Documentation ¶
Index ¶
- Constants
- type AccountInfo
- type AppInfo
- type Application
- type Backup
- type BackupSchedule
- type BackupScheduleResponse
- type BareMetalPlan
- type BareMetalServer
- type BareMetalServerOptions
- type BlockStorage
- type Client
- func (c *Client) AttachBlockStorage(id, serverID string) error
- func (c *Client) AttachISOtoServer(id string, isoID int) error
- func (c *Client) AttachReservedIP(ip string, serverID string) error
- func (c *Client) BackupGetSchedule(id string) (*BackupScheduleResponse, error)
- func (c *Client) BackupSetSchedule(id string, bs BackupSchedule) error
- func (c *Client) BandwidthOfBareMetalServer(id string) ([]map[string]string, error)
- func (c *Client) BandwidthOfServer(id string) (bandwidth []map[string]string, err error)
- func (c *Client) ChangeApplicationofBareMetalServer(id string, appID string) error
- func (c *Client) ChangeApplicationofServer(id string, appID string) error
- func (c *Client) ChangeOSofBareMetalServer(id string, osID int) error
- func (c *Client) ChangeOSofServer(id string, osID int) error
- func (c *Client) ChangePlanOfServer(id string, planID int) error
- func (c *Client) ConvertReservedIP(serverID string, ip string) (string, error)
- func (c *Client) CreateBareMetalServer(name string, regionID, planID, osID int, options *BareMetalServerOptions) (BareMetalServer, error)
- func (c *Client) CreateBlockStorage(name string, regionID, size int) (BlockStorage, 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) CreateFirewallGroup(description string) (string, error)
- func (c *Client) CreateFirewallRule(groupID, protocol, port string, network *net.IPNet, notes string) (int, error)
- func (c *Client) CreateIPv4(id string, reboot bool) error
- func (c *Client) CreateNetwork(regionID int, description string, subnet *net.IPNet) (Network, error)
- func (c *Client) CreateReservedIP(regionID int, ipType string, label string) (string, error)
- func (c *Client) CreateSSHKey(name, key string) (SSHKey, error)
- func (c *Client) CreateServer(name string, regionID, planID, osID 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) DeleteBareMetalServer(id string) error
- func (c *Client) DeleteBlockStorage(id string) error
- func (c *Client) DeleteDNSDomain(domain string) error
- func (c *Client) DeleteDNSRecord(domain string, recordID int) error
- func (c *Client) DeleteFirewallGroup(groupID string) error
- func (c *Client) DeleteFirewallRule(ruleNumber int, groupID string) error
- func (c *Client) DeleteIPv4(id, ip string) error
- func (c *Client) DeleteIPv6ReverseDNS(id string, ip string) error
- func (c *Client) DeleteNetwork(id 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) DestroyReservedIP(id string) error
- func (c *Client) DetachBlockStorage(id string) error
- func (c *Client) DetachISOfromServer(id string) error
- func (c *Client) DetachReservedIP(serverID string, ip string) error
- func (c *Client) DisablePrivateNetworkForServer(id, networkID string) error
- func (c *Client) EnablePrivateNetworkForServer(id, networkID string) error
- func (c *Client) GetAccountInfo() (info AccountInfo, err error)
- func (c *Client) GetApplicationInfo(id string) (appInfo AppInfo, err error)
- func (c *Client) GetApplications() ([]Application, error)
- func (c *Client) GetAvailableBareMetalPlansForRegion(id int) ([]int, error)
- func (c *Client) GetAvailablePlansForRegion(id int) (planIDs []int, err error)
- func (c *Client) GetBackups(id string, backupid string) ([]Backup, error)
- func (c *Client) GetBareMetalPlans() ([]BareMetalPlan, error)
- func (c *Client) GetBareMetalServer(id string) (BareMetalServer, error)
- func (c *Client) GetBareMetalServers() ([]BareMetalServer, error)
- func (c *Client) GetBareMetalServersByTag(tag string) ([]BareMetalServer, error)
- func (c *Client) GetBlockStorage(id string) (BlockStorage, error)
- func (c *Client) GetBlockStorages() (storages []BlockStorage, err error)
- func (c *Client) GetDNSDomains() (domains []DNSDomain, err error)
- func (c *Client) GetDNSRecords(domain string) (records []DNSRecord, err error)
- func (c *Client) GetFirewallGroup(id string) (FirewallGroup, error)
- func (c *Client) GetFirewallGroups() ([]FirewallGroup, error)
- func (c *Client) GetFirewallRules(groupID string) ([]FirewallRule, error)
- func (c *Client) GetISO() ([]ISO, error)
- func (c *Client) GetISOStatusofServer(id string) (isoStatus ISOStatus, err error)
- func (c *Client) GetNetworks() (nets []Network, err error)
- func (c *Client) GetOS() ([]OS, error)
- func (c *Client) GetPlans() ([]Plan, error)
- func (c *Client) GetRegions() ([]Region, error)
- func (c *Client) GetReservedIP(id string) (IP, error)
- func (c *Client) GetSSHKeys() (keys []SSHKey, err error)
- func (c *Client) GetServer(id string) (server Server, err error)
- func (c *Client) GetServers() (serverList []Server, err error)
- func (c *Client) GetServersByTag(tag string) (serverList []Server, err error)
- func (c *Client) GetSnapshots() (snapshotList []Snapshot, err error)
- func (c *Client) GetStartupScript(id string) (StartupScript, error)
- func (c *Client) GetStartupScripts() (scripts []StartupScript, err error)
- func (c *Client) HaltBareMetalServer(id string) error
- func (c *Client) HaltServer(id string) error
- func (c *Client) LabelBlockStorage(id, name string) error
- func (c *Client) ListApplicationsforBareMetalServer(id string) ([]Application, error)
- func (c *Client) ListApplicationsforServer(id string) (apps []Application, err 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) ListOSforBareMetalServer(id string) ([]OS, error)
- func (c *Client) ListOSforServer(id string) (os []OS, err error)
- func (c *Client) ListPrivateNetworksForServer(id string) (nets []PrivateNetwork, err error)
- func (c *Client) ListReservedIP() ([]IP, error)
- func (c *Client) ListUpgradePlansForServer(id string) (planIDs []int, err error)
- func (c *Client) OnRequestCompleted(rc RequestCompletionCallback)
- func (c *Client) RebootBareMetalServer(id string) error
- func (c *Client) RebootServer(id string) error
- func (c *Client) ReinstallBareMetalServer(id string) error
- func (c *Client) ReinstallServer(id string) error
- func (c *Client) RenameBareMetalServer(id, name string) error
- func (c *Client) RenameServer(id, name string) error
- func (c *Client) ResizeBlockStorage(id string, size int) error
- func (c *Client) RestoreBackup(id, backupID string) error
- func (c *Client) RestoreSnapshot(id, snapshotID string) error
- func (c *Client) SetFirewallGroup(id, firewallgroup string) error
- func (c *Client) SetFirewallGroupDescription(groupID, description 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) TagBareMetalServer(id, tag string) error
- func (c *Client) TagServer(id, tag string) error
- func (c *Client) UnsetFirewallGroup(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 FirewallGroup
- type FirewallRule
- type IP
- type IPv4
- type IPv6
- type ISO
- type ISOStatus
- type Network
- type OS
- type Options
- type Plan
- type PrivateNetwork
- type Region
- type RequestCompletionCallback
- type ReverseDNSIPv6
- type SSHKey
- type Server
- type ServerOptions
- type Snapshot
- type StartupScript
- type V6Network
Constants ¶
const ( // Version of this library Version = "2.0.2" // 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 AppInfo ¶
type AppInfo struct {
Info string `json:"app_info"`
}
AppInfo represents the application information of a Vultr server
type Application ¶
type Application struct { ID string `json:"APPID"` Name string `json:"name"` ShortName string `json:"short_name"` DeployName string `json:"deploy_name"` Surcharge float64 `json:"surcharge"` }
Application on Vultr
type Backup ¶
type Backup struct { ID string `json:"BACKUPID"` Created string `json:"date_created"` Description string `json:"description"` Size string `json:"size"` Status string `json:"status"` }
Backup of a virtual machine
type BackupSchedule ¶
type BackupSchedule struct { CronType string `json:"cron_type"` NextScheduledTimeUtc string `json:"next_scheduled_time_utc"` Hour int `json:"hour"` Dow int `json:"dow"` Dom int `json:"dom"` }
BackupSchedule represents a scheduled backup on a server see: server/backup_set_schedule, server/backup_get_schedule
type BackupScheduleResponse ¶
type BackupScheduleResponse struct { Enabled bool `json:"enabled"` BackupSchedule }
BackupScheduleResponse details about a virtual machines backup schedule
type BareMetalPlan ¶
type BareMetalPlan struct { Deprecated bool `json:"deprecated"` ID int `json:"METALPLANID,string"` Name string `json:"name"` CPUs int `json:"cpu_count"` RAM int `json:"ram"` Disk string `json:"disk"` Bandwidth int `json:"bandwidth_tb"` Price int `json:"price_per_month"` Regions []int `json:"available_locations"` Type string `json:"type"` }
BareMetalPlan is a bare metal-compatible plan on Vultr.
type BareMetalServer ¶
type BareMetalServer 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"` CPUs int `json:"cpu_count"` Location string `json:"location"` RegionID int `json:"DCID,string"` DefaultPassword string `json:"default_password"` Created string `json:"date_created"` Status string `json:"status"` NetmaskV4 string `json:"netmask_v4"` GatewayV4 string `json:"gateway_v4"` PlanID int `json:"METALPLANID"` V6Networks []V6Network `json:"v6_networks"` Tag string `json:"tag"` OSID string `json:"OSID"` AppID string `json:"APPID"` }
BareMetalServer represents a bare metal server on Vultr.
func (*BareMetalServer) UnmarshalJSON ¶
func (b *BareMetalServer) UnmarshalJSON(data []byte) error
UnmarshalJSON implements json.Unmarshaller on BareMetal. This is needed because the Vultr API is inconsistent in it's JSON responses for bare metal servers. Some fields can change type, from JSON number to JSON string and vice-versa.
type BareMetalServerOptions ¶
type BareMetalServerOptions struct { Script int UserData string Snapshot string SSHKey string ReservedIP string IPV6 bool DontNotifyOnActivate bool Hostname string Tag string AppID string }
BareMetalServerOptions are optional parameters to be used during bare metal server creation.
type BlockStorage ¶
type BlockStorage struct { ID string `json:"SUBID,string"` Name string `json:"label"` RegionID int `json:"DCID,string"` SizeGB int `json:"size_gb,string"` Created string `json:"date_created"` Cost string `json:"cost_per_month"` Status string `json:"status"` AttachedTo string `json:"attached_to_SUBID"` }
BlockStorage on Vultr account
func (*BlockStorage) UnmarshalJSON ¶
func (b *BlockStorage) UnmarshalJSON(data []byte) (err error)
UnmarshalJSON implements json.Unmarshaller on BlockStorage. This is needed because the Vultr API is inconsistent in it's JSON responses. Some fields can change type, from JSON number to JSON string and vice-versa.
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 }
Client represents the Vultr API client
func (*Client) AttachBlockStorage ¶
AttachBlockStorage attaches block storage to an existing virtual machine
func (*Client) AttachISOtoServer ¶
AttachISOtoServer attaches an ISO image to an existing virtual machine and reboots it
func (*Client) AttachReservedIP ¶
AttachReservedIP attaches a reserved IP to a virtual machine
func (*Client) BackupGetSchedule ¶
func (c *Client) BackupGetSchedule(id string) (*BackupScheduleResponse, error)
BackupGetSchedule returns a virtual machines backup schedule
func (*Client) BackupSetSchedule ¶
func (c *Client) BackupSetSchedule(id string, bs BackupSchedule) error
BackupSetSchedule sets the backup schedule given a BackupSchedule struct
func (*Client) BandwidthOfBareMetalServer ¶
BandwidthOfBareMetalServer retrieves the bandwidth used by a bare metal server.
func (*Client) BandwidthOfServer ¶
BandwidthOfServer retrieves the bandwidth used by a virtual machine
func (*Client) ChangeApplicationofBareMetalServer ¶
ChangeApplicationofBareMetalServer changes the bare metal server to a different application.
func (*Client) ChangeApplicationofServer ¶
ChangeApplicationofServer changes the virtual machine to a different application
func (*Client) ChangeOSofBareMetalServer ¶
ChangeOSofBareMetalServer changes the bare metal server to a different operating system.
func (*Client) ChangeOSofServer ¶
ChangeOSofServer changes the virtual machine to a different operating system
func (*Client) ChangePlanOfServer ¶
ChangePlanOfServer changes the virtual machine to a different plan
func (*Client) ConvertReservedIP ¶
ConvertReservedIP converts an existing virtual machines IP to a reserved IP
func (*Client) CreateBareMetalServer ¶
func (c *Client) CreateBareMetalServer(name string, regionID, planID, osID int, options *BareMetalServerOptions) (BareMetalServer, error)
CreateBareMetalServer creates a new bare metal server on Vultr. BareMetalServerOptions are optional settings.
func (*Client) CreateBlockStorage ¶
func (c *Client) CreateBlockStorage(name string, regionID, size int) (BlockStorage, error)
CreateBlockStorage creates a new block storage on Vultr account
func (*Client) CreateDNSDomain ¶
CreateDNSDomain creates a new DNS domain name on Vultr
func (*Client) CreateDNSRecord ¶
CreateDNSRecord creates a new DNS record
func (*Client) CreateFirewallGroup ¶
CreateFirewallGroup creates a new firewall group in Vultr account
func (*Client) CreateFirewallRule ¶
func (c *Client) CreateFirewallRule(groupID, protocol, port string, network *net.IPNet, notes string) (int, error)
CreateFirewallRule creates a new firewall rule in Vultr account. groupID is the ID of the firewall group to create the rule in protocol must be one of: "icmp", "tcp", "udp", "gre" port can be a port number or colon separated port range (TCP/UDP only)
func (*Client) CreateIPv4 ¶
CreateIPv4 creates an IPv4 address and attaches it to a virtual machine
func (*Client) CreateNetwork ¶
func (c *Client) CreateNetwork(regionID int, description string, subnet *net.IPNet) (Network, error)
CreateNetwork creates new Network on Vultr
func (*Client) CreateReservedIP ¶
CreateReservedIP creates a new reserved IP on Vultr account
func (*Client) CreateSSHKey ¶
CreateSSHKey creates new SSHKey on Vultr
func (*Client) CreateServer ¶
func (c *Client) CreateServer(name string, regionID, planID, osID int, options *ServerOptions) (Server, error)
CreateServer creates a new virtual machine on Vultr. ServerOptions are optional settings.
func (*Client) CreateSnapshot ¶
CreateSnapshot creates a new virtual machine snapshot
func (*Client) CreateStartupScript ¶
func (c *Client) CreateStartupScript(name, content, scriptType string) (StartupScript, error)
CreateStartupScript creates a new startup script
func (*Client) DefaultIPv4ReverseDNS ¶
DefaultIPv4ReverseDNS sets a reverse DNS entry for an IPv4 address of a virtual machine to the original setting
func (*Client) DeleteBareMetalServer ¶
DeleteBareMetalServer deletes an existing bare metal server.
func (*Client) DeleteBlockStorage ¶
DeleteBlockStorage deletes an existing block storage
func (*Client) DeleteDNSDomain ¶
DeleteDNSDomain deletes an existing DNS domain name
func (*Client) DeleteDNSRecord ¶
DeleteDNSRecord deletes an existing DNS record
func (*Client) DeleteFirewallGroup ¶
DeleteFirewallGroup deletes an existing firewall group
func (*Client) DeleteFirewallRule ¶
DeleteFirewallRule deletes an existing firewall rule
func (*Client) DeleteIPv4 ¶
DeleteIPv4 deletes an IPv4 address and detaches it from a virtual machine
func (*Client) DeleteIPv6ReverseDNS ¶
DeleteIPv6ReverseDNS removes a reverse DNS entry for an IPv6 address of a virtual machine
func (*Client) DeleteNetwork ¶
DeleteNetwork deletes an existing Network from Vultr account
func (*Client) DeleteSSHKey ¶
DeleteSSHKey deletes an existing SSHKey from Vultr account
func (*Client) DeleteServer ¶
DeleteServer deletes an existing virtual machine
func (*Client) DeleteSnapshot ¶
DeleteSnapshot deletes an existing virtual machine snapshot
func (*Client) DeleteStartupScript ¶
DeleteStartupScript deletes an existing startup script from Vultr account
func (*Client) DestroyReservedIP ¶
DestroyReservedIP deletes an existing reserved IP
func (*Client) DetachBlockStorage ¶
DetachBlockStorage detaches block storage from virtual machine
func (*Client) DetachISOfromServer ¶
DetachISOfromServer detaches the currently mounted ISO image from the virtual machine and reboots it
func (*Client) DetachReservedIP ¶
DetachReservedIP detaches a reserved IP from an existing virtual machine
func (*Client) DisablePrivateNetworkForServer ¶
DisablePrivateNetworkForServer removes the given virtual machine from the given private network
func (*Client) EnablePrivateNetworkForServer ¶
EnablePrivateNetworkForServer enables private networking for the given virtual machine. If private networking is already enabled, then nothing occurs. If multiple private networks exist in the virtual machine's region, then the network ID must be specified.
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) GetApplicationInfo ¶
GetApplicationInfo retrieves the application information for the existing virtual machine
func (*Client) GetApplications ¶
func (c *Client) GetApplications() ([]Application, error)
GetApplications returns a list of all available applications on Vultr
func (*Client) GetAvailableBareMetalPlansForRegion ¶
GetAvailableBareMetalPlansForRegion returns available bare metal plans for specified region.
func (*Client) GetAvailablePlansForRegion ¶
GetAvailablePlansForRegion returns available plans for specified region
func (*Client) GetBackups ¶
GetBackups retrieves a list of all backups on Vultr account
func (*Client) GetBareMetalPlans ¶
func (c *Client) GetBareMetalPlans() ([]BareMetalPlan, error)
GetBareMetalPlans returns a list of all available bare metal plans on Vultr account.
func (*Client) GetBareMetalServer ¶
func (c *Client) GetBareMetalServer(id string) (BareMetalServer, error)
GetBareMetalServer returns the bare metal server with the given ID.
func (*Client) GetBareMetalServers ¶
func (c *Client) GetBareMetalServers() ([]BareMetalServer, error)
GetBareMetalServers returns a list of current bare metal servers on the Vultr account.
func (*Client) GetBareMetalServersByTag ¶
func (c *Client) GetBareMetalServersByTag(tag string) ([]BareMetalServer, error)
GetBareMetalServersByTag returns a list of all bare metal servers matching by tag.
func (*Client) GetBlockStorage ¶
func (c *Client) GetBlockStorage(id string) (BlockStorage, error)
GetBlockStorage returns block storage with given ID
func (*Client) GetBlockStorages ¶
func (c *Client) GetBlockStorages() (storages []BlockStorage, err error)
GetBlockStorages returns a list of all active block storages on Vultr account
func (*Client) GetDNSDomains ¶
GetDNSDomains returns a list of available domains on Vultr account
func (*Client) GetDNSRecords ¶
GetDNSRecords returns a list of all DNS records of a particular domain
func (*Client) GetFirewallGroup ¶
func (c *Client) GetFirewallGroup(id string) (FirewallGroup, error)
GetFirewallGroup returns the firewall group with given ID
func (*Client) GetFirewallGroups ¶
func (c *Client) GetFirewallGroups() ([]FirewallGroup, error)
GetFirewallGroups returns a list of all available firewall groups on Vultr
func (*Client) GetFirewallRules ¶
func (c *Client) GetFirewallRules(groupID string) ([]FirewallRule, error)
GetFirewallRules returns a list of rules for the given firewall group
func (*Client) GetISOStatusofServer ¶
GetISOStatusofServer retrieves the current ISO image state of an existing virtual machine
func (*Client) GetNetworks ¶
GetNetworks returns a list of Networks from Vultr account
func (*Client) GetRegions ¶
GetRegions returns a list of all available Vultr regions
func (*Client) GetReservedIP ¶
GetReservedIP returns reserved IP with given ID
func (*Client) GetSSHKeys ¶
GetSSHKeys returns a list of SSHKeys from Vultr account
func (*Client) GetServers ¶
GetServers returns a list of current virtual machines on Vultr account
func (*Client) GetServersByTag ¶
GetServersByTag returns a list of all virtual machines matching by tag
func (*Client) GetSnapshots ¶
GetSnapshots retrieves a list of all snapshots on Vultr account
func (*Client) GetStartupScript ¶
func (c *Client) GetStartupScript(id string) (StartupScript, error)
GetStartupScript returns the startup script with the given ID
func (*Client) GetStartupScripts ¶
func (c *Client) GetStartupScripts() (scripts []StartupScript, err error)
GetStartupScripts returns a list of all startup scripts on the current Vultr account
func (*Client) HaltBareMetalServer ¶
HaltBareMetalServer stops an existing bare metal server.
func (*Client) HaltServer ¶
HaltServer stops an existing virtual machine
func (*Client) LabelBlockStorage ¶
LabelBlockStorage changes the label on an existing block storage
func (*Client) ListApplicationsforBareMetalServer ¶
func (c *Client) ListApplicationsforBareMetalServer(id string) ([]Application, error)
ListApplicationsforBareMetalServer lists all available operating systems to which an existing bare metal server can be changed.
func (*Client) ListApplicationsforServer ¶
func (c *Client) ListApplicationsforServer(id string) (apps []Application, err error)
ListApplicationsforServer lists all available operating systems to which an existing virtual machine can be changed
func (*Client) ListIPv6ReverseDNS ¶
func (c *Client) ListIPv6ReverseDNS(id string) (list []ReverseDNSIPv6, err error)
ListIPv6ReverseDNS lists the IPv6 reverse DNS entries of a virtual machine
func (*Client) ListOSforBareMetalServer ¶
ListOSforBareMetalServer lists all available operating systems to which an existing bare metal server can be changed.
func (*Client) ListOSforServer ¶
ListOSforServer lists all available operating systems to which an existing virtual machine can be changed
func (*Client) ListPrivateNetworksForServer ¶
func (c *Client) ListPrivateNetworksForServer(id string) (nets []PrivateNetwork, err error)
ListPrivateNetworksForServer lists all the private networks to which an existing virtual machine is attached
func (*Client) ListReservedIP ¶
ListReservedIP returns a list of all available reserved IPs on Vultr account
func (*Client) ListUpgradePlansForServer ¶
ListUpgradePlansForServer retrieves a list of the VPSPLANIDs for which a virtual machine can be upgraded. An empty response means that there are currently no upgrades available
func (*Client) OnRequestCompleted ¶
func (c *Client) OnRequestCompleted(rc RequestCompletionCallback)
OnRequestCompleted sets the API request completion callback
func (*Client) RebootBareMetalServer ¶
RebootBareMetalServer reboots an existing bare metal server.
func (*Client) RebootServer ¶
RebootServer reboots an existing virtual machine
func (*Client) ReinstallBareMetalServer ¶
ReinstallBareMetalServer reinstalls the operating system on an existing bare metal server.
func (*Client) ReinstallServer ¶
ReinstallServer reinstalls the operating system on an existing virtual machine
func (*Client) RenameBareMetalServer ¶
RenameBareMetalServer renames an existing bare metal server.
func (*Client) RenameServer ¶
RenameServer renames an existing virtual machine
func (*Client) ResizeBlockStorage ¶
ResizeBlockStorage resizes an existing block storage
func (*Client) RestoreBackup ¶
RestoreBackup restore the specified backup to the virtual machine
func (*Client) RestoreSnapshot ¶
RestoreSnapshot restore the specified snapshot to the virtual machine
func (*Client) SetFirewallGroup ¶
SetFirewallGroup adds a virtual machine to a firewall group
func (*Client) SetFirewallGroupDescription ¶
SetFirewallGroupDescription sets the description of an existing firewall group
func (*Client) SetIPv4ReverseDNS ¶
SetIPv4ReverseDNS sets a reverse DNS entry for an IPv4 address of a virtual machine
func (*Client) SetIPv6ReverseDNS ¶
SetIPv6ReverseDNS sets a reverse DNS entry for an IPv6 address of a virtual machine
func (*Client) StartServer ¶
StartServer starts an existing virtual machine
func (*Client) TagBareMetalServer ¶
TagBareMetalServer replaces the tag on an existing bare metal server.
func (*Client) UnsetFirewallGroup ¶
UnsetFirewallGroup removes a virtual machine from a firewall group
func (*Client) UpdateDNSRecord ¶
UpdateDNSRecord updates an existing DNS record
func (*Client) UpdateSSHKey ¶
UpdateSSHKey updates an existing SSHKey entry
func (*Client) UpdateStartupScript ¶
func (c *Client) UpdateStartupScript(script StartupScript) error
UpdateStartupScript updates an existing startup script
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"` }
DNSRecord represents a DNS record on Vultr
type FirewallGroup ¶
type FirewallGroup struct { ID string `json:"FIREWALLGROUPID"` Description string `json:"description"` Created string `json:"date_created"` Modified string `json:"date_modified"` InstanceCount int `json:"instance_count"` RuleCount int `json:"rule_count"` MaxRuleCount int `json:"max_rule_count"` }
FirewallGroup represents a firewall group on Vultr
type FirewallRule ¶
type FirewallRule struct { RuleNumber int `json:"rulenumber"` Action string `json:"action"` Protocol string `json:"protocol"` Port string `json:"port"` Network *net.IPNet Notes string `json:"notes"` }
FirewallRule represents a firewall rule on Vultr
func (*FirewallRule) UnmarshalJSON ¶
func (r *FirewallRule) UnmarshalJSON(data []byte) (err error)
UnmarshalJSON implements json.Unmarshaller on FirewallRule. This is needed because the Vultr API is inconsistent in it's JSON responses. Some fields can change type, from JSON number to JSON string and vice-versa.
type IP ¶
type IP struct { ID string `json:"SUBID,string"` RegionID int `json:"DCID,string"` IPType string `json:"ip_type"` Subnet string `json:"subnet"` SubnetSize int `json:"subnet_size"` Label string `json:"label"` AttachedTo string `json:"attached_SUBID,string"` }
IP on Vultr
func (*IP) UnmarshalJSON ¶
UnmarshalJSON implements json.Unmarshaller on IP. This is needed because the Vultr API is inconsistent in it's JSON responses. Some fields can change type, from JSON number to JSON string and vice-versa.
type IPv4 ¶
type IPv4 struct { IP string `json:"ip"` Netmask string `json:"netmask"` Gateway string `json:"gateway"` MAC string `json:"mac_address"` 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 Network ¶
type Network struct { ID string `json:"NETWORKID"` RegionID int `json:"DCID,string"` Description string `json:"description"` V4Subnet string `json:"v4_subnet"` V4SubnetMask int `json:"v4_subnet_mask"` Created string `json:"date_created"` }
Network on Vultr account
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 }
Options represents optional settings and flags that can be passed to NewClient
type Plan ¶
type Plan struct { ID int `json:"VPSPLANID,string"` Name string `json:"name"` VCpus int `json:"vcpu_count,string"` RAM string `json:"ram"` Disk string `json:"disk"` Bandwidth string `json:"bandwidth"` Price string `json:"price_per_month"` PlanType string `json:"plan_type"` Windows bool `json:"windows"` Regions []int `json:"available_locations"` }
Plan on Vultr
type PrivateNetwork ¶
type PrivateNetwork struct { ID string `json:"NETWORKID"` MACAddress string `json:"mac_address"` IPAddress string `json:"ip_address"` }
PrivateNetwork 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"` BlockStorage bool `json:"block_storage"` Code string `json:"regioncode"` }
Region on Vultr
type RequestCompletionCallback ¶
RequestCompletionCallback defines the type of the request callback function
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"` OSID string `json:"OSID"` AppID string `json:"APPID"` FirewallGroupID string `json:"FIREWALLGROUPID"` }
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 ISO int Script int UserData string Snapshot string SSHKey string ReservedIP string IPV6 bool Networks []string PrivateNetworking bool AutoBackups bool DontNotifyOnActivate bool Hostname string Tag string AppID string FirewallGroupID string }
ServerOptions are optional parameters to be used during server creation
type Snapshot ¶
type Snapshot struct { ID string `json:"SNAPSHOTID"` Description string `json:"description"` Size string `json:"size"` Status string `json:"status"` Created string `json:"date_created"` OSID string `json:"OSID"` AppID string `json:"APPID"` }
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)
UnmarshalJSON implements json.Unmarshaller on StartupScript. Necessary because the SCRIPTID field has inconsistent types.