loader

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Apr 2, 2024 License: MIT Imports: 35 Imported by: 0

Documentation

Index

Constants

View Source
const (
	VaultAwsAuthTypeIAM = iota + 1
	VaultAwsAuthTypeEC2
)
View Source
const (
	VaultAwsAuthSignatureIdentity = iota + 1
	VaultAwsAuthSignaturePKCS7
	VaultAwsAuthSignatureRSA2048
)
View Source
const (
	VaultGcpAuthTypeGCE = iota + 1
	VaultGcpAuthTypeIAM
)

Variables

This section is empty.

Functions

func GetEnvVars added in v0.2.0

func GetEnvVars() model.Values

func NewAutoDetect

func NewAutoDetect(opts AutoDetectOptions) model.Loader

NewAutoDetect tries to create a new loader based on the origin type, like a file or Hashicorp Vault

Types

type AutoDetectOptions

type AutoDetectOptions struct {
	// CmdLine specifies if command line parameters are checked in first place
	CmdLine struct {
		Check bool
		// Long is the long version of the command line parameter. Defaults to --settings
		Long string
		// Short is the short version of the command line parameter. Defaults to -S
		Short string
	}

	// EnvVar is the environment variable that contains a file or url of the configuration settings
	EnvVar string

	// TlsEnvVar can specify and override where to look for client side certificates
	TlsEnvVar TlsEnvVarNames
}

AutoDetectOptions indicates the behavior of the auto-detect module

type Callback

type Callback struct {
	// contains filtered or unexported fields
}

Callback wraps content to be loaded from a callback function

func NewCallback

func NewCallback() *Callback

NewCallback create a new callback loader

func (*Callback) Load

func (l *Callback) Load(ctx context.Context) (model.Values, error)

Load loads the content from the callback

func (*Callback) WithCallback

func (l *Callback) WithCallback(callback CallbackFunc) *Callback

WithCallback sets the callback function

type CallbackFunc

type CallbackFunc func(ctx context.Context) (model.Values, error)

type File

type File struct {
	// contains filtered or unexported fields
}

File wraps content to be loaded from a file on disk

func NewFile

func NewFile() *File

NewFile create a new file loader

func NewFileFromCommandLine

func NewFileFromCommandLine(CmdLineParameter *string, CmdLineParameterShort *string) *File

NewFileFromCommandLine create a new file loader from a command line parameter

func NewFileFromEnvironmentVariable

func NewFileFromEnvironmentVariable(Name string) *File

NewFileFromEnvironmentVariable create a new file loader from an environment variable

func (*File) Load

func (l *File) Load(_ context.Context) (model.Values, error)

Load loads the content from the file NOTE: We are not making use of the context assuming configuration files will be small and on a local disk

func (*File) WithFilename

func (l *File) WithFilename(filename string) *File

WithFilename sets the file name

type Http

type Http struct {
	// contains filtered or unexported fields
}

Http wraps content to be loaded from a URL

func NewHttp

func NewHttp() *Http

NewHttp create a new web loader

func (*Http) Load

func (l *Http) Load(ctx context.Context) (model.Values, error)

Load loads the content from the web

func (*Http) WithCredentials

func (l *Http) WithCredentials(username string, password string) *Http

WithCredentials sets the username and password

func (*Http) WithDefaultTLS

func (l *Http) WithDefaultTLS() *Http

WithDefaultTLS sets a default tls.Config object

func (*Http) WithHeaderItem

func (l *Http) WithHeaderItem(key string, value string) *Http

WithHeaderItem sets a single request header

func (*Http) WithHeaders

func (l *Http) WithHeaders(headers map[string]string) *Http

WithHeaders sets the request headers

func (*Http) WithHost

func (l *Http) WithHost(host string) *Http

WithHost sets the host address and, optionally, the port

func (*Http) WithPath

func (l *Http) WithPath(path string) *Http

WithPath sets the resource path

func (*Http) WithQuery

