-
Notifications
You must be signed in to change notification settings - Fork 22
Open
Description
Expected Behavior
Using KvV2Write with empty data should clear the secrets of keys
https://developer.hashicorp.com/vault/api-docs/secret/kv/kv-v2#create-update-secret
Current Behavior
Using KvV2Write with empty data yields a 400 with a message stating "no data provided"
Failure Information
vault-client-go v0.4.3
vault 1.13.3
Steps to Reproduce
KvV2Write(ctx, subpath, schema.KvV2WriteRequest{
Data: make(map[string]interface{}),
})
Additional Information
i managed to fix this by changing the struct to this
// KvV2WriteRequest struct for KvV2WriteRequest
type KvV2WriteRequest struct {
// The contents of the data map will be stored and returned on read.
Data map[string]interface{} `json:"data"`
// Options for writing a KV entry. Set the \"cas\" value to use a Check-And-Set operation. If not set the write will be allowed. If set to 0 a write will only be allowed if the key doesn’t exist. If the index is non-zero the write will only be allowed if the key’s current version matches the version specified in the cas parameter.
Options map[string]interface{} `json:"options,omitempty"`
// If provided during a read, the value at the version number will be returned
Version int32 `json:"version,omitempty"`
}
by removing the omitempty, the data is correctly sent in the json as an empty object and the vault backend understands the request
Metadata
Metadata
Assignees
Labels
No labels