
software.amazon.awssdk.services.docdb.model.ModifyDbClusterRequest 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.docdb.model;
import java.beans.Transient;
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.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;
/**
*
* Represents the input to ModifyDBCluster.
*
*/
@Generated("software.amazon.awssdk:codegen")
public final class ModifyDbClusterRequest extends DocDbRequest implements
ToCopyableBuilder {
private static final SdkField DB_CLUSTER_IDENTIFIER_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("DBClusterIdentifier").getter(getter(ModifyDbClusterRequest::dbClusterIdentifier))
.setter(setter(Builder::dbClusterIdentifier))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("DBClusterIdentifier").build())
.build();
private static final SdkField NEW_DB_CLUSTER_IDENTIFIER_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("NewDBClusterIdentifier").getter(getter(ModifyDbClusterRequest::newDBClusterIdentifier))
.setter(setter(Builder::newDBClusterIdentifier))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("NewDBClusterIdentifier").build())
.build();
private static final SdkField APPLY_IMMEDIATELY_FIELD = SdkField. builder(MarshallingType.BOOLEAN)
.memberName("ApplyImmediately").getter(getter(ModifyDbClusterRequest::applyImmediately))
.setter(setter(Builder::applyImmediately))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("ApplyImmediately").build()).build();
private static final SdkField BACKUP_RETENTION_PERIOD_FIELD = SdkField. builder(MarshallingType.INTEGER)
.memberName("BackupRetentionPeriod").getter(getter(ModifyDbClusterRequest::backupRetentionPeriod))
.setter(setter(Builder::backupRetentionPeriod))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("BackupRetentionPeriod").build())
.build();
private static final SdkField DB_CLUSTER_PARAMETER_GROUP_NAME_FIELD = SdkField
. builder(MarshallingType.STRING)
.memberName("DBClusterParameterGroupName")
.getter(getter(ModifyDbClusterRequest::dbClusterParameterGroupName))
.setter(setter(Builder::dbClusterParameterGroupName))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("DBClusterParameterGroupName")
.build()).build();
private static final SdkField> VPC_SECURITY_GROUP_IDS_FIELD = SdkField
.> builder(MarshallingType.LIST)
.memberName("VpcSecurityGroupIds")
.getter(getter(ModifyDbClusterRequest::vpcSecurityGroupIds))
.setter(setter(Builder::vpcSecurityGroupIds))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("VpcSecurityGroupIds").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 PORT_FIELD = SdkField. builder(MarshallingType.INTEGER).memberName("Port")
.getter(getter(ModifyDbClusterRequest::port)).setter(setter(Builder::port))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("Port").build()).build();
private static final SdkField MASTER_USER_PASSWORD_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("MasterUserPassword").getter(getter(ModifyDbClusterRequest::masterUserPassword))
.setter(setter(Builder::masterUserPassword))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("MasterUserPassword").build())
.build();
private static final SdkField PREFERRED_BACKUP_WINDOW_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("PreferredBackupWindow").getter(getter(ModifyDbClusterRequest::preferredBackupWindow))
.setter(setter(Builder::preferredBackupWindow))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("PreferredBackupWindow").build())
.build();
private static final SdkField PREFERRED_MAINTENANCE_WINDOW_FIELD = SdkField
. builder(MarshallingType.STRING)
.memberName("PreferredMaintenanceWindow")
.getter(getter(ModifyDbClusterRequest::preferredMaintenanceWindow))
.setter(setter(Builder::preferredMaintenanceWindow))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("PreferredMaintenanceWindow").build())
.build();
private static final SdkField CLOUDWATCH_LOGS_EXPORT_CONFIGURATION_FIELD = SdkField
. builder(MarshallingType.SDK_POJO)
.memberName("CloudwatchLogsExportConfiguration")
.getter(getter(ModifyDbClusterRequest::cloudwatchLogsExportConfiguration))
.setter(setter(Builder::cloudwatchLogsExportConfiguration))
.constructor(CloudwatchLogsExportConfiguration::builder)
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("CloudwatchLogsExportConfiguration")
.build()).build();
private static final SdkField ENGINE_VERSION_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("EngineVersion").getter(getter(ModifyDbClusterRequest::engineVersion))
.setter(setter(Builder::engineVersion))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("EngineVersion").build()).build();
private static final SdkField DELETION_PROTECTION_FIELD = SdkField. builder(MarshallingType.BOOLEAN)
.memberName("DeletionProtection").getter(getter(ModifyDbClusterRequest::deletionProtection))
.setter(setter(Builder::deletionProtection))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("DeletionProtection").build())
.build();
private static final List> SDK_FIELDS = Collections.unmodifiableList(Arrays.asList(DB_CLUSTER_IDENTIFIER_FIELD,
NEW_DB_CLUSTER_IDENTIFIER_FIELD, APPLY_IMMEDIATELY_FIELD, BACKUP_RETENTION_PERIOD_FIELD,
DB_CLUSTER_PARAMETER_GROUP_NAME_FIELD, VPC_SECURITY_GROUP_IDS_FIELD, PORT_FIELD, MASTER_USER_PASSWORD_FIELD,
PREFERRED_BACKUP_WINDOW_FIELD, PREFERRED_MAINTENANCE_WINDOW_FIELD, CLOUDWATCH_LOGS_EXPORT_CONFIGURATION_FIELD,
ENGINE_VERSION_FIELD, DELETION_PROTECTION_FIELD));
private final String dbClusterIdentifier;
private final String newDBClusterIdentifier;
private final Boolean applyImmediately;
private final Integer backupRetentionPeriod;
private final String dbClusterParameterGroupName;
private final List vpcSecurityGroupIds;
private final Integer port;
private final String masterUserPassword;
private final String preferredBackupWindow;
private final String preferredMaintenanceWindow;
private final CloudwatchLogsExportConfiguration cloudwatchLogsExportConfiguration;
private final String engineVersion;
private final Boolean deletionProtection;
private ModifyDbClusterRequest(BuilderImpl builder) {
super(builder);
this.dbClusterIdentifier = builder.dbClusterIdentifier;
this.newDBClusterIdentifier = builder.newDBClusterIdentifier;
this.applyImmediately = builder.applyImmediately;
this.backupRetentionPeriod = builder.backupRetentionPeriod;
this.dbClusterParameterGroupName = builder.dbClusterParameterGroupName;
this.vpcSecurityGroupIds = builder.vpcSecurityGroupIds;
this.port = builder.port;
this.masterUserPassword = builder.masterUserPassword;
this.preferredBackupWindow = builder.preferredBackupWindow;
this.preferredMaintenanceWindow = builder.preferredMaintenanceWindow;
this.cloudwatchLogsExportConfiguration = builder.cloudwatchLogsExportConfiguration;
this.engineVersion = builder.engineVersion;
this.deletionProtection = builder.deletionProtection;
}
/**
*
* The cluster identifier for the cluster that is being modified. This parameter is not case sensitive.
*
*
* Constraints:
*
*
* -
*
* Must match the identifier of an existing DBCluster
.
*
*
*
*
* @return The cluster identifier for the cluster that is being modified. This parameter is not case sensitive.
*
* Constraints:
*
*
* -
*
* Must match the identifier of an existing DBCluster
.
*
*
*/
public final String dbClusterIdentifier() {
return dbClusterIdentifier;
}
/**
*
* The new cluster identifier for the cluster when renaming a cluster. This value is stored as a lowercase string.
*
*
* Constraints:
*
*
* -
*
* Must contain from 1 to 63 letters, numbers, or hyphens.
*
*
* -
*
* The first character must be a letter.
*
*
* -
*
* Cannot end with a hyphen or contain two consecutive hyphens.
*
*
*
*
* Example: my-cluster2
*
*
* @return The new cluster identifier for the cluster when renaming a cluster. This value is stored as a lowercase
* string.
*
* Constraints:
*
*
* -
*
* Must contain from 1 to 63 letters, numbers, or hyphens.
*
*
* -
*
* The first character must be a letter.
*
*
* -
*
* Cannot end with a hyphen or contain two consecutive hyphens.
*
*
*
*
* Example: my-cluster2
*/
public final String newDBClusterIdentifier() {
return newDBClusterIdentifier;
}
/**
*
* A value that specifies whether the changes in this request and any pending changes are asynchronously applied as
* soon as possible, regardless of the PreferredMaintenanceWindow
setting for the cluster. If this
* parameter is set to false
, changes to the cluster are applied during the next maintenance window.
*
*
* The ApplyImmediately
parameter affects only the NewDBClusterIdentifier
and
* MasterUserPassword
values. If you set this parameter value to false
, the changes to the
* NewDBClusterIdentifier
and MasterUserPassword
values are applied during the next
* maintenance window. All other changes are applied immediately, regardless of the value of the
* ApplyImmediately
parameter.
*
*
* Default: false
*
*
* @return A value that specifies whether the changes in this request and any pending changes are asynchronously
* applied as soon as possible, regardless of the PreferredMaintenanceWindow
setting for the
* cluster. If this parameter is set to false
, changes to the cluster are applied during the
* next maintenance window.
*
* The ApplyImmediately
parameter affects only the NewDBClusterIdentifier
and
* MasterUserPassword
values. If you set this parameter value to false
, the
* changes to the NewDBClusterIdentifier
and MasterUserPassword
values are applied
* during the next maintenance window. All other changes are applied immediately, regardless of the value of
* the ApplyImmediately
parameter.
*
*
* Default: false
*/
public final Boolean applyImmediately() {
return applyImmediately;
}
/**
*
* The number of days for which automated backups are retained. You must specify a minimum value of 1.
*
*
* Default: 1
*
*
* Constraints:
*
*
* -
*
* Must be a value from 1 to 35.
*
*
*
*
* @return The number of days for which automated backups are retained. You must specify a minimum value of 1.
*
* Default: 1
*
*
* Constraints:
*
*
* -
*
* Must be a value from 1 to 35.
*
*
*/
public final Integer backupRetentionPeriod() {
return backupRetentionPeriod;
}
/**
*
* The name of the cluster parameter group to use for the cluster.
*
*
* @return The name of the cluster parameter group to use for the cluster.
*/
public final String dbClusterParameterGroupName() {
return dbClusterParameterGroupName;
}
/**
* For responses, this returns true if the service returned a value for the VpcSecurityGroupIds 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 hasVpcSecurityGroupIds() {
return vpcSecurityGroupIds != null && !(vpcSecurityGroupIds instanceof SdkAutoConstructList);
}
/**
*
* A list of virtual private cloud (VPC) security groups that the cluster will belong to.
*
*
* 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 #hasVpcSecurityGroupIds} method.
*
*
* @return A list of virtual private cloud (VPC) security groups that the cluster will belong to.
*/
public final List vpcSecurityGroupIds() {
return vpcSecurityGroupIds;
}
/**
*
* The port number on which the cluster accepts connections.
*
*
* Constraints: Must be a value from 1150
to 65535
.
*
*
* Default: The same port as the original cluster.
*
*
* @return The port number on which the cluster accepts connections.
*
* Constraints: Must be a value from 1150
to 65535
.
*
*
* Default: The same port as the original cluster.
*/
public final Integer port() {
return port;
}
/**
*
* The password for the master database user. This password can contain any printable ASCII character except forward
* slash (/), double quote ("), or the "at" symbol (@).
*
*
* Constraints: Must contain from 8 to 100 characters.
*
*
* @return The password for the master database user. This password can contain any printable ASCII character except
* forward slash (/), double quote ("), or the "at" symbol (@).
*
* Constraints: Must contain from 8 to 100 characters.
*/
public final String masterUserPassword() {
return masterUserPassword;
}
/**
*
* The daily time range during which automated backups are created if automated backups are enabled, using the
* BackupRetentionPeriod
parameter.
*
*
* The default is a 30-minute window selected at random from an 8-hour block of time for each Region.
*
*
* Constraints:
*
*
* -
*
* Must be in the format hh24:mi-hh24:mi
.
*
*
* -
*
* Must be in Universal Coordinated Time (UTC).
*
*
* -
*
* Must not conflict with the preferred maintenance window.
*
*
* -
*
* Must be at least 30 minutes.
*
*
*
*
* @return The daily time range during which automated backups are created if automated backups are enabled, using
* the BackupRetentionPeriod
parameter.
*
* The default is a 30-minute window selected at random from an 8-hour block of time for each Region.
*
*
* Constraints:
*
*
* -
*
* Must be in the format hh24:mi-hh24:mi
.
*
*
* -
*
* Must be in Universal Coordinated Time (UTC).
*
*
* -
*
* Must not conflict with the preferred maintenance window.
*
*
* -
*
* Must be at least 30 minutes.
*
*
*/
public final String preferredBackupWindow() {
return preferredBackupWindow;
}
/**
*
* The weekly time range during which system maintenance can occur, in Universal Coordinated Time (UTC).
*
*
* Format: ddd:hh24:mi-ddd:hh24:mi
*
*
* The default is a 30-minute window selected at random from an 8-hour block of time for each Region, occurring on a
* random day of the week.
*
*
* Valid days: Mon, Tue, Wed, Thu, Fri, Sat, Sun
*
*
* Constraints: Minimum 30-minute window.
*
*
* @return The weekly time range during which system maintenance can occur, in Universal Coordinated Time (UTC).
*
* Format: ddd:hh24:mi-ddd:hh24:mi
*
*
* The default is a 30-minute window selected at random from an 8-hour block of time for each Region,
* occurring on a random day of the week.
*
*
* Valid days: Mon, Tue, Wed, Thu, Fri, Sat, Sun
*
*
* Constraints: Minimum 30-minute window.
*/
public final String preferredMaintenanceWindow() {
return preferredMaintenanceWindow;
}
/**
*
* The configuration setting for the log types to be enabled for export to Amazon CloudWatch Logs for a specific
* instance or cluster. The EnableLogTypes
and DisableLogTypes
arrays determine which logs
* are exported (or not exported) to CloudWatch Logs.
*
*
* @return The configuration setting for the log types to be enabled for export to Amazon CloudWatch Logs for a
* specific instance or cluster. The EnableLogTypes
and DisableLogTypes
arrays
* determine which logs are exported (or not exported) to CloudWatch Logs.
*/
public final CloudwatchLogsExportConfiguration cloudwatchLogsExportConfiguration() {
return cloudwatchLogsExportConfiguration;
}
/**
*
* The version number of the database engine to which you want to upgrade. Modifying engine version is not supported
* on Amazon DocumentDB.
*
*
* @return The version number of the database engine to which you want to upgrade. Modifying engine version is not
* supported on Amazon DocumentDB.
*/
public final String engineVersion() {
return engineVersion;
}
/**
*
* Specifies whether this cluster can be deleted. If DeletionProtection
is enabled, the cluster cannot
* be deleted unless it is modified and DeletionProtection
is disabled. DeletionProtection
* protects clusters from being accidentally deleted.
*
*
* @return Specifies whether this cluster can be deleted. If DeletionProtection
is enabled, the cluster
* cannot be deleted unless it is modified and DeletionProtection
is disabled.
* DeletionProtection
protects clusters from being accidentally deleted.
*/
public final Boolean deletionProtection() {
return deletionProtection;
}
@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(dbClusterIdentifier());
hashCode = 31 * hashCode + Objects.hashCode(newDBClusterIdentifier());
hashCode = 31 * hashCode + Objects.hashCode(applyImmediately());
hashCode = 31 * hashCode + Objects.hashCode(backupRetentionPeriod());
hashCode = 31 * hashCode + Objects.hashCode(dbClusterParameterGroupName());
hashCode = 31 * hashCode + Objects.hashCode(hasVpcSecurityGroupIds() ? vpcSecurityGroupIds() : null);
hashCode = 31 * hashCode + Objects.hashCode(port());
hashCode = 31 * hashCode + Objects.hashCode(masterUserPassword());
hashCode = 31 * hashCode + Objects.hashCode(preferredBackupWindow());
hashCode = 31 * hashCode + Objects.hashCode(preferredMaintenanceWindow());
hashCode = 31 * hashCode + Objects.hashCode(cloudwatchLogsExportConfiguration());
hashCode = 31 * hashCode + Objects.hashCode(engineVersion());
hashCode = 31 * hashCode + Objects.hashCode(deletionProtection());
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 ModifyDbClusterRequest)) {
return false;
}
ModifyDbClusterRequest other = (ModifyDbClusterRequest) obj;
return Objects.equals(dbClusterIdentifier(), other.dbClusterIdentifier())
&& Objects.equals(newDBClusterIdentifier(), other.newDBClusterIdentifier())
&& Objects.equals(applyImmediately(), other.applyImmediately())
&& Objects.equals(backupRetentionPeriod(), other.backupRetentionPeriod())
&& Objects.equals(dbClusterParameterGroupName(), other.dbClusterParameterGroupName())
&& hasVpcSecurityGroupIds() == other.hasVpcSecurityGroupIds()
&& Objects.equals(vpcSecurityGroupIds(), other.vpcSecurityGroupIds()) && Objects.equals(port(), other.port())
&& Objects.equals(masterUserPassword(), other.masterUserPassword())
&& Objects.equals(preferredBackupWindow(), other.preferredBackupWindow())
&& Objects.equals(preferredMaintenanceWindow(), other.preferredMaintenanceWindow())
&& Objects.equals(cloudwatchLogsExportConfiguration(), other.cloudwatchLogsExportConfiguration())
&& Objects.equals(engineVersion(), other.engineVersion())
&& Objects.equals(deletionProtection(), other.deletionProtection());
}
/**
* 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("ModifyDbClusterRequest").add("DBClusterIdentifier", dbClusterIdentifier())
.add("NewDBClusterIdentifier", newDBClusterIdentifier()).add("ApplyImmediately", applyImmediately())
.add("BackupRetentionPeriod", backupRetentionPeriod())
.add("DBClusterParameterGroupName", dbClusterParameterGroupName())
.add("VpcSecurityGroupIds", hasVpcSecurityGroupIds() ? vpcSecurityGroupIds() : null).add("Port", port())
.add("MasterUserPassword", masterUserPassword()).add("PreferredBackupWindow", preferredBackupWindow())
.add("PreferredMaintenanceWindow", preferredMaintenanceWindow())
.add("CloudwatchLogsExportConfiguration", cloudwatchLogsExportConfiguration())
.add("EngineVersion", engineVersion()).add("DeletionProtection", deletionProtection()).build();
}
public final Optional getValueForField(String fieldName, Class clazz) {
switch (fieldName) {
case "DBClusterIdentifier":
return Optional.ofNullable(clazz.cast(dbClusterIdentifier()));
case "NewDBClusterIdentifier":
return Optional.ofNullable(clazz.cast(newDBClusterIdentifier()));
case "ApplyImmediately":
return Optional.ofNullable(clazz.cast(applyImmediately()));
case "BackupRetentionPeriod":
return Optional.ofNullable(clazz.cast(backupRetentionPeriod()));
case "DBClusterParameterGroupName":
return Optional.ofNullable(clazz.cast(dbClusterParameterGroupName()));
case "VpcSecurityGroupIds":
return Optional.ofNullable(clazz.cast(vpcSecurityGroupIds()));
case "Port":
return Optional.ofNullable(clazz.cast(port()));
case "MasterUserPassword":
return Optional.ofNullable(clazz.cast(masterUserPassword()));
case "PreferredBackupWindow":
return Optional.ofNullable(clazz.cast(preferredBackupWindow()));
case "PreferredMaintenanceWindow":
return Optional.ofNullable(clazz.cast(preferredMaintenanceWindow()));
case "CloudwatchLogsExportConfiguration":
return Optional.ofNullable(clazz.cast(cloudwatchLogsExportConfiguration()));
case "EngineVersion":
return Optional.ofNullable(clazz.cast(engineVersion()));
case "DeletionProtection":
return Optional.ofNullable(clazz.cast(deletionProtection()));
default:
return Optional.empty();
}
}
@Override
public final List> sdkFields() {
return SDK_FIELDS;
}
private static Function