Class: AWSCDK::IAM::CustomizeRolesOptions

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

Overview

Options for customizing IAM role creation.

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(prevent_synthesis: nil, use_precreated_roles: nil) ⇒ CustomizeRolesOptions

Returns a new instance of CustomizeRolesOptions.

Parameters:

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

    Whether or not to synthesize the resource into the CFN template.

  • use_precreated_roles (Hash{String => String}, nil) (defaults to: nil)

    A list of precreated IAM roles to substitute for roles that CDK is creating.



9
10
11
12
13
14
# File 'iam/customize_roles_options.rb', line 9

def initialize(prevent_synthesis: nil, use_precreated_roles: nil)
  @prevent_synthesis = prevent_synthesis
  Jsii::Type.check_type(@prevent_synthesis, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJib29sZWFuIn0=")), "preventSynthesis") unless @prevent_synthesis.nil?
  @use_precreated_roles = use_precreated_roles
  Jsii::Type.check_type(@use_precreated_roles, JSON.parse(Base64.strict_decode64("eyJjb2xsZWN0aW9uIjp7ImVsZW1lbnR0eXBlIjp7InByaW1pdGl2ZSI6InN0cmluZyJ9LCJraW5kIjoibWFwIn19")), "usePrecreatedRoles") unless @use_precreated_roles.nil?
end

Instance Attribute Details

#prevent_synthesisBoolean? (readonly)

Note:

Default: true

Whether or not to synthesize the resource into the CFN template.

Set this to false if you still want to create the resources and you also want to create the policy report.

Returns:

  • (Boolean, nil)


23
24
25
# File 'iam/customize_roles_options.rb', line 23

def prevent_synthesis
  @prevent_synthesis
end

#use_precreated_rolesHash{String => String}? (readonly)

Note:

Default: - there are no precreated roles. Synthesis will fail if preventSynthesis=true

A list of precreated IAM roles to substitute for roles that CDK is creating.

The constructPath can be either a relative or absolute path from the scope that customize_roles is used on to the role being created.

Examples:

app = nil # AWSCDK::App

stack = AWSCDK::Stack.new(app, "MyStack")
AWSCDK::IAM::Role.new(stack, "MyRole", {
    assumed_by: AWSCDK::IAM::AccountPrincipal.new("1111111111"),
})

AWSCDK::IAM::Role.customize_roles(stack, {
    use_precreated_roles: {
        # absolute path
        "MyStack/MyRole" => "my-precreated-role-name",
        # or relative path from `stack`
        "MyRole" => "my-precreated-role",
    },
})

Returns:

  • (Hash{String => String}, nil)


48
49
50
# File 'iam/customize_roles_options.rb', line 48

def use_precreated_roles
  @use_precreated_roles
end

Class Method Details

.jsii_propertiesObject



50
51
52
53
54
55
# File 'iam/customize_roles_options.rb', line 50

def self.jsii_properties
  {
    :prevent_synthesis => "preventSynthesis",
    :use_precreated_roles => "usePrecreatedRoles",
  }
end

Instance Method Details

#to_jsiiObject



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

def to_jsii
  result = {}
  result.merge!({
    "preventSynthesis" => @prevent_synthesis,
    "usePrecreatedRoles" => @use_precreated_roles,
  })
  result.compact
end