Documentation
¶
Overview ¶
Package infra is responsible for infrastructure related concerns of the app like deploying and configuration
Index ¶
- Variables
- func Bind(c *cobra.Command, v *viper.Viper, config interface{}) error
- func Process(cmd *cobra.Command, v *viper.Viper, spec interface{}, prefix ...string) error
- func SetupCommands(i *Infra) error
- func SetupDeployCmd(in *Infra) error
- func SetupEnvCmd(in *Infra) error
- func SetupInfraCmd(i *Infra) error
- func SetupParamStoreCmd(in *Infra) error
- type CmdConfig
- type DeployBind
- type DeployConfig
- type EnvBind
- type EnvConfig
- type EnvExportBind
- type EnvExportConfig
- type EnvIdentity
- type EnvResult
- type Filepath
- type Infra
- func (i *Infra) CheckFailure(err error)
- func (i *Infra) DeleteAllFeatureParams(ctx context.Context, appTitle string, feature sls.Feature) (map[string]string, error)
- func (i *Infra) DeleteAllServiceParams(ctx context.Context, appTitle string) (map[string]string, error)
- func (i *Infra) DeleteParam(ctx context.Context, appTitle, key string) (map[string]string, error)
- func (i *Infra) DeployFeatureCode(ctx context.Context, feature sls.Feature, settings sls.BuildSettings, ...) error
- func (i *Infra) DeployFeatureConfig(ctx context.Context, appTitle string, feature sls.Feature, config DeployConfig) error
- func (i *Infra) Display(data string)
- func (i *Infra) DisplayError(data string)
- func (i *Infra) DisplayErrorJson(d interface{})
- func (i *Infra) DisplayJson(d interface{})
- func (i *Infra) FeatureEnvReport(config sls.Configurable, c CmdConfig, isNamesOnly ...bool) (map[string]string, error)
- func (i *Infra) FeatureParams(ctx context.Context, appTitle string, feature sls.Feature) (map[string]string, error)
- func (i *Infra) LoadFeature(config CmdConfig, name string) (*sls.MicroService, sls.Feature, error)
- func (i *Infra) LoadService(config CmdConfig) (*sls.MicroService, error)
- func (i *Infra) Param(ctx context.Context, appTitle, key string) (string, error)
- func (i *Infra) Process(cmd *cobra.Command, c interface{}) error
- func (i *Infra) PutParam(ctx context.Context, appTitle, key, value string, overwrite bool) (map[string]string, error)
- func (i *Infra) RunDeploy(cmd *cobra.Command, args []string) error
- func (i *Infra) RunEnv(cmd *cobra.Command, args []string) error
- func (i *Infra) RunEnvExport(cmd *cobra.Command, args []string) error
- func (i *Infra) RunPStore(cmd *cobra.Command, args []string) error
- func (i *Infra) RunPStoreDelete(cmd *cobra.Command, args []string) error
- func (i *Infra) RunPStoreExport(cmd *cobra.Command, args []string) error
- func (i *Infra) RunPStoreImport(cmd *cobra.Command, _ []string) error
- func (i *Infra) ServiceEnvReport(service *sls.MicroService, c CmdConfig, isNamesOnly ...bool) (map[string]string, map[string]map[string]string, error)
- func (i *Infra) ServiceParams(ctx context.Context, appTitle string) (map[string]string, error)
- func (i *Infra) StripAppTitle(appTitle string, in map[string]string) map[string]string
- func (i *Infra) Validate() error
- func (i *Infra) WriteJson(p string, d interface{})
- type LambdaDeployments
- type PStoreBind
- type PStoreConfig
- type PStoreDeleteBind
- type PStoreDeleteConfig
- type PStoreExportBind
- type PStoreExportConfig
- type PStoreImportBind
- type PStoreImportConfig
- type ParamStorage
Constants ¶
This section is empty.
Variables ¶
var DeployCmd = &cobra.Command{ Use: "deploy", Short: "deploy lambdas to aws", Args: cobra.MinimumNArgs(1), }
var EnvCmd = &cobra.Command{ Use: "env [FEATURE]", Short: "display environment variables for a lambda", Args: cobra.MinimumNArgs(0), }
var EnvExportCmd = &cobra.Command{ Use: "export", Short: "exports all env vars for this service", Args: cobra.MinimumNArgs(0), }
var PStoreCmd = &cobra.Command{ Use: "pstore [FEATURE]", Short: "display parameter store values for a lambda", Args: cobra.MinimumNArgs(0), }
var PStoreDeleteCmd = &cobra.Command{ Use: "delete <PARAM_NAME>", Short: "delete single param or all params from the micro-service", Args: cobra.MaximumNArgs(1), }
var PStoreExportCmd = &cobra.Command{ Use: "export", Short: "exports all params for this service", Args: cobra.MinimumNArgs(0), }
var PStoreImportCmd = &cobra.Command{
Use: "import",
Short: "import params into parameter store",
}
Functions ¶
func SetupCommands ¶
func SetupDeployCmd ¶
func SetupEnvCmd ¶
func SetupInfraCmd ¶
func SetupParamStoreCmd ¶
Types ¶
type CmdConfig ¶
type CmdConfig struct {
Verbose bool `conf:" global-flag, cli:verbose, cli-s:v, cli-u:Show verbose output"`
IsAll bool `conf:" global-flag, cli:all, cli-u: apply to the whole service"`
SkipDefaults bool `conf:" global-flag, cli:skip-defaults, cli-u: skip default values"`
WithTrigger bool `` /* 161-byte string literal not displayed */
IsText bool `conf:" global-flag, env:CLI_FORMAT_TEXT, cli:text, cli-u:Use plain text instead of json'"`
IsQualifiedName bool `conf:" global-flag, env:QUALIFIED_NAMES, cli:qualified-name, cli-u:Display names as fully qualified"`
Env string `conf:"required, global-flag, env:ENV, cli:env, cli-s:e, cli-u:Application env"`
}
func (CmdConfig) IsFullyQualifiedName ¶
func (CmdConfig) NameIncludesTrigger ¶
type DeployBind ¶
type DeployBind struct {
IsEnvOnly bool `conf:"cli:env-only, cli-u: Only update environment variables"`
}
type DeployConfig ¶
type DeployConfig struct {
DeployBind
CmdConfig
}
type EnvBind ¶
type EnvBind struct {
NamesOnly bool `conf:"cli:names-only, cli-u: Only display the env var names for a given feature"`
}
type EnvExportBind ¶
type EnvExportConfig ¶
type EnvExportConfig struct {
CmdConfig
EnvExportBind
}
type EnvIdentity ¶
type EnvIdentity interface {
EnvName() string
}
type Filepath ¶
type Filepath struct {
Path string
}
Filepath is used as a custom decoder which will take a configuration string and resolve a ~ to the absolute path of the home directory. If ~ is not present it treated as a normal path to a directory
type Infra ¶
type Infra struct {
Stdout io.ReadWriteCloser
Stderr io.ReadWriteCloser
Viper *viper.Viper
PStoreAPI ParamStorage
LambdaAPI LambdaDeployments
Service *sls.MicroService
ServiceConstructor func(config EnvIdentity) (*sls.MicroService, error)
ParentCmd *cobra.Command
Prefix []string
DeployCmd *cobra.Command
EnvCmd *cobra.Command
EnvExportCmd *cobra.Command
PStoreCmd *cobra.Command
PStoreImportCmd *cobra.Command
PStoreDeleteCmd *cobra.Command
PStoreExportCmd *cobra.Command
InvokeCmd *cobra.Command
}
func (*Infra) CheckFailure ¶
func (*Infra) DeleteAllFeatureParams ¶
func (*Infra) DeleteAllServiceParams ¶
func (*Infra) DeleteParam ¶
func (*Infra) DeployFeatureCode ¶
func (i *Infra) DeployFeatureCode(ctx context.Context, feature sls.Feature, settings sls.BuildSettings, config DeployConfig) error
func (*Infra) DeployFeatureConfig ¶
func (*Infra) DisplayError ¶
func (*Infra) DisplayErrorJson ¶
func (i *Infra) DisplayErrorJson(d interface{})
func (*Infra) DisplayJson ¶
func (i *Infra) DisplayJson(d interface{})
func (*Infra) FeatureEnvReport ¶
func (*Infra) FeatureParams ¶
func (*Infra) LoadFeature ¶
func (*Infra) LoadService ¶
func (i *Infra) LoadService(config CmdConfig) (*sls.MicroService, error)
func (*Infra) RunPStore ¶
RunPStore runs `<service> infra pstore` which will return parameter values for the service or feature `<service> infra pstore <FEATURE [-a --all]>` - will list all params for just that feature
func (*Infra) RunPStoreDelete ¶
RunPStoreDelete runs `<service> infra pstore delete` which will return parameter values for the service or feature `<service> infra pstore delete <[FEATURE] | [--all]>`
func (*Infra) RunPStoreExport ¶
RunPStoreExport runs `<service> infra pstore export` which will return parameter values for the service or feature 1) `<service> infra pstore export` 2) `<service> infra pstore export [-f --file]` 3) `<service> infra pstore <FEATURE> [-f --file]` - export for that feature
func (*Infra) RunPStoreImport ¶
RunPStoreImport runs `<service> infra pstore import` which will import all parameters `<service> infra pstore import <[--file | --env]>`
func (*Infra) ServiceEnvReport ¶
func (*Infra) ServiceParams ¶
func (*Infra) StripAppTitle ¶
type LambdaDeployments ¶
type LambdaDeployments interface {
Compile(data sls.BuildSettings) (sls.BuildResult, error)
UpdateCode(ctx context.Context, payload lambda.CodePayload) (*lambda.FeatureUpdateReport, error)
UpdateConfig(ctx context.Context, in lambda.FeatureSettings) (*lambda.FeatureUpdateReport, error)
}
type PStoreBind ¶
type PStoreBind struct {
IsEncrypt bool `conf:"default:true, cli:encrypt, cli-u: use encryption for pstore"`
}
type PStoreConfig ¶
type PStoreConfig struct {
CmdConfig
PStoreBind
}
type PStoreDeleteBind ¶
type PStoreDeleteConfig ¶
type PStoreDeleteConfig struct {
CmdConfig
PStoreDeleteBind
}
type PStoreExportBind ¶
type PStoreExportConfig ¶
type PStoreExportConfig struct {
CmdConfig
PStoreExportBind
}
type PStoreImportBind ¶
type PStoreImportBind struct {
File Filepath `conf:"cli:file, cli-s:f, cli-u:Importing values from a json file"`
ImportFromEnv bool `conf:"cli:env, cli-u: Importing values from env vars on you machine"`
IsEncrypt bool `conf:"default:true, cli:encrypt, cli-u: use encryption for pstore"`
Overwrite bool `conf:"cli:overwrite, cli-u: Used to replace values that already exist in parameter store"`
}
type PStoreImportConfig ¶
type PStoreImportConfig struct {
CmdConfig
PStoreImportBind
}
type ParamStorage ¶
type ParamStorage interface {
Param(ctx context.Context, key string) (string, error)
Path(ctx context.Context, path string, recursive ...bool) (map[string]string, error)
Collect(ctx context.Context, key ...string) (map[string]string, []string, error)
Delete(ctx context.Context, key string) (string, error)
Put(ctx context.Context, key, value string, overwrite ...bool) (string, error)
EnsurePathPrefix(path string) string
}