Documentation

Index

Constants

const (
	// MachineScope is a special scope name that is used
	// for machine placement directives (e.g. --to 0).
	MachineScope = "#"
)

Variables

var ContainerTypes = []ContainerType{
	LXD,
	KVM,
}

ContainerTypes is used to validate add-machine arguments.


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

Functions

This section is empty.

Types

type ContainerType

type ContainerType string

ContainerType defines different container technologies known to juju.

const (
	NONE ContainerType = "none"
	LXD  ContainerType = "lxd"
	KVM  ContainerType = "kvm"
)

Known container types.

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 is the architecture of the processor.
	Arch *string `json:"arch,omitempty" yaml:"arch,omitempty"`

	// Mem is the size of RAM in megabytes.
	Mem *uint64 `json:"mem,omitempty" yaml:"mem,omitempty"`

	// RootDisk is the size of the disk in megabytes.
	RootDisk *uint64 `json:"root-disk,omitempty" yaml:"rootdisk,omitempty"`

	// RootDiskSource is where the disk storage resides.
	RootDiskSource *string `json:"root-disk-source,omitempty" yaml:"rootdisksource,omitempty"`

	// CpuCores is the number of logical cores the processor has.
	CpuCores *uint64 `json:"cpu-cores,omitempty" yaml:"cpucores,omitempty"`

	// CpuPower is a relative representation of the speed of the processor.
	CpuPower *uint64 `json:"cpu-power,omitempty" yaml:"cpupower,omitempty"`

	// Tags is a list of strings that identify the machine.
	Tags *[]string `json:"tags,omitempty" yaml:"tags,omitempty"`

	// AvailabilityZone defines the zone in which the machine resides.
	AvailabilityZone *string `json:"availability-zone,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) Clone

func (hc *HardwareCharacteristics) Clone() *HardwareCharacteristics

Clone returns a copy of the hardware characteristics.

func (HardwareCharacteristics) String

func (hc HardwareCharacteristics) String() string

type Id

type Id string

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 when it does not matter.

type Namespace

type Namespace interface {
	// Prefix returns the common part of the hostnames. i.e. 'juju-xxxxxx-'
	Prefix() string

	// Hostname returns a name suitable to be used for a machine hostname.
	// This function returns an error if the machine tags is invalid.
	Hostname(machineID string) (string, error)

	// MachineTag does the reverse of the Hostname method, and extracts the
	// Tag from the hostname.
	MachineTag(hostname string) (names.MachineTag, error)

	// Value returns the input prefixed with the namespace prefix.
	Value(string) string
}

Namespace provides a way to generate machine hostanmes with a given prefix.

func NewNamespace

func NewNamespace(modelUUID string) (Namespace, error)

NewNamespace returns a Namespace identified by the last six hex digits of the model UUID. NewNamespace returns an error if the model tag is invalid.

type Placement

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

	// 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 `json:"directive"`
}

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 Status

type Status struct {
	Status  status.Status
	Message string
}

Status represents the status for a provider instance.