exoscale

package
v0.0.0-...-492d7f2 Latest Latest
Warning

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

Go to latest
Published: Jul 3, 2018 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Overview

Package exoscale provides a standard way to create a virtual machine on exoscale.ch.

Index

Constants

This section is empty.

Variables

View Source
var SSHTimeout = 30 * time.Second

SSHTimeout is the maximum time to wait before failing to GetSSH. This is not thread-safe.

Functions

This section is empty.

Types

type Config

type Config struct {
	Endpoint  string `json:"endpoint,omitempty"`  // required
	APIKey    string `json:"apikey,omitempty"`    // required
	APISecret string `json:"apisecret,omitempty"` // required
}

Config is the new droplet payload

type SecurityGroup

type SecurityGroup struct {
	ID   string `json:"id,omitempty"`
	Name string `json:"name,omitempty"`
}

SecurityGroup is a Exoscale security group

type ServiceOffering

type ServiceOffering struct {
	ID   string              `json:"id,omitempty"`
	Name ServiceOfferingType `json:"name,omitempty"`
}

ServiceOffering is a Exoscale machine type offering

type ServiceOfferingType

type ServiceOfferingType string

ServiceOfferingType is a Exoscale instance type offering

const (
	Micro      ServiceOfferingType = "Micro"
	Tiny       ServiceOfferingType = "Tiny"
	Small      ServiceOfferingType = "Small"
	Medium     ServiceOfferingType = "Medium"
	Large      ServiceOfferingType = "Large"
	ExtraLarge ServiceOfferingType = "Extra-large"
	Huge       ServiceOfferingType = "Huge"
)

Exoscal offerings

type Template

type Template struct {
	ID        string `json:"id,omitempty"`
	Name      string `json:"name,omitempty"`
	ZoneName  string `json:"zonename,omitempty"`
	StorageGB int    `json:"storagegb,omitempty"`
}

Template is the base image for Exoscale virtual machines

type VM

type VM struct {
	Config Config // Exoscale client configuration

	Name            string          // virtual machine name
	Template        Template        // template identification
	ServiceOffering ServiceOffering // Service offering
	SecurityGroups  []SecurityGroup // list of security groups associated with the virtual machine
	KeypairName     string          // SSH Keypair identifier to use
	Userdata        string          // User data sent to the virtual machine
	Zone            Zone            // Zone identifier

	ID    string // Virtual machine ID.
	JobID string // virtual machine creation job ID

	SSHCreds ssh.Credentials // SSH credentials required to connect to machine
	// contains filtered or unexported fields
}

VM represents an Exoscale virtual machine.

func (*VM) AddDisk

func (vm *VM) AddDisk() error

func (*VM) Destroy

func (vm *VM) Destroy() error

Destroy removes virtual machine and all storage associated

func (*VM) GetIPs

func (vm *VM) GetIPs() ([]net.IP, error)

GetIPs returns the list of ip addresses associated with the VM

func (*VM) GetName

func (vm *VM) GetName() string

GetName returns the name of the virtual machine If an error occurs, an empty string is returned

func (*VM) GetSSH

func (vm *VM) GetSSH(options ssh.Options) (ssh.Client, error)

GetSSH returns SSH keys to access the virtual machine

func (*VM) GetState

func (vm *VM) GetState() (string, error)

GetState returns virtual machine state

func (*VM) Halt

func (vm *VM) Halt() error

Halt stop a virtual machine

func (*VM) Provision

func (vm *VM) Provision() error

Provision creates a virtual machine on exoscale. A JobID is informed that can be used to poll the VM creation process (see WaitVMCreation)

func (*VM) RemoveDisk

func (vm *VM) RemoveDisk(diskName string) error

func (*VM) Resume

func (vm *VM) Resume() error

Resume resumes a suspended virtual machine. Not supported

func (*VM) Start

func (vm *VM) Start() error

Start starts virtual machine

func (*VM) Suspend

func (vm *VM) Suspend() error

Suspend pauses the virtual machine. Not supported

func (*VM) WaitVMCreation

func (vm *VM) WaitVMCreation(timeoutSeconds int, pollIntervalSeconds int) error

WaitVMCreation waits for the virtual machine to be created, and stores the virtual machine ID VM structure must contain a valid JobID.

type Zone

type Zone struct {
	ID   string `json:"id,omitempty"`
	Name string `json:"name,omitempty"`
}

Zone is a Exoscale zone

Jump to

Keyboard shortcuts

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