All Downloads are FREE. Search and download functionalities are using the official Maven repository.

software.amazon.awssdk.services.rds.model.OptionConfiguration Maven / Gradle / Ivy

Go to download

The AWS Java SDK for Amazon RDS module holds the client classes that are used for communicating with Amazon Relational Database Service

There is a newer version: 2.29.15
Show newest version
/*
 * 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 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 getter(Function g) { return obj -> g.apply((OptionConfiguration) obj); } private static BiConsumer setter(BiConsumer s) { return (obj, val) -> s.accept((Builder) obj, val); } public interface Builder extends SdkPojo, CopyableBuilder { /** *

* The configuration of options to include in a group. *

* * @param optionName * The configuration of options to include in a group. * @return Returns a reference to this object so that method calls can be chained together. */ Builder optionName(String optionName); /** *

* The optional port for the option. *

* * @param port * The optional port for the option. * @return Returns a reference to this object so that method calls can be chained together. */ Builder port(Integer port); /** *

* The version for the option. *

* * @param optionVersion * The version for the option. * @return Returns a reference to this object so that method calls can be chained together. */ Builder optionVersion(String optionVersion); /** *

* A list of DBSecurityGroupMembership name strings used for this option. *

* * @param dbSecurityGroupMemberships * A list of DBSecurityGroupMembership name strings used for this option. * @return Returns a reference to this object so that method calls can be chained together. */ Builder dbSecurityGroupMemberships(Collection dbSecurityGroupMemberships); /** *

* A list of DBSecurityGroupMembership name strings used for this option. *

* * @param dbSecurityGroupMemberships * A list of DBSecurityGroupMembership name strings used for this option. * @return Returns a reference to this object so that method calls can be chained together. */ Builder dbSecurityGroupMemberships(String... dbSecurityGroupMemberships); /** *

* A list of VpcSecurityGroupMembership name strings used for this option. *

* * @param vpcSecurityGroupMemberships * A list of VpcSecurityGroupMembership name strings used for this option. * @return Returns a reference to this object so that method calls can be chained together. */ Builder vpcSecurityGroupMemberships(Collection vpcSecurityGroupMemberships); /** *

* A list of VpcSecurityGroupMembership name strings used for this option. *

* * @param vpcSecurityGroupMemberships * A list of VpcSecurityGroupMembership name strings used for this option. * @return Returns a reference to this object so that method calls can be chained together. */ Builder vpcSecurityGroupMemberships(String... vpcSecurityGroupMemberships); /** *

* The option settings to include in an option group. *

* * @param optionSettings * The option settings to include in an option group. * @return Returns a reference to this object so that method calls can be chained together. */ Builder optionSettings(Collection optionSettings); /** *

* The option settings to include in an option group. *

* * @param optionSettings * The option settings to include in an option group. * @return Returns a reference to this object so that method calls can be chained together. */ Builder optionSettings(OptionSetting... optionSettings); /** *

* The option settings to include in an option group. *

* This is a convenience method that creates an instance of the * {@link software.amazon.awssdk.services.rds.model.OptionSetting.Builder} avoiding the need to create one * manually via {@link software.amazon.awssdk.services.rds.model.OptionSetting#builder()}. * *

* When the {@link Consumer} completes, * {@link software.amazon.awssdk.services.rds.model.OptionSetting.Builder#build()} is called immediately and its * result is passed to {@link #optionSettings(List)}. * * @param optionSettings * a consumer that will call methods on * {@link software.amazon.awssdk.services.rds.model.OptionSetting.Builder} * @return Returns a reference to this object so that method calls can be chained together. * @see #optionSettings(java.util.Collection) */ Builder optionSettings(Consumer... optionSettings); } static final class BuilderImpl implements Builder { private String optionName; private Integer port; private String optionVersion; private List dbSecurityGroupMemberships = DefaultSdkAutoConstructList.getInstance(); private List vpcSecurityGroupMemberships = DefaultSdkAutoConstructList.getInstance(); private List optionSettings = DefaultSdkAutoConstructList.getInstance(); private BuilderImpl() { } private BuilderImpl(OptionConfiguration model) { optionName(model.optionName); port(model.port); optionVersion(model.optionVersion); dbSecurityGroupMemberships(model.dbSecurityGroupMemberships); vpcSecurityGroupMemberships(model.vpcSecurityGroupMemberships); optionSettings(model.optionSettings); } public final String getOptionName() { return optionName; } public final void setOptionName(String optionName) { this.optionName = optionName; } @Override public final Builder optionName(String optionName) { this.optionName = optionName; return this; } public final Integer getPort() { return port; } public final void setPort(Integer port) { this.port = port; } @Override public final Builder port(Integer port) { this.port = port; return this; } public final String getOptionVersion() { return optionVersion; } public final void setOptionVersion(String optionVersion) { this.optionVersion = optionVersion; } @Override public final Builder optionVersion(String optionVersion) { this.optionVersion = optionVersion; return this; } public final Collection getDbSecurityGroupMemberships() { if (dbSecurityGroupMemberships instanceof SdkAutoConstructList) { return null; } return dbSecurityGroupMemberships; } public final void setDbSecurityGroupMemberships(Collection dbSecurityGroupMemberships) { this.dbSecurityGroupMemberships = DBSecurityGroupNameListCopier.copy(dbSecurityGroupMemberships); } @Override public final Builder dbSecurityGroupMemberships(Collection dbSecurityGroupMemberships) { this.dbSecurityGroupMemberships = DBSecurityGroupNameListCopier.copy(dbSecurityGroupMemberships); return this; } @Override @SafeVarargs public final Builder dbSecurityGroupMemberships(String... dbSecurityGroupMemberships) { dbSecurityGroupMemberships(Arrays.asList(dbSecurityGroupMemberships)); return this; } public final Collection getVpcSecurityGroupMemberships() { if (vpcSecurityGroupMemberships instanceof SdkAutoConstructList) { return null; } return vpcSecurityGroupMemberships; } public final void setVpcSecurityGroupMemberships(Collection vpcSecurityGroupMemberships) { this.vpcSecurityGroupMemberships = VpcSecurityGroupIdListCopier.copy(vpcSecurityGroupMemberships); } @Override public final Builder vpcSecurityGroupMemberships(Collection vpcSecurityGroupMemberships) { this.vpcSecurityGroupMemberships = VpcSecurityGroupIdListCopier.copy(vpcSecurityGroupMemberships); return this; } @Override @SafeVarargs public final Builder vpcSecurityGroupMemberships(String... vpcSecurityGroupMemberships) { vpcSecurityGroupMemberships(Arrays.asList(vpcSecurityGroupMemberships)); return this; } public final List getOptionSettings() { List result = OptionSettingsListCopier.copyToBuilder(this.optionSettings); if (result instanceof SdkAutoConstructList) { return null; } return result; } public final void setOptionSettings(Collection optionSettings) { this.optionSettings = OptionSettingsListCopier.copyFromBuilder(optionSettings); } @Override public final Builder optionSettings(Collection optionSettings) { this.optionSettings = OptionSettingsListCopier.copy(optionSettings); return this; } @Override @SafeVarargs public final Builder optionSettings(OptionSetting... optionSettings) { optionSettings(Arrays.asList(optionSettings)); return this; } @Override @SafeVarargs public final Builder optionSettings(Consumer... optionSettings) { optionSettings(Stream.of(optionSettings).map(c -> OptionSetting.builder().applyMutation(c).build()) .collect(Collectors.toList())); return this; } @Override public OptionConfiguration build() { return new OptionConfiguration(this); } @Override public List> sdkFields() { return SDK_FIELDS; } } }





© 2015 - 2025 Weber Informatics LLC | Privacy Policy