原图保护
更新时间:2022-09-14
若用户想开启Bucket的原图保护功能,则如下代码可以做到:
参数 | 说明 |
---|---|
resource | 表示生效的资源范围 |
public void PutBucketCopyrightProtection(BosClient client, String bucketName, List<String> resource) {
SetBucketCopyrightProtectionRequest request = new SetBucketCopyrightProtectionRequest();
request.setBucketName(bucketName);
request.setResource(resource);
client.setBucketCopyrightProtection(request);
}
若用户想获取某个Bucket的原图保护配置情况,则如下代码可以做到:
public GetBucketCopyrightProtectionResponse GetBucketCopyrightProtection(BosClient client, String bucketName) {
GetBucketCopyrightProtectionRequest getBucketCopyrightProtectionRequest =
new GetBucketCopyrightProtectionRequest();
getBucketCopyrightProtectionRequest.withBucketName(bucketName);
GetBucketCopyrightProtectionResponse resp = new GetBucketCopyrightProtectionResponse();
resp = client.getBucketCopyrightProtection(getBucketCopyrightProtectionRequest);
return resp;
}
若用户想关闭原图保护功能,则如下代码可以做到:
public void DeleteBucketCopyrightProtection(BosClient client, String bucketName) {
DeleteBucketCopyrightProtectionRequest deleteBucketCopyrightProtectionRequest =
new DeleteBucketCopyrightProtectionRequest();
deleteBucketCopyrightProtectionRequest.withBucketName(bucketName);
client.deleteBucketCopyrightProtection(deleteBucketCopyrightProtectionRequest);
}