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;
 
 
Container for the parameters to the CreatePolicy operation.

Creates a new managed policy for your AWS account.

This operation creates a policy version with a version identifier of v1 and sets v1 as the policy's default version. For more information about policy versions, see Versioning for Managed Policies in the Using IAM guide.

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

 
 public class CreatePolicyRequest extends AmazonWebServiceRequest implements SerializableCloneable {

    
The name of the policy document.

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

 
     private String policyName;

    
The path for the policy.

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

This parameter is optional. If it is not included, it defaults to a slash (/).

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

 
     private String path;

    
The policy document.

The policy must be URL-encoded according to RFC 3986.

Constraints:
Length: 1 - 131072
Pattern: [\u0009\u000A\u000D\u0020-\u00FF]+

 
     private String policyDocument;

    
A friendly description of the policy.

Typically used to store information about the permissions defined in the policy. For example, "Grants access to production DynamoDB tables."

The policy description is immutable. After a value is assigned, it cannot be changed.

Constraints:
Length: 0 - 1000

 
     private String description;

    
The name of the policy document.

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

Returns:
The name of the policy document.
 
     public String getPolicyName() {
         return ;
     }
    
    
The name of the policy document.

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

Parameters:
policyName The name of the policy document.
    public void setPolicyName(String policyName) {
        this. = policyName;
    }
    
    
The name of the policy document.

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

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

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

    
The path for the policy.

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

This parameter is optional. If it is not included, it defaults to a slash (/).

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

Returns:
The path for the policy.

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

This parameter is optional. If it is not included, it defaults to a slash (/).

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

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

This parameter is optional. If it is not included, it defaults to a slash (/).

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

Parameters:
path The path for the policy.

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

This parameter is optional. If it is not included, it defaults to a slash (/).

    public void setPath(String path) {
        this. = path;
    }
    
    
The path for the policy.

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

This parameter is optional. If it is not included, it defaults to a slash (/).

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

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

Parameters:
path The path for the policy.

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

This parameter is optional. If it is not included, it defaults to a slash (/).

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

    
The policy document.

The policy must be URL-encoded according to RFC 3986.

Constraints:
Length: 1 - 131072
Pattern: [\u0009\u000A\u000D\u0020-\u00FF]+

Returns:
The policy document.

The policy must be URL-encoded according to RFC 3986.

    public String getPolicyDocument() {
        return ;
    }
    
    
The policy document.

The policy must be URL-encoded according to RFC 3986.

Constraints:
Length: 1 - 131072
Pattern: [\u0009\u000A\u000D\u0020-\u00FF]+

Parameters:
policyDocument The policy document.

The policy must be URL-encoded according to RFC 3986.

    public void setPolicyDocument(String policyDocument) {
        this. = policyDocument;
    }
    
    
The policy document.

The policy must be URL-encoded according to RFC 3986.

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

Constraints:
Length: 1 - 131072
Pattern: [\u0009\u000A\u000D\u0020-\u00FF]+

Parameters:
policyDocument The policy document.

The policy must be URL-encoded according to RFC 3986.

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

    
A friendly description of the policy.

Typically used to store information about the permissions defined in the policy. For example, "Grants access to production DynamoDB tables."

The policy description is immutable. After a value is assigned, it cannot be changed.

Constraints:
Length: 0 - 1000

Returns:
A friendly description of the policy.

Typically used to store information about the permissions defined in the policy. For example, "Grants access to production DynamoDB tables."

The policy description is immutable. After a value is assigned, it cannot be changed.

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

Typically used to store information about the permissions defined in the policy. For example, "Grants access to production DynamoDB tables."

The policy description is immutable. After a value is assigned, it cannot be changed.

Constraints:
Length: 0 - 1000

Parameters:
description A friendly description of the policy.

Typically used to store information about the permissions defined in the policy. For example, "Grants access to production DynamoDB tables."

The policy description is immutable. After a value is assigned, it cannot be changed.

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

Typically used to store information about the permissions defined in the policy. For example, "Grants access to production DynamoDB tables."

The policy description is immutable. After a value is assigned, it cannot be changed.

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.

Typically used to store information about the permissions defined in the policy. For example, "Grants access to production DynamoDB tables."

The policy description is immutable. After a value is assigned, it cannot be changed.

Returns:
A reference to this updated object so that method calls can be chained together.
    public CreatePolicyRequest withDescription(String description) {
        this. = description;
        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 (getPath() != nullsb.append("Path: " + getPath() + ",");
        if (getPolicyDocument() != nullsb.append("PolicyDocument: " + getPolicyDocument() + ",");
        if (getDescription() != nullsb.append("Description: " + getDescription() );
        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 + ((getPath() == null) ? 0 : getPath().hashCode()); 
        hashCode = prime * hashCode + ((getPolicyDocument() == null) ? 0 : getPolicyDocument().hashCode()); 
        hashCode = prime * hashCode + ((getDescription() == null) ? 0 : getDescription().hashCode()); 
        return hashCode;
    }
    
    @Override
    public boolean equals(Object obj) {
        if (this == objreturn true;
        if (obj == nullreturn false;
        if (obj instanceof CreatePolicyRequest == falsereturn false;
        CreatePolicyRequest other = (CreatePolicyRequest)obj;
        
        if (other.getPolicyName() == null ^ this.getPolicyName() == nullreturn false;
        if (other.getPolicyName() != null && other.getPolicyName().equals(this.getPolicyName()) == falsereturn false
        if (other.getPath() == null ^ this.getPath() == nullreturn false;
        if (other.getPath() != null && other.getPath().equals(this.getPath()) == falsereturn false
        if (other.getPolicyDocument() == null ^ this.getPolicyDocument() == nullreturn false;
        if (other.getPolicyDocument() != null && other.getPolicyDocument().equals(this.getPolicyDocument()) == falsereturn false
        if (other.getDescription() == null ^ this.getDescription() == nullreturn false;
        if (other.getDescription() != null && other.getDescription().equals(this.getDescription()) == falsereturn false
        return true;
    }
    
    @Override
    public CreatePolicyRequest clone() {
        
            return (CreatePolicyRequestsuper.clone();
    }
}
    
New to GrepCode? Check out our FAQ X