Skip to content

Latest commit

 

History

History
398 lines (308 loc) · 9.89 KB

api.md

File metadata and controls

398 lines (308 loc) · 9.89 KB

Dedalus Python API

Complete reference of every operation, grouped by resource. See the README for usage and configuration.

Contents

Setup

import os

from dedalus_sdk import Dedalus

client = Dedalus(
    x_api_key=os.environ.get("DEDALUS_X_API_KEY"),
)

Machines

List machines

Direction Type
Request MachineListParams
page = client.machines.list()

Create machine

Direction Type
Request MachineCreateParams
Response Machine
machine = client.machines.create(
    autosleep="300s",
    memory_mib=4096,
    storage_gib=10,
    vcpu=1,
    idempotency_key="",
)

Get machine

Direction Type
Response MachineRetrieveResponse
machine = client.machines.retrieve(
    machine_id="017f22e2-79b0-7cc3-98c4-dc0c0c07398f",
)

Update machine

Direction Type
Request MachineUpdateParams
Response Machine
machine = client.machines.update(
    machine_id="017f22e2-79b0-7cc3-98c4-dc0c0c07398f",
    idempotency_key="",
)

Destroy machine

Direction Type
Response Machine
machine = client.machines.delete(
    machine_id="017f22e2-79b0-7cc3-98c4-dc0c0c07398f",
    idempotency_key="",
)

Sleep a running machine

Direction Type
Response Machine
machine = client.machines.sleep(
    machine_id="017f22e2-79b0-7cc3-98c4-dc0c0c07398f",
    idempotency_key="",
)

Wake a sleeping machine

Direction Type
Response Machine
machine = client.machines.wake(
    machine_id="017f22e2-79b0-7cc3-98c4-dc0c0c07398f",
    idempotency_key="",
)

Reboot a machine with fresh memory

Checkpoints files and replaces the runtime. The machine ID and filesystem are preserved. RAM, processes, and temporary mounts are cleared. Poll the machine until its phase is running. Retry the same Idempotency-Key after a lost response.

Direction Type
Request MachineRebootParams
Response Machine
machine = client.machines.reboot(
    machine_id="017f22e2-79b0-7cc3-98c4-dc0c0c07398f",
    idempotency_key="",
)

Machines Ssh

List SSH sessions

Direction Type
Request SSHListParams
page = client.machines.ssh.list(
    machine_id="017f22e2-79b0-7cc3-98c4-dc0c0c07398f",
)

Create SSH session

Direction Type
Request SSHCreateParams
Response SSHSession
ssh = client.machines.ssh.create(
    machine_id="017f22e2-79b0-7cc3-98c4-dc0c0c07398f",
    public_key="",
    idempotency_key="",
)

Get SSH session

Direction Type
Response SSHSession
ssh = client.machines.ssh.retrieve(
    machine_id="017f22e2-79b0-7cc3-98c4-dc0c0c07398f",
    session_id="sessionID",
)

Delete SSH session

Direction Type
Response SSHSession
ssh = client.machines.ssh.delete(
    machine_id="017f22e2-79b0-7cc3-98c4-dc0c0c07398f",
    session_id="sessionID",
    idempotency_key="",
)

Machines Executions

List executions

Direction Type
Request ExecutionListParams
page = client.machines.executions.list(
    machine_id="017f22e2-79b0-7cc3-98c4-dc0c0c07398f",
)

Create execution

Direction Type
Request ExecutionCreateParams
Response Execution
execution = client.machines.executions.create(
    machine_id="017f22e2-79b0-7cc3-98c4-dc0c0c07398f",
    command=[""],
    idempotency_key="",
)

Get execution

Direction Type
Response Execution
execution = client.machines.executions.retrieve(
    machine_id="017f22e2-79b0-7cc3-98c4-dc0c0c07398f",
    execution_id="executionID",
)

Delete execution

Direction Type
Response Execution
execution = client.machines.executions.delete(
    machine_id="017f22e2-79b0-7cc3-98c4-dc0c0c07398f",
    execution_id="executionID",
    idempotency_key="",
)

Get execution output

Direction Type
Response ExecutionOutput
execution = client.machines.executions.output(
    machine_id="017f22e2-79b0-7cc3-98c4-dc0c0c07398f",
    execution_id="executionID",
)

List execution events

Direction Type
Request ExecutionEventsParams
page = client.machines.executions.events(
    machine_id="017f22e2-79b0-7cc3-98c4-dc0c0c07398f",
    execution_id="executionID",
)

Machines Executions Logs

Get execution log status
Direction Type
Response Status
log = client.machines.executions.logs.retrieve(
    machine_id="017f22e2-79b0-7cc3-98c4-dc0c0c07398f",
    execution_id="executionID",
)
Reauthorize execution log publication
Direction Type
Response Status
log = client.machines.executions.logs.reauthorize(
    machine_id="017f22e2-79b0-7cc3-98c4-dc0c0c07398f",
    execution_id="executionID",
    idempotency_key="",
)
Create execution log read token
Direction Type
Response ReadToken
log = client.machines.executions.logs.create_token(
    machine_id="017f22e2-79b0-7cc3-98c4-dc0c0c07398f",
    execution_id="executionID",
    idempotency_key="",
)

Machines Autoresizing

Read this machine's RAM autoresizing settings

Direction Type
Response Settings
autoresizing = client.machines.autoresizing.retrieve(
    machine_id="017f22e2-79b0-7cc3-98c4-dc0c0c07398f",
)

Set this machine's RAM autoresizing settings

Direction Type
Request AutoresizingUpdateParams
Response Settings
autoresizing = client.machines.autoresizing.update(
    machine_id="017f22e2-79b0-7cc3-98c4-dc0c0c07398f",
    enabled=False,
    idempotency_key="",
)

Organization

Organization Autoresizing

Read organization RAM autoresizing policy

Direction Type
Response Policy
autoresizing = client.organization.autoresizing.retrieve()

Set organization RAM autoresizing policy

Direction Type
Request AutoresizingUpdateParams
Response Policy
autoresizing = client.organization.autoresizing.update(
    enabled=False,
    idempotency_key="",
)