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

chore: remove an additional "prepare" usage #9428

Merged
merged 9 commits into from
Aug 5, 2020

Conversation

eladb
Copy link
Contributor

@eladb eladb commented Aug 4, 2020

Follow up on #9410 and remove a few additional usages of prepare:

  • In the API Gateway library we leveraged prepare() to record dependencies between all Deployment resources and all Method resources in the APIGW. The solution is to perform two-sided bookkeeping while methods/deployments are defined and record their dependencies in-band. We also refactored the way the code in LatestDeployment to be slightly more readable.
  • In the Pipelines library prepare was replaced with an aspect (which is technically the drop-in alternative to prepare() in v2.0, for lack of a better solution at the moment).
  • In the IAM library, the Policy resource needs to be conditionally created only if the document contains statements. To address that, we added a new protected API to CfnResource which is called shouldSynthesize(). By default it returns true but if it returns false (in a subclass), the resource will not be rendered into the cloudformation template.

Related: aws/aws-cdk-rfcs#192


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

Follow up on #9410 and remove an additional usage of `prepare` in the API Gateway library. In this case we leveraged `prepare()` to record dependencies between all Deployment resources and all Method resources in the APIGW.

The solution is to perform two-sided bookkeeping while methods/deployments are defined and record their dependencies in-band.

We also refactored the way the code in `LatestDeployment` to be slightly more readable.
@eladb eladb requested a review from iliapolo August 4, 2020 15:28
@mergify mergify bot added the contribution/core This is a PR that came from AWS. label Aug 4, 2020
@eladb eladb requested a review from nija-at August 4, 2020 15:30
@eladb eladb changed the title chore: remove an additional "prepare" from apigateway chore: remove an additional "prepare" Aug 4, 2020
@eladb eladb requested a review from rix0rrr August 4, 2020 16:03
@eladb eladb changed the title chore: remove an additional "prepare" chore: remove an additional "prepare" usages Aug 4, 2020
Copy link
Contributor

@iliapolo iliapolo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks ok to me but I think @nija-at should have a look as well.

packages/@aws-cdk/aws-iam/lib/policy.ts Outdated Show resolved Hide resolved
packages/@aws-cdk/aws-iam/lib/policy.ts Show resolved Hide resolved
@eladb
Copy link
Contributor Author

eladb commented Aug 4, 2020

Looks ok to me but I think @nija-at should have a look as well.

Yes, no worries. I contacted him and he'll take a look tomorrow.

@eladb eladb requested a review from iliapolo August 4, 2020 16:14
@nija-at nija-at added the pr/do-not-merge This PR should not be merged at this time. label Aug 5, 2020
@eladb eladb removed the pr/do-not-merge This PR should not be merged at this time. label Aug 5, 2020
@eladb eladb changed the title chore: remove an additional "prepare" usages chore: remove an additional "prepare" usage Aug 5, 2020
@aws-cdk-automation
Copy link
Collaborator

AWS CodeBuild CI Report

  • CodeBuild project: AutoBuildProject6AEA49D1-qxepHUsryhcu
  • Commit ID: a466ea4
  • Result: FAILED
  • 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 Aug 5, 2020

Thank you for contributing! Your pull request will be updated from master 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 53cb749 into master Aug 5, 2020
@mergify mergify bot deleted the benisrae/apigateway-prepare branch August 5, 2020 11:12
eladb pushed a commit that referenced this pull request Aug 10, 2020
Follow up on #9410 and remove a few additional usages of `prepare`:

- In the API Gateway library we leveraged `prepare()` to record dependencies between all Deployment resources and all Method resources in the APIGW. The solution is to perform two-sided bookkeeping while methods/deployments are defined and record their dependencies in-band. We also refactored the way the code in `LatestDeployment` to be slightly more readable.
- In the Pipelines library prepare was replaced with an aspect (which is technically the drop-in alternative to `prepare()` in v2.0, for lack of a better solution at the moment).
- In the IAM library, the `Policy` resource needs to be conditionally created only if the document contains statements. To address that, we added a new protected API to `CfnResource` which is called `shouldSynthesize()`. By default it returns `true` but if it returns `false` (in a subclass), the resource will not be rendered into the cloudformation template.

Related: aws/aws-cdk-rfcs#192

----

*By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license*
curtiseppel pushed a commit to curtiseppel/aws-cdk that referenced this pull request Aug 11, 2020
Follow up on aws#9410 and remove a few additional usages of `prepare`:

- In the API Gateway library we leveraged `prepare()` to record dependencies between all Deployment resources and all Method resources in the APIGW. The solution is to perform two-sided bookkeeping while methods/deployments are defined and record their dependencies in-band. We also refactored the way the code in `LatestDeployment` to be slightly more readable.
- In the Pipelines library prepare was replaced with an aspect (which is technically the drop-in alternative to `prepare()` in v2.0, for lack of a better solution at the moment).
- In the IAM library, the `Policy` resource needs to be conditionally created only if the document contains statements. To address that, we added a new protected API to `CfnResource` which is called `shouldSynthesize()`. By default it returns `true` but if it returns `false` (in a subclass), the resource will not be rendered into the cloudformation template.

Related: aws/aws-cdk-rfcs#192

----

*By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license*
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
Development

Successfully merging this pull request may close these issues.

4 participants