API | 操作名 | 操作描述 |
设置存储桶复制 | 设置存储桶的存储桶复制规则 | |
查询存储桶复制 | 查询存储桶的存储桶复制规则 | |
删除存储桶复制 | 删除存储桶的存储桶复制规则 |
// 存储桶名称,此处填入格式必须为 bucketname-APPID, 其中 APPID 获取参考 https://console.tencentcloud.com/developerstring bucket = "examplebucket-1250000000";string ownerUin = "100000000001"; //发起者身份标示: OwnerUinstring subUin = "100000000001"; //发起者身份标示: SubUinPutBucketReplicationRequest request = new PutBucketReplicationRequest(bucket);//设置 replicationPutBucketReplicationRequest.RuleStruct ruleStruct =new PutBucketReplicationRequest.RuleStruct();ruleStruct.id = "replication_01"; //用来标注具体 Rule 的名称ruleStruct.isEnable = true; //标识 Rule 是否生效 :true, 生效; false, 不生效ruleStruct.appid = "1250000000"; //APPIDruleStruct.region = "ap-beijing"; //目标存储桶地域信息ruleStruct.bucket = "destinationbucket-1250000000"; //格式:BucketName-APPIDruleStruct.prefix = "34"; //前缀匹配策略List<PutBucketReplicationRequest.RuleStruct> ruleStructs =new List<PutBucketReplicationRequest.RuleStruct>();ruleStructs.Add(ruleStruct);request.SetReplicationConfiguration(ownerUin, subUin, ruleStructs);try{PutBucketReplicationResult result = cosXml.PutBucketReplication(request);Console.WriteLine(result.GetResultInfo());}catch (COSXML.CosException.CosClientException clientEx){Console.WriteLine("CosClientException: " + clientEx);}catch (COSXML.CosException.CosServerException serverEx){Console.WriteLine("CosServerException: " + serverEx.GetInfo());}
// 存储桶名称,此处填入格式必须为 bucketname-APPID, 其中 APPID 获取参考 https://console.tencentcloud.com/developerstring bucket = "examplebucket-1250000000";GetBucketReplicationRequest request = new GetBucketReplicationRequest(bucket);try{GetBucketReplicationResult result = cosXml.GetBucketReplication(request);// 存储桶的跨区域复制配置ReplicationConfiguration conf = result.replicationConfiguration;}catch (COSXML.CosException.CosClientException clientEx){Console.WriteLine("CosClientException: " + clientEx);}catch (COSXML.CosException.CosServerException serverEx){Console.WriteLine("CosServerException: " + serverEx.GetInfo());}
// 存储桶名称,此处填入格式必须为 bucketname-APPID, 其中 APPID 获取参考 https://console.tencentcloud.com/developerstring bucket = "examplebucket-1250000000";DeleteBucketReplicationRequest request = new DeleteBucketReplicationRequest(bucket);try{DeleteBucketReplicationResult result = cosXml.DeleteBucketReplication(request);Console.WriteLine(result.GetResultInfo());}catch (COSXML.CosException.CosClientException clientEx){Console.WriteLine("CosClientException: " + clientEx);}catch (COSXML.CosException.CosServerException serverEx){Console.WriteLine("CosServerException: " + serverEx.GetInfo());}
本页内容是否解决了您的问题?