API | Operation | Description |
Setting versioning | Sets versioning for a bucket | |
Querying versioning | Queries the versioning information of a bucket |
// Bucket name in the format of bucketname-APPID. You can get APPID by referring to https://console.tencentcloud.com/developer.string bucket = "examplebucket-1250000000";PutBucketVersioningRequest request = new PutBucketVersioningRequest(bucket);request.IsEnableVersionConfig(true); //true: enable versioning; false: suspend versioningtry{PutBucketVersioningResult result = cosXml.PutBucketVersioning(request);Console.WriteLine(result.GetResultInfo());}catch (COSXML.CosException.CosClientException clientEx){Console.WriteLine("CosClientException: " + clientEx);}catch (COSXML.CosException.CosServerException serverEx){Console.WriteLine("CosServerException: " + serverEx.GetInfo());}
// Bucket name in the format of bucketname-APPID. You can get APPID by referring to https://console.tencentcloud.com/developer.string bucket = "examplebucket-1250000000";GetBucketVersioningRequest request = new GetBucketVersioningRequest(bucket);try{GetBucketVersioningResult result = cosXml.GetBucketVersioning(request);// Bucket lifecycle configurationVersioningConfiguration conf = result.versioningConfiguration;}catch (COSXML.CosException.CosClientException clientEx){Console.WriteLine("CosClientException: " + clientEx);}catch (COSXML.CosException.CosServerException serverEx){Console.WriteLine("CosServerException: " + serverEx.GetInfo());}
Was this page helpful?