software.amazon.awssdk.services.rds.model.CreateGlobalClusterRequest 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.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.awscore.AwsRequestOverrideConfiguration;
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;
/**
*/
@Generated("software.amazon.awssdk:codegen")
public final class CreateGlobalClusterRequest extends RdsRequest implements
ToCopyableBuilder {
private static final SdkField GLOBAL_CLUSTER_IDENTIFIER_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("GlobalClusterIdentifier").getter(getter(CreateGlobalClusterRequest::globalClusterIdentifier))
.setter(setter(Builder::globalClusterIdentifier))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("GlobalClusterIdentifier").build())
.build();
private static final SdkField SOURCE_DB_CLUSTER_IDENTIFIER_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("SourceDBClusterIdentifier").getter(getter(CreateGlobalClusterRequest::sourceDBClusterIdentifier))
.setter(setter(Builder::sourceDBClusterIdentifier))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("SourceDBClusterIdentifier").build())
.build();
private static final SdkField ENGINE_FIELD = SdkField. builder(MarshallingType.STRING).memberName("Engine")
.getter(getter(CreateGlobalClusterRequest::engine)).setter(setter(Builder::engine))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("Engine").build()).build();
private static final SdkField ENGINE_VERSION_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("EngineVersion").getter(getter(CreateGlobalClusterRequest::engineVersion))
.setter(setter(Builder::engineVersion))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("EngineVersion").build()).build();
private static final SdkField ENGINE_LIFECYCLE_SUPPORT_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("EngineLifecycleSupport").getter(getter(CreateGlobalClusterRequest::engineLifecycleSupport))
.setter(setter(Builder::engineLifecycleSupport))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("EngineLifecycleSupport").build())
.build();
private static final SdkField DELETION_PROTECTION_FIELD = SdkField. builder(MarshallingType.BOOLEAN)
.memberName("DeletionProtection").getter(getter(CreateGlobalClusterRequest::deletionProtection))
.setter(setter(Builder::deletionProtection))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("DeletionProtection").build())
.build();
private static final SdkField DATABASE_NAME_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("DatabaseName").getter(getter(CreateGlobalClusterRequest::databaseName))
.setter(setter(Builder::databaseName))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("DatabaseName").build()).build();
private static final SdkField STORAGE_ENCRYPTED_FIELD = SdkField. builder(MarshallingType.BOOLEAN)
.memberName("StorageEncrypted").getter(getter(CreateGlobalClusterRequest::storageEncrypted))
.setter(setter(Builder::storageEncrypted))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("StorageEncrypted").build()).build();
private static final SdkField> TAGS_FIELD = SdkField
.> builder(MarshallingType.LIST)
.memberName("Tags")
.getter(getter(CreateGlobalClusterRequest::tags))
.setter(setter(Builder::tags))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("Tags").build(),
ListTrait
.builder()
.memberLocationName("Tag")
.memberFieldInfo(
SdkField. builder(MarshallingType.SDK_POJO)
.constructor(Tag::builder)
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD)
.locationName("Tag").build()).build()).build()).build();
private static final List> SDK_FIELDS = Collections.unmodifiableList(Arrays.asList(
GLOBAL_CLUSTER_IDENTIFIER_FIELD, SOURCE_DB_CLUSTER_IDENTIFIER_FIELD, ENGINE_FIELD, ENGINE_VERSION_FIELD,
ENGINE_LIFECYCLE_SUPPORT_FIELD, DELETION_PROTECTION_FIELD, DATABASE_NAME_FIELD, STORAGE_ENCRYPTED_FIELD, TAGS_FIELD));
private final String globalClusterIdentifier;
private final String sourceDBClusterIdentifier;
private final String engine;
private final String engineVersion;
private final String engineLifecycleSupport;
private final Boolean deletionProtection;
private final String databaseName;
private final Boolean storageEncrypted;
private final List tags;
private CreateGlobalClusterRequest(BuilderImpl builder) {
super(builder);
this.globalClusterIdentifier = builder.globalClusterIdentifier;
this.sourceDBClusterIdentifier = builder.sourceDBClusterIdentifier;
this.engine = builder.engine;
this.engineVersion = builder.engineVersion;
this.engineLifecycleSupport = builder.engineLifecycleSupport;
this.deletionProtection = builder.deletionProtection;
this.databaseName = builder.databaseName;
this.storageEncrypted = builder.storageEncrypted;
this.tags = builder.tags;
}
/**
*
* The cluster identifier for this global database cluster. This parameter is stored as a lowercase string.
*
*
* @return The cluster identifier for this global database cluster. This parameter is stored as a lowercase string.
*/
public final String globalClusterIdentifier() {
return globalClusterIdentifier;
}
/**
*
* The Amazon Resource Name (ARN) to use as the primary cluster of the global database.
*
*
* If you provide a value for this parameter, don't specify values for the following settings because Amazon Aurora
* uses the values from the specified source DB cluster:
*
*
* -
*
* DatabaseName
*
*
* -
*
* Engine
*
*
* -
*
* EngineVersion
*
*
* -
*
* StorageEncrypted
*
*
*
*
* @return The Amazon Resource Name (ARN) to use as the primary cluster of the global database.
*
* If you provide a value for this parameter, don't specify values for the following settings because Amazon
* Aurora uses the values from the specified source DB cluster:
*
*
* -
*
* DatabaseName
*
*
* -
*
* Engine
*
*
* -
*
* EngineVersion
*
*
* -
*
* StorageEncrypted
*
*
*/
public final String sourceDBClusterIdentifier() {
return sourceDBClusterIdentifier;
}
/**
*
* The database engine to use for this global database cluster.
*
*
* Valid Values: aurora-mysql | aurora-postgresql
*
*
* Constraints:
*
*
* -
*
* Can't be specified if SourceDBClusterIdentifier
is specified. In this case, Amazon Aurora uses the
* engine of the source DB cluster.
*
*
*
*
* @return The database engine to use for this global database cluster.
*
* Valid Values: aurora-mysql | aurora-postgresql
*
*
* Constraints:
*
*
* -
*
* Can't be specified if SourceDBClusterIdentifier
is specified. In this case, Amazon Aurora
* uses the engine of the source DB cluster.
*
*
*/
public final String engine() {
return engine;
}
/**
*
* The engine version to use for this global database cluster.
*
*
* Constraints:
*
*
* -
*
* Can't be specified if SourceDBClusterIdentifier
is specified. In this case, Amazon Aurora uses the
* engine version of the source DB cluster.
*
*
*
*
* @return The engine version to use for this global database cluster.
*
* Constraints:
*
*
* -
*
* Can't be specified if SourceDBClusterIdentifier
is specified. In this case, Amazon Aurora
* uses the engine version of the source DB cluster.
*
*
*/
public final String engineVersion() {
return engineVersion;
}
/**
*
* The life cycle type for this global database cluster.
*
*
*
* By default, this value is set to open-source-rds-extended-support
, which enrolls your global cluster
* into Amazon RDS Extended Support. At the end of standard support, you can avoid charges for Extended Support by
* setting the value to open-source-rds-extended-support-disabled
. In this case, creating the global
* cluster will fail if the DB major version is past its end of standard support date.
*
*
*
* This setting only applies to Aurora PostgreSQL-based global databases.
*
*
* You can use this setting to enroll your global cluster into Amazon RDS Extended Support. With RDS Extended
* Support, you can run the selected major engine version on your global cluster past the end of standard support
* for that engine version. For more information, see Using Amazon RDS
* Extended Support in the Amazon Aurora User Guide.
*
*
* Valid Values: open-source-rds-extended-support | open-source-rds-extended-support-disabled
*
*
* Default: open-source-rds-extended-support
*
*
* @return The life cycle type for this global database cluster.
*
* By default, this value is set to open-source-rds-extended-support
, which enrolls your global
* cluster into Amazon RDS Extended Support. At the end of standard support, you can avoid charges for
* Extended Support by setting the value to open-source-rds-extended-support-disabled
. In this
* case, creating the global cluster will fail if the DB major version is past its end of standard support
* date.
*
*
*
* This setting only applies to Aurora PostgreSQL-based global databases.
*
*
* You can use this setting to enroll your global cluster into Amazon RDS Extended Support. With RDS
* Extended Support, you can run the selected major engine version on your global cluster past the end of
* standard support for that engine version. For more information, see Using Amazon
* RDS Extended Support in the Amazon Aurora User Guide.
*
*
* Valid Values: open-source-rds-extended-support | open-source-rds-extended-support-disabled
*
*
* Default: open-source-rds-extended-support
*/
public final String engineLifecycleSupport() {
return engineLifecycleSupport;
}
/**
*
* Specifies whether to enable deletion protection for the new global database cluster. The global database can't be
* deleted when deletion protection is enabled.
*
*
* @return Specifies whether to enable deletion protection for the new global database cluster. The global database
* can't be deleted when deletion protection is enabled.
*/
public final Boolean deletionProtection() {
return deletionProtection;
}
/**
*
* The name for your database of up to 64 alphanumeric characters. If you don't specify a name, Amazon Aurora
* doesn't create a database in the global database cluster.
*
*
* Constraints:
*
*
* -
*
* Can't be specified if SourceDBClusterIdentifier
is specified. In this case, Amazon Aurora uses the
* database name from the source DB cluster.
*
*
*
*
* @return The name for your database of up to 64 alphanumeric characters. If you don't specify a name, Amazon
* Aurora doesn't create a database in the global database cluster.
*
* Constraints:
*
*
* -
*
* Can't be specified if SourceDBClusterIdentifier
is specified. In this case, Amazon Aurora
* uses the database name from the source DB cluster.
*
*
*/
public final String databaseName() {
return databaseName;
}
/**
*
* Specifies whether to enable storage encryption for the new global database cluster.
*
*
* Constraints:
*
*
* -
*
* Can't be specified if SourceDBClusterIdentifier
is specified. In this case, Amazon Aurora uses the
* setting from the source DB cluster.
*
*
*
*
* @return Specifies whether to enable storage encryption for the new global database cluster.
*
* Constraints:
*
*
* -
*
* Can't be specified if SourceDBClusterIdentifier
is specified. In this case, Amazon Aurora
* uses the setting from the source DB cluster.
*
*
*/
public final Boolean storageEncrypted() {
return storageEncrypted;
}
/**
* For responses, this returns true if the service returned a value for the Tags 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 hasTags() {
return tags != null && !(tags instanceof SdkAutoConstructList);
}
/**
*
* Tags to assign to the global cluster.
*
*
* 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 #hasTags} method.
*
*
* @return Tags to assign to the global cluster.
*/
public final List tags() {
return tags;
}
@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 + super.hashCode();
hashCode = 31 * hashCode + Objects.hashCode(globalClusterIdentifier());
hashCode = 31 * hashCode + Objects.hashCode(sourceDBClusterIdentifier());
hashCode = 31 * hashCode + Objects.hashCode(engine());
hashCode = 31 * hashCode + Objects.hashCode(engineVersion());
hashCode = 31 * hashCode + Objects.hashCode(engineLifecycleSupport());
hashCode = 31 * hashCode + Objects.hashCode(deletionProtection());
hashCode = 31 * hashCode + Objects.hashCode(databaseName());
hashCode = 31 * hashCode + Objects.hashCode(storageEncrypted());
hashCode = 31 * hashCode + Objects.hashCode(hasTags() ? tags() : null);
return hashCode;
}
@Override
public final boolean equals(Object obj) {
return super.equals(obj) && equalsBySdkFields(obj);
}
@Override
public final boolean equalsBySdkFields(Object obj) {
if (this == obj) {
return true;
}
if (obj == null) {
return false;
}
if (!(obj instanceof CreateGlobalClusterRequest)) {
return false;
}
CreateGlobalClusterRequest other = (CreateGlobalClusterRequest) obj;
return Objects.equals(globalClusterIdentifier(), other.globalClusterIdentifier())
&& Objects.equals(sourceDBClusterIdentifier(), other.sourceDBClusterIdentifier())
&& Objects.equals(engine(), other.engine()) && Objects.equals(engineVersion(), other.engineVersion())
&& Objects.equals(engineLifecycleSupport(), other.engineLifecycleSupport())
&& Objects.equals(deletionProtection(), other.deletionProtection())
&& Objects.equals(databaseName(), other.databaseName())
&& Objects.equals(storageEncrypted(), other.storageEncrypted()) && hasTags() == other.hasTags()
&& Objects.equals(tags(), other.tags());
}
/**
* 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("CreateGlobalClusterRequest").add("GlobalClusterIdentifier", globalClusterIdentifier())
.add("SourceDBClusterIdentifier", sourceDBClusterIdentifier()).add("Engine", engine())
.add("EngineVersion", engineVersion()).add("EngineLifecycleSupport", engineLifecycleSupport())
.add("DeletionProtection", deletionProtection()).add("DatabaseName", databaseName())
.add("StorageEncrypted", storageEncrypted()).add("Tags", hasTags() ? tags() : null).build();
}
public final Optional getValueForField(String fieldName, Class clazz) {
switch (fieldName) {
case "GlobalClusterIdentifier":
return Optional.ofNullable(clazz.cast(globalClusterIdentifier()));
case "SourceDBClusterIdentifier":
return Optional.ofNullable(clazz.cast(sourceDBClusterIdentifier()));
case "Engine":
return Optional.ofNullable(clazz.cast(engine()));
case "EngineVersion":
return Optional.ofNullable(clazz.cast(engineVersion()));
case "EngineLifecycleSupport":
return Optional.ofNullable(clazz.cast(engineLifecycleSupport()));
case "DeletionProtection":
return Optional.ofNullable(clazz.cast(deletionProtection()));
case "DatabaseName":
return Optional.ofNullable(clazz.cast(databaseName()));
case "StorageEncrypted":
return Optional.ofNullable(clazz.cast(storageEncrypted()));
case "Tags":
return Optional.ofNullable(clazz.cast(tags()));
default:
return Optional.empty();
}
}
@Override
public final List> sdkFields() {
return SDK_FIELDS;
}
private static Function