func (l *Http) WithQuery(query map[string][]string) *Http

WithQuery sets the query parameters

func (*Http) WithQueryItem

func (l *Http) WithQueryItem(key string, values []string) *Http

WithQueryItem sets a single query parameter

func (*Http) WithTLS

func (l *Http) WithTLS(tlsConfig *tls.Config) *Http

WithTLS sets a tls.Config object

func (*Http) WithURL

func (l *Http) WithURL(rawURL string) *Http

WithURL sets the host, port, path and other settings from the provided url

type Memory

type Memory struct {
	// contains filtered or unexported fields
}

Memory wraps content to be loaded from a string

func NewMemory

func NewMemory() *Memory

NewMemory create a new memory data loader

func NewMemoryFromEnvironmentVariable

func NewMemoryFromEnvironmentVariable(Name string) *Memory

NewMemoryFromEnvironmentVariable create a new memory data loader from an environment variable

func (*Memory) Load

func (l *Memory) Load(_ context.Context) (model.Values, error)

Load loads the content from the file

func (*Memory) WithData

func (l *Memory) WithData(data model.Values) *Memory

WithData sets the data to return when the content is loaded

type TlsEnvVarNames

type TlsEnvVarNames struct {
	CaCert     string // Defaults to SSL_CA_CERT environment variable
	ClientCert string // Defaults to SSL_CLIENT_CERT environment variable
	ClientKey  string // Defaults to SSL_CLIENT_KEY environment variable
}

TlsEnvVarNames establishes environment variables to look for client certificates for http requests

type Vault

type Vault struct {
	// contains filtered or unexported fields
}

Vault wraps content to be loaded from a Hashicorp Vault instance

func NewVault

func NewVault() *Vault

NewVault create a new Hashicorp Vault loader

func (*Vault) Load

func (l *Vault) Load(ctx context.Context) (model.Values, error)

Load loads the content from Vault

func (*Vault) WithAccessToken

func (l *Vault) WithAccessToken(token string) *Vault

WithAccessToken sets the access token to use as authorization

func (*Vault) WithAuth

func (l *Vault) WithAuth(auth VaultAuthMethod) *Vault

WithAuth sets the authorization method to use

func (*Vault) WithDefaultTLS

func (l *Vault) WithDefaultTLS() *Vault

WithDefaultTLS sets a default tls.Config object

func (*Vault) WithHeaderItem

func (l *Vault) WithHeaderItem(key string, value string) *Vault

WithHeaderItem sets a single request header

func (*Vault) WithHeaders

func (l *Vault) WithHeaders(headers map[string]string) *Vault

WithHeaders sets the request headers

func (*Vault) WithHost

func (l *Vault) WithHost(host string) *Vault

WithHost sets the host address and, optionally, the port

func (*Vault) WithPath

func (l *Vault) WithPath(path string) *Vault

WithPath sets the path

func (*Vault) WithTLS

func (l *Vault) WithTLS(tlsConfig *tls.Config) *Vault

WithTLS sets a tls.Config object

func (*Vault) WithURL

func (l *Vault) WithURL(rawURL string) *Vault

WithURL sets the host, port, path and other settings from the provided url

type VaultAppRoleAuth

type VaultAppRoleAuth struct {
	// contains filtered or unexported fields
}

VaultAppRoleAuth contains the options to access vault with the AppRole authentication mechanism

func NewVaultAppRoleAuthMethod

func NewVaultAppRoleAuthMethod() *VaultAppRoleAuth

NewVaultAppRoleAuthMethod creates a new AppRole authentication method helper

func (*VaultAppRoleAuth) WithMountPath

func (a *VaultAppRoleAuth) WithMountPath(mountPath string) *VaultAppRoleAuth

WithMountPath sets an optional mount path. Defaults to approle

func (*VaultAppRoleAuth) WithRoleId

func (a *VaultAppRoleAuth) WithRoleId(roleId string) *VaultAppRoleAuth

