use of software.amazon.awssdk.services.s3.model.DeleteBucketPolicyRequest in project aws-doc-sdk-examples by awsdocs.
the class DeleteBucketPolicy method deleteS3BucketPolicy.
// snippet-start:[s3.java2.delete_bucket_policy.main]
// Delete the bucket policy
public static void deleteS3BucketPolicy(S3Client s3, String bucketName) {
DeleteBucketPolicyRequest delReq = DeleteBucketPolicyRequest.builder().bucket(bucketName).build();
try {
s3.deleteBucketPolicy(delReq);
System.out.println("Done!");
} catch (S3Exception e) {
System.err.println(e.awsErrorDetails().errorMessage());
System.exit(1);
}
}
Aggregations