store

package
v0.0.0-...-35f9d0a Latest Latest
Warning

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

Go to latest
Published: Nov 21, 2022 License: ISC Imports: 7 Imported by: 0

Documentation

Overview

Store is not designed to be used as a database, or some high intensity key/value store, rather a low volume ad-hoc key value store for secrets inside of AWS.

This should work out of the box with pretty much every AWS account. See also the bundled program.

Index

Constants

View Source
const SSM_KEY_FORMAT = "%s-%04X" // Should be good up to 256MB ( 16^4 bytes... )
View Source
const SSM_MAX_SIZE = 4096 // This is dictated by AWS

Variables

View Source
var (
	// TrimRegex is used to group the SSM keys inside of the Info struct under
	// ByKey. This is used so that we can have keys larger than 4KB.
	// See also SSM_KEY_FORMAT
	TrimRegex = regexp.MustCompile("-[0-9A-E][0-9A-E][0-9A-E][0-9A-E]$")

	// KMS_KEY_ID is optional, can be set set to utilize a specific KMS key if
	// desired.
	KMS_KEY_ID *string = nil

	// Tags are also optional, if used with the bundled program you can
	// simply set an environment variable. Otherwise, set them here
	// at the package level.
	Tags = []*ssm.Tag{}
)

Functions

func GetParam

func GetParam(svc *ssm.SSM, wrtr io.Writer, key string) error

GetParam will suck data out of parameter store for a key, automatically collecting all of the individual parameters needed to reconstruct the data and writes it out to the io.Writer

func InsertParam

func InsertParam(svc *ssm.SSM, rdr io.Reader, key string) error

InsertParam will chuck data from the rdr into the parameter store under key, automatically chunking it into multiple parameters as needed.

func RemoveParam

func RemoveParam(svc *ssm.SSM, key string) error

RemoveParam takes care of collecting all of the pieces for a given key, and removes all of them from the parameter store

Types

type Entry

type Entry struct {
	Name string
	Keys []*ssm.ParameterMetadata
}

Entry represents an entry in the store, and all of the actual parameters that it spans

type Info

type Info struct {
	ByKey     map[string]*Entry
	ByFullKey map[string]*Entry
}

Info contains a few maps with pointers to all of the parameters, setup with different keys for easy lookup. `ByKey` is what you'd expect. `ByFullKey` has a dash and four hex digits appended to it for entries larger than 4K and actually reflects the keys you'll see in the parameter store console.

func GetInfo

func GetInfo(svc *ssm.SSM) (*Info, error)

GetInfo returns a populated Info struct from the parameter store.

Jump to

Keyboard shortcuts

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