Documentation ¶
Index ¶
- Constants
- type AccountInfo
- type Application
- type Client
- func (c *Client) BandwidthOfServer(id string) (bandwidth []map[string]string, err error)
- func (c *Client) ChangeOSofServer(id string, osID int) error
- func (c *Client) CreateDnsDomain(domain, serverip string) error
- func (c *Client) CreateDnsRecord(domain, name, rtype, data string, priority, ttl int) error
- func (c *Client) CreateSSHKey(name, key string) (SSHKey, error)
- func (c *Client) CreateServer(name string, regionID, planID int, options *ServerOptions) (Server, error)
- func (c *Client) CreateSnapshot(id, description string) (Snapshot, error)
- func (c *Client) CreateStartupScript(name, content, scriptType string) (StartupScript, error)
- func (c *Client) DefaultIPv4ReverseDNS(id, ip string) error
- func (c *Client) DeleteDnsDomain(domain string) error
- func (c *Client) DeleteDnsRecord(domain string, recordID int) error
- func (c *Client) DeleteIPv6ReverseDNS(id string, ip string) error
- func (c *Client) DeleteSSHKey(id string) error
- func (c *Client) DeleteServer(id string) error
- func (c *Client) DeleteSnapshot(id string) error
- func (c *Client) DeleteStartupScript(id string) error
- func (c *Client) GetAccountInfo() (info AccountInfo, err error)
- func (c *Client) GetApplications() ([]Application, error)
- func (c *Client) GetAvailablePlansForRegion(id int) (planIDs []int, err error)
- func (c *Client) GetDnsDomains() (dnsdomains []DnsDomain, err error)
- func (c *Client) GetDnsRecords(domain string) (dnsrecords []DnsRecord, err error)
- func (c *Client) GetISO() ([]ISO, error)
- func (c *Client) GetOS() ([]OS, error)
- func (c *Client) GetPlans() ([]Plan, error)
- func (c *Client) GetRegions() ([]Region, error)
- func (c *Client) GetSSHKeys() (keys []SSHKey, err error)
- func (c *Client) GetServer(id string) (server Server, err error)
- func (c *Client) GetServers() (servers []Server, err error)
- func (c *Client) GetServersByTag(tag string) (servers []Server, err error)
- func (c *Client) GetSnapshots() (snapshots []Snapshot, err error)
- func (c *Client) GetStartupScript(id string) (StartupScript, error)
- func (c *Client) GetStartupScripts() (scripts []StartupScript, err error)
- func (c *Client) HaltServer(id string) error
- func (c *Client) ListIPv4(id string) (list []IPv4, err error)
- func (c *Client) ListIPv6(id string) (list []IPv6, err error)
- func (c *Client) ListIPv6ReverseDNS(id string) (list []ReverseDNSIPv6, err error)
- func (c *Client) ListOSforServer(id string) (os []OS, err error)
- func (c *Client) RebootServer(id string) error
- func (c *Client) ReinstallServer(id string) error
- func (c *Client) RenameServer(id, name string) error
- func (c *Client) SetIPv4ReverseDNS(id, ip, entry string) error
- func (c *Client) SetIPv6ReverseDNS(id, ip, entry string) error
- func (c *Client) StartServer(id string) error
- func (c *Client) UpdateDnsRecord(domain string, dnsrecord DnsRecord) error
- func (c *Client) UpdateSSHKey(key SSHKey) error
- func (c *Client) UpdateStartupScript(script StartupScript) error
- type DnsDomain
- type DnsRecord
- type IPv4
- type IPv6
- type ISO
- type OS
- type Options
- type Plan
- type Region
- type ReverseDNSIPv6
- type SSHKey
- type Server
- type ServerOptions
- type Snapshot
- type StartupScript
- type V6Network
Constants ¶
const ( // Version of this libary Version = "v1.8" // APIVersion of Vultr APIVersion = "v1" // DefaultEndpoint to be used DefaultEndpoint = "https://api.vultr.com/" )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type AccountInfo ¶
type AccountInfo struct { Balance float64 `json:"balance"` PendingCharges float64 `json:"pending_charges"` LastPaymentDate string `json:"last_payment_date"` LastPaymentAmount float64 `json:"last_payment_amount"` }
AccountInfo of Vultr account
func (*AccountInfo) UnmarshalJSON ¶
func (a *AccountInfo) UnmarshalJSON(data []byte) (err error)
UnmarshalJSON implements json.Unmarshaller on AccountInfo. This is needed because the Vultr API is inconsistent in it's JSON responses for account info. Some fields can change type, from JSON number to JSON string and vice-versa.
type Application ¶
type Application struct { ID int `json:"APPID,string"` Name string `json:"name"` ShortName string `json:"short_name"` DeployName string `json:"deploy_name"` Surcharge int `json:"surcharge"` }
application image on Vultr
type Client ¶
type Client struct { // User agent for HTTP client UserAgent string // Endpoint URL for API requests Endpoint *url.URL // API key for accessing the Vultr API APIKey string // Max. number of request attempts MaxAttempts int // contains filtered or unexported fields }
func (*Client) BandwidthOfServer ¶
func (*Client) CreateDnsDomain ¶
func (*Client) CreateDnsRecord ¶
func (*Client) CreateServer ¶
func (*Client) CreateSnapshot ¶
func (*Client) CreateStartupScript ¶
func (c *Client) CreateStartupScript(name, content, scriptType string) (StartupScript, error)
func (*Client) DefaultIPv4ReverseDNS ¶
func (*Client) DeleteDnsDomain ¶
func (*Client) DeleteDnsRecord ¶
func (*Client) DeleteIPv6ReverseDNS ¶
func (*Client) DeleteSSHKey ¶
func (*Client) DeleteServer ¶
func (*Client) DeleteSnapshot ¶
func (*Client) DeleteStartupScript ¶
func (*Client) GetAccountInfo ¶
func (c *Client) GetAccountInfo() (info AccountInfo, err error)
GetAccountInfo retrieves the Vultr account information about current balance, pending charges, etc..
func (*Client) GetApplications ¶
func (c *Client) GetApplications() ([]Application, error)
func (*Client) GetAvailablePlansForRegion ¶
func (*Client) GetDnsDomains ¶
func (*Client) GetDnsRecords ¶
func (*Client) GetRegions ¶
func (*Client) GetSSHKeys ¶
func (*Client) GetServers ¶
func (*Client) GetServersByTag ¶
func (*Client) GetSnapshots ¶
func (*Client) GetStartupScript ¶
func (c *Client) GetStartupScript(id string) (StartupScript, error)
func (*Client) GetStartupScripts ¶
func (c *Client) GetStartupScripts() (scripts []StartupScript, err error)
func (*Client) HaltServer ¶
func (*Client) ListIPv6ReverseDNS ¶
func (c *Client) ListIPv6ReverseDNS(id string) (list []ReverseDNSIPv6, err error)
func (*Client) RebootServer ¶
func (*Client) ReinstallServer ¶
func (*Client) RenameServer ¶
func (*Client) SetIPv4ReverseDNS ¶
func (*Client) SetIPv6ReverseDNS ¶
func (*Client) StartServer ¶
func (*Client) UpdateDnsRecord ¶
func (*Client) UpdateSSHKey ¶
func (*Client) UpdateStartupScript ¶
func (c *Client) UpdateStartupScript(script StartupScript) error
type DnsRecord ¶
type DnsRecord struct { RecordID int `json:"RECORDID"` Type string `json:"type"` Name string `json:"name"` Data string `json:"data"` Priority int `json:"priority"` TTL int `json:"ttl"` }
DNS Record
type IPv4 ¶
type IPv4 struct { IP string `json:"ip"` Netmask string `json:"netmask"` Gateway string `json:"gateway"` Type string `json:"type"` ReverseDNS string `json:"reverse"` }
IPv4 information of a virtual machine
type IPv6 ¶
type IPv6 struct { IP string `json:"ip"` Network string `json:"network"` NetworkSize string `json:"network_size"` Type string `json:"type"` }
IPv6 information of a virtual machine
type ISO ¶
type ISO struct { ID int `json:"ISOID"` Created string `json:"date_created"` Filename string `json:"filename"` Size int `json:"size"` MD5sum string `json:"md5sum"` }
ISO image on Vultr
type OS ¶
type OS struct { ID int `json:"OSID"` Name string `json:"name"` Arch string `json:"arch"` Family string `json:"family"` Windows bool `json:"windows"` Surcharge string `json:"surcharge"` }
OS image on Vultr
type Options ¶
type Options struct { // HTTP client for communication with the Vultr API HTTPClient *http.Client // User agent for HTTP client UserAgent string // Endpoint URL for API requests Endpoint string // API rate limitation, calls per duration RateLimitation time.Duration // Max. number of times to retry API calls MaxRetries int }
type Plan ¶
type Plan struct { ID int `json:"VPSPLANID,string"` Name string `json:"name"` VCpus int `json:"vcpu_count,string"` RAM int `json:"ram,string"` Disk int `json:"disk,string"` Bandwidth string `json:"bandwidth"` Price string `json:"price_per_month"` Regions []int `json:"available_locations"` }
Plan on Vultr
type Region ¶
type Region struct { ID int `json:"DCID,string"` Name string `json:"name"` Country string `json:"country"` Continent string `json:"continent"` State string `json:"state"` Ddos bool `json:"ddos_protection"` }
Region on Vultr
type ReverseDNSIPv6 ¶
ReverseDNSIPv6 information of a virtual machine
type SSHKey ¶
type SSHKey struct { ID string `json:"SSHKEYID"` Name string `json:"name"` Key string `json:"ssh_key"` Created string `json:"date_created"` }
SSHKey on Vultr account
type Server ¶
type Server struct { ID string `json:"SUBID"` Name string `json:"label"` OS string `json:"os"` RAM string `json:"ram"` Disk string `json:"disk"` MainIP string `json:"main_ip"` VCpus int `json:"vcpu_count,string"` Location string `json:"location"` RegionID int `json:"DCID,string"` DefaultPassword string `json:"default_password"` Created string `json:"date_created"` PendingCharges float64 `json:"pending_charges"` Status string `json:"status"` Cost string `json:"cost_per_month"` CurrentBandwidth float64 `json:"current_bandwidth_gb"` AllowedBandwidth float64 `json:"allowed_bandwidth_gb,string"` NetmaskV4 string `json:"netmask_v4"` GatewayV4 string `json:"gateway_v4"` PowerStatus string `json:"power_status"` ServerState string `json:"server_state"` PlanID int `json:"VPSPLANID,string"` V6Networks []V6Network `json:"v6_networks"` InternalIP string `json:"internal_ip"` KVMUrl string `json:"kvm_url"` AutoBackups string `json:"auto_backups"` Tag string `json:"tag"` }
Server (virtual machine) on Vultr account
func (*Server) UnmarshalJSON ¶
UnmarshalJSON implements json.Unmarshaller on Server. This is needed because the Vultr API is inconsistent in it's JSON responses for servers. Some fields can change type, from JSON number to JSON string and vice-versa.
type ServerOptions ¶
type ServerOptions struct { IPXEChainURL string OS int ISO int Script int Application int UserData string Snapshot string SSHKey string IPV6 bool PrivateNetworking bool AutoBackups bool DontNotifyOnActivate bool }
ServerOptions are optional parameters to be used during server creation
type Snapshot ¶
type Snapshot struct { ID string `json:"SNAPSHOTID"` Description string `json:"description"` Size int64 `json:"size,string"` Status string `json:"status"` Created string `json:"date_created"` }
Snapshot of a virtual machine on Vultr account
type StartupScript ¶
type StartupScript struct { ID string `json:"SCRIPTID"` Name string `json:"name"` Type string `json:"type"` Content string `json:"script"` }
StartupScript on Vultr account
func (*StartupScript) UnmarshalJSON ¶
func (s *StartupScript) UnmarshalJSON(data []byte) (err error)
Implements json.Unmarshaller on StartupScript. Necessary because the SRIPTID field has inconsistent types.