Class: AWSCDK::IAM::CfnManagedPolicyProps

Inherits:
Jsii::Struct
  • Object
show all
Defined in:
iam/cfn_managed_policy_props.rb

Overview

Properties for defining a CfnManagedPolicy.

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(policy_document:, description: nil, groups: nil, managed_policy_name: nil, path: nil, roles: nil, users: nil) ⇒ CfnManagedPolicyProps

Returns a new instance of CfnManagedPolicyProps.

Parameters:

  • policy_document (Object)

    The JSON policy document that you want to use as the content for the new policy.

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

    A friendly description of the policy.

  • groups (Array<String, AWSCDK::Interfaces::AWSIAM::IGroupRef>, nil) (defaults to: nil)

    The name (friendly name, not ARN) of the group to attach the policy to.

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

    The friendly name of the policy.

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

    The path for the policy.

  • roles (Array<String, AWSCDK::Interfaces::AWSIAM::IRoleRef>, nil) (defaults to: nil)

    The name (friendly name, not ARN) of the role to attach the policy to.

  • users (Array<String, AWSCDK::Interfaces::AWSIAM::IUserRef>, nil) (defaults to: nil)

    The name (friendly name, not ARN) of the IAM user to attach the policy to.



16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
# File 'iam/cfn_managed_policy_props.rb', line 16

