Setting an Online Decompression Policy
Functions
OBS can automatically decompress uploaded ZIP packages and save them to a specified directory. If any ZIP package uploaded to a bucket matches the configured decompression policy, the package will be automatically decompressed to the specified directory. You can call this API to configure a decompression policy for ZIP files in a bucket. For more information about online decompression, see Online Decompression.
Constraints
Permissions
- To configure, obtain, or delete online decompression policies, you must have the Tenant Administrator permission assigned by using role/policy-based authorization of IAM.
- Online decompression requires that you create an IAM agency to delegate OBS to access data in the bucket. The permissions the agency should assign to OBS include obs:object:PutObject, obs:object:GetObject, and obs:object:AbortMultipartUpload.
Package and file size
- A single ZIP package cannot exceed 1 GB in size.
- A single ZIP package can contain a maximum of 65,536 files.
- A single decompressed file cannot exceed 40 GB in size.
Time
- Decompressing a ZIP package takes 10 minutes at most.
Functions
- Currently, only ZIP packages are supported.
- ZIP package names cannot contain Chinese punctuation marks, special characters, or special codes.
- To decompress the ZIP package that contains other ZIP packages, the event type of the online decompression policy must be set to ObjectCreated:* or ObjectCreated:CompleteMultipartUpload.
- Currently, no notification will be sent to users after decompression tasks are complete.
- Currently, only deflate-compressed ZIP packages can be decompressed. Deflate is different from the compression algorithms (such as Store and Normal) provided by WinRAR.
- The total length of the decompression path plus the name of any decompressed file cannot exceed 512 characters.
- Currently, encrypted ZIP packages cannot be decompressed.
- Federated users cannot use the online decompression function. For more information about federated users, see What Are the Relationships Between a Huawei Cloud Account, HUAWEI ID, IAM User, and Federated User? and Identity Providers.
Request Syntax
PUT /?obscompresspolicy HTTP/1.1 Host: bucketname.obs.region.myhuaweicloud.com Authorization: authorization Content-Type: application/json Content-Length: length Date: date policy json body
URI Parameters
This request contains no message parameters.
Request Headers
This request uses common headers. For details, see Table 3.
Request Body
| Parameter | Description | Mandatory |
|---|---|---|
| rules | Number of rules. Type: container 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 | Name of a decompression policy. It is the unique ID of the decompression policy configured for the current bucket. Type: string The value can contain 1 to 256 characters, matching the regular expression of ^[a-zA-Z0-9_-]{1, 256}$. It consists of only uppercase letters, lowercase letters, digits, underscores (_), and hyphens (-), for example, event_0001. | 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 | Yes |
| events | Trigger event type. Type: string Supported event types: ["ObjectCreated:*"] ["ObjectCreated:Put"] ["ObjectCreated:Post"] ["ObjectCreated:Copy"] ["ObjectCreated:CompleteMultipartUpload"] | Yes |
| prefix | Rule prefix. Type: string 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: 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. If the value is not empty, it must end with a slash (/) but cannot start with a slash (/). Type: string 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
This response uses common headers. For details, see Table 1.
Response Body
This response contains 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.region.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/",
"policytype": "decompress"
}]
} Sample Response
HTTP/1.1 201 Created Server: OBS Date: Tue, 07 Jul 2020 07:29:13 GMT Content-Length: 0
References
- For more information about online decompression, see Online Decompression.
- For details about the billing items involved in API operations, see Billing Items.
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