Skip to content

feat: sync SDK to current API (proxies, instance sizing, renew) - #3

Merged
czpython merged 1 commit into
mainfrom
feat/http-proxies
Jul 9, 2026
Merged

czpython merged 1 commit into
mainfrom
feat/http-proxies

Conversation

@czpython

@czpython czpython commented Jul 9, 2026 •

Copy link
Copy Markdown
Owner

What

Brings the client up to the current Drukbox HTTP API. Three parts of the surface weren't covered yet.

HTTP proxies

  • create_http_proxy(*, name, target, headers) → HTTPProxy
  • delete_http_proxy(name)
  • attach_http_proxy(name, host_id) → HTTPProxyAttachment
  • detach_http_proxy(name, host_id)
  • New records: HTTPProxy, HTTPProxyAttachment

Instance sizing

  • create_host(instance_type=..., disk_gb=...)
  • SandboxHost.instance_type / .disk_gb

Lease renewal

  • renew_host(host_id, expires_at=...) → POST /hosts/{id}/renew, returns the updated SandboxHost
  • create_host now mirrors the wire tri-state for expires_at: omit it for the default lease, pass a datetime for an explicit expiry, pass None for a permanent (never-reaped) host. A private sentinel default distinguishes "omitted" from "passed None" — a plain datetime | None default can't.

No new exceptions

Every new error path reuses status codes the _request classifier already handles:

Path Status SDK error
proxy exists / host has no backing VM / host not renewable 409 SandboxConflictError
unknown proxy / host 404 SandboxNotFoundError
bad proxy target, empty headers, past expires_at 422 SandboxValidationError
unknown provider, unsupported sizing 400 SandboxResponseError
provider proxy failure 503 SandboxUnavailableError

Internal cleanup

Removed the parser-per-type layer (previously five _parse_* functions). Records are now constructed inline with cls(**data) — no helper, no generic. Dropped the "ignore unknown server fields" behavior: the SDK is co-versioned with the service, so an added field is handled by updating the SDK.

Tests

Net new respx coverage: proxy happy paths + conflict/not-found/validation; sizing round-trip; permanent-host explicit-null; renew happy path, omit-body, 404, 409. Full suite 42 passed; ruff + pyright clean.

@czpython czpython changed the title feat: HTTP proxy client (create/delete/attach/detach) feat: sync SDK to current API (proxies, instance sizing, renew) Jul 9, 2026
@czpython
czpython force-pushed the feat/http-proxies branch 3 times, most recently from e7c4fda to 8a87c8f Compare July 9, 2026 07:22
Bring the client up to the current Drukbox HTTP API:

- HTTP proxies: create/delete/attach/detach_http_proxy plus HTTPProxy and
  HTTPProxyAttachment records
- Instance sizing: create_host(instance_type=, disk_gb=) and the matching
  SandboxHost fields
- Lease renewal: renew_host() for POST /hosts/{id}/renew
- expires_at now mirrors the wire tri-state: omit for the default lease,
  pass a datetime for an explicit expiry, pass None for a permanent host

Records are constructed inline (cls(**data)) — no parser-per-type layer,
no generic builder. New error paths reuse the existing status classifier,
so no new exception types.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@czpython
czpython force-pushed the feat/http-proxies branch from 8a87c8f to 6d1f5fd Compare July 9, 2026 07:27
@czpython
czpython merged commit d3e7542 into main Jul 9, 2026
1 check passed
@czpython
czpython deleted the feat/http-proxies branch July 9, 2026 13:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant