Start line:  
End line:  

Snippet Preview

Snippet HTML Code

Stack Overflow Questions
  /*
   * Copyright 2010-2015 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.identitymanagement.model;
 

Contains information about an IAM user entity.

This data type is used as a response element in the following actions:

  • CreateUser

  • GetUser

  • ListUsers

 
 public class User implements SerializableCloneable {

    
The path to the user. For more information about paths, see IAM Identifiers in the Using IAM guide.

Constraints:
Length: 1 - 512
Pattern: (\u002F)|(\u002F[\u0021-\u007F]+\u002F)

 
     private String path;

    
The friendly name identifying the user.

Constraints:
Length: 1 - 64
Pattern: [\w+=,.@-]*

 
     private String userName;

    
The stable and unique string identifying the user. For more information about IDs, see IAM Identifiers in the Using IAM guide.

Constraints:
Length: 16 - 32
Pattern: [\w]*

 
     private String userId;

    
The Amazon Resource Name (ARN) that identifies the user. For more information about ARNs and how to use ARNs in policies, see IAM Identifiers in the Using IAM guide.

Constraints:
Length: 20 - 2048

 
     private String arn;

    
The date and time, in ISO 8601 date-time format, when the user was created.
 
     private java.util.Date createDate;

    
The date and time, in ISO 8601 date-time format, when the user's password was last used to sign in to an AWS website. For a list of AWS websites that capture a user's last sign-in time, see the Credential Reports topic in the Using IAM guide. If a password is used more than once in a five-minute span, only the first use is returned in this field. When the user does not have a password, this field is null (not present). When a user's password exists but has never been used, or when there is no sign-in data associated with the user, this field is null (not present).

This value is returned only in the GetUser and ListUsers actions.

    private java.util.Date passwordLastUsed;

    
Default constructor for a new User object. Callers should use the setter or fluent setter (with...) methods to initialize this object after creating it.
    public User() {}
    
    
Constructs a new User object. Callers should use the setter or fluent setter (with...) methods to initialize any additional object members.

Parameters:
path The path to the user. For more information about paths, see IAM Identifiers in the Using IAM guide.
userName The friendly name identifying the user.
userId The stable and unique string identifying the user. For more information about IDs, see IAM Identifiers in the Using IAM guide.
arn The Amazon Resource Name (ARN) that identifies the user. For more information about ARNs and how to use ARNs in policies, see IAM Identifiers in the Using IAM guide.
createDate The date and time, in ISO 8601 date-time format, when the user was created.
    public User(String pathString userNameString userIdString arnjava.util.Date createDate) {
        setPath(path);
        setUserName(userName);
        setUserId(userId);
        setArn(arn);
        setCreateDate(createDate);
    }

    
The path to the user. For more information about paths, see IAM Identifiers in the Using IAM guide.

Constraints:
Length: 1 - 512
Pattern: (\u002F)|(\u002F[\u0021-\u007F]+\u002F)

Returns:
The path to the user. For more information about paths, see IAM Identifiers in the Using IAM guide.
    public String getPath() {
        return ;
    }
    
    
The path to the user. For more information about paths, see IAM Identifiers in the Using IAM guide.

Constraints:
Length: 1 - 512
Pattern: (\u002F)|(\u002F[\u0021-\u007F]+\u002F)

Parameters:
path The path to the user. For more information about paths, see IAM Identifiers in the Using IAM guide.
    public void setPath(String path) {
        this. = path;
    }
    
    
The path to the user. For more information about paths, see IAM Identifiers in the Using IAM guide.

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

Constraints:
Length: 1 - 512
Pattern: (\u002F)|(\u002F[\u0021-\u007F]+\u002F)

Parameters:
path The path to the user. For more information about paths, see IAM Identifiers in the Using IAM guide.
Returns:
A reference to this updated object so that method calls can be chained together.
    public User withPath(String path) {
        this. = path;
        return this;
    }

    
The friendly name identifying the user.

Constraints:
Length: 1 - 64
Pattern: [\w+=,.@-]*

Returns:
The friendly name identifying the user.
    public String getUserName() {
        return ;
    }
    
    
The friendly name identifying the user.

Constraints:
Length: 1 - 64
Pattern: [\w+=,.@-]*

Parameters:
userName The friendly name identifying the user.
    public void setUserName(String userName) {
        this. = userName;
    }
    
    
The friendly name identifying the user.

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

Constraints:
Length: 1 - 64
Pattern: [\w+=,.@-]*

Parameters:
userName The friendly name identifying the user.
Returns:
A reference to this updated object so that method calls can be chained together.
    public User withUserName(String userName) {
        this. = userName;
        return this;
    }

    
The stable and unique string identifying the user. For more information about IDs, see IAM Identifiers in the Using IAM guide.

Constraints:
Length: 16 - 32
Pattern: [\w]*

Returns:
The stable and unique string identifying the user. For more information about IDs, see IAM Identifiers in the Using IAM guide.
    public String getUserId() {
        return ;
    }
    
    
The stable and unique string identifying the user. For more information about IDs, see IAM Identifiers in the Using IAM guide.

Constraints:
Length: 16 - 32
Pattern: [\w]*

Parameters:
userId The stable and unique string identifying the user. For more information about IDs, see IAM Identifiers in the Using IAM guide.
    public void setUserId(String userId) {
        this. = userId;
    }
    
    
The stable and unique string identifying the user. For more information about IDs, see IAM Identifiers in the Using IAM guide.

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

Constraints:
Length: 16 - 32
Pattern: [\w]*

Parameters:
userId The stable and unique string identifying the user. For more information about IDs, see IAM Identifiers in the Using IAM guide.
Returns:
A reference to this updated object so that method calls can be chained together.
    public User withUserId(String userId) {
        this. = userId;
        return this;
    }

    
The Amazon Resource Name (ARN) that identifies the user. For more information about ARNs and how to use ARNs in policies, see IAM Identifiers in the Using IAM guide.

Constraints:
Length: 20 - 2048

Returns:
The Amazon Resource Name (ARN) that identifies the user. For more information about ARNs and how to use ARNs in policies, see IAM Identifiers in the Using IAM guide.
    public String getArn() {
        return ;
    }
    
    
The Amazon Resource Name (ARN) that identifies the user. For more information about ARNs and how to use ARNs in policies, see IAM Identifiers in the Using IAM guide.

Constraints:
Length: 20 - 2048

Parameters:
arn The Amazon Resource Name (ARN) that identifies the user. For more information about ARNs and how to use ARNs in policies, see IAM Identifiers in the Using IAM guide.
    public void setArn(String arn) {
        this. = arn;
    }
    
    
The Amazon Resource Name (ARN) that identifies the user. For more information about ARNs and how to use ARNs in policies, see IAM Identifiers in the Using IAM guide.

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

Constraints:
Length: 20 - 2048

Parameters:
arn The Amazon Resource Name (ARN) that identifies the user. For more information about ARNs and how to use ARNs in policies, see IAM Identifiers in the Using IAM guide.
Returns:
A reference to this updated object so that method calls can be chained together.
    public User withArn(String arn) {
        this. = arn;
        return this;
    }

    
The date and time, in ISO 8601 date-time format, when the user was created.

Returns:
The date and time, in ISO 8601 date-time format, when the user was created.
    public java.util.Date getCreateDate() {
        return ;
    }
    
    
The date and time, in ISO 8601 date-time format, when the user was created.

Parameters:
createDate The date and time, in ISO 8601 date-time format, when the user was created.
    public void setCreateDate(java.util.Date createDate) {
        this. = createDate;
    }
    
    
The date and time, in ISO 8601 date-time format, when the user was created.

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

Parameters:
createDate The date and time, in ISO 8601 date-time format, when the user was created.
Returns:
A reference to this updated object so that method calls can be chained together.
    public User withCreateDate(java.util.Date createDate) {
        this. = createDate;
        return this;
    }

    
The date and time, in ISO 8601 date-time format, when the user's password was last used to sign in to an AWS website. For a list of AWS websites that capture a user's last sign-in time, see the Credential Reports topic in the Using IAM guide. If a password is used more than once in a five-minute span, only the first use is returned in this field. When the user does not have a password, this field is null (not present). When a user's password exists but has never been used, or when there is no sign-in data associated with the user, this field is null (not present).

This value is returned only in the GetUser and ListUsers actions.

Returns:
The date and time, in ISO 8601 date-time format, when the user's password was last used to sign in to an AWS website. For a list of AWS websites that capture a user's last sign-in time, see the Credential Reports topic in the Using IAM guide. If a password is used more than once in a five-minute span, only the first use is returned in this field. When the user does not have a password, this field is null (not present). When a user's password exists but has never been used, or when there is no sign-in data associated with the user, this field is null (not present).

This value is returned only in the GetUser and ListUsers actions.

    public java.util.Date getPasswordLastUsed() {
        return ;
    }
    
    
The date and time, in ISO 8601 date-time format, when the user's password was last used to sign in to an AWS website. For a list of AWS websites that capture a user's last sign-in time, see the Credential Reports topic in the Using IAM guide. If a password is used more than once in a five-minute span, only the first use is returned in this field. When the user does not have a password, this field is null (not present). When a user's password exists but has never been used, or when there is no sign-in data associated with the user, this field is null (not present).

This value is returned only in the GetUser and ListUsers actions.

Parameters:
passwordLastUsed The date and time, in ISO 8601 date-time format, when the user's password was last used to sign in to an AWS website. For a list of AWS websites that capture a user's last sign-in time, see the Credential Reports topic in the Using IAM guide. If a password is used more than once in a five-minute span, only the first use is returned in this field. When the user does not have a password, this field is null (not present). When a user's password exists but has never been used, or when there is no sign-in data associated with the user, this field is null (not present).

This value is returned only in the GetUser and ListUsers actions.

    public void setPasswordLastUsed(java.util.Date passwordLastUsed) {
        this. = passwordLastUsed;
    }
    
    
The date and time, in ISO 8601 date-time format, when the user's password was last used to sign in to an AWS website. For a list of AWS websites that capture a user's last sign-in time, see the Credential Reports topic in the Using IAM guide. If a password is used more than once in a five-minute span, only the first use is returned in this field. When the user does not have a password, this field is null (not present). When a user's password exists but has never been used, or when there is no sign-in data associated with the user, this field is null (not present).

This value is returned only in the GetUser and ListUsers actions.

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

Parameters:
passwordLastUsed The date and time, in ISO 8601 date-time format, when the user's password was last used to sign in to an AWS website. For a list of AWS websites that capture a user's last sign-in time, see the Credential Reports topic in the Using IAM guide. If a password is used more than once in a five-minute span, only the first use is returned in this field. When the user does not have a password, this field is null (not present). When a user's password exists but has never been used, or when there is no sign-in data associated with the user, this field is null (not present).

This value is returned only in the GetUser and ListUsers actions.

Returns:
A reference to this updated object so that method calls can be chained together.
    public User withPasswordLastUsed(java.util.Date passwordLastUsed) {
        this. = passwordLastUsed;
        return this;
    }

    
Returns a string representation of this object; useful for testing and debugging.

Returns:
A string representation of this object.
See also:
java.lang.Object.toString()
    @Override
    public String toString() {
        StringBuilder sb = new StringBuilder();
        sb.append("{");
        if (getPath() != nullsb.append("Path: " + getPath() + ",");
        if (getUserName() != nullsb.append("UserName: " + getUserName() + ",");
        if (getUserId() != nullsb.append("UserId: " + getUserId() + ",");
        if (getArn() != nullsb.append("Arn: " + getArn() + ",");
        if (getCreateDate() != nullsb.append("CreateDate: " + getCreateDate() + ",");
        if (getPasswordLastUsed() != nullsb.append("PasswordLastUsed: " + getPasswordLastUsed() );
        sb.append("}");
        return sb.toString();
    }
    
    @Override
    public int hashCode() {
        final int prime = 31;
        int hashCode = 1;
        
        hashCode = prime * hashCode + ((getPath() == null) ? 0 : getPath().hashCode()); 
        hashCode = prime * hashCode + ((getUserName() == null) ? 0 : getUserName().hashCode()); 
        hashCode = prime * hashCode + ((getUserId() == null) ? 0 : getUserId().hashCode()); 
        hashCode = prime * hashCode + ((getArn() == null) ? 0 : getArn().hashCode()); 
        hashCode = prime * hashCode + ((getCreateDate() == null) ? 0 : getCreateDate().hashCode()); 
        hashCode = prime * hashCode + ((getPasswordLastUsed() == null) ? 0 : getPasswordLastUsed().hashCode()); 
        return hashCode;
    }
    
    @Override
    public boolean equals(Object obj) {
        if (this == objreturn true;
        if (obj == nullreturn false;
        if (obj instanceof User == falsereturn false;
        User other = (User)obj;
        
        if (other.getPath() == null ^ this.getPath() == nullreturn false;
        if (other.getPath() != null && other.getPath().equals(this.getPath()) == falsereturn false
        if (other.getUserName() == null ^ this.getUserName() == nullreturn false;
        if (other.getUserName() != null && other.getUserName().equals(this.getUserName()) == falsereturn false
        if (other.getUserId() == null ^ this.getUserId() == nullreturn false;
        if (other.getUserId() != null && other.getUserId().equals(this.getUserId()) == falsereturn false
        if (other.getArn() == null ^ this.getArn() == nullreturn false;
        if (other.getArn() != null && other.getArn().equals(this.getArn()) == falsereturn false
        if (other.getCreateDate() == null ^ this.getCreateDate() == nullreturn false;
        if (other.getCreateDate() != null && other.getCreateDate().equals(this.getCreateDate()) == falsereturn false
        if (other.getPasswordLastUsed() == null ^ this.getPasswordLastUsed() == nullreturn false;
        if (other.getPasswordLastUsed() != null && other.getPasswordLastUsed().equals(this.getPasswordLastUsed()) == falsereturn false
        return true;
    }
    
    @Override
    public User clone() {
        try {
            return (Usersuper.clone();
        
        } catch (CloneNotSupportedException e) {
            throw new IllegalStateException(
                    "Got a CloneNotSupportedException from Object.clone() "
                    + "even though we're Cloneable!",
                    e);
        }
        
    }
}
    
New to GrepCode? Check out our FAQ X