Documentation
¶
Index ¶
Constants ¶
const (
// TasksPath The endpoint for retrieving tasks
TasksPath = "/api/cis/tasks"
)
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Info ¶ added in v0.53.0
type Info struct {
// Description of the operation associated with the task.
Description rest.LocalizableMessage `json:"description"`
// Service is the identifier of the service containing the operation.
Service string `json:"service"`
// Operation is the identifier of the operation associated with the task.
Operation string `json:"operation"`
// Parent of the current task.
//
// This field will be unset if the task has no parent.
Parent *string `json:"parent,omitempty"`
// Target is the identifier of the target created by the operation or an existing one
// the operation performed on.
//
// This field will be unset if the operation has no target or multiple targets.
Target map[string]string `json:"target,omitempty"`
// Status of the operation associated with the task.
Status Status `json:"status"`
// Cancelable is a flag to indicate whether or not the operation can be cancelled.
// The value may change as the operation progresses.
Cancelable bool `json:"cancelable"`
// Error is the description of the error if the operation status is "FAILED".
//
// If unset the description of why the operation failed will be included in the result of the operation
// (see Info.Result).
Error rest.Error `json:"error,omitempty"`
// Start is the time when the operation is started.
Start *time.Time `json:"start_time,omitempty"`
// End is the time when the operation is completed.
End *time.Time `json:"end_time,omitempty"`
// User is the name of the user who performed the operation.
//
// This field will be unset if the operation is performed by the system.
User *string `json:"user,omitempty"`
// Progress of the operation.
Progress Progress `json:"progress"`
// Result of the operation.
//
// If an operation reports partial results before it completes, this
// field could be set before the Status has the value SUCCEEDED. The value could change as the
// operation progresses.
//
// This field will be unset if the operation does not return a result or if the result is not available
// at the current step of the operation.
Result json.RawMessage `json:"result,omitempty"`
}
Info contains information about a task.
type Manager ¶
Manager extends rest.Client, adding task related methods.
func NewManager ¶
NewManager creates a new Manager instance with the given client.
func NewManagerWithCustomInterval ¶
NewManager creates a new Manager instance with the given client and custom polling interval
func (*Manager) WaitForCompletion ¶
WaitForCompletion will wait for the task status to be in anything but the Pending or Running state.
func (*Manager) WaitForRunningOrError ¶ added in v0.53.0
WaitForRunningOrError will wait for the task status to be Running or Failed. If the task has failed, it will return the TaskInfo Error field as an error.
type Progress ¶ added in v0.53.0
type Progress struct {
// Total is the total amount of work for the operation.
Total uint64 `json:"total"`
// Completed is the amount of work completed for the operation. The value can only be incremented.
Completed uint64 `json:"completed"`
// Message about the work progress.
Message *rest.LocalizableMessage `json:"message,omitempty"`
}
Progress contains information describing the progress of an operation.
type Status ¶ added in v0.53.0
type Status string
Status defines the status values that can be reported for an operation.
const ( // Pending indicates the operation is in pending state. Pending Status = "PENDING" // Running indicates the operation is in progress. Running Status = "RUNNING" // Blocked indicates the operation is blocked. Blocked Status = "BLOCKED" // Succeeded indicates the operation completed successfully. Succeeded Status = "SUCCEEDED" // Failed indicates the operation failed. Failed Status = "FAILED" )