Class: AWSCDK::IAM::LazyRoleProps

Inherits:
RoleProps
  • Object
show all
Defined in:
iam/lazy_role_props.rb

Overview

Properties for defining a LazyRole.

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(assumed_by:, description: nil, external_ids: nil, inline_policies: nil, managed_policies: nil, max_session_duration: nil, path: nil, permissions_boundary: nil, role_name: nil) ⇒ LazyRoleProps

Returns a new instance of LazyRoleProps.

Parameters:

  • assumed_by (AWSCDK::IAM::IPrincipal)

    The IAM principal (i.e. new ServicePrincipal('sns.amazonaws.com')) which can assume this role.

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

    A description of the role.

  • external_ids (Array<String>, nil) (defaults to: nil)

    List of IDs that the role assumer needs to provide one of when assuming this role.

  • inline_policies (Hash{String => AWSCDK::IAM::PolicyDocument}, nil) (defaults to: nil)

    A list of named policies to inline into this role.

  • managed_policies (Array<AWSCDK::IAM::IManagedPolicy>, nil) (defaults to: nil)

    A list of managed policies associated with this role.

  • max_session_duration (AWSCDK::Duration, nil) (defaults to: nil)

    The maximum session duration that you want to set for the specified role.

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

    The path associated with this role.

  • permissions_boundary (AWSCDK::IAM::IManagedPolicy, nil) (defaults to: nil)

    AWS supports permissions boundaries for IAM entities (users or roles).

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

    A name for the IAM role.



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

def initialize(assumed_by:, description: nil, external_ids: nil, inline_policies: nil, managed_policies: nil, max_session_duration: nil, path: nil, permissions_boundary: nil, role_name: nil)
  @assumed_by = assumed_by
  Jsii::Type.check_type(@assumed_by, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5hd3NfaWFtLklQcmluY2lwYWwifQ==")), "assumedBy")
  @description = description
  Jsii::Type.check_type(@description, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJzdHJpbmcifQ==")), "description") unless @description.nil?
  @external_ids = external_ids
  Jsii::Type.check_type(@external_ids, JSON.parse(Base64.strict_decode64("eyJjb2xsZWN0aW9uIjp7ImVsZW1lbnR0eXBlIjp7InByaW1pdGl2ZSI6InN0cmluZyJ9LCJraW5kIjoiYXJyYXkifX0=")), "externalIds") unless @external_ids.nil?
  @inline_policies = inline_policies
  Jsii::Type.check_type(@inline_policies, JSON.parse(Base64.strict_decode64("eyJjb2xsZWN0aW9uIjp7ImVsZW1lbnR0eXBlIjp7ImZxbiI6ImF3cy1jZGstbGliLmF3c19pYW0uUG9saWN5RG9jdW1lbnQifSwia2luZCI6Im1hcCJ9fQ==")), "inlinePolicies") unless @inline_policies.nil?
  @managed_policies = managed_policies
  Jsii::Type.check_type(@managed_policies, JSON.parse(Base64.strict_decode64("eyJjb2xsZWN0aW9uIjp7ImVsZW1lbnR0eXBlIjp7ImZxbiI6ImF3cy1jZGstbGliLmF3c19pYW0uSU1hbmFnZWRQb2xpY3kifSwia2luZCI6ImFycmF5In19")), "managedPolicies") unless @managed_policies.nil?
  @max_session_duration = max_session_duration
  Jsii::Type.check_type(@max_session_duration, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5EdXJhdGlvbiJ9")), "maxSessionDuration") unless @max_session_duration.nil?
  @path = path
  Jsii::Type.check_type(@path, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJzdHJpbmcifQ==")), "path") unless @path.nil?
  @permissions_boundary = permissions_boundary
  Jsii::Type.check_type(@permissions_boundary, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5hd3NfaWFtLklNYW5hZ2VkUG9saWN5In0=")), "permissionsBoundary") unless @permissions_boundary.nil?
  @role_name = role_name
  Jsii::Type.check_type(@role_name, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJzdHJpbmcifQ==")), "roleName") unless @role_name.nil?
end

Instance Attribute Details

#assumed_byAWSCDK::IAM::IPrincipal (readonly)

The IAM principal (i.e. new ServicePrincipal('sns.amazonaws.com')) which can assume this role.

You can later modify the assume role policy document by accessing it via the assume_role_policy property.



43
44
45
# File 'iam/lazy_role_props.rb', line 43

def assumed_by
  @assumed_by
end

#descriptionString? (readonly)

Note:

Default: - No description.

A description of the role.

It can be up to 1000 characters long.

Returns:

  • (String, nil)


50
51
52
# File 'iam/lazy_role_props.rb', line 50

def description
  @description
end

#external_idsArray<String>? (readonly)

Note:

Default: No external ID required

List of IDs that the role assumer needs to provide one of when assuming this role.

If the configured and provided external IDs do not match, the AssumeRole operation will fail.

Returns:

  • (Array<String>, nil)


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

def external_ids
  @external_ids
end

#inline_policiesHash{String => AWSCDK::IAM::PolicyDocument}? (readonly)

Note:

Default: - No policy is inlined in the Role resource.

A list of named policies to inline into this role.

These policies will be created with the role, whereas those added by add_to_policy are added using a separate CloudFormation resource (allowing a way around circular dependencies that could otherwise be introduced).

Returns:



68
69
70
# File 'iam/lazy_role_props.rb', line 68

def inline_policies
  @inline_policies
end

#managed_policiesArray<AWSCDK::IAM::IManagedPolicy>? (readonly)

Note:

Default: - No managed policies.

A list of managed policies associated with this role.

You can add managed policies later using addManagedPolicy(ManagedPolicy.fromAwsManagedPolicyName(policyName)).

Returns:



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

def managed_policies
  @managed_policies
end

#max_session_durationAWSCDK::Duration? (readonly)

Note:

Default: Duration.hours(1)

The maximum session duration that you want to set for the specified role.

This setting can have a value from 1 hour (3600sec) to 12 (43200sec) hours.

Anyone who assumes the role from the AWS CLI or API can use the DurationSeconds API parameter or the duration-seconds CLI parameter to request a longer session. The MaxSessionDuration setting determines the maximum duration that can be requested using the DurationSeconds parameter.

If users don't specify a value for the DurationSeconds parameter, their security credentials are valid for one hour by default. This applies when you use the AssumeRole* API operations or the assume-role* CLI operations but does not apply when you use those operations to create a console URL.

Returns:



94
95
96
# File 'iam/lazy_role_props.rb', line 94

def max_session_duration
  @max_session_duration
end

#pathString? (readonly)

Note:

Default: /

The path associated with this role.

For information about IAM paths, see Friendly Names and Paths in IAM User Guide.

Returns:

  • (String, nil)


102
103
104
# File 'iam/lazy_role_props.rb', line 102

def path
  @path
end

#permissions_boundaryAWSCDK::IAM::IManagedPolicy? (readonly)

Note:

Default: - No permissions boundary.

AWS supports permissions boundaries for IAM entities (users or roles).

A permissions boundary is an advanced feature for using a managed policy to set the maximum permissions that an identity-based policy can grant to an IAM entity. An entity's permissions boundary allows it to perform only the actions that are allowed by both its identity-based policies and its permissions boundaries.

Returns:



113
114
115
# File 'iam/lazy_role_props.rb', line 113

def permissions_boundary
  @permissions_boundary
end

#role_nameString? (readonly)

Note:

Default: - AWS CloudFormation generates a unique physical ID and uses that ID for the role name.

A name for the IAM role.

For valid values, see the RoleName parameter for the CreateRole action in the IAM API Reference.

IMPORTANT: 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 AWS CloudFormation Templates.

Returns:

  • (String, nil)


129
130
131
# File 'iam/lazy_role_props.rb', line 129

def role_name
  @role_name
end

Class Method Details

.jsii_propertiesObject



131
132
133
134
135
136
137
138
139
140
141
142
143
# File 'iam/lazy_role_props.rb', line 131

def self.jsii_properties
  {
    :assumed_by => "assumedBy",
    :description => "description",
    :external_ids => "externalIds",
    :inline_policies => "inlinePolicies",
    :managed_policies => "managedPolicies",
    :max_session_duration => "maxSessionDuration",
    :path => "path",
    :permissions_boundary => "permissionsBoundary",
    :role_name => "roleName",
  }
end

Instance Method Details

#to_jsiiObject



145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
# File 'iam/lazy_role_props.rb', line 145

def to_jsii
  result = {}
  result.merge!(super)
  result.merge!({
    "assumedBy" => @assumed_by,
    "description" => @description,
    "externalIds" => @external_ids,
    "inlinePolicies" => @inline_policies,
    "managedPolicies" => @managed_policies,
    "maxSessionDuration" => @max_session_duration,
    "path" => @path,
    "permissionsBoundary" => @permissions_boundary,
    "roleName" => @role_name,
  })
  result.compact
end