Documentation ¶
Index ¶
- func GetFirstConditionElseValue(parameter Parameter) string
- func SummarizeConditions(module ModuleConfig) []projectconfig.Condition
- func SummarizeParameters(module ModuleConfig, allParams map[string]string) map[string]string
- func ValidateZeroVersion(mc ModuleConfig) bool
- type Condition
- type ModuleCommands
- type ModuleConfig
- type Parameter
- type TemplateConfig
- type Validate
- type VersionConstraints
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func GetFirstConditionElseValue ¶ added in v0.2.1
GetFirstConditionElseValue returns the default value of the first condition that has a default
func SummarizeConditions ¶ added in v0.1.0
func SummarizeConditions(module ModuleConfig) []projectconfig.Condition
SummarizeConditions based on conditions from zero-module.yml creates and returns slice of conditions for project config
func SummarizeParameters ¶ added in v0.1.0
func SummarizeParameters(module ModuleConfig, allParams map[string]string) map[string]string
SummarizeParameters receives all parameters gathered from prompts during `Zero init` and based on module definition to construct the parameters for each module for zero-project.yml filters out parameters defined as OmitFromProjectFile: true
func ValidateZeroVersion ¶ added in v0.1.0
func ValidateZeroVersion(mc ModuleConfig) bool
ValidateZeroVersion receives a module config, and returns whether the running zero's binary is compatible with the module
Types ¶
type ModuleCommands ¶ added in v0.1.1
type ModuleConfig ¶
type ModuleConfig struct { Name string Description string Author string Commands ModuleCommands `yaml:"commands,omitempty"` DependsOn []string `yaml:"dependsOn,omitempty"` TemplateConfig `yaml:"template"` RequiredCredentials []string `yaml:"requiredCredentials"` ZeroVersion VersionConstraints `yaml:"zeroVersion,omitempty"` Parameters []Parameter Conditions []Condition `yaml:"conditions,omitempty"` }
func LoadModuleConfig ¶
func LoadModuleConfig(filePath string) (ModuleConfig, error)
func (ModuleConfig) GetParamEnvVarTranslationMap ¶ added in v0.1.0
func (cfg ModuleConfig) GetParamEnvVarTranslationMap() map[string]string
GetParamEnvVarTranslationMap returns a map for translating parameter's `Field` into env-var keys It loops through each parameter then adds to translation map if applicable for zero apply / zero init's prompt execute, this is useful for translating params like AWS credentials for running the AWS cli
type Parameter ¶
type Parameter struct { Field string Label string `yaml:"label,omitempty"` Options yaml.MapSlice `yaml:"options,omitempty"` Execute string `yaml:"execute,omitempty"` Value string `yaml:"value,omitempty"` Default string `yaml:"default,omitempty"` Info string `yaml:"info,omitempty"` FieldValidation Validate `yaml:"fieldValidation,omitempty"` Type string `yaml:"type,omitempty"` OmitFromProjectFile bool `yaml:"omitFromProjectFile,omitempty"` Conditions []Condition `yaml:"conditions,omitempty"` EnvVarName string `yaml:"envVarName,omitempty"` }
type TemplateConfig ¶
type VersionConstraints ¶ added in v0.1.0
type VersionConstraints struct {
goVersion.Constraints
}
func (*VersionConstraints) UnmarshalYAML ¶ added in v0.1.0
func (semVer *VersionConstraints) UnmarshalYAML(unmarshal func(interface{}) error) error
UnmarshalYAML Parses a version constraint string into go-version constraint during yaml parsing