lunanode

package
v0.0.0-...-dd062b7 Latest Latest
Warning

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

Go to latest
Published: Feb 22, 2018 License: Apache-2.0 Imports: 15 Imported by: 2

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 (this *API) ImageDelete(imageIdentification int) error

func (*API) ImageDetails

func (this *API) ImageDetails(imageIdentification int) (*APIImage, error)

func (*API) ImageFetch

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

func (*API) ImageList

func (this *API) ImageList(region string) ([]*APIImage, error)

func (*API) PlanList

func (this *API) PlanList() ([]*APIPlan, error)

func (*API) VmCreateImage

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

func (*API) VmCreateVolume

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

func (*API) VmDelete

func (this *API) VmDelete(vmIdentification int) error

func (*API) VmDiskSwap

func (this *API) VmDiskSwap(vmIdentification int) error

func (*API) VmInfo

func (this *API) VmInfo(vmIdentification int) (*APIVmInfoStruct, error)

func (*API) VmReboot

func (this *API) VmReboot(vmIdentification int) error

func (*API) VmReimage

func (this *API) VmReimage(vmIdentification int, imageIdentification int) error

func (*API) VmSnapshot

func (this *API) VmSnapshot(vmIdentification int, region string) (int, error)

func (*API) VmStart

func (this *API) VmStart(vmIdentification int) error

func (*API) VmStop

func (this *API) VmStop(vmIdentification int) error

func (*API) VmVnc

func (this *API) VmVnc(vmIdentification int) (string, error)

func (*API) VolumeCreate

func (this *API) VolumeCreate(region string, size int, imageIdentification int, timeout time.Duration) (int, error)

Create a volume with the given size in gigabytes and image identification. If timeout is greater than zero, we will wait for the volume to become ready, or return error if timeout is exceeded. Otherwise, we return immediately without error.

func (*API) VolumeDelete

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

type APIGenericResponse

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

type APIImage

type APIImage struct {
	Id     string `json:"image_id"`
	Name   string `json:"name"`
	Status string `json:"status"`
	Size   string `json:"size"`
}

type APIImageCreateResponse

type APIImageCreateResponse struct {
	Id string `json:"image_id"`
}

type APIImageDetailsResponse

type APIImageDetailsResponse struct {
	Image *APIImage `json:"details"`
}

type APIImageListResponse

type APIImageListResponse struct {
	Images []*APIImage `json:"images"`
}

type APIPlan

type APIPlan struct {
	Id        string `json:"plan_id"`
	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 APIPlanListResponse

type APIPlanListResponse struct {
	Plans []*APIPlan `json:"plans"`
}

type APIVmCreateResponse

type APIVmCreateResponse struct {
	VmId string `json:"vm_id"`
}

type APIVmInfoResponse

type APIVmInfoResponse struct {
	Info *APIVmInfoStruct `json:"info"`
}

type APIVmInfoStruct

type APIVmInfoStruct struct {
	Ip            string `json:"ip"`
	PrivateIp     string `json:"privateip"`
	Status        string `json:"status"`
	StatusColor   string `json:"-"`
	Hostname      string `json:"hostname"`
	BandwidthUsed string `json:"bandwidthUsedGB"`
	LoginDetails  string `json:"login_details"`
	DiskSwap      string `json:"diskswap"`
}

type APIVmVncResponse

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

type APIVolume

type APIVolume struct {
	Id     string `json:"id"`
	Name   string `json:"name"`
	Size   string `json:"size"`
	Region string `json:"region"`
	Status string `json:"status"`
}

type APIVolumeInfoResponse

type APIVolumeInfoResponse struct {
	Volume *APIVolume `json:"volume"`
}

type APIVolumeListResponse

type APIVolumeListResponse struct {
	Volumes []*APIVolume `json:"volumes"`
}

type LunaNode

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

func MakeLunaNode

func MakeLunaNode(region string, apiId string, apiKey string) *LunaNode

func (*LunaNode) BandwidthAccounting

func (this *LunaNode) BandwidthAccounting(vm *lobster.VirtualMachine) int64

func (*LunaNode) ImageDelete

func (this *LunaNode) ImageDelete(imageIdentification string) error

func (*LunaNode) ImageFetch

func (this *LunaNode) ImageFetch(url string, format string) (string, error)

func (*LunaNode) ImageInfo

func (this *LunaNode) ImageInfo(imageIdentification string) (*lobster.ImageInfo, error)

func (*LunaNode) ImageList

func (this *LunaNode) ImageList() ([]*lobster.Image, error)

func (*LunaNode) PlanList

func (this *LunaNode) PlanList() ([]*lobster.Plan, error)

func (*LunaNode) VmAction

func (this *LunaNode) VmAction(vm *lobster.VirtualMachine, action string, value string) error

func (*LunaNode) VmCreate

func (this *LunaNode) VmCreate(vm *lobster.VirtualMachine, options *lobster.VMIVmCreateOptions) (string, error)

func (*LunaNode) VmDelete

func (this *LunaNode) VmDelete(vm *lobster.VirtualMachine) error

func (*LunaNode) VmInfo

func (this *LunaNode) VmInfo(vm *lobster.VirtualMachine) (*lobster.VmInfo, error)

func (*LunaNode) VmReboot

func (this *LunaNode) VmReboot(vm *lobster.VirtualMachine) error

func (*LunaNode) VmReimage

func (this *LunaNode) VmReimage(vm *lobster.VirtualMachine, imageIdentification string) error

func (*LunaNode) VmSnapshot

func (this *LunaNode) VmSnapshot(vm *lobster.VirtualMachine) (string, error)

func (*LunaNode) VmStart

func (this *LunaNode) VmStart(vm *lobster.VirtualMachine) error

func (*LunaNode) VmStop

func (this *LunaNode) VmStop(vm *lobster.VirtualMachine) error

func (*LunaNode) VmVnc

func (this *LunaNode) VmVnc(vm *lobster.VirtualMachine) (string, error)

Jump to

Keyboard shortcuts

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