compute

package
v0.0.0-...-15aa78f Latest Latest
Warning

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

Go to latest
Published: Sep 12, 2016 License: Apache-2.0 Imports: 0 Imported by: 16

Documentation

Index

Constants

View Source
const (
	ArchAMD64 = "amd64"
	Archi386  = "i386"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Address

type Address struct {
	ID        string
	IP        string
	PrivateIP string

	CanDNS   bool
	Hostname string
}

type AddressService

type AddressService interface {
	ListInstanceAddresses(instanceID string) ([]*Address, error)
	AddAddressToInstance(instanceID string, address *Address) error
	RemoveAddressFromInstance(instanceID string, addressID string) error
	SetAddressHostname(addressID string, hostname string) error
}

type Flavor

type Flavor struct {
	ID      string
	Name    string
	Regions []string

	NumCores   int
	DiskGB     int
	MemoryMB   int
	TransferGB int
}

type FlavorService

type FlavorService interface {
	ListFlavors() ([]*Flavor, error)
	FindFlavor(flavor *Flavor) (string, error)
}

type Image

type Image struct {
	ID      string
	Name    string
	Regions []string
	Type    ImageType
	Format  string
	Status  ImageStatus
	Public  bool
	Size    int64

	SourceInstance string
	SourceURL      string

	Distribution string
	Version      string
	Architecture ImageArchitecture

	// Key-value additional details of the image.
	Details map[string]string
}

type ImageArchitecture

type ImageArchitecture string

type ImageService

type ImageService interface {
	// Creates an image based on the specified fields.
	// If SourceInstance is set, the instance is snapshotted
	// If SourceURL is set, the image is retrieved from URL.
	CreateImage(image *Image) (*Image, error)

	// Looks for an image matching the specified image.
	// If successful, returns nil if image not found, or the image ID.
	FindImage(image *Image) (string, error)

	ListImages() ([]*Image, error)
	GetImage(imageID string) (*Image, error)
	DeleteImage(imageID string) error
}

type ImageStatus

type ImageStatus string
const (
	ImageAvailable ImageStatus = "available"
	ImagePending   ImageStatus = "pending"
)

type ImageType

type ImageType string
const (
	TemplateImage ImageType = "template"
	ISOImage                = "iso"
)

type Instance

type Instance struct {
	ID        string
	Name      string
	Region    string
	IP        string
	PrivateIP string

	Image     Image
	Flavor    Flavor
	PublicKey PublicKey

	Status InstanceStatus

	Username string
	Password string

	// A temporary identifier that can be used to get additional details on the
	// instance immediately after it has been provisioned. For example, some
	// providers return the instance password this way.
	JobID string

	// Bytes of bandwidth used.
	BandwidthUsed int64

	// Tenant network ID.
	NetworkID string

	// Key-value additional details of the instance.
	Details map[string]string

	// Additional custom actions supported for this instance.
	Actions []InstanceAction
}

func (*Instance) Detail

func (instance *Instance) Detail(k string, d string) string

type InstanceAction

type InstanceAction struct {
	Label       string
	Description string

	// map of options from option value to description
	// if nil, then this action can take any string value
	Options map[string]string

	Func func(string) error
}

type InstanceStatus

type InstanceStatus string
const (
	StatusOnline  InstanceStatus = "online"
	StatusOffline InstanceStatus = "offline"
)

type KeypairService

type KeypairService interface {
	ListPublicKeys() ([]*PublicKey, error)
	ImportPublicKey(key *PublicKey) (*PublicKey, error)
	RemovePublicKey(keyID string) error
}

type Provider

type Provider interface {
	ComputeService() Service
}

type PublicKey

type PublicKey struct {
	ID    string
	Label string
	Key   []byte
}

type ReimageService

type ReimageService interface {
	ReimageInstance(instanceID string, image *Image) error
}

type RenameService

type RenameService interface {
	RenameInstance(instanceID string, name string) error
}

type ResizeService

type ResizeService interface {
	ResizeInstance(instanceID string, flavor *Flavor) error
}

type Service

type Service interface {
	// Creates a new instance.
	// All fields in Instance struct are optional. ID and JobID are always ignored.
	// Other fields may also be ignored or cause errors.
	CreateInstance(instance *Instance) (*Instance, error)

	// Destroys the specified instance.
	DeleteInstance(instanceID string) error

	// Lists instances.
	ListInstances() ([]*Instance, error)

	// Gets information about a specific instance.
	// This may return more details than ListInstances.
	GetInstance(instanceID string) (*Instance, error)

	// Starts/boots an instance.
	StartInstance(instanceID string) error

	// Stops/shuts down an instance.
	StopInstance(instanceID string) error

	// Reboots an instance.
	RebootInstance(instanceID string) error
}

type VNCService

type VNCService interface {
	// If successful, returns a string URL where VNC or similar console for the instance can be accessed.
	GetVNC(instanceID string) (string, error)
}

Jump to

Keyboard shortcuts

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