Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
var ( ERR_NO_DESCRIPTION = errors.New("No description is set") ERR_NO_ACTION = errors.New("Approval is not configured for 'provision', 'delete' nor 'reconfigure'") ERR_NO_RECIPIENTS = errors.New("No recipients are configured") ERR_BAD_RECIPIENT_EMAIL = errors.New("Recipient email address appears to be invalid") ERR_TEMPLATE_NOT_EXIST = errors.New("Configured message template cannot be found") ERR_MULTIPLE_SCOPES = errors.New("Multiple Scopes found") )
Functions ¶
func ReadAndParseConfig ¶
ReadAndParseConfig reads the contents of the YAML approvals config filer and parses it to a map of Approval structs
func ValidateConfig ¶
func ValidateConfig() error
ValidateConfig will check that the config parsed can be used by application
Types ¶
type Approval ¶
type Approval struct { Id int `json:"id"` Name string `json:"name"` RequestType string `json:"requestType"` Status string `json:"status"` DateCreated time.Time `json:"datedCreated"` RequestBy string `json:"requestBy"` Items []Item `json:"approvalItems"` Scope Scope `json:"scope"` Cost float64 `jsom:"cost"` }
Approval holds information about an approval, some properties are partially populated by the approval api request, we flesh out Scope by checking the instance or app information. we are also going to determine the cost from the instance/app info as it is not included in the approval response itself
type ApprovalConfig ¶
type ApprovalConfig struct { Description string `yaml:"description"` TemplateFile string `yaml:"template"` OnProvision bool `yaml:"onProvision"` OnDelete bool `yaml:"onDelete"` OnReconfigure bool `yaml:"onReconfigure"` LinkedApproval bool `yaml:"linkedApproval"` RecipientList []string `yaml:"recipientList"` Scope Scope `yaml:"scope"` }
ApprovalConfig represents a single approval configuration
type ApprovalsConfig ¶
type ApprovalsConfig []struct { ApprovalConfig `yaml:"approval"` }
ApprovalsConfig is a representation of the parsed YAML approvals.yaml configuration file
type Item ¶
Item holds the basic data we need in order to integorate an instance of application for scope metadata
type Scope ¶
type Scope struct { Group string `yaml:"group"` Cloud string `yaml:"cloud"` User string `yaml:"user"` Tenant string `yaml:"tenant"` Environment string `yaml:"environment"` }
Scope represents the scope configuration options which can be set in the YAML. Default scope is 'global' unless overridden here - by a single setting here