tasks

package
v1.10.1 Latest Latest
Warning

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

Go to latest
Published: Feb 7, 2025 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Overview

User API tasks interface

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type GetRequest

type GetRequest struct {
	// ID of audit GUID
	// Required: true
	AuditID string `url:"auditId" json:"auditId" validate:"required"`
}

GetRequest struct to get background API task status and result

type ItemTask added in v1.5.0

type ItemTask struct {
	// Audit ID
	AuditID string `json:"auditId"`

	// Completed
	Completed bool `json:"completed"`

	// Error
	Error string `json:"error"`

	// GUID
	GUID string `json:"guid"`

	// List of logs
	Log []string `json:"log"`

	// Final result
	Result

	// Stage
	Stage string `json:"stage"`

	// Status
	Status string `json:"status"`

	// Update time
	UpdateTime uint64 `json:"updateTime"`

	// Updated by
	UpdatedBy string `json:"updatedBy"`

	// Updated time
	UpdatedTime uint64 `json:"updatedTime"`
}

type ListRequest

type ListRequest struct {
	// Find by guId
	// Required: false
	TaskID string `url:"taskId,omitempty" json:"taskId,omitempty"`

	// Find by auditId
	// Required: false
	AuditID string `url:"auditId,omitempty" json:"auditId,omitempty"`

	// Find by status
	// Required: false
	Status string `url:"status,omitempty" json:"status,omitempty"`

	// Find by completed True or False
	// Required: false
	Completed interface{} `url:"completed,omitempty" json:"completed,omitempty" validate:"omitempty,isBool"`

	// Sort by one of supported fields, format +|-(field)
	// Required: false
	SortBy string `url:"sortBy,omitempty" json:"sortBy,omitempty" validate:"omitempty,sortBy"`

	// Find all tasks after point in time (unixtime)
	// Required: false
	UpdateTimeAt uint64 `url:"updateTimeAt,omitempty" json:"updateTimeAt,omitempty"`

	// Find all tasks before point in time (unixtime)
	// Required: false
	UpdateTimeTo uint64 `url:"updateTimeTo,omitempty" json:"updateTimeTo,omitempty"`

	// Page number
	// Default: 0
	// Default: 0
	// Required: false
	Page uint64 `url:"page,omitempty" json:"page,omitempty"`

	// Page size
	// Default: 0
	// Default: 0
	// Required: false
	Size uint64 `url:"size,omitempty" json:"size,omitempty"`
}

ListRequest struct to get list of audits

type ListTasks

type ListTasks struct {
	// Data
	Data []ItemTask `json:"data"`

	// Entry count
	EntryCount uint64 `json:"entryCount"`
}

List of tasks

type RecordTask

type RecordTask struct {
	// Updated by
	UpdatedBy string `json:"updatedBy"`

	ItemTask
}

Detailed information about task

type Result added in v1.8.0

type Result struct {
	Result interface{} `json:"result"`
}

Result structure of the task to provide methods

func (Result) ID added in v1.8.0

func (r Result) ID() (int, error)

ID returns ID of cluster or WG or any other resource successfully created as a Result of the task. It returns error if Result does not contain any resource ID.

func (Result) Name added in v1.8.0

func (r Result) Name() (string, error)

Name returns name of cluster or wg successfully created as a result of the task. It returns error if Result does not contain k8s name.

func (Result) ToMaps added in v1.8.0

func (r Result) ToMaps() ([]map[string]interface{}, error)

ToMaps converts Result to a slice of maps containing back-up information as a result of the task. It returns error if Result does not contain back-up information.

func (Result) ToString added in v1.8.0

func (r Result) ToString() (string, error)

ToString converts Result to non-empty string. It returns error if Result is not a string or is an empty string.

type Tasks

type Tasks struct {
	// contains filtered or unexported fields
}

Structure for creating request to tasks

func New

func New(client interfaces.Caller) *Tasks

Builder for tasks endpoints

func (Tasks) Get

func (t Tasks) Get(ctx context.Context, req GetRequest) (*RecordTask, error)

Get gets background API task status and result as a RecordTask struct

func (Tasks) GetRaw added in v1.6.6

func (t Tasks) GetRaw(ctx context.Context, req GetRequest) ([]byte, error)

GetRaw gets background API task status and result as an array of bytes

func (Tasks) List

func (t Tasks) List(ctx context.Context, req ListRequest) (*ListTasks, error)

List gets list of user API task with status PROCESSING as a ListTasks struct

func (Tasks) ListRaw added in v1.6.6

func (t Tasks) ListRaw(ctx context.Context, req ListRequest) ([]byte, error)

ListRaw gets list of user API task with status PROCESSING as an array of bytes

Jump to

Keyboard shortcuts

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