aws-cdk-lib 2.73.0__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 (111) 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.73.0.jsii.tgz → aws-cdk-lib@2.76.0.jsii.tgz} +0 -0
  4. aws_cdk/aws_amplifyuibuilder/__init__.py +182 -214
  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_batch/__init__.py +9 -2
  14. aws_cdk/aws_billingconductor/__init__.py +12 -7
  15. aws_cdk/aws_budgets/__init__.py +8 -17
  16. aws_cdk/aws_certificatemanager/__init__.py +7 -4
  17. aws_cdk/aws_cloudfront/__init__.py +14 -11
  18. aws_cdk/aws_cloudfront_origins/__init__.py +18 -8
  19. aws_cdk/aws_cloudtrail/__init__.py +7 -14
  20. aws_cdk/aws_cloudwatch/__init__.py +63 -35
  21. aws_cdk/aws_codebuild/__init__.py +10 -13
  22. aws_cdk/aws_codecommit/__init__.py +0 -1
  23. aws_cdk/aws_codedeploy/__init__.py +165 -162
  24. aws_cdk/aws_codegurureviewer/__init__.py +4 -4
  25. aws_cdk/aws_codepipeline/__init__.py +0 -4
  26. aws_cdk/aws_codepipeline_actions/__init__.py +16 -164
  27. aws_cdk/aws_cognito/__init__.py +195 -100
  28. aws_cdk/aws_config/__init__.py +28 -51
  29. aws_cdk/aws_connectcampaigns/__init__.py +5 -6
  30. aws_cdk/aws_databrew/__init__.py +5 -6
  31. aws_cdk/aws_dlm/__init__.py +33 -71
  32. aws_cdk/aws_docdb/__init__.py +20 -76
  33. aws_cdk/aws_dynamodb/__init__.py +29 -22
  34. aws_cdk/aws_ec2/__init__.py +2414 -603
  35. aws_cdk/aws_ecr/__init__.py +1 -2
  36. aws_cdk/aws_ecr_assets/__init__.py +27 -14
  37. aws_cdk/aws_ecs/__init__.py +458 -163
  38. aws_cdk/aws_ecs_patterns/__init__.py +13 -11
  39. aws_cdk/aws_eks/__init__.py +13 -8
  40. aws_cdk/aws_elasticloadbalancing/__init__.py +16 -9
  41. aws_cdk/aws_elasticloadbalancingv2/__init__.py +142 -82
  42. aws_cdk/aws_elasticloadbalancingv2_actions/__init__.py +126 -61
  43. aws_cdk/aws_elasticsearch/__init__.py +0 -7
  44. aws_cdk/aws_emr/__init__.py +7 -16
  45. aws_cdk/aws_emrserverless/__init__.py +14 -18
  46. aws_cdk/aws_events/__init__.py +33 -29
  47. aws_cdk/aws_events_targets/__init__.py +248 -89
  48. aws_cdk/aws_frauddetector/__init__.py +3 -4
  49. aws_cdk/aws_fsx/__init__.py +13 -7
  50. aws_cdk/aws_gamelift/__init__.py +11 -20
  51. aws_cdk/aws_grafana/__init__.py +4 -4
  52. aws_cdk/aws_iam/__init__.py +21 -25
  53. aws_cdk/aws_imagebuilder/__init__.py +58 -80
  54. aws_cdk/aws_internetmonitor/__init__.py +18 -10
  55. aws_cdk/aws_iot/__init__.py +16 -10
  56. aws_cdk/aws_iotcoredeviceadvisor/__init__.py +16 -26
  57. aws_cdk/aws_iotevents/__init__.py +6 -4
  58. aws_cdk/aws_iotfleetwise/__init__.py +27 -40
  59. aws_cdk/aws_iotsitewise/__init__.py +8 -5
  60. aws_cdk/aws_iotwireless/__init__.py +14 -9
  61. aws_cdk/aws_kinesisfirehose/__init__.py +21 -38
  62. aws_cdk/aws_lambda/__init__.py +76 -53
  63. aws_cdk/aws_lambda_event_sources/__init__.py +6 -21
  64. aws_cdk/aws_logs/__init__.py +5 -7
  65. aws_cdk/aws_macie/__init__.py +28 -23
  66. aws_cdk/aws_mediaconnect/__init__.py +5 -8
  67. aws_cdk/aws_mediaconvert/__init__.py +2 -2
  68. aws_cdk/aws_medialive/__init__.py +2 -4
  69. aws_cdk/aws_mediapackage/__init__.py +9 -18
  70. aws_cdk/aws_memorydb/__init__.py +5 -10
  71. aws_cdk/aws_mwaa/__init__.py +8 -4
  72. aws_cdk/aws_neptune/__init__.py +4 -4
  73. aws_cdk/aws_networkfirewall/__init__.py +8 -4
  74. aws_cdk/aws_networkmanager/__init__.py +4 -4
  75. aws_cdk/aws_nimblestudio/__init__.py +25 -45
  76. aws_cdk/aws_opensearchservice/__init__.py +0 -1
  77. aws_cdk/aws_panorama/__init__.py +11 -12
  78. aws_cdk/aws_personalize/__init__.py +46 -72
  79. aws_cdk/aws_pinpoint/__init__.py +36 -65
  80. aws_cdk/aws_quicksight/__init__.py +9972 -13374
  81. aws_cdk/aws_rds/__init__.py +53 -22
  82. aws_cdk/aws_route53/__init__.py +8 -16
  83. aws_cdk/aws_route53_targets/__init__.py +2 -4
  84. aws_cdk/aws_s3/__init__.py +41 -90
  85. aws_cdk/aws_s3_notifications/__init__.py +0 -3
  86. aws_cdk/aws_sagemaker/__init__.py +16 -10
  87. aws_cdk/aws_secretsmanager/__init__.py +17 -14
  88. aws_cdk/aws_servicecatalog/__init__.py +60 -83
  89. aws_cdk/aws_servicediscovery/__init__.py +4 -6
  90. aws_cdk/aws_ses/__init__.py +734 -28
  91. aws_cdk/aws_sns/__init__.py +4 -8
  92. aws_cdk/aws_ssm/__init__.py +19 -23
  93. aws_cdk/aws_ssmcontacts/__init__.py +10 -6
  94. aws_cdk/aws_ssmincidents/__init__.py +2 -1
  95. aws_cdk/aws_sso/__init__.py +4 -4
  96. aws_cdk/aws_stepfunctions/__init__.py +6 -15
  97. aws_cdk/aws_stepfunctions_tasks/__init__.py +51 -24
  98. aws_cdk/aws_timestream/__init__.py +22 -28
  99. aws_cdk/aws_transfer/__init__.py +188 -86
  100. aws_cdk/aws_wafv2/__init__.py +54 -38
  101. aws_cdk/aws_xray/__init__.py +15 -22
  102. aws_cdk/cloud_assembly_schema/__init__.py +14 -6
  103. aws_cdk/custom_resources/__init__.py +2 -3
  104. aws_cdk/pipelines/__init__.py +104 -134
  105. aws_cdk/triggers/__init__.py +46 -61
  106. {aws_cdk_lib-2.73.0.dist-info → aws_cdk_lib-2.76.0.dist-info}/METADATA +47 -92
  107. {aws_cdk_lib-2.73.0.dist-info → aws_cdk_lib-2.76.0.dist-info}/RECORD +111 -111
  108. {aws_cdk_lib-2.73.0.dist-info → aws_cdk_lib-2.76.0.dist-info}/LICENSE +0 -0
  109. {aws_cdk_lib-2.73.0.dist-info → aws_cdk_lib-2.76.0.dist-info}/NOTICE +0 -0
  110. {aws_cdk_lib-2.73.0.dist-info → aws_cdk_lib-2.76.0.dist-info}/WHEEL +0 -0
  111. {aws_cdk_lib-2.73.0.dist-info → aws_cdk_lib-2.76.0.dist-info}/top_level.txt +0 -0
aws_cdk/__init__.py CHANGED
@@ -29,10 +29,8 @@ According to the kind of project you are developing:
29
29
  You can use a classic import to get access to each service namespaces:
30
30
 
31
31
  ```python
32
- # Example automatically generated from non-compiling source. May contain errors.
33
32
  from aws_cdk import Stack, App, aws_s3 as s3
34
33
 
35
-
36
34
  app = App()
37
35
  stack = Stack(app, "TestStack")
38
36
 
@@ -44,11 +42,9 @@ s3.Bucket(stack, "TestBucket")
44
42
  Alternatively, you can use "barrel" imports:
45
43
 
46
44
  ```python
47
- # Example automatically generated from non-compiling source. May contain errors.
48
45
  from aws_cdk import App, Stack
49
46
  from aws_cdk.aws_s3 import Bucket
50
47
 
51
-
52
48
  app = App()
53
49
  stack = Stack(app, "TestStack")
