tencent cloud

Inventory - inventory
Last updated: 2025-10-28 16:07:10
Inventory - inventory
Last updated: 2025-10-28 16:07:10
The inventory command is used to set, query, delete, list, and trigger a one-time list.
Note:
To query the inventory, when performing authorization policy, set action to cos:GetBucketInventory.
To set the inventory, when performing authorization policy, set action to cos:PutBucketInventory.
To delete the inventory, when performing authorization policy, set action to cos:DeleteBucketInventory.
To list the inventory, when performing authorization policy, set action to cos:GetBucketInventory.
To trigger a one-time list, when performing authorization policy, set action to cos:PostBucketInventory.
For more authorization, please refer to Business APIs Supporting CAM.

Command Syntax

./coscli inventory --method [method] cos://<bucket-name>
The inventory command includes the following parameters:
Parameter Format
Description
Example
cos://<bucket-name>
Specify the target bucket. Supports using the bucket alias in configuration parameters or the bucket name for access. If using the bucket name for access, you must also include the endpoint flag.
Access with the bucket alias: cos://example-alias
Access with the bucket name: cos://examplebucket-1250000000
The inventory command includes the following optional flags:
Flag Abbreviation
Flag Name
Description
-h
--help
Views the usage of this command.
None
--method
Specify the required operation, including put (set bucket inventory), get (query bucket inventory), delete (delete bucket inventory), list (list bucket inventory), post (initiate one-time list).
None
--task-id
Inventory Task ID
None
--configuration
Inventory configuration (supports JSON format, XML format, or directly specifying a file path, such as /data/configuration.txt, which needs to be specified as file:///data/configuration.txt)
Note:
For more general options for this command (such as switching buckets or user accounts), see Common Options.

Setting Bucket Inventory

Operation Example

Set the inventory for the bucket named example-alias. The command is as follows (specific format see Setting Bucket Inventory):
./coscli inventory --method put cos://example-alias --task-id list4 --configuration "<InventoryConfiguration>...</InventoryConfiguration>"

Querying Bucket Inventory

Operation Example

Query the manifest tasks of the bucket named example-alias list4.
./coscli inventory --method get cos://example-alias --task-id list4
Output the following result.
SECTION | KEY | VALUE
------------------+-------------------+------------------------------------------------
Basic | ID | list4
+ +-------------------+-----------------------------------------------+
| Enabled | false
+ +-------------------+-----------------------------------------------+
| Included Versions | All
+-----------------+-------------------+-----------------------------------------------+
| |
+-----------------+-------------------+-----------------------------------------------+
Schedule | Frequency | Weekly
+-----------------+-------------------+-----------------------------------------------+
| |
+-----------------+-------------------+-----------------------------------------------+
Destination | Bucket | qcs::cos:ap-nanjing::test-125000000
+ +-------------------+-----------------------------------------------+
| Format | CSV
+ +-------------------+-----------------------------------------------+
| Account ID | 100000000
+ +-------------------+-----------------------------------------------+
| Prefix | list4
+-----------------+-------------------+-----------------------------------------------+
| |
+-----------------+-------------------+-----------------------------------------------+
Filter | Prefix | myPrefix
+ +-------------------+-----------------------------------------------+
| Tag | age=18
+ +-------------------+-----------------------------------------------+
| Period | 2026-01-18 to 2019-09-17
+-----------------+-------------------+-----------------------------------------------+
| |
+-----------------+-------------------+-----------------------------------------------+
Optional Fields | Field | Size
+ + +-----------------------------------------------+
| | ETag
+ + +-----------------------------------------------+
| | StorageClass
+ + +-----------------------------------------------+
| | IsMultipartUploaded
+ + +-----------------------------------------------+
| | Tag
+ + +-----------------------------------------------+
| | LastModifiedDate
------------------+-------------------+------------------------------------------------
Inventory Configuration Details

Deleting a Bucket Inventory

Operation Example

Delete the manifest task list4 of the bucket named example-alias. The command is as follows:
./coscli inventory --method delete cos://example-alias --task-id list4

Listing All Bucket Inventories

Operation Example

List all manifest tasks of the bucket named example-alias.
./coscli inventory --method list cos://example-alias
Output the following result.
ID | STATUS | SCHEDULE | INCLUDEDOBJECTVERSIONS | DESTINATION | FILTER | FIELDS
--------+----------+-------------------+------------------------+-------------------------------------------------------+----------------------------------+----------------------
list1 | Enabled | Frequency: Daily | All | Bucket: qcs::cos:ap-nanjing::test-125000000 | Period: 2019-09-17 to 2019-09-17 | Size
| | | | Format: CSV | | ETag
| | | | Account: 1000000000 | | StorageClass
| | | | Prefix: list1 | | IsMultipartUploaded
| | | | | | ReplicationStatus
| | | | | | LastModifiedDate
--------+----------+-------------------+------------------------+-------------------------------------------------------+----------------------------------+----------------------
list3 | Disabled | Frequency: Weekly | All | Bucket: qcs::cos:ap-nanjing::test-125000000 | Period: 2026-01-18 to 2019-09-17 | Size
| | | | Format: CSV | | ETag
| | | | Account: 1000000000 | | StorageClass
| | | | Prefix: list3 | | IsMultipartUploaded
| | | | | | ReplicationStatus
| | | | | | LastModifiedDate
--------+----------+-------------------+------------------------+-------------------------------------------------------+----------------------------------+----------------------
list4 | Disabled | Frequency: Weekly | All | Bucket: qcs::cos:ap-nanjing::test-125000000 | Prefix: myPrefix | Size
| | | | Format: CSV | Tags: age=18 | ETag
| | | | Account: 1000000000 | Period: 2026-01-18 to 2019-09-17 | StorageClass
| | | | Prefix: list4 | | IsMultipartUploaded
| | | | | | Tag
| | | | | | LastModifiedDate
--------+----------+-------------------+------------------------+-------------------------------------------------------+----------------------------------+----------------------
Detailed COS Bucket Inventory Configurations

Total inventory configurations: 3


Initiating a One-Time List

Operation Example

Initiate a one-time inventory task for the bucket named example-alias. The command is as follows (specific format see Initiating a One-Time Inventory Task):
./coscli inventory --method post cos://example-alias --task-id list4 --configuration "<InventoryConfiguration>...</InventoryConfiguration>"


Was this page helpful?
You can also Contact Sales or Submit a Ticket for help.
Yes
No

Feedback