tasks

package
v0.0.15 Latest Latest
Warning

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

Go to latest
Published: Jan 31, 2023 License: MIT Imports: 2 Imported by: 0

Documentation

Index

Constants

View Source
const (
	Source_ARCHIVE Source = "archive"
	Source_ACTIVE  Source = "active"
	Source_ALL     Source = "all"

	Status_RUNNING Status = "running"
	Status_STOPPED Status = "stopped"
)

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

func (c *Client) Delete(ctx context.Context, req DeleteRequest) error

Delete Stop a task.

func (*Client) Find

func (c *Client) Find(ctx context.Context, req FindRequest) ([]map[string]interface{}, error)

Find

func (*Client) Index

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

Index Read task list for one node (finished tasks).

func (*Client) ReadTaskLog

func (c *Client) ReadTaskLog(ctx context.Context, req ReadTaskLogRequest) ([]ReadTaskLogResponse, error)

ReadTaskLog Read task log.

func (*Client) ReadTaskStatus

ReadTaskStatus Read task status.

type DeleteRequest

type DeleteRequest struct {
	Node string `url:"node" json:"node"` // The cluster node name.
	Upid string `url:"upid" json:"upid"`
}

type FindRequest

type FindRequest struct {
	Node string `url:"node" json:"node"` // The cluster node name.
	Upid string `url:"upid" json:"upid"`
}

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.

	// The following parameters are optional
	Errors       *util.PVEBool `url:"errors,omitempty" json:"errors,omitempty"`             // Only list tasks with a status of ERROR.
	Limit        *int          `url:"limit,omitempty" json:"limit,omitempty"`               // Only list this amount of tasks.
	Since        *int          `url:"since,omitempty" json:"since,omitempty"`               // Only list tasks since this UNIX epoch.
	Source       *Source       `url:"source,omitempty" json:"source,omitempty"`             // List archived, active or all tasks.
	Start        *int          `url:"start,omitempty" json:"start,omitempty"`               // List tasks beginning from this offset.
	Statusfilter *string       `url:"statusfilter,omitempty" json:"statusfilter,omitempty"` // List of Task States that should be returned.
	Typefilter   *string       `url:"typefilter,omitempty" json:"typefilter,omitempty"`     // Only list tasks of this type (e.g., vzstart, vzdump).
	Until        *int          `url:"until,omitempty" json:"until,omitempty"`               // Only list tasks until this UNIX epoch.
	Userfilter   *string       `url:"userfilter,omitempty" json:"userfilter,omitempty"`     // Only list tasks from this user.
	Vmid         *int          `url:"vmid,omitempty" json:"vmid,omitempty"`                 // Only list tasks for this VM.
}

type IndexResponse

type IndexResponse struct {
	Id        string `url:"id" json:"id"`
	Node      string `url:"node" json:"node"`
	Pid       int    `url:"pid" json:"pid"`
	Pstart    int    `url:"pstart" json:"pstart"`
	Starttime int    `url:"starttime" json:"starttime"`
	Type      string `url:"type" json:"type"`
	Upid      string `url:"upid" json:"upid"`
	User      string `url:"user" json:"user"`

	// The following parameters are optional
	Endtime *int    `url:"endtime,omitempty" json:"endtime,omitempty"`
	Status  *string `url:"status,omitempty" json:"status,omitempty"`
}

type ReadTaskLogRequest

type ReadTaskLogRequest struct {
	Node string `url:"node" json:"node"` // The cluster node name.
	Upid string `url:"upid" json:"upid"` // The task's unique ID.

	// The following parameters are optional
	Limit *int `url:"limit,omitempty" json:"limit,omitempty"` // The maximum amount of lines that should be printed.
	Start *int `url:"start,omitempty" json:"start,omitempty"` // The line number to start printing at.
}

type ReadTaskLogResponse

type ReadTaskLogResponse struct {
	N int    `url:"n" json:"n"` // Line number
	T string `url:"t" json:"t"` // Line text

}

type ReadTaskStatusRequest

type ReadTaskStatusRequest struct {
	Node string `url:"node" json:"node"` // The cluster node name.
	Upid string `url:"upid" json:"upid"` // The task's unique ID.

}

type ReadTaskStatusResponse

type ReadTaskStatusResponse struct {
	Id        string  `url:"id" json:"id"`
	Node      string  `url:"node" json:"node"`
	Pid       int     `url:"pid" json:"pid"`
	Starttime float64 `url:"starttime" json:"starttime"`
	Status    Status  `url:"status" json:"status"`
	Type      string  `url:"type" json:"type"`
	Upid      string  `url:"upid" json:"upid"`
	User      string  `url:"user" json:"user"`

	// The following parameters are optional
	Exitstatus *string `url:"exitstatus,omitempty" json:"exitstatus,omitempty"`
}

type Source added in v0.0.15

type Source string

func PtrSource added in v0.0.15

func PtrSource(i Source) *Source

type Status added in v0.0.15

type Status string

func PtrStatus added in v0.0.15

func PtrStatus(i Status) *Status

Jump to

Keyboard shortcuts

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