vault

package
v1.9.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jun 14, 2017 License: MIT Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AuthResponse

type AuthResponse struct {
	Auth struct {
		ClientToken   string   `json:"client_token"`
		LeaseDuration int64    `json:"lease_duration"`
		Metadata      struct{} `json:"metadata"`
		Policies      []string `json:"policies"`
		Renewable     bool     `json:"renewable"`
	} `json:"auth"`
}

AuthResponse - the Auth response

func (*AuthResponse) String

func (a *AuthResponse) String() string

type AuthStrategy

type AuthStrategy interface {
	GetToken(addr *url.URL) (string, error)
	Revokable() bool
}

AuthStrategy -

type Client

type Client struct {
	Addr *url.URL
	Auth AuthStrategy
	// contains filtered or unexported fields
}

Client -

func NewClient

func NewClient() *Client

NewClient - instantiate a new

func (*Client) Do added in v1.2.1

func (c *Client) Do(req *http.Request) (*http.Response, error)

Do wraps http.Client.Do

func (*Client) GetHTTPClient added in v1.2.1

func (c *Client) GetHTTPClient() *http.Client

GetHTTPClient returns a client configured w/X-Vault-Token header

func (*Client) Login

func (c *Client) Login() error

Login - log in to Vault with the discovered auth backend and save the token

func (*Client) Read

func (c *Client) Read(path string) ([]byte, error)

func (*Client) RevokeToken

func (c *Client) RevokeToken()

RevokeToken - revoke the current auth token - effectively logging out

func (*Client) SetToken added in v1.2.1

func (c *Client) SetToken(req *http.Request)

SetToken adds an X-Vault-Token header to the request

type Strategy added in v1.6.0

type Strategy struct {
	// contains filtered or unexported fields
}

Strategy - an auth strategy configured through the Vault API

func AppIDStrategy added in v1.6.0

func AppIDStrategy(fs vfs.Filesystem) *Strategy

AppIDStrategy - app-id auth backend

func AppRoleStrategy added in v1.6.0

func AppRoleStrategy(fs vfs.Filesystem) *Strategy

AppRoleStrategy - approle auth backend

func GitHubStrategy added in v1.6.0

func GitHubStrategy(fs vfs.Filesystem) *Strategy

GitHubStrategy - github auth backend

func UserPassStrategy added in v1.6.0

func UserPassStrategy(fs vfs.Filesystem) *Strategy

UserPassStrategy - userpass auth backend

func (*Strategy) Do added in v1.6.0

func (a *Strategy) Do(req *http.Request) (*http.Response, error)

Do wraps http.Client.Do

func (*Strategy) GetHTTPClient added in v1.6.0

func (a *Strategy) GetHTTPClient() *http.Client

GetHTTPClient configures the HTTP client with a timeout

func (*Strategy) GetToken added in v1.6.0

func (a *Strategy) GetToken(addr *url.URL) (string, error)

GetToken - log in to the app-id auth backend and return the client token

func (*Strategy) Revokable added in v1.6.0

func (a *Strategy) Revokable() bool

Revokable -

func (*Strategy) SetToken added in v1.6.0

func (a *Strategy) SetToken(req *http.Request)

SetToken is a no-op here as a token hasn't been acquired yet

type TokenStrategy added in v1.6.0

type TokenStrategy struct {
	Token string
}

TokenStrategy - a pass-through strategy for situations where we already have a Vault token.

func NewTokenStrategy added in v1.6.0

func NewTokenStrategy(fs vfs.Filesystem) *TokenStrategy

NewTokenStrategy - Try to create a new TokenStrategy. If we can't nil will be returned.

func (*TokenStrategy) GetToken added in v1.6.0

func (a *TokenStrategy) GetToken(addr *url.URL) (string, error)

GetToken - return the token

func (*TokenStrategy) Revokable added in v1.6.0

func (a *TokenStrategy) Revokable() bool

Revokable -

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL