instance

package
v0.0.0-...-a0d7459 Latest Latest
Warning

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

Go to latest
Published: Mar 21, 2017 License: AGPL-3.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

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{
	LXD,
	KVM,
}

ContainerTypes is used to validate add-machine arguments.

View Source
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 Distributor

type Distributor interface {
	// DistributeInstance takes a set of clean, empty
	// instances, and a distribution group, and returns
	// the subset of candidates which the policy will
	// allow entry into the distribution group.
	//
	// The AssignClean and AssignCleanEmpty unit
	// assignment policies will attempt to assign a
	// unit to each of the resulting instances until
	// one is successful. If no instances can be assigned
	// to (e.g. because of concurrent deployments), then
	// a new machine will be allocated.
	DistributeInstances(candidates, distributionGroup []Id) ([]Id, error)
}

Distributor is an interface that may be used to distribute application units across instances for high availability.

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"`

	// 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) 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() InstanceStatus

	// 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, rules []network.IngressRule) error

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

	// IngressRules returns the set of ingress rules for the instance,
	// which should have been applied to the given machine id. The
	// rules are returned as sorted by network.SortIngressRules().
	// It is expected that there be only one ingress rule result for a given
	// port range - the rule's SourceCIDRs will contain all applicable source
	// address rules for that port range.
	IngressRules(machineId string) ([]network.IngressRule, error)
}

Instance represents the the realization of a machine in state.

type InstanceStatus

type InstanceStatus struct {
	Status  status.Status
	Message string
}

InstanceStatus represents the status for a provider instance.

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

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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