software.amazon.awssdk.services.sms.model.ValidationOutput Maven / Gradle / Ivy
Show all versions of sms 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.sms.model;
import java.io.Serializable;
import java.time.Instant;
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.Consumer;
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;
/**
*
* Contains validation output.
*
*/
@Generated("software.amazon.awssdk:codegen")
public final class ValidationOutput implements SdkPojo, Serializable,
ToCopyableBuilder {
private static final SdkField VALIDATION_ID_FIELD = SdkField. builder(MarshallingType.STRING)
.getter(getter(ValidationOutput::validationId)).setter(setter(Builder::validationId))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("validationId").build()).build();
private static final SdkField NAME_FIELD = SdkField. builder(MarshallingType.STRING)
.getter(getter(ValidationOutput::name)).setter(setter(Builder::name))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("name").build()).build();
private static final SdkField STATUS_FIELD = SdkField. builder(MarshallingType.STRING)
.getter(getter(ValidationOutput::statusAsString)).setter(setter(Builder::status))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("status").build()).build();
private static final SdkField STATUS_MESSAGE_FIELD = SdkField. builder(MarshallingType.STRING)
.getter(getter(ValidationOutput::statusMessage)).setter(setter(Builder::statusMessage))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("statusMessage").build()).build();
private static final SdkField LATEST_VALIDATION_TIME_FIELD = SdkField. builder(MarshallingType.INSTANT)
.getter(getter(ValidationOutput::latestValidationTime)).setter(setter(Builder::latestValidationTime))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("latestValidationTime").build())
.build();
private static final SdkField APP_VALIDATION_OUTPUT_FIELD = SdkField
. builder(MarshallingType.SDK_POJO).getter(getter(ValidationOutput::appValidationOutput))
.setter(setter(Builder::appValidationOutput)).constructor(AppValidationOutput::builder)
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("appValidationOutput").build())
.build();
private static final SdkField SERVER_VALIDATION_OUTPUT_FIELD = SdkField
. builder(MarshallingType.SDK_POJO).getter(getter(ValidationOutput::serverValidationOutput))
.setter(setter(Builder::serverValidationOutput)).constructor(ServerValidationOutput::builder)
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("serverValidationOutput").build())
.build();
private static final List> SDK_FIELDS = Collections.unmodifiableList(Arrays.asList(VALIDATION_ID_FIELD,
NAME_FIELD, STATUS_FIELD, STATUS_MESSAGE_FIELD, LATEST_VALIDATION_TIME_FIELD, APP_VALIDATION_OUTPUT_FIELD,
SERVER_VALIDATION_OUTPUT_FIELD));
private static final long serialVersionUID = 1L;
private final String validationId;
private final String name;
private final String status;
private final String statusMessage;
private final Instant latestValidationTime;
private final AppValidationOutput appValidationOutput;
private final ServerValidationOutput serverValidationOutput;
private ValidationOutput(BuilderImpl builder) {
this.validationId = builder.validationId;
this.name = builder.name;
this.status = builder.status;
this.statusMessage = builder.statusMessage;
this.latestValidationTime = builder.latestValidationTime;
this.appValidationOutput = builder.appValidationOutput;
this.serverValidationOutput = builder.serverValidationOutput;
}
/**
*
* The ID of the validation.
*
*
* @return The ID of the validation.
*/
public String validationId() {
return validationId;
}
/**
*
* The name of the validation.
*
*
* @return The name of the validation.
*/
public String name() {
return name;
}
/**
*
* The status of the validation.
*
*
* If the service returns an enum value that is not available in the current SDK version, {@link #status} will
* return {@link ValidationStatus#UNKNOWN_TO_SDK_VERSION}. The raw value returned by the service is available from
* {@link #statusAsString}.
*
*
* @return The status of the validation.
* @see ValidationStatus
*/
public ValidationStatus status() {
return ValidationStatus.fromValue(status);
}
/**
*
* The status of the validation.
*
*
* If the service returns an enum value that is not available in the current SDK version, {@link #status} will
* return {@link ValidationStatus#UNKNOWN_TO_SDK_VERSION}. The raw value returned by the service is available from
* {@link #statusAsString}.
*
*
* @return The status of the validation.
* @see ValidationStatus
*/
public String statusAsString() {
return status;
}
/**
*
* The status message.
*
*
* @return The status message.
*/
public String statusMessage() {
return statusMessage;
}
/**
*
* The latest time that the validation was performed.
*
*
* @return The latest time that the validation was performed.
*/
public Instant latestValidationTime() {
return latestValidationTime;
}
/**
*
* The output from validating an application.
*
*
* @return The output from validating an application.
*/
public AppValidationOutput appValidationOutput() {
return appValidationOutput;
}
/**
*
* The output from validation an instance.
*
*
* @return The output from validation an instance.
*/
public ServerValidationOutput serverValidationOutput() {
return serverValidationOutput;
}
@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(validationId());
hashCode = 31 * hashCode + Objects.hashCode(name());
hashCode = 31 * hashCode + Objects.hashCode(statusAsString());
hashCode = 31 * hashCode + Objects.hashCode(statusMessage());
hashCode = 31 * hashCode + Objects.hashCode(latestValidationTime());
hashCode = 31 * hashCode + Objects.hashCode(appValidationOutput());
hashCode = 31 * hashCode + Objects.hashCode(serverValidationOutput());
return hashCode;
}
@Override
public boolean equals(Object obj) {
return equalsBySdkFields(obj);
}
@Override
public boolean equalsBySdkFields(Object obj) {
if (this == obj) {
return true;
}
if (obj == null) {
return false;
}
if (!(obj instanceof ValidationOutput)) {
return false;
}
ValidationOutput other = (ValidationOutput) obj;
return Objects.equals(validationId(), other.validationId()) && Objects.equals(name(), other.name())
&& Objects.equals(statusAsString(), other.statusAsString())
&& Objects.equals(statusMessage(), other.statusMessage())
&& Objects.equals(latestValidationTime(), other.latestValidationTime())
&& Objects.equals(appValidationOutput(), other.appValidationOutput())
&& Objects.equals(serverValidationOutput(), other.serverValidationOutput());
}
/**
* 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("ValidationOutput").add("ValidationId", validationId()).add("Name", name())
.add("Status", statusAsString()).add("StatusMessage", statusMessage())
.add("LatestValidationTime", latestValidationTime()).add("AppValidationOutput", appValidationOutput())
.add("ServerValidationOutput", serverValidationOutput()).build();
}
public Optional getValueForField(String fieldName, Class clazz) {
switch (fieldName) {
case "validationId":
return Optional.ofNullable(clazz.cast(validationId()));
case "name":
return Optional.ofNullable(clazz.cast(name()));
case "status":
return Optional.ofNullable(clazz.cast(statusAsString()));
case "statusMessage":
return Optional.ofNullable(clazz.cast(statusMessage()));
case "latestValidationTime":
return Optional.ofNullable(clazz.cast(latestValidationTime()));
case "appValidationOutput":
return Optional.ofNullable(clazz.cast(appValidationOutput()));
case "serverValidationOutput":
return Optional.ofNullable(clazz.cast(serverValidationOutput()));
default:
return Optional.empty();
}
}
@Override
public List> sdkFields() {
return SDK_FIELDS;
}
private static Function