service

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Jul 9, 2020 License: Apache-2.0 Imports: 35 Imported by: 0

Documentation

Index

Constants

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

	S3RoleOption = "iam_role"
)
View Source
const (
	KMSKeyIDOption = "kms_key_id"

	SMKMSKeyIDDefault = "aws/secretsmanager"

	SMSecretsDescription = "Managed by Stash"

	SMSecretsOption   = "secrets"
	SMSecretsDefault  = "single"
	SMSecretsSingle   = "single"
	SMSecretsMultiple = "multiple"

	SMDelimiterOption = "group_delimiter"
)
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 Services = map[string]IService{}

Services ...

Functions

func FormatObjectKey

func FormatObjectKey(context, path string, service IService) string

FormatObjectKey ...

func Name

func Name(key string) string

Name ...

func ToKeys

func ToKeys(servcies []IService) []string

ToKeys converts a list of services into a list of services keys.

Types

type BySecurityRating

type BySecurityRating []IService

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 Dep

type Dep struct {
	Stdin  *os.File
	Stdout *os.File
	Stderr *os.File
}

type File

type File struct {
	// Context
	Context string

	// CatalogKey
	CatalogKey string

	// RemoteKey is the remote service key.
	RemoteKey string

	// LocalPath is the path to the local file.
	LocalPath string

	// Type describes the file type
	Type string

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

	// Keys tracks which fields are stashed.
	Keys []string

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

	// Synced is the last time the file was synced with the service.
	Synced time.Time
}

File ...

func (*File) AddKey

func (f *File) AddKey(key string)

AddKey ...

func (*File) EnsureOption

func (f *File) EnsureOption(opt Opt, io IO) error

func (*File) LookupRemoteKey

func (f *File) LookupRemoteKey(prop string) (string, bool)

LookupRemoteKey ...

func (*File) RemoveKey

func (f *File) RemoveKey(key string)

RemoveKey ...

func (*File) SupportsParsing

func (f *File) SupportsParsing() bool

type IO

type IO struct {
	Stdin  *os.File
	Stdout *os.File
	Stderr *os.File
}

IO ...

type IService

type IService interface {
	// Key uniquely identifies the service and can be entered
	// as a flag value by CLI users.
	// i.e. $ stash sync .env -s s3
	Key() string

	// ObjectKey uniquely identifies each object stashed.
	// This is called to display each files remote key
	// in the user output.
	ObjectKey(path string) string

	// Compatible determines if the list of file types are
	// supported by the service. File types are the file
	// extensions without the leading dot.
	// i.e. env,json,yml
	Compatible(types []string) bool

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

	// PreHook is called before Sync, Download, or Purge to
	// initilize the service.
	PreHook(io IO) error

	// Sync uploads file contents to the remote service.
	Sync(file File) (File, error)

	// Download gets file contents from the remote service.
	Download(file File, format string) (File, error)

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

IService defines the methods a remote service must satisfy.

func ListCompatible

func ListCompatible(files []string) []IService

ListCompatible returns the remote servcies that can hold the specified files.

type Opt

type Opt struct {
	Key          string
	DefaultValue string
	Description  string
	Items        []string
}

type ParameterStoreService

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

ParameterStoreService ...

func (ParameterStoreService) Compatible

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

Compatible ...

func (ParameterStoreService) Download

func (s ParameterStoreService) Download(file File, format string) (File, error)

Download ...

func (ParameterStoreService) Key

func (s ParameterStoreService) Key() string

Key ...

func (ParameterStoreService) ObjectKey

func (s ParameterStoreService) ObjectKey(path string) string

ObjectKey ...

func (*ParameterStoreService) PreHook

func (s *ParameterStoreService) PreHook(io IO) error

PreHook ...

func (ParameterStoreService) Purge

func (s ParameterStoreService) Purge(file File) error

Purge ...

func (ParameterStoreService) SecurityRating

func (s ParameterStoreService) SecurityRating() int

SecurityRating ...

func (ParameterStoreService) Sync

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

Sync ...

type S3Service

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

S3Service ...

func (*S3Service) Compatible

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

Compatible ...

func (*S3Service) Download

func (s *S3Service) Download(file File, format string) (File, error)

Download ...

func (*S3Service) Key

func (s *S3Service) Key() string

Key ...

func (*S3Service) ObjectKey

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

ObjectKey ...

func (*S3Service) PreHook

func (s *S3Service) PreHook(io IO) error

PreHook ...

func (*S3Service) Purge

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

Purge ...

func (*S3Service) SecurityRating

func (s *S3Service) SecurityRating() int

SecurityRating ...

func (*S3Service) Sync

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

Sync ...

type SecretsManagerService

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

SecretsManagerService ...

func (*SecretsManagerService) Compatible

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

Compatible ...

func (*SecretsManagerService) Download

func (s *SecretsManagerService) Download(file File, format string) (File, error)

Download ...

func (*SecretsManagerService) Key

func (s *SecretsManagerService) Key() string

Key ...

func (*SecretsManagerService) ObjectKey

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

ObjectKey ...

func (*SecretsManagerService) PreHook

func (s *SecretsManagerService) PreHook(io IO) error

PreHook ...

func (*SecretsManagerService) Purge

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

Purge ...

func (*SecretsManagerService) SecurityRating

func (s *SecretsManagerService) SecurityRating() int

SecurityRating ...

func (*SecretsManagerService) Sync

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

Sync ...

Directories

Path Synopsis
aws
kms
s3
sm

Jump to

Keyboard shortcuts

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