AWS AmazonS3 documentation change
Summary
Replaced Java code example for bucket notifications with a reference link to API documentation
Security assessment
The change removes a specific implementation example in favor of linking to API reference material. No security-related content was added or modified, and there is no indication of addressing security vulnerabilities.
Diff
diff --git a/AmazonS3/latest/userguide/ways-to-add-notification-config-to-bucket.md b/AmazonS3/latest/userguide/ways-to-add-notification-config-to-bucket.md index 38af7a51d..7af31f6b2 100644 --- a//AmazonS3/latest/userguide/ways-to-add-notification-config-to-bucket.md +++ b//AmazonS3/latest/userguide/ways-to-add-notification-config-to-bucket.md @@ -304,55 +304 @@ Java -The following example shows how to add a notification configuration to a bucket. For instructions on how to create and test a working sample, see [Getting Started](https://docs.aws.amazon.com/sdk-for-java/v1/developer-guide/getting-started.html) in the AWS SDK for Java Developer Guide. - - - import com.amazonaws.AmazonServiceException; - import com.amazonaws.SdkClientException; - import com.amazonaws.auth.profile.ProfileCredentialsProvider; - import com.amazonaws.regions.Regions; - import com.amazonaws.services.s3.AmazonS3; - import com.amazonaws.services.s3.AmazonS3ClientBuilder; - import com.amazonaws.services.s3.model.*; - - import java.io.IOException; - import java.util.EnumSet; - - public class EnableNotificationOnABucket { - - public static void main(String[] args) throws IOException { - String bucketName = "*** Bucket name ***"; - Regions clientRegion = Regions.DEFAULT_REGION; - String snsTopicARN = "*** SNS Topic ARN ***"; - String sqsQueueARN = "*** SQS Queue ARN ***"; - - try { - AmazonS3 s3Client = AmazonS3ClientBuilder.standard() - .withCredentials(new ProfileCredentialsProvider()) - .withRegion(clientRegion) - .build(); - BucketNotificationConfiguration notificationConfiguration = new BucketNotificationConfiguration(); - - // Add an SNS topic notification. - notificationConfiguration.addConfiguration("snsTopicConfig", - new TopicConfiguration(snsTopicARN, EnumSet.of(S3Event.ObjectCreated))); - - // Add an SQS queue notification. - notificationConfiguration.addConfiguration("sqsQueueConfig", - new QueueConfiguration(sqsQueueARN, EnumSet.of(S3Event.ObjectCreated))); - - // Create the notification configuration request and set the bucket notification - // configuration. - SetBucketNotificationConfigurationRequest request = new SetBucketNotificationConfigurationRequest( - bucketName, notificationConfiguration); - s3Client.setBucketNotificationConfiguration(request); - } catch (AmazonServiceException e) { - // The call was transmitted successfully, but Amazon S3 couldn't process - // it, so it returned an error response. - e.printStackTrace(); - } catch (SdkClientException e) { - // Amazon S3 couldn't be contacted for a response, or the client - // couldn't parse the response from Amazon S3. - e.printStackTrace(); - } - } - } - - +For examples of how to configure bucket notifications with the AWS SDK for Java, see [Process S3 event notifications](https://docs.aws.amazon.com/AmazonS3/latest/API/s3_example_s3_Scenario_ProcessS3EventNotification_section.html) in the _Amazon S3 API Reference_.