Hyper.Firecracker.Api.Transport (Hyper v0.1.0)

Copy Markdown View Source

oapi_generator client backend for the Firecracker API. Each generated operation calls request/1 with a plain map describing the call; this issues it over the target daemon's HTTP-over-Unix-socket API via Req and decodes the typed response.

The per-VM socket path arrives as opts[:socket_path] (injected by Hyper.Node.FireVMM.Client). Request bodies are generated structs encoded by Hyper.Firecracker.Api.Codec (nil-stripped) or, for free-form bodies like MMDS, plain maps sent verbatim. Typed responses are decoded by the schema's own generated decode/1 (also from Hyper.Firecracker.Api.Codec).

Returns: :ok (204 / empty), {:ok, decoded} (2xx with a typed body), {:error, {:api, status, fault_message}} (non-2xx), or {:error, {:transport, reason}} (socket/connection failure).

Summary

Types

result()

@type result() ::
  :ok
  | {:ok, term()}
  | {:error, {:api, pos_integer(), String.t() | nil} | {:transport, term()}}

Functions

request(info)

@spec request(map()) :: result()