Documentation
¶
Overview ¶
A generic binding of the Citrix XenServer API. Read more here: http://docs.vmd.citrix.com/XenServer/6.0.0/1.0/en_gb/api/
Index ¶
- func OpaqueRefIsEmpty(a string) bool
- func TimeoutDialer() func(net, addr string) (c net.Conn, err error)
- type APIResult
- type Event
- type Host
- type PIF
- type Session
- type VDB
- type VDI
- type VIF
- type VM
- type VirtualMachines
- type XapiClient
- func (client *XapiClient) GetHost(opref string) (host Host, err error)
- func (client *XapiClient) GetHostname(opref string) (hostname string, err error)
- func (client *XapiClient) GetPIF(opref string) (pif PIF, err error)
- func (client *XapiClient) GetSession() (session Session, err error)
- func (client *XapiClient) GetVIF(opref string) (vif VIF, err error)
- func (client *XapiClient) GetVM(opref string) (vm VM, err error)
- func (client *XapiClient) GetVMs() (machines VirtualMachines, err error)
- func (client *XapiClient) Login() (err error)
- func (client *XapiClient) NextEvent() (ev []Event, err error)
- func (client *XapiClient) RegisterEvent(classes ...interface{}) error
- func (client *XapiClient) RpcCall(result interface{}, call string, params ...interface{}) error
- func (client *XapiClient) SessionCall(result interface{}, call string, params ...interface{}) (err error)
- func (client *XapiClient) UnregisterEvent() error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func OpaqueRefIsEmpty ¶
Check to see if a field that should be an OpaqueRef is actually empty. Sometimes it's an empty string (rare) but other times it's OpaqueRef:NULL which is good to know.
func TimeoutDialer ¶
Custom Dialer for HTTP so that the initial connection only lasts for 1 minute and that the lifetime of the connection is only 1 minute as well. See http://golang.org/pkg/net/#Conn You shouldn't need to use this directly.
Types ¶
type Host ¶
type Host struct {
Address string
Allowed_operations []string
Current_operations map[string]string
API_version_major int
API_version_minor int
API_version_vendor string
API_version_vendor_implementation map[string]string
Bios_strings map[string]string
Blobs map[string][]byte
Capabilities []string
Chipset_info map[string]string
Cpu_configuration map[string]string
Cpu_info map[string]string
Crash_dump_sr string
Crashdumps []string
Edition string
Enabled bool
External_auth_configuration map[string]string
External_auth_type string
External_auth_service_name string
Ha_network_peers []string
Ha_statefiles []string
Host_CPUs []string
Hostname string
License_params map[string]string
License_server map[string]string
Local_cache_sr string
Logging map[string]string
Memory_overhead int
Metrics string
Name_description string
Name_label string
Other_config map[string]string
Patches []string
PBDs []string
PCIs []string
PGPUs []string
PIFs []string
Power_on_config map[string]string
Resident_VMs []string
Sched_policy string
Software_version map[string]string
Supported_bootloaders []string
Suspend_image_sr string
Uuid string
Tags []string
}
type PIF ¶
type PIF struct {
Bond_master_of []string
Bond_slave_of string
Currently_attached bool
Device string
Disallow_unplug bool
DNS string
Gateway string
Host string
IP string
Ip_configuration_mode string
MAC string
Management bool
Metrics string
MTU int
Netmask string
Network string
Other_config map[string]string
Physical bool
Tunnel_access_PIF_of string
Tunnel_transport_PIF_of string
Uuid string
VLAN int
VLAN_master_of string
VLAN_slave_of []string
}
type VDB ¶
type VDB struct {
Allowed_operations []string
Current_operations map[string]string
Bootable bool
Currently_attached bool
Device string
Empty bool
Metrics string
Mode string
Other_config map[string]string
Qos_algorithm_params map[string]string
Qos_algorithm_type string
Qos_supported_algorithms []string
Runtime_properties map[string]string
Status_code int
Status_detail string
Uuid string
VDI string
VM string
Storage_lock bool
Type string
Unpluggable bool
Userdevice string
}
type VDI ¶
type VDI struct {
Allow_caching bool
Allowed_operations []string
Crash_dumps []string
Current_operations map[string]string
Is_a_snapshot bool
Location string
Managed bool
Metadata_latest bool
Missing bool
Name_description string
Name_label string
On_boot string
Other_config map[string]string
Parent string
Physcial_utilisation int
Read_only bool
Sharable bool
Sm_config map[string]string
Snapshot_of []string
SR []string
Storage_lock bool
Tags string
Type string
Uuid string
VDBs []string
Virtual_size int
Xenstore_data map[string]string
}
type VIF ¶
type VIF struct {
Allowed_operations []string
Current_operations map[string]string
Currently_attached bool
Device string
MAC string
MAC_autogenerated bool
Metrics string
MTU int
Network string
Other_config map[string]string
Qos_algorithm_params map[string]string
Qos_algorithm_type string
Qos_supported_algorithms []string
Runtime_properties map[string]string
Status_code int
Status_detail string
Uuid string
VM string
}
type VM ¶
type VM struct {
Actions_after_crash string
Actions_after_reboot string
Actions_after_shutdown string
Affinity string
Allowed_operations []string
Appliance string
Attached_PCIs []string
Bios_strings map[string]string
Blobs map[string][]byte
Blocked_operations map[string]string
Children []string
Consoles []string
Crash_dumps []string
Current_operations map[string]string
Domarch string
Domid int
Guest_metrics string
Ha_always_run bool
Ha_restart_priority string
HVM_boot_params map[string]string
HVM_boot_policy string
HVM_shadow_multiplier float64
Is_a_snapshot bool
Is_a_template bool
Is_control_domain bool
Is_snapshot_from_vmpp bool
Last_boot_CPU_flags map[string]string
Last_booted_record string
Memory_dynamic_max int
Memory_dynamic_min int
Memory_overhead int
Memory_static_max int
Memory_static_min int
Memory_target int
Metrics string
Name_description string
Name_label string
Order int
Other_config map[string]string
Parent string
PCI_bus string
Platform map[string]string
Power_status string
Protection_policy string
PV_args string
PV_bootloader string
PV_bootloader_args string
PV_kernel string
PV_legacy_args string
PV_ramdisk string
Recommendations string
Resident_on string
Shutdown_delay int
Snapshot_info map[string]string
Snapshot_metadata string
Snapshot_time time.Time
Start_delay int
Suspend_SR string
Suspend_VDI string
Tags []string
Transportable_snapshot_id string
User_version int
Uuid string
VBDs []string
VCPUs_at_startup int
VCPUs_max int
VCPUs_params map[string]string
Version int
VGPUs []string
VIFs []string
VTPM []string
Xenstore_data map[string]string
}
type VirtualMachines ¶
type VirtualMachines []string
type XapiClient ¶
type XapiClient struct {
Session string
Uri string
Username string
Password string
Version string
// contains filtered or unexported fields
}
func NewXapiClient ¶
func NewXapiClient(uri, username, password, version string) (client XapiClient)
Stand up a new XapiClient. Version should probably be "1.2" unless you know what you are doing.
func (*XapiClient) GetHostname ¶
func (client *XapiClient) GetHostname(opref string) (hostname string, err error)
Get hostname of a Host. Useful in combination with GetSession and session.This_host
func (*XapiClient) GetSession ¶
func (client *XapiClient) GetSession() (session Session, err error)
func (*XapiClient) GetVMs ¶
func (client *XapiClient) GetVMs() (machines VirtualMachines, err error)
func (*XapiClient) Login ¶
func (client *XapiClient) Login() (err error)
func (*XapiClient) NextEvent ¶
func (client *XapiClient) NextEvent() (ev []Event, err error)
func (*XapiClient) RegisterEvent ¶
func (client *XapiClient) RegisterEvent(classes ...interface{}) error
func (*XapiClient) RpcCall ¶
func (client *XapiClient) RpcCall(result interface{}, call string, params ...interface{}) error
Make a generic RPC call passing in a pointer to a struct (or f). The call parameter is a combination of class.message. For example: VIF.get_record, host.evacuate, pool.eject. Any time the XAPI specifies a `type ref` it's really an OpaqueReference, which is a UUID, and as far as xmlrpc and like library are concerned, a string.
x := xapi.NewXapiClient("http://localhost/", "username", "password", "1.2")
host := xapi.Host{}
err := x.RpcCall(&host, "host.get_record", "324c2264-d86f-4a42-a971-bb5fd6203877")
if err != nil {
fmt.Printf("%v", host)
}
func (*XapiClient) SessionCall ¶
func (client *XapiClient) SessionCall(result interface{}, call string, params ...interface{}) (err error)
Useful for making multiple calls that require the session ID. Automatically prepends the existing session OpaqRef to the beginning of the API call. You can see the session ID by looking at XapiClient.Session.
func (*XapiClient) UnregisterEvent ¶
func (client *XapiClient) UnregisterEvent() error