instance

package
v0.0.0-...-a002913 Latest Latest
Warning

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

Go to latest
Published: Oct 2, 2015 License: AGPL-3.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

View Source
const (
	NONE = ContainerType("none")
	LXC  = ContainerType("lxc")
	KVM  = ContainerType("kvm")
)
View Source
const (
	// MachineScope is a special scope name that is used
	// for machine placement directives (e.g. --to 0).
	MachineScope = "#"
)

Variables

View Source
var ContainerTypes []ContainerType = []ContainerType{
	LXC,
	KVM,
}

ContainerTypes is used to validate add-machine arguments.

View Source
var ErrPlacementScopeMissing = fmt.Errorf("placement scope missing")

Functions

func IsRetryableCreationError

func IsRetryableCreationError(err error) bool

IsRetryableCreationError returns true if the given error is RetryableCreationError

Types

type ContainerType

type ContainerType string

func ParseContainerType

func ParseContainerType(ctype string) (ContainerType, error)

ParseContainerType converts the specified string into a supported ContainerType instance or returns an error if the container type is invalid.

func ParseContainerTypeOrNone

func ParseContainerTypeOrNone(ctype string) (ContainerType, error)

ParseContainerTypeOrNone converts the specified string into a supported ContainerType instance or returns an error if the container type is invalid. For this version of the function, 'none' is a valid value.

type HardwareCharacteristics

type HardwareCharacteristics struct {
	Arch     *string   `json:",omitempty" yaml:"arch,omitempty"`
	Mem      *uint64   `json:",omitempty" yaml:"mem,omitempty"`
	RootDisk *uint64   `json:",omitempty" yaml:"rootdisk,omitempty"`
	CpuCores *uint64   `json:",omitempty" yaml:"cpucores,omitempty"`
	CpuPower *uint64   `json:",omitempty" yaml:"cpupower,omitempty"`
	Tags     *[]string `json:",omitempty" yaml:"tags,omitempty"`

	AvailabilityZone *string `json:",omitempty" yaml:"availabilityzone,omitempty"`
}

HardwareCharacteristics represents the characteristics of the instance (if known). Attributes that are nil are unknown or not supported.

func MustParseHardware

func MustParseHardware(args ...string) HardwareCharacteristics

MustParseHardware constructs a HardwareCharacteristics from the supplied arguments, as Parse, but panics on failure.

func ParseHardware

func ParseHardware(args ...string) (HardwareCharacteristics, error)

ParseHardware constructs a HardwareCharacteristics from the supplied arguments, each of which must contain only spaces and name=value pairs. If any name is specified more than once, an error is returned.

func (*HardwareCharacteristics) Set

Implement gnuflag.Value

func (HardwareCharacteristics) String

func (hc HardwareCharacteristics) String() string

type Id

type Id string

An instance Id is a provider-specific identifier associated with an instance (physical or virtual machine allocated in the provider).

const UnknownId Id = ""

UnknownId can be used to explicitly specify the instance ID does not matter.

type Instance

type Instance interface {
	// Id returns a provider-generated identifier for the Instance.
	Id() Id

	// Status returns the provider-specific status for the instance.
	Status() string

	// Addresses returns a list of hostnames or ip addresses
	// associated with the instance.
	Addresses() ([]network.Address, error)

	// OpenPorts opens the given port ranges on the instance, which
	// should have been started with the given machine id.
	OpenPorts(machineId string, ports []network.PortRange) error

	// ClosePorts closes the given port ranges on the instance, which
	// should have been started with the given machine id.
	ClosePorts(machineId string, ports []network.PortRange) error

	// Ports returns the set of port ranges open on the instance,
	// which should have been started with the given machine id. The
	// port ranges are returned as sorted by network.SortPortRanges().
	Ports(machineId string) ([]network.PortRange, error)
}

Instance represents the the realization of a machine in state.

type Placement

type Placement struct {
	// Scope is the scope of the placement directive. Scope may
	// be a container type (lxc, kvm), instance.MachineScope, or
	// an environment name.
	//
	// If Scope is empty, then it must be inferred from the context.
	Scope string

	// Directive is a scope-specific placement directive.
	//
	// For MachineScope or a container scope, this may be empty or
	// the ID of an existing machine.
	Directive string
}

Placement defines a placement directive, which has a scope and a value that is scope-specific.

func MustParsePlacement

func MustParsePlacement(directive string) *Placement

MustParsePlacement attempts to parse the specified string and create a corresponding Placement structure, panicking if an error occurs.

func ParsePlacement

func ParsePlacement(directive string) (*Placement, error)

ParsePlacement attempts to parse the specified string and create a corresponding Placement structure.

If the placement directive is non-empty and missing a scope, ErrPlacementScopeMissing will be returned as well as a Placement with an empty Scope field.

func (*Placement) String

func (p *Placement) String() string

type RetryableCreationError

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

An error reporting that an error has occurred during instance creation (e.g. due to a failed container from on of previous deploys) and that it is safe to restart instance creation

func NewRetryableCreationError

func NewRetryableCreationError(errorMessage string) *RetryableCreationError

func (RetryableCreationError) Error

func (e RetryableCreationError) Error() string

Returns the error message

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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