packer-cn/packer/run_interfaces.go

41 lines
1008 B
Go
Raw Normal View History

2020-05-08 10:41:47 -04:00
package packer
import "github.com/hashicorp/hcl/v2"
type GetBuildsOptions struct {
// Get builds except the ones that match with except and with only the ones
2020-05-08 10:59:19 -04:00
// that match with Only. When those are empty everything matches.
2020-05-08 10:41:47 -04:00
Except, Only []string
Debug, Force bool
OnError string
2020-05-08 10:41:47 -04:00
}
type BuildGetter interface {
2020-05-12 06:29:31 -04:00
// GetBuilds return all possible builds for a config. It also starts all
// builders.
2020-05-08 10:41:47 -04:00
// TODO(azr): rename to builder starter ?
GetBuilds(GetBuildsOptions) ([]Build, hcl.Diagnostics)
}
2020-05-08 10:54:44 -04:00
//go:generate enumer -type FixConfigMode
2020-05-08 10:41:47 -04:00
type FixConfigMode int
const (
2020-05-12 07:03:43 -04:00
// Stdout will make FixConfig simply print what the config should be; it
// will only work when a single file is passed.
2020-05-08 10:54:44 -04:00
Stdout FixConfigMode = iota
2020-05-12 06:29:31 -04:00
// Inplace fixes your files on the spot.
2020-05-08 10:54:44 -04:00
Inplace
2020-05-12 06:29:31 -04:00
// Diff shows a full diff.
2020-05-08 10:54:44 -04:00
Diff
2020-05-08 10:41:47 -04:00
)
type FixConfigOptions struct {
DiffOnly bool
}
2020-05-12 06:29:31 -04:00
type ConfigFixer interface {
2020-05-08 10:41:47 -04:00
// FixConfig will output the config in a fixed manner.
FixConfig(FixConfigOptions) hcl.Diagnostics
}