The GetBucketInventory operation queries the specified inventory configuration for a bucket.
Usage notes
By default, an Alibaba Cloud account has the permission to view the specified inventory configuration of a bucket. To call this operation as a Resource Access Management (RAM) user or by using Security Token Service (STS), you must have the oss:GetBucketInventory permission.
Request syntax
GET /?inventory&inventoryId=inventoryId HTTP/1.1Request parameters
| Parameter | Type | Required | Description |
inventoryId | string | Yes | The ID of the inventory rule to query. |
Response elements
The following table describes the elements returned in the response. Some elements apply only to specific inventory configurations. For example, DayOfMonth applies only when Frequency is set to Monthly, and AutoDelete applies only when Frequency is set to Once. The elements that are specific to incremental inventories are described in the following subsection.
| Element | Type | Description |
Id | string | The user-specified name of the inventory. The name must be unique within the bucket. |
IsEnabled | boolean | Indicates whether the inventory is enabled. Valid values: true and false. If the value is true, the inventory feature takes effect. If the value is false, no inventory is generated. |
Filter | container | The prefix used to filter the inventory. If a prefix is specified, the inventory includes only the objects whose names match the prefix. |
Prefix | string | The matching prefix of the filter rule. Parent node: Filter |
Destination | container | The information about where the inventory results are stored. |
OSSBucketDestination | container | The information about the bucket where the exported inventory results are stored. Parent node: Destination |
Format | string | The format of the exported inventory file. Valid values: CSV and Parquet. The Parquet format is currently supported only in the UK (London) region. Parent node: OSSBucketDestination |
AccountId | string | The account ID granted by the bucket owner. Parent node: OSSBucketDestination |
RoleArn | string | The name of the role granted by the bucket owner for operation permissions. Format: acs:ram::uid:role/rolename Parent node: OSSBucketDestination |
Bucket | string | The bucket where the exported inventory file is stored. Parent node: OSSBucketDestination |
Prefix | string | The prefix of the storage path for the inventory file. Parent node: OSSBucketDestination |
Encryption | container | The encryption method of the inventory file. Valid values: SSE-OSS and SSE-KMS. If the inventory file is not encrypted, this element is empty. Parent node: OSSBucketDestination |
SSE-OSS | container | The container for the SSE-OSS encryption method. Parent node: Encryption |
SSE-KMS | container | The container for the key used in the SSE-KMS encryption method. Parent node: Encryption |
KeyId | string | The ID of the KMS key. Parent node: SSE-KMS |
Schedule | container | The container for the schedule information of the inventory export. |
Frequency | string | The schedule for exporting the inventory file. Valid values: Daily, Weekly, Monthly, and Once. Parent node: Schedule |
DayOfMonth | positive integer | The day of the month on which the inventory is exported. This element applies only when Frequency is set to Monthly. Valid values: 1 to 31. Parent node: Schedule |
AutoDelete | boolean | Specifies whether the inventory configuration is automatically deleted after the one-time inventory run completes. This element is present only when Frequency is set to Once. Valid values: true and false. Parent node: Schedule |
IncludedObjectVersions | string | Specifies whether to include object version information in the inventory. Valid values: All and Current. If the value is All, the version information of all versions of the object is exported. If the value is Current, the version information of the current version of the object is exported. |
OptionalFields | container | The configuration items to include in the inventory results. |
Field | string | The configuration items included in the inventory results. Optional configuration items: Size, LastModifiedDate, TransitionTime, ETag, StorageClass, IsMultipartUploaded, EncryptionStatus, ObjectAcl, TaggingCount, ObjectType, and Crc64. Parent node: OptionalFields |
Incremental inventory elements
The following table describes the elements that are specific to incremental inventories.
| Element | Type | Description |
IncrementalInventory | container | The configuration information of the incremental inventory. |
IsEnabled | boolean | Specifies whether to enable the incremental inventory. Valid values: true (enabled) and false (disabled). When the value is true, the incremental inventory feature is enabled and is not affected by the parent element being set to false. Parent node: IncrementalInventory |
Schedule | container | The schedule of the incremental inventory export. Parent node: IncrementalInventory |
Frequency | positive integer | The export frequency of the incremental inventory, in seconds. The system currently uses a fixed period of 600 seconds. During each period, the system automatically creates a directory prefix and generates the corresponding manifest file and multiple CSV files produced within that period. Custom frequency settings are not supported. Parent node: Schedule |
OptionalFields | container | The configuration items to include in the incremental inventory. Parent node: IncrementalInventory |
Field | string | The configuration items included in the incremental inventory. Parent node: OptionalFields |
Incremental inventory record fields
The following fields describe records in an incremental inventory file:
SequenceNumber: The serial number of the record. TheSequenceNumberof each record is unique. Records of the same object in the same bucket can be sorted bySequenceNumber, and the sorted records typically follow chronological order.RecordType: The event type. Valid values:CREATE: all upload operations that occur under the selected prefix, such asPut,Post,Append,MultipartUpload, andCopy.UPDATE_METADATA: all metadata updates under the selected prefix.DELETE: all deletion operations of objects under the selected prefix, such asDeleteObjectandDeleteMultipleObjects, the generation of a delete marker after versioning is enabled, and lifecycle-based deletion. Deletions include creating a delete marker and permanent deletion. For a permanent deletion, the record retains only the core fieldsBucket,Key,SequenceNumber,RecordType,RecordTimestamp, andVersionId, and all other columns are null.
RecordTimestamp: The timestamp of the record, in Greenwich Mean Time and accurate to the millisecond. Example:2024-08-25 18:08:01.024.Requester: The Alibaba Cloud ID or Principal ID of the requester.RequestId: The unique identifier of the request.SourceIp: The source IP address of the requester.Key: The URL-encoded name of the object in the bucket.VersionId: The version ID of the object. This field appears only when the configured inventory rule exports all versions.If versioning is not enabled on the bucket for which the inventory rule is configured, this field is empty.
If versioning is enabled on the bucket for which the inventory rule is configured, this field displays the
VersionIdof the object.
IsDeleteMarker: Specifies whether the object version is a delete marker. This field appears only when the configured inventory rule exports all versions.If versioning is not enabled on the bucket for which the inventory rule is configured, this field defaults to
false.If versioning is enabled on the bucket for which the inventory rule is configured, this field is
truewhen the object is a delete marker, andfalsewhen the object is not a delete marker.
Size: The size of the object.StorageClass: The storage class of the object.LastModifiedDate: The last modified time of the object.ETag: The ETag of the object. An ETag is created when the object is generated and identifies the content of the object.For an object created by using the
PutObjectoperation, the ETag is the MD5 hash of its content.For an object created by using other methods, the ETag is a unique value generated based on certain calculation rules and is not the MD5 hash of its content.
IsMultipartUploaded: Specifies whether the object was uploaded by using multipart upload.ObjectType: The type of the object.ObjectAcl: The access control list of the object.Crc64: The CRC-64 value of the object.EncryptionStatus: Specifies whether the object is encrypted.
Examples
Example request
GET /?inventory&inventoryId=report1 HTTP/1.1Example response
HTTP/1.1 200 OK
x-oss-request-id: 56594298207FB304438516F9
Date: Mon, 31 Oct 2016 12:00:00 GMT
Server: AliyunOSS
Content-Length: length
<?xml version="1.0" encoding="UTF-8"?>
<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:::bucket_0001</Bucket>
<Prefix>prefix1</Prefix>
<Encryption>
<SSE-OSS/>
</Encryption>
</OSSBucketDestination>
</Destination>
<Schedule>
<Frequency>Daily</Frequency>
</Schedule>
<Filter>
<Prefix>myprefix/</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>SDKs
The following SDKs support this operation:
ossutil CLI
For the ossutil command that corresponds to the GetBucketInventory operation, see get-bucket-inventory.