See: Description
| Enum | Description |
|---|---|
| ReceiptFilterPolicy |
(experimental) The policy for the receipt filter.
|
| TlsPolicy |
(experimental) The type of TLS policy for a receipt rule.
|
---
All classes with the
Cfnprefix in this module (CFN Resources) are always stable and safe to use.
The APIs of higher level constructs in this module are experimental and under active development. They are subject to non-backward compatible changes or removal in any future version. These are not subject to the Semantic Versioning model and breaking changes will be announced in the release notes. This means that while you may use them, you may need to update your source code when upgrading to a newer version of this package.
This module is part of the AWS Cloud Development Kit project.
Create a receipt rule set with rules and actions (actions can be found in the
@aws-cdk/aws-ses-actions package):
// Example automatically generated without compilation. See https://github.com/aws/jsii/issues/826
import software.amazon.awscdk.services.s3.*;
import software.amazon.awscdk.services.ses.*;
import software.amazon.awscdk.services.ses.actions.*;
import software.amazon.awscdk.services.sns.*;
Bucket bucket = new Bucket(stack, "Bucket");
Topic topic = new Topic(stack, "Topic");
new ReceiptRuleSet(stack, "RuleSet", new ReceiptRuleSetProps()
.rules(asList(new ReceiptRuleOptions()
.recipients(asList("hello@aws.com"))
.actions(asList(
new AddHeader(new AddHeaderProps()
.name("X-Special-Header")
.value("aws")),
new S3(new S3Props()
.bucket(bucket)
.objectKeyPrefix("emails/")
.topic(topic)))), new ReceiptRuleOptions()
.recipients(asList("aws.com"))
.actions(asList(
new Sns(new SnsProps()
.topic(topic)))))));
Alternatively, rules can be added to a rule set:
// Example automatically generated without compilation. See https://github.com/aws/jsii/issues/826
Object ruleSet = new ReceiptRuleSet(this, "RuleSet");
Object awsRule = ruleSet.addRule("Aws", Map.of(
"recipients", asList("aws.com")));
And actions to rules:
// Example automatically generated without compilation. See https://github.com/aws/jsii/issues/826
awsRule.addAction(Sns.Builder.create()
.topic(topic)
.build());
When using addRule, the new rule is added after the last added rule unless after is specified.
A rule to drop spam can be added by setting dropSpam to true:
// Example automatically generated without compilation. See https://github.com/aws/jsii/issues/826
ReceiptRuleSet.Builder.create(this, "RuleSet")
.dropSpam(true)
.build();
This will add a rule at the top of the rule set with a Lambda action that stops processing messages that have at least one spam indicator. See Lambda Function Examples.
Create a receipt filter:
// Example automatically generated without compilation. See https://github.com/aws/jsii/issues/826
ReceiptFilter.Builder.create(this, "Filter")
.ip("1.2.3.4/16")
.build();
A white list filter is also available:
// Example automatically generated without compilation. See https://github.com/aws/jsii/issues/826
WhiteListReceiptFilter.Builder.create(this, "WhiteList")
.ips(asList("10.0.0.0/16", "1.2.3.4/16"))
.build();
This will first create a block all filter and then create allow filters for the listed ip addresses.
Copyright © 2021. All rights reserved.