Original image protection
Updated at:2025-11-03
If users want to enable the original image protection function of the bucket, the following code can achieve this:
| Parameters | Description |
|---|---|
| resource | Indicate the scope of effective resources |
Java
1public void PutBucketCopyrightProtection(BosClient client, String bucketName, List<String> resource) {
2 SetBucketCopyrightProtectionRequest request = new SetBucketCopyrightProtectionRequest();
3 request.setBucketName(bucketName);
4 request.setResource(resource);
5 client.setBucketCopyrightProtection(request);
6}
If users want to get the original image protection configuration details of the bucket, the following code can achieve this:
Java
1public GetBucketCopyrightProtectionResponse GetBucketCopyrightProtection(BosClient client, String bucketName) {
2 GetBucketCopyrightProtectionRequest getBucketCopyrightProtectionRequest =
3 new GetBucketCopyrightProtectionRequest();
4 getBucketCopyrightProtectionRequest.withBucketName(bucketName);
5 GetBucketCopyrightProtectionResponse resp = new GetBucketCopyrightProtectionResponse();
6 resp = client.getBucketCopyrightProtection(getBucketCopyrightProtectionRequest);
7 return resp;
8}
If users want to disable the original image protection function of the bucket, the following code can achieve this:
Java
1public void DeleteBucketCopyrightProtection(BosClient client, String bucketName) {
2 DeleteBucketCopyrightProtectionRequest deleteBucketCopyrightProtectionRequest =
3 new DeleteBucketCopyrightProtectionRequest();
4 deleteBucketCopyrightProtectionRequest.withBucketName(bucketName);
5 client.deleteBucketCopyrightProtection(deleteBucketCopyrightProtectionRequest);
6}
