rest

package
v0.0.0-...-5928fa9 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 26, 2024 License: MPL-2.0 Imports: 17 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Alert

type Alert struct {
	Acknowledged bool   `json:"acknowledged"`
	Class        string `json:"class"`
	Count        int    `json:"count"`
	ID           string `json:"id"`
	Level        string `json:"level"`
	Message      string `json:"message"`
	Ref          struct {
		Cluster string `json:"cluster"`
		Host    string `json:"host"`
	} `json:"ref"`
	Tags      []string    `json:"tags"`
	Timestamp interface{} `json:"timestamp"`
	Type      string      `json:"type"`
}

Alert structure for alerts

func (*Alert) Acknowledge

func (alert *Alert) Acknowledge(client *Client) error

Acknowledge marks an alert as acknowledged

func (Alert) String

func (alert Alert) String() string

type Broker

type Broker struct {
	AutoConnectUserDesktop    bool        `json:"autoConnectUserDesktop,omitempty"`
	BackgroundColor           string      `json:"backgroundColor,omitempty"`
	BgImage                   string      `json:"bgImage,omitempty"`
	BgImageFilename           string      `json:"bgImageFilename,omitempty"`
	ButtonTextColor           string      `json:"buttonTextColor,omitempty"`
	Disclaimer                string      `json:"disclaimer,omitempty"`
	Enabled                   bool        `json:"enabled"`
	External                  bool        `json:"external"`
	ExternalProfile           string      `json:"externalProfile,omitempty"`
	Favicon                   string      `json:"favicon,omitempty"`
	FaviconFilename           string      `json:"faviconFilename,omitempty"`
	HideRealms                bool        `json:"hideRealms,omitempty"`
	HideRelease               bool        `json:"hideRelease,omitempty"`
	LogoFilename              string      `json:"logoFilename,omitempty"`
	MainColor                 string      `json:"mainColor,omitempty"`
	PassthroughAuthentication bool        `json:"passthroughAuthentication,omitempty"`
	TextColor                 string      `json:"textColor,omitempty"`
	Title                     string      `json:"title,omitempty"`
	TwoFormAuth               interface{} `json:"twoFormAuth,omitempty"`
	AllowPhysical             bool        `json:"allowPhysical,omitempty"`
}

Broker settings from the cluster table

type BrokerConfig

type BrokerConfig struct {
	AutoConnectUserDesktop    bool   `json:"autoConnectUserDesktop"`
	BackgroundColor           string `json:"backgroundColor"`
	BgImage                   string `json:"bgImage"`
	BgImageFilename           string `json:"bgImageFilename"`
	ButtonTextColor           string `json:"buttonTextColor"`
	ClientSourceIsolation     bool   `json:"clientSourceIsolation"`
	Disclaimer                string `json:"disclaimer"`
	Enabled                   bool   `json:"enabled"`
	External                  bool   `json:"external"`
	ExternalProfile           string `json:"externalProfile"`
	Favicon                   string `json:"favicon"`
	FaviconFilename           string `json:"faviconFilename"`
	HideRealms                bool   `json:"hideRealms"`
	HideRelease               bool   `json:"hideRelease"`
	LogoFilename              string `json:"logoFilename"`
	MainColor                 string `json:"mainColor"`
	PassthroughAuthentication bool   `json:"passthroughAuthentication"`
	TextColor                 string `json:"textColor"`
	Title                     string `json:"title"`
	TwoFormAuth               struct {
		Enabled      bool   `json:"enabled"`
		EnforceLocal bool   `json:"enforceLocal"`
		Type         string `json:"type"`
	} `json:"twoFormAuth"`
	Remote bool `json:"remote"`
}

type BrokerGuest

type BrokerGuest struct {
	Name        string                  `json:"name"`
	UUID        string                  `json:"uuid"`
	HostID      string                  `json:"hostid"`
	GuestState  string                  `json:"guestState"`
	Username    string                  `json:"username"`
	PoolID      string                  `json:"poolID"`
	IP          string                  `json:"ip"`
	Connections []GuestBrokerConnection `json:"connections"`
	UserVolume  *UserVolume             `json:"userVolume,omitempty"`
}

BrokerGuest describes a guest assignment

type BrokerPool

type BrokerPool struct {
	ID        string        `json:"id"`
	Name      string        `json:"name"`
	Os        string        `json:"os"`
	UserGroup string        `json:"userGroup"`
	Guests    []BrokerGuest `json:"guests"`
}

BrokerPool describes a pool received from BrokerLogin

type ChangeFeed

type ChangeFeed struct {
	Data chan ChangeFeedMessage
	Done chan struct{}
	// contains filtered or unexported fields
}

ChangeFeed wrapper around a websocket to monitor database changes

func (*ChangeFeed) Close

func (feed *ChangeFeed) Close() error

Close disconnects the changefeed websocket

type ChangeFeedMessage

type ChangeFeedMessage struct {
	OldValue json.RawMessage `json:"old_val"`
	NewValue json.RawMessage `json:"new_val"`
	Error    error
}

ChangeFeedMessage contains a change from the database

type Client

type Client struct {
	Host          string
	Port          uint
	AllowInsecure bool
	UserAgent     string
	// contains filtered or unexported fields
}

Client is a wrapper around the hiveio rest api

func (*Client) AssignGuest

func (client *Client) AssignGuest(poolID, username, realm, guest string) (interface{}, error)

AssignGuest assign a user to a specific guest

func (*Client) BrokerAssign

func (client *Client) BrokerAssign(poolID string) (BrokerGuest, error)

BrokerAssign requests a desktop from a pool

func (*Client) BrokerAssignments

func (client *Client) BrokerAssignments() ([]BrokerPool, error)

BrokerAssignments returns an array of assignments for the logged in user

func (*Client) BrokerConnect

func (client *Client) BrokerConnect(guest string, outputType string, connection string) ([]byte, error)

BrokerConnect request the rdp file to connect to a guest. outputType can be rdp, json, or hio

func (*Client) BrokerLogin

func (client *Client) BrokerLogin(username, password, realm, token, mfaToken string) error

BrokerLogin connects to the broker with the provided username, password, and realm returns nil or an error

func (*Client) CheckHostVersion

func (client *Client) CheckHostVersion(minimumVersion string) error

CheckHostVersion returns an error if minimumVersion is greater than the host software version

func (*Client) ClusterID

func (client *Client) ClusterID() (string, error)

ClusterID returns the cluster id of the host the client is connected to

func (*Client) CopyFile

func (client *Client) CopyFile(srcStorageID, srcFilePath, destStorageID, destFilePath string) (*Task, error)

CopyFile copies a file in a storage pool to a new file in another storage pool

func (*Client) GetAlert

func (client *Client) GetAlert(id string) (Alert, error)

GetAlert requests a single Alert by id

func (*Client) GetBroker

func (client *Client) GetBroker(clusterID string) (Broker, error)

GetBroker returns the broker settings for the cluster

func (*Client) GetBrokerConfig

func (client *Client) GetBrokerConfig() (BrokerConfig, error)

GetBrokerConfig returns the configuration options of the broker

func (*Client) GetChangeFeed

func (client *Client) GetChangeFeed(table string, filter map[string]string, includeInitial bool) (*ChangeFeed, error)

GetChangeFeed returns a ChangeFeed for monitoring the specified table filter can be used to limit the changes monitored. example to monitor a single task: client.GetChangeFeed("task", map[string]string{"id": task.ID})

func (*Client) GetChangeFeedWithContext

