Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type MultipleUpstreamVariableSource ¶
type MultipleUpstreamVariableSource struct {
// contains filtered or unexported fields
}
MultipleUpstreamVariableSource is a VariableSource with multiple possible upstreams
func NewMultipleUpstreamVariableSource ¶
func NewMultipleUpstreamVariableSource(opts ...Option) *MultipleUpstreamVariableSource
NewMultipleUpstreamVariableSource is the MultipleUpstreamVariableSource constructor. It returns a newly-initialized MultipleUpstreamVariableSource with all the given upstream sources set.
func (*MultipleUpstreamVariableSource) GetVariable ¶
func (vs *MultipleUpstreamVariableSource) GetVariable(ctx context.Context, varDefn string) (string, error)
GetVariable takes a single variable definition and returns the variable's value i.e. fetches the variable's value based on the variable definition.
Note that variables that begin with one of the prefixes can have fetching from upstream escaped using backslash ('\') e.g.: - from:aws:ssm:/my/path --> agdkylfuiaoeifas (value in ssm was fetched) - \from:aws:ssm:/my/path --> from:aws:ssm:/my/path - \\from:aws:ssm:/my/path --> \from:aws:ssm:/my/path
func (*MultipleUpstreamVariableSource) GetVariables ¶
func (vs *MultipleUpstreamVariableSource) GetVariables(ctx context.Context, vars map[string]string) (map[string]string, error)
GetVariables takes a map of variable names to variable definitions and returns a map of variable name to variable values. i.e. returns fetches the variable values based on the variable definitions and returns the same map populated with values instead of definitions.
type Option ¶
type Option func(muvs *MultipleUpstreamVariableSource)
Option represents a constructor option to set configuration settings (e.g. an entry in the upstreams map) for a new MultipleUpstreamVariableSource
func WithAWSSSMVariableUpstream ¶
func WithAWSSSMVariableUpstream() Option
WithAWSSSMVariableUpstream is the Option to set the aws ssm parameter store upstream source in a new MultipleUpstreamVariableSource
func WithAWSSecretsManagerVariableUpstream ¶
func WithAWSSecretsManagerVariableUpstream() Option
WithAWSSecretsManagerVariableUpstream is the Option to set the aws secrets manager upstream source in a new MultipleUpstreamVariableSource
func WithEnvVariableUpstream ¶
func WithEnvVariableUpstream() Option
WithEnvVariableUpstream is the Option to set the environment variable upstream source in a new MultipleUpstreamVariableSource
func WithFileVariableUpstream ¶
func WithFileVariableUpstream() Option
WithFileVariableUpstream is the Option to set the file contents source in a new MultipleUpstreamVariableSource
func WithTopLevelPrefix ¶
WithTopLevelPrefix is the Option to set the top level prefix string.
type VariableSource ¶
type VariableSource interface { // GetVariables takes a map of variable-name to variable-definition // and returns a map of variable-name to variable-value. i.e. returns // the same map except that the variable definitions are replaced with // the actual variable values. // // For example: // { // "DB_USERNAME": "from:env:DB_USERNAME", // "DB_PASSWORD": "from:file:~/.creds/password.txt", // } // would be translated to: // { // "DB_USERNAME": "database-user-xyz", // "DB_PASSWORD": "df29^%qd3gs8&*&(asd8t\tqe=", // } GetVariables(ctx context.Context, vars map[string]string) (map[string]string, error) GetVariable(ctx context.Context, varDefn string) (string, error) }
VariableSource represents the necessary functionality of a source of variables.
func NewDefaultVariableSource ¶
func NewDefaultVariableSource() VariableSource
NewDefaultVariableSource returns the default VariableSource implementation.