WithRoleId sets the role id

func (*VaultAppRoleAuth) WithSecretId

func (a *VaultAppRoleAuth) WithSecretId(secretId string) *VaultAppRoleAuth

WithSecretId sets the secret id

func (*VaultAppRoleAuth) WithSecretUnwrap

func (a *VaultAppRoleAuth) WithSecretUnwrap(unwrap interface{}) *VaultAppRoleAuth

WithSecretUnwrap specifies if the secret must be unwrapped

type VaultAuthMethod

type VaultAuthMethod interface {
	// contains filtered or unexported methods
}

VaultAuthMethod is an interface used to set up an authentication mechanism

type VaultAwsAuth

type VaultAwsAuth struct {
	// contains filtered or unexported fields
}

VaultAwsAuth contains the options to access vault with the AWS authentication mechanism

func NewVaultAwsAuthMethod

func NewVaultAwsAuthMethod() *VaultAwsAuth

NewVaultAwsAuthMethod creates a new AWS authentication method helper

func (*VaultAwsAuth) WithIamServerID

func (a *VaultAwsAuth) WithIamServerID(id string) *VaultAwsAuth

WithIamServerID sets the server id header when authenticating as IAM

func (*VaultAwsAuth) WithIdentitySignature

func (a *VaultAwsAuth) WithIdentitySignature() *VaultAwsAuth

WithIdentitySignature tells the client to use the cryptographic identity document signature to verify EC2 auth logins

func (*VaultAwsAuth) WithMountPath

func (a *VaultAwsAuth) WithMountPath(mountPath string) *VaultAwsAuth

WithMountPath sets an optional mount path. Defaults to aws

func (*VaultAwsAuth) WithNonce

func (a *VaultAwsAuth) WithNonce(nonce string) *VaultAwsAuth

WithNonce sets nonce to use. Defaults to generate a random uuid

func (*VaultAwsAuth) WithPKCS7Signature

func (a *VaultAwsAuth) WithPKCS7Signature() *VaultAwsAuth

WithPKCS7Signature tells the client to use the PKCS #7 signature to verify EC2 auth logins

func (*VaultAwsAuth) WithRSA2048Signature

func (a *VaultAwsAuth) WithRSA2048Signature() *VaultAwsAuth

WithRSA2048Signature tells the client to use the RSA 2048 signature to verify EC2 auth logins

func (*VaultAwsAuth) WithRegion

func (a *VaultAwsAuth) WithRegion(region string) *VaultAwsAuth

WithRegion sets the region to use. Defaults to us-east-1

func (*VaultAwsAuth) WithRole

func (a *VaultAwsAuth) WithRole(role string) *VaultAwsAuth

WithRole sets the role

func (*VaultAwsAuth) WithSignature

func (a *VaultAwsAuth) WithSignature(signature interface{}) *VaultAwsAuth

WithSignature tells the client which type of signature to use when verifying EC2 auth logins

func (*VaultAwsAuth) WithType

func (a *VaultAwsAuth) WithType(_type interface{}) *VaultAwsAuth

WithType sets the authentication type IAM or EC2

func (*VaultAwsAuth) WithTypeEC2

func (a *VaultAwsAuth) WithTypeEC2() *VaultAwsAuth

WithTypeEC2 sets the authentication type as EC2

func (*VaultAwsAuth) WithTypeIAM

func (a *VaultAwsAuth) WithTypeIAM() *VaultAwsAuth

WithTypeIAM sets the authentication type as IAM

type VaultAzureAuth

type VaultAzureAuth struct {
	// contains filtered or unexported fields
}

VaultAzureAuth contains the options to access vault with the Azure authentication mechanism

func NewVaultAzureAuthMethod

func NewVaultAzureAuthMethod() *VaultAzureAuth

NewVaultAzureAuthMethod creates a new Azure authentication method helper

func (*VaultAzureAuth) WithMountPath

func (a *VaultAzureAuth) WithMountPath(mountPath string) *VaultAzureAuth

