aws-cdk-lib 2.157.0__py3-none-any.whl → 2.159.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 (294) hide show
  1. aws_cdk/__init__.py +52 -20
  2. aws_cdk/_jsii/__init__.py +17 -2
  3. aws_cdk/_jsii/{aws-cdk-lib@2.157.0.jsii.tgz → aws-cdk-lib@2.159.0.jsii.tgz} +0 -0
  4. aws_cdk/alexa_ask/__init__.py +16 -1
  5. aws_cdk/assertions/__init__.py +16 -1
  6. aws_cdk/aws_accessanalyzer/__init__.py +16 -1
  7. aws_cdk/aws_acmpca/__init__.py +16 -1
  8. aws_cdk/aws_amazonmq/__init__.py +16 -1
  9. aws_cdk/aws_amplify/__init__.py +38 -9
  10. aws_cdk/aws_amplifyuibuilder/__init__.py +16 -1
  11. aws_cdk/aws_apigateway/__init__.py +16 -1
  12. aws_cdk/aws_apigatewayv2/__init__.py +46 -1
  13. aws_cdk/aws_apigatewayv2_authorizers/__init__.py +16 -1
  14. aws_cdk/aws_apigatewayv2_integrations/__init__.py +16 -1
  15. aws_cdk/aws_appconfig/__init__.py +19 -4
  16. aws_cdk/aws_appflow/__init__.py +16 -1
  17. aws_cdk/aws_appintegrations/__init__.py +16 -1
  18. aws_cdk/aws_applicationautoscaling/__init__.py +16 -1
  19. aws_cdk/aws_applicationinsights/__init__.py +560 -5
  20. aws_cdk/aws_applicationsignals/__init__.py +186 -143
  21. aws_cdk/aws_appmesh/__init__.py +16 -1
  22. aws_cdk/aws_apprunner/__init__.py +16 -1
  23. aws_cdk/aws_appstream/__init__.py +16 -1
  24. aws_cdk/aws_appsync/__init__.py +16 -1
  25. aws_cdk/aws_apptest/__init__.py +16 -1
  26. aws_cdk/aws_aps/__init__.py +16 -1
  27. aws_cdk/aws_arczonalshift/__init__.py +16 -1
  28. aws_cdk/aws_athena/__init__.py +31 -16
  29. aws_cdk/aws_auditmanager/__init__.py +21 -6
  30. aws_cdk/aws_autoscaling/__init__.py +16 -1
  31. aws_cdk/aws_autoscaling_common/__init__.py +16 -1
  32. aws_cdk/aws_autoscaling_hooktargets/__init__.py +16 -1
  33. aws_cdk/aws_autoscalingplans/__init__.py +16 -1
  34. aws_cdk/aws_b2bi/__init__.py +16 -1
  35. aws_cdk/aws_backup/__init__.py +16 -1
  36. aws_cdk/aws_backupgateway/__init__.py +16 -1
  37. aws_cdk/aws_batch/__init__.py +16 -1
  38. aws_cdk/aws_bcmdataexports/__init__.py +16 -1
  39. aws_cdk/aws_bedrock/__init__.py +23 -8
  40. aws_cdk/aws_billingconductor/__init__.py +16 -1
  41. aws_cdk/aws_budgets/__init__.py +16 -1
  42. aws_cdk/aws_cassandra/__init__.py +16 -1
  43. aws_cdk/aws_ce/__init__.py +16 -1
  44. aws_cdk/aws_certificatemanager/__init__.py +16 -1
  45. aws_cdk/aws_chatbot/__init__.py +16 -1
  46. aws_cdk/aws_cleanrooms/__init__.py +16 -1
  47. aws_cdk/aws_cleanroomsml/__init__.py +16 -1
  48. aws_cdk/aws_cloud9/__init__.py +16 -1
  49. aws_cdk/aws_cloudformation/__init__.py +16 -1
  50. aws_cdk/aws_cloudfront/__init__.py +16 -1
  51. aws_cdk/aws_cloudfront/experimental/__init__.py +16 -1
  52. aws_cdk/aws_cloudfront_origins/__init__.py +16 -1
  53. aws_cdk/aws_cloudtrail/__init__.py +16 -1
  54. aws_cdk/aws_cloudwatch/__init__.py +16 -1
  55. aws_cdk/aws_cloudwatch_actions/__init__.py +16 -1
  56. aws_cdk/aws_codeartifact/__init__.py +16 -1
  57. aws_cdk/aws_codebuild/__init__.py +55 -19
  58. aws_cdk/aws_codecommit/__init__.py +16 -1
  59. aws_cdk/aws_codeconnections/__init__.py +17 -2
  60. aws_cdk/aws_codedeploy/__init__.py +16 -1
  61. aws_cdk/aws_codeguruprofiler/__init__.py +16 -1
  62. aws_cdk/aws_codegurureviewer/__init__.py +16 -1
  63. aws_cdk/aws_codepipeline/__init__.py +16 -1
  64. aws_cdk/aws_codepipeline_actions/__init__.py +16 -1
  65. aws_cdk/aws_codestar/__init__.py +16 -1
  66. aws_cdk/aws_codestarconnections/__init__.py +16 -1
  67. aws_cdk/aws_codestarnotifications/__init__.py +16 -1
  68. aws_cdk/aws_cognito/__init__.py +406 -204
  69. aws_cdk/aws_comprehend/__init__.py +16 -1
  70. aws_cdk/aws_config/__init__.py +16 -1
  71. aws_cdk/aws_connect/__init__.py +1695 -153
  72. aws_cdk/aws_connectcampaigns/__init__.py +16 -1
  73. aws_cdk/aws_controltower/__init__.py +16 -1
  74. aws_cdk/aws_cur/__init__.py +16 -1
  75. aws_cdk/aws_customerprofiles/__init__.py +16 -1
  76. aws_cdk/aws_databrew/__init__.py +16 -1
  77. aws_cdk/aws_datapipeline/__init__.py +16 -1
  78. aws_cdk/aws_datasync/__init__.py +16 -1
  79. aws_cdk/aws_datazone/__init__.py +681 -41
  80. aws_cdk/aws_dax/__init__.py +16 -1
  81. aws_cdk/aws_deadline/__init__.py +16 -1
  82. aws_cdk/aws_detective/__init__.py +16 -1
  83. aws_cdk/aws_devicefarm/__init__.py +16 -1
  84. aws_cdk/aws_devopsguru/__init__.py +16 -1
  85. aws_cdk/aws_directoryservice/__init__.py +16 -1
  86. aws_cdk/aws_dlm/__init__.py +16 -1
  87. aws_cdk/aws_dms/__init__.py +16 -1
  88. aws_cdk/aws_docdb/__init__.py +22 -2
  89. aws_cdk/aws_docdbelastic/__init__.py +16 -1
  90. aws_cdk/aws_dynamodb/__init__.py +21 -6
  91. aws_cdk/aws_ec2/__init__.py +137 -37
  92. aws_cdk/aws_ecr/__init__.py +30 -7
  93. aws_cdk/aws_ecr_assets/__init__.py +16 -1
  94. aws_cdk/aws_ecs/__init__.py +36 -21
  95. aws_cdk/aws_ecs_patterns/__init__.py +16 -1
  96. aws_cdk/aws_efs/__init__.py +16 -1
  97. aws_cdk/aws_eks/__init__.py +16 -1
  98. aws_cdk/aws_elasticache/__init__.py +16 -1
  99. aws_cdk/aws_elasticbeanstalk/__init__.py +16 -1
  100. aws_cdk/aws_elasticloadbalancing/__init__.py +16 -1
  101. aws_cdk/aws_elasticloadbalancingv2/__init__.py +183 -21
  102. aws_cdk/aws_elasticloadbalancingv2_actions/__init__.py +16 -1
  103. aws_cdk/aws_elasticloadbalancingv2_targets/__init__.py +16 -1
  104. aws_cdk/aws_elasticsearch/__init__.py +16 -1
  105. aws_cdk/aws_emr/__init__.py +24 -9
  106. aws_cdk/aws_emrcontainers/__init__.py +16 -1
  107. aws_cdk/aws_emrserverless/__init__.py +16 -1
  108. aws_cdk/aws_entityresolution/__init__.py +16 -1
  109. aws_cdk/aws_events/__init__.py +35 -18
  110. aws_cdk/aws_events_targets/__init__.py +181 -86
  111. aws_cdk/aws_eventschemas/__init__.py +16 -1
  112. aws_cdk/aws_evidently/__init__.py +16 -1
  113. aws_cdk/aws_finspace/__init__.py +16 -1
  114. aws_cdk/aws_fis/__init__.py +16 -1
  115. aws_cdk/aws_fms/__init__.py +75 -1
  116. aws_cdk/aws_forecast/__init__.py +16 -1
  117. aws_cdk/aws_frauddetector/__init__.py +16 -1
  118. aws_cdk/aws_fsx/__init__.py +19 -4
  119. aws_cdk/aws_gamelift/__init__.py +56 -53
  120. aws_cdk/aws_globalaccelerator/__init__.py +38 -30
  121. aws_cdk/aws_globalaccelerator_endpoints/__init__.py +16 -1
  122. aws_cdk/aws_glue/__init__.py +16 -1
  123. aws_cdk/aws_grafana/__init__.py +16 -1
  124. aws_cdk/aws_greengrass/__init__.py +16 -1
  125. aws_cdk/aws_greengrassv2/__init__.py +16 -1
  126. aws_cdk/aws_groundstation/__init__.py +16 -1
  127. aws_cdk/aws_guardduty/__init__.py +16 -1
  128. aws_cdk/aws_healthimaging/__init__.py +16 -1
  129. aws_cdk/aws_healthlake/__init__.py +16 -1
  130. aws_cdk/aws_iam/__init__.py +38 -21
  131. aws_cdk/aws_identitystore/__init__.py +16 -1
  132. aws_cdk/aws_imagebuilder/__init__.py +16 -1
  133. aws_cdk/aws_inspector/__init__.py +16 -1
  134. aws_cdk/aws_inspectorv2/__init__.py +16 -1
  135. aws_cdk/aws_internetmonitor/__init__.py +16 -1
  136. aws_cdk/aws_iot/__init__.py +16 -1
  137. aws_cdk/aws_iot1click/__init__.py +16 -1
  138. aws_cdk/aws_iotanalytics/__init__.py +16 -1
  139. aws_cdk/aws_iotcoredeviceadvisor/__init__.py +16 -1
  140. aws_cdk/aws_iotevents/__init__.py +16 -1
  141. aws_cdk/aws_iotfleethub/__init__.py +16 -1
  142. aws_cdk/aws_iotfleetwise/__init__.py +435 -1
  143. aws_cdk/aws_iotsitewise/__init__.py +106 -2
  144. aws_cdk/aws_iotthingsgraph/__init__.py +16 -1
  145. aws_cdk/aws_iottwinmaker/__init__.py +16 -1
  146. aws_cdk/aws_iotwireless/__init__.py +221 -1
  147. aws_cdk/aws_ivs/__init__.py +16 -1
  148. aws_cdk/aws_ivschat/__init__.py +16 -1
  149. aws_cdk/aws_kafkaconnect/__init__.py +16 -1
  150. aws_cdk/aws_kendra/__init__.py +16 -1
  151. aws_cdk/aws_kendraranking/__init__.py +16 -1
  152. aws_cdk/aws_kinesis/__init__.py +16 -1
  153. aws_cdk/aws_kinesisanalytics/__init__.py +16 -1
  154. aws_cdk/aws_kinesisanalyticsv2/__init__.py +16 -1
  155. aws_cdk/aws_kinesisfirehose/__init__.py +16 -1
  156. aws_cdk/aws_kinesisvideo/__init__.py +16 -1
  157. aws_cdk/aws_kms/__init__.py +16 -1
  158. aws_cdk/aws_lakeformation/__init__.py +16 -1
  159. aws_cdk/aws_lambda/__init__.py +145 -17
  160. aws_cdk/aws_lambda_destinations/__init__.py +16 -1
  161. aws_cdk/aws_lambda_event_sources/__init__.py +16 -1
  162. aws_cdk/aws_lambda_nodejs/__init__.py +16 -1
  163. aws_cdk/aws_launchwizard/__init__.py +16 -1
  164. aws_cdk/aws_lex/__init__.py +31 -2
  165. aws_cdk/aws_licensemanager/__init__.py +16 -1
  166. aws_cdk/aws_lightsail/__init__.py +16 -1
  167. aws_cdk/aws_location/__init__.py +16 -1
  168. aws_cdk/aws_logs/__init__.py +17 -2
  169. aws_cdk/aws_logs_destinations/__init__.py +16 -1
  170. aws_cdk/aws_lookoutequipment/__init__.py +16 -1
  171. aws_cdk/aws_lookoutmetrics/__init__.py +16 -1
  172. aws_cdk/aws_lookoutvision/__init__.py +16 -1
  173. aws_cdk/aws_m2/__init__.py +16 -1
  174. aws_cdk/aws_macie/__init__.py +16 -1
  175. aws_cdk/aws_managedblockchain/__init__.py +16 -1
  176. aws_cdk/aws_mediaconnect/__init__.py +127 -1
  177. aws_cdk/aws_mediaconvert/__init__.py +16 -1
  178. aws_cdk/aws_medialive/__init__.py +8004 -3263
  179. aws_cdk/aws_mediapackage/__init__.py +16 -1
  180. aws_cdk/aws_mediapackagev2/__init__.py +16 -1
  181. aws_cdk/aws_mediastore/__init__.py +16 -1
  182. aws_cdk/aws_mediatailor/__init__.py +16 -1
  183. aws_cdk/aws_memorydb/__init__.py +16 -1
  184. aws_cdk/aws_msk/__init__.py +303 -480
  185. aws_cdk/aws_mwaa/__init__.py +16 -1
  186. aws_cdk/aws_neptune/__init__.py +16 -1
  187. aws_cdk/aws_neptunegraph/__init__.py +16 -1
  188. aws_cdk/aws_networkfirewall/__init__.py +16 -1
  189. aws_cdk/aws_networkmanager/__init__.py +16 -1
  190. aws_cdk/aws_nimblestudio/__init__.py +16 -1
  191. aws_cdk/aws_oam/__init__.py +16 -1
  192. aws_cdk/aws_omics/__init__.py +16 -1
  193. aws_cdk/aws_opensearchserverless/__init__.py +16 -1
  194. aws_cdk/aws_opensearchservice/__init__.py +22 -1
  195. aws_cdk/aws_opsworks/__init__.py +16 -1
  196. aws_cdk/aws_opsworkscm/__init__.py +16 -1
  197. aws_cdk/aws_organizations/__init__.py +16 -1
  198. aws_cdk/aws_osis/__init__.py +16 -1
  199. aws_cdk/aws_panorama/__init__.py +16 -1
  200. aws_cdk/aws_paymentcryptography/__init__.py +16 -1
  201. aws_cdk/aws_pcaconnectorad/__init__.py +16 -1
  202. aws_cdk/aws_pcaconnectorscep/__init__.py +85 -31
  203. aws_cdk/aws_personalize/__init__.py +16 -1
  204. aws_cdk/aws_pinpoint/__init__.py +16 -1
  205. aws_cdk/aws_pinpointemail/__init__.py +16 -1
  206. aws_cdk/aws_pipes/__init__.py +65 -1
  207. aws_cdk/aws_proton/__init__.py +16 -1
  208. aws_cdk/aws_qbusiness/__init__.py +27 -15
  209. aws_cdk/aws_qldb/__init__.py +16 -1
  210. aws_cdk/aws_quicksight/__init__.py +654 -100
  211. aws_cdk/aws_ram/__init__.py +16 -1
  212. aws_cdk/aws_rds/__init__.py +78 -32
  213. aws_cdk/aws_redshift/__init__.py +16 -1
  214. aws_cdk/aws_redshiftserverless/__init__.py +16 -1
  215. aws_cdk/aws_refactorspaces/__init__.py +16 -1
  216. aws_cdk/aws_rekognition/__init__.py +16 -1
  217. aws_cdk/aws_resiliencehub/__init__.py +16 -1
  218. aws_cdk/aws_resourceexplorer2/__init__.py +16 -1
  219. aws_cdk/aws_resourcegroups/__init__.py +16 -1
  220. aws_cdk/aws_robomaker/__init__.py +16 -1
  221. aws_cdk/aws_rolesanywhere/__init__.py +16 -1
  222. aws_cdk/aws_route53/__init__.py +16 -1
  223. aws_cdk/aws_route53_patterns/__init__.py +16 -1
  224. aws_cdk/aws_route53_targets/__init__.py +16 -1
  225. aws_cdk/aws_route53profiles/__init__.py +16 -1
  226. aws_cdk/aws_route53recoverycontrol/__init__.py +16 -1
  227. aws_cdk/aws_route53recoveryreadiness/__init__.py +16 -1
  228. aws_cdk/aws_route53resolver/__init__.py +16 -1
  229. aws_cdk/aws_rum/__init__.py +16 -1
  230. aws_cdk/aws_s3/__init__.py +231 -34
  231. aws_cdk/aws_s3_assets/__init__.py +16 -1
  232. aws_cdk/aws_s3_deployment/__init__.py +16 -1
  233. aws_cdk/aws_s3_notifications/__init__.py +16 -1
  234. aws_cdk/aws_s3express/__init__.py +16 -1
  235. aws_cdk/aws_s3objectlambda/__init__.py +18 -3
  236. aws_cdk/aws_s3outposts/__init__.py +16 -1
  237. aws_cdk/aws_sagemaker/__init__.py +888 -59
  238. aws_cdk/aws_sam/__init__.py +16 -1
  239. aws_cdk/aws_scheduler/__init__.py +16 -1
  240. aws_cdk/aws_sdb/__init__.py +16 -1
  241. aws_cdk/aws_secretsmanager/__init__.py +38 -9
  242. aws_cdk/aws_securityhub/__init__.py +277 -20
  243. aws_cdk/aws_securitylake/__init__.py +343 -8
  244. aws_cdk/aws_servicecatalog/__init__.py +16 -1
  245. aws_cdk/aws_servicecatalogappregistry/__init__.py +16 -1
  246. aws_cdk/aws_servicediscovery/__init__.py +21 -6
  247. aws_cdk/aws_ses/__init__.py +16 -1
  248. aws_cdk/aws_ses_actions/__init__.py +16 -1
  249. aws_cdk/aws_shield/__init__.py +16 -1
  250. aws_cdk/aws_signer/__init__.py +16 -1
  251. aws_cdk/aws_simspaceweaver/__init__.py +16 -1
  252. aws_cdk/aws_sns/__init__.py +16 -9
  253. aws_cdk/aws_sns_subscriptions/__init__.py +16 -1
  254. aws_cdk/aws_sqs/__init__.py +16 -1
  255. aws_cdk/aws_ssm/__init__.py +36 -13
  256. aws_cdk/aws_ssmcontacts/__init__.py +16 -1
  257. aws_cdk/aws_ssmincidents/__init__.py +16 -1
  258. aws_cdk/aws_ssmquicksetup/__init__.py +16 -1
  259. aws_cdk/aws_sso/__init__.py +16 -1
  260. aws_cdk/aws_stepfunctions/__init__.py +16 -1
  261. aws_cdk/aws_stepfunctions_tasks/__init__.py +52 -1
  262. aws_cdk/aws_supportapp/__init__.py +16 -1
  263. aws_cdk/aws_synthetics/__init__.py +16 -1
  264. aws_cdk/aws_systemsmanagersap/__init__.py +16 -1
  265. aws_cdk/aws_timestream/__init__.py +16 -1
  266. aws_cdk/aws_transfer/__init__.py +16 -1
  267. aws_cdk/aws_verifiedpermissions/__init__.py +16 -1
  268. aws_cdk/aws_voiceid/__init__.py +16 -1
  269. aws_cdk/aws_vpclattice/__init__.py +16 -1
  270. aws_cdk/aws_waf/__init__.py +16 -1
  271. aws_cdk/aws_wafregional/__init__.py +16 -1
  272. aws_cdk/aws_wafv2/__init__.py +16 -1
  273. aws_cdk/aws_wisdom/__init__.py +16 -1
  274. aws_cdk/aws_workspaces/__init__.py +16 -1
  275. aws_cdk/aws_workspacesthinclient/__init__.py +16 -1
  276. aws_cdk/aws_workspacesweb/__init__.py +16 -1
  277. aws_cdk/aws_xray/__init__.py +16 -1
  278. aws_cdk/cloud_assembly_schema/__init__.py +16 -1
  279. aws_cdk/cloudformation_include/__init__.py +16 -1
  280. aws_cdk/custom_resources/__init__.py +16 -1
  281. aws_cdk/cx_api/__init__.py +35 -1
  282. aws_cdk/lambda_layer_awscli/__init__.py +16 -1
  283. aws_cdk/lambda_layer_kubectl/__init__.py +16 -1
  284. aws_cdk/lambda_layer_node_proxy_agent/__init__.py +16 -1
  285. aws_cdk/pipelines/__init__.py +16 -1
  286. aws_cdk/region_info/__init__.py +16 -1
  287. aws_cdk/triggers/__init__.py +16 -1
  288. {aws_cdk_lib-2.157.0.dist-info → aws_cdk_lib-2.159.0.dist-info}/METADATA +5 -5
  289. {aws_cdk_lib-2.157.0.dist-info → aws_cdk_lib-2.159.0.dist-info}/NOTICE +27 -8
  290. aws_cdk_lib-2.159.0.dist-info/RECORD +294 -0
  291. aws_cdk_lib-2.157.0.dist-info/RECORD +0 -294
  292. {aws_cdk_lib-2.157.0.dist-info → aws_cdk_lib-2.159.0.dist-info}/LICENSE +0 -0
  293. {aws_cdk_lib-2.157.0.dist-info → aws_cdk_lib-2.159.0.dist-info}/WHEEL +0 -0
  294. {aws_cdk_lib-2.157.0.dist-info → aws_cdk_lib-2.159.0.dist-info}/top_level.txt +0 -0
