software.amazon.awssdk.services.rds.model.OptionConfiguration Maven / Gradle / Ivy
Show all versions of rds 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.rds.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 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;
/**
*
* A list of all available options
*
*/
@Generated("software.amazon.awssdk:codegen")
public final class OptionConfiguration implements SdkPojo, Serializable,
ToCopyableBuilder {
private static final SdkField OPTION_NAME_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("OptionName").getter(getter(OptionConfiguration::optionName)).setter(setter(Builder::optionName))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("OptionName").build()).build();
private static final SdkField PORT_FIELD = SdkField. builder(MarshallingType.INTEGER).memberName("Port")
.getter(getter(OptionConfiguration::port)).setter(setter(Builder::port))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("Port").build()).build();
private static final SdkField OPTION_VERSION_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("OptionVersion").getter(getter(OptionConfiguration::optionVersion))
.setter(setter(Builder::optionVersion))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("OptionVersion").build()).build();
private static final SdkField> DB_SECURITY_GROUP_MEMBERSHIPS_FIELD = SdkField
.> builder(MarshallingType.LIST)
.memberName("DBSecurityGroupMemberships")
.getter(getter(OptionConfiguration::dbSecurityGroupMemberships))
.setter(setter(Builder::dbSecurityGroupMemberships))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("DBSecurityGroupMemberships").build(),
ListTrait
.builder()
.memberLocationName("DBSecurityGroupName")
.memberFieldInfo(
SdkField. builder(MarshallingType.STRING)
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD)
.locationName("DBSecurityGroupName").build()).build()).build()).build();
private static final SdkField> VPC_SECURITY_GROUP_MEMBERSHIPS_FIELD = SdkField
.> builder(MarshallingType.LIST)
.memberName("VpcSecurityGroupMemberships")
.getter(getter(OptionConfiguration::vpcSecurityGroupMemberships))
.setter(setter(Builder::vpcSecurityGroupMemberships))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("VpcSecurityGroupMemberships")
.build(),
ListTrait
.builder()
.memberLocationName("VpcSecurityGroupId")
.memberFieldInfo(
SdkField. builder(MarshallingType.STRING)
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD)
.locationName("VpcSecurityGroupId").build()).build()).build()).build();
private static final SdkField> OPTION_SETTINGS_FIELD = SdkField
.> builder(MarshallingType.LIST)
.memberName("OptionSettings")
.getter(getter(OptionConfiguration::optionSettings))
.setter(setter(Builder::optionSettings))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("OptionSettings").build(),
ListTrait
.builder()
.memberLocationName("OptionSetting")
.memberFieldInfo(
SdkField. builder(MarshallingType.SDK_POJO)
.constructor(OptionSetting::builder)
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD)
.locationName("OptionSetting").build()).build()).build()).build();
private static final List> SDK_FIELDS = Collections.unmodifiableList(Arrays.asList(OPTION_NAME_FIELD, PORT_FIELD,
OPTION_VERSION_FIELD, DB_SECURITY_GROUP_MEMBERSHIPS_FIELD, VPC_SECURITY_GROUP_MEMBERSHIPS_FIELD,
OPTION_SETTINGS_FIELD));
private static final long serialVersionUID = 1L;
private final String optionName;
private final Integer port;
private final String optionVersion;
private final List dbSecurityGroupMemberships;
private final List vpcSecurityGroupMemberships;
private final List optionSettings;
private OptionConfiguration(BuilderImpl builder) {
this.optionName = builder.optionName;
this.port = builder.port;
this.optionVersion = builder.optionVersion;
this.dbSecurityGroupMemberships = builder.dbSecurityGroupMemberships;
this.vpcSecurityGroupMemberships = builder.vpcSecurityGroupMemberships;
this.optionSettings = builder.optionSettings;
}
/**
*
* The configuration of options to include in a group.
*
*
* @return The configuration of options to include in a group.
*/
public final String optionName() {
return optionName;
}
/**
*
* The optional port for the option.
*
*
* @return The optional port for the option.
*/
public final Integer port() {
return port;
}
/**
*
* The version for the option.
*
*
* @return The version for the option.
*/
public final String optionVersion() {
return optionVersion;
}
/**
* For responses, this returns true if the service returned a value for the DBSecurityGroupMemberships 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 hasDbSecurityGroupMemberships() {
return dbSecurityGroupMemberships != null && !(dbSecurityGroupMemberships instanceof SdkAutoConstructList);
}
/**
*
* A list of DBSecurityGroupMembership name strings used for this option.
*
*
* 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 #hasDbSecurityGroupMemberships} method.
*
*
* @return A list of DBSecurityGroupMembership name strings used for this option.
*/
public final List dbSecurityGroupMemberships() {
return dbSecurityGroupMemberships;
}
/**
* For responses, this returns true if the service returned a value for the VpcSecurityGroupMemberships 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 hasVpcSecurityGroupMemberships() {
return vpcSecurityGroupMemberships != null && !(vpcSecurityGroupMemberships instanceof SdkAutoConstructList);
}
/**
*
* A list of VpcSecurityGroupMembership name strings used for this option.
*
*
* 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 #hasVpcSecurityGroupMemberships} method.
*
*
* @return A list of VpcSecurityGroupMembership name strings used for this option.
*/
public final List vpcSecurityGroupMemberships() {
return vpcSecurityGroupMemberships;
}
/**
* For responses, this returns true if the service returned a value for the OptionSettings 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 hasOptionSettings() {
return optionSettings != null && !(optionSettings instanceof SdkAutoConstructList);
}
/**
*
* The option settings to include in an option group.
*
*
* 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 #hasOptionSettings} method.
*
*
* @return The option settings to include in an option group.
*/
public final List optionSettings() {
return optionSettings;
}
@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(optionName());
hashCode = 31 * hashCode + Objects.hashCode(port());
hashCode = 31 * hashCode + Objects.hashCode(optionVersion());
hashCode = 31 * hashCode + Objects.hashCode(hasDbSecurityGroupMemberships() ? dbSecurityGroupMemberships() : null);
hashCode = 31 * hashCode + Objects.hashCode(hasVpcSecurityGroupMemberships() ? vpcSecurityGroupMemberships() : null);
hashCode = 31 * hashCode + Objects.hashCode(hasOptionSettings() ? optionSettings() : 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 OptionConfiguration)) {
return false;
}
OptionConfiguration other = (OptionConfiguration) obj;
return Objects.equals(optionName(), other.optionName()) && Objects.equals(port(), other.port())
&& Objects.equals(optionVersion(), other.optionVersion())
&& hasDbSecurityGroupMemberships() == other.hasDbSecurityGroupMemberships()
&& Objects.equals(dbSecurityGroupMemberships(), other.dbSecurityGroupMemberships())
&& hasVpcSecurityGroupMemberships() == other.hasVpcSecurityGroupMemberships()
&& Objects.equals(vpcSecurityGroupMemberships(), other.vpcSecurityGroupMemberships())
&& hasOptionSettings() == other.hasOptionSettings() && Objects.equals(optionSettings(), other.optionSettings());
}
/**
* 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("OptionConfiguration").add("OptionName", optionName()).add("Port", port())
.add("OptionVersion", optionVersion())
.add("DBSecurityGroupMemberships", hasDbSecurityGroupMemberships() ? dbSecurityGroupMemberships() : null)
.add("VpcSecurityGroupMemberships", hasVpcSecurityGroupMemberships() ? vpcSecurityGroupMemberships() : null)
.add("OptionSettings", hasOptionSettings() ? optionSettings() : null).build();
}
public final Optional getValueForField(String fieldName, Class clazz) {
switch (fieldName) {
case "OptionName":
return Optional.ofNullable(clazz.cast(optionName()));
case "Port":
return Optional.ofNullable(clazz.cast(port()));
case "OptionVersion":
return Optional.ofNullable(clazz.cast(optionVersion()));
case "DBSecurityGroupMemberships":
return Optional.ofNullable(clazz.cast(dbSecurityGroupMemberships()));
case "VpcSecurityGroupMemberships":
return Optional.ofNullable(clazz.cast(vpcSecurityGroupMemberships()));
case "OptionSettings":
return Optional.ofNullable(clazz.cast(optionSettings()));
default:
return Optional.empty();
}
}
@Override
public final List> sdkFields() {
return SDK_FIELDS;
}
private static Function