Documentation
¶
Index ¶
- func DefaultSecretStringDecoder(v string) (data []byte, err error)
- type Variable
- func Env(key string) Variable[string]
- func EnvAs[T any](key string, m func(string) (T, error)) Variable[T]
- func Getenv(key string) Variable[string]
- func GetenvAs[T any](key string, m func(string) (T, error)) Variable[T]
- func Map[In any, Out any](v Variable[In], m func(In) (Out, error)) Variable[Out]
- func ParameterAs[T any](input *ssm.GetParameterInput, m func(*string) (T, error)) Variable[T]
- func ParameterBinary(input *ssm.GetParameterInput, decodeString func(string) ([]byte, error)) Variable[[]byte]
- func ParameterString(input *ssm.GetParameterInput) Variable[string]
- func SecretAs[T any](input *secretsmanager.GetSecretValueInput, ...) Variable[T]
- func SecretBinary(input *secretsmanager.GetSecretValueInput) Variable[[]byte]
- func SecretBinaryWithDecoder(input *secretsmanager.GetSecretValueInput, ...) Variable[[]byte]
- func SecretString(input *secretsmanager.GetSecretValueInput) Variable[string]
- func WithBase64Encoding(v Variable[string], encoding *base64.Encoding) Variable[[]byte]
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func DefaultSecretStringDecoder ¶
DefaultSecretStringDecoder attempts to decode the string first with base64.RawStdEncoding, then with hex.DecodeString, and as a fallback, converts the string to []byte.
Types ¶
type Variable ¶
type Variable[T any] interface { Get() (T, error) GetWithContext(ctx context.Context) (T, error) MustGet() T MustGetWithContext(ctx context.Context) T }
Variable defines ways to retrieve a variable.
func Env ¶
Env calls os.Getenv and returns that value in subsequent calls.
See Getenv if you need something that calls os.Getenv on every invocation.
func EnvAs ¶
EnvAs calls os.Getenv, decodes with m, then returns that value in subsequent calls.
See GetenvAs if you need something that calls os.Getenv on every invocation.
func Getenv ¶
Getenv calls os.Getenv on every invocation and returns its value.
Most of the time, Env suffices because environment variables are not updated that often. Use Getenv if you have a use case where the environment variables might be updated by some other processes.
func GetenvAs ¶
GetenvAs calls os.Getenv on every invocation, decodes with m, and returns its value.
Most of the time, EnvAs suffices because environment variables are not updated that often. Use GetenvAs if you have a use case where the environment variables might be updated by some other processes.
func Map ¶
Map provides a way to transform the original variable into another type.
Useful if you're getting base64-encoded strings from either environment variables or AWS ParameterAs Store and Secrets Manager Lambda extension.
func ParameterAs ¶
ParameterAs creates a Parameter Store Variable of type T that retrieves from the AWS Parameter and Secrets Lambda extension.
Function m is passed the Value from the ssm.GetParameterOutput.Parameter.
func ParameterBinary ¶
func ParameterBinary(input *ssm.GetParameterInput, decodeString func(string) ([]byte, error)) Variable[[]byte]
ParameterBinary creates a ParameterAs Store binary Variable that retrieves from the AWS Parameter and Secrets Lambda extension.
func ParameterString ¶
func ParameterString(input *ssm.GetParameterInput) Variable[string]
ParameterString creates a string Parameter Store Variable that retrieves from the AWS Parameter and Secrets Lambda extension.
func SecretAs ¶
func SecretAs[T any](input *secretsmanager.GetSecretValueInput, m func(secretBinary []byte, secretString *string) (T, error)) Variable[T]
SecretAs creates a Secrets Manager Variable of type T that retrieves from the AWS Parameter and Secrets Lambda extension.
Function m is passed both the SecretBinary and SecretString of secretsmanager.GetSecretValueOutput.
func SecretBinary ¶
func SecretBinary(input *secretsmanager.GetSecretValueInput) Variable[[]byte]
SecretBinary creates a binary Secrets Manager Variable that retrieves from the AWS Parameter and Secrets Lambda extension.
If the SecretBinary is not available but the SecretString is, DefaultSecretStringDecoder is used to decode the SecretString from secretsmanager.GetSecretValueOutput.
func SecretBinaryWithDecoder ¶
func SecretBinaryWithDecoder(input *secretsmanager.GetSecretValueInput, decodeString func(secretString string) ([]byte, error)) Variable[[]byte]
SecretBinaryWithDecoder creates a binary Secrets Manager Variable that retrieves from the AWS Parameter and Secrets Lambda extension.
If the SecretBinary is not available but the SecretString is, the given decodeString argument is used.
func SecretString ¶
func SecretString(input *secretsmanager.GetSecretValueInput) Variable[string]
SecretString creates a string Secrets Manager Variable that retrieves from the AWS Parameter and Secrets Lambda extension.