Documentation ¶
Index ¶
- func GetEnv(env string, defaultValue string) string
- func GetEnvInt(env string, defaultValue int) int
- func PrepareSNSMessageJSON(body interface{}) (string, error)
- func RequireEnv(env string) string
- func RequireEnvFloat(env string) float64
- func RequireEnvFloatSlice(env string, sep string) []float64
- func RequireEnvInt(env string) int
- func RequireEnvStringSlice(env string, sep string) []string
- type DefaultEnvConfig
- func (cfg DefaultEnvConfig) GetEnvBoolVar(varName string, defaultValue bool) bool
- func (cfg DefaultEnvConfig) GetEnvFloatVar(varName string, defaultValue float64) float64
- func (cfg DefaultEnvConfig) GetEnvIntVar(varName string, defaultValue int) int
- func (cfg DefaultEnvConfig) GetEnvVar(varName string, defaultValue string) string
- func (cfg DefaultEnvConfig) RequireEnvIntVar(varName string) int
- func (cfg DefaultEnvConfig) RequireEnvVar(varName string) string
- type EnvConfig
- type Notificationer
- type Queue
- type S3
- func (stor S3) Download(bucket string, key string, filepath string) error
- func (stor S3) GetObject(bucket string, key string) (string, error)
- func (stor S3) GetObjectWithETag(bucket string, key string) (string, string, error)
- func (stor S3) GetTemplateObject(bucket string, key string, input interface{}) (string, string, error)
- type SNS
- type SQSQueue
- func (queue SQSQueue) DeleteMessage(input *sqs.DeleteMessageInput) (*sqs.DeleteMessageOutput, error)
- func (queue SQSQueue) NewFromEnv() error
- func (queue SQSQueue) ReceiveMessage(input *sqs.ReceiveMessageInput) (*sqs.ReceiveMessageOutput, error)
- func (queue SQSQueue) SendMessage(queueURL *string, message *string) error
- type STS
- func (service STS) AssumeRole(input *sts.AssumeRoleInput) (*sts.AssumeRoleOutput, error)
- func (service STS) NewCredentials(inputClient client.ConfigProvider, inputRole string) *credentials.Credentials
- func (service STS) NewSession(baseSession awsiface.AwsSession, roleArn string) (awsiface.AwsSession, error)
- type Storager
- type TokenService
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func GetEnv ¶
GetEnv returns an environment. The defaultValue is returned if the variable does not exist.
func PrepareSNSMessageJSON ¶
PrepareSNSMessageJSON creates a JSON message from a struct, for publising to an SNS topic
func RequireEnv ¶
RequireEnv validates and returns an environment variable's value if it exists
func RequireEnvFloat ¶
RequireEnvFloat returns an environment that is required to be an float64
func RequireEnvFloatSlice ¶
RequireEnvFloatSlice - Requires the given environment variable to contain a slice of float64
func RequireEnvInt ¶
RequireEnvInt returns an environment that is required to be an integer
func RequireEnvStringSlice ¶
RequireEnvStringSlice - Requires the given environment variable to contain a slice of string
Types ¶
type DefaultEnvConfig ¶
type DefaultEnvConfig struct{}
DefaultEnvConfig - Default configuration
func (DefaultEnvConfig) GetEnvBoolVar ¶
func (cfg DefaultEnvConfig) GetEnvBoolVar(varName string, defaultValue bool) bool
GetEnvBoolVar - Requires the environment variable with the provided varName
and panics if the variable is not present.
func (DefaultEnvConfig) GetEnvFloatVar ¶
func (cfg DefaultEnvConfig) GetEnvFloatVar(varName string, defaultValue float64) float64
GetEnvFloatVar - Requires the environment variable with the provided varName
and panics if the variable is not present
func (DefaultEnvConfig) GetEnvIntVar ¶
func (cfg DefaultEnvConfig) GetEnvIntVar(varName string, defaultValue int) int
GetEnvIntVar - Requires the environment variable with the provided varName
and panics if the variable is not present.
func (DefaultEnvConfig) GetEnvVar ¶
func (cfg DefaultEnvConfig) GetEnvVar(varName string, defaultValue string) string
GetEnvVar - Requires the environment variable with the provided varName
and panics if the variable is not present.
func (DefaultEnvConfig) RequireEnvIntVar ¶
func (cfg DefaultEnvConfig) RequireEnvIntVar(varName string) int
RequireEnvIntVar - Requires the environment variable with the provided varName
and panics if the variable is not present.
func (DefaultEnvConfig) RequireEnvVar ¶
func (cfg DefaultEnvConfig) RequireEnvVar(varName string) string
RequireEnvVar - Requires the environment variable with the provided varName
and panics if the variable is not present.
type EnvConfig ¶
type EnvConfig interface { RequireEnvVar(varName string) string RequireEnvIntVar(varName string) int GetEnvVar(varName string, defaultValue string) string GetEnvIntVar(varName string, defaultValue int) int GetEnvFloatVar(varName string, defaultValue float64) float64 }
EnvConfig - Configuration pulled from the environment.
type Notificationer ¶
type Notificationer interface {
PublishMessage(topicArn *string, message *string, isJSON bool) (*string, error)
}
Notificationer interface requires methods to interact with an AWS SNS Topic and publish a message to it
type Queue ¶
type Queue interface { SendMessage(*string, *string) error ReceiveMessage(*sqs.ReceiveMessageInput) (*sqs.ReceiveMessageOutput, error) DeleteMessage(*sqs.DeleteMessageInput) (*sqs.DeleteMessageOutput, error) NewFromEnv() error }
Queue interface requires a method to receive an SQS Message Output based on the provided SQS Message Input
type S3 ¶
type S3 struct { Client *s3.S3 Manager *s3manager.Downloader }
S3 implements the Storage interface using AWS S3 Client
func (S3) Download ¶
Download downloads an S3 Bucket object to the file path provided and returns any errors if any
func (S3) GetObject ¶
GetObject returns a string output based on the results of the retrieval of an existing object from S3
func (S3) GetObjectWithETag ¶
GetObjectWithETag returns a string output based on the results of the retrieval of an existing object from S3
type SQSQueue ¶
SQSQueue implments the Queue interface using the AWS SQS Service
func (SQSQueue) DeleteMessage ¶
func (queue SQSQueue) DeleteMessage(input *sqs.DeleteMessageInput) ( *sqs.DeleteMessageOutput, error)
DeleteMessage method returns an AWS SQS Delete Message Output based on the provided Delete Message Input through the SQS Client
func (SQSQueue) NewFromEnv ¶
NewFromEnv creates an SQS instance configured from environment variables. Requires env vars for: - AWS_CURRENT_REGION
func (SQSQueue) ReceiveMessage ¶
func (queue SQSQueue) ReceiveMessage(input *sqs.ReceiveMessageInput) ( *sqs.ReceiveMessageOutput, error)
ReceiveMessage method returns an AWS SQS Message Output based on the provided Message Input through the AWS SQS Client.
type STS ¶
STS implements the TokenService interface using AWS STS Client
func (STS) AssumeRole ¶
func (service STS) AssumeRole(input *sts.AssumeRoleInput) ( *sts.AssumeRoleOutput, error)
AssumeRole returns an STS AssumeRoleOutput struct based on the provided input through the AWS STS Client
func (STS) NewCredentials ¶
func (service STS) NewCredentials(inputClient client.ConfigProvider, inputRole string) *credentials.Credentials
NewCredentials returns a set of credentials for an Assume Role
func (STS) NewSession ¶
func (service STS) NewSession(baseSession awsiface.AwsSession, roleArn string) (awsiface.AwsSession, error)
type Storager ¶
type Storager interface { GetObject(bucket string, key string) (string, error) GetTemplateObject(bucket string, key string, input interface{}) (string, string, error) Download(bukcet string, key string, filepath string) error }
Storager interface requires a method to delete an S3 Object from a Bucket based on the provided S3 Object Input
type TokenService ¶
type TokenService interface { AssumeRole(*sts.AssumeRoleInput) (*sts.AssumeRoleOutput, error) NewCredentials(client.ConfigProvider, string) *credentials.Credentials NewSession(baseSession awsiface.AwsSession, roleArn string) (awsiface.AwsSession, error) }
TokenService interface requires a method to receive credentials for an AWS Role provided by the Role Input.