Class: AWSCDK::IAM::FromRoleNameOptions

Inherits:
FromRoleARNOptions
  • Object
show all
Defined in:
iam/from_role_name_options.rb

Overview

Options allowing customizing the behavior of Role.fromRoleName.

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(add_grants_to_resources: nil, default_policy_name: nil, mutable: nil) ⇒ FromRoleNameOptions

Returns a new instance of FromRoleNameOptions.

Parameters:

  • add_grants_to_resources (Boolean, nil) (defaults to: nil)

    For immutable roles: add grants to resources instead of dropping them.

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

    Any policies created by this role will use this value as their ID, if specified.

  • mutable (Boolean, nil) (defaults to: nil)

    Whether the imported role can be modified by attaching policy resources to it.



10
11
12
13
14
15
16
17
# File 'iam/from_role_name_options.rb', line 10

def initialize(add_grants_to_resources: nil, default_policy_name: nil, mutable: nil)
  @add_grants_to_resources = add_grants_to_resources
  Jsii::Type.check_type(@add_grants_to_resources, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJib29sZWFuIn0=")), "addGrantsToResources") unless @add_grants_to_resources.nil?
  @default_policy_name = default_policy_name
  Jsii::Type.check_type(@default_policy_name, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJzdHJpbmcifQ==")), "defaultPolicyName") unless @default_policy_name.nil?
  @mutable = mutable
  Jsii::Type.check_type(@mutable, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJib29sZWFuIn0=")), "mutable") unless @mutable.nil?
end

Instance Attribute Details

#add_grants_to_resourcesBoolean? (readonly)

Note:

Default: false

For immutable roles: add grants to resources instead of dropping them.

If this is false or not specified, grant permissions added to this role are ignored. It is your own responsibility to make sure the role has the required permissions.

If this is true, any grant permissions will be added to the resource instead.

Returns:

  • (Boolean, nil)


28
29
30
# File 'iam/from_role_name_options.rb', line 28

def add_grants_to_resources
  @add_grants_to_resources
end

#default_policy_nameString? (readonly)

Note:

Default: 'Policy'

Any policies created by this role will use this value as their ID, if specified.

Specify this if importing the same role in multiple stacks, and granting it different permissions in at least two stacks. If this is not specified (or if the same name is specified in more than one stack), a CloudFormation issue will result in the policy created in whichever stack is deployed last overwriting the policies created by the others.

Returns:

  • (String, nil)


39
40
41
# File 'iam/from_role_name_options.rb', line 39

def default_policy_name
  @default_policy_name
end

#mutableBoolean? (readonly)

Note:

Default: true

Whether the imported role can be modified by attaching policy resources to it.

Returns:

  • (Boolean, nil)


44
45
46
# File 'iam/from_role_name_options.rb', line 44

def mutable
  @mutable
end

Class Method Details

.jsii_propertiesObject



46
47
48
49
50
51
52
# File 'iam/from_role_name_options.rb', line 46

def self.jsii_properties
  {
    :add_grants_to_resources => "addGrantsToResources",
    :default_policy_name => "defaultPolicyName",
    :mutable => "mutable",
  }
end

Instance Method Details

#to_jsiiObject



54
55
56
57
58
59
60
61
62
63
# File 'iam/from_role_name_options.rb', line 54

def to_jsii
  result = {}
  result.merge!(super)
  result.merge!({
    "addGrantsToResources" => @add_grants_to_resources,
    "defaultPolicyName" => @default_policy_name,
    "mutable" => @mutable,
  })
  result.compact
end