software.amazon.awssdk.services.elasticbeanstalk.model.ValidationMessage Maven / Gradle / Ivy
Show all versions of elasticbeanstalk Show documentation
/*
* 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.elasticbeanstalk.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;
/**
*
* An error or warning for a desired configuration option value.
*
*/
@Generated("software.amazon.awssdk:codegen")
public final class ValidationMessage implements SdkPojo, Serializable,
ToCopyableBuilder {
private static final SdkField MESSAGE_FIELD = SdkField. builder(MarshallingType.STRING)
.getter(getter(ValidationMessage::message)).setter(setter(Builder::message))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("Message").build()).build();
private static final SdkField SEVERITY_FIELD = SdkField. builder(MarshallingType.STRING)
.getter(getter(ValidationMessage::severityAsString)).setter(setter(Builder::severity))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("Severity").build()).build();
private static final SdkField NAMESPACE_FIELD = SdkField. builder(MarshallingType.STRING)
.getter(getter(ValidationMessage::namespace)).setter(setter(Builder::namespace))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("Namespace").build()).build();
private static final SdkField OPTION_NAME_FIELD = SdkField. builder(MarshallingType.STRING)
.getter(getter(ValidationMessage::optionName)).setter(setter(Builder::optionName))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("OptionName").build()).build();
private static final List> SDK_FIELDS = Collections.unmodifiableList(Arrays.asList(MESSAGE_FIELD, SEVERITY_FIELD,
NAMESPACE_FIELD, OPTION_NAME_FIELD));
private static final long serialVersionUID = 1L;
private final String message;
private final String severity;
private final String namespace;
private final String optionName;
private ValidationMessage(BuilderImpl builder) {
this.message = builder.message;
this.severity = builder.severity;
this.namespace = builder.namespace;
this.optionName = builder.optionName;
}
/**
*
* A message describing the error or warning.
*
*
* @return A message describing the error or warning.
*/
public String message() {
return message;
}
/**
*
* An indication of the severity of this message:
*
*
* -
*
* error
: This message indicates that this is not a valid setting for an option.
*
*
* -
*
* warning
: This message is providing information you should take into account.
*
*
*
*
* If the service returns an enum value that is not available in the current SDK version, {@link #severity} will
* return {@link ValidationSeverity#UNKNOWN_TO_SDK_VERSION}. The raw value returned by the service is available from
* {@link #severityAsString}.
*
*
* @return An indication of the severity of this message:
*
* -
*
* error
: This message indicates that this is not a valid setting for an option.
*
*
* -
*
* warning
: This message is providing information you should take into account.
*
*
* @see ValidationSeverity
*/
public ValidationSeverity severity() {
return ValidationSeverity.fromValue(severity);
}
/**
*
* An indication of the severity of this message:
*
*
* -
*
* error
: This message indicates that this is not a valid setting for an option.
*
*
* -
*
* warning
: This message is providing information you should take into account.
*
*
*
*
* If the service returns an enum value that is not available in the current SDK version, {@link #severity} will
* return {@link ValidationSeverity#UNKNOWN_TO_SDK_VERSION}. The raw value returned by the service is available from
* {@link #severityAsString}.
*
*
* @return An indication of the severity of this message:
*
* -
*
* error
: This message indicates that this is not a valid setting for an option.
*
*
* -
*
* warning
: This message is providing information you should take into account.
*
*
* @see ValidationSeverity
*/
public String severityAsString() {
return severity;
}
/**
*
* The namespace to which the option belongs.
*
*
* @return The namespace to which the option belongs.
*/
public String namespace() {
return namespace;
}
/**
*
* The name of the option.
*
*
* @return The name of the option.
*/
public String optionName() {
return optionName;
}
@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(message());
hashCode = 31 * hashCode + Objects.hashCode(severityAsString());
hashCode = 31 * hashCode + Objects.hashCode(namespace());
hashCode = 31 * hashCode + Objects.hashCode(optionName());
return hashCode;
}
@Override
public boolean equals(Object obj) {
if (this == obj) {
return true;
}
if (obj == null) {
return false;
}
if (!(obj instanceof ValidationMessage)) {
return false;
}
ValidationMessage other = (ValidationMessage) obj;
return Objects.equals(message(), other.message()) && Objects.equals(severityAsString(), other.severityAsString())
&& Objects.equals(namespace(), other.namespace()) && Objects.equals(optionName(), other.optionName());
}
/**
* 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("ValidationMessage").add("Message", message()).add("Severity", severityAsString())
.add("Namespace", namespace()).add("OptionName", optionName()).build();
}
public Optional getValueForField(String fieldName, Class clazz) {
switch (fieldName) {
case "Message":
return Optional.ofNullable(clazz.cast(message()));
case "Severity":
return Optional.ofNullable(clazz.cast(severityAsString()));
case "Namespace":
return Optional.ofNullable(clazz.cast(namespace()));
case "OptionName":
return Optional.ofNullable(clazz.cast(optionName()));
default:
return Optional.empty();
}
}
@Override
public List> sdkFields() {
return SDK_FIELDS;
}
private static Function