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

software.amazon.awssdk.services.elasticache.model.NodeGroupConfiguration Maven / Gradle / Ivy

Go to download

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

There is a newer version: 2.29.39
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.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.Function;
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;

/**
 * 

* Node group (shard) configuration options. Each node group (shard) configuration has the following: Slots, PrimaryAvailabilityZone, ReplicaAvailabilityZones, ReplicaCount. *

*/ @Generated("software.amazon.awssdk:codegen") public final class NodeGroupConfiguration implements SdkPojo, Serializable, ToCopyableBuilder { private static final SdkField NODE_GROUP_ID_FIELD = SdkField. builder(MarshallingType.STRING) .memberName("NodeGroupId").getter(getter(NodeGroupConfiguration::nodeGroupId)).setter(setter(Builder::nodeGroupId)) .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("NodeGroupId").build()).build(); private static final SdkField SLOTS_FIELD = SdkField. builder(MarshallingType.STRING).memberName("Slots") .getter(getter(NodeGroupConfiguration::slots)).setter(setter(Builder::slots)) .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("Slots").build()).build(); private static final SdkField REPLICA_COUNT_FIELD = SdkField. builder(MarshallingType.INTEGER) .memberName("ReplicaCount").getter(getter(NodeGroupConfiguration::replicaCount)) .setter(setter(Builder::replicaCount)) .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("ReplicaCount").build()).build(); private static final SdkField PRIMARY_AVAILABILITY_ZONE_FIELD = SdkField. builder(MarshallingType.STRING) .memberName("PrimaryAvailabilityZone").getter(getter(NodeGroupConfiguration::primaryAvailabilityZone)) .setter(setter(Builder::primaryAvailabilityZone)) .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("PrimaryAvailabilityZone").build()) .build(); private static final SdkField> REPLICA_AVAILABILITY_ZONES_FIELD = SdkField .> builder(MarshallingType.LIST) .memberName("ReplicaAvailabilityZones") .getter(getter(NodeGroupConfiguration::replicaAvailabilityZones)) .setter(setter(Builder::replicaAvailabilityZones)) .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("ReplicaAvailabilityZones").build(), ListTrait .builder() .memberLocationName("AvailabilityZone") .memberFieldInfo( SdkField. builder(MarshallingType.STRING) .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD) .locationName("AvailabilityZone").build()).build()).build()).build(); private static final SdkField PRIMARY_OUTPOST_ARN_FIELD = SdkField. builder(MarshallingType.STRING) .memberName("PrimaryOutpostArn").getter(getter(NodeGroupConfiguration::primaryOutpostArn)) .setter(setter(Builder::primaryOutpostArn)) .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("PrimaryOutpostArn").build()).build(); private static final SdkField> REPLICA_OUTPOST_ARNS_FIELD = SdkField .> builder(MarshallingType.LIST) .memberName("ReplicaOutpostArns") .getter(getter(NodeGroupConfiguration::replicaOutpostArns)) .setter(setter(Builder::replicaOutpostArns)) .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("ReplicaOutpostArns").build(), ListTrait .builder() .memberLocationName("OutpostArn") .memberFieldInfo( SdkField. builder(MarshallingType.STRING) .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD) .locationName("OutpostArn").build()).build()).build()).build(); private static final List> SDK_FIELDS = Collections.unmodifiableList(Arrays.asList(NODE_GROUP_ID_FIELD, SLOTS_FIELD, REPLICA_COUNT_FIELD, PRIMARY_AVAILABILITY_ZONE_FIELD, REPLICA_AVAILABILITY_ZONES_FIELD, PRIMARY_OUTPOST_ARN_FIELD, REPLICA_OUTPOST_ARNS_FIELD)); private static final long serialVersionUID = 1L; private final String nodeGroupId; private final String slots; private final Integer replicaCount; private final String primaryAvailabilityZone; private final List replicaAvailabilityZones; private final String primaryOutpostArn; private final List replicaOutpostArns; private NodeGroupConfiguration(BuilderImpl builder) { this.nodeGroupId = builder.nodeGroupId; this.slots = builder.slots; this.replicaCount = builder.replicaCount; this.primaryAvailabilityZone = builder.primaryAvailabilityZone; this.replicaAvailabilityZones = builder.replicaAvailabilityZones; this.primaryOutpostArn = builder.primaryOutpostArn; this.replicaOutpostArns = builder.replicaOutpostArns; } /** *

* Either the ElastiCache (Redis OSS) supplied 4-digit id or a user supplied id for the node group these * configuration values apply to. *

* * @return Either the ElastiCache (Redis OSS) supplied 4-digit id or a user supplied id for the node group these * configuration values apply to. */ public final String nodeGroupId() { return nodeGroupId; } /** *

* A string that specifies the keyspace for a particular node group. Keyspaces range from 0 to 16,383. The string is * in the format startkey-endkey. *

*

* Example: "0-3999" *

* * @return A string that specifies the keyspace for a particular node group. Keyspaces range from 0 to 16,383. The * string is in the format startkey-endkey.

*

* Example: "0-3999" */ public final String slots() { return slots; } /** *

* The number of read replica nodes in this node group (shard). *

* * @return The number of read replica nodes in this node group (shard). */ public final Integer replicaCount() { return replicaCount; } /** *

* The Availability Zone where the primary node of this node group (shard) is launched. *

* * @return The Availability Zone where the primary node of this node group (shard) is launched. */ public final String primaryAvailabilityZone() { return primaryAvailabilityZone; } /** * For responses, this returns true if the service returned a value for the ReplicaAvailabilityZones 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 hasReplicaAvailabilityZones() { return replicaAvailabilityZones != null && !(replicaAvailabilityZones instanceof SdkAutoConstructList); } /** *

* A list of Availability Zones to be used for the read replicas. The number of Availability Zones in this list must * match the value of ReplicaCount or ReplicasPerNodeGroup if not specified. *

*

* 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 #hasReplicaAvailabilityZones} method. *

* * @return A list of Availability Zones to be used for the read replicas. The number of Availability Zones in this * list must match the value of ReplicaCount or ReplicasPerNodeGroup if not * specified. */ public final List replicaAvailabilityZones() { return replicaAvailabilityZones; } /** *

* The outpost ARN of the primary node. *

* * @return The outpost ARN of the primary node. */ public final String primaryOutpostArn() { return primaryOutpostArn; } /** * For responses, this returns true if the service returned a value for the ReplicaOutpostArns 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 hasReplicaOutpostArns() { return replicaOutpostArns != null && !(replicaOutpostArns instanceof SdkAutoConstructList); } /** *

* The outpost ARN of the node replicas. *

*

* 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 #hasReplicaOutpostArns} method. *

* * @return The outpost ARN of the node replicas. */ public final List replicaOutpostArns() { return replicaOutpostArns; } @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(nodeGroupId()); hashCode = 31 * hashCode + Objects.hashCode(slots()); hashCode = 31 * hashCode + Objects.hashCode(replicaCount()); hashCode = 31 * hashCode + Objects.hashCode(primaryAvailabilityZone()); hashCode = 31 * hashCode + Objects.hashCode(hasReplicaAvailabilityZones() ? replicaAvailabilityZones() : null); hashCode = 31 * hashCode + Objects.hashCode(primaryOutpostArn()); hashCode = 31 * hashCode + Objects.hashCode(hasReplicaOutpostArns() ? replicaOutpostArns() : 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 NodeGroupConfiguration)) { return false; } NodeGroupConfiguration other = (NodeGroupConfiguration) obj; return Objects.equals(nodeGroupId(), other.nodeGroupId()) && Objects.equals(slots(), other.slots()) && Objects.equals(replicaCount(), other.replicaCount()) && Objects.equals(primaryAvailabilityZone(), other.primaryAvailabilityZone()) && hasReplicaAvailabilityZones() == other.hasReplicaAvailabilityZones() && Objects.equals(replicaAvailabilityZones(), other.replicaAvailabilityZones()) && Objects.equals(primaryOutpostArn(), other.primaryOutpostArn()) && hasReplicaOutpostArns() == other.hasReplicaOutpostArns() && Objects.equals(replicaOutpostArns(), other.replicaOutpostArns()); } /** * 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("NodeGroupConfiguration").add("NodeGroupId", nodeGroupId()).add("Slots", slots()) .add("ReplicaCount", replicaCount()).add("PrimaryAvailabilityZone", primaryAvailabilityZone()) .add("ReplicaAvailabilityZones", hasReplicaAvailabilityZones() ? replicaAvailabilityZones() : null) .add("PrimaryOutpostArn", primaryOutpostArn()) .add("ReplicaOutpostArns", hasReplicaOutpostArns() ? replicaOutpostArns() : null).build(); } public final Optional getValueForField(String fieldName, Class clazz) { switch (fieldName) { case "NodeGroupId": return Optional.ofNullable(clazz.cast(nodeGroupId())); case "Slots": return Optional.ofNullable(clazz.cast(slots())); case "ReplicaCount": return Optional.ofNullable(clazz.cast(replicaCount())); case "PrimaryAvailabilityZone": return Optional.ofNullable(clazz.cast(primaryAvailabilityZone())); case "ReplicaAvailabilityZones": return Optional.ofNullable(clazz.cast(replicaAvailabilityZones())); case "PrimaryOutpostArn": return Optional.ofNullable(clazz.cast(primaryOutpostArn())); case "ReplicaOutpostArns": return Optional.ofNullable(clazz.cast(replicaOutpostArns())); default: return Optional.empty(); } } @Override public final List> sdkFields() { return SDK_FIELDS; } private static Function getter(Function g) { return obj -> g.apply((NodeGroupConfiguration) obj); } private static BiConsumer setter(BiConsumer s) { return (obj, val) -> s.accept((Builder) obj, val); } public interface Builder extends SdkPojo, CopyableBuilder { /** *

* Either the ElastiCache (Redis OSS) supplied 4-digit id or a user supplied id for the node group these * configuration values apply to. *

* * @param nodeGroupId * Either the ElastiCache (Redis OSS) supplied 4-digit id or a user supplied id for the node group these * configuration values apply to. * @return Returns a reference to this object so that method calls can be chained together. */ Builder nodeGroupId(String nodeGroupId); /** *

* A string that specifies the keyspace for a particular node group. Keyspaces range from 0 to 16,383. The * string is in the format startkey-endkey. *

*

* Example: "0-3999" *

* * @param slots * A string that specifies the keyspace for a particular node group. Keyspaces range from 0 to 16,383. * The string is in the format startkey-endkey.

*

* Example: "0-3999" * @return Returns a reference to this object so that method calls can be chained together. */ Builder slots(String slots); /** *

* The number of read replica nodes in this node group (shard). *

* * @param replicaCount * The number of read replica nodes in this node group (shard). * @return Returns a reference to this object so that method calls can be chained together. */ Builder replicaCount(Integer replicaCount); /** *

* The Availability Zone where the primary node of this node group (shard) is launched. *

* * @param primaryAvailabilityZone * The Availability Zone where the primary node of this node group (shard) is launched. * @return Returns a reference to this object so that method calls can be chained together. */ Builder primaryAvailabilityZone(String primaryAvailabilityZone); /** *

* A list of Availability Zones to be used for the read replicas. The number of Availability Zones in this list * must match the value of ReplicaCount or ReplicasPerNodeGroup if not specified. *

* * @param replicaAvailabilityZones * A list of Availability Zones to be used for the read replicas. The number of Availability Zones in * this list must match the value of ReplicaCount or ReplicasPerNodeGroup if * not specified. * @return Returns a reference to this object so that method calls can be chained together. */ Builder replicaAvailabilityZones(Collection replicaAvailabilityZones); /** *

* A list of Availability Zones to be used for the read replicas. The number of Availability Zones in this list * must match the value of ReplicaCount or ReplicasPerNodeGroup if not specified. *

* * @param replicaAvailabilityZones * A list of Availability Zones to be used for the read replicas. The number of Availability Zones in * this list must match the value of ReplicaCount or ReplicasPerNodeGroup if * not specified. * @return Returns a reference to this object so that method calls can be chained together. */ Builder replicaAvailabilityZones(String... replicaAvailabilityZones); /** *

* The outpost ARN of the primary node. *

* * @param primaryOutpostArn * The outpost ARN of the primary node. * @return Returns a reference to this object so that method calls can be chained together. */ Builder primaryOutpostArn(String primaryOutpostArn); /** *

* The outpost ARN of the node replicas. *

* * @param replicaOutpostArns * The outpost ARN of the node replicas. * @return Returns a reference to this object so that method calls can be chained together. */ Builder replicaOutpostArns(Collection replicaOutpostArns); /** *

* The outpost ARN of the node replicas. *

* * @param replicaOutpostArns * The outpost ARN of the node replicas. * @return Returns a reference to this object so that method calls can be chained together. */ Builder replicaOutpostArns(String... replicaOutpostArns); } static final class BuilderImpl implements Builder { private String nodeGroupId; private String slots; private Integer replicaCount; private String primaryAvailabilityZone; private List replicaAvailabilityZones = DefaultSdkAutoConstructList.getInstance(); private String primaryOutpostArn; private List replicaOutpostArns = DefaultSdkAutoConstructList.getInstance(); private BuilderImpl() { } private BuilderImpl(NodeGroupConfiguration model) { nodeGroupId(model.nodeGroupId); slots(model.slots); replicaCount(model.replicaCount); primaryAvailabilityZone(model.primaryAvailabilityZone); replicaAvailabilityZones(model.replicaAvailabilityZones); primaryOutpostArn(model.primaryOutpostArn); replicaOutpostArns(model.replicaOutpostArns); } public final String getNodeGroupId() { return nodeGroupId; } public final void setNodeGroupId(String nodeGroupId) { this.nodeGroupId = nodeGroupId; } @Override public final Builder nodeGroupId(String nodeGroupId) { this.nodeGroupId = nodeGroupId; return this; } public final String getSlots() { return slots; } public final void setSlots(String slots) { this.slots = slots; } @Override public final Builder slots(String slots) { this.slots = slots; return this; } public final Integer getReplicaCount() { return replicaCount; } public final void setReplicaCount(Integer replicaCount) { this.replicaCount = replicaCount; } @Override public final Builder replicaCount(Integer replicaCount) { this.replicaCount = replicaCount; return this; } public final String getPrimaryAvailabilityZone() { return primaryAvailabilityZone; } public final void setPrimaryAvailabilityZone(String primaryAvailabilityZone) { this.primaryAvailabilityZone = primaryAvailabilityZone; } @Override public final Builder primaryAvailabilityZone(String primaryAvailabilityZone) { this.primaryAvailabilityZone = primaryAvailabilityZone; return this; } public final Collection getReplicaAvailabilityZones() { if (replicaAvailabilityZones instanceof SdkAutoConstructList) { return null; } return replicaAvailabilityZones; } public final void setReplicaAvailabilityZones(Collection replicaAvailabilityZones) { this.replicaAvailabilityZones = AvailabilityZonesListCopier.copy(replicaAvailabilityZones); } @Override public final Builder replicaAvailabilityZones(Collection replicaAvailabilityZones) { this.replicaAvailabilityZones = AvailabilityZonesListCopier.copy(replicaAvailabilityZones); return this; } @Override @SafeVarargs public final Builder replicaAvailabilityZones(String... replicaAvailabilityZones) { replicaAvailabilityZones(Arrays.asList(replicaAvailabilityZones)); return this; } public final String getPrimaryOutpostArn() { return primaryOutpostArn; } public final void setPrimaryOutpostArn(String primaryOutpostArn) { this.primaryOutpostArn = primaryOutpostArn; } @Override public final Builder primaryOutpostArn(String primaryOutpostArn) { this.primaryOutpostArn = primaryOutpostArn; return this; } public final Collection getReplicaOutpostArns() { if (replicaOutpostArns instanceof SdkAutoConstructList) { return null; } return replicaOutpostArns; } public final void setReplicaOutpostArns(Collection replicaOutpostArns) { this.replicaOutpostArns = OutpostArnsListCopier.copy(replicaOutpostArns); } @Override public final Builder replicaOutpostArns(Collection replicaOutpostArns) { this.replicaOutpostArns = OutpostArnsListCopier.copy(replicaOutpostArns); return this; } @Override @SafeVarargs public final Builder replicaOutpostArns(String... replicaOutpostArns) { replicaOutpostArns(Arrays.asList(replicaOutpostArns)); return this; } @Override public NodeGroupConfiguration build() { return new NodeGroupConfiguration(this); } @Override public List> sdkFields() { return SDK_FIELDS; } } }




© 2015 - 2025 Weber Informatics LLC | Privacy Policy