agent

package
v0.0.4 Latest Latest
Warning

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

Go to latest
Published: Jan 15, 2023 License: MIT Imports: 1 Imported by: 0

Documentation

Index

Constants

This section is empty.

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) Create

func (c *Client) Create(ctx context.Context, req *CreateRequest) (*CreateResponse, error)

Create Execute Qemu Guest Agent commands.

func (*Client) Exec

func (c *Client) Exec(ctx context.Context, req *ExecRequest) (*ExecResponse, error)

Exec Executes the given command in the vm via the guest-agent and returns an object with the pid.

func (*Client) ExecStatus

func (c *Client) ExecStatus(ctx context.Context, req *ExecStatusRequest) (*ExecStatusResponse, error)

ExecStatus Gets the status of the given pid started by the guest-agent

func (*Client) FileRead

func (c *Client) FileRead(ctx context.Context, req *FileReadRequest) (*FileReadResponse, error)

FileRead Reads the given file via guest agent. Is limited to 16777216 bytes.

func (*Client) FileWrite

func (c *Client) FileWrite(ctx context.Context, req *FileWriteRequest) (*FileWriteResponse, error)

FileWrite Writes the given file via guest agent.

func (*Client) FsfreezeFreeze

func (c *Client) FsfreezeFreeze(ctx context.Context, req *FsfreezeFreezeRequest) (*FsfreezeFreezeResponse, error)

FsfreezeFreeze Execute fsfreeze-freeze.

func (*Client) FsfreezeStatus

func (c *Client) FsfreezeStatus(ctx context.Context, req *FsfreezeStatusRequest) (*FsfreezeStatusResponse, error)

FsfreezeStatus Execute fsfreeze-status.

func (*Client) FsfreezeThaw

func (c *Client) FsfreezeThaw(ctx context.Context, req *FsfreezeThawRequest) (*FsfreezeThawResponse, error)

FsfreezeThaw Execute fsfreeze-thaw.

func (*Client) Fstrim

func (c *Client) Fstrim(ctx context.Context, req *FstrimRequest) (*FstrimResponse, error)

Fstrim Execute fstrim.

func (*Client) GetFsinfo

func (c *Client) GetFsinfo(ctx context.Context, req *GetFsinfoRequest) (*GetFsinfoResponse, error)

GetFsinfo Execute get-fsinfo.

func (*Client) GetHostName

func (c *Client) GetHostName(ctx context.Context, req *GetHostNameRequest) (*GetHostNameResponse, error)

GetHostName Execute get-host-name.

func (*Client) GetMemoryBlockInfo

func (c *Client) GetMemoryBlockInfo(ctx context.Context, req *GetMemoryBlockInfoRequest) (*GetMemoryBlockInfoResponse, error)

GetMemoryBlockInfo Execute get-memory-block-info.

func (*Client) GetMemoryBlocks

func (c *Client) GetMemoryBlocks(ctx context.Context, req *GetMemoryBlocksRequest) (*GetMemoryBlocksResponse, error)

GetMemoryBlocks Execute get-memory-blocks.

func (*Client) GetOsinfo

func (c *Client) GetOsinfo(ctx context.Context, req *GetOsinfoRequest) (*GetOsinfoResponse, error)

GetOsinfo Execute get-osinfo.

func (*Client) GetTime

func (c *Client) GetTime(ctx context.Context, req *GetTimeRequest) (*GetTimeResponse, error)

GetTime Execute get-time.

func (*Client) GetTimezone

func (c *Client) GetTimezone(ctx context.Context, req *GetTimezoneRequest) (*GetTimezoneResponse, error)

GetTimezone Execute get-timezone.

func (*Client) GetUsers

func (c *Client) GetUsers(ctx context.Context, req *GetUsersRequest) (*GetUsersResponse, error)

GetUsers Execute get-users.

func (*Client) GetVcpus

func (c *Client) GetVcpus(ctx context.Context, req *GetVcpusRequest) (*GetVcpusResponse, error)

