software.amazon.awssdk.services.appstream.model.User Maven / Gradle / Ivy
Show all versions of appstream 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.appstream.model;
import java.io.Serializable;
import java.time.Instant;
import java.util.Arrays;
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.LocationTrait;
import software.amazon.awssdk.utils.ToString;
import software.amazon.awssdk.utils.builder.CopyableBuilder;
import software.amazon.awssdk.utils.builder.ToCopyableBuilder;
/**
*
* Describes a user in the user pool.
*
*/
@Generated("software.amazon.awssdk:codegen")
public final class User implements SdkPojo, Serializable, ToCopyableBuilder {
private static final SdkField ARN_FIELD = SdkField. builder(MarshallingType.STRING).memberName("Arn")
.getter(getter(User::arn)).setter(setter(Builder::arn))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("Arn").build()).build();
private static final SdkField USER_NAME_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("UserName").getter(getter(User::userName)).setter(setter(Builder::userName))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("UserName").build()).build();
private static final SdkField ENABLED_FIELD = SdkField. builder(MarshallingType.BOOLEAN)
.memberName("Enabled").getter(getter(User::enabled)).setter(setter(Builder::enabled))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("Enabled").build()).build();
private static final SdkField STATUS_FIELD = SdkField. builder(MarshallingType.STRING).memberName("Status")
.getter(getter(User::status)).setter(setter(Builder::status))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("Status").build()).build();
private static final SdkField FIRST_NAME_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("FirstName").getter(getter(User::firstName)).setter(setter(Builder::firstName))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("FirstName").build()).build();
private static final SdkField LAST_NAME_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("LastName").getter(getter(User::lastName)).setter(setter(Builder::lastName))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("LastName").build()).build();
private static final SdkField CREATED_TIME_FIELD = SdkField. builder(MarshallingType.INSTANT)
.memberName("CreatedTime").getter(getter(User::createdTime)).setter(setter(Builder::createdTime))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("CreatedTime").build()).build();
private static final SdkField AUTHENTICATION_TYPE_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("AuthenticationType").getter(getter(User::authenticationTypeAsString))
.setter(setter(Builder::authenticationType))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("AuthenticationType").build())
.build();
private static final List> SDK_FIELDS = Collections.unmodifiableList(Arrays.asList(ARN_FIELD, USER_NAME_FIELD,
ENABLED_FIELD, STATUS_FIELD, FIRST_NAME_FIELD, LAST_NAME_FIELD, CREATED_TIME_FIELD, AUTHENTICATION_TYPE_FIELD));
private static final long serialVersionUID = 1L;
private final String arn;
private final String userName;
private final Boolean enabled;
private final String status;
private final String firstName;
private final String lastName;
private final Instant createdTime;
private final String authenticationType;
private User(BuilderImpl builder) {
this.arn = builder.arn;
this.userName = builder.userName;
this.enabled = builder.enabled;
this.status = builder.status;
this.firstName = builder.firstName;
this.lastName = builder.lastName;
this.createdTime = builder.createdTime;
this.authenticationType = builder.authenticationType;
}
/**
*
* The ARN of the user.
*
*
* @return The ARN of the user.
*/
public String arn() {
return arn;
}
/**
*
* The email address of the user.
*
*
*
* Users' email addresses are case-sensitive.
*
*
*
* @return The email address of the user.
*
* Users' email addresses are case-sensitive.
*
*/
public String userName() {
return userName;
}
/**
*
* Specifies whether the user in the user pool is enabled.
*
*
* @return Specifies whether the user in the user pool is enabled.
*/
public Boolean enabled() {
return enabled;
}
/**
*
* The status of the user in the user pool. The status can be one of the following:
*
*
* -
*
* UNCONFIRMED – The user is created but not confirmed.
*
*
* -
*
* CONFIRMED – The user is confirmed.
*
*
* -
*
* ARCHIVED – The user is no longer active.
*
*
* -
*
* COMPROMISED – The user is disabled because of a potential security threat.
*
*
* -
*
* UNKNOWN – The user status is not known.
*
*
*
*
* @return The status of the user in the user pool. The status can be one of the following:
*
* -
*
* UNCONFIRMED – The user is created but not confirmed.
*
*
* -
*
* CONFIRMED – The user is confirmed.
*
*
* -
*
* ARCHIVED – The user is no longer active.
*
*
* -
*
* COMPROMISED – The user is disabled because of a potential security threat.
*
*
* -
*
* UNKNOWN – The user status is not known.
*
*
*/
public String status() {
return status;
}
/**
*
* The first name, or given name, of the user.
*
*
* @return The first name, or given name, of the user.
*/
public String firstName() {
return firstName;
}
/**
*
* The last name, or surname, of the user.
*
*
* @return The last name, or surname, of the user.
*/
public String lastName() {
return lastName;
}
/**
*
* The date and time the user was created in the user pool.
*
*
* @return The date and time the user was created in the user pool.
*/
public Instant createdTime() {
return createdTime;
}
/**
*
* The authentication type for the user.
*
*
* If the service returns an enum value that is not available in the current SDK version,
* {@link #authenticationType} will return {@link AuthenticationType#UNKNOWN_TO_SDK_VERSION}. The raw value returned
* by the service is available from {@link #authenticationTypeAsString}.
*
*
* @return The authentication type for the user.
* @see AuthenticationType
*/
public AuthenticationType authenticationType() {
return AuthenticationType.fromValue(authenticationType);
}
/**
*
* The authentication type for the user.
*
*
* If the service returns an enum value that is not available in the current SDK version,
* {@link #authenticationType} will return {@link AuthenticationType#UNKNOWN_TO_SDK_VERSION}. The raw value returned
* by the service is available from {@link #authenticationTypeAsString}.
*
*
* @return The authentication type for the user.
* @see AuthenticationType
*/
public String authenticationTypeAsString() {
return authenticationType;
}
@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 + Objects.hashCode(arn());
hashCode = 31 * hashCode + Objects.hashCode(userName());
hashCode = 31 * hashCode + Objects.hashCode(enabled());
hashCode = 31 * hashCode + Objects.hashCode(status());
hashCode = 31 * hashCode + Objects.hashCode(firstName());
hashCode = 31 * hashCode + Objects.hashCode(lastName());
hashCode = 31 * hashCode + Objects.hashCode(createdTime());
hashCode = 31 * hashCode + Objects.hashCode(authenticationTypeAsString());
return hashCode;
}
@Override
public boolean equals(Object obj) {
return equalsBySdkFields(obj);
}
@Override
public boolean equalsBySdkFields(Object obj) {
if (this == obj) {
return true;
}
if (obj == null) {
return false;
}
if (!(obj instanceof User)) {
return false;
}
User other = (User) obj;
return Objects.equals(arn(), other.arn()) && Objects.equals(userName(), other.userName())
&& Objects.equals(enabled(), other.enabled()) && Objects.equals(status(), other.status())
&& Objects.equals(firstName(), other.firstName()) && Objects.equals(lastName(), other.lastName())
&& Objects.equals(createdTime(), other.createdTime())
&& Objects.equals(authenticationTypeAsString(), other.authenticationTypeAsString());
}
/**
* 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("User").add("Arn", arn())
.add("UserName", userName() == null ? null : "*** Sensitive Data Redacted ***").add("Enabled", enabled())
.add("Status", status()).add("FirstName", firstName() == null ? null : "*** Sensitive Data Redacted ***")
.add("LastName", lastName() == null ? null : "*** Sensitive Data Redacted ***").add("CreatedTime", createdTime())
.add("AuthenticationType", authenticationTypeAsString()).build();
}
public Optional getValueForField(String fieldName, Class clazz) {
switch (fieldName) {
case "Arn":
return Optional.ofNullable(clazz.cast(arn()));
case "UserName":
return Optional.ofNullable(clazz.cast(userName()));
case "Enabled":
return Optional.ofNullable(clazz.cast(enabled()));
case "Status":
return Optional.ofNullable(clazz.cast(status()));
case "FirstName":
return Optional.ofNullable(clazz.cast(firstName()));
case "LastName":
return Optional.ofNullable(clazz.cast(lastName()));
case "CreatedTime":
return Optional.ofNullable(clazz.cast(createdTime()));
case "AuthenticationType":
return Optional.ofNullable(clazz.cast(authenticationTypeAsString()));
default:
return Optional.empty();
}
}
@Override
public List> sdkFields() {
return SDK_FIELDS;
}
private static Function