store

package
v0.1.0-rc Latest Latest
Warning

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

Go to latest
Published: May 7, 2020 License: Apache-2.0 Imports: 20 Imported by: 0

Documentation

Index

Constants

View Source
const (
	S3BucketOption    = "s3_bucket"
	S3KMSKeyIDDefault = "aws/s3"
)
View Source
const (
	KMSKeyIDOption = "kms_key_id"

	SMKMSKeyIDDefault = "aws/secretsmanager"

	SMSecretsOption   = "secrets"
	SMSecretsDefault  = "single"
	SMSecretsSingle   = "single"
	SMSecretsMultiple = "multiple"
)
View Source
const (
	SecurityRatingLow    = 3
	SecurityRatingMedium = 2
	SecurityRatingHigh   = 1
)
View Source
const (
	PSKMSKeyIDDefault = "aws/ssm"
)

Variables

View Source
var SMSecretsOptions = []string{
	SMSecretsSingle,
	SMSecretsMultiple,
}
View Source
var Stores = map[string]IStore{}

Stores ...

Functions

func FormatObjectKey

func FormatObjectKey(context, path string, store IStore) string

FormatObjectKey ...

func Name

func Name(key string) string

Name ...

func ToKeys

func ToKeys(stores []IStore) []string

ToKeys converts a list of stores into a list of store keys.

Types

type BySecurityRating

type BySecurityRating []IStore

func (BySecurityRating) Len

func (s BySecurityRating) Len() int

func (BySecurityRating) Less

func (s BySecurityRating) Less(i, j int) bool

func (BySecurityRating) Swap

func (s BySecurityRating) Swap(i, j int)

type File

type File struct {
	// CatalogKey
	CatalogKey string

	// RemoteKey is the remote location key.
	RemoteKey string

	// Type describes the file type
	Type string

	// Options allow stores to persist user preferences locally.
	Options map[string]string

	// Keys allows remotes to track which fields are stored remotely.
	Keys []string

	// Data contains the file contents.
	Data []byte

	// Synced is the last time the file matched the remote store.
	Synced time.Time
}

File ...

func (*File) AddKey

func (f *File) AddKey(key string)

AddKey ...

func (*File) EnsureOption

func (f *File) EnsureOption(key, defaultValue string, items []string) error

func (*File) RemoveKey

func (f *File) RemoveKey(key string)

RemoveKey ...

func (*File) SupportsParsing

func (f *File) SupportsParsing() bool

func (*File) ToData

func (f *File) ToData(m map[string]string) error

ToData ...

func (*File) ToMap

func (f *File) ToMap() (map[string]string, error)

ToMap ...

type IStore

type IStore interface {
	// Key uniquely identifies the store and can be entered
	// as a flag value by CLI users.
	// >> $ xstore push .env -s s3
	Key() string

	// ObjectKey uniquely identifies each object stored
	// remotely.
	ObjectKey(path string) string

	// Compatible determines if the list of file types are
	// supported by the storage solution. File types are the
	// file extensions without the leading dot.
	// >> (env/json/yml)
	Compatible(types []string) bool

	// SecurityRating is a number between one and three where
	// one inicates the most secure.
	SecurityRating() int

	// Sync pushes file contents to the remote store.
	Sync(file File) (File, error)

	// Download pulls file contents from the remote store.
	Download(file File) (File, error)

	// Purge deletes file contents from the remote store.
	Purge(file File) error
}

IStore defines the methods a remote store must satisfy.

func ListCompatible

func ListCompatible(files []string) []IStore

ListCompatible returns the remote store keys that can store the specified files.

type ParameterStore

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

ParameterStore ...

func (ParameterStore) Compatible

func (s ParameterStore) Compatible(types []string) bool

Compatible ...

func (ParameterStore) Download

func (s ParameterStore) Download(file File) (File, error)

Download ...

func (ParameterStore) Key

func (s ParameterStore) Key() string

Key ...

func (ParameterStore) ObjectKey

func (s ParameterStore) ObjectKey(path string) string

ObjectKey ...

func (ParameterStore) Purge

func (s ParameterStore) Purge(file File) error

Purge ...

func (ParameterStore) SecurityRating

func (s ParameterStore) SecurityRating() int

SecurityRating ...

func (ParameterStore) Sync

func (s ParameterStore) Sync(file File) (File, error)

Sync ...

type S3Store

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

S3Store ...

func (S3Store) Compatible

func (s S3Store) Compatible(types []string) bool

Compatible ...

func (S3Store) Download

func (s S3Store) Download(file File) (File, error)

Download ...

func (S3Store) Key

func (s S3Store) Key() string

Key ...

func (S3Store) ObjectKey

func (s S3Store) ObjectKey(path string) string

ObjectKey ...

func (S3Store) Purge

func (s S3Store) Purge(file File) error

Purge ...

func (S3Store) SecurityRating

func (s S3Store) SecurityRating() int

SecurityRating ...

func (S3Store) Sync

func (s S3Store) Sync(file File) (File, error)

Sync ...

type SecretsManagerStore

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

SecretsManagerStore ...

func (*SecretsManagerStore) Compatible

func (s *SecretsManagerStore) Compatible(types []string) bool

Compatible ...

func (*SecretsManagerStore) Download

func (s *SecretsManagerStore) Download(file File) (File, error)

Download ...

func (*SecretsManagerStore) Key

func (s *SecretsManagerStore) Key() string

Key ...

func (*SecretsManagerStore) ObjectKey

func (s *SecretsManagerStore) ObjectKey(path string) string

ObjectKey ...

func (*SecretsManagerStore) Purge

func (s *SecretsManagerStore) Purge(file File) error

Purge ...

func (*SecretsManagerStore) SecurityRating

func (s *SecretsManagerStore) SecurityRating() int

SecurityRating ...

func (*SecretsManagerStore) Sync

func (s *SecretsManagerStore) Sync(file File) (File, error)

Sync ...

Jump to

Keyboard shortcuts

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