Documentation ¶
Overview ¶
Package config holds all of the data structures for DeployStack. Having them in main package caused circular dependecy issues.
Index ¶
- Variables
- type Config
- type Custom
- type Customs
- type Product
- type Project
- type Projects
- type Report
- type Setting
- type Settings
- type Stack
- func (s *Stack) AddSetting(key, value string)
- func (s *Stack) AddSettingComplete(set Setting)
- func (s *Stack) DeleteSetting(key string)
- func (s *Stack) FindAndRead(path string, required bool) error
- func (s *Stack) FindAndReadRequired(path string) error
- func (s *Stack) GetSetting(key string) string
- func (s Stack) Terraform() string
- func (s Stack) TerraformFile(filename string) error
Constants ¶
This section is empty.
Variables ¶
var ErrConfigNotExist = fmt.Errorf("could not find and parse a config file")
ErrConfigNotExist is what happens when a config file either does not exist or exists but is not readable.
Functions ¶
This section is empty.
Types ¶
type Config ¶
type Config struct { Title string `json:"title" yaml:"title"` Name string `json:"name" yaml:"name"` Description string `json:"description" yaml:"description"` Duration int `json:"duration" yaml:"duration"` Project bool `json:"collect_project" yaml:"collect_project"` ProjectNumber bool `json:"collect_project_number" yaml:"collect_project_number"` BillingAccount bool `json:"collect_billing_account" yaml:"collect_billing_account"` Domain bool `json:"register_domain" yaml:"register_domain"` Region bool `json:"collect_region" yaml:"collect_region"` RegionType string `json:"region_type" yaml:"region_type"` RegionDefault string `json:"region_default" yaml:"region_default"` Zone bool `json:"collect_zone" yaml:"collect_zone"` HardSet map[string]string `json:"hard_settings" yaml:"hard_settings"` CustomSettings Customs `json:"custom_settings" yaml:"custom_settings"` AuthorSettings Settings `json:"author_settings" yaml:"author_settings"` ConfigureGCEInstance bool `json:"configure_gce_instance" yaml:"configure_gce_instance"` DocumentationLink string `json:"documentation_link" yaml:"documentation_link"` PathTerraform string `json:"path_terraform" yaml:"path_terraform"` PathMessages string `json:"path_messages" yaml:"path_messages"` PathScripts string `json:"path_scripts" yaml:"path_scripts"` Projects Projects `json:"projects" yaml:"projects"` Products []Product `json:"products" yaml:"products"` // contains filtered or unexported fields }
Config represents the settings this app will collect from a user. It should be in a json file. The idea is minimal programming has to be done to setup a DeployStack and export out a tfvars file for terraform part of solution.
func NewConfigJSON ¶
NewConfigJSON returns a Config object from a file read.
func NewConfigYAML ¶
NewConfigYAML returns a Config object from a file read.
func (*Config) ComputeName ¶
ComputeName uses the git repo in the working directory to compute the shortname for the application.
func (Config) Copy ¶ added in v1.9.0
Copy produces a copy of a config file for manipulating it without changing the original
func (*Config) GetAuthorSettings ¶ added in v1.4.0
GetAuthorSettings delivers the combined Hardset and AuthorSettings variables
type Custom ¶
type Custom struct { Setting `json:"-" yaml:"-"` Name string `json:"name" yaml:"name"` Description string `json:"description" yaml:"description"` Default string `json:"default" yaml:"default"` Options []string `json:"options" yaml:"options"` PrependProject bool `json:"prepend_project" yaml:"prepend_project"` Validation string `json:"validation,omitempty" yaml:"validation,omitempty"` // contains filtered or unexported fields }
Custom represents a custom setting that we would like to collect from a user We will collect these settings from the user before continuing.
type Product ¶ added in v1.9.0
type Product struct { Info string `json:"info" yaml:"info"` Product string `json:"product" yaml:"product"` }
Product is some info about a GCP product
type Project ¶
type Project struct { Name string `json:"variable_name" yaml:"variable_name"` UserPrompt string `json:"user_prompt" yaml:"user_prompt"` SetAsDefault bool `json:"set_as_default" yaml:"set_as_default"` // contains filtered or unexported fields }
Project represets a GCP project for use in a stack
type Projects ¶
type Projects struct { Items []Project `json:"items" yaml:"items"` AllowDuplicates bool `json:"allow_duplicates" yaml:"allow_duplicates"` }
Projects is a list of projects that we will collect info for
type Report ¶ added in v1.5.0
Report is collection of data about multiple configs in the same root used for multi stack repos
func FindConfigReports ¶ added in v1.5.0
FindConfigReports walks through a directory and finds all of the configs in the folder
type Setting ¶ added in v1.3.0
type Setting struct { Name string `json:"name" yaml:"name"` Value string `json:"value" yaml:"value"` Type string `json:"type" yaml:"type"` List []string `json:"list" yaml:"list"` Map map[string]string `json:"map" yaml:"map"` }
Setting is a item that will be translated to a varaible in a terraform file
func (*Setting) TFVars ¶ added in v1.4.0
TFVars emits the name value combination here in away that terraform excepts in a tfvars file
func (Setting) TFvarsName ¶ added in v1.4.0
TFvarsName formats the name for the tfvars format
func (Setting) TFvarsValue ¶ added in v1.4.0
TFvarsValue formats the value for the tfvars format
type Settings ¶ added in v1.3.0
type Settings []Setting
Settings are a collection of setting
func (*Settings) AddComplete ¶ added in v1.4.0
AddComplete adds an whole setting to the settings control
func (*Settings) Replace ¶ added in v1.3.0
Replace will look for a setting with the same name, and overwrite the value
type Stack ¶
Stack represents the input config and output settings for this DeployStack
func (*Stack) AddSetting ¶
AddSetting stores a setting key/value pair.
func (*Stack) AddSettingComplete ¶ added in v1.4.0
AddSettingComplete passes a completely intact setting to the underlying setting structure
func (*Stack) DeleteSetting ¶
DeleteSetting removes a setting value.
func (*Stack) FindAndRead ¶ added in v1.9.0
FindAndRead figures out a default config, or reads it if it is there has option to insure various things and folders exist
func (*Stack) FindAndReadRequired ¶
FindAndReadRequired finds and reads in a Config from a json file.
func (*Stack) GetSetting ¶
GetSetting returns a setting value.
func (Stack) TerraformFile ¶
TerraformFile exports TFVars format to input file.