WithMountPath sets an optional mount path. Defaults to azure

func (*VaultAzureAuth) WithResource

func (a *VaultAzureAuth) WithResource(url string) *VaultAzureAuth

WithResource sets an optional different resource URL. Defaults to Azure Public Cloud's ARM URL

func (*VaultAzureAuth) WithRole

func (a *VaultAzureAuth) WithRole(role string) *VaultAzureAuth

WithRole sets the role

type VaultGcpAuth

type VaultGcpAuth struct {
	// contains filtered or unexported fields
}

VaultGcpAuth contains the options to access vault with the GCP authentication mechanism

func NewVaultGcpAuthMethod

func NewVaultGcpAuthMethod() *VaultGcpAuth

NewVaultGcpAuthMethod creates a new GCP authentication method helper

func (*VaultGcpAuth) WithIamServiceAccountEmail

func (a *VaultGcpAuth) WithIamServiceAccountEmail(email string) *VaultGcpAuth

WithIamServiceAccountEmail sets the service account email for IAM authentication type

func (*VaultGcpAuth) WithMountPath

func (a *VaultGcpAuth) WithMountPath(mountPath string) *VaultGcpAuth

WithMountPath sets an optional mount path. Defaults to gcp

func (*VaultGcpAuth) WithRole

func (a *VaultGcpAuth) WithRole(role string) *VaultGcpAuth

WithRole sets the role

func (*VaultGcpAuth) WithType

func (a *VaultGcpAuth) WithType(_type interface{}) *VaultGcpAuth

WithType sets the authentication type IAM or EC2

func (*VaultGcpAuth) WithTypeGCE

func (a *VaultGcpAuth) WithTypeGCE() *VaultGcpAuth

WithTypeGCE sets the authentication type as GCE

func (*VaultGcpAuth) WithTypeIAM

func (a *VaultGcpAuth) WithTypeIAM() *VaultGcpAuth

WithTypeIAM sets the authentication type as IAM

type VaultKubernetesAuth

type VaultKubernetesAuth struct {
	// contains filtered or unexported fields
}

VaultKubernetesAuth contains the options to access vault with the Kubernetes authentication mechanism

func NewVaultKubernetesAuthMethod

func NewVaultKubernetesAuthMethod() *VaultKubernetesAuth

NewVaultKubernetesAuthMethod creates a new Kubernetes authentication method helper

func (*VaultKubernetesAuth) WithAccountToken

func (a *VaultKubernetesAuth) WithAccountToken(token string) *VaultKubernetesAuth

WithAccountToken sets the account access token

func (*VaultKubernetesAuth) WithMountPath

func (a *VaultKubernetesAuth) WithMountPath(mountPath string) *VaultKubernetesAuth

WithMountPath sets an optional mount path. Defaults to kubernetes

func (*VaultKubernetesAuth) WithRole

func (a *VaultKubernetesAuth) WithRole(role string) *VaultKubernetesAuth

WithRole sets the role

type VaultLdapAuth

type VaultLdapAuth struct {
	// contains filtered or unexported fields
}

VaultLdapAuth contains the options to access vault with the LDAP authentication mechanism

func NewVaultLdapAuthMethod

func NewVaultLdapAuthMethod() *VaultLdapAuth

NewVaultLdapAuthMethod creates a new LDAP authentication method helper

func (*VaultLdapAuth) WithMountPath

func (a *VaultLdapAuth) WithMountPath(mountPath string) *VaultLdapAuth

WithMountPath sets an optional mount path. Defaults to ldap

func (*VaultLdapAuth) WithPassword

func (a *VaultLdapAuth) WithPassword(password string) *VaultLdapAuth

WithPassword sets the access password

func (*VaultLdapAuth) WithUsername

func (a *VaultLdapAuth) WithUsername(userName string) *VaultLdapAuth

WithUsername sets the username

Jump to

Keyboard shortcuts

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