Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(apigateway): cannot create an ApiKey with an imported RestApi #22368

Merged
merged 4 commits into from Oct 11, 2022

Conversation

corymhall
Copy link
Contributor

@corymhall corymhall commented Oct 5, 2022

The current implementation of ApiKey is a little confusing. It takes a resources property which expects a list of IRestApis. An ApiKey is not associated with a RestApi by itself though, it needs to be associated with a specific Stage on the RestApi. When you import a RestApi you cannot import it with a Stage and even if you could provide an IStage I don't think that makes the most sense (you can have multiple stages).

Instead, this PR deprecates the resources prop and adds a new stages prop which expects a list of IStages. To facilitate this I have also done a couple of other things

  • Added the ability to import a Stage using Stage.fromStageAttributes().
  • Added an addApiKey method to IStage.
  • Added additional error handling if the user does try to create an ApiKey with an imported RestApi.

fixes #22102


All Submissions:

Adding new Unconventional Dependencies:

  • This PR adds new unconventional dependencies following the process described here

New Features

  • Have you added the new feature to an integration test?
    • Did you use yarn integ to deploy the infrastructure and generate the snapshot (i.e. yarn integ without --dry-run)?

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license

The current implementation of `ApiKey` is a little confusing. It takes a
`resources` property which expects a list of `IRestApi`s. An ApiKey is
not associated with a RestApi by itself though, it needs to be
associated with a specific `Stage` on the RestApi. When you import a
RestApi you cannot import it with a `Stage` and even if you could
provide an `IStage` I don't think that makes the most sense (you can
have multiple stages).

Instead, this PR deprecates the `resources` prop and adds a new `stages`
prop which expects a list of `IStage`s. To facilitate this I have also
done a couple of other things

- Added the ability to import a Stage using
  `Stage.fromStageAttributes()`.
- Added an `addApiKey` method to `IStage`.
- Added additional error handling if the user does try to create an
  ApiKey with an imported RestApi.

fixes #22102
@gitpod-io
Copy link

gitpod-io bot commented Oct 5, 2022

@mergify mergify bot added the contribution/core This is a PR that came from AWS. label Oct 5, 2022
@corymhall corymhall requested a review from a team October 5, 2022 19:42
@mergify
Copy link
Contributor

mergify bot commented Oct 11, 2022

Thank you for contributing! Your pull request will be updated from main and then merged automatically (do not update manually, and be sure to allow changes to be pushed to your fork).

@aws-cdk-automation
Copy link
Collaborator

AWS CodeBuild CI Report

  • CodeBuild project: AutoBuildv2Project1C6BFA3F-wQm2hXv2jqQv
  • Commit ID: a39db91
  • Result: SUCCEEDED
  • Build Logs (available for 30 days)

Powered by github-codebuild-logs, available on the AWS Serverless Application Repository

@mergify
Copy link
Contributor

mergify bot commented Oct 11, 2022

Thank you for contributing! Your pull request will be updated from main and then merged automatically (do not update manually, and be sure to allow changes to be pushed to your fork).

@mergify mergify bot merged commit 83c4123 into aws:main Oct 11, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
contribution/core This is a PR that came from AWS.
Projects
None yet
3 participants