@@ -38,7 +38,22 @@ import jsii
38
38
  import publication
39
39
  import typing_extensions
40
40
 
41
- from typeguard import check_type
41
+ import typeguard
42
+ from importlib.metadata import version as _metadata_package_version
43
+ TYPEGUARD_MAJOR_VERSION = int(_metadata_package_version('typeguard').split('.')[0])
44
+
45
+ def check_type(argname: str, value: object, expected_type: typing.Any) -> typing.Any:
46
+ if TYPEGUARD_MAJOR_VERSION <= 2:
47
+ return typeguard.check_type(argname=argname, value=value, expected_type=expected_type) # type:ignore
48
+ else:
49
+ if isinstance(value, jsii._reference_map.InterfaceDynamicProxy): # pyright: ignore [reportAttributeAccessIssue]
50
+ pass
51
+ else:
52
+ if TYPEGUARD_MAJOR_VERSION == 3:
53
+ typeguard.config.collection_check_strategy = typeguard.CollectionCheckStrategy.ALL_ITEMS # type:ignore
54
+ typeguard.check_type(value=value, expected_type=expected_type) # type:ignore
55
+ else:
56
+ typeguard.check_type(value=value, expected_type=expected_type, collection_check_strategy=typeguard.CollectionCheckStrategy.ALL_ITEMS) # type:ignore
42
57
 
