/* * Copyright 2010-2023 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 com.amazonaws.services.connect.model; import java.io.Serializable; import com.amazonaws.AmazonWebServiceRequest; /** *

* Creates a user account for the specified Amazon Connect instance. *

*

* For information about how to create user accounts using the Amazon Connect * console, see Add Users in the Amazon Connect Administrator Guide. *

*/ public class CreateUserRequest extends AmazonWebServiceRequest implements Serializable { /** *

* 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_-.\@]+. *

*

* Constraints:
* Length: 1 - 100
*/ private 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. *

*

* Constraints:
* Pattern: /^(?=.*[a-z])(?=.*[A-Z])(?=.*\d)[a-zA-Z\d\S]{8,64}$/
*/ private String password; /** *

* The information about the identity of the user. *

*/ private UserIdentityInfo identityInfo; /** *

* The phone settings for the user. *

*/ private UserPhoneConfig 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. *

*/ private String directoryUserId; /** *

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

*/ private java.util.List securityProfileIds; /** *

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

*/ private String routingProfileId; /** *

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

*/ private String hierarchyGroupId; /** *

* The identifier of the Amazon Connect instance. You can find the instance ID in the Amazon Resource Name (ARN) of the * instance. *

*

* Constraints:
* Length: 1 - 100
*/ private String instanceId; /** *

* The tags used to organize, track, or control access for this resource. * For example, { "tags": {"key1":"value1", "key2":"value2"} }. *

*/ private java.util.Map 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_-.\@]+. *

*

* Constraints:
* Length: 1 - 100
* * @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 getUsername() { return 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_-.\@]+. *

*

* Constraints:
* Length: 1 - 100
* * @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_-.\@]+. *

*/ public void setUsername(String username) { this.username = 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_-.\@]+. *

*

* Returns a reference to this object so that method calls can be chained * together. *

