Skip to content

cloud

konigle.managers.cloud

Managers for BentoCloud resources.

AsyncCloudClient

Async sub-client providing access to all BentoCloud resources.

Accessed via client.cloud on an AsyncClient.

Example
async with konigle.AsyncClient(api_key="...") as client:
    computers = await client.cloud.computers.list()
    computer, job_id = await client.cloud.computers.create(...)

computers = AsyncComputerManager(session) instance-attribute

Async manager for Computer (VM) resources.

jobs = AsyncJobManager(session) instance-attribute

Async manager for async Job resources.

spaces = AsyncSpaceManager(session) instance-attribute

Async manager for Space (uat / production) resources.

webapps = AsyncWebAppManager(session) instance-attribute

Async manager for WebApp resources.

__init__(session)

Initialize async sub-client with all cloud managers.

PARAMETER DESCRIPTION
session

Asynchronous HTTP session from the parent AsyncClient.

TYPE: AsyncSession

AsyncComputerManager

Bases: BaseComputerManager, BaseAsyncManager

Asynchronous manager for BentoCloud Computer resources.

Example
computers = await client.computers.list()
data = ComputerCreate(
    display_name="My Server",
    size="M",
    region="nyc3",
)
computer, job_id = await client.computers.create(data)

__init__(session)

Initialize the AsyncComputerManager.

PARAMETER DESCRIPTION
session

Asynchronous HTTP session.

TYPE: AsyncSession

create(data) async

Provision a new computer VM asynchronously.

PARAMETER DESCRIPTION
data

Computer provisioning parameters.

TYPE: ComputerCreate

RETURNS DESCRIPTION
Tuple[Computer, str]

Tuple of (Computer resource, job_id string).

AsyncJobManager

Bases: BaseJobManager, BaseAsyncManager

Asynchronous manager for BentoCloud Job resources.

Example
job = await client.jobs.get(job_id)
if job.is_terminal:
    print(job.status)

__init__(session)

Initialize the AsyncJobManager.

PARAMETER DESCRIPTION
session

Asynchronous HTTP session.

TYPE: AsyncSession

get(id_) async

Retrieve a job by its UUID.

PARAMETER DESCRIPTION
id_

Job UUID returned by a provisioning or deploy call.

TYPE: str

RETURNS DESCRIPTION
Job

Job with current status and log entries.

AsyncSpaceManager

Bases: BaseSpaceManager, BaseAsyncManager

Asynchronous manager for BentoCloud Space resources.

Example
spaces = await client.spaces.list(webapp_id="456")

with open("app.zip", "rb") as f:
    deployment = await client.spaces.deploy(space_id, f)

deployment = await client.spaces.promote(uat_space_id)

__init__(session)

Initialize the AsyncSpaceManager.

PARAMETER DESCRIPTION
session

Asynchronous HTTP session.

TYPE: AsyncSession

deploy(space_id, zip_file, filename='app.zip', display_name=None) async

Upload a ZIP archive and enqueue a deployment.

PARAMETER DESCRIPTION
space_id

ID of the target Space.

TYPE: str

zip_file

File-like object containing the ZIP archive.

TYPE: Union[BytesIO, RawIOBase]

filename

Filename sent in the multipart request.

TYPE: str DEFAULT: 'app.zip'

display_name

Human-readable label for the deployment.

TYPE: Optional[str] DEFAULT: None

RETURNS DESCRIPTION
Deployment

Deployment resource with an embedded job for polling.

promote(uat_space_id) async

Promote the uat space image to production.

PARAMETER DESCRIPTION
uat_space_id

ID of the uat Space to promote from.

TYPE: str

RETURNS DESCRIPTION
Deployment

Deployment resource with an embedded job for polling.

AsyncWebAppManager

Bases: BaseWebAppManager, BaseAsyncManager

Asynchronous manager for BentoCloud WebApp resources.

Example
webapps = await client.webapps.list(computer_id="123")
data = WebAppCreate(
    computer_id="123",
    name="my-app",
    runtime="python3",
)
webapp, job_id = await client.webapps.create(data)

__init__(session)

Initialize the AsyncWebAppManager.

PARAMETER DESCRIPTION
session

Asynchronous HTTP session.

TYPE: AsyncSession

check_name_availability(name) async

Check whether a webapp name is available.

PARAMETER DESCRIPTION
name

The webapp name slug to check.

TYPE: str

RETURNS DESCRIPTION
bool

True if the name is available, False if already taken.

create(data) async

Create a new web application asynchronously.

PARAMETER DESCRIPTION
data

WebApp creation parameters.

TYPE: WebAppCreate

RETURNS DESCRIPTION
Tuple[WebApp, str]

Tuple of (WebApp resource, job_id string).

CloudClient

Sub-client providing access to all BentoCloud resources.

Accessed via client.cloud.

Example
import konigle
from konigle.models.cloud import ComputerCreate, WebAppCreate

client = konigle.Client(api_key="...")

# List computers
computers = client.cloud.computers.list()

# Provision a computer
computer, job_id = client.cloud.computers.create(
    ComputerCreate(
        display_name="My Server",
        size="M",
        region="nyc3",
    )
)

