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.
Calling Method
For details, see Calling APIs.
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: 200
|
Parameter |
Type |
Description |
|---|---|---|
|
job_id |
String |
Definition Background task ID. Range N/A |
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
Status code: 200
User permission setting task submitted successfully.
{
"job_id" : "8a2c259182ab0e9d0182ab1882560010"
}
Status Codes
|
Status Code |
Description |
|---|---|
|
200 |
User permission setting task submitted successfully. |
|
400 |
Invalid parameters. |
|
403 |
Authentication failed. |
Error Codes
See Error Codes.
Feedback
Was this page helpful?
Provide feedbackThank you very much for your feedback. We will continue working to improve the documentation.