func (client *Client) GetChangeFeedWithContext(ctx context.Context, table string, filter map[string]string, includeInitial bool) (*ChangeFeed, error)

GetChangeFeedWithContext returns a ChangeFeed for monitoring the specified table with a custom context filter can be used to limit the changes monitored. example to monitor a single task: client.GetChangeFeed("task", map[string]string{"id": task.ID})

func (*Client) GetCluster

func (client *Client) GetCluster(id string) (Cluster, error)

GetCluster request a cluster by id

func (*Client) GetGateway

func (client *Client) GetGateway(clusterID string) (Gateway, error)

GetGateway returns the gateway settings for the cluster

func (*Client) GetGuest

func (client *Client) GetGuest(name string) (*Guest, error)

GetGuest requests a single guest by name

func (*Client) GetHost

func (client *Client) GetHost(hostid string) (Host, error)

GetHost requests a single guest by hostid

func (*Client) GetHostByIP

func (client *Client) GetHostByIP(ip string) (*Host, error)

GetHostByIP requests a host by hostname

func (*Client) GetHostByName

func (client *Client) GetHostByName(name string) (*Host, error)

GetHostByName requests a host by hostname

func (*Client) GetPool

func (client *Client) GetPool(id string) (*Pool, error)

GetPool request a pool by id

func (*Client) GetPoolByName

func (client *Client) GetPoolByName(name string) (*Pool, error)

GetPoolByName request a task by name

func (*Client) GetProfile

func (client *Client) GetProfile(id string) (*Profile, error)

GetProfile requests a profile by id

func (*Client) GetProfileByName

func (client *Client) GetProfileByName(name string) (*Profile, error)

GetProfileByName requests a profile by name

func (*Client) GetRealm

func (client *Client) GetRealm(name string) (Realm, error)

GetRealm requests a realm by name

func (*Client) GetStoragePool

func (client *Client) GetStoragePool(id string) (*StoragePool, error)

GetStoragePool requests a storage pool by id

func (*Client) GetStoragePoolByName

func (client *Client) GetStoragePoolByName(name string) (*StoragePool, error)

GetStoragePoolByName requests a storage pool by name

func (*Client) GetTask

func (client *Client) GetTask(id string) (*Task, error)

GetTask request a task by id

func (*Client) GetTaskByName

func (client *Client) GetTaskByName(name string) (*Task, error)

GetTaskByName request a task by name

func (*Client) GetTemplate

func (client *Client) GetTemplate(name string) (Template, error)

GetTemplate request a template by name

func (*Client) GetUser

func (client *Client) GetUser(id string) (*User, error)

GetUser request a user by id

func (*Client) GetUserByGroupName

func (client *Client) GetUserByGroupName(name string) (*User, error)

GetUserByGroupName request a user by groupname

func (*Client) GetUserByName

func (client *Client) GetUserByName(name string) (*User, error)

GetUserByName request a user by name

func (*Client) HostID

func (client *Client) HostID() (string, error)

HostID returns the hostid of the host the client is connected to

func (*Client) HostVersion

func (client *Client) HostVersion() (Version, error)

HostVersion returns the software version of the host the client is connected to

func (*Client) JoinHost

func (client *Client) JoinHost(username, password, ipAddress string) (*Task, error)

JoinHost Add a new host to the cluster

func (*Client) ListAlerts

func (client *Client) ListAlerts(query string) ([]Alert, error)

ListAlerts lists all alerts with an optional filter string

func (*Client) ListClusters

func (client *Client) ListClusters(query string) ([]Cluster, error)

ListClusters request a list of all clusters

func (*Client) ListGuestPools

func (client *Client) ListGuestPools(query string) ([]Pool, error)

ListGuestPools returns an array of all guest pools with an optional filter string

func (*Client) ListGuests

func (client *Client) ListGuests(query string) ([]Guest, error)

ListGuests returns an array of all guests with an optional filter string

func (*Client) ListHosts

func (client *Client) ListHosts(query string) ([]Host, error)

ListHosts returns an array of all host with an optional filter string

func (*Client) ListProfiles

func (client *Client) ListProfiles(query string) ([]Profile, error)

ListProfiles returns an array of all profiles with an optional filter string

func (*Client) ListRealms

func (client *Client) ListRealms(query string) ([]Realm, error)

ListRealms returns an array of all realms with an optional filter string

func (*Client) ListStoragePools

func (client *Client) ListStoragePools(query string) ([]StoragePool, error)

ListStoragePools returns an array of storage pools with an optional filter string

func (*Client) ListTasks

func (client *Client) ListTasks(query string) ([]Task, error)

ListTasks returns an array of tasks with an optional filter string

func (*Client) ListTemplates

func (client *Client) ListTemplates(query string) ([]Template, error)

ListTemplates returns an array of templates with an optional filter string

func (*Client) ListUsers

func (client *Client) ListUsers(query string) ([]User, error)

ListUsers returns an array of all users with an optional filter string

func (*Client) Login

func (client *Client) Login(username, password, realm string) error

Login attempts to connect to the server specified in Client with the provided username, password, and realm

func (*Client) MetricsExport

func (client *Client) MetricsExport(metric string, entity string, resolution uint, output string) ([]byte, error)

MetricsExport export metrics as json or csv output can be json or csv

func (*Client) MetricsLatest

func (client *Client) MetricsLatest(metric string, entity string, resolution uint) ([]byte, error)

MetricsLatest gets the latest metric for entity. metric can be host, guest, storage, pool, and cluster resolution can be 20, 900, 3600, or 21600

func (*Client) MoveFile

func (client *Client) MoveFile(srcStorageID, srcFilePath, destStorageID, destFilePath string) (*Task, error)

MoveFile moves or renames a file in a storage pool

func (*Client) ReleaseGuest

func (client *Client) ReleaseGuest(poolID, username, guest string) error

ReleaseGuest release a guest that is currently assigned

func (*Client) ResetBroker

func (client *Client) ResetBroker(clusterID string) error

ResetBroker updates broker settings for the cluster

func (*Client) SetBroker

func (client *Client) SetBroker(clusterID string, brokerSettings Broker) error

SetBroker updates broker settings for the cluster

func (*Client) SetGateway

func (client *Client) SetGateway(clusterID string, gatewaySettings Gateway) error

SetGateway updates gateway settings for the cluster

func (*Client) SetToken

func (client *Client) SetToken(token string)

SetToken sets the token directly instead of calling auth

type Cluster

type Cluster struct {
	AdminPassword string   `json:"adminPassword"`
	Broker        *Broker  `json:"broker"`
	Gateway       *Gateway `json:"gateway"`
	HiveSense     struct {
		AwsAccessKeyID     string `json:"awsAccessKeyId,omitempty"`
		AwsSecretAccessKey string `json:"awsSecretAccessKey,omitempty"`
		CustomerName       string `json:"customerName,omitempty"`
		Enabled            bool   `json:"enabled"`
		LogStatus          string `json:"logStatus,omitempty"`
		UploadFrequency    int    `json:"uploadFrequency,omitempty"`
	} `json:"hiveSense"`
	ID      string `json:"id"`
	License *struct {
		Expiration time.Time `json:"expiration"`
		Type       string    `json:"type"`
		MaxGuests  int       `json:"maxGuests,omitempty"`
	} `json:"license"`
	Name          string `json:"name"`
	SharedStorage *struct {
		Enabled bool `json:"enabled"`
		Hosts   []struct {
			Hostid string `json:"hostid"`
			State  string `json:"state"`
		} `json:"hosts"`
		ID                 string `json:"id"`
		MinSetSize         int    `json:"minSetSize"`
		State              string `json:"state"`
		StorageUtilization int    `json:"storageUtilization"`
	} `json:"sharedStorage"`
	Backup      *ClusterBackup `json:"backup,omitempty"`
	Tags        []string       `json:"tags"`
	EmailAlerts EmailAlerts    `json:"emailAlerts,omitempty"`
}

