Documentation
¶
Index ¶
- Constants
- type Client
- func (c *Client) Index(ctx context.Context, req IndexRequest) ([]IndexResponse, error)
- func (c *Client) VmReboot(ctx context.Context, req VmRebootRequest) (string, error)
- func (c *Client) VmReset(ctx context.Context, req VmResetRequest) (string, error)
- func (c *Client) VmResume(ctx context.Context, req VmResumeRequest) (string, error)
- func (c *Client) VmShutdown(ctx context.Context, req VmShutdownRequest) (string, error)
- func (c *Client) VmStart(ctx context.Context, req VmStartRequest) (string, error)
- func (c *Client) VmStatusCurrent(ctx context.Context, req VmStatusCurrentRequest) (VmStatusCurrentResponse, error)
- func (c *Client) VmStop(ctx context.Context, req VmStopRequest) (string, error)
- func (c *Client) VmSuspend(ctx context.Context, req VmSuspendRequest) (string, error)
- type HTTPClient
- type IndexRequest
- type IndexResponse
- type MigrationType
- type Status
- type VmRebootRequest
- type VmResetRequest
- type VmResumeRequest
- type VmShutdownRequest
- type VmStartRequest
- type VmStatusCurrentRequest
- type VmStatusCurrentResponse
- type VmStopRequest
- type VmSuspendRequest
Constants ¶
View Source
const ( MigrationType_SECURE MigrationType = "secure" MigrationType_INSECURE MigrationType = "insecure" Status_STOPPED Status = "stopped" Status_RUNNING Status = "running" )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
func New ¶
func New(c HTTPClient) *Client
func (*Client) Index ¶
func (c *Client) Index(ctx context.Context, req IndexRequest) ([]IndexResponse, error)
Index Directory index
func (*Client) VmReboot ¶
VmReboot Reboot the VM by shutting it down, and starting it again. Applies pending changes.
func (*Client) VmShutdown ¶
VmShutdown Shutdown virtual machine. This is similar to pressing the power button on a physical machine.This will send an ACPI event for the guest OS, which should then proceed to a clean shutdown.
func (*Client) VmStatusCurrent ¶
func (c *Client) VmStatusCurrent(ctx context.Context, req VmStatusCurrentRequest) (VmStatusCurrentResponse, error)
VmStatusCurrent Get virtual machine status.
type HTTPClient ¶
type IndexRequest ¶
type IndexResponse ¶
type IndexResponse struct {
Subdir string `url:"subdir" json:"subdir"`
}
type MigrationType ¶ added in v0.0.15
type MigrationType string
func PtrMigrationType ¶ added in v0.0.15
func PtrMigrationType(i MigrationType) *MigrationType
type VmRebootRequest ¶
type VmRebootRequest struct {
Node string `url:"node" json:"node"` // The cluster node name.
Vmid int `url:"vmid" json:"vmid"` // The (unique) ID of the VM.
// The following parameters are optional
Timeout *int `url:"timeout,omitempty" json:"timeout,omitempty"` // Wait maximal timeout seconds for the shutdown.
}
type VmResetRequest ¶
type VmResetRequest struct {
Node string `url:"node" json:"node"` // The cluster node name.
Vmid int `url:"vmid" json:"vmid"` // The (unique) ID of the VM.
// The following parameters are optional
Skiplock *util.PVEBool `url:"skiplock,omitempty" json:"skiplock,omitempty"` // Ignore locks - only root is allowed to use this option.
}
type VmResumeRequest ¶
type VmResumeRequest struct {
Node string `url:"node" json:"node"` // The cluster node name.
Vmid int `url:"vmid" json:"vmid"` // The (unique) ID of the VM.
// The following parameters are optional
Nocheck *util.PVEBool `url:"nocheck,omitempty" json:"nocheck,omitempty"`
Skiplock *util.PVEBool `url:"skiplock,omitempty" json:"skiplock,omitempty"` // Ignore locks - only root is allowed to use this option.
}
type VmShutdownRequest ¶
type VmShutdownRequest struct {
Node string `url:"node" json:"node"` // The cluster node name.
Vmid int `url:"vmid" json:"vmid"` // The (unique) ID of the VM.
// The following parameters are optional
Forcestop *util.PVEBool `url:"forceStop,omitempty" json:"forceStop,omitempty"` // Make sure the VM stops.
Keepactive *util.PVEBool `url:"keepActive,omitempty" json:"keepActive,omitempty"` // Do not deactivate storage volumes.
Skiplock *util.PVEBool `url:"skiplock,omitempty" json:"skiplock,omitempty"` // Ignore locks - only root is allowed to use this option.
Timeout *int `url:"timeout,omitempty" json:"timeout,omitempty"` // Wait maximal timeout seconds.
}
type VmStartRequest ¶
type VmStartRequest struct {
Node string `url:"node" json:"node"` // The cluster node name.
Vmid int `url:"vmid" json:"vmid"` // The (unique) ID of the VM.
// The following parameters are optional
ForceCpu *string `url:"force-cpu,omitempty" json:"force-cpu,omitempty"` // Override QEMU's -cpu argument with the given string.
Machine *string `url:"machine,omitempty" json:"machine,omitempty"` // Specifies the QEMU machine type.
Migratedfrom *string `url:"migratedfrom,omitempty" json:"migratedfrom,omitempty"` // The cluster node name.
MigrationNetwork *string `url:"migration_network,omitempty" json:"migration_network,omitempty"` // CIDR of the (sub) network that is used for migration.
MigrationType *MigrationType `url:"migration_type,omitempty" json:"migration_type,omitempty"` // Migration traffic is encrypted using an SSH tunnel by default. On secure, completely private networks this can be disabled to increase performance.
Skiplock *util.PVEBool `url:"skiplock,omitempty" json:"skiplock,omitempty"` // Ignore locks - only root is allowed to use this option.
Stateuri *string `url:"stateuri,omitempty" json:"stateuri,omitempty"` // Some command save/restore state from this location.
Targetstorage *string `url:"targetstorage,omitempty" json:"targetstorage,omitempty"` // Mapping from source to target storages. Providing only a single storage ID maps all source storages to that storage. Providing the special value '1' will map each source storage to itself.
Timeout *int `url:"timeout,omitempty" json:"timeout,omitempty"` // Wait maximal timeout seconds.
}
type VmStatusCurrentRequest ¶
type VmStatusCurrentResponse ¶
type VmStatusCurrentResponse struct {
Ha map[string]interface{} `url:"ha" json:"ha"` // HA manager service status.
Status Status `url:"status" json:"status"` // QEMU process status.
Vmid int `url:"vmid" json:"vmid"` // The (unique) ID of the VM.
// The following parameters are optional
Agent *util.PVEBool `url:"agent,omitempty" json:"agent,omitempty"` // QEMU Guest Agent is enabled in config.
Cpus *float64 `url:"cpus,omitempty" json:"cpus,omitempty"` // Maximum usable CPUs.
Lock *string `url:"lock,omitempty" json:"lock,omitempty"` // The current config lock, if any.
Maxdisk *int `url:"maxdisk,omitempty" json:"maxdisk,omitempty"` // Root disk size in bytes.
Maxmem *int `url:"maxmem,omitempty" json:"maxmem,omitempty"` // Maximum memory in bytes.
Name *string `url:"name,omitempty" json:"name,omitempty"` // VM name.
Pid *int `url:"pid,omitempty" json:"pid,omitempty"` // PID of running qemu process.
Qmpstatus *string `url:"qmpstatus,omitempty" json:"qmpstatus,omitempty"` // QEMU QMP agent status.
RunningMachine *string `url:"running-machine,omitempty" json:"running-machine,omitempty"` // The currently running machine type (if running).
RunningQemu *string `url:"running-qemu,omitempty" json:"running-qemu,omitempty"` // The currently running QEMU version (if running).
Spice *util.PVEBool `url:"spice,omitempty" json:"spice,omitempty"` // QEMU VGA configuration supports spice.
Tags *string `url:"tags,omitempty" json:"tags,omitempty"` // The current configured tags, if any
Uptime *int `url:"uptime,omitempty" json:"uptime,omitempty"` // Uptime.
}
type VmStopRequest ¶
type VmStopRequest struct {
Node string `url:"node" json:"node"` // The cluster node name.
Vmid int `url:"vmid" json:"vmid"` // The (unique) ID of the VM.
// The following parameters are optional
Keepactive *util.PVEBool `url:"keepActive,omitempty" json:"keepActive,omitempty"` // Do not deactivate storage volumes.
Migratedfrom *string `url:"migratedfrom,omitempty" json:"migratedfrom,omitempty"` // The cluster node name.
Skiplock *util.PVEBool `url:"skiplock,omitempty" json:"skiplock,omitempty"` // Ignore locks - only root is allowed to use this option.
Timeout *int `url:"timeout,omitempty" json:"timeout,omitempty"` // Wait maximal timeout seconds.
}
type VmSuspendRequest ¶
type VmSuspendRequest struct {
Node string `url:"node" json:"node"` // The cluster node name.
Vmid int `url:"vmid" json:"vmid"` // The (unique) ID of the VM.
// The following parameters are optional
Skiplock *util.PVEBool `url:"skiplock,omitempty" json:"skiplock,omitempty"` // Ignore locks - only root is allowed to use this option.
Statestorage *string `url:"statestorage,omitempty" json:"statestorage,omitempty"` // The storage for the VM state
Todisk *util.PVEBool `url:"todisk,omitempty" json:"todisk,omitempty"` // If set, suspends the VM to disk. Will be resumed on next VM start.
}
Click to show internal directories.
Click to hide internal directories.