driver

package
v0.0.0-...-ce92fef Latest Latest
Warning

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

Go to latest
Published: Dec 10, 2018 License: MIT Imports: 21 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ImageTypeDocker = "docker"
	ImageTypeOCI    = "oci"
	ImageTypeQCOW   = "qcow"
)

ImageType constants provide some of the image types supported TODO: I think we can remove all but Docker, since the rest are supported externally

Variables

This section is empty.

Functions

This section is empty.

Types

type CommandDriver

type CommandDriver struct {
	Name string
}

CommandDriver relies upon a system command to provide a driver implementation

func (*CommandDriver) Handles

func (d *CommandDriver) Handles(dt string) bool

Handles executes the driver with `--handles` and parses the results

func (*CommandDriver) Run

func (d *CommandDriver) Run(op *Operation) error

Run executes the command

type Configurable

type Configurable interface {
	// Config returns a map of configuration names and values that can be set via environment variable
	Config() map[string]string
	// SetConfig allows setting configuration, where name corresponds to the key in Config, and value is
	// the value to be set.
	SetConfig(map[string]string)
}

Configurable drivers can explain their configuration, and have it explicitly set

type DebugDriver

type DebugDriver struct {
	// contains filtered or unexported fields
}

DebugDriver prints the information passed to a driver

It does not ever run the image.

func (*DebugDriver) Config

func (d *DebugDriver) Config() map[string]string

Config returns the configuration help text

func (*DebugDriver) Handles

func (d *DebugDriver) Handles(dt string) bool

Handles always returns true, effectively claiming to work for any image type

func (*DebugDriver) Run

func (d *DebugDriver) Run(op *Operation) error

Run executes the operation on the Debug driver

func (*DebugDriver) SetConfig

func (d *DebugDriver) SetConfig(settings map[string]string)

SetConfig sets configuration for this driver

type DockerDriver

type DockerDriver struct {

	// If true, this will not actually run Docker
	Simulate bool
	// contains filtered or unexported fields
}

DockerDriver is capable of running Docker invocation images using Docker itself.

func (*DockerDriver) Config

func (d *DockerDriver) Config() map[string]string

Config returns the Docker driver configuration options

func (*DockerDriver) Handles

func (d *DockerDriver) Handles(dt string) bool

Handles indicates that the Docker driver supports "docker" and "oci"

func (*DockerDriver) Run

func (d *DockerDriver) Run(op *Operation) error

Run executes the Docker driver

func (*DockerDriver) SetConfig

func (d *DockerDriver) SetConfig(settings map[string]string)

SetConfig sets Docker driver configuration

type Driver

type Driver interface {
	// Run executes the operation inside of the invocation image
	Run(*Operation) error
	// Handles receives an ImageType* and answers whether this driver supports that type
	Handles(string) bool
}

Driver is capable of running a invocation image

func Lookup

func Lookup(name string) (Driver, error)

Lookup takes a driver name and tries to resolve the most pertinent driver.

type Operation

type Operation struct {
	// Installation is the name of this installation
	Installation string `json:"installation_name"`
	// The revision ID for this installation
	Revision string `json:"revision"`
	// Action is the action to be performed
	Action string `json:"action"`
	// Parameters are the parameters to be injected into the container
	Parameters map[string]interface{} `json:"parameters"`
	// Image is the invocation image
	Image string `json:"image"`
	// ImageType is the type of image.
	ImageType string `json:"image_type"`
	// Environment contains environment variables that should be injected into the invocation image
	Environment map[string]string `json:"environment"`
	// Files contains files that should be injected into the invocation image.
	Files map[string]string `json:"files"`
	// Output stream for log messages from the driver
	Out io.Writer
}

Operation describes the data passed into the driver to run an operation

type ResolvedCred

type ResolvedCred struct {
	Type  string `json:"type"`
	Name  string `json:"name"`
	Value string `json:"value"`
}

ResolvedCred is a credential that has been resolved and is ready for injection into the runtime.

Jump to

Keyboard shortcuts

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