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(core): improved API for tags #3465

Merged
merged 3 commits into from
Jul 29, 2019
Merged

Conversation

iamhopaul123
Copy link
Contributor

@iamhopaul123 iamhopaul123 commented Jul 29, 2019

Improved tagging API.

Please read the contribution guidelines and follow the pull-request checklist.

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

@eladb eladb changed the title design(core): tagging API change feat(core): improved API for tags Jul 29, 2019
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.

I've updated the title. Even if this is only a design, you'll eventually evolve it to the actual PR. Please update PR description

@iamhopaul123
Copy link
Contributor Author

I've updated the title. Even if this is only a design, you'll eventually evolve it to the actual PR. Please update PR description

But I've submitted another PR for the implementation part. Do I need to close that PR and migrate those changes to this PR?

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.

@moofish32 what do you think?

/**
* add tags to the node of a construct and all its the taggable children
*/
public static add(scope: Construct, key: string, value: string, props: TagProps = {}) {
Copy link
Contributor

Choose a reason for hiding this comment

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

since tags are essentially maps, why not something like this:

Tag.add(scope, { sfoo: 'bar' })

This will allow people to add multiple tags like this:

Tag.add(scope, {
  tag1: 'value1',
  tag2: 'value2'
});

Copy link
Contributor Author

@iamhopaul123 iamhopaul123 Jul 29, 2019

Choose a reason for hiding this comment

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

But tag also supports other properties like priority. See here. I would suggest Tag.add(scope, [
(tag1, 'value1', props)
(tag2, 'value2', props)
]);
but not sure if that's an over-engineer.

Copy link
Contributor

Choose a reason for hiding this comment

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

okay, let's just leave it with Tag.add(scope, key, value[, options)

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.

Missing unit test

@eladb eladb merged commit e15d391 into aws:master Jul 29, 2019
@eladb
Copy link
Contributor

eladb commented Jul 30, 2019

@iamhopaul123 could you please also submit a PR to update the developer guide:
https://github.com/awsdocs/aws-cdk-guide/blob/master/doc_source/tagging.md

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants