software.amazon.awssdk.services.pinpoint.model.SendOTPMessageRequestParameters 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;
/**
*
* Send OTP message request parameters.
*
*/
@Generated("software.amazon.awssdk:codegen")
public final class SendOTPMessageRequestParameters implements SdkPojo, Serializable,
ToCopyableBuilder {
private static final SdkField ALLOWED_ATTEMPTS_FIELD = SdkField. builder(MarshallingType.INTEGER)
.memberName("AllowedAttempts").getter(getter(SendOTPMessageRequestParameters::allowedAttempts))
.setter(setter(Builder::allowedAttempts))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("AllowedAttempts").build()).build();
private static final SdkField BRAND_NAME_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("BrandName").getter(getter(SendOTPMessageRequestParameters::brandName))
.setter(setter(Builder::brandName))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("BrandName").build()).build();
private static final SdkField CHANNEL_FIELD = SdkField. builder(MarshallingType.STRING).memberName("Channel")
.getter(getter(SendOTPMessageRequestParameters::channel)).setter(setter(Builder::channel))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("Channel").build()).build();
private static final SdkField CODE_LENGTH_FIELD = SdkField. builder(MarshallingType.INTEGER)
.memberName("CodeLength").getter(getter(SendOTPMessageRequestParameters::codeLength))
.setter(setter(Builder::codeLength))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("CodeLength").build()).build();
private static final SdkField DESTINATION_IDENTITY_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("DestinationIdentity").getter(getter(SendOTPMessageRequestParameters::destinationIdentity))
.setter(setter(Builder::destinationIdentity))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("DestinationIdentity").build())
.build();
private static final SdkField ENTITY_ID_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("EntityId").getter(getter(SendOTPMessageRequestParameters::entityId)).setter(setter(Builder::entityId))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("EntityId").build()).build();
private static final SdkField LANGUAGE_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("Language").getter(getter(SendOTPMessageRequestParameters::language)).setter(setter(Builder::language))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("Language").build()).build();
private static final SdkField ORIGINATION_IDENTITY_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("OriginationIdentity").getter(getter(SendOTPMessageRequestParameters::originationIdentity))
.setter(setter(Builder::originationIdentity))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("OriginationIdentity").build())
.build();
private static final SdkField REFERENCE_ID_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("ReferenceId").getter(getter(SendOTPMessageRequestParameters::referenceId))
.setter(setter(Builder::referenceId))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("ReferenceId").build()).build();
private static final SdkField TEMPLATE_ID_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("TemplateId").getter(getter(SendOTPMessageRequestParameters::templateId))
.setter(setter(Builder::templateId))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("TemplateId").build()).build();
private static final SdkField VALIDITY_PERIOD_FIELD = SdkField. builder(MarshallingType.INTEGER)
.memberName("ValidityPeriod").getter(getter(SendOTPMessageRequestParameters::validityPeriod))
.setter(setter(Builder::validityPeriod))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("ValidityPeriod").build()).build();
private static final List> SDK_FIELDS = Collections.unmodifiableList(Arrays.asList(ALLOWED_ATTEMPTS_FIELD,
BRAND_NAME_FIELD, CHANNEL_FIELD, CODE_LENGTH_FIELD, DESTINATION_IDENTITY_FIELD, ENTITY_ID_FIELD, LANGUAGE_FIELD,
ORIGINATION_IDENTITY_FIELD, REFERENCE_ID_FIELD, TEMPLATE_ID_FIELD, VALIDITY_PERIOD_FIELD));
private static final long serialVersionUID = 1L;
private final Integer allowedAttempts;
private final String brandName;
private final String channel;
private final Integer codeLength;
private final String destinationIdentity;
private final String entityId;
private final String language;
private final String originationIdentity;
private final String referenceId;
private final String templateId;
private final Integer validityPeriod;
private SendOTPMessageRequestParameters(BuilderImpl builder) {
this.allowedAttempts = builder.allowedAttempts;
this.brandName = builder.brandName;
this.channel = builder.channel;
this.codeLength = builder.codeLength;
this.destinationIdentity = builder.destinationIdentity;
this.entityId = builder.entityId;
this.language = builder.language;
this.originationIdentity = builder.originationIdentity;
this.referenceId = builder.referenceId;
this.templateId = builder.templateId;
this.validityPeriod = builder.validityPeriod;
}
/**
*
* The attempts allowed to validate an OTP.
*
*
* @return The attempts allowed to validate an OTP.
*/
public final Integer allowedAttempts() {
return allowedAttempts;
}
/**
*
* The brand name that will be substituted into the OTP message body. Should be owned by calling AWS account.
*
*
* @return The brand name that will be substituted into the OTP message body. Should be owned by calling AWS
* account.
*/
public final String brandName() {
return brandName;
}
/**
*
* Channel type for the OTP message. Supported values: [SMS].
*
*
* @return Channel type for the OTP message. Supported values: [SMS].
*/
public final String channel() {
return channel;
}
/**
*
* The number of characters in the generated OTP.
*
*
* @return The number of characters in the generated OTP.
*/
public final Integer codeLength() {
return codeLength;
}
/**
*
* The destination identity to send OTP to.
*
*
* @return The destination identity to send OTP to.
*/
public final String destinationIdentity() {
return destinationIdentity;
}
/**
*
* A unique Entity ID received from DLT after entity registration is approved.
*
*
* @return A unique Entity ID received from DLT after entity registration is approved.
*/
public final String entityId() {
return entityId;
}
/**
*
* The language to be used for the outgoing message body containing the OTP.
*
*
* @return The language to be used for the outgoing message body containing the OTP.
*/
public final String language() {
return language;
}
/**
*
* The origination identity used to send OTP from.
*
*
* @return The origination identity used to send OTP from.
*/
public final String originationIdentity() {
return originationIdentity;
}
/**
*
* Developer-specified reference identifier. Required to match during OTP verification.
*
*
* @return Developer-specified reference identifier. Required to match during OTP verification.
*/
public final String referenceId() {
return referenceId;
}
/**
*
* A unique Template ID received from DLT after entity registration is approved.
*
*
* @return A unique Template ID received from DLT after entity registration is approved.
*/
public final String templateId() {
return templateId;
}
/**
*
* The time in minutes before the OTP is no longer valid.
*
*
* @return The time in minutes before the OTP is no longer valid.
*/
public final Integer validityPeriod() {
return validityPeriod;
}
@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(allowedAttempts());
hashCode = 31 * hashCode + Objects.hashCode(brandName());
hashCode = 31 * hashCode + Objects.hashCode(channel());
hashCode = 31 * hashCode + Objects.hashCode(codeLength());
hashCode = 31 * hashCode + Objects.hashCode(destinationIdentity());
hashCode = 31 * hashCode + Objects.hashCode(entityId());
hashCode = 31 * hashCode + Objects.hashCode(language());
hashCode = 31 * hashCode + Objects.hashCode(originationIdentity());
hashCode = 31 * hashCode + Objects.hashCode(referenceId());
hashCode = 31 * hashCode + Objects.hashCode(templateId());
hashCode = 31 * hashCode + Objects.hashCode(validityPeriod());
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 SendOTPMessageRequestParameters)) {
return false;
}
SendOTPMessageRequestParameters other = (SendOTPMessageRequestParameters) obj;
return Objects.equals(allowedAttempts(), other.allowedAttempts()) && Objects.equals(brandName(), other.brandName())
&& Objects.equals(channel(), other.channel()) && Objects.equals(codeLength(), other.codeLength())
&& Objects.equals(destinationIdentity(), other.destinationIdentity())
&& Objects.equals(entityId(), other.entityId()) && Objects.equals(language(), other.language())
&& Objects.equals(originationIdentity(), other.originationIdentity())
&& Objects.equals(referenceId(), other.referenceId()) && Objects.equals(templateId(), other.templateId())
&& Objects.equals(validityPeriod(), other.validityPeriod());
}
/**
* 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("SendOTPMessageRequestParameters").add("AllowedAttempts", allowedAttempts())
.add("BrandName", brandName()).add("Channel", channel()).add("CodeLength", codeLength())
.add("DestinationIdentity", destinationIdentity()).add("EntityId", entityId()).add("Language", language())
.add("OriginationIdentity", originationIdentity()).add("ReferenceId", referenceId())
.add("TemplateId", templateId()).add("ValidityPeriod", validityPeriod()).build();
}
public final Optional getValueForField(String fieldName, Class clazz) {
switch (fieldName) {
case "AllowedAttempts":
return Optional.ofNullable(clazz.cast(allowedAttempts()));
case "BrandName":
return Optional.ofNullable(clazz.cast(brandName()));
case "Channel":
return Optional.ofNullable(clazz.cast(channel()));
case "CodeLength":
return Optional.ofNullable(clazz.cast(codeLength()));
case "DestinationIdentity":
return Optional.ofNullable(clazz.cast(destinationIdentity()));
case "EntityId":
return Optional.ofNullable(clazz.cast(entityId()));
case "Language":
return Optional.ofNullable(clazz.cast(language()));
case "OriginationIdentity":
return Optional.ofNullable(clazz.cast(originationIdentity()));
case "ReferenceId":
return Optional.ofNullable(clazz.cast(referenceId()));
case "TemplateId":
return Optional.ofNullable(clazz.cast(templateId()));
case "ValidityPeriod":
return Optional.ofNullable(clazz.cast(validityPeriod()));
default:
return Optional.empty();
}
}
@Override
public final List> sdkFields() {
return SDK_FIELDS;
}
private static Function