Class: AWSCDK::IAM::PolicyProps
- Inherits:
-
Jsii::Struct
- Object
- Jsii::Struct
- AWSCDK::IAM::PolicyProps
- Defined in:
- iam/policy_props.rb
Overview
Properties for defining an IAM inline policy document.
Instance Attribute Summary collapse
-
#document ⇒ AWSCDK::IAM::PolicyDocument?
readonly
Initial PolicyDocument to use for this Policy.
-
#force ⇒ Boolean?
readonly
Force creation of an
AWS::IAM::Policy. -
#groups ⇒ Array<AWSCDK::IAM::IGroup>?
readonly
Groups to attach this policy to.
-
#policy_name ⇒ String?
readonly
The name of the policy.
-
#roles ⇒ Array<AWSCDK::IAM::IRole>?
readonly
Roles to attach this policy to.
-
#statements ⇒ Array<AWSCDK::IAM::PolicyStatement>?
readonly
Initial set of permissions to add to this policy document.
-
#users ⇒ Array<AWSCDK::IAM::IUser>?
readonly
Users to attach this policy to.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(document: nil, force: nil, groups: nil, policy_name: nil, roles: nil, statements: nil, users: nil) ⇒ PolicyProps
constructor
A new instance of PolicyProps.
- #to_jsii ⇒ Object
Constructor Details
#initialize(document: nil, force: nil, groups: nil, policy_name: nil, roles: nil, statements: nil, users: nil) ⇒ PolicyProps
Returns a new instance of PolicyProps.
14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 |
# File 'iam/policy_props.rb', line 14 def initialize(document: nil, force: nil, groups: nil, policy_name: nil, roles: nil, statements: nil, users: nil) @document = document Jsii::Type.check_type(@document, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5hd3NfaWFtLlBvbGljeURvY3VtZW50In0=")), "document") unless @document.nil? @force = force Jsii::Type.check_type(@force, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJib29sZWFuIn0=")), "force") unless @force.nil? @groups = groups Jsii::Type.check_type(@groups, JSON.parse(Base64.strict_decode64("eyJjb2xsZWN0aW9uIjp7ImVsZW1lbnR0eXBlIjp7ImZxbiI6ImF3cy1jZGstbGliLmF3c19pYW0uSUdyb3VwIn0sImtpbmQiOiJhcnJheSJ9fQ==")), "groups") unless @groups.nil? @policy_name = policy_name Jsii::Type.check_type(@policy_name, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJzdHJpbmcifQ==")), "policyName") unless @policy_name.nil? @roles = roles Jsii::Type.check_type(@roles, JSON.parse(Base64.strict_decode64("eyJjb2xsZWN0aW9uIjp7ImVsZW1lbnR0eXBlIjp7ImZxbiI6ImF3cy1jZGstbGliLmF3c19pYW0uSVJvbGUifSwia2luZCI6ImFycmF5In19")), "roles") unless @roles.nil? @statements = statements Jsii::Type.check_type(@statements, JSON.parse(Base64.strict_decode64("eyJjb2xsZWN0aW9uIjp7ImVsZW1lbnR0eXBlIjp7ImZxbiI6ImF3cy1jZGstbGliLmF3c19pYW0uUG9saWN5U3RhdGVtZW50In0sImtpbmQiOiJhcnJheSJ9fQ==")), "statements") unless @statements.nil? @users = users Jsii::Type.check_type(@users, JSON.parse(Base64.strict_decode64("eyJjb2xsZWN0aW9uIjp7ImVsZW1lbnR0eXBlIjp7ImZxbiI6ImF3cy1jZGstbGliLmF3c19pYW0uSVVzZXIifSwia2luZCI6ImFycmF5In19")), "users") unless @users.nil? end |
Instance Attribute Details
#document ⇒ AWSCDK::IAM::PolicyDocument? (readonly)
Default: - An empty policy.
Initial PolicyDocument to use for this Policy.
If omited, any
PolicyStatement provided in the statements property will be applied
against the empty default PolicyDocument.
39 40 41 |
# File 'iam/policy_props.rb', line 39 def document @document end |
#force ⇒ Boolean? (readonly)
Default: false
Force creation of an AWS::IAM::Policy.
Unless set to true, this Policy construct will not materialize to an
AWS::IAM::Policy CloudFormation resource in case it would have no effect
(for example, if it remains unattached to an IAM identity or if it has no
statements). This is generally desired behavior, since it prevents
creating invalid--and hence undeployable--CloudFormation templates.
In cases where you know the policy must be created and it is actually
an error if no statements have been added to it or it remains unattached to
an IAM identity, you can set this to true.
54 55 56 |
# File 'iam/policy_props.rb', line 54 def force @force end |
#groups ⇒ Array<AWSCDK::IAM::IGroup>? (readonly)
Default: - No groups.
Groups to attach this policy to.
You can also use attach_to_group(group) to attach this policy to a group.
61 62 63 |
# File 'iam/policy_props.rb', line 61 def groups @groups end |
#policy_name ⇒ String? (readonly)
Default: - Uses the logical ID of the policy resource, which is ensured to be unique within the stack.
The name of the policy.
If you specify multiple policies for an entity, specify unique names. For example, if you specify a list of policies for an IAM role, each policy must have a unique name.
70 71 72 |
# File 'iam/policy_props.rb', line 70 def policy_name @policy_name end |
#roles ⇒ Array<AWSCDK::IAM::IRole>? (readonly)
Default: - No roles.
Roles to attach this policy to.
You can also use attach_to_role(role) to attach this policy to a role.
77 78 79 |
# File 'iam/policy_props.rb', line 77 def roles @roles end |
#statements ⇒ Array<AWSCDK::IAM::PolicyStatement>? (readonly)
Default: - No statements.
Initial set of permissions to add to this policy document.
You can also use addStatements(...statement) to add permissions later.
84 85 86 |
# File 'iam/policy_props.rb', line 84 def statements @statements end |
#users ⇒ Array<AWSCDK::IAM::IUser>? (readonly)
Default: - No users.
Users to attach this policy to.
You can also use attach_to_user(user) to attach this policy to a user.
91 92 93 |
# File 'iam/policy_props.rb', line 91 def users @users end |
Class Method Details
.jsii_properties ⇒ Object
93 94 95 96 97 98 99 100 101 102 103 |
# File 'iam/policy_props.rb', line 93 def self.jsii_properties { :document => "document", :force => "force", :groups => "groups", :policy_name => "policyName", :roles => "roles", :statements => "statements", :users => "users", } end |
Instance Method Details
#to_jsii ⇒ Object
105 106 107 108 109 110 111 112 113 114 115 116 117 |
# File 'iam/policy_props.rb', line 105 def to_jsii result = {} result.merge!({ "document" => @document, "force" => @force, "groups" => @groups, "policyName" => @policy_name, "roles" => @roles, "statements" => @statements, "users" => @users, }) result.compact end |