43
58
  from .._jsii import *
44
59
 
@@ -538,7 +538,22 @@ import jsii
538
538
  import publication
539
539
  import typing_extensions
540
540
 
541
- from typeguard import check_type
541
+ import typeguard
542
+ from importlib.metadata import version as _metadata_package_version
543
+ TYPEGUARD_MAJOR_VERSION = int(_metadata_package_version('typeguard').split('.')[0])
544
+
545
+ def check_type(argname: str, value: object, expected_type: typing.Any) -> typing.Any:
546
+ if TYPEGUARD_MAJOR_VERSION <= 2:
547
+ return typeguard.check_type(argname=argname, value=value, expected_type=expected_type) # type:ignore
548
+ else:
549
+ if isinstance(value, jsii._reference_map.InterfaceDynamicProxy): # pyright: ignore [reportAttributeAccessIssue]
550
+ pass
551
+ else:
552
+ if TYPEGUARD_MAJOR_VERSION == 3:
553
+ typeguard.config.collection_check_strategy = typeguard.CollectionCheckStrategy.ALL_ITEMS # type:ignore
554
+ typeguard.check_type(value=value, expected_type=expected_type) # type:ignore
555
+ else:
556
+ typeguard.check_type(value=value, expected_type=expected_type, collection_check_strategy=typeguard.CollectionCheckStrategy.ALL_ITEMS) # type:ignore
542
557
 
543
558
  from .._jsii import *
544
559
 
@@ -87,7 +87,22 @@ import jsii
87
87
  import publication
88
88
  import typing_extensions
89
89
 
90
- from typeguard import check_type
90
+ import typeguard
91
+ from importlib.metadata import version as _metadata_package_version
92
+ TYPEGUARD_MAJOR_VERSION = int(_metadata_package_version('typeguard').split('.')[0])
93
+
94
+ def check_type(argname: str, value: object, expected_type: typing.Any) -> typing.Any:
95
+ if TYPEGUARD_MAJOR_VERSION <= 2:
96
+ return typeguard.check_type(argname=argname, value=value, expected_type=expected_type) # type:ignore
97
+ else:
98
+ if isinstance(value, jsii._reference_map.InterfaceDynamicProxy): # pyright: ignore [reportAttributeAccessIssue]
99
+ pass
100
+ else:
101
+ if TYPEGUARD_MAJOR_VERSION == 3:
102
+ typeguard.config.collection_check_strategy = typeguard.CollectionCheckStrategy.ALL_ITEMS # type:ignore
103
+ typeguard.check_type(value=value, expected_type=expected_type) # type:ignore
104
+ else:
105
+ typeguard.check_type(value=value, expected_type=expected_type, collection_check_strategy=typeguard.CollectionCheckStrategy.ALL_ITEMS) # type:ignore
91
106
 
92
107
  from .._jsii import *
93
108
 
@@ -194,7 +194,22 @@ import jsii
194
194
  import publication
195
195
  import typing_extensions
196
196
 
197
- from typeguard import check_type
197
+ import typeguard
198
+ from importlib.metadata import version as _metadata_package_version
199
+ TYPEGUARD_MAJOR_VERSION = int(_metadata_package_version('typeguard').split('.')[0])
200
+
201
+ def check_type(argname: str, value: object, expected_type: typing.Any) -> typing.Any:
202
+ if TYPEGUARD_MAJOR_VERSION <= 2:
203
+ return typeguard.check_type(argname=argname, value=value, expected_type=expected_type) # type:ignore
204
+ else:
205
+ if isinstance(value, jsii._reference_map.InterfaceDynamicProxy): # pyright: ignore [reportAttributeAccessIssue]
206
+ pass
207
+ else:
208
+ if TYPEGUARD_MAJOR_VERSION == 3:
209
+ typeguard.config.collection_check_strategy = typeguard.CollectionCheckStrategy.ALL_ITEMS # type:ignore
210
+ typeguard.check_type(value=value, expected_type=expected_type) # type:ignore
211
+ else:
212
+ typeguard.check_type(value=value, expected_type=expected_type, collection_check_strategy=typeguard.CollectionCheckStrategy.ALL_ITEMS) # type:ignore
198
213
 
199
214
  from .._jsii import *
200
215
 
@@ -48,7 +48,22 @@ import jsii
48
48
  import publication
49
49
  import typing_extensions
50
50
 
51
- from typeguard import check_type
51
+ import typeguard
52
+ from importlib.metadata import version as _metadata_package_version
53
+ TYPEGUARD_MAJOR_VERSION = int(_metadata_package_version('typeguard').split('.')[0])
54
+
55
+ def check_type(argname: str, value: object, expected_type: typing.Any) -> typing.Any:
56
+ if TYPEGUARD_MAJOR_VERSION <= 2:
57
+ return typeguard.check_type(argname=argname, value=value, expected_type=expected_type) # type:ignore
58
+ else:
59
+ if isinstance(value, jsii._reference_map.InterfaceDynamicProxy): # pyright: ignore [reportAttributeAccessIssue]
60
+ pass
61
+ else:
62
+ if TYPEGUARD_MAJOR_VERSION == 3:
63
+ typeguard.config.collection_check_strategy = typeguard.CollectionCheckStrategy.ALL_ITEMS # type:ignore
64
+ typeguard.check_type(value=value, expected_type=expected_type) # type:ignore
65
+ else:
66
+ typeguard.check_type(value=value, expected_type=expected_type, collection_check_strategy=typeguard.CollectionCheckStrategy.ALL_ITEMS) # type:ignore
52
67
 
53
68
  from .._jsii import *
54
69
 
@@ -38,7 +38,22 @@ import jsii
38
38
  import publication
39
39
  import typing_extensions
40
40
 
41
- from typeguard import check_type
41
+ import typeguard
42
+ from importlib.metadata import version as _metadata_package_version
43
+ TYPEGUARD_MAJOR_VERSION = int(_metadata_package_version('typeguard').split('.')[0])
44
+
45
+ def check_type(argname: str, value: object, expected_type: typing.Any) -> typing.Any:
46
+ if TYPEGUARD_MAJOR_VERSION <= 2:
47
+ return typeguard.check_type(argname=argname, value=value, expected_type=expected_type) # type:ignore
48
+ else:
49
+ if isinstance(value, jsii._reference_map.InterfaceDynamicProxy): # pyright: ignore [reportAttributeAccessIssue]
50
+ pass
51
+ else:
52
+ if TYPEGUARD_MAJOR_VERSION == 3:
53
+ typeguard.config.collection_check_strategy = typeguard.CollectionCheckStrategy.ALL_ITEMS # type:ignore
54
+ typeguard.check_type(value=value, expected_type=expected_type) # type:ignore
55
+ else:
56
+ typeguard.check_type(value=value, expected_type=expected_type, collection_check_strategy=typeguard.CollectionCheckStrategy.ALL_ITEMS) # type:ignore
42
57
 
43
58
  from .._jsii import *
44
59
 
@@ -38,7 +38,22 @@ import jsii
38
38
  import publication
39
39
  import typing_extensions
40
40
 
