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 a managed policy.

This data type is used as a response element in the CreatePolicy, GetPolicy, and ListPolicies actions.

For more information about managed policies, refer to Managed Policies and Inline Policies in the Using IAM guide.

 
 public class Policy implements SerializableCloneable {

    
The friendly name (not ARN) identifying the policy.

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

 
     private String policyName;

    
The stable and unique string identifying the policy.

For more information about IDs, see IAM Identifiers in the Using IAM guide.

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

 
     private String policyId;

    
The Amazon Resource Name (ARN). ARNs are unique identifiers for AWS resources.

For more information about ARNs, go to Amazon Resource Names (ARNs) and AWS Service Namespaces in the AWS General Reference.

Constraints:
Length: 20 - 2048

 
     private String arn;

    
The path to the policy.

For more information about paths, see IAM Identifiers in the Using IAM guide.

Constraints:
Pattern: ((/[A-Za-z0-9\.,\+@=_-]+)*)/

 
     private String path;

    
The identifier for the version of the policy that is set as the default version.

Constraints:
Pattern: v[1-9][0-9]*(\.[A-Za-z0-9-]*)?

 
     private String defaultVersionId;

    
The number of 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.

This element is included in the response to the GetPolicy operation. It is not included in the response to the ListPolicies operation.

Constraints:
Length: 0 - 1000

    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;

    
The friendly name (not ARN) identifying the policy.

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

Returns:
The friendly name (not ARN) identifying the policy.
    public String getPolicyName() {
        return ;
    }
    
    
The friendly name (not ARN) identifying the policy.

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

Parameters:
policyName The friendly name (not ARN) identifying the policy.
    public void setPolicyName(String policyName) {
        this. = policyName;
    }
    
    
The friendly name (not ARN) identifying the policy.

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

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

Parameters:
policyName The friendly name (not ARN) identifying the policy.
Returns:
A reference to this updated object so that method calls can be chained together.
    public Policy withPolicyName(String policyName) {
        this. = policyName;
        return this;
    }

    
The stable and unique string identifying the policy.

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 policy.

For more information about IDs, see IAM Identifiers in the Using IAM guide.

    public String getPolicyId() {
        return ;
    }
    
    
The stable and unique string identifying the policy.

For more information about IDs, see IAM Identifiers in the Using IAM guide.

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

Parameters:
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;
    }
    
    
The stable and unique string identifying the policy.

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:
policyId The stable and unique string identifying the policy.

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 Policy withPolicyId(String policyId) {
        this. = policyId;
        return this;
    }

    
The Amazon Resource Name (ARN). ARNs are unique identifiers for AWS resources.

For more information about ARNs, go to Amazon Resource Names (ARNs) and AWS Service Namespaces in the AWS General Reference.

Constraints:
Length: 20 - 2048

Returns:
The Amazon Resource Name (ARN). ARNs are unique identifiers for AWS resources.

For more information about ARNs, go to Amazon Resource Names (ARNs) and AWS Service Namespaces in the AWS General Reference.

    public String getArn() {
        return ;
    }
    
    
The Amazon Resource Name (ARN). ARNs are unique identifiers for AWS resources.

For more information about ARNs, go to Amazon Resource Names (ARNs) and AWS Service Namespaces in the AWS General Reference.

Constraints:
Length: 20 - 2048

Parameters:
arn The Amazon Resource Name (ARN). ARNs are unique identifiers for AWS resources.

For more information about ARNs, go to Amazon Resource Names (ARNs) and AWS Service Namespaces in the AWS General Reference.

    public void setArn(String arn) {
        this. = arn;
    }
    
    
The Amazon Resource Name (ARN). ARNs are unique identifiers for AWS resources.

For more information about ARNs, go to Amazon Resource Names (ARNs) and AWS Service Namespaces in the AWS General Reference.

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). ARNs are unique identifiers for AWS resources.

For more information about ARNs, go to Amazon Resource Names (ARNs) and AWS Service Namespaces in the AWS General Reference.

Returns:
A reference to this updated object so that method calls can be chained together.
    public Policy withArn(String arn) {
        this. = arn;
        return this;
    }

    
The path to the policy.

For more information about paths, see IAM Identifiers in the Using IAM guide.

Constraints:
Pattern: ((/[A-Za-z0-9\.,\+@=_-]+)*)/

