tencent cloud

Cloud Object Storage

Release Notes and Announcements
Release Notes
Announcements
Product Introduction
Overview
Features
Use Cases
Strengths
Concepts
Regions and Access Endpoints
Specifications and Limits
Service Regions and Service Providers
Billing
Billing Overview
Billing Method
Billable Items
Free Tier
Billing Examples
Viewing and Downloading Bill
Payment Overdue
FAQs
Getting Started
Console
Getting Started with COSBrowser
User Guide
Creating Request
Bucket
Object
Data Management
Batch Operation
Global Acceleration
Monitoring and Alarms
Operations Center
Data Processing
Content Moderation
Smart Toolbox
Data Processing Workflow
Application Integration
User Tools
Tool Overview
Installation and Configuration of Environment
COSBrowser
COSCLI (Beta)
COSCMD
COS Migration
FTP Server
Hadoop
COSDistCp
HDFS TO COS
GooseFS-Lite
Online Tools
Diagnostic Tool
Use Cases
Overview
Access Control and Permission Management
Performance Optimization
Accessing COS with AWS S3 SDK
Data Disaster Recovery and Backup
Domain Name Management Practice
Image Processing
Audio/Video Practices
Workflow
Direct Data Upload
Content Moderation
Data Security
Data Verification
Big Data Practice
COS Cost Optimization Solutions
Using COS in the Third-party Applications
Migration Guide
Migrating Local Data to COS
Migrating Data from Third-Party Cloud Storage Service to COS
Migrating Data from URL to COS
Migrating Data Within COS
Migrating Data Between HDFS and COS
Data Lake Storage
Cloud Native Datalake Storage
Metadata Accelerator
GooseFS
Data Processing
Data Processing Overview
Image Processing
Media Processing
Content Moderation
File Processing Service
File Preview
Troubleshooting
Obtaining RequestId
Slow Upload over Public Network
403 Error for COS Access
Resource Access Error
POST Object Common Exceptions
API Documentation
Introduction
Common Request Headers
Common Response Headers
Error Codes
Request Signature
Action List
Service APIs
Bucket APIs
Object APIs
Batch Operation APIs
Data Processing APIs
Job and Workflow
Content Moderation APIs
Cloud Antivirus API
SDK Documentation
SDK Overview
Preparations
Android SDK
C SDK
C++ SDK
.NET(C#) SDK
Flutter SDK
Go SDK
iOS SDK
Java SDK
JavaScript SDK
Node.js SDK
PHP SDK
Python SDK
React Native SDK
Mini Program SDK
Error Codes
Harmony SDK
Endpoint SDK Quality Optimization
Security and Compliance
Data Disaster Recovery
Data Security
Cloud Access Management
FAQs
Popular Questions
General
Billing
Domain Name Compliance Issues
Bucket Configuration
Domain Names and CDN
Object Operations
Logging and Monitoring
Permission Management
Data Processing
Data Security
Pre-signed URL Issues
SDKs
Tools
APIs
Agreements
Service Level Agreement
Privacy Policy
Data Processing And Security Agreement
Contact Us
Glossary

Inventory

PDF
Focus Mode
Font Size
Last updated: 2024-02-04 11:37:32

Overview

This document provides an overview of APIs and SDK code samples related to COS inventory.
API
Operation Name
Description
Creating an inventory job
Creates an inventory job for a bucket
Querying inventory jobs
Queries the inventory jobs of a bucket
Deleting inventory jobs
Deletes an inventory job from a bucket

Creating an Inventory Job

Feature description

This API is used to create an inventory job for a bucket. For more information, see Inventory Overview.
Note:
Up to 1,000 inventory jobs can be created in one COS bucket.
You must write a bucket policy for the destination bucket in order for COS to put the resulting file of the inventory job into the destination bucket.
To call this API, make sure that you have the necessary permission for bucket inventory jobs; the bucket owner has permission by default. If you do not have such permission, you can request permission from the bucket owner.

Request samples

Sample 1. Creating an inventory job with server-side encryption.
cos.putBucketInventory({
Bucket: 'sourcebucket-1250000000', /* Required */
Region: 'ap-beijing', /* Required */
Id: 'inventory_test', /* Required */
InventoryConfiguration: {
Id: 'inventory_test',
IsEnabled: 'true',
Destination: {
COSBucketDestination: {
Format: 'CSV',
AccountId: '100000000001',
Bucket: 'qcs::cos:ap-beijing::targetbucket-1250000000',
Prefix: 'inventory_test_prefix',
Encryption: {
SSECOS: ''
}
}
},
Schedule: {
Frequency: 'Daily'
},
Filter: {
Prefix: 'filter_prefix'
},
IncludedObjectVersions: 'All',
OptionalFields: [
'Size',
'LastModifiedDate',
'StorageClass',
'ETag'
]
}
}, function(err, data) {
console.log(err || data);
});
Sample 2. Creating an inventory job without server-side encryption.
cos.putBucketInventory({
Bucket: 'sourcebucket-1250000000', /* Required */
Region: 'ap-beijing', /* Required */
Id: 'inventory_test', /* Required */
InventoryConfiguration: {
Id: 'inventory_test',
IsEnabled: 'true',
Destination: {
COSBucketDestination: {
Format: 'CSV',
AccountId: '100000000001',
Bucket: 'qcs::cos:ap-beijing::targetbucket-1250000000',
Prefix: 'inventory_test_prefix'
}
},
Schedule: {
Frequency: 'Daily'
},
Filter: {
Prefix: 'filter_prefix'
},
IncludedObjectVersions: 'All',
OptionalFields: [
'Size',
'LastModifiedDate',
'StorageClass',
'ETag'
]
}
}, function(err, data) {
console.log(err || data);
});

Parameter description

Parameter Name
Description
Type
Required
Bucket
Name of the bucket for which the inventory job is configured in the format: BucketName-APPID
String
Yes
Region
Bucket region. For enumerated values, see Regions and Access Domain Names
String
Yes
Id
ID of the inventory job.
Default: None
Valid characters: a-z,A-Z,0-9,-,_,.
String
Yes
InventoryConfiguration
Inventory configuration parameters
Object
Yes
- Id
ID of the inventory job.
Default: None
Valid characters: a-z,A-Z,0-9,-,_,.
String
Yes
- IsEnabled
Indicates whether inventory is enabled. true indicates it is enabled; false indicates no inventory list will be generated.
String
Yes
- IncludedObjectVersions
Indicates whether to include object versions in the inventory
If this is set to All, the inventory will include all object versions and the additional fields VersionId, IsLatest, and DeleteMarker.
If this is set to Current, no object versions will be included in the inventory.
String
Yes
- Filter
Filters the objects subject to the inventory job with the prefix specified in this parameter
Object
No
- - Prefix
Prefix of the objects to be inventoried
String
No
- OptionalFields
Optional fields included in the inventory result, including Size, LastModifiedDate, StorageClass, ETag, IsMultipartUploaded, and ReplicationStatus
Array
No
- Schedule
Schedule for the inventory job
Object
Yes
- - Frequency
Frequency of the inventory job. Enumerated values: Daily, Weekly
String
Yes
- Destination
Destination that stores the inventory results
Object
Yes
- - COSBucketDestination
Destination bucket that stores the exported inventory results
Object
Yes
- - - Bucket
Name of the bucket that stores the inventory results
String
Yes
- - - AccountId
ID of the bucket owner, e.g. 100000000001
String
No
- - - Prefix
The prefix for shipping inventory reports. COS automatically adds a '/' after the prefix you specify. For example, if you specify 'Prefix' as the prefix, COS will ship inventory reports to the path 'Prefix/inventory_report'.
String
No
- - - Format
Format of the inventory results. Value: CSV
String
Yes
- - - Encryption
The option of enabling server-side encryption for inventory results
Object
No
- - - - SSECOS
Encryption with a COS-managed key. Left empty.
String
No

Callback function description

function(err, data) { ... }
Parameter Name
Description
Type
err
Object returned when an error (network error or service error) occurs. If the request is successful, this is null. For more information, see Error Codes
Object
- statusCode
HTTP status code returned by the request, such as 200, 403, and 404
Number
- headers
Header information returned by the request
Object
data
Object returned when the request is successful. If the request fails, this is null
Object
- statusCode
HTTP status code returned by the request, such as 200, 403, and 404
Number
- headers
Header information returned by the request
Object

Querying Inventory Jobs

Feature description

This API is used to query the inventory jobs of a bucket. To initiate this request, you need to provide the inventory job ID, and a request signature that indicates that the request has been permitted. For more information, see Inventory Overview.
Note:
To call this API, make sure that you have the necessary permission for bucket inventory jobs.
The bucket owner has such permission by default. If you do not have the permission, you can request permission from the bucket owner.

Request samples

cos.getBucketInventory({
Bucket: 'sourcebucket-1250000000', /* Required */
Region: 'ap-beijing', /* Required */
Id: 'inventory_test' /* Required */
}, function(err, data) {
console.log(err || data);
});

Sample response

{
"InventoryConfiguration": {
"Id":"inventory_test",
"IsEnabled":"true",
"Destination":{
"COSBucketDestination": {
"Format":"CSV",
"AccountId":"100000000001",
"Bucket":"qcs::cos:ap-beijing::targetbucket-1250000000",
"Prefix":"inventory_test_prefix",
"Encryption": {
"SSECOS":""
}
}
},
"Schedule": {
"Frequency":"Daily"
},
"Filter": {
"Prefix":"filter_prefix"
},
"IncludedObjectVersions":"All",
"OptionalFields": [
"Size",
"LastModifiedDate",
"StorageClass",
"ETag"
]
}
"statusCode": 200,
"headers": {}
}

Parameter description

Parameter Name
Description
Type
Required
Bucket
Name of the bucket for which the inventory job is queried in the format: BucketName-APPID
String
Yes
Region
Bucket region. For the enumerated values, see Regions and Access Domain Names
String
Yes
Id
ID of the inventory job.
Default: None
Valid characters: a-z,A-Z,0-9,-,_,.
String
Yes

Callback function description

function(err, data) { ... }
Parameter Name
Description
Type
err
Object returned when an error (network error or service error) occurs. If the request is successful, this is null. For more information, see Error Codes
Object
- statusCode
HTTP status code returned by the request, such as 200, 403, and 404
Number
- headers
Header information returned by the request
Object
data
Data returned when the request is successful. If the request fails, this is null.
Object
- statusCode
HTTP status code returned by the request, such as 200, 403, and 404
Number
- headers
Header information returned by the request
Object
- InventoryConfiguration
Inventory configuration parameters
Object
- - Id
ID of the inventory job.
Default: None
Valid characters: a-z,A-Z,0-9,-,_,.
String
- - IsEnabled
Indicates whether inventory is enabled. true indicates it is enabled; false indicates no inventory list will be generated.
String
- - IncludedObjectVersions
Indicates whether to include object versions in the inventory
If this is set to All, the inventory will include all object versions and additional fields VersionId, IsLatest, and DeleteMarker.
If this is set to Current, no object versions will be included in the inventory.
String
- - Filter
Filters objects subject to the inventory job with the prefix specified in this field
Object
- - - Prefix
Prefix of the objects to be inventoried
String
- - OptionalFields
Optional fields included in the inventory result, including Size, LastModifiedDate, StorageClass, ETag, IsMultipartUploaded, and ReplicationStatus
Array
- - Schedule
Schedule for the inventory job
Object
- - - Frequency
Frequency of the inventory job. Enumerated values: Daily, Weekly
String
- - Destination
Destination that stores the inventory results
Object
- - - COSBucketDestination
Destination bucket that stores the exported inventory results
Object
- - - - Bucket
Name of the bucket that stores the inventory results
String
- - - - AccountId
ID of the bucket owner, e.g. 100000000001
String
- - - - Prefix
The prefix for shipping inventory reports. COS automatically adds a '/' after the prefix you specify. For example, if you specify 'Prefix' as the prefix, COS will ship inventory reports to the path 'Prefix/inventory_report'.
String
- - - - Format
Format of the inventory results. Value: CSV
String
- - - - Encryption
The option of enabling server-side encryption for inventory results
Object
- - - - - SSECOS
Encryption with a COS-managed key. Left empty.
String

Deleting Inventory Jobs

Feature description

This API is used to delete an inventory job from a bucket with the inventory job ID you specify. For more information, please see Inventory Overview.
Note:
To call this API, make sure that you have the necessary permission for bucket inventory jobs.
The bucket owner has such permission by default. If you do not have the permission, you can request permission from the bucket owner.

Request samples

cos.deleteBucketInventory({
Bucket: 'sourcebucket-1250000000', /* Required */
Region: 'ap-beijing', /* Required */
Id: 'inventory_test' /* Required */
}, function(err, data) {
console.log(err || data);
});

Parameter description

Parameter Name
Description
Type
Required
Bucket
Name of the bucket from which the inventory job is deleted in the format: BucketName-APPID
String
Yes
Region
Bucket region. For the enumerated values, see Regions and Access Domain Names
String
Yes
Id
ID of the inventory job. Default: None
Valid characters: a-z,A-Z,0-9,-,_,.
String
Yes

Callback function description

function(err, data) { ... }
Parameter Name
Description
Type
err
Object returned when an error (network error or service error) occurs. If the request is successful, this is null. For more information, see Error Codes
Object
- statusCode
HTTP status code returned by the request, such as 200, 403, and 404
Number
- headers
Header information returned by the request
Object
data
Object returned when the request is successful. If the request fails, this is null
Object
- statusCode
HTTP status code returned by the request, such as 200, 403, and 404
Number
- headers
Header information returned by the request
Object


Help and Support

Was this page helpful?

Help us improve! Rate your documentation experience in 5 mins.

Feedback