Search in sources :

Example 1 with DeleteBucketCorsRequest

use of software.amazon.awssdk.services.s3.model.DeleteBucketCorsRequest in project aws-doc-sdk-examples by awsdocs.

the class S3Cors method deleteBucketCorsInformation.

// snippet-start:[s3.java2.cors.main]
public static void deleteBucketCorsInformation(S3Client s3, String bucketName, String accountId) {
    try {
        DeleteBucketCorsRequest bucketCorsRequest = DeleteBucketCorsRequest.builder().bucket(bucketName).expectedBucketOwner(accountId).build();
        s3.deleteBucketCors(bucketCorsRequest);
    } catch (S3Exception e) {
        System.err.println(e.awsErrorDetails().errorMessage());
        System.exit(1);
    }
}
Also used : S3Exception(software.amazon.awssdk.services.s3.model.S3Exception) DeleteBucketCorsRequest(software.amazon.awssdk.services.s3.model.DeleteBucketCorsRequest)

Aggregations

DeleteBucketCorsRequest (software.amazon.awssdk.services.s3.model.DeleteBucketCorsRequest)1 S3Exception (software.amazon.awssdk.services.s3.model.S3Exception)1