Returns:
The path to the policy.

For more information about paths, see IAM Identifiers in the Using IAM guide.

    public String getPath() {
        return ;
    }
    
    
The path to the policy.

For more information about paths, see IAM Identifiers in the Using IAM guide.

Constraints:
Pattern: ((/[A-Za-z0-9\.,\+@=_-]+)*)/

Parameters:
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;
    }
    
    
The path to the policy.

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:
Pattern: ((/[A-Za-z0-9\.,\+@=_-]+)*)/

Parameters:
path The path to the policy.

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 Policy withPath(String path) {
        this. = path;
        return this;
    }

    
The identifier for the version of the policy that is set as the default version.

Constraints:
Pattern: v[1-9][0-9]*(\.[A-Za-z0-9-]*)?

Returns:
The identifier for the version of the policy that is set as the default version.
    public String getDefaultVersionId() {
        return ;
    }
    
    
The identifier for the version of the policy that is set as the default version.

Constraints:
Pattern: v[1-9][0-9]*(\.[A-Za-z0-9-]*)?

Parameters:
defaultVersionId The identifier for the version of the policy that is set as the default version.
    public void setDefaultVersionId(String defaultVersionId) {
        this. = defaultVersionId;
    }
    
    
The identifier for the version of the policy that is set as the default version.

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

Constraints:
Pattern: v[1-9][0-9]*(\.[A-Za-z0-9-]*)?

Parameters:
defaultVersionId The identifier for the version of the policy that is set as the default version.
Returns:
A reference to this updated object so that method calls can be chained together.
    public Policy withDefaultVersionId(String defaultVersionId) {
        this. = defaultVersionId;
        return this;
    }

    
The number of entities (users, groups, and roles) that the policy is attached to.

Returns:
The number of entities (users, groups, and roles) that the policy is attached to.
    public Integer getAttachmentCount() {
        return ;
    }
    
    
The number of entities (users, groups, and roles) that the policy is attached to.

Parameters:
attachmentCount The number of entities (users, groups, and roles) that the policy is attached to.
    public void setAttachmentCount(Integer attachmentCount) {
        this. = attachmentCount;
    }
    
    
The number of entities (users, groups, and roles) that the policy is attached to.

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

Parameters:
attachmentCount The number of entities (users, groups, and roles) that the policy is attached to.
Returns:
A reference to this updated object so that method calls can be chained together.
    public Policy withAttachmentCount(Integer attachmentCount) {
        this. = attachmentCount;
        return this;
    }

    
Specifies whether the policy can be attached to an IAM user, group, or role.

Returns:
Specifies whether the policy can be attached to an IAM user, group, or role.
    public Boolean isAttachable() {
        return ;
    }
    
    
Specifies whether the policy can be attached to an IAM user, group, or role.

Parameters:
isAttachable Specifies whether the policy can be attached to an IAM user, group, or role.
    public void setIsAttachable(Boolean isAttachable) {
        this. = isAttachable;
    }
    
    
Specifies whether the policy can be attached to an IAM user, group, or role.

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

Parameters:
isAttachable Specifies whether the policy can be attached to an IAM user, group, or role.
Returns:
A reference to this updated object so that method calls can be chained together.
    public Policy withIsAttachable(Boolean isAttachable) {
        this. = isAttachable;
        return this;
    }

    
Specifies whether the policy can be attached to an IAM user, group, or role.

Returns:
Specifies whether the policy can be attached to an IAM user, group, or role.
    public Boolean getIsAttachable() {
        return ;
    }

    
A friendly description of the policy.

This element is included in the response to the GetPolicy operation. It is not included in the response to the ListPolicies operation.

Constraints:
Length: 0 - 1000

Returns:
A friendly description of the policy.

This element is included in the response to the GetPolicy operation. It is not included in the response to the ListPolicies operation.

    public String getDescription() {
        return ;
    }
    
    
A friendly description of the policy.

This element is included in the response to the GetPolicy operation. It is not included in the response to the ListPolicies operation.

Constraints:
Length: 0 - 1000

Parameters:
description A friendly description of the policy.

This element is included in the response to the GetPolicy operation. It is not included in the response to the ListPolicies operation.

    public void setDescription(String description) {
        this. = description;
    }
    
    
A friendly description of the policy.

This element is included in the response to the GetPolicy operation. It is not included in the response to the ListPolicies operation.

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

