atlanticnet

package module
v0.0.0-...-8ee55b3 Latest Latest
Warning

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

Go to latest
Published: Apr 11, 2016 License: MIT Imports: 13 Imported by: 0

README

Go Atlantic.Net

Atlantic.Net CLI and API client library, written in Go

Status

Alpha

Installation from source

  • Install the latest version of Go
  • Make sure your GOPATH is set
  • Add $GOPATH/bin to your PATH
  • Use go get to download, compile and install the source
$ go get github.com/jdextraze/go-atlanticnet

Dependencies

go get -u github.com/kardianos/govendor
  • Go into source folder
cd $GOPATH/src/github.com/jdextraze/go-atlanticnet
  • Sync vendor folder
$ govendor sync

License

Released under the MIT license, see LICENSE.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type BaseResponse

type BaseResponse struct {
	Error     *ErrorResponse
	Timestamp int
}

type Client

type Client interface {
	DescribePlan(name, platform string) ([]Plan, error)

	ListInstances() ([]Instance, error)
	RunInstance(req RunInstanceRequest) ([]RunInstance, error)
	TerminateInstance(instanceId string) ([]TerminateInstance, error)
	DescribeInstance(instanceId string) (*InstanceDescription, error)
	RebootInstance(instanceId string, rebootType RebootType) (*RebootInstance, error)

	DescribeImage(imageId string) ([]Image, error)

	ListSshKeys() ([]SshKey, error)
}

func NewClient

func NewClient(apiKey, secret string, debug bool) Client

type ErrorResponse

type ErrorResponse struct {
	Code    string
	Message string
	Time    int
}

func (ErrorResponse) Error

func (e ErrorResponse) Error() string

type Image

type Image struct {
	Architecture string `json:"architecture"`
	DisplayName  string `json:"displayname"`
	Type         string `json:"image_type"`
	Id           string `json:"imageid"`
	OsType       string `json:"ostype"`
	Owner        string `json:"owner"`
	Platform     string `json:"platform"`
	Version      string `json:"version"`
}

type Instance

type Instance struct {
	Id                 string `json:"InstanceId"`
	CuId               string `json:"cu_id"`
	RatePerHour        string `json:"rate_per_hr"`
	VmBandwith         string `json:"vm_bandwith"`
	VmCpuReq           string `json:"vm_cpu_req"`
	VmCreatedDate      string `json:"vm_created_date"`
	VmDescription      string `json:"vm_description"`
	VmDiskReq          string `json:"vm_disk_req"`
	VmImage            string `json:"vm_image"`
	VmImageDisplayName string `json:"vm_image_display_name"`
	VmIpAddress        string `json:"vm_ip_address"`
	VmName             string `json:"vm_name"`
	VmNetworkReq       string `json:"vm_network_req"`
	VmOsArchitecture   string `json:"vm_os_architecture"`
	VmPlanName         string `json:"vm_plan_name"`
	VmRamReq           string `json:"vm_ram_req"`
	VmStatus           Status `json:"vm_status"`
}

type InstanceDescription

type InstanceDescription struct {
	Instance
	ClonedFrom                  string      `json:"cloned_from"`
	DisallowDeletion            string      `json:"disallow_deletion"`
	Removed                     string      `json:"removed"`
	ReprovisioningProcessedDate string      `json:"reprovisioning_processed_date"`
	VmId                        string      `json:"vm_id"`
	VmIpGateway                 string      `json:"vm_ip_gateway"`
	VmIpSubnet                  string      `json:"vm_ip_subnet"`
	RemovedDate                 string      `json:"vm_removed_date"`
	VmUsername                  string      `json:"vm_username"`
	VmVncPassword               string      `json:"vm_vnc_password"`
	VncPort                     interface{} `json:"vnc_port"` // TODO can be string or bool
}

type Plan

type Plan struct {
	Bandwidth        int     `json:"bandwidth"`
	CentOsCapable    string  `json:"centos_capable"`
	CPanelCapable    string  `json:"cpanel_capable"`
	Disk             string  `json:"disk"`
	DisplayBandwidth string  `json:"display_bandwidth"`
	DisplayDisk      string  `json:"display_disk"`
	DisplayRam       string  `json:"display_ram"`
	FreeTransfer     string  `json:"free_transfer"`
	NumCpu           string  `json:"num_cpu"`
	OsType           string  `json:"ostype"`
	PlanName         string  `json:"plan_name"`
	Platform         string  `json:"platform"`
	Ram              string  `json:"ram"`
	RatePerHour      float64 `json:"rate_per_hr"`
}

type RebootInstance

type RebootInstance struct {
	InstanceId string `json:"InstanceId"`
	Message    string `json:"message"`
	Value      string `json:"value"`
}

type RebootType

type RebootType string
const (
	RebootTypeSoft RebootType = "soft"
	RebootTypeHard RebootType = "hard"
)

type RunInstance

type RunInstance struct {
	Id        int    `json:"instanceid"`
	IpAddress string `json:"ip_address"`
	Password  string `json:"password"`
	Username  string `json:"username"`
}

type RunInstanceRequest

type RunInstanceRequest struct {
	ServerName   string
	ImageId      string
	PlanName     string
	VMLocation   string
	EnableBackup bool
	CloneImage   string
	ServerQty    int
	KeyId        string
}

func (RunInstanceRequest) ToMap

func (r RunInstanceRequest) ToMap() map[string]string

type SshKey

type SshKey struct {
	Id        string `json:"key_id"`
	Name      string `json:"key_name"`
	PublicKey string `json:"public_key"`
}

type Status

type Status string
const (
	StatusAwaitingCreation  Status = "AWAITING_CREATION"
	StatusCreating          Status = "CREATING"
	StatusFailed            Status = "FAILED"
	StatusReprovisioning    Status = "REPROVISIONING"
	StatusResettingPassword Status = "RESETTINGPWD"
	StatusRestarting        Status = "RESTARTING"
	StatusRunning           Status = "RUNNING"
	StatusStopped           Status = "STOPPED"
	StatusQueued            Status = "QUEUED"
	StatusRemoving          Status = "REMOVING"
	StatusRemoved           Status = "REMOVED"
	StatusResizingServer    Status = "RESIZINGSERVER"
	StatusSuspending        Status = "SUSPENDING"
	StatusSuspended         Status = "SUSPENDED"
)

type TerminateInstance

type TerminateInstance struct {
	Id      string `json:"InstanceId"`
	Message string `json:"message"`
	Result  string `json:"result"`
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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