Cluster record from the rest api

func (Cluster) ClearEmailAlerts

func (cluster Cluster) ClearEmailAlerts(client *Client) error

ClearEmailAlerts updates cluster email alert settings

func (*Cluster) DisableBackup

func (cluster *Cluster) DisableBackup(client *Client) error

DisableBackup disable automatic data protection

func (*Cluster) DisableSharedStorage

func (cluster *Cluster) DisableSharedStorage(client *Client) (*Task, error)

DisableSharedStorage disables shared storage on the cluster

func (*Cluster) EnableBackup

func (cluster *Cluster) EnableBackup(client *Client, startWindow string, endWindow string) error

EnableBackup enable automatic data protection startWindow and endWindow must be strings in the format "01:00:00"

func (*Cluster) EnableSharedStorage

func (cluster *Cluster) EnableSharedStorage(client *Client, storageUtilization int, minSetSize int) (*Task, error)

EnableSharedStorage enable shared storage on a cluster storageUtilization is a percentage for the amount of storage to be allocated for shared storage minSetSize is the number of host to grow the storage by (2 or 3)

func (*Cluster) GetLicenseInfo

func (cluster *Cluster) GetLicenseInfo(client *Client) (string, string, error)

GetLicenseInfo Lookup license information for the current cluster

func (Cluster) SetEmailAlerts

func (cluster Cluster) SetEmailAlerts(client *Client, emailAlerts EmailAlerts) error

EmailAlerts updates cluster email alert settings

func (*Cluster) SetLicense

func (cluster *Cluster) SetLicense(client *Client, key string) error

SetLicense replaces the license for the cluster

func (Cluster) String

func (cluster Cluster) String() string

func (Cluster) UpdateSoftware

func (cluster Cluster) UpdateSoftware(client *Client, packageName string) (*Task, error)

UpdateSoftware applies a software package across the cluster

type ClusterBackup

type ClusterBackup struct {
	Enabled     bool   `json:"enabled"`
	StartWindow string `json:"startWindow"`
	EndWindow   string `json:"endWindow"`
}

ClusterBackup data protection settings from the cluster table

type DiskInfo

type DiskInfo struct {
	Filename            string   `json:"filename,omitempty"`
	Format              string   `json:"format,omitempty"`
	VirtualSize         uint     `json:"virtual-size,omitempty"`
	ActualSize          uint     `json:"actual-size,omitempty"`
	DirtyFlag           bool     `json:"dirty-flag,omitempty"`
	ClusterSize         uint     `json:"cluster-size,omitempty"`
	Encrypted           bool     `json:"encrypted,omitempty"`
	BackingFilename     string   `json:"backing-filename,omitempty"`
	FullBackingFilename string   `json:"full-backing-filename,omitempty"`
	Snapshots           []string `json:"snapshots,omitempty"`
}

DiskInfo contains information about a disk from a storage pool

type EmailAlerts

type EmailAlerts struct {
	Service   string                   `json:"service,omitempty"`
	Host      string                   `json:"host,omitempty"`
	SMTPPort  uint                     `json:"smtpPort,omitempty"`
	Secure    bool                     `json:"secure"`
	Username  string                   `json:"username"`
	Password  string                   `json:"password"`
	Level     string                   `json:"level,omitempty"`
	From      string                   `json:"from,omitempty"`
	To        string                   `json:"to"`
	BlackList []map[string]interface{} `json:"blackList,omitempty"`
}

Settings for email alerts

type ExternalGuest

type ExternalGuest struct {
	GuestName        string             `json:"guestName,omitempty"`
	Address          string             `json:"address,omitempty"`
	Username         string             `json:"username,omitempty"`
	ADGroup          string             `json:"ADGroup,omitempty"`
	Realm            string             `json:"realm,omitempty"`
	OS               string             `json:"os,omitempty"`
	DisablePortCheck bool               `json:"disablePortCheck"`
	BrokerOptions    GuestBrokerOptions `json:"brokerOptions,omitempty"`
}

ExternalGuest is used to add external guest records to the system

func (*ExternalGuest) Create

func (guest *ExternalGuest) Create(client *Client) (string, error)

Create creates a new pool

type Gateway

type Gateway struct {
	Enabled                  bool                   `json:"enabled"`
	ClientSourceIsolation    bool                   `json:"clientSourceIsolation"`
	PersistentPortAssignment bool                   `json:"persistentPortAssignment"`
	Hosts                    map[string]GatewayHost `json:"hosts"`
}

Gateway settings from the cluster table

type GatewayHost

type GatewayHost struct {
	StartPort       uint   `json:"startPort"`
	EndPort         uint   `json:"endPort"`
	ExternalAddress string `json:"externalAddress"`
}

type Guest

type Guest struct {
	Address             string                  `json:"address,omitempty"`
	ADGroup             string                  `json:"ADGroup,omitempty"`
	AgentInstalled      bool                    `json:"agentInstalled"`
	AgentMetadata       *GuestAgentMetadata     `json:"agentMetadata"`
	AgentVersion        string                  `json:"agentVersion,omitempty"`
	Backup              *GuestBackup            `json:"backup,omitempty"`
	Cpus                int                     `json:"cpus,omitempty"`
	Currentmem          int                     `json:"currentmem,omitempty"`
	Disks               []GuestDisk             `json:"disks,omitempty"`
	DuplicateMitigation bool                    `json:"duplicateMitigation"`
	Error               *GuestError             `json:"error,omitempty"`
	External            bool                    `json:"external"`
	DisablePortCheck    bool                    `json:"disablePortCheck"`
	Gateway             string                  `json:"gateway,omitempty"`
	GPU                 bool                    `json:"gpu"`
	GuestState          string                  `json:"guestState,omitempty"`
	HasBeenReady        bool                    `json:"hasBeenReady,omitempty"`
	Hostid              string                  `json:"hostid,omitempty"`
	HostDevices         []HostDevice            `json:"hostDevices,omitempty"`
	Hostname            string                  `json:"hostname,omitempty"`
	Interfaces          []GuestNetwork          `json:"interfaces,omitempty"`
	Memory              int                     `json:"memory,omitempty"`
	MigrationMetadata   *GuestMigrationMetadata `json:"migrationMetadata,omitempty"`
	MigrationProcessing bool                    `json:"migrationProcessing"`
	Name                string                  `json:"name,omitempty"`
	Os                  string                  `json:"os,omitempty"`
	Persistent          bool                    `json:"persistent,omitempty"`
	PoolID              string                  `json:"poolId,omitempty"`
	PreviousGuestState  string                  `json:"previousGuestState,omitempty"`
	ProfileID           string                  `json:"profileId,omitempty"`
	PublishedIP         string                  `json:"publishedIp,omitempty"`
	RdpUserInjected     bool                    `json:"rdpUserInjected,omitempty"`
	Realm               string                  `json:"realm,omitempty"`
	SessionInfo         *GuestSessionInfo       `json:"sessionInfo,omitempty"`
	Stamp               interface{}             `json:"stamp,omitempty"`
	Standalone          bool                    `json:"standalone"`
	StateChronology     *StateChronology        `json:"stateChronology,omitempty"`
	Tags                []string                `json:"tags,omitempty"`
	TargetState         []string                `json:"targetState,omitempty"`
	TemplateName        string                  `json:"templateName,omitempty"`
	UserVolume          *UserVolume             `json:"userVolume,omitempty"`
	Username            string                  `json:"username"`
	UserSessionState    string                  `json:"userSessionState,omitempty"`
	UserSession         *UserSession            `json:"userSession,omitempty"`
	UUID                string                  `json:"uuid,omitempty"`
	BrokerOptions       *GuestBrokerOptions     `json:"brokerOptions,omitempty"`
}

