-
Notifications
You must be signed in to change notification settings - Fork 16
/
client.go
27 lines (23 loc) · 799 Bytes
/
client.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
package vaku
import (
vapi "github.com/hashicorp/vault/api"
)
// Client is a simple wrapper around a real Vault API client. All Vaku
// functions are defined on Client as well, which lets anyone already
// using a Vault Client easily make use of Vaku.
type Client struct {
*vapi.Client
}
// NewClient returns a new empty Vaku Client. Using this function requires
// that you initialize and set the nested Vault client on your own before
// Vaku functions will work.
func NewClient() *Client {
return &Client{}
}
// NewClientFromVaultClient takes in an official Vault Client that you have
// already created and returns a Vaku client that wraps your Vault client.
func NewClientFromVaultClient(vc *vapi.Client) *Client {
vakuClient := NewClient()
vakuClient.Client = vc
return vakuClient
}