public class BucketNotificationConfiguration
extends java.lang.Object
implements java.io.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.
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(java.util.Collection<BucketNotificationConfiguration.TopicConfiguration> topicConfigurations)
Deprecated.
|
BucketNotificationConfiguration(java.lang.String name,
NotificationConfiguration notificationConfiguration)
Creates a new bucket notification configuration with the given
configuration.
|
Modifier and Type | Method and Description |
---|---|
BucketNotificationConfiguration |
addConfiguration(java.lang.String name,
NotificationConfiguration notificationConfiguration)
Adds the given notification configuration to the
BucketNotificationConfiguration object |
NotificationConfiguration |
getConfigurationByName(java.lang.String name)
Returns the notification configuration for the given name.
|
java.util.Map<java.lang.String,NotificationConfiguration> |
getConfigurations()
Returns all the notification configurations associated with the Amazon S3
bucket.
|
java.util.List<BucketNotificationConfiguration.TopicConfiguration> |
getTopicConfigurations()
Deprecated.
|
NotificationConfiguration |
removeConfiguration(java.lang.String name)
Removes the notification configuration for the given name in the
BucketNotificationConfiguration object. |
void |
setConfigurations(java.util.Map<java.lang.String,NotificationConfiguration> configurations)
Sets the given notification configurations in this
BucketNotificationConfiguration object. |
void |
setTopicConfigurations(java.util.Collection<BucketNotificationConfiguration.TopicConfiguration> topicConfigurations)
Deprecated.
|
java.lang.String |
toString() |
BucketNotificationConfiguration |
withNotificationConfiguration(java.util.Map<java.lang.String,NotificationConfiguration> notificationConfiguration)
Sets the given notification configurations and returns this object.
|
BucketNotificationConfiguration |
withTopicConfigurations(BucketNotificationConfiguration.TopicConfiguration... topicConfigurations)
Deprecated.
|
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(java.lang.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.@Deprecated public BucketNotificationConfiguration(java.util.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(java.util.Map<java.lang.String,NotificationConfiguration> notificationConfiguration)
notificationConfiguration
- the notification configurations to setBucketNotificationConfiguration
object.public BucketNotificationConfiguration addConfiguration(java.lang.String name, NotificationConfiguration notificationConfiguration)
BucketNotificationConfiguration
objectname
- the name of the configurationnotificationConfiguration
- the notification configuration for the
Amazon S3 bucket.BucketNotificationConfiguration
object.public java.util.Map<java.lang.String,NotificationConfiguration> getConfigurations()
public void setConfigurations(java.util.Map<java.lang.String,NotificationConfiguration> configurations)
BucketNotificationConfiguration
object.configurations
- the notification configurations to setpublic NotificationConfiguration getConfigurationByName(java.lang.String name)
name
- the name of the notification configurationNotificationConfiguration
associated with the given name.public NotificationConfiguration removeConfiguration(java.lang.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.@Deprecated 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)
@Deprecated public void setTopicConfigurations(java.util.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)
@Deprecated public java.util.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()
public java.lang.String toString()
toString
in class java.lang.Object
Copyright © 2018 Amazon Web Services, Inc. All Rights Reserved.