Guest describes a guest record from the rest api

func (*Guest) Delete

func (guest *Guest) Delete(client *Client) error

Delete deletes a guest

func (*Guest) ListBackups

func (guest *Guest) ListBackups(client *Client, storageId string) ([]string, error)

StartBackup requests starting a backup immediately

func (*Guest) Migrate

func (guest *Guest) Migrate(client *Client, destinationHostid string) error

Migrate migrate a guest to a different host

func (*Guest) Poweroff

func (guest *Guest) Poweroff(client *Client) error

Poweroff forces a guest to powers off

func (*Guest) Poweron

func (guest *Guest) Poweron(client *Client) error

Poweron starts a powered off guest

func (*Guest) Reboot

func (guest *Guest) Reboot(client *Client) error

Reboot asks the guest operation system to reboot

func (*Guest) Refresh

func (guest *Guest) Refresh(client *Client) error

Refresh recreates the guest with the latest pool configuration

func (*Guest) Reset

func (guest *Guest) Reset(client *Client) error

Reset forces a guest to hard reset

func (*Guest) ResetRecord

func (guest *Guest) ResetRecord(client *Client) error

ResetRecord forces a guest record to be reset so it can be rebuilt

func (*Guest) Restore

func (guest *Guest) Restore(client *Client, storageId, backup string) (*Task, error)

Restore restores a guest from a backup

func (*Guest) Shutdown

func (guest *Guest) Shutdown(client *Client) error

Shutdown asks the guest operation system to shutdown

func (*Guest) StartBackup

func (guest *Guest) StartBackup(client *Client, storageId string) (*Task, error)

StartBackup requests starting a backup immediately

func (Guest) String

func (guest Guest) String() string

func (*Guest) Update

func (guest *Guest) Update(client *Client) (string, error)

Update a guest record

func (Guest) WaitForGuest

func (guest Guest) WaitForGuest(client *Client, timeout time.Duration) error

WaitForGuest waits for a guest state to match the targetState

func (Guest) WaitForGuestWithContext

func (guest Guest) WaitForGuestWithContext(ctx context.Context, client *Client, timeout time.Duration) error

WaitForGuestWithContext waits for a guest state to match the targetState

type GuestAgentMetadata

type GuestAgentMetadata struct {
	ActualVersion   string `json:"actualVersion"`
	ExpectedVersion string `json:"expectedVersion"`
	Installed       bool   `json:"installed"`
	State           string `json:"state"`
	UpdateStatus    string `json:"updateStatus"`
}

GuestAgentMetadata contains information fabout the hive agent on the guest

type GuestBackup

type GuestBackup struct {
	Enabled         bool        `json:"enabled"`
	State           string      `json:"state"`
	Frequency       string      `json:"frequency"`
	TargetStorageID string      `json:"targetStorageId"`
	LastBackup      interface{} `json:"lastBackup"`
	StateMessage    string      `json:"stateMessage"`
	DiskFrozen      bool        `json:"diskFrozen"`
}

GuestBackup is struct for backup data of VM

type GuestBrokerConnection

type GuestBrokerConnection struct {
	Name         string `json:"name,omitempty"`
	Description  string `json:"description,omitempty"`
	Port         uint   `json:"port,omitempty"`
	Protocol     string `json:"protocol,omitempty"`
	DisableHtml5 bool   `json:"disableHtml5"`
	Gateway      struct {
		Disabled   bool     `json:"disabled"`
		Protocols  []string `json:"prococols,omitempty"`
		Persistent bool     `json:"persistent"`
	} `json:"gateway"`
}

GuestBrokerConnection contains settings for a broker connection to a guest

type GuestBrokerOptions

type GuestBrokerOptions struct {
	DefaultConnection string                  `json:"defaultConnection,omitempty"`
	Connections       []GuestBrokerConnection `json:"connections,omitempty"`
}

GuestBrokerOptions allows configuring broker connection settings for a guest

type GuestDisk

type GuestDisk struct {
	Type         string `json:"type"`
	Path         string `json:"path"`
	DiskDriver   string `json:"diskDriver"`
	Format       string `json:"format"`
	Filename     string `json:"filename"`
	StorageID    string `json:"storageId"`
	Size         int    `json:"size"`
	Device       string `json:"dev"`
	Backing      string `json:"backing"`
	SerialNumber string `json:"serial"`
	OSVolume     int    `json:"osvolume"`
	BootOrder    int    `json:"bootOrder"`
	Cache        string `json:"cache"`
}

GuestDisk is the structure for GuestDisk object in db

type GuestError

type GuestError struct {
	Code    string `json:"code"`
	Message string `json:"message"`
}

GuestError is a struct for errors in the guest record

type GuestMigrationMetadata

type GuestMigrationMetadata struct {
	SourceHostId        string `json:"sourceHostId"`
	SourceHostname      string `json:"sourceHostname"`
	DestinationHostId   string `json:"destinationHostId"`
	DestinationHostname string `json:"destinationHostname"`
	Progress            int    `json:"progress"`
	MigratableXml       string `json:"migratableXml"`
}

type GuestNetwork

type GuestNetwork struct {
	Emulation   string `json:"emulation"`
	MacAddress  string `json:"macAddress"`
	NetworkType string `json:"network"`
	Vlan        int    `json:"vlan"`
	Bus         string `json:"bus"`
	IPAddress   string `json:"ipAddress"`
}

GuestNetwork is the structure for guest network interfaces

type GuestSessionInfo

type GuestSessionInfo struct {
	SessionID              int    `json:"sessionId"`
	SessionState           string `json:"sessionState"`
	SourceIP               string `json:"sourceIP"`
	SourceName             string `json:"sourceName"`
	SessionWorkstationName string `json:"sessionWorkstationName"`
	SessionResolution      string `json:"sessionResolution"`
}

GuestSessionInfo is struct for sessioninfo of user on VM

type GuestSnapshot

type GuestSnapshot struct {
	Name     string `json:"name"`
	Domain   string `json:"domain"`
	Current  string `json:"current"`
	State    string `json:"state"`
	Location string `json:"location"`
	Metadata string `json:"metadata"`
}

GuestSnapshot is contains snapshot information about the guest

type Host

