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 that must be implemented for a builder is the `packer.Builder`
|
||||
interface. It is reproduced below for easy reference. The reference below
|
||||
also contains some basic documentatin of what each of the methods are
|
||||
supposed to do.
|
||||
interface. It is reproduced below for easy reference. The actual interface
|
||||
in the source code contains some basic documentation as well explaining
|
||||
what each method should do.
|
||||
|
||||
<pre class="prettyprint">
|
||||
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
|
||||
|
||||
// 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)
|
||||
|
||||
// Cancel cancels a possibly running Builder. This should block until
|
||||
// the builder actually cancels and cleans up after itself.
|
||||
Cancel()
|
||||
}
|
||||
</pre>
|
||||
|
|
|
@ -28,24 +28,14 @@ in the core Packer configuration.
|
|||
## The Interface
|
||||
|
||||
The interface that must be implemented for a command is the `packer.Command`
|
||||
interface. It is reproduced below for easy reference. The reference below
|
||||
also contains some basic documentation of what each of the methods are
|
||||
supposed to do.
|
||||
interface. It is reproduced below for easy reference. The actual interface
|
||||
in the source code contains some basic documentation as well explaining
|
||||
what each method should do.
|
||||
|
||||
<pre class="prettyprint">
|
||||
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
|
||||
|
||||
// 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
|
||||
|
||||
// Synopsis should return a one-line, short synopsis of the command.
|
||||
// This should be less than 50 characters ideally.
|
||||
Synopsis() string
|
||||
}
|
||||
</pre>
|
||||
|
|
|
@ -31,23 +31,13 @@ are served using the `plugin.ServePostProcessor` function.
|
|||
|
||||
The interface that must be implemented for a post-processor is the
|
||||
`packer.PostProcessor` interface. It is reproduced below for easy reference.
|
||||
The reference below also contains some basic documentation of what each of
|
||||
the methods are supposed to do.
|
||||
The actual interface in the source code contains some basic documentation as well explaining
|
||||
what each method should do.
|
||||
|
||||
|
||||
<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 {
|
||||
// Configure is responsible for setting up configuration, storing
|
||||
// the state for later, and returning and errors, such as validation
|
||||
// errors.
|
||||
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)
|
||||
}
|
||||
</pre>
|
||||
|
|
|
@ -26,22 +26,13 @@ are served using the `plugin.ServeProvisioner` function.
|
|||
|
||||
The interface that must be implemented for a provisioner is the
|
||||
`packer.Provisioner` interface. It is reproduced below for easy reference.
|
||||
The reference below also contains some basic documentation of what each of
|
||||
the methods are supposed to do.
|
||||
The actual interface in the source code contains some basic documentation as well explaining
|
||||
what each method should do.
|
||||
|
||||
|
||||
<pre class="prettyprint">
|
||||
// A provisioner is responsible for installing and configuring software
|
||||
// on a machine prior to building the actual image.
|
||||
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
|
||||
|
||||
// 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)
|
||||
}
|
||||
</pre>
|
||||
|
|
Loading…
Reference in New Issue