vultr

package module
v0.0.0-...-2635be5 Latest Latest
Warning

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

Go to latest
Published: Jan 3, 2015 License: BSD-3-Clause Imports: 8 Imported by: 1

README

Vultr API in go

Build Status

A partly go implementation of the Vultr API. This is being made for use with packer/terraform plugins, thus only servers and snapshots are supported with the few methods needed. No support for startup scripts etc.

Also it's a pure go package (not CLI tool) - for that look elsewhere

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

type Client struct {
	APIKey string
	URL    string
	Http   *http.Client
	Params Parameters
}

func MakeClient

func MakeClient(apikey string) (*Client, error)

func NewClient

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

func (*Client) CreateOpts

func (c *Client) CreateOpts() CreateServer

func (*Client) CreateServer

func (c *Client) CreateServer(opts *CreateServer) (string, error)

func (*Client) CreateSnapshot

func (c *Client) CreateSnapshot(serverId string, description string) (string, error)

func (*Client) DeleteServer

func (c *Client) DeleteServer(id string) error

func (*Client) DeleteSnapshot

func (c *Client) DeleteSnapshot(snapshotId string) error

func (*Client) GetServer

func (c *Client) GetServer(search_id string) (*Server, error)

func (*Client) GetServerIpV4Reverse

func (c *Client) GetServerIpV4Reverse(id string) (map[string]string, error)

func (*Client) GetServerIpV6Reverse

func (c *Client) GetServerIpV6Reverse(id string) (map[string]string, error)

func (*Client) GetServers

func (c *Client) GetServers() (map[string]Server, error)

func (*Client) GetSnapshot

func (c *Client) GetSnapshot(snapshotId string) (*Snapshot, error)

func (*Client) GetSnapshotByLabel

func (c *Client) GetSnapshotByLabel(snapshotLabel string) (*Snapshot, error)

func (*Client) GetSnapshots

func (c *Client) GetSnapshots() (map[string]Snapshot, error)

func (*Client) HaltServer

func (c *Client) HaltServer(id string) error

func (*Client) RequestArr

func (c *Client) RequestArr(params map[string]string, action string, method string) ([]interface{}, error)

Create a new request and decodes to Jaons

func (*Client) RequestByte

func (c *Client) RequestByte(params map[string]string, action string, method string) ([]byte, error)

send a request including api key

func (*Client) RequestInterface

func (c *Client) RequestInterface(params map[string]string, action string, method string, out interface{}) error

func (*Client) RequestMap

func (c *Client) RequestMap(params map[string]string, action string, method string) (map[string]interface{}, error)

Create a new request and decodes to Jaons

func (*Client) RequestStr

func (c *Client) RequestStr(params map[string]string, action string, method string) (string, error)

create a new request and returns body as string

func (*Client) SetServerIpV4Reverse

func (c *Client) SetServerIpV4Reverse(id string, ip string, dns string) error

func (*Client) SetServerIpV6Reverse

func (c *Client) SetServerIpV6Reverse(id string, ip string, dns string) error

func (*Client) SetServerLabel

func (c *Client) SetServerLabel(id string, label string) error

func (*Client) TestRegionPlan

func (c *Client) TestRegionPlan(region_id string, plan_id string) bool

func (*Client) WaitForServer

func (c *Client) WaitForServer(id string) (*Server, error)

type CreateServer

type CreateServer struct {
	Region     string
	Plan       string
	Os         string
	Snapshot   string
	IpV6       bool
	PrivateNet bool
	Name       string
	IpxeUrl    string
}

type Parameter

type Parameter struct {
	// contains filtered or unexported fields
}

type Parameters

type Parameters struct {
	Params map[string]Parameter
	// contains filtered or unexported fields
}

func NewParameters

func NewParameters(client *Client) (Parameters, error)

func (*Parameters) GetId

func (p *Parameters) GetId(paramname string, label string) (string, error)

func (*Parameters) GetLabel

func (p *Parameters) GetLabel(paramname string, id string) (string, error)

type ReverseList

type ReverseList struct {
	Ip      string `json:"ip"`
	Reverse string `json:"reverse"`
}

type Server

type Server struct {
	Id        string `json:"SUBID"`
	Os        string `json:"os"`
	Ram       string `json:"ram"`
	Disk      string `json:"disk"`
	Ip        string `json:"main_ip"`
	Cpu       string `json:"vcpu_count"`
	Location  string `json:"location"`
	DCID      string `json:"dcid"`
	Password  string `json:"default_password"`
	Created   string `json:"date_created"`
	Status    string `json:"status"`
	Netmaskv4 string `json:"netmask_v4"`
	Gatewayv4 string `json:"gateway_v4"`
	PlanID    string `json:"VPSPLANID"`
	IpV6      string `json:"v6_main_ip"`
	NetmaskV6 string `json:"v6_network"`
	SizeV6    string `json:"v6_network_size"`
	PrivateIP string `json:"internal_ip"`
	Label     string `json:"label"`
	//  Charges       string  `json:"pending_charges"`
	//  Cost          float64 `json:"cost_per_month"`
	//  CurrentBW     float64 `json:"current_bandwidth_gb"`
	//  AllowedVW     float64 `json:"alllowed_bandwidth_gb"`
	Power  string `json:"power_status"`
	KVMurl string `json:"kvm_url"`
}

type Snapshot

type Snapshot struct {
	Id          string `json:"SNAPSHOTID"`
	Created     string `json:"date_created"`
	Description string `json:"description"`
	Size        string `json:"size"`
	Status      string `json:"status"`
}

Jump to

Keyboard shortcuts

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