app

package
v2.1.0 Latest Latest
Warning

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

Go to latest
Published: May 20, 2024 License: MIT Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewSSMClient

func NewSSMClient(ctx context.Context, retries int) (*ssm.Client, error)

Types

type DefaultSSMConnector

type DefaultSSMConnector struct{}

type DestinationRule

type DestinationRule struct {
	Type DestinationType

	// To is address of destination.
	To string

	TypeEnvOptions  *DestinationTypeEnvOptions
	TypeFileOptions *DestinationTypeFileOptions
}

func (DestinationRule) String

func (r DestinationRule) String() string

type DestinationType

type DestinationType string
const (
	DestinationTypeEnv  DestinationType = "env"
	DestinationTypeFile DestinationType = "file"
)

type DestinationTypeEnvOptions

type DestinationTypeEnvOptions struct {
	// Prefix is a prefix for environment variable.
	// For example, if Prefix is PREFIX, then the environment variable name will be PREFIX_NAME.
	Prefix string

	// EntirePath is a flag to export entire path as environment variable name.
	// For example, if EntirePath is true and the path is /a/b/c, then the environment variable name will be A_B_C.
	// If EntirePath is false, then the environment variable name will be C.
	EntirePath bool
}

func (DestinationTypeEnvOptions) String

func (o DestinationTypeEnvOptions) String() string

type DestinationTypeFileOptions

type DestinationTypeFileOptions struct {
	// Mode is a file mode of exported file.
	// If Mode is 0, then the default file mode is used defined in FileExporter.
	Mode fs.FileMode

	// Uid is a user id of exported file.
	// If Uid is 0, then the default user id is used defined in FileExporter.
	Uid int

	// Gid is a group id of exported file.
	// If Gid is 0, then the default group id is used defined in FileExporter.
	Gid int
}

func (DestinationTypeFileOptions) String

type EnvExporter

type EnvExporter struct {
	Name string
}

func NewEnvExporter

func NewEnvExporter(name string) *EnvExporter

func (EnvExporter) Address

func (e EnvExporter) Address() string

func (EnvExporter) Export

func (e EnvExporter) Export(value string) error

type Exporter

type Exporter interface {
	Address() string
	Export(value string) error
}

type FileExporter

type FileExporter struct {
	Path string
	Mode fs.FileMode
	Uid  int
	Gid  int
}

func NewFileExporter

func NewFileExporter(path string) *FileExporter

func (FileExporter) Address

func (e FileExporter) Address() string

func (FileExporter) Export

func (e FileExporter) Export(v string) error

type Parameter

type Parameter struct {
	Path  string
	Value string
}

type ParameterLevel

type ParameterLevel int
const (
	// ParameterLevelStrict means the path will be searched strictly.
	ParameterLevelStrict ParameterLevel = 0

	// ParameterLevelUnder means the path will be searched just under the path.
	ParameterLevelUnder ParameterLevel = 1

	// ParameterLevelAll means the path will be searched under the path recursively.
	ParameterLevelAll ParameterLevel = 2
)

type ParameterRule

type ParameterRule struct {
	// Path is the target path on SSM Parameter Store.
	Path string

	// Level means how deep the path should be searched.
	Level ParameterLevel
}

func NewParameterRule

func NewParameterRule(path string) (*ParameterRule, error)

NewParameterRule creates a new ParameterRule. The path should be a valid path format. If the path ends with `/*`, the level will be `ParameterLevelUnder`. If the path ends with `/**/*`, the level will be `ParameterLevelAll`. Otherwise, the level will be `ParameterLevelStrict`.

func (ParameterRule) Equals added in v2.1.0

func (r1 ParameterRule) Equals(r2 ParameterRule) bool

func (ParameterRule) IsCovers added in v2.1.0

func (r1 ParameterRule) IsCovers(r2 ParameterRule) bool

func (ParameterRule) String

func (r ParameterRule) String() string

type ParameterStore

type ParameterStore struct {
	Parameters []Parameter
	// contains filtered or unexported fields
}

func NewParameterStore

func NewParameterStore(client *ssm.Client, conn SSMConnector) *ParameterStore

func (ParameterStore) FindByName

func (c ParameterStore) FindByName(name string) *Parameter

func (ParameterStore) Retrieve

func (c ParameterStore) Retrieve(path string, level ParameterLevel) ([]Parameter, error)

func (ParameterStore) SearchByPath

func (c ParameterStore) SearchByPath(path string, recursive bool) []Parameter

func (*ParameterStore) Store

func (c *ParameterStore) Store(ctx context.Context, rules []ParameterRule) error

type Rule

type Rule struct {
	ParameterRule   ParameterRule
	DestinationRule DestinationRule
}

func (Rule) Execute

func (r Rule) Execute(store ParameterStore) error

func (Rule) String

func (r Rule) String() string

type SSMConnector

type SSMConnector interface {
	// contains filtered or unexported methods
}

type SSMWrap

type SSMWrap struct {
	// Retry limit to request to SSM.
	Retries int

	// Command and arguments to run.
	Command []string
}

func NewSSMWrap

func NewSSMWrap() *SSMWrap

func (SSMWrap) Export

func (s SSMWrap) Export(ctx context.Context, rules []Rule) error

func (*SSMWrap) Run

func (s *SSMWrap) Run(ctx context.Context, rules []Rule, command []string) error

Jump to

Keyboard shortcuts

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