Skip to content

Latest commit

 

History

History
397 lines (259 loc) · 23.8 KB

File metadata and controls

397 lines (259 loc) · 23.8 KB

SandboxAdmin

Overview

Available Operations

  • get_sandbox - GetSandbox
  • list_sandbox_egress - Outbound HTTP(S) calls a sandbox made (the egress ledger). Durable — reads the recorded table, so it works for stopped sandboxes too.
  • list_executions - ListSandboxExecutions
  • list_sandbox_files - Live filesystem of a running sandbox. Both are NO-OP (read-only) and only return data while the worker is alive; available=false otherwise.
  • list_sandbox_spend - Per-lease compute usage for a sandbox, computed from lease durations × the compute rate. Durable (reads the lease table), so it works for stopped sandboxes. This is usage (ACUs), not the invoiced dollar amount.
  • list - ListSandboxes
  • read_file - ReadSandboxFile
  • restart_sandbox - Restart a stopped/reaped sandbox by re-acquiring a worker for the same sandbox_id, preserving the original owner. Same scoping as StopSandbox (owner, or sandbox:write_private for org-wide).
  • stop - StopSandbox

get_sandbox

GetSandbox

Example Usage

import os
from textql_sdk import Textql


with Textql(
    api_key=os.getenv("TEXTQL_API_KEY", ""),
) as textql:

    res = textql.sandbox_admin.get_sandbox()

    # Handle response
    print(res)

Parameters

Parameter Type Required Description
connect_timeout_ms Optional[float] ➖ N/A
sandbox_id Optional[str] ➖ N/A
retries Optional[utils.RetryConfig] ➖ Configuration to override the default retry behavior of the client.

Response

models.SandboxAdminServiceGetSandboxResponse

Errors

Error Type Status Code Content Type
errors.TextqlDefaultError 4XX, 5XX */*

list_sandbox_egress

Outbound HTTP(S) calls a sandbox made (the egress ledger). Durable — reads the recorded table, so it works for stopped sandboxes too.

Example Usage

import os
from textql_sdk import Textql


with Textql(
    api_key=os.getenv("TEXTQL_API_KEY", ""),
) as textql:

    res = textql.sandbox_admin.list_sandbox_egress()

    # Handle response
    print(res)

Parameters

Parameter Type Required Description
connect_timeout_ms Optional[float] ➖ N/A
sandbox_id Optional[str] ➖ N/A
limit Optional[int] ➖ Max calls to return (newest first). Server clamps to a sane default/cap.
retries Optional[utils.RetryConfig] ➖ Configuration to override the default retry behavior of the client.

Response

models.SandboxAdminServiceListSandboxEgressResponse

Errors

Error Type Status Code Content Type
errors.TextqlDefaultError 4XX, 5XX */*

list_executions

ListSandboxExecutions

Example Usage

import os
from textql_sdk import Textql


with Textql(
    api_key=os.getenv("TEXTQL_API_KEY", ""),
) as textql:

    res = textql.sandbox_admin.list_executions()

    # Handle response
    print(res)

Parameters

Parameter Type Required Description
connect_timeout_ms Optional[float] ➖ N/A
sandbox_id Optional[str] ➖ N/A
limit Optional[int] ➖ N/A
cursor Optional[str] ➖ N/A
retries Optional[utils.RetryConfig] ➖ Configuration to override the default retry behavior of the client.

Response

models.SandboxAdminServiceListSandboxExecutionsResponse

Errors

Error Type Status Code Content Type
errors.TextqlDefaultError 4XX, 5XX */*

list_sandbox_files

Live filesystem of a running sandbox. Both are NO-OP (read-only) and only return data while the worker is alive; available=false otherwise.

Example Usage

import os
from textql_sdk import Textql


with Textql(
    api_key=os.getenv("TEXTQL_API_KEY", ""),
) as textql:

    res = textql.sandbox_admin.list_sandbox_files()

    # Handle response
    print(res)

Parameters

Parameter Type Required Description
connect_timeout_ms Optional[float] ➖ N/A
sandbox_id Optional[str] ➖ N/A
path Optional[str] ➖ Directory to list, relative to the sandbox files root ("" = root).
retries Optional[utils.RetryConfig] ➖ Configuration to override the default retry behavior of the client.

Response

models.SandboxAdminServiceListSandboxFilesResponse

Errors

Error Type Status Code Content Type
errors.TextqlDefaultError 4XX, 5XX */*

