-
Notifications
You must be signed in to change notification settings - Fork 3.8k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(apigateway): define Resources on imported RestApi (#8270)
The apigateway CDK construct library creates a large number of CloudFormation resources. To define a single Method that is backed with a Lambda function and authorizer with an Authorizer, ~8 CloudFormation resources are created. This quickly grows and a reasonable sized RestApi is bound to hit the 200 resource limit on their stack. Re-organizing the CDK app into multiple `Stack`s that share the same instance of `RestApi` will not resolve this problem, since the CDK still makes an executive decision to keep the Methods and Resources in the same stack as the `RestApi` construct. (see #7391) This change introduces a new import style API `fromRestApiAttributes()` that returns an instance of `IRestApi` that allows for new Resources to be defined across stacks. As a nice side effect, this change also adds the ability to define Resources on SpecRestApi in addition to what has already been defined in the OpenAPI spec. closes #1477 closes #7391 fixes #8347 ---- *By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license*
- Loading branch information
Niranjan Jayakar
committed
Jun 12, 2020
1 parent
d21231f
commit 21a1de3
Showing
14 changed files
with
906 additions
and
74 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
21a1de3
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It works but only with MockIntegration. When I try to use LambdaIntegration(lambdaFn) the following error is thrown:
RestApi is not available on Resource not connected to an instance of RestApi. Use
api
insteadLambdaIntegration function is using method.restApi intrinsically, hence the error. Workarounds?