aws-cdk-lib 2.154.1__py3-none-any.whl → 2.156.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.

Files changed (37) hide show
  1. aws_cdk/__init__.py +2 -2
  2. aws_cdk/_jsii/__init__.py +1 -1
  3. aws_cdk/_jsii/{aws-cdk-lib@2.154.1.jsii.tgz → aws-cdk-lib@2.156.0.jsii.tgz} +0 -0
  4. aws_cdk/assertions/__init__.py +17 -17
  5. aws_cdk/aws_bedrock/__init__.py +22 -4
  6. aws_cdk/aws_cloudfront/__init__.py +654 -59
  7. aws_cdk/aws_cloudfront_origins/__init__.py +2034 -91
  8. aws_cdk/aws_codebuild/__init__.py +349 -8
  9. aws_cdk/aws_docdb/__init__.py +78 -6
  10. aws_cdk/aws_ec2/__init__.py +250 -61
  11. aws_cdk/aws_ecs/__init__.py +18 -14
  12. aws_cdk/aws_ecs_patterns/__init__.py +129 -11
  13. aws_cdk/aws_eks/__init__.py +74 -8
  14. aws_cdk/aws_elasticloadbalancingv2/__init__.py +22 -46
  15. aws_cdk/aws_events/__init__.py +40 -14
  16. aws_cdk/aws_events_targets/__init__.py +357 -0
  17. aws_cdk/aws_iam/__init__.py +7 -8
  18. aws_cdk/aws_ivs/__init__.py +10 -8
  19. aws_cdk/aws_kms/__init__.py +89 -10
  20. aws_cdk/aws_lambda/__init__.py +38 -23
  21. aws_cdk/aws_lambda_event_sources/__init__.py +27 -0
  22. aws_cdk/aws_rds/__init__.py +12 -0
  23. aws_cdk/aws_s3/__init__.py +13 -14
  24. aws_cdk/aws_secretsmanager/__init__.py +3 -2
  25. aws_cdk/aws_ses/__init__.py +7 -7
  26. aws_cdk/aws_ssmcontacts/__init__.py +12 -0
  27. aws_cdk/aws_stepfunctions/__init__.py +12 -14
  28. aws_cdk/aws_stepfunctions_tasks/__init__.py +178 -41
  29. aws_cdk/aws_synthetics/__init__.py +26 -0
  30. aws_cdk/custom_resources/__init__.py +106 -1
  31. aws_cdk/cx_api/__init__.py +16 -0
  32. {aws_cdk_lib-2.154.1.dist-info → aws_cdk_lib-2.156.0.dist-info}/METADATA +1 -1
  33. {aws_cdk_lib-2.154.1.dist-info → aws_cdk_lib-2.156.0.dist-info}/RECORD +37 -37
  34. {aws_cdk_lib-2.154.1.dist-info → aws_cdk_lib-2.156.0.dist-info}/LICENSE +0 -0
  35. {aws_cdk_lib-2.154.1.dist-info → aws_cdk_lib-2.156.0.dist-info}/NOTICE +0 -0
  36. {aws_cdk_lib-2.154.1.dist-info → aws_cdk_lib-2.156.0.dist-info}/WHEEL +0 -0
  37. {aws_cdk_lib-2.154.1.dist-info → aws_cdk_lib-2.156.0.dist-info}/top_level.txt +0 -0
@@ -1021,7 +1021,7 @@ class AddNetworkTargetsProps:
1021
1021
  ) -> None:
1022
1022
  '''Properties for adding new network targets to a listener.
1023
1023
 
1024
- :param port: The port on which the listener listens for requests. Default: Determined from protocol if known
1024
+ :param port: The port on which the target receives traffic. Default: Determined from protocol if known
1025
1025
  :param deregistration_delay: The amount of time for Elastic Load Balancing to wait before deregistering a target. The range is 0-3600 seconds. Default: Duration.minutes(5)
1026
1026
  :param health_check: Health check configuration. Default: - The default value for each property in this configuration varies depending on the target.
1027
1027
  :param preserve_client_ip: Indicates whether client IP preservation is enabled. Default: false if the target group type is IP address and the target group protocol is TCP or TLS. Otherwise, true.
@@ -1092,7 +1092,7 @@ class AddNetworkTargetsProps:
1092
1092
 
1093
1093
  @builtins.property
1094
1094
  def port(self) -> jsii.Number:
1095
- '''The port on which the listener listens for requests.
1095
+ '''The port on which the target receives traffic.
1096
1096
 
1097
1097
  :default: Determined from protocol if known
1098
1098
  '''
@@ -14942,53 +14942,29 @@ class IpAddressType(enum.Enum):
14942
14942
 
14943
14943
  Example::
14944
14944
 
