Class: AWSCDK::IAM::RoleLookupOptions

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

Overview

Properties for looking up an existing Role.

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, role_name:) ⇒ RoleLookupOptions

Returns a new instance of RoleLookupOptions.

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.

  • role_name (String)

    The name of the role to lookup.



11
12
13
14
15
16
17
18
19
20
# File 'iam/role_lookup_options.rb', line 11

def initialize(add_grants_to_resources: nil, default_policy_name: nil, mutable: nil, role_name:)
  @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?
  @role_name = role_name
  Jsii::Type.check_type(@role_name, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJzdHJpbmcifQ==")), "roleName")
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)


31
32
33
# File 'iam/role_lookup_options.rb', line 31

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)


42
43
44
# File 'iam/role_lookup_options.rb', line 42

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)


47
48
49
# File 'iam/role_lookup_options.rb', line 47

def mutable
  @mutable
end

#role_nameString (readonly)

The name of the role to lookup.

If the role you want to lookup is a service role, you need to specify the role name without the 'service-role' prefix. For example, if the role arn is 'arn:aws:iam::123456789012:role/service-role/ExampleServiceExecutionRole', you need to specify the role name as 'ExampleServiceExecutionRole'.

Returns:

  • (String)


56
57
58
# File 'iam/role_lookup_options.rb', line 56

def role_name
  @role_name
end

Class Method Details

.jsii_propertiesObject



58
59
60
61
62
63
64
65
# File 'iam/role_lookup_options.rb', line 58

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

Instance Method Details

#to_jsiiObject



67
68
69
70
71
72
73
74
75
76
77
# File 'iam/role_lookup_options.rb', line 67

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