software.amazon.awssdk.services.elasticbeanstalk.model.ConfigurationOptionDescription Maven / Gradle / Ivy
Show all versions of elasticbeanstalk 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.elasticbeanstalk.model;
import java.io.Serializable;
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 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;
/**
*
* Describes the possible values for a configuration option.
*
*/
@Generated("software.amazon.awssdk:codegen")
public final class ConfigurationOptionDescription implements SdkPojo, Serializable,
ToCopyableBuilder {
private static final SdkField NAMESPACE_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("Namespace").getter(getter(ConfigurationOptionDescription::namespace)).setter(setter(Builder::namespace))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("Namespace").build()).build();
private static final SdkField NAME_FIELD = SdkField. builder(MarshallingType.STRING).memberName("Name")
.getter(getter(ConfigurationOptionDescription::name)).setter(setter(Builder::name))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("Name").build()).build();
private static final SdkField DEFAULT_VALUE_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("DefaultValue").getter(getter(ConfigurationOptionDescription::defaultValue))
.setter(setter(Builder::defaultValue))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("DefaultValue").build()).build();
private static final SdkField CHANGE_SEVERITY_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("ChangeSeverity").getter(getter(ConfigurationOptionDescription::changeSeverity))
.setter(setter(Builder::changeSeverity))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("ChangeSeverity").build()).build();
private static final SdkField USER_DEFINED_FIELD = SdkField. builder(MarshallingType.BOOLEAN)
.memberName("UserDefined").getter(getter(ConfigurationOptionDescription::userDefined))
.setter(setter(Builder::userDefined))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("UserDefined").build()).build();
private static final SdkField VALUE_TYPE_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("ValueType").getter(getter(ConfigurationOptionDescription::valueTypeAsString))
.setter(setter(Builder::valueType))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("ValueType").build()).build();
private static final SdkField> VALUE_OPTIONS_FIELD = SdkField
.> builder(MarshallingType.LIST)
.memberName("ValueOptions")
.getter(getter(ConfigurationOptionDescription::valueOptions))
.setter(setter(Builder::valueOptions))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("ValueOptions").build(),
ListTrait
.builder()
.memberLocationName(null)
.memberFieldInfo(
SdkField. builder(MarshallingType.STRING)
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD)
.locationName("member").build()).build()).build()).build();
private static final SdkField MIN_VALUE_FIELD = SdkField. builder(MarshallingType.INTEGER)
.memberName("MinValue").getter(getter(ConfigurationOptionDescription::minValue)).setter(setter(Builder::minValue))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("MinValue").build()).build();
private static final SdkField MAX_VALUE_FIELD = SdkField. builder(MarshallingType.INTEGER)
.memberName("MaxValue").getter(getter(ConfigurationOptionDescription::maxValue)).setter(setter(Builder::maxValue))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("MaxValue").build()).build();
private static final SdkField MAX_LENGTH_FIELD = SdkField. builder(MarshallingType.INTEGER)
.memberName("MaxLength").getter(getter(ConfigurationOptionDescription::maxLength)).setter(setter(Builder::maxLength))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("MaxLength").build()).build();
private static final SdkField REGEX_FIELD = SdkField
. builder(MarshallingType.SDK_POJO).memberName("Regex")
.getter(getter(ConfigurationOptionDescription::regex)).setter(setter(Builder::regex))
.constructor(OptionRestrictionRegex::builder)
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("Regex").build()).build();
private static final List> SDK_FIELDS = Collections.unmodifiableList(Arrays.asList(NAMESPACE_FIELD, NAME_FIELD,
DEFAULT_VALUE_FIELD, CHANGE_SEVERITY_FIELD, USER_DEFINED_FIELD, VALUE_TYPE_FIELD, VALUE_OPTIONS_FIELD,
MIN_VALUE_FIELD, MAX_VALUE_FIELD, MAX_LENGTH_FIELD, REGEX_FIELD));
private static final long serialVersionUID = 1L;
private final String namespace;
private final String name;
private final String defaultValue;
private final String changeSeverity;
private final Boolean userDefined;
private final String valueType;
private final List valueOptions;
private final Integer minValue;
private final Integer maxValue;
private final Integer maxLength;
private final OptionRestrictionRegex regex;
private ConfigurationOptionDescription(BuilderImpl builder) {
this.namespace = builder.namespace;
this.name = builder.name;
this.defaultValue = builder.defaultValue;
this.changeSeverity = builder.changeSeverity;
this.userDefined = builder.userDefined;
this.valueType = builder.valueType;
this.valueOptions = builder.valueOptions;
this.minValue = builder.minValue;
this.maxValue = builder.maxValue;
this.maxLength = builder.maxLength;
this.regex = builder.regex;
}
/**
*
* A unique namespace identifying the option's associated AWS resource.
*
*
* @return A unique namespace identifying the option's associated AWS resource.
*/
public final String namespace() {
return namespace;
}
/**
*
* The name of the configuration option.
*
*
* @return The name of the configuration option.
*/
public final String name() {
return name;
}
/**
*
* The default value for this configuration option.
*
*
* @return The default value for this configuration option.
*/
public final String defaultValue() {
return defaultValue;
}
/**
*
* An indication of which action is required if the value for this configuration option changes:
*
*
* -
*
* NoInterruption
: There is no interruption to the environment or application availability.
*
*
* -
*
* RestartEnvironment
: The environment is entirely restarted, all AWS resources are deleted and
* recreated, and the environment is unavailable during the process.
*
*
* -
*
* RestartApplicationServer
: The environment is available the entire time. However, a short
* application outage occurs when the application servers on the running Amazon EC2 instances are restarted.
*
*
*
*
* @return An indication of which action is required if the value for this configuration option changes:
*
* -
*
* NoInterruption
: There is no interruption to the environment or application availability.
*
*
* -
*
* RestartEnvironment
: The environment is entirely restarted, all AWS resources are deleted
* and recreated, and the environment is unavailable during the process.
*
*
* -
*
* RestartApplicationServer
: The environment is available the entire time. However, a short
* application outage occurs when the application servers on the running Amazon EC2 instances are restarted.
*
*
*/
public final String changeSeverity() {
return changeSeverity;
}
/**
*
* An indication of whether the user defined this configuration option:
*
*
* -
*
* true
: This configuration option was defined by the user. It is a valid choice for specifying if
* this as an Option to Remove
when updating configuration settings.
*
*
* -
*
* false
: This configuration was not defined by the user.
*
*
*
*
* Constraint: You can remove only UserDefined
options from a configuration.
*
*
* Valid Values: true
| false
*
*
* @return An indication of whether the user defined this configuration option:
*
* -
*
* true
: This configuration option was defined by the user. It is a valid choice for
* specifying if this as an Option to Remove
when updating configuration settings.
*
*
* -
*
* false
: This configuration was not defined by the user.
*
*
*
*
* Constraint: You can remove only UserDefined
options from a configuration.
*
*
* Valid Values: true
| false
*/
public final Boolean userDefined() {
return userDefined;
}
/**
*
* An indication of which type of values this option has and whether it is allowable to select one or more than one
* of the possible values:
*
*
* -
*
* Scalar
: Values for this option are a single selection from the possible values, or an unformatted
* string, or numeric value governed by the MIN/MAX/Regex
constraints.
*
*
* -
*
* List
: Values for this option are multiple selections from the possible values.
*
*
* -
*
* Boolean
: Values for this option are either true
or false
.
*
*
* -
*
* Json
: Values for this option are a JSON representation of a ConfigDocument
.
*
*
*
*
* If the service returns an enum value that is not available in the current SDK version, {@link #valueType} will
* return {@link ConfigurationOptionValueType#UNKNOWN_TO_SDK_VERSION}. The raw value returned by the service is
* available from {@link #valueTypeAsString}.
*
*
* @return An indication of which type of values this option has and whether it is allowable to select one or more
* than one of the possible values:
*
* -
*
* Scalar
: Values for this option are a single selection from the possible values, or an
* unformatted string, or numeric value governed by the MIN/MAX/Regex
constraints.
*
*
* -
*
* List
: Values for this option are multiple selections from the possible values.
*
*
* -
*
* Boolean
: Values for this option are either true
or false
.
*
*
* -
*
* Json
: Values for this option are a JSON representation of a ConfigDocument
.
*
*
* @see ConfigurationOptionValueType
*/
public final ConfigurationOptionValueType valueType() {
return ConfigurationOptionValueType.fromValue(valueType);
}
/**
*
* An indication of which type of values this option has and whether it is allowable to select one or more than one
* of the possible values:
*
*
* -
*
* Scalar
: Values for this option are a single selection from the possible values, or an unformatted
* string, or numeric value governed by the MIN/MAX/Regex
constraints.
*
*
* -
*
* List
: Values for this option are multiple selections from the possible values.
*
*
* -
*
* Boolean
: Values for this option are either true
or false
.
*
*
* -
*
* Json
: Values for this option are a JSON representation of a ConfigDocument
.
*
*
*
*
* If the service returns an enum value that is not available in the current SDK version, {@link #valueType} will
* return {@link ConfigurationOptionValueType#UNKNOWN_TO_SDK_VERSION}. The raw value returned by the service is
* available from {@link #valueTypeAsString}.
*
*
* @return An indication of which type of values this option has and whether it is allowable to select one or more
* than one of the possible values:
*
* -
*
* Scalar
: Values for this option are a single selection from the possible values, or an
* unformatted string, or numeric value governed by the MIN/MAX/Regex
constraints.
*
*
* -
*
* List
: Values for this option are multiple selections from the possible values.
*
*
* -
*
* Boolean
: Values for this option are either true
or false
.
*
*
* -
*
* Json
: Values for this option are a JSON representation of a ConfigDocument
.
*
*
* @see ConfigurationOptionValueType
*/
public final String valueTypeAsString() {
return valueType;
}
/**
* Returns true if the ValueOptions property was specified by the sender (it may be empty), or false if the sender
* did not specify the value (it will be empty). For responses returned by the SDK, the sender is the AWS service.
*/
public final boolean hasValueOptions() {
return valueOptions != null && !(valueOptions instanceof SdkAutoConstructList);
}
/**
*
* If specified, values for the configuration option are selected from this list.
*
*
* Attempts to modify the collection returned by this method will result in an UnsupportedOperationException.
*
*
* You can use {@link #hasValueOptions()} to see if a value was sent in this field.
*
*
* @return If specified, values for the configuration option are selected from this list.
*/
public final List valueOptions() {
return valueOptions;
}
/**
*
* If specified, the configuration option must be a numeric value greater than this value.
*
*
* @return If specified, the configuration option must be a numeric value greater than this value.
*/
public final Integer minValue() {
return minValue;
}
/**
*
* If specified, the configuration option must be a numeric value less than this value.
*
*
* @return If specified, the configuration option must be a numeric value less than this value.
*/
public final Integer maxValue() {
return maxValue;
}
/**
*
* If specified, the configuration option must be a string value no longer than this value.
*
*
* @return If specified, the configuration option must be a string value no longer than this value.
*/
public final Integer maxLength() {
return maxLength;
}
/**
*
* If specified, the configuration option must be a string value that satisfies this regular expression.
*
*
* @return If specified, the configuration option must be a string value that satisfies this regular expression.
*/
public final OptionRestrictionRegex regex() {
return regex;
}
@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(namespace());
hashCode = 31 * hashCode + Objects.hashCode(name());
hashCode = 31 * hashCode + Objects.hashCode(defaultValue());
hashCode = 31 * hashCode + Objects.hashCode(changeSeverity());
hashCode = 31 * hashCode + Objects.hashCode(userDefined());
hashCode = 31 * hashCode + Objects.hashCode(valueTypeAsString());
hashCode = 31 * hashCode + Objects.hashCode(hasValueOptions() ? valueOptions() : null);
hashCode = 31 * hashCode + Objects.hashCode(minValue());
hashCode = 31 * hashCode + Objects.hashCode(maxValue());
hashCode = 31 * hashCode + Objects.hashCode(maxLength());
hashCode = 31 * hashCode + Objects.hashCode(regex());
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 ConfigurationOptionDescription)) {
return false;
}
ConfigurationOptionDescription other = (ConfigurationOptionDescription) obj;
return Objects.equals(namespace(), other.namespace()) && Objects.equals(name(), other.name())
&& Objects.equals(defaultValue(), other.defaultValue())
&& Objects.equals(changeSeverity(), other.changeSeverity()) && Objects.equals(userDefined(), other.userDefined())
&& Objects.equals(valueTypeAsString(), other.valueTypeAsString()) && hasValueOptions() == other.hasValueOptions()
&& Objects.equals(valueOptions(), other.valueOptions()) && Objects.equals(minValue(), other.minValue())
&& Objects.equals(maxValue(), other.maxValue()) && Objects.equals(maxLength(), other.maxLength())
&& Objects.equals(regex(), other.regex());
}
/**
* 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("ConfigurationOptionDescription").add("Namespace", namespace()).add("Name", name())
.add("DefaultValue", defaultValue()).add("ChangeSeverity", changeSeverity()).add("UserDefined", userDefined())
.add("ValueType", valueTypeAsString()).add("ValueOptions", hasValueOptions() ? valueOptions() : null)
.add("MinValue", minValue()).add("MaxValue", maxValue()).add("MaxLength", maxLength()).add("Regex", regex())
.build();
}
public final Optional getValueForField(String fieldName, Class clazz) {
switch (fieldName) {
case "Namespace":
return Optional.ofNullable(clazz.cast(namespace()));
case "Name":
return Optional.ofNullable(clazz.cast(name()));
case "DefaultValue":
return Optional.ofNullable(clazz.cast(defaultValue()));
case "ChangeSeverity":
return Optional.ofNullable(clazz.cast(changeSeverity()));
case "UserDefined":
return Optional.ofNullable(clazz.cast(userDefined()));
case "ValueType":
return Optional.ofNullable(clazz.cast(valueTypeAsString()));
case "ValueOptions":
return Optional.ofNullable(clazz.cast(valueOptions()));
case "MinValue":
return Optional.ofNullable(clazz.cast(minValue()));
case "MaxValue":
return Optional.ofNullable(clazz.cast(maxValue()));
case "MaxLength":
return Optional.ofNullable(clazz.cast(maxLength()));
case "Regex":
return Optional.ofNullable(clazz.cast(regex()));
default:
return Optional.empty();
}
}
@Override
public final List> sdkFields() {
return SDK_FIELDS;
}
private static Function