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

Add HTTP PATCH support for KV key metadata #13215

Merged
merged 18 commits into from Jan 12, 2022
Merged

Conversation

ccapurso
Copy link
Contributor

@ccapurso ccapurso commented Nov 18, 2021

PR #57 for vault-plugin-secrets-kv introduces a PatchOperation handler for the KV <mount>/metadata/:path endpoint. This PR introduces the CLI command kv metadata patch. The command will only include fields in the request data that have been provided as flags to prevent unexpectedly clearing them via the patch operation. This was actually an issue that was discovered for the kv metadata put command and has been fixed as part of this PR.

@ccapurso ccapurso changed the title go get vault-plugin-secrets-kv@vault-4290-patch-metadata Add HTTP PATCH support for key metadata Nov 18, 2021
@ccapurso ccapurso changed the title Add HTTP PATCH support for key metadata Add HTTP PATCH support for KV key metadata Nov 18, 2021
@vercel vercel bot temporarily deployed to Preview – vault November 23, 2021 16:42 Inactive
@vercel vercel bot temporarily deployed to Preview – vault-storybook November 23, 2021 16:42 Inactive
@vercel vercel bot temporarily deployed to Preview – vault November 23, 2021 17:09 Inactive
@vercel vercel bot temporarily deployed to Preview – vault-storybook November 23, 2021 17:09 Inactive
@vercel vercel bot temporarily deployed to Preview – vault-storybook November 23, 2021 20:46 Inactive
@vercel vercel bot temporarily deployed to Preview – vault November 23, 2021 20:46 Inactive
@vercel vercel bot temporarily deployed to Preview – vault November 23, 2021 21:47 Inactive
@vercel vercel bot temporarily deployed to Preview – vault-storybook November 23, 2021 21:47 Inactive
@vercel vercel bot temporarily deployed to Preview – vault-storybook November 24, 2021 21:49 Inactive
@vercel vercel bot temporarily deployed to Preview – vault November 24, 2021 21:49 Inactive
@vercel vercel bot temporarily deployed to Preview – vault November 30, 2021 15:42 Inactive
@vercel vercel bot temporarily deployed to Preview – vault-storybook November 30, 2021 15:42 Inactive
@vercel vercel bot temporarily deployed to Preview – vault December 8, 2021 18:35 Inactive
@vercel vercel bot temporarily deployed to Preview – vault-storybook December 8, 2021 18:35 Inactive
@ccapurso ccapurso added this to the 1.10 milestone Dec 8, 2021
@vercel vercel bot temporarily deployed to Preview – vault December 8, 2021 20:27 Inactive
@vercel vercel bot temporarily deployed to Preview – vault-storybook December 8, 2021 20:27 Inactive
@vercel vercel bot temporarily deployed to Preview – vault-storybook December 8, 2021 21:09 Inactive
@ccapurso ccapurso marked this pull request as ready for review December 8, 2021 21:09
@ccapurso ccapurso requested a review from a team December 9, 2021 19:34
Copy link
Contributor

@HridoyRoy HridoyRoy left a comment

Choose a reason for hiding this comment

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

A few small questions/comments, but looks great overall!

go.mod Outdated
@@ -108,15 +108,15 @@ require (
github.com/hashicorp/vault-plugin-secrets-azure v0.11.2
github.com/hashicorp/vault-plugin-secrets-gcp v0.11.0
github.com/hashicorp/vault-plugin-secrets-gcpkms v0.10.0
github.com/hashicorp/vault-plugin-secrets-kv v0.5.7-0.20211123171606-16933c88368a
github.com/hashicorp/vault-plugin-secrets-kv v0.5.7-0.20211206210934-74fe79f60b74
Copy link
Contributor

Choose a reason for hiding this comment

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

Were these upgrades intentional? If you wanted to include the upgrades in the other 2 PRs open for review, I think you'd need to re-import after those PRs are merged.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes, the intention is to include the upgrade for vault-plugin-secrets-kv for review. As you mentioned, I plan to re-import after those PRs are merged.

command/kv_metadata_patch.go Show resolved Hide resolved
command/kv_metadata_put.go Show resolved Hide resolved
command/kv_metadata_put.go Show resolved Hide resolved
website/content/api-docs/secret/kv/kv-v2.mdx Show resolved Hide resolved
@HridoyRoy HridoyRoy self-requested a review January 10, 2022 18:32
Copy link
Contributor

@HridoyRoy HridoyRoy left a comment

Choose a reason for hiding this comment

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

Looks good to me, though as a minor nit I'd still prefer for us to clean up the BoolVar struct if we can, since it doesn't seem to be used. Overall it looks good to go!

@vercel vercel bot temporarily deployed to Preview – vault-storybook January 12, 2022 16:01 Inactive
@vercel vercel bot temporarily deployed to Preview – vault January 12, 2022 16:01 Inactive
@ccapurso ccapurso merged commit e014065 into main Jan 12, 2022
@ccapurso ccapurso deleted the vault-4290-patch-metadata branch January 12, 2022 17:05
heppu pushed a commit to heppu/vault that referenced this pull request Jan 13, 2022
* go get vault-plugin-secrets-kv@vault-4290-patch-metadata

* add kv metadata patch command

* add changelog entry

* success tests for kv metadata patch flags

* add more kv metadata patch flags tests

* add kv metadata patch cas warning test

* add kv-v2 key metadata patch API docs

* add kv metadata patch to docs

* prevent unintentional field overwriting in kv metadata put cmd

* like create/update ops, prevent patch to paths ending in /

* fix kv metadata patch cmd in docs

* fix flag defaults for kv metadata put

* go get vault-plugin-secrets-kv@vault-4290-patch-metadata

* fix TestKvMetadataPatchCommand_Flags test

* doc fixes

* go get vault-plugin-secrets-kv@master; go mod tidy
joatmon08 pushed a commit that referenced this pull request Jan 25, 2022
* go get vault-plugin-secrets-kv@vault-4290-patch-metadata

* add kv metadata patch command

* add changelog entry

* success tests for kv metadata patch flags

* add more kv metadata patch flags tests

* add kv metadata patch cas warning test

* add kv-v2 key metadata patch API docs

* add kv metadata patch to docs

* prevent unintentional field overwriting in kv metadata put cmd

* like create/update ops, prevent patch to paths ending in /

* fix kv metadata patch cmd in docs

* fix flag defaults for kv metadata put

* go get vault-plugin-secrets-kv@vault-4290-patch-metadata

* fix TestKvMetadataPatchCommand_Flags test

* doc fixes

* go get vault-plugin-secrets-kv@master; go mod tidy
qk4l pushed a commit to qk4l/vault that referenced this pull request Feb 4, 2022
* go get vault-plugin-secrets-kv@vault-4290-patch-metadata

* add kv metadata patch command

* add changelog entry

* success tests for kv metadata patch flags

* add more kv metadata patch flags tests

* add kv metadata patch cas warning test

* add kv-v2 key metadata patch API docs

* add kv metadata patch to docs

* prevent unintentional field overwriting in kv metadata put cmd

* like create/update ops, prevent patch to paths ending in /

* fix kv metadata patch cmd in docs

* fix flag defaults for kv metadata put

* go get vault-plugin-secrets-kv@vault-4290-patch-metadata

* fix TestKvMetadataPatchCommand_Flags test

* doc fixes

* go get vault-plugin-secrets-kv@master; go mod tidy
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.

None yet

3 participants