RBAC Related Interfaces
Authorization
Description
Grant the cluster RBAC permissions to specified users
Request structure
1POST /v2/rbac HTTP/1.1
2Host: cce.bj.baidubce.com
3Authorization: authorization string
Request headers
There are no special headers required beyond the common headers.
Request parameters
| Parameter name | Types | Required or not | Parameter location | Description |
|---|---|---|---|---|
| clusterID | String | Yes | RequestBody | Cluster IDs to be authorized. Special value all, indicating authorization for all existing clusters. |
| userID | String | Yes | RequestBody | Authorized user IDs. |
| namespace | String | No | RequestBody | Namespace to be authorized. Only valid when clusterID is not null or all. Special values all and "", indicating authorization for all namespaces. |
| role | String | Yes | RequestBody | Authorized RBAC role, options:
|
Response headers
No special headers are required beyond the standard ones.
Response parameters
| Parameter name | Types | Required or not | Description |
|---|---|---|---|
| data | List |
Yes | Authorization result of each cluster |
| requestID | String | Yes | Request ID. This ID is provided for issue localization. |
CreateRBACMessage
| Parameter name | Types | Required or not | Description |
|---|---|---|---|
| success | Boolean | Yes | Succeeded or not |
| clusterID | String | Yes | Cluster ID |
| message | String | No | Prompt message upon failure |
Request example: Authorize all existing clusters
clusterIDis set toall- There is no need to set the
namespaceparameter - Set other parameters as needed by referring to the API documentation
1POST /v2/rbac HTTP/1.1
2Host: cce.bj.baidubce.com
3Authorization: bce-auth-v1/f81d3b34e48048fbb2634dc7882d7e21/2019-03-11T04:17:29Z/3600/host/74c506f68c65e26c633bfa104c863fffac5190fdec1ec24b7c03eb5d67d2e1de
4{
5 "clusterID": "all",
6 "userID": "60a039xxxxxxxxxxxxxxxx",
7 "role": "cce:readonly"
8}
Request example: Authorize all namespaces of a specified cluster
clusterIDis set to the specified cluster IDnamespaceis set toall- Set other parameters as needed by referring to the API documentation
1POST /v2/rbac HTTP/1.1
2Host: cce.bj.baidubce.com
3Authorization: bce-auth-v1/f81d3b34e48048fbb2634dc7882d7e21/2019-03-11T04:17:29Z/3600/host/74c506f68c65e26c633bfa104c863fffac5190fdec1ec24b7c03eb5d67d2e1de
4{
5 "clusterID": "cce-xxxxxxx",
6 "userID": "60a039xxxxxxxxxxxxxxxx",
7 "namespace": "all",
8 "role": "cce:devops"
9}
Request example: Authorize specified namespaces of a specified cluster
clusterIDis set to the specified cluster IDnamespaceis set to the specified namespace- Set other parameters as needed by referring to the API documentation
1POST /v2/rbac HTTP/1.1
2Host: cce.bj.baidubce.com
3Authorization: bce-auth-v1/f81d3b34e48048fbb2634dc7882d7e21/2019-03-11T04:17:29Z/3600/host/74c506f68c65e26c633bfa104c863fffac5190fdec1ec24b7c03eb5d67d2e1de
4{
5 "clusterID": "cce-xxxxxxx",
6 "userID": "60a039xxxxxxxxxxxxxxxx",
7 "namespace": "default",
8 "role": "cce:admin"
9}
Response example
1HTTP/1.1 200 OK
2X-Bce-Request-Id: d2ce8f50-529a-4663-9265-ad08c94633c8
3Date: Thu, 16 Mar 2020 06:29:48 GMT
4Content-Type: application/json;charset=UTF-8
5{
6 "requestID": "d2ce8f50-529a-4663-9265-ad08c94633c8",
7 "data": [
8 {
9 "success": true,
10 "clusterID": "cce-6m8tij7z"
11 }
12 ]
13}
RBAC List
Description
Query the user's RBAC list
Request structure
1GET /v2/rbac HTTP/1.1
2Host: cce.bj.baidubce.com
3Authorization: bce-auth-v1/f81d3b34e48048fbb2634dc7882d7e21/2019-03-11T04:17:29Z/3600/host/74c506f68c65e26c633bfa104c863fffac5190fdec1ec24b7c03eb5d67d2e1de
Request headers
There are no special headers required beyond the common headers.
Request parameters
| Parameter name | Types | Required or not | Parameter location | Description |
|---|---|---|---|---|
| userID | String | Yes | Query | User ID |
Response headers
No special headers are required beyond the standard ones.
Response parameters
| Parameter name | Types | Description | Description |
|---|---|---|---|
| data | List |
Yes | RBAC query results |
| requestID | String | Yes | Request ID. This ID is provided for issue localization. |
GetRBACMessage
| Parameter name | Types | Required or not | Description |
|---|---|---|---|
| role | String | Yes | RBAC role |
| clusterID | String | Yes | Cluster ID |
| namespace | String | Yes | Namespace, special value: all |
| clusterName | String | No | Cluster name |
Request example
1GET /v2/rbac?userID=60a039xxxxxxxxxxxxxxxx HTTP/1.1
2Host: cce.bj.baidubce.com
3Authorization: bce-auth-v1/f81d3b34e48048fbb2634dc7882d7e21/2019-03-11T04:17:29Z/3600/host/74c506f68c65e26c633bfa104c863fffac5190fdec1ec24b7c03eb5d67d2e1de
Response example
1HTTP/1.1 200 OK
2X-Bce-Request-Id: 97342dc7-29a1-4ed9-a75d-904bb293d295
3Date: Thu, 16 Mar 2020 06:29:48 GMT
4Content-Type: application/json;charset=UTF-8
5{
6 "requestID": "97342dc7-29a1-4ed9-a75d-904bb293d295",
7 "data": [{
8 "role": "cce:readonly",
9 "clusterID": "cce-aaaaaa",
10 "namespace": "all",
11 "clusterName": "test-resource"
12 },
13 {
14 "role": "cce:readonly",
15 "clusterID": "cce-bbbbbb",
16 "namespace": "test-ns",
17 "clusterName": "test04"
18 }
19 ]
20}
Delete RBAC permission
Description
Delete user’s RBAC permissions
Request structure
1DELETE /v2/rbac HTTP/1.1
2Host: cce.bj.baidubce.com
3Authorization: authorization string
Request headers
There are no special headers required beyond the common headers.
Request parameters
| Parameter name | Types | Required or not | Parameter location | Description |
|---|---|---|---|---|
| clusterID | String | Yes | RequestBody | Cluster ID, a specific cluster ID, rather than all. |
| userID | String | Yes | RequestBody | User ID |
| namespace | String | Yes | RequestBody | Namespace, consistent with the authorized one. If authorized as all, it must be all. |
Response headers
No special headers are required beyond the standard ones.
Response parameters
| Parameter name | Types | Required or not | Description |
|---|---|---|---|
| requestID | String | Yes | Request ID. This ID is provided for issue localization. |
Request example
1DELETE /v2/rbac HTTP/1.1
2Host: cce.bj.baidubce.com
3Authorization: bce-auth-v1/f81d3b34e48048fbb2634dc7882d7e21/2019-03-11T04:17:29Z/3600/host/74c506f68c65e26c633bfa104c863fffac5190fdec1ec24b7c03eb5d67d2e1de
4{
5 "clusterID": "cce-xxxxxxx",
6 "userID": "60a039xxxxxxxxxxxxxxxx",
7 "namespace": "default"
8}
Response example
1HTTP/1.1 200 OK
2X-Bce-Request-Id: 928a21b5-d117-4a83-a274-fd7d6f413524
3Date: Thu, 16 Mar 2020 06:29:48 GMT
4Content-Type: application/json;charset=UTF-8
5{
6 "requestID": "928a21b5-d117-4a83-a274-fd7d6f413524"
7}
Reset RBAC Kubeconfig
Description
Revoke the user's existing RBAC Kubeconfig and generate a new one. Note: Once this action is completed, the old RBAC Kubeconfig will no longer be valid.
Request structure
1PUT /v2/rbac HTTP/1.1
2Host: cce.bj.baidubce.com
3Authorization: authorization string
Request headers
There are no special headers required beyond the common headers.
Request parameters
| Parameter name | Types | Required or not | Parameter location | Description |
|---|---|---|---|---|
| clusterID | String | Yes | RequestBody | Cluster ID, a specific cluster ID, rather than all. |
| userID | String | No | RequestBody | User ID. If left blank, it indicates the current user. |
| namespace | String | Yes | RequestBody | Namespace, consistent with the authorized one. If authorized as all, it must be all. |
| role | String | Yes | RequestBody | Roles aligned with the authorized one. |
Response headers
No special headers are required beyond the standard ones.
Response parameters
| Parameter name | Types | Required or not | Description |
|---|---|---|---|
| requestID | String | Yes | Request ID. This ID is provided for issue localization. |
Request example
1PUT /v2/rbac HTTP/1.1
2Host: cce.bj.baidubce.com
3Authorization: bce-auth-v1/f81d3b34e48048fbb2634dc7882d7e21/2019-03-11T04:17:29Z/3600/host/74c506f68c65e26c633bfa104c863fffac5190fdec1ec24b7c03eb5d67d2e1de
Response example
1HTTP/1.1 200 OK
2X-Bce-Request-Id: 105ce04b-1a42-4f77-9d22-ab6f413f9d69
3Date: Thu, 16 Mar 2020 06:29:48 GMT
4Content-Type: application/json;charset=UTF-8
5{
6 "requestID": "105ce04b-1a42-4f77-9d22-ab6f413f9d69"
7}
Apply for temporary access credentials
Description
Request temporary credentials for specified cluster, and specify credential validity period
Request structure
1POST /v2/rbac HTTP/1.1
2Host: cce.bj.baidubce.com
3Authorization: authorization string
Request headers
There are no special headers required beyond the common headers.
Request parameters
| Parameter name | Types | Required or not | Parameter location | Description |
|---|---|---|---|---|
| clusterID | String | Yes | RequestBody | Cluster IDs to be authorized. Special value all, indicating authorization for all existing clusters. |
| temp | Boolean | Yes | RequestBody | It must be true, indicating it is necessary to apply for temporary access credentials. |
| expireHours | Integer | Yes | RequestBody | Temporary credential validity period, in hours |
| kubeConfigType | String | Yes | RequestBody | Type of temporary credential, values:
|
Response headers
No special headers are required beyond the standard ones.
Response parameters
| Parameter name | Types | Required or not | Description |
|---|---|---|---|
| temporaryKubeConfig | String | Yes | Temporary credential Kubeconfig |
| requestID | String | Yes | Request ID. This ID is provided for issue localization. |
Request example: Apply for 7-day VPC temporary access credentials
1POST /v2/rbac HTTP/1.1
2Host: cce.bj.baidubce.com
3Authorization: bce-auth-v1/f81d3b34e48048fbb2634dc7882d7e21/2019-03-11T04:17:29Z/3600/host/74c506f68c65e26c633bfa104c863fffac5190fdec1ec24b7c03eb5d67d2e1de
4{
5 "clusterID": "cce-xxxx",
6 "temp": true,
7 "expireHours": 168,
8 "kubeConfigType": "vpc"
9}
Response example
1HTTP/1.1 200 OK
2X-Bce-Request-Id: d2ce8f50-529a-4663-9265-ad08c94633c8
3Date: Thu, 16 Mar 2020 06:29:48 GMT
4Content-Type: application/json;charset=UTF-8
5{
6 "requestID": "d2ce8f50-529a-4663-9265-ad08c94633c8",
7 "temporaryKubeConfig": "apiVersion: v1\nclusters:\n- cluster:\n certificate-authority-data: xxxx......"
8}