type Host struct {
	Appliance struct {
		Broker           bool   `json:"broker"`
		ClusterID        string `json:"clusterId"`
		Cma              string `json:"cma"`
		CPUGovernor      string `json:"cpuGovernor"`
		CRS              bool   `json:"crs"`
		DbName           string `json:"dbName"`
		DoNotParticipate bool   `json:"doNotParticipate"`
		Firmware         struct {
			Active      string `json:"active"`
			Software    string `json:"software"`
			PendingSwap bool   `json:"pendingSwap"`
		} `json:"firmware"`
		Hostname        string `json:"hostname"`
		Loglevel        string `json:"loglevel"`
		MaxCloneDensity int    `json:"maxCloneDensity"`
		Ntp             string `json:"ntp"`
		Timezone        string `json:"timezone"`
		Role            string `json:"role"`
	} `json:"appliance"`
	Capabilities struct {
		StorageTypes []string `json:"storageTypes"`
	} `json:"capabilities"`
	Certificate struct {
		Expiration interface{} `json:"expiration"`
		Issuer     string      `json:"issuer"`
		Status     string      `json:"status"`
	} `json:"certificate"`
	Hardware struct {
		BIOS struct {
			ReleaseDate string `json:"releaseDate"`
			Vender      string `json:"vender"`
			Version     string `json:"version"`
		} `json:"BIOS"`
		Chasis struct {
			AssetTag     string `json:"assetTag"`
			Manufacturer string `json:"manufacturer"`
			Version      string `json:"version"`
		} `json:"Chasis"`
		HyperThreadingEnabled bool `json:"HyperThreadingEnabled"`
		PhysicalCPUs          int  `json:"PhysicalCPUs"`
		PhysicalCoresPerCPU   int  `json:"PhysicalCoresPerCPU"`
		Processor             []struct {
			Cores        int    `json:"cores"`
			Family       string `json:"family"`
			Manufacturer string `json:"manufacturer"`
			Threads      int    `json:"threads"`
			Version      string `json:"version"`
		} `json:"Processor"`
		System struct {
			Manufacturer string `json:"manufacturer"`
			ProductName  string `json:"productName"`
		} `json:"System"`
		TotalPhysicalMemory int `json:"TotalPhysicalMemory"`
		CPUFeatures         interface{}
		Memory              []struct {
			Size int    `json:"size"`
			Type string `json:"type"`
		} `json:"memory"`
		VideoCards []struct {
			Bus         int    `json:"bus"`
			DeviceClass int    `json:"deviceClass"`
			DeviceID    int    `json:"deviceId"`
			Domain      int    `json:"domain"`
			Func        int    `json:"func"`
			IommuGroup  int    `json:"iommu_group"`
			Mode        string `json:"mode"`
			Path        string `json:"path"`
			Slot        int    `json:"slot"`
			VendorID    int    `json:"vendorId"`
		} `json:"videoCards"`
	} `json:"hardware"`
	Hostid     string                 `json:"hostid"`
	Hostname   string                 `json:"hostname"`
	IP         string                 `json:"ip"`
	Networking map[string]interface{} `json:"networking"`
	RdbID      string                 `json:"rdbId"`
	Software   interface{}            `json:"software"`
	State      string                 `json:"state"`
	Storage    struct {
		Blockdevices []interface{}          `json:"blockdevices"`
		Disk         map[string]interface{} `json:"disk"`
		RAM          struct {
			RamdiskPercent int `json:"ramdiskPercent"`
			SwapSize       int `json:"swapSize"`
			Swappiness     int `json:"swappiness"`
			Zram           struct {
				Compression string `json:"compression"`
				Dedup       string `json:"dedup"`
				Filesystems struct {
					Users struct {
						Mountpoint string `json:"mountpoint"`
					} `json:"users"`
				} `json:"filesystems"`
				Mountpoint string `json:"mountpoint"`
			} `json:"zram"`
		} `json:"ram"`
	} `json:"storage"`
	Tags []string `json:"tags"`
}

Host describes a host record from the rest api

func (*Host) ChangeGatewayMode

func (host *Host) ChangeGatewayMode(client *Client, enable bool) error

ChangeGatewayMode enable or disable gateway mode on the host

func (*Host) Delete

func (host *Host) Delete(client *Client) error

Delete removes a host from the database

func (*Host) DeleteSoftware

func (host *Host) DeleteSoftware(client *Client, pkg string) error

DeleteSoftware deletes a software package from a host

func (*Host) DisableCRS

func (host *Host) DisableCRS(client *Client) error

DisableCRS disables crs on the host

func (*Host) EnableCRS

func (host *Host) EnableCRS(client *Client) error

EnableCRS enables crs on the host

func (Host) GetNetwork

func (host Host) GetNetwork(client *Client, name string) (HostNetwork, error)

GetNetwork retrieves settings for a host network

func (*Host) GetState

func (host *Host) GetState(client *Client) (string, error)

GetState gets the current state of the host

func (Host) ListNics

func (host Host) ListNics(client *Client) ([]HostNetworkInterface, error)

ListNics returns information about the network interfaces on a host

func (*Host) ListSoftware

func (host *Host) ListSoftware(client *Client) (HostPackageInfo, error)

ListSoftware returns the current software version and available packages

func (*Host) Reboot

func (host *Host) Reboot(client *Client) error

Reboot calls reboot on a host

func (Host) ResetNicSettings

func (host Host) ResetNicSettings(client *Client, nic string) error

UpdateNetworkInterface resets the settings for a nic

func (*Host) RestartNetworking

func (host *Host) RestartNetworking(client *Client) error

RestartNetworking calls restarts networking on the host

func (*Host) RestartServices

func (host *Host) RestartServices(client *Client) error

RestartServices calls restart hive services

func (Host) SetNetwork

func (host Host) SetNetwork(client *Client, net HostNetwork) error

SetNetwork adds or edits network settings for the host

func (*Host) SetState

func (host *Host) SetState(client *Client, state string) (*Task, error)

SetState can be used to set a host's state to available or maintenance

func (*Host) Shutdown

func (host *Host) Shutdown(client *Client) error

Shutdown calls shutdown on a host

func (Host) String

func (host Host) String() string

func (*Host) UnjoinCluster

func (host *Host) UnjoinCluster(client *Client) (*Task, error)

UnjoinCluster removes a host from the cluster

func (*Host) UpdateAppliance

func (host *Host) UpdateAppliance(client *Client) (string, error)

UpdateAppliance updates settings from Host.appliance

func (Host) UpdateNicSettings

func (host Host) UpdateNicSettings(client *Client, nic string, settings HostNetworkInterfaceSettings) error

UpdateNetworkInterface hardcodes settings for a nic

func (*Host) UploadSoftware

func (host *Host) UploadSoftware(client *Client, filename string) error

UploadSoftware uploads a firmware pkg file to the host

type HostDevice

type HostDevice struct {
	Type    string `json:"type"`
	Model   string `json:"model"`
	Managed bool   `json:"managed"`
	Domain  int    `json:"domain"`
	Bus     int    `json:"bus"`
	Slot    int    `json:"slot"`
	Func    int    `json:"func"`
	UUID    string `json:"uuid"`
}

HostDevice is information about a device forwarded to the guest from the host

type HostNetwork

type HostNetwork struct {
	Name      string `json:"-"`
	DHCP      bool   `json:"dhcp"`
	DNS       string `json:"dns"`
	Gw        string `json:"gw"`
	Interface string `json:"interface"`
	IP        string `json:"ip"`
	Mask      string `json:"mask"`
	Search    string `json:"search"`
	VLAN      int64  `json:"vlan"`
}

func (HostNetwork) MarshalJSON

func (net HostNetwork) MarshalJSON() ([]byte, error)

func (*HostNetwork) UnmarshalJSON

func (net *HostNetwork) UnmarshalJSON(b []byte) error

type HostNetworkInterface

