aws-cdk-lib 2.190.0__py3-none-any.whl → 2.192.0__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.

Potentially problematic release.


This version of aws-cdk-lib might be problematic. Click here for more details.

@@ -89,6 +89,22 @@ on_commit_rule.add_target(targets.SnsTopic(topic,
89
89
  ))
90
90
  ```
91
91
 
92
+ ### Role
93
+
94
+ You can specify an IAM Role:
95
+
96
+ ```python
97
+ # role: iam.IRole
98
+
99
+
100
+ events.Rule(self, "MyRule",
101
+ schedule=events.Schedule.cron(minute="0", hour="4"),
102
+ role=role
103
+ )
104
+ ```
105
+
106
+ **Note**: If you're setting an event bus in another account as the target and that account granted permission to your account through an organization instead of directly by the account ID, you must specify a RoleArn with proper permissions in the Target structure, instead of here in this parameter.
107
+
92
108
  ### Matchers
93
109
 
94
110
  To define a pattern, use the `Match` class, which provides a number of factory methods to declare
@@ -1710,6 +1726,7 @@ class CfnConnection(
1710
1726
  resource_association_arn="resourceAssociationArn"
1711
1727
  )
1712
1728
  ),
1729
+ kms_key_identifier="kmsKeyIdentifier",
1713
1730
  name="name"
1714
1731
  )
1715
1732
  '''
@@ -1723,6 +1740,7 @@ class CfnConnection(
1723
1740
  auth_parameters: typing.Optional[typing.Union[_IResolvable_da3f097b, typing.Union["CfnConnection.AuthParametersProperty", typing.Dict[builtins.str, typing.Any]]]] = None,
1724
1741
  description: typing.Optional[builtins.str] = None,
1725
1742
  invocation_connectivity_parameters: typing.Optional[typing.Union[_IResolvable_da3f097b, typing.Union["CfnConnection.InvocationConnectivityParametersProperty", typing.Dict[builtins.str, typing.Any]]]] = None,
1743
+ kms_key_identifier: typing.Optional[builtins.str] = None,
1726
1744
  name: typing.Optional[builtins.str] = None,
1727
1745
  ) -> None:
1728
1746
  '''
@@ -1732,6 +1750,7 @@ class CfnConnection(
1732
1750
  :param auth_parameters: The authorization parameters to use to authorize with the endpoint. You must include only authorization parameters for the ``AuthorizationType`` you specify.
1733
1751
  :param description: A description for the connection to create.
1734
1752
  :param invocation_connectivity_parameters: For connections to private APIs, the parameters to use for invoking the API. For more information, see `Connecting to private APIs <https://docs.aws.amazon.com/eventbridge/latest/userguide/connection-private.html>`_ in the **Amazon EventBridge User Guide** .
1753
+ :param kms_key_identifier:
1735
1754
  :param name: The name for the connection to create.
