Inventory

Last updated: 2020-03-20 09:56:08

PDF

Note

This document provides an overview of inventory's API and SDK sample code.

API Operation name pedagogical operation
PUT Bucket inventory Set up inventory job Inventory and job who set up Bucket
GET Bucket inventory Inquire about inventory job Inquire about inventory and job of Bucket
DELETE Bucket inventory Delete inventory job Delete inventory and job of Bucket

Set up inventory job

Function description

PUT Bucket inventory is used to create inventory and job in Bucket.

Method prototype

put_bucket_inventory(Bucket, Id, InventoryConfiguration={}, **kwargs)

Request Sample

response = client.put_bucket_inventory(
    Bucket='examplebucket-1250000000'',
    Id='string',
    InventoryConfiguration={
        'Destination': {
            'COSBucketDestination': {
                'AccountId': '100000000001',
                'Bucket': 'qcs::cos:ap-guangzhou::examplebucket-1250000000',
                'Format': 'CSV',
                'Prefix': 'string',
                'Encryption': {
                    'SSECOS': {}
                }
            }
        },
        'IsEnabled': 'true'|'false',
        'Filter': {
            'Prefix': 'string'
        },
        'IncludedObjectVersions':'All'|'Current',
        'OptionalFields': {
            'Field': [
                'Size',
                'LastModifiedDate',
                'ETag',
                'StorageClass',
                'IsMultipartUploaded',
                'ReplicationStatus'
            ]
        },
        'Schedule': {
            'Frequency': 'Daily'|'Weekly'
        }
    }
)

Parameter description

Parameter name Parameter description Type Required/Optional
Bucket Set the format of Bucket of inventory and job to BucketName-APPID. For more information, please see Naming convention String Yes
Id The name of inventory job, Valid character: a muri zmena Alyzjimi 0muri 9mai, _ ,. String Yes
Destination The purpose information of inventory, job and shipping Dict Yes
COSBucketDestination Inventory job result shipping's purpose Bucket information Dict Yes
AccountId Objective Bucket's account information String No
Bucket The name of Bucket String Yes
Format Inventory result file format, optional value CSV String Yes
Prefix Objective the prefix of Bucket shipping path String No
Encryption Objective the encrypted information of Bucket and shipping files. The optional value is SSECOS. Dict No
IsEnabled The logo of whether inventory and job are enabled. Available values include true and flase. String Yes
Filter Filtering conditions of objects analyzed by inventory Dict No
Prefix The filtering prefix of inventory's analytical object String No
IncludedObjectVersions Contains multiple versions of the case. Available values: All and Current String Yes
OptionalFields Inventory optional fields Dict No
Field Field name, including Size, LastModifiedDate, ETag, StorageClass, IsMultipartUploaded, ReplicationStatus List No
Schedule The plan carried out by inventory and job Dict Yes
Frequency The frequency performed by inventory and job. Available values include Daily and Weekly. String Yes

Return result description

The return value of this method is None.

Error code description

Some common special errors that may occur in this request are as follows:

Error Codes Description Status Code
InvalidArgument Invalid's parameter value HTTP 400 Bad Request
TooManyConfigurations The number of inventory has reached the upper limit of 1000. HTTP 400 Bad Request
AccessDenied Unauthorized Access. You may not have Permission of Access and Bucket. HTTP 403 Forbidden

Inquire about inventory job

Function description

GET Bucket inventory is used to query inventory and job information of users in Bucket.

Method prototype

get_bucket_inventory(Bucket, Id, **kwargs)

Request Sample

response = client.get_bucket_inventory(
    Bucket='examplebucket-1250000000',
    Id='string'
)

Parameter description

Parameter name Parameter description Type Required/Optional
Bucket Query inventory job's Bucket in BucketName-APPID format. For more information, please see Naming convention String Yes
Id The name of inventory job, Valid character: a muri zmena Alyzjimi 0muri 9mai, _ ,. String Yes

Return result description

Bucket inventory job configuration, type is dict.

{
    'Id': 'string',
    'Destination': {
        'COSBucketDestination': {
            'AccountId': '100000000001',
            'Bucket': 'qcs::cos:ap-guangzhou::examplebucket-1250000000',
            'Format': 'CSV',
            'Prefix': 'string',
            'Encryption': {
                'SSECOS': {}
            }
        }
    },
    'IsEnabled': 'true'|'false',
    'Filter': {
        'Prefix': 'string'
    },
    'IncludedObjectVersions':'All'|'Current',
    'OptionalFields': {
        'Field': [
            'Size',
            'LastModifiedDate',
            'ETag',
            'StorageClass',
            'IsMultipartUploaded',
            'ReplicationStatus'
        ]
    },
    'Schedule': {
        'Frequency': 'Daily'|'Weekly'
    }
}
Parameter name Parameter description Type
Id The name of inventory job, Valid character: a muri zmena Alyzjimi 0muri 9mai, _ ,. String
Destination The purpose information of inventory, job and shipping Dict
COSBucketDestination Inventory job result shipping's purpose Bucket information Dict
AccountId Objective Bucket's account information String
Bucket The name of destination bucket String
Format Inventory result file format, optional value CSV String
Prefix Objective the prefix of Bucket shipping path String
Encryption Objective the encrypted information of Bucket and shipping files. The optional value is SSECOS. Dict
IsEnabled The logo of whether inventory and job are enabled. Available values include true and flase. String
Filter Filtering conditions of objects analyzed by inventory Dict
Prefix The filtering prefix of inventory's analytical object String
IncludedObjectVersions Contains multiple versions of the case. Available values: All and Current String
OptionalFields Inventory optional fields Dict
Field Field name, including Size, LastModifiedDate, ETag, StorageClass, IsMultipartUploaded, ReplicationStatus List
Schedule The plan carried out by inventory and job Dict
Frequency The frequency performed by inventory and job. Available values include Daily and Weekly. String

Delete inventory job

Function description

DELETE Bucket inventory is used to delete inventory and job specified in Bucket.

Method prototype

delete_bucket_inventory(Bucket, Id, **kwargs)

Request Sample

response = client.delete_bucket_inventory(
    Bucket='examplebucket-1250000000',
    Id='string'
)

Parameter description

Parameter name Parameter description Type Required/Optional
Bucket Bucket of inventory job is deleted in BucketName-APPID format. For more information, please see Naming convention String Yes
Id The name of inventory job, Valid character: a muri zmena Alyzjimi 0muri 9mai, _ ,. String Yes

Return result description

The return value of this method is None.