UpdateTopicAttribute
Modify the topic attributes.
PUT /v2/{project_id}/notifications/topics/{topic_urn}/attributes/{name}
Parameter |
Mandatory |
Type |
Description |
---|---|---|---|
project_id |
Yes |
String |
Project ID |
topic_urn |
Yes |
String |
Unique resource ID of a topic. You can obtain it according to Querying Topics. |
name |
Yes |
String |
Attribute name Only specified attribute names are supported. For details, see Topic Attribute List. |
Parameter |
Mandatory |
Type |
Description |
---|---|---|---|
value |
Yes |
String |
Topic attribute value The value cannot exceed 30 KB. For details, see Table 1. |
Name |
Description |
Restriction |
---|---|---|
Version |
Policy specification version |
Currently, only 2016-09-07 is supported. |
Id |
Policy ID, which uniquely identifies a policy |
The value cannot be empty. |
Statement |
Statements used to configure a topic policy. Each topic policy may contain one or more statements. You can use statements to grant topic permissions to other users or cloud services. |
A policy must contain at least one statement. For details about elements in a statement, see Table 2. |
Element |
Description |
Restriction |
---|---|---|
Sid |
Statement ID |
The statement ID must be unique, for example, statement01 or statement02. |
Effect |
Statement effect |
The value can be Allow or Deny. |
Principal NotPrincipal |
|
Either the Principal or NotPrincipal element must be configured.
|
Action NotAction |
|
Either the Action or NotAction element must be configured. The following actions are supported:
|
Resource NotResource |
|
Either the Resource or NotResource element must be configured. You need to enter a topic URN. |
PUT https://{SMN_Endpoint}/v2/{project_id}/notifications/topics/{topic_urn}/attributes/access_policy
{ "value": "{ \"Version\": \"2016-09-07\", \"Id\": \"__default_policy_ID\", \"Statement\": [ { \"Sid\": \"__user_pub_0\", \"Effect\": \"Allow\", \"Principal\": { \"CSP\": [ \"urn:csp:iam::{domainID}:root\" ] }, \"Action\": [\"SMN:Publish\",\"SMN:QueryTopicDetail\"], \"Resource\": \"{topic_urn}\" }, { \"Sid\": \"__service_pub_0\", \"Effect\": \"Allow\", \"Principal\": { \"Service\": [\"obs\"] }, \"Action\": [\"SMN:Publish\",\"SMN:QueryTopicDetail\"], \"Resource\": \"{topic_urn}\" } ] }" }
You need to replace {project_id}, {domainID}, and {topic_urn} with the actual values.
domainID indicates the user's domain ID. To obtain it, log in to the SMN console, click My Credential in the username drop-down list on the upper right.
Parameter |
Type |
Description |
---|---|---|
request_id |
String |
Request ID, which is unique |
{ "request_id":"6837531fd3f54550927b930180a706bf" }
See Returned Value.
See Error Code.