com.amazonaws.services.elasticache.model.CreateUserRequest Maven / Gradle / Ivy
Show all versions of aws-java-sdk-elasticache Show documentation
/*
* Copyright 2019-2024 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.elasticache.model;
import java.io.Serializable;
import javax.annotation.Generated;
import com.amazonaws.AmazonWebServiceRequest;
/**
*
* @see AWS API
* Documentation
*/
@Generated("com.amazonaws:aws-java-sdk-code-generator")
public class CreateUserRequest extends com.amazonaws.AmazonWebServiceRequest implements Serializable, Cloneable {
/**
*
* The ID of the user.
*
*/
private String userId;
/**
*
* The username of the user.
*
*/
private String userName;
/**
*
* The current supported value is Redis.
*
*/
private String engine;
/**
*
* Passwords used for this user. You can create up to two passwords for each user.
*
*/
private com.amazonaws.internal.SdkInternalList passwords;
/**
*
* Access permissions string used for this user.
*
*/
private String accessString;
/**
*
* Indicates a password is not required for this user.
*
*/
private Boolean noPasswordRequired;
/**
*
* A list of tags to be added to this resource. A tag is a key-value pair. A tag key must be accompanied by a tag
* value, although null is accepted.
*
*/
private com.amazonaws.internal.SdkInternalList tags;
/**
*
* Specifies how to authenticate the user.
*
*/
private AuthenticationMode authenticationMode;
/**
*
* The ID of the user.
*
*
* @param userId
* The ID of the user.
*/
public void setUserId(String userId) {
this.userId = userId;
}
/**
*
* The ID of the user.
*
*
* @return The ID of the user.
*/
public String getUserId() {
return this.userId;
}
/**
*
* The ID of the user.
*
*
* @param userId
* The ID of the user.
* @return Returns a reference to this object so that method calls can be chained together.
*/
public CreateUserRequest withUserId(String userId) {
setUserId(userId);
return this;
}
/**
*
* The username of the user.
*
*
* @param userName
* The username of the user.
*/
public void setUserName(String userName) {
this.userName = userName;
}
/**
*
* The username of the user.
*
*
* @return The username of the user.
*/
public String getUserName() {
return this.userName;
}
/**
*
* The username of the user.
*
*
* @param userName
* The username of the user.
* @return Returns a reference to this object so that method calls can be chained together.
*/
public CreateUserRequest withUserName(String userName) {
setUserName(userName);
return this;
}
/**
*
* The current supported value is Redis.
*
*
* @param engine
* The current supported value is Redis.
*/
public void setEngine(String engine) {
this.engine = engine;
}
/**
*
* The current supported value is Redis.
*
*
* @return The current supported value is Redis.
*/
public String getEngine() {
return this.engine;
}
/**
*
* The current supported value is Redis.
*
*
* @param engine
* The current supported value is Redis.
* @return Returns a reference to this object so that method calls can be chained together.
*/
public CreateUserRequest withEngine(String engine) {
setEngine(engine);
return this;
}
/**
*
* Passwords used for this user. You can create up to two passwords for each user.
*
*
* @return Passwords used for this user. You can create up to two passwords for each user.
*/
public java.util.List getPasswords() {
if (passwords == null) {
passwords = new com.amazonaws.internal.SdkInternalList();
}
return passwords;
}
/**
*
* Passwords used for this user. You can create up to two passwords for each user.
*
*
* @param passwords
* Passwords used for this user. You can create up to two passwords for each user.
*/
public void setPasswords(java.util.Collection passwords) {
if (passwords == null) {
this.passwords = null;
return;
}
this.passwords = new com.amazonaws.internal.SdkInternalList(passwords);
}
/**
*
* Passwords used for this user. You can create up to two passwords for each user.
*
*
* NOTE: This method appends the values to the existing list (if any). Use
* {@link #setPasswords(java.util.Collection)} or {@link #withPasswords(java.util.Collection)} if you want to
* override the existing values.
*
*
* @param passwords
* Passwords used for this user. You can create up to two passwords for each user.
* @return Returns a reference to this object so that method calls can be chained together.
*/
public CreateUserRequest withPasswords(String... passwords) {
if (this.passwords == null) {
setPasswords(new com.amazonaws.internal.SdkInternalList(passwords.length));
}
for (String ele : passwords) {
this.passwords.add(ele);
}
return this;
}
/**
*
* Passwords used for this user. You can create up to two passwords for each user.
*
*
* @param passwords
* Passwords used for this user. You can create up to two passwords for each user.
* @return Returns a reference to this object so that method calls can be chained together.
*/
public CreateUserRequest withPasswords(java.util.Collection passwords) {
setPasswords(passwords);
return this;
}
/**
*
* Access permissions string used for this user.
*
*
* @param accessString
* Access permissions string used for this user.
*/
public void setAccessString(String accessString) {
this.accessString = accessString;
}
/**
*
* Access permissions string used for this user.
*
*
* @return Access permissions string used for this user.
*/
public String getAccessString() {
return this.accessString;
}
/**
*
* Access permissions string used for this user.
*
*
* @param accessString
* Access permissions string used for this user.
* @return Returns a reference to this object so that method calls can be chained together.
*/
public CreateUserRequest withAccessString(String accessString) {
setAccessString(accessString);
return this;
}
/**
*
* Indicates a password is not required for this user.
*
*
* @param noPasswordRequired
* Indicates a password is not required for this user.
*/
public void setNoPasswordRequired(Boolean noPasswordRequired) {
this.noPasswordRequired = noPasswordRequired;
}
/**
*
* Indicates a password is not required for this user.
*
*
* @return Indicates a password is not required for this user.
*/
public Boolean getNoPasswordRequired() {
return this.noPasswordRequired;
}
/**
*
* Indicates a password is not required for this user.
*
*
* @param noPasswordRequired
* Indicates a password is not required for this user.
* @return Returns a reference to this object so that method calls can be chained together.
*/
public CreateUserRequest withNoPasswordRequired(Boolean noPasswordRequired) {
setNoPasswordRequired(noPasswordRequired);
return this;
}
/**
*
* Indicates a password is not required for this user.
*
*
* @return Indicates a password is not required for this user.
*/
public Boolean isNoPasswordRequired() {
return this.noPasswordRequired;
}
/**
*
* A list of tags to be added to this resource. A tag is a key-value pair. A tag key must be accompanied by a tag
* value, although null is accepted.
*
*
* @return A list of tags to be added to this resource. A tag is a key-value pair. A tag key must be accompanied by
* a tag value, although null is accepted.
*/
public java.util.List getTags() {
if (tags == null) {
tags = new com.amazonaws.internal.SdkInternalList();
}
return tags;
}
/**
*
* A list of tags to be added to this resource. A tag is a key-value pair. A tag key must be accompanied by a tag
* value, although null is accepted.
*
*
* @param tags
* A list of tags to be added to this resource. A tag is a key-value pair. A tag key must be accompanied by a
* tag value, although null is accepted.
*/
public void setTags(java.util.Collection tags) {
if (tags == null) {
this.tags = null;
return;
}
this.tags = new com.amazonaws.internal.SdkInternalList(tags);
}
/**
*
* A list of tags to be added to this resource. A tag is a key-value pair. A tag key must be accompanied by a tag
* value, although null is accepted.
*
*
* NOTE: This method appends the values to the existing list (if any). Use
* {@link #setTags(java.util.Collection)} or {@link #withTags(java.util.Collection)} if you want to override the
* existing values.
*
*
* @param tags
* A list of tags to be added to this resource. A tag is a key-value pair. A tag key must be accompanied by a
* tag value, although null is accepted.
* @return Returns a reference to this object so that method calls can be chained together.
*/
public CreateUserRequest withTags(Tag... tags) {
if (this.tags == null) {
setTags(new com.amazonaws.internal.SdkInternalList(tags.length));
}
for (Tag ele : tags) {
this.tags.add(ele);
}
return this;
}
/**
*
* A list of tags to be added to this resource. A tag is a key-value pair. A tag key must be accompanied by a tag
* value, although null is accepted.
*
*
* @param tags
* A list of tags to be added to this resource. A tag is a key-value pair. A tag key must be accompanied by a
* tag value, although null is accepted.
* @return Returns a reference to this object so that method calls can be chained together.
*/
public CreateUserRequest withTags(java.util.Collection tags) {
setTags(tags);
return this;
}
/**
*
* Specifies how to authenticate the user.
*
*
* @param authenticationMode
* Specifies how to authenticate the user.
*/
public void setAuthenticationMode(AuthenticationMode authenticationMode) {
this.authenticationMode = authenticationMode;
}
/**
*
* Specifies how to authenticate the user.
*
*
* @return Specifies how to authenticate the user.
*/
public AuthenticationMode getAuthenticationMode() {
return this.authenticationMode;
}
/**
*
* Specifies how to authenticate the user.
*
*
* @param authenticationMode
* Specifies how to authenticate the user.
* @return Returns a reference to this object so that method calls can be chained together.
*/
public CreateUserRequest withAuthenticationMode(AuthenticationMode authenticationMode) {
setAuthenticationMode(authenticationMode);
return this;
}
/**
* 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.
*
* @return A string representation of this object.
*
* @see java.lang.Object#toString()
*/
@Override
public String toString() {
StringBuilder sb = new StringBuilder();
sb.append("{");
if (getUserId() != null)
sb.append("UserId: ").append(getUserId()).append(",");
if (getUserName() != null)
sb.append("UserName: ").append(getUserName()).append(",");
if (getEngine() != null)
sb.append("Engine: ").append(getEngine()).append(",");
if (getPasswords() != null)
sb.append("Passwords: ").append(getPasswords()).append(",");
if (getAccessString() != null)
sb.append("AccessString: ").append(getAccessString()).append(",");
if (getNoPasswordRequired() != null)
sb.append("NoPasswordRequired: ").append(getNoPasswordRequired()).append(",");
if (getTags() != null)
sb.append("Tags: ").append(getTags()).append(",");
if (getAuthenticationMode() != null)
sb.append("AuthenticationMode: ").append(getAuthenticationMode());
sb.append("}");
return sb.toString();
}
@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.getUserId() == null ^ this.getUserId() == null)
return false;
if (other.getUserId() != null && other.getUserId().equals(this.getUserId()) == false)
return false;
if (other.getUserName() == null ^ this.getUserName() == null)
return false;
if (other.getUserName() != null && other.getUserName().equals(this.getUserName()) == false)
return false;
if (other.getEngine() == null ^ this.getEngine() == null)
return false;
if (other.getEngine() != null && other.getEngine().equals(this.getEngine()) == false)
return false;
if (other.getPasswords() == null ^ this.getPasswords() == null)
return false;
if (other.getPasswords() != null && other.getPasswords().equals(this.getPasswords()) == false)
return false;
if (other.getAccessString() == null ^ this.getAccessString() == null)
return false;
if (other.getAccessString() != null && other.getAccessString().equals(this.getAccessString()) == false)
return false;
if (other.getNoPasswordRequired() == null ^ this.getNoPasswordRequired() == null)
return false;
if (other.getNoPasswordRequired() != null && other.getNoPasswordRequired().equals(this.getNoPasswordRequired()) == false)
return false;
if (other.getTags() == null ^ this.getTags() == null)
return false;
if (other.getTags() != null && other.getTags().equals(this.getTags()) == false)
return false;
if (other.getAuthenticationMode() == null ^ this.getAuthenticationMode() == null)
return false;
if (other.getAuthenticationMode() != null && other.getAuthenticationMode().equals(this.getAuthenticationMode()) == false)
return false;
return true;
}
@Override
public int hashCode() {
final int prime = 31;
int hashCode = 1;
hashCode = prime * hashCode + ((getUserId() == null) ? 0 : getUserId().hashCode());
hashCode = prime * hashCode + ((getUserName() == null) ? 0 : getUserName().hashCode());
hashCode = prime * hashCode + ((getEngine() == null) ? 0 : getEngine().hashCode());
hashCode = prime * hashCode + ((getPasswords() == null) ? 0 : getPasswords().hashCode());
hashCode = prime * hashCode + ((getAccessString() == null) ? 0 : getAccessString().hashCode());
hashCode = prime * hashCode + ((getNoPasswordRequired() == null) ? 0 : getNoPasswordRequired().hashCode());
hashCode = prime * hashCode + ((getTags() == null) ? 0 : getTags().hashCode());
hashCode = prime * hashCode + ((getAuthenticationMode() == null) ? 0 : getAuthenticationMode().hashCode());
return hashCode;
}
@Override
public CreateUserRequest clone() {
return (CreateUserRequest) super.clone();
}
}