juju: github.com/juju/juju/core/instance Index | Files

package instance

import "github.com/juju/juju/core/instance"


Package Files

container.go hardwarecharacteristics.go instance.go namespace.go placement.go


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


var ContainerTypes = []ContainerType{

ContainerTypes is used to validate add-machine arguments.

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

type ContainerType Uses

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 Uses

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 Uses

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 Uses

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 Uses

func MustParseHardware(args ...string) HardwareCharacteristics

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

func ParseHardware Uses

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 Uses

func (hc *HardwareCharacteristics) Clone() *HardwareCharacteristics

Clone returns a copy of the hardware characteristics.

func (HardwareCharacteristics) String Uses

func (hc HardwareCharacteristics) String() string

type Id Uses

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 Uses

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 Uses

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 Uses

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 Uses

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 Uses

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 Uses

func (p *Placement) String() string

type Status Uses

type Status struct {
    Status  status.Status
    Message string

Status represents the status for a provider instance.

Package instance imports 10 packages (graph) and is imported by 237 packages. Updated 2020-09-23. Refresh now. Tools for package owners.