Documentation
¶
Index ¶
- func GetAzureDynamicCredentials(ctx context.Context, client *vault.Client, azure_role string) (map[string]interface{}, error)
- func GetKVSecret(ctx context.Context, client *vault.Client, path, mount string) (map[string]interface{}, error)
- func LegacyVaultClient(ctx context.Context, config *VaultConfig) (*vault.Client, error)
- func VaultValidateConfig(config *VaultConfig) error
- type AppRoleAuthenticator
- type ConfigLoader
- type Credentials
- type VaultAuthenticator
- type VaultClient
- func (vc *VaultClient) GetAzureDynamicCredentials(ctx context.Context, azureRole string) (map[string]interface{}, error)
- func (vc *VaultClient) GetKVSecret(ctx context.Context, path, mount string) (map[string]interface{}, error)
- func (vc *VaultClient) GetKVSecretList(ctx context.Context, path, mount string) ([]string, error)
- func (vc *VaultClient) SetToken(token string) error
- type VaultClientInterface
- type VaultConfig
- type ViperConfigLoader
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func GetKVSecret ¶
func LegacyVaultClient ¶ added in v1.3.9
LegacyVaultClient maintains backward compatibility with the old function signature
func VaultValidateConfig ¶
func VaultValidateConfig(config *VaultConfig) error
validateConfig validates the loaded configuration.
Types ¶
type AppRoleAuthenticator ¶ added in v1.3.9
type AppRoleAuthenticator struct{}
AppRoleAuthenticator implements authentication using AppRole
func (*AppRoleAuthenticator) Authenticate ¶ added in v1.3.9
func (a *AppRoleAuthenticator) Authenticate(ctx context.Context, client *vault.Client, config *VaultConfig) error
AppRoleAuthenticator implements VaultAuthenticator interface
type ConfigLoader ¶ added in v1.3.9
type ConfigLoader interface {
LoadConfig() (*VaultConfig, error)
}
ConfigLoader interface allows for dependency injection of configuration loading
type Credentials ¶ added in v1.3.9
type VaultAuthenticator ¶ added in v1.3.9
type VaultAuthenticator interface {
Authenticate(ctx context.Context, client *vault.Client, config *VaultConfig) error
}
VaultAuthenticator interface for authentication strategies
type VaultClient ¶
type VaultClient struct {
// contains filtered or unexported fields
}
VaultClient wraps the actual Vault client and implements VaultClientInterface
func CreateVaultClient ¶ added in v1.3.9
func CreateVaultClient(ctx context.Context, config *VaultConfig) (*VaultClient, error)
CreateVaultClient is a convenience function that uses AppRole authentication
func NewVaultClient ¶ added in v1.3.9
func NewVaultClient(ctx context.Context, config *VaultConfig, authenticator VaultAuthenticator) (*VaultClient, error)
NewVaultClient creates a new Vault client with the given configuration and authenticator
func (*VaultClient) GetAzureDynamicCredentials ¶ added in v1.3.9
func (*VaultClient) GetKVSecret ¶ added in v1.3.9
func (vc *VaultClient) GetKVSecret(ctx context.Context, path, mount string) (map[string]interface{}, error)
VaultClient methods implementing VaultClientInterface
func (*VaultClient) GetKVSecretList ¶ added in v1.3.9
func (*VaultClient) SetToken ¶ added in v1.3.9
func (vc *VaultClient) SetToken(token string) error
type VaultClientInterface ¶ added in v1.3.9
type VaultClientInterface interface {
GetKVSecret(ctx context.Context, path, mount string) (map[string]interface{}, error)
GetKVSecretList(ctx context.Context, path, mount string) ([]string, error)
GetAzureDynamicCredentials(ctx context.Context, azureRole string) (map[string]interface{}, error)
SetToken(token string) error
}
VaultClientInterface defines the interface for Vault operations
type VaultConfig ¶
type VaultConfig struct {
VaultAddress string `mapstructure:"vaultaddress"`
Credentials Credentials `mapstructure:"credentials"`
}
func VaultLoadConfig ¶
func VaultLoadConfig() (*VaultConfig, error)
VaultLoadConfig is a convenience function that uses the default ViperConfigLoader
type ViperConfigLoader ¶ added in v1.3.9
type ViperConfigLoader struct{}
ViperConfigLoader implements configuration loading using Viper
func (*ViperConfigLoader) LoadConfig ¶ added in v1.3.9
func (v *ViperConfigLoader) LoadConfig() (*VaultConfig, error)
ViperConfigLoader implements ConfigLoader interface