Class BucketNotificationConfiguration
- All Implemented Interfaces:
Serializable
Represents a bucket's notification configuration. The notification configuration is used to control reception of notifications for specific events for Amazon S3 buckets.
Using SNS as the delivery service, the notification configuration of an Amazon S3 bucket provides near real-time notifications of events the user is interested in. Notification is turned on by enabling configuration on a bucket, specifying the events and the SNS topic. This configuration can only be turned on by the bucket owner.
If a notification configuration already exists for the
specified bucket, the new notification configuration will replace the existing
notification configuration. To remove a notification configuration, pass an
an empty configuration directly to
AmazonS3.setBucketNotificationConfiguration(String,BucketNotificationConfiguration)
.
Note: Currently buckets may only have a single event and topic configuration.
- See Also:
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic class
Deprecated. -
Constructor Summary
ConstructorsConstructorDescriptionCreates a new bucket notification configuration.BucketNotificationConfiguration
(String name, NotificationConfiguration notificationConfiguration) Creates a new bucket notification configuration with the given configuration.BucketNotificationConfiguration
(Collection<BucketNotificationConfiguration.TopicConfiguration> topicConfigurations) Deprecated. -
Method Summary
Modifier and TypeMethodDescriptionaddConfiguration
(String name, NotificationConfiguration notificationConfiguration) Adds the given notification configuration to theBucketNotificationConfiguration
objectgetConfigurationByName
(String name) Returns the notification configuration for the given name.Returns all the notification configurations associated with the Amazon S3 bucket.Deprecated.removeConfiguration
(String name) Removes the notification configuration for the given name in theBucketNotificationConfiguration
object.void
setConfigurations
(Map<String, NotificationConfiguration> configurations) Sets the given notification configurations in thisBucketNotificationConfiguration
object.void
setTopicConfigurations
(Collection<BucketNotificationConfiguration.TopicConfiguration> topicConfigurations) Deprecated.toString()
withNotificationConfiguration
(Map<String, NotificationConfiguration> notificationConfiguration) Sets the given notification configurations and returns this object.withTopicConfigurations
(BucketNotificationConfiguration.TopicConfiguration... topicConfigurations) Deprecated.
-
Constructor Details
-
BucketNotificationConfiguration
public BucketNotificationConfiguration()Creates a new bucket notification configuration. By default, the newly created configuration is empty.
Passing the new configuration directly to
AmazonS3.setBucketNotificationConfiguration(String,BucketNotificationConfiguration)
will remove any existing bucket notification configuration.- See Also:
-
BucketNotificationConfiguration
public BucketNotificationConfiguration(String name, NotificationConfiguration notificationConfiguration) Creates a new bucket notification configuration with the given configuration.
- Parameters:
name
- the name for the configurationnotificationConfiguration
- the notification configuration for the Amazon S3 bucket.
-
BucketNotificationConfiguration
public BucketNotificationConfiguration(Collection<BucketNotificationConfiguration.TopicConfiguration> topicConfigurations) Deprecated.Creates a new bucket notification configuration containing the specified
TopicConfigurations
.Passing the new configuration directly to
AmazonS3.setBucketNotificationConfiguration(String,BucketNotificationConfiguration)
will set the bucket's notification configuration and overwrite any existing configuration.- See Also:
-
-
Method Details
-
withNotificationConfiguration
public BucketNotificationConfiguration withNotificationConfiguration(Map<String, NotificationConfiguration> notificationConfiguration) Sets the given notification configurations and returns this object.- Parameters:
notificationConfiguration
- the notification configurations to set- Returns:
- The updated
BucketNotificationConfiguration
object.
-
addConfiguration
public BucketNotificationConfiguration addConfiguration(String name, NotificationConfiguration notificationConfiguration) Adds the given notification configuration to theBucketNotificationConfiguration
object- Parameters:
name
- the name of the configurationnotificationConfiguration
- the notification configuration for the Amazon S3 bucket.- Returns:
- The updated
BucketNotificationConfiguration
object.
-
getConfigurations
Returns all the notification configurations associated with the Amazon S3 bucket. -
setConfigurations
Sets the given notification configurations in thisBucketNotificationConfiguration
object.- Parameters:
configurations
- the notification configurations to set
-
getConfigurationByName
Returns the notification configuration for the given name.- Parameters:
name
- the name of the notification configuration- Returns:
NotificationConfiguration
associated with the given name.
-
removeConfiguration
Removes the notification configuration for the given name in the
BucketNotificationConfiguration
object.Pass the updated
BucketNotificationConfiguration
toAmazonS3.setBucketNotificationConfiguration(String,BucketNotificationConfiguration)
to update the configuration in Amazon S3 for the bucket.- Parameters:
name
- the name of the notification configuration- Returns:
NotificationConfiguration
associated with the given name.
-
withTopicConfigurations
public BucketNotificationConfiguration withTopicConfigurations(BucketNotificationConfiguration.TopicConfiguration... topicConfigurations) Deprecated.Sets the
BucketNotificationConfiguration.TopicConfiguration
TopicConfigurations
and returns this object, enabling additional method calls to be chained together.Calling this method will overwrite any previously set
TopicConfigurations
for this object.- Parameters:
topicConfigurations
- A set of topic configurations.- Returns:
- The updated
BucketNotificationConfiguration
object, enabling additional method calls to be chained together. - See Also:
-
setTopicConfigurations
public void setTopicConfigurations(Collection<BucketNotificationConfiguration.TopicConfiguration> topicConfigurations) Deprecated.Sets the
BucketNotificationConfiguration.TopicConfiguration
.Calling this method will overwrite any previously set
TopicConfigurations
for this object.- Parameters:
topicConfigurations
- A collection of topic configurations.- See Also:
-
getTopicConfigurations
Deprecated.Gets the list of
BucketNotificationConfiguration.TopicConfiguration
objects contained in this object. This method may return an empty list if noTopicConfiguration
objects are present.This method is deprecated and will not return all the notification configuration associated with the Amazon S3 bucket. To retrieve all the configuration use @see BucketNotificationConfiguration#getConfigurations()
- Returns:
- The list of
TopicConfiguration
objects contained in this object. May return an empty list. - See Also:
-
toString
-
TopicConfiguration
instead