1736
1755
  '''
1737
1756
  if __debug__:
@@ -1743,6 +1762,7 @@ class CfnConnection(
1743
1762
  auth_parameters=auth_parameters,
1744
1763
  description=description,
1745
1764
  invocation_connectivity_parameters=invocation_connectivity_parameters,
1765
+ kms_key_identifier=kms_key_identifier,
1746
1766
  name=name,
1747
1767
  )
1748
1768
 
@@ -1902,6 +1922,18 @@ class CfnConnection(
1902
1922
  check_type(argname="argument value", value=value, expected_type=type_hints["value"])
1903
1923
  jsii.set(self, "invocationConnectivityParameters", value) # pyright: ignore[reportArgumentType]
1904
1924
 
1925
+ @builtins.property
1926
+ @jsii.member(jsii_name="kmsKeyIdentifier")
1927
+ def kms_key_identifier(self) -> typing.Optional[builtins.str]:
1928
+ return typing.cast(typing.Optional[builtins.str], jsii.get(self, "kmsKeyIdentifier"))
1929
+
1930
+ @kms_key_identifier.setter
1931
+ def kms_key_identifier(self, value: typing.Optional[builtins.str]) -> None:
1932
+ if __debug__:
1933
+ type_hints = typing.get_type_hints(_typecheckingstub__579f1ad92b1c0b7657d928d388da032a83ada8c6564dd3ab6da98459fced8ae1)
1934
+ check_type(argname="argument value", value=value, expected_type=type_hints["value"])
1935
+ jsii.set(self, "kmsKeyIdentifier", value) # pyright: ignore[reportArgumentType]
1936
+
1905
1937
  @builtins.property
1906
1938
  @jsii.member(jsii_name="name")
1907
1939
  def name(self) -> typing.Optional[builtins.str]:
@@ -2890,6 +2922,7 @@ class CfnConnection(
2890
2922
  "auth_parameters": "authParameters",
2891
2923
  "description": "description",
2892
2924
  "invocation_connectivity_parameters": "invocationConnectivityParameters",
2925
+ "kms_key_identifier": "kmsKeyIdentifier",
2893
2926
  "name": "name",
2894
2927
  },
2895
2928
  )
@@ -2901,6 +2934,7 @@ class CfnConnectionProps:
2901
2934
  auth_parameters: typing.Optional[typing.Union[_IResolvable_da3f097b, typing.Union[CfnConnection.AuthParametersProperty, typing.Dict[builtins.str, typing.Any]]]] = None,
2902
2935
  description: typing.Optional[builtins.str] = None,
2903
2936
  invocation_connectivity_parameters: typing.Optional[typing.Union[_IResolvable_da3f097b, typing.Union[CfnConnection.InvocationConnectivityParametersProperty, typing.Dict[builtins.str, typing.Any]]]] = None,
2937
+ kms_key_identifier: typing.Optional[builtins.str] = None,
2904
2938
  name: typing.Optional[builtins.str] = None,
2905
2939
  ) -> None:
2906
2940
  '''Properties for defining a ``CfnConnection``.
@@ -2909,6 +2943,7 @@ class CfnConnectionProps:
2909
2943
  :param auth_parameters: The authorization parameters to use to authorize with the endpoint. You must include only authorization parameters for the ``AuthorizationType`` you specify.
2910
2944
  :param description: A description for the connection to create.
2911
2945
  :param invocation_connectivity_parameters: For connections to private APIs, the parameters to use for invoking the API. For more information, see `Connecting to private APIs <https://docs.aws.amazon.com/eventbridge/latest/userguide/connection-private.html>`_ in the **Amazon EventBridge User Guide** .
2946
+ :param kms_key_identifier:
2912
2947
  :param name: The name for the connection to create.
2913
2948
 
2914
2949
  :see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-events-connection.html
@@ -3005,6 +3040,7 @@ class CfnConnectionProps:
3005
3040
  resource_association_arn="resourceAssociationArn"
3006
3041
  )
3007
3042
  ),
3043
+ kms_key_identifier="kmsKeyIdentifier",
3008
3044
  name="name"
3009
3045
  )
3010
3046
  '''
@@ -3014,6 +3050,7 @@ class CfnConnectionProps:
3014
3050
  check_type(argname="argument auth_parameters", value=auth_parameters, expected_type=type_hints["auth_parameters"])
3015
3051
  check_type(argname="argument description", value=description, expected_type=type_hints["description"])
3016
3052
  check_type(argname="argument invocation_connectivity_parameters", value=invocation_connectivity_parameters, expected_type=type_hints["invocation_connectivity_parameters"])
3053
+ check_type(argname="argument kms_key_identifier", value=kms_key_identifier, expected_type=type_hints["kms_key_identifier"])
3017
3054
  check_type(argname="argument name", value=name, expected_type=type_hints["name"])
3018
3055
  self._values: typing.Dict[builtins.str, typing.Any] = {}
3019
3056
  if authorization_type is not None:
@@ -3024,6 +3061,8 @@ class CfnConnectionProps:
3024
3061
  self._values["description"] = description
3025
3062
  if invocation_connectivity_parameters is not None:
3026
3063
  self._values["invocation_connectivity_parameters"] = invocation_connectivity_parameters
3064
+ if kms_key_identifier is not None:
3065
+ self._values["kms_key_identifier"] = kms_key_identifier
3027
3066
  if name is not None:
3028
3067
  self._values["name"] = name
3029
3068
 
@@ -3075,6 +3114,14 @@ class CfnConnectionProps:
3075
3114
  result = self._values.get("invocation_connectivity_parameters")
3076
3115
  return typing.cast(typing.Optional[typing.Union[_IResolvable_da3f097b, CfnConnection.InvocationConnectivityParametersProperty]], result)
3077
3116
 
3117
+ @builtins.property
3118
+ def kms_key_identifier(self) -> typing.Optional[builtins.str]:
3119
+ '''
3120
+ :see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-events-connection.html#cfn-events-connection-kmskeyidentifier
3121
+ '''
3122
+ result = self._values.get("kms_key_identifier")
3123
+ return typing.cast(typing.Optional[builtins.str], result)
3124
+
3078
3125
  @builtins.property
3079
3126
  def name(self) -> typing.Optional[builtins.str]:
3080
3127
  '''The name for the connection to create.
