Class LambdaSubscription
Use a Lambda function as a subscription target.
Inheritance
System.Object
LambdaSubscription
Implements
Namespace: Amazon.CDK.AWS.SNS.Subscriptions
Assembly: Amazon.CDK.AWS.SNS.Subscriptions.dll
Syntax (csharp)
public class LambdaSubscription : DeputyBase, ITopicSubscription
Syntax (vb)
Public Class LambdaSubscription
Inherits DeputyBase
Implements ITopicSubscription
Remarks
ExampleMetadata: infused
Examples
using Amazon.CDK.AWS.Lambda;
Function fn;
var myTopic = new Topic(this, "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(new LambdaSubscription(fn, new LambdaSubscriptionProps {
FilterPolicy = new Dictionary<string, SubscriptionFilter> {
{ "color", SubscriptionFilter.StringFilter(new StringConditions {
Allowlist = new [] { "red", "orange" },
MatchPrefixes = new [] { "bl" }
}) },
{ "size", SubscriptionFilter.StringFilter(new StringConditions {
Denylist = new [] { "small", "medium" }
}) },
{ "price", SubscriptionFilter.NumericFilter(new NumericConditions {
Between = new BetweenCondition { Start = 100, Stop = 200 },
GreaterThan = 300
}) },
{ "store", SubscriptionFilter.ExistsFilter() }
}
}));
Synopsis
Constructors
LambdaSubscription(IFunction, ILambdaSubscriptionProps) | |
LambdaSubscription(ByRefValue) | Used by jsii to construct an instance of this class from a Javascript-owned object reference |
LambdaSubscription(DeputyBase.DeputyProps) | Used by jsii to construct an instance of this class from DeputyProps |
Methods
Bind(ITopic) | Returns a configuration for a Lambda function to subscribe to an SNS topic. |
Constructors
LambdaSubscription(IFunction, ILambdaSubscriptionProps)
public LambdaSubscription(IFunction fn, ILambdaSubscriptionProps props = null)
Parameters
- fn IFunction
- props ILambdaSubscriptionProps
LambdaSubscription(ByRefValue)
Used by jsii to construct an instance of this class from a Javascript-owned object reference
protected LambdaSubscription(ByRefValue reference)
Parameters
- reference Amazon.JSII.Runtime.Deputy.ByRefValue
The Javascript-owned object reference
LambdaSubscription(DeputyBase.DeputyProps)
Used by jsii to construct an instance of this class from DeputyProps
protected LambdaSubscription(DeputyBase.DeputyProps props)
Parameters
- props Amazon.JSII.Runtime.Deputy.DeputyBase.DeputyProps
The deputy props
Methods
Bind(ITopic)
Returns a configuration for a Lambda function to subscribe to an SNS topic.
public virtual ITopicSubscriptionConfig Bind(ITopic topic)
Parameters
- topic ITopic
Returns