Documentation ¶
Index ¶
- func NewEmailSubscription_Override(e EmailSubscription, emailAddress *string, props *EmailSubscriptionProps)
- func NewLambdaSubscription_Override(l LambdaSubscription, fn awslambda.IFunction, props *LambdaSubscriptionProps)
- func NewSmsSubscription_Override(s SmsSubscription, phoneNumber *string, props *SmsSubscriptionProps)
- func NewSqsSubscription_Override(s SqsSubscription, queue awssqs.IQueue, props *SqsSubscriptionProps)
- func NewUrlSubscription_Override(u UrlSubscription, url *string, props *UrlSubscriptionProps)
- type EmailSubscription
- type EmailSubscriptionProps
- type LambdaSubscription
- type LambdaSubscriptionProps
- type SmsSubscription
- type SmsSubscriptionProps
- type SqsSubscription
- type SqsSubscriptionProps
- type SubscriptionProps
- type UrlSubscription
- type UrlSubscriptionProps
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func NewEmailSubscription_Override ¶
func NewEmailSubscription_Override(e EmailSubscription, emailAddress *string, props *EmailSubscriptionProps)
func NewLambdaSubscription_Override ¶
func NewLambdaSubscription_Override(l LambdaSubscription, fn awslambda.IFunction, props *LambdaSubscriptionProps)
func NewSmsSubscription_Override ¶
func NewSmsSubscription_Override(s SmsSubscription, phoneNumber *string, props *SmsSubscriptionProps)
func NewSqsSubscription_Override ¶
func NewSqsSubscription_Override(s SqsSubscription, queue awssqs.IQueue, props *SqsSubscriptionProps)
func NewUrlSubscription_Override ¶
func NewUrlSubscription_Override(u UrlSubscription, url *string, props *UrlSubscriptionProps)
Types ¶
type EmailSubscription ¶
type EmailSubscription interface { awssns.ITopicSubscription // Returns a configuration for an email address to subscribe to an SNS topic. Bind(_topic awssns.ITopic) *awssns.TopicSubscriptionConfig }
Use an email address as a subscription target.
Email subscriptions require confirmation.
Example:
myTopic := sns.NewTopic(this, jsii.String("Topic")) emailAddress := awscdk.NewCfnParameter(this, jsii.String("email-param")) myTopic.AddSubscription(subscriptions.NewEmailSubscription(emailAddress.valueAsString))
func NewEmailSubscription ¶
func NewEmailSubscription(emailAddress *string, props *EmailSubscriptionProps) EmailSubscription
type EmailSubscriptionProps ¶
type EmailSubscriptionProps struct { // Queue to be used as dead letter queue. // // If not passed no dead letter queue is enabled. // Default: - No dead letter queue enabled. // DeadLetterQueue awssqs.IQueue `field:"optional" json:"deadLetterQueue" yaml:"deadLetterQueue"` // The filter policy. // Default: - all messages are delivered. // FilterPolicy *map[string]awssns.SubscriptionFilter `field:"optional" json:"filterPolicy" yaml:"filterPolicy"` // The filter policy that is applied on the message body. // // To apply a filter policy to the message attributes, use `filterPolicy`. A maximum of one of `filterPolicyWithMessageBody` and `filterPolicy` may be used. // Default: - all messages are delivered. // FilterPolicyWithMessageBody *map[string]awssns.FilterOrPolicy `field:"optional" json:"filterPolicyWithMessageBody" yaml:"filterPolicyWithMessageBody"` // Indicates if the full notification JSON should be sent to the email address or just the message text. // Default: false (Message text). // Json *bool `field:"optional" json:"json" yaml:"json"` }
Options for email subscriptions.
Example:
// The code below shows an example of how to instantiate this type. // The values are placeholders you should change. import "github.com/aws/aws-cdk-go/awscdk" import "github.com/aws/aws-cdk-go/awscdk" import "github.com/aws/aws-cdk-go/awscdk" var filterOrPolicy filterOrPolicy var queue queue var subscriptionFilter subscriptionFilter emailSubscriptionProps := &EmailSubscriptionProps{ DeadLetterQueue: queue, FilterPolicy: map[string]*subscriptionFilter{ "filterPolicyKey": subscriptionFilter, }, FilterPolicyWithMessageBody: map[string]*filterOrPolicy{ "filterPolicyWithMessageBodyKey": filterOrPolicy, }, Json: jsii.Boolean(false), }
type LambdaSubscription ¶
type LambdaSubscription interface { awssns.ITopicSubscription // Returns a configuration for a Lambda function to subscribe to an SNS topic. Bind(topic awssns.ITopic) *awssns.TopicSubscriptionConfig }
Use a Lambda function as a subscription target.
Example:
import lambda "github.com/aws/aws-cdk-go/awscdk" var fn function myTopic := sns.NewTopic(this, jsii.String("MyTopic")) // Lambda should receive only message matching the following conditions on message body: // color: 'red' or 'orange' myTopic.AddSubscription(subscriptions.NewLambdaSubscription(fn, &LambdaSubscriptionProps{ FilterPolicyWithMessageBody: map[string]filterOrPolicy{ "background": sns.*filterOrPolicy_policy(map[string]*filterOrPolicy{ "color": sns.*filterOrPolicy_filter(sns.SubscriptionFilter_stringFilter(&StringConditions{ "allowlist": []*string{ jsii.String("red"), jsii.String("orange"), }, })), }), }, }))
func NewLambdaSubscription ¶
func NewLambdaSubscription(fn awslambda.IFunction, props *LambdaSubscriptionProps) LambdaSubscription
type LambdaSubscriptionProps ¶
type LambdaSubscriptionProps struct { // Queue to be used as dead letter queue. // // If not passed no dead letter queue is enabled. // Default: - No dead letter queue enabled. // DeadLetterQueue awssqs.IQueue `field:"optional" json:"deadLetterQueue" yaml:"deadLetterQueue"` // The filter policy. // Default: - all messages are delivered. // FilterPolicy *map[string]awssns.SubscriptionFilter `field:"optional" json:"filterPolicy" yaml:"filterPolicy"` // The filter policy that is applied on the message body. // // To apply a filter policy to the message attributes, use `filterPolicy`. A maximum of one of `filterPolicyWithMessageBody` and `filterPolicy` may be used. // Default: - all messages are delivered. // FilterPolicyWithMessageBody *map[string]awssns.FilterOrPolicy `field:"optional" json:"filterPolicyWithMessageBody" yaml:"filterPolicyWithMessageBody"` }
Properties for a Lambda subscription.
Example:
import lambda "github.com/aws/aws-cdk-go/awscdk" var fn function myTopic := sns.NewTopic(this, jsii.String("MyTopic")) // Lambda should receive only message matching the following conditions on attributes: // color: 'red' or 'orange' or begins with 'bl' // size: anything but 'small' or 'medium' // price: between 100 and 200 or greater than 300 // store: attribute must be present myTopic.AddSubscription(subscriptions.NewLambdaSubscription(fn, &LambdaSubscriptionProps{ FilterPolicy: map[string]subscriptionFilter{ "color": sns.*subscriptionFilter_stringFilter(&StringConditions{ "allowlist": []*string{ jsii.String("red"), jsii.String("orange"), }, "matchPrefixes": []*string{ jsii.String("bl"), }, "matchSuffixes": []*string{ jsii.String("ue"), }, }), "size": sns.*subscriptionFilter_stringFilter(&StringConditions{ "denylist": []*string{ jsii.String("small"), jsii.String("medium"), }, }), "price": sns.*subscriptionFilter_numericFilter(&NumericConditions{ "between": &BetweenCondition{ "start": jsii.Number(100), "stop": jsii.Number(200), }, "greaterThan": jsii.Number(300), }), "store": sns.*subscriptionFilter_existsFilter(), }, }))
type SmsSubscription ¶
type SmsSubscription interface { awssns.ITopicSubscription // Returns a configuration used to subscribe to an SNS topic. Bind(_topic awssns.ITopic) *awssns.TopicSubscriptionConfig }
Use an sms address as a subscription target.
Example:
myTopic := sns.NewTopic(this, jsii.String("Topic")) myTopic.AddSubscription(subscriptions.NewSmsSubscription(jsii.String("+15551231234")))
func NewSmsSubscription ¶
func NewSmsSubscription(phoneNumber *string, props *SmsSubscriptionProps) SmsSubscription
type SmsSubscriptionProps ¶
type SmsSubscriptionProps struct { // Queue to be used as dead letter queue. // // If not passed no dead letter queue is enabled. // Default: - No dead letter queue enabled. // DeadLetterQueue awssqs.IQueue `field:"optional" json:"deadLetterQueue" yaml:"deadLetterQueue"` // The filter policy. // Default: - all messages are delivered. // FilterPolicy *map[string]awssns.SubscriptionFilter `field:"optional" json:"filterPolicy" yaml:"filterPolicy"` // The filter policy that is applied on the message body. // // To apply a filter policy to the message attributes, use `filterPolicy`. A maximum of one of `filterPolicyWithMessageBody` and `filterPolicy` may be used. // Default: - all messages are delivered. // FilterPolicyWithMessageBody *map[string]awssns.FilterOrPolicy `field:"optional" json:"filterPolicyWithMessageBody" yaml:"filterPolicyWithMessageBody"` }
Options for SMS subscriptions.
Example:
// The code below shows an example of how to instantiate this type. // The values are placeholders you should change. import "github.com/aws/aws-cdk-go/awscdk" import "github.com/aws/aws-cdk-go/awscdk" import "github.com/aws/aws-cdk-go/awscdk" var filterOrPolicy filterOrPolicy var queue queue var subscriptionFilter subscriptionFilter smsSubscriptionProps := &SmsSubscriptionProps{ DeadLetterQueue: queue, FilterPolicy: map[string]*subscriptionFilter{ "filterPolicyKey": subscriptionFilter, }, FilterPolicyWithMessageBody: map[string]*filterOrPolicy{ "filterPolicyWithMessageBodyKey": filterOrPolicy, }, }
type SqsSubscription ¶
type SqsSubscription interface { awssns.ITopicSubscription // Returns a configuration for an SQS queue to subscribe to an SNS topic. Bind(topic awssns.ITopic) *awssns.TopicSubscriptionConfig }
Use an SQS queue as a subscription target.
Example:
var queue queue myTopic := sns.NewTopic(this, jsii.String("MyTopic")) myTopic.AddSubscription(subscriptions.NewSqsSubscription(queue))
func NewSqsSubscription ¶
func NewSqsSubscription(queue awssqs.IQueue, props *SqsSubscriptionProps) SqsSubscription
type SqsSubscriptionProps ¶
type SqsSubscriptionProps struct { // Queue to be used as dead letter queue. // // If not passed no dead letter queue is enabled. // Default: - No dead letter queue enabled. // DeadLetterQueue awssqs.IQueue `field:"optional" json:"deadLetterQueue" yaml:"deadLetterQueue"` // The filter policy. // Default: - all messages are delivered. // FilterPolicy *map[string]awssns.SubscriptionFilter `field:"optional" json:"filterPolicy" yaml:"filterPolicy"` // The filter policy that is applied on the message body. // // To apply a filter policy to the message attributes, use `filterPolicy`. A maximum of one of `filterPolicyWithMessageBody` and `filterPolicy` may be used. // Default: - all messages are delivered. // FilterPolicyWithMessageBody *map[string]awssns.FilterOrPolicy `field:"optional" json:"filterPolicyWithMessageBody" yaml:"filterPolicyWithMessageBody"` // The message to the queue is the same as it was sent to the topic. // // If false, the message will be wrapped in an SNS envelope. // Default: false. // RawMessageDelivery *bool `field:"optional" json:"rawMessageDelivery" yaml:"rawMessageDelivery"` }
Properties for an SQS subscription.
Example:
// The code below shows an example of how to instantiate this type. // The values are placeholders you should change. import "github.com/aws/aws-cdk-go/awscdk" import "github.com/aws/aws-cdk-go/awscdk" import "github.com/aws/aws-cdk-go/awscdk" var filterOrPolicy filterOrPolicy var queue queue var subscriptionFilter subscriptionFilter sqsSubscriptionProps := &SqsSubscriptionProps{ DeadLetterQueue: queue, FilterPolicy: map[string]*subscriptionFilter{ "filterPolicyKey": subscriptionFilter, }, FilterPolicyWithMessageBody: map[string]*filterOrPolicy{ "filterPolicyWithMessageBodyKey": filterOrPolicy, }, RawMessageDelivery: jsii.Boolean(false), }
type SubscriptionProps ¶
type SubscriptionProps struct { // Queue to be used as dead letter queue. // // If not passed no dead letter queue is enabled. // Default: - No dead letter queue enabled. // DeadLetterQueue awssqs.IQueue `field:"optional" json:"deadLetterQueue" yaml:"deadLetterQueue"` // The filter policy. // Default: - all messages are delivered. // FilterPolicy *map[string]awssns.SubscriptionFilter `field:"optional" json:"filterPolicy" yaml:"filterPolicy"` // The filter policy that is applied on the message body. // // To apply a filter policy to the message attributes, use `filterPolicy`. A maximum of one of `filterPolicyWithMessageBody` and `filterPolicy` may be used. // Default: - all messages are delivered. // FilterPolicyWithMessageBody *map[string]awssns.FilterOrPolicy `field:"optional" json:"filterPolicyWithMessageBody" yaml:"filterPolicyWithMessageBody"` }
Options to subscribing to an SNS topic.
Example:
// The code below shows an example of how to instantiate this type. // The values are placeholders you should change. import "github.com/aws/aws-cdk-go/awscdk" import "github.com/aws/aws-cdk-go/awscdk" import "github.com/aws/aws-cdk-go/awscdk" var filterOrPolicy filterOrPolicy var queue queue var subscriptionFilter subscriptionFilter subscriptionProps := &SubscriptionProps{ DeadLetterQueue: queue, FilterPolicy: map[string]*subscriptionFilter{ "filterPolicyKey": subscriptionFilter, }, FilterPolicyWithMessageBody: map[string]*filterOrPolicy{ "filterPolicyWithMessageBodyKey": filterOrPolicy, }, }
type UrlSubscription ¶
type UrlSubscription interface { awssns.ITopicSubscription // Returns a configuration for a URL to subscribe to an SNS topic. Bind(_topic awssns.ITopic) *awssns.TopicSubscriptionConfig }
Use a URL as a subscription target.
The message will be POSTed to the given URL.
Example:
myTopic := sns.NewTopic(this, jsii.String("MyTopic")) url := awscdk.NewCfnParameter(this, jsii.String("url-param")) myTopic.AddSubscription(subscriptions.NewUrlSubscription(url.valueAsString))
See: https://docs.aws.amazon.com/sns/latest/dg/sns-http-https-endpoint-as-subscriber.html
func NewUrlSubscription ¶
func NewUrlSubscription(url *string, props *UrlSubscriptionProps) UrlSubscription
type UrlSubscriptionProps ¶
type UrlSubscriptionProps struct { // Queue to be used as dead letter queue. // // If not passed no dead letter queue is enabled. // Default: - No dead letter queue enabled. // DeadLetterQueue awssqs.IQueue `field:"optional" json:"deadLetterQueue" yaml:"deadLetterQueue"` // The filter policy. // Default: - all messages are delivered. // FilterPolicy *map[string]awssns.SubscriptionFilter `field:"optional" json:"filterPolicy" yaml:"filterPolicy"` // The filter policy that is applied on the message body. // // To apply a filter policy to the message attributes, use `filterPolicy`. A maximum of one of `filterPolicyWithMessageBody` and `filterPolicy` may be used. // Default: - all messages are delivered. // FilterPolicyWithMessageBody *map[string]awssns.FilterOrPolicy `field:"optional" json:"filterPolicyWithMessageBody" yaml:"filterPolicyWithMessageBody"` // The delivery policy. // Default: - if the initial delivery of the message fails, three retries with a delay between failed attempts set at 20 seconds. // DeliveryPolicy *awssns.DeliveryPolicy `field:"optional" json:"deliveryPolicy" yaml:"deliveryPolicy"` // The subscription's protocol. // Default: - Protocol is derived from url. // Protocol awssns.SubscriptionProtocol `field:"optional" json:"protocol" yaml:"protocol"` // The message to the queue is the same as it was sent to the topic. // // If false, the message will be wrapped in an SNS envelope. // Default: false. // RawMessageDelivery *bool `field:"optional" json:"rawMessageDelivery" yaml:"rawMessageDelivery"` }
Options for URL subscriptions.
Example:
myTopic := sns.NewTopic(this, jsii.String("MyTopic")) myTopic.AddSubscription( subscriptions.NewUrlSubscription(jsii.String("https://foobar.com/"), &UrlSubscriptionProps{ DeliveryPolicy: &DeliveryPolicy{ HealthyRetryPolicy: &HealthyRetryPolicy{ MinDelayTarget: awscdk.Duration_Seconds(jsii.Number(5)), MaxDelayTarget: awscdk.Duration_*Seconds(jsii.Number(10)), NumRetries: jsii.Number(6), BackoffFunction: sns.BackoffFunction_EXPONENTIAL, }, ThrottlePolicy: &ThrottlePolicy{ MaxReceivesPerSecond: jsii.Number(10), }, RequestPolicy: &RequestPolicy{ HeaderContentType: jsii.String("application/json"), }, }, }))
Source Files ¶
- EmailSubscription.go
- EmailSubscriptionProps.go
- EmailSubscription__checks.go
- LambdaSubscription.go
- LambdaSubscriptionProps.go
- LambdaSubscription__checks.go
- SmsSubscription.go
- SmsSubscriptionProps.go
- SmsSubscription__checks.go
- SqsSubscription.go
- SqsSubscriptionProps.go
- SqsSubscription__checks.go
- SubscriptionProps.go
- UrlSubscription.go
- UrlSubscriptionProps.go
- UrlSubscription__checks.go
- main.go