-
Notifications
You must be signed in to change notification settings - Fork 150
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
Add ackcompare.GetTagsDifference
helper method
#109
Add ackcompare.GetTagsDifference
helper method
#109
Conversation
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.
Great stuff, @RedbackThomson :)
@@ -44,9 +44,11 @@ require ( | |||
github.com/prometheus/client_model v0.2.0 // indirect | |||
github.com/prometheus/common v0.28.0 // indirect | |||
github.com/prometheus/procfs v0.6.0 // indirect | |||
github.com/samber/lo v1.37.0 // indirect |
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.
\o/
// we need to convert the tag tuples to a comparable interface type | ||
fromPairs := lo.ToPairs(from) | ||
toPairs := lo.ToPairs(to) | ||
|
||
left, right := lo.Difference(fromPairs, toPairs) | ||
middle := lo.Intersect(fromPairs, toPairs) | ||
|
||
removed = lo.FromPairs(left) | ||
added = lo.FromPairs(right) | ||
unchanged = lo.FromPairs(middle) |
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.
cool use of samber/lo utilities. ++
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.
/lgtm
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: jaypipes, jljaco, RedbackThomson The full list of commands accepted by this bot can be found here. The pull request process is described here
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
Extends aws-controllers-k8s/code-generator#399
Description of changes:
Adds a
GetTagsDifference
helper method that can be used to determine which tags should be added and removed based on what they are going "from" and "to" - typically needed for services withTagResource
andUntagResource
operations.For example:
By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.