
com.amazonaws.services.identitymanagement.model.ManagedPolicyDetail Maven / Gradle / Ivy
Show all versions of aws-java-sdk-iam Show documentation
/*
* Copyright 2010-2016 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;
import java.io.Serializable;
/**
*
* Contains information about a managed policy, including the policy's ARN,
* versions, and the number of principal entities (users, groups, and roles)
* that the policy is attached to.
*
*
* This data type is used as a response element in the
* GetAccountAuthorizationDetails action.
*
*
* For more information about managed policies, see Managed Policies and Inline Policies in the Using IAM guide.
*
*/
public class ManagedPolicyDetail implements Serializable, Cloneable {
/**
*
* The friendly name (not ARN) identifying the policy.
*
*/
private String policyName;
/**
*
* The stable and unique string identifying the policy.
*
*
* For more information about IDs, see IAM Identifiers in the Using IAM guide.
*
*/
private String policyId;
private String arn;
/**
*
* The path to the policy.
*
*
* For more information about paths, see IAM Identifiers in the Using IAM guide.
*
*/
private String path;
/**
*
* The identifier for the version of the policy that is set as the default
* (operative) version.
*
*
* For more information about policy versions, see Versioning for Managed Policies in the Using IAM guide.
*
*/
private String defaultVersionId;
/**
*
* The number of principal entities (users, groups, and roles) that the
* policy is attached to.
*
*/
private Integer attachmentCount;
/**
*
* Specifies whether the policy can be attached to an IAM user, group, or
* role.
*
*/
private Boolean isAttachable;
/**
*
* A friendly description of the policy.
*
*/
private String description;
/**
*
* The date and time, in ISO 8601
* date-time format, when the policy was created.
*
*/
private java.util.Date createDate;
/**
*
* The date and time, in ISO 8601
* date-time format, when the policy was last updated.
*
*
* When a policy has only one version, this field contains the date and time
* when the policy was created. When a policy has more than one version,
* this field contains the date and time when the most recent policy version
* was created.
*
*/
private java.util.Date updateDate;
/**
*
* A list containing information about the versions of the policy.
*
*/
private com.amazonaws.internal.SdkInternalList policyVersionList;
/**
*
* The friendly name (not ARN) identifying the policy.
*
*
* @param policyName
* The friendly name (not ARN) identifying the policy.
*/
public void setPolicyName(String policyName) {
this.policyName = policyName;
}
/**
*
* The friendly name (not ARN) identifying the policy.
*
*
* @return The friendly name (not ARN) identifying the policy.
*/
public String getPolicyName() {
return this.policyName;
}
/**
*
* The friendly name (not ARN) identifying the policy.
*
*
* @param policyName
* The friendly name (not ARN) identifying the policy.
* @return Returns a reference to this object so that method calls can be
* chained together.
*/
public ManagedPolicyDetail withPolicyName(String policyName) {
setPolicyName(policyName);
return this;
}
/**
*
* The stable and unique string identifying the policy.
*
*
* For more information about IDs, see IAM Identifiers in the Using IAM guide.
*
*
* @param policyId
* The stable and unique string identifying the policy.
*
* For more information about IDs, see IAM Identifiers in the Using IAM guide.
*/
public void setPolicyId(String policyId) {
this.policyId = policyId;
}
/**
*
* The stable and unique string identifying the policy.
*
*
* For more information about IDs, see IAM Identifiers in the Using IAM guide.
*
*
* @return The stable and unique string identifying the policy.
*
* For more information about IDs, see IAM Identifiers in the Using IAM guide.
*/
public String getPolicyId() {
return this.policyId;
}
/**
*
* The stable and unique string identifying the policy.
*
*
* For more information about IDs, see IAM Identifiers in the Using IAM guide.
*
*
* @param policyId
* The stable and unique string identifying the policy.
*
* For more information about IDs, see IAM Identifiers in the Using IAM guide.
* @return Returns a reference to this object so that method calls can be
* chained together.
*/
public ManagedPolicyDetail withPolicyId(String policyId) {
setPolicyId(policyId);
return this;
}
/**
* @param arn
*/
public void setArn(String arn) {
this.arn = arn;
}
/**
* @return
*/
public String getArn() {
return this.arn;
}
/**
* @param arn
* @return Returns a reference to this object so that method calls can be
* chained together.
*/
public ManagedPolicyDetail withArn(String arn) {
setArn(arn);
return this;
}
/**
*
* The path to the policy.
*
*
* For more information about paths, see IAM Identifiers in the Using IAM guide.
*
*
* @param path
* The path to the policy.
*
* For more information about paths, see IAM Identifiers in the Using IAM guide.
*/
public void setPath(String path) {
this.path = path;
}
/**
*
* The path to the policy.
*
*
* For more information about paths, see IAM Identifiers in the Using IAM guide.
*
*
* @return The path to the policy.
*
* For more information about paths, see IAM Identifiers in the Using IAM guide.
*/
public String getPath() {
return this.path;
}
/**
*
* The path to the policy.
*
*
* For more information about paths, see IAM Identifiers in the Using IAM guide.
*
*
* @param path
* The path to the policy.
*
* For more information about paths, see IAM Identifiers in the Using IAM guide.
* @return Returns a reference to this object so that method calls can be
* chained together.
*/
public ManagedPolicyDetail withPath(String path) {
setPath(path);
return this;
}
/**
*
* The identifier for the version of the policy that is set as the default
* (operative) version.
*
*
* For more information about policy versions, see Versioning for Managed Policies in the Using IAM guide.
*
*
* @param defaultVersionId
* The identifier for the version of the policy that is set as the
* default (operative) version.
*
* For more information about policy versions, see Versioning for Managed Policies in the Using IAM
* guide.
*/
public void setDefaultVersionId(String defaultVersionId) {
this.defaultVersionId = defaultVersionId;
}
/**
*
* The identifier for the version of the policy that is set as the default
* (operative) version.
*
*
* For more information about policy versions, see Versioning for Managed Policies in the Using IAM guide.
*
*
* @return The identifier for the version of the policy that is set as the
* default (operative) version.
*
* For more information about policy versions, see Versioning for Managed Policies in the Using IAM
* guide.
*/
public String getDefaultVersionId() {
return this.defaultVersionId;
}
/**
*
* The identifier for the version of the policy that is set as the default
* (operative) version.
*
*
* For more information about policy versions, see Versioning for Managed Policies in the Using IAM guide.
*
*
* @param defaultVersionId
* The identifier for the version of the policy that is set as the
* default (operative) version.
*
* For more information about policy versions, see Versioning for Managed Policies in the Using IAM
* guide.
* @return Returns a reference to this object so that method calls can be
* chained together.
*/
public ManagedPolicyDetail withDefaultVersionId(String defaultVersionId) {
setDefaultVersionId(defaultVersionId);
return this;
}
/**
*
* The number of principal entities (users, groups, and roles) that the
* policy is attached to.
*
*
* @param attachmentCount
* The number of principal entities (users, groups, and roles) that
* the policy is attached to.
*/
public void setAttachmentCount(Integer attachmentCount) {
this.attachmentCount = attachmentCount;
}
/**
*
* The number of principal entities (users, groups, and roles) that the
* policy is attached to.
*
*
* @return The number of principal entities (users, groups, and roles) that
* the policy is attached to.
*/
public Integer getAttachmentCount() {
return this.attachmentCount;
}
/**
*
* The number of principal entities (users, groups, and roles) that the
* policy is attached to.
*
*
* @param attachmentCount
* The number of principal entities (users, groups, and roles) that
* the policy is attached to.
* @return Returns a reference to this object so that method calls can be
* chained together.
*/
public ManagedPolicyDetail withAttachmentCount(Integer attachmentCount) {
setAttachmentCount(attachmentCount);
return this;
}
/**
*
* Specifies whether the policy can be attached to an IAM user, group, or
* role.
*
*
* @param isAttachable
* Specifies whether the policy can be attached to an IAM user,
* group, or role.
*/
public void setIsAttachable(Boolean isAttachable) {
this.isAttachable = isAttachable;
}
/**
*
* Specifies whether the policy can be attached to an IAM user, group, or
* role.
*
*
* @return Specifies whether the policy can be attached to an IAM user,
* group, or role.
*/
public Boolean getIsAttachable() {
return this.isAttachable;
}
/**
*
* Specifies whether the policy can be attached to an IAM user, group, or
* role.
*
*
* @param isAttachable
* Specifies whether the policy can be attached to an IAM user,
* group, or role.
* @return Returns a reference to this object so that method calls can be
* chained together.
*/
public ManagedPolicyDetail withIsAttachable(Boolean isAttachable) {
setIsAttachable(isAttachable);
return this;
}
/**
*
* Specifies whether the policy can be attached to an IAM user, group, or
* role.
*
*
* @return Specifies whether the policy can be attached to an IAM user,
* group, or role.
*/
public Boolean isAttachable() {
return this.isAttachable;
}
/**
*
* A friendly description of the policy.
*
*
* @param description
* A friendly description of the policy.
*/
public void setDescription(String description) {
this.description = description;
}
/**
*
* A friendly description of the policy.
*
*
* @return A friendly description of the policy.
*/
public String getDescription() {
return this.description;
}
/**
*
* A friendly description of the policy.
*
*
* @param description
* A friendly description of the policy.
* @return Returns a reference to this object so that method calls can be
* chained together.
*/
public ManagedPolicyDetail withDescription(String description) {
setDescription(description);
return this;
}
/**
*
* The date and time, in ISO 8601
* date-time format, when the policy was created.
*
*
* @param createDate
* The date and time, in ISO
* 8601 date-time format, when the policy was created.
*/
public void setCreateDate(java.util.Date createDate) {
this.createDate = createDate;
}
/**
*
* The date and time, in ISO 8601
* date-time format, when the policy was created.
*
*
* @return The date and time, in ISO 8601 date-time
* format, when the policy was created.
*/
public java.util.Date getCreateDate() {
return this.createDate;
}
/**
*
* The date and time, in ISO 8601
* date-time format, when the policy was created.
*
*
* @param createDate
* The date and time, in ISO
* 8601 date-time format, when the policy was created.
* @return Returns a reference to this object so that method calls can be
* chained together.
*/
public ManagedPolicyDetail withCreateDate(java.util.Date createDate) {
setCreateDate(createDate);
return this;
}
/**
*
* The date and time, in ISO 8601
* date-time format, when the policy was last updated.
*
*
* When a policy has only one version, this field contains the date and time
* when the policy was created. When a policy has more than one version,
* this field contains the date and time when the most recent policy version
* was created.
*
*
* @param updateDate
* The date and time, in ISO
* 8601 date-time format, when the policy was last updated.
*
* When a policy has only one version, this field contains the date
* and time when the policy was created. When a policy has more than
* one version, this field contains the date and time when the most
* recent policy version was created.
*/
public void setUpdateDate(java.util.Date updateDate) {
this.updateDate = updateDate;
}
/**
*
* The date and time, in ISO 8601
* date-time format, when the policy was last updated.
*
*
* When a policy has only one version, this field contains the date and time
* when the policy was created. When a policy has more than one version,
* this field contains the date and time when the most recent policy version
* was created.
*
*
* @return The date and time, in ISO 8601 date-time
* format, when the policy was last updated.
*
* When a policy has only one version, this field contains the date
* and time when the policy was created. When a policy has more than
* one version, this field contains the date and time when the most
* recent policy version was created.
*/
public java.util.Date getUpdateDate() {
return this.updateDate;
}
/**
*
* The date and time, in ISO 8601
* date-time format, when the policy was last updated.
*
*
* When a policy has only one version, this field contains the date and time
* when the policy was created. When a policy has more than one version,
* this field contains the date and time when the most recent policy version
* was created.
*
*
* @param updateDate
* The date and time, in ISO
* 8601 date-time format, when the policy was last updated.
*
* When a policy has only one version, this field contains the date
* and time when the policy was created. When a policy has more than
* one version, this field contains the date and time when the most
* recent policy version was created.
* @return Returns a reference to this object so that method calls can be
* chained together.
*/
public ManagedPolicyDetail withUpdateDate(java.util.Date updateDate) {
setUpdateDate(updateDate);
return this;
}
/**
*
* A list containing information about the versions of the policy.
*
*
* @return A list containing information about the versions of the policy.
*/
public java.util.List getPolicyVersionList() {
if (policyVersionList == null) {
policyVersionList = new com.amazonaws.internal.SdkInternalList();
}
return policyVersionList;
}
/**
*
* A list containing information about the versions of the policy.
*
*
* @param policyVersionList
* A list containing information about the versions of the policy.
*/
public void setPolicyVersionList(
java.util.Collection policyVersionList) {
if (policyVersionList == null) {
this.policyVersionList = null;
return;
}
this.policyVersionList = new com.amazonaws.internal.SdkInternalList(
policyVersionList);
}
/**
*
* A list containing information about the versions of the policy.
*
*
* NOTE: This method appends the values to the existing list (if
* any). Use {@link #setPolicyVersionList(java.util.Collection)} or
* {@link #withPolicyVersionList(java.util.Collection)} if you want to
* override the existing values.
*
*
* @param policyVersionList
* A list containing information about the versions of the policy.
* @return Returns a reference to this object so that method calls can be
* chained together.
*/
public ManagedPolicyDetail withPolicyVersionList(
PolicyVersion... policyVersionList) {
if (this.policyVersionList == null) {
setPolicyVersionList(new com.amazonaws.internal.SdkInternalList(
policyVersionList.length));
}
for (PolicyVersion ele : policyVersionList) {
this.policyVersionList.add(ele);
}
return this;
}
/**
*
* A list containing information about the versions of the policy.
*
*
* @param policyVersionList
* A list containing information about the versions of the policy.
* @return Returns a reference to this object so that method calls can be
* chained together.
*/
public ManagedPolicyDetail withPolicyVersionList(
java.util.Collection policyVersionList) {
setPolicyVersionList(policyVersionList);
return this;
}
/**
* Returns a string representation of this object; useful for testing and
* debugging.
*
* @return A string representation of this object.
*
* @see java.lang.Object#toString()
*/
@Override
public String toString() {
StringBuilder sb = new StringBuilder();
sb.append("{");
if (getPolicyName() != null)
sb.append("PolicyName: " + getPolicyName() + ",");
if (getPolicyId() != null)
sb.append("PolicyId: " + getPolicyId() + ",");
if (getArn() != null)
sb.append("Arn: " + getArn() + ",");
if (getPath() != null)
sb.append("Path: " + getPath() + ",");
if (getDefaultVersionId() != null)
sb.append("DefaultVersionId: " + getDefaultVersionId() + ",");
if (getAttachmentCount() != null)
sb.append("AttachmentCount: " + getAttachmentCount() + ",");
if (getIsAttachable() != null)
sb.append("IsAttachable: " + getIsAttachable() + ",");
if (getDescription() != null)
sb.append("Description: " + getDescription() + ",");
if (getCreateDate() != null)
sb.append("CreateDate: " + getCreateDate() + ",");
if (getUpdateDate() != null)
sb.append("UpdateDate: " + getUpdateDate() + ",");
if (getPolicyVersionList() != null)
sb.append("PolicyVersionList: " + getPolicyVersionList());
sb.append("}");
return sb.toString();
}
@Override
public boolean equals(Object obj) {
if (this == obj)
return true;
if (obj == null)
return false;
if (obj instanceof ManagedPolicyDetail == false)
return false;
ManagedPolicyDetail other = (ManagedPolicyDetail) obj;
if (other.getPolicyName() == null ^ this.getPolicyName() == null)
return false;
if (other.getPolicyName() != null
&& other.getPolicyName().equals(this.getPolicyName()) == false)
return false;
if (other.getPolicyId() == null ^ this.getPolicyId() == null)
return false;
if (other.getPolicyId() != null
&& other.getPolicyId().equals(this.getPolicyId()) == false)
return false;
if (other.getArn() == null ^ this.getArn() == null)
return false;
if (other.getArn() != null
&& other.getArn().equals(this.getArn()) == false)
return false;
if (other.getPath() == null ^ this.getPath() == null)
return false;
if (other.getPath() != null
&& other.getPath().equals(this.getPath()) == false)
return false;
if (other.getDefaultVersionId() == null
^ this.getDefaultVersionId() == null)
return false;
if (other.getDefaultVersionId() != null
&& other.getDefaultVersionId().equals(
this.getDefaultVersionId()) == false)
return false;
if (other.getAttachmentCount() == null
^ this.getAttachmentCount() == null)
return false;
if (other.getAttachmentCount() != null
&& other.getAttachmentCount().equals(this.getAttachmentCount()) == false)
return false;
if (other.getIsAttachable() == null ^ this.getIsAttachable() == null)
return false;
if (other.getIsAttachable() != null
&& other.getIsAttachable().equals(this.getIsAttachable()) == false)
return false;
if (other.getDescription() == null ^ this.getDescription() == null)
return false;
if (other.getDescription() != null
&& other.getDescription().equals(this.getDescription()) == 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.getUpdateDate() == null ^ this.getUpdateDate() == null)
return false;
if (other.getUpdateDate() != null
&& other.getUpdateDate().equals(this.getUpdateDate()) == false)
return false;
if (other.getPolicyVersionList() == null
^ this.getPolicyVersionList() == null)
return false;
if (other.getPolicyVersionList() != null
&& other.getPolicyVersionList().equals(
this.getPolicyVersionList()) == false)
return false;
return true;
}
@Override
public int hashCode() {
final int prime = 31;
int hashCode = 1;
hashCode = prime * hashCode
+ ((getPolicyName() == null) ? 0 : getPolicyName().hashCode());
hashCode = prime * hashCode
+ ((getPolicyId() == null) ? 0 : getPolicyId().hashCode());
hashCode = prime * hashCode
+ ((getArn() == null) ? 0 : getArn().hashCode());
hashCode = prime * hashCode
+ ((getPath() == null) ? 0 : getPath().hashCode());
hashCode = prime
* hashCode
+ ((getDefaultVersionId() == null) ? 0 : getDefaultVersionId()
.hashCode());
hashCode = prime
* hashCode
+ ((getAttachmentCount() == null) ? 0 : getAttachmentCount()
.hashCode());
hashCode = prime
* hashCode
+ ((getIsAttachable() == null) ? 0 : getIsAttachable()
.hashCode());
hashCode = prime
* hashCode
+ ((getDescription() == null) ? 0 : getDescription().hashCode());
hashCode = prime * hashCode
+ ((getCreateDate() == null) ? 0 : getCreateDate().hashCode());
hashCode = prime * hashCode
+ ((getUpdateDate() == null) ? 0 : getUpdateDate().hashCode());
hashCode = prime
* hashCode
+ ((getPolicyVersionList() == null) ? 0
: getPolicyVersionList().hashCode());
return hashCode;
}
@Override
public ManagedPolicyDetail clone() {
try {
return (ManagedPolicyDetail) super.clone();
} catch (CloneNotSupportedException e) {
throw new IllegalStateException(
"Got a CloneNotSupportedException from Object.clone() "
+ "even though we're Cloneable!", e);
}
}
}