Documentation
¶
Index ¶
Constants ¶
const ( ApproleLoginPath = "/v1/auth/approle/login" AwsroleLoginPath = "/v1/auth/aws/login" )
const ( TokenLookupPath = "/v1/auth/token/lookup" DefaultTimeout = 10 ErrAddrMissing = "vault address is missing" ErrTokenMissing = "vault token is missing" ErrEmptyToken = "vault parsed token is empty" ErrSecretParse = "failed to parse secret" Err403Auth = "Authorization error. Check your clientToken." Err404NotFound = "Secret not found" ErrUnknown = "Unknown error" )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Approle ¶
type Approle struct {
// contains filtered or unexported fields
}
func (Approle) LoginEndpoint ¶
func (Approle) LoginPayload ¶
type Awsrole ¶
type Awsrole struct {
// contains filtered or unexported fields
}
func (Awsrole) LoginEndpoint ¶
func (Awsrole) LoginPayload ¶
type Option ¶
type Option func(vc *VaultClient) error
func ProvideApprole ¶
ProvideApprole allows to inject Approle object to the client. Use this if you want to provide the roleId and secretId from outside, and not getting them from the environment vars.
func ProvideAwsrole ¶
ProvideAwsrole allows to inject Awsrole object to the client. Use this if you want to provide the struct fields from outside, and not getting them from the environment vars.
func SetRootCA ¶
SetRootCA configures the client with specific RootCAs to trust. Use this when you work with a vault server that uses self-signed certificates.
func SetVaultAddr ¶
SetVaultAddr configures the vault server address of the client
func UseApprole ¶
func UseApprole() Option
UseApprole configures the client with the Approle auth method. Enabling this option will read the VAULT_ROLE_ID and VAULT_SECRET_ID from environment vars
func UseAwsrole ¶
func UseAwsrole() Option
UseAwsrole configures the client with the Awsrole auth method. It reads the VAULT_ROLE, VAULT_PKCS7 and VAULT_NONCE from environment vars
type VaultClient ¶
type VaultClient struct {
// contains filtered or unexported fields
}
func NewClient ¶
func NewClient(opts ...func(v *VaultClient) error) (*VaultClient, error)
NewClient creates a new Vault client. The default client is a valid one. You can configure it using functional options. Check the vault_test.go file for examples.
func (*VaultClient) LookupToken ¶
func (c *VaultClient) LookupToken() error
LookupToken performs lookup on a token (mostly to validate it)
func (*VaultClient) Read ¶
func (c *VaultClient) Read(secretPath string) (map[string]string, error)
Read reads a single secret path from the Vault
func (*VaultClient) ReadMany ¶
func (c *VaultClient) ReadMany(secretsPaths []string) (map[string]string, error)
ReadMany reads all the secretsPaths defined, returning a single map containing all the secrets. If a secret key exists in more than a single path, the secret return is from the last path specified.
func (*VaultClient) String ¶
func (c *VaultClient) String() string