com.amazonaws.services.securitytoken.model.GetCallerIdentityResult Maven / Gradle / Ivy
Show all versions of aws-java-sdk-sts 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.securitytoken.model;
import java.io.Serializable;
import javax.annotation.Generated;
/**
*
* Contains the response to a successful GetCallerIdentity request, including information about the entity making
* the request.
*
*
* @see AWS API
* Documentation
*/
@Generated("com.amazonaws:aws-java-sdk-code-generator")
public class GetCallerIdentityResult extends com.amazonaws.AmazonWebServiceResult implements Serializable, Cloneable {
/**
*
* The unique identifier of the calling entity. The exact value depends on the type of entity that is making the
* call. The values returned are those listed in the aws:userid column in the Principal table found on the Policy Variables reference page in the IAM User Guide.
*
*/
private String userId;
/**
*
* The Amazon Web Services account ID number of the account that owns or contains the calling entity.
*
*/
private String account;
/**
*
* The Amazon Web Services ARN associated with the calling entity.
*
*/
private String arn;
/**
*
* The unique identifier of the calling entity. The exact value depends on the type of entity that is making the
* call. The values returned are those listed in the aws:userid column in the Principal table found on the Policy Variables reference page in the IAM User Guide.
*
*
* @param userId
* The unique identifier of the calling entity. The exact value depends on the type of entity that is making
* the call. The values returned are those listed in the aws:userid column in the Principal table found on the Policy Variables reference page in the IAM User Guide.
*/
public void setUserId(String userId) {
this.userId = userId;
}
/**
*
* The unique identifier of the calling entity. The exact value depends on the type of entity that is making the
* call. The values returned are those listed in the aws:userid column in the Principal table found on the Policy Variables reference page in the IAM User Guide.
*
*
* @return The unique identifier of the calling entity. The exact value depends on the type of entity that is making
* the call. The values returned are those listed in the aws:userid column in the Principal table found on the Policy Variables reference page in the IAM User Guide.
*/
public String getUserId() {
return this.userId;
}
/**
*
* The unique identifier of the calling entity. The exact value depends on the type of entity that is making the
* call. The values returned are those listed in the aws:userid column in the Principal table found on the Policy Variables reference page in the IAM User Guide.
*
*
* @param userId
* The unique identifier of the calling entity. The exact value depends on the type of entity that is making
* the call. The values returned are those listed in the aws:userid column in the Principal table found on the Policy Variables reference page in the IAM User Guide.
* @return Returns a reference to this object so that method calls can be chained together.
*/
public GetCallerIdentityResult withUserId(String userId) {
setUserId(userId);
return this;
}
/**
*
* The Amazon Web Services account ID number of the account that owns or contains the calling entity.
*
*
* @param account
* The Amazon Web Services account ID number of the account that owns or contains the calling entity.
*/
public void setAccount(String account) {
this.account = account;
}
/**
*
* The Amazon Web Services account ID number of the account that owns or contains the calling entity.
*
*
* @return The Amazon Web Services account ID number of the account that owns or contains the calling entity.
*/
public String getAccount() {
return this.account;
}
/**
*
* The Amazon Web Services account ID number of the account that owns or contains the calling entity.
*
*
* @param account
* The Amazon Web Services account ID number of the account that owns or contains the calling entity.
* @return Returns a reference to this object so that method calls can be chained together.
*/
public GetCallerIdentityResult withAccount(String account) {
setAccount(account);
return this;
}
/**
*
* The Amazon Web Services ARN associated with the calling entity.
*
*
* @param arn
* The Amazon Web Services ARN associated with the calling entity.
*/
public void setArn(String arn) {
this.arn = arn;
}
/**
*
* The Amazon Web Services ARN associated with the calling entity.
*
*
* @return The Amazon Web Services ARN associated with the calling entity.
*/
public String getArn() {
return this.arn;
}
/**
*
* The Amazon Web Services ARN associated with the calling entity.
*
*
* @param arn
* The Amazon Web Services ARN associated with the calling entity.
* @return Returns a reference to this object so that method calls can be chained together.
*/
public GetCallerIdentityResult withArn(String arn) {
setArn(arn);
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 (getAccount() != null)
sb.append("Account: ").append(getAccount()).append(",");
if (getArn() != null)
sb.append("Arn: ").append(getArn());
sb.append("}");
return sb.toString();
}
@Override
public boolean equals(Object obj) {
if (this == obj)
return true;
if (obj == null)
return false;
if (obj instanceof GetCallerIdentityResult == false)
return false;
GetCallerIdentityResult other = (GetCallerIdentityResult) obj;
if (other.getUserId() == null ^ this.getUserId() == null)
return false;
if (other.getUserId() != null && other.getUserId().equals(this.getUserId()) == false)
return false;
if (other.getAccount() == null ^ this.getAccount() == null)
return false;
if (other.getAccount() != null && other.getAccount().equals(this.getAccount()) == false)
return false;
if (other.getArn() == null ^ this.getArn() == null)
return false;
if (other.getArn() != null && other.getArn().equals(this.getArn()) == 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 + ((getAccount() == null) ? 0 : getAccount().hashCode());
hashCode = prime * hashCode + ((getArn() == null) ? 0 : getArn().hashCode());
return hashCode;
}
@Override
public GetCallerIdentityResult clone() {
try {
return (GetCallerIdentityResult) super.clone();
} catch (CloneNotSupportedException e) {
throw new IllegalStateException("Got a CloneNotSupportedException from Object.clone() " + "even though we're Cloneable!", e);
}
}
}