Host binding for shared Incus operations. The host owns every trust decision.
For an authenticated caller (a host-owned term, such as the host's MCP
request context), the host returns the trusted backend and authorizes each
operation with its validated input. Tool input never selects a socket, URL,
credential, owner or host path; the operation selects a native project
from input only after authorize/3 returns :ok.
A callback that is missing, raises, exits or returns anything else denies the call before any backend request. Calls run in the caller's process.
Summary
Callbacks
Allow restricted create/update input: each item is {:config, key} or
{:device, name}. Without this callback restricted input is denied.
Authorize the operation and its validated, normalized input (including project).
The backend for this caller and operation: a discovered client, or a
connection and context the operation discovers with Opsmaru.Incus.connect/2
after authorization. The connection's timeout bounds every native request,
including bounded waits.
Resolve a host-approved image remote named in create input to its native
source server and protocol. Without this callback only local images are used.
Types
Callbacks
@callback allow_restricted?( caller(), operation(), items :: [{:config | :device, String.t()}] ) :: boolean()
Allow restricted create/update input: each item is {:config, key} or
{:device, name}. Without this callback restricted input is denied.
Authorize the operation and its validated, normalized input (including project).
@callback binding(caller(), operation()) :: {:ok, Opsmaru.Incus.t()} | {:ok, Opsmaru.Incus.Connection.t(), Opsmaru.Incus.Context.t()} | {:error, term()}
The backend for this caller and operation: a discovered client, or a
connection and context the operation discovers with Opsmaru.Incus.connect/2
after authorization. The connection's timeout bounds every native request,
including bounded waits.
@callback image_remote(caller(), name :: String.t()) :: {:ok, %{required(String.t()) => String.t()}} | {:error, term()}
Resolve a host-approved image remote named in create input to its native
source server and protocol. Without this callback only local images are used.