gizmo: Index | Files

package aws

import ""


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.

func WithMessageAttributes Uses

func WithMessageAttributes(ctx context.Context, msgAttrs map[string]*sns.MessageAttributeValue) context.Context

WithMessageAttributes used to add SNS Message Attributes to the context for further usage in publishing messages to sns with provided attributes

type SNSConfig Uses

type SNSConfig struct {

    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 {
    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 19 packages. Updated 2020-03-13. Refresh now. Tools for package owners.