sns

package
v0.15.2 Latest Latest
Warning

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

Go to latest
Published: Feb 22, 2024 License: MIT Imports: 18 Imported by: 0

Documentation

Index

Constants

View Source
const (
	MaxBatchSize      = 10
	MetadataKeyTopics = "cloud.aws.sns.topics"
)

Variables

This section is empty.

Functions

func CreateTopic

func CreateTopic(ctx context.Context, logger log.Logger, client Client, topicName string) (string, error)

func GetTopicName

func GetTopicName(config cfg.Config, topicSettings TopicNameSettingsAware) (string, error)

func IsValidAttributeName

func IsValidAttributeName(name string) bool

func NewClient

func NewClient(ctx context.Context, config cfg.Config, logger log.Logger, name string, optFns ...ClientOption) (*sns.Client, error)

func NewTopic

func NewTopic(ctx context.Context, config cfg.Config, logger log.Logger, settings *TopicSettings) (*snsTopic, error)

func NewTopicWithInterfaces

func NewTopicWithInterfaces(logger log.Logger, client Client, topicArn string) *snsTopic

func ProvideClient

func ProvideClient(ctx context.Context, config cfg.Config, logger log.Logger, name string, optFns ...ClientOption) (*sns.Client, error)

Types

type Client

type Client interface {
	CreateTopic(ctx context.Context, params *sns.CreateTopicInput, optFns ...func(options *sns.Options)) (*sns.CreateTopicOutput, error)
	GetSubscriptionAttributes(ctx context.Context, params *sns.GetSubscriptionAttributesInput, optFns ...func(*sns.Options)) (*sns.GetSubscriptionAttributesOutput, error)
	ListSubscriptionsByTopic(ctx context.Context, params *sns.ListSubscriptionsByTopicInput, optFns ...func(*sns.Options)) (*sns.ListSubscriptionsByTopicOutput, error)
	Publish(ctx context.Context, params *sns.PublishInput, optFns ...func(options *sns.Options)) (*sns.PublishOutput, error)
	PublishBatch(ctx context.Context, input *sns.PublishBatchInput, optFns ...func(options *sns.Options)) (*sns.PublishBatchOutput, error)
	Subscribe(ctx context.Context, params *sns.SubscribeInput, optFns ...func(options *sns.Options)) (*sns.SubscribeOutput, error)
	Unsubscribe(ctx context.Context, params *sns.UnsubscribeInput, optFns ...func(*sns.Options)) (*sns.UnsubscribeOutput, error)
}

type ClientConfig

type ClientConfig struct {
	Settings    ClientSettings
	LoadOptions []func(options *awsCfg.LoadOptions) error
}

func (ClientConfig) GetLoadOptions

func (c ClientConfig) GetLoadOptions() []func(options *awsCfg.LoadOptions) error

func (ClientConfig) GetRetryOptions

func (c ClientConfig) GetRetryOptions() []func(*retry.StandardOptions)

func (ClientConfig) GetSettings

func (c ClientConfig) GetSettings() gosoAws.ClientSettings

type ClientOption

type ClientOption func(cfg *ClientConfig)

type ClientSettings

type ClientSettings struct {
	gosoAws.ClientSettings
}

type Message

type Message struct {
	Type      string
	TopicArn  string
	MessageId string
	Message   string
}

func (Message) MarshalToBytes

func (m Message) MarshalToBytes() ([]byte, error)

func (Message) MarshalToString

func (m Message) MarshalToString() (string, error)

type Topic

type Topic interface {
	Publish(ctx context.Context, msg string, attributes ...map[string]string) error
	PublishBatch(ctx context.Context, messages []string, attributes []map[string]string) error
	SubscribeSqs(ctx context.Context, queueArn string, attributes map[string]string) error
}

type TopicMetadata added in v0.15.0

type TopicMetadata struct {
	AwsClientName string `json:"aws_client_name"`
	TopicArn      string `json:"topic_arn"`
	TopicName     string `json:"topic_name"`
}

type TopicNameSettings

type TopicNameSettings struct {
	AppId      cfg.AppId
	ClientName string
	TopicId    string
}

func (TopicNameSettings) GetAppId

func (s TopicNameSettings) GetAppId() cfg.AppId

func (TopicNameSettings) GetClientName

func (s TopicNameSettings) GetClientName() string

func (TopicNameSettings) GetTopicId

func (s TopicNameSettings) GetTopicId() string

type TopicNameSettingsAware

type TopicNameSettingsAware interface {
	GetAppId() cfg.AppId
	GetClientName() string
	GetTopicId() string
}

type TopicNamingSettings

type TopicNamingSettings struct {
	Pattern string `cfg:"pattern,nodecode" default:"{project}-{env}-{family}-{group}-{topicId}"`
}

type TopicSettings

type TopicSettings struct {
	TopicName  string
	ClientName string
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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