API | 操作名 | 操作描述 |
设置清单任务 | 设置存储桶的清单任务 | |
查询清单任务 | 查询存储桶的清单任务 | |
删除清单任务 | 删除存储桶的清单任务 |
try{string inventoryId = "aInventoryId";// 存储桶名称,此处填入格式必须为 bucketname-APPID, 其中 APPID 获取参考 https://console.tencentcloud.com/developerstring bucket = "examplebucket-1250000000";PutBucketInventoryRequest putRequest = new PutBucketInventoryRequest(bucket, inventoryId);putRequest.SetDestination("CSV", "100000000001", "examplebucket-1250000000", "ap-guangzhou","list1");putRequest.IsEnable(true);// 清单任务周期,枚举值:Daily、WeeklyputRequest.SetScheduleFrequency("Daily");// 是否在清单中包含对象版本,枚举值:All、CurrentputRequest.SetIncludedObjectVersions("All");//执行请求PutBucketInventoryResult putResult = cosXml.PutBucketInventory(putRequest);//请求成功Console.WriteLine(putResult.GetResultInfo());}catch (COSXML.CosException.CosClientException clientEx){//请求失败Console.WriteLine("CosClientException: " + clientEx);}catch (COSXML.CosException.CosServerException serverEx){//请求失败Console.WriteLine("CosServerException: " + serverEx.GetInfo());}
错误码 | 描述 | 状态码 |
InvalidArgument | 不合法的参数值 | HTTP 400 Bad Request |
TooManyConfigurations | 清单数量已经达到1000条的上限 | HTTP 400 Bad Request |
AccessDenied | 未授权的访问。您可能不具备访问该存储桶的权限 | HTTP 403 Forbidden |
try{string inventoryId = "aInventoryId";// 存储桶名称,此处填入格式必须为 bucketname-APPID, 其中 APPID 获取参考 https://console.tencentcloud.com/developerstring 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){//请求失败Console.WriteLine("CosClientException: " + clientEx);}catch (COSXML.CosException.CosServerException serverEx){//请求失败Console.WriteLine("CosServerException: " + serverEx.GetInfo());}
try{string inventoryId = "aInventoryId";// 存储桶名称,此处填入格式必须为 bucketname-APPID, 其中 APPID 获取参考 https://console.tencentcloud.com/developerstring bucket = "examplebucket-1250000000";DeleteBucketInventoryRequest deleteRequest = new DeleteBucketInventoryRequest(bucket);deleteRequest.SetInventoryId(inventoryId);DeleteBucketInventoryResult deleteResult = cosXml.DeleteBucketInventory(deleteRequest);//请求成功Console.WriteLine(deleteResult.GetResultInfo());}catch (COSXML.CosException.CosClientException clientEx){//请求失败Console.WriteLine("CosClientException: " + clientEx);}catch (COSXML.CosException.CosServerException serverEx){//请求失败Console.WriteLine("CosServerException: " + serverEx.GetInfo());}
本页内容是否解决了您的问题?