tencent cloud

Feedback

List Bucket Inventory Configurations

Last updated: 2024-11-19 17:36:56

    Feature Overview

    This API is used to query all inventory jobs configured for a bucket. You can configure up to 1,000 inventory jobs for a bucket.
    This request supports returning the results in multiple responses. Each response can contain up to 100 inventory jobs. The value of IsTruncated in the request is described as follows:
    If the value of IsTruncated is false, all inventory jobs of the bucket have been listed.
    If the value of IsTruncated is true and NextContinuationToken carries a value, you can pass this value to continuation-token in the next request to obtain the remaining inventory jobs from the next response.
    For more information, see Inventory Overview.
    Note:
    To call this API, make sure that you have the required permission for bucket inventory jobs. The bucket owner has the permission by default. If you don’t have it, you must request it from the bucket owner first.
    

    Request

    Sample request

    GET /?inventory HTTP/1.1
    Host: <BucketName-APPID>.cos.<Region>.myqcloud.com
    Date: GMT Date
    Authorization: Auth String
    Note:
    In Host: <BucketName-APPID>.cos.<Region>.myqcloud.com, <BucketName-APPID> is the bucket name followed by the APPID, such as examplebucket-1250000000 (see Bucket Overview > Basic Information and Bucket Overview > Bucket Naming Conventions), and <Region> is a COS region (see Regions and Access Endpoints).
    Authorization: Auth String (See Request Signature for details.)

    Request parameters

    The request parameter is as follows:
    Parameter
    Description
    Type
    Required
    continuation-token
    If the value of IsTruncated is true in the last COS response and NextContinuationToken carries a value, you can pass this value to continuation-token to obtain the inventory jobs in the response.
    Default value: None
    String
    No

    Request headers

    This API only uses Common Request Headers.

    Request body

    The request body of this request is empty.

    Response

    Response headers

    This API only returns Common Response Headers.

    Response body

    The response body returns application/xml data. The following contains all the nodes:
    <ListInventoryConfigurationResult>
    <InventoryConfiguration>
    <Id>list1</Id>
    <IsEnabled>True</IsEnabled>
    <Destination>
    <COSBucketDestination>
    <Format>CSV</Format>
    <AccountId>1250000000</AccountId>
    <Bucket>qcs::cos:ap-beijing::examplebucket-1250000000</Bucket>
    <Prefix>list1</Prefix>
    <SSE-COS></SSE-COS>
    </COSBucketDestination>
    </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>IsMultipartUpload</Field>
    <Field>ReplicationStatus</Field>
    </OptionalFields>
    </InventoryConfiguration>
    <InventoryConfiguration>
    <Id>list2</Id>
    <IsEnabled>True</IsEnabled>
    <Destination>
    <COSBucketDestination>
    <Format>CSV</Format>
    <AccountId>1250000000</AccountId>
    <Bucket>qcs::cos:ap-beijing::examplebucket-1250000000</Bucket>
    <Prefix>list2</Prefix>
    <SSE-COS></SSE-COS>
    </COSBucketDestination>
    </Destination>
    <Schedule>
    <Frequency>Weekly</Frequency>
    </Schedule>
    <Filter>
    <Prefix>myPrefix2</Prefix>
    </Filter>
    <IncludedObjectVersions>All</IncludedObjectVersions>
    <OptionalFields>
    <Field>Size</Field>
    <Field>LastModifiedDate</Field>
    <Field>ETag</Field>
    <Field>StorageClass</Field>
    </OptionalFields>
    </InventoryConfiguration>
    <IsTruncated>false</IsTruncated>
    ------If ContinuationToken was provided in the request---
    <ContinuationToken>...</ContinuationToken>
    <IsTruncated>true</IsTruncated>
    <NextContinuationToken>1ueSDFASDF1Tr/XDAFdadEADadf2J/wm36Hy4vbOwM=</NextContinuationToken>
    </ListInventoryConfigurationResult>
    The nodes are described as follows:
    Node Name
    Parent Node
    Description
    Type
    List InventoryConfigurationResult
    None
    Information about all inventory jobs of the bucket
    Container
    InventoryConfiguration
    ListInventoryConfigurationResult
    Detailed configuration of an inventory job. For the XML structure, see GET Bucket inventory.
    Container
    IsTruncated
    ListInventoryConfigurationResult
    Whether all inventory jobs have been listed. If yes, the value is false. Otherwise, the value is true.
    Boolean
    ContinuationToken
    ListInventoryConfigurationResult
    Identifier of the current response. This parameter corresponds to the continuation-token request parameter.
    String
    NextContinuationToken
    ListInventoryConfigurationResult
    Identifier of the next response. You can pass the value of this parameter to continuation-token and initiate a GET request to obtain the inventory jobs from the next response.
    String

    Error codes

    This API returns common error responses and error codes. For more information, see Error Codes.

    Examples

    Request

    The following example queries the inventory jobs of the examplebucket-1250000000 bucket:
    GET /?inventory HTTP/1.1
    Date: Mon, 28 Aug 2018 02:53:38 GMT
    Authorization: q-sign-algorithm=sha1&q-ak=************************************&q-sign-time=1503895278;1503895638&q-key-time=1503895278;1503895638&q-header-list=host&q-url-param-list=inventory&q-signature=****************************************
    Host: examplebucket-1250000000.cos.ap-beijing.myqcloud.com

    Response

    After the request above is made, COS returns the following response, indicating that the inventory jobs list1 and list2 are set for the bucket.
    Inventory job list1
    Objects to analyze: objects prefixed with myPrefix and all their versions in the examplebucket-1250000000 bucket
    Analysis frequency: daily
    Analysis dimensions: Size, LastModifiedDate, StorageClass, ETag, IsMultipartUploaded, and ReplicationStatus
    Analysis result: to be stored in the inventorybucket-1250000000 bucket as a CSV file, which is prefixed with list1 and encrypted with SSE-COS.
    Inventory job list2
    Objects to analyze: objects prefixed with myPrefix2 and labeled {age:18} and all their versions in the examplebucket-1250000000 bucket
    Analysis frequency: once a week
    Analysis dimensions: Size, LastModifiedDate, StorageClass, ETag and Tag.
    The result will be stored in the inventorybucket-1250000000 bucket as a CSV file.
    Assume that 100 inventory jobs are listed in this response. If the value of IsTruncated is true, COS will return NextContinuationToken, whose value can be passed to continuation-token for a GET request to obtain the inventory jobs from the next response.
    HTTP/1.1 200 OK
    Content-Type: application/xml
    Content-Length: 331
    Date: Mon, 28 Aug 2018 02:53:39 GMT
    Server: tencent-cos
    x-cos-request-id: NTlhMzg1ZWVfMjQ4OGY3MGFfMWE1NF8****
    <?xml version = "1.0" encoding = "UTF-8">
    <ListInventoryConfigurationResult xmlns = "http://....">
    <InventoryConfiguration>
    <Id>list1</Id>
    <IsEnabled>True</IsEnabled>
    <Destination>
    <COSBucketDestination>
    <Format>CSV</Format>
    <AccountId>1250000000</AccountId>
    <Bucket>qcs::cos:ap-beijing::inventorybucket-1250000000</Bucket>
    <Prefix>list1</Prefix>
    <SSE-COS></SSE-COS>
    </COSBucketDestination>
    </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>IsMultipartUpload</Field>
    <Field>ReplicationStatus</Field>
    </OptionalFields>
    </InventoryConfiguration>
    <InventoryConfiguration>
    <Id>list2</Id>
    <IsEnabled>True</IsEnabled>
    <Destination>
    <COSBucketDestination>
    <Format>CSV</Format>
    <AccountId>1250000000</AccountId>
    <Bucket>qcs::cos:ap-beijing::inventorybucket-1250000000</Bucket>
    </COSBucketDestination>
    </Destination>
    <Schedule>
    <Frequency>Weekly</Frequency>
    </Schedule>
    <Filter>
    <And>
    <Prefix>myPrefix2</Prefix>
    <Tag>
    <Key>age</Key>
    <Value>18</Value>
    </Tag>
    </And>
    </Filter>
    <IncludedObjectVersions>All</IncludedObjectVersions>
    <OptionalFields>
    <Field>Size</Field>
    <Field>LastModifiedDate</Field>
    <Field>StorageClass</Field>
    <Field>ETag</Field>
    <Field>Tag</Field>
    </OptionalFields>
    </InventoryConfiguration>
    <IsTruncated>false</IsTruncated>
    ------If ContinuationToken was provided in the request---
    <ContinuationToken>...</ContinuationToken>
    <IsTruncated>true</IsTruncated>
    <NextContinuationToken>1ueSDFASDF1Tr/XDAFdadEADadf2J/wm36Hy4vbOwM=</NextContinuationToken>
    </ListInventoryConfigurationResult>
    
    Contact Us

    Contact our sales team or business advisors to help your business.

    Technical Support

    Open a ticket if you're looking for further assistance. Our Ticket is 7x24 avaliable.

    7x24 Phone Support