vault

package
v0.0.0-...-9009645 Latest Latest
Warning

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

Go to latest
Published: Dec 9, 2024 License: MIT Imports: 10 Imported by: 0

Documentation

Index

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

func (vc *VaultClient) GetSecret(ctx context.Context, s string) ([]byte, error)

GetKVSecret will login and retry secret access on failure to gracefully handle token expiration

func (*VaultClient) Init

func (vc *VaultClient) Init(ctx context.Context) error

func (*VaultClient) ListSecrets

func (vc *VaultClient) ListSecrets(ctx context.Context, p string) ([]string, error)

func (*VaultClient) ListSecretsOnce

func (vc *VaultClient) ListSecretsOnce(ctx context.Context, p string) ([]string, error)

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

func (vc *VaultClient) NewClient(ctx context.Context) (*api.Client, error)

NewClients creates and returns a new vault client with a valid token or error

func (*VaultClient) NewToken

func (vc *VaultClient) NewToken(ctx context.Context) 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

Jump to

Keyboard shortcuts

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