Class: AWSCDK::Organizations::CfnPolicyProps

Inherits:
Jsii::Struct
  • Object
show all
Defined in:
organizations/cfn_policy_props.rb

Overview

Properties for defining a CfnPolicy.

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(content:, name:, type:, description: nil, tags: nil, target_ids: nil) ⇒ CfnPolicyProps

Returns a new instance of CfnPolicyProps.

Parameters:

  • content (Object)

    The policy text content. You can specify the policy content as a JSON object or a JSON string.

  • name (String)

    Name of the policy.

  • type (String)

    The type of policy to create.

  • description (String, nil) (defaults to: nil)

    Human readable description of the policy.

  • tags (Array<AWSCDK::CfnTag>, nil) (defaults to: nil)

    A list of tags that you want to attach to the newly created policy.

  • target_ids (Array<String>, nil) (defaults to: nil)

    List of unique identifiers (IDs) of the root, OU, or account that you want to attach the policy to.



15
16
17
18
19
20
21
22
23
24
25
26
27
28
# File 'organizations/cfn_policy_props.rb', line 15

def initialize(content:, name:, type:, description: nil, tags: nil, target_ids: nil)
  @content = content
  Jsii::Type.check_type(@content, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJhbnkifQ==")), "content")
  @name = name
  Jsii::Type.check_type(@name, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJzdHJpbmcifQ==")), "name")
  @type = type
  Jsii::Type.check_type(@type, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJzdHJpbmcifQ==")), "type")
  @description = description
  Jsii::Type.check_type(@description, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJzdHJpbmcifQ==")), "description") unless @description.nil?
  @tags = tags.is_a?(Array) ? tags.map { |jsii_v0| jsii_v0.is_a?(Hash) ? ::AWSCDK::CfnTag.new(**jsii_v0.transform_keys(&:to_sym)) : jsii_v0 } : tags
  Jsii::Type.check_type(@tags, JSON.parse(Base64.strict_decode64("eyJjb2xsZWN0aW9uIjp7ImVsZW1lbnR0eXBlIjp7ImZxbiI6ImF3cy1jZGstbGliLkNmblRhZyJ9LCJraW5kIjoiYXJyYXkifX0=")), "tags") unless @tags.nil?
  @target_ids = target_ids
  Jsii::Type.check_type(@target_ids, JSON.parse(Base64.strict_decode64("eyJjb2xsZWN0aW9uIjp7ImVsZW1lbnR0eXBlIjp7InByaW1pdGl2ZSI6InN0cmluZyJ9LCJraW5kIjoiYXJyYXkifX0=")), "targetIds") unless @target_ids.nil?
end

Instance Attribute Details

#contentObject (readonly)

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 characters
  • Resource control policies: 5,120 characters
  • Declarative policies: 10,000 characters
  • Backup policies: 10,000 characters
  • Tag policies: 10,000 characters
  • Chat applications policies: 10,000 characters
  • AI services opt-out policies: 2,500 characters
  • Security Hub policies: 10,000 characters
  • Amazon Inspector policies: 10,000 characters
  • Amazon Bedrock policies: 10,000 characters
  • Upgrade rollout policies: 10,000 characters

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



52
53
54
# File 'organizations/cfn_policy_props.rb', line 52

def content
  @content
end

#descriptionString? (readonly)

Human readable description of the policy.



69
70
71
# File 'organizations/cfn_policy_props.rb', line 69

def description
  @description
end

#nameString (readonly)

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.



59
60
61
# File 'organizations/cfn_policy_props.rb', line 59

def name
  @name
end

#tagsArray<AWSCDK::CfnTag>? (readonly)

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.



78
79
80
# File 'organizations/cfn_policy_props.rb', line 78

def tags
  @tags
end

#target_idsArray<String>? (readonly)

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.


91
92
93
# File 'organizations/cfn_policy_props.rb', line 91

def target_ids
  @target_ids
end

#typeString (readonly)

The type of policy to create.



64
65
66
# File 'organizations/cfn_policy_props.rb', line 64

def type
  @type
end

Class Method Details

.jsii_propertiesObject



93
94
95
96
97
98
99
100
101
102
# File 'organizations/cfn_policy_props.rb', line 93

def self.jsii_properties
  {
    :content => "content",
    :name => "name",
    :type => "type",
    :description => "description",
    :tags => "tags",
    :target_ids => "targetIds",
  }
end

Instance Method Details

#to_jsiiObject



104
105
106
107
108
109
110
111
112
113
114
115
# File 'organizations/cfn_policy_props.rb', line 104

def to_jsii
  result = {}
  result.merge!({
    "content" => @content,
    "name" => @name,
    "type" => @type,
    "description" => @description,
    "tags" => @tags,
    "targetIds" => @target_ids,
  })
  result.compact
end