software.amazon.awssdk.services.elasticache.model.CreateServerlessCacheRequest 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.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.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;
/**
*/
@Generated("software.amazon.awssdk:codegen")
public final class CreateServerlessCacheRequest extends ElastiCacheRequest implements
ToCopyableBuilder {
private static final SdkField SERVERLESS_CACHE_NAME_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("ServerlessCacheName").getter(getter(CreateServerlessCacheRequest::serverlessCacheName))
.setter(setter(Builder::serverlessCacheName))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("ServerlessCacheName").build())
.build();
private static final SdkField DESCRIPTION_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("Description").getter(getter(CreateServerlessCacheRequest::description))
.setter(setter(Builder::description))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("Description").build()).build();
private static final SdkField ENGINE_FIELD = SdkField. builder(MarshallingType.STRING).memberName("Engine")
.getter(getter(CreateServerlessCacheRequest::engine)).setter(setter(Builder::engine))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("Engine").build()).build();
private static final SdkField MAJOR_ENGINE_VERSION_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("MajorEngineVersion").getter(getter(CreateServerlessCacheRequest::majorEngineVersion))
.setter(setter(Builder::majorEngineVersion))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("MajorEngineVersion").build())
.build();
private static final SdkField CACHE_USAGE_LIMITS_FIELD = SdkField
. builder(MarshallingType.SDK_POJO).memberName("CacheUsageLimits")
.getter(getter(CreateServerlessCacheRequest::cacheUsageLimits)).setter(setter(Builder::cacheUsageLimits))
.constructor(CacheUsageLimits::builder)
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("CacheUsageLimits").build()).build();
private static final SdkField KMS_KEY_ID_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("KmsKeyId").getter(getter(CreateServerlessCacheRequest::kmsKeyId)).setter(setter(Builder::kmsKeyId))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("KmsKeyId").build()).build();
private static final SdkField> SECURITY_GROUP_IDS_FIELD = SdkField
.> builder(MarshallingType.LIST)
.memberName("SecurityGroupIds")
.getter(getter(CreateServerlessCacheRequest::securityGroupIds))
.setter(setter(Builder::securityGroupIds))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("SecurityGroupIds").build(),
ListTrait
.builder()
.memberLocationName("SecurityGroupId")
.memberFieldInfo(
SdkField. builder(MarshallingType.STRING)
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD)
.locationName("SecurityGroupId").build()).build()).build()).build();
private static final SdkField> SNAPSHOT_ARNS_TO_RESTORE_FIELD = SdkField
.> builder(MarshallingType.LIST)
.memberName("SnapshotArnsToRestore")
.getter(getter(CreateServerlessCacheRequest::snapshotArnsToRestore))
.setter(setter(Builder::snapshotArnsToRestore))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("SnapshotArnsToRestore").build(),
ListTrait
.builder()
.memberLocationName("SnapshotArn")
.memberFieldInfo(
SdkField. builder(MarshallingType.STRING)
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD)
.locationName("SnapshotArn").build()).build()).build()).build();
private static final SdkField> TAGS_FIELD = SdkField
.> builder(MarshallingType.LIST)
.memberName("Tags")
.getter(getter(CreateServerlessCacheRequest::tags))
.setter(setter(Builder::tags))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("Tags").build(),
ListTrait
.builder()
.memberLocationName("Tag")
.memberFieldInfo(
SdkField. builder(MarshallingType.SDK_POJO)
.constructor(Tag::builder)
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD)
.locationName("Tag").build()).build()).build()).build();
private static final SdkField USER_GROUP_ID_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("UserGroupId").getter(getter(CreateServerlessCacheRequest::userGroupId))
.setter(setter(Builder::userGroupId))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("UserGroupId").build()).build();
private static final SdkField> SUBNET_IDS_FIELD = SdkField
.> builder(MarshallingType.LIST)
.memberName("SubnetIds")
.getter(getter(CreateServerlessCacheRequest::subnetIds))
.setter(setter(Builder::subnetIds))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("SubnetIds").build(),
ListTrait
.builder()
.memberLocationName("SubnetId")
.memberFieldInfo(
SdkField. builder(MarshallingType.STRING)
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD)
.locationName("SubnetId").build()).build()).build()).build();
private static final SdkField SNAPSHOT_RETENTION_LIMIT_FIELD = SdkField. builder(MarshallingType.INTEGER)
.memberName("SnapshotRetentionLimit").getter(getter(CreateServerlessCacheRequest::snapshotRetentionLimit))
.setter(setter(Builder::snapshotRetentionLimit))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("SnapshotRetentionLimit").build())
.build();
private static final SdkField DAILY_SNAPSHOT_TIME_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("DailySnapshotTime").getter(getter(CreateServerlessCacheRequest::dailySnapshotTime))
.setter(setter(Builder::dailySnapshotTime))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("DailySnapshotTime").build()).build();
private static final List> SDK_FIELDS = Collections.unmodifiableList(Arrays.asList(SERVERLESS_CACHE_NAME_FIELD,
DESCRIPTION_FIELD, ENGINE_FIELD, MAJOR_ENGINE_VERSION_FIELD, CACHE_USAGE_LIMITS_FIELD, KMS_KEY_ID_FIELD,
SECURITY_GROUP_IDS_FIELD, SNAPSHOT_ARNS_TO_RESTORE_FIELD, TAGS_FIELD, USER_GROUP_ID_FIELD, SUBNET_IDS_FIELD,
SNAPSHOT_RETENTION_LIMIT_FIELD, DAILY_SNAPSHOT_TIME_FIELD));
private final String serverlessCacheName;
private final String description;
private final String engine;
private final String majorEngineVersion;
private final CacheUsageLimits cacheUsageLimits;
private final String kmsKeyId;
private final List securityGroupIds;
private final List snapshotArnsToRestore;
private final List tags;
private final String userGroupId;
private final List subnetIds;
private final Integer snapshotRetentionLimit;
private final String dailySnapshotTime;
private CreateServerlessCacheRequest(BuilderImpl builder) {
super(builder);
this.serverlessCacheName = builder.serverlessCacheName;
this.description = builder.description;
this.engine = builder.engine;
this.majorEngineVersion = builder.majorEngineVersion;
this.cacheUsageLimits = builder.cacheUsageLimits;
this.kmsKeyId = builder.kmsKeyId;
this.securityGroupIds = builder.securityGroupIds;
this.snapshotArnsToRestore = builder.snapshotArnsToRestore;
this.tags = builder.tags;
this.userGroupId = builder.userGroupId;
this.subnetIds = builder.subnetIds;
this.snapshotRetentionLimit = builder.snapshotRetentionLimit;
this.dailySnapshotTime = builder.dailySnapshotTime;
}
/**
*
* User-provided identifier for the serverless cache. This parameter is stored as a lowercase string.
*
*
* @return User-provided identifier for the serverless cache. This parameter is stored as a lowercase string.
*/
public final String serverlessCacheName() {
return serverlessCacheName;
}
/**
*
* User-provided description for the serverless cache. The default is NULL, i.e. if no description is provided then
* an empty string will be returned. The maximum length is 255 characters.
*
*
* @return User-provided description for the serverless cache. The default is NULL, i.e. if no description is
* provided then an empty string will be returned. The maximum length is 255 characters.
*/
public final String description() {
return description;
}
/**
*
* The name of the cache engine to be used for creating the serverless cache.
*
*
* @return The name of the cache engine to be used for creating the serverless cache.
*/
public final String engine() {
return engine;
}
/**
*
* The version of the cache engine that will be used to create the serverless cache.
*
*
* @return The version of the cache engine that will be used to create the serverless cache.
*/
public final String majorEngineVersion() {
return majorEngineVersion;
}
/**
*
* Sets the cache usage limits for storage and ElastiCache Processing Units for the cache.
*
*
* @return Sets the cache usage limits for storage and ElastiCache Processing Units for the cache.
*/
public final CacheUsageLimits cacheUsageLimits() {
return cacheUsageLimits;
}
/**
*
* ARN of the customer managed key for encrypting the data at rest. If no KMS key is provided, a default service key
* is used.
*
*
* @return ARN of the customer managed key for encrypting the data at rest. If no KMS key is provided, a default
* service key is used.
*/
public final String kmsKeyId() {
return kmsKeyId;
}
/**
* For responses, this returns true if the service returned a value for the SecurityGroupIds 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 hasSecurityGroupIds() {
return securityGroupIds != null && !(securityGroupIds instanceof SdkAutoConstructList);
}
/**
*
* A list of the one or more VPC security groups to be associated with the serverless cache. The security group will
* authorize traffic access for the VPC end-point (private-link). If no other information is given this will be the
* VPC’s Default Security Group that is associated with the cluster VPC end-point.
*
*
* 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 #hasSecurityGroupIds} method.
*
*
* @return A list of the one or more VPC security groups to be associated with the serverless cache. The security
* group will authorize traffic access for the VPC end-point (private-link). If no other information is
* given this will be the VPC’s Default Security Group that is associated with the cluster VPC end-point.
*/
public final List securityGroupIds() {
return securityGroupIds;
}
/**
* For responses, this returns true if the service returned a value for the SnapshotArnsToRestore 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 hasSnapshotArnsToRestore() {
return snapshotArnsToRestore != null && !(snapshotArnsToRestore instanceof SdkAutoConstructList);
}
/**
*
* The ARN(s) of the snapshot that the new serverless cache will be created from. Available for Redis OSS and
* Serverless Memcached only.
*
*
* 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 #hasSnapshotArnsToRestore} method.
*
*
* @return The ARN(s) of the snapshot that the new serverless cache will be created from. Available for Redis OSS
* and Serverless Memcached only.
*/
public final List snapshotArnsToRestore() {
return snapshotArnsToRestore;
}
/**
* For responses, this returns true if the service returned a value for the Tags 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 hasTags() {
return tags != null && !(tags instanceof SdkAutoConstructList);
}
/**
*
* The list of tags (key, value) pairs to be added to the serverless cache resource. Default is NULL.
*
*
* 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 #hasTags} method.
*
*
* @return The list of tags (key, value) pairs to be added to the serverless cache resource. Default is NULL.
*/
public final List tags() {
return tags;
}
/**
*
* The identifier of the UserGroup to be associated with the serverless cache. Available for Redis OSS only. Default
* is NULL.
*
*
* @return The identifier of the UserGroup to be associated with the serverless cache. Available for Redis OSS only.
* Default is NULL.
*/
public final String userGroupId() {
return userGroupId;
}
/**
* For responses, this returns true if the service returned a value for the SubnetIds 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 hasSubnetIds() {
return subnetIds != null && !(subnetIds instanceof SdkAutoConstructList);
}
/**
*
* A list of the identifiers of the subnets where the VPC endpoint for the serverless cache will be deployed. All
* the subnetIds must belong to the same VPC.
*
*
* 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 #hasSubnetIds} method.
*
*
* @return A list of the identifiers of the subnets where the VPC endpoint for the serverless cache will be
* deployed. All the subnetIds must belong to the same VPC.
*/
public final List subnetIds() {
return subnetIds;
}
/**
*
* The number of snapshots that will be retained for the serverless cache that is being created. As new snapshots
* beyond this limit are added, the oldest snapshots will be deleted on a rolling basis. Available for Redis OSS and
* Serverless Memcached only.
*
*
* @return The number of snapshots that will be retained for the serverless cache that is being created. As new
* snapshots beyond this limit are added, the oldest snapshots will be deleted on a rolling basis. Available
* for Redis OSS and Serverless Memcached only.
*/
public final Integer snapshotRetentionLimit() {
return snapshotRetentionLimit;
}
/**
*
* The daily time that snapshots will be created from the new serverless cache. By default this number is populated
* with 0, i.e. no snapshots will be created on an automatic daily basis. Available for Redis OSS and Serverless
* Memcached only.
*
*
* @return The daily time that snapshots will be created from the new serverless cache. By default this number is
* populated with 0, i.e. no snapshots will be created on an automatic daily basis. Available for Redis OSS
* and Serverless Memcached only.
*/
public final String dailySnapshotTime() {
return dailySnapshotTime;
}
@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(serverlessCacheName());
hashCode = 31 * hashCode + Objects.hashCode(description());
hashCode = 31 * hashCode + Objects.hashCode(engine());
hashCode = 31 * hashCode + Objects.hashCode(majorEngineVersion());
hashCode = 31 * hashCode + Objects.hashCode(cacheUsageLimits());
hashCode = 31 * hashCode + Objects.hashCode(kmsKeyId());
hashCode = 31 * hashCode + Objects.hashCode(hasSecurityGroupIds() ? securityGroupIds() : null);
hashCode = 31 * hashCode + Objects.hashCode(hasSnapshotArnsToRestore() ? snapshotArnsToRestore() : null);
hashCode = 31 * hashCode + Objects.hashCode(hasTags() ? tags() : null);
hashCode = 31 * hashCode + Objects.hashCode(userGroupId());
hashCode = 31 * hashCode + Objects.hashCode(hasSubnetIds() ? subnetIds() : null);
hashCode = 31 * hashCode + Objects.hashCode(snapshotRetentionLimit());
hashCode = 31 * hashCode + Objects.hashCode(dailySnapshotTime());
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 CreateServerlessCacheRequest)) {
return false;
}
CreateServerlessCacheRequest other = (CreateServerlessCacheRequest) obj;
return Objects.equals(serverlessCacheName(), other.serverlessCacheName())
&& Objects.equals(description(), other.description()) && Objects.equals(engine(), other.engine())
&& Objects.equals(majorEngineVersion(), other.majorEngineVersion())
&& Objects.equals(cacheUsageLimits(), other.cacheUsageLimits()) && Objects.equals(kmsKeyId(), other.kmsKeyId())
&& hasSecurityGroupIds() == other.hasSecurityGroupIds()
&& Objects.equals(securityGroupIds(), other.securityGroupIds())
&& hasSnapshotArnsToRestore() == other.hasSnapshotArnsToRestore()
&& Objects.equals(snapshotArnsToRestore(), other.snapshotArnsToRestore()) && hasTags() == other.hasTags()
&& Objects.equals(tags(), other.tags()) && Objects.equals(userGroupId(), other.userGroupId())
&& hasSubnetIds() == other.hasSubnetIds() && Objects.equals(subnetIds(), other.subnetIds())
&& Objects.equals(snapshotRetentionLimit(), other.snapshotRetentionLimit())
&& Objects.equals(dailySnapshotTime(), other.dailySnapshotTime());
}
/**
* 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("CreateServerlessCacheRequest").add("ServerlessCacheName", serverlessCacheName())
.add("Description", description()).add("Engine", engine()).add("MajorEngineVersion", majorEngineVersion())
.add("CacheUsageLimits", cacheUsageLimits()).add("KmsKeyId", kmsKeyId())
.add("SecurityGroupIds", hasSecurityGroupIds() ? securityGroupIds() : null)
.add("SnapshotArnsToRestore", hasSnapshotArnsToRestore() ? snapshotArnsToRestore() : null)
.add("Tags", hasTags() ? tags() : null).add("UserGroupId", userGroupId())
.add("SubnetIds", hasSubnetIds() ? subnetIds() : null).add("SnapshotRetentionLimit", snapshotRetentionLimit())
.add("DailySnapshotTime", dailySnapshotTime()).build();
}
public final Optional getValueForField(String fieldName, Class clazz) {
switch (fieldName) {
case "ServerlessCacheName":
return Optional.ofNullable(clazz.cast(serverlessCacheName()));
case "Description":
return Optional.ofNullable(clazz.cast(description()));
case "Engine":
return Optional.ofNullable(clazz.cast(engine()));
case "MajorEngineVersion":
return Optional.ofNullable(clazz.cast(majorEngineVersion()));
case "CacheUsageLimits":
return Optional.ofNullable(clazz.cast(cacheUsageLimits()));
case "KmsKeyId":
return Optional.ofNullable(clazz.cast(kmsKeyId()));
case "SecurityGroupIds":
return Optional.ofNullable(clazz.cast(securityGroupIds()));
case "SnapshotArnsToRestore":
return Optional.ofNullable(clazz.cast(snapshotArnsToRestore()));
case "Tags":
return Optional.ofNullable(clazz.cast(tags()));
case "UserGroupId":
return Optional.ofNullable(clazz.cast(userGroupId()));
case "SubnetIds":
return Optional.ofNullable(clazz.cast(subnetIds()));
case "SnapshotRetentionLimit":
return Optional.ofNullable(clazz.cast(snapshotRetentionLimit()));
case "DailySnapshotTime":
return Optional.ofNullable(clazz.cast(dailySnapshotTime()));
default:
return Optional.empty();
}
}
@Override
public final List> sdkFields() {
return SDK_FIELDS;
}
private static Function