Documentation ¶
Overview ¶
The client package contains the implementation of VaultClient which acts as a small wrapper around the Vault API client (github.com/hashicorp/vault/api).
Index ¶
- type VaultClient
- func (c *VaultClient) Address() string
- func (c *VaultClient) Authenticated() bool
- func (c *VaultClient) Available() (bool, error)
- func (c *VaultClient) Login(a auth.Auth, d map[string]*auth.Detail) error
- func (c *VaultClient) SetConfigValues(server string, token string) error
- func (c *VaultClient) SignPubKey(mount string, role string, key []byte) (string, error)
- func (c *VaultClient) Token() string
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type VaultClient ¶
type VaultClient struct {
// contains filtered or unexported fields
}
VaultClient is a small wrapper around the Vault API client. It provides additional functionality needed by vssh such as handling authentication a client and signing SSH public keys.
func NewClient ¶
func NewClient(c *api.Config) (*VaultClient, error)
NewClient returns a new VaultClient with the underlying API client configured with the given api.Config.
func NewClientWithAPI ¶
func NewClientWithAPI(c *api.Client) *VaultClient
NewClientWithAPI returns a new VaultClient with the underlying API client configured with the given api.Client.
func NewDefaultClient ¶
func NewDefaultClient() (*VaultClient, error)
NewDefaultClient() returns a new VaultClient with the underlying API client configured with the Vault default values.
func (*VaultClient) Address ¶
func (c *VaultClient) Address() string
Address returns the Vault instance address configured for the underlying API client.
func (*VaultClient) Authenticated ¶
func (c *VaultClient) Authenticated() bool
Authenticated performs a lookup of the underlying API client which by nature requires a valid token. If the lookup fails it will return false, indicating the client does not have a valid token. If the lookup succeeds, it returns true.
func (*VaultClient) Available ¶
func (c *VaultClient) Available() (bool, error)
Available checks if the configured Vault instance is either sealed or not initialized, returning false if either of those conditions are true.
func (*VaultClient) Login ¶
Login takes an authentication type along with its associated details and attempts to authenticate against the configured Vault instance. If authentication is successful, the token returned from the Vault instance will be automatically set to the underlying API client.
func (*VaultClient) SetConfigValues ¶
func (c *VaultClient) SetConfigValues(server string, token string) error
SetConfigValues provides a method for setting the server and token of the underlying API client.
func (*VaultClient) SignPubKey ¶
SignPubKey will use the underlying API client to attempt to sign the given SSH public key with the given role and mount point.
func (*VaultClient) Token ¶
func (c *VaultClient) Token() string
Token returns the token configured for the underlying API client.