API | Operation | Description |
Creating an inventory job | Creates an inventory job for a bucket | |
Querying inventory jobs | Queries the inventory jobs of a bucket | |
Deleting an inventory job | Deletes an inventory job from a bucket |
try{string inventoryId = "aInventoryId";// Bucket name in the format of bucketname-APPID. You can get APPID by referring to https://console.tencentcloud.com/developer.string bucket = "examplebucket-1250000000";PutBucketInventoryRequest putRequest = new PutBucketInventoryRequest(bucket, inventoryId);putRequest.SetDestination("CSV", "100000000001", "examplebucket-1250000000", "ap-guangzhou","list1");putRequest.IsEnable(true);putRequest.SetScheduleFrequency("Daily");// Execute the requestPutBucketInventoryResult putResult = cosXml.PutBucketInventory(putRequest);// Request succeededConsole.WriteLine(putResult.GetResultInfo());}catch (COSXML.CosException.CosClientException clientEx){// Request failedConsole.WriteLine("CosClientException: " + clientEx);}catch (COSXML.CosException.CosServerException serverEx){// Request failedConsole.WriteLine("CosServerException: " + serverEx.GetInfo());}
Error Code | Description | Status Code |
InvalidArgument | Invalid parameter value | HTTP 400 Bad Request |
TooManyConfigurations | The number of inventories has reached the upper limit of 1,000 | HTTP 400 Bad Request |
AccessDenied | Unauthorized access. You most likely do not have access permission for the bucket | HTTP 403 Forbidden |
try{string inventoryId = "aInventoryId";// Bucket name in the format of bucketname-APPID. You can get APPID by referring to https://console.tencentcloud.com/developer.string bucket = "examplebucket-1250000000";GetBucketInventoryRequest getRequest = new GetBucketInventoryRequest(bucket);getRequest.SetInventoryId(inventoryId);GetBucketInventoryResult getResult = cosXml.GetBucketInventory(getRequest);InventoryConfiguration configuration = getResult.inventoryConfiguration;}catch (COSXML.CosException.CosClientException clientEx){// Request failedConsole.WriteLine("CosClientException: " + clientEx);}catch (COSXML.CosException.CosServerException serverEx){// Request failedConsole.WriteLine("CosServerException: " + serverEx.GetInfo());}
try{string inventoryId = "aInventoryId";// Bucket name in the format of bucketname-APPID. You can get APPID by referring to https://console.tencentcloud.com/developer.string bucket = "examplebucket-1250000000";DeleteBucketInventoryRequest deleteRequest = new DeleteBucketInventoryRequest(bucket);deleteRequest.SetInventoryId(inventoryId);DeleteBucketInventoryResult deleteResult = cosXml.DeleteBucketInventory(deleteRequest);// Request succeededConsole.WriteLine(deleteResult.GetResultInfo());}catch (COSXML.CosException.CosClientException clientEx){// Request failedConsole.WriteLine("CosClientException: " + clientEx);}catch (COSXML.CosException.CosServerException serverEx){// Request failedConsole.WriteLine("CosServerException: " + serverEx.GetInfo());}
Was this page helpful?