
software.amazon.awssdk.services.transfer.model.DescribedUser Maven / Gradle / Ivy
/*
* 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.transfer.model;
import java.io.Serializable;
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.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;
/**
*
* Describes the properties of a user that was specified.
*
*/
@Generated("software.amazon.awssdk:codegen")
public final class DescribedUser implements SdkPojo, Serializable, ToCopyableBuilder {
private static final SdkField ARN_FIELD = SdkField. builder(MarshallingType.STRING).memberName("Arn")
.getter(getter(DescribedUser::arn)).setter(setter(Builder::arn))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("Arn").build()).build();
private static final SdkField HOME_DIRECTORY_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("HomeDirectory").getter(getter(DescribedUser::homeDirectory)).setter(setter(Builder::homeDirectory))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("HomeDirectory").build()).build();
private static final SdkField> HOME_DIRECTORY_MAPPINGS_FIELD = SdkField
.> builder(MarshallingType.LIST)
.memberName("HomeDirectoryMappings")
.getter(getter(DescribedUser::homeDirectoryMappings))
.setter(setter(Builder::homeDirectoryMappings))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("HomeDirectoryMappings").build(),
ListTrait
.builder()
.memberLocationName(null)
.memberFieldInfo(
SdkField. builder(MarshallingType.SDK_POJO)
.constructor(HomeDirectoryMapEntry::builder)
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD)
.locationName("member").build()).build()).build()).build();
private static final SdkField HOME_DIRECTORY_TYPE_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("HomeDirectoryType").getter(getter(DescribedUser::homeDirectoryTypeAsString))
.setter(setter(Builder::homeDirectoryType))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("HomeDirectoryType").build()).build();
private static final SdkField POLICY_FIELD = SdkField. builder(MarshallingType.STRING).memberName("Policy")
.getter(getter(DescribedUser::policy)).setter(setter(Builder::policy))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("Policy").build()).build();
private static final SdkField ROLE_FIELD = SdkField. builder(MarshallingType.STRING).memberName("Role")
.getter(getter(DescribedUser::role)).setter(setter(Builder::role))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("Role").build()).build();
private static final SdkField> SSH_PUBLIC_KEYS_FIELD = SdkField
.> builder(MarshallingType.LIST)
.memberName("SshPublicKeys")
.getter(getter(DescribedUser::sshPublicKeys))
.setter(setter(Builder::sshPublicKeys))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("SshPublicKeys").build(),
ListTrait
.builder()
.memberLocationName(null)
.memberFieldInfo(
SdkField. builder(MarshallingType.SDK_POJO)
.constructor(SshPublicKey::builder)
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD)
.locationName("member").build()).build()).build()).build();
private static final SdkField> TAGS_FIELD = SdkField
.> builder(MarshallingType.LIST)
.memberName("Tags")
.getter(getter(DescribedUser::tags))
.setter(setter(Builder::tags))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("Tags").build(),
ListTrait
.builder()
.memberLocationName(null)
.memberFieldInfo(
SdkField. builder(MarshallingType.SDK_POJO)
.constructor(Tag::builder)
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD)
.locationName("member").build()).build()).build()).build();
private static final SdkField USER_NAME_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("UserName").getter(getter(DescribedUser::userName)).setter(setter(Builder::userName))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("UserName").build()).build();
private static final List> SDK_FIELDS = Collections.unmodifiableList(Arrays.asList(ARN_FIELD,
HOME_DIRECTORY_FIELD, HOME_DIRECTORY_MAPPINGS_FIELD, HOME_DIRECTORY_TYPE_FIELD, POLICY_FIELD, ROLE_FIELD,
SSH_PUBLIC_KEYS_FIELD, TAGS_FIELD, USER_NAME_FIELD));
private static final long serialVersionUID = 1L;
private final String arn;
private final String homeDirectory;
private final List homeDirectoryMappings;
private final String homeDirectoryType;
private final String policy;
private final String role;
private final List sshPublicKeys;
private final List tags;
private final String userName;
private DescribedUser(BuilderImpl builder) {
this.arn = builder.arn;
this.homeDirectory = builder.homeDirectory;
this.homeDirectoryMappings = builder.homeDirectoryMappings;
this.homeDirectoryType = builder.homeDirectoryType;
this.policy = builder.policy;
this.role = builder.role;
this.sshPublicKeys = builder.sshPublicKeys;
this.tags = builder.tags;
this.userName = builder.userName;
}
/**
*
* Specifies the unique Amazon Resource Name (ARN) for the user that was requested to be described.
*
*
* @return Specifies the unique Amazon Resource Name (ARN) for the user that was requested to be described.
*/
public String arn() {
return arn;
}
/**
*
* Specifies the landing directory (or folder), which is the location that files are written to or read from in an
* Amazon S3 bucket, for the described user. An example is
* your-Amazon-S3-bucket-name>/home/username
.
*
*
* @return Specifies the landing directory (or folder), which is the location that files are written to or read from
* in an Amazon S3 bucket, for the described user. An example is
* your-Amazon-S3-bucket-name>/home/username
.
*/
public String homeDirectory() {
return homeDirectory;
}
/**
* Returns true if the HomeDirectoryMappings 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 hasHomeDirectoryMappings() {
return homeDirectoryMappings != null && !(homeDirectoryMappings instanceof SdkAutoConstructList);
}
/**
*
* Specifies the logical directory mappings that specify what Amazon S3 paths and keys should be visible to your
* user and how you want to make them visible. You will need to specify the "Entry
" and "
* Target
" pair, where Entry
shows how the path is made visible and Target
is
* the actual Amazon S3 path. If you only specify a target, it will be displayed as is. You will need to also make
* sure that your AWS Identity and Access Management (IAM) role provides access to paths in Target
.
*
*
* In most cases, you can use this value instead of the scope-down policy to lock your user down to the designated
* home directory ("chroot"). To do this, you can set Entry
to '/' and set Target
to the
* HomeDirectory parameter value.
*
*
* Attempts to modify the collection returned by this method will result in an UnsupportedOperationException.
*
*
* You can use {@link #hasHomeDirectoryMappings()} to see if a value was sent in this field.
*
*
* @return Specifies the logical directory mappings that specify what Amazon S3 paths and keys should be visible to
* your user and how you want to make them visible. You will need to specify the "Entry
" and "
* Target
" pair, where Entry
shows how the path is made visible and
* Target
is the actual Amazon S3 path. If you only specify a target, it will be displayed as
* is. You will need to also make sure that your AWS Identity and Access Management (IAM) role provides
* access to paths in Target
.
*
* In most cases, you can use this value instead of the scope-down policy to lock your user down to the
* designated home directory ("chroot"). To do this, you can set Entry
to '/' and set
* Target
to the HomeDirectory parameter value.
*/
public List homeDirectoryMappings() {
return homeDirectoryMappings;
}
/**
*
* Specifies the type of landing directory (folder) you mapped for your users to see when they log into the file
* transfer protocol-enabled server. If you set it to PATH
, the user will see the absolute Amazon S3
* bucket paths as is in their file transfer protocol clients. If you set it LOGICAL
, you will need to
* provide mappings in the HomeDirectoryMappings
for how you want to make Amazon S3 paths visible to
* your users.
*
*
* If the service returns an enum value that is not available in the current SDK version, {@link #homeDirectoryType}
* will return {@link HomeDirectoryType#UNKNOWN_TO_SDK_VERSION}. The raw value returned by the service is available
* from {@link #homeDirectoryTypeAsString}.
*
*
* @return Specifies the type of landing directory (folder) you mapped for your users to see when they log into the
* file transfer protocol-enabled server. If you set it to PATH
, the user will see the absolute
* Amazon S3 bucket paths as is in their file transfer protocol clients. If you set it LOGICAL
,
* you will need to provide mappings in the HomeDirectoryMappings
for how you want to make
* Amazon S3 paths visible to your users.
* @see HomeDirectoryType
*/
public HomeDirectoryType homeDirectoryType() {
return HomeDirectoryType.fromValue(homeDirectoryType);
}
/**
*
* Specifies the type of landing directory (folder) you mapped for your users to see when they log into the file
* transfer protocol-enabled server. If you set it to PATH
, the user will see the absolute Amazon S3
* bucket paths as is in their file transfer protocol clients. If you set it LOGICAL
, you will need to
* provide mappings in the HomeDirectoryMappings
for how you want to make Amazon S3 paths visible to
* your users.
*
*
* If the service returns an enum value that is not available in the current SDK version, {@link #homeDirectoryType}
* will return {@link HomeDirectoryType#UNKNOWN_TO_SDK_VERSION}. The raw value returned by the service is available
* from {@link #homeDirectoryTypeAsString}.
*
*
* @return Specifies the type of landing directory (folder) you mapped for your users to see when they log into the
* file transfer protocol-enabled server. If you set it to PATH
, the user will see the absolute
* Amazon S3 bucket paths as is in their file transfer protocol clients. If you set it LOGICAL
,
* you will need to provide mappings in the HomeDirectoryMappings
for how you want to make
* Amazon S3 paths visible to your users.
* @see HomeDirectoryType
*/
public String homeDirectoryTypeAsString() {
return homeDirectoryType;
}
/**
*
* Specifies the name of the policy in use for the described user.
*
*
* @return Specifies the name of the policy in use for the described user.
*/
public String policy() {
return policy;
}
/**
*
* Specifies the IAM role that controls your users' access to your Amazon S3 bucket. The policies attached to this
* role will determine the level of access you want to provide your users when transferring files into and out of
* your Amazon S3 bucket or buckets. The IAM role should also contain a trust relationship that allows a server to
* access your resources when servicing your users' transfer requests.
*
*
* @return Specifies the IAM role that controls your users' access to your Amazon S3 bucket. The policies attached
* to this role will determine the level of access you want to provide your users when transferring files
* into and out of your Amazon S3 bucket or buckets. The IAM role should also contain a trust relationship
* that allows a server to access your resources when servicing your users' transfer requests.
*/
public String role() {
return role;
}
/**
* Returns true if the SshPublicKeys 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 hasSshPublicKeys() {
return sshPublicKeys != null && !(sshPublicKeys instanceof SdkAutoConstructList);
}
/**
*
* Specifies the public key portion of the Secure Shell (SSH) keys stored for the described user.
*
*
* Attempts to modify the collection returned by this method will result in an UnsupportedOperationException.
*
*
* You can use {@link #hasSshPublicKeys()} to see if a value was sent in this field.
*
*
* @return Specifies the public key portion of the Secure Shell (SSH) keys stored for the described user.
*/
public List sshPublicKeys() {
return sshPublicKeys;
}
/**
* Returns true if the Tags 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 hasTags() {
return tags != null && !(tags instanceof SdkAutoConstructList);
}
/**
*
* Specifies the key-value pairs for the user requested. Tag can be used to search for and group users for a variety
* of purposes.
*
*
* Attempts to modify the collection returned by this method will result in an UnsupportedOperationException.
*
*
* You can use {@link #hasTags()} to see if a value was sent in this field.
*
*
* @return Specifies the key-value pairs for the user requested. Tag can be used to search for and group users for a
* variety of purposes.
*/
public List tags() {
return tags;
}
/**
*
* Specifies the name of the user that was requested to be described. User names are used for authentication
* purposes. This is the string that will be used by your user when they log in to your server.
*
*
* @return Specifies the name of the user that was requested to be described. User names are used for authentication
* purposes. This is the string that will be used by your user when they log in to your server.
*/
public String userName() {
return userName;
}
@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(homeDirectory());
hashCode = 31 * hashCode + Objects.hashCode(hasHomeDirectoryMappings() ? homeDirectoryMappings() : null);
hashCode = 31 * hashCode + Objects.hashCode(homeDirectoryTypeAsString());
hashCode = 31 * hashCode + Objects.hashCode(policy());
hashCode = 31 * hashCode + Objects.hashCode(role());
hashCode = 31 * hashCode + Objects.hashCode(hasSshPublicKeys() ? sshPublicKeys() : null);
hashCode = 31 * hashCode + Objects.hashCode(hasTags() ? tags() : null);
hashCode = 31 * hashCode + Objects.hashCode(userName());
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 DescribedUser)) {
return false;
}
DescribedUser other = (DescribedUser) obj;
return Objects.equals(arn(), other.arn()) && Objects.equals(homeDirectory(), other.homeDirectory())
&& hasHomeDirectoryMappings() == other.hasHomeDirectoryMappings()
&& Objects.equals(homeDirectoryMappings(), other.homeDirectoryMappings())
&& Objects.equals(homeDirectoryTypeAsString(), other.homeDirectoryTypeAsString())
&& Objects.equals(policy(), other.policy()) && Objects.equals(role(), other.role())
&& hasSshPublicKeys() == other.hasSshPublicKeys() && Objects.equals(sshPublicKeys(), other.sshPublicKeys())
&& hasTags() == other.hasTags() && Objects.equals(tags(), other.tags())
&& Objects.equals(userName(), other.userName());
}
/**
* 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("DescribedUser").add("Arn", arn()).add("HomeDirectory", homeDirectory())
.add("HomeDirectoryMappings", hasHomeDirectoryMappings() ? homeDirectoryMappings() : null)
.add("HomeDirectoryType", homeDirectoryTypeAsString()).add("Policy", policy()).add("Role", role())
.add("SshPublicKeys", hasSshPublicKeys() ? sshPublicKeys() : null).add("Tags", hasTags() ? tags() : null)
.add("UserName", userName()).build();
}
public Optional getValueForField(String fieldName, Class clazz) {
switch (fieldName) {
case "Arn":
return Optional.ofNullable(clazz.cast(arn()));
case "HomeDirectory":
return Optional.ofNullable(clazz.cast(homeDirectory()));
case "HomeDirectoryMappings":
return Optional.ofNullable(clazz.cast(homeDirectoryMappings()));
case "HomeDirectoryType":
return Optional.ofNullable(clazz.cast(homeDirectoryTypeAsString()));
case "Policy":
return Optional.ofNullable(clazz.cast(policy()));
case "Role":
return Optional.ofNullable(clazz.cast(role()));
case "SshPublicKeys":
return Optional.ofNullable(clazz.cast(sshPublicKeys()));
case "Tags":
return Optional.ofNullable(clazz.cast(tags()));
case "UserName":
return Optional.ofNullable(clazz.cast(userName()));
default:
return Optional.empty();
}
}
@Override
public List> sdkFields() {
return SDK_FIELDS;
}
private static Function
*
* In most cases, you can use this value instead of the scope-down policy to lock your user down to the
* designated home directory ("chroot"). To do this, you can set Entry
to '/' and set
* Target
to the HomeDirectory parameter value.
* @return Returns a reference to this object so that method calls can be chained together.
*/
Builder homeDirectoryMappings(Collection homeDirectoryMappings);
/**
*
* Specifies the logical directory mappings that specify what Amazon S3 paths and keys should be visible to your
* user and how you want to make them visible. You will need to specify the "Entry
" and "
* Target
" pair, where Entry
shows how the path is made visible and
* Target
is the actual Amazon S3 path. If you only specify a target, it will be displayed as is.
* You will need to also make sure that your AWS Identity and Access Management (IAM) role provides access to
* paths in Target
.
*
*
* In most cases, you can use this value instead of the scope-down policy to lock your user down to the
* designated home directory ("chroot"). To do this, you can set Entry
to '/' and set
* Target
to the HomeDirectory parameter value.
*
*
* @param homeDirectoryMappings
* Specifies the logical directory mappings that specify what Amazon S3 paths and keys should be visible
* to your user and how you want to make them visible. You will need to specify the "Entry
* " and "Target
" pair, where Entry
shows how the path is made visible and
* Target
is the actual Amazon S3 path. If you only specify a target, it will be displayed
* as is. You will need to also make sure that your AWS Identity and Access Management (IAM) role
* provides access to paths in Target
.
*
* In most cases, you can use this value instead of the scope-down policy to lock your user down to the
* designated home directory ("chroot"). To do this, you can set Entry
to '/' and set
* Target
to the HomeDirectory parameter value.
* @return Returns a reference to this object so that method calls can be chained together.
*/
Builder homeDirectoryMappings(HomeDirectoryMapEntry... homeDirectoryMappings);
/**
*
* Specifies the logical directory mappings that specify what Amazon S3 paths and keys should be visible to your
* user and how you want to make them visible. You will need to specify the "Entry
" and "
* Target
" pair, where Entry
shows how the path is made visible and
* Target
is the actual Amazon S3 path. If you only specify a target, it will be displayed as is.
* You will need to also make sure that your AWS Identity and Access Management (IAM) role provides access to
* paths in Target
.
*
*
* In most cases, you can use this value instead of the scope-down policy to lock your user down to the
* designated home directory ("chroot"). To do this, you can set Entry
to '/' and set
* Target
to the HomeDirectory parameter value.
*
* This is a convenience that creates an instance of the {@link List.Builder} avoiding
* the need to create one manually via {@link List#builder()}.
*
* When the {@link Consumer} completes, {@link List.Builder#build()} is called
* immediately and its result is passed to {@link #homeDirectoryMappings(List)}.
*
* @param homeDirectoryMappings
* a consumer that will call methods on {@link List.Builder}
* @return Returns a reference to this object so that method calls can be chained together.
* @see #homeDirectoryMappings(List)
*/
Builder homeDirectoryMappings(Consumer... homeDirectoryMappings);
/**
*
* Specifies the type of landing directory (folder) you mapped for your users to see when they log into the file
* transfer protocol-enabled server. If you set it to PATH
, the user will see the absolute Amazon
* S3 bucket paths as is in their file transfer protocol clients. If you set it LOGICAL
, you will
* need to provide mappings in the HomeDirectoryMappings
for how you want to make Amazon S3 paths
* visible to your users.
*
*
* @param homeDirectoryType
* Specifies the type of landing directory (folder) you mapped for your users to see when they log into
* the file transfer protocol-enabled server. If you set it to PATH
, the user will see the
* absolute Amazon S3 bucket paths as is in their file transfer protocol clients. If you set it
* LOGICAL
, you will need to provide mappings in the HomeDirectoryMappings
for
* how you want to make Amazon S3 paths visible to your users.
* @see HomeDirectoryType
* @return Returns a reference to this object so that method calls can be chained together.
* @see HomeDirectoryType
*/
Builder homeDirectoryType(String homeDirectoryType);
/**
*
* Specifies the type of landing directory (folder) you mapped for your users to see when they log into the file
* transfer protocol-enabled server. If you set it to PATH
, the user will see the absolute Amazon
* S3 bucket paths as is in their file transfer protocol clients. If you set it LOGICAL
, you will
* need to provide mappings in the HomeDirectoryMappings
for how you want to make Amazon S3 paths
* visible to your users.
*
*
* @param homeDirectoryType
* Specifies the type of landing directory (folder) you mapped for your users to see when they log into
* the file transfer protocol-enabled server. If you set it to PATH
, the user will see the
* absolute Amazon S3 bucket paths as is in their file transfer protocol clients. If you set it
* LOGICAL
, you will need to provide mappings in the HomeDirectoryMappings
for
* how you want to make Amazon S3 paths visible to your users.
* @see HomeDirectoryType
* @return Returns a reference to this object so that method calls can be chained together.
* @see HomeDirectoryType
*/
Builder homeDirectoryType(HomeDirectoryType homeDirectoryType);
/**
*
* Specifies the name of the policy in use for the described user.
*
*
* @param policy
* Specifies the name of the policy in use for the described user.
* @return Returns a reference to this object so that method calls can be chained together.
*/
Builder policy(String policy);
/**
*
* Specifies the IAM role that controls your users' access to your Amazon S3 bucket. The policies attached to
* this role will determine the level of access you want to provide your users when transferring files into and
* out of your Amazon S3 bucket or buckets. The IAM role should also contain a trust relationship that allows a
* server to access your resources when servicing your users' transfer requests.
*
*
* @param role
* Specifies the IAM role that controls your users' access to your Amazon S3 bucket. The policies
* attached to this role will determine the level of access you want to provide your users when
* transferring files into and out of your Amazon S3 bucket or buckets. The IAM role should also contain
* a trust relationship that allows a server to access your resources when servicing your users' transfer
* requests.
* @return Returns a reference to this object so that method calls can be chained together.
*/
Builder role(String role);
/**
*
* Specifies the public key portion of the Secure Shell (SSH) keys stored for the described user.
*
*
* @param sshPublicKeys
* Specifies the public key portion of the Secure Shell (SSH) keys stored for the described user.
* @return Returns a reference to this object so that method calls can be chained together.
*/
Builder sshPublicKeys(Collection sshPublicKeys);
/**
*
* Specifies the public key portion of the Secure Shell (SSH) keys stored for the described user.
*
*
* @param sshPublicKeys
* Specifies the public key portion of the Secure Shell (SSH) keys stored for the described user.
* @return Returns a reference to this object so that method calls can be chained together.
*/
Builder sshPublicKeys(SshPublicKey... sshPublicKeys);
/**
*
* Specifies the public key portion of the Secure Shell (SSH) keys stored for the described user.
*
* This is a convenience that creates an instance of the {@link List.Builder} avoiding the need to
* create one manually via {@link List#builder()}.
*
* When the {@link Consumer} completes, {@link List.Builder#build()} is called immediately and its
* result is passed to {@link #sshPublicKeys(List)}.
*
* @param sshPublicKeys
* a consumer that will call methods on {@link List.Builder}
* @return Returns a reference to this object so that method calls can be chained together.
* @see #sshPublicKeys(List)
*/
Builder sshPublicKeys(Consumer... sshPublicKeys);
/**
*
* Specifies the key-value pairs for the user requested. Tag can be used to search for and group users for a
* variety of purposes.
*
*
* @param tags
* Specifies the key-value pairs for the user requested. Tag can be used to search for and group users
* for a variety of purposes.
* @return Returns a reference to this object so that method calls can be chained together.
*/
Builder tags(Collection tags);
/**
*
* Specifies the key-value pairs for the user requested. Tag can be used to search for and group users for a
* variety of purposes.
*
*
* @param tags
* Specifies the key-value pairs for the user requested. Tag can be used to search for and group users
* for a variety of purposes.
* @return Returns a reference to this object so that method calls can be chained together.
*/
Builder tags(Tag... tags);
/**
*
* Specifies the key-value pairs for the user requested. Tag can be used to search for and group users for a
* variety of purposes.
*
* This is a convenience that creates an instance of the {@link List.Builder} avoiding the need to create
* one manually via {@link List#builder()}.
*
* When the {@link Consumer} completes, {@link List.Builder#build()} is called immediately and its result
* is passed to {@link #tags(List)}.
*
* @param tags
* a consumer that will call methods on {@link List.Builder}
* @return Returns a reference to this object so that method calls can be chained together.
* @see #tags(List)
*/
Builder tags(Consumer... tags);
/**
*
* Specifies the name of the user that was requested to be described. User names are used for authentication
* purposes. This is the string that will be used by your user when they log in to your server.
*
*
* @param userName
* Specifies the name of the user that was requested to be described. User names are used for
* authentication purposes. This is the string that will be used by your user when they log in to your
* server.
* @return Returns a reference to this object so that method calls can be chained together.
*/
Builder userName(String userName);
}
static final class BuilderImpl implements Builder {
private String arn;
private String homeDirectory;
private List homeDirectoryMappings = DefaultSdkAutoConstructList.getInstance();
private String homeDirectoryType;
private String policy;
private String role;
private List sshPublicKeys = DefaultSdkAutoConstructList.getInstance();
private List tags = DefaultSdkAutoConstructList.getInstance();
private String userName;
private BuilderImpl() {
}
private BuilderImpl(DescribedUser model) {
arn(model.arn);
homeDirectory(model.homeDirectory);
homeDirectoryMappings(model.homeDirectoryMappings);
homeDirectoryType(model.homeDirectoryType);
policy(model.policy);
role(model.role);
sshPublicKeys(model.sshPublicKeys);
tags(model.tags);
userName(model.userName);
}
public final String getArn() {
return arn;
}
@Override
public final Builder arn(String arn) {
this.arn = arn;
return this;
}
public final void setArn(String arn) {
this.arn = arn;
}
public final String getHomeDirectory() {
return homeDirectory;
}
@Override
public final Builder homeDirectory(String homeDirectory) {
this.homeDirectory = homeDirectory;
return this;
}
public final void setHomeDirectory(String homeDirectory) {
this.homeDirectory = homeDirectory;
}
public final Collection getHomeDirectoryMappings() {
if (homeDirectoryMappings instanceof SdkAutoConstructList) {
return null;
}
return homeDirectoryMappings != null ? homeDirectoryMappings.stream().map(HomeDirectoryMapEntry::toBuilder)
.collect(Collectors.toList()) : null;
}
@Override
public final Builder homeDirectoryMappings(Collection homeDirectoryMappings) {
this.homeDirectoryMappings = HomeDirectoryMappingsCopier.copy(homeDirectoryMappings);
return this;
}
@Override
@SafeVarargs
public final Builder homeDirectoryMappings(HomeDirectoryMapEntry... homeDirectoryMappings) {
homeDirectoryMappings(Arrays.asList(homeDirectoryMappings));
return this;
}
@Override
@SafeVarargs
public final Builder homeDirectoryMappings(Consumer... homeDirectoryMappings) {
homeDirectoryMappings(Stream.of(homeDirectoryMappings)
.map(c -> HomeDirectoryMapEntry.builder().applyMutation(c).build()).collect(Collectors.toList()));
return this;
}
public final void setHomeDirectoryMappings(Collection homeDirectoryMappings) {
this.homeDirectoryMappings = HomeDirectoryMappingsCopier.copyFromBuilder(homeDirectoryMappings);
}
public final String getHomeDirectoryType() {
return homeDirectoryType;
}
@Override
public final Builder homeDirectoryType(String homeDirectoryType) {
this.homeDirectoryType = homeDirectoryType;
return this;
}
@Override
public final Builder homeDirectoryType(HomeDirectoryType homeDirectoryType) {
this.homeDirectoryType(homeDirectoryType == null ? null : homeDirectoryType.toString());
return this;
}
public final void setHomeDirectoryType(String homeDirectoryType) {
this.homeDirectoryType = homeDirectoryType;
}
public final String getPolicy() {
return policy;
}
@Override
public final Builder policy(String policy) {
this.policy = policy;
return this;
}
public final void setPolicy(String policy) {
this.policy = policy;
}
public final String getRole() {
return role;
}
@Override
public final Builder role(String role) {
this.role = role;
return this;
}
public final void setRole(String role) {
this.role = role;
}
public final Collection getSshPublicKeys() {
if (sshPublicKeys instanceof SdkAutoConstructList) {
return null;
}
return sshPublicKeys != null ? sshPublicKeys.stream().map(SshPublicKey::toBuilder).collect(Collectors.toList())
: null;
}
@Override
public final Builder sshPublicKeys(Collection sshPublicKeys) {
this.sshPublicKeys = SshPublicKeysCopier.copy(sshPublicKeys);
return this;
}
@Override
@SafeVarargs
public final Builder sshPublicKeys(SshPublicKey... sshPublicKeys) {
sshPublicKeys(Arrays.asList(sshPublicKeys));
return this;
}
@Override
@SafeVarargs
public final Builder sshPublicKeys(Consumer... sshPublicKeys) {
sshPublicKeys(Stream.of(sshPublicKeys).map(c -> SshPublicKey.builder().applyMutation(c).build())
.collect(Collectors.toList()));
return this;
}
public final void setSshPublicKeys(Collection sshPublicKeys) {
this.sshPublicKeys = SshPublicKeysCopier.copyFromBuilder(sshPublicKeys);
}
public final Collection getTags() {
if (tags instanceof SdkAutoConstructList) {
return null;
}
return tags != null ? tags.stream().map(Tag::toBuilder).collect(Collectors.toList()) : null;
}
@Override
public final Builder tags(Collection tags) {
this.tags = TagsCopier.copy(tags);
return this;
}
@Override
@SafeVarargs
public final Builder tags(Tag... tags) {
tags(Arrays.asList(tags));
return this;
}
@Override
@SafeVarargs
public final Builder tags(Consumer... tags) {
tags(Stream.of(tags).map(c -> Tag.builder().applyMutation(c).build()).collect(Collectors.toList()));
return this;
}
public final void setTags(Collection tags) {
this.tags = TagsCopier.copyFromBuilder(tags);
}
public final String getUserName() {
return userName;
}
@Override
public final Builder userName(String userName) {
this.userName = userName;
return this;
}
public final void setUserName(String userName) {
this.userName = userName;
}
@Override
public DescribedUser build() {
return new DescribedUser(this);
}
@Override
public List> sdkFields() {
return SDK_FIELDS;
}
}
}