* Constraints:
* Length: 1 - 100
* * @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 A reference to this updated object so that method calls can be * chained together. */ public CreateUserRequest withUsername(String username) { this.username = username; return this; } /** *

* 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. *

*

* Constraints:
* Pattern: /^(?=.*[a-z])(?=.*[A-Z])(?=.*\d)[a-zA-Z\d\S]{8,64}$/
* * @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 getPassword() { return 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. *

*

* Constraints:
* Pattern: /^(?=.*[a-z])(?=.*[A-Z])(?=.*\d)[a-zA-Z\d\S]{8,64}$/
* * @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. *

*/ public void setPassword(String password) { this.password = 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. *

*

* Returns a reference to this object so that method calls can be chained * together. *

* Constraints:
* Pattern: /^(?=.*[a-z])(?=.*[A-Z])(?=.*\d)[a-zA-Z\d\S]{8,64}$/
* * @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 A reference to this updated object so that method calls can be * chained together. */ public CreateUserRequest withPassword(String password) { this.password = password; return this; } /** *

* The information about the identity of the user. *

* * @return

* The information about the identity of the user. *

*/ public UserIdentityInfo getIdentityInfo() { return identityInfo; } /** *

* The information about the identity of the user. *

* * @param identityInfo

* The information about the identity of the user. *

*/ public void setIdentityInfo(UserIdentityInfo identityInfo) { this.identityInfo = identityInfo; } /** *

* The information about the identity of the user. *

*

* Returns a reference to this object so that method calls can be chained * together. * * @param identityInfo

* The information about the identity of the user. *

* @return A reference to this updated object so that method calls can be * chained together. */ public CreateUserRequest withIdentityInfo(UserIdentityInfo identityInfo) { this.identityInfo = identityInfo; return this; } /** *

* The phone settings for the user. *

* * @return

* The phone settings for the user. *

*/ public UserPhoneConfig getPhoneConfig() { return phoneConfig; } /** *

* The phone settings for the user. *

* * @param phoneConfig

* The phone settings for the user. *

*/ public void setPhoneConfig(UserPhoneConfig phoneConfig) { this.phoneConfig = phoneConfig; } /** *

* The phone settings for the user. *

*

* Returns a reference to this object so that method calls can be chained * together. * * @param phoneConfig

* The phone settings for the user. *

* @return A reference to this updated object so that method calls can be * chained together. */ public CreateUserRequest withPhoneConfig(UserPhoneConfig phoneConfig) { this.phoneConfig = phoneConfig; return this; } /** *

* 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 getDirectoryUserId() { return 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. *

* * @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. *

*/ public void setDirectoryUserId(String directoryUserId) { this.directoryUserId = 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. *

*

* Returns a reference to this object so that method calls can be chained * together. * * @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 A reference to this updated object so that method calls can be * chained together. */ public CreateUserRequest withDirectoryUserId(String directoryUserId) { this.directoryUserId = directoryUserId; return this; } /** *

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

* * @return

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

*/ public java.util.List getSecurityProfileIds() { return securityProfileIds; } /** *

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

* * @param securityProfileIds

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

*/ public void setSecurityProfileIds(java.util.Collection securityProfileIds) { if (securityProfileIds == null) { this.securityProfileIds = null; return; } this.securityProfileIds = new java.util.ArrayList(securityProfileIds); } /** *

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

*

* Returns a reference to this object so that method calls can be chained * together. * * @param securityProfileIds

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

* @return A reference to this updated object so that method calls can be * chained together. */ public CreateUserRequest withSecurityProfileIds(String... securityProfileIds) { if (getSecurityProfileIds() == null) { this.securityProfileIds = new java.util.ArrayList(securityProfileIds.length); } for (String value : securityProfileIds) { this.securityProfileIds.add(value); } return this; } /** *

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

*

* Returns a reference to this object so that method calls can be chained * together. * * @param securityProfileIds

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

* @return A reference to this updated object so that method calls can be * chained together. */ public CreateUserRequest withSecurityProfileIds(java.util.Collection securityProfileIds) { setSecurityProfileIds(securityProfileIds); return this; } /** *

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

* * @return

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

*/ public String getRoutingProfileId() { return routingProfileId; } /** *

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

* * @param routingProfileId

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

*/ public void setRoutingProfileId(String routingProfileId) { this.routingProfileId = routingProfileId; } /** *

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

*

* Returns a reference to this object so that method calls can be chained * together. * * @param routingProfileId

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

* @return A reference to this updated object so that method calls can be * chained together. */ public CreateUserRequest withRoutingProfileId(String routingProfileId) { this.routingProfileId = routingProfileId; return this; } /** *

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

* * @return

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

*/ public String getHierarchyGroupId() { return hierarchyGroupId; } /** *

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

* * @param hierarchyGroupId

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

*/ public void setHierarchyGroupId(String hierarchyGroupId) { this.hierarchyGroupId = hierarchyGroupId; } /** *

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

*

* Returns a reference to this object so that method calls can be chained * together. * * @param hierarchyGroupId

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

* @return A reference to this updated object so that method calls can be * chained together. */ public CreateUserRequest withHierarchyGroupId(String hierarchyGroupId) { this.hierarchyGroupId = hierarchyGroupId; return this; } /** *

* The identifier of the Amazon Connect instance. You can find the instance ID in the Amazon Resource Name (ARN) of the * instance. *

*

* Constraints:
* Length: 1 - 100
* * @return

* The identifier of the Amazon Connect instance. You can find the instance ID in the Amazon Resource Name (ARN) of * the instance. *

*/ public String getInstanceId() { return instanceId; } /** *

* The identifier of the Amazon Connect instance. You can find the instance ID in the Amazon Resource Name (ARN) of the * instance. *

*

* Constraints:
* Length: 1 - 100
* * @param instanceId

* The identifier of the Amazon Connect instance. You can find the instance ID in the Amazon Resource Name (ARN) of * the instance. *

*/ public void setInstanceId(String instanceId) { this.instanceId = instanceId; } /** *

* The identifier of the Amazon Connect instance. You can find the instance ID in the Amazon Resource Name (ARN) of the * instance. *

*

* Returns a reference to this object so that method calls can be chained * together. *

* Constraints:
* Length: 1 - 100
* * @param instanceId

* The identifier of the Amazon Connect instance. You can find the instance ID in the Amazon Resource Name (ARN) of * the instance. *

* @return A reference to this updated object so that method calls can be * chained together. */ public CreateUserRequest withInstanceId(String instanceId) { this.instanceId = instanceId; return this; } /** *

* The tags used to organize, track, or control access for this resource. * For example, { "tags": {"key1":"value1", "key2":"value2"} }. *

* * @return

* The tags used to organize, track, or control access for this * resource. For example, { "tags": {"key1":"value1", * "key2":"value2"} }. *

*/ public java.util.Map getTags() { return tags; } /** *

* The tags used to organize, track, or control access for this resource. * For example, { "tags": {"key1":"value1", "key2":"value2"} }. *

* * @param tags

* The tags used to organize, track, or control access for this * resource. For example, { "tags": {"key1":"value1", * "key2":"value2"} }. *

*/ public void setTags(java.util.Map tags) { this.tags = tags; } /** *

* The tags used to organize, track, or control access for this resource. * For example, { "tags": {"key1":"value1", "key2":"value2"} }. *

*

* Returns a reference to this object so that method calls can be chained * together. * * @param tags

* The tags used to organize, track, or control access for this * resource. For example, { "tags": {"key1":"value1", * "key2":"value2"} }. *

* @return A reference to this updated object so that method calls can be * chained together. */ public CreateUserRequest withTags(java.util.Map tags) { this.tags = tags; return this; } /** *

* The tags used to organize, track, or control access for this resource. * For example, { "tags": {"key1":"value1", "key2":"value2"} }. *

*

* The method adds a new key-value pair into Tags parameter, and returns a * reference to this object so that method calls can be chained together. * * @param key The key of the entry to be added into Tags. * @param value The corresponding value of the entry to be added into Tags. * @return A reference to this updated object so that method calls can be * chained together. */ public CreateUserRequest addTagsEntry(String key, String value) { if (null == this.tags) { this.tags = new java.util.HashMap(); } if (this.tags.containsKey(key)) throw new IllegalArgumentException("Duplicated keys (" + key.toString() + ") are provided."); this.tags.put(key, value); return this; } /** * Removes all the entries added into Tags. *

* Returns a reference to this object so that method calls can be chained * together. */ public CreateUserRequest clearTagsEntries() { this.tags = null; return this; } /** * Returns a string representation of this object; useful for testing and * debugging. * * @return A string representation of this object. * @see java.lang.Object#toString() */ @Override public String toString() { StringBuilder sb = new StringBuilder(); sb.append("{"); if (getUsername() != null) sb.append("Username: " + getUsername() + ","); if (getPassword() != null) sb.append("Password: " + getPassword() + ","); if (getIdentityInfo() != null) sb.append("IdentityInfo: " + getIdentityInfo() + ","); if (getPhoneConfig() != null) sb.append("PhoneConfig: " + getPhoneConfig() + ","); if (getDirectoryUserId() != null) sb.append("DirectoryUserId: " + getDirectoryUserId() + ","); if (getSecurityProfileIds() != null) sb.append("SecurityProfileIds: " + getSecurityProfileIds() + ","); if (getRoutingProfileId() != null) sb.append("RoutingProfileId: " + getRoutingProfileId() + ","); if (getHierarchyGroupId() != null) sb.append("HierarchyGroupId: " + getHierarchyGroupId() + ","); if (getInstanceId() != null) sb.append("InstanceId: " + getInstanceId() + ","); if (getTags() != null) sb.append("Tags: " + getTags()); sb.append("}"); return sb.toString(); } @Override public int hashCode() { final int prime = 31; int hashCode = 1; hashCode = prime * hashCode + ((getUsername() == null) ? 0 : getUsername().hashCode()); hashCode = prime * hashCode + ((getPassword() == null) ? 0 : getPassword().hashCode()); hashCode = prime * hashCode + ((getIdentityInfo() == null) ? 0 : getIdentityInfo().hashCode()); hashCode = prime * hashCode + ((getPhoneConfig() == null) ? 0 : getPhoneConfig().hashCode()); hashCode = prime * hashCode + ((getDirectoryUserId() == null) ? 0 : getDirectoryUserId().hashCode()); hashCode = prime * hashCode + ((getSecurityProfileIds() == null) ? 0 : getSecurityProfileIds().hashCode()); hashCode = prime * hashCode + ((getRoutingProfileId() == null) ? 0 : getRoutingProfileId().hashCode()); hashCode = prime * hashCode + ((getHierarchyGroupId() == null) ? 0 : getHierarchyGroupId().hashCode()); hashCode = prime * hashCode + ((getInstanceId() == null) ? 0 : getInstanceId().hashCode()); hashCode = prime * hashCode + ((getTags() == null) ? 0 : getTags().hashCode()); return hashCode; } @Override public boolean equals(Object obj) { if (this == obj) return true; if (obj == null) return false; if (obj instanceof CreateUserRequest == false) return false; CreateUserRequest other = (CreateUserRequest) obj; if (other.getUsername() == null ^ this.getUsername() == null) return false; if (other.getUsername() != null && other.getUsername().equals(this.getUsername()) == false) return false; if (other.getPassword() == null ^ this.getPassword() == null) return false; if (other.getPassword() != null && other.getPassword().equals(this.getPassword()) == false) return false; if (other.getIdentityInfo() == null ^ this.getIdentityInfo() == null) return false; if (other.getIdentityInfo() != null && other.getIdentityInfo().equals(this.getIdentityInfo()) == false) return false; if (other.getPhoneConfig() == null ^ this.getPhoneConfig() == null) return false; if (other.getPhoneConfig() != null && other.getPhoneConfig().equals(this.getPhoneConfig()) == false) return false; if (other.getDirectoryUserId() == null ^ this.getDirectoryUserId() == null) return false; if (other.getDirectoryUserId() != null && other.getDirectoryUserId().equals(this.getDirectoryUserId()) == false) return false; if (other.getSecurityProfileIds() == null ^ this.getSecurityProfileIds() == null) return false; if (other.getSecurityProfileIds() != null && other.getSecurityProfileIds().equals(this.getSecurityProfileIds()) == false) return false; if (other.getRoutingProfileId() == null ^ this.getRoutingProfileId() == null) return false; if (other.getRoutingProfileId() != null && other.getRoutingProfileId().equals(this.getRoutingProfileId()) == false) return false; if (other.getHierarchyGroupId() == null ^ this.getHierarchyGroupId() == null) return false; if (other.getHierarchyGroupId() != null && other.getHierarchyGroupId().equals(this.getHierarchyGroupId()) == false) return false; if (other.getInstanceId() == null ^ this.getInstanceId() == null) return false; if (other.getInstanceId() != null && other.getInstanceId().equals(this.getInstanceId()) == false) return false; if (other.getTags() == null ^ this.getTags() == null) return false; if (other.getTags() != null && other.getTags().equals(this.getTags()) == false) return false; return true; } }