software.amazon.awssdk.services.elasticache.model.ReservedCacheNodesOffering 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.beans.Transient;
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;
/**
*
* Describes all of the attributes of a reserved cache node offering.
*
*/
@Generated("software.amazon.awssdk:codegen")
public final class ReservedCacheNodesOffering implements SdkPojo, Serializable,
ToCopyableBuilder {
private static final SdkField RESERVED_CACHE_NODES_OFFERING_ID_FIELD = SdkField
. builder(MarshallingType.STRING)
.memberName("ReservedCacheNodesOfferingId")
.getter(getter(ReservedCacheNodesOffering::reservedCacheNodesOfferingId))
.setter(setter(Builder::reservedCacheNodesOfferingId))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("ReservedCacheNodesOfferingId")
.build()).build();
private static final SdkField CACHE_NODE_TYPE_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("CacheNodeType").getter(getter(ReservedCacheNodesOffering::cacheNodeType))
.setter(setter(Builder::cacheNodeType))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("CacheNodeType").build()).build();
private static final SdkField DURATION_FIELD = SdkField. builder(MarshallingType.INTEGER)
.memberName("Duration").getter(getter(ReservedCacheNodesOffering::duration)).setter(setter(Builder::duration))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("Duration").build()).build();
private static final SdkField FIXED_PRICE_FIELD = SdkField. builder(MarshallingType.DOUBLE)
.memberName("FixedPrice").getter(getter(ReservedCacheNodesOffering::fixedPrice)).setter(setter(Builder::fixedPrice))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("FixedPrice").build()).build();
private static final SdkField USAGE_PRICE_FIELD = SdkField. builder(MarshallingType.DOUBLE)
.memberName("UsagePrice").getter(getter(ReservedCacheNodesOffering::usagePrice)).setter(setter(Builder::usagePrice))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("UsagePrice").build()).build();
private static final SdkField PRODUCT_DESCRIPTION_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("ProductDescription").getter(getter(ReservedCacheNodesOffering::productDescription))
.setter(setter(Builder::productDescription))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("ProductDescription").build())
.build();
private static final SdkField OFFERING_TYPE_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("OfferingType").getter(getter(ReservedCacheNodesOffering::offeringType))
.setter(setter(Builder::offeringType))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("OfferingType").build()).build();
private static final SdkField> RECURRING_CHARGES_FIELD = SdkField
.> builder(MarshallingType.LIST)
.memberName("RecurringCharges")
.getter(getter(ReservedCacheNodesOffering::recurringCharges))
.setter(setter(Builder::recurringCharges))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("RecurringCharges").build(),
ListTrait
.builder()
.memberLocationName("RecurringCharge")
.memberFieldInfo(
SdkField. builder(MarshallingType.SDK_POJO)
.constructor(RecurringCharge::builder)
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD)
.locationName("RecurringCharge").build()).build()).build()).build();
private static final List> SDK_FIELDS = Collections.unmodifiableList(Arrays.asList(
RESERVED_CACHE_NODES_OFFERING_ID_FIELD, CACHE_NODE_TYPE_FIELD, DURATION_FIELD, FIXED_PRICE_FIELD, USAGE_PRICE_FIELD,
PRODUCT_DESCRIPTION_FIELD, OFFERING_TYPE_FIELD, RECURRING_CHARGES_FIELD));
private static final long serialVersionUID = 1L;
private final String reservedCacheNodesOfferingId;
private final String cacheNodeType;
private final Integer duration;
private final Double fixedPrice;
private final Double usagePrice;
private final String productDescription;
private final String offeringType;
private final List recurringCharges;
private ReservedCacheNodesOffering(BuilderImpl builder) {
this.reservedCacheNodesOfferingId = builder.reservedCacheNodesOfferingId;
this.cacheNodeType = builder.cacheNodeType;
this.duration = builder.duration;
this.fixedPrice = builder.fixedPrice;
this.usagePrice = builder.usagePrice;
this.productDescription = builder.productDescription;
this.offeringType = builder.offeringType;
this.recurringCharges = builder.recurringCharges;
}
/**
*
* A unique identifier for the reserved cache node offering.
*
*
* @return A unique identifier for the reserved cache node offering.
*/
public final String reservedCacheNodesOfferingId() {
return reservedCacheNodesOfferingId;
}
/**
*
* The cache node type for the reserved cache node.
*
*
* The following node types are supported by ElastiCache. Generally speaking, the current generation types provide
* more memory and computational power at lower cost when compared to their equivalent previous generation
* counterparts.
*
*
* -
*
* General purpose:
*
*
* -
*
* Current generation:
*
*
* M6g node types (available only for Redis engine version 5.0.6 onward and for Memcached engine version
* 1.5.16 onward).
*
*
* cache.m6g.large
, cache.m6g.xlarge
, cache.m6g.2xlarge
,
* cache.m6g.4xlarge
, cache.m6g.8xlarge
, cache.m6g.12xlarge
,
* cache.m6g.16xlarge
*
*
*
* For region availability, see Supported Node Types
*
*
*
* M5 node types: cache.m5.large
, cache.m5.xlarge
, cache.m5.2xlarge
,
* cache.m5.4xlarge
, cache.m5.12xlarge
, cache.m5.24xlarge
*
*
* M4 node types: cache.m4.large
, cache.m4.xlarge
, cache.m4.2xlarge
,
* cache.m4.4xlarge
, cache.m4.10xlarge
*
*
* T3 node types: cache.t3.micro
, cache.t3.small
, cache.t3.medium
*
*
* T2 node types: cache.t2.micro
, cache.t2.small
, cache.t2.medium
*
*
* -
*
* Previous generation: (not recommended)
*
*
* T1 node types: cache.t1.micro
*
*
* M1 node types: cache.m1.small
, cache.m1.medium
, cache.m1.large
,
* cache.m1.xlarge
*
*
* M3 node types: cache.m3.medium
, cache.m3.large
, cache.m3.xlarge
,
* cache.m3.2xlarge
*
*
*
*
* -
*
* Compute optimized:
*
*
* -
*
* Previous generation: (not recommended)
*
*
* C1 node types: cache.c1.xlarge
*
*
*
*
* -
*
* Memory optimized:
*
*
* -
*
* Current generation:
*
*
* R6g node types (available only for Redis engine version 5.0.6 onward and for Memcached engine version
* 1.5.16 onward).
*
*
* cache.r6g.large
, cache.r6g.xlarge
, cache.r6g.2xlarge
,
* cache.r6g.4xlarge
, cache.r6g.8xlarge
, cache.r6g.12xlarge
,
* cache.r6g.16xlarge
*
*
*
* For region availability, see Supported Node Types
*
*
*
* R5 node types: cache.r5.large
, cache.r5.xlarge
, cache.r5.2xlarge
,
* cache.r5.4xlarge
, cache.r5.12xlarge
, cache.r5.24xlarge
*
*
* R4 node types: cache.r4.large
, cache.r4.xlarge
, cache.r4.2xlarge
,
* cache.r4.4xlarge
, cache.r4.8xlarge
, cache.r4.16xlarge
*
*
* -
*
* Previous generation: (not recommended)
*
*
* M2 node types: cache.m2.xlarge
, cache.m2.2xlarge
, cache.m2.4xlarge
*
*
* R3 node types: cache.r3.large
, cache.r3.xlarge
, cache.r3.2xlarge
,
* cache.r3.4xlarge
, cache.r3.8xlarge
*
*
*
*
*
*
* Additional node type info
*
*
* -
*
* All current generation instance types are created in Amazon VPC by default.
*
*
* -
*
* Redis append-only files (AOF) are not supported for T1 or T2 instances.
*
*
* -
*
* Redis Multi-AZ with automatic failover is not supported on T1 instances.
*
*
* -
*
* Redis configuration variables appendonly
and appendfsync
are not supported on Redis
* version 2.8.22 and later.
*
*
*
*
* @return The cache node type for the reserved cache node.
*
* The following node types are supported by ElastiCache. Generally speaking, the current generation types
* provide more memory and computational power at lower cost when compared to their equivalent previous
* generation counterparts.
*
*
* -
*
* General purpose:
*
*
* -
*
* Current generation:
*
*
* M6g node types (available only for Redis engine version 5.0.6 onward and for Memcached engine
* version 1.5.16 onward).
*
*
* cache.m6g.large
, cache.m6g.xlarge
, cache.m6g.2xlarge
,
* cache.m6g.4xlarge
, cache.m6g.8xlarge
, cache.m6g.12xlarge
,
* cache.m6g.16xlarge
*
*
*
* For region availability, see Supported Node Types
*
*
*
* M5 node types: cache.m5.large
, cache.m5.xlarge
,
* cache.m5.2xlarge
, cache.m5.4xlarge
, cache.m5.12xlarge
,
* cache.m5.24xlarge
*
*
* M4 node types: cache.m4.large
, cache.m4.xlarge
,
* cache.m4.2xlarge
, cache.m4.4xlarge
, cache.m4.10xlarge
*
*
* T3 node types: cache.t3.micro
, cache.t3.small
,
* cache.t3.medium
*
*
* T2 node types: cache.t2.micro
, cache.t2.small
,
* cache.t2.medium
*
*
* -
*
* Previous generation: (not recommended)
*
*
* T1 node types: cache.t1.micro
*
*
* M1 node types: cache.m1.small
, cache.m1.medium
,
* cache.m1.large
, cache.m1.xlarge
*
*
* M3 node types: cache.m3.medium
, cache.m3.large
,
* cache.m3.xlarge
, cache.m3.2xlarge
*
*
*
*
* -
*
* Compute optimized:
*
*
* -
*
* Previous generation: (not recommended)
*
*
* C1 node types: cache.c1.xlarge
*
*
*
*
* -
*
* Memory optimized:
*
*
* -
*
* Current generation:
*
*
* R6g node types (available only for Redis engine version 5.0.6 onward and for Memcached engine
* version 1.5.16 onward).
*
*
* cache.r6g.large
, cache.r6g.xlarge
, cache.r6g.2xlarge
,
* cache.r6g.4xlarge
, cache.r6g.8xlarge
, cache.r6g.12xlarge
,
* cache.r6g.16xlarge
*
*
*
* For region availability, see Supported Node Types
*
*
*
* R5 node types: cache.r5.large
, cache.r5.xlarge
,
* cache.r5.2xlarge
, cache.r5.4xlarge
, cache.r5.12xlarge
,
* cache.r5.24xlarge
*
*
* R4 node types: cache.r4.large
, cache.r4.xlarge
,
* cache.r4.2xlarge
, cache.r4.4xlarge
, cache.r4.8xlarge
,
* cache.r4.16xlarge
*
*
* -
*
* Previous generation: (not recommended)
*
*
* M2 node types: cache.m2.xlarge
, cache.m2.2xlarge
,
* cache.m2.4xlarge
*
*
* R3 node types: cache.r3.large
, cache.r3.xlarge
,
* cache.r3.2xlarge
, cache.r3.4xlarge
, cache.r3.8xlarge
*
*
*
*
*
*
* Additional node type info
*
*
* -
*
* All current generation instance types are created in Amazon VPC by default.
*
*
* -
*
* Redis append-only files (AOF) are not supported for T1 or T2 instances.
*
*
* -
*
* Redis Multi-AZ with automatic failover is not supported on T1 instances.
*
*
* -
*
* Redis configuration variables appendonly
and appendfsync
are not supported on
* Redis version 2.8.22 and later.
*
*
*/
public final String cacheNodeType() {
return cacheNodeType;
}
/**
*
* The duration of the offering. in seconds.
*
*
* @return The duration of the offering. in seconds.
*/
public final Integer duration() {
return duration;
}
/**
*
* The fixed price charged for this offering.
*
*
* @return The fixed price charged for this offering.
*/
public final Double fixedPrice() {
return fixedPrice;
}
/**
*
* The hourly price charged for this offering.
*
*
* @return The hourly price charged for this offering.
*/
public final Double usagePrice() {
return usagePrice;
}
/**
*
* The cache engine used by the offering.
*
*
* @return The cache engine used by the offering.
*/
public final String productDescription() {
return productDescription;
}
/**
*
* The offering type.
*
*
* @return The offering type.
*/
public final String offeringType() {
return offeringType;
}
/**
* For responses, this returns true if the service returned a value for the RecurringCharges 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 hasRecurringCharges() {
return recurringCharges != null && !(recurringCharges instanceof SdkAutoConstructList);
}
/**
*
* The recurring price charged to run this reserved cache node.
*
*
* 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 #hasRecurringCharges} method.
*
*
* @return The recurring price charged to run this reserved cache node.
*/
public final List recurringCharges() {
return recurringCharges;
}
@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(reservedCacheNodesOfferingId());
hashCode = 31 * hashCode + Objects.hashCode(cacheNodeType());
hashCode = 31 * hashCode + Objects.hashCode(duration());
hashCode = 31 * hashCode + Objects.hashCode(fixedPrice());
hashCode = 31 * hashCode + Objects.hashCode(usagePrice());
hashCode = 31 * hashCode + Objects.hashCode(productDescription());
hashCode = 31 * hashCode + Objects.hashCode(offeringType());
hashCode = 31 * hashCode + Objects.hashCode(hasRecurringCharges() ? recurringCharges() : 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 ReservedCacheNodesOffering)) {
return false;
}
ReservedCacheNodesOffering other = (ReservedCacheNodesOffering) obj;
return Objects.equals(reservedCacheNodesOfferingId(), other.reservedCacheNodesOfferingId())
&& Objects.equals(cacheNodeType(), other.cacheNodeType()) && Objects.equals(duration(), other.duration())
&& Objects.equals(fixedPrice(), other.fixedPrice()) && Objects.equals(usagePrice(), other.usagePrice())
&& Objects.equals(productDescription(), other.productDescription())
&& Objects.equals(offeringType(), other.offeringType()) && hasRecurringCharges() == other.hasRecurringCharges()
&& Objects.equals(recurringCharges(), other.recurringCharges());
}
/**
* 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("ReservedCacheNodesOffering").add("ReservedCacheNodesOfferingId", reservedCacheNodesOfferingId())
.add("CacheNodeType", cacheNodeType()).add("Duration", duration()).add("FixedPrice", fixedPrice())
.add("UsagePrice", usagePrice()).add("ProductDescription", productDescription())
.add("OfferingType", offeringType()).add("RecurringCharges", hasRecurringCharges() ? recurringCharges() : null)
.build();
}
public final Optional getValueForField(String fieldName, Class clazz) {
switch (fieldName) {
case "ReservedCacheNodesOfferingId":
return Optional.ofNullable(clazz.cast(reservedCacheNodesOfferingId()));
case "CacheNodeType":
return Optional.ofNullable(clazz.cast(cacheNodeType()));
case "Duration":
return Optional.ofNullable(clazz.cast(duration()));
case "FixedPrice":
return Optional.ofNullable(clazz.cast(fixedPrice()));
case "UsagePrice":
return Optional.ofNullable(clazz.cast(usagePrice()));
case "ProductDescription":
return Optional.ofNullable(clazz.cast(productDescription()));
case "OfferingType":
return Optional.ofNullable(clazz.cast(offeringType()));
case "RecurringCharges":
return Optional.ofNullable(clazz.cast(recurringCharges()));
default:
return Optional.empty();
}
}
@Override
public final List> sdkFields() {
return SDK_FIELDS;
}
private static Function