PutBucketInventory
Last Updated:2021-12-08
Interface Description
PutBucketInventory is used to create an inventory task in the source bucket. You can use this request to create an inventory task after you name the inventory task.
BOS recommends that the user creates a lifecycle policy to delete the old inventory list file.
Notes:
- The user must be the source bucket owner with the FULL_CONTROL permission and the destination bucket owner.
- The target bucket and source bucket must exist. The target bucket and source bucket must be of the bucket under the same account and region. The cross-account output is not supported.
- BOS supports creating up to 20 inventory tasks in each storage bucket.
- The inventory list achieves the final consistency of the new object and the overwritten PUT, and the final consistency of the DELETE operation. The inventory list is a rolling snapshot of the bucket. The contents are consistent finally. The inventory may not contain the objects added or deleted recently.
Request
-
Request syntax
PUT /?inventory&id=inventory-configuration-ID HTTP/1.1 Host: <BucketName>.bj.bcebos.com x-bce-date: date Content-Length: request-body length Content-Type: application/json; charset=utf-8 Authorization: AuthorizationString { "id": "inventory-configuration-ID", "status": "enabled", "resource": [ "bucket/prefix/*" ], "schedule": "Weekly", "destination": { "targetBucket": "destBucketName", "targetPrefix": "destination-prefix", "format": "CSV" } }
-
Request header field
None.
-
Request parameters
Name | Type | Description | Required? |
---|---|---|---|
id | string | Inventory rule name. Specification: Maximum length of 64 bytes. Valid characters: "a-z", "A-Z", "0-9", "-", "_" and ".". | Yes |
status | string | Identify whether the inventory is invalid. If it is set to "Enabled", the inventory feature takes effect. If it is set to "Disabled", no inventory is generated. | Yes |
resource | list | The sub-element is of string type. Effective prefix. The configuration form of resource is bucket_name/<Effective object prefix> , which must start with bucket_name/ . When it is effective for the entire bucket, bucket_name/* is used. |
Yes |
schedule | string | Inventory task cycle, ThreeDaily or Weekly optional. | Yes |
destination | object | Describe the information on the storage of inventory results. | Yes |
+targetBucket | string | Specify the bucket for storing the inventory file. | Yes |
+targetPrefix | string | Specify the prefix of inventory file saved finally. | No |
+format | string | File form of inventory analysis results, whose current supporting format is CSV. | Yes |
Response
Example
-
Request example
PUT /?inventory&id=inventory-configuration-ID HTTP/1.1 Host: <BucketName>.bj.bcebos.com x-bce-date: date Content-Length: request-body length Content-Type: application/json; charset=utf-8 Authorization: AuthorizationString { "id": "inventory-configuration-ID", "status": "enabled", "resource": [ "bucket/prefix/*" ], "schedule": "Weekly", "destination": { "targetBucket": "destBucketName", "targetPrefix": "destination-prefix", "format": "CSV" } }
-
Response example
HTTP/1.1 200 OK x-bce-request-id: 4db4b34d-653d-4d9a-b49b-3049ca786409 Date: Wed, 31 May 2018 08:34:40 GMT Server: BceBos