software.amazon.awssdk.services.elasticache.model.GlobalReplicationGroup Maven / Gradle / Ivy
Show all versions of elasticache 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.elasticache.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;
/**
*
* Consists of a primary cluster that accepts writes and an associated secondary cluster that resides in a different
* Amazon region. The secondary cluster accepts only reads. The primary cluster automatically replicates updates to the
* secondary cluster.
*
*
* -
*
* The GlobalReplicationGroupIdSuffix represents the name of the Global datastore, which is what you use to
* associate a secondary cluster.
*
*
*
*/
@Generated("software.amazon.awssdk:codegen")
public final class GlobalReplicationGroup implements SdkPojo, Serializable,
ToCopyableBuilder {
private static final SdkField GLOBAL_REPLICATION_GROUP_ID_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("GlobalReplicationGroupId").getter(getter(GlobalReplicationGroup::globalReplicationGroupId))
.setter(setter(Builder::globalReplicationGroupId))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("GlobalReplicationGroupId").build())
.build();
private static final SdkField GLOBAL_REPLICATION_GROUP_DESCRIPTION_FIELD = SdkField
. builder(MarshallingType.STRING)
.memberName("GlobalReplicationGroupDescription")
.getter(getter(GlobalReplicationGroup::globalReplicationGroupDescription))
.setter(setter(Builder::globalReplicationGroupDescription))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("GlobalReplicationGroupDescription")
.build()).build();
private static final SdkField STATUS_FIELD = SdkField. builder(MarshallingType.STRING).memberName("Status")
.getter(getter(GlobalReplicationGroup::status)).setter(setter(Builder::status))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("Status").build()).build();
private static final SdkField CACHE_NODE_TYPE_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("CacheNodeType").getter(getter(GlobalReplicationGroup::cacheNodeType))
.setter(setter(Builder::cacheNodeType))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("CacheNodeType").build()).build();
private static final SdkField ENGINE_FIELD = SdkField. builder(MarshallingType.STRING).memberName("Engine")
.getter(getter(GlobalReplicationGroup::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(GlobalReplicationGroup::engineVersion))
.setter(setter(Builder::engineVersion))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("EngineVersion").build()).build();
private static final SdkField> MEMBERS_FIELD = SdkField
.> builder(MarshallingType.LIST)
.memberName("Members")
.getter(getter(GlobalReplicationGroup::members))
.setter(setter(Builder::members))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("Members").build(),
ListTrait
.builder()
.memberLocationName("GlobalReplicationGroupMember")
.memberFieldInfo(
SdkField. builder(MarshallingType.SDK_POJO)
.constructor(GlobalReplicationGroupMember::builder)
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD)
.locationName("GlobalReplicationGroupMember").build()).build()).build())
.build();
private static final SdkField CLUSTER_ENABLED_FIELD = SdkField. builder(MarshallingType.BOOLEAN)
.memberName("ClusterEnabled").getter(getter(GlobalReplicationGroup::clusterEnabled))
.setter(setter(Builder::clusterEnabled))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("ClusterEnabled").build()).build();
private static final SdkField> GLOBAL_NODE_GROUPS_FIELD = SdkField
.> builder(MarshallingType.LIST)
.memberName("GlobalNodeGroups")
.getter(getter(GlobalReplicationGroup::globalNodeGroups))
.setter(setter(Builder::globalNodeGroups))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("GlobalNodeGroups").build(),
ListTrait
.builder()
.memberLocationName("GlobalNodeGroup")
.memberFieldInfo(
SdkField. builder(MarshallingType.SDK_POJO)
.constructor(GlobalNodeGroup::builder)
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD)
.locationName("GlobalNodeGroup").build()).build()).build()).build();
private static final SdkField AUTH_TOKEN_ENABLED_FIELD = SdkField. builder(MarshallingType.BOOLEAN)
.memberName("AuthTokenEnabled").getter(getter(GlobalReplicationGroup::authTokenEnabled))
.setter(setter(Builder::authTokenEnabled))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("AuthTokenEnabled").build()).build();
private static final SdkField TRANSIT_ENCRYPTION_ENABLED_FIELD = SdkField. builder(MarshallingType.BOOLEAN)
.memberName("TransitEncryptionEnabled").getter(getter(GlobalReplicationGroup::transitEncryptionEnabled))
.setter(setter(Builder::transitEncryptionEnabled))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("TransitEncryptionEnabled").build())
.build();
private static final SdkField AT_REST_ENCRYPTION_ENABLED_FIELD = SdkField. builder(MarshallingType.BOOLEAN)
.memberName("AtRestEncryptionEnabled").getter(getter(GlobalReplicationGroup::atRestEncryptionEnabled))
.setter(setter(Builder::atRestEncryptionEnabled))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("AtRestEncryptionEnabled").build())
.build();
private static final SdkField ARN_FIELD = SdkField. builder(MarshallingType.STRING).memberName("ARN")
.getter(getter(GlobalReplicationGroup::arn)).setter(setter(Builder::arn))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("ARN").build()).build();
private static final List> SDK_FIELDS = Collections.unmodifiableList(Arrays.asList(
GLOBAL_REPLICATION_GROUP_ID_FIELD, GLOBAL_REPLICATION_GROUP_DESCRIPTION_FIELD, STATUS_FIELD, CACHE_NODE_TYPE_FIELD,
ENGINE_FIELD, ENGINE_VERSION_FIELD, MEMBERS_FIELD, CLUSTER_ENABLED_FIELD, GLOBAL_NODE_GROUPS_FIELD,
AUTH_TOKEN_ENABLED_FIELD, TRANSIT_ENCRYPTION_ENABLED_FIELD, AT_REST_ENCRYPTION_ENABLED_FIELD, ARN_FIELD));
private static final long serialVersionUID = 1L;
private final String globalReplicationGroupId;
private final String globalReplicationGroupDescription;
private final String status;
private final String cacheNodeType;
private final String engine;
private final String engineVersion;
private final List members;
private final Boolean clusterEnabled;
private final List globalNodeGroups;
private final Boolean authTokenEnabled;
private final Boolean transitEncryptionEnabled;
private final Boolean atRestEncryptionEnabled;
private final String arn;
private GlobalReplicationGroup(BuilderImpl builder) {
this.globalReplicationGroupId = builder.globalReplicationGroupId;
this.globalReplicationGroupDescription = builder.globalReplicationGroupDescription;
this.status = builder.status;
this.cacheNodeType = builder.cacheNodeType;
this.engine = builder.engine;
this.engineVersion = builder.engineVersion;
this.members = builder.members;
this.clusterEnabled = builder.clusterEnabled;
this.globalNodeGroups = builder.globalNodeGroups;
this.authTokenEnabled = builder.authTokenEnabled;
this.transitEncryptionEnabled = builder.transitEncryptionEnabled;
this.atRestEncryptionEnabled = builder.atRestEncryptionEnabled;
this.arn = builder.arn;
}
/**
*
* The name of the Global datastore
*
*
* @return The name of the Global datastore
*/
public final String globalReplicationGroupId() {
return globalReplicationGroupId;
}
/**
*
* The optional description of the Global datastore
*
*
* @return The optional description of the Global datastore
*/
public final String globalReplicationGroupDescription() {
return globalReplicationGroupDescription;
}
/**
*
* The status of the Global datastore
*
*
* @return The status of the Global datastore
*/
public final String status() {
return status;
}
/**
*
* The cache node type of the Global datastore
*
*
* @return The cache node type of the Global datastore
*/
public final String cacheNodeType() {
return cacheNodeType;
}
/**
*
* The Elasticache engine. For Redis only.
*
*
* @return The Elasticache engine. For Redis only.
*/
public final String engine() {
return engine;
}
/**
*
* The Elasticache Redis engine version.
*
*
* @return The Elasticache Redis engine version.
*/
public final String engineVersion() {
return engineVersion;
}
/**
* For responses, this returns true if the service returned a value for the Members 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 hasMembers() {
return members != null && !(members instanceof SdkAutoConstructList);
}
/**
*
* The replication groups that comprise the Global datastore.
*
*
* 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 #hasMembers} method.
*
*
* @return The replication groups that comprise the Global datastore.
*/
public final List members() {
return members;
}
/**
*
* A flag that indicates whether the Global datastore is cluster enabled.
*
*
* @return A flag that indicates whether the Global datastore is cluster enabled.
*/
public final Boolean clusterEnabled() {
return clusterEnabled;
}
/**
* For responses, this returns true if the service returned a value for the GlobalNodeGroups 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 hasGlobalNodeGroups() {
return globalNodeGroups != null && !(globalNodeGroups instanceof SdkAutoConstructList);
}
/**
*
* Indicates the slot configuration and global identifier for each slice 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 #hasGlobalNodeGroups} method.
*
*
* @return Indicates the slot configuration and global identifier for each slice group.
*/
public final List globalNodeGroups() {
return globalNodeGroups;
}
/**
*
* A flag that enables using an AuthToken
(password) when issuing Redis commands.
*
*
* Default: false
*
*
* @return A flag that enables using an AuthToken
(password) when issuing Redis commands.
*
* Default: false
*/
public final Boolean authTokenEnabled() {
return authTokenEnabled;
}
/**
*
* A flag that enables in-transit encryption when set to true. You cannot modify the value of
* TransitEncryptionEnabled
after the cluster is created. To enable in-transit encryption on a cluster
* you must set TransitEncryptionEnabled
to true when you create a cluster.
*
*
* Required: Only available when creating a replication group in an Amazon VPC using redis version
* 3.2.6
, 4.x
or later.
*
*
* @return A flag that enables in-transit encryption when set to true. You cannot modify the value of
* TransitEncryptionEnabled
after the cluster is created. To enable in-transit encryption on a
* cluster you must set TransitEncryptionEnabled
to true when you create a cluster.
*
* Required: Only available when creating a replication group in an Amazon VPC using redis version
* 3.2.6
, 4.x
or later.
*/
public final Boolean transitEncryptionEnabled() {
return transitEncryptionEnabled;
}
/**
*
* A flag that enables encryption at rest when set to true
.
*
*
* You cannot modify the value of AtRestEncryptionEnabled
after the replication group is created. To
* enable encryption at rest on a replication group you must set AtRestEncryptionEnabled
to
* true
when you create the replication group.
*
*
* Required: Only available when creating a replication group in an Amazon VPC using redis version
* 3.2.6
, 4.x
or later.
*
*
* @return A flag that enables encryption at rest when set to true
.
*
* You cannot modify the value of AtRestEncryptionEnabled
after the replication group is
* created. To enable encryption at rest on a replication group you must set
* AtRestEncryptionEnabled
to true
when you create the replication group.
*
*
* Required: Only available when creating a replication group in an Amazon VPC using redis version
* 3.2.6
, 4.x
or later.
*/
public final Boolean atRestEncryptionEnabled() {
return atRestEncryptionEnabled;
}
/**
*
* The ARN (Amazon Resource Name) of the global replication group.
*
*
* @return The ARN (Amazon Resource Name) of the global replication group.
*/
public final String arn() {
return arn;
}
@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(globalReplicationGroupId());
hashCode = 31 * hashCode + Objects.hashCode(globalReplicationGroupDescription());
hashCode = 31 * hashCode + Objects.hashCode(status());
hashCode = 31 * hashCode + Objects.hashCode(cacheNodeType());
hashCode = 31 * hashCode + Objects.hashCode(engine());
hashCode = 31 * hashCode + Objects.hashCode(engineVersion());
hashCode = 31 * hashCode + Objects.hashCode(hasMembers() ? members() : null);
hashCode = 31 * hashCode + Objects.hashCode(clusterEnabled());
hashCode = 31 * hashCode + Objects.hashCode(hasGlobalNodeGroups() ? globalNodeGroups() : null);
hashCode = 31 * hashCode + Objects.hashCode(authTokenEnabled());
hashCode = 31 * hashCode + Objects.hashCode(transitEncryptionEnabled());
hashCode = 31 * hashCode + Objects.hashCode(atRestEncryptionEnabled());
hashCode = 31 * hashCode + Objects.hashCode(arn());
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 GlobalReplicationGroup)) {
return false;
}
GlobalReplicationGroup other = (GlobalReplicationGroup) obj;
return Objects.equals(globalReplicationGroupId(), other.globalReplicationGroupId())
&& Objects.equals(globalReplicationGroupDescription(), other.globalReplicationGroupDescription())
&& Objects.equals(status(), other.status()) && Objects.equals(cacheNodeType(), other.cacheNodeType())
&& Objects.equals(engine(), other.engine()) && Objects.equals(engineVersion(), other.engineVersion())
&& hasMembers() == other.hasMembers() && Objects.equals(members(), other.members())
&& Objects.equals(clusterEnabled(), other.clusterEnabled())
&& hasGlobalNodeGroups() == other.hasGlobalNodeGroups()
&& Objects.equals(globalNodeGroups(), other.globalNodeGroups())
&& Objects.equals(authTokenEnabled(), other.authTokenEnabled())
&& Objects.equals(transitEncryptionEnabled(), other.transitEncryptionEnabled())
&& Objects.equals(atRestEncryptionEnabled(), other.atRestEncryptionEnabled())
&& Objects.equals(arn(), other.arn());
}
/**
* 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("GlobalReplicationGroup").add("GlobalReplicationGroupId", globalReplicationGroupId())
.add("GlobalReplicationGroupDescription", globalReplicationGroupDescription()).add("Status", status())
.add("CacheNodeType", cacheNodeType()).add("Engine", engine()).add("EngineVersion", engineVersion())
.add("Members", hasMembers() ? members() : null).add("ClusterEnabled", clusterEnabled())
.add("GlobalNodeGroups", hasGlobalNodeGroups() ? globalNodeGroups() : null)
.add("AuthTokenEnabled", authTokenEnabled()).add("TransitEncryptionEnabled", transitEncryptionEnabled())
.add("AtRestEncryptionEnabled", atRestEncryptionEnabled()).add("ARN", arn()).build();
}
public final Optional getValueForField(String fieldName, Class clazz) {
switch (fieldName) {
case "GlobalReplicationGroupId":
return Optional.ofNullable(clazz.cast(globalReplicationGroupId()));
case "GlobalReplicationGroupDescription":
return Optional.ofNullable(clazz.cast(globalReplicationGroupDescription()));
case "Status":
return Optional.ofNullable(clazz.cast(status()));
case "CacheNodeType":
return Optional.ofNullable(clazz.cast(cacheNodeType()));
case "Engine":
return Optional.ofNullable(clazz.cast(engine()));
case "EngineVersion":
return Optional.ofNullable(clazz.cast(engineVersion()));
case "Members":
return Optional.ofNullable(clazz.cast(members()));
case "ClusterEnabled":
return Optional.ofNullable(clazz.cast(clusterEnabled()));
case "GlobalNodeGroups":
return Optional.ofNullable(clazz.cast(globalNodeGroups()));
case "AuthTokenEnabled":
return Optional.ofNullable(clazz.cast(authTokenEnabled()));
case "TransitEncryptionEnabled":
return Optional.ofNullable(clazz.cast(transitEncryptionEnabled()));
case "AtRestEncryptionEnabled":
return Optional.ofNullable(clazz.cast(atRestEncryptionEnabled()));
case "ARN":
return Optional.ofNullable(clazz.cast(arn()));
default:
return Optional.empty();
}
}
@Override
public final List> sdkFields() {
return SDK_FIELDS;
}
private static Function