aws-cdk-lib 2.75.1__py3-none-any.whl → 2.76.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 (98) hide show
  1. aws_cdk/__init__.py +245 -259
  2. aws_cdk/_jsii/__init__.py +1 -1
  3. aws_cdk/_jsii/{aws-cdk-lib@2.75.1.jsii.tgz → aws-cdk-lib@2.76.0.jsii.tgz} +0 -0
  4. aws_cdk/aws_amplifyuibuilder/__init__.py +184 -216
  5. aws_cdk/aws_apigateway/__init__.py +95 -148
  6. aws_cdk/aws_appconfig/__init__.py +8 -4
  7. aws_cdk/aws_appflow/__init__.py +27 -52
  8. aws_cdk/aws_appmesh/__init__.py +91 -200
  9. aws_cdk/aws_apprunner/__init__.py +4 -16
  10. aws_cdk/aws_appstream/__init__.py +18 -82
  11. aws_cdk/aws_athena/__init__.py +18 -32
  12. aws_cdk/aws_backup/__init__.py +48 -86
  13. aws_cdk/aws_billingconductor/__init__.py +12 -7
  14. aws_cdk/aws_budgets/__init__.py +8 -17
  15. aws_cdk/aws_certificatemanager/__init__.py +7 -4
  16. aws_cdk/aws_cloudfront/__init__.py +14 -11
  17. aws_cdk/aws_cloudfront_origins/__init__.py +18 -8
  18. aws_cdk/aws_cloudtrail/__init__.py +7 -10
  19. aws_cdk/aws_cloudwatch/__init__.py +63 -35
  20. aws_cdk/aws_codebuild/__init__.py +10 -13
  21. aws_cdk/aws_codecommit/__init__.py +0 -1
  22. aws_cdk/aws_codedeploy/__init__.py +165 -162
  23. aws_cdk/aws_codepipeline/__init__.py +0 -4
  24. aws_cdk/aws_codepipeline_actions/__init__.py +16 -164
  25. aws_cdk/aws_cognito/__init__.py +195 -100
  26. aws_cdk/aws_config/__init__.py +28 -51
  27. aws_cdk/aws_connectcampaigns/__init__.py +5 -6
  28. aws_cdk/aws_databrew/__init__.py +5 -6
  29. aws_cdk/aws_dlm/__init__.py +33 -71
  30. aws_cdk/aws_docdb/__init__.py +20 -76
  31. aws_cdk/aws_dynamodb/__init__.py +7 -14
  32. aws_cdk/aws_ec2/__init__.py +1846 -421
  33. aws_cdk/aws_ecr/__init__.py +1 -2
  34. aws_cdk/aws_ecr_assets/__init__.py +27 -14
  35. aws_cdk/aws_ecs/__init__.py +241 -111
  36. aws_cdk/aws_ecs_patterns/__init__.py +13 -11
  37. aws_cdk/aws_eks/__init__.py +13 -8
  38. aws_cdk/aws_elasticloadbalancing/__init__.py +16 -9
  39. aws_cdk/aws_elasticloadbalancingv2/__init__.py +142 -82
  40. aws_cdk/aws_elasticloadbalancingv2_actions/__init__.py +126 -61
  41. aws_cdk/aws_elasticsearch/__init__.py +0 -7
  42. aws_cdk/aws_emr/__init__.py +7 -16
  43. aws_cdk/aws_emrserverless/__init__.py +14 -18
  44. aws_cdk/aws_events/__init__.py +33 -29
  45. aws_cdk/aws_events_targets/__init__.py +248 -89
  46. aws_cdk/aws_frauddetector/__init__.py +3 -4
  47. aws_cdk/aws_fsx/__init__.py +13 -7
  48. aws_cdk/aws_gamelift/__init__.py +11 -20
  49. aws_cdk/aws_iam/__init__.py +21 -25
  50. aws_cdk/aws_imagebuilder/__init__.py +58 -80
  51. aws_cdk/aws_iot/__init__.py +16 -10
  52. aws_cdk/aws_iotcoredeviceadvisor/__init__.py +16 -26
  53. aws_cdk/aws_iotevents/__init__.py +6 -4
  54. aws_cdk/aws_iotfleetwise/__init__.py +27 -40
  55. aws_cdk/aws_iotsitewise/__init__.py +8 -5
  56. aws_cdk/aws_kinesisfirehose/__init__.py +21 -38
  57. aws_cdk/aws_lambda/__init__.py +59 -48
  58. aws_cdk/aws_lambda_event_sources/__init__.py +6 -21
  59. aws_cdk/aws_logs/__init__.py +5 -7
  60. aws_cdk/aws_macie/__init__.py +22 -15
  61. aws_cdk/aws_mediaconnect/__init__.py +5 -8
  62. aws_cdk/aws_medialive/__init__.py +2 -4
  63. aws_cdk/aws_mediapackage/__init__.py +9 -18
  64. aws_cdk/aws_memorydb/__init__.py +5 -10
  65. aws_cdk/aws_mwaa/__init__.py +8 -4
  66. aws_cdk/aws_nimblestudio/__init__.py +25 -45
  67. aws_cdk/aws_opensearchservice/__init__.py +0 -1
  68. aws_cdk/aws_panorama/__init__.py +11 -12
  69. aws_cdk/aws_personalize/__init__.py +46 -72
  70. aws_cdk/aws_pinpoint/__init__.py +36 -65
  71. aws_cdk/aws_quicksight/__init__.py +9972 -13374
  72. aws_cdk/aws_rds/__init__.py +23 -22
  73. aws_cdk/aws_route53/__init__.py +8 -16
  74. aws_cdk/aws_route53_targets/__init__.py +2 -4
  75. aws_cdk/aws_s3/__init__.py +25 -85
  76. aws_cdk/aws_s3_notifications/__init__.py +0 -3
  77. aws_cdk/aws_sagemaker/__init__.py +6 -2
  78. aws_cdk/aws_secretsmanager/__init__.py +17 -14
  79. aws_cdk/aws_servicecatalog/__init__.py +58 -82
  80. aws_cdk/aws_servicediscovery/__init__.py +4 -6
  81. aws_cdk/aws_ses/__init__.py +21 -34
  82. aws_cdk/aws_sns/__init__.py +4 -8
  83. aws_cdk/aws_ssm/__init__.py +19 -23
  84. aws_cdk/aws_ssmcontacts/__init__.py +10 -6
  85. aws_cdk/aws_stepfunctions/__init__.py +3 -12
  86. aws_cdk/aws_stepfunctions_tasks/__init__.py +7 -12
  87. aws_cdk/aws_timestream/__init__.py +22 -28
  88. aws_cdk/aws_xray/__init__.py +15 -22
  89. aws_cdk/cloud_assembly_schema/__init__.py +14 -6
  90. aws_cdk/custom_resources/__init__.py +2 -3
  91. aws_cdk/pipelines/__init__.py +84 -134
  92. aws_cdk/triggers/__init__.py +46 -61
  93. {aws_cdk_lib-2.75.1.dist-info → aws_cdk_lib-2.76.0.dist-info}/METADATA +47 -92
  94. {aws_cdk_lib-2.75.1.dist-info → aws_cdk_lib-2.76.0.dist-info}/RECORD +98 -98
  95. {aws_cdk_lib-2.75.1.dist-info → aws_cdk_lib-2.76.0.dist-info}/LICENSE +0 -0
  96. {aws_cdk_lib-2.75.1.dist-info → aws_cdk_lib-2.76.0.dist-info}/NOTICE +0 -0
  97. {aws_cdk_lib-2.75.1.dist-info → aws_cdk_lib-2.76.0.dist-info}/WHEEL +0 -0
  98. {aws_cdk_lib-2.75.1.dist-info → aws_cdk_lib-2.76.0.dist-info}/top_level.txt +0 -0
