gizmo: github.com/NYTimes/gizmo/pubsub/aws Index | Files

package aws

import "github.com/NYTimes/gizmo/pubsub/aws"

Index

Package Files

aws.go config.go

func NewPublisher Uses

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 Uses

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.

type SNSConfig Uses

type SNSConfig struct {
    aws.Config

    Topic string `envconfig:"AWS_SNS_TOPIC"`
}

SNSConfig holds the info required to work with Amazon SNS.

func LoadSNSConfigFromEnv Uses

func LoadSNSConfigFromEnv() SNSConfig

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

type SQSConfig Uses

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 Uses

func LoadSQSConfigFromEnv() SQSConfig

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

Package aws imports 17 packages (graph) and is imported by 11 packages. Updated 2019-03-11. Refresh now. Tools for package owners.