-
Notifications
You must be signed in to change notification settings - Fork 4.3k
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 Patch KV helper #15587
Add Patch KV helper #15587
Conversation
… it as part of helper method
I'm adding the no-changelog label since I plan to tag and release this along with #15305 which already has a changelog entry that should cover this in the release notes (as well as future PRs I'm about to do for other KV helper functions like PutMetadata, etc.) @mladlow Let me know if you think otherwise! |
@digivava changelog plan sounds good! |
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.
Looks good, just a couple small comments. It might also be interesting to add a test where we perform a JSON merge patch for an entry that does not exist to prevent regressions with our error handling as that will result in a 404.
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 looks good to me!
* Add Read methods for KVClient * KV write helper * Add changelog * Add Delete method * Use extractVersionMetadata inside extractDataAndVersionMetadata * Return nil, nil for v1 writes * Add test for extracting version metadata * Split kv client into v1 and v2-specific clients * Add ability to set options on Put * Add test for KV helpers * Add custom metadata to top level and allow for getting versions as sorted slice * Update tests * Separate KV v1 and v2 into different files * Add test for GetVersionsAsList, rename Metadata key to VersionMetadata for clarity * Move structs and godoc comments to more appropriate files * Add more tests for extract methods * Rework custom metadata helper to be more consistent with other helpers * Remove KVSecret from custom metadata test now that we don't append to it as part of helper method * Add Patch KV helper * Add godoc comment and use WithOption ourselves in other KVOption functions * Clean up options-handling and resp parsing logic; add more tests * Add constants and more patch tests
This PR is an addition onto the already-merged KV helpers PR (#15305), to add a helper method to the api package that allows the Patch command. The logic is mostly the same as the CLI. It also provides a new
WithOption
KVOption to allow for providing an arbitrary key-value option (for future-proofing if we don't get around to adding new With* functions when new options are developed).