public class BucketNotificationConfiguration extends Object
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.
Modifier and Type | Class and Description |
---|---|
static class |
BucketNotificationConfiguration.TopicConfiguration
Deprecated.
Use
TopicConfiguration
instead |
Constructor and Description |
---|
BucketNotificationConfiguration()
Creates a new bucket notification configuration.
|
BucketNotificationConfiguration(Collection<BucketNotificationConfiguration.TopicConfiguration> topicConfigurations)
Deprecated.
|
BucketNotificationConfiguration(String name,
NotificationConfiguration notificationConfiguration)
Creates a new bucket notification configuration with the given configuration.
|
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.
public BucketNotificationConfiguration(String name, NotificationConfiguration notificationConfiguration)
Creates a new bucket notification configuration with the given configuration.
name
- the name for the configurationnotificationConfiguration
- the notification configuration for the Amazon S3 bucket.public BucketNotificationConfiguration(Collection<BucketNotificationConfiguration.TopicConfiguration> topicConfigurations)
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.
public BucketNotificationConfiguration withNotificationConfiguration(Map<String,NotificationConfiguration> notificationConfiguration)
notificationConfiguration
- the notification configurations to setBucketNotificationConfiguration
object.public BucketNotificationConfiguration addConfiguration(String name, NotificationConfiguration notificationConfiguration)
BucketNotificationConfiguration
objectname
- the name of the configurationnotificationConfiguration
- the notification configuration for the Amazon S3 bucket.BucketNotificationConfiguration
object.public Map<String,NotificationConfiguration> getConfigurations()
public void setConfigurations(Map<String,NotificationConfiguration> configurations)
BucketNotificationConfiguration
object.configurations
- the notification configurations to setpublic NotificationConfiguration getConfigurationByName(String name)
name
- the name of the notification configurationNotificationConfiguration
associated with the given name.public NotificationConfiguration removeConfiguration(String name)
Removes the notification configuration for the given name in the
BucketNotificationConfiguration
object.
Pass the updated BucketNotificationConfiguration
to
AmazonS3.setBucketNotificationConfiguration(String,BucketNotificationConfiguration)
to update the configuration in Amazon S3 for the bucket.
name
- the name of the notification configurationNotificationConfiguration
associated with the given name.public BucketNotificationConfiguration withTopicConfigurations(BucketNotificationConfiguration.TopicConfiguration... topicConfigurations)
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.
topicConfigurations
- A set of topic configurations.BucketNotificationConfiguration
object,
enabling additional method calls to be chained together.withNotificationConfiguration(Map)
public void setTopicConfigurations(Collection<BucketNotificationConfiguration.TopicConfiguration> topicConfigurations)
Sets the BucketNotificationConfiguration.TopicConfiguration
.
Calling this method will overwrite any
previously set TopicConfigurations
for this object.
topicConfigurations
- A collection of topic configurations.setConfigurations(Map)
public List<BucketNotificationConfiguration.TopicConfiguration> getTopicConfigurations()
Gets the list of
BucketNotificationConfiguration.TopicConfiguration
objects
contained in this object. This method may return an empty list if no
TopicConfiguration
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()
TopicConfiguration
objects contained in
this object. May return an empty list.getConfigurations()
Copyright © 2014. All rights reserved.