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

feat: aws resource api linting (breaking changes) #1434

Merged
merged 29 commits into from
Dec 28, 2018
Merged

Conversation

eladb
Copy link
Contributor

@eladb eladb commented Dec 26, 2018

Fixes #742
Built on top of #1428

BREAKING CHANGE: AWS resource-related classes have been changed to conform to API guidelines:

  • XxxRef abstract classes are now IXxx interfaces
  • XxxRefProps are now XxxImportProps
  • XxxRef.import(...) are now Xxx.import(...) accept XxxImportProps and return IXxx
  • export(): XxxImportProps is now defined in IXxx and implemented by imported resources
  • Lambda's static "metric" methods moved from lambda.FunctionRef to lambda.Function.
  • Route53 record classes now require a zone when created (not assuming zone is the parent construct).

Pull Request Checklist

  • Testing
    • Unit test added
    • CLI change?: manually run integration tests and paste output as a PR comment
    • cdk-init template change?: coordinated update of integration tests with team
  • Docs
    • jsdocs: All public APIs documented
    • README: README and/or documentation topic updated
  • Title and Description
    • Change type: title prefixed with fix, feat will appear in changelog
    • Title: use lower-case and doesn't end with a period
    • Breaking?: last paragraph: "BREAKING CHANGE: <describe what changed + link for details>"
    • Issues: Indicate issues fixed via: "Fixes #xxx" or "Closes #xxx"
  • Sensitive Modules (requires 2 PR approvers)
    • IAM Policy Document (in @aws-cdk/aws-iam)
    • EC2 Security Groups and ACLs (in @aws-cdk/aws-ec2)
    • Grant APIs (only if not based on official documentation with a reference)

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

Elad Ben-Israel added 6 commits December 25, 2018 12:42
Normalize the import/export APIs for all AWS resources:

* `IXxx`: an interface that contains all properties and methods that are
  common to both internal and imported resources.
* `XxxAttributes`: includes the set of attributes that represent
  the resource (used to be `XxxRefProps`).
* `XxxBase` (optional): abstract base class which implements `IXxx` and
  contains implementations that can be reused between internal and 
  imported resources.
examples/cdk-examples-typescript/advanced-usage/index.ts Outdated Show resolved Hide resolved
package.json Outdated Show resolved Hide resolved
@rix0rrr
Copy link
Contributor

rix0rrr commented Dec 27, 2018

XxxRefProps interfaces renamed to XxxAttributes.

I find BucketProps vs BucketAttributes somewhat inscrutable. ImportedBucketProps? BucketImportProps?

Implement export in ImportedXxx by simply proxying the passed-in attributes

Not sure that export() needs to be possible on an imported object. I realize that it is possible today, but not sure it's something we need to maintain. We'd need to put export() on IBucket as well to make use of it.

Create XxxBase when appropriate

This can't be private, huh?

@eladb
Copy link
Contributor Author

eladb commented Dec 27, 2018

I find BucketProps vs BucketAttributes somewhat inscrutable. ImportedBucketProps? BucketImportProps?

I agree that XxxAttributes is not perfect. I think it should begin with Bucket so it will be grouped together with the rest of the resource classes, and I feel XxxxImportProps is just too long and ugly. How about just BucketImport?

Not sure that export() needs to be possible on an imported object. I realize that it is possible today, but not sure it's something we need to maintain.

I think export() is relevant for imported resources. If you have an IBucket in your hands and want to export it so it can be used by other apps/stacks, you don't want to care if it's an internal or external resource.

Create XxxBase when appropriate
This can't be private, huh?

Sadly not. We could come up with some other convoluted way to reuse, but I think this is fine.

@eladb eladb merged commit 8c17ca7 into master Dec 28, 2018
@eladb eladb deleted the benisrae/api-linting branch December 28, 2018 06:13
@NGL321 NGL321 added the contribution/core This is a PR that came from AWS. label Sep 23, 2019
@mergify
Copy link
Contributor

mergify bot commented Sep 23, 2019

Thanks so much for taking the time to contribute to the AWS CDK ❤️

We will shortly assign someone to review this pull request and help get it
merged. In the meantime, please take a minute to make sure you follow this
checklist
:

  • PR title type(scope): text
    • type: fix, feat, refactor go into CHANGELOG, chore is hidden
    • scope: name of module without aws- or cdk- prefix or postfix (e.g. s3 instead of aws-s3-deployment)
    • text: use all lower-case, do not end with a period, do not include issue refs
  • PR Description
    • Rationale: describe rationale of change and approach taken
    • Issues: indicate issues fixed via: fixes #xxx or closes #xxx
    • Breaking?: last paragraph: BREAKING CHANGE: <describe what changed + link for details>
  • Testing
    • Unit test added. Prefer to add a new test rather than modify existing tests
    • CLI or init templates change? Re-run/add CLI integration tests
  • Documentation
    • README: update module README to describe new features
    • API docs: public APIs must be documented. Copy from official AWS docs when possible
    • Design: for significant features, follow design process

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.

Ref types should be interfaces (BucketRef -> IBucket)
4 participants