API | 操作名 | 操作描述 |
设置存储桶复制 | 设置存储桶的存储桶复制规则 | |
查询存储桶复制 | 查询存储桶的存储桶复制规则 | |
删除存储桶复制 | 删除存储桶的存储桶复制规则 |
public void setBucketReplicationConfiguration(SetBucketReplicationConfigurationRequest setBucketReplicationConfigurationRequest)throws CosClientException, CosServiceException;
// 源存储桶名称,需包含 appidString bucketName = "examplebucket-1250000000";BucketReplicationConfiguration bucketReplicationConfiguration = new BucketReplicationConfiguration();// 设置发起者身份, 格式为: qcs::cam::uin/<OwnerUin>:uin/<SubUin>bucketReplicationConfiguration.setRoleName("qcs::cam::uin/100000000001:uin/100000000001");// 设置目标存储桶和存储类型,QCS 的格式为:qcs::cos:[region]::[bucketname-AppId]ReplicationDestinationConfig replicationDestinationConfig = new ReplicationDestinationConfig();replicationDestinationConfig.setBucketQCS("qcs::cos:ap-beijing::destinationbucket-1250000000");replicationDestinationConfig.setStorageClass(StorageClass.Standard);// 设置规则状态和前缀ReplicationRule replicationRule = new ReplicationRule();replicationRule.setStatus(ReplicationRuleStatus.Enabled);replicationRule.setPrefix("");replicationRule.setDestinationConfig(replicationDestinationConfig);// 添加规则String ruleId = "replication-to-beijing";bucketReplicationConfiguration.addRule(replicationRule);SetBucketReplicationConfigurationRequest setBucketReplicationConfigurationRequest =new SetBucketReplicationConfigurationRequest(bucketName, bucketReplicationConfiguration);cosClient.setBucketReplicationConfiguration(setBucketReplicationConfigurationRequest);
参数名 | 参数描述 | 类型 |
bucketName | 存储桶的命名格式为 BucketName-APPID,详情请参见 命名规范 | String |
setBucketReplicationConfigurationRequest | 存储桶复制配置 | SetBucketReplicationConfigurationRequest |
// 获取存储桶存储桶复制配置方法1public BucketReplicationConfiguration getBucketReplicationConfiguration(String bucketName)throws CosClientException, CosServiceException;// 获取存储桶存储桶复制方法2public BucketReplicationConfiguration getBucketReplicationConfiguration(GetBucketReplicationConfigurationRequest getBucketReplicationConfigurationRequest)throws CosClientException, CosServiceException;
String bucketName = "examplebucket-1250000000";// 获取存储桶存储桶复制配置方法1BucketReplicationConfiguration brcfRet = cosClient.getBucketReplicationConfiguration(bucketName);// 获取存储桶存储桶复制配置方法2BucketReplicationConfiguration brcfRet2 = cosClient.getBucketReplicationConfiguration(new GetBucketReplicationConfigurationRequest(bucketName));
参数名 | 参数描述 | 类型 |
bucketName | 存储桶的命名格式为 BucketName-APPID,详情请参见 命名规范 | String |
getBucketReplicationConfigurationRequest | 获取存储桶复制配置请求 | GetBucketReplicationConfigurationRequest |
// 删除存储桶存储桶复制配置方法1public void deleteBucketReplicationConfiguration(String bucketName)throws CosClientException, CosServiceException;// 删除存储桶存储桶复制方法2public void deleteBucketReplicationConfiguration(DeleteBucketReplicationConfigurationRequest deleteBucketReplicationConfigurationRequest)throws CosClientException, CosServiceException;
String bucketName = "examplebucket-1250000000";// 删除存储桶存储桶复制配置方法1cosClient.deleteBucketReplicationConfiguration(bucketName);// 删除存储桶存储桶复制配置方法2cosClient.deleteBucketReplicationConfiguration(new DeleteBucketReplicationConfigurationRequest(bucketName));
参数名 | 参数描述 | 类型 |
bucketName | 存储桶的命名格式为 BucketName-APPID,详情请参见 命名规范 | String |
deleteBucketReplicationConfigurationRequest | 删除存储桶复制配置请求 | DeleteBucketReplicationConfigurationRequest |
本页内容是否解决了您的问题?