Documentation
¶
Overview ¶
Code generated by "mapstructure-to-hcl2 -type MockPostProcessor"; DO NOT EDIT.
Index ¶
- Constants
- Variables
- func BasicPlaceholderData() map[string]string
- func CastDataToMap(data interface{}) map[string]interface{}
- func ProgressBarConfig(bar *pb.ProgressBar, prefix string)
- func TestBuilder(t *testing.T, c *CoreConfig, n string) *packersdk.MockBuilder
- func TestProvisioner(t *testing.T, c *CoreConfig, n string) *packersdk.MockProvisioner
- func TestUi(t *testing.T) packersdk.Ui
- type BasicStore
- type BuildGetter
- type BuilderFunc
- type BuilderStore
- type CheckpointTelemetry
- type ColoredUi
- func (u *ColoredUi) Ask(query string) (string, error)
- func (u *ColoredUi) Error(message string)
- func (u *ColoredUi) Machine(t string, args ...string)
- func (u *ColoredUi) Message(message string)
- func (u *ColoredUi) Say(message string)
- func (u *ColoredUi) TrackProgress(src string, currentSize, totalSize int64, stream io.ReadCloser) io.ReadCloser
- type ComponentFinder
- type ConfigFixer
- type ConfigInspector
- type Core
- func (c *Core) Build(n string) (packersdk.Build, error)
- func (c *Core) BuildNames(only, except []string) []string
- func (c *Core) Context() *interpolate.Context
- func (c *Core) EvaluateExpression(line string) (string, bool, hcl.Diagnostics)
- func (c *Core) FixConfig(opts FixConfigOptions) hcl.Diagnostics
- func (c *Core) GetBuilds(opts GetBuildsOptions) ([]packersdk.Build, hcl.Diagnostics)
- func (core *Core) Initialize() error
- func (c *Core) InspectConfig(opts InspectConfigOptions) int
- type CoreBuild
- func (b *CoreBuild) Name() string
- func (b *CoreBuild) Prepare() (warn []string, err error)
- func (b *CoreBuild) Run(ctx context.Context, originalUi packersdk.Ui) ([]packersdk.Artifact, error)
- func (b *CoreBuild) SetDebug(val bool)
- func (b *CoreBuild) SetForce(val bool)
- func (b *CoreBuild) SetOnError(val string)
- type CoreBuildPostProcessor
- type CoreBuildProvisioner
- type CoreConfig
- type DebuggedProvisioner
- type Evaluator
- type FixConfigMode
- type FixConfigOptions
- type FlatMockPostProcessor
- type GetBuildsOptions
- type Handler
- type HookFunc
- type HookedProvisioner
- type InspectConfigOptions
- type MachineReadableUi
- func (u *MachineReadableUi) Ask(query string) (string, error)
- func (u *MachineReadableUi) Error(message string)
- func (u *MachineReadableUi) Machine(category string, args ...string)
- func (u *MachineReadableUi) Message(message string)
- func (u *MachineReadableUi) Say(message string)
- func (u *MachineReadableUi) TrackProgress(src string, currentSize, totalSize int64, stream io.ReadCloser) (body io.ReadCloser)
- type MockPostProcessor
- func (t *MockPostProcessor) ConfigSpec() hcldec.ObjectSpec
- func (t *MockPostProcessor) Configure(configs ...interface{}) error
- func (*MockPostProcessor) FlatMapstructure() interface{ ... }
- func (t *MockPostProcessor) PostProcess(ctx context.Context, ui packersdk.Ui, a packersdk.Artifact) (packersdk.Artifact, bool, bool, error)
- type PackerReport
- type PausedProvisioner
- type PostProcessorFunc
- type PostProcessorStore
- type ProvisionHook
- type ProvisionerFunc
- type ProvisionerStore
- type RetriedProvisioner
- type TargetedUI
- func (u *TargetedUI) Ask(query string) (string, error)
- func (u *TargetedUI) Error(message string)
- func (u *TargetedUI) Machine(t string, args ...string)
- func (u *TargetedUI) Message(message string)
- func (u *TargetedUI) Say(message string)
- func (u *TargetedUI) TrackProgress(src string, currentSize, totalSize int64, stream io.ReadCloser) io.ReadCloser
- type TelemetrySpan
- type TimeoutProvisioner
- type TimestampedUi
- func (u *TimestampedUi) Ask(query string) (string, error)
- func (u *TimestampedUi) Error(message string)
- func (u *TimestampedUi) Machine(message string, args ...string)
- func (u *TimestampedUi) Message(message string)
- func (u *TimestampedUi) Say(message string)
- func (u *TimestampedUi) TrackProgress(src string, currentSize, totalSize int64, stream io.ReadCloser) (body io.ReadCloser)
- type UiColor
- type UiProgressBar
Constants ¶
const ( UiColorRed UiColor = 31 UiColorGreen = 32 UiColorYellow = 33 UiColorBlue = 34 UiColorMagenta = 35 UiColorCyan = 36 )
const TelemetryPanicVersion string = "beta/packer_panic/4"
const TelemetryVersion string = "beta/packer/5"
Variables ¶
var BuilderDataCommonKeys = []string{
"ID",
"Host",
"Port",
"User",
"Password",
"ConnType",
"PackerRunUUID",
"PackerHTTPPort",
"PackerHTTPIP",
"PackerHTTPAddr",
"SSHPublicKey",
"SSHPrivateKey",
"WinRMPassword",
}
BuilderDataCommonKeys is the list of common keys that all builder will return
var ConsoleHelp = strings.TrimSpace(`
Packer console JSON Mode.
The Packer console allows you to experiment with Packer interpolations.
You may access variables in the Packer config you called the console with.
Type in the interpolation to test and hit <enter> to see the result.
"variables" will dump all available variables and their values.
"{{timestamp}}" will output the timestamp, for example "1559855090".
To exit the console, type "exit" and hit <enter>, or use Control-C.
/!\ If you would like to start console in hcl2 mode without a config you can
use the --config-type=hcl2 option.
`)
var ErrInterrupted = errors.New("interrupted")
Functions ¶
func BasicPlaceholderData ¶ added in v1.5.0
Provisioners interpolate most of their fields in the prepare stage; this placeholder map helps keep fields that are only generated at build time from accidentally being interpolated into empty strings at prepare time. This helper function generates the most basic placeholder data which should be accessible to the provisioners. It is used to initialize provisioners, to force validation using the `generated` template function. In the future, custom generated data could be passed into provisioners from builders to enable specialized builder-specific (but still validated!!) access to builder data.
func CastDataToMap ¶ added in v1.5.0
func CastDataToMap(data interface{}) map[string]interface{}
func ProgressBarConfig ¶ added in v1.4.0
func ProgressBarConfig(bar *pb.ProgressBar, prefix string)
func TestBuilder ¶ added in v0.8.0
func TestBuilder(t *testing.T, c *CoreConfig, n string) *packersdk.MockBuilder
TestBuilder sets the builder with the name n to the component finder and returns the mock.
func TestProvisioner ¶ added in v0.8.0
func TestProvisioner(t *testing.T, c *CoreConfig, n string) *packersdk.MockProvisioner
TestProvisioner sets the prov. with the name n to the component finder and returns the mock.
Types ¶
type BasicStore ¶ added in v1.5.0
type BuildGetter ¶ added in v1.6.0
type BuildGetter interface { // GetBuilds return all possible builds for a config. It also starts all // builders. // TODO(azr): rename to builder starter ? GetBuilds(GetBuildsOptions) ([]packersdk.Build, hcl.Diagnostics) }
type BuilderFunc ¶
The function type used to lookup Builder implementations.
type BuilderStore ¶ added in v1.5.0
type BuilderStore interface { BasicStore Start(name string) (packersdk.Builder, error) }
type CheckpointTelemetry ¶ added in v1.0.1
type CheckpointTelemetry struct {
// contains filtered or unexported fields
}
var CheckpointReporter *CheckpointTelemetry
func NewCheckpointReporter ¶ added in v1.1.1
func NewCheckpointReporter(disableSignature bool) *CheckpointTelemetry
func (*CheckpointTelemetry) AddSpan ¶ added in v1.0.1
func (c *CheckpointTelemetry) AddSpan(name, pluginType string, options interface{}) *TelemetrySpan
func (*CheckpointTelemetry) Finalize ¶ added in v1.0.1
func (c *CheckpointTelemetry) Finalize(command string, errCode int, err error) error
func (*CheckpointTelemetry) ReportPanic ¶ added in v1.0.1
func (c *CheckpointTelemetry) ReportPanic(m string) error
type ColoredUi ¶
type ColoredUi struct { Color UiColor ErrorColor UiColor Ui packersdk.Ui PB getter.ProgressTracker }
ColoredUi is a UI that is colored using terminal colors.
func (*ColoredUi) TrackProgress ¶ added in v1.4.0
func (u *ColoredUi) TrackProgress(src string, currentSize, totalSize int64, stream io.ReadCloser) io.ReadCloser
type ComponentFinder ¶
type ComponentFinder struct { Hook HookFunc // For HCL2 BuilderStore BuilderStore ProvisionerStore ProvisionerStore PostProcessorStore PostProcessorStore }
ComponentFinder is a struct that contains the various function pointers necessary to look up components of Packer such as builders, commands, etc.
type ConfigFixer ¶ added in v1.6.0
type ConfigFixer interface { // FixConfig will output the config in a fixed manner. FixConfig(FixConfigOptions) hcl.Diagnostics }
type ConfigInspector ¶ added in v1.6.1
type ConfigInspector interface { // Inspect will output self inspection for a configuration InspectConfig(InspectConfigOptions) (ret int) }
type Core ¶ added in v0.8.0
Core is the main executor of Packer. If Packer is being used as a library, this is the struct you'll want to instantiate to get anything done.
func (*Core) BuildNames ¶ added in v0.8.0
BuildNames returns the builds that are available in this configured core.
func (*Core) Context ¶ added in v0.8.0
func (c *Core) Context() *interpolate.Context
Context returns an interpolation context.
func (*Core) EvaluateExpression ¶ added in v1.6.0
func (*Core) FixConfig ¶ added in v1.6.0
func (c *Core) FixConfig(opts FixConfigOptions) hcl.Diagnostics
func (*Core) GetBuilds ¶ added in v1.6.0
func (c *Core) GetBuilds(opts GetBuildsOptions) ([]packersdk.Build, hcl.Diagnostics)
This is used for json templates to launch the build plugins. They will be prepared via b.Prepare() later.
func (*Core) Initialize ¶ added in v1.6.1
func (*Core) InspectConfig ¶ added in v1.6.1
func (c *Core) InspectConfig(opts InspectConfigOptions) int
type CoreBuild ¶ added in v1.5.0
type CoreBuild struct { BuildName string Type string Builder packersdk.Builder BuilderConfig interface{} BuilderType string Provisioners []CoreBuildProvisioner PostProcessors [][]CoreBuildPostProcessor CleanupProvisioner CoreBuildProvisioner TemplatePath string Variables map[string]string // Indicates whether the build is already initialized before calling Prepare(..) Prepared bool // contains filtered or unexported fields }
A CoreBuild struct represents a single build job, the result of which should be a single machine image artifact. This artifact may be comprised of multiple files, of course, but it should be for only a single provider (such as VirtualBox, EC2, etc.).
func (*CoreBuild) Prepare ¶ added in v1.5.0
Prepare prepares the build by doing some initialization for the builder and any hooks. This _must_ be called prior to Run. The parameter is the overrides for the variables within the template (if any).
func (*CoreBuild) Run ¶ added in v1.5.0
Runs the actual build. Prepare must be called prior to running this.
func (*CoreBuild) SetOnError ¶ added in v1.5.0
type CoreBuildPostProcessor ¶ added in v1.5.0
type CoreBuildPostProcessor struct { PostProcessor packersdk.PostProcessor PType string PName string KeepInputArtifact *bool // contains filtered or unexported fields }
CoreBuildPostProcessor Keeps track of the post-processor and the configuration of the post-processor used within a build.
type CoreBuildProvisioner ¶ added in v1.5.0
type CoreBuildProvisioner struct { PType string PName string Provisioner packersdk.Provisioner // contains filtered or unexported fields }
CoreBuildProvisioner keeps track of the provisioner and the configuration of the provisioner within the build.
type CoreConfig ¶ added in v0.8.0
type CoreConfig struct { Components ComponentFinder Template *template.Template Variables map[string]string SensitiveVariables []string Version string // These are set by command-line flags Except []string Only []string }
CoreConfig is the structure for initializing a new Core. Once a CoreConfig is used to initialize a Core, it shouldn't be re-used or modified again.
func TestCoreConfig ¶ added in v0.8.0
func TestCoreConfig(t *testing.T) *CoreConfig
type DebuggedProvisioner ¶ added in v1.2.5
type DebuggedProvisioner struct { Provisioner packersdk.Provisioner // contains filtered or unexported fields }
DebuggedProvisioner is a Provisioner implementation that waits until a key press before the provisioner is actually run.
func (*DebuggedProvisioner) ConfigSpec ¶ added in v1.5.0
func (p *DebuggedProvisioner) ConfigSpec() hcldec.ObjectSpec
func (*DebuggedProvisioner) FlatConfig ¶ added in v1.5.0
func (p *DebuggedProvisioner) FlatConfig() interface{}
func (*DebuggedProvisioner) Prepare ¶ added in v1.2.5
func (p *DebuggedProvisioner) Prepare(raws ...interface{}) error
type Evaluator ¶ added in v1.6.0
type Evaluator interface { // EvaluateExpression is meant to be used in the `packer console` command. // It parses the input string and returns what needs to be displayed. In // case of an error the error should be displayed. EvaluateExpression(expr string) (output string, exit bool, diags hcl.Diagnostics) }
type FixConfigMode ¶ added in v1.6.0
type FixConfigMode int
const ( // Stdout will make FixConfig simply print what the config should be; it // will only work when a single file is passed. Stdout FixConfigMode = iota // Inplace fixes your files on the spot. Inplace // Diff shows a full diff. Diff )
func FixConfigModeString ¶ added in v1.6.0
func FixConfigModeString(s string) (FixConfigMode, error)
FixConfigModeString retrieves an enum value from the enum constants string name. Throws an error if the param is not part of the enum.
func FixConfigModeValues ¶ added in v1.6.0
func FixConfigModeValues() []FixConfigMode
FixConfigModeValues returns all values of the enum
func (FixConfigMode) IsAFixConfigMode ¶ added in v1.6.0
func (i FixConfigMode) IsAFixConfigMode() bool
IsAFixConfigMode returns "true" if the value is listed in the enum definition. "false" otherwise
func (FixConfigMode) String ¶ added in v1.6.0
func (i FixConfigMode) String() string
type FixConfigOptions ¶ added in v1.6.0
type FixConfigOptions struct {
Mode FixConfigMode
}
type FlatMockPostProcessor ¶ added in v1.5.0
type FlatMockPostProcessor struct { ArtifactId *string `cty:"artifact_id" hcl:"artifact_id"` Keep *bool `cty:"keep" hcl:"keep"` ForceOverride *bool `cty:"force_override" hcl:"force_override"` Error error `cty:"error" hcl:"error"` ConfigureCalled *bool `cty:"configure_called" hcl:"configure_called"` ConfigureConfigs []interface{} `cty:"configure_configs" hcl:"configure_configs"` ConfigureError error `cty:"configure_error" hcl:"configure_error"` PostProcessCalled *bool `cty:"post_process_called" hcl:"post_process_called"` PostProcessArtifact packer.Artifact `cty:"post_process_artifact" hcl:"post_process_artifact"` PostProcessUi packer.Ui `cty:"post_process_ui" hcl:"post_process_ui"` }
FlatMockPostProcessor is an auto-generated flat version of MockPostProcessor. Where the contents of a field with a `mapstructure:,squash` tag are bubbled up.
func (*FlatMockPostProcessor) HCL2Spec ¶ added in v1.5.0
func (*FlatMockPostProcessor) HCL2Spec() map[string]hcldec.Spec
HCL2Spec returns the hcl spec of a MockPostProcessor. This spec is used by HCL to read the fields of MockPostProcessor. The decoded values from this spec will then be applied to a FlatMockPostProcessor.
type GetBuildsOptions ¶ added in v1.6.0
type Handler ¶ added in v1.6.0
type Handler interface { Initialize() hcl.Diagnostics Evaluator BuildGetter ConfigFixer ConfigInspector }
The packer.Handler handles all Packer things.
type HookedProvisioner ¶ added in v1.1.2
type HookedProvisioner struct { Provisioner packersdk.Provisioner Config interface{} TypeName string }
A HookedProvisioner represents a provisioner and information describing it
type InspectConfigOptions ¶ added in v1.6.1
type MachineReadableUi ¶ added in v0.3.0
type MachineReadableUi struct { Writer io.Writer PB packersdk.NoopProgressTracker }
MachineReadableUi is a UI that only outputs machine-readable output to the given Writer.
func (*MachineReadableUi) Ask ¶ added in v0.3.0
func (u *MachineReadableUi) Ask(query string) (string, error)
func (*MachineReadableUi) Error ¶ added in v0.3.0
func (u *MachineReadableUi) Error(message string)
func (*MachineReadableUi) Machine ¶ added in v0.3.0
func (u *MachineReadableUi) Machine(category string, args ...string)
func (*MachineReadableUi) Message ¶ added in v0.3.0
func (u *MachineReadableUi) Message(message string)
func (*MachineReadableUi) Say ¶ added in v0.3.0
func (u *MachineReadableUi) Say(message string)
func (*MachineReadableUi) TrackProgress ¶ added in v1.6.3
func (u *MachineReadableUi) TrackProgress(src string, currentSize, totalSize int64, stream io.ReadCloser) (body io.ReadCloser)
type MockPostProcessor ¶ added in v0.8.0
type MockPostProcessor struct { ArtifactId string Keep bool ForceOverride bool Error error ConfigureCalled bool ConfigureConfigs []interface{} ConfigureError error PostProcessCalled bool PostProcessArtifact packersdk.Artifact PostProcessUi packersdk.Ui }
MockPostProcessor is an implementation of PostProcessor that can be used for tests.
func TestPostProcessor ¶ added in v0.8.0
func TestPostProcessor(t *testing.T, c *CoreConfig, n string) *MockPostProcessor
TestPostProcessor sets the prov. with the name n to the component finder and returns the mock.
func (*MockPostProcessor) ConfigSpec ¶ added in v1.5.0
func (t *MockPostProcessor) ConfigSpec() hcldec.ObjectSpec
func (*MockPostProcessor) Configure ¶ added in v0.8.0
func (t *MockPostProcessor) Configure(configs ...interface{}) error
func (*MockPostProcessor) FlatMapstructure ¶ added in v1.5.0
func (*MockPostProcessor) FlatMapstructure() interface{ HCL2Spec() map[string]hcldec.Spec }
FlatMapstructure returns a new FlatMockPostProcessor. FlatMockPostProcessor is an auto-generated flat version of MockPostProcessor. Where the contents a fields with a `mapstructure:,squash` tag are bubbled up.
type PackerReport ¶ added in v1.0.1
type PackerReport struct { Spans []*TelemetrySpan `json:"spans"` ExitCode int `json:"exit_code"` Error string `json:"error"` Command string `json:"command"` }
type PausedProvisioner ¶ added in v0.5.0
type PausedProvisioner struct { PauseBefore time.Duration Provisioner packersdk.Provisioner }
PausedProvisioner is a Provisioner implementation that pauses before the provisioner is actually run.
func (*PausedProvisioner) ConfigSpec ¶ added in v1.5.0
func (p *PausedProvisioner) ConfigSpec() hcldec.ObjectSpec
func (*PausedProvisioner) FlatConfig ¶ added in v1.5.0
func (p *PausedProvisioner) FlatConfig() interface{}
func (*PausedProvisioner) Prepare ¶ added in v0.5.0
func (p *PausedProvisioner) Prepare(raws ...interface{}) error
type PostProcessorFunc ¶
type PostProcessorFunc func(name string) (packersdk.PostProcessor, error)
The function type used to lookup PostProcessor implementations.
type PostProcessorStore ¶ added in v1.5.0
type PostProcessorStore interface { BasicStore Start(name string) (packersdk.PostProcessor, error) }
type ProvisionHook ¶
type ProvisionHook struct { // The provisioners to run as part of the hook. These should already // be prepared (by calling Prepare) at some earlier stage. Provisioners []*HookedProvisioner }
A Hook implementation that runs the given provisioners.
type ProvisionerFunc ¶
type ProvisionerFunc func(name string) (packersdk.Provisioner, error)
The function type used to lookup Provisioner implementations.
type ProvisionerStore ¶ added in v1.5.0
type ProvisionerStore interface { BasicStore Start(name string) (packersdk.Provisioner, error) }
type RetriedProvisioner ¶ added in v1.5.6
type RetriedProvisioner struct { MaxRetries int Provisioner packersdk.Provisioner }
RetriedProvisioner is a Provisioner implementation that retries the provisioner whenever there's an error.
func (*RetriedProvisioner) ConfigSpec ¶ added in v1.5.6
func (r *RetriedProvisioner) ConfigSpec() hcldec.ObjectSpec
func (*RetriedProvisioner) FlatConfig ¶ added in v1.5.6
func (r *RetriedProvisioner) FlatConfig() interface{}
func (*RetriedProvisioner) Prepare ¶ added in v1.5.6
func (r *RetriedProvisioner) Prepare(raws ...interface{}) error
type TargetedUI ¶ added in v1.0.0
TargetedUI is a UI that wraps another UI implementation and modifies the output to indicate a specific target. Specifically, all Say output is prefixed with the target name. Message output is not prefixed but is offset by the length of the target so that output is lined up properly with Say output. Machine-readable output has the proper target set.
func (*TargetedUI) Error ¶ added in v1.0.0
func (u *TargetedUI) Error(message string)
func (*TargetedUI) Machine ¶ added in v1.0.0
func (u *TargetedUI) Machine(t string, args ...string)
func (*TargetedUI) Message ¶ added in v1.0.0
func (u *TargetedUI) Message(message string)
func (*TargetedUI) Say ¶ added in v1.0.0
func (u *TargetedUI) Say(message string)
func (*TargetedUI) TrackProgress ¶ added in v1.4.0
func (u *TargetedUI) TrackProgress(src string, currentSize, totalSize int64, stream io.ReadCloser) io.ReadCloser
type TelemetrySpan ¶ added in v1.0.1
type TelemetrySpan struct { EndTime time.Time `json:"end_time"` Error string `json:"error"` Name string `json:"name"` Options []string `json:"options"` StartTime time.Time `json:"start_time"` Type string `json:"type"` }
func (*TelemetrySpan) End ¶ added in v1.0.1
func (s *TelemetrySpan) End(err error)
type TimeoutProvisioner ¶ added in v1.4.0
type TimeoutProvisioner struct { packersdk.Provisioner Timeout time.Duration }
TimeoutProvisioner is a Provisioner implementation that can timeout after a duration
type TimestampedUi ¶ added in v1.3.2
type TimestampedUi struct { Ui packersdk.Ui PB getter.ProgressTracker }
TimestampedUi is a UI that wraps another UI implementation and prefixes each message with an RFC3339 timestamp
func (*TimestampedUi) Ask ¶ added in v1.3.2
func (u *TimestampedUi) Ask(query string) (string, error)
func (*TimestampedUi) Error ¶ added in v1.3.2
func (u *TimestampedUi) Error(message string)
func (*TimestampedUi) Machine ¶ added in v1.3.2
func (u *TimestampedUi) Machine(message string, args ...string)
func (*TimestampedUi) Message ¶ added in v1.3.2
func (u *TimestampedUi) Message(message string)
func (*TimestampedUi) Say ¶ added in v1.3.2
func (u *TimestampedUi) Say(message string)
func (*TimestampedUi) TrackProgress ¶ added in v1.4.0
func (u *TimestampedUi) TrackProgress(src string, currentSize, totalSize int64, stream io.ReadCloser) (body io.ReadCloser)
type UiProgressBar ¶ added in v1.6.3
type UiProgressBar struct {
// contains filtered or unexported fields
}
UiProgressBar is a progress bar compatible with go-getter used in our UI structs.
func (*UiProgressBar) TrackProgress ¶ added in v1.6.3
func (p *UiProgressBar) TrackProgress(src string, currentSize, totalSize int64, stream io.ReadCloser) io.ReadCloser