type HostNetworkInterface struct {
	Name      string `json:"name"`
	Address   string `json:"address"`
	Speed     int64  `json:"speed"`
	Carrier   int64  `json:"carrier"`
	Duplex    string `json:"duplex"`
	MTU       int64  `json:"mtu"`
	LinkModes []struct {
		Speed  string `json:"speed"`
		Duplex string `json:"duplex"`
	} `json:"linkModes"`
	Autoneg   bool   `json:"autoneg"`
	Link      bool   `json:"link"`
	PortTypes string `json:"portTypes"`
	Driver    string `json:"driver"`
}

type HostNetworkInterfaceSettings

type HostNetworkInterfaceSettings struct {
	Speed  int64  `json:"speed"`
	Duplex string `json:"duplex"`
	MTU    int64  `json:"mtu,omitempty"`
}

type HostPackageInfo

type HostPackageInfo struct {
	Packages []string `json:"packages"`
	Current  string   `json:"current"`
}

HostPackageInfo contains information about software and firmware packages

type Pool

type Pool struct {
	ID                        string            `json:"id,omitempty"`
	Density                   []int             `json:"density"`
	Description               string            `json:"description,omitempty"`
	GuestProfile              *PoolGuestProfile `json:"guestProfile,omitempty"`
	InjectAgent               bool              `json:"injectAgent"`
	Name                      string            `json:"name"`
	PerformanceThreshold      int               `json:"performanceThreshold,omitempty"`
	ProfileID                 string            `json:"profileId,omitempty"`
	Seed                      string            `json:"seed,omitempty"`
	State                     string            `json:"state,omitempty"`
	StorageID                 string            `json:"storageId,omitempty"`
	StorageType               string            `json:"storageType,omitempty"`
	Tags                      []string          `json:"tags,omitempty"`
	TargetState               []string          `json:"targetState,omitempty"`
	Type                      string            `json:"type"`
	UserSessionLoginThreshold int               `json:"userSessionLoginThreshold,omitempty"`
	Backup                    *PoolBackup       `json:"backup,omitempty"`
	PoolAffinity              *PoolAffinity     `json:"poolAffinity"`
	Assignment                *PoolAssignment   `json:"assignment,omitempty"`
}

Pool describes a guest pool record from the rest api

func (*Pool) Assign

func (pool *Pool) Assign(client *Client, realm, username, group string) error

Assign adds a user or group assignment for a standalone pool

func (*Pool) Create

func (pool *Pool) Create(client *Client) (string, error)

Create creates a new pool

func (*Pool) Delete

func (pool *Pool) Delete(client *Client) error

Delete removes a pool record

func (*Pool) DeleteAssignment

func (pool *Pool) DeleteAssignment(client *Client) error

DeleteAssignment removes the assignment for a standalone pool

func (*Pool) Merge

func (pool *Pool) Merge(client *Client) error

Merge commits the guest snapshots back into their disk

func (*Pool) Refresh

func (pool *Pool) Refresh(client *Client) error

Refresh refreshes a pool to ensure the definition is applied

func (*Pool) Snapshot

func (pool *Pool) Snapshot(client *Client) error

Snapshot stores pool state and creates disk snapshots for running guests

func (Pool) String

func (pool Pool) String() string

func (*Pool) Update

func (pool *Pool) Update(client *Client) (string, error)

Update updates an existing pool record

func (Pool) WaitForPool

func (pool Pool) WaitForPool(client *Client, targetState string, timeout time.Duration) error

WaitForPool waits for a pool to reach the desired state

func (Pool) WaitForPoolWithContext

func (pool Pool) WaitForPoolWithContext(ctx context.Context, client *Client, targetState string, timeout time.Duration) error

WaitForPoolWithContext waits for a pool to reach the desired state with a context

type PoolAffinity

type PoolAffinity struct {
	CustomCPUFeatures  string   `json:"customCpuFeatures,omitempty"`
	UseHostPassthrough bool     `json:"useHostPassthrough"`
	AllowedHostIDs     []string `json:"allowedHostIds,omitempty"`
}

PoolAffinity host affinity settings for the pool

type PoolAssignment

type PoolAssignment struct {
	Realm     string                   `json:"realm,omitempty"`
	Username  string                   `json:"username,omitempty"`
	ADGroup   string                   `json:"ADGroup,omitempty"`
	AutoClear *PoolAssignmentAutoClear `json:"autoClear,omitempty"`
}

type PoolAssignmentAutoClear

type PoolAssignmentAutoClear struct {
	Enabled bool `json:"enabled,omitempty"`
	MaxTime int  `json:"maxTime,omitempty"`
}

type PoolBackup

type PoolBackup struct {
	Enabled         bool   `json:"enabled"`
	Frequency       string `json:"frequency"`
	TargetStorageID string `json:"targetStorageId"`
}

PoolBackup data protection settings from a pool record

type PoolCloudInit

type PoolCloudInit struct {
	Enabled       bool   `json:"enabled"`
	UserData      string `json:"userData,omitempty"`
	NetworkConfig string `json:"networkConfig,omitempty"`
}

PoolCloudInit cloud-init settings for a pool record

type PoolDisk

type PoolDisk struct {
	BootOrder  int    `json:"bootOrder,omitempty"`
	DiskDriver string `json:"diskDriver,omitempty"`
	Filename   string `json:"filename,omitempty"`
	StorageID  string `json:"storageId,omitempty"`
	Type       string `json:"type,omitempty"`
}

PoolDisk disk structure for a pool record

type PoolGuestProfile

type PoolGuestProfile struct {
	AgentInstalled bool               `json:"agentInstalled"`
	CPU            []int              `json:"cpu,omitempty"`
	Debug          bool               `json:"debug,omitempty"`
	Disks          []*PoolDisk        `json:"disks,omitempty"`
	Firmware       string             `json:"firmware,omitempty"`
	Gpu            bool               `json:"gpu"`
	HostDevices    []*PoolHostDevice  `json:"hostDevices,omitempty"`
	Interfaces     []*PoolInterface   `json:"interfaces,omitempty"`
	Mem            []int              `json:"mem,omitempty"`
	OS             string             `json:"os,omitempty"`
	Persistent     bool               `json:"persistent"`
	Protocol       string             `json:"protocol,omitempty"`
	TemplateName   string             `json:"templateName,omitempty"`
	Vga            string             `json:"vga,omitempty"`
	CloudInit      *PoolCloudInit     `json:"cloudInit,omitempty"`
	BrokerOptions  GuestBrokerOptions `json:"brokerOptions,omitempty"`
}

PoolGuestProfile guestProfile section of a pool record

type PoolHostDevice

type PoolHostDevice struct {
	Bus     int    `json:"bus"`
	Domain  int    `json:"domain"`
	Func    int    `json:"func"`
	Managed bool   `json:"managed"`
	Slot    int    `json:"slot"`
	Type    string `json:"type"`
	UUID    string `json:"uuid,omitempty"`
}

PoolHostDevice a hostdevice to share with a virtual machine

type PoolInterface

type PoolInterface struct {
	Emulation  string      `json:"emulation,omitempty"`
	Network    string      `json:"network,omitempty"`
	Vlan       interface{} `json:"vlan,omitempty"`
	IPAddress  string      `json:"ipAddress"`
	MacAddress string      `json:"macAddress,omitempty"`
}

PoolInterface network interface settings for a pool

type Profile

type Profile struct {
	AdConfig      *ProfileADConfig      `json:"adConfig,omitempty"`
	BrokerOptions *ProfileBrokerOptions `json:"brokerOptions,omitempty"`
	BypassBroker  bool                  `json:"bypassBroker"`
	ID            string                `json:"id,omitempty"`
	Name          string                `json:"name"`
	Tags          []string              `json:"tags,omitempty"`
	Timezone      string                `json:"timezone,omitempty"`
	UserVolumes   *ProfileUserVolumes   `json:"userVolumes,omitempty"`
	Vlan          int                   `json:"vlan,omitempty"`
	Backup        *ProfileBackup        `json:"backup,omitempty"`
}

Profile is a profile record from the rest api

func (*Profile) Create

func (profile *Profile) Create(client *Client) (string, error)

Create creates a new profile

func (*Profile) Delete

func (profile *Profile) Delete(client *Client) error

Delete deletes a profile

func (Profile) String

func (profile Profile) String() string

func (*Profile) Update

func (profile *Profile) Update(client *Client) (string, error)

Update updates an existing profile

type ProfileADConfig

type ProfileADConfig struct {
	Domain    string `json:"domain,omitempty"`
	Ou        string `json:"ou,omitempty"`
	Password  string `json:"password,omitempty"`
	UserGroup string `json:"userGroup,omitempty"`
	Username  string `json:"username,omitempty"`
}

ProfileADConfig contains the active directory settings for a profile

type ProfileBackup

type ProfileBackup struct {
	Enabled         bool        `json:"enabled"`
	Frequency       string      `json:"frequency"`
	TargetStorageID string      `json:"targetStorageId"`
	UserVolumeList  []string    `json:"userVolumeList,omitempty"`
	LastBackup      interface{} `json:"lastBackup,omitempty"`
}

ProfileBackup contains data protection settings for a profile

type ProfileBrokerOptions

type ProfileBrokerOptions struct {
	AllowDesktopComposition   bool `json:"allowDesktopComposition"`
	AudioCapture              bool `json:"audioCapture"`
	DisableFullWindowDrag     bool `json:"disableFullWindowDrag"`
	DisableMenuAnims          bool `json:"disableMenuAnims"`
	DisablePrinter            bool `json:"disablePrinter"`
	DisableThemes             bool `json:"disableThemes"`
	DisableWallpaper          bool `json:"disableWallpaper"`
	HideAuthenticationFailure bool `json:"hideAuthenticationFailure"`
	InjectPassword            bool `json:"injectPassword"`
	RedirectCSSP              bool `json:"redirectCSSP"`
	RedirectClipboard         bool `json:"redirectClipboard"`
	RedirectDisk              bool `json:"redirectDisk"`
	RedirectPNP               bool `json:"redirectPNP"`
	RedirectPrinter           bool `json:"redirectPrinter"`
	RedirectSmartCard         bool `json:"redirectSmartCard"`
	RedirectUSB               bool `json:"redirectUSB"`
	SmartResize               bool `json:"smartResize"`
	FailOnCertMismatch        bool `json:"failOnCertMismatch"`
	EnableHTML5               bool `json:"enableHtml5"`
}

ProfileBrokerOptions contains rdp settings for a profile

type ProfileUserVolumes

type ProfileUserVolumes struct {
	BackupSchedule int    `json:"backupSchedule,omitempty"`
	Repository     string `json:"repository,omitempty"`
	Size           int    `json:"size,omitempty"`
	Target         string `json:"target,omitempty"`
}

ProfileUserVolumes contains user volume settings for a profile

type Realm

type Realm struct {
	Alias          string               `json:"alias,omitempty"`
	Enabled        bool                 `json:"enabled"`
	ForceTLS       bool                 `json:"forceTls"`
	FQDN           string               `json:"fqdn"`
	Name           string               `json:"name"`
	Site           string               `json:"site,omitempty"`
	Tags           []string             `json:"tags,omitempty"`
	Verified       bool                 `json:"verified"`
	ServiceAccount *RealmServiceAccount `json:"serviceAccount,omitempty"`
}

Realm describes a realm from the rest api

func (*Realm) Create

func (realm *Realm) Create(client *Client) (string, error)

Create creates a new realm

func (*Realm) Delete

func (realm *Realm) Delete(client *Client) error

Delete deletes a realm

func (Realm) String

func (realm Realm) String() string

func (*Realm) Update

func (realm *Realm) Update(client *Client) (string, error)

Update updates an existing realm

type RealmServiceAccount

type RealmServiceAccount struct {
	Username string `json:"username"`
	Password string `json:"password"`
}

RealmServiceAccount contains an active directory service account for the realm

type StateChronology

type StateChronology struct {
	Current string `json:"current"`
	Next    string `json:"next"`
	Target  string `json:"target"`
}

StateChronology state tracking for the guest

type StoragePool

type StoragePool struct {
	ID                string   `json:"id,omitempty"`
	Name              string   `json:"name"`
	Type              string   `json:"type"`
	Server            string   `json:"server,omitempty"`
	Path              string   `json:"path,omitempty"`
	URL               string   `json:"url,omitempty"`
	Username          string   `json:"username,omitempty"`
	Password          string   `json:"password,omitempty"`
	Key               string   `json:"key,omitempty"`
	MountOptions      []string `json:"mountOptions,omitempty"`
	Roles             []string `json:"roles,omitempty"`
	Tags              []string `json:"tags,omitempty"`
	S3AccessKeyID     string   `json:"s3AccessKeyId,omitempty"`
	S3SecretAccessKey string   `json:"s3SecretAccessKey,omitempty"`
	S3Region          string   `json:"s3Region,omitempty"`
	S3Provider        string   `json:"s3Provider,omitempty"`
	S3Endpoint        string   `json:"s3Endpoint,omitempty"`
	Disabled          bool     `json:"disabled"`
	Replicated        bool     `json:"replicated,omitempty"`
}

StoragePool describes a storage pool returned from the rest api

func (*StoragePool) Browse

func (pool *StoragePool) Browse(client *Client, filePath string, recursive bool) ([]StoragePoolFileInfo, error)

Browse returns a list of files from a storage pool

func (*StoragePool) ConvertDisk

func (pool *StoragePool) ConvertDisk(client *Client, srcFilename, dstStorageID, dstFilename, dstFormat string) (*Task, error)

ConvertDisk converts or copies a disk to a new file

func (*StoragePool) CopyURL

func (pool *StoragePool) CopyURL(client *Client, url, filePath string) (*Task, error)

CopyURL downloads a file from a http url into a storage pool

func (*StoragePool) Create

func (pool *StoragePool) Create(client *Client) (string, error)

Create creates a new storage pool

func (*StoragePool) CreateDisk

func (pool *StoragePool) CreateDisk(client *Client, filename, format string, size uint) (*Task, error)

CreateDisk creates a new disk in the storage pool

func (*StoragePool) Delete

func (pool *StoragePool) Delete(client *Client) error

Delete deletes a storage pool

func (*StoragePool) DeleteFile

func (pool *StoragePool) DeleteFile(client *Client, filename string) error

DeleteFile deletes a file from a storage pool

func (*StoragePool) DiskInfo

func (pool *StoragePool) DiskInfo(client *Client, filePath string) (DiskInfo, error)

DiskInfo retrieves information about a disk in the storage pool

func (*StoragePool) Download

func (pool *StoragePool) Download(client *Client, filePath string) (*http.Response, error)

Download downloads a file from a storage pool

func (*StoragePool) DownloadWithContext

func (pool *StoragePool) DownloadWithContext(ctx context.Context, client *Client, filePath string) (*http.Response, error)

DownloadWithContext downloads a file from a storage pool with a custom context

func (*StoragePool) GrowDisk