GetVcpus Execute get-vcpus.

func (*Client) Index

func (c *Client) Index(ctx context.Context, req *IndexRequest) (*IndexResponse, error)

Index Qemu Agent command index.

func (*Client) Info

func (c *Client) Info(ctx context.Context, req *InfoRequest) (*InfoResponse, error)

Info Execute info.

func (*Client) NetworkGetInterfaces

NetworkGetInterfaces Execute network-get-interfaces.

func (*Client) Ping

func (c *Client) Ping(ctx context.Context, req *PingRequest) (*PingResponse, error)

Ping Execute ping.

func (*Client) SetUserPassword

func (c *Client) SetUserPassword(ctx context.Context, req *SetUserPasswordRequest) (*SetUserPasswordResponse, error)

SetUserPassword Sets the password for the given user to the given password

func (*Client) Shutdown

func (c *Client) Shutdown(ctx context.Context, req *ShutdownRequest) (*ShutdownResponse, error)

Shutdown Execute shutdown.

func (*Client) SuspendDisk

func (c *Client) SuspendDisk(ctx context.Context, req *SuspendDiskRequest) (*SuspendDiskResponse, error)

SuspendDisk Execute suspend-disk.

func (*Client) SuspendHybrid

func (c *Client) SuspendHybrid(ctx context.Context, req *SuspendHybridRequest) (*SuspendHybridResponse, error)

SuspendHybrid Execute suspend-hybrid.

func (*Client) SuspendRam

func (c *Client) SuspendRam(ctx context.Context, req *SuspendRamRequest) (*SuspendRamResponse, error)

SuspendRam Execute suspend-ram.

type CreateRequest

type CreateRequest struct {
	Command string `url:"command",json:"command"` // The QGA command.
	Node    string `url:"node",json:"node"`       // The cluster node name.
	Vmid    int    `url:"vmid",json:"vmid"`       // The (unique) ID of the VM.

}

type CreateResponse

type CreateResponse map[string]interface{}

type ExecRequest

type ExecRequest 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
	Command   *string `url:"command,omitempty",json:"command,omitempty"`       // The command as a list of program + arguments
	InputData *string `url:"input-data,omitempty",json:"input-data,omitempty"` // Data to pass as 'input-data' to the guest. Usually treated as STDIN to 'command'.
}

type ExecResponse

type ExecResponse struct {
	Pid int `url:"pid",json:"pid"` // The PID of the process started by the guest-agent.

}

type ExecStatusRequest

type ExecStatusRequest struct {
	Node string `url:"node",json:"node"` // The cluster node name.
	Pid  int    `url:"pid",json:"pid"`   // The PID to query
	Vmid int    `url:"vmid",json:"vmid"` // The (unique) ID of the VM.

}

type ExecStatusResponse

type ExecStatusResponse struct {
	Exited bool `url:"exited",json:"exited"` // Tells if the given command has exited yet.

	// The following parameters are optional
	ErrData      *string `url:"err-data,omitempty",json:"err-data,omitempty"`           // stderr of the process
	ErrTruncated *bool   `url:"err-truncated,omitempty",json:"err-truncated,omitempty"` // true if stderr was not fully captured
	Exitcode     *int    `url:"exitcode,omitempty",json:"exitcode,omitempty"`           // process exit code if it was normally terminated.
	OutData      *string `url:"out-data,omitempty",json:"out-data,omitempty"`           // stdout of the process
	OutTruncated *bool   `url:"out-truncated,omitempty",json:"out-truncated,omitempty"` // true if stdout was not fully captured
	Signal       *int    `url:"signal,omitempty",json:"signal,omitempty"`               // signal number or exception code if the process was abnormally terminated.
}

type FileReadRequest

type FileReadRequest struct {
	File string `url:"file",json:"file"` // The path to the file
	Node string `url:"node",json:"node"` // The cluster node name.
	Vmid int    `url:"vmid",json:"vmid"` // The (unique) ID of the VM.

}

type FileReadResponse

