ExIncus.Operation (ex_incus v1.0.0)

Copy Markdown

A background operation.

Most state-changing Incus calls (create/delete instance, state changes, exec, ...) are asynchronous: the server replies immediately with an operation that runs in the background. Functions in this library wait for those operations to finish by default (pass wait: false to get the running operation back instead) - see ExIncus.Operations.wait/3.

Status codes

  • 100..199 - in progress (100 created, 101 started, 103 running, ...)
  • 200 - success
  • 400 - failure (see :err)
  • 401 - cancelled

Summary

Functions

Extracts the operation UUID from an operation struct, a UUID string or an API path such as "/1.0/operations/<uuid>".

Returns true if the operation is still in progress.

Returns true if the operation completed successfully.

Types

t()

@type t() :: %ExIncus.Operation{
  class: String.t() | nil,
  created_at: String.t() | nil,
  description: String.t() | nil,
  err: String.t() | nil,
  id: String.t() | nil,
  location: String.t() | nil,
  may_cancel: boolean() | nil,
  metadata: map() | nil,
  resources: map() | nil,
  status: String.t() | nil,
  status_code: integer() | nil,
  updated_at: String.t() | nil
}

Functions

id(id)

@spec id(t() | String.t()) :: String.t()

Extracts the operation UUID from an operation struct, a UUID string or an API path such as "/1.0/operations/<uuid>".

running?(operation)

@spec running?(t()) :: boolean()

Returns true if the operation is still in progress.

success?(operation)

@spec success?(t()) :: boolean()

Returns true if the operation completed successfully.