ListBucketInventory lists all inventory configurations for a bucket.
Usage notes
Calling the ListBucketInventory operation requires the oss:GetBucketInventory permission. For more information, see Grant custom permission policies to a RAM user.
A single request can retrieve a maximum of 100 inventory configurations. If a response is truncated, use the NextContinuationToken value from the response as the continuation-token in your next request to retrieve the next page of results.
Ensure you have permission to manage inventory configurations for the bucket. By default, only the bucket owner has this permission. If you are not the owner, request the necessary permission.
Request syntax
With continuation-token
GET /?inventory&continuation-token=xxx HTTP/1.1Without continuation-token
GET /?inventory HTTP/1.1
Response elements
Parameter | Type | Description |
InventoryConfiguration | container | A container for inventory configuration parameters. |
IsTruncated | Boolean | Indicates whether the list of inventory configurations is truncated. Valid values: true or false
|
NextContinuationToken | String | If the response is truncated (IsTruncated is true), use this token in the continuation-token parameter of your next request to get the next page of results. |
Id | String | The user-specified name for the inventory configuration. The name must be unique within the bucket. |
IsEnabled | Boolean | Specifies whether the inventory is enabled. Valid values: true or false
|
Filter | container | A container for the filter rules. The inventory includes only objects that match the filter. |
Prefix | String | The object prefix to use for filtering. Parent node: Filter |
Destination | container | A container for information about where to publish the inventory results. |
OSSBucketDestination | container | Contains details about the destination bucket where the inventory report is stored. Parent node: Destination |
Format | String | The file format of the exported inventory. Valid value: CSV Parent node: OSSBucketDestination |
AccountId | String | The ID of the account granted permission to write the inventory report to the destination bucket. Parent node: OSSBucketDestination |
RoleArn | String | The ARN of the role granted permission to write the inventory report to the destination bucket. Format: acs:ram::uid:role/rolename Parent node: OSSBucketDestination |
Bucket | String | The destination bucket for the inventory report. Parent node: OSSBucketDestination |
Prefix | String | The prefix within the destination bucket where the inventory report is stored. Parent node: OSSBucketDestination |
Encryption | container | The server-side encryption method for the inventory report. Valid values: SSE-OSS, SSE-KMS, or Null Parent node: OSSBucketDestination |
SSE-OSS | container | A container for SSE-OSS encryption. Parent node: Encryption |
SSE-KMS | container | A container for the key used for SSE-KMS encryption. Parent node: Encryption |
KeyId | String | The KMS key ID. Parent node: SSE-KMS |
Schedule | container | A container for the inventory export schedule. |
Frequency | String | The export frequency of the inventory. Valid values: Parent node: Schedule |
DayOfMonth | Integer | The day of the month on which to export the inventory when Parent node: Schedule |
AutoDelete | Boolean | Specifies whether to automatically delete the inventory configuration after exporting a one-time inventory. This element is valid only when Valid values: true, false Parent node: Schedule |
IncludedObjectVersions | String | Specifies which object versions to include in the inventory. Valid values:
|
OptionalFields | container | A container for the optional fields to include in the inventory. |
Field | container | The optional fields to include in the inventory. Optional fields include: Parent node: OptionalFields |
IncrementalInventory | container | A container for the incremental inventory configuration. |
IsEnabled | Boolean | Indicates whether to enable incremental inventory. Valid values:
If true, incremental inventory is enabled even if the parent IsEnabled is false. Parent node: IncrementalInventory |
Schedule | container | A container for the incremental inventory export schedule. Parent node: IncrementalInventory |
Frequency | Integer | The export frequency of the incremental inventory, in seconds. The system exports incremental inventories at a fixed interval of 600 seconds. In each interval, the system automatically creates a directory prefix and generates a manifest file and multiple CSV files. Custom frequencies are not supported. Parent node: Schedule |
OptionalFields | container | A container for the optional fields to include in the incremental inventory. Parent node: IncrementalInventory |
Field | String | The fields that are included in the incremental inventory. Parent node: OptionalFields
|
Examples
Sample request
GET /?inventory HTTP/1.1 Host: BucketName.oss.aliyuncs.com Date: Fri, 24 Feb 2012 03:55:00 GMT Authorization: authorization string Content-Type: text/plainSample response
HTTP/1.1 200 OK x-oss-request-id: 56594298207FB304438516F9 Date: Sat, 30 Apr 2016 23:29:37 GMT Content-Type: application/xml Content-Length: length Connection: close Server: AliyunOSS <?xml version="1.0" encoding="UTF-8"?> <ListInventoryConfigurationsResult> <InventoryConfiguration> <Id>report1</Id> <IsEnabled>true</IsEnabled> <Destination> <OSSBucketDestination> <Format>CSV</Format> <AccountId>1000000000000000</AccountId> <RoleArn>acs:ram::1000000000000000:role/AliyunOSSRole</RoleArn> <Bucket>acs:oss:::destination-bucket</Bucket> <Prefix>prefix1</Prefix> </OSSBucketDestination> </Destination> <Schedule> <Frequency>Daily</Frequency> </Schedule> <Filter> <Prefix>prefix/One</Prefix> </Filter> <IncludedObjectVersions>All</IncludedObjectVersions> <OptionalFields> <Field>Size</Field> <Field>LastModifiedDate</Field> <Field>ETag</Field> <Field>StorageClass</Field> <Field>IsMultipartUploaded</Field> <Field>EncryptionStatus</Field> </OptionalFields> </InventoryConfiguration> <InventoryConfiguration> <Id>report2</Id> <IsEnabled>true</IsEnabled> <Destination> <OSSBucketDestination> <Format>CSV</Format> <AccountId>1000000000000000</AccountId> <RoleArn>acs:ram::1000000000000000:role/AliyunOSSRole</RoleArn> <Bucket>acs:oss:::destination-bucket</Bucket> <Prefix>prefix2</Prefix> </OSSBucketDestination> </Destination> <Schedule> <Frequency>Daily</Frequency> </Schedule> <Filter> <Prefix>prefix/Two</Prefix> </Filter> <IncludedObjectVersions>All</IncludedObjectVersions> <OptionalFields> <Field>Size</Field> <Field>LastModifiedDate</Field> <Field>ETag</Field> <Field>StorageClass</Field> <Field>IsMultipartUploaded</Field> <Field>EncryptionStatus</Field> </OptionalFields> </InventoryConfiguration> <InventoryConfiguration> <Id>report3</Id> <IsEnabled>true</IsEnabled> <Destination> <OSSBucketDestination> <Format>CSV</Format> <AccountId>1000000000000000</AccountId> <RoleArn>acs:ram::1000000000000000:role/AliyunOSSRole</RoleArn> <Bucket>acs:oss:::destination-bucket</Bucket> <Prefix>prefix3</Prefix> </OSSBucketDestination> </Destination> <Schedule> <Frequency>Daily</Frequency> </Schedule> <Filter> <Prefix>prefix/Three</Prefix> </Filter> <IncludedObjectVersions>All</IncludedObjectVersions> <OptionalFields> <Field>Size</Field> <Field>LastModifiedDate</Field> <Field>ETag</Field> <Field>StorageClass</Field> <Field>IsMultipartUploaded</Field> <Field>EncryptionStatus</Field> </OptionalFields> </InventoryConfiguration> ... <IsTruncated>true</IsTruncated> <NextContinuationToken>...</NextContinuationToken> </ListInventoryConfigurationsResult>
SDKs
You can call this operation by using the following SDKs:
Ossutil CLI
To perform this operation using ossutil, see the list-bucket-inventory command.