type FileReadResponse struct {
	Content string `url:"content",json:"content"` // The content of the file, maximum 16777216

	// The following parameters are optional
	Truncated *bool `url:"truncated,omitempty",json:"truncated,omitempty"` // If set to 1, the output is truncated and not complete
}

type FileWriteRequest

type FileWriteRequest struct {
	Content string `url:"content",json:"content"` // The content to write into the file.
	File    string `url:"file",json:"file"`       // The path to the file.
	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
	Encode *bool `url:"encode,omitempty",json:"encode,omitempty"` // If set, the content will be encoded as base64 (required by QEMU).Otherwise the content needs to be encoded beforehand - defaults to true.
}

type FileWriteResponse

type FileWriteResponse map[string]interface{}

type FsfreezeFreezeRequest

type FsfreezeFreezeRequest struct {
	Node string `url:"node",json:"node"` // The cluster node name.
	Vmid int    `url:"vmid",json:"vmid"` // The (unique) ID of the VM.

}

type FsfreezeFreezeResponse

type FsfreezeFreezeResponse map[string]interface{}

type FsfreezeStatusRequest

type FsfreezeStatusRequest struct {
	Node string `url:"node",json:"node"` // The cluster node name.
	Vmid int    `url:"vmid",json:"vmid"` // The (unique) ID of the VM.

}

type FsfreezeStatusResponse

type FsfreezeStatusResponse map[string]interface{}

type FsfreezeThawRequest

type FsfreezeThawRequest struct {
	Node string `url:"node",json:"node"` // The cluster node name.
	Vmid int    `url:"vmid",json:"vmid"` // The (unique) ID of the VM.

}

type FsfreezeThawResponse

type FsfreezeThawResponse map[string]interface{}

type FstrimRequest

type FstrimRequest struct {
	Node string `url:"node",json:"node"` // The cluster node name.
	Vmid int    `url:"vmid",json:"vmid"` // The (unique) ID of the VM.

}

type FstrimResponse

type FstrimResponse map[string]interface{}

type GetFsinfoRequest

type GetFsinfoRequest struct {
	Node string `url:"node",json:"node"` // The cluster node name.
	Vmid int    `url:"vmid",json:"vmid"` // The (unique) ID of the VM.

}

type GetFsinfoResponse

type GetFsinfoResponse map[string]interface{}

type GetHostNameRequest

type GetHostNameRequest struct {
	Node string `url:"node",json:"node"` // The cluster node name.
	Vmid int    `url:"vmid",json:"vmid"` // The (unique) ID of the VM.

}

type GetHostNameResponse

type GetHostNameResponse map[string]interface{}

type GetMemoryBlockInfoRequest

type GetMemoryBlockInfoRequest struct {
	Node string `url:"node",json:"node"` // The cluster node name.
	Vmid int    `url:"vmid",json:"vmid"` // The (unique) ID of the VM.

}

type GetMemoryBlockInfoResponse

type GetMemoryBlockInfoResponse map[string]interface{}

type GetMemoryBlocksRequest

type GetMemoryBlocksRequest struct {
	Node string `url:"node",json:"node"` // The cluster node name.
	Vmid int    `url:"vmid",json:"vmid"` // The (unique) ID of the VM.

}

type GetMemoryBlocksResponse

type GetMemoryBlocksResponse map[string]interface{}

type GetOsinfoRequest

type GetOsinfoRequest struct {
	Node string `url:"node",json:"node"` // The cluster node name.
	Vmid int    `url:"vmid",json:"vmid"` // The (unique) ID of the VM.

}

type GetOsinfoResponse

type GetOsinfoResponse map[string]interface{}

type GetTimeRequest

type GetTimeRequest struct {
	Node string `url:"node",json:"node"` // The cluster node name.
	Vmid int    `url:"vmid",json:"vmid"` // The (unique) ID of the VM.

}

type GetTimeResponse

type GetTimeResponse map[string]interface{}

type GetTimezoneRequest

