ExDaytona.Platform (ex_daytona v0.2.0)

Copy Markdown View Source

Read-only platform lookups commonly needed before creating a sandbox: organizations, regions, sandbox classes, snapshots, and usage/quota.

{:ok, regions} = ExDaytona.Platform.regions(client)
{:ok, classes} = ExDaytona.Platform.sandbox_classes(client, org_id)
{:ok, %{items: snapshots}} = ExDaytona.Platform.snapshots(client, limit: 10)

All helpers return normalized generated models with facade error handling. Note that organizations/1 requires JWT authentication — plain API keys receive a 401 from the provider.

Summary

Functions

List the caller's organizations.

List the regions available to the caller.

List the sandbox classes (with GPU availability) an organization can use.

Fetch one snapshot by id or name.

List snapshots with pagination. Accepts :page, :limit, :name, :sort, :order; returns {:ok, %{items: [...], page: p, total: n, total_pages: tp}}.

The organization's usage/quota overview (current usage vs. limits).

Functions

organizations(client)

@spec organizations(ExDaytona.Client.t()) ::
  {:ok, [ExDaytona.Model.Organization.t()]} | {:error, ExDaytona.Error.t()}

List the caller's organizations.

JWT only

The provider rejects API-key authentication on this endpoint (401 "Invalid credentials"). Sandbox-scoped code can read its own organization id from sandbox.info.organizationId instead.

regions(client)

@spec regions(ExDaytona.Client.t()) ::
  {:ok, [ExDaytona.Model.Region.t()]} | {:error, ExDaytona.Error.t()}

List the regions available to the caller.

sandbox_classes(client, organization_id)

@spec sandbox_classes(ExDaytona.Client.t(), String.t()) ::
  {:ok, [ExDaytona.Model.AvailableSandboxClass.t()]}
  | {:error, ExDaytona.Error.t()}

List the sandbox classes (with GPU availability) an organization can use.

snapshot(client, id_or_name)

@spec snapshot(ExDaytona.Client.t(), String.t()) ::
  {:ok, ExDaytona.Model.SnapshotDto.t()} | {:error, ExDaytona.Error.t()}

Fetch one snapshot by id or name.

snapshots(client, opts \\ [])

@spec snapshots(
  ExDaytona.Client.t(),
  keyword()
) ::
  {:ok,
   %{
     items: [ExDaytona.Model.SnapshotDto.t()],
     page: non_neg_integer() | nil,
     total: non_neg_integer() | nil,
     total_pages: non_neg_integer() | nil
   }}
  | {:error, ExDaytona.Error.t()}

List snapshots with pagination. Accepts :page, :limit, :name, :sort, :order; returns {:ok, %{items: [...], page: p, total: n, total_pages: tp}}.

usage_overview(client, organization_id)

@spec usage_overview(ExDaytona.Client.t(), String.t()) ::
  {:ok, ExDaytona.Model.OrganizationUsageOverview.t()}
  | {:error, ExDaytona.Error.t()}

The organization's usage/quota overview (current usage vs. limits).