Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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(servicecatalog): Create TagOptions Construct #18314
feat(servicecatalog): Create TagOptions Construct #18314
Changes from 2 commits
d0e30d3
c3d930c
023e440
d519888
e6cc8cb
fb125c1
f67a303
d1cfcd4
58e9391
f33d001
8c0f465
e434806
35e831f
03d733a
e5bfdef
e934d89
ca9ec79
84f9410
5f1f4a6
File filter
Filter by extension
Conversations
Jump to
There are no files selected for viewing
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.
The cdk linting doesn't like this setup (no interface and no props struct) but I don't particularly see value of having classes that are just pass throughs. I don't know if making it props with a
tagOptions
field is better since it seems redundant to doOnly if its a little bit of future proofing in case we want to add another field to props then it would be easier to make change.
I will defer to you though on this.
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 think linting rules have become more stringent? Build is failing since you apparently need to disable interface ref in js docs ( I had hoped I could just do it in package.json).
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.
Let's just introduce a
TagOptionsProps
interface as the third argument, like you suggested in #18314 (comment).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.
that works, leaves more wiggle room to not break things in future should changes happen and we want to modify props.
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.
key
is also a bad name. This is actually atagName
, right?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.
sure,
the raw values ->
tagKey
:tagValue
and then the hashed value in maptagOptionIdentifier
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.
Let's kill the
TagOptions
prefix from here - it makes the logical ID duplicated, like"TagOptionsTagOption5f31c54ba705C49A7414"
.Just do:
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.
okay, I wasn't sure before because someone might have used a contextual name in naming the resource like 'TagOptionsForCatalog2' that might make it easier to understand the enumerated resource names in template.
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.
What would you say if, instead of hashing, we use just number indexes for these, counting from 1? (Not that each
TagOptions
is a construct, these don't have to be unique, unlike when we created these under the Stack scope).This would make the resulting template much cleaner.
So, this would be something like:
Where
i
andj
are indexes in a loop -i
is the index of the tag, andj
is the index of the allowed values of the tag.Thoughts on this?
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.
What about in the case of updating and modifying the values? e.g. we might have
key: ['value1', 'value2', 'value3', value4']
and then I update this to just be
key: ['value1', 'value2', 'value4']
I wouldn't expect to see 2 updated resources in template (1 deleted, 1 modified), only the one that was removed.
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.
This
if
doesn't make sense anymore, right? It can never betrue
anymore.Pretty sure we should kill it.
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.
This is carryover from how we originally did things so that if you for example had duplicate values it would be idempotent and ignore. I would prefer it if we could modify it so that creation is very strict, but that would change behavior again.
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 changed this now to just get check for unique values, and we don't need to examine construct tree, which to some degree might have minor latency if construct tree is big.
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.
Since
tagOptionIdentifier
is also the identifier of theCfnTagOption
resource, is there actually any reason for this map? I think we can just have an array ofCfnTagOption
, and then retrieve its identifier withcfnTagOption.node.id
(or possiblyNode.of(cfnTagOption).id
if it uses the new construct API).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 can just make this a list, the map part was a relic of an earlier point where we considered adding lookup access to an underlying tagOption(s), and a map felt more efficient than searching list.