/* * 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; /** *
* Contains information about an IAM role, including all of the role's policies. *
* * @see AWS API * Documentation */ @Generated("com.amazonaws:aws-java-sdk-code-generator") public class AwsIamRoleDetails implements Serializable, Cloneable, StructuredPojo { /** ** The trust policy that grants permission to assume the role. *
*/ private String assumeRolePolicyDocument; /** ** The list of the managed policies that are attached to the role. *
*/ private java.util.List* Indicates when the role 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 list of instance profiles that contain this role. *
*/ private java.util.List* The stable and unique string identifying the role. *
*/ private String roleId; /** ** The friendly name that identifies the role. *
*/ private String roleName; /** ** The list of inline policies that are embedded in the role. *
*/ private java.util.List* The maximum session duration (in seconds) that you want to set for the specified role. *
*/ private Integer maxSessionDuration; /** ** The path to the role. *
*/ private String path; /** ** The trust policy that grants permission to assume the role. *
* * @param assumeRolePolicyDocument * The trust policy that grants permission to assume the role. */ public void setAssumeRolePolicyDocument(String assumeRolePolicyDocument) { this.assumeRolePolicyDocument = assumeRolePolicyDocument; } /** ** The trust policy that grants permission to assume the role. *
* * @return The trust policy that grants permission to assume the role. */ public String getAssumeRolePolicyDocument() { return this.assumeRolePolicyDocument; } /** ** The trust policy that grants permission to assume the role. *
* * @param assumeRolePolicyDocument * The trust policy that grants permission to assume the role. * @return Returns a reference to this object so that method calls can be chained together. */ public AwsIamRoleDetails withAssumeRolePolicyDocument(String assumeRolePolicyDocument) { setAssumeRolePolicyDocument(assumeRolePolicyDocument); return this; } /** ** The list of the managed policies that are attached to the role. *
* * @return The list of the managed policies that are attached to the role. */ public java.util.List* The list of the managed policies that are attached to the role. *
* * @param attachedManagedPolicies * The list of the managed policies that are attached to the role. */ public void setAttachedManagedPolicies(java.util.Collection* The list of the managed policies that are attached to the role. *
** NOTE: This method appends the values to the existing list (if any). Use * {@link #setAttachedManagedPolicies(java.util.Collection)} or * {@link #withAttachedManagedPolicies(java.util.Collection)} if you want to override the existing values. *
* * @param attachedManagedPolicies * The list of the managed policies that are attached to the role. * @return Returns a reference to this object so that method calls can be chained together. */ public AwsIamRoleDetails withAttachedManagedPolicies(AwsIamAttachedManagedPolicy... attachedManagedPolicies) { if (this.attachedManagedPolicies == null) { setAttachedManagedPolicies(new java.util.ArrayList* The list of the managed policies that are attached to the role. *
* * @param attachedManagedPolicies * The list of the managed policies that are attached to the role. * @return Returns a reference to this object so that method calls can be chained together. */ public AwsIamRoleDetails withAttachedManagedPolicies(java.util.Collection* Indicates when the role 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 setCreateDate(String createDate) {
this.createDate = createDate;
}
/**
*
* Indicates when the role 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 getCreateDate() {
return this.createDate;
}
/**
*
* Indicates when the role 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 AwsIamRoleDetails withCreateDate(String createDate) {
setCreateDate(createDate);
return this;
}
/**
*
* The list of instance profiles that contain this role. *
* * @return The list of instance profiles that contain this role. */ public java.util.List* The list of instance profiles that contain this role. *
* * @param instanceProfileList * The list of instance profiles that contain this role. */ public void setInstanceProfileList(java.util.Collection* The list of instance profiles that contain this role. *
** NOTE: This method appends the values to the existing list (if any). Use * {@link #setInstanceProfileList(java.util.Collection)} or {@link #withInstanceProfileList(java.util.Collection)} * if you want to override the existing values. *
* * @param instanceProfileList * The list of instance profiles that contain this role. * @return Returns a reference to this object so that method calls can be chained together. */ public AwsIamRoleDetails withInstanceProfileList(AwsIamInstanceProfile... instanceProfileList) { if (this.instanceProfileList == null) { setInstanceProfileList(new java.util.ArrayList* The list of instance profiles that contain this role. *
* * @param instanceProfileList * The list of instance profiles that contain this role. * @return Returns a reference to this object so that method calls can be chained together. */ public AwsIamRoleDetails withInstanceProfileList(java.util.Collection* The stable and unique string identifying the role. *
* * @param roleId * The stable and unique string identifying the role. */ public void setRoleId(String roleId) { this.roleId = roleId; } /** ** The stable and unique string identifying the role. *
* * @return The stable and unique string identifying the role. */ public String getRoleId() { return this.roleId; } /** ** The stable and unique string identifying the role. *
* * @param roleId * The stable and unique string identifying the role. * @return Returns a reference to this object so that method calls can be chained together. */ public AwsIamRoleDetails withRoleId(String roleId) { setRoleId(roleId); return this; } /** ** The friendly name that identifies the role. *
* * @param roleName * The friendly name that identifies the role. */ public void setRoleName(String roleName) { this.roleName = roleName; } /** ** The friendly name that identifies the role. *
* * @return The friendly name that identifies the role. */ public String getRoleName() { return this.roleName; } /** ** The friendly name that identifies the role. *
* * @param roleName * The friendly name that identifies the role. * @return Returns a reference to this object so that method calls can be chained together. */ public AwsIamRoleDetails withRoleName(String roleName) { setRoleName(roleName); return this; } /** ** The list of inline policies that are embedded in the role. *
* * @return The list of inline policies that are embedded in the role. */ public java.util.List* The list of inline policies that are embedded in the role. *
* * @param rolePolicyList * The list of inline policies that are embedded in the role. */ public void setRolePolicyList(java.util.Collection* The list of inline policies that are embedded in the role. *
** NOTE: This method appends the values to the existing list (if any). Use * {@link #setRolePolicyList(java.util.Collection)} or {@link #withRolePolicyList(java.util.Collection)} if you want * to override the existing values. *
* * @param rolePolicyList * The list of inline policies that are embedded in the role. * @return Returns a reference to this object so that method calls can be chained together. */ public AwsIamRoleDetails withRolePolicyList(AwsIamRolePolicy... rolePolicyList) { if (this.rolePolicyList == null) { setRolePolicyList(new java.util.ArrayList* The list of inline policies that are embedded in the role. *
* * @param rolePolicyList * The list of inline policies that are embedded in the role. * @return Returns a reference to this object so that method calls can be chained together. */ public AwsIamRoleDetails withRolePolicyList(java.util.Collection* The maximum session duration (in seconds) that you want to set for the specified role. *
* * @param maxSessionDuration * The maximum session duration (in seconds) that you want to set for the specified role. */ public void setMaxSessionDuration(Integer maxSessionDuration) { this.maxSessionDuration = maxSessionDuration; } /** ** The maximum session duration (in seconds) that you want to set for the specified role. *
* * @return The maximum session duration (in seconds) that you want to set for the specified role. */ public Integer getMaxSessionDuration() { return this.maxSessionDuration; } /** ** The maximum session duration (in seconds) that you want to set for the specified role. *
* * @param maxSessionDuration * The maximum session duration (in seconds) that you want to set for the specified role. * @return Returns a reference to this object so that method calls can be chained together. */ public AwsIamRoleDetails withMaxSessionDuration(Integer maxSessionDuration) { setMaxSessionDuration(maxSessionDuration); return this; } /** ** The path to the role. *
* * @param path * The path to the role. */ public void setPath(String path) { this.path = path; } /** ** The path to the role. *
* * @return The path to the role. */ public String getPath() { return this.path; } /** ** The path to the role. *
* * @param path * The path to the role. * @return Returns a reference to this object so that method calls can be chained together. */ public AwsIamRoleDetails withPath(String path) { setPath(path); 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 (getAssumeRolePolicyDocument() != null) sb.append("AssumeRolePolicyDocument: ").append(getAssumeRolePolicyDocument()).append(","); if (getAttachedManagedPolicies() != null) sb.append("AttachedManagedPolicies: ").append(getAttachedManagedPolicies()).append(","); if (getCreateDate() != null) sb.append("CreateDate: ").append(getCreateDate()).append(","); if (getInstanceProfileList() != null) sb.append("InstanceProfileList: ").append(getInstanceProfileList()).append(","); if (getPermissionsBoundary() != null) sb.append("PermissionsBoundary: ").append(getPermissionsBoundary()).append(","); if (getRoleId() != null) sb.append("RoleId: ").append(getRoleId()).append(","); if (getRoleName() != null) sb.append("RoleName: ").append(getRoleName()).append(","); if (getRolePolicyList() != null) sb.append("RolePolicyList: ").append(getRolePolicyList()).append(","); if (getMaxSessionDuration() != null) sb.append("MaxSessionDuration: ").append(getMaxSessionDuration()).append(","); if (getPath() != null) sb.append("Path: ").append(getPath()); sb.append("}"); return sb.toString(); } @Override public boolean equals(Object obj) { if (this == obj) return true; if (obj == null) return false; if (obj instanceof AwsIamRoleDetails == false) return false; AwsIamRoleDetails other = (AwsIamRoleDetails) obj; if (other.getAssumeRolePolicyDocument() == null ^ this.getAssumeRolePolicyDocument() == null) return false; if (other.getAssumeRolePolicyDocument() != null && other.getAssumeRolePolicyDocument().equals(this.getAssumeRolePolicyDocument()) == false) return false; if (other.getAttachedManagedPolicies() == null ^ this.getAttachedManagedPolicies() == null) return false; if (other.getAttachedManagedPolicies() != null && other.getAttachedManagedPolicies().equals(this.getAttachedManagedPolicies()) == false) return false; if (other.getCreateDate() == null ^ this.getCreateDate() == null) return false; if (other.getCreateDate() != null && other.getCreateDate().equals(this.getCreateDate()) == false) return false; if (other.getInstanceProfileList() == null ^ this.getInstanceProfileList() == null) return false; if (other.getInstanceProfileList() != null && other.getInstanceProfileList().equals(this.getInstanceProfileList()) == false) return false; if (other.getPermissionsBoundary() == null ^ this.getPermissionsBoundary() == null) return false; if (other.getPermissionsBoundary() != null && other.getPermissionsBoundary().equals(this.getPermissionsBoundary()) == false) return false; if (other.getRoleId() == null ^ this.getRoleId() == null) return false; if (other.getRoleId() != null && other.getRoleId().equals(this.getRoleId()) == false) return false; if (other.getRoleName() == null ^ this.getRoleName() == null) return false; if (other.getRoleName() != null && other.getRoleName().equals(this.getRoleName()) == false) return false; if (other.getRolePolicyList() == null ^ this.getRolePolicyList() == null) return false; if (other.getRolePolicyList() != null && other.getRolePolicyList().equals(this.getRolePolicyList()) == false) return false; if (other.getMaxSessionDuration() == null ^ this.getMaxSessionDuration() == null) return false; if (other.getMaxSessionDuration() != null && other.getMaxSessionDuration().equals(this.getMaxSessionDuration()) == false) return false; if (other.getPath() == null ^ this.getPath() == null) return false; if (other.getPath() != null && other.getPath().equals(this.getPath()) == false) return false; return true; } @Override public int hashCode() { final int prime = 31; int hashCode = 1; hashCode = prime * hashCode + ((getAssumeRolePolicyDocument() == null) ? 0 : getAssumeRolePolicyDocument().hashCode()); hashCode = prime * hashCode + ((getAttachedManagedPolicies() == null) ? 0 : getAttachedManagedPolicies().hashCode()); hashCode = prime * hashCode + ((getCreateDate() == null) ? 0 : getCreateDate().hashCode()); hashCode = prime * hashCode + ((getInstanceProfileList() == null) ? 0 : getInstanceProfileList().hashCode()); hashCode = prime * hashCode + ((getPermissionsBoundary() == null) ? 0 : getPermissionsBoundary().hashCode()); hashCode = prime * hashCode + ((getRoleId() == null) ? 0 : getRoleId().hashCode()); hashCode = prime * hashCode + ((getRoleName() == null) ? 0 : getRoleName().hashCode()); hashCode = prime * hashCode + ((getRolePolicyList() == null) ? 0 : getRolePolicyList().hashCode()); hashCode = prime * hashCode + ((getMaxSessionDuration() == null) ? 0 : getMaxSessionDuration().hashCode()); hashCode = prime * hashCode + ((getPath() == null) ? 0 : getPath().hashCode()); return hashCode; } @Override public AwsIamRoleDetails clone() { try { return (AwsIamRoleDetails) 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.AwsIamRoleDetailsMarshaller.getInstance().marshall(this, protocolMarshaller); } }