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: rename core classes adding a Cfn prefix #1960

Merged
merged 30 commits into from
Mar 14, 2019

Conversation

skinny85
Copy link
Contributor

@skinny85 skinny85 commented Mar 5, 2019

To better align with our L1 layer that is closely tied to CloudFormation, add the Cfn prefix to classes from the @aws-cdk/cdk package.

BREAKING CHANGE: rename Output to CfnOutput.
BREAKING CHANGE: rename Condition to CfnCondition.
BREAKING CHANGE: rename StackElement to CfnElement.
BREAKING CHANGE: rename Parameter to CfnParameter.
BREAKING CHANGE: rename Resource to CfnResource.

Fixes #1462
Fixes #288


Pull Request Checklist

  • Testing
    • Unit test added (prefer not to modify an existing test, otherwise, it's probably a breaking change)
    • CLI change?: coordinate update of integration tests with team
    • 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.

@skinny85 skinny85 requested review from SoManyHs and a team as code owners March 5, 2019 23:05
@skinny85
Copy link
Contributor Author

skinny85 commented Mar 5, 2019

There's also a bunch of other classes that were not mentioned in the #1462 issue, but perhaps should be renamed as well?

  • Referenceable -> CfnReferenceable ?
  • Include -> CfnInclude ?
  • Rule -> CfnRule ?
  • Mapping -> CfnMapping ?
  • IConditionExpression -> ICfnConditionExpression ?

Let me know should those be included as well.

CHANGELOG.md Outdated Show resolved Hide resolved
tools/awslint/lib/cfn-resources.ts Outdated Show resolved Hide resolved
Copy link
Contributor

@RomainMuller RomainMuller left a comment

Choose a reason for hiding this comment

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

We don't really have L2 surface for most of these things... Are we positive users don't routinely have to interact with those classes?

CfnCondition, CfnElement and CfnResource should 100% be the names though - my concern really is around Output and Parameter there.

@skinny85
Copy link
Contributor Author

skinny85 commented Mar 7, 2019

Addressed the comments.

Copy link
Contributor

@eladb eladb left a comment

Choose a reason for hiding this comment

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

Looks good to me.

Yes, good call about other renames:

  • Rule to CfnRule
  • Mapping to CfnMapping.
  • Referenceable maybe to CfnRefElement (it's a CfnElement that can be Refed).
  • IConditionExpression => ICfnConditionExpression

I wouldn't touch Include for now, if at all, it should be IncludeTemplate or IncludeCfnTemplate.

The "rule of thumb" is that we use the Cfn prefix only with types that represent CloudFormation template entities.

Also, CfnReference should be Reference (it's not only for CloudFormation refs anymore).

And please flatten the file tree while you are wrecking havoc in this library.

@eladb
Copy link
Contributor

eladb commented Mar 11, 2019

@RomainMuller wrote:

my concern really is around Output and Parameter there

I see your point about Output and Parameter, and I was wondering that myself. But then I convinced myself that in both cases, people will use them only if they care about CFN. A "CDK Native" user doesn't need to interact with these classes directly, right?

@skinny85
Copy link
Contributor Author

Yes, good call about other renames:

  • Rule to CfnRule

Done.

  • Mapping to CfnMapping.

Done.

  • Referenceable maybe to CfnRefElement (it's a CfnElement that can be Refed).

Done.

  • IConditionExpression => ICfnConditionExpression

Done.

I wouldn't touch Include for now, if at all, it should be IncludeTemplate or IncludeCfnTemplate.

Left alone.

Also, CfnReference should be Reference (it's not only for CloudFormation refs anymore).

Done.

And please flatten the file tree while you are wrecking havoc in this library.

Done.

@skinny85
Copy link
Contributor Author

Renamed Reference#isReference to isReferenceToken, as I missed that there's already an instance property with the name isReference (that's not legal in Java or C#).

@skinny85
Copy link
Contributor Author

Rebased on top of Sam's changes to the AWS Glue package.

@skinny85 skinny85 merged commit 5886bf6 into aws:master Mar 14, 2019
@skinny85 skinny85 deleted the feature/rename-core-to-cfn branch March 14, 2019 21:25
@fulghum
Copy link
Contributor

fulghum commented Mar 15, 2019

Nice! Thanks for picking this one up @skinny85 !

@skinny85
Copy link
Contributor Author

My pleasure :)

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.

core: prefix all "DOM" (L1) CloudFormation classes with "Cfn" core: Rename StackElement -> CfnElement
6 participants