Class CfnPolicy.Builder

java.lang.Object
software.amazon.awscdk.services.organizations.CfnPolicy.Builder
All Implemented Interfaces:
software.amazon.jsii.Builder<CfnPolicy>
Enclosing class:
CfnPolicy

@Stability(Stable) public static final class CfnPolicy.Builder extends Object implements software.amazon.jsii.Builder<CfnPolicy>
A fluent builder for CfnPolicy.
  • Method Details

    • create

      @Stability(Stable) public static CfnPolicy.Builder create(Construct scope, String id)
      Parameters:
      scope -
      • scope in which this resource is defined.
      This parameter is required.
      id -
      • scoped id of the resource.
      This parameter is required.
      Returns:
      a new instance of CfnPolicy.Builder.
    • content

      @Stability(Stable) public CfnPolicy.Builder content(Object content)
      The policy text content. You can specify the policy content as a JSON object or a JSON string.

      When you specify the policy content as a JSON string, you can't perform drift detection on the CloudFormation stack. For this reason, we recommend specifying the policy content as a JSON object instead.

      The text that you supply must adhere to the rules of the policy type you specify in the Type parameter. The following AWS Organizations quotas are enforced for the maximum size of a policy document:

      • Service control policies: 5,120 bytes (not characters)
      • AI services opt-out policies: 2,500 characters
      • Backup policies: 10,000 characters
      • Tag policies: 10,000 characters

      For more information about Organizations service quotas, see Quotas for AWS Organizations in the AWS Organizations User Guide .

      Parameters:
      content - The policy text content. You can specify the policy content as a JSON object or a JSON string. This parameter is required.
      Returns:
      this
    • name

      @Stability(Stable) public CfnPolicy.Builder name(String name)
      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.

      Parameters:
      name - Name of the policy. This parameter is required.
      Returns:
      this
    • type

      @Stability(Stable) public CfnPolicy.Builder type(String type)
      The type of policy to create.

      Parameters:
      type - The type of policy to create. This parameter is required.
      Returns:
      this
    • description

      @Stability(Stable) public CfnPolicy.Builder description(String description)
      Human readable description of the policy.

      Parameters:
      description - Human readable description of the policy. This parameter is required.
      Returns:
      this
    • tags

      @Stability(Stable) public CfnPolicy.Builder tags(List<? extends CfnTag> 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 not valid or if you exceed the allowed number of tags for a policy, then the entire request fails and the policy is not created.

      Parameters:
      tags - A list of tags that you want to attach to the newly created policy. This parameter is required.
      Returns:
      this
    • targetIds

      @Stability(Stable) public CfnPolicy.Builder targetIds(List<String> 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.

      Parameters:
      targetIds - List of unique identifiers (IDs) of the root, OU, or account that you want to attach the policy to. This parameter is required.
      Returns:
      this
    • build

      @Stability(Stable) public CfnPolicy build()
      Specified by:
      build in interface software.amazon.jsii.Builder<CfnPolicy>
      Returns:
      a newly built instance of CfnPolicy.