init

package
v0.2.1 Latest Latest
Warning

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

Go to latest
Published: Oct 6, 2021 License: MPL-2.0 Imports: 21 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CustomPromptHandler added in v0.1.0

func CustomPromptHandler(promptType string, params map[string]string) error

CustomPromptHandler handles non-input and enum options prompts zero-module's parameters allow prompts to specify types of custom actions this allows non-standard enum / string input to be added, such as AWS profile picker

func Init

func Init(outDir string, localModulePath string) *projectconfig.ZeroProjectConfig

Create cloud provider context

func NoCondition

func NoCondition(map[string]string) bool

NoCondition is a no-op condition check function that always returns true

func NoValidation

func NoValidation(string) error

NoValidation is a no-op validation function

func PromptModuleParams

func PromptModuleParams(moduleConfig moduleconfig.ModuleConfig, parameters map[string]string) (map[string]string, error)

PromptModuleParams renders series of prompt UI based on the config

func SpecificValueValidation

func SpecificValueValidation(values ...string) func(string) error

SpecificValueValidation is a validation function that checks if the value is in the list of options

func ValidateAKID

func ValidateAKID(input string) error

ValidateAKID checks if the input is a valid AWS Access Key ID

func ValidateProjectName

func ValidateProjectName(input string) error

ValidateProjectName validates Project Name field user input.

func ValidateSAK

func ValidateSAK(input string) error

ValidateSAK checks if the input is a valid AWS Secret Access Key

Types

type CredentialPrompts

type CredentialPrompts struct {
	Vendor  string
	Prompts []PromptHandler
}

CredentialPrompts is a list of prompts for sensitive credentials

type CustomConditionSignature

type CustomConditionSignature func(map[string]string) bool

CustomConditionSignature is the function signature of a custom condition. It takes a map of parameters and returns a boolean

func KeyMatchCondition

func KeyMatchCondition(key string, value string) CustomConditionSignature

KeyMatchCondition is a condition that checks if the key matches the value

type PromptHandler

type PromptHandler struct {
	moduleconfig.Parameter
	Condition CustomConditionSignature
	Validate  func(string) error
}

PromptHandler defines how a user is prompted for a parameter, containing information about the parameter, conditions, and value validation

func (PromptHandler) RunPrompt added in v0.1.0

func (p PromptHandler) RunPrompt(projectParams map[string]string, envVarTranslationMap map[string]string) error

RunPrompt obtains the value of PromptHandler depending on the parameter's definition for the project config, there are multiple ways of obtaining the value values go into params depending on `Condition` as the highest precedence (Whether it gets this value) then follows this order to determine HOW it obtains that value 1. Execute (this could potentially be refactored into type + data) 2. type: specific ways of obtaining values (in AWS credential case it will set 2 values to the map) 3. value: directly assigns a value to a parameter 4. prompt: requires users to select an option OR input a string

Jump to

Keyboard shortcuts

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