Constraints:
Length: 0 - 1000

Parameters:
description A friendly description of the policy.

This element is included in the response to the GetPolicy operation. It is not included in the response to the ListPolicies operation.

Returns:
A reference to this updated object so that method calls can be chained together.
    public Policy withDescription(String description) {
        this. = description;
        return this;
    }

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

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

Parameters:
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;
    }
    
    
The date and time, in ISO 8601 date-time format, when the policy 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 policy was created.
Returns:
A reference to this updated object so that method calls can be chained together.
    public Policy withCreateDate(java.util.Date createDate) {
        this. = 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.

Returns:
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 ;
    }
    
    
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.

Parameters:
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;
    }
    
    
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.

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

Parameters:
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.

Returns:
A reference to this updated object so that method calls can be chained together.
    public Policy withUpdateDate(java.util.Date updateDate) {
        this. = updateDate;
        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 (getPolicyName() != nullsb.append("PolicyName: " + getPolicyName() + ",");
        if (getPolicyId() != nullsb.append("PolicyId: " + getPolicyId() + ",");
        if (getArn() != nullsb.append("Arn: " + getArn() + ",");
        if (getPath() != nullsb.append("Path: " + getPath() + ",");
        if (getDefaultVersionId() != nullsb.append("DefaultVersionId: " + getDefaultVersionId() + ",");
        if (getAttachmentCount() != nullsb.append("AttachmentCount: " + getAttachmentCount() + ",");
        if (isAttachable() != nullsb.append("IsAttachable: " + isAttachable() + ",");
        if (getDescription() != nullsb.append("Description: " + getDescription() + ",");
        if (getCreateDate() != nullsb.append("CreateDate: " + getCreateDate() + ",");
        if (getUpdateDate() != nullsb.append("UpdateDate: " + getUpdateDate() );
        sb.append("}");
        return sb.toString();
    }
    
    @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 + ((isAttachable() == null) ? 0 : isAttachable().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()); 
        return hashCode;
    }
    
    @Override
    public boolean equals(Object obj) {
        if (this == objreturn true;
        if (obj == nullreturn false;
        if (obj instanceof Policy == falsereturn false;
        Policy other = (Policy)obj;
        
        if (other.getPolicyName() == null ^ this.getPolicyName() == nullreturn false;
        if (other.getPolicyName() != null && other.getPolicyName().equals(this.getPolicyName()) == falsereturn false
        if (other.getPolicyId() == null ^ this.getPolicyId() == nullreturn false;
        if (other.getPolicyId() != null && other.getPolicyId().equals(this.getPolicyId()) == falsereturn false
        if (other.getArn() == null ^ this.getArn() == nullreturn false;
        if (other.getArn() != null && other.getArn().equals(this.getArn()) == falsereturn false
        if (other.getPath() == null ^ this.getPath() == nullreturn false;
        if (other.getPath() != null && other.getPath().equals(this.getPath()) == falsereturn false
        if (other.getDefaultVersionId() == null ^ this.getDefaultVersionId() == nullreturn false;
        if (other.getDefaultVersionId() != null && other.getDefaultVersionId().equals(this.getDefaultVersionId()) == falsereturn false
        if (other.getAttachmentCount() == null ^ this.getAttachmentCount() == nullreturn false;
        if (other.getAttachmentCount() != null && other.getAttachmentCount().equals(this.getAttachmentCount()) == falsereturn false
        if (other.isAttachable() == null ^ this.isAttachable() == nullreturn false;
        if (other.isAttachable() != null && other.isAttachable().equals(this.isAttachable()) == falsereturn false
        if (other.getDescription() == null ^ this.getDescription() == nullreturn false;
        if (other.getDescription() != null && other.getDescription().equals(this.getDescription()) == falsereturn false
        if (other.getCreateDate() == null ^ this.getCreateDate() == nullreturn false;
        if (other.getCreateDate() != null && other.getCreateDate().equals(this.getCreateDate()) == falsereturn false
        if (other.getUpdateDate() == null ^ this.getUpdateDate() == nullreturn false;
        if (other.getUpdateDate() != null && other.getUpdateDate().equals(this.getUpdateDate()) == falsereturn false
        return true;
    }
    
    @Override
    public Policy clone() {
        try {
            return (Policysuper.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