Granting User Permissions
Function
This API is used to grant user permissions.
User management is supported only when SASL is enabled for the Kafka instance.
URI
POST /v1/{project_id}/instances/{instance_id}/topics/accesspolicy
Parameter | Mandatory | Type | Description |
---|---|---|---|
project_id | Yes | String | Project ID. For details about how to obtain it, see Obtaining a Project ID. |
instance_id | Yes | String | Instance ID. |
Request Parameters
Parameter | Mandatory | Type | Description |
---|---|---|---|
topics | Yes | Array of AccessPolicyTopicEntity objects | Topic list. |
Parameter | Mandatory | Type | Description |
---|---|---|---|
name | Yes | String | Topic name. |
policies | Yes | Array of AccessPolicyEntity objects | Permission list. |
Parameter | Mandatory | Type | Description |
---|---|---|---|
user_name | No | String | Username. This parameter is mandatory when you set user permissions. |
access_policy | No | String | Permission type.
This parameter is mandatory when you set user permissions. |
Response Parameters
Status code: 400
Parameter | Type | Description |
---|---|---|
error_code | String | Error code. |
error_msg | String | Error description. |
Status code: 403
Parameter | Type | Description |
---|---|---|
error_code | String | Error code. |
error_msg | String | Error description. |
Example Requests
Granting the root user the permission to publish and subscribe to topic-test
POST https://{endpoint}/v1/{project_id}/instances/{instance_id}/topics/accesspolicy{"topics" : [ {"name" : "topic-test","policies" : [ {"user_name" : "root","access_policy" : "all"} ]} ]}
Example Responses
None
Status Codes
Status Code | Description |
---|---|
204 | The update is successful. |
400 | Invalid parameters. |
403 | Authentication failed. |
Error Codes
See Error Codes.
- URI