Configuring a DIS-Enabled Notification Policy
Functions
Configures a DIS-enabled notification policy for a specified bucket. The API is idempotent. If the same rule already exists in the bucket, a success message is returned with the status code of 200. Otherwise, status code 201 is returned.
Request Syntax
PUT /?disPolicy HTTP/1.1 Host: bucketname.obs.region.example.com Authorization: authorization Content-Type: application/json Content-Length: length Date: date Body: { "rules": [{ "id":"rule_id", "stream": "stream_name", "project": "project_id", "events": ["ObjectCreated:*", "ObjectRemoved:*"], "prefix": "", "suffix": "", "agency": "agency_name" }] }
Request parameters
This request contains no message parameters.
Request Headers
This request uses common headers. For details, see Table 3.
Request Elements
Parameter |
Description |
Mandatory |
---|---|---|
rules |
Number of rules. Type: container Value range: [1, 10]
NOTE:
For the same bucket, prefixes of different rules cannot contain each other or have duplicate beginning characters. The same agency is recommended. |
Yes |
Parameter |
Description |
Mandatory |
---|---|---|
id |
Rule ID. Unique identifier of the DIS policy rule configured for the bucket. Type: string Value range: 1 to 256. The value must be within the range of ^[a-zA-Z0-9_-]{1, 256}$. |
Yes |
stream |
DIS stream name. You need to create a DIS stream first. Type: string |
Yes |
project |
ID of the project to which the DIS stream belongs. Type: string |
Yes |
events |
OBS event list. Type: string Valid value: a string of 0 to 1023 characters. The value can contain any characters. The following event types are supported:
|
Yes |
prefix |
Object name prefix, key word of object names. Based on the prefix defined by this parameter, enter the key word for filtering objects. A longer string of characters delivers a more accurate filtering result. A maximum of 1024 characters are supported. It also can be empty. In addition, the total length of the prefix and suffix cannot exceed 1024 characters. Type: string Value range: [0, 1024] |
No |
suffix |
Object name suffix. Key word of object names. Based on the suffix defined by this parameter, enter the key word for filtering objects. A longer string of characters delivers a more accurate filtering result. A maximum of 1024 characters are supported. It also can be empty. In addition, the total length of the prefix and suffix cannot exceed 1024 characters. Type: string Value range: [0, 1024] |
No |
agency |
IAM agency name. The delegated party must contain OBS and be granted with the DIS Administrator or DIS User permission. Type: string |
Yes |
Response Syntax
HTTP/1.1 status Server: OBS Date: date Content-Length: length
Response Headers
The response to the request uses common headers. For details, see Table 1.
Response Elements
This response contains no elements.
Error Responses
No special error responses are returned. For details about error responses, see Table 2.
Sample Request
PUT /?disPolicy HTTP/1.1 Host: bucketname.obs.region.example.com Authorization: OBS H4IPJX0TQTHTHEBQQCEC:sc2PM13Wlfcoc/YZLK0MwsI2Zpo= Content-Type: application/json Content-Length: 1049 Date: Tue, 21 Jul 2020 15:38:30 GMT { "rules": [{ "id":"event-01", "stream": "stream_name", "project": "project_id", "events": ["ObjectCreated:*", "ObjectRemoved:*"], "prefix": "", "suffix": "", "agency": "dis_agency" }] }
Sample Response
HTTP/1.1 201 Created Server: OBS Date: Tue, 07 Jul 2020 07:29:13 GMT Content-Length: 0
Feedback
Was this page helpful?
Provide feedbackThank you very much for your feedback. We will continue working to improve the documentation.See the reply and handling status in My Cloud VOC.
For any further questions, feel free to contact us through the chatbot.
Chatbot