vault

package
v2.0.0-dev.6 Latest Latest
Warning

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

Go to latest
Published: Feb 15, 2021 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// NamespaceHeader specifies the header name to use when including Namespace information in a request.
	NamespaceHeader = "X-Vault-Namespace"
	AuthTypeHeader  = "X-Vault-Token"
)

Variables

This section is empty.

Functions

func CreateHTTPClient

func CreateHTTPClient(config types.SecretConfig) (pkg.Caller, error)

CreateHTTPClient creates and configures an HTTP client which can be used to communicate with the underlying secret-store based on the SecretConfig. Returns ErrCaRootCert is there is an error with the certificate.

Types

type Client

type Client struct {
	HttpConfig types.SecretConfig
	HttpCaller pkg.Caller
	// contains filtered or unexported fields
}

Client defines the behavior for interacting with the Vault REST secret key/value store via HTTP(S).

func NewClient

func NewClient(config types.SecretConfig, caller pkg.Caller, lc logger.LoggingClient) Client

func (Client) GetSecrets

func (c Client) GetSecrets(subPath string, keys ...string) (map[string]string, error)

GetSecrets retrieves the secrets at the provided sub-path that matches the specified keys.

func (Client) GetTokenLookupResponseData

func (c Client) GetTokenLookupResponseData() (*TokenLookupResponse, error)

func (Client) RefreshToken

func (c Client) RefreshToken(ctx context.Context, tokenExpiredCallback pkg.TokenExpiredCallback) error

func (Client) StoreSecrets

func (c Client) StoreSecrets(subPath string, secrets map[string]string) error

StoreSecrets stores the secrets at the provided sub-path for the specified keys.

type ErrCaRootCert

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

ErrCaRootCert error when the provided CA Root certificate is invalid.

func (ErrCaRootCert) Error

func (e ErrCaRootCert) Error() string

type ErrHTTPResponse

type ErrHTTPResponse struct {
	StatusCode int
	ErrMsg     string
}

func (ErrHTTPResponse) Error

func (err ErrHTTPResponse) Error() string

type TokenLookupMetadata

type TokenLookupMetadata struct {
	ExpireTime string `json:"expire_time"`
	Period     int    `json:"period"` // in seconds
	Renewable  bool   `json:"renewable"`
	Ttl        int    `json:"ttl"` // in seconds
}

type TokenLookupResponse

type TokenLookupResponse struct {
	Data TokenLookupMetadata
}

Jump to

Keyboard shortcuts

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