aws-cdk-lib 2.173.4__py3-none-any.whl → 2.174.1__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.
- aws_cdk/__init__.py +210 -181
- aws_cdk/_jsii/__init__.py +1 -1
- aws_cdk/_jsii/{aws-cdk-lib@2.173.4.jsii.tgz → aws-cdk-lib@2.174.1.jsii.tgz} +0 -0
- aws_cdk/aws_amazonmq/__init__.py +18 -0
- aws_cdk/aws_apigateway/__init__.py +127 -168
- aws_cdk/aws_appconfig/__init__.py +498 -1
- aws_cdk/aws_applicationautoscaling/__init__.py +4 -1
- aws_cdk/aws_appsync/__init__.py +4 -0
- aws_cdk/aws_autoscaling/__init__.py +96 -0
- aws_cdk/aws_batch/__init__.py +662 -237
- aws_cdk/aws_bedrock/__init__.py +2122 -181
- aws_cdk/aws_cassandra/__init__.py +476 -4
- aws_cdk/aws_cleanrooms/__init__.py +1227 -20
- aws_cdk/aws_cloudformation/__init__.py +172 -169
- aws_cdk/aws_cloudfront/__init__.py +773 -26
- aws_cdk/aws_cloudtrail/__init__.py +8 -2
- aws_cdk/aws_codebuild/__init__.py +83 -0
- aws_cdk/aws_codepipeline/__init__.py +2 -1
- aws_cdk/aws_cognito/__init__.py +232 -200
- aws_cdk/aws_connect/__init__.py +187 -36
- aws_cdk/aws_connectcampaignsv2/__init__.py +106 -12
- aws_cdk/aws_databrew/__init__.py +69 -1
- aws_cdk/aws_datasync/__init__.py +33 -28
- aws_cdk/aws_datazone/__init__.py +141 -41
- aws_cdk/aws_dlm/__init__.py +20 -10
- aws_cdk/aws_dms/__init__.py +736 -22
- aws_cdk/aws_docdb/__init__.py +134 -0
- aws_cdk/aws_dynamodb/__init__.py +76 -4
- aws_cdk/aws_ec2/__init__.py +1233 -65
- aws_cdk/aws_ecr/__init__.py +31 -0
- aws_cdk/aws_ecr_assets/__init__.py +5 -0
- aws_cdk/aws_ecs/__init__.py +88 -11
- aws_cdk/aws_efs/__init__.py +15 -8
- aws_cdk/aws_eks/__init__.py +114 -45
- aws_cdk/aws_elasticloadbalancingv2/__init__.py +2 -2
- aws_cdk/aws_emrserverless/__init__.py +143 -0
- aws_cdk/aws_events/__init__.py +50 -30
- aws_cdk/aws_fis/__init__.py +33 -33
- aws_cdk/aws_fsx/__init__.py +20 -10
- aws_cdk/aws_glue/__init__.py +34 -11
- aws_cdk/aws_greengrass/__init__.py +8 -8
- aws_cdk/aws_guardduty/__init__.py +1 -1
- aws_cdk/aws_imagebuilder/__init__.py +45 -47
- aws_cdk/aws_internetmonitor/__init__.py +3 -3
- aws_cdk/aws_invoicing/__init__.py +55 -30
- aws_cdk/aws_iot/__init__.py +1117 -4
- aws_cdk/aws_iot1click/__init__.py +17 -7
- aws_cdk/aws_kendra/__init__.py +4 -6
- aws_cdk/aws_lambda/__init__.py +15 -1
- aws_cdk/aws_logs/__init__.py +4011 -86
- aws_cdk/aws_m2/__init__.py +41 -0
- aws_cdk/aws_mediaconnect/__init__.py +202 -7
- aws_cdk/aws_mediaconvert/__init__.py +39 -0
- aws_cdk/aws_memorydb/__init__.py +22 -22
- aws_cdk/aws_networkmanager/__init__.py +758 -0
- aws_cdk/aws_opensearchservice/__init__.py +222 -0
- aws_cdk/aws_organizations/__init__.py +5 -3
- aws_cdk/aws_pcs/__init__.py +3038 -0
- aws_cdk/aws_pipes/__init__.py +10 -10
- aws_cdk/aws_qbusiness/__init__.py +415 -140
- aws_cdk/aws_quicksight/__init__.py +59795 -49748
- aws_cdk/aws_ram/__init__.py +5 -11
- aws_cdk/aws_rbin/__init__.py +28 -16
- aws_cdk/aws_rds/__init__.py +186 -31
- aws_cdk/aws_redshiftserverless/__init__.py +156 -0
- aws_cdk/aws_resiliencehub/__init__.py +2 -1
- aws_cdk/aws_route53_targets/__init__.py +5 -5
- aws_cdk/aws_s3/__init__.py +25 -15
- aws_cdk/aws_s3express/__init__.py +7 -7
- aws_cdk/aws_s3tables/__init__.py +683 -0
- aws_cdk/aws_sagemaker/__init__.py +580 -195
- aws_cdk/aws_secretsmanager/__init__.py +2 -0
- aws_cdk/aws_securityhub/__init__.py +41 -165
- aws_cdk/aws_servicediscovery/__init__.py +10 -3
- aws_cdk/aws_ses/__init__.py +190 -5
- aws_cdk/aws_sns/__init__.py +7 -3
- aws_cdk/aws_synthetics/__init__.py +29 -4
- aws_cdk/aws_transfer/__init__.py +8 -0
- aws_cdk/aws_vpclattice/__init__.py +147 -77
- aws_cdk/aws_wafv2/__init__.py +20 -8
- aws_cdk/aws_wisdom/__init__.py +162 -111
- aws_cdk/aws_workspaces/__init__.py +10 -4
- aws_cdk/cloud_assembly_schema/__init__.py +22 -0
- aws_cdk/custom_resources/__init__.py +31 -0
- aws_cdk/cx_api/__init__.py +19 -0
- {aws_cdk_lib-2.173.4.dist-info → aws_cdk_lib-2.174.1.dist-info}/LICENSE +1 -1
- {aws_cdk_lib-2.173.4.dist-info → aws_cdk_lib-2.174.1.dist-info}/METADATA +2 -2
- {aws_cdk_lib-2.173.4.dist-info → aws_cdk_lib-2.174.1.dist-info}/NOTICE +1 -1
- {aws_cdk_lib-2.173.4.dist-info → aws_cdk_lib-2.174.1.dist-info}/RECORD +91 -89
- {aws_cdk_lib-2.173.4.dist-info → aws_cdk_lib-2.174.1.dist-info}/WHEEL +0 -0
- {aws_cdk_lib-2.173.4.dist-info → aws_cdk_lib-2.174.1.dist-info}/top_level.txt +0 -0
aws_cdk/_jsii/__init__.py
CHANGED
|
@@ -35,7 +35,7 @@ import aws_cdk.cloud_assembly_schema._jsii
|
|
|
35
35
|
import constructs._jsii
|
|
36
36
|
|
|
37
37
|
__jsii_assembly__ = jsii.JSIIAssembly.load(
|
|
38
|
-
"aws-cdk-lib", "2.
|
|
38
|
+
"aws-cdk-lib", "2.174.1", __name__[0:-6], "aws-cdk-lib@2.174.1.jsii.tgz"
|
|
39
39
|
)
|
|
40
40
|
|
|
41
41
|
__all__ = [
|
|
Binary file
|
aws_cdk/aws_amazonmq/__init__.py
CHANGED
|
@@ -122,6 +122,7 @@ class CfnBroker(
|
|
|
122
122
|
# the properties below are optional
|
|
123
123
|
console_access=False,
|
|
124
124
|
groups=["groups"],
|
|
125
|
+
jolokia_api_access="jolokiaApiAccess",
|
|
125
126
|
replication_user=False
|
|
126
127
|
)],
|
|
127
128
|
|
|
@@ -1358,6 +1359,7 @@ class CfnBroker(
|
|
|
1358
1359
|
"username": "username",
|
|
1359
1360
|
"console_access": "consoleAccess",
|
|
1360
1361
|
"groups": "groups",
|
|
1362
|
+
"jolokia_api_access": "jolokiaApiAccess",
|
|
1361
1363
|
"replication_user": "replicationUser",
|
|
1362
1364
|
},
|
|
1363
1365
|
)
|
|
@@ -1369,6 +1371,7 @@ class CfnBroker(
|
|
|
1369
1371
|
username: builtins.str,
|
|
1370
1372
|
console_access: typing.Optional[typing.Union[builtins.bool, _IResolvable_da3f097b]] = None,
|
|
1371
1373
|
groups: typing.Optional[typing.Sequence[builtins.str]] = None,
|
|
1374
|
+
jolokia_api_access: typing.Optional[builtins.str] = None,
|
|
1372
1375
|
replication_user: typing.Optional[typing.Union[builtins.bool, _IResolvable_da3f097b]] = None,
|
|
1373
1376
|
) -> None:
|
|
1374
1377
|
'''The list of broker users (persons or applications) who can access queues and topics.
|
|
@@ -1379,6 +1382,7 @@ class CfnBroker(
|
|
|
1379
1382
|
:param username: The username of the broker user. For Amazon MQ for ActiveMQ brokers, this value can contain only alphanumeric characters, dashes, periods, underscores, and tildes (- . _ ~). For Amazon MQ for RabbitMQ brokers, this value can contain only alphanumeric characters, dashes, periods, underscores (- . _). This value must not contain a tilde (~) character. Amazon MQ prohibts using guest as a valid usename. This value must be 2-100 characters long. .. epigraph:: Do not add personally identifiable information (PII) or other confidential or sensitive information in broker usernames. Broker usernames are accessible to other AWS services, including CloudWatch Logs . Broker usernames are not intended to be used for private or sensitive data.
|
|
1380
1383
|
:param console_access: Enables access to the ActiveMQ web console for the ActiveMQ user. Does not apply to RabbitMQ brokers.
|
|
1381
1384
|
:param groups: The list of groups (20 maximum) to which the ActiveMQ user belongs. This value can contain only alphanumeric characters, dashes, periods, underscores, and tildes (- . _ ~). This value must be 2-100 characters long. Does not apply to RabbitMQ brokers.
|
|
1385
|
+
:param jolokia_api_access:
|
|
1382
1386
|
:param replication_user: Defines if this user is intended for CRDR replication purposes.
|
|
1383
1387
|
|
|
1384
1388
|
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-amazonmq-broker-user.html
|
|
@@ -1397,6 +1401,7 @@ class CfnBroker(
|
|
|
1397
1401
|
# the properties below are optional
|
|
1398
1402
|
console_access=False,
|
|
1399
1403
|
groups=["groups"],
|
|
1404
|
+
jolokia_api_access="jolokiaApiAccess",
|
|
1400
1405
|
replication_user=False
|
|
1401
1406
|
)
|
|
1402
1407
|
'''
|
|
@@ -1406,6 +1411,7 @@ class CfnBroker(
|
|
|
1406
1411
|
check_type(argname="argument username", value=username, expected_type=type_hints["username"])
|
|
1407
1412
|
check_type(argname="argument console_access", value=console_access, expected_type=type_hints["console_access"])
|
|
1408
1413
|
check_type(argname="argument groups", value=groups, expected_type=type_hints["groups"])
|
|
1414
|
+
check_type(argname="argument jolokia_api_access", value=jolokia_api_access, expected_type=type_hints["jolokia_api_access"])
|
|
1409
1415
|
check_type(argname="argument replication_user", value=replication_user, expected_type=type_hints["replication_user"])
|
|
1410
1416
|
self._values: typing.Dict[builtins.str, typing.Any] = {
|
|
1411
1417
|
"password": password,
|
|
@@ -1415,6 +1421,8 @@ class CfnBroker(
|
|
|
1415
1421
|
self._values["console_access"] = console_access
|
|
1416
1422
|
if groups is not None:
|
|
1417
1423
|
self._values["groups"] = groups
|
|
1424
|
+
if jolokia_api_access is not None:
|
|
1425
|
+
self._values["jolokia_api_access"] = jolokia_api_access
|
|
1418
1426
|
if replication_user is not None:
|
|
1419
1427
|
self._values["replication_user"] = replication_user
|
|
1420
1428
|
|
|
@@ -1469,6 +1477,14 @@ class CfnBroker(
|
|
|
1469
1477
|
result = self._values.get("groups")
|
|
1470
1478
|
return typing.cast(typing.Optional[typing.List[builtins.str]], result)
|
|
1471
1479
|
|
|
1480
|
+
@builtins.property
|
|
1481
|
+
def jolokia_api_access(self) -> typing.Optional[builtins.str]:
|
|
1482
|
+
'''
|
|
1483
|
+
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-amazonmq-broker-user.html#cfn-amazonmq-broker-user-jolokiaapiaccess
|
|
1484
|
+
'''
|
|
1485
|
+
result = self._values.get("jolokia_api_access")
|
|
1486
|
+
return typing.cast(typing.Optional[builtins.str], result)
|
|
1487
|
+
|
|
1472
1488
|
@builtins.property
|
|
1473
1489
|
def replication_user(
|
|
1474
1490
|
self,
|
|
@@ -1588,6 +1604,7 @@ class CfnBrokerProps:
|
|
|
1588
1604
|
# the properties below are optional
|
|
1589
1605
|
console_access=False,
|
|
1590
1606
|
groups=["groups"],
|
|
1607
|
+
jolokia_api_access="jolokiaApiAccess",
|
|
1591
1608
|
replication_user=False
|
|
1592
1609
|
)],
|
|
1593
1610
|
|
|
@@ -2938,6 +2955,7 @@ def _typecheckingstub__8a458786a0cd0d4269adef0bf3c85862386851ab69649004d5d3dcba4
|
|
|
2938
2955
|
username: builtins.str,
|
|
2939
2956
|
console_access: typing.Optional[typing.Union[builtins.bool, _IResolvable_da3f097b]] = None,
|
|
2940
2957
|
groups: typing.Optional[typing.Sequence[builtins.str]] = None,
|
|
2958
|
+
jolokia_api_access: typing.Optional[builtins.str] = None,
|
|
2941
2959
|
replication_user: typing.Optional[typing.Union[builtins.bool, _IResolvable_da3f097b]] = None,
|
|
2942
2960
|
) -> None:
|
|
2943
2961
|
"""Type checking stubs"""
|
|
@@ -13,10 +13,10 @@ running on AWS Lambda, or any web application.
|
|
|
13
13
|
|
|
14
14
|
* [Table of Contents](#table-of-contents)
|
|
15
15
|
* [Defining APIs](#defining-apis)
|
|
16
|
-
* [AWS Lambda-backed APIs](#aws-lambda-backed-apis)
|
|
17
|
-
* [AWS StepFunctions backed APIs](#aws-stepfunctions-backed-apis)
|
|
18
16
|
|
|
19
17
|
* [Breaking up Methods and Resources across Stacks](#breaking-up-methods-and-resources-across-stacks)
|
|
18
|
+
* [AWS Lambda-backed APIs](#aws-lambda-backed-apis)
|
|
19
|
+
* [AWS StepFunctions backed APIs](#aws-stepfunctions-backed-apis)
|
|
20
20
|
* [Integration Targets](#integration-targets)
|
|
21
21
|
* [Usage Plan & API Keys](#usage-plan--api-keys)
|
|
22
22
|
|
|
@@ -84,6 +84,131 @@ method = api.root.add_resource("books").add_method("GET")
|
|
|
84
84
|
method.grant_execute(user)
|
|
85
85
|
```
|
|
86
86
|
|
|
87
|
+
### Breaking up Methods and Resources across Stacks
|
|
88
|
+
|
|
89
|
+
It is fairly common for REST APIs with a large number of Resources and Methods to hit the [CloudFormation
|
|
90
|
+
limit](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/cloudformation-limits.html) of 500 resources per
|
|
91
|
+
stack.
|
|
92
|
+
|
|
93
|
+
To help with this, Resources and Methods for the same REST API can be re-organized across multiple stacks. A common
|
|
94
|
+
way to do this is to have a stack per Resource or groups of Resources, but this is not the only possible way.
|
|
95
|
+
The following example uses sets up two Resources '/pets' and '/books' in separate stacks using nested stacks:
|
|
96
|
+
|
|
97
|
+
```python
|
|
98
|
+
from aws_cdk.aws_apigateway import IntegrationResponse, MethodResponse, IntegrationResponse, MethodResponse
|
|
99
|
+
from constructs import Construct
|
|
100
|
+
from aws_cdk import App, CfnOutput, NestedStack, NestedStackProps, Stack
|
|
101
|
+
from aws_cdk.aws_apigateway import Deployment, Method, MockIntegration, PassthroughBehavior, RestApi, Stage
|
|
102
|
+
|
|
103
|
+
#
|
|
104
|
+
# This file showcases how to split up a RestApi's Resources and Methods across nested stacks.
|
|
105
|
+
#
|
|
106
|
+
# The root stack 'RootStack' first defines a RestApi.
|
|
107
|
+
# Two nested stacks BooksStack and PetsStack, create corresponding Resources '/books' and '/pets'.
|
|
108
|
+
# They are then deployed to a 'prod' Stage via a third nested stack - DeployStack.
|
|
109
|
+
#
|
|
110
|
+
# To verify this worked, go to the APIGateway
|
|
111
|
+
#
|
|
112
|
+
|
|
113
|
+
class RootStack(Stack):
|
|
114
|
+
def __init__(self, scope):
|
|
115
|
+
super().__init__(scope, "integ-restapi-import-RootStack")
|
|
116
|
+
|
|
117
|
+
rest_api = RestApi(self, "RestApi",
|
|
118
|
+
cloud_watch_role=True,
|
|
119
|
+
deploy=False
|
|
120
|
+
)
|
|
121
|
+
rest_api.root.add_method("ANY")
|
|
122
|
+
|
|
123
|
+
pets_stack = PetsStack(self,
|
|
124
|
+
rest_api_id=rest_api.rest_api_id,
|
|
125
|
+
root_resource_id=rest_api.rest_api_root_resource_id
|
|
126
|
+
)
|
|
127
|
+
books_stack = BooksStack(self,
|
|
128
|
+
rest_api_id=rest_api.rest_api_id,
|
|
129
|
+
root_resource_id=rest_api.rest_api_root_resource_id
|
|
130
|
+
)
|
|
131
|
+
DeployStack(self,
|
|
132
|
+
rest_api_id=rest_api.rest_api_id,
|
|
133
|
+
methods=pets_stack.methods.concat(books_stack.methods)
|
|
134
|
+
)
|
|
135
|
+
|
|
136
|
+
CfnOutput(self, "PetsURL",
|
|
137
|
+
value=f"https://{restApi.restApiId}.execute-api.{this.region}.amazonaws.com/prod/pets"
|
|
138
|
+
)
|
|
139
|
+
|
|
140
|
+
CfnOutput(self, "BooksURL",
|
|
141
|
+
value=f"https://{restApi.restApiId}.execute-api.{this.region}.amazonaws.com/prod/books"
|
|
142
|
+
)
|
|
143
|
+
|
|
144
|
+
class PetsStack(NestedStack):
|
|
145
|
+
|
|
146
|
+
def __init__(self, scope, *, restApiId, rootResourceId, parameters=None, timeout=None, notificationArns=None, removalPolicy=None, description=None):
|
|
147
|
+
super().__init__(scope, "integ-restapi-import-PetsStack", restApiId=restApiId, rootResourceId=rootResourceId, parameters=parameters, timeout=timeout, notificationArns=notificationArns, removalPolicy=removalPolicy, description=description)
|
|
148
|
+
|
|
149
|
+
api = RestApi.from_rest_api_attributes(self, "RestApi",
|
|
150
|
+
rest_api_id=rest_api_id,
|
|
151
|
+
root_resource_id=root_resource_id
|
|
152
|
+
)
|
|
153
|
+
|
|
154
|
+
method = api.root.add_resource("pets").add_method("GET", MockIntegration(
|
|
155
|
+
integration_responses=[IntegrationResponse(
|
|
156
|
+
status_code="200"
|
|
157
|
+
)],
|
|
158
|
+
passthrough_behavior=PassthroughBehavior.NEVER,
|
|
159
|
+
request_templates={
|
|
160
|
+
"application/json": "{ \"statusCode\": 200 }"
|
|
161
|
+
}
|
|
162
|
+
),
|
|
163
|
+
method_responses=[MethodResponse(status_code="200")]
|
|
164
|
+
)
|
|
165
|
+
|
|
166
|
+
self.methods.push(method)
|
|
167
|
+
|
|
168
|
+
class BooksStack(NestedStack):
|
|
169
|
+
|
|
170
|
+
def __init__(self, scope, *, restApiId, rootResourceId, parameters=None, timeout=None, notificationArns=None, removalPolicy=None, description=None):
|
|
171
|
+
super().__init__(scope, "integ-restapi-import-BooksStack", restApiId=restApiId, rootResourceId=rootResourceId, parameters=parameters, timeout=timeout, notificationArns=notificationArns, removalPolicy=removalPolicy, description=description)
|
|
172
|
+
|
|
173
|
+
api = RestApi.from_rest_api_attributes(self, "RestApi",
|
|
174
|
+
rest_api_id=rest_api_id,
|
|
175
|
+
root_resource_id=root_resource_id
|
|
176
|
+
)
|
|
177
|
+
|
|
178
|
+
method = api.root.add_resource("books").add_method("GET", MockIntegration(
|
|
179
|
+
integration_responses=[IntegrationResponse(
|
|
180
|
+
status_code="200"
|
|
181
|
+
)],
|
|
182
|
+
passthrough_behavior=PassthroughBehavior.NEVER,
|
|
183
|
+
request_templates={
|
|
184
|
+
"application/json": "{ \"statusCode\": 200 }"
|
|
185
|
+
}
|
|
186
|
+
),
|
|
187
|
+
method_responses=[MethodResponse(status_code="200")]
|
|
188
|
+
)
|
|
189
|
+
|
|
190
|
+
self.methods.push(method)
|
|
191
|
+
|
|
192
|
+
class DeployStack(NestedStack):
|
|
193
|
+
def __init__(self, scope, *, restApiId, methods=None, parameters=None, timeout=None, notificationArns=None, removalPolicy=None, description=None):
|
|
194
|
+
super().__init__(scope, "integ-restapi-import-DeployStack", restApiId=restApiId, methods=methods, parameters=parameters, timeout=timeout, notificationArns=notificationArns, removalPolicy=removalPolicy, description=description)
|
|
195
|
+
|
|
196
|
+
deployment = Deployment(self, "Deployment",
|
|
197
|
+
api=RestApi.from_rest_api_id(self, "RestApi", rest_api_id)
|
|
198
|
+
)
|
|
199
|
+
if methods:
|
|
200
|
+
for method in methods:
|
|
201
|
+
deployment.node.add_dependency(method)
|
|
202
|
+
Stage(self, "Stage", deployment=deployment)
|
|
203
|
+
|
|
204
|
+
RootStack(App())
|
|
205
|
+
```
|
|
206
|
+
|
|
207
|
+
> **Warning:** In the code above, an API Gateway deployment is created during the initial CDK deployment.
|
|
208
|
+
> However, if there are changes to the resources in subsequent CDK deployments, a new API Gateway deployment is not
|
|
209
|
+
> automatically created. As a result, the latest state of the resources is not reflected. To ensure the latest state
|
|
210
|
+
> of the resources is reflected, a manual deployment of the API Gateway is required after the CDK deployment. See [Controlled triggering of deployments](#controlled-triggering-of-deployments) for more info.
|
|
211
|
+
|
|
87
212
|
## AWS Lambda-backed APIs
|
|
88
213
|
|
|
89
214
|
A very common practice is to use Amazon API Gateway with AWS Lambda as the
|
|
@@ -267,131 +392,6 @@ AWS Step Functions will receive the following execution input:
|
|
|
267
392
|
}
|
|
268
393
|
```
|
|
269
394
|
|
|
270
|
-
### Breaking up Methods and Resources across Stacks
|
|
271
|
-
|
|
272
|
-
It is fairly common for REST APIs with a large number of Resources and Methods to hit the [CloudFormation
|
|
273
|
-
limit](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/cloudformation-limits.html) of 500 resources per
|
|
274
|
-
stack.
|
|
275
|
-
|
|
276
|
-
To help with this, Resources and Methods for the same REST API can be re-organized across multiple stacks. A common
|
|
277
|
-
way to do this is to have a stack per Resource or groups of Resources, but this is not the only possible way.
|
|
278
|
-
The following example uses sets up two Resources '/pets' and '/books' in separate stacks using nested stacks:
|
|
279
|
-
|
|
280
|
-
```python
|
|
281
|
-
from aws_cdk.aws_apigateway import IntegrationResponse, MethodResponse, IntegrationResponse, MethodResponse
|
|
282
|
-
from constructs import Construct
|
|
283
|
-
from aws_cdk import App, CfnOutput, NestedStack, NestedStackProps, Stack
|
|
284
|
-
from aws_cdk.aws_apigateway import Deployment, Method, MockIntegration, PassthroughBehavior, RestApi, Stage
|
|
285
|
-
|
|
286
|
-
#
|
|
287
|
-
# This file showcases how to split up a RestApi's Resources and Methods across nested stacks.
|
|
288
|
-
#
|
|
289
|
-
# The root stack 'RootStack' first defines a RestApi.
|
|
290
|
-
# Two nested stacks BooksStack and PetsStack, create corresponding Resources '/books' and '/pets'.
|
|
291
|
-
# They are then deployed to a 'prod' Stage via a third nested stack - DeployStack.
|
|
292
|
-
#
|
|
293
|
-
# To verify this worked, go to the APIGateway
|
|
294
|
-
#
|
|
295
|
-
|
|
296
|
-
class RootStack(Stack):
|
|
297
|
-
def __init__(self, scope):
|
|
298
|
-
super().__init__(scope, "integ-restapi-import-RootStack")
|
|
299
|
-
|
|
300
|
-
rest_api = RestApi(self, "RestApi",
|
|
301
|
-
cloud_watch_role=True,
|
|
302
|
-
deploy=False
|
|
303
|
-
)
|
|
304
|
-
rest_api.root.add_method("ANY")
|
|
305
|
-
|
|
306
|
-
pets_stack = PetsStack(self,
|
|
307
|
-
rest_api_id=rest_api.rest_api_id,
|
|
308
|
-
root_resource_id=rest_api.rest_api_root_resource_id
|
|
309
|
-
)
|
|
310
|
-
books_stack = BooksStack(self,
|
|
311
|
-
rest_api_id=rest_api.rest_api_id,
|
|
312
|
-
root_resource_id=rest_api.rest_api_root_resource_id
|
|
313
|
-
)
|
|
314
|
-
DeployStack(self,
|
|
315
|
-
rest_api_id=rest_api.rest_api_id,
|
|
316
|
-
methods=pets_stack.methods.concat(books_stack.methods)
|
|
317
|
-
)
|
|
318
|
-
|
|
319
|
-
CfnOutput(self, "PetsURL",
|
|
320
|
-
value=f"https://{restApi.restApiId}.execute-api.{this.region}.amazonaws.com/prod/pets"
|
|
321
|
-
)
|
|
322
|
-
|
|
323
|
-
CfnOutput(self, "BooksURL",
|
|
324
|
-
value=f"https://{restApi.restApiId}.execute-api.{this.region}.amazonaws.com/prod/books"
|
|
325
|
-
)
|
|
326
|
-
|
|
327
|
-
class PetsStack(NestedStack):
|
|
328
|
-
|
|
329
|
-
def __init__(self, scope, *, restApiId, rootResourceId, parameters=None, timeout=None, notificationArns=None, removalPolicy=None, description=None):
|
|
330
|
-
super().__init__(scope, "integ-restapi-import-PetsStack", restApiId=restApiId, rootResourceId=rootResourceId, parameters=parameters, timeout=timeout, notificationArns=notificationArns, removalPolicy=removalPolicy, description=description)
|
|
331
|
-
|
|
332
|
-
api = RestApi.from_rest_api_attributes(self, "RestApi",
|
|
333
|
-
rest_api_id=rest_api_id,
|
|
334
|
-
root_resource_id=root_resource_id
|
|
335
|
-
)
|
|
336
|
-
|
|
337
|
-
method = api.root.add_resource("pets").add_method("GET", MockIntegration(
|
|
338
|
-
integration_responses=[IntegrationResponse(
|
|
339
|
-
status_code="200"
|
|
340
|
-
)],
|
|
341
|
-
passthrough_behavior=PassthroughBehavior.NEVER,
|
|
342
|
-
request_templates={
|
|
343
|
-
"application/json": "{ \"statusCode\": 200 }"
|
|
344
|
-
}
|
|
345
|
-
),
|
|
346
|
-
method_responses=[MethodResponse(status_code="200")]
|
|
347
|
-
)
|
|
348
|
-
|
|
349
|
-
self.methods.push(method)
|
|
350
|
-
|
|
351
|
-
class BooksStack(NestedStack):
|
|
352
|
-
|
|
353
|
-
def __init__(self, scope, *, restApiId, rootResourceId, parameters=None, timeout=None, notificationArns=None, removalPolicy=None, description=None):
|
|
354
|
-
super().__init__(scope, "integ-restapi-import-BooksStack", restApiId=restApiId, rootResourceId=rootResourceId, parameters=parameters, timeout=timeout, notificationArns=notificationArns, removalPolicy=removalPolicy, description=description)
|
|
355
|
-
|
|
356
|
-
api = RestApi.from_rest_api_attributes(self, "RestApi",
|
|
357
|
-
rest_api_id=rest_api_id,
|
|
358
|
-
root_resource_id=root_resource_id
|
|
359
|
-
)
|
|
360
|
-
|
|
361
|
-
method = api.root.add_resource("books").add_method("GET", MockIntegration(
|
|
362
|
-
integration_responses=[IntegrationResponse(
|
|
363
|
-
status_code="200"
|
|
364
|
-
)],
|
|
365
|
-
passthrough_behavior=PassthroughBehavior.NEVER,
|
|
366
|
-
request_templates={
|
|
367
|
-
"application/json": "{ \"statusCode\": 200 }"
|
|
368
|
-
}
|
|
369
|
-
),
|
|
370
|
-
method_responses=[MethodResponse(status_code="200")]
|
|
371
|
-
)
|
|
372
|
-
|
|
373
|
-
self.methods.push(method)
|
|
374
|
-
|
|
375
|
-
class DeployStack(NestedStack):
|
|
376
|
-
def __init__(self, scope, *, restApiId, methods=None, parameters=None, timeout=None, notificationArns=None, removalPolicy=None, description=None):
|
|
377
|
-
super().__init__(scope, "integ-restapi-import-DeployStack", restApiId=restApiId, methods=methods, parameters=parameters, timeout=timeout, notificationArns=notificationArns, removalPolicy=removalPolicy, description=description)
|
|
378
|
-
|
|
379
|
-
deployment = Deployment(self, "Deployment",
|
|
380
|
-
api=RestApi.from_rest_api_id(self, "RestApi", rest_api_id)
|
|
381
|
-
)
|
|
382
|
-
if methods:
|
|
383
|
-
for method in methods:
|
|
384
|
-
deployment.node.add_dependency(method)
|
|
385
|
-
Stage(self, "Stage", deployment=deployment)
|
|
386
|
-
|
|
387
|
-
RootStack(App())
|
|
388
|
-
```
|
|
389
|
-
|
|
390
|
-
> **Warning:** In the code above, an API Gateway deployment is created during the initial CDK deployment.
|
|
391
|
-
> However, if there are changes to the resources in subsequent CDK deployments, a new API Gateway deployment is not
|
|
392
|
-
> automatically created. As a result, the latest state of the resources is not reflected. To ensure the latest state
|
|
393
|
-
> of the resources is reflected, a manual deployment of the API Gateway is required after the CDK deployment. See [Controlled triggering of deployments](#controlled-triggering-of-deployments) for more info.
|
|
394
|
-
|
|
395
395
|
## Integration Targets
|
|
396
396
|
|
|
397
397
|
Methods are associated with backend integrations, which are invoked when this
|
|
@@ -8588,7 +8588,6 @@ class CfnDomainNameV2(
|
|
|
8588
8588
|
# The values are placeholders you should change.
|
|
8589
8589
|
from aws_cdk import aws_apigateway as apigateway
|
|
8590
8590
|
|
|
8591
|
-
# management_policy: Any
|
|
8592
8591
|
# policy: Any
|
|
8593
8592
|
|
|
8594
8593
|
cfn_domain_name_v2 = apigateway.CfnDomainNameV2(self, "MyCfnDomainNameV2",
|
|
@@ -8597,7 +8596,6 @@ class CfnDomainNameV2(
|
|
|
8597
8596
|
endpoint_configuration=apigateway.CfnDomainNameV2.EndpointConfigurationProperty(
|
|
8598
8597
|
types=["types"]
|
|
8599
8598
|
),
|
|
8600
|
-
management_policy=management_policy,
|
|
8601
8599
|
policy=policy,
|
|
8602
8600
|
security_policy="securityPolicy",
|
|
8603
8601
|
tags=[CfnTag(
|
|
@@ -8615,7 +8613,6 @@ class CfnDomainNameV2(
|
|
|
8615
8613
|
certificate_arn: typing.Optional[builtins.str] = None,
|
|
8616
8614
|
domain_name: typing.Optional[builtins.str] = None,
|
|
8617
8615
|
endpoint_configuration: typing.Optional[typing.Union[_IResolvable_da3f097b, typing.Union["CfnDomainNameV2.EndpointConfigurationProperty", typing.Dict[builtins.str, typing.Any]]]] = None,
|
|
8618
|
-
management_policy: typing.Any = None,
|
|
8619
8616
|
policy: typing.Any = None,
|
|
8620
8617
|
security_policy: typing.Optional[builtins.str] = None,
|
|
8621
8618
|
tags: typing.Optional[typing.Sequence[typing.Union[_CfnTag_f6864754, typing.Dict[builtins.str, typing.Any]]]] = None,
|
|
@@ -8626,7 +8623,6 @@ class CfnDomainNameV2(
|
|
|
8626
8623
|
:param certificate_arn: The reference to an AWS -managed certificate that will be used by the private endpoint for this domain name. AWS Certificate Manager is the only supported source.
|
|
8627
8624
|
:param domain_name: Represents a custom domain name as a user-friendly host name of an API (RestApi).
|
|
8628
8625
|
:param endpoint_configuration: The endpoint configuration to indicate the types of endpoints an API (RestApi) or its custom domain name (DomainName) has.
|
|
8629
|
-
:param management_policy:
|
|
8630
8626
|
:param policy: A stringified JSON policy document that applies to the ``execute-api`` service for this DomainName regardless of the caller and Method configuration. You can use ``Fn::ToJsonString`` to enter your ``policy`` . For more information, see `Fn::ToJsonString <https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/intrinsic-function-reference-ToJsonString.html>`_ .
|
|
8631
8627
|
:param security_policy: The Transport Layer Security (TLS) version + cipher suite for this DomainName. Only ``TLS_1_2`` is supported.
|
|
8632
8628
|
:param tags: The collection of tags. Each tag element is associated with a given resource.
|
|
@@ -8639,7 +8635,6 @@ class CfnDomainNameV2(
|
|
|
8639
8635
|
certificate_arn=certificate_arn,
|
|
8640
8636
|
domain_name=domain_name,
|
|
8641
8637
|
endpoint_configuration=endpoint_configuration,
|
|
8642
|
-
management_policy=management_policy,
|
|
8643
8638
|
policy=policy,
|
|
8644
8639
|
security_policy=security_policy,
|
|
8645
8640
|
tags=tags,
|
|
@@ -8750,18 +8745,6 @@ class CfnDomainNameV2(
|
|
|
8750
8745
|
check_type(argname="argument value", value=value, expected_type=type_hints["value"])
|
|
8751
8746
|
jsii.set(self, "endpointConfiguration", value) # pyright: ignore[reportArgumentType]
|
|
8752
8747
|
|
|
8753
|
-
@builtins.property
|
|
8754
|
-
@jsii.member(jsii_name="managementPolicy")
|
|
8755
|
-
def management_policy(self) -> typing.Any:
|
|
8756
|
-
return typing.cast(typing.Any, jsii.get(self, "managementPolicy"))
|
|
8757
|
-
|
|
8758
|
-
@management_policy.setter
|
|
8759
|
-
def management_policy(self, value: typing.Any) -> None:
|
|
8760
|
-
if __debug__:
|
|
8761
|
-
type_hints = typing.get_type_hints(_typecheckingstub__8b6d7f1f638d8720556c9e4d7598ad47d45db07dc328a664195267638644608c)
|
|
8762
|
-
check_type(argname="argument value", value=value, expected_type=type_hints["value"])
|
|
8763
|
-
jsii.set(self, "managementPolicy", value) # pyright: ignore[reportArgumentType]
|
|
8764
|
-
|
|
8765
8748
|
@builtins.property
|
|
8766
8749
|
@jsii.member(jsii_name="policy")
|
|
8767
8750
|
def policy(self) -> typing.Any:
|
|
@@ -8866,7 +8849,6 @@ class CfnDomainNameV2(
|
|
|
8866
8849
|
"certificate_arn": "certificateArn",
|
|
8867
8850
|
"domain_name": "domainName",
|
|
8868
8851
|
"endpoint_configuration": "endpointConfiguration",
|
|
8869
|
-
"management_policy": "managementPolicy",
|
|
8870
8852
|
"policy": "policy",
|
|
8871
8853
|
"security_policy": "securityPolicy",
|
|
8872
8854
|
"tags": "tags",
|
|
@@ -8879,7 +8861,6 @@ class CfnDomainNameV2Props:
|
|
|
8879
8861
|
certificate_arn: typing.Optional[builtins.str] = None,
|
|
8880
8862
|
domain_name: typing.Optional[builtins.str] = None,
|
|
8881
8863
|
endpoint_configuration: typing.Optional[typing.Union[_IResolvable_da3f097b, typing.Union[CfnDomainNameV2.EndpointConfigurationProperty, typing.Dict[builtins.str, typing.Any]]]] = None,
|
|
8882
|
-
management_policy: typing.Any = None,
|
|
8883
8864
|
policy: typing.Any = None,
|
|
8884
8865
|
security_policy: typing.Optional[builtins.str] = None,
|
|
8885
8866
|
tags: typing.Optional[typing.Sequence[typing.Union[_CfnTag_f6864754, typing.Dict[builtins.str, typing.Any]]]] = None,
|
|
@@ -8889,7 +8870,6 @@ class CfnDomainNameV2Props:
|
|
|
8889
8870
|
:param certificate_arn: The reference to an AWS -managed certificate that will be used by the private endpoint for this domain name. AWS Certificate Manager is the only supported source.
|
|
8890
8871
|
:param domain_name: Represents a custom domain name as a user-friendly host name of an API (RestApi).
|
|
8891
8872
|
:param endpoint_configuration: The endpoint configuration to indicate the types of endpoints an API (RestApi) or its custom domain name (DomainName) has.
|
|
8892
|
-
:param management_policy:
|
|
8893
8873
|
:param policy: A stringified JSON policy document that applies to the ``execute-api`` service for this DomainName regardless of the caller and Method configuration. You can use ``Fn::ToJsonString`` to enter your ``policy`` . For more information, see `Fn::ToJsonString <https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/intrinsic-function-reference-ToJsonString.html>`_ .
|
|
8894
8874
|
:param security_policy: The Transport Layer Security (TLS) version + cipher suite for this DomainName. Only ``TLS_1_2`` is supported.
|
|
8895
8875
|
:param tags: The collection of tags. Each tag element is associated with a given resource.
|
|
@@ -8903,7 +8883,6 @@ class CfnDomainNameV2Props:
|
|
|
8903
8883
|
# The values are placeholders you should change.
|
|
8904
8884
|
from aws_cdk import aws_apigateway as apigateway
|
|
8905
8885
|
|
|
8906
|
-
# management_policy: Any
|
|
8907
8886
|
# policy: Any
|
|
8908
8887
|
|
|
8909
8888
|
cfn_domain_name_v2_props = apigateway.CfnDomainNameV2Props(
|
|
@@ -8912,7 +8891,6 @@ class CfnDomainNameV2Props:
|
|
|
8912
8891
|
endpoint_configuration=apigateway.CfnDomainNameV2.EndpointConfigurationProperty(
|
|
8913
8892
|
types=["types"]
|
|
8914
8893
|
),
|
|
8915
|
-
management_policy=management_policy,
|
|
8916
8894
|
policy=policy,
|
|
8917
8895
|
security_policy="securityPolicy",
|
|
8918
8896
|
tags=[CfnTag(
|
|
@@ -8926,7 +8904,6 @@ class CfnDomainNameV2Props:
|
|
|
8926
8904
|
check_type(argname="argument certificate_arn", value=certificate_arn, expected_type=type_hints["certificate_arn"])
|
|
8927
8905
|
check_type(argname="argument domain_name", value=domain_name, expected_type=type_hints["domain_name"])
|
|
8928
8906
|
check_type(argname="argument endpoint_configuration", value=endpoint_configuration, expected_type=type_hints["endpoint_configuration"])
|
|
8929
|
-
check_type(argname="argument management_policy", value=management_policy, expected_type=type_hints["management_policy"])
|
|
8930
8907
|
check_type(argname="argument policy", value=policy, expected_type=type_hints["policy"])
|
|
8931
8908
|
check_type(argname="argument security_policy", value=security_policy, expected_type=type_hints["security_policy"])
|
|
8932
8909
|
check_type(argname="argument tags", value=tags, expected_type=type_hints["tags"])
|
|
@@ -8937,8 +8914,6 @@ class CfnDomainNameV2Props:
|
|
|
8937
8914
|
self._values["domain_name"] = domain_name
|
|
8938
8915
|
if endpoint_configuration is not None:
|
|
8939
8916
|
self._values["endpoint_configuration"] = endpoint_configuration
|
|
8940
|
-
if management_policy is not None:
|
|
8941
|
-
self._values["management_policy"] = management_policy
|
|
8942
8917
|
if policy is not None:
|
|
8943
8918
|
self._values["policy"] = policy
|
|
8944
8919
|
if security_policy is not None:
|
|
@@ -8977,14 +8952,6 @@ class CfnDomainNameV2Props:
|
|
|
8977
8952
|
result = self._values.get("endpoint_configuration")
|
|
8978
8953
|
return typing.cast(typing.Optional[typing.Union[_IResolvable_da3f097b, CfnDomainNameV2.EndpointConfigurationProperty]], result)
|
|
8979
8954
|
|
|
8980
|
-
@builtins.property
|
|
8981
|
-
def management_policy(self) -> typing.Any:
|
|
8982
|
-
'''
|
|
8983
|
-
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-apigateway-domainnamev2.html#cfn-apigateway-domainnamev2-managementpolicy
|
|
8984
|
-
'''
|
|
8985
|
-
result = self._values.get("management_policy")
|
|
8986
|
-
return typing.cast(typing.Any, result)
|
|
8987
|
-
|
|
8988
8955
|
@builtins.property
|
|
8989
8956
|
def policy(self) -> typing.Any:
|
|
8990
8957
|
'''A stringified JSON policy document that applies to the ``execute-api`` service for this DomainName regardless of the caller and Method configuration.
|
|
@@ -33963,7 +33930,6 @@ def _typecheckingstub__a4f501d10d57d39a48913872efdcb7d389a076fed9b5aabb21034b8e6
|
|
|
33963
33930
|
certificate_arn: typing.Optional[builtins.str] = None,
|
|
33964
33931
|
domain_name: typing.Optional[builtins.str] = None,
|
|
33965
33932
|
endpoint_configuration: typing.Optional[typing.Union[_IResolvable_da3f097b, typing.Union[CfnDomainNameV2.EndpointConfigurationProperty, typing.Dict[builtins.str, typing.Any]]]] = None,
|
|
33966
|
-
management_policy: typing.Any = None,
|
|
33967
33933
|
policy: typing.Any = None,
|
|
33968
33934
|
security_policy: typing.Optional[builtins.str] = None,
|
|
33969
33935
|
tags: typing.Optional[typing.Sequence[typing.Union[_CfnTag_f6864754, typing.Dict[builtins.str, typing.Any]]]] = None,
|
|
@@ -34001,12 +33967,6 @@ def _typecheckingstub__a1f648b520c9d40bb72a9028880e48540125da8ba68522e25c483400d
|
|
|
34001
33967
|
"""Type checking stubs"""
|
|
34002
33968
|
pass
|
|
34003
33969
|
|
|
34004
|
-
def _typecheckingstub__8b6d7f1f638d8720556c9e4d7598ad47d45db07dc328a664195267638644608c(
|
|
34005
|
-
value: typing.Any,
|
|
34006
|
-
) -> None:
|
|
34007
|
-
"""Type checking stubs"""
|
|
34008
|
-
pass
|
|
34009
|
-
|
|
34010
33970
|
def _typecheckingstub__a0c6989179a94e32b700994895064456ee57af9eb39330638ade9b7801085b38(
|
|
34011
33971
|
value: typing.Any,
|
|
34012
33972
|
) -> None:
|
|
@@ -34037,7 +33997,6 @@ def _typecheckingstub__dfb97b3f8aa373f21ebe15318ceaaf08a4d4b4b31e9ba1ed8fb04ef59
|
|
|
34037
33997
|
certificate_arn: typing.Optional[builtins.str] = None,
|
|
34038
33998
|
domain_name: typing.Optional[builtins.str] = None,
|
|
34039
33999
|
endpoint_configuration: typing.Optional[typing.Union[_IResolvable_da3f097b, typing.Union[CfnDomainNameV2.EndpointConfigurationProperty, typing.Dict[builtins.str, typing.Any]]]] = None,
|
|
34040
|
-
management_policy: typing.Any = None,
|
|
34041
34000
|
policy: typing.Any = None,
|
|
34042
34001
|
security_policy: typing.Optional[builtins.str] = None,
|
|
34043
34002
|
tags: typing.Optional[typing.Sequence[typing.Union[_CfnTag_f6864754, typing.Dict[builtins.str, typing.Any]]]] = None,
|