software.amazon.awscdk.services.ses.actions.SnsProps Maven / Gradle / Ivy
Show all versions of ses-actions Show documentation
package software.amazon.awscdk.services.ses.actions;
/**
* Construction properties for a SNS action.
*
* Example:
*
*
* import software.amazon.awscdk.services.s3.*;
* import software.amazon.awscdk.services.ses.actions.*;
* Bucket bucket = new Bucket(this, "Bucket");
* Topic topic = new Topic(this, "Topic");
* ReceiptRuleSet.Builder.create(this, "RuleSet")
* .rules(List.of(ReceiptRuleOptions.builder()
* .recipients(List.of("hello@aws.com"))
* .actions(List.of(
* AddHeader.Builder.create()
* .name("X-Special-Header")
* .value("aws")
* .build(),
* S3.Builder.create()
* .bucket(bucket)
* .objectKeyPrefix("emails/")
* .topic(topic)
* .build()))
* .build(), ReceiptRuleOptions.builder()
* .recipients(List.of("aws.com"))
* .actions(List.of(
* Sns.Builder.create()
* .topic(topic)
* .build()))
* .build()))
* .build();
*
*/
@javax.annotation.Generated(value = "jsii-pacmak/1.72.0 (build 4b8828b)", date = "2022-12-14T20:30:51.557Z")
@software.amazon.jsii.Jsii(module = software.amazon.awscdk.services.ses.actions.$Module.class, fqn = "@aws-cdk/aws-ses-actions.SnsProps")
@software.amazon.jsii.Jsii.Proxy(SnsProps.Jsii$Proxy.class)
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Stable)
public interface SnsProps extends software.amazon.jsii.JsiiSerializable {
/**
* The SNS topic to notify.
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Stable)
@org.jetbrains.annotations.NotNull software.amazon.awscdk.services.sns.ITopic getTopic();
/**
* The encoding to use for the email within the Amazon SNS notification.
*
* Default: UTF-8
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Stable)
default @org.jetbrains.annotations.Nullable software.amazon.awscdk.services.ses.actions.EmailEncoding getEncoding() {
return null;
}
/**
* @return a {@link Builder} of {@link SnsProps}
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Stable)
static Builder builder() {
return new Builder();
}
/**
* A builder for {@link SnsProps}
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Stable)
public static final class Builder implements software.amazon.jsii.Builder {
software.amazon.awscdk.services.sns.ITopic topic;
software.amazon.awscdk.services.ses.actions.EmailEncoding encoding;
/**
* Sets the value of {@link SnsProps#getTopic}
* @param topic The SNS topic to notify. This parameter is required.
* @return {@code this}
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Stable)
public Builder topic(software.amazon.awscdk.services.sns.ITopic topic) {
this.topic = topic;
return this;
}
/**
* Sets the value of {@link SnsProps#getEncoding}
* @param encoding The encoding to use for the email within the Amazon SNS notification.
* @return {@code this}
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Stable)
public Builder encoding(software.amazon.awscdk.services.ses.actions.EmailEncoding encoding) {
this.encoding = encoding;
return this;
}
/**
* Builds the configured instance.
* @return a new instance of {@link SnsProps}
* @throws NullPointerException if any required attribute was not provided
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Stable)
@Override
public SnsProps build() {
return new Jsii$Proxy(this);
}
}
/**
* An implementation for {@link SnsProps}
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Stable)
@software.amazon.jsii.Internal
final class Jsii$Proxy extends software.amazon.jsii.JsiiObject implements SnsProps {
private final software.amazon.awscdk.services.sns.ITopic topic;
private final software.amazon.awscdk.services.ses.actions.EmailEncoding encoding;
/**
* Constructor that initializes the object based on values retrieved from the JsiiObject.
* @param objRef Reference to the JSII managed object.
*/
protected Jsii$Proxy(final software.amazon.jsii.JsiiObjectRef objRef) {
super(objRef);
this.topic = software.amazon.jsii.Kernel.get(this, "topic", software.amazon.jsii.NativeType.forClass(software.amazon.awscdk.services.sns.ITopic.class));
this.encoding = software.amazon.jsii.Kernel.get(this, "encoding", software.amazon.jsii.NativeType.forClass(software.amazon.awscdk.services.ses.actions.EmailEncoding.class));
}
/**
* Constructor that initializes the object based on literal property values passed by the {@link Builder}.
*/
protected Jsii$Proxy(final Builder builder) {
super(software.amazon.jsii.JsiiObject.InitializationMode.JSII);
this.topic = java.util.Objects.requireNonNull(builder.topic, "topic is required");
this.encoding = builder.encoding;
}
@Override
public final software.amazon.awscdk.services.sns.ITopic getTopic() {
return this.topic;
}
@Override
public final software.amazon.awscdk.services.ses.actions.EmailEncoding getEncoding() {
return this.encoding;
}
@Override
@software.amazon.jsii.Internal
public com.fasterxml.jackson.databind.JsonNode $jsii$toJson() {
final com.fasterxml.jackson.databind.ObjectMapper om = software.amazon.jsii.JsiiObjectMapper.INSTANCE;
final com.fasterxml.jackson.databind.node.ObjectNode data = com.fasterxml.jackson.databind.node.JsonNodeFactory.instance.objectNode();
data.set("topic", om.valueToTree(this.getTopic()));
if (this.getEncoding() != null) {
data.set("encoding", om.valueToTree(this.getEncoding()));
}
final com.fasterxml.jackson.databind.node.ObjectNode struct = com.fasterxml.jackson.databind.node.JsonNodeFactory.instance.objectNode();
struct.set("fqn", om.valueToTree("@aws-cdk/aws-ses-actions.SnsProps"));
struct.set("data", data);
final com.fasterxml.jackson.databind.node.ObjectNode obj = com.fasterxml.jackson.databind.node.JsonNodeFactory.instance.objectNode();
obj.set("$jsii.struct", struct);
return obj;
}
@Override
public final boolean equals(final Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
SnsProps.Jsii$Proxy that = (SnsProps.Jsii$Proxy) o;
if (!topic.equals(that.topic)) return false;
return this.encoding != null ? this.encoding.equals(that.encoding) : that.encoding == null;
}
@Override
public final int hashCode() {
int result = this.topic.hashCode();
result = 31 * result + (this.encoding != null ? this.encoding.hashCode() : 0);
return result;
}
}
}