41
- from typeguard import check_type
41
+ import typeguard
42
+ from importlib.metadata import version as _metadata_package_version
43
+ TYPEGUARD_MAJOR_VERSION = int(_metadata_package_version('typeguard').split('.')[0])
44
+
45
+ def check_type(argname: str, value: object, expected_type: typing.Any) -> typing.Any:
46
+ if TYPEGUARD_MAJOR_VERSION <= 2:
47
+ return typeguard.check_type(argname=argname, value=value, expected_type=expected_type) # type:ignore
48
+ else:
49
+ if isinstance(value, jsii._reference_map.InterfaceDynamicProxy): # pyright: ignore [reportAttributeAccessIssue]
50
+ pass
51
+ else:
52
+ if TYPEGUARD_MAJOR_VERSION == 3:
53
+ typeguard.config.collection_check_strategy = typeguard.CollectionCheckStrategy.ALL_ITEMS # type:ignore
54
+ typeguard.check_type(value=value, expected_type=expected_type) # type:ignore
55
+ else:
56
+ typeguard.check_type(value=value, expected_type=expected_type, collection_check_strategy=typeguard.CollectionCheckStrategy.ALL_ITEMS) # type:ignore
42
57
 
43
58
  from .._jsii import *
44
59
 
@@ -43,7 +43,22 @@ import jsii
43
43
  import publication
44
44
  import typing_extensions
45
45
 
46
- from typeguard import check_type
46
+ import typeguard
47
+ from importlib.metadata import version as _metadata_package_version
48
+ TYPEGUARD_MAJOR_VERSION = int(_metadata_package_version('typeguard').split('.')[0])
49
+
50
+ def check_type(argname: str, value: object, expected_type: typing.Any) -> typing.Any:
51
+ if TYPEGUARD_MAJOR_VERSION <= 2:
52
+ return typeguard.check_type(argname=argname, value=value, expected_type=expected_type) # type:ignore
53
+ else:
54
+ if isinstance(value, jsii._reference_map.InterfaceDynamicProxy): # pyright: ignore [reportAttributeAccessIssue]
55
+ pass
56
+ else:
57
+ if TYPEGUARD_MAJOR_VERSION == 3:
58
+ typeguard.config.collection_check_strategy = typeguard.CollectionCheckStrategy.ALL_ITEMS # type:ignore
59
+ typeguard.check_type(value=value, expected_type=expected_type) # type:ignore
60
+ else:
61
+ typeguard.check_type(value=value, expected_type=expected_type, collection_check_strategy=typeguard.CollectionCheckStrategy.ALL_ITEMS) # type:ignore
47
62
 
48
63
  from .._jsii import *
49
64
 
@@ -38,7 +38,22 @@ import jsii
38
38
  import publication
39
39
  import typing_extensions
40
40
 
41
- from typeguard import check_type
41
+ import typeguard
42
+ from importlib.metadata import version as _metadata_package_version
43
+ TYPEGUARD_MAJOR_VERSION = int(_metadata_package_version('typeguard').split('.')[0])
44
+
45
+ def check_type(argname: str, value: object, expected_type: typing.Any) -> typing.Any:
46
+ if TYPEGUARD_MAJOR_VERSION <= 2:
47
+ return typeguard.check_type(argname=argname, value=value, expected_type=expected_type) # type:ignore
48
+ else:
49
+ if isinstance(value, jsii._reference_map.InterfaceDynamicProxy): # pyright: ignore [reportAttributeAccessIssue]
50
+ pass
51
+ else:
52
+ if TYPEGUARD_MAJOR_VERSION == 3:
53
+ typeguard.config.collection_check_strategy = typeguard.CollectionCheckStrategy.ALL_ITEMS # type:ignore
54
+ typeguard.check_type(value=value, expected_type=expected_type) # type:ignore
55
+ else:
56
+ typeguard.check_type(value=value, expected_type=expected_type, collection_check_strategy=typeguard.CollectionCheckStrategy.ALL_ITEMS) # type:ignore
42
57
 
43
58
  from .._jsii import *
44
59
 
@@ -478,6 +478,110 @@ bucket = s3.Bucket(self, "MyBucket",
478
478
  )
479
479
  ```
480
480
 
481
+ The above code will create a new bucket policy if none exists or update the
482
+ existing bucket policy to allow access log delivery.
483
+
484
+ However, there could be an edge case if the `accessLogsBucket` also defines a bucket
485
+ policy resource using the L1 Construct. Although the mixing of L1 and L2 Constructs is not
486
+ recommended, there are no mechanisms in place to prevent users from doing this at the moment.
487
+
488
+ ```python
489
+ bucket_name = "my-favorite-bucket-name"
490
+ access_logs_bucket = s3.Bucket(self, "AccessLogsBucket",
491
+ object_ownership=s3.ObjectOwnership.BUCKET_OWNER_ENFORCED,
492
+ bucket_name=bucket_name
493
+ )
494
+
495
+ # Creating a bucket policy using L1
496
+ bucket_policy = s3.CfnBucketPolicy(self, "BucketPolicy",
497
+ bucket=bucket_name,
498
+ policy_document={
499
+ "Statement": [{
500
+ "Action": "s3:*",
501
+ "Effect": "Deny",
502
+ "Principal": {
503
+ "AWS": "*"
504
+ },
505
+ "Resource": [access_logs_bucket.bucket_arn, f"{accessLogsBucket.bucketArn}/*"
506
+ ]
507
+ }
508
+ ],
509
+ "Version": "2012-10-17"
510
+ }
511
+ )
512
+
513
+ # 'serverAccessLogsBucket' will create a new L2 bucket policy
514
+ # to allow log delivery and overwrite the L1 bucket policy.
515
+ bucket = s3.Bucket(self, "MyBucket",
516
+ server_access_logs_bucket=access_logs_bucket,
517
+ server_access_logs_prefix="logs"
518
+ )
519
+ ```
520
+
521
+ The above example uses the L2 Bucket Construct with the L1 CfnBucketPolicy Construct. However,
522
+ when `serverAccessLogsBucket` is set, a new L2 Bucket Policy resource will be created
523
+ which overwrites the permissions defined in the L1 Bucket Policy causing unintended
524
+ behaviours.
525
+
526
+ As noted above, we highly discourage the mixed usage of L1 and L2 Constructs. The recommended
527
+ approach would to define the bucket policy using `addToResourcePolicy` method.
528
+
529
+ ```python
530
+ access_logs_bucket = s3.Bucket(self, "AccessLogsBucket",
531
+ object_ownership=s3.ObjectOwnership.BUCKET_OWNER_ENFORCED
532
+ )
533
+
534
+ access_logs_bucket.add_to_resource_policy(
535
+ iam.PolicyStatement(
536
+ actions=["s3:*"],
537
+ resources=[access_logs_bucket.bucket_arn, access_logs_bucket.arn_for_objects("*")],
538
+ principals=[iam.AnyPrincipal()]
539
+ ))
540
+
541
+ bucket = s3.Bucket(self, "MyBucket",
542
+ server_access_logs_bucket=access_logs_bucket,
543
+ server_access_logs_prefix="logs"
544
+ )
545
+ ```
546
+
547
+ Alternatively, users can use the L2 Bucket Policy Construct
548
+ `BucketPolicy.fromCfnBucketPolicy` to wrap around `CfnBucketPolicy` Construct. This will allow the subsequent bucket policy generated by `serverAccessLogsBucket` usage to append to the existing bucket policy instead of overwriting.
549
+
550
+ ```python
551
+ bucket_name = "my-favorite-bucket-name"
552
+ access_logs_bucket = s3.Bucket(self, "AccessLogsBucket",
553
+ object_ownership=s3.ObjectOwnership.BUCKET_OWNER_ENFORCED,
554
+ bucket_name=bucket_name
555
+ )
556
+
557
+ bucket_policy = s3.CfnBucketPolicy(self, "BucketPolicy",
558
+ bucket=bucket_name,
559
+ policy_document={
560
+ "Statement": [{
561
+ "Action": "s3:*",
562
+ "Effect": "Deny",
563
+ "Principal": {
564
+ "AWS": "*"
565
+ },
566
+ "Resource": [access_logs_bucket.bucket_arn, f"{accessLogsBucket.bucketArn}/*"
567
+ ]
568
+ }
569
+ ],
570
+ "Version": "2012-10-17"
571
+ }
572
+ )
573
+
574
+ # Wrap L1 Construct with L2 Bucket Policy Construct. Subsequent
575
+ # generated bucket policy to allow access log delivery would append
576
+ # to the current policy.
577
+ s3.BucketPolicy.from_cfn_bucket_policy(bucket_policy)
578
+
579
+ bucket = s3.Bucket(self, "MyBucket",
580
+ server_access_logs_bucket=access_logs_bucket,
581
+ server_access_logs_prefix="logs"
582
+ )
583
+ ```
584
+
481
585
  ## S3 Inventory
482
586
 
483
587
  An [inventory](https://docs.aws.amazon.com/AmazonS3/latest/dev/storage-inventory.html) contains a list of the objects in the source bucket and metadata for each object. The inventory lists are stored in the destination bucket as a CSV file compressed with GZIP, as an Apache optimized row columnar (ORC) file compressed with ZLIB, or as an Apache Parquet (Parquet) file compressed with Snappy.
@@ -769,7 +873,22 @@ import jsii
769
873
  import publication
770
874
  import typing_extensions
771
875
 
772
- from typeguard import check_type
876
+ import typeguard
877
+ from importlib.metadata import version as _metadata_package_version
878
+ TYPEGUARD_MAJOR_VERSION = int(_metadata_package_version('typeguard').split('.')[0])
879
+
880
+ def check_type(argname: str, value: object, expected_type: typing.Any) -> typing.Any:
881
+ if TYPEGUARD_MAJOR_VERSION <= 2:
882
+ return typeguard.check_type(argname=argname, value=value, expected_type=expected_type) # type:ignore
883
+ else:
884
+ if isinstance(value, jsii._reference_map.InterfaceDynamicProxy): # pyright: ignore [reportAttributeAccessIssue]
885
+ pass
886
+ else:
887
+ if TYPEGUARD_MAJOR_VERSION == 3:
888
+ typeguard.config.collection_check_strategy = typeguard.CollectionCheckStrategy.ALL_ITEMS # type:ignore
889
+ typeguard.check_type(value=value, expected_type=expected_type) # type:ignore
890
+ else:
891
+ typeguard.check_type(value=value, expected_type=expected_type, collection_check_strategy=typeguard.CollectionCheckStrategy.ALL_ITEMS) # type:ignore
773
892
 
774
893
  from .._jsii import *
775
894
 
@@ -1560,24 +1679,55 @@ class BucketPolicy(
1560
1679
  policy if one doesn't exist yet, otherwise it will add to the existing
1561
1680
  policy.
1562
1681
 
1563
- Prefer to use ``addToResourcePolicy()`` instead.
1682
+ The bucket policy method is implemented differently than ``addToResourcePolicy()``
1683
+ as ``BucketPolicy()`` creates a new policy without knowing one earlier existed.
1684
+ e.g. if during Bucket creation, if ``autoDeleteObject:true``, these policies are
1685
+ added to the bucket policy:
1686
+ ["s3:DeleteObject*", "s3:GetBucket*", "s3:List*", "s3:PutBucketPolicy"],
1687
+ and when you add a new BucketPolicy with ["s3:GetObject", "s3:ListBucket"] on
1688
+ this existing bucket, invoking ``BucketPolicy()`` will create a new Policy
1689
+ without knowing one earlier exists already, so it creates a new one.
1690
+ In this case, the custom resource handler will not have access to
1691
+ ``s3:GetBucketTagging`` action which will cause failure during deletion of stack.
1564
1692
 
1565
- :exampleMetadata: fixture=_generated
1693
+ Hence its strongly recommended to use ``addToResourcePolicy()`` method to add
1694
+ new permissions to existing policy.
1695
+
1696
+ :exampleMetadata: infused
1566
1697
 
1567
1698
  Example::
1568
1699
 
1569
- # The code below shows an example of how to instantiate this type.
1570
- # The values are placeholders you should change.
1571
- import aws_cdk as cdk
1572
- from aws_cdk import aws_s3 as s3
1700
+ bucket_name = "my-favorite-bucket-name"
1701
+ access_logs_bucket = s3.Bucket(self, "AccessLogsBucket",
1702
+ object_ownership=s3.ObjectOwnership.BUCKET_OWNER_ENFORCED,
1703
+ bucket_name=bucket_name
1704
+ )
1573
1705
 
1574
- # bucket: s3.Bucket
1706
+ bucket_policy = s3.CfnBucketPolicy(self, "BucketPolicy",
1707
+ bucket=bucket_name,
1708
+ policy_document={
1709
+ "Statement": [{
1710
+ "Action": "s3:*",
1711
+ "Effect": "Deny",
1712
+ "Principal": {
1713
+ "AWS": "*"
1714
+ },
1715
+ "Resource": [access_logs_bucket.bucket_arn, f"{accessLogsBucket.bucketArn}/*"
1716
+ ]
1717
+ }
1718
+ ],
1719
+ "Version": "2012-10-17"
1720
+ }
1721
+ )
1575
1722
 
1576
- bucket_policy = s3.BucketPolicy(self, "MyBucketPolicy",
1577
- bucket=bucket,
1723
+ # Wrap L1 Construct with L2 Bucket Policy Construct. Subsequent
1724
+ # generated bucket policy to allow access log delivery would append
1725
+ # to the current policy.
1726
+ s3.BucketPolicy.from_cfn_bucket_policy(bucket_policy)
1578
1727
 
1579
- # the properties below are optional
1580
- removal_policy=cdk.RemovalPolicy.DESTROY
1728
+ bucket = s3.Bucket(self, "MyBucket",
1729
+ server_access_logs_bucket=access_logs_bucket,
1730
+ server_access_logs_prefix="logs"
1581
1731
  )
1582
1732
  '''
1583
1733
 
@@ -3646,7 +3796,7 @@ class CfnAccessPoint(
3646
3796
  :param block_public_acls: Specifies whether Amazon S3 should block public access control lists (ACLs) for this bucket and objects in this bucket. Setting this element to ``TRUE`` causes the following behavior: - PUT Bucket ACL and PUT Object ACL calls fail if the specified ACL is public. - PUT Object calls fail if the request includes a public ACL. - PUT Bucket calls fail if the request includes a public ACL. Enabling this setting doesn't affect existing policies or ACLs.
3647
3797
  :param block_public_policy: Specifies whether Amazon S3 should block public bucket policies for this bucket. Setting this element to ``TRUE`` causes Amazon S3 to reject calls to PUT Bucket policy if the specified bucket policy allows public access. Enabling this setting doesn't affect existing bucket policies.
3648
3798
  :param ignore_public_acls: Specifies whether Amazon S3 should ignore public ACLs for this bucket and objects in this bucket. Setting this element to ``TRUE`` causes Amazon S3 to ignore all public ACLs on this bucket and objects in this bucket. Enabling this setting doesn't affect the persistence of any existing ACLs and doesn't prevent new public ACLs from being set.
3649
- :param restrict_public_buckets: Specifies whether Amazon S3 should restrict public bucket policies for this bucket. Setting this element to ``TRUE`` restricts access to this bucket to only AWS-service principals and authorized users within this account if the bucket has a public policy. Enabling this setting doesn't affect previously stored bucket policies, except that public and cross-account access within any public bucket policy, including non-public delegation to specific accounts, is blocked.
3799
+ :param restrict_public_buckets: Specifies whether Amazon S3 should restrict public bucket policies for this bucket. Setting this element to ``TRUE`` restricts access to this bucket to only AWS service principals and authorized users within this account if the bucket has a public policy. Enabling this setting doesn't affect previously stored bucket policies, except that public and cross-account access within any public bucket policy, including non-public delegation to specific accounts, is blocked.
3650
3800
 
3651
3801
  :see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-s3-accesspoint-publicaccessblockconfiguration.html
3652
3802
  :exampleMetadata: fixture=_generated
@@ -3735,7 +3885,7 @@ class CfnAccessPoint(
3735
3885
  ) -> typing.Optional[typing.Union[builtins.bool, _IResolvable_da3f097b]]:
3736
3886
  '''Specifies whether Amazon S3 should restrict public bucket policies for this bucket.
3737
3887
 
3738
- Setting this element to ``TRUE`` restricts access to this bucket to only AWS-service principals and authorized users within this account if the bucket has a public policy.
3888
+ Setting this element to ``TRUE`` restricts access to this bucket to only AWS service principals and authorized users within this account if the bucket has a public policy.
3739
3889
 
3740
3890
  Enabling this setting doesn't affect previously stored bucket policies, except that public and cross-account access within any public bucket policy, including non-public delegation to specific accounts, is blocked.
3741
3891
 
@@ -7250,7 +7400,7 @@ class CfnBucket(
7250
7400
  :param block_public_acls: Specifies whether Amazon S3 should block public access control lists (ACLs) for this bucket and objects in this bucket. Setting this element to ``TRUE`` causes the following behavior: - PUT Bucket ACL and PUT Object ACL calls fail if the specified ACL is public. - PUT Object calls fail if the request includes a public ACL. - PUT Bucket calls fail if the request includes a public ACL. Enabling this setting doesn't affect existing policies or ACLs.
7251
7401
  :param block_public_policy: Specifies whether Amazon S3 should block public bucket policies for this bucket. Setting this element to ``TRUE`` causes Amazon S3 to reject calls to PUT Bucket policy if the specified bucket policy allows public access. Enabling this setting doesn't affect existing bucket policies.
7252
7402
  :param ignore_public_acls: Specifies whether Amazon S3 should ignore public ACLs for this bucket and objects in this bucket. Setting this element to ``TRUE`` causes Amazon S3 to ignore all public ACLs on this bucket and objects in this bucket. Enabling this setting doesn't affect the persistence of any existing ACLs and doesn't prevent new public ACLs from being set.
7253
- :param restrict_public_buckets: Specifies whether Amazon S3 should restrict public bucket policies for this bucket. Setting this element to ``TRUE`` restricts access to this bucket to only AWS-service principals and authorized users within this account if the bucket has a public policy. Enabling this setting doesn't affect previously stored bucket policies, except that public and cross-account access within any public bucket policy, including non-public delegation to specific accounts, is blocked.
7403
+ :param restrict_public_buckets: Specifies whether Amazon S3 should restrict public bucket policies for this bucket. Setting this element to ``TRUE`` restricts access to this bucket to only AWS service principals and authorized users within this account if the bucket has a public policy. Enabling this setting doesn't affect previously stored bucket policies, except that public and cross-account access within any public bucket policy, including non-public delegation to specific accounts, is blocked.
7254
7404
 
7255
7405
  :see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-s3-bucket-publicaccessblockconfiguration.html
7256
7406
  :exampleMetadata: fixture=_generated
@@ -7339,7 +7489,7 @@ class CfnBucket(
7339
7489
  ) -> typing.Optional[typing.Union[builtins.bool, _IResolvable_da3f097b]]:
7340
7490
  '''Specifies whether Amazon S3 should restrict public bucket policies for this bucket.
7341
7491
 
7342
- Setting this element to ``TRUE`` restricts access to this bucket to only AWS-service principals and authorized users within this account if the bucket has a public policy.
7492
+ Setting this element to ``TRUE`` restricts access to this bucket to only AWS service principals and authorized users within this account if the bucket has a public policy.
7343
7493
 
7344
7494
  Enabling this setting doesn't affect previously stored bucket policies, except that public and cross-account access within any public bucket policy, including non-public delegation to specific accounts, is blocked.
7345
7495
 
@@ -10285,19 +10435,39 @@ class CfnBucketPolicy(
10285
10435
 
10286
10436
  :see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-s3-bucketpolicy.html
10287
10437
  :cloudformationResource: AWS::S3::BucketPolicy
10288
- :exampleMetadata: fixture=_generated
10438
+ :exampleMetadata: infused
10289
10439
 
10290
10440
  Example::
10291
10441
 
10292
- # The code below shows an example of how to instantiate this type.
10293
- # The values are placeholders you should change.
10294
- from aws_cdk import aws_s3 as s3
10442
+ bucket_name = "my-favorite-bucket-name"
10443
+ access_logs_bucket = s3.Bucket(self, "AccessLogsBucket",
10444
+ object_ownership=s3.ObjectOwnership.BUCKET_OWNER_ENFORCED,
10445
+ bucket_name=bucket_name
10446
+ )
10295
10447
 
10296
- # policy_document: Any
10448
+ # Creating a bucket policy using L1
10449
+ bucket_policy = s3.CfnBucketPolicy(self, "BucketPolicy",
10450
+ bucket=bucket_name,
10451
+ policy_document={
10452
+ "Statement": [{
10453
+ "Action": "s3:*",
10454
+ "Effect": "Deny",
10455
+ "Principal": {
10456
+ "AWS": "*"
10457
+ },
10458
+ "Resource": [access_logs_bucket.bucket_arn, f"{accessLogsBucket.bucketArn}/*"
10459
+ ]
10460
+ }
10461
+ ],
10462
+ "Version": "2012-10-17"
10463
+ }
10464
+ )
10297
10465
 
10298
- cfn_bucket_policy = s3.CfnBucketPolicy(self, "MyCfnBucketPolicy",
10299
- bucket="bucket",
10300
- policy_document=policy_document
10466
+ # 'serverAccessLogsBucket' will create a new L2 bucket policy
10467
+ # to allow log delivery and overwrite the L1 bucket policy.
10468
+ bucket = s3.Bucket(self, "MyBucket",
10469
+ server_access_logs_bucket=access_logs_bucket,
10470
+ server_access_logs_prefix="logs"
10301
10471
  )
10302
10472
  '''
10303
10473
 
@@ -10398,19 +10568,39 @@ class CfnBucketPolicyProps:
10398
10568
  :param policy_document: A policy document containing permissions to add to the specified bucket. In IAM, you must provide policy documents in JSON format. However, in CloudFormation you can provide the policy in JSON or YAML format because CloudFormation converts YAML to JSON before submitting it to IAM. For more information, see the AWS::IAM::Policy `PolicyDocument <https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-iam-policy.html#cfn-iam-policy-policydocument>`_ resource description in this guide and `Access Policy Language Overview <https://docs.aws.amazon.com/AmazonS3/latest/dev/access-policy-language-overview.html>`_ in the *Amazon S3 User Guide* .