# Create a webapp
webapp, job_id = client.cloud.webapps.create(
    WebAppCreate(
        computer_id=computer.id,
        name="my-app",
        runtime="python3",
    )
)

# Deploy
spaces = client.cloud.spaces.list(webapp_id=webapp.id)
uat = next(s for s in spaces.payload if s.space_type == "uat")

import io, zipfile
buf = io.BytesIO()
with zipfile.ZipFile(buf, "w") as zf:
    zf.write("app.py")
buf.seek(0)

deployment = client.cloud.spaces.deploy(uat.id, buf)
job = client.cloud.jobs.get(deployment.job_id)

computers = ComputerManager(session) instance-attribute

Manager for Computer (VM) resources.

jobs = JobManager(session) instance-attribute

Manager for async Job resources.

spaces = SpaceManager(session) instance-attribute

Manager for Space (uat / production) resources.

webapps = WebAppManager(session) instance-attribute

Manager for WebApp resources.

__init__(session)

Initialize sub-client with all cloud managers.

PARAMETER DESCRIPTION
session

Synchronous HTTP session from the parent Client.

TYPE: SyncSession

ComputerManager

Bases: BaseComputerManager, BaseSyncManager

Synchronous manager for BentoCloud Computer resources.

Example
computers = client.computers.list()
for c in computers.payload:
    print(c.name, c.status)

data = ComputerCreate(
    display_name="My Server",
    size="M",
    region="nyc3",
)
computer, job_id = client.computers.create(data)

__init__(session)

Initialize the ComputerManager.

PARAMETER DESCRIPTION
session

Synchronous HTTP session.

TYPE: SyncSession

create(data)

Provision a new computer VM.

The operation is asynchronous. Poll the returned job_id via client.jobs.get(job_id) until status reaches success or failed.

PARAMETER DESCRIPTION
data

Computer provisioning parameters.

TYPE: ComputerCreate

RETURNS DESCRIPTION
Tuple[Computer, str]

Tuple of (Computer resource, job_id string).

JobManager

Bases: BaseJobManager, BaseSyncManager

Synchronous manager for BentoCloud Job resources.

Jobs are read-only from the SDK — they are created by service operations like computer provisioning and deployment.

Example
job = client.jobs.get(job_id)
while not job.is_terminal:
    import time; time.sleep(3)
    job = client.jobs.get(job_id)

if job.succeeded:
    print("Done!")
else:
    print("Failed:", job.log)

__init__(session)

Initialize the JobManager.

PARAMETER DESCRIPTION
session

Synchronous HTTP session.

TYPE: SyncSession

get(id_)

Retrieve a job by its UUID.

PARAMETER DESCRIPTION
id_

Job UUID returned by a provisioning or deploy call.

TYPE: str

RETURNS DESCRIPTION
Job

Job with current status and log entries.

SpaceManager

Bases: BaseSpaceManager, BaseSyncManager

Synchronous manager for BentoCloud Space resources.

Example
spaces = client.spaces.list(webapp_id="456")

with open("app.zip", "rb") as f:
    deployment = client.spaces.deploy(space_id, f)

deployment = client.spaces.promote(uat_space_id)

__init__(session)

Initialize the SpaceManager.

PARAMETER DESCRIPTION
session

Synchronous HTTP session.

TYPE: SyncSession

deploy(space_id, zip_file, filename='app.zip', display_name=None)

Upload a ZIP archive and enqueue a deployment.

PARAMETER DESCRIPTION
space_id

ID of the target Space.

TYPE: str

zip_file

File-like object containing the ZIP archive.

TYPE: Union[BytesIO, RawIOBase]

filename

Filename sent in the multipart request.

TYPE: str DEFAULT: 'app.zip'

display_name

Human-readable label for the deployment.

TYPE: Optional[str] DEFAULT: None

RETURNS DESCRIPTION
Deployment

Deployment resource with an embedded job for polling.

promote(uat_space_id)

Promote the uat space image to production.

No re-upload is needed — the currently running image tag is copied directly to the paired production space.

PARAMETER DESCRIPTION
uat_space_id

ID of the uat Space to promote from.

TYPE: str

RETURNS DESCRIPTION
Deployment

Deployment resource with an embedded job for polling.

WebAppManager

Bases: BaseWebAppManager, BaseSyncManager

Synchronous manager for BentoCloud WebApp resources.

Example
webapps = client.webapps.list(computer_id="123")

data = WebAppCreate(
    computer_id="123",
    name="my-app",
    runtime="python3",
)
webapp, job_id = client.webapps.create(data)

__init__(session)

Initialize the WebAppManager.

PARAMETER DESCRIPTION
session

Synchronous HTTP session.

TYPE: SyncSession

check_name_availability(name)

Check whether a webapp name (subdomain) is available.

PARAMETER DESCRIPTION
name

The webapp name slug to check.

TYPE: str

RETURNS DESCRIPTION
bool

True if the name is available, False if already taken.

create(data)

Create a new web application on a computer.

The backend automatically provisions uat and production spaces. The operation is asynchronous — poll the returned job_id to confirm provisioning completes.

PARAMETER DESCRIPTION
data

WebApp creation parameters.

TYPE: WebAppCreate

RETURNS DESCRIPTION
Tuple[WebApp, str]

Tuple of (WebApp resource, job_id string).