54
50
 
@@ -122,7 +118,6 @@ Each of these synthesizers takes configuration arguments. To configure
122
118
  a stack with a synthesizer, pass it as one of its properties:
123
119
 
124
120
  ```python
125
- # Example automatically generated from non-compiling source. May contain errors.
126
121
  MyStack(app, "MyStack",
127
122
  synthesizer=DefaultStackSynthesizer(
128
123
  file_assets_bucket_name="my-orgs-asset-bucket"
@@ -144,7 +139,6 @@ For example, assume that you have a load balancer configuration that you use for
144
139
  The following example will define a single top-level stack that contains two nested stacks: each one with a single Amazon S3 bucket:
145
140
 
146
141
  ```python
147
- # Example automatically generated from non-compiling source. May contain errors.
148
142
  class MyNestedStack(cfn.NestedStack):
149
143
  def __init__(self, scope, id, *, parameters=None, timeout=None, notifications=None):
150
144
  super().__init__(scope, id, parameters=parameters, timeout=timeout, notifications=notifications)
@@ -176,7 +170,6 @@ which defines an Amazon S3 bucket. Then it defines a second stack, `stack2`,
176
170
  which takes the bucket from stack1 as a constructor property.
177
171
 
178
172
  ```python
179
- # Example automatically generated from non-compiling source. May contain errors.
180
173
  prod = {"account": "123456789012", "region": "us-east-1"}
181
174
 
182
175
  stack1 = StackThatProvidesABucket(app, "Stack1", env=prod)
@@ -207,7 +200,6 @@ enabled it is possible to do something like creating a CloudFront distribution i
207
200
  an ACM certificate in `us-east-1`.
208
201
 
209
202
  ```python
