Refactor secret source data structures #2729
Merged
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.
What does this change
As I was working on advanced dependencies, I kept running into confusion about what some of these structs and fields represented. For example, a source mapping had both a Value field (representing the resolved value) and a Source.Value representing a hint to the secret strategy on how to resolve the value of parameter or credential.
I have renamed the data structures and fields a bit to better align with how they are used.
The renames happened in pkg/secrets/stragegy.go, the rest of the file just propagate the name changes.
What issue does it fix
None
Notes for the reviewer
I can make this a smaller PR by just renaming the top level Value field to ResolvedValue, but I think the other renames may be helpful as well for anyone maintaining the code. Within the same data structure we were using Value to mean 3 different things...
Let me know what you think, we don't have to do any of this unless it makes the code more clear!
Checklist
Reviewer Checklist