[aws-apigateway] ApiKey is not supported for SpecRestApi #11079
Labels
@aws-cdk/aws-apigateway
Related to Amazon API Gateway
effort/small
Small work item – less than a day of effort
feature-request
A feature should be added or improved.
in-progress
This issue is being actively worked on.
p1
There's an API disparity for
ApiKey
betweenRestApi
andSpecRestApi
constructs:aws-cdk/packages/@aws-cdk/aws-apigateway/lib/api-key.ts
Lines 48 to 54 in 2b474b9
Notice how
resources
is of typeRestApi[]
instead ofIRestApi[]
, making this impossible:Additionally, the convenience method:
aws-cdk/packages/@aws-cdk/aws-apigateway/lib/restapi.ts
Lines 712 to 717 in 2b474b9
Is only available in
RestApi
. It should probably be moved toRestApiBase
soSpecRestApi
can benefit from it as well.Fortunately, this disparity doesn't make it impossible to create/associate an API key to an API:
As a side note,
option 2
from the previous example has an unnecessary requirement to assign a value toapiStages
in order to bind it to the API.I believe this could be improved by changing:
aws-cdk/packages/@aws-cdk/aws-apigateway/lib/restapi.ts
Lines 350 to 352 in 2b474b9
to:
Reproduction Steps
See description above
What did you expect to happen?
RestApi
andSpecRestApi
have API parity for dealing with API keys.RestApiBase.prototype.addUsagePlan()
automatically binds the usage plan to theRestApiBase
instance.What actually happened?
RestApiBase.prototype.addUsagePlan()
does not bind the usage plan to theRestApiBase
instance. It has to be specified in theapiStages
field of theUsagePlanProps
parameter.Environment
1.68.0
1.69.0
12.13.0
10.14.6
typescript@4.0.3
Other
N/A
This is 🐛 Bug Report
The text was updated successfully, but these errors were encountered: