pstore

package
v0.4.8 Latest Latest
Warning

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

Go to latest
Published: Aug 30, 2023 License: MIT Imports: 8 Imported by: 0

Documentation

Overview

Package pstore implements a parameter store client used specifically to managing configuration data for microservices

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AdapterAPI

type AdapterAPI interface {
	GetParameter(ctx context.Context, params *ssm.GetParameterInput, optFns ...func(*ssm.Options)) (*ssm.GetParameterOutput, error)
	GetParameters(ctx context.Context, params *ssm.GetParametersInput, optFns ...func(*ssm.Options)) (*ssm.GetParametersOutput, error)
	GetParametersByPath(ctx context.Context, params *ssm.GetParametersByPathInput, optFns ...func(*ssm.Options)) (*ssm.GetParametersByPathOutput, error)
	DeleteParameter(ctx context.Context, params *ssm.DeleteParameterInput, optFns ...func(*ssm.Options)) (*ssm.DeleteParameterOutput, error)
	PutParameter(ctx context.Context, params *ssm.PutParameterInput, optFns ...func(*ssm.Options)) (*ssm.PutParameterOutput, error)
}

type Client

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

func NewClient

func NewClient(api AdapterAPI, isEncrypted bool) (*Client, error)

NewClient simple constructor to inject private api and configuration values

func NewClientWithConfig

func NewClientWithConfig(cfg aws.Config, isEncrypted bool) (*Client, error)

func NewClientWithConfigMust

func NewClientWithConfigMust(cfg aws.Config, isEncrypted bool) *Client

func (*Client) Collect

func (c *Client) Collect(ctx context.Context, keys ...string) (map[string]string, []string, error)

Collect retrieves one or many params regardless of hierarchy. Note: a second array of strings will report on any invalid params that were sent

func (*Client) Delete

func (c *Client) Delete(ctx context.Context, key string) (string, error)

Delete will remove a single param from the store and return its old value. If the parameter does not exist a NotFound error is returned

func (*Client) EnsurePathPrefix

func (c *Client) EnsurePathPrefix(path string) string

func (*Client) IsEncrypted

func (c *Client) IsEncrypted() bool

func (*Client) Param

func (c *Client) Param(ctx context.Context, key string) (string, error)

Param will retrieve a single parameter as `key` returning the value always as a string. If the parameter does not exist a NotFound error is returned

func (*Client) Params

func (c *Client) Params(ctx context.Context, keys ...string) (map[string]string, error)

Params uses Param to retrieve multiple parameters from the given list of `keys`

func (*Client) Path

func (c *Client) Path(ctx context.Context, path string, recursive ...bool) (map[string]string, error)

Path retrieves one or more params in a specific hierarchy, controlled by path.

func (*Client) PathPagingConstructor

func (c *Client) PathPagingConstructor() PathPagingConstructor

func (*Client) Put

func (c *Client) Put(ctx context.Context, key, value string, overwrite ...bool) (string, error)

Put will check the existence of the parameter and only change them if they are different, or it does not exist

func (*Client) ResolvePathPages

func (c *Client) ResolvePathPages(ctx context.Context, pager PathPaging) (map[string]string, error)

func (*Client) SetEncryption

func (c *Client) SetEncryption(value bool)

func (*Client) SetPathPagingConstructor

func (c *Client) SetPathPagingConstructor(fn PathPagingConstructor)

type PathPaging

type PathPaging interface {
	HasMorePages() bool
	NextPage(ctx context.Context, optFns ...func(*ssm.Options)) (*ssm.GetParametersByPathOutput, error)
}

type PathPagingConstructor

type PathPagingConstructor func(api AdapterAPI, in *ssm.GetParametersByPathInput) PathPaging

PathPagingConstructor constructor function used to create a new paginator for GetParametersByPath api call

Jump to

Keyboard shortcuts

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