contegixclassic

package module
v0.0.0-...-1896711 Latest Latest
Warning

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

Go to latest
Published: Mar 6, 2016 License: MPL-2.0 Imports: 10 Imported by: 0

README

contegix-classic

Basic library for accessing Contegix Cloud 'Classic' VMs, described here.

This code is heavily inspired by the pearkes/dnsimple library.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func IsQueryMethod

func IsQueryMethod(method string) bool

Types

type Client

type Client struct {
	// Access Token
	Token string

	// URL to the base API to use
	URL string

	// HttpClient is the client to use. A client with
	// default values will be used if not provided.
	HTTP *http.Client
}

Client provides a client to the Contegix Cloud Classic API https://docs.contegix.com/display/CLOUDCLASSIC/

func NewClient

func NewClient(token string) (*Client, error)

NewClient returns a new Contegix Cloud client, requires an authorization token.

func NewCustomClient

func NewCustomClient(token string, baseUrl string) (*Client, error)

NewCustomClient returns a new Contigix client with a custom base URL. It requires an authorization token.

func (*Client) CreateVirtualMachine

func (c *Client) CreateVirtualMachine(details *CreateVirtualMachine) (*VirtualMachine, error)

CreateVirtualMachine will attempt to create a new VM with the specified details. The name must be unique within your account.

func (*Client) DeleteVirtualMachine

func (c *Client) DeleteVirtualMachine(uuid string) error

DeleteVirtualMachine will destroy the VM immediately and permanently.

func (*Client) DoRequest

func (c *Client) DoRequest(method string, endpoint string, params interface{}, result interface{}) (*http.Response, error)

func (*Client) GetPackage

func (c *Client) GetPackage(uuid string) (*Package, error)

GetPackage returns the details for the specified VM Package

func (*Client) GetTemplate

func (c *Client) GetTemplate(uuid string) (*Template, error)

GetTemplate returns the details for the specified VM Template

func (*Client) GetVirtualMachine

func (c *Client) GetVirtualMachine(uuid string) (*VirtualMachine, error)

GetVirtualMachine returns the details for the specified VM

func (*Client) GetZone

func (c *Client) GetZone(uuid string) (*Zone, error)

GetZone returns the details for the specified hosting zone

func (*Client) ListPackages

func (c *Client) ListPackages() ([]Package, error)

ListPackages returns an array of the available VM Packages.

func (*Client) ListTemplates

func (c *Client) ListTemplates() ([]Template, error)

ListTemplates returns an array of the available VM templates.

func (*Client) ListVirtualMachines

func (c *Client) ListVirtualMachines() ([]VirtualMachine, error)

ListVirtualMachines retrieves all the VMs for the current account.

func (*Client) ListZones

func (c *Client) ListZones() ([]Zone, error)

ListZones returns an array of the available hosting zones.

func (*Client) NewRequest

func (c *Client) NewRequest(method string, endpoint string, params interface{}) (*http.Request, error)

Creates a new request with the params

func (*Client) PowerOffVirtualMachine

func (c *Client) PowerOffVirtualMachine(uuid string) error

PowerOffVirtualMachine will shut a VM down indefinitely.

func (*Client) SayHello

func (c *Client) SayHello() (*string, error)

func (*Client) ShutDownVirtualMachine

func (c *Client) ShutDownVirtualMachine(uuid string) error

ShutDownVirtualMachine will shut down the VM immediately.

func (*Client) StartVirtualMachine

func (c *Client) StartVirtualMachine(uuid string) error

StartVirtualMachine will start (or restart) the VM.

func (*Client) SuspendVirtualMachine

func (c *Client) SuspendVirtualMachine(uuid string) error

SuspendVirtualMachine will pause the VM for later use.

func (*Client) UpdateVirtualMachine

func (c *Client) UpdateVirtualMachine(uuid string, details *UpdateVirtualMachine) (*VirtualMachine, error)

UpdateVirtualMachine allows changing the package of a VM, which adjusts the capacity and cost.

type CreateVirtualMachine

type CreateVirtualMachine struct {
	Name         string `form:"virtual_machine[name]"`
	ZoneUUID     string `form:"virtual_machine[zone_uuid]"`
	PackageUUID  string `form:"virtual_machine[package_uuid]"`
	TemplateUUID string `form:"virtual_machine[template_uuid]"`
}

type Package

type Package struct {
	Name       string `json:"name"`
	UUID       string `json:"uuid"`
	DiskSizeGB int    `json:"disk_size_in_gigabytes"`
	NumCPUs    int    `json:"num_cpus"`
	MemoryMB   int    `json:"memory_mb"`
}

type Template

type Template struct {
	Name        string  `json:"name"`
	UUID        string  `json:"uuid"`
	Description *string `json:"description"`
}

type UpdateVirtualMachine

type UpdateVirtualMachine struct {
	PackageUUID string `form:"virtual_machine[package_uuid]"`
}

type VirtualMachine

type VirtualMachine struct {
	Name          string   `json:"name"`
	UUID          string   `json:"uuid"`
	State         string   `json:"state"`
	IPAddresses   []string `json:"ip_addresses"`
	TemplateName  string   `json:"template_name"`
	TemplateUUID  string   `json:"template_uuid"`
	PackageName   string   `json:"package_name"`
	PackageUUID   string   `json:"package_uuid"`
	ZoneName      string   `json:"zone_name"`
	ZoneUUID      string   `json:"zone_uuid"`
	VMToolsStatus *string  `json:"vm_tools_status"`
}

VirtualMachine represents the details of a Contegix VM Instance.

type Zone

type Zone struct {
	Name string `json:"name"`
	UUID string `json:"uuid"`
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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