Setting an Online Decompression Policy
Functions
Sets the policy for decompressing ZIP files in a bucket. This 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 /?obscompresspolicy HTTP/1.1 Host: bucketname.obs.cn-north-4.myhuaweicloud.com Authorization: authorization Content-Type: application/json Content-Length: length Date: date policy json body
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: from 1 to 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 ID of a back-to-source rule configured for the current bucket. Type: string Value range: 1 to 256. The value must be within the range of ^[a-zA-Z0-9_-]{1, 256}$. |
Yes |
|
project |
Project ID. Type: string |
Yes |
|
agency |
Agency name. With an agency, the customer can grant OBS the permissions to query whether a specified object exists in the bucket and upload objects to the bucket. Type: string |
No |
|
events |
Trigger event type. Type: list Supported event types: ["ObjectCreated:*"] ["ObjectCreated:PUT"] ["ObjectCreated:Post"] ["ObjectCreated:Copy"] ["ObjectCreated:CompleteMultipartUpload"] |
Yes |
|
prefix |
Rule prefix. Type: string Value range: [0, 1023] |
No |
|
suffix |
Rule suffix. Type: string Fixed value: .zip |
Yes |
|
overwrite |
Method of processing the unzipped file if it has the same name as an existing file. Type: positive integer 0: Skip without overwriting; 1: Do not overwrite (rename the file with the CRC32 value); 2: Overwrite the existing file. |
Yes |
|
decompresspath |
Path for storing decompressed files. This parameter must end with a slash (/) if it is not empty. Type: string Value range: [0, 800] |
No |
|
policytype |
Type of the decompression policy. Type: string Fixed value: decompress |
Yes |
The total length of the decompression policy name, decompression path, and IAM agency name cannot exceed 800 characters.
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 involves no elements.
Error Responses
No special error responses are returned. For details about error responses, see Table 2 and Table 3.
Sample Request
PUT /?obscompresspolicy HTTP/1.1
Host: bucketname.obs.cn-north-4.myhuaweicloud.com
Authorization: OBS H4IPJX0TQTHTHEBQQCEC:sc2PM13Wlfcoc/YZLK0MwsI2Zpo=
Content-Type: application/json
Content-Length: 497
Date: Tue, 21 Jul 2020 15:38:30 GMT
{
"rules": [{
"id": "ruleid",
"project": "your project id",
"agency": "testagency",
"events": ["ObjectCreated:*"],
"prefix": "decompress",
"suffix": ".zip",
"overwrite": 0,
"decompresspath": "after-decompress/"
}]
}
Sample Response
HTTP/1.1 201 Created Server: OBS Date: Tue, 07 Jul 2020 07:29:13 GMT Content-Length: 0
Last Article: Deleting Mirroring Back-to-Source Rules
Next Article: Obtaining an Online Decompression Policy
Did this article solve your problem?
Thank you for your score!Your feedback would help us improve the website.