software.amazon.awssdk.services.pinpoint.model.TemplateVersionResponse Maven / Gradle / Ivy
Show all versions of pinpoint 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.pinpoint.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;
/**
*
* Provides information about a specific version of a message template.
*
*/
@Generated("software.amazon.awssdk:codegen")
public final class TemplateVersionResponse implements SdkPojo, Serializable,
ToCopyableBuilder {
private static final SdkField CREATION_DATE_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("CreationDate").getter(getter(TemplateVersionResponse::creationDate))
.setter(setter(Builder::creationDate))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("CreationDate").build()).build();
private static final SdkField DEFAULT_SUBSTITUTIONS_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("DefaultSubstitutions").getter(getter(TemplateVersionResponse::defaultSubstitutions))
.setter(setter(Builder::defaultSubstitutions))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("DefaultSubstitutions").build())
.build();
private static final SdkField LAST_MODIFIED_DATE_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("LastModifiedDate").getter(getter(TemplateVersionResponse::lastModifiedDate))
.setter(setter(Builder::lastModifiedDate))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("LastModifiedDate").build()).build();
private static final SdkField TEMPLATE_DESCRIPTION_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("TemplateDescription").getter(getter(TemplateVersionResponse::templateDescription))
.setter(setter(Builder::templateDescription))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("TemplateDescription").build())
.build();
private static final SdkField TEMPLATE_NAME_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("TemplateName").getter(getter(TemplateVersionResponse::templateName))
.setter(setter(Builder::templateName))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("TemplateName").build()).build();
private static final SdkField TEMPLATE_TYPE_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("TemplateType").getter(getter(TemplateVersionResponse::templateType))
.setter(setter(Builder::templateType))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("TemplateType").build()).build();
private static final SdkField VERSION_FIELD = SdkField. builder(MarshallingType.STRING).memberName("Version")
.getter(getter(TemplateVersionResponse::version)).setter(setter(Builder::version))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("Version").build()).build();
private static final List> SDK_FIELDS = Collections.unmodifiableList(Arrays.asList(CREATION_DATE_FIELD,
DEFAULT_SUBSTITUTIONS_FIELD, LAST_MODIFIED_DATE_FIELD, TEMPLATE_DESCRIPTION_FIELD, TEMPLATE_NAME_FIELD,
TEMPLATE_TYPE_FIELD, VERSION_FIELD));
private static final long serialVersionUID = 1L;
private final String creationDate;
private final String defaultSubstitutions;
private final String lastModifiedDate;
private final String templateDescription;
private final String templateName;
private final String templateType;
private final String version;
private TemplateVersionResponse(BuilderImpl builder) {
this.creationDate = builder.creationDate;
this.defaultSubstitutions = builder.defaultSubstitutions;
this.lastModifiedDate = builder.lastModifiedDate;
this.templateDescription = builder.templateDescription;
this.templateName = builder.templateName;
this.templateType = builder.templateType;
this.version = builder.version;
}
/**
*
* The date, in ISO 8601 format, when the version of the message template was created.
*
*
* @return The date, in ISO 8601 format, when the version of the message template was created.
*/
public final String creationDate() {
return creationDate;
}
/**
*
* A JSON object that specifies the default values that are used for message variables in the version of the message
* template. This object is a set of key-value pairs. Each key defines a message variable in the template. The
* corresponding value defines the default value for that variable.
*
*
* @return A JSON object that specifies the default values that are used for message variables in the version of the
* message template. This object is a set of key-value pairs. Each key defines a message variable in the
* template. The corresponding value defines the default value for that variable.
*/
public final String defaultSubstitutions() {
return defaultSubstitutions;
}
/**
*
* The date, in ISO 8601 format, when the version of the message template was last modified.
*
*
* @return The date, in ISO 8601 format, when the version of the message template was last modified.
*/
public final String lastModifiedDate() {
return lastModifiedDate;
}
/**
*
* The custom description of the version of the message template.
*
*
* @return The custom description of the version of the message template.
*/
public final String templateDescription() {
return templateDescription;
}
/**
*
* The name of the message template.
*
*
* @return The name of the message template.
*/
public final String templateName() {
return templateName;
}
/**
*
* The type of channel that the message template is designed for. Possible values are: EMAIL, PUSH, SMS, INAPP, and
* VOICE.
*
*
* @return The type of channel that the message template is designed for. Possible values are: EMAIL, PUSH, SMS,
* INAPP, and VOICE.
*/
public final String templateType() {
return templateType;
}
/**
*
* The unique identifier for the version of the message template. This value is an integer that Amazon Pinpoint
* automatically increments and assigns to each new version of a template.
*
*
* @return The unique identifier for the version of the message template. This value is an integer that Amazon
* Pinpoint automatically increments and assigns to each new version of a template.
*/
public final String version() {
return version;
}
@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 + Objects.hashCode(creationDate());
hashCode = 31 * hashCode + Objects.hashCode(defaultSubstitutions());
hashCode = 31 * hashCode + Objects.hashCode(lastModifiedDate());
hashCode = 31 * hashCode + Objects.hashCode(templateDescription());
hashCode = 31 * hashCode + Objects.hashCode(templateName());
hashCode = 31 * hashCode + Objects.hashCode(templateType());
hashCode = 31 * hashCode + Objects.hashCode(version());
return hashCode;
}
@Override
public final boolean equals(Object obj) {
return equalsBySdkFields(obj);
}
@Override
public final boolean equalsBySdkFields(Object obj) {
if (this == obj) {
return true;
}
if (obj == null) {
return false;
}
if (!(obj instanceof TemplateVersionResponse)) {
return false;
}
TemplateVersionResponse other = (TemplateVersionResponse) obj;
return Objects.equals(creationDate(), other.creationDate())
&& Objects.equals(defaultSubstitutions(), other.defaultSubstitutions())
&& Objects.equals(lastModifiedDate(), other.lastModifiedDate())
&& Objects.equals(templateDescription(), other.templateDescription())
&& Objects.equals(templateName(), other.templateName()) && Objects.equals(templateType(), other.templateType())
&& Objects.equals(version(), other.version());
}
/**
* 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("TemplateVersionResponse").add("CreationDate", creationDate())
.add("DefaultSubstitutions", defaultSubstitutions()).add("LastModifiedDate", lastModifiedDate())
.add("TemplateDescription", templateDescription()).add("TemplateName", templateName())
.add("TemplateType", templateType()).add("Version", version()).build();
}
public final Optional getValueForField(String fieldName, Class clazz) {
switch (fieldName) {
case "CreationDate":
return Optional.ofNullable(clazz.cast(creationDate()));
case "DefaultSubstitutions":
return Optional.ofNullable(clazz.cast(defaultSubstitutions()));
case "LastModifiedDate":
return Optional.ofNullable(clazz.cast(lastModifiedDate()));
case "TemplateDescription":
return Optional.ofNullable(clazz.cast(templateDescription()));
case "TemplateName":
return Optional.ofNullable(clazz.cast(templateName()));
case "TemplateType":
return Optional.ofNullable(clazz.cast(templateType()));
case "Version":
return Optional.ofNullable(clazz.cast(version()));
default:
return Optional.empty();
}
}
@Override
public final List> sdkFields() {
return SDK_FIELDS;
}
private static Function