software.amazon.awssdk.services.elasticache.model.CreateUserGroupResponse 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 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;
/**
*/
@Generated("software.amazon.awssdk:codegen")
public final class CreateUserGroupResponse extends ElastiCacheResponse implements
ToCopyableBuilder {
private static final SdkField USER_GROUP_ID_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("UserGroupId").getter(getter(CreateUserGroupResponse::userGroupId)).setter(setter(Builder::userGroupId))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("UserGroupId").build()).build();
private static final SdkField STATUS_FIELD = SdkField. builder(MarshallingType.STRING).memberName("Status")
.getter(getter(CreateUserGroupResponse::status)).setter(setter(Builder::status))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("Status").build()).build();
private static final SdkField ENGINE_FIELD = SdkField. builder(MarshallingType.STRING).memberName("Engine")
.getter(getter(CreateUserGroupResponse::engine)).setter(setter(Builder::engine))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("Engine").build()).build();
private static final SdkField> USER_IDS_FIELD = SdkField
.> builder(MarshallingType.LIST)
.memberName("UserIds")
.getter(getter(CreateUserGroupResponse::userIds))
.setter(setter(Builder::userIds))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("UserIds").build(),
ListTrait
.builder()
.memberLocationName(null)
.memberFieldInfo(
SdkField. builder(MarshallingType.STRING)
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD)
.locationName("member").build()).build()).build()).build();
private static final SdkField MINIMUM_ENGINE_VERSION_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("MinimumEngineVersion").getter(getter(CreateUserGroupResponse::minimumEngineVersion))
.setter(setter(Builder::minimumEngineVersion))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("MinimumEngineVersion").build())
.build();
private static final SdkField PENDING_CHANGES_FIELD = SdkField
. builder(MarshallingType.SDK_POJO).memberName("PendingChanges")
.getter(getter(CreateUserGroupResponse::pendingChanges)).setter(setter(Builder::pendingChanges))
.constructor(UserGroupPendingChanges::builder)
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("PendingChanges").build()).build();
private static final SdkField> REPLICATION_GROUPS_FIELD = SdkField
.> builder(MarshallingType.LIST)
.memberName("ReplicationGroups")
.getter(getter(CreateUserGroupResponse::replicationGroups))
.setter(setter(Builder::replicationGroups))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("ReplicationGroups").build(),
ListTrait
.builder()
.memberLocationName(null)
.memberFieldInfo(
SdkField. builder(MarshallingType.STRING)
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD)
.locationName("member").build()).build()).build()).build();
private static final SdkField> SERVERLESS_CACHES_FIELD = SdkField
.> builder(MarshallingType.LIST)
.memberName("ServerlessCaches")
.getter(getter(CreateUserGroupResponse::serverlessCaches))
.setter(setter(Builder::serverlessCaches))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("ServerlessCaches").build(),
ListTrait
.builder()
.memberLocationName(null)
.memberFieldInfo(
SdkField. builder(MarshallingType.STRING)
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD)
.locationName("member").build()).build()).build()).build();
private static final SdkField ARN_FIELD = SdkField. builder(MarshallingType.STRING).memberName("ARN")
.getter(getter(CreateUserGroupResponse::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(USER_GROUP_ID_FIELD,
STATUS_FIELD, ENGINE_FIELD, USER_IDS_FIELD, MINIMUM_ENGINE_VERSION_FIELD, PENDING_CHANGES_FIELD,
REPLICATION_GROUPS_FIELD, SERVERLESS_CACHES_FIELD, ARN_FIELD));
private final String userGroupId;
private final String status;
private final String engine;
private final List userIds;
private final String minimumEngineVersion;
private final UserGroupPendingChanges pendingChanges;
private final List replicationGroups;
private final List serverlessCaches;
private final String arn;
private CreateUserGroupResponse(BuilderImpl builder) {
super(builder);
this.userGroupId = builder.userGroupId;
this.status = builder.status;
this.engine = builder.engine;
this.userIds = builder.userIds;
this.minimumEngineVersion = builder.minimumEngineVersion;
this.pendingChanges = builder.pendingChanges;
this.replicationGroups = builder.replicationGroups;
this.serverlessCaches = builder.serverlessCaches;
this.arn = builder.arn;
}
/**
*
* The ID of the user group.
*
*
* @return The ID of the user group.
*/
public final String userGroupId() {
return userGroupId;
}
/**
*
* Indicates user group status. Can be "creating", "active", "modifying", "deleting".
*
*
* @return Indicates user group status. Can be "creating", "active", "modifying", "deleting".
*/
public final String status() {
return status;
}
/**
*
* The current supported value is Redis.
*
*
* @return The current supported value is Redis.
*/
public final String engine() {
return engine;
}
/**
* For responses, this returns true if the service returned a value for the UserIds 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 hasUserIds() {
return userIds != null && !(userIds instanceof SdkAutoConstructList);
}
/**
*
* The list of user IDs that belong to the user 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 #hasUserIds} method.
*
*
* @return The list of user IDs that belong to the user group.
*/
public final List userIds() {
return userIds;
}
/**
*
* The minimum engine version required, which is Redis 6.0
*
*
* @return The minimum engine version required, which is Redis 6.0
*/
public final String minimumEngineVersion() {
return minimumEngineVersion;
}
/**
*
* A list of updates being applied to the user group.
*
*
* @return A list of updates being applied to the user group.
*/
public final UserGroupPendingChanges pendingChanges() {
return pendingChanges;
}
/**
* For responses, this returns true if the service returned a value for the ReplicationGroups 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 hasReplicationGroups() {
return replicationGroups != null && !(replicationGroups instanceof SdkAutoConstructList);
}
/**
*
* A list of replication groups that the user group can access.
*
*
* 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 #hasReplicationGroups} method.
*
*
* @return A list of replication groups that the user group can access.
*/
public final List replicationGroups() {
return replicationGroups;
}
/**
* For responses, this returns true if the service returned a value for the ServerlessCaches 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 hasServerlessCaches() {
return serverlessCaches != null && !(serverlessCaches instanceof SdkAutoConstructList);
}
/**
*
* Indicates which serverless caches the specified user group is associated with. Available for Redis 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 #hasServerlessCaches} method.
*
*
* @return Indicates which serverless caches the specified user group is associated with. Available for Redis only.
*/
public final List serverlessCaches() {
return serverlessCaches;
}
/**
*
* The Amazon Resource Name (ARN) of the user group.
*
*
* @return The Amazon Resource Name (ARN) of the user 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 + super.hashCode();
hashCode = 31 * hashCode + Objects.hashCode(userGroupId());
hashCode = 31 * hashCode + Objects.hashCode(status());
hashCode = 31 * hashCode + Objects.hashCode(engine());
hashCode = 31 * hashCode + Objects.hashCode(hasUserIds() ? userIds() : null);
hashCode = 31 * hashCode + Objects.hashCode(minimumEngineVersion());
hashCode = 31 * hashCode + Objects.hashCode(pendingChanges());
hashCode = 31 * hashCode + Objects.hashCode(hasReplicationGroups() ? replicationGroups() : null);
hashCode = 31 * hashCode + Objects.hashCode(hasServerlessCaches() ? serverlessCaches() : null);
hashCode = 31 * hashCode + Objects.hashCode(arn());
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 CreateUserGroupResponse)) {
return false;
}
CreateUserGroupResponse other = (CreateUserGroupResponse) obj;
return Objects.equals(userGroupId(), other.userGroupId()) && Objects.equals(status(), other.status())
&& Objects.equals(engine(), other.engine()) && hasUserIds() == other.hasUserIds()
&& Objects.equals(userIds(), other.userIds())
&& Objects.equals(minimumEngineVersion(), other.minimumEngineVersion())
&& Objects.equals(pendingChanges(), other.pendingChanges())
&& hasReplicationGroups() == other.hasReplicationGroups()
&& Objects.equals(replicationGroups(), other.replicationGroups())
&& hasServerlessCaches() == other.hasServerlessCaches()
&& Objects.equals(serverlessCaches(), other.serverlessCaches()) && 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("CreateUserGroupResponse").add("UserGroupId", userGroupId()).add("Status", status())
.add("Engine", engine()).add("UserIds", hasUserIds() ? userIds() : null)
.add("MinimumEngineVersion", minimumEngineVersion()).add("PendingChanges", pendingChanges())
.add("ReplicationGroups", hasReplicationGroups() ? replicationGroups() : null)
.add("ServerlessCaches", hasServerlessCaches() ? serverlessCaches() : null).add("ARN", arn()).build();
}
public final Optional getValueForField(String fieldName, Class clazz) {
switch (fieldName) {
case "UserGroupId":
return Optional.ofNullable(clazz.cast(userGroupId()));
case "Status":
return Optional.ofNullable(clazz.cast(status()));
case "Engine":
return Optional.ofNullable(clazz.cast(engine()));
case "UserIds":
return Optional.ofNullable(clazz.cast(userIds()));
case "MinimumEngineVersion":
return Optional.ofNullable(clazz.cast(minimumEngineVersion()));
case "PendingChanges":
return Optional.ofNullable(clazz.cast(pendingChanges()));
case "ReplicationGroups":
return Optional.ofNullable(clazz.cast(replicationGroups()));
case "ServerlessCaches":
return Optional.ofNullable(clazz.cast(serverlessCaches()));
case "ARN":
return Optional.ofNullable(clazz.cast(arn()));
default:
return Optional.empty();
}
}
@Override
public final List> sdkFields() {
return SDK_FIELDS;
}
private static Function