
software.amazon.awssdk.services.ses.model.IdentityNotificationAttributes Maven / Gradle / Ivy
/*
* Copyright 2014-2019 Amazon.com, Inc. or its affiliates. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License"). You may not use this file except in compliance with
* the License. A copy of the License is located at
*
* http://aws.amazon.com/apache2.0
*
* or in the "license" file accompanying this file. This file is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
* CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions
* and limitations under the License.
*/
package software.amazon.awssdk.services.ses.model;
import java.io.Serializable;
import java.util.Arrays;
import java.util.Collections;
import java.util.List;
import java.util.Objects;
import java.util.Optional;
import java.util.function.BiConsumer;
import java.util.function.Function;
import software.amazon.awssdk.annotations.Generated;
import software.amazon.awssdk.core.SdkField;
import software.amazon.awssdk.core.SdkPojo;
import software.amazon.awssdk.core.protocol.MarshallLocation;
import software.amazon.awssdk.core.protocol.MarshallingType;
import software.amazon.awssdk.core.traits.LocationTrait;
import software.amazon.awssdk.utils.ToString;
import software.amazon.awssdk.utils.builder.CopyableBuilder;
import software.amazon.awssdk.utils.builder.ToCopyableBuilder;
/**
*
* Represents the notification attributes of an identity, including whether an identity has Amazon Simple Notification
* Service (Amazon SNS) topics set for bounce, complaint, and/or delivery notifications, and whether feedback forwarding
* is enabled for bounce and complaint notifications.
*
*/
@Generated("software.amazon.awssdk:codegen")
public final class IdentityNotificationAttributes implements SdkPojo, Serializable,
ToCopyableBuilder {
private static final SdkField BOUNCE_TOPIC_FIELD = SdkField. builder(MarshallingType.STRING)
.getter(getter(IdentityNotificationAttributes::bounceTopic)).setter(setter(Builder::bounceTopic))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("BounceTopic").build()).build();
private static final SdkField COMPLAINT_TOPIC_FIELD = SdkField. builder(MarshallingType.STRING)
.getter(getter(IdentityNotificationAttributes::complaintTopic)).setter(setter(Builder::complaintTopic))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("ComplaintTopic").build()).build();
private static final SdkField DELIVERY_TOPIC_FIELD = SdkField. builder(MarshallingType.STRING)
.getter(getter(IdentityNotificationAttributes::deliveryTopic)).setter(setter(Builder::deliveryTopic))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("DeliveryTopic").build()).build();
private static final SdkField FORWARDING_ENABLED_FIELD = SdkField. builder(MarshallingType.BOOLEAN)
.getter(getter(IdentityNotificationAttributes::forwardingEnabled)).setter(setter(Builder::forwardingEnabled))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("ForwardingEnabled").build()).build();
private static final SdkField HEADERS_IN_BOUNCE_NOTIFICATIONS_ENABLED_FIELD = SdkField
. builder(MarshallingType.BOOLEAN)
.getter(getter(IdentityNotificationAttributes::headersInBounceNotificationsEnabled))
.setter(setter(Builder::headersInBounceNotificationsEnabled))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD)
.locationName("HeadersInBounceNotificationsEnabled").build()).build();
private static final SdkField HEADERS_IN_COMPLAINT_NOTIFICATIONS_ENABLED_FIELD = SdkField
. builder(MarshallingType.BOOLEAN)
.getter(getter(IdentityNotificationAttributes::headersInComplaintNotificationsEnabled))
.setter(setter(Builder::headersInComplaintNotificationsEnabled))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD)
.locationName("HeadersInComplaintNotificationsEnabled").build()).build();
private static final SdkField HEADERS_IN_DELIVERY_NOTIFICATIONS_ENABLED_FIELD = SdkField
. builder(MarshallingType.BOOLEAN)
.getter(getter(IdentityNotificationAttributes::headersInDeliveryNotificationsEnabled))
.setter(setter(Builder::headersInDeliveryNotificationsEnabled))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD)
.locationName("HeadersInDeliveryNotificationsEnabled").build()).build();
private static final List> SDK_FIELDS = Collections.unmodifiableList(Arrays.asList(BOUNCE_TOPIC_FIELD,
COMPLAINT_TOPIC_FIELD, DELIVERY_TOPIC_FIELD, FORWARDING_ENABLED_FIELD, HEADERS_IN_BOUNCE_NOTIFICATIONS_ENABLED_FIELD,
HEADERS_IN_COMPLAINT_NOTIFICATIONS_ENABLED_FIELD, HEADERS_IN_DELIVERY_NOTIFICATIONS_ENABLED_FIELD));
private static final long serialVersionUID = 1L;
private final String bounceTopic;
private final String complaintTopic;
private final String deliveryTopic;
private final Boolean forwardingEnabled;
private final Boolean headersInBounceNotificationsEnabled;
private final Boolean headersInComplaintNotificationsEnabled;
private final Boolean headersInDeliveryNotificationsEnabled;
private IdentityNotificationAttributes(BuilderImpl builder) {
this.bounceTopic = builder.bounceTopic;
this.complaintTopic = builder.complaintTopic;
this.deliveryTopic = builder.deliveryTopic;
this.forwardingEnabled = builder.forwardingEnabled;
this.headersInBounceNotificationsEnabled = builder.headersInBounceNotificationsEnabled;
this.headersInComplaintNotificationsEnabled = builder.headersInComplaintNotificationsEnabled;
this.headersInDeliveryNotificationsEnabled = builder.headersInDeliveryNotificationsEnabled;
}
/**
*
* The Amazon Resource Name (ARN) of the Amazon SNS topic where Amazon SES will publish bounce notifications.
*
*
* @return The Amazon Resource Name (ARN) of the Amazon SNS topic where Amazon SES will publish bounce
* notifications.
*/
public String bounceTopic() {
return bounceTopic;
}
/**
*
* The Amazon Resource Name (ARN) of the Amazon SNS topic where Amazon SES will publish complaint notifications.
*
*
* @return The Amazon Resource Name (ARN) of the Amazon SNS topic where Amazon SES will publish complaint
* notifications.
*/
public String complaintTopic() {
return complaintTopic;
}
/**
*
* The Amazon Resource Name (ARN) of the Amazon SNS topic where Amazon SES will publish delivery notifications.
*
*
* @return The Amazon Resource Name (ARN) of the Amazon SNS topic where Amazon SES will publish delivery
* notifications.
*/
public String deliveryTopic() {
return deliveryTopic;
}
/**
*
* Describes whether Amazon SES will forward bounce and complaint notifications as email. true
* indicates that Amazon SES will forward bounce and complaint notifications as email, while false
* indicates that bounce and complaint notifications will be published only to the specified bounce and complaint
* Amazon SNS topics.
*
*
* @return Describes whether Amazon SES will forward bounce and complaint notifications as email. true
* indicates that Amazon SES will forward bounce and complaint notifications as email, while
* false
indicates that bounce and complaint notifications will be published only to the
* specified bounce and complaint Amazon SNS topics.
*/
public Boolean forwardingEnabled() {
return forwardingEnabled;
}
/**
*
* Describes whether Amazon SES includes the original email headers in Amazon SNS notifications of type
* Bounce
. A value of true
specifies that Amazon SES will include headers in bounce
* notifications, and a value of false
specifies that Amazon SES will not include headers in bounce
* notifications.
*
*
* @return Describes whether Amazon SES includes the original email headers in Amazon SNS notifications of type
* Bounce
. A value of true
specifies that Amazon SES will include headers in
* bounce notifications, and a value of false
specifies that Amazon SES will not include
* headers in bounce notifications.
*/
public Boolean headersInBounceNotificationsEnabled() {
return headersInBounceNotificationsEnabled;
}
/**
*
* Describes whether Amazon SES includes the original email headers in Amazon SNS notifications of type
* Complaint
. A value of true
specifies that Amazon SES will include headers in complaint
* notifications, and a value of false
specifies that Amazon SES will not include headers in complaint
* notifications.
*
*
* @return Describes whether Amazon SES includes the original email headers in Amazon SNS notifications of type
* Complaint
. A value of true
specifies that Amazon SES will include headers in
* complaint notifications, and a value of false
specifies that Amazon SES will not include
* headers in complaint notifications.
*/
public Boolean headersInComplaintNotificationsEnabled() {
return headersInComplaintNotificationsEnabled;
}
/**
*
* Describes whether Amazon SES includes the original email headers in Amazon SNS notifications of type
* Delivery
. A value of true
specifies that Amazon SES will include headers in delivery
* notifications, and a value of false
specifies that Amazon SES will not include headers in delivery
* notifications.
*
*
* @return Describes whether Amazon SES includes the original email headers in Amazon SNS notifications of type
* Delivery
. A value of true
specifies that Amazon SES will include headers in
* delivery notifications, and a value of false
specifies that Amazon SES will not include
* headers in delivery notifications.
*/
public Boolean headersInDeliveryNotificationsEnabled() {
return headersInDeliveryNotificationsEnabled;
}
@Override
public Builder toBuilder() {
return new BuilderImpl(this);
}
public static Builder builder() {
return new BuilderImpl();
}
public static Class extends Builder> serializableBuilderClass() {
return BuilderImpl.class;
}
@Override
public int hashCode() {
int hashCode = 1;
hashCode = 31 * hashCode + Objects.hashCode(bounceTopic());
hashCode = 31 * hashCode + Objects.hashCode(complaintTopic());
hashCode = 31 * hashCode + Objects.hashCode(deliveryTopic());
hashCode = 31 * hashCode + Objects.hashCode(forwardingEnabled());
hashCode = 31 * hashCode + Objects.hashCode(headersInBounceNotificationsEnabled());
hashCode = 31 * hashCode + Objects.hashCode(headersInComplaintNotificationsEnabled());
hashCode = 31 * hashCode + Objects.hashCode(headersInDeliveryNotificationsEnabled());
return hashCode;
}
@Override
public boolean equals(Object obj) {
if (this == obj) {
return true;
}
if (obj == null) {
return false;
}
if (!(obj instanceof IdentityNotificationAttributes)) {
return false;
}
IdentityNotificationAttributes other = (IdentityNotificationAttributes) obj;
return Objects.equals(bounceTopic(), other.bounceTopic()) && Objects.equals(complaintTopic(), other.complaintTopic())
&& Objects.equals(deliveryTopic(), other.deliveryTopic())
&& Objects.equals(forwardingEnabled(), other.forwardingEnabled())
&& Objects.equals(headersInBounceNotificationsEnabled(), other.headersInBounceNotificationsEnabled())
&& Objects.equals(headersInComplaintNotificationsEnabled(), other.headersInComplaintNotificationsEnabled())
&& Objects.equals(headersInDeliveryNotificationsEnabled(), other.headersInDeliveryNotificationsEnabled());
}
/**
* Returns a string representation of this object. This is useful for testing and debugging. Sensitive data will be
* redacted from this string using a placeholder value.
*/
@Override
public String toString() {
return ToString.builder("IdentityNotificationAttributes").add("BounceTopic", bounceTopic())
.add("ComplaintTopic", complaintTopic()).add("DeliveryTopic", deliveryTopic())
.add("ForwardingEnabled", forwardingEnabled())
.add("HeadersInBounceNotificationsEnabled", headersInBounceNotificationsEnabled())
.add("HeadersInComplaintNotificationsEnabled", headersInComplaintNotificationsEnabled())
.add("HeadersInDeliveryNotificationsEnabled", headersInDeliveryNotificationsEnabled()).build();
}
public Optional getValueForField(String fieldName, Class clazz) {
switch (fieldName) {
case "BounceTopic":
return Optional.ofNullable(clazz.cast(bounceTopic()));
case "ComplaintTopic":
return Optional.ofNullable(clazz.cast(complaintTopic()));
case "DeliveryTopic":
return Optional.ofNullable(clazz.cast(deliveryTopic()));
case "ForwardingEnabled":
return Optional.ofNullable(clazz.cast(forwardingEnabled()));
case "HeadersInBounceNotificationsEnabled":
return Optional.ofNullable(clazz.cast(headersInBounceNotificationsEnabled()));
case "HeadersInComplaintNotificationsEnabled":
return Optional.ofNullable(clazz.cast(headersInComplaintNotificationsEnabled()));
case "HeadersInDeliveryNotificationsEnabled":
return Optional.ofNullable(clazz.cast(headersInDeliveryNotificationsEnabled()));
default:
return Optional.empty();
}
}
@Override
public List> sdkFields() {
return SDK_FIELDS;
}
private static Function