GcpCompute.Operation (GcpCompute v0.2.0)

Copy Markdown View Source

A Compute Engine Operation.

Every mutating call (insert, delete, start, stop, …) is asynchronous and returns an Operation. Wait for it with GcpCompute.Operations.wait/2 or GcpCompute.Operations.poll_until_done/3.

Summary

Functions

True once the operation has reached the :done status.

True if the (done) operation carries an error payload.

Parse a decoded JSON operation map into a struct.

Where the operation lives — {:zone, z}, {:region, r}, or :global.

Convert a failed operation into a GcpCompute.Error.

Types

scope()

@type scope() :: {:zone, String.t()} | {:region, String.t()} | :global

status()

@type status() :: :pending | :running | :done | String.t()

t()

@type t() :: %GcpCompute.Operation{
  error: map() | nil,
  http_error_message: String.t() | nil,
  http_error_status_code: integer() | nil,
  name: String.t() | nil,
  operation_type: String.t() | nil,
  progress: integer() | nil,
  raw: map(),
  region: String.t() | nil,
  status: status() | nil,
  target_id: String.t() | nil,
  target_link: String.t() | nil,
  zone: String.t() | nil
}

Functions

done?(operation)

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

True once the operation has reached the :done status.

error?(operation)

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

True if the (done) operation carries an error payload.

from_json(map)

@spec from_json(map()) :: t()

Parse a decoded JSON operation map into a struct.

scope(operation)

@spec scope(t()) :: scope()

Where the operation lives — {:zone, z}, {:region, r}, or :global.

to_error(op)

@spec to_error(t()) :: GcpCompute.Error.t()

Convert a failed operation into a GcpCompute.Error.