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 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 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, PENDING_CHANGES_FIELD, REPLICATION_GROUPS_FIELD, ARN_FIELD));
private final String userGroupId;
private final String status;
private final String engine;
private final List userIds;
private final UserGroupPendingChanges pendingChanges;
private final List replicationGroups;
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.pendingChanges = builder.pendingChanges;
this.replicationGroups = builder.replicationGroups;
this.arn = builder.arn;
}
/**
*
* The ID of the user group.
*
*
* @return The ID of the user group.
*/
public 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 String status() {
return status;
}
/**
*
* Must be Redis.
*
*
* @return Must be Redis.
*/
public String engine() {
return engine;
}
/**
* Returns true if the UserIds property was specified by the sender (it may be empty), or false if the sender did
* not specify the value (it will be empty). For responses returned by the SDK, the sender is the AWS service.
*/
public 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.
*
*
* You can use {@link #hasUserIds()} to see if a value was sent in this field.
*
*
* @return The list of user IDs that belong to the user group.
*/
public List userIds() {
return userIds;
}
/**
*
* A list of updates being applied to the user groups.
*
*
* @return A list of updates being applied to the user groups.
*/
public UserGroupPendingChanges pendingChanges() {
return pendingChanges;
}
/**
* Returns true if the ReplicationGroups property was specified by the sender (it may be empty), or false if the
* sender did not specify the value (it will be empty). For responses returned by the SDK, the sender is the AWS
* service.
*/
public 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.
*
*
* You can use {@link #hasReplicationGroups()} to see if a value was sent in this field.
*
*
* @return A list of replication groups that the user group can access.
*/
public List replicationGroups() {
return replicationGroups;
}
/**
*
* The Amazon Resource Name (ARN) of the user group.
*
*
* @return The Amazon Resource Name (ARN) of the user group.
*/
public 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 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(userIds());
hashCode = 31 * hashCode + Objects.hashCode(pendingChanges());
hashCode = 31 * hashCode + Objects.hashCode(replicationGroups());
hashCode = 31 * hashCode + Objects.hashCode(arn());
return hashCode;
}
@Override
public boolean equals(Object obj) {
return super.equals(obj) && equalsBySdkFields(obj);
}
@Override
public 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()) && Objects.equals(userIds(), other.userIds())
&& Objects.equals(pendingChanges(), other.pendingChanges())
&& Objects.equals(replicationGroups(), other.replicationGroups()) && 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 String toString() {
return ToString.builder("CreateUserGroupResponse").add("UserGroupId", userGroupId()).add("Status", status())
.add("Engine", engine()).add("UserIds", userIds()).add("PendingChanges", pendingChanges())
.add("ReplicationGroups", replicationGroups()).add("ARN", arn()).build();
}
public 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 "PendingChanges":
return Optional.ofNullable(clazz.cast(pendingChanges()));
case "ReplicationGroups":
return Optional.ofNullable(clazz.cast(replicationGroups()));
case "ARN":
return Optional.ofNullable(clazz.cast(arn()));
default:
return Optional.empty();
}
}
@Override
public List> sdkFields() {
return SDK_FIELDS;
}
private static Function