instance

package
v0.0.9 Latest Latest
Warning

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

Go to latest
Published: Sep 13, 2013 License: AGPL-3.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

View Source
const (
	NONE = ContainerType("none")
	LXC  = ContainerType("lxc")
	KVM  = ContainerType("kvm")
	DOCK = ContainerType("dock")
)

Variables

View Source
var ErrNoDNSName = errors.New("DNS name not allocated")
View Source
var SupportedContainerTypes []ContainerType = []ContainerType{
	LXC,
	DOCK,
}

SupportedContainerTypes is used to validate add-machine arguments.

Functions

func SelectInternalAddress

func SelectInternalAddress(addresses []Address, machineLocal bool) string

SelectInternalAddress picks one address from a slice that can be used as an endpoint for juju internal communication. If there are no suitable addresses, the empty string is returned.

func SelectPublicAddress

func SelectPublicAddress(addresses []Address) string

SelectPublicAddress picks one address from a slice that would be appropriate to display as a publicly accessible endpoint. If there are no suitable addresses, the empty string is returned.

Types

type Address

type Address struct {
	Value       string
	Type        AddressType
	NetworkName string
	NetworkScope
}

Address represents the location of a machine, including metadata about what kind of location the address describes.

func NewAddress

func NewAddress(value string) Address

type AddressType

type AddressType string

AddressType represents the possible ways of specifying a machine location by either a hostname resolvable by dns lookup, or ipv4 or ipv6 address.

const (
	HostName    AddressType = "hostname"
	Ipv4Address AddressType = "ipv4"
	Ipv6Address AddressType = "ipv6"
)

func DeriveAddressType

func DeriveAddressType(value string) AddressType

type ContainerType

type ContainerType string

func ParseSupportedContainerType

func ParseSupportedContainerType(ctype string) (ContainerType, error)

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

func ParseSupportedContainerTypeOrNone

func ParseSupportedContainerTypeOrNone(ctype string) (ContainerType, error)

ParseSupportedContainerTypeOrNone 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 `yaml:"arch,omitempty"`
	Mem      *uint64 `yaml:"mem,omitempty"`
	RootDisk *uint64 `yaml:"rootdisk,omitempty"`
	CpuCores *uint64 `yaml:"cpucores,omitempty"`
	CpuPower *uint64 `yaml:"cpupower,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).

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. This will supercede DNSName
	// which can be implemented by selecting a preferred address.
	Addresses() ([]Address, error)

	// DNSName returns the DNS name for the instance.
	// If the name is not yet allocated, it will return
	// an ErrNoDNSName error.
	DNSName() (string, error)

	// WaitDNSName returns the DNS name for the instance,
	// waiting until it is allocated if necessary.
	// TODO: We may not need this in the interface any more.  All
	// implementations now delegate to environs.WaitDNSName.
	WaitDNSName() (string, error)

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

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

	// Ports returns the set of ports open on the instance, which
	// should have been started with the given machine id.
	// The ports are returned as sorted by state.SortPorts.
	Ports(machineId string) ([]Port, error)
}

Instance represents the the realization of a machine in state.

type NetworkScope

type NetworkScope string

NetworkScope denotes the context a location may apply to. If a name or address can be reached from the wider internet, it is considered public. A private network address is either specific to the cloud or cloud subnet a machine belongs to, or to the machine itself for containers.

const (
	NetworkUnknown      NetworkScope = ""
	NetworkPublic       NetworkScope = "public"
	NetworkCloudLocal   NetworkScope = "local-cloud"
	NetworkMachineLocal NetworkScope = "local-machine"
)

type Port

type Port struct {
	Protocol string
	Number   int
}

Port identifies a network port number for a particular protocol.

func (Port) String

func (p Port) String() string

Jump to

Keyboard shortcuts

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