Skip to content
Branch: master
Find file Copy path
Find file Copy path
Fetching contributors…
Cannot retrieve contributors at this time
32 lines (26 sloc) 859 Bytes
package vaku
import "fmt"
// PathWrite takes in a PathInput and data to written to that path. It then
// calls the native vault write with that data at the specified path.
func (c *Client) PathWrite(i *PathInput, d map[string]interface{}) error {
var err error
// Initialize the input
i.opType = "write"
err = c.InitPathInput(i)
if err != nil {
return fmt.Errorf("failed to init write path %s: %w", i.Path, err)
// V2 mounts nest the actual data in another map[string]interface{}
if i.mountVersion == "2" {
d = map[string]interface{}{
"data": d,
// Do the actual write
_, err = c.Logical().Write(i.opPath, d)
if err != nil {
return fmt.Errorf("failed to write secret to %s: %w", i.opPath, err)
return err
You can’t perform that action at this time.