
software.amazon.awssdk.services.rds.model.OptionGroupOptionSetting Maven / Gradle / Ivy
/*
* 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.rds.model;
import java.beans.Transient;
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 java.util.stream.Collectors;
import java.util.stream.Stream;
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;
/**
*
* Option group option settings are used to display settings available for each option with their default values and
* other information. These values are used with the DescribeOptionGroupOptions action.
*
*/
@Generated("software.amazon.awssdk:codegen")
public final class OptionGroupOptionSetting implements SdkPojo, Serializable,
ToCopyableBuilder {
private static final SdkField SETTING_NAME_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("SettingName").getter(getter(OptionGroupOptionSetting::settingName)).setter(setter(Builder::settingName))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("SettingName").build()).build();
private static final SdkField SETTING_DESCRIPTION_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("SettingDescription").getter(getter(OptionGroupOptionSetting::settingDescription))
.setter(setter(Builder::settingDescription))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("SettingDescription").build())
.build();
private static final SdkField DEFAULT_VALUE_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("DefaultValue").getter(getter(OptionGroupOptionSetting::defaultValue))
.setter(setter(Builder::defaultValue))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("DefaultValue").build()).build();
private static final SdkField APPLY_TYPE_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("ApplyType").getter(getter(OptionGroupOptionSetting::applyType)).setter(setter(Builder::applyType))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("ApplyType").build()).build();
private static final SdkField ALLOWED_VALUES_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("AllowedValues").getter(getter(OptionGroupOptionSetting::allowedValues))
.setter(setter(Builder::allowedValues))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("AllowedValues").build()).build();
private static final SdkField IS_MODIFIABLE_FIELD = SdkField. builder(MarshallingType.BOOLEAN)
.memberName("IsModifiable").getter(getter(OptionGroupOptionSetting::isModifiable))
.setter(setter(Builder::isModifiable))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("IsModifiable").build()).build();
private static final SdkField IS_REQUIRED_FIELD = SdkField. builder(MarshallingType.BOOLEAN)
.memberName("IsRequired").getter(getter(OptionGroupOptionSetting::isRequired)).setter(setter(Builder::isRequired))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("IsRequired").build()).build();
private static final SdkField> MINIMUM_ENGINE_VERSION_PER_ALLOWED_VALUE_FIELD = SdkField
.> builder(MarshallingType.LIST)
.memberName("MinimumEngineVersionPerAllowedValue")
.getter(getter(OptionGroupOptionSetting::minimumEngineVersionPerAllowedValue))
.setter(setter(Builder::minimumEngineVersionPerAllowedValue))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD)
.locationName("MinimumEngineVersionPerAllowedValue").build(),
ListTrait
.builder()
.memberLocationName("MinimumEngineVersionPerAllowedValue")
.memberFieldInfo(
SdkField. builder(MarshallingType.SDK_POJO)
.constructor(MinimumEngineVersionPerAllowedValue::builder)
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD)
.locationName("MinimumEngineVersionPerAllowedValue").build()).build())
.build()).build();
private static final List> SDK_FIELDS = Collections.unmodifiableList(Arrays.asList(SETTING_NAME_FIELD,
SETTING_DESCRIPTION_FIELD, DEFAULT_VALUE_FIELD, APPLY_TYPE_FIELD, ALLOWED_VALUES_FIELD, IS_MODIFIABLE_FIELD,
IS_REQUIRED_FIELD, MINIMUM_ENGINE_VERSION_PER_ALLOWED_VALUE_FIELD));
private static final long serialVersionUID = 1L;
private final String settingName;
private final String settingDescription;
private final String defaultValue;
private final String applyType;
private final String allowedValues;
private final Boolean isModifiable;
private final Boolean isRequired;
private final List minimumEngineVersionPerAllowedValue;
private OptionGroupOptionSetting(BuilderImpl builder) {
this.settingName = builder.settingName;
this.settingDescription = builder.settingDescription;
this.defaultValue = builder.defaultValue;
this.applyType = builder.applyType;
this.allowedValues = builder.allowedValues;
this.isModifiable = builder.isModifiable;
this.isRequired = builder.isRequired;
this.minimumEngineVersionPerAllowedValue = builder.minimumEngineVersionPerAllowedValue;
}
/**
*
* The name of the option group option.
*
*
* @return The name of the option group option.
*/
public final String settingName() {
return settingName;
}
/**
*
* The description of the option group option.
*
*
* @return The description of the option group option.
*/
public final String settingDescription() {
return settingDescription;
}
/**
*
* The default value for the option group option.
*
*
* @return The default value for the option group option.
*/
public final String defaultValue() {
return defaultValue;
}
/**
*
* The DB engine specific parameter type for the option group option.
*
*
* @return The DB engine specific parameter type for the option group option.
*/
public final String applyType() {
return applyType;
}
/**
*
* Indicates the acceptable values for the option group option.
*
*
* @return Indicates the acceptable values for the option group option.
*/
public final String allowedValues() {
return allowedValues;
}
/**
*
* Indicates whether this option group option can be changed from the default value.
*
*
* @return Indicates whether this option group option can be changed from the default value.
*/
public final Boolean isModifiable() {
return isModifiable;
}
/**
*
* Indicates whether a value must be specified for this option setting of the option group option.
*
*
* @return Indicates whether a value must be specified for this option setting of the option group option.
*/
public final Boolean isRequired() {
return isRequired;
}
/**
* For responses, this returns true if the service returned a value for the MinimumEngineVersionPerAllowedValue
* property. This DOES NOT check that the value is non-empty (for which, you should check the {@code isEmpty()}
* method on the property). This is useful because the SDK will never return a null collection or map, but you may
* need to differentiate between the service returning nothing (or null) and the service returning an empty
* collection or map. For requests, this returns true if a value for the property was specified in the request
* builder, and false if a value was not specified.
*/
public final boolean hasMinimumEngineVersionPerAllowedValue() {
return minimumEngineVersionPerAllowedValue != null
&& !(minimumEngineVersionPerAllowedValue instanceof SdkAutoConstructList);
}
/**
*
* The minimum DB engine version required for the corresponding allowed value for this option setting.
*
*
* Attempts to modify the collection returned by this method will result in an UnsupportedOperationException.
*
*
* This method will never return null. If you would like to know whether the service returned this field (so that
* you can differentiate between null and empty), you can use the {@link #hasMinimumEngineVersionPerAllowedValue}
* method.
*
*
* @return The minimum DB engine version required for the corresponding allowed value for this option setting.
*/
public final List minimumEngineVersionPerAllowedValue() {
return minimumEngineVersionPerAllowedValue;
}
@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(settingName());
hashCode = 31 * hashCode + Objects.hashCode(settingDescription());
hashCode = 31 * hashCode + Objects.hashCode(defaultValue());
hashCode = 31 * hashCode + Objects.hashCode(applyType());
hashCode = 31 * hashCode + Objects.hashCode(allowedValues());
hashCode = 31 * hashCode + Objects.hashCode(isModifiable());
hashCode = 31 * hashCode + Objects.hashCode(isRequired());
hashCode = 31 * hashCode
+ Objects.hashCode(hasMinimumEngineVersionPerAllowedValue() ? minimumEngineVersionPerAllowedValue() : null);
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 OptionGroupOptionSetting)) {
return false;
}
OptionGroupOptionSetting other = (OptionGroupOptionSetting) obj;
return Objects.equals(settingName(), other.settingName())
&& Objects.equals(settingDescription(), other.settingDescription())
&& Objects.equals(defaultValue(), other.defaultValue()) && Objects.equals(applyType(), other.applyType())
&& Objects.equals(allowedValues(), other.allowedValues()) && Objects.equals(isModifiable(), other.isModifiable())
&& Objects.equals(isRequired(), other.isRequired())
&& hasMinimumEngineVersionPerAllowedValue() == other.hasMinimumEngineVersionPerAllowedValue()
&& Objects.equals(minimumEngineVersionPerAllowedValue(), other.minimumEngineVersionPerAllowedValue());
}
/**
* 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("OptionGroupOptionSetting")
.add("SettingName", settingName())
.add("SettingDescription", settingDescription())
.add("DefaultValue", defaultValue())
.add("ApplyType", applyType())
.add("AllowedValues", allowedValues())
.add("IsModifiable", isModifiable())
.add("IsRequired", isRequired())
.add("MinimumEngineVersionPerAllowedValue",
hasMinimumEngineVersionPerAllowedValue() ? minimumEngineVersionPerAllowedValue() : null).build();
}
public final Optional getValueForField(String fieldName, Class clazz) {
switch (fieldName) {
case "SettingName":
return Optional.ofNullable(clazz.cast(settingName()));
case "SettingDescription":
return Optional.ofNullable(clazz.cast(settingDescription()));
case "DefaultValue":
return Optional.ofNullable(clazz.cast(defaultValue()));
case "ApplyType":
return Optional.ofNullable(clazz.cast(applyType()));
case "AllowedValues":
return Optional.ofNullable(clazz.cast(allowedValues()));
case "IsModifiable":
return Optional.ofNullable(clazz.cast(isModifiable()));
case "IsRequired":
return Optional.ofNullable(clazz.cast(isRequired()));
case "MinimumEngineVersionPerAllowedValue":
return Optional.ofNullable(clazz.cast(minimumEngineVersionPerAllowedValue()));
default:
return Optional.empty();
}
}
@Override
public final List> sdkFields() {
return SDK_FIELDS;
}
private static Function