Interface CfnBucket.NotificationConfigurationProperty

All Superinterfaces:
software.amazon.jsii.JsiiSerializable
All Known Implementing Classes:
CfnBucket.NotificationConfigurationProperty.Jsii$Proxy
Enclosing class:
CfnBucket

@Stability(Stable) public static interface CfnBucket.NotificationConfigurationProperty extends software.amazon.jsii.JsiiSerializable
Describes the notification configuration for an Amazon S3 bucket.

If you create the target resource and related permissions in the same template, you might have a circular dependency.

For example, you might use the AWS::Lambda::Permission resource to grant the bucket permission to invoke an AWS Lambda function. However, AWS CloudFormation can't create the bucket until the bucket has permission to invoke the function ( AWS CloudFormation checks whether the bucket can invoke the function). If you're using Refs to pass the bucket name, this leads to a circular dependency.

To avoid this dependency, you can create all resources without specifying the notification configuration. Then, update the stack with a notification configuration.

For more information on permissions, see AWS::Lambda::Permission and Granting Permissions to Publish Event Notification Messages to a Destination .

Example:

 // The code below shows an example of how to instantiate this type.
 // The values are placeholders you should change.
 import software.amazon.awscdk.services.s3.*;
 NotificationConfigurationProperty notificationConfigurationProperty = NotificationConfigurationProperty.builder()
         .eventBridgeConfiguration(EventBridgeConfigurationProperty.builder()
                 .eventBridgeEnabled(false)
                 .build())
         .lambdaConfigurations(List.of(LambdaConfigurationProperty.builder()
                 .event("event")
                 .function("function")
                 // the properties below are optional
                 .filter(NotificationFilterProperty.builder()
                         .s3Key(S3KeyFilterProperty.builder()
                                 .rules(List.of(FilterRuleProperty.builder()
                                         .name("name")
                                         .value("value")
                                         .build()))
                                 .build())
                         .build())
                 .build()))
         .queueConfigurations(List.of(QueueConfigurationProperty.builder()
                 .event("event")
                 .queue("queue")
                 // the properties below are optional
                 .filter(NotificationFilterProperty.builder()
                         .s3Key(S3KeyFilterProperty.builder()
                                 .rules(List.of(FilterRuleProperty.builder()
                                         .name("name")
                                         .value("value")
                                         .build()))
                                 .build())
                         .build())
                 .build()))
         .topicConfigurations(List.of(TopicConfigurationProperty.builder()
                 .event("event")
                 .topic("topic")
                 // the properties below are optional
                 .filter(NotificationFilterProperty.builder()
                         .s3Key(S3KeyFilterProperty.builder()
                                 .rules(List.of(FilterRuleProperty.builder()
                                         .name("name")
                                         .value("value")
                                         .build()))
                                 .build())
                         .build())
                 .build()))
         .build();
 
  • Method Details

    • getEventBridgeConfiguration

      @Stability(Stable) @Nullable default Object getEventBridgeConfiguration()
      Enables delivery of events to Amazon EventBridge.
    • getLambdaConfigurations

      @Stability(Stable) @Nullable default Object getLambdaConfigurations()
      Describes the AWS Lambda functions to invoke and the events for which to invoke them.
    • getQueueConfigurations

      @Stability(Stable) @Nullable default Object getQueueConfigurations()
      The Amazon Simple Queue Service queues to publish messages to and the events for which to publish messages.
    • getTopicConfigurations

      @Stability(Stable) @Nullable default Object getTopicConfigurations()
      The topic to which notifications are sent and the events for which notifications are generated.
    • builder

      @Stability(Stable) static CfnBucket.NotificationConfigurationProperty.Builder builder()
      Returns:
      a CfnBucket.NotificationConfigurationProperty.Builder of CfnBucket.NotificationConfigurationProperty