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 support #49

Merged
merged 23 commits into from
Oct 13, 2021
Merged
Show file tree
Hide file tree
Changes from 14 commits
Commits
Show all changes
23 commits
Select commit Hold shift + click to select a range
297b68c
add initial PatchOperation support with cas validation
ccapurso Sep 20, 2021
bb691fc
update go.mod, go.sum
ccapurso Sep 20, 2021
395b8fe
Add PatchOperation case to invalid patch fallthrough
ccapurso Sep 20, 2021
988f831
initial PatchOperation handler for data endpoint
ccapurso Sep 20, 2021
aebffbb
move old version cleanup logic into its own function
ccapurso Sep 21, 2021
9240181
respond with 404 for PATCH to deleted or destroyed version
ccapurso Sep 22, 2021
0f77523
go fmt
ccapurso Sep 23, 2021
976a5fa
add test for put with cas=0
ccapurso Sep 23, 2021
edd764b
additional patch tests for no data provided and entry/metadata not found
ccapurso Sep 24, 2021
9ca3716
add better error messaging for data path tests
ccapurso Sep 24, 2021
cc1037b
add comments
ccapurso Sep 30, 2021
6d744b5
make patch resp when deleted/destroyed consistent with success resp
ccapurso Sep 30, 2021
2b63c32
fixes for PR feedback
ccapurso Oct 1, 2021
787a916
check for data in patch handler prior to locking
ccapurso Oct 1, 2021
6eb837c
pass storage view and key to cleanupOldVersions directly
ccapurso Oct 6, 2021
4b7603e
remove replace directive for vault/sdk
ccapurso Oct 6, 2021
ee35352
get vault/sdk @kv-patch branch
ccapurso Oct 7, 2021
ec96a56
add cas_required check to TestVersionedKV_Patch_CASValidation
ccapurso Oct 7, 2021
2d15a6f
cleanupOldVersions now returns string instead of error
ccapurso Oct 7, 2021
d77d100
remove direct dependency on json-patch
ccapurso Oct 7, 2021
7783446
require the json-patch library
raskchanky Oct 7, 2021
afe8241
fix TestVersionedKV_Patch_NoData
ccapurso Oct 8, 2021
41274a0
upgrade to go 1.16
ccapurso Oct 8, 2021
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
3 changes: 3 additions & 0 deletions backend.go
Original file line number Diff line number Diff line change
Expand Up @@ -170,6 +170,8 @@ func pathInvalid(b *versionedKVBackend) []*framework.Path {
switch req.Operation {
case logical.CreateOperation, logical.UpdateOperation:
subCommand = "put"
case logical.PatchOperation:
subCommand = "patch"
case logical.ReadOperation:
subCommand = "get"
case logical.ListOperation:
Expand All @@ -188,6 +190,7 @@ func pathInvalid(b *versionedKVBackend) []*framework.Path {
Operations: map[logical.Operation]framework.OperationHandler{
logical.UpdateOperation: &framework.PathOperation{Callback: handler, Unpublished: true},
logical.CreateOperation: &framework.PathOperation{Callback: handler, Unpublished: true},
logical.PatchOperation: &framework.PathOperation{Callback: handler, Unpublished: true},
logical.ReadOperation: &framework.PathOperation{Callback: handler, Unpublished: true},
logical.DeleteOperation: &framework.PathOperation{Callback: handler, Unpublished: true},
logical.ListOperation: &framework.PathOperation{Callback: handler, Unpublished: true},
Expand Down
9 changes: 5 additions & 4 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -2,18 +2,19 @@ module github.com/hashicorp/vault-plugin-secrets-kv

go 1.12

replace github.com/hashicorp/vault/sdk => ../vault/sdk
ccapurso marked this conversation as resolved.
Show resolved Hide resolved

require (
github.com/evanphx/json-patch v0.5.2 // indirect
github.com/go-test/deep v1.0.7 // indirect
github.com/golang/protobuf v1.5.0
github.com/hashicorp/go-hclog v0.12.0
github.com/hashicorp/go-multierror v1.0.0 // indirect
github.com/hashicorp/go-hclog v0.16.2
github.com/hashicorp/go-multierror v1.1.1 // indirect
github.com/hashicorp/go-secure-stdlib/parseutil v0.1.1
github.com/hashicorp/go-secure-stdlib/strutil v0.1.1 // indirect
github.com/hashicorp/vault/api v1.0.5-0.20200215224050-f6547fa8e820
github.com/hashicorp/vault/sdk v0.1.14-0.20200215224050-f6547fa8e820
github.com/hashicorp/yamux v0.0.0-20181012175058-2f1d1f20f75d // indirect
github.com/mitchellh/mapstructure v1.4.1
golang.org/x/text v0.3.1-0.20181227161524-e6919f6577db // indirect
google.golang.org/genproto v0.0.0-20190404172233-64821d5d2107 // indirect
google.golang.org/protobuf v1.27.1 // indirect
)