tasks

package
v0.66.3 Latest Latest
Warning

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

Go to latest
Published: Oct 31, 2024 License: MPL-2.0 Imports: 10 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 {
	api.Client
}

Client is an interface for performing requests against the Proxmox 'tasks' API.

func (*Client) BuildPath

func (c *Client) BuildPath(taskID string, path string) (string, error)

BuildPath builds a path using information from Task ID.

func (*Client) DeleteTask

func (c *Client) DeleteTask(ctx context.Context, upid string) error

DeleteTask deletes specific task.

func (*Client) ExpandPath

func (c *Client) ExpandPath(_ string) string

ExpandPath expands a path relative to the client's base path.

func (*Client) GetTaskLog

func (c *Client) GetTaskLog(ctx context.Context, upid string) ([]string, error)

GetTaskLog retrieves the log of a task. The log is returned as an array of lines. Each line is an object with a line number and the text of the line. Reads first 50 lines by default.

func (*Client) GetTaskStatus

func (c *Client) GetTaskStatus(ctx context.Context, upid string) (*GetTaskStatusResponseData, error)

GetTaskStatus retrieves the status of a task.

func (*Client) WaitForTask

func (c *Client) WaitForTask(ctx context.Context, upid string, opts ...TaskWaitOption) error

WaitForTask waits for a specific task to complete.

type GetTaskLogResponseBody

type GetTaskLogResponseBody struct {
	Data []*GetTaskLogResponseData `json:"data,omitempty"`
}

GetTaskLogResponseBody contains the body from a node get task log response.

type GetTaskLogResponseData

type GetTaskLogResponseData struct {
	LineNumber int    `json:"n,omitempty"`
	LineText   string `json:"t,omitempty"`
}

GetTaskLogResponseData contains the data from a node get task log response.

type GetTaskStatusResponseBody

type GetTaskStatusResponseBody struct {
	Data *GetTaskStatusResponseData `json:"data,omitempty"`
}

GetTaskStatusResponseBody contains the body from a node get task status response.

type GetTaskStatusResponseData

type GetTaskStatusResponseData struct {
	PID      int    `json:"pid,omitempty"`
	Status   string `json:"status,omitempty"`
	ExitCode string `json:"exitstatus,omitempty"`
}

GetTaskStatusResponseData contains the data from a node get task status response.

type TaskID

type TaskID struct {
	NodeName  string
	PID       int64
	PStart    int64
	StartTime time.Time
	Type      string
	ID        string
	User      string
}

TaskID contains the components of a PVE task ID.

func ParseTaskID

func ParseTaskID(taskID string) (TaskID, error)

ParseTaskID parses a task ID into its component parts. The task ID is expected to be in the format of:

UPID:<node_name>:<pid_in_hex>:<pstart_in_hex>:<starttime_in_hex>:<type>:<id (optional)>:<user>@<realm>:

type TaskWaitOption

type TaskWaitOption interface {
	// contains filtered or unexported methods
}

TaskWaitOption is an option for waiting for a task to complete.

func WithIgnoreStatus

func WithIgnoreStatus(statusCode int) TaskWaitOption

WithIgnoreStatus is an option to ignore particular status code from PVE API when waiting for a task to complete.

func WithIgnoreWarnings

func WithIgnoreWarnings() TaskWaitOption

WithIgnoreWarnings is an option to ignore warnings when waiting for a task to complete.

Jump to

Keyboard shortcuts

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