
software.amazon.awssdk.services.elasticache.model.ModifyGlobalReplicationGroupRequest 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.elasticache.model;
import java.util.Arrays;
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.LocationTrait;
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 ModifyGlobalReplicationGroupRequest extends ElastiCacheRequest implements
ToCopyableBuilder {
private static final SdkField GLOBAL_REPLICATION_GROUP_ID_FIELD = SdkField. builder(MarshallingType.STRING)
.getter(getter(ModifyGlobalReplicationGroupRequest::globalReplicationGroupId))
.setter(setter(Builder::globalReplicationGroupId))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("GlobalReplicationGroupId").build())
.build();
private static final SdkField APPLY_IMMEDIATELY_FIELD = SdkField. builder(MarshallingType.BOOLEAN)
.getter(getter(ModifyGlobalReplicationGroupRequest::applyImmediately)).setter(setter(Builder::applyImmediately))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("ApplyImmediately").build()).build();
private static final SdkField CACHE_NODE_TYPE_FIELD = SdkField. builder(MarshallingType.STRING)
.getter(getter(ModifyGlobalReplicationGroupRequest::cacheNodeType)).setter(setter(Builder::cacheNodeType))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("CacheNodeType").build()).build();
private static final SdkField ENGINE_VERSION_FIELD = SdkField. builder(MarshallingType.STRING)
.getter(getter(ModifyGlobalReplicationGroupRequest::engineVersion)).setter(setter(Builder::engineVersion))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("EngineVersion").build()).build();
private static final SdkField GLOBAL_REPLICATION_GROUP_DESCRIPTION_FIELD = SdkField
. builder(MarshallingType.STRING)
.getter(getter(ModifyGlobalReplicationGroupRequest::globalReplicationGroupDescription))
.setter(setter(Builder::globalReplicationGroupDescription))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("GlobalReplicationGroupDescription")
.build()).build();
private static final SdkField AUTOMATIC_FAILOVER_ENABLED_FIELD = SdkField. builder(MarshallingType.BOOLEAN)
.getter(getter(ModifyGlobalReplicationGroupRequest::automaticFailoverEnabled))
.setter(setter(Builder::automaticFailoverEnabled))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("AutomaticFailoverEnabled").build())
.build();
private static final List> SDK_FIELDS = Collections.unmodifiableList(Arrays.asList(
GLOBAL_REPLICATION_GROUP_ID_FIELD, APPLY_IMMEDIATELY_FIELD, CACHE_NODE_TYPE_FIELD, ENGINE_VERSION_FIELD,
GLOBAL_REPLICATION_GROUP_DESCRIPTION_FIELD, AUTOMATIC_FAILOVER_ENABLED_FIELD));
private final String globalReplicationGroupId;
private final Boolean applyImmediately;
private final String cacheNodeType;
private final String engineVersion;
private final String globalReplicationGroupDescription;
private final Boolean automaticFailoverEnabled;
private ModifyGlobalReplicationGroupRequest(BuilderImpl builder) {
super(builder);
this.globalReplicationGroupId = builder.globalReplicationGroupId;
this.applyImmediately = builder.applyImmediately;
this.cacheNodeType = builder.cacheNodeType;
this.engineVersion = builder.engineVersion;
this.globalReplicationGroupDescription = builder.globalReplicationGroupDescription;
this.automaticFailoverEnabled = builder.automaticFailoverEnabled;
}
/**
*
* The name of the Global Datastore
*
*
* @return The name of the Global Datastore
*/
public String globalReplicationGroupId() {
return globalReplicationGroupId;
}
/**
*
* If true, this parameter causes the modifications in this request and any pending modifications to be applied,
* asynchronously and as soon as possible, regardless of the PreferredMaintenanceWindow setting for the replication
* group. If false, changes to the nodes in the replication group are applied on the next maintenance reboot, or the
* next failure reboot, whichever occurs first.
*
*
* @return If true, this parameter causes the modifications in this request and any pending modifications to be
* applied, asynchronously and as soon as possible, regardless of the PreferredMaintenanceWindow setting for
* the replication group. If false, changes to the nodes in the replication group are applied on the next
* maintenance reboot, or the next failure reboot, whichever occurs first.
*/
public Boolean applyImmediately() {
return applyImmediately;
}
/**
*
* A valid cache node type that you want to scale this Global Datastore to.
*
*
* @return A valid cache node type that you want to scale this Global Datastore to.
*/
public String cacheNodeType() {
return cacheNodeType;
}
/**
*
* The upgraded version of the cache engine to be run on the clusters in the Global Datastore.
*
*
* @return The upgraded version of the cache engine to be run on the clusters in the Global Datastore.
*/
public String engineVersion() {
return engineVersion;
}
/**
*
* A description of the Global Datastore
*
*
* @return A description of the Global Datastore
*/
public String globalReplicationGroupDescription() {
return globalReplicationGroupDescription;
}
/**
*
* Determines whether a read replica is automatically promoted to read/write primary if the existing primary
* encounters a failure.
*
*
* @return Determines whether a read replica is automatically promoted to read/write primary if the existing primary
* encounters a failure.
*/
public Boolean automaticFailoverEnabled() {
return automaticFailoverEnabled;
}
@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 int hashCode() {
int hashCode = 1;
hashCode = 31 * hashCode + super.hashCode();
hashCode = 31 * hashCode + Objects.hashCode(globalReplicationGroupId());
hashCode = 31 * hashCode + Objects.hashCode(applyImmediately());
hashCode = 31 * hashCode + Objects.hashCode(cacheNodeType());
hashCode = 31 * hashCode + Objects.hashCode(engineVersion());
hashCode = 31 * hashCode + Objects.hashCode(globalReplicationGroupDescription());
hashCode = 31 * hashCode + Objects.hashCode(automaticFailoverEnabled());
return hashCode;
}
@Override
public boolean equals(Object obj) {
return super.equals(obj) && equalsBySdkFields(obj);
}
@Override
public boolean equalsBySdkFields(Object obj) {
if (this == obj) {
return true;
}
if (obj == null) {
return false;
}
if (!(obj instanceof ModifyGlobalReplicationGroupRequest)) {
return false;
}
ModifyGlobalReplicationGroupRequest other = (ModifyGlobalReplicationGroupRequest) obj;
return Objects.equals(globalReplicationGroupId(), other.globalReplicationGroupId())
&& Objects.equals(applyImmediately(), other.applyImmediately())
&& Objects.equals(cacheNodeType(), other.cacheNodeType())
&& Objects.equals(engineVersion(), other.engineVersion())
&& Objects.equals(globalReplicationGroupDescription(), other.globalReplicationGroupDescription())
&& Objects.equals(automaticFailoverEnabled(), other.automaticFailoverEnabled());
}
/**
* 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 String toString() {
return ToString.builder("ModifyGlobalReplicationGroupRequest")
.add("GlobalReplicationGroupId", globalReplicationGroupId()).add("ApplyImmediately", applyImmediately())
.add("CacheNodeType", cacheNodeType()).add("EngineVersion", engineVersion())
.add("GlobalReplicationGroupDescription", globalReplicationGroupDescription())
.add("AutomaticFailoverEnabled", automaticFailoverEnabled()).build();
}
public Optional getValueForField(String fieldName, Class clazz) {
switch (fieldName) {
case "GlobalReplicationGroupId":
return Optional.ofNullable(clazz.cast(globalReplicationGroupId()));
case "ApplyImmediately":
return Optional.ofNullable(clazz.cast(applyImmediately()));
case "CacheNodeType":
return Optional.ofNullable(clazz.cast(cacheNodeType()));
case "EngineVersion":
return Optional.ofNullable(clazz.cast(engineVersion()));
case "GlobalReplicationGroupDescription":
return Optional.ofNullable(clazz.cast(globalReplicationGroupDescription()));
case "AutomaticFailoverEnabled":
return Optional.ofNullable(clazz.cast(automaticFailoverEnabled()));
default:
return Optional.empty();
}
}
@Override
public List> sdkFields() {
return SDK_FIELDS;
}
private static Function