Documentation ¶
Index ¶
- type VaultClient
- func (c *VaultClient) Close() error
- func (in *VaultClient) DeepCopy() *VaultClient
- func (in *VaultClient) DeepCopyInto(out *VaultClient)
- func (vc *VaultClient) DeleteSecret(ctx context.Context, p string) error
- func (vc *VaultClient) Driver() driver.DriverName
- func (vc *VaultClient) GetKVSecretOnce(ctx context.Context, s string) (map[string]interface{}, error)
- func (vc *VaultClient) GetPath() string
- func (vc *VaultClient) GetSecret(ctx context.Context, s string) ([]byte, error)
- func (vc *VaultClient) Init(ctx context.Context) error
- func (vc *VaultClient) ListSecrets(ctx context.Context, p string) ([]string, error)
- func (vc *VaultClient) ListSecretsOnce(ctx context.Context, p string) ([]string, error)
- func (vc *VaultClient) Login(ctx context.Context) error
- func (vc *VaultClient) Meta() map[string]any
- func (vc *VaultClient) NewClient(ctx context.Context) (*api.Client, error)
- func (vc *VaultClient) NewToken(ctx context.Context) error
- func (c *VaultClient) SetDefaults(defaults any) error
- func (c *VaultClient) Validate() error
- func (vc *VaultClient) WriteSecret(ctx context.Context, meta metav1.ObjectMeta, s string, bData []byte) ([]byte, error)
- func (vc *VaultClient) WriteSecretOnce(ctx context.Context, p string, s map[string]interface{}) (map[string]interface{}, error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type VaultClient ¶
type VaultClient struct { Path string `yaml:"path,omitempty" json:"path,omitempty"` Address string `yaml:"address,omitempty" json:"address,omitempty"` CIDR string `yaml:"cidr,omitempty" json:"cidr,omitempty"` AuthMethod string `yaml:"authMethod,omitempty" json:"authMethod,omitempty"` Namespace string `yaml:"namespace,omitempty" json:"namespace,omitempty"` TTL string `yaml:"ttl,omitempty" json:"ttl,omitempty"` Merge bool `yaml:"merge,omitempty" json:"merge,omitempty"` Role string `yaml:"role,omitempty" json:"role,omitempty"` Client *api.Client `yaml:"-" json:"-"` }
VaultClient is a single self-contained vault client
func NewClient ¶
func NewClient(cfg *VaultClient) (*VaultClient, error)
func (*VaultClient) Close ¶
func (c *VaultClient) Close() error
func (*VaultClient) DeepCopy ¶
func (in *VaultClient) DeepCopy() *VaultClient
DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new VaultClient.
func (*VaultClient) DeepCopyInto ¶
func (in *VaultClient) DeepCopyInto(out *VaultClient)
DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (*VaultClient) DeleteSecret ¶
func (vc *VaultClient) DeleteSecret(ctx context.Context, p string) error
DeleteSecret deletes a secret from path p
func (*VaultClient) Driver ¶
func (vc *VaultClient) Driver() driver.DriverName
func (*VaultClient) GetKVSecretOnce ¶
func (vc *VaultClient) GetKVSecretOnce(ctx context.Context, s string) (map[string]interface{}, error)
GetKVSecret retrieves a kv secret from vault
func (*VaultClient) GetPath ¶
func (vc *VaultClient) GetPath() string
func (*VaultClient) GetSecret ¶
GetKVSecret will login and retry secret access on failure to gracefully handle token expiration
func (*VaultClient) ListSecrets ¶
func (*VaultClient) ListSecretsOnce ¶
func (*VaultClient) Login ¶
func (vc *VaultClient) Login(ctx context.Context) error
Login creates a vault token with the k8s auth provider
func (*VaultClient) Meta ¶
func (vc *VaultClient) Meta() map[string]any
func (*VaultClient) NewClient ¶
NewClients creates and returns a new vault client with a valid token or error
func (*VaultClient) SetDefaults ¶
func (c *VaultClient) SetDefaults(defaults any) error
func (*VaultClient) Validate ¶
func (c *VaultClient) Validate() error
func (*VaultClient) WriteSecret ¶
func (vc *VaultClient) WriteSecret(ctx context.Context, meta metav1.ObjectMeta, s string, bData []byte) ([]byte, error)
WriteSecret will login and retry secret write on failure to gracefully handle token expiration
func (*VaultClient) WriteSecretOnce ¶
func (vc *VaultClient) WriteSecretOnce(ctx context.Context, p string, s map[string]interface{}) (map[string]interface{}, error)
WriteSecret writes a secret to Vault VaultClient at path p with secret value s