Documentation ¶
Index ¶
- func GetPingTime(ipAddress string) (pingTime int64, err error)
- func GetPingTimes(ipAddressList []IPPingTime) (closestRegion string, err error)
- type DNSProvider
- type HostInfo
- type IPPingTime
- type ImageInfo
- type NetworkInfo
- type PingTime
- type RegionInfo
- type Regions
- type SSHKey
- type SSHKeys
- type SizeInfo
- type V4NetworkInfo
- type V6NetworkInfo
- type VMInfo
- type VMManager
- type VMSizes
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func GetPingTime ¶ added in v0.2.7
GetPingTime will do a ping test to the given ip address
func GetPingTimes ¶ added in v0.2.9
func GetPingTimes(ipAddressList []IPPingTime) (closestRegion string, err error)
GetPingTimesForArray will ping all ips/hosts and return the ID of the closest
Types ¶
type DNSProvider ¶
type DNSProvider interface { Init() bool GetHostRecord(host string) *HostInfo UpdateHostRecord(*HostInfo) error DeleteHostRecord(*HostInfo) error }
DNSProvider is the interface all DNS providers need to follow
type HostInfo ¶
type HostInfo struct { Name string // hostname ID string // assigned by dns provider IP string // current IP address assigned to this host }
HostInfo has DNS details of a host
type IPPingTime ¶ added in v0.2.9
type ImageInfo ¶
type ImageInfo struct { ID int `json:"id"` Name string `json:"name"` Type string `json:"type"` Distrubution string `json:"distribution"` Slug string `json:"slug"` // N/A if status is 'retired' Public bool `json:"public"` // N/A if status is 'retired' Regions []string `json:"regions"` // N/A if status is 'retired' MinDiskSize int `json:"min_disk_size"` SizeGigabytes float64 `json:"size_gigabytes"` CreatedAt string `json:"created_at"` Description string `json:"description"` Status string `json:"status"` }
ImageInfo contains details about a disk image
type NetworkInfo ¶
type NetworkInfo struct { V4Info []V4NetworkInfo `json:"v4,omitempty"` V6Info []V6NetworkInfo `json:"v6,omitempty"` }
NetworkInfo has info about the networks a VM has
type PingTime ¶ added in v0.2.7
type PingTime struct { Name string // name (optional) associated with the ip address IPAddress string // address to test Result int64 // ping time in mSec }
PingTime contains results of ping test to ip address
type RegionInfo ¶
type RegionInfo struct { Name string `json:"name"` Slug string `json:"slug"` Available bool `json:"available"` Country string `json:"country"` State string `json:"State"` Sizes []string `json:"sizes"` Features []string `json:"features"` }
RegionInfo has details about a given datacenter/region
type Regions ¶
type Regions interface { GetList() ([]RegionInfo, error) GetClosestByPing() ([]RegionInfo, error) GetClosestByLatLong(lat float32, long float32) ([]RegionInfo, error) GetClosestByCountry(country string) ([]RegionInfo, error) }
Regions has details about all the regions a provider supports
type SSHKey ¶ added in v0.2.7
SSHKey has details of an ssh key
func (*SSHKey) Fingerprint ¶ added in v0.2.7
Fingerprint for the given ssh key
func (*SSHKey) GetPublicKey ¶ added in v0.2.7
GetPublicKey will return the string form of the public key
func (*SSHKey) LoadPublicKey ¶ added in v0.2.7
LoadPublicKey the public key for an ssh key
type SSHKeys ¶
type SSHKeys struct { ID int `json:"id"` Name string `json:"name"` Fingerprint string `json:"fingerprint"` PublicKey string `json:"public_key"` }
SSHKeys has details of a ssh key in user's DO account
type SizeInfo ¶
type SizeInfo struct { Slug string `json:"slug"` Memory int `json:"memory"` VCPUs int `json:"vcpus"` Disk int `json:"disk"` PriceMonthly float32 `json:"price_monthly"` PriceHourly float32 `json:"price_hourly"` Regions []string `json:"regions"` Available bool `json:"available"` Transfer int `json:"transfer"` }
SizeInfo has details about a specific VM size
type V4NetworkInfo ¶
type V4NetworkInfo struct { IPAddress string `json:"ip_address"` Netmask string `json:"netmask"` Gateway string `json:"gateway"` Type string `json:"type"` }
V4NetworkInfo has details of ipv4 networks
type V6NetworkInfo ¶
type V6NetworkInfo struct { IPAddress string `json:"ip_address"` Netmask int `json:"netmask"` Gateway string `json:"gateway"` Type string `json:"type"` }
V6NetworkInfo has details about ipv6 networks
type VMInfo ¶
type VMInfo struct { ID string `json:"id"` Name string `json:"name"` Memory int `json:"memory"` VCPUs int `json:"vcpus"` Disk int `json:"disk"` Region RegionInfo `json:"region"` Status string `json:"status"` SizeSlug string `json:"size_slug"` CreatedAt string `json:"created_at"` Image ImageInfo `json:"image"` Size SizeInfo `json:"size"` Networks NetworkInfo `json:"networks"` VPCUUID string `json:"vpc_uuid"` Tags []string `json:"tags"` }
VMInfo has all details about a given VM
func (*VMInfo) GetPublicIP ¶
GetPublicIP for the VM
type VMManager ¶ added in v0.2.7
type VMManager interface { GetAuthToken() string ListVMs() (vmInfo []VMInfo, err error) CreateVM(name string, image string, size string, region string, sshKey SSHKey) (VMInfo, error) GetVMInfo(vmID string) (vmInfo VMInfo, err error) DeleteVM(ID string) error // UploadSSHKey() IsSSHKeyUploaded(sshKey SSHKey) (string, error) SelectClosestRegion() (closestRegion string, err error) }
VMManager is the interface all cloud provider need to follow