aws

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Feb 5, 2019 License: Apache-2.0 Imports: 16 Imported by: 69

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewPublisher

func NewPublisher(cfg SNSConfig) (pubsub.Publisher, error)

NewPublisher will initiate the SNS client. If no credentials are passed in with the config, the publisher is instantiated with the AWS_ACCESS_KEY and the AWS_SECRET_KEY environment variables.

func NewSubscriber

func NewSubscriber(cfg SQSConfig) (pubsub.Subscriber, error)

NewSubscriber will initiate a new Decrypter for the subscriber if a key file is provided. It will also fetch the SQS Queue Url and set up the SQS client.

Types

type SNSConfig

type SNSConfig struct {
	aws.Config

	Topic string `envconfig:"AWS_SNS_TOPIC"`
}

SNSConfig holds the info required to work with Amazon SNS.

func LoadSNSConfigFromEnv

func LoadSNSConfigFromEnv() SNSConfig

LoadSNSConfigFromEnv will attempt to load the SNSConfig struct from environment variables. If not populated, nil is returned.

type SQSConfig

type SQSConfig struct {
	aws.Config
	QueueName           string `envconfig:"AWS_SQS_NAME"`
	QueueOwnerAccountID string `envconfig:"AWS_SQS_OWNER_ACCOUNT_ID"`
	// QueueURL can be used instead of QueueName and QueueOwnerAccountID.
	// If provided, the client will skip the "GetQueueUrl" call to AWS.
	QueueURL string `envconfig:"AWS_SQS_QUEUE_URL"`
	// MaxMessages will override the DefaultSQSMaxMessages.
	MaxMessages *int64 `envconfig:"AWS_SQS_MAX_MESSAGES"`
	// TimeoutSeconds will override the DefaultSQSTimeoutSeconds.
	TimeoutSeconds *int64 `envconfig:"AWS_SQS_TIMEOUT_SECONDS"`
	// SleepInterval will override the DefaultSQSSleepInterval.
	SleepInterval *time.Duration `envconfig:"AWS_SQS_SLEEP_INTERVAL"`
	// DeleteBufferSize will override the DefaultSQSDeleteBufferSize.
	DeleteBufferSize *int `envconfig:"AWS_SQS_DELETE_BUFFER_SIZE"`
	// ConsumeBase64 is a flag to signal the subscriber to base64 decode the payload
	// before returning it. If it is not set in the config, the flag will default
	// to 'true'.
	ConsumeBase64 *bool `envconfig:"AWS_SQS_CONSUME_BASE64"`
}

SQSConfig holds the info required to work with Amazon SQS

func LoadSQSConfigFromEnv

func LoadSQSConfigFromEnv() SQSConfig

LoadSQSConfigFromEnv will attempt to load the SQSConfig struct from environment variables. If not populated, nil is returned.

Jump to

Keyboard shortcuts

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