func (pool *StoragePool) GrowDisk(client *Client, filePath string, size uint) (*Task, error)

GrowDisk increases the size of a disk in a storage pool by size GB

func (*StoragePool) Start

func (pool *StoragePool) Start(client *Client) error

Start re-enables a stopped storage pool

func (*StoragePool) Stop

func (pool *StoragePool) Stop(client *Client) error

Stop disables a storage pool

func (StoragePool) String

func (pool StoragePool) String() string

func (*StoragePool) Upload

func (pool *StoragePool) Upload(client *Client, filename, targetFilename string) error

Upload uploads a local file into a storage pool

type StoragePoolFileInfo

type StoragePoolFileInfo struct {
	Path     string `json:"Path"`
	Name     string `json:"Name"`
	Size     int    `json:"Size"`
	MimeType string `json:"MimeType"`
	ModTime  string `json:"ModTime"`
	IsDir    bool   `json:"IsDir"`
}

StoragePoolFileInfo contains information about the files returned by Browse

type Task

type Task struct {
	Cancellable     bool      `json:"cancellable"`
	Description     string    `json:"description"`
	FinishedTime    time.Time `json:"finishedTime"`
	ID              string    `json:"id"`
	LastUpdatedTime time.Time `json:"lastUpdatedTime"`
	Message         string    `json:"message"`
	Name            string    `json:"name"`
	Progress        float32   `json:"progress"`
	QueueTime       int       `json:"queueTime"`
	Ref             struct {
		Cluster string `json:"cluster"`
		Host    string `json:"host"`
	} `json:"ref"`
	StartTime time.Time `json:"startTime"`
	State     string    `json:"state"`
	Tags      []string  `json:"tags"`
	Type      string    `json:"type"`
	Username  string    `json:"username"`
}

Task describes a task record from the rest api

func (*Task) ForceComplete

func (task *Task) ForceComplete(client *Client) error

ForceComplete marks a task as completed in the database

func (Task) String

func (task Task) String() string

func (Task) WaitForTask

func (task Task) WaitForTask(client *Client, printProgress bool) (*Task, error)

WaitForTask blocks until a task is complete and returns the task

func (Task) WaitForTaskWithContext

func (task Task) WaitForTaskWithContext(ctx context.Context, client *Client, printProgress bool) (*Task, error)

WaitForTask blocks until a task is complete and returns the task

func (Task) WatchTask

func (task Task) WatchTask(client *Client, taskData chan Task, errorChannel chan error)

WatchTask monitors a task changefeed and sends updates to taskData

func (Task) WatchTaskWithContext

func (task Task) WatchTaskWithContext(ctx context.Context, client *Client, taskData chan Task, errorChannel chan error)

WatchTaskWithContext monitors a task changefeed and sends updates to taskData

type Template

type Template struct {
	Name               string                 `json:"name"`
	Vcpu               int                    `json:"vcpu"`
	Mem                int                    `json:"mem"`
	OS                 string                 `json:"os"`
	Firmware           string                 `json:"firmware,omitempty"`
	Gpu                bool                   `json:"gpu,omitempty"`
	DisplayDriver      string                 `json:"displayDriver,omitempty"`
	Interfaces         []*TemplateInterface   `json:"interfaces,omitempty"`
	Drivers            bool                   `json:"drivers"`
	Disks              []*TemplateDisk        `json:"disks,omitempty"`
	State              string                 `json:"state,omitempty"`
	StateMessage       string                 `json:"stateMessage,omitempty"`
	ManualAgentInstall bool                   `json:"manualAgentInstall"`
	TemplateMap        map[string]interface{} `json:"templateMap,omitempty"`
	BrokerOptions      GuestBrokerOptions     `json:"brokerOptions,omitempty"`
}

Template a template record from the rest interface

func (*Template) Analyze

func (template *Template) Analyze(client *Client) error

Analyze validates a template

func (*Template) Author

func (template *Template) Author(client *Client) error

Author creates a virtual machine to author a template

func (*Template) Create

func (template *Template) Create(client *Client) (string, error)

Create creates a new template

func (*Template) Delete

func (template *Template) Delete(client *Client) error

Delete deletes a template record

func (*Template) Duplicate

func (template *Template) Duplicate(client *Client, dstName, dstStorage, dstFilename string) (*Task, error)

Duplicate copies a template

func (*Template) Load

func (template *Template) Load(client *Client, storage string) error

Load stages a template to storage across the cluster stoarge can be "disk" or "ram"

func (Template) String

func (template Template) String() string

func (*Template) Unload

func (template *Template) Unload(client *Client) error

Unload removes a staged template from local storage across the cluster

func (*Template) Update

func (template *Template) Update(client *Client) (string, error)

Update updates an existing template

type TemplateDisk

type TemplateDisk struct {
	DiskDriver string `json:"diskDriver"`
	Filename   string `json:"filename"`
	Format     string `json:"format,omitempty"`
	Path       string `json:"path,omitempty"` //TODO: Is this actually used?
	Size       int    `json:"size"`
	StorageID  string `json:"storageId"`
	Type       string `json:"type"`
	OsVolume   int    `json:"osvolume"`
}

TemplateDisk a disk from a template record

type TemplateInterface

type TemplateInterface struct {
	Network   string `json:"network"`
	Vlan      int    `json:"vlan"`
	Emulation string `json:"emulation"`
}

TemplateInterface a network interface from a template record

type User

type User struct {
	ID          string           `json:"id,omitempty"`
	GroupName   string           `json:"groupName,omitempty"`
	Password    string           `json:"password,omitempty"`
	Preferences *UserPreferences `json:"preferences,omitempty"`
	Realm       string           `json:"realm,omitempty"`
	Role        string           `json:"role,omitempty"`
	Tags        []string         `json:"tags,omitempty"`
	Username    string           `json:"username,omitempty"`
}

User describes a user record

func (*User) Create

func (user *User) Create(client *Client) (string, error)

Create creates a new user

func (*User) Delete

func (user *User) Delete(client *Client) error

Delete deletes a user

func (User) String

func (user User) String() string

func (*User) Update

func (user *User) Update(client *Client) (string, error)

Update updates an existing user

type UserPreferences

type UserPreferences struct {
	UiTimeout float64 `json:"uiTimeout,omitempty"`
}

UserPreferences

type UserSession

type UserSession struct {
	UserSessionState  string      `json:"userSessionState"`
	LastUserLoginTime interface{} `json:"lastUserLoginTime"`
	LastLoginDuration int         `json:"lastLoginDuration"`
	DisconnectTime    interface{} `json:"disconnectTime"`
}

UserSession contains user session information for a guest

type UserVolume

type UserVolume struct {
	State                 string      `json:"state,omitempty"`
	LastReplication       interface{} `json:"lastReplication,omitempty"`
	RepliacationRequested interface{} `json:"replicationRequested,omitempty"`
	Source                string      `json:"source,omitempty"`
	Target                string      `json:"target,omitempty"`
	RunningBackup         bool        `json:"runningBackup,omitempty"`
	StateMessage          interface{} `json:"stateMessage,omitempty"`
	DiskFrozen            bool        `json:"diskFrozen,omitempty"`
	BackupSchedule        int         `json:"backupSchedule,omitempty"`
}

UserVolume is the struct for uservolume on guest record

type Version

type Version struct {
	Major   uint   `json:"major"`
	Minor   uint   `json:"minor"`
	Patch   uint   `json:"patch"`
	Version string `json:"version"`
}

Version is a structure containing version information returned by HostVersion

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL