s3

package module
v1.1.0 Latest Latest
Warning

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

Go to latest
Published: Apr 24, 2024 License: MIT Imports: 14 Imported by: 0

Documentation

Overview

Package s3 loads configuration from AWS S3.

It requires following permissions to access object from AWS S3:

  • s3:GetObject

Change notification

By default, it's periodically polls the configuration. It also listens to change events by register it to SNS notifier with one of following setups:

Only ObjectCreated:* events trigger polling the configuration and other type of events are ignored.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Option

type Option func(options *options)

Option configures the a S3 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 WithPollInterval

func WithPollInterval(interval time.Duration) Option

WithPollInterval provides the interval for polling the configuration.

The default interval is 1 minute.

func WithUnmarshal

func WithUnmarshal(unmarshal func([]byte, any) error) Option

WithUnmarshal provides the function used to parses the configuration. The unmarshal function must be able to unmarshal the configuration into a map[string]any.

The default function is json.Unmarshal.

type S3

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

S3 is a Provider that loads configuration from AWS S3.

To create a new S3, call New.

func New

func New(uri string, opts ...Option) *S3

New creates an S3 with the given uri and Option(s).

func (*S3) Load

func (a *S3) Load() (map[string]any, error)

func (*S3) OnEvent added in v1.1.0

func (a *S3) OnEvent(msg []byte) error

func (*S3) Status

func (a *S3) Status(onStatus func(bool, error))

func (*S3) String

func (a *S3) String() string

func (*S3) Watch

func (a *S3) Watch(ctx context.Context, onChange func(map[string]any)) error

Directories

Path Synopsis
internal

Jump to

Keyboard shortcuts

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