210
- # Example automatically generated from non-compiling source. May contain errors.
211
203
  stack1 = Stack(app, "Stack1",
212
204
  env=Environment(
213
205
  region="us-east-1"
@@ -291,7 +283,6 @@ An instance of Duration is constructed by using one of the static factory
291
283
  methods on it:
292
284
 
293
285
  ```python
294
- # Example automatically generated from non-compiling source. May contain errors.
295
286
  Duration.seconds(300) # 5 minutes
296
287
  Duration.minutes(5) # 5 minutes
297
288
  Duration.hours(1) # 1 hour
@@ -302,7 +293,6 @@ Duration.parse("PT5M")
302
293
  Durations can be added or subtracted together:
303
294
 
304
295
  ```python
305
- # Example automatically generated from non-compiling source. May contain errors.
306
296
  Duration.minutes(1).plus(Duration.seconds(60)) # 2 minutes
307
297
  Duration.minutes(5).minus(Duration.seconds(10))
308
298
  ```
@@ -315,7 +305,6 @@ To make specification of digital storage quantities unambiguous, a class called
315
305
  An instance of `Size` is initialized through one of its static factory methods:
316
306
 
317
307
  ```python
318
- # Example automatically generated from non-compiling source. May contain errors.
319
308
  Size.kibibytes(200) # 200 KiB
320
309
  Size.mebibytes(5) # 5 MiB
321
310
  Size.gibibytes(40) # 40 GiB
@@ -328,7 +317,6 @@ By default, conversion to a higher unit will fail if the conversion does not pro
328
317
  a whole number. This can be overridden by unsetting `integral` property.
329
318
 
330
319
  ```python
331
- # Example automatically generated from non-compiling source. May contain errors.
332
320
  Size.mebibytes(2).to_kibibytes() # yields 2048
333
321
  Size.kibibytes(2050).to_mebibytes(rounding=SizeRoundingBehavior.FLOOR)
334
322
  ```
@@ -342,7 +330,6 @@ a password or an access key) will take a parameter of type `SecretValue`.
342
330
  The best practice is to store secrets in AWS Secrets Manager and reference them using `SecretValue.secretsManager`:
343
331
 
344
332
  ```python
345
- # Example automatically generated from non-compiling source. May contain errors.
346
333
  secret = SecretValue.secrets_manager("secretId",
347
334
  json_field="password", # optional: key of a JSON field to retrieve (defaults to all content),
348
335
  version_id="id", # optional: id of the version (default AWSCURRENT)
@@ -385,7 +372,6 @@ this purpose.
385
372
  use the region and account of the stack you're calling it on:
386
373
 
387
374
  ```python
388
- # Example automatically generated from non-compiling source. May contain errors.
389
375
  # stack: Stack
390
376
 
391
377
 
@@ -404,7 +390,6 @@ but in case of a deploy-time value be aware that the result will be another
404
390
  deploy-time value which cannot be inspected in the CDK application.
405
391
 
406
392
  ```python
407
- # Example automatically generated from non-compiling source. May contain errors.
408
393
  # stack: Stack
409
394
 
410
395
 
@@ -446,7 +431,6 @@ following creates a single object that represents a dependency on two
446
431
  constructs, `constructB` and `constructC`:
447
432
 
448
433
  ```python
449
- # Example automatically generated from non-compiling source. May contain errors.
450
434
  # Declare the dependable object
451
435
  b_and_c = DependencyGroup()
452
436
  b_and_c.add(construct_b)
@@ -499,7 +483,6 @@ of arbitrarily many custom resource definitions. A single definition looks like
499
483
  this:
500
484
 
501
485
  ```python
502
- # Example automatically generated from non-compiling source. May contain errors.
503
486
  CustomResource(self, "MyMagicalResource",
504
487
  resource_type="Custom::MyCustomResource", # must start with 'Custom::'
505
488
 
@@ -553,7 +536,6 @@ Here is a basic pattern for defining stack singletons in the CDK. The following
553
536
  examples ensures that only a single SNS topic is defined:
554
537
 
555
538
  ```python
556
- # Example automatically generated from non-compiling source. May contain errors.
557
539
  def get_or_create(self, scope):
558
540
  stack = Stack.of(scope)
559
541
  uniqueid = "GloballyUniqueIdForSingleton" # For example, a UUID from `uuidgen`
@@ -579,7 +561,6 @@ CloudFormation service.
579
561
  Set `serviceToken` to `topic.topicArn` in order to use this provider:
580
562
 
581
563
  ```python
582
- # Example automatically generated from non-compiling source. May contain errors.
583
564
  topic = sns.Topic(self, "MyProvider")
584
565
 
585
566
  CustomResource(self, "MyResource",
@@ -600,7 +581,6 @@ response to the CloudFormation service and handle various error cases.
600
581
  Set `serviceToken` to `lambda.functionArn` to use this provider:
601
582
 
602
583
  ```python
603
- # Example automatically generated from non-compiling source. May contain errors.
604
584
  fn = lambda_.Function(self, "MyProvider", function_props)
605
585
 
606
586
  CustomResource(self, "MyResource",
@@ -625,7 +605,6 @@ The provider has a built-in singleton method which uses the resource type as a
625
605
  stack-unique identifier and returns the service token:
626
606
 
627
607
  ```python
628
- # Example automatically generated from non-compiling source. May contain errors.
629
608
  service_token = CustomResourceProvider.get_or_create(self, "Custom::MyCustomResourceType",
630
609
  code_directory=f"{__dirname}/my-handler",
631
610
  runtime=CustomResourceProviderRuntime.NODEJS_14_X,
@@ -701,8 +680,8 @@ exports.handler = async (e) => {
701
680
  `sum.ts`:
702
681
 
703
682
  ```python
704
- # Example automatically generated from non-compiling source. May contain errors.
705
- from aws_cdk.core import Construct, CustomResource, CustomResourceProvider, CustomResourceProviderRuntime, Token
683
+ from constructs import Construct
684
+ from aws_cdk import CustomResource, CustomResourceProvider, CustomResourceProviderRuntime, Token
706
685
 
707
686
  class Sum(Construct):
708
687
 
@@ -730,7 +709,6 @@ class Sum(Construct):
730
709
  Usage will look like this:
731
710
 
732
711
  ```python
733
- # Example automatically generated from non-compiling source. May contain errors.
734
712
  sum = Sum(self, "MySum", lhs=40, rhs=2)
735
713
  CfnOutput(self, "Result", value=Token.as_string(sum.result))
736
714
  ```
@@ -739,7 +717,6 @@ To access the ARN of the provider's AWS Lambda function role, use the `getOrCrea
739
717
  built-in singleton method:
740
718
 
741
719
  ```python
742
- # Example automatically generated from non-compiling source. May contain errors.
743
720
  provider = CustomResourceProvider.get_or_create_provider(self, "Custom::MyCustomResourceType",
744
721
  code_directory=f"{__dirname}/my-handler",
745
722
  runtime=CustomResourceProviderRuntime.NODEJS_14_X
@@ -753,7 +730,6 @@ This role ARN can then be used in resource-based IAM policies.
753
730
  To add IAM policy statements to this role, use `addToRolePolicy()`:
754
731
 
755
732
  ```python
756
- # Example automatically generated from non-compiling source. May contain errors.
757
733
  provider = CustomResourceProvider.get_or_create_provider(self, "Custom::MyCustomResourceType",
758
734
  code_directory=f"{__dirname}/my-handler",
759
735
  runtime=CustomResourceProviderRuntime.NODEJS_14_X
@@ -782,7 +758,6 @@ allows implementing providers that can take up to two hours to stabilize.
782
758
  Set `serviceToken` to `provider.serviceToken` to use this type of provider:
783
759
 
784
760
  ```python
785
- # Example automatically generated from non-compiling source. May contain errors.
786
761
  provider = customresources.Provider(self, "MyProvider",
787
762
  on_event_handler=on_event_handler,
788
763
  is_complete_handler=is_complete_handler
@@ -807,7 +782,6 @@ CloudFormation [stack outputs](https://docs.aws.amazon.com/AWSCloudFormation/lat
807
782
  the `CfnOutput` class:
808
783
 
809
784
  ```python
810
- # Example automatically generated from non-compiling source. May contain errors.
811
785
  CfnOutput(self, "OutputName",
812
786
  value=my_bucket.bucket_name,
813
787
  description="The name of an S3 bucket", # Optional
@@ -827,7 +801,6 @@ stack to the AWS CDK).
827
801
  Template parameters can be added to a stack by using the `CfnParameter` class:
828
802
 
829
803
  ```python
830
- # Example automatically generated from non-compiling source. May contain errors.
831
804
  CfnParameter(self, "MyParameter",
832
805
  type="Number",
833
806
  default=1337
@@ -840,7 +813,6 @@ placeholder tokens for the real value (`Token.isUnresolved()` would return `true
840
813
  for those):
841
814
 
842
815
  ```python
843
- # Example automatically generated from non-compiling source. May contain errors.
844
816
  param = CfnParameter(self, "ParameterName")
845
817
 
846
818
  # If the parameter is a String
@@ -864,7 +836,6 @@ instead, which guarantees the values produced are qualifying the designated
864
836
  stack, which is essential in cases where resources are shared cross-stack:
865
837
 
866
838
  ```python
867
- # Example automatically generated from non-compiling source. May contain errors.
868
839
  # "this" is the current construct
869
840
  stack = Stack.of(self)
870
841
 
@@ -880,7 +851,6 @@ attributes](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-p
880
851
  accessing those through the `cfnOptions` property:
881
852
 
882
853
  ```python
883
- # Example automatically generated from non-compiling source. May contain errors.
884
854
  raw_bucket = s3.CfnBucket(self, "Bucket")
885
855
  # -or-
886
856
  raw_bucket_alt = my_bucket.node.default_child
@@ -896,7 +866,6 @@ Resource dependencies (the `DependsOn` attribute) is modified using the
896
866
  `cfnResource.addDependency` method:
897
867
 
898
868
  ```python
899
- # Example automatically generated from non-compiling source. May contain errors.
900
869
  resource_a = CfnResource(self, "ResourceA", resource_props)
901
870
  resource_b = CfnResource(self, "ResourceB", resource_props)
902
871
 
@@ -914,18 +883,17 @@ a property of the creationPolicy on the resource options. Setting it to true wil
914
883
  resources that depend on the fleet resource.
915
884
 
916
885
  ```python
917
- # Example automatically generated from non-compiling source. May contain errors.
918
- fleet = CfnFleet(stack, "Fleet",
886
+ fleet = appstream.CfnFleet(self, "Fleet",
919
887
  instance_type="stream.standard.small",
920
888
  name="Fleet",
921
- compute_capacity={
922
- "desired_instances": 1
923
- },
889
+ compute_capacity=appstream.CfnFleet.ComputeCapacityProperty(
890
+ desired_instances=1
891
+ ),
924
892
  image_name="AppStream-AmazonLinux2-09-21-2022"
925
893
  )
926
- fleet.cfn_options.creation_policy = {
927
- "start_fleet": True
928
- }
894
+ fleet.cfn_options.creation_policy = CfnCreationPolicy(
895
+ start_fleet=True
896
+ )
929
897
  ```
930
898
 
931
899
  The properties passed to the level 2 constructs `AutoScalingGroup` and `Instance` from the
@@ -938,11 +906,15 @@ The format of the timeout is `PT#H#M#S`. In the example below AWS Cloudformation
938
906
  `CREATE_COMPLETE`.
939
907
 
940
908
  ```python
941
- # Example automatically generated from non-compiling source. May contain errors.
942
- resource.cfn_options.resource_signal = {
943
- "count": 3,
944
- "timeout": "PR15M"
945
- }
909
+ # resource: CfnResource
910
+
911
+
912
+ resource.cfn_options.creation_policy = CfnCreationPolicy(
913
+ resource_signal=CfnResourceSignal(
914
+ count=3,
915
+ timeout="PR15M"
916
+ )
917
+ )
946
918
  ```
947
919
 
948
920
  ### Intrinsic Functions and Condition Expressions
@@ -952,7 +924,6 @@ can be accessed from the `Fn` class, which provides type-safe methods for each
952
924
  intrinsic function as well as condition expressions:
953
925
 
954
926
  ```python
955
- # Example automatically generated from non-compiling source. May contain errors.
956
927
  # my_object_or_array: Any
957
928
  # my_array: Any
958
929
 
@@ -982,7 +953,6 @@ needs to be expressed with un-resolved values, it is necessary to use
982
953
  CloudFormation conditions by means of the `CfnCondition` class:
983
954
 
984
955
  ```python
985
- # Example automatically generated from non-compiling source. May contain errors.
986
956
  environment_parameter = CfnParameter(self, "Environment")
987
957
  is_prod = CfnCondition(self, "IsProduction",
988
958
  expression=Fn.condition_equals("Production", environment_parameter)
@@ -1004,7 +974,6 @@ CloudFormation [mappings](https://docs.aws.amazon.com/AWSCloudFormation/latest/U
1004
974
  `CfnMappings` class:
1005
975
 
1006
976
  ```python
1007
- # Example automatically generated from non-compiling source. May contain errors.
1008
977
  region_table = CfnMapping(self, "RegionTable",
1009
978
  mapping={
1010
979
  "us-east-1": {
@@ -1040,7 +1009,6 @@ call to `findInMap` will be able to resolve the value during synthesis and simpl
1040
1009
  `'US East (Ohio)'`.
1041
1010
 
1042
1011
  ```python
1043
- # Example automatically generated from non-compiling source. May contain errors.
1044
1012
  region_table = CfnMapping(self, "RegionTable",
1045
1013
  mapping={
1046
1014
  "us-east-1": {
@@ -1061,7 +1029,6 @@ since the top-level key is an unresolved token. The call to `findInMap` will ret
1061
1029
  `{ "Fn::FindInMap": [ "RegionTable", { "Ref": "AWS::Region" }, "regionName" ] }`.
1062
1030
 
1063
1031
  ```python
1064
- # Example automatically generated from non-compiling source. May contain errors.
1065
1032
  # region_table: CfnMapping
1066
1033
 
1067
1034
 
@@ -1075,7 +1042,6 @@ for SSM parameters (including secure strings) and Secrets Manager. Encoding such
1075
1042
  references is done using the `CfnDynamicReference` class:
1076
1043
 
1077
1044
  ```python
1078
- # Example automatically generated from non-compiling source. May contain errors.
1079
1045
  CfnDynamicReference(CfnDynamicReferenceService.SECRETS_MANAGER, "secret-id:secret-string:json-key:version-stage:version-id")
1080
1046
  ```
1081
1047
 
@@ -1086,7 +1052,6 @@ CloudFormation templates support a number of options, including which Macros or
1086
1052
  configured using the `stack.templateOptions` property:
1087
1053
 
1088
1054
  ```python
1089
- # Example automatically generated from non-compiling source. May contain errors.
1090
1055
  stack = Stack(app, "StackName")
1091
1056
 
1092
1057
  stack.template_options.description = "This will appear in the AWS console"
@@ -1102,7 +1067,6 @@ The `CfnResource` class allows emitting arbitrary entries in the
1102
1067
  [Resources](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/resources-section-structure.html) section of the CloudFormation template.
1103
1068
 
1104
1069
  ```python
1105
- # Example automatically generated from non-compiling source. May contain errors.
1106
1070
  CfnResource(self, "ResourceId",
1107
1071
  type="AWS::S3::Bucket",
1108
1072
  properties={
@@ -1122,7 +1086,6 @@ include fragments of an existing template verbatim in the synthesized template.
1122
1086
  This can be achieved using the `CfnInclude` class.
1123
1087
 
1124
1088
  ```python
1125
- # Example automatically generated from non-compiling source. May contain errors.
1126
1089
  CfnInclude(self, "ID",
1127
1090
  template={
1128
1091
  "Resources": {
@@ -1147,7 +1110,6 @@ nested stacks belonging to that stack as well. You can enable termination protec
1147
1110
  on a stack by setting the `terminationProtection` prop to `true`.
1148
1111
 
1149
1112
  ```python
1150
- # Example automatically generated from non-compiling source. May contain errors.
1151
1113
  stack = Stack(app, "StackName",
1152
1114
  termination_protection=True
1153
1115
  )
@@ -1160,7 +1122,6 @@ By default, termination protection is disabled.
1160
1122
  You can add a description of the stack in the same way as `StackProps`.
1161
1123
 
1162
1124
  ```python
1163
- # Example automatically generated from non-compiling source. May contain errors.
1164
1125
  stack = Stack(app, "StackName",
1165
1126
  description="This is a description."
1166
1127
  )
@@ -1180,7 +1141,6 @@ The following example defines an IAM role which can only be assumed by
1180
1141
  principals that are tagged with a specific tag.
1181
1142
 
1182
1143
  ```python
1183
- # Example automatically generated from non-compiling source. May contain errors.
1184
1144
  tag_param = CfnParameter(self, "TagName")
1185
1145
 
1186
1146
  string_equals = CfnJson(self, "ConditionJson",
@@ -1231,7 +1191,6 @@ top take precedence over those below).
1231
1191
  ### Examples of setting context
1232
1192
 
1233
1193
  ```python
1234
- # Example automatically generated from non-compiling source. May contain errors.
1235
1194
  App(
1236
1195
  context={
1237
1196
  "@aws-cdk/core:newStyleStackSynthesis": True
@@ -1240,13 +1199,11 @@ App(
1240
1199
  ```
1241
1200
 
1242
1201
  ```python
1243
- # Example automatically generated from non-compiling source. May contain errors.
1244
1202
  app = App()
1245
1203
  app.node.set_context("@aws-cdk/core:newStyleStackSynthesis", True)
1246
1204
  ```
1247
1205
 
1248
1206
  ```python
1249
- # Example automatically generated from non-compiling source. May contain errors.
1250
1207
  App(
1251
1208
  post_cli_context={
1252
1209
  "@aws-cdk/core:newStyleStackSynthesis": True
@@ -1293,10 +1250,6 @@ to all roles within a specific construct scope. The most common use case would
1293
1250
  be to apply a permissions boundary at the `Stage` level.
1294
1251
 
1295
1252
  ```python
1296
- # Example automatically generated from non-compiling source. May contain errors.
1297
- # app: App
1298
-
1299
-
1300
1253
  prod_stage = Stage(app, "ProdStage",
1301
1254
  permissions_boundary=PermissionsBoundary.from_name("cdk-${Qualifier}-PermissionsBoundary")
1302
1255
  )
@@ -1329,11 +1282,10 @@ To use one or more validation plugins in your application, use the
1329
1282
  `policyValidationBeta1` property of `Stage`:
1330
1283
 
1331
1284
  ```python
1332
- # Example automatically generated from non-compiling source. May contain errors.
1333
1285
  # globally for the entire app (an app is a stage)
1334
1286
  app = App(
1335
1287
  policy_validation_beta1=[
1336
- # These hypothetical classes implement IValidationPlugin:
1288
+ # These hypothetical classes implement IPolicyValidationPluginBeta1:
1337
1289
  ThirdPartyPluginX(),
1338
1290
  ThirdPartyPluginY()
1339
1291
  ]
@@ -1341,7 +1293,9 @@ app = App(
1341
1293
 
1342
1294
  # only apply to a particular stage
1343
1295
  prod_stage = Stage(app, "ProdStage",
1344
- policy_validation_beta1=[...]
1296
+ policy_validation_beta1=[
1297
+ ThirdPartyPluginX()
1298
+ ]
1345
1299
  )
1346
1300
  ```
1347
1301
 
@@ -1361,7 +1315,6 @@ report in JSON format, enable it using the `@aws-cdk/core:validationReportJson`
1361
1315
  context passing it directly to the application:
1362
1316
 
1363
1317
  ```python
1364
- # Example automatically generated from non-compiling source. May contain errors.
1365
1318
  app = App(
1366
1319
  context={"@aws-cdk/core:validationReportJson": True}
1367
1320
  )
@@ -1379,36 +1332,38 @@ the standard output.
1379
1332
  ### For plugin authors
1380
1333
 
1381
1334
  The communication protocol between the CDK core module and your policy tool is
1382
- defined by the `IValidationPluginBeta1` interface. To create a new plugin you must
1335
+ defined by the `IPolicyValidationPluginBeta1` interface. To create a new plugin you must
1383
1336
  write a class that implements this interface. There are two things you need to
1384
1337
  implement: the plugin name (by overriding the `name` property), and the
1385
1338
  `validate()` method.
1386
1339
 
1387
- The framework will call `validate()`, passing an `IValidationContextBeta1` object.
1340
+ The framework will call `validate()`, passing an `IPolicyValidationContextBeta1` object.
1388
1341
  The location of the templates to be validated is given by `templatePaths`. The
1389
- plugin should return an instance of `ValidationPluginReportBeta1`. This object
1342
+ plugin should return an instance of `PolicyValidationPluginReportBeta1`. This object
1390
1343
  represents the report that the user wil receive at the end of the synthesis.
1391
1344
 
1392
1345
  ```python
1393
- # Example automatically generated from non-compiling source. May contain errors.
1394
- validate(context, ValidationContextBeta1)ValidationReportBeta1
1395
- # First read the templates using context.templatePaths...
1396
-
1397
- # ...then perform the validation, and then compose and return the report.
1398
- # Using hard-coded values here for better clarity:
1399
- return {
1400
- "success": False,
1401
- "violations": [{
1402
- "rule_name": "CKV_AWS_117",
1403
- "recommendation": "Ensure that AWS Lambda function is configured inside a VPC",
1404
- "fix": "https://docs.bridgecrew.io/docs/ensure-that-aws-lambda-function-is-configured-inside-a-vpc-1",
1405
- "violating_resources": [{
1406
- "resource_name": "MyFunction3BAA72D1",
1407
- "template_path": "/home/johndoe/myapp/cdk.out/MyService.template.json",
1408
- "locations": "Properties/VpcConfig"
1409
- }]
1410
- }]
1411
- }
1346
+ @jsii.implements(IPolicyValidationPluginBeta1)
1347
+ class MyPlugin:
1348
+
1349
+ def validate(self, context):
1350
+ # First read the templates using context.templatePaths...
1351
+
1352
+ # ...then perform the validation, and then compose and return the report.
1353
+ # Using hard-coded values here for better clarity:
1354
+ return PolicyValidationPluginReportBeta1(
1355
+ success=False,
1356
+ violations=[PolicyViolationBeta1(
1357
+ rule_name="CKV_AWS_117",
1358
+ description="Ensure that AWS Lambda function is configured inside a VPC",
1359
+ fix="https://docs.bridgecrew.io/docs/ensure-that-aws-lambda-function-is-configured-inside-a-vpc-1",
1360
+ violating_resources=[PolicyViolatingResourceBeta1(
1361
+ resource_logical_id="MyFunction3BAA72D1",
1362
+ template_path="/home/johndoe/myapp/cdk.out/MyService.template.json",
1363
+ locations=["Properties/VpcConfig"]
1364
+ )]
1365
+ )]
1366
+ )
1412
1367
  ```
1413
1368
 
1414
1369
  Note that plugins are not allowed to modify anything in the cloud assembly. Any
@@ -1617,7 +1572,6 @@ class AppProps:
1617
1572
 
1618
1573
  Example::
1619
1574
 
1620
- # Example automatically generated from non-compiling source. May contain errors.
1621
1575
  app = App(
1622
1576
  context={"@aws-cdk/core:validationReportJson": True}
1623
1577
  )
@@ -1754,7 +1708,6 @@ class AppProps:
1754
1708
 
1755
1709
  Example::
1756
1710
 
1757
- # Example automatically generated from non-compiling source. May contain errors.
1758
1711
  # context from the CLI and from `cdk.json` are stored in the
1759
1712
  # CDK_CONTEXT env variable
1760
1713
  cli_context = JSON.parse(process.env.CDK_CONTEXT)
@@ -4384,7 +4337,6 @@ class CfnConditionProps:
4384
4337
 
4385
4338
  Example::
4386
4339
 
4387
- # Example automatically generated from non-compiling source. May contain errors.
4388
4340
  raw_bucket = s3.CfnBucket(self, "Bucket")
4389
4341
  # -or-
4390
4342
  raw_bucket_alt = my_bucket.node.default_child
@@ -4694,7 +4646,6 @@ class CfnDynamicReferenceService(enum.Enum):
4694
4646
 
4695
4647
  Example::
4696
4648
 
4697
- # Example automatically generated from non-compiling source. May contain errors.
4698
4649
  CfnDynamicReference(CfnDynamicReferenceService.SECRETS_MANAGER, "secret-id:secret-string:json-key:version-stage:version-id")
4699
4650
  '''
4700
4651
 
@@ -5296,7 +5247,6 @@ class CfnJsonProps:
5296
5247
 
5297
5248
  Example::
5298
5249
 
5299
- # Example automatically generated from non-compiling source. May contain errors.
5300
5250
  tag_param = CfnParameter(self, "TagName")
5301
5251
 
5302
5252
  string_equals = CfnJson(self, "ConditionJson",
@@ -5488,7 +5438,6 @@ class CfnMappingProps:
5488
5438
 
5489
5439
  Example::
5490
5440
 
5491
- # Example automatically generated from non-compiling source. May contain errors.
5492
5441
  region_table = CfnMapping(self, "RegionTable",
5493
5442
  mapping={
5494
5443
  "us-east-1": {
@@ -6353,7 +6302,6 @@ class CfnParameterProps:
6353
6302
 
6354
6303
  Example::
6355
6304
 
6356
- # Example automatically generated from non-compiling source. May contain errors.
6357
6305
  CfnParameter(self, "MyParameter",
6358
6306
  type="Number",
6359
6307
  default=1337
@@ -6805,12 +6753,19 @@ class CfnResource(
6805
6753
 
6806
6754
  Example::
6807
6755
 
6808
- # Example automatically generated from non-compiling source. May contain errors.
6809
- # bucket: s3.Bucket
6756
+ @jsii.implements(ITaggable)
6757
+ class MyConstruct(Resource):
6810
6758
 
6759
+ def __init__(self, scope, id):
6760
+ super().__init__(scope, id)
6811
6761
 
6812
- cfn_bucket = bucket.node.find_child("Resource")
6813
- cfn_bucket.apply_removal_policy(RemovalPolicy.DESTROY)
6762
+ CfnResource(self, "Resource",
6763
+ type="Whatever::The::Type",
6764
+ properties={
6765
+ # ...
6766
+ "Tags": self.tags.rendered_tags
6767
+ }
6768
+ )
6814
6769
  '''
6815
6770
 
6816
6771
  def __init__(
@@ -6929,7 +6884,6 @@ class CfnResource(
6929
6884
 
6930
6885
  For example::
6931
6886
 
6932
- # Example automatically generated from non-compiling source. May contain errors.
6933
6887
  cfn_resource.add_override("Properties.GlobalSecondaryIndexes.0.Projection.NonKeyAttributes", ["myattribute"])
6934
6888
  cfn_resource.add_override("Properties.GlobalSecondaryIndexes.1.ProjectionType", "INCLUDE")
6935
6889
 
@@ -7382,11 +7336,19 @@ class CfnResourceProps:
7382
7336
 
7383
7337
  Example::
7384
7338
 
7385
- # Example automatically generated from non-compiling source. May contain errors.
7386
- resource_a = CfnResource(self, "ResourceA", resource_props)
7387
- resource_b = CfnResource(self, "ResourceB", resource_props)
7339
+ @jsii.implements(ITaggable)
7340
+ class MyConstruct(Resource):
7341
+
7342
+ def __init__(self, scope, id):
7343
+ super().__init__(scope, id)
7388
7344
 
7389
- resource_b.add_dependency(resource_a)
7345
+ CfnResource(self, "Resource",
7346
+ type="Whatever::The::Type",
7347
+ properties={
7348
+ # ...
7349
+ "Tags": self.tags.rendered_tags
7350
+ }
7351
+ )
7390
7352
  '''
7391
7353
  if __debug__:
7392
7354
  type_hints = typing.get_type_hints(_typecheckingstub__4d1b62b09ffbab6ff0f59d664e89ba6054339a477f55c26bf979a6779e45c976)
@@ -7443,17 +7405,18 @@ class CfnResourceSignal:
7443
7405
  :param count: The number of success signals AWS CloudFormation must receive before it sets the resource status as CREATE_COMPLETE. If the resource receives a failure signal or doesn't receive the specified number of signals before the timeout period expires, the resource creation fails and AWS CloudFormation rolls the stack back.
7444
7406
  :param timeout: The length of time that AWS CloudFormation waits for the number of signals that was specified in the Count property. The timeout period starts after AWS CloudFormation starts creating the resource, and the timeout expires no sooner than the time you specify but can occur shortly thereafter. The maximum time that you can specify is 12 hours.
7445
7407
 
7446
- :exampleMetadata: fixture=_generated
7408
+ :exampleMetadata: infused
7447
7409
 
7448
7410
  Example::
7449
7411
 
7450
- # The code below shows an example of how to instantiate this type.
7451
- # The values are placeholders you should change.
7452
- import aws_cdk as cdk
7412
+ # resource: CfnResource
7453
7413
 
7454
- cfn_resource_signal = cdk.CfnResourceSignal(
7455
- count=123,
7456
- timeout="timeout"
7414
+
7415
+ resource.cfn_options.creation_policy = CfnCreationPolicy(
7416
+ resource_signal=CfnResourceSignal(
7417
+ count=3,
7418
+ timeout="PR15M"
7419
+ )
7457
7420
  )
7458
7421
  '''
7459
7422
  if __debug__:
@@ -9724,14 +9687,15 @@ class CustomResourceProps:
9724
9687
 
9725
9688
  Example::
9726
9689
 
9727
- # Example automatically generated from non-compiling source. May contain errors.
9728
- provider = customresources.Provider(self, "MyProvider",
9729
- on_event_handler=on_event_handler,
9730
- is_complete_handler=is_complete_handler
9690
+ service_token = CustomResourceProvider.get_or_create(self, "Custom::MyCustomResourceType",
9691
+ code_directory=f"{__dirname}/my-handler",
9692
+ runtime=CustomResourceProviderRuntime.NODEJS_14_X,
9693
+ description="Lambda function created by the custom resource provider"
9731
9694
  )
9732
9695
 
9733
9696
  CustomResource(self, "MyResource",
9734
- service_token=provider.service_token
9697
+ resource_type="Custom::MyCustomResourceType",
9698
+ service_token=service_token
9735
9699
  )
9736
9700
  '''
9737
9701
  if __debug__:
@@ -9764,7 +9728,6 @@ class CustomResourceProps:
9764
9728
 
9765
9729
  Provider framework::
9766
9730
 
9767
- # Example automatically generated from non-compiling source. May contain errors.
9768
9731
  # use the provider framework from aws-cdk/custom-resources:
9769
9732
  provider = customresources.Provider(self, "ResourceProvider",
9770
9733
  on_event_handler=on_event_handler,
@@ -9778,7 +9741,6 @@ class CustomResourceProps:
9778
9741
  AWS Lambda function (not recommended to use AWS Lambda Functions directly,
9779
9742
  see the module README)::
9780
9743
 
9781
- # Example automatically generated from non-compiling source. May contain errors.
9782
9744
  # invoke an AWS Lambda function when a lifecycle event occurs:
9783
9745
  CustomResource(self, "MyResource",
9784
9746
  service_token=my_function.function_arn
@@ -9787,7 +9749,6 @@ class CustomResourceProps:
9787
9749
  SNS topic (not recommended to use AWS Lambda Functions directly, see the
9788
9750
  module README)::
9789
9751
 
9790
- # Example automatically generated from non-compiling source. May contain errors.
9791
9752
  # publish lifecycle events to an SNS topic:
9792
9753
  CustomResource(self, "MyResource",
9793
9754
  service_token=my_topic.topic_arn
@@ -9892,7 +9853,6 @@ class CustomResourceProvider(
9892
9853
 
9893
9854
  Example::
9894
9855
 
9895
- # Example automatically generated from non-compiling source. May contain errors.
9896
9856
  provider = CustomResourceProvider.get_or_create_provider(self, "Custom::MyCustomResourceType",
9897
9857
  code_directory=f"{__dirname}/my-handler",
9898
9858
  runtime=CustomResourceProviderRuntime.NODEJS_14_X
@@ -10051,7 +10011,6 @@ class CustomResourceProvider(
10051
10011
 
10052
10012
  Example::
10053
10013
 
10054
- # Example automatically generated from non-compiling source. May contain errors.
10055
10014
  # my_provider: CustomResourceProvider
10056
10015
 
10057
10016
 
@@ -10089,7 +10048,6 @@ class CustomResourceProvider(
10089
10048
 
10090
10049
  Example::
10091
10050
 
10092
- # Example automatically generated from non-compiling source. May contain errors.
10093
10051
  # my_provider: CustomResourceProvider
10094
10052
 
10095
10053
 
@@ -10143,7 +10101,6 @@ class CustomResourceProviderProps:
10143
10101
 
10144
10102
  Example::
10145
10103
 
10146
- # Example automatically generated from non-compiling source. May contain errors.
10147
10104
  provider = CustomResourceProvider.get_or_create_provider(self, "Custom::MyCustomResourceType",
10148
10105
  code_directory=f"{__dirname}/my-handler",
10149
10106
  runtime=CustomResourceProviderRuntime.NODEJS_14_X
@@ -10239,7 +10196,6 @@ class CustomResourceProviderProps:
10239
10196
 
10240
10197
  Example::
10241
10198
 
10242
- # Example automatically generated from non-compiling source. May contain errors.
10243
10199
  provider = CustomResourceProvider.get_or_create_provider(self, "Custom::MyCustomResourceType",
10244
10200
  code_directory=f"{__dirname}/my-handler",
10245
10201
  runtime=CustomResourceProviderRuntime.NODEJS_14_X,
@@ -10286,7 +10242,6 @@ class CustomResourceProviderRuntime(enum.Enum):
10286
10242
 
10287
10243
  Example::
10288
10244
 
10289
- # Example automatically generated from non-compiling source. May contain errors.
10290
10245
  provider = CustomResourceProvider.get_or_create_provider(self, "Custom::MyCustomResourceType",
10291
10246
  code_directory=f"{__dirname}/my-handler",
10292
10247
  runtime=CustomResourceProviderRuntime.NODEJS_14_X
@@ -10375,7 +10330,6 @@ class DefaultStackSynthesizerProps:
10375
10330
 
10376
10331
  Example::
10377
10332
 
10378
- # Example automatically generated from non-compiling source. May contain errors.
10379
10333
  MyStack(app, "MyStack",
10380
10334
  synthesizer=DefaultStackSynthesizer(
10381
10335
  file_assets_bucket_name="my-orgs-asset-bucket"
@@ -10859,7 +10813,6 @@ class DockerCacheOption:
10859
10813
 
10860
10814
  Example::
10861
10815
 
10862
- # Example automatically generated from non-compiling source. May contain errors.
10863
10816
  "registry"
10864
10817
  '''
10865
10818
  result = self._values.get("type")
@@ -10876,8 +10829,13 @@ class DockerCacheOption:
10876
10829
 
10877
10830
  Example::
10878
10831
 
10879
- # Example automatically generated from non-compiling source. May contain errors.
10880
- ref: `12345678.dkr.ecr.us-west-2.amazonaws.com/cache:${branch}`, mode"max"
10832
+ # branch: str
10833
+
10834
+
10835
+ params = {
10836
+ "ref": f"12345678.dkr.ecr.us-west-2.amazonaws.com/cache:{branch}",
10837
+ "mode": "max"
10838
+ }
10881
10839
  '''
10882
10840
  result = self._values.get("params")
10883
10841
  return typing.cast(typing.Optional[typing.Mapping[builtins.str, builtins.str]], result)
@@ -11737,23 +11695,26 @@ class Duration(metaclass=jsii.JSIIMeta, jsii_type="aws-cdk-lib.Duration"):
11737
11695
  Example::
11738
11696
 
11739
11697
  # Example automatically generated from non-compiling source. May contain errors.
11740
- import aws_cdk.aws_cloudwatch as cloudwatch
11698
+ import aws_cdk.aws_ecs as ecs
11699
+ # cluster: ecs.ICluster
11700
+ # task_definition: ecs.TaskDefinition
11741
11701
 
11742
11702
 
11743
- table = dynamodb.Table(self, "Table",
11744
- partition_key=dynamodb.Attribute(name="id", type=dynamodb.AttributeType.STRING)
11703
+ rule = events.Rule(self, "Rule",
11704
+ schedule=events.Schedule.rate(cdk.Duration.hours(1))
11745
11705
  )
11746
11706
 
11747
- metric = table.metric_throttled_requests_for_operations(
11748
- operations=[dynamodb.Operation.PUT_ITEM],
11749
- period=Duration.minutes(1)
11750
- )
11751
-
11752
- cloudwatch.Alarm(stack, "Alarm",
11753
- metric=metric,
11754
- evaluation_periods=1,
11755
- threshold=1
11756
- )
11707
+ rule.add_target(
11708
+ targets.EcsTask(
11709
+ cluster=cluster,
11710
+ task_definition=task_definition,
11711
+ propagate_tags=ecs.PropagatedTagSource.TASK_DEFINITION,
11712
+ tags=[targets.Tag(
11713
+ key="my-tag",
11714
+ value="my-tag-value"
11715
+ )
11716
+ ]
11717
+ ))
11757
11718
  '''
11758
11719
 
11759
11720
  @jsii.member(jsii_name="days")
@@ -13028,20 +12989,13 @@ class Fn(metaclass=jsii.JSIIMeta, jsii_type="aws-cdk-lib.Fn"):
13028
12989
 
13029
12990
  Example::
13030
12991
 
13031
- import aws_cdk as cdk
13032
-
13033
- # destination_bucket: s3.Bucket
13034
-
12992
+ # cfn_template: cfn_inc.CfnInclude
13035
12993
 
13036
- my_bucket_deployment = s3deploy.BucketDeployment(self, "DeployMeWithoutExtractingFilesOnDestination",
13037
- sources=[s3deploy.Source.asset(path.join(__dirname, "my-website"))],
13038
- destination_bucket=destination_bucket,
13039
- extract=False
13040
- )
12994
+ # mutating the rule
12995
+ # my_parameter: core.CfnParameter
13041
12996
 
13042
- cdk.CfnOutput(self, "ObjectKey",
13043
- value=cdk.Fn.select(0, my_bucket_deployment.object_keys)
13044
- )
12997
+ rule = cfn_template.get_rule("MyRule")
12998
+ rule.add_assertion(core.Fn.condition_contains(["m1.small"], my_parameter.value_as_string), "MyParameter has to be m1.small")
13045
12999
  '''
13046
13000
 
13047
13001
  @jsii.member(jsii_name="base64")
@@ -14591,29 +14545,27 @@ class IPolicyValidationPluginBeta1(typing_extensions.Protocol):
14591
14545
 
14592
14546
  Example::
14593
14547
 
14594
- # Example automatically generated from non-compiling source. May contain errors.
14595
- IValidationPlugin):
14548
+ @jsii.implements(IPolicyValidationPluginBeta1)
14549
+ class MyPlugin:
14596
14550
 
14597
- def is_ready(self):
14598
- # check if the plugin tool is installed
14599
- return True
14551
+ def validate(self, context):
14552
+ # First read the templates using context.templatePaths...
14600
14553
 
14601
- def validate(self, context):
14602
- template_paths = context.template_paths
14603
- # perform validation on the template
14604
- # if there are any failures report them
14605
- return {
14606
- "plugin_name": self.name,
14607
- "success": False,
14608
- "violations": [{
14609
- "rule_name": "rule-name",
14610
- "description": "description of the rule",
14611
- "violating_resources": [{
14612
- "resource_name": "FailingResource",
14613
- "template_path": "/path/to/stack.template.json"
14614
- }]
14615
- }]
14616
- }
14554
+ # ...then perform the validation, and then compose and return the report.
14555
+ # Using hard-coded values here for better clarity:
14556
+ return PolicyValidationPluginReportBeta1(
14557
+ success=False,
14558
+ violations=[PolicyViolationBeta1(
14559
+ rule_name="CKV_AWS_117",
14560
+ description="Ensure that AWS Lambda function is configured inside a VPC",
14561
+ fix="https://docs.bridgecrew.io/docs/ensure-that-aws-lambda-function-is-configured-inside-a-vpc-1",
14562
+ violating_resources=[PolicyViolatingResourceBeta1(
14563
+ resource_logical_id="MyFunction3BAA72D1",
14564
+ template_path="/home/johndoe/myapp/cdk.out/MyService.template.json",
14565
+ locations=["Properties/VpcConfig"]
14566
+ )]
14567
+ )]
14568
+ )
14617
14569
  '''
14618
14570
 
14619
14571
  @builtins.property
@@ -14622,6 +14574,18 @@ class IPolicyValidationPluginBeta1(typing_extensions.Protocol):
14622
14574
  '''The name of the plugin that will be displayed in the validation report.'''
14623
14575
  ...
14624
14576
 
14577
+ @builtins.property
14578
+ @jsii.member(jsii_name="ruleIds")
14579
+ def rule_ids(self) -> typing.Optional[typing.List[builtins.str]]:
14580
+ '''The list of rule IDs that the plugin will evaluate.
14581
+
14582
+ Used for analytics
14583
+ purposes.
14584
+
14585
+ :default: - No rule is reported
14586
+ '''
14587
+ ...
14588
+
14625
14589
  @builtins.property
14626
14590
  @jsii.member(jsii_name="version")
14627
14591
  def version(self) -> typing.Optional[builtins.str]:
@@ -14648,29 +14612,27 @@ class _IPolicyValidationPluginBeta1Proxy:
14648
14612
 
14649
14613
  Example::
14650
14614
 
14651
- # Example automatically generated from non-compiling source. May contain errors.
14652
- IValidationPlugin):
14615
+ @jsii.implements(IPolicyValidationPluginBeta1)
14616
+ class MyPlugin:
14653
14617
 
14654
- def is_ready(self):
14655
- # check if the plugin tool is installed
14656
- return True
14618
+ def validate(self, context):
14619
+ # First read the templates using context.templatePaths...
14657
14620
 
14658
- def validate(self, context):
14659
- template_paths = context.template_paths
14660
- # perform validation on the template
14661
- # if there are any failures report them
14662
- return {
14663
- "plugin_name": self.name,
14664
- "success": False,
14665
- "violations": [{
14666
- "rule_name": "rule-name",
14667
- "description": "description of the rule",
14668
- "violating_resources": [{
14669
- "resource_name": "FailingResource",
14670
- "template_path": "/path/to/stack.template.json"
14671
- }]
14672
- }]
14673
- }
14621
+ # ...then perform the validation, and then compose and return the report.
14622
+ # Using hard-coded values here for better clarity:
14623
+ return PolicyValidationPluginReportBeta1(
14624
+ success=False,
14625
+ violations=[PolicyViolationBeta1(
14626
+ rule_name="CKV_AWS_117",
14627
+ description="Ensure that AWS Lambda function is configured inside a VPC",
14628
+ fix="https://docs.bridgecrew.io/docs/ensure-that-aws-lambda-function-is-configured-inside-a-vpc-1",
14629
+ violating_resources=[PolicyViolatingResourceBeta1(
14630
+ resource_logical_id="MyFunction3BAA72D1",
14631
+ template_path="/home/johndoe/myapp/cdk.out/MyService.template.json",
14632
+ locations=["Properties/VpcConfig"]
14633
+ )]
14634
+ )]
14635
+ )
14674
14636
  '''
14675
14637
 
14676
14638
  __jsii_type__: typing.ClassVar[str] = "aws-cdk-lib.IPolicyValidationPluginBeta1"
@@ -14681,6 +14643,18 @@ class _IPolicyValidationPluginBeta1Proxy:
14681
14643
  '''The name of the plugin that will be displayed in the validation report.'''
14682
14644
  return typing.cast(builtins.str, jsii.get(self, "name"))
14683
14645
 
14646
+ @builtins.property
14647
+ @jsii.member(jsii_name="ruleIds")
14648
+ def rule_ids(self) -> typing.Optional[typing.List[builtins.str]]:
14649
+ '''The list of rule IDs that the plugin will evaluate.
14650
+
14651
+ Used for analytics
14652
+ purposes.
14653
+
14654
+ :default: - No rule is reported
14655
+ '''
14656
+ return typing.cast(typing.Optional[typing.List[builtins.str]], jsii.get(self, "ruleIds"))
14657
+
14684
14658
  @builtins.property
14685
14659
  @jsii.member(jsii_name="version")
14686
14660
  def version(self) -> typing.Optional[builtins.str]:
@@ -16927,7 +16901,6 @@ class PermissionsBoundary(
16927
16901
 
16928
16902
  Example::
16929
16903
 
16930
- # Example automatically generated from non-compiling source. May contain errors.
16931
16904
  # no permissions boundary for dev stage
16932
16905
  Stage(app, "DevStage")
16933
16906
 
@@ -16964,9 +16937,6 @@ class PermissionsBoundary(
16964
16937
 
16965
16938
  Example::
16966
16939
 
16967
- # Example automatically generated from non-compiling source. May contain errors.
16968
- # app: App
16969
-
16970
16940
  Stage(app, "ProdStage",
16971
16941
  permissions_boundary=PermissionsBoundary.from_arn("arn:aws:iam::${AWS::AccountId}:policy/my-custom-permissions-boundary")
16972
16942
  )
@@ -16995,9 +16965,6 @@ class PermissionsBoundary(
16995
16965
 
16996
16966
  Example::
16997
16967
 
16998
- # Example automatically generated from non-compiling source. May contain errors.
16999
- # app: App
17000
-
17001
16968
  Stage(app, "ProdStage",
17002
16969
  permissions_boundary=PermissionsBoundary.from_name("my-custom-permissions-boundary")
17003
16970
  )
@@ -17496,7 +17463,6 @@ class RemovalPolicy(enum.Enum):
17496
17463
  argument, you can always configure it by using the escape hatch mechanism,
17497
17464
  as shown in the following example::
17498
17465
 
17499
- # Example automatically generated from non-compiling source. May contain errors.
17500
17466
  # bucket: s3.Bucket
17501
17467
 
17502
17468
 
@@ -17903,7 +17869,26 @@ class Resource(
17903
17869
  metaclass=jsii.JSIIAbstractClass,
17904
17870
  jsii_type="aws-cdk-lib.Resource",
17905
17871
  ):
17906
- '''A construct which represents an AWS resource.'''
17872
+ '''A construct which represents an AWS resource.
17873
+
17874
+ :exampleMetadata: infused
17875
+
17876
+ Example::
17877
+
17878
+ @jsii.implements(ITaggable)
17879
+ class MyConstruct(Resource):
17880
+
17881
+ def __init__(self, scope, id):
17882
+ super().__init__(scope, id)
17883
+
17884
+ CfnResource(self, "Resource",
17885
+ type="Whatever::The::Type",
17886
+ properties={
17887
+ # ...
17888
+ "Tags": self.tags.rendered_tags
17889
+ }
17890
+ )
17891
+ '''
17907
17892
 
17908
17893
  def __init__(
17909
17894
  self,
@@ -18503,13 +18488,16 @@ class SecretValue(
18503
18488
 
18504
18489
  Example::
18505
18490
 
18506
- amplify_app = amplify.App(self, "MyApp",
18507
- source_code_provider=amplify.GitHubSourceCodeProvider(
18508
- owner="<user>",
18509
- repository="<repo>",
18510
- oauth_token=SecretValue.secrets_manager("my-github-token")
18511
- ),
18512
- basic_auth=amplify.BasicAuth.from_credentials("username", SecretValue.secrets_manager("my-github-token"))
18491
+ # my_hosted_zone: route53.IPublicHostedZone
18492
+
18493
+
18494
+ ses.EmailIdentity(self, "Identity",
18495
+ identity=ses.Identity.public_hosted_zone(my_hosted_zone),
18496
+ dkim_identity=ses.DkimIdentity.byo_dkim(
18497
+ private_key=SecretValue.secrets_manager("dkim-private-key"),
18498
+ public_key="...base64-encoded-public-key...",
18499
+ selector="selector"
18500
+ )
18513
18501
  )
18514
18502
  '''
18515
18503
 
@@ -18681,7 +18669,6 @@ class SecretValue(
18681
18669
 
18682
18670
  Example::
18683
18671
 
18684
- # Example automatically generated from non-compiling source. May contain errors.
18685
18672
  # secret: SecretValue
18686
18673
 
18687
18674
  json_secret = {
@@ -19067,7 +19054,6 @@ class SizeConversionOptions:
19067
19054
 
19068
19055
  Example::
19069
19056
 
19070
- # Example automatically generated from non-compiling source. May contain errors.
19071
19057
  Size.mebibytes(2).to_kibibytes() # yields 2048
19072
19058
  Size.kibibytes(2050).to_mebibytes(rounding=SizeRoundingBehavior.FLOOR)
19073
19059
  '''
@@ -19107,7 +19093,6 @@ class SizeRoundingBehavior(enum.Enum):
19107
19093
 
19108
19094
  Example::
19109
19095
 
19110
- # Example automatically generated from non-compiling source. May contain errors.
19111
19096
  Size.mebibytes(2).to_kibibytes() # yields 2048
19112
19097
  Size.kibibytes(2050).to_mebibytes(rounding=SizeRoundingBehavior.FLOOR)
19113
19098
  '''
@@ -19281,7 +19266,6 @@ class Stack(
19281
19266
 
19282
19267
  Example::
19283
19268
 
19284
- # Example automatically generated from non-compiling source. May contain errors.
19285
19269
  # stack: Stack
19286
19270
 
19287
19271
 
@@ -19765,7 +19749,6 @@ class Stack(
19765
19749
 
19766
19750
  Example::
19767
19751
 
19768
- # Example automatically generated from non-compiling source. May contain errors.
19769
19752
  # After resolving, looks like
19770
19753
  "arn:aws:cloudformation:us-west-2:123456789012:stack/teststack/51af3dc0-da77-11e4-872e-1234567db123"
19771
19754
  '''
@@ -19886,7 +19869,6 @@ class StackProps:
19886
19869
 
19887
19870
  Example::
19888
19871
 
19889
- # Example automatically generated from non-compiling source. May contain errors.
19890
19872
  stack1 = Stack(app, "Stack1",
19891
19873
  env=Environment(
19892
19874
  region="us-east-1"
@@ -20010,7 +19992,6 @@ class StackProps:
20010
19992
 
20011
19993
  Example::
20012
19994
 
20013
- # Example automatically generated from non-compiling source. May contain errors.
20014
19995
  # Use a concrete account and region to deploy this stack to:
20015
19996
  # `.account` and `.region` will simply return these values.
20016
19997
  Stack(app, "Stack1",
@@ -20601,7 +20582,6 @@ class Stage(
20601
20582
 
20602
20583
  Example::
20603
20584
 
20604
- # Example automatically generated from non-compiling source. May contain errors.
20605
20585
  # pipeline: pipelines.CodePipeline
20606
20586
 
20607
20587
  preprod = MyApplicationStage(self, "PreProd")
@@ -20864,7 +20844,6 @@ class StageProps:
20864
20844
 
20865
20845
  Example::
20866
20846
 
20867
- # Example automatically generated from non-compiling source. May contain errors.
20868
20847
  # Use a concrete account and region to deploy this Stage to
20869
20848
  Stage(app, "Stage1",
20870
20849
  env=Environment(account="123456789012", region="us-east-1")
@@ -21393,23 +21372,19 @@ class TagManager(metaclass=jsii.JSIIMeta, jsii_type="aws-cdk-lib.TagManager"):
21393
21372
 
21394
21373
  Example::
21395
21374
 
21396
- import * as cdk from '@aws-cdk/core';
21397
-
21398
- class MyConstruct extends cdk.Resource implements cdk.ITaggable {
21399
- public readonly tags = new cdk.TagManager(cdk.TagType.KEY_VALUE, 'Whatever::The::Type');
21375
+ @jsii.implements(ITaggable)
21376
+ class MyConstruct(Resource):
21400
21377
 
21401
- constructor(scope: cdk.Construct, id: string) {
21402
- super(scope, id);
21378
+ def __init__(self, scope, id):
21379
+ super().__init__(scope, id)
21403
21380
 
21404
- new cdk.CfnResource(this, 'Resource', {
21405
- type: 'Whatever::The::Type',
21406
- properties: {
21407
- // ...
21408
- Tags: this.tags.renderedTags,
21409
- },
21410
- });
21411
- }
21412
- }
21381
+ CfnResource(self, "Resource",
21382
+ type="Whatever::The::Type",
21383
+ properties={
21384
+ # ...
21385
+ "Tags": self.tags.rendered_tags
21386
+ }
21387
+ )
21413
21388
  '''
21414
21389
 
21415
21390
  def __init__(
@@ -21728,6 +21703,26 @@ class TagProps:
21728
21703
 
21729
21704
  @jsii.enum(jsii_type="aws-cdk-lib.TagType")
21730
21705
  class TagType(enum.Enum):
21706
+ '''
21707
+ :exampleMetadata: infused
21708
+
21709
+ Example::
21710
+
21711
+ @jsii.implements(ITaggable)
21712
+ class MyConstruct(Resource):
21713
+
21714
+ def __init__(self, scope, id):
21715
+ super().__init__(scope, id)
21716
+
21717
+ CfnResource(self, "Resource",
21718
+ type="Whatever::The::Type",
21719
+ properties={
21720
+ # ...
21721
+ "Tags": self.tags.rendered_tags
21722
+ }
21723
+ )
21724
+ '''
21725
+
21731
21726
  STANDARD = "STANDARD"
21732
21727
  AUTOSCALING_GROUP = "AUTOSCALING_GROUP"
21733
21728
  MAP = "MAP"
@@ -21742,7 +21737,6 @@ class Tags(metaclass=jsii.JSIIMeta, jsii_type="aws-cdk-lib.Tags"):
21742
21737
 
21743
21738
  Example::
21744
21739
 
21745
- # Example automatically generated from non-compiling source. May contain errors.
21746
21740
  # mesh: appmesh.Mesh
21747
21741
  # service: cloudmap.Service
21748
21742
 
@@ -21754,13 +21748,13 @@ class Tags(metaclass=jsii.JSIIMeta, jsii_type="aws-cdk-lib.Tags"):
21754
21748
  port=8080,
21755
21749
  health_check=appmesh.HealthCheck.http(
21756
21750
  healthy_threshold=3,
21757
- interval=cdk.Duration.seconds(5),
21751
+ interval=Duration.seconds(5),
21758
21752
  path="/ping",
21759
- timeout=cdk.Duration.seconds(2),
21753
+ timeout=Duration.seconds(2),
21760
21754
  unhealthy_threshold=2
21761
21755
  ),
21762
21756
  timeout=appmesh.HttpTimeout(
21763
- idle=cdk.Duration.seconds(5)
21757
+ idle=Duration.seconds(5)
21764
21758
  )
21765
21759
  )],
21766
21760
  backend_defaults=appmesh.BackendDefaults(
@@ -26408,7 +26402,6 @@ class CfnDynamicReference(
26408
26402
 
26409
26403
  Example::
26410
26404
 
26411
- # Example automatically generated from non-compiling source. May contain errors.
26412
26405
  CfnDynamicReference(CfnDynamicReferenceService.SECRETS_MANAGER, "secret-id:secret-string:json-key:version-stage:version-id")
26413
26406
  '''
26414
26407
 
@@ -27090,7 +27083,6 @@ class CfnJson(
27090
27083
 
27091
27084
  Example::
27092
27085
 
27093
- # Example automatically generated from non-compiling source. May contain errors.
27094
27086
  tag_param = CfnParameter(self, "TagName")
27095
27087
 
27096
27088
  string_equals = CfnJson(self, "ConditionJson",
@@ -27354,7 +27346,6 @@ class CfnMapping(
27354
27346
 
27355
27347
  Example::
27356
27348
 
27357
- # Example automatically generated from non-compiling source. May contain errors.
27358
27349
  region_table = CfnMapping(self, "RegionTable",
27359
27350
  mapping={
27360
27351
  "us-east-1": {
@@ -30664,16 +30655,15 @@ class CustomResource(
30664
30655
 
30665
30656
  Example::
30666
30657
 
30667
- # Example automatically generated from non-compiling source. May contain errors.
30668
- # my_provider: CustomResourceProvider
30669
-
30658
+ service_token = CustomResourceProvider.get_or_create(self, "Custom::MyCustomResourceType",
30659
+ code_directory=f"{__dirname}/my-handler",
30660
+ runtime=CustomResourceProviderRuntime.NODEJS_14_X,
30661
+ description="Lambda function created by the custom resource provider"
30662
+ )
30670
30663
 
30671
- CustomResource(self, "MyCustomResource",
30672
- service_token=my_provider.service_token,
30673
- properties={
30674
- "my_property_one": "one",
30675
- "my_property_two": "two"
30676
- }
30664
+ CustomResource(self, "MyResource",
30665
+ resource_type="Custom::MyCustomResourceType",
30666
+ service_token=service_token
30677
30667
  )
30678
30668
  '''
30679
30669
 
@@ -31073,7 +31063,6 @@ class ICfnConditionExpression(IResolvable, typing_extensions.Protocol):
31073
31063
  You can use ``toString`` when you wish to embed a condition expression
31074
31064
  in a property value that accepts a ``string``. For example::
31075
31065
 
31076
- # Example automatically generated from non-compiling source. May contain errors.
31077
31066
  sqs.Queue(self, "MyQueue",
31078
31067
  queue_name=Fn.condition_if("Condition", "Hello", "World").to_string()
31079
31068
  )
@@ -31111,7 +31100,6 @@ class _ICfnConditionExpressionProxy(
31111
31100
  You can use ``toString`` when you wish to embed a condition expression
31112
31101
  in a property value that accepts a ``string``. For example::
31113
31102
 
31114
- # Example automatically generated from non-compiling source. May contain errors.
31115
31103
  sqs.Queue(self, "MyQueue",
31116
31104
  queue_name=Fn.condition_if("Condition", "Hello", "World").to_string()
31117
31105
  )
@@ -31767,7 +31755,6 @@ class CfnCondition(
31767
31755
 
31768
31756
  Example::
31769
31757
 
31770
- # Example automatically generated from non-compiling source. May contain errors.
31771
31758
  raw_bucket = s3.CfnBucket(self, "Bucket")
31772
31759
  # -or-
31773
31760
  raw_bucket_alt = my_bucket.node.default_child
@@ -32054,7 +32041,6 @@ class DefaultStackSynthesizer(
32054
32041
 
32055
32042
  Example::
32056
32043
 
32057
- # Example automatically generated from non-compiling source. May contain errors.
32058
32044
  MyStack(app, "MyStack",
32059
32045
  synthesizer=DefaultStackSynthesizer(
32060
32046
  file_assets_bucket_name="my-orgs-asset-bucket"