list_sandbox_spend

Per-lease compute usage for a sandbox, computed from lease durations × the compute rate. Durable (reads the lease table), so it works for stopped sandboxes. This is usage (ACUs), not the invoiced dollar amount.

Example Usage

import os
from textql_sdk import Textql


with Textql(
    api_key=os.getenv("TEXTQL_API_KEY", ""),
) as textql:

    res = textql.sandbox_admin.list_sandbox_spend()

    # Handle response
    print(res)

Parameters

Parameter Type Required Description
connect_timeout_ms Optional[float] ➖ N/A
sandbox_id Optional[str] ➖ N/A
retries Optional[utils.RetryConfig] ➖ Configuration to override the default retry behavior of the client.

Response

models.SandboxAdminServiceListSandboxSpendResponse

Errors

Error Type Status Code Content Type
errors.TextqlDefaultError 4XX, 5XX */*

list

ListSandboxes

Example Usage

import os
from textql_sdk import Textql


with Textql(
    api_key=os.getenv("TEXTQL_API_KEY", ""),
) as textql:

    res = textql.sandbox_admin.list()

    # Handle response
    print(res)

Parameters

Parameter Type Required Description
connect_timeout_ms Optional[float] ➖ N/A
status Optional[str] ➖ One of: running | stopped | all. Defaults to running.
limit Optional[int] ➖ N/A
cursor Optional[str] ➖ N/A
retries Optional[utils.RetryConfig] ➖ Configuration to override the default retry behavior of the client.

Response

models.SandboxAdminServiceListSandboxesResponse

Errors

Error Type Status Code Content Type
errors.TextqlDefaultError 4XX, 5XX */*

read_file

ReadSandboxFile

Example Usage

import os
from textql_sdk import Textql


with Textql(
    api_key=os.getenv("TEXTQL_API_KEY", ""),
) as textql:

    res = textql.sandbox_admin.read_file()

    # Handle response
    print(res)

Parameters

Parameter Type Required Description
connect_timeout_ms Optional[float] ➖ N/A
sandbox_id Optional[str] ➖ N/A
path Optional[str] ➖ File to read, relative to the sandbox files root.
retries Optional[utils.RetryConfig] ➖ Configuration to override the default retry behavior of the client.

Response

models.SandboxAdminServiceReadSandboxFileResponse

Errors

Error Type Status Code Content Type
errors.TextqlDefaultError 4XX, 5XX */*

restart_sandbox

Restart a stopped/reaped sandbox by re-acquiring a worker for the same sandbox_id, preserving the original owner. Same scoping as StopSandbox (owner, or sandbox:write_private for org-wide).

Example Usage

import os
from textql_sdk import Textql


with Textql(
    api_key=os.getenv("TEXTQL_API_KEY", ""),
) as textql:

    res = textql.sandbox_admin.restart_sandbox()

    # Handle response
    print(res)

Parameters

Parameter Type Required Description
connect_timeout_ms Optional[float] ➖ N/A
sandbox_id Optional[str] ➖ N/A
retries Optional[utils.RetryConfig] ➖ Configuration to override the default retry behavior of the client.

Response

models.SandboxAdminServiceRestartSandboxResponse

Errors

Error Type Status Code Content Type
errors.TextqlDefaultError 4XX, 5XX */*

stop

StopSandbox

Example Usage

import os
from textql_sdk import Textql


with Textql(
    api_key=os.getenv("TEXTQL_API_KEY", ""),
) as textql:

    res = textql.sandbox_admin.stop()

    # Handle response
    print(res)

Parameters

Parameter Type Required Description
connect_timeout_ms Optional[float] ➖ N/A
sandbox_id Optional[str] ➖ N/A
retries Optional[utils.RetryConfig] ➖ Configuration to override the default retry behavior of the client.

Response

models.SandboxAdminServiceStopSandboxResponse

Errors

Error Type Status Code Content Type
errors.TextqlDefaultError 4XX, 5XX */*