Function
This topic describes the roles granted to a user.
Call specification
Interface constraints
You must authenticate your account by using OCP.
You must have the permissions to modify a tenant.
Request URL
POST /api/v2/ob/clusters/{id}/tenants/{tenantId}/users/{username}/grantRole
Request parameters
Path parameters:
Parameter |
Type |
Required |
Example value |
Description |
|---|---|---|---|---|
| id | Integer | Yes | 1 | Cluster ID. |
| tenantId | Integer | Yes | 5 | Tenant ID. |
| username | String | Yes | root | Username. |
Body parameters:
Parameter |
Type |
Required |
Example value |
Description |
|---|---|---|---|---|
| roles | StringArray | Yes | [R1, R2] | The list of roles to grant. |
Response
Parameter |
Type |
Description |
|---|---|---|
| successful | Boolean | Indicates whether the request is successful. |
| timestamp | Datetime | The timestamp when the server completed the request. |
| duration | Integer | The time taken by the server to process the request (in ms). |
| status | Integer | The HTTP status code that conforms to the HTTP status specification. |
| traceId | String | The Trace ID of the request for troubleshooting. |
| server | String | The IP address of the application service that responds to the request. |
Examples
Sample request
Grant the CONNECT role to the user named USER1 in the cluster with ID 1 and the tenant with ID 1000001.
POST /api/v2/ob/clusters/1/tenants/2000001/users/USER1/grantRole?id=1&tenantId=2000001&username=USER1
{
"roles": [
"CONNECT"
]
}
Sample response
{
"duration": 201,
"server": "a83ad33525",
"status": 200,
"successful": true,
"timestamp": "2021-09-07T15:30:41.205+08:00",
"traceId": "f4783564b21746db"
}
