OBS uses the GET method to obtain a specific inventory of a bucket.
To perform this operation, you must have the GetBucketInventoryConfiguration permission. By default, the bucket owner has this permission and can grant it to others.
GET /?inventory&id=configuration-id HTTP/1.1 User-Agent: curl/7.29.0 Host: bucketname.obs.region.example.com Accept: */* Date: date Authorization: authorization string
Parameter |
Description |
Mandatory |
---|---|---|
id |
ID of the inventory configuration that you want to obtain. Type: string Specifications: A maximum of 64 characters There is no default value. Valid characters: letters, digits, hyphens (-), periods (.) and underscores (_) |
Yes |
This request uses common headers. For details, see Table 3.
This request involves no elements.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 | HTTP/1.1 status_code Server: OBS x-obs-request-id: request id x-obs-id-2: id Content-Type: application/xml Date: date Content-Length: length <?xml version="1.0" encoding="UTF-8" standalone="yes"?> <InventoryConfiguration xmlns="http://obs.region.example.com/doc/2015-06-30/"> <Id>configuration-id</Id> <IsEnabled>true</IsEnabled> <Filter> <Prefix>inventoryTestPrefix</Prefix> </Filter> <Destination> <Format>CSV</Format> <Bucket>destbucket</Bucket> <Prefix>prefix</Prefix> </Destination> <Schedule> <Frequency>Daily</Frequency> </Schedule> <IncludedObjectVersions>Current</IncludedObjectVersions> <OptionalFields> <Field>Size</Field> <Field>LastModifiedDate</Field> <Field>ETag</Field> <Field>StorageClass</Field> <Field>IsMultipartUploaded</Field> <Field>ReplicationStatus</Field> <Field>EncryptionStatus</Field> </OptionalFields> </InventoryConfiguration> |
The response to the request uses common headers. For details, see Table 1.
Table 2 lists elements contained in the response body.
Element |
Description |
---|---|
InventoryConfiguration |
Inventory configuration. Type: container Parent: none Child: Id, IsEnabled, Filter, Destination, Schedule, IncludedObjectVersions, and OptionalFields |
Id |
ID of an inventory configuration, which must be consistent with the inventory configuration ID specified in the request. Type: string Specifications: A maximum of 64 characters There is no default value. Valid characters: letters, digits, hyphens (-), periods (.) and underscores (_) Parent: InventoryConfiguration |
IsEnabled |
Indicates whether the rule is enabled. If this parameter is set to true, the inventory is generated. If not, the inventory will not be generated. Type: boolean Value options: true, false Parent: InventoryConfiguration |
Filter |
Inventory filter configuration. The inventory contains only objects that meet the filter criteria (filtering by object name prefix). If no filter criteria is configured, all objects are included. Type: container Parent: InventoryConfiguration Child: Prefix |
Prefix |
Filtering by name prefix. Only objects with the specified name prefix are included in the inventory. Type: string Parent: Filter |
Schedule |
Time scheduled for generation of inventories. Type: container Parent: InventoryConfiguration Child: Frequency |
Frequency |
Intervals when inventories are generated. You can set this parameter to Daily or Weekly. An inventory is generated within one hour after it is configured for the first time. Then it is generated at the specified intervals. Type: string Parent: Schedule Value options: Daily, Weekly |
Destination |
Destination bucket of an inventory. Type: container Parent: InventoryConfiguration |
Format |
Inventory format. Only the CSV format is supported. Type: string Parent: Destination Value options: CSV |
Bucket |
Name of the bucket for saving inventories. Type: string Parent: Destination |
Prefix |
The name prefix of inventory files. If no prefix is configured, the names of inventory files will start with the BucketInventory by default. Type: string Parent: Destination |
IncludedObjectVersions |
Indicates whether versions of objects are included in an inventory.
Type: string Parent: InventoryConfiguration Value options: All, Current |
OptionalFields |
Extra metadata fields that can be added to an inventory. If this parameter is configured, fields specified in this parameter are contained in the inventory. Type: container Parent: InventoryConfiguration Child: Field |
Field |
Optional fields. The OptionalFields can contain multiple field elements. Type: string Parent: OptionalFields Value options: Size, LastModifiedDate, StorageClass, ETag, IsMultipartUploaded, ReplicationStatus, EncryptionStatus |
In addition to common error codes, this API also returns other error codes. The following table lists common errors and possible causes. For details, see Table 3.
GET /?inventory&id=id1 HTTP/1.1 User-Agent: curl/7.29.0 Host: examplebucket.obs.region.example.com Accept: */* Date: Tue, 08 Jan 2019 09:32:24 +0000 Authorization: OBS UDSIAMSTUBTEST000001:ySWncC9M08jNsyXdJLSMJkpi7XM=
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 | HTTP/1.1 200 OK Server: OBS x-obs-request-id: 000001682CB4C2EE6808A0D8DF9F3D00 x-obs-id-2: 32AAAQAAEAABAAAQAAEAABAAAQAAEAABCSBjn5O7Jv9CqvUMO0BenehRdil1n8rR Content-Type: application/xml Date: Tue, 08 Jan 2019 09:04:30 GMT Content-Length: 626 <?xml version="1.0" encoding="UTF-8" standalone="yes"?> <InventoryConfiguration xmlns="http://obs.region.example.com/doc/2015-06-30/"> <Id>id1</Id> <IsEnabled>true</IsEnabled> <Destination> <Format>CSV</Format> <Bucket>bucket</Bucket> <Prefix>prefix</Prefix> </Destination> <Schedule> <Frequency>Daily</Frequency> </Schedule> <IncludedObjectVersions>Current</IncludedObjectVersions> <OptionalFields> <Field>Size</Field> <Field>LastModifiedDate</Field> <Field>ETag</Field> <Field>StorageClass</Field> <Field>IsMultipartUploaded</Field> <Field>ReplicationStatus</Field> <Field>EncryptionStatus</Field> </OptionalFields> </InventoryConfiguration> |