triton

package
v1.3.1 Latest Latest
Warning

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

Go to latest
Published: Sep 14, 2018 License: MPL-2.0 Imports: 22 Imported by: 0

Documentation

Index

Constants

View Source
const (
	BuilderId = "joyent.triton"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type AccessConfig

type AccessConfig struct {
	Endpoint              string `mapstructure:"triton_url"`
	Account               string `mapstructure:"triton_account"`
	Username              string `mapstructure:"triton_user"`
	KeyID                 string `mapstructure:"triton_key_id"`
	KeyMaterial           string `mapstructure:"triton_key_material"`
	InsecureSkipTLSVerify bool   `mapstructure:"insecure_skip_tls_verify"`
	// contains filtered or unexported fields
}

AccessConfig is for common configuration related to Triton access

func (*AccessConfig) Comm

func (c *AccessConfig) Comm() communicator.Config

func (*AccessConfig) CreateTritonClient

func (c *AccessConfig) CreateTritonClient() (*Client, error)

func (*AccessConfig) Prepare

func (c *AccessConfig) Prepare(ctx *interpolate.Context) []error

Prepare performs basic validation on the AccessConfig and ensures we can sign a request.

type Artifact

type Artifact struct {
	// ImageID is the image ID of the artifact
	ImageID string

	// BuilderIDValue is the unique ID for the builder that created this Image
	BuilderIDValue string

	// SDC connection for cleanup etc
	Driver Driver
}

Artifact is an artifact implementation that contains built Triton images.

func (*Artifact) BuilderId

func (a *Artifact) BuilderId() string

func (*Artifact) Destroy

func (a *Artifact) Destroy() error

func (*Artifact) Files

func (*Artifact) Files() []string

func (*Artifact) Id

func (a *Artifact) Id() string

func (*Artifact) State

func (a *Artifact) State(name string) interface{}

func (*Artifact) String

func (a *Artifact) String() string

type Builder

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

func (*Builder) Cancel

func (b *Builder) Cancel()

Cancel cancels a possibly running Builder. This should block until the builder actually cancels and cleans up after itself.

func (*Builder) Prepare

func (b *Builder) Prepare(raws ...interface{}) ([]string, error)

func (*Builder) Run

func (b *Builder) Run(ui packer.Ui, hook packer.Hook, cache packer.Cache) (packer.Artifact, error)

type Client added in v1.1.2

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

func (*Client) Compute added in v1.1.2

func (c *Client) Compute() (*compute.ComputeClient, error)

func (*Client) Network added in v1.1.2

func (c *Client) Network() (*network.NetworkClient, error)

type Config

type Config struct {
	common.PackerConfig `mapstructure:",squash"`
	AccessConfig        `mapstructure:",squash"`
	SourceMachineConfig `mapstructure:",squash"`
	TargetImageConfig   `mapstructure:",squash"`

	Comm communicator.Config `mapstructure:",squash"`
	// contains filtered or unexported fields
}

type Driver

type Driver interface {
	GetImage(config Config) (string, error)
	CreateImageFromMachine(machineId string, config Config) (string, error)
	CreateMachine(config Config) (string, error)
	DeleteImage(imageId string) error
	DeleteMachine(machineId string) error
	GetMachineIP(machineId string) (string, error)
	StopMachine(machineId string) error
	WaitForImageCreation(imageId string, timeout time.Duration) error
	WaitForMachineDeletion(machineId string, timeout time.Duration) error
	WaitForMachineState(machineId string, state string, timeout time.Duration) error
}

func NewDriverTriton

func NewDriverTriton(ui packer.Ui, config Config) (Driver, error)

type DriverMock

type DriverMock struct {
	CreateImageFromMachineId  string
	CreateImageFromMachineErr error

	CreateMachineId  string
	CreateMachineErr error

	DeleteImageId  string
	DeleteImageErr error

	DeleteMachineId  string
	DeleteMachineErr error

	GetImageId  string
	GetImageErr error

	GetMachineErr error

	StopMachineId  string
	StopMachineErr error

	WaitForImageCreationErr error

	WaitForMachineDeletionErr error

	WaitForMachineStateErr error
}

func (*DriverMock) CreateImageFromMachine

func (d *DriverMock) CreateImageFromMachine(machineId string, config Config) (string, error)

func (*DriverMock) CreateMachine

func (d *DriverMock) CreateMachine(config Config) (string, error)

func (*DriverMock) DeleteImage

func (d *DriverMock) DeleteImage(imageId string) error

func (*DriverMock) DeleteMachine

func (d *DriverMock) DeleteMachine(machineId string) error

func (*DriverMock) GetImage added in v1.1.2

func (d *DriverMock) GetImage(config Config) (string, error)

func (*DriverMock) GetMachineIP added in v1.0.1

func (d *DriverMock) GetMachineIP(machineId string) (string, error)

func (*DriverMock) StopMachine

func (d *DriverMock) StopMachine(machineId string) error

func (*DriverMock) WaitForImageCreation

func (d *DriverMock) WaitForImageCreation(machineId string, timeout time.Duration) error

func (*DriverMock) WaitForMachineDeletion

func (d *DriverMock) WaitForMachineDeletion(machineId string, timeout time.Duration) error

func (*DriverMock) WaitForMachineState

func (d *DriverMock) WaitForMachineState(machineId string, state string, timeout time.Duration) error

type MachineImageFilter added in v1.1.2

type MachineImageFilter struct {
	MostRecent bool `mapstructure:"most_recent"`
	Name       string
	OS         string
	Version    string
	Public     bool
	State      string
	Owner      string
	Type       string
}

func (*MachineImageFilter) Empty added in v1.1.2

func (m *MachineImageFilter) Empty() bool

type SourceMachineConfig

type SourceMachineConfig struct {
	MachineName            string             `mapstructure:"source_machine_name"`
	MachinePackage         string             `mapstructure:"source_machine_package"`
	MachineImage           string             `mapstructure:"source_machine_image"`
	MachineNetworks        []string           `mapstructure:"source_machine_networks"`
	MachineMetadata        map[string]string  `mapstructure:"source_machine_metadata"`
	MachineTags            map[string]string  `mapstructure:"source_machine_tags"`
	MachineFirewallEnabled bool               `mapstructure:"source_machine_firewall_enabled"`
	MachineImageFilters    MachineImageFilter `mapstructure:"source_machine_image_filter"`
}

SourceMachineConfig represents the configuration to run a machine using the SDC API in order for provisioning to take place.

func (*SourceMachineConfig) Prepare

func (c *SourceMachineConfig) Prepare(ctx *interpolate.Context) []error

Prepare performs basic validation on a SourceMachineConfig struct.

type StepCreateImageFromMachine

type StepCreateImageFromMachine struct{}

StepCreateImageFromMachine creates an image with the specified attributes from the machine with the given ID, and waits for the image to be created. The machine must be in the "stopped" state prior to this step being run.

func (*StepCreateImageFromMachine) Cleanup

func (s *StepCreateImageFromMachine) Cleanup(state multistep.StateBag)

func (*StepCreateImageFromMachine) Run

type StepCreateSourceMachine

type StepCreateSourceMachine struct{}

StepCreateSourceMachine creates an machine with the specified attributes and waits for it to become available for provisioners.

func (*StepCreateSourceMachine) Cleanup

func (s *StepCreateSourceMachine) Cleanup(state multistep.StateBag)

func (*StepCreateSourceMachine) Run

type StepDeleteMachine

type StepDeleteMachine struct{}

StepDeleteMachine deletes the machine with the ID specified in state["machine"]

func (*StepDeleteMachine) Cleanup

func (s *StepDeleteMachine) Cleanup(state multistep.StateBag)

func (*StepDeleteMachine) Run

type StepStopMachine

type StepStopMachine struct{}

StepStopMachine stops the machine with the given Machine ID, and waits for it to reach the stopped state.

func (*StepStopMachine) Cleanup

func (s *StepStopMachine) Cleanup(state multistep.StateBag)

func (*StepStopMachine) Run

type StepWaitForStopNotToFail

type StepWaitForStopNotToFail struct{}

StepWaitForStopNotToFail waits for 10 seconds before returning with continue in order to prevent an observed issue where machines stopped immediately after they are started never actually stop.

func (*StepWaitForStopNotToFail) Cleanup

func (s *StepWaitForStopNotToFail) Cleanup(state multistep.StateBag)

func (*StepWaitForStopNotToFail) Run

type TargetImageConfig

type TargetImageConfig struct {
	ImageName        string            `mapstructure:"image_name"`
	ImageVersion     string            `mapstructure:"image_version"`
	ImageDescription string            `mapstructure:"image_description"`
	ImageHomepage    string            `mapstructure:"image_homepage"`
	ImageEULA        string            `mapstructure:"image_eula_url"`
	ImageACL         []string          `mapstructure:"image_acls"`
	ImageTags        map[string]string `mapstructure:"image_tags"`
}

TargetImageConfig represents the configuration for the image to be created from the source machine.

func (*TargetImageConfig) Prepare

func (c *TargetImageConfig) Prepare(ctx *interpolate.Context) []error

Prepare performs basic validation on a TargetImageConfig struct.

Jump to

Keyboard shortcuts

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