software.amazon.awssdk.services.pinpointemail.model.GetEmailIdentityResponse Maven / Gradle / Ivy
Show all versions of pinpointemail Show documentation
/*
* Copyright 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.pinpointemail.model;
import java.util.Arrays;
import java.util.Collection;
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.Consumer;
import java.util.function.Function;
import java.util.stream.Collectors;
import java.util.stream.Stream;
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.ListTrait;
import software.amazon.awssdk.core.traits.LocationTrait;
import software.amazon.awssdk.core.util.DefaultSdkAutoConstructList;
import software.amazon.awssdk.core.util.SdkAutoConstructList;
import software.amazon.awssdk.utils.ToString;
import software.amazon.awssdk.utils.builder.CopyableBuilder;
import software.amazon.awssdk.utils.builder.ToCopyableBuilder;
/**
*
* Details about an email identity.
*
*/
@Generated("software.amazon.awssdk:codegen")
public final class GetEmailIdentityResponse extends PinpointEmailResponse implements
ToCopyableBuilder {
private static final SdkField IDENTITY_TYPE_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("IdentityType").getter(getter(GetEmailIdentityResponse::identityTypeAsString))
.setter(setter(Builder::identityType))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("IdentityType").build()).build();
private static final SdkField FEEDBACK_FORWARDING_STATUS_FIELD = SdkField. builder(MarshallingType.BOOLEAN)
.memberName("FeedbackForwardingStatus").getter(getter(GetEmailIdentityResponse::feedbackForwardingStatus))
.setter(setter(Builder::feedbackForwardingStatus))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("FeedbackForwardingStatus").build())
.build();
private static final SdkField VERIFIED_FOR_SENDING_STATUS_FIELD = SdkField
. builder(MarshallingType.BOOLEAN).memberName("VerifiedForSendingStatus")
.getter(getter(GetEmailIdentityResponse::verifiedForSendingStatus)).setter(setter(Builder::verifiedForSendingStatus))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("VerifiedForSendingStatus").build())
.build();
private static final SdkField DKIM_ATTRIBUTES_FIELD = SdkField
. builder(MarshallingType.SDK_POJO).memberName("DkimAttributes")
.getter(getter(GetEmailIdentityResponse::dkimAttributes)).setter(setter(Builder::dkimAttributes))
.constructor(DkimAttributes::builder)
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("DkimAttributes").build()).build();
private static final SdkField MAIL_FROM_ATTRIBUTES_FIELD = SdkField
. builder(MarshallingType.SDK_POJO).memberName("MailFromAttributes")
.getter(getter(GetEmailIdentityResponse::mailFromAttributes)).setter(setter(Builder::mailFromAttributes))
.constructor(MailFromAttributes::builder)
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("MailFromAttributes").build())
.build();
private static final SdkField> TAGS_FIELD = SdkField
.> builder(MarshallingType.LIST)
.memberName("Tags")
.getter(getter(GetEmailIdentityResponse::tags))
.setter(setter(Builder::tags))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("Tags").build(),
ListTrait
.builder()
.memberLocationName(null)
.memberFieldInfo(
SdkField. builder(MarshallingType.SDK_POJO)
.constructor(Tag::builder)
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD)
.locationName("member").build()).build()).build()).build();
private static final List> SDK_FIELDS = Collections.unmodifiableList(Arrays.asList(IDENTITY_TYPE_FIELD,
FEEDBACK_FORWARDING_STATUS_FIELD, VERIFIED_FOR_SENDING_STATUS_FIELD, DKIM_ATTRIBUTES_FIELD,
MAIL_FROM_ATTRIBUTES_FIELD, TAGS_FIELD));
private final String identityType;
private final Boolean feedbackForwardingStatus;
private final Boolean verifiedForSendingStatus;
private final DkimAttributes dkimAttributes;
private final MailFromAttributes mailFromAttributes;
private final List tags;
private GetEmailIdentityResponse(BuilderImpl builder) {
super(builder);
this.identityType = builder.identityType;
this.feedbackForwardingStatus = builder.feedbackForwardingStatus;
this.verifiedForSendingStatus = builder.verifiedForSendingStatus;
this.dkimAttributes = builder.dkimAttributes;
this.mailFromAttributes = builder.mailFromAttributes;
this.tags = builder.tags;
}
/**
*
* The email identity type.
*
*
* If the service returns an enum value that is not available in the current SDK version, {@link #identityType} will
* return {@link IdentityType#UNKNOWN_TO_SDK_VERSION}. The raw value returned by the service is available from
* {@link #identityTypeAsString}.
*
*
* @return The email identity type.
* @see IdentityType
*/
public final IdentityType identityType() {
return IdentityType.fromValue(identityType);
}
/**
*
* The email identity type.
*
*
* If the service returns an enum value that is not available in the current SDK version, {@link #identityType} will
* return {@link IdentityType#UNKNOWN_TO_SDK_VERSION}. The raw value returned by the service is available from
* {@link #identityTypeAsString}.
*
*
* @return The email identity type.
* @see IdentityType
*/
public final String identityTypeAsString() {
return identityType;
}
/**
*
* The feedback forwarding configuration for the identity.
*
*
* If the value is true
, Amazon Pinpoint sends you email notifications when bounce or complaint events
* occur. Amazon Pinpoint sends this notification to the address that you specified in the Return-Path header of the
* original email.
*
*
* When you set this value to false
, Amazon Pinpoint sends notifications through other mechanisms, such
* as by notifying an Amazon SNS topic or another event destination. You're required to have a method of tracking
* bounces and complaints. If you haven't set up another mechanism for receiving bounce or complaint notifications,
* Amazon Pinpoint sends an email notification when these events occur (even if this setting is disabled).
*
*
* @return The feedback forwarding configuration for the identity.
*
* If the value is true
, Amazon Pinpoint sends you email notifications when bounce or complaint
* events occur. Amazon Pinpoint sends this notification to the address that you specified in the
* Return-Path header of the original email.
*
*
* When you set this value to false
, Amazon Pinpoint sends notifications through other
* mechanisms, such as by notifying an Amazon SNS topic or another event destination. You're required to
* have a method of tracking bounces and complaints. If you haven't set up another mechanism for receiving
* bounce or complaint notifications, Amazon Pinpoint sends an email notification when these events occur
* (even if this setting is disabled).
*/
public final Boolean feedbackForwardingStatus() {
return feedbackForwardingStatus;
}
/**
*
* Specifies whether or not the identity is verified. In Amazon Pinpoint, you can only send email from verified
* email addresses or domains. For more information about verifying identities, see the Amazon Pinpoint
* User Guide.
*
*
* @return Specifies whether or not the identity is verified. In Amazon Pinpoint, you can only send email from
* verified email addresses or domains. For more information about verifying identities, see the Amazon
* Pinpoint User Guide.
*/
public final Boolean verifiedForSendingStatus() {
return verifiedForSendingStatus;
}
/**
*
* An object that contains information about the DKIM attributes for the identity. This object includes the tokens
* that you use to create the CNAME records that are required to complete the DKIM verification process.
*
*
* @return An object that contains information about the DKIM attributes for the identity. This object includes the
* tokens that you use to create the CNAME records that are required to complete the DKIM verification
* process.
*/
public final DkimAttributes dkimAttributes() {
return dkimAttributes;
}
/**
*
* An object that contains information about the Mail-From attributes for the email identity.
*
*
* @return An object that contains information about the Mail-From attributes for the email identity.
*/
public final MailFromAttributes mailFromAttributes() {
return mailFromAttributes;
}
/**
* For responses, this returns true if the service returned a value for the Tags property. This DOES NOT check that
* the value is non-empty (for which, you should check the {@code isEmpty()} method on the property). This is useful
* because the SDK will never return a null collection or map, but you may need to differentiate between the service
* returning nothing (or null) and the service returning an empty collection or map. For requests, this returns true
* if a value for the property was specified in the request builder, and false if a value was not specified.
*/
public final boolean hasTags() {
return tags != null && !(tags instanceof SdkAutoConstructList);
}
/**
*
* An array of objects that define the tags (keys and values) that are associated with the email identity.
*
*
* Attempts to modify the collection returned by this method will result in an UnsupportedOperationException.
*
*
* This method will never return null. If you would like to know whether the service returned this field (so that
* you can differentiate between null and empty), you can use the {@link #hasTags} method.
*
*
* @return An array of objects that define the tags (keys and values) that are associated with the email identity.
*/
public final List tags() {
return tags;
}
@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 final int hashCode() {
int hashCode = 1;
hashCode = 31 * hashCode + super.hashCode();
hashCode = 31 * hashCode + Objects.hashCode(identityTypeAsString());
hashCode = 31 * hashCode + Objects.hashCode(feedbackForwardingStatus());
hashCode = 31 * hashCode + Objects.hashCode(verifiedForSendingStatus());
hashCode = 31 * hashCode + Objects.hashCode(dkimAttributes());
hashCode = 31 * hashCode + Objects.hashCode(mailFromAttributes());
hashCode = 31 * hashCode + Objects.hashCode(hasTags() ? tags() : null);
return hashCode;
}
@Override
public final boolean equals(Object obj) {
return super.equals(obj) && equalsBySdkFields(obj);
}
@Override
public final boolean equalsBySdkFields(Object obj) {
if (this == obj) {
return true;
}
if (obj == null) {
return false;
}
if (!(obj instanceof GetEmailIdentityResponse)) {
return false;
}
GetEmailIdentityResponse other = (GetEmailIdentityResponse) obj;
return Objects.equals(identityTypeAsString(), other.identityTypeAsString())
&& Objects.equals(feedbackForwardingStatus(), other.feedbackForwardingStatus())
&& Objects.equals(verifiedForSendingStatus(), other.verifiedForSendingStatus())
&& Objects.equals(dkimAttributes(), other.dkimAttributes())
&& Objects.equals(mailFromAttributes(), other.mailFromAttributes()) && hasTags() == other.hasTags()
&& Objects.equals(tags(), other.tags());
}
/**
* 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 final String toString() {
return ToString.builder("GetEmailIdentityResponse").add("IdentityType", identityTypeAsString())
.add("FeedbackForwardingStatus", feedbackForwardingStatus())
.add("VerifiedForSendingStatus", verifiedForSendingStatus()).add("DkimAttributes", dkimAttributes())
.add("MailFromAttributes", mailFromAttributes()).add("Tags", hasTags() ? tags() : null).build();
}
public final Optional getValueForField(String fieldName, Class clazz) {
switch (fieldName) {
case "IdentityType":
return Optional.ofNullable(clazz.cast(identityTypeAsString()));
case "FeedbackForwardingStatus":
return Optional.ofNullable(clazz.cast(feedbackForwardingStatus()));
case "VerifiedForSendingStatus":
return Optional.ofNullable(clazz.cast(verifiedForSendingStatus()));
case "DkimAttributes":
return Optional.ofNullable(clazz.cast(dkimAttributes()));
case "MailFromAttributes":
return Optional.ofNullable(clazz.cast(mailFromAttributes()));
case "Tags":
return Optional.ofNullable(clazz.cast(tags()));
default:
return Optional.empty();
}
}
@Override
public final List> sdkFields() {
return SDK_FIELDS;
}
private static Function