Track Compute Engine operations to completion.
Mutating calls return an GcpCompute.Operation immediately; use these
functions to wait for the underlying work (boot, delete, …) to finish.
{:ok, op} = GcpCompute.Instances.insert(config, spec)
{:ok, done} = GcpCompute.Operations.poll_until_done(config, op)
Summary
Functions
@spec get(GcpCompute.Config.t(), GcpCompute.Operation.t()) :: {:ok, GcpCompute.Operation.t()} | {:error, GcpCompute.Error.t()}
Fetch the current state of an operation (single GET, no waiting).
@spec poll_until_done(GcpCompute.Config.t(), GcpCompute.Operation.t(), keyword()) :: {:ok, GcpCompute.Operation.t()} | {:error, GcpCompute.Error.t()}
Repeatedly wait/2 until the operation is done or :timeout (ms) elapses.
Returns {:ok, done_operation} on success. If the operation completes with
an error payload, returns {:error, %GcpCompute.Error{reason: :operation_failed}}.
On timeout, {:error, %GcpCompute.Error{reason: :timeout}}.
Options
:timeout— wall-clock budget in ms (default300000). The deadline is checked betweenwait/2calls; since eachwaitlong-polls server-side, an in-flight call may overshoot the deadline by up to ~2 min.
@spec wait(GcpCompute.Config.t(), GcpCompute.Operation.t()) :: {:ok, GcpCompute.Operation.t()} | {:error, GcpCompute.Error.t()}
Long-poll an operation once.
Calls the Compute operations.wait endpoint, which blocks server-side until
the operation is DONE or ~2 minutes elapse, then returns the current state.