software.amazon.awssdk.services.workdocs.model.User Maven / Gradle / Ivy
Show all versions of workdocs 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.workdocs.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.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.LocationTrait;
import software.amazon.awssdk.utils.ToString;
import software.amazon.awssdk.utils.builder.CopyableBuilder;
import software.amazon.awssdk.utils.builder.ToCopyableBuilder;
/**
*
* Describes a user.
*
*/
@Generated("software.amazon.awssdk:codegen")
public final class User implements SdkPojo, Serializable, ToCopyableBuilder {
private static final SdkField ID_FIELD = SdkField. builder(MarshallingType.STRING).memberName("Id")
.getter(getter(User::id)).setter(setter(Builder::id))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("Id").build()).build();
private static final SdkField USERNAME_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 EMAIL_ADDRESS_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("EmailAddress").getter(getter(User::emailAddress)).setter(setter(Builder::emailAddress))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("EmailAddress").build()).build();
private static final SdkField GIVEN_NAME_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("GivenName").getter(getter(User::givenName)).setter(setter(Builder::givenName))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("GivenName").build()).build();
private static final SdkField SURNAME_FIELD = SdkField. builder(MarshallingType.STRING).memberName("Surname")
.getter(getter(User::surname)).setter(setter(Builder::surname))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("Surname").build()).build();
private static final SdkField ORGANIZATION_ID_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("OrganizationId").getter(getter(User::organizationId)).setter(setter(Builder::organizationId))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("OrganizationId").build()).build();
private static final SdkField ROOT_FOLDER_ID_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("RootFolderId").getter(getter(User::rootFolderId)).setter(setter(Builder::rootFolderId))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("RootFolderId").build()).build();
private static final SdkField RECYCLE_BIN_FOLDER_ID_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("RecycleBinFolderId").getter(getter(User::recycleBinFolderId))
.setter(setter(Builder::recycleBinFolderId))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("RecycleBinFolderId").build())
.build();
private static final SdkField STATUS_FIELD = SdkField. builder(MarshallingType.STRING).memberName("Status")
.getter(getter(User::statusAsString)).setter(setter(Builder::status))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("Status").build()).build();
private static final SdkField TYPE_FIELD = SdkField. builder(MarshallingType.STRING).memberName("Type")
.getter(getter(User::typeAsString)).setter(setter(Builder::type))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("Type").build()).build();
private static final SdkField CREATED_TIMESTAMP_FIELD = SdkField. builder(MarshallingType.INSTANT)
.memberName("CreatedTimestamp").getter(getter(User::createdTimestamp)).setter(setter(Builder::createdTimestamp))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("CreatedTimestamp").build()).build();
private static final SdkField MODIFIED_TIMESTAMP_FIELD = SdkField. builder(MarshallingType.INSTANT)
.memberName("ModifiedTimestamp").getter(getter(User::modifiedTimestamp)).setter(setter(Builder::modifiedTimestamp))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("ModifiedTimestamp").build()).build();
private static final SdkField TIME_ZONE_ID_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("TimeZoneId").getter(getter(User::timeZoneId)).setter(setter(Builder::timeZoneId))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("TimeZoneId").build()).build();
private static final SdkField LOCALE_FIELD = SdkField. builder(MarshallingType.STRING).memberName("Locale")
.getter(getter(User::localeAsString)).setter(setter(Builder::locale))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("Locale").build()).build();
private static final SdkField STORAGE_FIELD = SdkField
. builder(MarshallingType.SDK_POJO).memberName("Storage").getter(getter(User::storage))
.setter(setter(Builder::storage)).constructor(UserStorageMetadata::builder)
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("Storage").build()).build();
private static final List> SDK_FIELDS = Collections.unmodifiableList(Arrays.asList(ID_FIELD, USERNAME_FIELD,
EMAIL_ADDRESS_FIELD, GIVEN_NAME_FIELD, SURNAME_FIELD, ORGANIZATION_ID_FIELD, ROOT_FOLDER_ID_FIELD,
RECYCLE_BIN_FOLDER_ID_FIELD, STATUS_FIELD, TYPE_FIELD, CREATED_TIMESTAMP_FIELD, MODIFIED_TIMESTAMP_FIELD,
TIME_ZONE_ID_FIELD, LOCALE_FIELD, STORAGE_FIELD));
private static final long serialVersionUID = 1L;
private final String id;
private final String username;
private final String emailAddress;
private final String givenName;
private final String surname;
private final String organizationId;
private final String rootFolderId;
private final String recycleBinFolderId;
private final String status;
private final String type;
private final Instant createdTimestamp;
private final Instant modifiedTimestamp;
private final String timeZoneId;
private final String locale;
private final UserStorageMetadata storage;
private User(BuilderImpl builder) {
this.id = builder.id;
this.username = builder.username;
this.emailAddress = builder.emailAddress;
this.givenName = builder.givenName;
this.surname = builder.surname;
this.organizationId = builder.organizationId;
this.rootFolderId = builder.rootFolderId;
this.recycleBinFolderId = builder.recycleBinFolderId;
this.status = builder.status;
this.type = builder.type;
this.createdTimestamp = builder.createdTimestamp;
this.modifiedTimestamp = builder.modifiedTimestamp;
this.timeZoneId = builder.timeZoneId;
this.locale = builder.locale;
this.storage = builder.storage;
}
/**
*
* The ID of the user.
*
*
* @return The ID of the user.
*/
public final String id() {
return id;
}
/**
*
* The login name of the user.
*
*
* @return The login name of the user.
*/
public final String username() {
return username;
}
/**
*
* The email address of the user.
*
*
* @return The email address of the user.
*/
public final String emailAddress() {
return emailAddress;
}
/**
*
* The given name of the user.
*
*
* @return The given name of the user.
*/
public final String givenName() {
return givenName;
}
/**
*
* The surname of the user.
*
*
* @return The surname of the user.
*/
public final String surname() {
return surname;
}
/**
*
* The ID of the organization.
*
*
* @return The ID of the organization.
*/
public final String organizationId() {
return organizationId;
}
/**
*
* The ID of the root folder.
*
*
* @return The ID of the root folder.
*/
public final String rootFolderId() {
return rootFolderId;
}
/**
*
* The ID of the recycle bin folder.
*
*
* @return The ID of the recycle bin folder.
*/
public final String recycleBinFolderId() {
return recycleBinFolderId;
}
/**
*
* The status of the user.
*
*
* If the service returns an enum value that is not available in the current SDK version, {@link #status} will
* return {@link UserStatusType#UNKNOWN_TO_SDK_VERSION}. The raw value returned by the service is available from
* {@link #statusAsString}.
*
*
* @return The status of the user.
* @see UserStatusType
*/
public final UserStatusType status() {
return UserStatusType.fromValue(status);
}
/**
*
* The status of the user.
*
*
* If the service returns an enum value that is not available in the current SDK version, {@link #status} will
* return {@link UserStatusType#UNKNOWN_TO_SDK_VERSION}. The raw value returned by the service is available from
* {@link #statusAsString}.
*
*
* @return The status of the user.
* @see UserStatusType
*/
public final String statusAsString() {
return status;
}
/**
*
* The type of user.
*
*
* If the service returns an enum value that is not available in the current SDK version, {@link #type} will return
* {@link UserType#UNKNOWN_TO_SDK_VERSION}. The raw value returned by the service is available from
* {@link #typeAsString}.
*
*
* @return The type of user.
* @see UserType
*/
public final UserType type() {
return UserType.fromValue(type);
}
/**
*
* The type of user.
*
*
* If the service returns an enum value that is not available in the current SDK version, {@link #type} will return
* {@link UserType#UNKNOWN_TO_SDK_VERSION}. The raw value returned by the service is available from
* {@link #typeAsString}.
*
*
* @return The type of user.
* @see UserType
*/
public final String typeAsString() {
return type;
}
/**
*
* The time when the user was created.
*
*
* @return The time when the user was created.
*/
public final Instant createdTimestamp() {
return createdTimestamp;
}
/**
*
* The time when the user was modified.
*
*
* @return The time when the user was modified.
*/
public final Instant modifiedTimestamp() {
return modifiedTimestamp;
}
/**
*
* The time zone ID of the user.
*
*
* @return The time zone ID of the user.
*/
public final String timeZoneId() {
return timeZoneId;
}
/**
*
* The locale of the user.
*
*
* If the service returns an enum value that is not available in the current SDK version, {@link #locale} will
* return {@link LocaleType#UNKNOWN_TO_SDK_VERSION}. The raw value returned by the service is available from
* {@link #localeAsString}.
*
*
* @return The locale of the user.
* @see LocaleType
*/
public final LocaleType locale() {
return LocaleType.fromValue(locale);
}
/**
*
* The locale of the user.
*
*
* If the service returns an enum value that is not available in the current SDK version, {@link #locale} will
* return {@link LocaleType#UNKNOWN_TO_SDK_VERSION}. The raw value returned by the service is available from
* {@link #localeAsString}.
*
*
* @return The locale of the user.
* @see LocaleType
*/
public final String localeAsString() {
return locale;
}
/**
*
* The storage for the user.
*
*
* @return The storage for the user.
*/
public final UserStorageMetadata storage() {
return storage;
}
@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(id());
hashCode = 31 * hashCode + Objects.hashCode(username());
hashCode = 31 * hashCode + Objects.hashCode(emailAddress());
hashCode = 31 * hashCode + Objects.hashCode(givenName());
hashCode = 31 * hashCode + Objects.hashCode(surname());
hashCode = 31 * hashCode + Objects.hashCode(organizationId());
hashCode = 31 * hashCode + Objects.hashCode(rootFolderId());
hashCode = 31 * hashCode + Objects.hashCode(recycleBinFolderId());
hashCode = 31 * hashCode + Objects.hashCode(statusAsString());
hashCode = 31 * hashCode + Objects.hashCode(typeAsString());
hashCode = 31 * hashCode + Objects.hashCode(createdTimestamp());
hashCode = 31 * hashCode + Objects.hashCode(modifiedTimestamp());
hashCode = 31 * hashCode + Objects.hashCode(timeZoneId());
hashCode = 31 * hashCode + Objects.hashCode(localeAsString());
hashCode = 31 * hashCode + Objects.hashCode(storage());
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 User)) {
return false;
}
User other = (User) obj;
return Objects.equals(id(), other.id()) && Objects.equals(username(), other.username())
&& Objects.equals(emailAddress(), other.emailAddress()) && Objects.equals(givenName(), other.givenName())
&& Objects.equals(surname(), other.surname()) && Objects.equals(organizationId(), other.organizationId())
&& Objects.equals(rootFolderId(), other.rootFolderId())
&& Objects.equals(recycleBinFolderId(), other.recycleBinFolderId())
&& Objects.equals(statusAsString(), other.statusAsString())
&& Objects.equals(typeAsString(), other.typeAsString())
&& Objects.equals(createdTimestamp(), other.createdTimestamp())
&& Objects.equals(modifiedTimestamp(), other.modifiedTimestamp())
&& Objects.equals(timeZoneId(), other.timeZoneId()) && Objects.equals(localeAsString(), other.localeAsString())
&& Objects.equals(storage(), other.storage());
}
/**
* 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("User").add("Id", id())
.add("Username", username() == null ? null : "*** Sensitive Data Redacted ***")
.add("EmailAddress", emailAddress() == null ? null : "*** Sensitive Data Redacted ***")
.add("GivenName", givenName() == null ? null : "*** Sensitive Data Redacted ***")
.add("Surname", surname() == null ? null : "*** Sensitive Data Redacted ***")
.add("OrganizationId", organizationId()).add("RootFolderId", rootFolderId())
.add("RecycleBinFolderId", recycleBinFolderId()).add("Status", statusAsString()).add("Type", typeAsString())
.add("CreatedTimestamp", createdTimestamp()).add("ModifiedTimestamp", modifiedTimestamp())
.add("TimeZoneId", timeZoneId()).add("Locale", localeAsString()).add("Storage", storage()).build();
}
public final Optional getValueForField(String fieldName, Class clazz) {
switch (fieldName) {
case "Id":
return Optional.ofNullable(clazz.cast(id()));
case "Username":
return Optional.ofNullable(clazz.cast(username()));
case "EmailAddress":
return Optional.ofNullable(clazz.cast(emailAddress()));
case "GivenName":
return Optional.ofNullable(clazz.cast(givenName()));
case "Surname":
return Optional.ofNullable(clazz.cast(surname()));
case "OrganizationId":
return Optional.ofNullable(clazz.cast(organizationId()));
case "RootFolderId":
return Optional.ofNullable(clazz.cast(rootFolderId()));
case "RecycleBinFolderId":
return Optional.ofNullable(clazz.cast(recycleBinFolderId()));
case "Status":
return Optional.ofNullable(clazz.cast(statusAsString()));
case "Type":
return Optional.ofNullable(clazz.cast(typeAsString()));
case "CreatedTimestamp":
return Optional.ofNullable(clazz.cast(createdTimestamp()));
case "ModifiedTimestamp":
return Optional.ofNullable(clazz.cast(modifiedTimestamp()));
case "TimeZoneId":
return Optional.ofNullable(clazz.cast(timeZoneId()));
case "Locale":
return Optional.ofNullable(clazz.cast(localeAsString()));
case "Storage":
return Optional.ofNullable(clazz.cast(storage()));
default:
return Optional.empty();
}
}
@Override
public final List> sdkFields() {
return SDK_FIELDS;
}
private static Function