10399
10569
 
10400
10570
  :see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-s3-bucketpolicy.html
10401
- :exampleMetadata: fixture=_generated
10571
+ :exampleMetadata: infused
10402
10572
 
10403
10573
  Example::
10404
10574
 
10405
- # The code below shows an example of how to instantiate this type.
10406
- # The values are placeholders you should change.
10407
- from aws_cdk import aws_s3 as s3
10575
+ bucket_name = "my-favorite-bucket-name"
10576
+ access_logs_bucket = s3.Bucket(self, "AccessLogsBucket",
10577
+ object_ownership=s3.ObjectOwnership.BUCKET_OWNER_ENFORCED,
10578
+ bucket_name=bucket_name
10579
+ )
10408
10580
 
10409
- # policy_document: Any
10581
+ # Creating a bucket policy using L1
10582
+ bucket_policy = s3.CfnBucketPolicy(self, "BucketPolicy",
10583
+ bucket=bucket_name,
10584
+ policy_document={
10585
+ "Statement": [{
10586
+ "Action": "s3:*",
10587
+ "Effect": "Deny",
10588
+ "Principal": {
10589
+ "AWS": "*"
10590
+ },
10591
+ "Resource": [access_logs_bucket.bucket_arn, f"{accessLogsBucket.bucketArn}/*"
10592
+ ]
10593
+ }
10594
+ ],
10595
+ "Version": "2012-10-17"
10596
+ }
10597
+ )
10410
10598
 
