Documentation ¶
Index ¶
- Variables
- type Approle
- type ApproleLoginInput
- type Auth
- type Client
- func (v *Client) CreateToken(roleId, secretId string) string
- func (v *Client) ExtendedValidate() error
- func (v *Client) FetchSecret(token, path, selector string) string
- func (v *Client) ParseFile(roleId, secretId, vaultPath, file string)
- func (v *Client) RenewToken(token string) string
- func (v *Client) RevokeToken(token string)
- func (v *Client) Setup()
- func (v *Client) Validate() error
- func (v *Client) ValidateCreateToken() error
- func (v *Client) ValidateFetchSecret() error
- func (v *Client) ValidateParseFile() error
- func (v *Client) ValidateRenewToken() error
- func (v *Client) ValidateRevokeToken() error
- type Response
- type Secret
- type SystemHealth
- type Token
- type VaultClientErrors
Constants ¶
This section is empty.
Variables ¶
var ( AuthTokenRenewSelfLocation = "/auth/token/renew-self" AuthTokenRevokeSelfLocation = "/auth/token/revoke-self" )
var ( TLSHandshakeTimeout = 10 ResponseHeaderTimeout = 20 ExpectContinueTimeout = 10 KeepAlive = 3 LeftTemplateDelim = `((` RightTemplateDelim = `))` )
var (
AuthApproleLoginLocation = "/auth/approle/login"
)
var (
SysHealthLocation = "/sys/health"
)
Functions ¶
This section is empty.
Types ¶
type ApproleLoginInput ¶
type Auth ¶
type Auth struct { ClientToken string `json:"client_token"` Accessor string `json:"accessor"` Policies []string `json:"policies"` TokenPolicies []string `json:"token_policies,omitempty"` IdentityPolicies []string `json:"identity_policies,omitempty"` Metadata map[string]string `json:"metadata"` LeaseDuration int `json:"lease_duration"` Renewable bool `json:"renewable"` EntityID string `json:"entity_id"` Approle Approle Token Token }
type Client ¶
type Client struct { Address string RoleId string SecretId string Token string Path string File string Selector string Insecure bool SystemHealth SystemHealth Auth Auth Secret Secret // contains filtered or unexported fields }
A client represents a go-resty based HTTP client that interacts with the vault API
func NewVaultClient ¶
Creates, validates, and initializes a new Client with specified params
func (*Client) CreateToken ¶
Given the role id and secret id,
func (*Client) ExtendedValidate ¶
Extended validate is broken out separately here since it makes HTTP calls to vault Note that we expect vault to be initialized, unsealed, and the active node to continue.
func (*Client) FetchSecret ¶
func (*Client) RenewToken ¶
func (*Client) RevokeToken ¶
func (*Client) Setup ¶
func (v *Client) Setup()
Sets up the go-resty client to interact with the vault API service. We do set some defaults for retry count/wait/max, and our own custom HTTP.Transport so we can ignore self-signed SSL certs if required. We also add a few retry conditions if vault is having issues or over-loaded.
func (*Client) ValidateCreateToken ¶
func (*Client) ValidateFetchSecret ¶
func (*Client) ValidateParseFile ¶
func (*Client) ValidateRenewToken ¶
func (*Client) ValidateRevokeToken ¶
type Secret ¶
type SystemHealth ¶
type SystemHealth struct { Initialized bool `json:"initialized"` Sealed bool `json:"sealed"` Standby bool `json:"standby"` }
func (*SystemHealth) GetInitialized ¶
func (i *SystemHealth) GetInitialized() bool
func (*SystemHealth) GetSealed ¶
func (i *SystemHealth) GetSealed() bool
func (*SystemHealth) GetStandby ¶
func (i *SystemHealth) GetStandby() bool
func (*SystemHealth) Ready ¶
func (i *SystemHealth) Ready() bool
func (*SystemHealth) Reload ¶
func (i *SystemHealth) Reload(v *Client) *SystemHealth
type VaultClientErrors ¶
type VaultClientErrors struct {
Errors []string `json:"errors"`
}
When vault emits errors, we marshal them to this struct so it's easier to print out
func (*VaultClientErrors) Error ¶
func (i *VaultClientErrors) Error() string