sns

package module
v1.1.1 Latest Latest
Warning

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

Go to latest
Published: May 2, 2024 License: MIT Imports: 16 Imported by: 0

Documentation

Overview

Package sns provides a notifier that subscribes to a SNS topic that watches change of configuration on AWS.

It Fanout SNS topic to Amazon SQS queues, which requires following permissions:

  • sns:Subscribe
  • sns:Unsubscribe
  • sns:CreateTopic
  • sqs:CreateQueue

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Notifier

type Notifier struct {
	// contains filtered or unexported fields
}

Notifier that watches change events on given SNS topic.

To create a new Notifier, call NewNotifier.

func NewNotifier

func NewNotifier(topic string, opts ...Option) *Notifier

NewNotifier creates a Notifier with the given SNS topic Name or ARN.

func (*Notifier) Register

func (n *Notifier) Register(loaders ...loader)

Register registers a loader to the Notifier.

func (*Notifier) Start

func (n *Notifier) Start(ctx context.Context) error

Start starts watching events on given SNS topic and fanout to registered loaders. It blocks until ctx is done, or it returns an error.

type Option

type Option func(options *options)

Option configures the Notifier with specific options.

func WithAWSConfig

func WithAWSConfig(config aws.Config) Option

WithAWSConfig provides the AWS Config for the AWS SDK.

By default, it loads the default AWS Config.

func WithLogHandler

func WithLogHandler(handler slog.Handler) Option

WithLogHandler provides the slog.Handler for logs from notifier.

By default, it uses handler from slog.Default().

Directories

Path Synopsis
internal

Jump to

Keyboard shortcuts

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