api

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: 14 Imported by: 0

Documentation

Index

Constants

View Source
const LNDYNAMIC_API_URL = "https://dynamic.lunanode.com/api/{CATEGORY}/{ACTION}/"

Variables

This section is empty.

Functions

This section is empty.

Types

type API

type API struct {
	ApiId         string
	ApiKey        string
	ApiPartialKey string
}

func MakeAPI

func MakeAPI(id string, key string) (*API, error)

func (*API) ImageDelete

func (api *API) ImageDelete(imageIdentification int) error

func (*API) ImageDetails

func (api *API) ImageDetails(imageIdentification int) (*Image, error)

func (*API) ImageFetch

func (api *API) ImageFetch(region string, location string, format string, virtio bool) (int, error)

func (*API) ImageList

func (api *API) ImageList(region string) ([]*Image, error)

func (*API) PlanList

func (api *API) PlanList() ([]*Plan, error)

func (*API) VmCreateImage

func (api *API) VmCreateImage(region string, hostname string, planIdentification int, imageIdentification int) (string, error)

func (*API) VmCreateVolume

func (api *API) VmCreateVolume(region string, hostname string, planIdentification int, volumeIdentification int) (string, error)

func (*API) VmDelete

func (api *API) VmDelete(vmIdentification string) error

func (*API) VmDiskSwap

func (api *API) VmDiskSwap(vmIdentification string) error

func (*API) VmInfo

func (api *API) VmInfo(vmIdentification string) (*VmStruct, *VmInfoStruct, error)

func (*API) VmList

func (api *API) VmList() ([]VmStruct, error)

func (*API) VmReboot

func (api *API) VmReboot(vmIdentification string) error

func (*API) VmReimage

func (api *API) VmReimage(vmIdentification string, imageIdentification int) error

func (*API) VmSnapshot

func (api *API) VmSnapshot(vmIdentification string) (int, error)

func (*API) VmStart

func (api *API) VmStart(vmIdentification string) error

func (*API) VmStop

func (api *API) VmStop(vmIdentification string) error

func (*API) VmVnc

func (api *API) VmVnc(vmIdentification string) (string, error)

func (*API) VolumeAttach

func (api *API) VolumeAttach(region string, volumeIdentification int, vmIdentification string) error

func (*API) VolumeCreate

func (api *API) VolumeCreate(region string, size int, imageIdentification *int) (int, error)

Create a volume with the given size in gigabytes and image identification (or nil for empty volume).

func (*API) VolumeDelete

func (api *API) VolumeDelete(region string, volumeIdentification int) error

func (*API) VolumeDetach

func (api *API) VolumeDetach(region string, volumeIdentification int) error

func (*API) VolumeInfo

func (api *API) VolumeInfo(region string, volumeIdentification int) (*Volume, error)

func (*API) VolumeList

func (api *API) VolumeList(region string) ([]*Volume, error)

type GenericResponse

type GenericResponse struct {
	Success string `json:"success"`
	Error   string `json:"error"`
}

type Image

type Image struct {
	ID     int    `json:"image_id,string"`
	Name   string `json:"name"`
	Status string `json:"status"`
	Size   string `json:"size"`
	Region string `json:"region"`
}

type ImageCreateResponse

type ImageCreateResponse struct {
	ID int `json:"image_id,string"`
}

type ImageDetailsResponse

type ImageDetailsResponse struct {
	Image *Image `json:"details"`
}

type ImageListResponse

type ImageListResponse struct {
	Images []*Image `json:"images"`
}

type Plan

type Plan struct {
	ID        int    `json:"plan_id,string"`
	Name      string `json:"name"`
	Vcpu      string `json:"vcpu"`
	Price     string `json:"price"`
	RAM       string `json:"ram"`
	Storage   string `json:"storage"`
	Bandwidth string `json:"bandwidth"`
}

type PlanListResponse

type PlanListResponse struct {
	Plans []*Plan `json:"plans"`
}

type VmCreateResponse

type VmCreateResponse struct {
	ID string `json:"vm_id"`
}

type VmInfoResponse

type VmInfoResponse struct {
	Info  *VmInfoStruct `json:"info"`
	Extra *VmStruct     `json:"extra"`
}

type VmInfoStruct

type VmInfoStruct struct {
	IP            string `json:"ip"`
	PrivateIP     string `json:"privateip"`
	Status        string `json:"status_nohtml"`
	Hostname      string `json:"hostname"`
	BandwidthUsed string `json:"bandwidthUsedGB"`
	LoginDetails  string `json:"login_details"`
	DiskSwap      string `json:"diskswap"`
}

type VmListResponse

type VmListResponse struct {
	Vms []VmStruct `json:"vms"`
}

type VmStruct

type VmStruct struct {
	ID        string `json:"vm_id"`
	Name      string `json:"name"`
	Region    string `json:"region"`
	Hostname  string `json:"hostname"`
	PrimaryIP string `json:"primaryip"`
	PrivateIP string `json:"privateip"`
	PlanID    string `json:"plan_id"`
	RAM       string `json:"ram"`
	Vcpu      string `json:"vcpu"`
	Storage   string `json:"storage"`
	Bandwidth string `json:"bandwidth"`
}

type VmVncResponse

type VmVncResponse struct {
	VncUrl string `json:"vnc_url"`
}

type Volume

type Volume struct {
	ID     int    `json:"id,string"`
	Name   string `json:"name"`
	Size   string `json:"size"`
	Region string `json:"region"`
	Status string `json:"status"`
}

type VolumeCreateResponse

type VolumeCreateResponse struct {
	ID int `json:"volume_id,string"`
}

type VolumeInfoResponse

type VolumeInfoResponse struct {
	Volume *Volume `json:"volume"`
}

type VolumeListResponse

type VolumeListResponse struct {
	Volumes []*Volume `json:"volumes"`
}

Jump to

Keyboard shortcuts

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