software.amazon.awscdk.services.organizations.CfnPolicyProps Maven / Gradle / Ivy
Show all versions of organizations Show documentation
package software.amazon.awscdk.services.organizations;
/**
* Properties for defining a `CfnPolicy`.
*
* Example:
*
*
* // The code below shows an example of how to instantiate this type.
* // The values are placeholders you should change.
* import software.amazon.awscdk.services.organizations.*;
* CfnPolicyProps cfnPolicyProps = CfnPolicyProps.builder()
* .content("content")
* .name("name")
* .type("type")
* // the properties below are optional
* .description("description")
* .tags(List.of(CfnTag.builder()
* .key("key")
* .value("value")
* .build()))
* .targetIds(List.of("targetIds"))
* .build();
*
*/
@javax.annotation.Generated(value = "jsii-pacmak/1.73.0 (build 6faeda3)", date = "2023-01-25T18:28:59.565Z")
@software.amazon.jsii.Jsii(module = software.amazon.awscdk.services.organizations.$Module.class, fqn = "@aws-cdk/aws-organizations.CfnPolicyProps")
@software.amazon.jsii.Jsii.Proxy(CfnPolicyProps.Jsii$Proxy.class)
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Stable)
public interface CfnPolicyProps extends software.amazon.jsii.JsiiSerializable {
/**
* The policy text content.
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Stable)
@org.jetbrains.annotations.NotNull java.lang.String getContent();
/**
* Name of the policy.
*
* The regex pattern that is used to validate this parameter is a string of any of the characters in the ASCII character range.
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Stable)
@org.jetbrains.annotations.NotNull java.lang.String getName();
/**
* The type of policy to create.
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Stable)
@org.jetbrains.annotations.NotNull java.lang.String getType();
/**
* Human readable description of the policy.
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Stable)
default @org.jetbrains.annotations.Nullable java.lang.String getDescription() {
return null;
}
/**
* A list of tags that you want to attach to the newly created policy.
*
* For each tag in the list, you must specify both a tag key and a value. You can set the value to an empty string, but you can't set it to null
. For more information about tagging, see Tagging AWS Organizations resources in the AWS Organizations User Guide.
*
*
*
* If any one of the tags is invalid or if you exceed the allowed number of tags for a policy, then the entire request fails and the policy is not created.
*
*
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Stable)
default @org.jetbrains.annotations.Nullable java.util.List getTags() {
return null;
}
/**
* List of unique identifiers (IDs) of the root, OU, or account that you want to attach the policy to.
*
* You can get the ID by calling the ListRoots , ListOrganizationalUnitsForParent , or ListAccounts operations. If you don't specify this parameter, the policy is created but not attached to any organization resource.
*
* The regex pattern for a target ID string requires one of the following:
*
*
* - Root - A string that begins with "r-" followed by from 4 to 32 lowercase letters or digits.
* - Account - A string that consists of exactly 12 digits.
* - Organizational unit (OU) - A string that begins with "ou-" followed by from 4 to 32 lowercase letters or digits (the ID of the root that the OU is in). This string is followed by a second "-" dash and from 8 to 32 additional lowercase letters or digits.
*
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Stable)
default @org.jetbrains.annotations.Nullable java.util.List getTargetIds() {
return null;
}
/**
* @return a {@link Builder} of {@link CfnPolicyProps}
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Stable)
static Builder builder() {
return new Builder();
}
/**
* A builder for {@link CfnPolicyProps}
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Stable)
public static final class Builder implements software.amazon.jsii.Builder {
java.lang.String content;
java.lang.String name;
java.lang.String type;
java.lang.String description;
java.util.List tags;
java.util.List targetIds;
/**
* Sets the value of {@link CfnPolicyProps#getContent}
* @param content The policy text content. This parameter is required.
* @return {@code this}
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Stable)
public Builder content(java.lang.String content) {
this.content = content;
return this;
}
/**
* Sets the value of {@link CfnPolicyProps#getName}
* @param name Name of the policy. This parameter is required.
* The regex pattern that is used to validate this parameter is a string of any of the characters in the ASCII character range.
* @return {@code this}
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Stable)
public Builder name(java.lang.String name) {
this.name = name;
return this;
}
/**
* Sets the value of {@link CfnPolicyProps#getType}
* @param type The type of policy to create. This parameter is required.
* @return {@code this}
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Stable)
public Builder type(java.lang.String type) {
this.type = type;
return this;
}
/**
* Sets the value of {@link CfnPolicyProps#getDescription}
* @param description Human readable description of the policy.
* @return {@code this}
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Stable)
public Builder description(java.lang.String description) {
this.description = description;
return this;
}
/**
* Sets the value of {@link CfnPolicyProps#getTags}
* @param tags A list of tags that you want to attach to the newly created policy.
* For each tag in the list, you must specify both a tag key and a value. You can set the value to an empty string, but you can't set it to null
. For more information about tagging, see Tagging AWS Organizations resources in the AWS Organizations User Guide.
*
*
*
* If any one of the tags is invalid or if you exceed the allowed number of tags for a policy, then the entire request fails and the policy is not created.
*
*
* @return {@code this}
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Stable)
@SuppressWarnings("unchecked")
public Builder tags(java.util.List extends software.amazon.awscdk.core.CfnTag> tags) {
this.tags = (java.util.List)tags;
return this;
}
/**
* Sets the value of {@link CfnPolicyProps#getTargetIds}
* @param targetIds List of unique identifiers (IDs) of the root, OU, or account that you want to attach the policy to.
* You can get the ID by calling the ListRoots , ListOrganizationalUnitsForParent , or ListAccounts operations. If you don't specify this parameter, the policy is created but not attached to any organization resource.
*
* The regex pattern for a target ID string requires one of the following:
*
*
* - Root - A string that begins with "r-" followed by from 4 to 32 lowercase letters or digits.
* - Account - A string that consists of exactly 12 digits.
* - Organizational unit (OU) - A string that begins with "ou-" followed by from 4 to 32 lowercase letters or digits (the ID of the root that the OU is in). This string is followed by a second "-" dash and from 8 to 32 additional lowercase letters or digits.
*
* @return {@code this}
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Stable)
public Builder targetIds(java.util.List targetIds) {
this.targetIds = targetIds;
return this;
}
/**
* Builds the configured instance.
* @return a new instance of {@link CfnPolicyProps}
* @throws NullPointerException if any required attribute was not provided
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Stable)
@Override
public CfnPolicyProps build() {
return new Jsii$Proxy(this);
}
}
/**
* An implementation for {@link CfnPolicyProps}
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Stable)
@software.amazon.jsii.Internal
final class Jsii$Proxy extends software.amazon.jsii.JsiiObject implements CfnPolicyProps {
private final java.lang.String content;
private final java.lang.String name;
private final java.lang.String type;
private final java.lang.String description;
private final java.util.List tags;
private final java.util.List targetIds;
/**
* Constructor that initializes the object based on values retrieved from the JsiiObject.
* @param objRef Reference to the JSII managed object.
*/
protected Jsii$Proxy(final software.amazon.jsii.JsiiObjectRef objRef) {
super(objRef);
this.content = software.amazon.jsii.Kernel.get(this, "content", software.amazon.jsii.NativeType.forClass(java.lang.String.class));
this.name = software.amazon.jsii.Kernel.get(this, "name", software.amazon.jsii.NativeType.forClass(java.lang.String.class));
this.type = software.amazon.jsii.Kernel.get(this, "type", software.amazon.jsii.NativeType.forClass(java.lang.String.class));
this.description = software.amazon.jsii.Kernel.get(this, "description", software.amazon.jsii.NativeType.forClass(java.lang.String.class));
this.tags = software.amazon.jsii.Kernel.get(this, "tags", software.amazon.jsii.NativeType.listOf(software.amazon.jsii.NativeType.forClass(software.amazon.awscdk.core.CfnTag.class)));
this.targetIds = software.amazon.jsii.Kernel.get(this, "targetIds", software.amazon.jsii.NativeType.listOf(software.amazon.jsii.NativeType.forClass(java.lang.String.class)));
}
/**
* Constructor that initializes the object based on literal property values passed by the {@link Builder}.
*/
@SuppressWarnings("unchecked")
protected Jsii$Proxy(final Builder builder) {
super(software.amazon.jsii.JsiiObject.InitializationMode.JSII);
this.content = java.util.Objects.requireNonNull(builder.content, "content is required");
this.name = java.util.Objects.requireNonNull(builder.name, "name is required");
this.type = java.util.Objects.requireNonNull(builder.type, "type is required");
this.description = builder.description;
this.tags = (java.util.List)builder.tags;
this.targetIds = builder.targetIds;
}
@Override
public final java.lang.String getContent() {
return this.content;
}
@Override
public final java.lang.String getName() {
return this.name;
}
@Override
public final java.lang.String getType() {
return this.type;
}
@Override
public final java.lang.String getDescription() {
return this.description;
}
@Override
public final java.util.List getTags() {
return this.tags;
}
@Override
public final java.util.List getTargetIds() {
return this.targetIds;
}
@Override
@software.amazon.jsii.Internal
public com.fasterxml.jackson.databind.JsonNode $jsii$toJson() {
final com.fasterxml.jackson.databind.ObjectMapper om = software.amazon.jsii.JsiiObjectMapper.INSTANCE;
final com.fasterxml.jackson.databind.node.ObjectNode data = com.fasterxml.jackson.databind.node.JsonNodeFactory.instance.objectNode();
data.set("content", om.valueToTree(this.getContent()));
data.set("name", om.valueToTree(this.getName()));
data.set("type", om.valueToTree(this.getType()));
if (this.getDescription() != null) {
data.set("description", om.valueToTree(this.getDescription()));
}
if (this.getTags() != null) {
data.set("tags", om.valueToTree(this.getTags()));
}
if (this.getTargetIds() != null) {
data.set("targetIds", om.valueToTree(this.getTargetIds()));
}
final com.fasterxml.jackson.databind.node.ObjectNode struct = com.fasterxml.jackson.databind.node.JsonNodeFactory.instance.objectNode();
struct.set("fqn", om.valueToTree("@aws-cdk/aws-organizations.CfnPolicyProps"));
struct.set("data", data);
final com.fasterxml.jackson.databind.node.ObjectNode obj = com.fasterxml.jackson.databind.node.JsonNodeFactory.instance.objectNode();
obj.set("$jsii.struct", struct);
return obj;
}
@Override
public final boolean equals(final Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
CfnPolicyProps.Jsii$Proxy that = (CfnPolicyProps.Jsii$Proxy) o;
if (!content.equals(that.content)) return false;
if (!name.equals(that.name)) return false;
if (!type.equals(that.type)) return false;
if (this.description != null ? !this.description.equals(that.description) : that.description != null) return false;
if (this.tags != null ? !this.tags.equals(that.tags) : that.tags != null) return false;
return this.targetIds != null ? this.targetIds.equals(that.targetIds) : that.targetIds == null;
}
@Override
public final int hashCode() {
int result = this.content.hashCode();
result = 31 * result + (this.name.hashCode());
result = 31 * result + (this.type.hashCode());
result = 31 * result + (this.description != null ? this.description.hashCode() : 0);
result = 31 * result + (this.tags != null ? this.tags.hashCode() : 0);
result = 31 * result + (this.targetIds != null ? this.targetIds.hashCode() : 0);
return result;
}
}
}