com.amazonaws.services.identitymanagement.model.CreatePolicyVersionRequest Maven / Gradle / Ivy
Show all versions of aws-java-sdk-iam Show documentation
/*
* Copyright 2020-2025 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;
import javax.annotation.Generated;
import com.amazonaws.AmazonWebServiceRequest;
/**
*
* @see AWS API
* Documentation
*/
@Generated("com.amazonaws:aws-java-sdk-code-generator")
public class CreatePolicyVersionRequest extends com.amazonaws.AmazonWebServiceRequest implements Serializable, Cloneable {
/**
*
* The Amazon Resource Name (ARN) of the IAM policy to which you want to add a new version.
*
*
* For more information about ARNs, see Amazon Resource Names
* (ARNs) in the Amazon Web Services General Reference.
*
*/
private String policyArn;
/**
*
* The JSON policy document that you want to use as the content for this new version of the policy.
*
*
* You must provide policies in JSON format in IAM. However, for CloudFormation templates formatted in YAML, you can
* provide the policy in JSON or YAML format. CloudFormation always converts a YAML policy to JSON format before
* submitting it to IAM.
*
*
* The maximum length of the policy document that you can pass in this operation, including whitespace, is listed
* below. To view the maximum character counts of a managed policy with no whitespaces, see IAM and STS character quotas.
*
*
* The regex pattern used to validate this parameter is a string of
* characters consisting of the following:
*
*
* -
*
* Any printable ASCII character ranging from the space character (\u0020) through the end of the ASCII
* character range
*
*
* -
*
* The printable characters in the Basic Latin and Latin-1 Supplement character set (through \u00FF)
*
*
* -
*
* The special characters tab (\u0009), line feed (\u000A), and carriage return (\u000D
* )
*
*
*
*/
private String policyDocument;
/**
*
* Specifies whether to set this version as the policy's default version.
*
*
* When this parameter is true, the new policy version becomes the operative version. That is, it
* becomes the version that is in effect for the IAM users, groups, and roles that the policy is attached to.
*
*
* For more information about managed policy versions, see Versioning for managed
* policies in the IAM User Guide.
*
*/
private Boolean setAsDefault;
/**
*
* The Amazon Resource Name (ARN) of the IAM policy to which you want to add a new version.
*
*
* For more information about ARNs, see Amazon Resource Names
* (ARNs) in the Amazon Web Services General Reference.
*
*
* @param policyArn
* The Amazon Resource Name (ARN) of the IAM policy to which you want to add a new version.
*
* For more information about ARNs, see Amazon Resource Names
* (ARNs) in the Amazon Web Services General Reference.
*/
public void setPolicyArn(String policyArn) {
this.policyArn = policyArn;
}
/**
*
* The Amazon Resource Name (ARN) of the IAM policy to which you want to add a new version.
*
*
* For more information about ARNs, see Amazon Resource Names
* (ARNs) in the Amazon Web Services General Reference.
*
*
* @return The Amazon Resource Name (ARN) of the IAM policy to which you want to add a new version.
*
* For more information about ARNs, see Amazon Resource Names
* (ARNs) in the Amazon Web Services General Reference.
*/
public String getPolicyArn() {
return this.policyArn;
}
/**
*
* The Amazon Resource Name (ARN) of the IAM policy to which you want to add a new version.
*
*
* For more information about ARNs, see Amazon Resource Names
* (ARNs) in the Amazon Web Services General Reference.
*
*
* @param policyArn
* The Amazon Resource Name (ARN) of the IAM policy to which you want to add a new version.
*
* For more information about ARNs, see Amazon Resource Names
* (ARNs) in the Amazon Web Services General Reference.
* @return Returns a reference to this object so that method calls can be chained together.
*/
public CreatePolicyVersionRequest withPolicyArn(String policyArn) {
setPolicyArn(policyArn);
return this;
}
/**
*
* The JSON policy document that you want to use as the content for this new version of the policy.
*
*
* You must provide policies in JSON format in IAM. However, for CloudFormation templates formatted in YAML, you can
* provide the policy in JSON or YAML format. CloudFormation always converts a YAML policy to JSON format before
* submitting it to IAM.
*
*
* The maximum length of the policy document that you can pass in this operation, including whitespace, is listed
* below. To view the maximum character counts of a managed policy with no whitespaces, see IAM and STS character quotas.
*
*
* The regex pattern used to validate this parameter is a string of
* characters consisting of the following:
*
*
* -
*
* Any printable ASCII character ranging from the space character (\u0020) through the end of the ASCII
* character range
*
*
* -
*
* The printable characters in the Basic Latin and Latin-1 Supplement character set (through \u00FF)
*
*
* -
*
* The special characters tab (\u0009), line feed (\u000A), and carriage return (\u000D
* )
*
*
*
*
* @param policyDocument
* The JSON policy document that you want to use as the content for this new version of the policy.
*
* You must provide policies in JSON format in IAM. However, for CloudFormation templates formatted in YAML,
* you can provide the policy in JSON or YAML format. CloudFormation always converts a YAML policy to JSON
* format before submitting it to IAM.
*
*
* The maximum length of the policy document that you can pass in this operation, including whitespace, is
* listed below. To view the maximum character counts of a managed policy with no whitespaces, see IAM and STS character quotas.
*
*
* The regex pattern used to validate this parameter is a
* string of characters consisting of the following:
*
*
* -
*
* Any printable ASCII character ranging from the space character (\u0020) through the end of
* the ASCII character range
*
*
* -
*
* The printable characters in the Basic Latin and Latin-1 Supplement character set (through
* \u00FF)
*
*
* -
*
* The special characters tab (\u0009), line feed (\u000A), and carriage return (
* \u000D)
*
*
*/
public void setPolicyDocument(String policyDocument) {
this.policyDocument = policyDocument;
}
/**
*
* The JSON policy document that you want to use as the content for this new version of the policy.
*
*
* You must provide policies in JSON format in IAM. However, for CloudFormation templates formatted in YAML, you can
* provide the policy in JSON or YAML format. CloudFormation always converts a YAML policy to JSON format before
* submitting it to IAM.
*
*
* The maximum length of the policy document that you can pass in this operation, including whitespace, is listed
* below. To view the maximum character counts of a managed policy with no whitespaces, see IAM and STS character quotas.
*
*
* The regex pattern used to validate this parameter is a string of
* characters consisting of the following:
*
*
* -
*
* Any printable ASCII character ranging from the space character (\u0020) through the end of the ASCII
* character range
*
*
* -
*
* The printable characters in the Basic Latin and Latin-1 Supplement character set (through \u00FF)
*
*
* -
*
* The special characters tab (\u0009), line feed (\u000A), and carriage return (\u000D
* )
*
*
*
*
* @return The JSON policy document that you want to use as the content for this new version of the policy.
*
* You must provide policies in JSON format in IAM. However, for CloudFormation templates formatted in YAML,
* you can provide the policy in JSON or YAML format. CloudFormation always converts a YAML policy to JSON
* format before submitting it to IAM.
*
*
* The maximum length of the policy document that you can pass in this operation, including whitespace, is
* listed below. To view the maximum character counts of a managed policy with no whitespaces, see IAM and STS character quotas.
*
*
* The regex pattern used to validate this parameter is a
* string of characters consisting of the following:
*
*
* -
*
* Any printable ASCII character ranging from the space character (\u0020) through the end of
* the ASCII character range
*
*
* -
*
* The printable characters in the Basic Latin and Latin-1 Supplement character set (through
* \u00FF)
*
*
* -
*
* The special characters tab (\u0009), line feed (\u000A), and carriage return (
* \u000D)
*
*
*/
public String getPolicyDocument() {
return this.policyDocument;
}
/**
*
* The JSON policy document that you want to use as the content for this new version of the policy.
*
*
* You must provide policies in JSON format in IAM. However, for CloudFormation templates formatted in YAML, you can
* provide the policy in JSON or YAML format. CloudFormation always converts a YAML policy to JSON format before
* submitting it to IAM.
*
*
* The maximum length of the policy document that you can pass in this operation, including whitespace, is listed
* below. To view the maximum character counts of a managed policy with no whitespaces, see IAM and STS character quotas.
*
*
* The regex pattern used to validate this parameter is a string of
* characters consisting of the following:
*
*
* -
*
* Any printable ASCII character ranging from the space character (\u0020) through the end of the ASCII
* character range
*
*
* -
*
* The printable characters in the Basic Latin and Latin-1 Supplement character set (through \u00FF)
*
*
* -
*
* The special characters tab (\u0009), line feed (\u000A), and carriage return (\u000D
* )
*
*
*
*
* @param policyDocument
* The JSON policy document that you want to use as the content for this new version of the policy.
*
* You must provide policies in JSON format in IAM. However, for CloudFormation templates formatted in YAML,
* you can provide the policy in JSON or YAML format. CloudFormation always converts a YAML policy to JSON
* format before submitting it to IAM.
*
*
* The maximum length of the policy document that you can pass in this operation, including whitespace, is
* listed below. To view the maximum character counts of a managed policy with no whitespaces, see IAM and STS character quotas.
*
*
* The regex pattern used to validate this parameter is a
* string of characters consisting of the following:
*
*
* -
*
* Any printable ASCII character ranging from the space character (\u0020) through the end of
* the ASCII character range
*
*
* -
*
* The printable characters in the Basic Latin and Latin-1 Supplement character set (through
* \u00FF)
*
*
* -
*
* The special characters tab (\u0009), line feed (\u000A), and carriage return (
* \u000D)
*
*
* @return Returns a reference to this object so that method calls can be chained together.
*/
public CreatePolicyVersionRequest withPolicyDocument(String policyDocument) {
setPolicyDocument(policyDocument);
return this;
}
/**
*
* Specifies whether to set this version as the policy's default version.
*
*
* When this parameter is true, the new policy version becomes the operative version. That is, it
* becomes the version that is in effect for the IAM users, groups, and roles that the policy is attached to.
*
*
* For more information about managed policy versions, see Versioning for managed
* policies in the IAM User Guide.
*
*
* @param setAsDefault
* Specifies whether to set this version as the policy's default version.
*
* When this parameter is true, the new policy version becomes the operative version. That is,
* it becomes the version that is in effect for the IAM users, groups, and roles that the policy is attached
* to.
*
*
* For more information about managed policy versions, see Versioning for
* managed policies in the IAM User Guide.
*/
public void setSetAsDefault(Boolean setAsDefault) {
this.setAsDefault = setAsDefault;
}
/**
*
* Specifies whether to set this version as the policy's default version.
*
*
* When this parameter is true, the new policy version becomes the operative version. That is, it
* becomes the version that is in effect for the IAM users, groups, and roles that the policy is attached to.
*
*
* For more information about managed policy versions, see Versioning for managed
* policies in the IAM User Guide.
*
*
* @return Specifies whether to set this version as the policy's default version.
*
* When this parameter is true, the new policy version becomes the operative version. That is,
* it becomes the version that is in effect for the IAM users, groups, and roles that the policy is attached
* to.
*
*
* For more information about managed policy versions, see Versioning for
* managed policies in the IAM User Guide.
*/
public Boolean getSetAsDefault() {
return this.setAsDefault;
}
/**
*
* Specifies whether to set this version as the policy's default version.
*
*
* When this parameter is true, the new policy version becomes the operative version. That is, it
* becomes the version that is in effect for the IAM users, groups, and roles that the policy is attached to.
*
*
* For more information about managed policy versions, see Versioning for managed
* policies in the IAM User Guide.
*
*
* @param setAsDefault
* Specifies whether to set this version as the policy's default version.
*
* When this parameter is true, the new policy version becomes the operative version. That is,
* it becomes the version that is in effect for the IAM users, groups, and roles that the policy is attached
* to.
*
*
* For more information about managed policy versions, see Versioning for
* managed policies in the IAM User Guide.
* @return Returns a reference to this object so that method calls can be chained together.
*/
public CreatePolicyVersionRequest withSetAsDefault(Boolean setAsDefault) {
setSetAsDefault(setAsDefault);
return this;
}
/**
*
* Specifies whether to set this version as the policy's default version.
*
*
* When this parameter is true, the new policy version becomes the operative version. That is, it
* becomes the version that is in effect for the IAM users, groups, and roles that the policy is attached to.
*
*
* For more information about managed policy versions, see Versioning for managed
* policies in the IAM User Guide.
*
*
* @return Specifies whether to set this version as the policy's default version.
*
* When this parameter is true, the new policy version becomes the operative version. That is,
* it becomes the version that is in effect for the IAM users, groups, and roles that the policy is attached
* to.
*
*
* For more information about managed policy versions, see Versioning for
* managed policies in the IAM User Guide.
*/
public Boolean isSetAsDefault() {
return this.setAsDefault;
}
/**
* 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 (getPolicyArn() != null)
sb.append("PolicyArn: ").append(getPolicyArn()).append(",");
if (getPolicyDocument() != null)
sb.append("PolicyDocument: ").append(getPolicyDocument()).append(",");
if (getSetAsDefault() != null)
sb.append("SetAsDefault: ").append(getSetAsDefault());
sb.append("}");
return sb.toString();
}
@Override
public boolean equals(Object obj) {
if (this == obj)
return true;
if (obj == null)
return false;
if (obj instanceof CreatePolicyVersionRequest == false)
return false;
CreatePolicyVersionRequest other = (CreatePolicyVersionRequest) obj;
if (other.getPolicyArn() == null ^ this.getPolicyArn() == null)
return false;
if (other.getPolicyArn() != null && other.getPolicyArn().equals(this.getPolicyArn()) == false)
return false;
if (other.getPolicyDocument() == null ^ this.getPolicyDocument() == null)
return false;
if (other.getPolicyDocument() != null && other.getPolicyDocument().equals(this.getPolicyDocument()) == false)
return false;
if (other.getSetAsDefault() == null ^ this.getSetAsDefault() == null)
return false;
if (other.getSetAsDefault() != null && other.getSetAsDefault().equals(this.getSetAsDefault()) == false)
return false;
return true;
}
@Override
public int hashCode() {
final int prime = 31;
int hashCode = 1;
hashCode = prime * hashCode + ((getPolicyArn() == null) ? 0 : getPolicyArn().hashCode());
hashCode = prime * hashCode + ((getPolicyDocument() == null) ? 0 : getPolicyDocument().hashCode());
hashCode = prime * hashCode + ((getSetAsDefault() == null) ? 0 : getSetAsDefault().hashCode());
return hashCode;
}
@Override
public CreatePolicyVersionRequest clone() {
return (CreatePolicyVersionRequest) super.clone();
}
}