14945
- # vpc: ec2.Vpc
14946
-
14947
-
14948
- lb = elbv2.ApplicationLoadBalancer(self, "LB",
14949
- vpc=vpc,
14950
- internet_facing=True,
14945
+ import aws_cdk.aws_elasticloadbalancingv2 as elbv2
14951
14946
 
14952
- # Whether HTTP/2 is enabled
14953
- http2_enabled=False,
14954
-
14955
- # The idle timeout value, in seconds
14956
- idle_timeout=Duration.seconds(1000),
14957
14947
 
14958
- # Whether HTTP headers with header fields thatare not valid
14959
- # are removed by the load balancer (true), or routed to targets
14960
- drop_invalid_header_fields=True,
14961
-
14962
- # How the load balancer handles requests that might
14963
- # pose a security risk to your application
14964
- desync_mitigation_mode=elbv2.DesyncMitigationMode.DEFENSIVE,
14965
-
14966
- # The type of IP addresses to use.
14967
- ip_address_type=elbv2.IpAddressType.IPV4,
14968
-
14969
- # The duration of client keep-alive connections
14970
- client_keep_alive=Duration.seconds(500),
14971
-
14972
- # Whether cross-zone load balancing is enabled.
14973
- cross_zone_enabled=True,
14974
-
14975
- # Whether the load balancer blocks traffic through the Internet Gateway (IGW).
14976
- deny_all_igw_traffic=False,
14977
-
14978
- # Whether to preserve host header in the request to the target
14979
- preserve_host_header=True,
14980
-
14981
- # Whether to add the TLS information header to the request
14982
- x_amzn_tls_version_and_cipher_suite_headers=True,
14983
-
14984
- # Whether the X-Forwarded-For header should preserve the source port
14985
- preserve_xff_client_port=True,
14948
+ # The VPC and subnet must have associated IPv6 CIDR blocks.
14949
+ vpc = ec2.Vpc(self, "Vpc",
14950
+ ip_protocol=ec2.IpProtocol.DUAL_STACK
14951
+ )
14952
+ cluster = ecs.Cluster(self, "EcsCluster", vpc=vpc)
14986
14953
 
14987
- # The processing mode for X-Forwarded-For headers
14988
- xff_header_processing_mode=elbv2.XffHeaderProcessingMode.APPEND,
14954
+ service = ecs_patterns.ApplicationLoadBalancedFargateService(self, "myService",
14955
+ cluster=cluster,
14956
+ task_image_options=ecsPatterns.ApplicationLoadBalancedTaskImageOptions(
14957
+ image=ecs.ContainerImage.from_registry("amazon/amazon-ecs-sample")
14958
+ ),
14959
+ ip_address_type=elbv2.IpAddressType.DUAL_STACK
14960
+ )
14989
14961
 
14990
- # Whether to allow a load balancer to route requests to targets if it is unable to forward the request to AWS WAF.
14991
- waf_fail_open=True
14962
+ application_load_balanced_ec2_service = ecs_patterns.ApplicationLoadBalancedEc2Service(self, "myService",
14963
+ cluster=cluster,
14964
+ task_image_options=ecsPatterns.ApplicationLoadBalancedTaskImageOptions(
14965
+ image=ecs.ContainerImage.from_registry("amazon/amazon-ecs-sample")
14966
+ ),
14967
+ ip_address_type=elbv2.IpAddressType.DUAL_STACK
14992
14968
  )
14993
14969
  '''
14994
14970
 
@@ -21794,7 +21770,7 @@ class NetworkListener(
21794
21770
  one set of targets must be added without conditions.
21795
21771
 
21796
21772
  :param id: -
21797
- :param port: The port on which the listener listens for requests. Default: Determined from protocol if known
21773
+ :param port: The port on which the target receives traffic. Default: Determined from protocol if known
21798
21774
  :param deregistration_delay: The amount of time for Elastic Load Balancing to wait before deregistering a target. The range is 0-3600 seconds. Default: Duration.minutes(5)
21799
21775
  :param health_check: Health check configuration. Default: - The default value for each property in this configuration varies depending on the target.
21800
21776
  :param preserve_client_ip: Indicates whether client IP preservation is enabled. Default: false if the target group type is IP address and the target group protocol is TCP or TLS. Otherwise, true.
@@ -10276,6 +10276,7 @@ class RuleProps(EventCommonOptions):
10276
10276
  "http_parameters": "httpParameters",
10277
10277
  "input": "input",
10278
10278
  "kinesis_parameters": "kinesisParameters",
10279
+ "redshift_data_parameters": "redshiftDataParameters",
10279
10280
  "retry_policy": "retryPolicy",
10280
10281
  "role": "role",
10281
10282
  "run_command_parameters": "runCommandParameters",
@@ -10295,6 +10296,7 @@ class RuleTargetConfig:
10295
10296
  http_parameters: typing.Optional[typing.Union[CfnRule.HttpParametersProperty, typing.Dict[builtins.str, typing.Any]]] = None,
10296
10297
  input: typing.Optional["RuleTargetInput"] = None,
10297
10298
  kinesis_parameters: typing.Optional[typing.Union[CfnRule.KinesisParametersProperty, typing.Dict[builtins.str, typing.Any]]] = None,
10299
+ redshift_data_parameters: typing.Optional[typing.Union[CfnRule.RedshiftDataParametersProperty, typing.Dict[builtins.str, typing.Any]]] = None,
10298
10300
  retry_policy: typing.Optional[typing.Union[CfnRule.RetryPolicyProperty, typing.Dict[builtins.str, typing.Any]]] = None,
10299
10301
  role: typing.Optional[_IRole_235f5d8e] = None,
10300
10302
  run_command_parameters: typing.Optional[typing.Union[CfnRule.RunCommandParametersProperty, typing.Dict[builtins.str, typing.Any]]] = None,
@@ -10311,6 +10313,7 @@ class RuleTargetConfig:
10311
10313
  :param http_parameters: Contains the HTTP parameters to use when the target is a API Gateway REST endpoint or EventBridge API destination. Default: - None
10312
10314
  :param input: What input to send to the event target. Default: the entire event
10313
10315
  :param kinesis_parameters: Settings that control shard assignment, when the target is a Kinesis stream. If you don't include this parameter, eventId is used as the partition key.
10316
+ :param redshift_data_parameters: Parameters used when the rule invokes Amazon Redshift Queries. Default: - no parameters set
10314
10317
  :param retry_policy: A RetryPolicy object that includes information about the retry policy settings. Default: EventBridge default retry policy
10315
10318
  :param role: Role to use to invoke this event target.
10316
10319
  :param run_command_parameters: Parameters used when the rule invokes Amazon EC2 Systems Manager Run Command.
@@ -10407,6 +10410,17 @@ class RuleTargetConfig:
10407
10410
  kinesis_parameters=events.CfnRule.KinesisParametersProperty(
10408
10411
  partition_key_path="partitionKeyPath"
10409
10412
  ),
10413
+ redshift_data_parameters=events.CfnRule.RedshiftDataParametersProperty(
10414
+ database="database",
10415
+
10416
+ # the properties below are optional
10417
+ db_user="dbUser",
10418
+ secret_manager_arn="secretManagerArn",
10419
+ sql="sql",
10420
+ sqls=["sqls"],
10421
+ statement_name="statementName",
10422
+ with_event=False
10423
+ ),
10410
10424
  retry_policy=events.CfnRule.RetryPolicyProperty(
10411
10425
  maximum_event_age_in_seconds=123,
10412
10426
  maximum_retry_attempts=123
@@ -10436,6 +10450,8 @@ class RuleTargetConfig:
10436
10450
  http_parameters = CfnRule.HttpParametersProperty(**http_parameters)
10437
10451
  if isinstance(kinesis_parameters, dict):
10438
10452
  kinesis_parameters = CfnRule.KinesisParametersProperty(**kinesis_parameters)
10453
+ if isinstance(redshift_data_parameters, dict):
10454
+ redshift_data_parameters = CfnRule.RedshiftDataParametersProperty(**redshift_data_parameters)
10439
10455
  if isinstance(retry_policy, dict):
10440
10456
  retry_policy = CfnRule.RetryPolicyProperty(**retry_policy)
10441
10457
  if isinstance(run_command_parameters, dict):
@@ -10452,6 +10468,7 @@ class RuleTargetConfig:
10452
10468
  check_type(argname="argument http_parameters", value=http_parameters, expected_type=type_hints["http_parameters"])
10453
10469
  check_type(argname="argument input", value=input, expected_type=type_hints["input"])
10454
10470
  check_type(argname="argument kinesis_parameters", value=kinesis_parameters, expected_type=type_hints["kinesis_parameters"])
10471
+ check_type(argname="argument redshift_data_parameters", value=redshift_data_parameters, expected_type=type_hints["redshift_data_parameters"])
10455
10472
  check_type(argname="argument retry_policy", value=retry_policy, expected_type=type_hints["retry_policy"])
10456
10473
  check_type(argname="argument role", value=role, expected_type=type_hints["role"])
10457
10474
  check_type(argname="argument run_command_parameters", value=run_command_parameters, expected_type=type_hints["run_command_parameters"])
@@ -10474,6 +10491,8 @@ class RuleTargetConfig:
10474
10491
  self._values["input"] = input
10475
10492
  if kinesis_parameters is not None:
10476
10493
  self._values["kinesis_parameters"] = kinesis_parameters
10494
+ if redshift_data_parameters is not None:
10495
+ self._values["redshift_data_parameters"] = redshift_data_parameters
10477
10496
  if retry_policy is not None:
10478
10497
  self._values["retry_policy"] = retry_policy
10479
10498
  if role is not None:
@@ -10553,6 +10572,17 @@ class RuleTargetConfig:
10553
10572
  result = self._values.get("kinesis_parameters")
10554
10573
  return typing.cast(typing.Optional[CfnRule.KinesisParametersProperty], result)
10555
10574
 
10575
+ @builtins.property
10576
+ def redshift_data_parameters(
10577
+ self,
10578
+ ) -> typing.Optional[CfnRule.RedshiftDataParametersProperty]:
10579
+ '''Parameters used when the rule invokes Amazon Redshift Queries.
10580
+
10581
+ :default: - no parameters set
10582
+ '''
10583
+ result = self._values.get("redshift_data_parameters")
10584
+ return typing.cast(typing.Optional[CfnRule.RedshiftDataParametersProperty], result)
10585
+
10556
10586
  @builtins.property
10557
10587
  def retry_policy(self) -> typing.Optional[CfnRule.RetryPolicyProperty]:
10558
10588
  '''A RetryPolicy object that includes information about the retry policy settings.
@@ -10862,27 +10892,22 @@ class Schedule(
10862
10892
 
10863
10893
  Example::
10864
10894
 
10865
- import aws_cdk.aws_ecs as ecs
10895
+ import aws_cdk.aws_redshiftserverless as redshiftserverless
10866
10896
 
10867
- # cluster: ecs.ICluster
10868
- # task_definition: ecs.TaskDefinition
10897
+ # workgroup: redshiftserverless.CfnWorkgroup
10869
10898
 
10870
10899
 
10871
10900
  rule = events.Rule(self, "Rule",
10872
10901
  schedule=events.Schedule.rate(cdk.Duration.hours(1))
10873
10902
  )
10874
10903
 
10875
- rule.add_target(
10876
- targets.EcsTask(
10877
- cluster=cluster,
10878
- task_definition=task_definition,
10879
- propagate_tags=ecs.PropagatedTagSource.TASK_DEFINITION,
10880
- tags=[targets.Tag(
10881
- key="my-tag",
10882
- value="my-tag-value"
10883
- )
10884
- ]
10885
- ))
10904
+ dlq = sqs.Queue(self, "DeadLetterQueue")
10905
+
10906
+ rule.add_target(targets.RedshiftQuery(workgroup.attr_workgroup_workgroup_arn,
10907
+ database="dev",
10908
+ dead_letter_queue=dlq,
10909
+ sql=["SELECT * FROM foo", "SELECT * FROM baz"]
10910
+ ))
10886
10911
  '''
10887
10912
 
10888
10913
  def __init__(self) -> None:
@@ -12891,6 +12916,7 @@ def _typecheckingstub__10b46a391417178d3d06a5360e56af2bf314e68a1662e39855324f124
12891
12916
  http_parameters: typing.Optional[typing.Union[CfnRule.HttpParametersProperty, typing.Dict[builtins.str, typing.Any]]] = None,
12892
12917
  input: typing.Optional[RuleTargetInput] = None,
12893
12918
  kinesis_parameters: typing.Optional[typing.Union[CfnRule.KinesisParametersProperty, typing.Dict[builtins.str, typing.Any]]] = None,
12919
+ redshift_data_parameters: typing.Optional[typing.Union[CfnRule.RedshiftDataParametersProperty, typing.Dict[builtins.str, typing.Any]]] = None,
12894
12920
  retry_policy: typing.Optional[typing.Union[CfnRule.RetryPolicyProperty, typing.Dict[builtins.str, typing.Any]]] = None,
12895
12921
  role: typing.Optional[_IRole_235f5d8e] = None,
12896
12922
  run_command_parameters: typing.Optional[typing.Union[CfnRule.RunCommandParametersProperty, typing.Dict[builtins.str, typing.Any]]] = None,
@@ -26,6 +26,7 @@ Currently supported are:
26
26
  * [Launch type for ECS Task](#launch-type-for-ecs-task)
27
27
  * [Assign public IP addresses to tasks](#assign-public-ip-addresses-to-tasks)
28
28
  * [Enable Amazon ECS Exec for ECS Task](#enable-amazon-ecs-exec-for-ecs-task)
29
+ * [Run a Redshift query](#schedule-a-redshift-query-serverless-or-cluster)
29
30
 
30
31
  See the README of the `aws-cdk-lib/aws-events` library for more information on
31
32
  EventBridge.
@@ -556,6 +557,31 @@ rule.add_target(targets.EcsTask(
556
557
  enable_execute_command=True
557
558
  ))
558
559
  ```
560
+
561
+ ## Schedule a Redshift query (serverless or cluster)
562
+
563
+ Use the `RedshiftQuery` target to schedule an Amazon Redshift Query.
564
+
565
+ The code snippet below creates the scheduled event rule that route events to an Amazon Redshift Query
566
+
567
+ ```python
568
+ import aws_cdk.aws_redshiftserverless as redshiftserverless
569
+
570
+ # workgroup: redshiftserverless.CfnWorkgroup
571
+
572
+
573
+ rule = events.Rule(self, "Rule",
574
+ schedule=events.Schedule.rate(cdk.Duration.hours(1))
575
+ )
576
+
577
+ dlq = sqs.Queue(self, "DeadLetterQueue")
578
+
579
+ rule.add_target(targets.RedshiftQuery(workgroup.attr_workgroup_workgroup_arn,
580
+ database="dev",
581
+ dead_letter_queue=dlq,
582
+ sql=["SELECT * FROM foo", "SELECT * FROM baz"]
583
+ ))
584
+ ```
559
585
  '''
560
586
  from pkgutil import extend_path
561
587
  __path__ = extend_path(__path__, __name__)
@@ -609,6 +635,7 @@ from ..aws_kinesis import IStream as _IStream_4e2457d2
609
635
  from ..aws_kinesisfirehose import CfnDeliveryStream as _CfnDeliveryStream_8f3b1735
610
636
  from ..aws_lambda import IFunction as _IFunction_6adb0ab8
611
637
  from ..aws_logs import ILogGroup as _ILogGroup_3c4fa718
638
+ from ..aws_secretsmanager import ISecret as _ISecret_6e020e6a
612
639
  from ..aws_sns import ITopic as _ITopic_9eca4852
613
640
  from ..aws_sqs import IQueue as _IQueue_7ed6f679
614
641
  from ..aws_stepfunctions import IStateMachine as _IStateMachine_73e8d2b0
@@ -2628,6 +2655,296 @@ class LogGroupTargetInputOptions:
2628
2655
  )
2629
2656
 
2630
2657
 
2658
+ @jsii.implements(_IRuleTarget_7a91f454)
2659
+ class RedshiftQuery(
2660
+ metaclass=jsii.JSIIMeta,
2661
+ jsii_type="aws-cdk-lib.aws_events_targets.RedshiftQuery",
2662
+ ):
2663
+ '''Schedule an Amazon Redshift Query to be run, using the Redshift Data API.
2664
+
2665
+ If you would like Amazon Redshift to identify the Event Bridge rule, and present it in the Amazon Redshift console, append a ``QS2-`` prefix to both ``statementName`` and ``ruleName``.
2666
+
2667
+ :exampleMetadata: infused
2668
+
2669
+ Example::
2670
+
2671
+ import aws_cdk.aws_redshiftserverless as redshiftserverless
2672
+
2673
+ # workgroup: redshiftserverless.CfnWorkgroup
2674
+
2675
+
2676
+ rule = events.Rule(self, "Rule",
2677
+ schedule=events.Schedule.rate(cdk.Duration.hours(1))
2678
+ )
2679
+
2680
+ dlq = sqs.Queue(self, "DeadLetterQueue")
2681
+
2682
+ rule.add_target(targets.RedshiftQuery(workgroup.attr_workgroup_workgroup_arn,
2683
+ database="dev",
2684
+ dead_letter_queue=dlq,
2685
+ sql=["SELECT * FROM foo", "SELECT * FROM baz"]
2686
+ ))
2687
+ '''
2688
+
2689
+ def __init__(
2690
+ self,
2691
+ cluster_arn: builtins.str,
2692
+ *,
2693
+ database: builtins.str,
2694
+ sql: typing.Sequence[builtins.str],
2695
+ db_user: typing.Optional[builtins.str] = None,
2696
+ dead_letter_queue: typing.Optional[_IQueue_7ed6f679] = None,
2697
+ input: typing.Optional[_RuleTargetInput_6beca786] = None,
2698
+ role: typing.Optional[_IRole_235f5d8e] = None,
2699
+ secret: typing.Optional[_ISecret_6e020e6a] = None,
2700
+ send_event_bridge_event: typing.Optional[builtins.bool] = None,
2701
+ statement_name: typing.Optional[builtins.str] = None,
2702
+ ) -> None:
2703
+ '''
2704
+ :param cluster_arn: The ARN of the Amazon Redshift cluster.
2705
+ :param database: The Amazon Redshift database to run the query against.
2706
+ :param sql: The SQL queries to be executed. Each query is run sequentially within a single transaction; the next query in the array will only execute after the previous one has successfully completed. - When multiple sql queries are included, this will use the ``batchExecuteStatement`` API. Therefore, if any statement fails, the entire transaction is rolled back. - If a single SQL statement is to be executed, this will use the ``executeStatement`` API. Default: - No SQL query is specified
2707
+ :param db_user: The Amazon Redshift database user to run the query as. This is required when authenticating via temporary credentials. Default: - No Database user is specified
2708
+ :param dead_letter_queue: The queue to be used as dead letter queue. Default: - No dead letter queue is specified
2709
+ :param input: The input to the state machine execution. Default: - the entire EventBridge event
2710
+ :param role: The IAM role to be used to execute the SQL statement. Default: - a new role will be created.
2711
+ :param secret: The secret containing the password for the database user. This is required when authenticating via Secrets Manager. If the full secret ARN is not specified, this will instead use the secret name. Default: - No secret is specified
2712
+ :param send_event_bridge_event: Should an event be sent back to Event Bridge when the SQL statement is executed. Default: false
2713
+ :param statement_name: The name of the SQL statement. You can name the SQL statement for identitfication purposes. If you would like Amazon Redshift to identify the Event Bridge rule, and present it in the Amazon Redshift console, append a ``QS2-`` prefix to the statement name. Default: - No statement name is specified
2714
+ '''
2715
+ if __debug__:
2716
+ type_hints = typing.get_type_hints(_typecheckingstub__6f991f630fb494b0dbf6dd8dd11dec71e3b3618d520bce2a1761a05620a3d899)
2717
+ check_type(argname="argument cluster_arn", value=cluster_arn, expected_type=type_hints["cluster_arn"])
2718
+ props = RedshiftQueryProps(
2719
+ database=database,
2720
+ sql=sql,
2721
+ db_user=db_user,
2722
+ dead_letter_queue=dead_letter_queue,
2723
+ input=input,
2724
+ role=role,
2725
+ secret=secret,
2726
+ send_event_bridge_event=send_event_bridge_event,
2727
+ statement_name=statement_name,
2728
+ )
2729
+
2730
+ jsii.create(self.__class__, self, [cluster_arn, props])
2731
+
2732
+ @jsii.member(jsii_name="bind")
2733
+ def bind(
2734
+ self,
2735
+ rule: _IRule_af9e3d28,
2736
+ _id: typing.Optional[builtins.str] = None,
2737
+ ) -> _RuleTargetConfig_4e70fe03:
2738
+ '''Returns the rule target specification.
2739
+
2740
+ NOTE: Do not use the various ``inputXxx`` options. They can be set in a call to ``addTarget``.
2741
+
2742
+ :param rule: -
2743
+ :param _id: -
2744
+ '''
2745
+ if __debug__:
2746
+ type_hints = typing.get_type_hints(_typecheckingstub__39a86a8b0444f7c45c252e76fda9d4157fe34d2c363d4a99075556e92c234689)
2747
+ check_type(argname="argument rule", value=rule, expected_type=type_hints["rule"])
2748
+ check_type(argname="argument _id", value=_id, expected_type=type_hints["_id"])
2749
+ return typing.cast(_RuleTargetConfig_4e70fe03, jsii.invoke(self, "bind", [rule, _id]))
2750
+
2751
+
2752
+ @jsii.data_type(
2753
+ jsii_type="aws-cdk-lib.aws_events_targets.RedshiftQueryProps",
2754
+ jsii_struct_bases=[],
2755
+ name_mapping={
2756
+ "database": "database",
2757
+ "sql": "sql",
2758
+ "db_user": "dbUser",
2759
+ "dead_letter_queue": "deadLetterQueue",
2760
+ "input": "input",
2761
+ "role": "role",
2762
+ "secret": "secret",
2763
+ "send_event_bridge_event": "sendEventBridgeEvent",
2764
+ "statement_name": "statementName",
2765
+ },
2766
+ )
2767
+ class RedshiftQueryProps:
2768
+ def __init__(
2769
+ self,
2770
+ *,
2771
+ database: builtins.str,
2772
+ sql: typing.Sequence[builtins.str],
2773
+ db_user: typing.Optional[builtins.str] = None,
2774
+ dead_letter_queue: typing.Optional[_IQueue_7ed6f679] = None,
2775
+ input: typing.Optional[_RuleTargetInput_6beca786] = None,
2776
+ role: typing.Optional[_IRole_235f5d8e] = None,
2777
+ secret: typing.Optional[_ISecret_6e020e6a] = None,
2778
+ send_event_bridge_event: typing.Optional[builtins.bool] = None,
2779
+ statement_name: typing.Optional[builtins.str] = None,
2780
+ ) -> None:
2781
+ '''Configuration properties of an Amazon Redshift Query event.
2782
+
2783
+ :param database: The Amazon Redshift database to run the query against.
2784
+ :param sql: The SQL queries to be executed. Each query is run sequentially within a single transaction; the next query in the array will only execute after the previous one has successfully completed. - When multiple sql queries are included, this will use the ``batchExecuteStatement`` API. Therefore, if any statement fails, the entire transaction is rolled back. - If a single SQL statement is to be executed, this will use the ``executeStatement`` API. Default: - No SQL query is specified
2785
+ :param db_user: The Amazon Redshift database user to run the query as. This is required when authenticating via temporary credentials. Default: - No Database user is specified
2786
+ :param dead_letter_queue: The queue to be used as dead letter queue. Default: - No dead letter queue is specified
2787
+ :param input: The input to the state machine execution. Default: - the entire EventBridge event
2788
+ :param role: The IAM role to be used to execute the SQL statement. Default: - a new role will be created.
2789
+ :param secret: The secret containing the password for the database user. This is required when authenticating via Secrets Manager. If the full secret ARN is not specified, this will instead use the secret name. Default: - No secret is specified
2790
+ :param send_event_bridge_event: Should an event be sent back to Event Bridge when the SQL statement is executed. Default: false
2791
+ :param statement_name: The name of the SQL statement. You can name the SQL statement for identitfication purposes. If you would like Amazon Redshift to identify the Event Bridge rule, and present it in the Amazon Redshift console, append a ``QS2-`` prefix to the statement name. Default: - No statement name is specified
2792
+
2793
+ :exampleMetadata: infused
2794
+
2795
+ Example::
2796
+
2797
+ import aws_cdk.aws_redshiftserverless as redshiftserverless
2798
+
2799
+ # workgroup: redshiftserverless.CfnWorkgroup
2800
+
2801
+
2802
+ rule = events.Rule(self, "Rule",
2803
+ schedule=events.Schedule.rate(cdk.Duration.hours(1))
2804
+ )
2805
+
2806
+ dlq = sqs.Queue(self, "DeadLetterQueue")
2807
+
2808
+ rule.add_target(targets.RedshiftQuery(workgroup.attr_workgroup_workgroup_arn,
2809
+ database="dev",
2810
+ dead_letter_queue=dlq,
2811
+ sql=["SELECT * FROM foo", "SELECT * FROM baz"]
2812
+ ))
2813
+ '''
2814
+ if __debug__:
2815
+ type_hints = typing.get_type_hints(_typecheckingstub__d13f81540e4b5fba1ebd8aafeb69150df8060d4625c37631f59f81095b2a27b2)
2816
+ check_type(argname="argument database", value=database, expected_type=type_hints["database"])
2817
+ check_type(argname="argument sql", value=sql, expected_type=type_hints["sql"])
2818
+ check_type(argname="argument db_user", value=db_user, expected_type=type_hints["db_user"])
2819
+ check_type(argname="argument dead_letter_queue", value=dead_letter_queue, expected_type=type_hints["dead_letter_queue"])
2820
+ check_type(argname="argument input", value=input, expected_type=type_hints["input"])
2821
+ check_type(argname="argument role", value=role, expected_type=type_hints["role"])
2822
+ check_type(argname="argument secret", value=secret, expected_type=type_hints["secret"])
2823
+ check_type(argname="argument send_event_bridge_event", value=send_event_bridge_event, expected_type=type_hints["send_event_bridge_event"])
2824
+ check_type(argname="argument statement_name", value=statement_name, expected_type=type_hints["statement_name"])
2825
+ self._values: typing.Dict[builtins.str, typing.Any] = {
2826
+ "database": database,
2827
+ "sql": sql,
2828
+ }
2829
+ if db_user is not None:
2830
+ self._values["db_user"] = db_user
2831
+ if dead_letter_queue is not None:
2832
+ self._values["dead_letter_queue"] = dead_letter_queue
2833
+ if input is not None:
2834
+ self._values["input"] = input
2835
+ if role is not None:
2836
+ self._values["role"] = role
2837
+ if secret is not None:
2838
+ self._values["secret"] = secret
2839
+ if send_event_bridge_event is not None:
2840
+ self._values["send_event_bridge_event"] = send_event_bridge_event
2841
+ if statement_name is not None:
2842
+ self._values["statement_name"] = statement_name
2843
+
2844
+ @builtins.property
2845
+ def database(self) -> builtins.str:
2846
+ '''The Amazon Redshift database to run the query against.'''
2847
+ result = self._values.get("database")
2848
+ assert result is not None, "Required property 'database' is missing"
2849
+ return typing.cast(builtins.str, result)
2850
+
2851
+ @builtins.property
2852
+ def sql(self) -> typing.List[builtins.str]:
2853
+ '''The SQL queries to be executed.
2854
+
2855
+ Each query is run sequentially within a single transaction; the next query in the array will only execute after the previous one has successfully completed.
2856
+
2857
+ - When multiple sql queries are included, this will use the ``batchExecuteStatement`` API. Therefore, if any statement fails, the entire transaction is rolled back.
2858
+ - If a single SQL statement is to be executed, this will use the ``executeStatement`` API.
2859
+
2860
+ :default: - No SQL query is specified
2861
+ '''
2862
+ result = self._values.get("sql")
2863
+ assert result is not None, "Required property 'sql' is missing"
2864
+ return typing.cast(typing.List[builtins.str], result)
2865
+
2866
+ @builtins.property
2867
+ def db_user(self) -> typing.Optional[builtins.str]:
2868
+ '''The Amazon Redshift database user to run the query as.
2869
+
2870
+ This is required when authenticating via temporary credentials.
2871
+
2872
+ :default: - No Database user is specified
2873
+ '''
2874
+ result = self._values.get("db_user")
2875
+ return typing.cast(typing.Optional[builtins.str], result)
2876
+
2877
+ @builtins.property
2878
+ def dead_letter_queue(self) -> typing.Optional[_IQueue_7ed6f679]:
2879
+ '''The queue to be used as dead letter queue.
2880
+
2881
+ :default: - No dead letter queue is specified
2882
+ '''
2883
+ result = self._values.get("dead_letter_queue")
2884
+ return typing.cast(typing.Optional[_IQueue_7ed6f679], result)
2885
+
2886
+ @builtins.property
2887
+ def input(self) -> typing.Optional[_RuleTargetInput_6beca786]:
2888
+ '''The input to the state machine execution.
2889
+
2890
+ :default: - the entire EventBridge event
2891
+ '''
2892
+ result = self._values.get("input")
2893
+ return typing.cast(typing.Optional[_RuleTargetInput_6beca786], result)
2894
+
2895
+ @builtins.property
2896
+ def role(self) -> typing.Optional[_IRole_235f5d8e]:
2897
+ '''The IAM role to be used to execute the SQL statement.
2898
+
2899
+ :default: - a new role will be created.
2900
+ '''
2901
+ result = self._values.get("role")
2902
+ return typing.cast(typing.Optional[_IRole_235f5d8e], result)
2903
+
2904
+ @builtins.property
2905
+ def secret(self) -> typing.Optional[_ISecret_6e020e6a]:
2906
+ '''The secret containing the password for the database user.
2907
+
2908
+ This is required when authenticating via Secrets Manager.
2909
+ If the full secret ARN is not specified, this will instead use the secret name.
2910
+
2911
+ :default: - No secret is specified
2912
+ '''
2913
+ result = self._values.get("secret")
2914
+ return typing.cast(typing.Optional[_ISecret_6e020e6a], result)
2915
+
2916
+ @builtins.property
2917
+ def send_event_bridge_event(self) -> typing.Optional[builtins.bool]:
2918
+ '''Should an event be sent back to Event Bridge when the SQL statement is executed.
2919
+
2920
+ :default: false
2921
+ '''
2922
+ result = self._values.get("send_event_bridge_event")
2923
+ return typing.cast(typing.Optional[builtins.bool], result)
2924
+
2925
+ @builtins.property
2926
+ def statement_name(self) -> typing.Optional[builtins.str]:
2927
+ '''The name of the SQL statement.
2928
+
2929
+ You can name the SQL statement for identitfication purposes. If you would like Amazon Redshift to identify the Event Bridge rule, and present it in the Amazon Redshift console, append a ``QS2-`` prefix to the statement name.
2930
+
2931
+ :default: - No statement name is specified
2932
+ '''
2933
+ result = self._values.get("statement_name")
2934
+ return typing.cast(typing.Optional[builtins.str], result)
2935
+
2936
+ def __eq__(self, rhs: typing.Any) -> builtins.bool:
2937
+ return isinstance(rhs, self.__class__) and rhs._values == self._values
2938
+
2939
+ def __ne__(self, rhs: typing.Any) -> builtins.bool:
2940
+ return not (rhs == self)
2941
+
2942
+ def __repr__(self) -> str:
2943
+ return "RedshiftQueryProps(%s)" % ", ".join(
2944
+ k + "=" + repr(v) for k, v in self._values.items()
2945
+ )
2946
+
2947
+
2631
2948
  @jsii.implements(_IRuleTarget_7a91f454)
2632
2949
  class SfnStateMachine(
2633
2950
  metaclass=jsii.JSIIMeta,
@@ -5197,6 +5514,8 @@ __all__ = [
5197
5514
  "LogGroupProps",
5198
5515
  "LogGroupTargetInput",
5199
5516
  "LogGroupTargetInputOptions",
5517
+ "RedshiftQuery",
5518
+ "RedshiftQueryProps",
5200
5519
  "SfnStateMachine",
5201
5520
  "SfnStateMachineProps",
5202
5521
  "SnsTopic",
@@ -5524,6 +5843,44 @@ def _typecheckingstub__12b2a1770edaa7f8ba5d731e85339d65d757aa25fd54d6c6be4746c6a
5524
5843
  """Type checking stubs"""
5525
5844
  pass
5526
5845
 
5846
+ def _typecheckingstub__6f991f630fb494b0dbf6dd8dd11dec71e3b3618d520bce2a1761a05620a3d899(
5847
+ cluster_arn: builtins.str,
5848
+ *,
5849
+ database: builtins.str,
5850
+ sql: typing.Sequence[builtins.str],
5851
+ db_user: typing.Optional[builtins.str] = None,
5852
+ dead_letter_queue: typing.Optional[_IQueue_7ed6f679] = None,
5853
+ input: typing.Optional[_RuleTargetInput_6beca786] = None,
5854
+ role: typing.Optional[_IRole_235f5d8e] = None,
5855
+ secret: typing.Optional[_ISecret_6e020e6a] = None,
5856
+ send_event_bridge_event: typing.Optional[builtins.bool] = None,
5857
+ statement_name: typing.Optional[builtins.str] = None,
5858
+ ) -> None:
5859
+ """Type checking stubs"""
5860
+ pass
5861
+
5862
+ def _typecheckingstub__39a86a8b0444f7c45c252e76fda9d4157fe34d2c363d4a99075556e92c234689(
5863
+ rule: _IRule_af9e3d28,
5864
+ _id: typing.Optional[builtins.str] = None,
5865
+ ) -> None:
5866
+ """Type checking stubs"""
5867
+ pass
5868
+
5869
+ def _typecheckingstub__d13f81540e4b5fba1ebd8aafeb69150df8060d4625c37631f59f81095b2a27b2(
5870
+ *,
5871
+ database: builtins.str,
5872
+ sql: typing.Sequence[builtins.str],
5873
+ db_user: typing.Optional[builtins.str] = None,
5874
+ dead_letter_queue: typing.Optional[_IQueue_7ed6f679] = None,
5875
+ input: typing.Optional[_RuleTargetInput_6beca786] = None,
5876
+ role: typing.Optional[_IRole_235f5d8e] = None,
5877
+ secret: typing.Optional[_ISecret_6e020e6a] = None,
5878
+ send_event_bridge_event: typing.Optional[builtins.bool] = None,
5879
+ statement_name: typing.Optional[builtins.str] = None,
5880
+ ) -> None:
5881
+ """Type checking stubs"""
5882
+ pass
5883
+
5527
5884
  def _typecheckingstub__257316eeebae5ef658a5b570361035fdfb5ab37e96962b24c2e814b0702cba68(
5528
5885
  machine: _IStateMachine_73e8d2b0,
5529
5886
  *,
@@ -13237,17 +13237,16 @@ class ServicePrincipal(
13237
13237
 
13238
13238
  Example::
13239
13239
 
13240
- lambda_role = iam.Role(self, "Role",
13241
- assumed_by=iam.ServicePrincipal("lambda.amazonaws.com"),
13242
- description="Example role..."
13240
+ # definition: sfn.IChainable
13241
+ role = iam.Role(self, "Role",
13242
+ assumed_by=iam.ServicePrincipal("lambda.amazonaws.com")
13243
13243
  )
13244
-
13245
- stream = kinesis.Stream(self, "MyEncryptedStream",
13246
- encryption=kinesis.StreamEncryption.KMS
13244
+ state_machine = sfn.StateMachine(self, "StateMachine",
13245
+ definition_body=sfn.DefinitionBody.from_chainable(definition)
13247
13246
  )
13248
13247
 
13249
- # give lambda permissions to read stream
13250
- stream.grant_read(lambda_role)
13248
+ # Give role permission to get execution history of ALL executions for the state machine
13249
+ state_machine.grant_execution(role, "states:GetExecutionHistory")
13251
13250
  '''
13252
13251
 
13253
13252
  def __init__(