type GetTimezoneRequest struct {
	Node string `url:"node",json:"node"` // The cluster node name.
	Vmid int    `url:"vmid",json:"vmid"` // The (unique) ID of the VM.

}

type GetTimezoneResponse

type GetTimezoneResponse map[string]interface{}

type GetUsersRequest

type GetUsersRequest struct {
	Node string `url:"node",json:"node"` // The cluster node name.
	Vmid int    `url:"vmid",json:"vmid"` // The (unique) ID of the VM.

}

type GetUsersResponse

type GetUsersResponse map[string]interface{}

type GetVcpusRequest

type GetVcpusRequest struct {
	Node string `url:"node",json:"node"` // The cluster node name.
	Vmid int    `url:"vmid",json:"vmid"` // The (unique) ID of the VM.

}

type GetVcpusResponse

type GetVcpusResponse map[string]interface{}

type HTTPClient

type HTTPClient interface {
	Do(context.Context, string, string, interface{}, interface{}) error
}

type IndexRequest

type IndexRequest struct {
	Node string `url:"node",json:"node"` // The cluster node name.
	Vmid int    `url:"vmid",json:"vmid"` // The (unique) ID of the VM.

}

type IndexResponse

type IndexResponse []*map[string]interface{}

type InfoRequest

type InfoRequest struct {
	Node string `url:"node",json:"node"` // The cluster node name.
	Vmid int    `url:"vmid",json:"vmid"` // The (unique) ID of the VM.

}

type InfoResponse

type InfoResponse map[string]interface{}

type NetworkGetInterfacesRequest

type NetworkGetInterfacesRequest struct {
	Node string `url:"node",json:"node"` // The cluster node name.
	Vmid int    `url:"vmid",json:"vmid"` // The (unique) ID of the VM.

}

type NetworkGetInterfacesResponse

type NetworkGetInterfacesResponse map[string]interface{}

type PingRequest

type PingRequest struct {
	Node string `url:"node",json:"node"` // The cluster node name.
	Vmid int    `url:"vmid",json:"vmid"` // The (unique) ID of the VM.

}

type PingResponse

type PingResponse map[string]interface{}

type SetUserPasswordRequest

type SetUserPasswordRequest struct {
	Node     string `url:"node",json:"node"`         // The cluster node name.
	Password string `url:"password",json:"password"` // The new password.
	Username string `url:"username",json:"username"` // The user to set the password for.
	Vmid     int    `url:"vmid",json:"vmid"`         // The (unique) ID of the VM.

	// The following parameters are optional
	Crypted *bool `url:"crypted,omitempty",json:"crypted,omitempty"` // set to 1 if the password has already been passed through crypt()
}

type SetUserPasswordResponse

type SetUserPasswordResponse map[string]interface{}

type ShutdownRequest

type ShutdownRequest struct {
	Node string `url:"node",json:"node"` // The cluster node name.
	Vmid int    `url:"vmid",json:"vmid"` // The (unique) ID of the VM.

}

type ShutdownResponse

type ShutdownResponse map[string]interface{}

type SuspendDiskRequest

type SuspendDiskRequest struct {
	Node string `url:"node",json:"node"` // The cluster node name.
	Vmid int    `url:"vmid",json:"vmid"` // The (unique) ID of the VM.

}

type SuspendDiskResponse

type SuspendDiskResponse map[string]interface{}

type SuspendHybridRequest

type SuspendHybridRequest struct {
	Node string `url:"node",json:"node"` // The cluster node name.
	Vmid int    `url:"vmid",json:"vmid"` // The (unique) ID of the VM.

}

type SuspendHybridResponse

type SuspendHybridResponse map[string]interface{}

type SuspendRamRequest

type SuspendRamRequest struct {
	Node string `url:"node",json:"node"` // The cluster node name.
	Vmid int    `url:"vmid",json:"vmid"` // The (unique) ID of the VM.

}

type SuspendRamResponse

type SuspendRamResponse map[string]interface{}

Jump to

Keyboard shortcuts

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