-
Notifications
You must be signed in to change notification settings - Fork 4k
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(core): tags not working for cognito user pools #4225
Conversation
* moved all knowledge about tag names into the schema package and included UserPoolTags as taggable name * refactored codegen to use new schema package to identify tag properties BREAKING CHANGE: * TagManager constructor now takes a property object instead of individual agruments: new TagManager(props: TagManagerProps) instead of new cdk.TagManager(cdk.TagType.STANDARD, resourceType, initialTags); Fixes aws#3882
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
|
UserPoolTags: "", | ||
}; | ||
|
||
export type TagPropertyName = keyof typeof tagPropertyNames; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not sure if there are reasons I can't do this, but it was the cleanest way to check a literal type. I suppose I could go enum?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is JSII complaining about this?
export type TagPropertyName = 'Tags' | 'UserPoolTags';
If that's the case, I can see a slightly cleaner way that doesn't require instantiating an "unused" const:
interface TagProperty {
Tags: never;
UserPoolTags: never;
}
export type TagPropertyName = keyof TagProperty;
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
jsii didn't complain locally -- figured the full suite would tell me.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I meant complaining about my first snippet:
export type TagPropertyName = 'Tags' | 'UserPoolTags';
Sorry if I wasn't clear. And if you don't get errors building the cognito package, you should be good. 👍
AWS CodeBuild CI Report
Powered by github-codebuild-logs, available on the AWS Serverless Application Repository |
is my fail just the breaking change? If so I can revert to avoid the break to one of the options identified above.
|
Breaking changes are checked near the end of the build IIRC, so you should
be good for the rest yes
…On Tue, Sep 24, 2019, 11:52 PM Mike Cowgill ***@***.***> wrote:
is my fail just the breaking change? If so I can revert to avoid the break
to one of the options identified above.
err - INITIALIZER @aws-cdk/core.TagManager.<initializer>: argument tagType, takes @aws-cdk/core.TagManagerProps (formerly @aws-cdk/core.TagType): @aws-cdk/core.TagType is an enum different from @aws-cdk/core.TagManagerProps ***@***.***/core.TagManager.<initializer>]
err - INITIALIZER @aws-cdk/core.TagManager.<initializer>: argument resourceTypeName, not accepted anymore. ***@***.***/core.TagManager.<initializer>]
err - INITIALIZER @aws-cdk/core.TagManager.<initializer>: argument tagStructure, not accepted anymore. ***@***.***/core.TagManager.<initializer>]
@aws-cdk/custom-resources... OK.
@aws-cdk/cx-api... OK.
@aws-cdk/region-info... OK.
Some packages seem to have undergone breaking API changes. Please avoid.```
—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub
<#4225?email_source=notifications&email_token=AATDXYHRJC3E6A3YOTPW2WTQLKD25A5CNFSM4I2E453KYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOD7P5RLI#issuecomment-534763693>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AATDXYBQGMYFMALT5LTB6ZTQLKD25ANCNFSM4I2E453A>
.
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In the PR description please include information on what was the issue and the root cause that motivated this change
AWS CodeBuild CI Report
Powered by github-codebuild-logs, available on the AWS Serverless Application Repository |
AWS CodeBuild CI Report
Powered by github-codebuild-logs, available on the AWS Serverless Application Repository |
Where do I open the v2 issue or did I miss a document telling me about this? |
AWS CodeBuild CI Report
Powered by github-codebuild-logs, available on the AWS Serverless Application Repository |
Hey @moofish32 what's up? How are you?
|
packages/@aws-cdk/aws-s3/lib/notifications-resource/notifications-resource-handler.ts
Outdated
Show resolved
Hide resolved
@eladb - I refactored to make this backwards compatible. I think I'm ready for one more review I have a couple of clean up comments against my self. I'm still not sure how I should handle a breaking change in the constructor. I went to an optional additional parameter: constructor(tagType: TagType, resourceTypeName: string, tagStructure?: any, options?: TagManagerOptions) Going forward it seems like it would make more sense to move the constructor to: export interface TagManagerOptions {
/**
* The initial CloudFormation tags
*
* If the user set tags on the lower level Cfn* object this are passed here to
* ensure they are set on the final contruct. Based on the TagType these are
* validated and parsed.
*/
readonly cfnTags?: any;
/**
* The name of the property in CloudFormation for these tags
*
* Normally this is Tags, but Cognito UserPool uses UserPoolTags
* @default tags
*/
readonly tagPropertyName?: string;
}
constructor(tagType: TagType, resourceTypeName: string, options?: TagManagerOptions) Based on the V2 issue, how to deprecate a constructor. |
AWS CodeBuild CI Report
Powered by github-codebuild-logs, available on the AWS Serverless Application Repository |
AWS CodeBuild CI Report
Powered by github-codebuild-logs, available on the AWS Serverless Application Repository |
AWS CodeBuild CI Report
Powered by github-codebuild-logs, available on the AWS Serverless Application Repository |
AWS CodeBuild CI Report
Powered by github-codebuild-logs, available on the AWS Serverless Application Repository |
AWS CodeBuild CI Report
Powered by github-codebuild-logs, available on the AWS Serverless Application Repository |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
remove asCfnProperty
and move logic to CfnResource
AWS CodeBuild CI Report
Powered by github-codebuild-logs, available on the AWS Serverless Application Repository |
tagsProp[this.tags.tagPropertyName] = this.tags.renderTags(); | ||
return deepMerge(this._cfnProperties || {}, tagsProp); | ||
} | ||
return this._cfnProperties; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
return this._cfnProperties; | |
return this._cfnProperties || {}; |
AWS CodeBuild CI Report
Powered by github-codebuild-logs, available on the AWS Serverless Application Repository |
AWS CodeBuild CI Report
Powered by github-codebuild-logs, available on the AWS Serverless Application Repository |
I believe I'm complete for all comments, let me know if I need to update branch or take any other action. |
Thank you for contributing! Your pull request is now being automatically merged. |
AWS CodeBuild CI Report
Powered by github-codebuild-logs, available on the AWS Serverless Application Repository |
AWS CodeBuild CI Report
Powered by github-codebuild-logs, available on the AWS Serverless Application Repository |
Thank you for contributing! Your pull request is now being automatically merged. |
3rd test body
|
Cognito user pool tags do not use the property name
Tags
. In order to support properties without the nameTags
the code needs to support arbitrary names for the tags field. I moved all references toTags
into the schema package such thatcodegen
does not share any of the knowledge about special names for tag fields.included UserPoolTags as taggable name
properties
Fixes #3882
By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license