parameterstore

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: 14 Imported by: 0

Documentation

Overview

Package parameterstore loads configuration from AWS Parameter Store.

It requires following permissions to access object from AWS S3:

  • ssm:GetParametersByPath

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 following events trigger polling the configuration and other type of events are ignored:

  • Parameter Store Change

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 ParameterStore 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 WithFilter

func WithFilter(filters ...types.ParameterStringFilter) Option

WithFilter provides [filter] that will be used to select a set of parameters.

Filters to limit the request results. The following Key values are supported for GetParametersByPath : Type, KeyId, and Label. The following Key values aren't supported for GetParametersByPath : tag, DataType, Name, Path, and Tier .

func WithNameSplitter

func WithNameSplitter(splitter func(string) []string) Option

WithNameSplitter provides the function used to split parameter names into nested keys. If it returns an nil/[]string{}/[]string{""}, the parameter will be ignored.

For example, with the default splitter, an parameter name like "PARENT/CHILD/KEY" would be split into "PARENT", "CHILD", and "KEY".

func WithPath

func WithPath(path string) Option

WithPath provides the hierarchy for loading parameters from Parameter Store. Only parameters under the given path will be loaded. Hierarchies start with a forward slash (/). The hierarchy is the parameter name except the last part of the parameter.

For example, if the prefix is "/server", only parameters starts with "/server/" will be loaded. By default, the path is "/" for all parameters.

func WithPollInterval

func WithPollInterval(interval time.Duration) Option

WithPollInterval provides the interval for polling the configuration.

The default interval is 1 minute.

type ParameterStore

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

func New

func New(opts ...Option) *ParameterStore

New creates a ParameterStore with the given endpoint and Option(s).

func (*ParameterStore) Load

func (p *ParameterStore) Load() (map[string]any, error)

func (*ParameterStore) OnEvent

func (p *ParameterStore) OnEvent(msg []byte) error

func (*ParameterStore) Status

func (p *ParameterStore) Status(onStatus func(bool, error))

func (*ParameterStore) String

func (p *ParameterStore) String() string

func (*ParameterStore) Watch

func (p *ParameterStore) 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