def initialize(policy_document:, description: nil, groups: nil, managed_policy_name: nil, path: nil, roles: nil, users: nil)
  @policy_document = policy_document
  Jsii::Type.check_type(@policy_document, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJhbnkifQ==")), "policyDocument")
  @description = description
  Jsii::Type.check_type(@description, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJzdHJpbmcifQ==")), "description") unless @description.nil?
  @groups = groups
  Jsii::Type.check_type(@groups, JSON.parse(Base64.strict_decode64("eyJjb2xsZWN0aW9uIjp7ImVsZW1lbnR0eXBlIjp7InVuaW9uIjp7InR5cGVzIjpbeyJwcmltaXRpdmUiOiJzdHJpbmcifSx7ImZxbiI6ImF3cy1jZGstbGliLmludGVyZmFjZXMuYXdzX2lhbS5JR3JvdXBSZWYifV19fSwia2luZCI6ImFycmF5In19")), "groups") unless @groups.nil?
  @managed_policy_name = managed_policy_name
  Jsii::Type.check_type(@managed_policy_name, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJzdHJpbmcifQ==")), "managedPolicyName") unless @managed_policy_name.nil?
  @path = path
  Jsii::Type.check_type(@path, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJzdHJpbmcifQ==")), "path") unless @path.nil?
  @roles = roles
  Jsii::Type.check_type(@roles, JSON.parse(Base64.strict_decode64("eyJjb2xsZWN0aW9uIjp7ImVsZW1lbnR0eXBlIjp7InVuaW9uIjp7InR5cGVzIjpbeyJwcmltaXRpdmUiOiJzdHJpbmcifSx7ImZxbiI6ImF3cy1jZGstbGliLmludGVyZmFjZXMuYXdzX2lhbS5JUm9sZVJlZiJ9XX19LCJraW5kIjoiYXJyYXkifX0=")), "roles") unless @roles.nil?
  @users = users
  Jsii::Type.check_type(@users, JSON.parse(Base64.strict_decode64("eyJjb2xsZWN0aW9uIjp7ImVsZW1lbnR0eXBlIjp7InVuaW9uIjp7InR5cGVzIjpbeyJwcmltaXRpdmUiOiJzdHJpbmcifSx7ImZxbiI6ImF3cy1jZGstbGliLmludGVyZmFjZXMuYXdzX2lhbS5JVXNlclJlZiJ9XX19LCJraW5kIjoiYXJyYXkifX0=")), "users") unless @users.nil?
end

Instance Attribute Details

#descriptionString? (readonly)

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.



58
59
60
# File 'iam/cfn_managed_policy_props.rb', line 58

def description
  @description
end

#groupsArray<String, AWSCDK::Interfaces::AWSIAM::IGroupRef>? (readonly)

The name (friendly name, not ARN) of the group to attach the policy to.

This parameter allows (through its regex pattern ) a string of characters consisting of upper and lowercase alphanumeric characters with no spaces. You can also include any of the following characters: _+=,.@-



65
66
67
# File 'iam/cfn_managed_policy_props.rb', line 65

def groups
  @groups
end

#managed_policy_nameString? (readonly)

The friendly name of the policy.

If you specify a name, you cannot perform updates that require replacement of this resource. You can perform updates that require no or some interruption. If you must replace the resource, specify a new name.

If you specify a name, you must specify the CAPABILITY_NAMED_IAM value to acknowledge your template's capabilities. For more information, see Acknowledging IAM Resources in CloudFormation Templates .

Naming an IAM resource can cause an unrecoverable error if you reuse the same template in multiple Regions. To prevent this, we recommend using Fn::Join and AWS::Region to create a Region-specific name, as in the following example: {"Fn::Join": ["", [{"Ref": "AWS::Region"}, {"Ref": "MyResourceName"}]]} .



76
77
78
# File 'iam/cfn_managed_policy_props.rb', line 76

def managed_policy_name
  @managed_policy_name
end

#pathString? (readonly)

Note:

Default: - "/"

The path for the policy.

For more information about paths, see IAM identifiers in the IAM User Guide .

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

This parameter allows (through its regex pattern ) a string of characters consisting of either a forward slash (/) by itself or a string that must begin and end with forward slashes. In addition, it can contain any ASCII character from the ! ( \u0021 ) through the DEL character ( \u007F ), including most punctuation characters, digits, and upper and lowercased letters.

You cannot use an asterisk (*) in the path name.



90
91
92
# File 'iam/cfn_managed_policy_props.rb', line 90

def path
  @path
end

#policy_documentObject (readonly)

The JSON policy document that you want to use as the content for the new 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 AWS STS character quotas .

To learn more about JSON policy grammar, see Grammar of the IAM JSON policy language in the IAM User Guide .

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 )


49
50
51
# File 'iam/cfn_managed_policy_props.rb', line 49

def policy_document
  @policy_document
end

#rolesArray<String, AWSCDK::Interfaces::AWSIAM::IRoleRef>? (readonly)

The name (friendly name, not ARN) of the role to attach the policy to.

This parameter allows (per its regex pattern ) a string of characters consisting of upper and lowercase alphanumeric characters with no spaces. You can also include any of the following characters: _+=,.@-

If an external policy (such as AWS::IAM::Policy or AWS::IAM::ManagedPolicy ) has a Ref to a role and if a resource (such as AWS::ECS::Service ) also has a Ref to the same role, add a DependsOn attribute to the resource to make the resource depend on the external policy. This dependency ensures that the role's policy is available throughout the resource's lifecycle. For example, when you delete a stack with an AWS::ECS::Service resource, the DependsOn attribute ensures that CloudFormation deletes the AWS::ECS::Service resource before deleting its role's policy.



99
100
101
# File 'iam/cfn_managed_policy_props.rb', line 99

def roles
  @roles
end

#usersArray<String, AWSCDK::Interfaces::AWSIAM::IUserRef>? (readonly)

The name (friendly name, not ARN) of the IAM user to attach the policy to.

This parameter allows (through its regex pattern ) a string of characters consisting of upper and lowercase alphanumeric characters with no spaces. You can also include any of the following characters: _+=,.@-



106
107
108
# File 'iam/cfn_managed_policy_props.rb', line 106

def users
  @users
end

Class Method Details

.jsii_propertiesObject



108
109
110
111
112
113
114
115
116
117
118
# File 'iam/cfn_managed_policy_props.rb', line 108

def self.jsii_properties
  {
    :policy_document => "policyDocument",
    :description => "description",
    :groups => "groups",
    :managed_policy_name => "managedPolicyName",
    :path => "path",
    :roles => "roles",
    :users => "users",
  }
end

Instance Method Details

#to_jsiiObject



120
121
122
123
124
125
126
127
128
129
130
131
132
# File 'iam/cfn_managed_policy_props.rb', line 120

def to_jsii
  result = {}
  result.merge!({
    "policyDocument" => @policy_document,
    "description" => @description,
    "groups" => @groups,
    "managedPolicyName" => @managed_policy_name,
    "path" => @path,
    "roles" => @roles,
    "users" => @users,
  })
  result.compact
end