Documentation
¶
Index ¶
- type Client
- func (c *Client) GetProfile() (*Profile, error)
- func (c *Client) GetRemoteAccessSession(id int) (RemoteAccessSession, error)
- func (c *Client) GetTransactions() (Transactions, error)
- func (c *Client) GetVirtualMachine(id int) (VirtualMachine, error)
- func (c *Client) GetVirtualMachines() (VirtualMachines, error)
- func (c *Client) VirtualMachineGetLatestTransaction(vmId int, statuses ...string) (Transaction, error)
- func (c *Client) VirtualMachineGetTransactions(vmId int) (Transactions, error)
- func (c *Client) VirtualMachineReboot(id int) error
- func (c *Client) VirtualMachineShutdown(id int) error
- func (c *Client) VirtualMachineStartup(id int) error
- type IpAddress
- type Profile
- type RemoteAccessSession
- type Transaction
- type Transactions
- type VirtualMachine
- func (vm *VirtualMachine) BootedString() string
- func (vm *VirtualMachine) BootedStringColored() string
- func (vm *VirtualMachine) GetIpAddress() IpAddress
- func (vm *VirtualMachine) GetIpAddresses() ([]IpAddress, error)
- func (vm *VirtualMachine) GetRemoteAccessSession() (*RemoteAccessSession, error)
- func (vm *VirtualMachine) GetRunningTransaction() (Transaction, error)
- func (vm *VirtualMachine) GetTransactions() (Transactions, error)
- func (vm *VirtualMachine) Reboot() error
- func (vm *VirtualMachine) Shutdown() error
- func (vm *VirtualMachine) Startup() error
- type VirtualMachines
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Client ¶
type Client struct {
Server string
// contains filtered or unexported fields
}
func NewClient ¶
Creates a new API client with the specified hostname, email address and API key. The hostname needs to be the DNS-resolvable hostname of the dashboard server (such as dashboard.example.org).
func (*Client) GetProfile ¶
Fetches the user profile from the dashboard server
func (*Client) GetRemoteAccessSession ¶
func (c *Client) GetRemoteAccessSession(id int) (RemoteAccessSession, error)
func (*Client) GetTransactions ¶
func (c *Client) GetTransactions() (Transactions, error)
func (*Client) GetVirtualMachine ¶
func (c *Client) GetVirtualMachine(id int) (VirtualMachine, error)
Fetches an individual Virtual Machine from the dashboard server
func (*Client) GetVirtualMachines ¶
func (c *Client) GetVirtualMachines() (VirtualMachines, error)
Fetches a list of Virtual Machines from the dashboard server
func (*Client) VirtualMachineGetLatestTransaction ¶
func (c *Client) VirtualMachineGetLatestTransaction(vmId int, statuses ...string) (Transaction, error)
func (*Client) VirtualMachineGetTransactions ¶
func (c *Client) VirtualMachineGetTransactions(vmId int) (Transactions, error)
func (*Client) VirtualMachineReboot ¶
func (*Client) VirtualMachineShutdown ¶
func (*Client) VirtualMachineStartup ¶
type IpAddress ¶
type IpAddress struct {
Address string `json:"address"`
Gateway string `json:"gateway"`
Broadcast string `json:"broadcast"`
NetworkAddress string `json:"network_address"`
Netmask string `json:"netmask"`
}
IP address of a virtual machine as represented by /virtual_machines/:id.json
type Profile ¶
type Profile struct {
FirstName string `json:"first_name"`
LastName string `json:"last_name"`
Login string `json:"login"`
Id int `json:"id"`
Email string `json:"email"`
}
The OnApp user profile as according to /profile.json
type RemoteAccessSession ¶
type RemoteAccessSession struct {
Port int `json:"port"`
}
Remote Access Session
type Transaction ¶
type Transaction struct {
Id int `json:"id"`
Status string `json:"status"`
Parent int `json:"parent_id"`
User int `json:"user_id"`
ParentType string `json:"parent_type"`
Action string `json:"action"`
CreatedAt string `json:"created_at"`
StartedAt string `json:"started_at"`
UpdatedAt string `json:"updated_at"`
Dependent int `json:"dependent_transaction_id"`
// contains filtered or unexported fields
}
func (*Transaction) CreatedAtTime ¶
func (tx *Transaction) CreatedAtTime() (time.Time, error)
func (*Transaction) IsValid ¶
func (t *Transaction) IsValid() bool
func (*Transaction) StatusColored ¶
func (t *Transaction) StatusColored() string
type Transactions ¶
type Transactions []Transaction
type VirtualMachine ¶
type VirtualMachine struct {
Id int `json:"id"`
Label string `json:"label"`
Booted bool `json:"booted"`
Hostname string `json:"hostname"`
HV int `json:"hypervisor_id"`
Cpus int `json:"cpus"`
Memory int `json:"memory"`
Template string `json:"template_label"`
User int `json:"user_id"`
Locked bool `json:"locked"`
RootPassword string `json:"initial_root_password"`
IpAddressesRaw []map[string]IpAddress `json:"ip_addresses"`
VncPassword string `json:"remote_access_password"`
// contains filtered or unexported fields
}
The OnApp Virtual Machine as according to /virtual_machines.json
func (*VirtualMachine) BootedString ¶
func (vm *VirtualMachine) BootedString() string
func (*VirtualMachine) BootedStringColored ¶
func (vm *VirtualMachine) BootedStringColored() string
func (*VirtualMachine) GetIpAddress ¶
func (vm *VirtualMachine) GetIpAddress() IpAddress
This prefers non-rfc5735 addresses if possible
func (*VirtualMachine) GetIpAddresses ¶
func (vm *VirtualMachine) GetIpAddresses() ([]IpAddress, error)
func (*VirtualMachine) GetRemoteAccessSession ¶
func (vm *VirtualMachine) GetRemoteAccessSession() (*RemoteAccessSession, error)
func (*VirtualMachine) GetRunningTransaction ¶
func (vm *VirtualMachine) GetRunningTransaction() (Transaction, error)
func (*VirtualMachine) GetTransactions ¶
func (vm *VirtualMachine) GetTransactions() (Transactions, error)
func (*VirtualMachine) Reboot ¶
func (vm *VirtualMachine) Reboot() error
func (*VirtualMachine) Shutdown ¶
func (vm *VirtualMachine) Shutdown() error
func (*VirtualMachine) Startup ¶
func (vm *VirtualMachine) Startup() error
type VirtualMachines ¶
type VirtualMachines []VirtualMachine
sort.Sort'ing over this type will sort by UserId
func (VirtualMachines) AsList ¶
func (vms VirtualMachines) AsList() list.List
func (VirtualMachines) Len ¶
func (vms VirtualMachines) Len() int
func (VirtualMachines) Less ¶
func (vms VirtualMachines) Less(i, j int) bool
func (VirtualMachines) Swap ¶
func (vms VirtualMachines) Swap(i, j int)