@@ -10487,6 +10534,7 @@ class Rule(
10487
10534
  *,
10488
10535
  enabled: typing.Optional[builtins.bool] = None,
10489
10536
  event_bus: typing.Optional[IEventBus] = None,
10537
+ role: typing.Optional[_IRole_235f5d8e] = None,
10490
10538
  schedule: typing.Optional["Schedule"] = None,
10491
10539
  targets: typing.Optional[typing.Sequence[IRuleTarget]] = None,
10492
10540
  cross_stack_scope: typing.Optional[_constructs_77d1e7e8.Construct] = None,
@@ -10499,6 +10547,7 @@ class Rule(
10499
10547
  :param id: -
10500
10548
  :param enabled: Indicates whether the rule is enabled. Default: true
10501
10549
  :param event_bus: The event bus to associate with this rule. Default: - The default event bus.
10550
+ :param role: The role that is used for target invocation. Must be assumable by principal ``events.amazonaws.com``. Default: - No role associated
10502
10551
  :param schedule: The schedule or rate (frequency) that determines when EventBridge runs the rule. You must specify this property, the ``eventPattern`` property, or both. For more information, see Schedule Expression Syntax for Rules in the Amazon EventBridge User Guide. Default: - None.
10503
10552
  :param targets: Targets to invoke when this rule matches an event. Input will be the full matched event. If you wish to specify custom target input, use ``addTarget(target[, inputOptions])``. Default: - No targets.
10504
10553
  :param cross_stack_scope: The scope to use if the source of the rule and its target are in different Stacks (but in the same account & region). This helps dealing with cycles that often arise in these situations. Default: - none (the main scope will be used, even for cross-stack Events)
@@ -10513,6 +10562,7 @@ class Rule(
10513
10562
  props = RuleProps(
10514
10563
  enabled=enabled,
10515
10564
  event_bus=event_bus,
10565
+ role=role,
10516
10566
  schedule=schedule,
10517
10567
  targets=targets,
10518
10568
  cross_stack_scope=cross_stack_scope,
@@ -10655,6 +10705,7 @@ class Rule(
10655
10705
  "rule_name": "ruleName",
10656
10706
  "enabled": "enabled",
10657
10707
  "event_bus": "eventBus",
10708
+ "role": "role",
10658
10709
  "schedule": "schedule",
10659
10710
  "targets": "targets",
10660
10711
  },
@@ -10669,6 +10720,7 @@ class RuleProps(EventCommonOptions):
10669
10720
  rule_name: typing.Optional[builtins.str] = None,
10670
10721
  enabled: typing.Optional[builtins.bool] = None,
10671
10722
  event_bus: typing.Optional[IEventBus] = None,
10723
+ role: typing.Optional[_IRole_235f5d8e] = None,
10672
10724
  schedule: typing.Optional["Schedule"] = None,
10673
10725
  targets: typing.Optional[typing.Sequence[IRuleTarget]] = None,
10674
10726
  ) -> None:
@@ -10680,6 +10732,7 @@ class RuleProps(EventCommonOptions):
10680
10732
  :param rule_name: A name for the rule. Default: AWS CloudFormation generates a unique physical ID.
10681
10733
  :param enabled: Indicates whether the rule is enabled. Default: true
10682
10734
  :param event_bus: The event bus to associate with this rule. Default: - The default event bus.
10735
+ :param role: The role that is used for target invocation. Must be assumable by principal ``events.amazonaws.com``. Default: - No role associated
10683
10736
  :param schedule: The schedule or rate (frequency) that determines when EventBridge runs the rule. You must specify this property, the ``eventPattern`` property, or both. For more information, see Schedule Expression Syntax for Rules in the Amazon EventBridge User Guide. Default: - None.
10684
10737
  :param targets: Targets to invoke when this rule matches an event. Input will be the full matched event. If you wish to specify custom target input, use ``addTarget(target[, inputOptions])``. Default: - No targets.
10685
10738
 
@@ -10714,6 +10767,7 @@ class RuleProps(EventCommonOptions):
10714
10767
  check_type(argname="argument rule_name", value=rule_name, expected_type=type_hints["rule_name"])
10715
10768
  check_type(argname="argument enabled", value=enabled, expected_type=type_hints["enabled"])
10716
10769
  check_type(argname="argument event_bus", value=event_bus, expected_type=type_hints["event_bus"])
10770
+ check_type(argname="argument role", value=role, expected_type=type_hints["role"])
10717
10771
  check_type(argname="argument schedule", value=schedule, expected_type=type_hints["schedule"])
10718
10772
  check_type(argname="argument targets", value=targets, expected_type=type_hints["targets"])
10719
10773
  self._values: typing.Dict[builtins.str, typing.Any] = {}
@@ -10729,6 +10783,8 @@ class RuleProps(EventCommonOptions):
10729
10783
  self._values["enabled"] = enabled
10730
10784
  if event_bus is not None:
10731
10785
  self._values["event_bus"] = event_bus
10786
+ if role is not None:
10787
+ self._values["role"] = role
10732
10788
  if schedule is not None:
10733
10789
  self._values["schedule"] = schedule
10734
10790
  if targets is not None:
@@ -10796,6 +10852,17 @@ class RuleProps(EventCommonOptions):
10796
10852
  result = self._values.get("event_bus")
10797
10853
  return typing.cast(typing.Optional[IEventBus], result)
10798
10854
 
10855
+ @builtins.property
10856
+ def role(self) -> typing.Optional[_IRole_235f5d8e]:
10857
+ '''The role that is used for target invocation.
10858
+
10859
+ Must be assumable by principal ``events.amazonaws.com``.
10860
+
10861
+ :default: - No role associated
10862
+ '''
10863
+ result = self._values.get("role")
10864
+ return typing.cast(typing.Optional[_IRole_235f5d8e], result)
10865
+
10799
10866
  @builtins.property
10800
10867
  def schedule(self) -> typing.Optional["Schedule"]:
10801
10868
  '''The schedule or rate (frequency) that determines when EventBridge runs the rule.
@@ -12474,6 +12541,7 @@ def _typecheckingstub__65bde9b35de094b905dd335652d04503af85c50ac027a006a1d7ec926
12474
12541
  auth_parameters: typing.Optional[typing.Union[_IResolvable_da3f097b, typing.Union[CfnConnection.AuthParametersProperty, typing.Dict[builtins.str, typing.Any]]]] = None,
12475
12542
  description: typing.Optional[builtins.str] = None,
12476
12543
  invocation_connectivity_parameters: typing.Optional[typing.Union[_IResolvable_da3f097b, typing.Union[CfnConnection.InvocationConnectivityParametersProperty, typing.Dict[builtins.str, typing.Any]]]] = None,
12544
+ kms_key_identifier: typing.Optional[builtins.str] = None,
12477
12545
  name: typing.Optional[builtins.str] = None,
12478
12546
  ) -> None:
12479
12547
  """Type checking stubs"""
@@ -12515,6 +12583,12 @@ def _typecheckingstub__81977d37ca8e880d59a06a5f2212ea535fd65a2615c824916ce07bd93
12515
12583
  """Type checking stubs"""
12516
12584
  pass
12517
12585
 
12586
+ def _typecheckingstub__579f1ad92b1c0b7657d928d388da032a83ada8c6564dd3ab6da98459fced8ae1(
12587
+ value: typing.Optional[builtins.str],
12588
+ ) -> None:
12589
+ """Type checking stubs"""
12590
+ pass
12591
+
12518
12592
  def _typecheckingstub__d93a7e7bebc6e390076ef7174623c4da1c018543554603bbb442c270a532a536(
12519
12593
  value: typing.Optional[builtins.str],
12520
12594
  ) -> None:
@@ -12612,6 +12686,7 @@ def _typecheckingstub__2b32e6c6e8c1c2772bb604474216b07683c108c349058e240d272750b
12612
12686
  auth_parameters: typing.Optional[typing.Union[_IResolvable_da3f097b, typing.Union[CfnConnection.AuthParametersProperty, typing.Dict[builtins.str, typing.Any]]]] = None,
12613
12687
  description: typing.Optional[builtins.str] = None,
12614
12688
  invocation_connectivity_parameters: typing.Optional[typing.Union[_IResolvable_da3f097b, typing.Union[CfnConnection.InvocationConnectivityParametersProperty, typing.Dict[builtins.str, typing.Any]]]] = None,
12689
+ kms_key_identifier: typing.Optional[builtins.str] = None,
12615
12690
  name: typing.Optional[builtins.str] = None,
12616
12691
  ) -> None:
12617
12692
  """Type checking stubs"""
@@ -13525,6 +13600,7 @@ def _typecheckingstub__15ada85ef5f1cb4f0237eff6253e200138049f1bebbea7163294d28f9
13525
13600
  *,
13526
13601
  enabled: typing.Optional[builtins.bool] = None,
13527
13602
  event_bus: typing.Optional[IEventBus] = None,
13603
+ role: typing.Optional[_IRole_235f5d8e] = None,
13528
13604
  schedule: typing.Optional[Schedule] = None,
13529
13605
  targets: typing.Optional[typing.Sequence[IRuleTarget]] = None,
13530
13606
  cross_stack_scope: typing.Optional[_constructs_77d1e7e8.Construct] = None,
@@ -13557,6 +13633,7 @@ def _typecheckingstub__26677a946da4037892c1c589c005b7536d8ffed632ca92c5c52a92586
13557
13633
  rule_name: typing.Optional[builtins.str] = None,
13558
13634
  enabled: typing.Optional[builtins.bool] = None,
13559
13635
  event_bus: typing.Optional[IEventBus] = None,
13636
+ role: typing.Optional[_IRole_235f5d8e] = None,
13560
13637
  schedule: typing.Optional[Schedule] = None,
13561
13638
  targets: typing.Optional[typing.Sequence[IRuleTarget]] = None,
13562
13639
  ) -> None:
@@ -145,6 +145,14 @@ role = iam.Role.from_role_arn(self, "Role", "arn:aws:iam::123456789012:role/MyEx
145
145
  )
146
146
  ```
147
147
 
148
+ If you want to lookup roles that actually exist in your account, you can use `Role.fromLookup()`.
149
+
150
+ ```python
151
+ role = iam.Role.from_lookup(self, "Role",
152
+ role_name="MyExistingRole"
153
+ )
154
+ ```
155
+
148
156
  ### Customizing role creation
149
157
 
150
158
  It is best practice to allow CDK to manage IAM roles and permissions. You can prevent CDK from
@@ -11101,6 +11109,119 @@ class PrincipalPolicyFragment(
11101
11109
  return typing.cast(typing.Mapping[builtins.str, typing.List[builtins.str]], jsii.get(self, "principalJson"))
11102
11110
 
11103
11111
 
11112
+ @jsii.data_type(
11113
+ jsii_type="aws-cdk-lib.aws_iam.RoleLookupOptions",
11114
+ jsii_struct_bases=[FromRoleArnOptions],
11115
+ name_mapping={
11116
+ "add_grants_to_resources": "addGrantsToResources",
11117
+ "default_policy_name": "defaultPolicyName",
11118
+ "mutable": "mutable",
11119
+ "role_name": "roleName",
11120
+ },
11121
+ )
11122
+ class RoleLookupOptions(FromRoleArnOptions):
11123
+ def __init__(
11124
+ self,
11125
+ *,
11126
+ add_grants_to_resources: typing.Optional[builtins.bool] = None,
11127
+ default_policy_name: typing.Optional[builtins.str] = None,
11128
+ mutable: typing.Optional[builtins.bool] = None,
11129
+ role_name: builtins.str,
11130
+ ) -> None:
11131
+ '''Properties for looking up an existing Role.
11132
+
11133
+ :param add_grants_to_resources: 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. Default: false
11134
+ :param default_policy_name: 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. Default: 'Policy'
11135
+ :param mutable: Whether the imported role can be modified by attaching policy resources to it. Default: true
11136
+ :param role_name: 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'.
11137
+
11138
+ :exampleMetadata: infused
11139
+
11140
+ Example::
11141
+
11142
+ role = iam.Role.from_lookup(self, "Role",
11143
+ role_name="MyExistingRole"
11144
+ )
11145
+ '''
11146
+ if __debug__:
11147
+ type_hints = typing.get_type_hints(_typecheckingstub__06f459857ae55dc3473fba5b10ef4188eca762038ac741736a6d4b8cac006356)
11148
+ check_type(argname="argument add_grants_to_resources", value=add_grants_to_resources, expected_type=type_hints["add_grants_to_resources"])
11149
+ check_type(argname="argument default_policy_name", value=default_policy_name, expected_type=type_hints["default_policy_name"])
11150
+ check_type(argname="argument mutable", value=mutable, expected_type=type_hints["mutable"])
11151
+ check_type(argname="argument role_name", value=role_name, expected_type=type_hints["role_name"])
11152
+ self._values: typing.Dict[builtins.str, typing.Any] = {
11153
+ "role_name": role_name,
11154
+ }
11155
+ if add_grants_to_resources is not None:
11156
+ self._values["add_grants_to_resources"] = add_grants_to_resources
11157
+ if default_policy_name is not None:
11158
+ self._values["default_policy_name"] = default_policy_name
11159
+ if mutable is not None:
11160
+ self._values["mutable"] = mutable
11161
+
11162
+ @builtins.property
11163
+ def add_grants_to_resources(self) -> typing.Optional[builtins.bool]:
11164
+ '''For immutable roles: add grants to resources instead of dropping them.
11165
+
11166
+ If this is ``false`` or not specified, grant permissions added to this role are ignored.
11167
+ It is your own responsibility to make sure the role has the required permissions.
11168
+
11169
+ If this is ``true``, any grant permissions will be added to the resource instead.
11170
+
11171
+ :default: false
11172
+ '''
11173
+ result = self._values.get("add_grants_to_resources")
11174
+ return typing.cast(typing.Optional[builtins.bool], result)
11175
+
11176
+ @builtins.property
11177
+ def default_policy_name(self) -> typing.Optional[builtins.str]:
11178
+ '''Any policies created by this role will use this value as their ID, if specified.
11179
+
11180
+ Specify this if importing the same role in multiple stacks, and granting it
11181
+ different permissions in at least two stacks. If this is not specified
11182
+ (or if the same name is specified in more than one stack),
11183
+ a CloudFormation issue will result in the policy created in whichever stack
11184
+ is deployed last overwriting the policies created by the others.
11185
+
11186
+ :default: 'Policy'
11187
+ '''
11188
+ result = self._values.get("default_policy_name")
11189
+ return typing.cast(typing.Optional[builtins.str], result)
11190
+
11191
+ @builtins.property
11192
+ def mutable(self) -> typing.Optional[builtins.bool]:
11193
+ '''Whether the imported role can be modified by attaching policy resources to it.
11194
+
11195
+ :default: true
11196
+ '''
11197
+ result = self._values.get("mutable")
11198
+ return typing.cast(typing.Optional[builtins.bool], result)
11199
+
11200
+ @builtins.property
11201
+ def role_name(self) -> builtins.str:
11202
+ '''The name of the role to lookup.
11203
+
11204
+ If the role you want to lookup is a service role, you need to specify
11205
+ the role name without the 'service-role' prefix. For example, if the role arn is
11206
+ 'arn:aws:iam::123456789012:role/service-role/ExampleServiceExecutionRole',
11207
+ you need to specify the role name as 'ExampleServiceExecutionRole'.
11208
+ '''
11209
+ result = self._values.get("role_name")
11210
+ assert result is not None, "Required property 'role_name' is missing"
11211
+ return typing.cast(builtins.str, result)
11212
+
11213
+ def __eq__(self, rhs: typing.Any) -> builtins.bool:
11214
+ return isinstance(rhs, self.__class__) and rhs._values == self._values
11215
+
11216
+ def __ne__(self, rhs: typing.Any) -> builtins.bool:
11217
+ return not (rhs == self)
11218
+
11219
+ def __repr__(self) -> str:
11220
+ return "RoleLookupOptions(%s)" % ", ".join(
11221
+ k + "=" + repr(v) for k, v in self._values.items()
11222
+ )
11223
+
11224
+
11104
11225
  @jsii.data_type(
11105
11226
  jsii_type="aws-cdk-lib.aws_iam.RoleProps",
11106
11227
  jsii_struct_bases=[],
@@ -13568,6 +13689,40 @@ class Role(
13568
13689
 
13569
13690
  return typing.cast(None, jsii.sinvoke(cls, "customizeRoles", [scope, options]))
13570
13691
 
13692
+ @jsii.member(jsii_name="fromLookup")
13693
+ @builtins.classmethod
13694
+ def from_lookup(
13695
+ cls,
13696
+ scope: _constructs_77d1e7e8.Construct,
13697
+ id: builtins.str,
13698
+ *,
13699
+ role_name: builtins.str,
13700
+ add_grants_to_resources: typing.Optional[builtins.bool] = None,
13701
+ default_policy_name: typing.Optional[builtins.str] = None,
13702
+ mutable: typing.Optional[builtins.bool] = None,
13703
+ ) -> IRole:
13704
+ '''Lookup an existing Role.
13705
+
13706
+ :param scope: -
13707
+ :param id: -
13708
+ :param role_name: 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'.
13709
+ :param add_grants_to_resources: 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. Default: false
13710
+ :param default_policy_name: 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. Default: 'Policy'
13711
+ :param mutable: Whether the imported role can be modified by attaching policy resources to it. Default: true
13712
+ '''
13713
+ if __debug__:
13714
+ type_hints = typing.get_type_hints(_typecheckingstub__bb04fc568ec6668a9d1d9742e44b19ae3793417172af39b9989724471935e6d7)
13715
+ check_type(argname="argument scope", value=scope, expected_type=type_hints["scope"])
13716
+ check_type(argname="argument id", value=id, expected_type=type_hints["id"])
13717
+ options = RoleLookupOptions(
13718
+ role_name=role_name,
13719
+ add_grants_to_resources=add_grants_to_resources,
13720
+ default_policy_name=default_policy_name,
13721
+ mutable=mutable,
13722
+ )
13723
+
13724
+ return typing.cast(IRole, jsii.sinvoke(cls, "fromLookup", [scope, id, options]))
13725
+
13571
13726
  @jsii.member(jsii_name="fromRoleArn")
13572
13727
  @builtins.classmethod
13573
13728
  def from_role_arn(
@@ -15399,6 +15554,7 @@ __all__ = [
15399
15554
  "PrincipalPolicyFragment",
15400
15555
  "PrincipalWithConditions",
15401
15556
  "Role",
15557
+ "RoleLookupOptions",
15402
15558
  "RoleProps",
15403
15559
  "SamlConsolePrincipal",
15404
15560
  "SamlMetadataDocument",
@@ -17021,6 +17177,16 @@ def _typecheckingstub__278426b331a0d887bf9449f77f6f9c562033abef58a3d7279c5604a1e
17021
17177
  """Type checking stubs"""
17022
17178
  pass
17023
17179
 
17180
+ def _typecheckingstub__06f459857ae55dc3473fba5b10ef4188eca762038ac741736a6d4b8cac006356(
17181
+ *,
17182
+ add_grants_to_resources: typing.Optional[builtins.bool] = None,
17183
+ default_policy_name: typing.Optional[builtins.str] = None,
17184
+ mutable: typing.Optional[builtins.bool] = None,
17185
+ role_name: builtins.str,
17186
+ ) -> None:
17187
+ """Type checking stubs"""
17188
+ pass
17189
+
17024
17190
  def _typecheckingstub__9c9223cb9fa6dff45ee4fd7013629ab18542c2499a83f542c5405968fad2287c(
17025
17191
  *,
17026
17192
  assumed_by: IPrincipal,
@@ -17364,6 +17530,18 @@ def _typecheckingstub__3abda5df0b9e172ab6b6506372119fbc1518a3e56245c4130fbbbd573
17364
17530
  """Type checking stubs"""
17365
17531
  pass
17366
17532
 
17533
+ def _typecheckingstub__bb04fc568ec6668a9d1d9742e44b19ae3793417172af39b9989724471935e6d7(
17534
+ scope: _constructs_77d1e7e8.Construct,
17535
+ id: builtins.str,
17536
+ *,
17537
+ role_name: builtins.str,
17538
+ add_grants_to_resources: typing.Optional[builtins.bool] = None,
17539
+ default_policy_name: typing.Optional[builtins.str] = None,
17540
+ mutable: typing.Optional[builtins.bool] = None,
17541
+ ) -> None:
17542
+ """Type checking stubs"""
17543
+ pass
17544
+
17367
17545
  def _typecheckingstub__5c43d6c30d91c1507a4d83080c4d03e80839da9ab22909456251bc529eb41a48(
17368
17546
  scope: _constructs_77d1e7e8.Construct,
17369
17547
  id: builtins.str,