@@ -59,7 +59,7 @@ queue = sqs.Queue(self, "Queue")
59
59
 
60
60
  rule.add_target(targets.LambdaFunction(fn,
61
61
  dead_letter_queue=queue, # Optional: add a dead letter queue
62
- max_event_age=cdk.Duration.hours(2), # Optional: set the maxEventAge retry policy
62
+ max_event_age=Duration.hours(2), # Optional: set the maxEventAge retry policy
63
63
  retry_attempts=2
64
64
  ))
65
65
  ```
@@ -92,16 +92,15 @@ A rule target input can also be specified to modify the event that is sent to th
92
92
  Unlike other event targets, CloudWatchLogs requires a specific input template format.
93
93
 
94
94
  ```python
95
- # Example automatically generated from non-compiling source. May contain errors.
96
95
  import aws_cdk.aws_logs as logs
97
96
  # log_group: logs.LogGroup
98
97
  # rule: events.Rule
99
98
 
100
99
 
101
100
  rule.add_target(targets.CloudWatchLogGroup(log_group,
102
- log_event=targets.LogGroupTargetInput(
103
- timestamp=events.EventField.from("$.time"),
104
- message=events.EventField.from("$.detail-type")
101
+ log_event=targets.LogGroupTargetInput.from_object(
102
+ timestamp=events.EventField.from_path("$.time"),
103
+ message=events.EventField.from_path("$.detail-type")
105
104
  )
106
105
  ))
107
106
  ```
@@ -110,14 +109,13 @@ If you want to use static values to overwrite the `message` make sure that you p
110
109
  value.
111
110
 
112
111
  ```python
113
- # Example automatically generated from non-compiling source. May contain errors.
114
112
  import aws_cdk.aws_logs as logs
115
113
  # log_group: logs.LogGroup
116
114
  # rule: events.Rule
117
115
 
118
116
 
119
117
  rule.add_target(targets.CloudWatchLogGroup(log_group,
120
- log_event=targets.LogGroupTargetInput(
118
+ log_event=targets.LogGroupTargetInput.from_object(
121
119
  message=JSON.stringify({
122
120
  "CustomField": "CustomValue"
123
121
  })
@@ -192,7 +190,7 @@ import aws_cdk.aws_stepfunctions as sfn
192
190
 
193
191
 
194
192
  rule = events.Rule(self, "Rule",
195
- schedule=events.Schedule.rate(cdk.Duration.minutes(1))
193
+ schedule=events.Schedule.rate(Duration.minutes(1))
196
194
  )
197
195
 
198
196
  dlq = sqs.Queue(self, "DeadLetterQueue")
@@ -201,7 +199,7 @@ role = iam.Role(self, "Role",
201
199
  assumed_by=iam.ServicePrincipal("events.amazonaws.com")
202
200
  )
203
201
  state_machine = sfn.StateMachine(self, "SM",
204
- definition=sfn.Wait(self, "Hello", time=sfn.WaitTime.duration(cdk.Duration.seconds(10)))
202
+ definition=sfn.Wait(self, "Hello", time=sfn.WaitTime.duration(Duration.seconds(10)))
205
203
  )
206
204
 
207
205
  rule.add_target(targets.SfnStateMachine(state_machine,
@@ -223,17 +221,17 @@ to the target.
223
221
 
224
222
  ```python
225
223
  # Example automatically generated from non-compiling source. May contain errors.
226
- import aws_cdk.aws_batch as batch
224
+ import aws_cdk.aws_batch_alpha as batch
227
225
  from aws_cdk.aws_ecs import ContainerImage
228
226
 
229
227
 
230
228
  job_queue = batch.JobQueue(self, "MyQueue",
231
- compute_environments=[{
232
- "compute_environment": batch.ComputeEnvironment(self, "ComputeEnvironment",
229
+ compute_environments=[batch.OrderedComputeEnvironment(
230
+ compute_environment=batch.ComputeEnvironment(self, "ComputeEnvironment",
233
231
  managed=False
234
232
  ),
235
- "order": 1
236
- }
233
+ order=1
234
+ )
237
235
  ]
238
236
  )
239
237
 
@@ -246,14 +244,14 @@ job_definition = batch.JobDefinition(self, "MyJob",
246
244
  queue = sqs.Queue(self, "Queue")
247
245
 
248
246
  rule = events.Rule(self, "Rule",
249
- schedule=events.Schedule.rate(cdk.Duration.hours(1))
247
+ schedule=events.Schedule.rate(Duration.hours(1))
250
248
  )
251
249
 
252
250
  rule.add_target(targets.BatchJob(job_queue.job_queue_arn, job_queue, job_definition.job_definition_arn, job_definition,
253
251
  dead_letter_queue=queue,
254
252
  event=events.RuleTargetInput.from_object({"SomeParam": "SomeValue"}),
255
253
  retry_attempts=2,
256
- max_event_age=cdk.Duration.hours(2)
254
+ max_event_age=Duration.hours(2)
257
255
  ))
258
256
  ```
259
257
 
@@ -269,7 +267,7 @@ import aws_cdk.aws_lambda as lambda_
269
267
 
270
268
 
271
269
  rule = events.Rule(self, "Rule",
272
- schedule=events.Schedule.rate(cdk.Duration.minutes(1))
270
+ schedule=events.Schedule.rate(Duration.minutes(1))
273
271
  )
274
272
 
275
273
  fn = lambda_.Function(self, "MyFunc",
@@ -318,7 +316,7 @@ destination = events.ApiDestination(self, "Destination",
318
316
  )
319
317
 
320
318
  rule = events.Rule(self, "Rule",
321
- schedule=events.Schedule.rate(cdk.Duration.minutes(1)),
319
+ schedule=events.Schedule.rate(Duration.minutes(1)),
322
320
  targets=[targets.ApiDestination(destination)]
323
321
  )
324
322
  ```
@@ -337,6 +335,46 @@ rule = events.Rule(self, "Rule",
337
335
  rule.add_target(targets.EventBus(
338
336
  events.EventBus.from_event_bus_arn(self, "External", "arn:aws:events:eu-west-1:999999999999:event-bus/test-bus")))
339
337
  ```
338
+
339
+ ## Run an ECS Task
340
+
341
+ Use the `EcsTask` target to run an ECS Task.
342
+
343
+ The code snippet below creates a scheduled event rule that will run the task described in `taskDefinition` every hour.
344
+
345
+ ### Tagging Tasks
346
+
347
+ By default, ECS tasks run from EventBridge targets will not have tags applied to
348
+ them. You can set the `propagateTags` field to propagate the tags set on the task
349
+ definition to the task initialized by the event trigger.
350
+
351
+ If you want to set tags independent of those applied to the TaskDefinition, you
352
+ can use the `tags` array. Both of these fields can be used together or separately
353
+ to set tags on the triggered task.
354
+
355
+ ```python
356
+ # Example automatically generated from non-compiling source. May contain errors.
357
+ import aws_cdk.aws_ecs as ecs
358
+ # cluster: ecs.ICluster
359
+ # task_definition: ecs.TaskDefinition
360
+
361
+
362
+ rule = events.Rule(self, "Rule",
363
+ schedule=events.Schedule.rate(cdk.Duration.hours(1))
364
+ )
365
+
366
+ rule.add_target(
367
+ targets.EcsTask(
368
+ cluster=cluster,
369
+ task_definition=task_definition,
370
+ propagate_tags=ecs.PropagatedTagSource.TASK_DEFINITION,
371
+ tags=[targets.Tag(
372
+ key="my-tag",
373
+ value="my-tag-value"
374
+ )
375
+ ]
376
+ ))
377
+ ```
340
378
  '''
341
379
  import abc
342
380
  import builtins
@@ -365,6 +403,7 @@ from ..aws_ecs import (
365
403
  FargatePlatformVersion as _FargatePlatformVersion_55d8be5c,
366
404
  ICluster as _ICluster_16cddd09,
367
405
  ITaskDefinition as _ITaskDefinition_889ba4d8,
406
+ PropagatedTagSource as _PropagatedTagSource_ad4e874a,
368
407
  )
369
408
  from ..aws_events import (
370
409
  IApiDestination as _IApiDestination_44cdeedd,
@@ -410,7 +449,7 @@ class ApiDestination(
410
449
  )
411
450
 
412
451
  rule = events.Rule(self, "Rule",
413
- schedule=events.Schedule.rate(cdk.Duration.minutes(1)),
452
+ schedule=events.Schedule.rate(Duration.minutes(1)),
414
453
  targets=[targets.ApiDestination(destination)]
415
454
  )
416
455
  '''
@@ -489,7 +528,7 @@ class ApiGateway(
489
528
 
490
529
 
491
530
  rule = events.Rule(self, "Rule",
492
- schedule=events.Schedule.rate(cdk.Duration.minutes(1))
531
+ schedule=events.Schedule.rate(Duration.minutes(1))
493
532
  )
494
533
 
495
534
  fn = lambda_.Function(self, "MyFunc",
@@ -976,17 +1015,17 @@ class BatchJob(
976
1015
  Example::
977
1016
 
978
1017
  # Example automatically generated from non-compiling source. May contain errors.
979
- import aws_cdk.aws_batch as batch
1018
+ import aws_cdk.aws_batch_alpha as batch
980
1019
  from aws_cdk.aws_ecs import ContainerImage
981
1020
 
982
1021
 
983
1022
  job_queue = batch.JobQueue(self, "MyQueue",
984
- compute_environments=[{
985
- "compute_environment": batch.ComputeEnvironment(self, "ComputeEnvironment",
1023
+ compute_environments=[batch.OrderedComputeEnvironment(
1024
+ compute_environment=batch.ComputeEnvironment(self, "ComputeEnvironment",
986
1025
  managed=False
987
1026
  ),
988
- "order": 1
989
- }
1027
+ order=1
1028
+ )
990
1029
  ]
991
1030
  )
992
1031
 
@@ -999,14 +1038,14 @@ class BatchJob(
999
1038
  queue = sqs.Queue(self, "Queue")
1000
1039
 
1001
1040
  rule = events.Rule(self, "Rule",
1002
- schedule=events.Schedule.rate(cdk.Duration.hours(1))
1041
+ schedule=events.Schedule.rate(Duration.hours(1))
1003
1042
  )
1004
1043
 
1005
1044
  rule.add_target(targets.BatchJob(job_queue.job_queue_arn, job_queue, job_definition.job_definition_arn, job_definition,
1006
1045
  dead_letter_queue=queue,
1007
1046
  event=events.RuleTargetInput.from_object({"SomeParam": "SomeValue"}),
1008
1047
  retry_attempts=2,
1009
- max_event_age=cdk.Duration.hours(2)
1048
+ max_event_age=Duration.hours(2)
1010
1049
  ))
1011
1050
  '''
1012
1051
 
@@ -1085,14 +1124,13 @@ class CloudWatchLogGroup(
1085
1124
 
1086
1125
  Example::
1087
1126
 
1088
- # Example automatically generated from non-compiling source. May contain errors.
1089
1127
  import aws_cdk.aws_logs as logs
1090
1128
  # log_group: logs.LogGroup
1091
1129
  # rule: events.Rule
1092
1130
 
1093
1131
 
1094
1132
  rule.add_target(targets.CloudWatchLogGroup(log_group,
1095
- log_event=targets.LogGroupTargetInput(
1133
+ log_event=targets.LogGroupTargetInput.from_object(
1096
1134
  message=JSON.stringify({
1097
1135
  "CustomField": "CustomValue"
1098
1136
  })
@@ -1445,26 +1483,31 @@ class EcsTask(
1445
1483
  ):
1446
1484
  '''Start a task on an ECS cluster.
1447
1485
 
1448
- :exampleMetadata: fixture=basic infused
1486
+ :exampleMetadata: infused
1449
1487
 
1450
1488
  Example::
1451
1489
 
1452
- from aws_cdk.aws_events import Rule, Schedule
1453
- from aws_cdk.aws_events_targets import EcsTask
1454
- from aws_cdk.aws_ecs import Cluster, TaskDefinition
1455
- from aws_cdk.aws_iam import Role
1456
-
1457
- # cluster: Cluster
1458
- # task_definition: TaskDefinition
1459
- # role: Role
1460
-
1490
+ # Example automatically generated from non-compiling source. May contain errors.
1491
+ import aws_cdk.aws_ecs as ecs
1492
+ # cluster: ecs.ICluster
1493
+ # task_definition: ecs.TaskDefinition
1461
1494
 
1462
- ecs_task_target = EcsTask(cluster=cluster, task_definition=task_definition, role=role)
1463
1495
 
1464
- Rule(self, "ScheduleRule",
1465
- schedule=Schedule.cron(minute="0", hour="4"),
1466
- targets=[ecs_task_target]
1496
+ rule = events.Rule(self, "Rule",
1497
+ schedule=events.Schedule.rate(cdk.Duration.hours(1))
1467
1498
  )
1499
+
1500
+ rule.add_target(
1501
+ targets.EcsTask(
1502
+ cluster=cluster,
1503
+ task_definition=task_definition,
1504
+ propagate_tags=ecs.PropagatedTagSource.TASK_DEFINITION,
1505
+ tags=[targets.Tag(
1506
+ key="my-tag",
1507
+ value="my-tag-value"
1508
+ )
1509
+ ]
1510
+ ))
1468
1511
  '''
1469
1512
 
1470
1513
  def __init__(
@@ -1474,9 +1517,11 @@ class EcsTask(
1474
1517
  task_definition: _ITaskDefinition_889ba4d8,
1475
1518
  container_overrides: typing.Optional[typing.Sequence[typing.Union[ContainerOverride, typing.Dict[builtins.str, typing.Any]]]] = None,
1476
1519
  platform_version: typing.Optional[_FargatePlatformVersion_55d8be5c] = None,
1520
+ propagate_tags: typing.Optional[_PropagatedTagSource_ad4e874a] = None,
1477
1521
  role: typing.Optional[_IRole_235f5d8e] = None,
1478
1522
  security_groups: typing.Optional[typing.Sequence[_ISecurityGroup_acf8a799]] = None,
1479
1523
  subnet_selection: typing.Optional[typing.Union[_SubnetSelection_e57d76df, typing.Dict[builtins.str, typing.Any]]] = None,
1524
+ tags: typing.Optional[typing.Sequence[typing.Union["Tag", typing.Dict[builtins.str, typing.Any]]]] = None,
1480
1525
  task_count: typing.Optional[jsii.Number] = None,
1481
1526
  dead_letter_queue: typing.Optional[_IQueue_7ed6f679] = None,
1482
1527
  max_event_age: typing.Optional[_Duration_4839e8c3] = None,
@@ -1487,9 +1532,11 @@ class EcsTask(
1487
1532
  :param task_definition: Task Definition of the task that should be started.
1488
1533
  :param container_overrides: Container setting overrides. Key is the name of the container to override, value is the values you want to override.
1489
1534
  :param platform_version: The platform version on which to run your task. Unless you have specific compatibility requirements, you don't need to specify this. Default: - ECS will set the Fargate platform version to 'LATEST'
1535
+ :param propagate_tags: Specifies whether to propagate the tags from the task definition to the task. If no value is specified, the tags are not propagated. Default: - Tags will not be propagated
1490
1536
  :param role: Existing IAM role to run the ECS task. Default: A new IAM role is created
1491
1537
  :param security_groups: Existing security groups to use for the task's ENIs. (Only applicable in case the TaskDefinition is configured for AwsVpc networking) Default: A new security group is created
1492
1538
  :param subnet_selection: In what subnets to place the task's ENIs. (Only applicable in case the TaskDefinition is configured for AwsVpc networking) Default: Private subnets
1539
+ :param tags: The metadata that you apply to the task to help you categorize and organize them. Each tag consists of a key and an optional value, both of which you define. Default: - No additional tags are applied to the task
1493
1540
  :param task_count: How many tasks should be started when this event is triggered. Default: 1
1494
1541
  :param dead_letter_queue: The SQS queue to be used as deadLetterQueue. Check out the `considerations for using a dead-letter queue <https://docs.aws.amazon.com/eventbridge/latest/userguide/rule-dlq.html#dlq-considerations>`_. The events not successfully delivered are automatically retried for a specified period of time, depending on the retry policy of the target. If an event is not delivered before all retry attempts are exhausted, it will be sent to the dead letter queue. Default: - no dead-letter queue
1495
1542
  :param max_event_age: The maximum age of a request that Lambda sends to a function for processing. Minimum value of 60. Maximum value of 86400. Default: Duration.hours(24)
@@ -1500,9 +1547,11 @@ class EcsTask(
1500
1547
  task_definition=task_definition,
1501
1548
  container_overrides=container_overrides,
1502
1549
  platform_version=platform_version,
1550
+ propagate_tags=propagate_tags,
1503
1551
  role=role,
1504
1552
  security_groups=security_groups,
1505
1553
  subnet_selection=subnet_selection,
1554
+ tags=tags,
1506
1555
  task_count=task_count,
1507
1556
  dead_letter_queue=dead_letter_queue,
1508
1557
  max_event_age=max_event_age,
@@ -1957,7 +2006,7 @@ class LambdaFunction(
1957
2006
 
1958
2007
  rule.add_target(targets.LambdaFunction(fn,
1959
2008
  dead_letter_queue=queue, # Optional: add a dead letter queue
1960
- max_event_age=cdk.Duration.hours(2), # Optional: set the maxEventAge retry policy
2009
+ max_event_age=Duration.hours(2), # Optional: set the maxEventAge retry policy
1961
2010
  retry_attempts=2
1962
2011
  ))
1963
2012
  '''
@@ -2018,16 +2067,15 @@ class LogGroupTargetInput(
2018
2067
 
2019
2068
  Example::
2020
2069
 
2021
- # Example automatically generated from non-compiling source. May contain errors.
2022
2070
  import aws_cdk.aws_logs as logs
2023
2071
  # log_group: logs.LogGroup
2024
2072
  # rule: events.Rule
2025
2073
 
2026
2074
 
2027
2075
  rule.add_target(targets.CloudWatchLogGroup(log_group,
2028
- log_event=targets.LogGroupTargetInput(
2029
- timestamp=events.EventField.from("$.time"),
2030
- message=events.EventField.from("$.detail-type")
2076
+ log_event=targets.LogGroupTargetInput.from_object(
2077
+ timestamp=events.EventField.from_path("$.time"),
2078
+ message=events.EventField.from_path("$.detail-type")
2031
2079
  )
2032
2080
  ))
2033
2081
  '''
@@ -2098,21 +2146,21 @@ class LogGroupTargetInputOptions:
2098
2146
  :param message: The value provided here will be used in the Log "message" field. This field must be a string. If an object is passed (e.g. JSON data) it will not throw an error, but the message that makes it to CloudWatch logs will be incorrect. This is a likely scenario if doing something like: EventField.fromPath('$.detail') since in most cases the ``detail`` field contains JSON data. Default: EventField.detailType
2099
2147
  :param timestamp: The timestamp that will appear in the CloudWatch Logs record. Default: EventField.time
2100
2148
 
2101
- :exampleMetadata: fixture=_generated
2149
+ :exampleMetadata: infused
2102
2150
 
2103
2151
  Example::
2104
2152
 
2105
- # The code below shows an example of how to instantiate this type.
2106
- # The values are placeholders you should change.
2107
- from aws_cdk import aws_events_targets as events_targets
2153
+ import aws_cdk.aws_logs as logs
2154
+ # log_group: logs.LogGroup
2155
+ # rule: events.Rule
2108
2156
 
2109
- # message: Any
2110
- # timestamp: Any
2111
2157
 
2112
- log_group_target_input_options = events_targets.LogGroupTargetInputOptions(
2113
- message=message,
2114
- timestamp=timestamp
2115
- )
2158
+ rule.add_target(targets.CloudWatchLogGroup(log_group,
2159
+ log_event=targets.LogGroupTargetInput.from_object(
2160
+ timestamp=events.EventField.from_path("$.time"),
2161
+ message=events.EventField.from_path("$.detail-type")
2162
+ )
2163
+ ))
2116
2164
  '''
2117
2165
  if __debug__:
2118
2166
  type_hints = typing.get_type_hints(_typecheckingstub__12b2a1770edaa7f8ba5d731e85339d65d757aa25fd54d6c6be4746c6a4f4a070)
@@ -2176,7 +2224,7 @@ class SfnStateMachine(
2176
2224
 
2177
2225
 
2178
2226
  rule = events.Rule(self, "Rule",
2179
- schedule=events.Schedule.rate(cdk.Duration.minutes(1))
2227
+ schedule=events.Schedule.rate(Duration.minutes(1))
2180
2228
  )
2181
2229
 
2182
2230
  dlq = sqs.Queue(self, "DeadLetterQueue")
@@ -2185,7 +2233,7 @@ class SfnStateMachine(
2185
2233
  assumed_by=iam.ServicePrincipal("events.amazonaws.com")
2186
2234
  )
2187
2235
  state_machine = sfn.StateMachine(self, "SM",
2188
- definition=sfn.Wait(self, "Hello", time=sfn.WaitTime.duration(cdk.Duration.seconds(10)))
2236
+ definition=sfn.Wait(self, "Hello", time=sfn.WaitTime.duration(Duration.seconds(10)))
2189
2237
  )
2190
2238
 
2191
2239
  rule.add_target(targets.SfnStateMachine(state_machine,
@@ -2388,6 +2436,68 @@ class SqsQueue(
2388
2436
  return typing.cast(_IQueue_7ed6f679, jsii.get(self, "queue"))
2389
2437
 
2390
2438
 
2439
+ @jsii.data_type(
2440
+ jsii_type="aws-cdk-lib.aws_events_targets.Tag",
2441
+ jsii_struct_bases=[],
2442
+ name_mapping={"key": "key", "value": "value"},
2443
+ )
2444
+ class Tag:
2445
+ def __init__(self, *, key: builtins.str, value: builtins.str) -> None:
2446
+ '''Metadata that you apply to a resource to help categorize and organize the resource.
2447
+
2448
+ Each tag consists of a key and an optional value, both of which you define.
2449
+
2450
+ :param key: Key is the name of the tag.
2451
+ :param value: Value is the metadata contents of the tag.
2452
+
2453
+ :exampleMetadata: fixture=_generated
2454
+
2455
+ Example::
2456
+
2457
+ # The code below shows an example of how to instantiate this type.
2458
+ # The values are placeholders you should change.
2459
+ from aws_cdk import aws_events_targets as events_targets
2460
+
2461
+ tag = events_targets.Tag(
2462
+ key="key",
2463
+ value="value"
2464
+ )
2465
+ '''
2466
+ if __debug__:
2467
+ type_hints = typing.get_type_hints(_typecheckingstub__a813f48d70b31d8149568e4c733eee0b3ddf93c3d8ee22172032406da2f91b10)
2468
+ check_type(argname="argument key", value=key, expected_type=type_hints["key"])
2469
+ check_type(argname="argument value", value=value, expected_type=type_hints["value"])
2470
+ self._values: typing.Dict[builtins.str, typing.Any] = {
2471
+ "key": key,
2472
+ "value": value,
2473
+ }
2474
+
2475
+ @builtins.property
2476
+ def key(self) -> builtins.str:
2477
+ '''Key is the name of the tag.'''
2478
+ result = self._values.get("key")
2479
+ assert result is not None, "Required property 'key' is missing"
2480
+ return typing.cast(builtins.str, result)
2481
+
2482
+ @builtins.property
2483
+ def value(self) -> builtins.str:
2484
+ '''Value is the metadata contents of the tag.'''
2485
+ result = self._values.get("value")
2486
+ assert result is not None, "Required property 'value' is missing"
2487
+ return typing.cast(builtins.str, result)
2488
+
2489
+ def __eq__(self, rhs: typing.Any) -> builtins.bool:
2490
+ return isinstance(rhs, self.__class__) and rhs._values == self._values
2491
+
2492
+ def __ne__(self, rhs: typing.Any) -> builtins.bool:
2493
+ return not (rhs == self)
2494
+
2495
+ def __repr__(self) -> str:
2496
+ return "Tag(%s)" % ", ".join(
2497
+ k + "=" + repr(v) for k, v in self._values.items()
2498
+ )
2499
+
2500
+
2391
2501
  @jsii.data_type(
2392
2502
  jsii_type="aws-cdk-lib.aws_events_targets.TargetBaseProps",
2393
2503
  jsii_struct_bases=[],
@@ -2821,7 +2931,7 @@ class ApiGatewayProps(TargetBaseProps):
2821
2931
 
2822
2932
 
2823
2933
  rule = events.Rule(self, "Rule",
2824
- schedule=events.Schedule.rate(cdk.Duration.minutes(1))
2934
+ schedule=events.Schedule.rate(Duration.minutes(1))
2825
2935
  )
2826
2936
 
2827
2937
  fn = lambda_.Function(self, "MyFunc",
@@ -3054,17 +3164,17 @@ class BatchJobProps(TargetBaseProps):
3054
3164
  Example::
3055
3165
 
3056
3166
  # Example automatically generated from non-compiling source. May contain errors.
3057
- import aws_cdk.aws_batch as batch
3167
+ import aws_cdk.aws_batch_alpha as batch
3058
3168
  from aws_cdk.aws_ecs import ContainerImage
3059
3169
 
3060
3170
 
3061
3171
  job_queue = batch.JobQueue(self, "MyQueue",
3062
- compute_environments=[{
3063
- "compute_environment": batch.ComputeEnvironment(self, "ComputeEnvironment",
3172
+ compute_environments=[batch.OrderedComputeEnvironment(
3173
+ compute_environment=batch.ComputeEnvironment(self, "ComputeEnvironment",
3064
3174
  managed=False
3065
3175
  ),
3066
- "order": 1
3067
- }
3176
+ order=1
3177
+ )
3068
3178
  ]
3069
3179
  )
3070
3180
 
@@ -3077,14 +3187,14 @@ class BatchJobProps(TargetBaseProps):
3077
3187
  queue = sqs.Queue(self, "Queue")
3078
3188
 
3079
3189
  rule = events.Rule(self, "Rule",
3080
- schedule=events.Schedule.rate(cdk.Duration.hours(1))
3190
+ schedule=events.Schedule.rate(Duration.hours(1))
3081
3191
  )
3082
3192
 
3083
3193
  rule.add_target(targets.BatchJob(job_queue.job_queue_arn, job_queue, job_definition.job_definition_arn, job_definition,
3084
3194
  dead_letter_queue=queue,
3085
3195
  event=events.RuleTargetInput.from_object({"SomeParam": "SomeValue"}),
3086
3196
  retry_attempts=2,
3087
- max_event_age=cdk.Duration.hours(2)
3197
+ max_event_age=Duration.hours(2)
3088
3198
  ))
3089
3199
  '''
3090
3200
  if __debug__:
@@ -3478,9 +3588,11 @@ class CodePipelineTargetOptions(TargetBaseProps):
3478
3588
  "task_definition": "taskDefinition",
3479
3589
  "container_overrides": "containerOverrides",
3480
3590
  "platform_version": "platformVersion",
3591
+ "propagate_tags": "propagateTags",
3481
3592
  "role": "role",
3482
3593
  "security_groups": "securityGroups",
3483
3594
  "subnet_selection": "subnetSelection",
3595
+ "tags": "tags",
3484
3596
  "task_count": "taskCount",
3485
3597
  },
3486
3598
  )
@@ -3495,9 +3607,11 @@ class EcsTaskProps(TargetBaseProps):
3495
3607
  task_definition: _ITaskDefinition_889ba4d8,
3496
3608
  container_overrides: typing.Optional[typing.Sequence[typing.Union[ContainerOverride, typing.Dict[builtins.str, typing.Any]]]] = None,
3497
3609
  platform_version: typing.Optional[_FargatePlatformVersion_55d8be5c] = None,
3610
+ propagate_tags: typing.Optional[_PropagatedTagSource_ad4e874a] = None,
3498
3611
  role: typing.Optional[_IRole_235f5d8e] = None,
3499
3612
  security_groups: typing.Optional[typing.Sequence[_ISecurityGroup_acf8a799]] = None,
3500
3613
  subnet_selection: typing.Optional[typing.Union[_SubnetSelection_e57d76df, typing.Dict[builtins.str, typing.Any]]] = None,
3614
+ tags: typing.Optional[typing.Sequence[typing.Union[Tag, typing.Dict[builtins.str, typing.Any]]]] = None,
3501
3615
  task_count: typing.Optional[jsii.Number] = None,
3502
3616
  ) -> None:
3503
3617
  '''Properties to define an ECS Event Task.
@@ -3509,31 +3623,38 @@ class EcsTaskProps(TargetBaseProps):
3509
3623
  :param task_definition: Task Definition of the task that should be started.
3510
3624
  :param container_overrides: Container setting overrides. Key is the name of the container to override, value is the values you want to override.
3511
3625
  :param platform_version: The platform version on which to run your task. Unless you have specific compatibility requirements, you don't need to specify this. Default: - ECS will set the Fargate platform version to 'LATEST'
3626
+ :param propagate_tags: Specifies whether to propagate the tags from the task definition to the task. If no value is specified, the tags are not propagated. Default: - Tags will not be propagated
3512
3627
  :param role: Existing IAM role to run the ECS task. Default: A new IAM role is created
3513
3628
  :param security_groups: Existing security groups to use for the task's ENIs. (Only applicable in case the TaskDefinition is configured for AwsVpc networking) Default: A new security group is created
3514
3629
  :param subnet_selection: In what subnets to place the task's ENIs. (Only applicable in case the TaskDefinition is configured for AwsVpc networking) Default: Private subnets
3630
+ :param tags: The metadata that you apply to the task to help you categorize and organize them. Each tag consists of a key and an optional value, both of which you define. Default: - No additional tags are applied to the task
3515
3631
  :param task_count: How many tasks should be started when this event is triggered. Default: 1
3516
3632
 
3517
- :exampleMetadata: fixture=basic infused
3633
+ :exampleMetadata: infused
3518
3634
 
3519
3635
  Example::
3520
3636
 
3521
- from aws_cdk.aws_events import Rule, Schedule
3522
- from aws_cdk.aws_events_targets import EcsTask
3523
- from aws_cdk.aws_ecs import Cluster, TaskDefinition
3524
- from aws_cdk.aws_iam import Role
3525
-
3526
- # cluster: Cluster
3527
- # task_definition: TaskDefinition
3528
- # role: Role
3529
-
3637
+ # Example automatically generated from non-compiling source. May contain errors.
3638
+ import aws_cdk.aws_ecs as ecs
3639
+ # cluster: ecs.ICluster
3640
+ # task_definition: ecs.TaskDefinition
3530
3641
 
3531
- ecs_task_target = EcsTask(cluster=cluster, task_definition=task_definition, role=role)
3532
3642
 
3533
- Rule(self, "ScheduleRule",
3534
- schedule=Schedule.cron(minute="0", hour="4"),
3535
- targets=[ecs_task_target]
3643
+ rule = events.Rule(self, "Rule",
3644
+ schedule=events.Schedule.rate(cdk.Duration.hours(1))
3536
3645
  )
3646
+
3647
+ rule.add_target(
3648
+ targets.EcsTask(
3649
+ cluster=cluster,
3650
+ task_definition=task_definition,
3651
+ propagate_tags=ecs.PropagatedTagSource.TASK_DEFINITION,
3652
+ tags=[targets.Tag(
3653
+ key="my-tag",
3654
+ value="my-tag-value"
3655
+ )
3656
+ ]
3657
+ ))
3537
3658
  '''
3538
3659
  if isinstance(subnet_selection, dict):
3539
3660
  subnet_selection = _SubnetSelection_e57d76df(**subnet_selection)
@@ -3546,9 +3667,11 @@ class EcsTaskProps(TargetBaseProps):
3546
3667
  check_type(argname="argument task_definition", value=task_definition, expected_type=type_hints["task_definition"])
3547
3668
  check_type(argname="argument container_overrides", value=container_overrides, expected_type=type_hints["container_overrides"])
3548
3669
  check_type(argname="argument platform_version", value=platform_version, expected_type=type_hints["platform_version"])
3670
+ check_type(argname="argument propagate_tags", value=propagate_tags, expected_type=type_hints["propagate_tags"])
3549
3671
  check_type(argname="argument role", value=role, expected_type=type_hints["role"])
3550
3672
  check_type(argname="argument security_groups", value=security_groups, expected_type=type_hints["security_groups"])
3551
3673
  check_type(argname="argument subnet_selection", value=subnet_selection, expected_type=type_hints["subnet_selection"])
3674
+ check_type(argname="argument tags", value=tags, expected_type=type_hints["tags"])
3552
3675
  check_type(argname="argument task_count", value=task_count, expected_type=type_hints["task_count"])
3553
3676
  self._values: typing.Dict[builtins.str, typing.Any] = {
3554
3677
  "cluster": cluster,
@@ -3564,12 +3687,16 @@ class EcsTaskProps(TargetBaseProps):
3564
3687
  self._values["container_overrides"] = container_overrides
3565
3688
  if platform_version is not None:
3566
3689
  self._values["platform_version"] = platform_version
3690
+ if propagate_tags is not None:
3691
+ self._values["propagate_tags"] = propagate_tags
3567
3692
  if role is not None:
3568
3693
  self._values["role"] = role
3569
3694
  if security_groups is not None:
3570
3695
  self._values["security_groups"] = security_groups
3571
3696
  if subnet_selection is not None:
3572
3697
  self._values["subnet_selection"] = subnet_selection
3698
+ if tags is not None:
3699
+ self._values["tags"] = tags
3573
3700
  if task_count is not None:
3574
3701
  self._values["task_count"] = task_count
3575
3702
 
@@ -3647,6 +3774,17 @@ class EcsTaskProps(TargetBaseProps):
3647
3774
  result = self._values.get("platform_version")
3648
3775
  return typing.cast(typing.Optional[_FargatePlatformVersion_55d8be5c], result)
3649
3776
 
3777
+ @builtins.property
3778
+ def propagate_tags(self) -> typing.Optional[_PropagatedTagSource_ad4e874a]:
3779
+ '''Specifies whether to propagate the tags from the task definition to the task.
3780
+
3781
+ If no value is specified, the tags are not propagated.
3782
+
3783
+ :default: - Tags will not be propagated
3784
+ '''
3785
+ result = self._values.get("propagate_tags")
3786
+ return typing.cast(typing.Optional[_PropagatedTagSource_ad4e874a], result)
3787
+
3650
3788
  @builtins.property
3651
3789
  def role(self) -> typing.Optional[_IRole_235f5d8e]:
3652
3790
  '''Existing IAM role to run the ECS task.
@@ -3678,6 +3816,17 @@ class EcsTaskProps(TargetBaseProps):
3678
3816
  result = self._values.get("subnet_selection")
3679
3817
  return typing.cast(typing.Optional[_SubnetSelection_e57d76df], result)
3680
3818
 
3819
+ @builtins.property
3820
+ def tags(self) -> typing.Optional[typing.List[Tag]]:
3821
+ '''The metadata that you apply to the task to help you categorize and organize them.
3822
+
3823
+ Each tag consists of a key and an optional value, both of which you define.
3824
+
3825
+ :default: - No additional tags are applied to the task
3826
+ '''
3827
+ result = self._values.get("tags")
3828
+ return typing.cast(typing.Optional[typing.List[Tag]], result)
3829
+
3681
3830
  @builtins.property
3682
3831
  def task_count(self) -> typing.Optional[jsii.Number]:
3683
3832
  '''How many tasks should be started when this event is triggered.
@@ -3748,7 +3897,7 @@ class LambdaFunctionProps(TargetBaseProps):
3748
3897
 
3749
3898
  rule.add_target(targets.LambdaFunction(fn,
3750
3899
  dead_letter_queue=queue, # Optional: add a dead letter queue
3751
- max_event_age=cdk.Duration.hours(2), # Optional: set the maxEventAge retry policy
3900
+ max_event_age=Duration.hours(2), # Optional: set the maxEventAge retry policy
3752
3901
  retry_attempts=2
3753
3902
  ))
3754
3903
  '''
@@ -3861,16 +4010,15 @@ class LogGroupProps(TargetBaseProps):
3861
4010
 
3862
4011
  Example::
3863
4012
 
3864
- # Example automatically generated from non-compiling source. May contain errors.
3865
4013
  import aws_cdk.aws_logs as logs
3866
4014
  # log_group: logs.LogGroup
3867
4015
  # rule: events.Rule
3868
4016
 
3869
4017
 
3870
4018
  rule.add_target(targets.CloudWatchLogGroup(log_group,
3871
- log_event=targets.LogGroupTargetInput(
3872
- timestamp=events.EventField.from("$.time"),
3873
- message=events.EventField.from("$.detail-type")
4019
+ log_event=targets.LogGroupTargetInput.from_object(
4020
+ timestamp=events.EventField.from_path("$.time"),
4021
+ message=events.EventField.from_path("$.detail-type")
3874
4022
  )
3875
4023
  ))
3876
4024
  '''
@@ -4006,7 +4154,7 @@ class SfnStateMachineProps(TargetBaseProps):
4006
4154
 
4007
4155
 
4008
4156
  rule = events.Rule(self, "Rule",
4009
- schedule=events.Schedule.rate(cdk.Duration.minutes(1))
4157
+ schedule=events.Schedule.rate(Duration.minutes(1))
4010
4158
  )
4011
4159
 
4012
4160
  dlq = sqs.Queue(self, "DeadLetterQueue")
@@ -4015,7 +4163,7 @@ class SfnStateMachineProps(TargetBaseProps):
4015
4163
  assumed_by=iam.ServicePrincipal("events.amazonaws.com")
4016
4164
  )
4017
4165
  state_machine = sfn.StateMachine(self, "SM",
4018
- definition=sfn.Wait(self, "Hello", time=sfn.WaitTime.duration(cdk.Duration.seconds(10)))
4166
+ definition=sfn.Wait(self, "Hello", time=sfn.WaitTime.duration(Duration.seconds(10)))
4019
4167
  )
4020
4168
 
4021
4169
  rule.add_target(targets.SfnStateMachine(state_machine,
@@ -4398,6 +4546,7 @@ __all__ = [
4398
4546
  "SnsTopicProps",
4399
4547
  "SqsQueue",
4400
4548
  "SqsQueueProps",
4549
+ "Tag",
4401
4550
  "TargetBaseProps",
4402
4551
  "TaskEnvironmentVariable",
4403
4552
  ]
@@ -4738,6 +4887,14 @@ def _typecheckingstub__d7bbb7c546d67f5f999da3b2a71dc36c03ae5d8723a592b50de5b0193
4738
4887
  """Type checking stubs"""
4739
4888
  pass
4740
4889
 
4890
+ def _typecheckingstub__a813f48d70b31d8149568e4c733eee0b3ddf93c3d8ee22172032406da2f91b10(
4891
+ *,
4892
+ key: builtins.str,
4893
+ value: builtins.str,
4894
+ ) -> None:
4895
+ """Type checking stubs"""
4896
+ pass
4897
+
4741
4898
  def _typecheckingstub__5c149bf0de902d492c0a50daf03a233ef8286c2fb8799f305c9e4b91ffc8d577(
4742
4899
  *,
4743
4900
  dead_letter_queue: typing.Optional[_IQueue_7ed6f679] = None,
@@ -4829,9 +4986,11 @@ def _typecheckingstub__3624031da4f9372e2ccdb3e422123cc459d01922cc36bab5b96caa98f
4829
4986
  task_definition: _ITaskDefinition_889ba4d8,
4830
4987
  container_overrides: typing.Optional[typing.Sequence[typing.Union[ContainerOverride, typing.Dict[builtins.str, typing.Any]]]] = None,
4831
4988
  platform_version: typing.Optional[_FargatePlatformVersion_55d8be5c] = None,
4989
+ propagate_tags: typing.Optional[_PropagatedTagSource_ad4e874a] = None,
4832
4990
  role: typing.Optional[_IRole_235f5d8e] = None,
4833
4991
  security_groups: typing.Optional[typing.Sequence[_ISecurityGroup_acf8a799]] = None,
4834
4992
  subnet_selection: typing.Optional[typing.Union[_SubnetSelection_e57d76df, typing.Dict[builtins.str, typing.Any]]] = None,
4993
+ tags: typing.Optional[typing.Sequence[typing.Union[Tag, typing.Dict[builtins.str, typing.Any]]]] = None,
4835
4994
  task_count: typing.Optional[jsii.Number] = None,
4836
4995
  ) -> None:
4837
4996
  """Type checking stubs"""