All Products
Search
Document Center

Container Service for Kubernetes:GrantPermissions

Last Updated:Feb 29, 2024

You can call the GrantPermissions operation to grant a Resource Access Management (RAM) user the permissions to manage Container Service for Kubernetes (ACK) clusters.

Operation description


  • Make sure that you have granted the RAM user at least read-only permissions on the desired ACK clusters in the RAM console. Otherwise, the ErrorRamPolicyConfig error code is returned. For more information about how to authorize a RAM user by attaching RAM policies, see Create a custom RAM policy.
  • If you use a RAM user to call this API operation, make sure that the RAM user is authorized to modify the permissions of other RAM users on the desired ACK clusters. Otherwise, the StatusForbidden or ForbiddenGrantPermissions error code is returned. For more information, see Use a RAM user to grant RBAC permissions to other RAM users.
  • This operation overwrites the permissions that have been granted to the specified RAM user. When you call this operation, make sure that the required permissions are included.

Debugging

OpenAPI Explorer automatically calculates the signature value. For your convenience, we recommend that you call this operation in OpenAPI Explorer.

Authorization information

The following table shows the authorization information corresponding to the API. The authorization information can be used in the Action policy element to grant a RAM user or RAM role the permissions to call this API operation. Description:

  • Operation: the value that you can use in the Action element to specify the operation on a resource.
  • Access level: the access level of each operation. The levels are read, write, and list.
  • Resource type: the type of the resource on which you can authorize the RAM user or the RAM role to perform the operation. Take note of the following items:
    • The required resource types are displayed in bold characters.
    • If the permissions cannot be granted at the resource level, All Resources is used in the Resource type column of the operation.
  • Condition Key: the condition key that is defined by the cloud service.
  • Associated operation: other operations that the RAM user or the RAM role must have permissions to perform to complete the operation. To complete the operation, the RAM user or the RAM role must have the permissions to perform the associated operations.
OperationAccess levelResource typeCondition keyAssociated operation
cs:GrantPermissionWrite
  • All Resources
    *
    none
none

Request syntax

POST /permissions/users/{uid}

Request parameters

ParameterTypeRequiredDescriptionExample
uidstringYes

The ID of the RAM user.

2367****
bodyobject []No

The request body.

clusterstringYes

The ID of the cluster that you want to manage.

  • When the role_type parameter is set to all-clusters, this parameter is set to an empty string.
c796c60***
is_custombooleanNo

Specifies whether to perform a custom authorization. To perform a custom authorization, set role_name to a custom cluster role.

false
role_namestringYes

The predefined role name. Valid values:

  • admin: administrator
  • ops: O&M engineer
  • dev: developer
  • restricted: restricted user
  • The custom cluster role.
ops
role_typestringYes

The authorization type. Valid values:

  • cluster: indicates that the permissions are scoped to a cluster.
  • namespace: specifies that the permissions are scoped to a namespace of a cluster.
  • all-clusters: specifies that the permissions are scoped to all clusters.
cluster
namespacestringNo

The namespace to which the permissions are scoped. This parameter is required only if you set role_type to namespace.

test
is_ram_rolebooleanNo

Specifies whether the permissions are granted to a RAM role.

false

Response parameters

ParameterTypeDescriptionExample
The current API has no return parameters

Examples

Sample success responses

JSONformat

{}

Error codes

For a list of error codes, visit the Service error codes.

Change history

Change timeSummary of changesOperation
2024-01-09The internal configuration of the API is changed, but the call is not affectedsee changesets
Change itemChange content
The internal configuration of the API is changed, but the call is not affected.