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 patch_metadata method to kv api #277

Merged
merged 8 commits into from
Nov 27, 2023

Conversation

hortoncd
Copy link
Contributor

This PR adds a patch_metadata method to the kv api, as described in https://developer.hashicorp.com/vault/api-docs/secret/kv/kv-v2#patch-metadata. The driver for this was to be able to update custom_metadata via patch rather than re-writing the entire existing custom_metadata hash.

@hashicorp-cla
Copy link

hashicorp-cla commented Nov 14, 2022

CLA assistant check
All committers have signed the CLA.

# be a {Hash}.
#
# @example
# Vault.kv("secret").patch_metadata("password", custom_metadata: { data: update }, max_versions => 3)
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
# Vault.kv("secret").patch_metadata("password", custom_metadata: { data: update }, max_versions => 3)
# Vault.kv("secret").patch_metadata("password", custom_metadata: { my_custom_key: "my_value" }, max_versions: 3)

two suggestions:

  • removing data as the key (data can get confusing w/ kv-v2 engine)
  • replaced => with : (didn't work with the => as written)

Copy link
Contributor Author

@hortoncd hortoncd Jun 14, 2023

Choose a reason for hiding this comment

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

@dhuckins Adjusted. The max_versions issue is in a bunch of the other examples in that file, so will probably want to fix those if they have the same issue.

Copy link
Contributor

Choose a reason for hiding this comment

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

thanks! do you mind rebasing/pulling upstream branch so the refactored CI can run? (on your branch: git pull master should do the trick)

sorry for the delay

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@dhuckins no worries. should be caught up now

@hortoncd hortoncd requested a review from a team June 14, 2023 19:36
@hortoncd hortoncd requested a review from dhuckins July 18, 2023 02:32
@dhuckins dhuckins merged commit 11f70a9 into hashicorp:master Nov 27, 2023
@hortoncd hortoncd deleted the add-patch-metadata branch November 27, 2023 19:37
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.

3 participants