All Products
Search
Document Center

Object Storage Service:get-bucket-inventory

Last Updated:Aug 20, 2024

Queries specific inventories of a bucket.

Usage notes

By default, an Alibaba Cloud account has the permissions to query specific inventories of a bucket. If you want to use a RAM user or STS to query specific inventories of a bucket, you must have the oss:GetBucketInventory permission. For more information, see Attach a custom policy to a RAM user.

Command syntax

ossutil api get-bucket-inventory --bucket value --inventory-id value [flags]

Parameter

Type

Description

--bucket

string

The name of the bucket whose inventories you want to query.

--inventory-id

string

The ID of the inventories that you want to query.

Note
  • The get-bucket-inventory command corresponds to the GetBucketInventory operation. For more information about the parameters in the GetBucketInventory operation, see GetBucketInventory.

  • For more information about supported global command-line options, see Global command-line options.

Examples

  • Run the following command to query an inventory whose name is report1 in the examplebucket bucket:

    ossutil api get-bucket-inventory --bucket examplebucket --inventory-id report1
  • Run the following command to query an inventory whose name is report1 in the examplebucket bucket and display the inventory in the JSON format:

    ossutil api get-bucket-inventory --bucket examplebucket --inventory-id report1 --output-format json
  • Run the following command to query an inventory whose name is report1 in the examplebucket bucket and display the inventory in the YAML format:

    ossutil api get-bucket-inventory --bucket examplebucket --inventory-id report1 --output-format yaml