GetBucketInventoryConfiguration - Amazon Simple Storage Service

GetBucketInventoryConfiguration

Note

This operation is not supported for directory buckets.

Returns an inventory configuration (identified by the inventory configuration ID) from the bucket.

To use this operation, you must have permissions to perform the s3:GetInventoryConfiguration action. The bucket owner has this permission by default and can grant this permission to others. For more information about permissions, see Permissions Related to Bucket Subresource Operations and Managing Access Permissions to Your Amazon S3 Resources.

For information about the Amazon S3 inventory feature, see Amazon S3 Inventory.

The following operations are related to GetBucketInventoryConfiguration:

Request Syntax

GET /?inventory&id=Id HTTP/1.1 Host: Bucket.s3.amazonaws.com x-amz-expected-bucket-owner: ExpectedBucketOwner

URI Request Parameters

The request uses the following URI parameters.

Bucket

The name of the bucket containing the inventory configuration to retrieve.

Required: Yes

id

The ID used to identify the inventory configuration.

Required: Yes

x-amz-expected-bucket-owner

The account ID of the expected bucket owner. If the account ID that you provide does not match the actual owner of the bucket, the request fails with the HTTP status code 403 Forbidden (access denied).

Request Body

The request does not have a request body.

Response Syntax

HTTP/1.1 200 <?xml version="1.0" encoding="UTF-8"?> <InventoryConfiguration> <Destination> <S3BucketDestination> <AccountId>string</AccountId> <Bucket>string</Bucket> <Encryption> <SSE-KMS> <KeyId>string</KeyId> </SSE-KMS> <SSE-S3> </SSE-S3> </Encryption> <Format>string</Format> <Prefix>string</Prefix> </S3BucketDestination> </Destination> <IsEnabled>boolean</IsEnabled> <Filter> <Prefix>string</Prefix> </Filter> <Id>string</Id> <IncludedObjectVersions>string</IncludedObjectVersions> <OptionalFields> <Field>string</Field> </OptionalFields> <Schedule> <Frequency>string</Frequency> </Schedule> </InventoryConfiguration>

Response Elements

If the action is successful, the service sends back an HTTP 200 response.

The following data is returned in XML format by the service.

InventoryConfiguration

Root level tag for the InventoryConfiguration parameters.

Required: Yes

Destination

Contains information about where to publish the inventory results.

Type: InventoryDestination data type

Filter

Specifies an inventory filter. The inventory only includes objects that meet the filter's criteria.

Type: InventoryFilter data type

Id

The ID used to identify the inventory configuration.

Type: String

IncludedObjectVersions

Object versions to include in the inventory list. If set to All, the list includes all the object versions, which adds the version-related fields VersionId, IsLatest, and DeleteMarker to the list. If set to Current, the list does not contain these version-related fields.

Type: String

Valid Values: All | Current

IsEnabled

Specifies whether the inventory is enabled or disabled. If set to True, an inventory list is generated. If set to False, no inventory list is generated.

Type: Boolean

OptionalFields

Contains the optional fields that are included in the inventory results.

Type: Array of strings

Valid Values: Size | LastModifiedDate | StorageClass | ETag | IsMultipartUploaded | ReplicationStatus | EncryptionStatus | ObjectLockRetainUntilDate | ObjectLockMode | ObjectLockLegalHoldStatus | IntelligentTieringAccessTier | BucketKeyStatus | ChecksumAlgorithm | ObjectAccessControlList | ObjectOwner

Schedule

Specifies the schedule for generating inventory results.

Type: InventorySchedule data type

Examples

Sample Request: Configure an inventory report

The following GET request for the bucket examplebucket returns the inventory configuration with the ID list1.

GET /?inventory&id=list1 HTTP/1.1 Host: examplebucket.s3.<Region>.amazonaws.com Date: Mon, 31 Oct 2016 12:00:00 GMT Authorization: authorization string

Sample Response

This example illustrates one usage of GetBucketInventoryConfiguration.

HTTP/1.1 200 OK x-amz-id-2: YgIPIfBiKa2bj0KMgUAdQkf3ShJTOOpXUueF6QKo x-amz-request-id: 236A8905248E5A02 Date: Mon, 31 Oct 2016 12:00:00 GMT Server: AmazonS3 Content-Length: length <?xml version="1.0" encoding="UTF-8"?> <InventoryConfiguration xmlns="http://s3.amazonaws.com/doc/2006-03-01/"> <Id>report1</Id> <IsEnabled>true</IsEnabled> <Destination> <S3BucketDestination> <Format>CSV</Format> <AccountId>123456789012</AccountId> <Bucket>arn:aws:s3:::destination-bucket</Bucket> <Prefix>prefix1</Prefix> <SSE-S3/> </S3BucketDestination> </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>ReplicationStatus</Field> <Field>ObjectLockRetainUntilDate</Field> <Field>ObjectLockMode</Field> <Field>ObjectLockLegalHoldStatus</Field> </OptionalFields> </InventoryConfiguration>

See Also

For more information about using this API in one of the language-specific AWS SDKs, see the following: