/* * Copyright 2018-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.securityhub.model; import java.io.Serializable; import javax.annotation.Generated; import com.amazonaws.protocol.StructuredPojo; import com.amazonaws.protocol.ProtocolMarshaller; /** *
* IAM access key details related to a finding. *
* * @see AWS * API Documentation */ @Generated("com.amazonaws:aws-java-sdk-code-generator") public class AwsIamAccessKeyDetails implements Serializable, Cloneable, StructuredPojo { /** ** The user associated with the IAM access key related to a finding. *
*
* The UserName
parameter has been replaced with the PrincipalName
parameter because
* access keys can also be assigned to principals that are not IAM users.
*
* The status of the IAM access key related to a finding. *
*/ private String status; /** ** Indicates when the IAM access key was created. *
*
* Uses the date-time
format specified in RFC
* 3339 section 5.6, Internet Date/Time Format. The value cannot contain spaces, and date and time should be
* separated by T
. For example, 2020-03-22T13:22:13.933Z
.
*
* The ID of the principal associated with an access key. *
*/ private String principalId; /** ** The type of principal associated with an access key. *
*/ private String principalType; /** ** The name of the principal. *
*/ private String principalName; /** ** The Amazon Web Services account ID of the account for the key. *
*/ private String accountId; /** ** The identifier of the access key. *
*/ private String accessKeyId; /** ** Information about the session that the key was used for. *
*/ private AwsIamAccessKeySessionContext sessionContext; /** ** The user associated with the IAM access key related to a finding. *
*
* The UserName
parameter has been replaced with the PrincipalName
parameter because
* access keys can also be assigned to principals that are not IAM users.
*
* The UserName
parameter has been replaced with the PrincipalName
parameter
* because access keys can also be assigned to principals that are not IAM users.
*/
@Deprecated
public void setUserName(String userName) {
this.userName = userName;
}
/**
*
* The user associated with the IAM access key related to a finding. *
*
* The UserName
parameter has been replaced with the PrincipalName
parameter because
* access keys can also be assigned to principals that are not IAM users.
*
* The UserName
parameter has been replaced with the PrincipalName
parameter
* because access keys can also be assigned to principals that are not IAM users.
*/
@Deprecated
public String getUserName() {
return this.userName;
}
/**
*
* The user associated with the IAM access key related to a finding. *
*
* The UserName
parameter has been replaced with the PrincipalName
parameter because
* access keys can also be assigned to principals that are not IAM users.
*
* The UserName
parameter has been replaced with the PrincipalName
parameter
* because access keys can also be assigned to principals that are not IAM users.
* @return Returns a reference to this object so that method calls can be chained together.
*/
@Deprecated
public AwsIamAccessKeyDetails withUserName(String userName) {
setUserName(userName);
return this;
}
/**
*
* The status of the IAM access key related to a finding. *
* * @param status * The status of the IAM access key related to a finding. * @see AwsIamAccessKeyStatus */ public void setStatus(String status) { this.status = status; } /** ** The status of the IAM access key related to a finding. *
* * @return The status of the IAM access key related to a finding. * @see AwsIamAccessKeyStatus */ public String getStatus() { return this.status; } /** ** The status of the IAM access key related to a finding. *
* * @param status * The status of the IAM access key related to a finding. * @return Returns a reference to this object so that method calls can be chained together. * @see AwsIamAccessKeyStatus */ public AwsIamAccessKeyDetails withStatus(String status) { setStatus(status); return this; } /** ** The status of the IAM access key related to a finding. *
* * @param status * The status of the IAM access key related to a finding. * @return Returns a reference to this object so that method calls can be chained together. * @see AwsIamAccessKeyStatus */ public AwsIamAccessKeyDetails withStatus(AwsIamAccessKeyStatus status) { this.status = status.toString(); return this; } /** ** Indicates when the IAM access key was created. *
*
* Uses the date-time
format specified in RFC
* 3339 section 5.6, Internet Date/Time Format. The value cannot contain spaces, and date and time should be
* separated by T
. For example, 2020-03-22T13:22:13.933Z
.
*
* Uses the date-time
format specified in RFC 3339 section 5.6, Internet Date/Time
* Format. The value cannot contain spaces, and date and time should be separated by T
. For
* example, 2020-03-22T13:22:13.933Z
.
*/
public void setCreatedAt(String createdAt) {
this.createdAt = createdAt;
}
/**
*
* Indicates when the IAM access key was created. *
*
* Uses the date-time
format specified in RFC
* 3339 section 5.6, Internet Date/Time Format. The value cannot contain spaces, and date and time should be
* separated by T
. For example, 2020-03-22T13:22:13.933Z
.
*
* Uses the date-time
format specified in RFC 3339 section 5.6, Internet Date/Time
* Format. The value cannot contain spaces, and date and time should be separated by T
. For
* example, 2020-03-22T13:22:13.933Z
.
*/
public String getCreatedAt() {
return this.createdAt;
}
/**
*
* Indicates when the IAM access key was created. *
*
* Uses the date-time
format specified in RFC
* 3339 section 5.6, Internet Date/Time Format. The value cannot contain spaces, and date and time should be
* separated by T
. For example, 2020-03-22T13:22:13.933Z
.
*
* Uses the date-time
format specified in RFC 3339 section 5.6, Internet Date/Time
* Format. The value cannot contain spaces, and date and time should be separated by T
. For
* example, 2020-03-22T13:22:13.933Z
.
* @return Returns a reference to this object so that method calls can be chained together.
*/
public AwsIamAccessKeyDetails withCreatedAt(String createdAt) {
setCreatedAt(createdAt);
return this;
}
/**
*
* The ID of the principal associated with an access key. *
* * @param principalId * The ID of the principal associated with an access key. */ public void setPrincipalId(String principalId) { this.principalId = principalId; } /** ** The ID of the principal associated with an access key. *
* * @return The ID of the principal associated with an access key. */ public String getPrincipalId() { return this.principalId; } /** ** The ID of the principal associated with an access key. *
* * @param principalId * The ID of the principal associated with an access key. * @return Returns a reference to this object so that method calls can be chained together. */ public AwsIamAccessKeyDetails withPrincipalId(String principalId) { setPrincipalId(principalId); return this; } /** ** The type of principal associated with an access key. *
* * @param principalType * The type of principal associated with an access key. */ public void setPrincipalType(String principalType) { this.principalType = principalType; } /** ** The type of principal associated with an access key. *
* * @return The type of principal associated with an access key. */ public String getPrincipalType() { return this.principalType; } /** ** The type of principal associated with an access key. *
* * @param principalType * The type of principal associated with an access key. * @return Returns a reference to this object so that method calls can be chained together. */ public AwsIamAccessKeyDetails withPrincipalType(String principalType) { setPrincipalType(principalType); return this; } /** ** The name of the principal. *
* * @param principalName * The name of the principal. */ public void setPrincipalName(String principalName) { this.principalName = principalName; } /** ** The name of the principal. *
* * @return The name of the principal. */ public String getPrincipalName() { return this.principalName; } /** ** The name of the principal. *
* * @param principalName * The name of the principal. * @return Returns a reference to this object so that method calls can be chained together. */ public AwsIamAccessKeyDetails withPrincipalName(String principalName) { setPrincipalName(principalName); return this; } /** ** The Amazon Web Services account ID of the account for the key. *
* * @param accountId * The Amazon Web Services account ID of the account for the key. */ public void setAccountId(String accountId) { this.accountId = accountId; } /** ** The Amazon Web Services account ID of the account for the key. *
* * @return The Amazon Web Services account ID of the account for the key. */ public String getAccountId() { return this.accountId; } /** ** The Amazon Web Services account ID of the account for the key. *
* * @param accountId * The Amazon Web Services account ID of the account for the key. * @return Returns a reference to this object so that method calls can be chained together. */ public AwsIamAccessKeyDetails withAccountId(String accountId) { setAccountId(accountId); return this; } /** ** The identifier of the access key. *
* * @param accessKeyId * The identifier of the access key. */ public void setAccessKeyId(String accessKeyId) { this.accessKeyId = accessKeyId; } /** ** The identifier of the access key. *
* * @return The identifier of the access key. */ public String getAccessKeyId() { return this.accessKeyId; } /** ** The identifier of the access key. *
* * @param accessKeyId * The identifier of the access key. * @return Returns a reference to this object so that method calls can be chained together. */ public AwsIamAccessKeyDetails withAccessKeyId(String accessKeyId) { setAccessKeyId(accessKeyId); return this; } /** ** Information about the session that the key was used for. *
* * @param sessionContext * Information about the session that the key was used for. */ public void setSessionContext(AwsIamAccessKeySessionContext sessionContext) { this.sessionContext = sessionContext; } /** ** Information about the session that the key was used for. *
* * @return Information about the session that the key was used for. */ public AwsIamAccessKeySessionContext getSessionContext() { return this.sessionContext; } /** ** Information about the session that the key was used for. *
* * @param sessionContext * Information about the session that the key was used for. * @return Returns a reference to this object so that method calls can be chained together. */ public AwsIamAccessKeyDetails withSessionContext(AwsIamAccessKeySessionContext sessionContext) { setSessionContext(sessionContext); 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 (getUserName() != null) sb.append("UserName: ").append(getUserName()).append(","); if (getStatus() != null) sb.append("Status: ").append(getStatus()).append(","); if (getCreatedAt() != null) sb.append("CreatedAt: ").append(getCreatedAt()).append(","); if (getPrincipalId() != null) sb.append("PrincipalId: ").append(getPrincipalId()).append(","); if (getPrincipalType() != null) sb.append("PrincipalType: ").append(getPrincipalType()).append(","); if (getPrincipalName() != null) sb.append("PrincipalName: ").append(getPrincipalName()).append(","); if (getAccountId() != null) sb.append("AccountId: ").append(getAccountId()).append(","); if (getAccessKeyId() != null) sb.append("AccessKeyId: ").append(getAccessKeyId()).append(","); if (getSessionContext() != null) sb.append("SessionContext: ").append(getSessionContext()); sb.append("}"); return sb.toString(); } @Override public boolean equals(Object obj) { if (this == obj) return true; if (obj == null) return false; if (obj instanceof AwsIamAccessKeyDetails == false) return false; AwsIamAccessKeyDetails other = (AwsIamAccessKeyDetails) obj; if (other.getUserName() == null ^ this.getUserName() == null) return false; if (other.getUserName() != null && other.getUserName().equals(this.getUserName()) == false) return false; if (other.getStatus() == null ^ this.getStatus() == null) return false; if (other.getStatus() != null && other.getStatus().equals(this.getStatus()) == false) return false; if (other.getCreatedAt() == null ^ this.getCreatedAt() == null) return false; if (other.getCreatedAt() != null && other.getCreatedAt().equals(this.getCreatedAt()) == false) return false; if (other.getPrincipalId() == null ^ this.getPrincipalId() == null) return false; if (other.getPrincipalId() != null && other.getPrincipalId().equals(this.getPrincipalId()) == false) return false; if (other.getPrincipalType() == null ^ this.getPrincipalType() == null) return false; if (other.getPrincipalType() != null && other.getPrincipalType().equals(this.getPrincipalType()) == false) return false; if (other.getPrincipalName() == null ^ this.getPrincipalName() == null) return false; if (other.getPrincipalName() != null && other.getPrincipalName().equals(this.getPrincipalName()) == false) return false; if (other.getAccountId() == null ^ this.getAccountId() == null) return false; if (other.getAccountId() != null && other.getAccountId().equals(this.getAccountId()) == false) return false; if (other.getAccessKeyId() == null ^ this.getAccessKeyId() == null) return false; if (other.getAccessKeyId() != null && other.getAccessKeyId().equals(this.getAccessKeyId()) == false) return false; if (other.getSessionContext() == null ^ this.getSessionContext() == null) return false; if (other.getSessionContext() != null && other.getSessionContext().equals(this.getSessionContext()) == false) return false; return true; } @Override public int hashCode() { final int prime = 31; int hashCode = 1; hashCode = prime * hashCode + ((getUserName() == null) ? 0 : getUserName().hashCode()); hashCode = prime * hashCode + ((getStatus() == null) ? 0 : getStatus().hashCode()); hashCode = prime * hashCode + ((getCreatedAt() == null) ? 0 : getCreatedAt().hashCode()); hashCode = prime * hashCode + ((getPrincipalId() == null) ? 0 : getPrincipalId().hashCode()); hashCode = prime * hashCode + ((getPrincipalType() == null) ? 0 : getPrincipalType().hashCode()); hashCode = prime * hashCode + ((getPrincipalName() == null) ? 0 : getPrincipalName().hashCode()); hashCode = prime * hashCode + ((getAccountId() == null) ? 0 : getAccountId().hashCode()); hashCode = prime * hashCode + ((getAccessKeyId() == null) ? 0 : getAccessKeyId().hashCode()); hashCode = prime * hashCode + ((getSessionContext() == null) ? 0 : getSessionContext().hashCode()); return hashCode; } @Override public AwsIamAccessKeyDetails clone() { try { return (AwsIamAccessKeyDetails) super.clone(); } catch (CloneNotSupportedException e) { throw new IllegalStateException("Got a CloneNotSupportedException from Object.clone() " + "even though we're Cloneable!", e); } } @com.amazonaws.annotation.SdkInternalApi @Override public void marshall(ProtocolMarshaller protocolMarshaller) { com.amazonaws.services.securityhub.model.transform.AwsIamAccessKeyDetailsMarshaller.getInstance().marshall(this, protocolMarshaller); } }