All Downloads are FREE. Search and download functionalities are using the official Maven repository.

software.amazon.awssdk.services.connect.model.CreateUserRequest Maven / Gradle / Ivy

Go to download

The AWS Java SDK for Connect module holds the client classes that are used for communicating with Connect.

There is a newer version: 2.29.39
Show newest version
/*
 * 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.connect.model;

import java.util.Arrays;
import java.util.Collection;
import java.util.Collections;
import java.util.List;
import java.util.Map;
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.awscore.AwsRequestOverrideConfiguration;
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.traits.MapTrait;
import software.amazon.awssdk.core.util.DefaultSdkAutoConstructList;
import software.amazon.awssdk.core.util.DefaultSdkAutoConstructMap;
import software.amazon.awssdk.core.util.SdkAutoConstructList;
import software.amazon.awssdk.core.util.SdkAutoConstructMap;
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 CreateUserRequest extends ConnectRequest implements
        ToCopyableBuilder {
    private static final SdkField USERNAME_FIELD = SdkField. builder(MarshallingType.STRING)
            .getter(getter(CreateUserRequest::username)).setter(setter(Builder::username))
            .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("Username").build()).build();

    private static final SdkField PASSWORD_FIELD = SdkField. builder(MarshallingType.STRING)
            .getter(getter(CreateUserRequest::password)).setter(setter(Builder::password))
            .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("Password").build()).build();

    private static final SdkField IDENTITY_INFO_FIELD = SdkField
            . builder(MarshallingType.SDK_POJO).getter(getter(CreateUserRequest::identityInfo))
            .setter(setter(Builder::identityInfo)).constructor(UserIdentityInfo::builder)
            .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("IdentityInfo").build()).build();

    private static final SdkField PHONE_CONFIG_FIELD = SdkField
            . builder(MarshallingType.SDK_POJO).getter(getter(CreateUserRequest::phoneConfig))
            .setter(setter(Builder::phoneConfig)).constructor(UserPhoneConfig::builder)
            .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("PhoneConfig").build()).build();

    private static final SdkField DIRECTORY_USER_ID_FIELD = SdkField. builder(MarshallingType.STRING)
            .getter(getter(CreateUserRequest::directoryUserId)).setter(setter(Builder::directoryUserId))
            .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("DirectoryUserId").build()).build();

    private static final SdkField> SECURITY_PROFILE_IDS_FIELD = SdkField
            .> builder(MarshallingType.LIST)
            .getter(getter(CreateUserRequest::securityProfileIds))
            .setter(setter(Builder::securityProfileIds))
            .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("SecurityProfileIds").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 ROUTING_PROFILE_ID_FIELD = SdkField. builder(MarshallingType.STRING)
            .getter(getter(CreateUserRequest::routingProfileId)).setter(setter(Builder::routingProfileId))
            .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("RoutingProfileId").build()).build();

    private static final SdkField HIERARCHY_GROUP_ID_FIELD = SdkField. builder(MarshallingType.STRING)
            .getter(getter(CreateUserRequest::hierarchyGroupId)).setter(setter(Builder::hierarchyGroupId))
            .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("HierarchyGroupId").build()).build();

    private static final SdkField INSTANCE_ID_FIELD = SdkField. builder(MarshallingType.STRING)
            .getter(getter(CreateUserRequest::instanceId)).setter(setter(Builder::instanceId))
            .traits(LocationTrait.builder().location(MarshallLocation.PATH).locationName("InstanceId").build()).build();

    private static final SdkField> TAGS_FIELD = SdkField
            .> builder(MarshallingType.MAP)
            .getter(getter(CreateUserRequest::tags))
            .setter(setter(Builder::tags))
            .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("Tags").build(),
                    MapTrait.builder()
                            .keyLocationName("key")
                            .valueLocationName("value")
                            .valueFieldInfo(
                                    SdkField. builder(MarshallingType.STRING)
                                            .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD)
                                                    .locationName("value").build()).build()).build()).build();

    private static final List> SDK_FIELDS = Collections.unmodifiableList(Arrays.asList(USERNAME_FIELD,
            PASSWORD_FIELD, IDENTITY_INFO_FIELD, PHONE_CONFIG_FIELD, DIRECTORY_USER_ID_FIELD, SECURITY_PROFILE_IDS_FIELD,
            ROUTING_PROFILE_ID_FIELD, HIERARCHY_GROUP_ID_FIELD, INSTANCE_ID_FIELD, TAGS_FIELD));

    private final String username;

    private final String password;

    private final UserIdentityInfo identityInfo;

    private final UserPhoneConfig phoneConfig;

    private final String directoryUserId;

    private final List securityProfileIds;

    private final String routingProfileId;

    private final String hierarchyGroupId;

    private final String instanceId;

    private final Map tags;

    private CreateUserRequest(BuilderImpl builder) {
        super(builder);
        this.username = builder.username;
        this.password = builder.password;
        this.identityInfo = builder.identityInfo;
        this.phoneConfig = builder.phoneConfig;
        this.directoryUserId = builder.directoryUserId;
        this.securityProfileIds = builder.securityProfileIds;
        this.routingProfileId = builder.routingProfileId;
        this.hierarchyGroupId = builder.hierarchyGroupId;
        this.instanceId = builder.instanceId;
        this.tags = builder.tags;
    }

    /**
     * 

* The user name for the account. For instances not using SAML for identity management, the user name can include up * to 20 characters. If you are using SAML for identity management, the user name can include up to 64 characters * from [a-zA-Z0-9_-.\@]+. *

* * @return The user name for the account. For instances not using SAML for identity management, the user name can * include up to 20 characters. If you are using SAML for identity management, the user name can include up * to 64 characters from [a-zA-Z0-9_-.\@]+. */ public String username() { return username; } /** *

* The password for the user account. A password is required if you are using Amazon Connect for identity * management. Otherwise, it is an error to include a password. *

* * @return The password for the user account. A password is required if you are using Amazon Connect for identity * management. Otherwise, it is an error to include a password. */ public String password() { return password; } /** *

* The information about the identity of the user. *

* * @return The information about the identity of the user. */ public UserIdentityInfo identityInfo() { return identityInfo; } /** *

* The phone settings for the user. *

* * @return The phone settings for the user. */ public UserPhoneConfig phoneConfig() { return phoneConfig; } /** *

* The identifier of the user account in the directory used for identity management. If Amazon Connect cannot access * the directory, you can specify this identifier to authenticate users. If you include the identifier, we assume * that Amazon Connect cannot access the directory. Otherwise, the identity information is used to authenticate * users from your directory. *

*

* This parameter is required if you are using an existing directory for identity management in Amazon Connect when * Amazon Connect cannot access your directory to authenticate users. If you are using SAML for identity management * and include this parameter, an error is returned. *

* * @return The identifier of the user account in the directory used for identity management. If Amazon Connect * cannot access the directory, you can specify this identifier to authenticate users. If you include the * identifier, we assume that Amazon Connect cannot access the directory. Otherwise, the identity * information is used to authenticate users from your directory.

*

* This parameter is required if you are using an existing directory for identity management in Amazon * Connect when Amazon Connect cannot access your directory to authenticate users. If you are using SAML for * identity management and include this parameter, an error is returned. */ public String directoryUserId() { return directoryUserId; } /** * Returns true if the SecurityProfileIds 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 hasSecurityProfileIds() { return securityProfileIds != null && !(securityProfileIds instanceof SdkAutoConstructList); } /** *

* The identifier of the security profile for the user. *

*

* Attempts to modify the collection returned by this method will result in an UnsupportedOperationException. *

*

* You can use {@link #hasSecurityProfileIds()} to see if a value was sent in this field. *

* * @return The identifier of the security profile for the user. */ public List securityProfileIds() { return securityProfileIds; } /** *

* The identifier of the routing profile for the user. *

* * @return The identifier of the routing profile for the user. */ public String routingProfileId() { return routingProfileId; } /** *

* The identifier of the hierarchy group for the user. *

* * @return The identifier of the hierarchy group for the user. */ public String hierarchyGroupId() { return hierarchyGroupId; } /** *

* The identifier of the Amazon Connect instance. *

* * @return The identifier of the Amazon Connect instance. */ public String instanceId() { return instanceId; } /** * 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 SdkAutoConstructMap); } /** *

* One or more tags. *

*

* 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 One or more tags. */ public Map tags() { return tags; } @Override public Builder toBuilder() { return new BuilderImpl(this); } public static Builder builder() { return new BuilderImpl(); } public static Class serializableBuilderClass() { return BuilderImpl.class; } @Override public int hashCode() { int hashCode = 1; hashCode = 31 * hashCode + super.hashCode(); hashCode = 31 * hashCode + Objects.hashCode(username()); hashCode = 31 * hashCode + Objects.hashCode(password()); hashCode = 31 * hashCode + Objects.hashCode(identityInfo()); hashCode = 31 * hashCode + Objects.hashCode(phoneConfig()); hashCode = 31 * hashCode + Objects.hashCode(directoryUserId()); hashCode = 31 * hashCode + Objects.hashCode(securityProfileIds()); hashCode = 31 * hashCode + Objects.hashCode(routingProfileId()); hashCode = 31 * hashCode + Objects.hashCode(hierarchyGroupId()); hashCode = 31 * hashCode + Objects.hashCode(instanceId()); hashCode = 31 * hashCode + Objects.hashCode(tags()); 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 CreateUserRequest)) { return false; } CreateUserRequest other = (CreateUserRequest) obj; return Objects.equals(username(), other.username()) && Objects.equals(password(), other.password()) && Objects.equals(identityInfo(), other.identityInfo()) && Objects.equals(phoneConfig(), other.phoneConfig()) && Objects.equals(directoryUserId(), other.directoryUserId()) && Objects.equals(securityProfileIds(), other.securityProfileIds()) && Objects.equals(routingProfileId(), other.routingProfileId()) && Objects.equals(hierarchyGroupId(), other.hierarchyGroupId()) && Objects.equals(instanceId(), other.instanceId()) && Objects.equals(tags(), other.tags()); } /** * 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("CreateUserRequest").add("Username", username()).add("Password", password()) .add("IdentityInfo", identityInfo()).add("PhoneConfig", phoneConfig()).add("DirectoryUserId", directoryUserId()) .add("SecurityProfileIds", securityProfileIds()).add("RoutingProfileId", routingProfileId()) .add("HierarchyGroupId", hierarchyGroupId()).add("InstanceId", instanceId()).add("Tags", tags()).build(); } public Optional getValueForField(String fieldName, Class clazz) { switch (fieldName) { case "Username": return Optional.ofNullable(clazz.cast(username())); case "Password": return Optional.ofNullable(clazz.cast(password())); case "IdentityInfo": return Optional.ofNullable(clazz.cast(identityInfo())); case "PhoneConfig": return Optional.ofNullable(clazz.cast(phoneConfig())); case "DirectoryUserId": return Optional.ofNullable(clazz.cast(directoryUserId())); case "SecurityProfileIds": return Optional.ofNullable(clazz.cast(securityProfileIds())); case "RoutingProfileId": return Optional.ofNullable(clazz.cast(routingProfileId())); case "HierarchyGroupId": return Optional.ofNullable(clazz.cast(hierarchyGroupId())); case "InstanceId": return Optional.ofNullable(clazz.cast(instanceId())); case "Tags": return Optional.ofNullable(clazz.cast(tags())); default: return Optional.empty(); } } @Override public List> sdkFields() { return SDK_FIELDS; } private static Function getter(Function g) { return obj -> g.apply((CreateUserRequest) obj); } private static BiConsumer setter(BiConsumer s) { return (obj, val) -> s.accept((Builder) obj, val); } public interface Builder extends ConnectRequest.Builder, SdkPojo, CopyableBuilder { /** *

* The user name for the account. For instances not using SAML for identity management, the user name can * include up to 20 characters. If you are using SAML for identity management, the user name can include up to * 64 characters from [a-zA-Z0-9_-.\@]+. *

* * @param username * The user name for the account. For instances not using SAML for identity management, the user name can * include up to 20 characters. If you are using SAML for identity management, the user name can include * up to 64 characters from [a-zA-Z0-9_-.\@]+. * @return Returns a reference to this object so that method calls can be chained together. */ Builder username(String username); /** *

* The password for the user account. A password is required if you are using Amazon Connect for identity * management. Otherwise, it is an error to include a password. *

* * @param password * The password for the user account. A password is required if you are using Amazon Connect for identity * management. Otherwise, it is an error to include a password. * @return Returns a reference to this object so that method calls can be chained together. */ Builder password(String password); /** *

* The information about the identity of the user. *

* * @param identityInfo * The information about the identity of the user. * @return Returns a reference to this object so that method calls can be chained together. */ Builder identityInfo(UserIdentityInfo identityInfo); /** *

* The information about the identity of the user. *

* This is a convenience that creates an instance of the {@link UserIdentityInfo.Builder} avoiding the need to * create one manually via {@link UserIdentityInfo#builder()}. * * When the {@link Consumer} completes, {@link UserIdentityInfo.Builder#build()} is called immediately and its * result is passed to {@link #identityInfo(UserIdentityInfo)}. * * @param identityInfo * a consumer that will call methods on {@link UserIdentityInfo.Builder} * @return Returns a reference to this object so that method calls can be chained together. * @see #identityInfo(UserIdentityInfo) */ default Builder identityInfo(Consumer identityInfo) { return identityInfo(UserIdentityInfo.builder().applyMutation(identityInfo).build()); } /** *

* The phone settings for the user. *

* * @param phoneConfig * The phone settings for the user. * @return Returns a reference to this object so that method calls can be chained together. */ Builder phoneConfig(UserPhoneConfig phoneConfig); /** *

* The phone settings for the user. *

* This is a convenience that creates an instance of the {@link UserPhoneConfig.Builder} avoiding the need to * create one manually via {@link UserPhoneConfig#builder()}. * * When the {@link Consumer} completes, {@link UserPhoneConfig.Builder#build()} is called immediately and its * result is passed to {@link #phoneConfig(UserPhoneConfig)}. * * @param phoneConfig * a consumer that will call methods on {@link UserPhoneConfig.Builder} * @return Returns a reference to this object so that method calls can be chained together. * @see #phoneConfig(UserPhoneConfig) */ default Builder phoneConfig(Consumer phoneConfig) { return phoneConfig(UserPhoneConfig.builder().applyMutation(phoneConfig).build()); } /** *

* The identifier of the user account in the directory used for identity management. If Amazon Connect cannot * access the directory, you can specify this identifier to authenticate users. If you include the identifier, * we assume that Amazon Connect cannot access the directory. Otherwise, the identity information is used to * authenticate users from your directory. *

*

* This parameter is required if you are using an existing directory for identity management in Amazon Connect * when Amazon Connect cannot access your directory to authenticate users. If you are using SAML for identity * management and include this parameter, an error is returned. *

* * @param directoryUserId * The identifier of the user account in the directory used for identity management. If Amazon Connect * cannot access the directory, you can specify this identifier to authenticate users. If you include the * identifier, we assume that Amazon Connect cannot access the directory. Otherwise, the identity * information is used to authenticate users from your directory.

*

* This parameter is required if you are using an existing directory for identity management in Amazon * Connect when Amazon Connect cannot access your directory to authenticate users. If you are using SAML * for identity management and include this parameter, an error is returned. * @return Returns a reference to this object so that method calls can be chained together. */ Builder directoryUserId(String directoryUserId); /** *

* The identifier of the security profile for the user. *

* * @param securityProfileIds * The identifier of the security profile for the user. * @return Returns a reference to this object so that method calls can be chained together. */ Builder securityProfileIds(Collection securityProfileIds); /** *

* The identifier of the security profile for the user. *

* * @param securityProfileIds * The identifier of the security profile for the user. * @return Returns a reference to this object so that method calls can be chained together. */ Builder securityProfileIds(String... securityProfileIds); /** *

* The identifier of the routing profile for the user. *

* * @param routingProfileId * The identifier of the routing profile for the user. * @return Returns a reference to this object so that method calls can be chained together. */ Builder routingProfileId(String routingProfileId); /** *

* The identifier of the hierarchy group for the user. *

* * @param hierarchyGroupId * The identifier of the hierarchy group for the user. * @return Returns a reference to this object so that method calls can be chained together. */ Builder hierarchyGroupId(String hierarchyGroupId); /** *

* The identifier of the Amazon Connect instance. *

* * @param instanceId * The identifier of the Amazon Connect instance. * @return Returns a reference to this object so that method calls can be chained together. */ Builder instanceId(String instanceId); /** *

* One or more tags. *

* * @param tags * One or more tags. * @return Returns a reference to this object so that method calls can be chained together. */ Builder tags(Map tags); @Override Builder overrideConfiguration(AwsRequestOverrideConfiguration overrideConfiguration); @Override Builder overrideConfiguration(Consumer builderConsumer); } static final class BuilderImpl extends ConnectRequest.BuilderImpl implements Builder { private String username; private String password; private UserIdentityInfo identityInfo; private UserPhoneConfig phoneConfig; private String directoryUserId; private List securityProfileIds = DefaultSdkAutoConstructList.getInstance(); private String routingProfileId; private String hierarchyGroupId; private String instanceId; private Map tags = DefaultSdkAutoConstructMap.getInstance(); private BuilderImpl() { } private BuilderImpl(CreateUserRequest model) { super(model); username(model.username); password(model.password); identityInfo(model.identityInfo); phoneConfig(model.phoneConfig); directoryUserId(model.directoryUserId); securityProfileIds(model.securityProfileIds); routingProfileId(model.routingProfileId); hierarchyGroupId(model.hierarchyGroupId); instanceId(model.instanceId); tags(model.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; } public final String getPassword() { return password; } @Override public final Builder password(String password) { this.password = password; return this; } public final void setPassword(String password) { this.password = password; } public final UserIdentityInfo.Builder getIdentityInfo() { return identityInfo != null ? identityInfo.toBuilder() : null; } @Override public final Builder identityInfo(UserIdentityInfo identityInfo) { this.identityInfo = identityInfo; return this; } public final void setIdentityInfo(UserIdentityInfo.BuilderImpl identityInfo) { this.identityInfo = identityInfo != null ? identityInfo.build() : null; } public final UserPhoneConfig.Builder getPhoneConfig() { return phoneConfig != null ? phoneConfig.toBuilder() : null; } @Override public final Builder phoneConfig(UserPhoneConfig phoneConfig) { this.phoneConfig = phoneConfig; return this; } public final void setPhoneConfig(UserPhoneConfig.BuilderImpl phoneConfig) { this.phoneConfig = phoneConfig != null ? phoneConfig.build() : null; } public final String getDirectoryUserId() { return directoryUserId; } @Override public final Builder directoryUserId(String directoryUserId) { this.directoryUserId = directoryUserId; return this; } public final void setDirectoryUserId(String directoryUserId) { this.directoryUserId = directoryUserId; } public final Collection getSecurityProfileIds() { return securityProfileIds; } @Override public final Builder securityProfileIds(Collection securityProfileIds) { this.securityProfileIds = SecurityProfileIdsCopier.copy(securityProfileIds); return this; } @Override @SafeVarargs public final Builder securityProfileIds(String... securityProfileIds) { securityProfileIds(Arrays.asList(securityProfileIds)); return this; } public final void setSecurityProfileIds(Collection securityProfileIds) { this.securityProfileIds = SecurityProfileIdsCopier.copy(securityProfileIds); } public final String getRoutingProfileId() { return routingProfileId; } @Override public final Builder routingProfileId(String routingProfileId) { this.routingProfileId = routingProfileId; return this; } public final void setRoutingProfileId(String routingProfileId) { this.routingProfileId = routingProfileId; } public final String getHierarchyGroupId() { return hierarchyGroupId; } @Override public final Builder hierarchyGroupId(String hierarchyGroupId) { this.hierarchyGroupId = hierarchyGroupId; return this; } public final void setHierarchyGroupId(String hierarchyGroupId) { this.hierarchyGroupId = hierarchyGroupId; } public final String getInstanceId() { return instanceId; } @Override public final Builder instanceId(String instanceId) { this.instanceId = instanceId; return this; } public final void setInstanceId(String instanceId) { this.instanceId = instanceId; } public final Map getTags() { return tags; } @Override public final Builder tags(Map tags) { this.tags = TagMapCopier.copy(tags); return this; } public final void setTags(Map tags) { this.tags = TagMapCopier.copy(tags); } @Override public Builder overrideConfiguration(AwsRequestOverrideConfiguration overrideConfiguration) { super.overrideConfiguration(overrideConfiguration); return this; } @Override public Builder overrideConfiguration(Consumer builderConsumer) { super.overrideConfiguration(builderConsumer); return this; } @Override public CreateUserRequest build() { return new CreateUserRequest(this); } @Override public List> sdkFields() { return SDK_FIELDS; } } }




© 2015 - 2025 Weber Informatics LLC | Privacy Policy