website: fix up the interface pastings to not have comments
This commit is contained in:
parent
0e8b61c162
commit
90af6f1d38
|
@ -23,30 +23,14 @@ Prior to reading this page, it is assumed you have read the page on
|
||||||
## The Interface
|
## The Interface
|
||||||
|
|
||||||
The interface that must be implemented for a builder is the `packer.Builder`
|
The interface that must be implemented for a builder is the `packer.Builder`
|
||||||
interface. It is reproduced below for easy reference. The reference below
|
interface. It is reproduced below for easy reference. The actual interface
|
||||||
also contains some basic documentatin of what each of the methods are
|
in the source code contains some basic documentation as well explaining
|
||||||
supposed to do.
|
what each method should do.
|
||||||
|
|
||||||
<pre class="prettyprint">
|
<pre class="prettyprint">
|
||||||
type Builder interface {
|
type Builder interface {
|
||||||
// Prepare is responsible for configuring the builder and validating
|
|
||||||
// that configuration. Any setup should be done in this method. Note that
|
|
||||||
// NO side effects should take place in prepare, it is meant as a state
|
|
||||||
// setup only. Calling Prepare is not necessarilly followed by a Run.
|
|
||||||
//
|
|
||||||
// The parameters to Prepare are a set of interface{} values of the
|
|
||||||
// configuration. These are almost always `map[string]interface{}`
|
|
||||||
// parsed from a template, but no guarantee is made.
|
|
||||||
//
|
|
||||||
// Each of the configuration values should merge into the final
|
|
||||||
// configuration.
|
|
||||||
Prepare(...interface{}) error
|
Prepare(...interface{}) error
|
||||||
|
|
||||||
// Run is where the actual build should take place. It takes a Build and a Ui.
|
|
||||||
Run(ui Ui, hook Hook, cache Cache) (Artifact, error)
|
Run(ui Ui, hook Hook, cache Cache) (Artifact, error)
|
||||||
|
|
||||||
// Cancel cancels a possibly running Builder. This should block until
|
|
||||||
// the builder actually cancels and cleans up after itself.
|
|
||||||
Cancel()
|
Cancel()
|
||||||
}
|
}
|
||||||
</pre>
|
</pre>
|
||||||
|
|
|
@ -28,24 +28,14 @@ in the core Packer configuration.
|
||||||
## The Interface
|
## The Interface
|
||||||
|
|
||||||
The interface that must be implemented for a command is the `packer.Command`
|
The interface that must be implemented for a command is the `packer.Command`
|
||||||
interface. It is reproduced below for easy reference. The reference below
|
interface. It is reproduced below for easy reference. The actual interface
|
||||||
also contains some basic documentation of what each of the methods are
|
in the source code contains some basic documentation as well explaining
|
||||||
supposed to do.
|
what each method should do.
|
||||||
|
|
||||||
<pre class="prettyprint">
|
<pre class="prettyprint">
|
||||||
type Command interface {
|
type Command interface {
|
||||||
// Help should return long-form help text that includes the command-line
|
|
||||||
// usage, a brief few sentences explaining the function of the command,
|
|
||||||
// and the complete list of flags the command accepts.
|
|
||||||
Help() string
|
Help() string
|
||||||
|
|
||||||
// Run should run the actual command with the given environmet and
|
|
||||||
// command-line arguments. It should return the exit status when it is
|
|
||||||
// finished.
|
|
||||||
Run(env Environment, args []string) int
|
Run(env Environment, args []string) int
|
||||||
|
|
||||||
// Synopsis should return a one-line, short synopsis of the command.
|
|
||||||
// This should be less than 50 characters ideally.
|
|
||||||
Synopsis() string
|
Synopsis() string
|
||||||
}
|
}
|
||||||
</pre>
|
</pre>
|
||||||
|
|
|
@ -31,23 +31,13 @@ are served using the `plugin.ServePostProcessor` function.
|
||||||
|
|
||||||
The interface that must be implemented for a post-processor is the
|
The interface that must be implemented for a post-processor is the
|
||||||
`packer.PostProcessor` interface. It is reproduced below for easy reference.
|
`packer.PostProcessor` interface. It is reproduced below for easy reference.
|
||||||
The reference below also contains some basic documentation of what each of
|
The actual interface in the source code contains some basic documentation as well explaining
|
||||||
the methods are supposed to do.
|
what each method should do.
|
||||||
|
|
||||||
|
|
||||||
<pre class="prettyprint">
|
<pre class="prettyprint">
|
||||||
// A PostProcessor is responsible for taking an artifact of a build
|
|
||||||
// and doing some sort of post-processing to turn this into another
|
|
||||||
// artifact. An example of a post-processor would be something that takes
|
|
||||||
// the result of a build, compresses it, and returns a new artifact containing
|
|
||||||
// a single file of the prior artifact compressed.
|
|
||||||
type PostProcessor interface {
|
type PostProcessor interface {
|
||||||
// Configure is responsible for setting up configuration, storing
|
|
||||||
// the state for later, and returning and errors, such as validation
|
|
||||||
// errors.
|
|
||||||
Configure(interface{}) error
|
Configure(interface{}) error
|
||||||
|
|
||||||
// PostProcess takes a previously created Artifact and produces another
|
|
||||||
// Artifact. If an error occurs, it should return that error.
|
|
||||||
PostProcess(Artifact) (Artifact, error)
|
PostProcess(Artifact) (Artifact, error)
|
||||||
}
|
}
|
||||||
</pre>
|
</pre>
|
||||||
|
|
|
@ -26,22 +26,13 @@ are served using the `plugin.ServeProvisioner` function.
|
||||||
|
|
||||||
The interface that must be implemented for a provisioner is the
|
The interface that must be implemented for a provisioner is the
|
||||||
`packer.Provisioner` interface. It is reproduced below for easy reference.
|
`packer.Provisioner` interface. It is reproduced below for easy reference.
|
||||||
The reference below also contains some basic documentation of what each of
|
The actual interface in the source code contains some basic documentation as well explaining
|
||||||
the methods are supposed to do.
|
what each method should do.
|
||||||
|
|
||||||
|
|
||||||
<pre class="prettyprint">
|
<pre class="prettyprint">
|
||||||
// A provisioner is responsible for installing and configuring software
|
|
||||||
// on a machine prior to building the actual image.
|
|
||||||
type Provisioner interface {
|
type Provisioner interface {
|
||||||
// Prepare is called with a set of configurations to setup the
|
|
||||||
// internal state of the provisioner. The multiple configurations
|
|
||||||
// should be merged in some sane way.
|
|
||||||
Prepare(...interface{}) error
|
Prepare(...interface{}) error
|
||||||
|
|
||||||
// Provision is called to actually provision the machine. A UI is
|
|
||||||
// given to communicate with the user, and a communicator is given that
|
|
||||||
// is guaranteed to be connected to some machine so that provisioning
|
|
||||||
// can be done.
|
|
||||||
Provision(Ui, Communicator)
|
Provision(Ui, Communicator)
|
||||||
}
|
}
|
||||||
</pre>
|
</pre>
|
||||||
|
|
Loading…
Reference in New Issue