10411
- cfn_bucket_policy_props = s3.CfnBucketPolicyProps(
10412
- bucket="bucket",
10413
- policy_document=policy_document
10599
+ # 'serverAccessLogsBucket' will create a new L2 bucket policy
10600
+ # to allow log delivery and overwrite the L1 bucket policy.
10601
+ bucket = s3.Bucket(self, "MyBucket",
10602
+ server_access_logs_bucket=access_logs_bucket,
10603
+ server_access_logs_prefix="logs"
10414
10604
  )
10415
10605
  '''
10416
10606
  if __debug__:
@@ -11081,7 +11271,7 @@ class CfnMultiRegionAccessPoint(
11081
11271
  :param block_public_acls: Specifies whether Amazon S3 should block public access control lists (ACLs) for this bucket and objects in this bucket. Setting this element to ``TRUE`` causes the following behavior: - PUT Bucket ACL and PUT Object ACL calls fail if the specified ACL is public. - PUT Object calls fail if the request includes a public ACL. - PUT Bucket calls fail if the request includes a public ACL. Enabling this setting doesn't affect existing policies or ACLs.
11082
11272
  :param block_public_policy: Specifies whether Amazon S3 should block public bucket policies for this bucket. Setting this element to ``TRUE`` causes Amazon S3 to reject calls to PUT Bucket policy if the specified bucket policy allows public access. Enabling this setting doesn't affect existing bucket policies.
11083
11273
  :param ignore_public_acls: Specifies whether Amazon S3 should ignore public ACLs for this bucket and objects in this bucket. Setting this element to ``TRUE`` causes Amazon S3 to ignore all public ACLs on this bucket and objects in this bucket. Enabling this setting doesn't affect the persistence of any existing ACLs and doesn't prevent new public ACLs from being set.
11084
- :param restrict_public_buckets: Specifies whether Amazon S3 should restrict public bucket policies for this bucket. Setting this element to ``TRUE`` restricts access to this bucket to only AWS-service principals and authorized users within this account if the bucket has a public policy. Enabling this setting doesn't affect previously stored bucket policies, except that public and cross-account access within any public bucket policy, including non-public delegation to specific accounts, is blocked.
11274
+ :param restrict_public_buckets: Specifies whether Amazon S3 should restrict public bucket policies for this bucket. Setting this element to ``TRUE`` restricts access to this bucket to only AWS service principals and authorized users within this account if the bucket has a public policy. Enabling this setting doesn't affect previously stored bucket policies, except that public and cross-account access within any public bucket policy, including non-public delegation to specific accounts, is blocked.
11085
11275
 
11086
11276
  :see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-s3-multiregionaccesspoint-publicaccessblockconfiguration.html
11087
11277
  :exampleMetadata: fixture=_generated
@@ -11170,7 +11360,7 @@ class CfnMultiRegionAccessPoint(
11170
11360
  ) -> typing.Optional[typing.Union[builtins.bool, _IResolvable_da3f097b]]:
11171
11361
  '''Specifies whether Amazon S3 should restrict public bucket policies for this bucket.
11172
11362
 
11173
- Setting this element to ``TRUE`` restricts access to this bucket to only AWS-service principals and authorized users within this account if the bucket has a public policy.
11363
+ Setting this element to ``TRUE`` restricts access to this bucket to only AWS service principals and authorized users within this account if the bucket has a public policy.
11174
11364
 
11175
11365
  Enabling this setting doesn't affect previously stored bucket policies, except that public and cross-account access within any public bucket policy, including non-public delegation to specific accounts, is blocked.
11176
11366
 
@@ -17447,6 +17637,13 @@ class ObjectOwnership(enum.Enum):
17447
17637
  object_ownership=s3.ObjectOwnership.BUCKET_OWNER_ENFORCED
17448
17638
  )
17449
17639
 
17640
+ access_logs_bucket.add_to_resource_policy(
17641
+ iam.PolicyStatement(
17642
+ actions=["s3:*"],
17643
+ resources=[access_logs_bucket.bucket_arn, access_logs_bucket.arn_for_objects("*")],
17644
+ principals=[iam.AnyPrincipal()]
17645
+ ))
17646
+
17450
17647
  bucket = s3.Bucket(self, "MyBucket",
17451
17648
  server_access_logs_bucket=access_logs_bucket,
17452
17649
  server_access_logs_prefix="logs"
@@ -227,7 +227,22 @@ import jsii
227
227
  import publication
228
228
  import typing_extensions
229
229
 
230
- from typeguard import check_type
230
+ import typeguard
231
+ from importlib.metadata import version as _metadata_package_version
232
+ TYPEGUARD_MAJOR_VERSION = int(_metadata_package_version('typeguard').split('.')[0])
233
+
234
+ def check_type(argname: str, value: object, expected_type: typing.Any) -> typing.Any:
235
+ if TYPEGUARD_MAJOR_VERSION <= 2:
236
+ return typeguard.check_type(argname=argname, value=value, expected_type=expected_type) # type:ignore
237
+ else:
238
+ if isinstance(value, jsii._reference_map.InterfaceDynamicProxy): # pyright: ignore [reportAttributeAccessIssue]
239
+ pass
240
+ else:
241
+ if TYPEGUARD_MAJOR_VERSION == 3:
242
+ typeguard.config.collection_check_strategy = typeguard.CollectionCheckStrategy.ALL_ITEMS # type:ignore
243
+ typeguard.check_type(value=value, expected_type=expected_type) # type:ignore
244
+ else:
245
+ typeguard.check_type(value=value, expected_type=expected_type, collection_check_strategy=typeguard.CollectionCheckStrategy.ALL_ITEMS) # type:ignore
231
246
 
232
247
  from .._jsii import *
233
248
 
@@ -524,7 +524,22 @@ import jsii
524
524
  import publication
525
525
  import typing_extensions
526
526
 
527
- from typeguard import check_type
527
+ import typeguard
528
+ from importlib.metadata import version as _metadata_package_version
529
+ TYPEGUARD_MAJOR_VERSION = int(_metadata_package_version('typeguard').split('.')[0])
530
+
531
+ def check_type(argname: str, value: object, expected_type: typing.Any) -> typing.Any:
532
+ if TYPEGUARD_MAJOR_VERSION <= 2:
533
+ return typeguard.check_type(argname=argname, value=value, expected_type=expected_type) # type:ignore
534
+ else:
535
+ if isinstance(value, jsii._reference_map.InterfaceDynamicProxy): # pyright: ignore [reportAttributeAccessIssue]
536
+ pass
537
+ else:
538
+ if TYPEGUARD_MAJOR_VERSION == 3:
539
+ typeguard.config.collection_check_strategy = typeguard.CollectionCheckStrategy.ALL_ITEMS # type:ignore
540
+ typeguard.check_type(value=value, expected_type=expected_type) # type:ignore
541
+ else:
542
+ typeguard.check_type(value=value, expected_type=expected_type, collection_check_strategy=typeguard.CollectionCheckStrategy.ALL_ITEMS) # type:ignore
528
543
 
529
544
  from .._jsii import *
530
545