terraform

package
v0.3.3 Latest Latest
Warning

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

Go to latest
Published: Sep 24, 2019 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// DefaultDefaultTitle is a default title for terraform commands
	DefaultDefaultTitle = "## Terraform result"
	// DefaultFmtTitle is a default title for terraform fmt
	DefaultFmtTitle = "## Fmt result"
	// DefaultPlanTitle is a default title for terraform plan
	DefaultPlanTitle = "## Plan result"
	// DefaultApplyTitle is a default title for terraform apply
	DefaultApplyTitle = "## Apply result"

	// DefaultDefaultTemplate is a default template for terraform commands
	DefaultDefaultTemplate = `` /* 189-byte string literal not displayed */

	// DefaultFmtTemplate is a default template for terraform fmt
	DefaultFmtTemplate = `
{{ .Title }}

{{ .Message }}

{{ .Result }}

{{ .Body }}
`

	// DefaultPlanTemplate is a default template for terraform plan
	DefaultPlanTemplate = `` /* 189-byte string literal not displayed */

	// DefaultApplyTemplate is a default template for terraform apply
	DefaultApplyTemplate = `` /* 189-byte string literal not displayed */

)
View Source
const (
	// ExitPass is status code zero
	ExitPass int = iota

	// ExitFail is status code non-zero
	ExitFail
)

Variables

This section is empty.

Functions

This section is empty.

Types

type ApplyParser

type ApplyParser struct {
	Pass *regexp.Regexp
	Fail *regexp.Regexp
}

ApplyParser is a parser for terraform apply

func NewApplyParser

func NewApplyParser() *ApplyParser

NewApplyParser is ApplyParser initialized with its Regexp

func (*ApplyParser) Parse

func (p *ApplyParser) Parse(body string) ParseResult

Parse returns ParseResult related with terraform apply

type ApplyTemplate

type ApplyTemplate struct {
	Template string

	CommonTemplate
}

ApplyTemplate is a default template for terraform apply

func NewApplyTemplate

func NewApplyTemplate(template string) *ApplyTemplate

NewApplyTemplate is ApplyTemplate initializer

func (*ApplyTemplate) Execute

func (t *ApplyTemplate) Execute() (resp string, err error)

Execute binds the execution result of terraform apply into tepmlate

func (*ApplyTemplate) GetValue

func (t *ApplyTemplate) GetValue() CommonTemplate

GetValue gets template entities

func (*ApplyTemplate) SetValue

func (t *ApplyTemplate) SetValue(ct CommonTemplate)

SetValue sets template entities about terraform apply to CommonTemplate

type CommonTemplate

type CommonTemplate struct {
	Title   string
	Message string
	Result  string
	Body    string
	Link    string
}

CommonTemplate represents template entities

type DefaultParser

type DefaultParser struct {
}

DefaultParser is a parser for terraform commands

func NewDefaultParser

func NewDefaultParser() *DefaultParser

NewDefaultParser is DefaultParser initializer

func (*DefaultParser) Parse

func (p *DefaultParser) Parse(body string) ParseResult

Parse returns ParseResult related with terraform commands

type DefaultTemplate

type DefaultTemplate struct {
	Template string

	CommonTemplate
}

DefaultTemplate is a default template for terraform commands

func NewDefaultTemplate

func NewDefaultTemplate(template string) *DefaultTemplate

NewDefaultTemplate is DefaultTemplate initializer

func (*DefaultTemplate) Execute

func (t *DefaultTemplate) Execute() (resp string, err error)

Execute binds the execution result of terraform command into tepmlate

func (*DefaultTemplate) GetValue

func (t *DefaultTemplate) GetValue() CommonTemplate

GetValue gets template entities

func (*DefaultTemplate) SetValue

func (t *DefaultTemplate) SetValue(ct CommonTemplate)

SetValue sets template entities to CommonTemplate

type FmtParser

type FmtParser struct {
	Pass *regexp.Regexp
	Fail *regexp.Regexp
}

FmtParser is a parser for terraform fmt

func NewFmtParser

func NewFmtParser() *FmtParser

NewFmtParser is FmtParser initialized with its Regexp

func (*FmtParser) Parse

func (p *FmtParser) Parse(body string) ParseResult

Parse returns ParseResult related with terraform fmt

type FmtTemplate

type FmtTemplate struct {
	Template string

	CommonTemplate
}

FmtTemplate is a default template for terraform fmt

func NewFmtTemplate

func NewFmtTemplate(template string) *FmtTemplate

NewFmtTemplate is FmtTemplate initializer

func (*FmtTemplate) Execute

func (t *FmtTemplate) Execute() (resp string, err error)

Execute binds the execution result of terraform fmt into tepmlate

func (*FmtTemplate) GetValue

func (t *FmtTemplate) GetValue() CommonTemplate

GetValue gets template entities

func (*FmtTemplate) SetValue

func (t *FmtTemplate) SetValue(ct CommonTemplate)

SetValue sets template entities about terraform fmt to CommonTemplate

type ParseResult

type ParseResult struct {
	Result   string
	ExitCode int
	Error    error
}

ParseResult represents the result of parsed terraform execution

type Parser

type Parser interface {
	Parse(body string) ParseResult
}

Parser is an interface for parsing terraform execution result

type PlanParser

type PlanParser struct {
	Pass *regexp.Regexp
	Fail *regexp.Regexp
}

PlanParser is a parser for terraform plan

func NewPlanParser

func NewPlanParser() *PlanParser

NewPlanParser is PlanParser initialized with its Regexp

func (*PlanParser) Parse

func (p *PlanParser) Parse(body string) ParseResult

Parse returns ParseResult related with terraform plan

type PlanTemplate

type PlanTemplate struct {
	Template string

	CommonTemplate
}

PlanTemplate is a default template for terraform plan

func NewPlanTemplate

func NewPlanTemplate(template string) *PlanTemplate

NewPlanTemplate is PlanTemplate initializer

func (*PlanTemplate) Execute

func (t *PlanTemplate) Execute() (resp string, err error)

Execute binds the execution result of terraform plan into tepmlate

func (*PlanTemplate) GetValue

func (t *PlanTemplate) GetValue() CommonTemplate

GetValue gets template entities

func (*PlanTemplate) SetValue

func (t *PlanTemplate) SetValue(ct CommonTemplate)

SetValue sets template entities about terraform plan to CommonTemplate

type Template

type Template interface {
	Execute() (resp string, err error)
	SetValue(template CommonTemplate)
	GetValue() CommonTemplate
}

Template is an template interface for parsed terraform execution result

Jump to

Keyboard shortcuts

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