Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
140 changes: 134 additions & 6 deletions src/runloop_api_client/resources/blueprints.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
blueprint_list_params,
blueprint_create_params,
blueprint_preview_params,
blueprint_register_params,
blueprint_list_public_params,
)
from .._types import NOT_GIVEN, Body, Omit, Query, Headers, NotGiven, SequenceNotStr, omit, not_given
Expand All @@ -31,6 +32,7 @@
from ..lib.polling_async import async_poll_until
from .._utils._validation import ValidationNotification
from ..types.blueprint_view import BlueprintView
from ..types.blueprint_upload_view import BlueprintUploadView
from ..types.blueprint_preview_view import BlueprintPreviewView
from ..types.blueprint_build_logs_list_view import BlueprintBuildLogsListView
from ..types.shared_params.launch_parameters import LaunchParameters
Expand Down Expand Up @@ -243,6 +245,63 @@ def create(
cast_to=BlueprintView,
)

def register(
self,
*,
name: str,
launch_parameters: Optional[LaunchParameters] | Omit = omit,
metadata: Optional[Dict[str, str]] | Omit = omit,
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
# The extra values given here take precedence over values defined on the client or passed to this method.
extra_headers: Headers | None = None,
extra_query: Query | None = None,
extra_body: Body | None = None,
timeout: float | httpx.Timeout | None | NotGiven = not_given,
idempotency_key: str | None = None,
) -> BlueprintUploadView:
"""Create a private Blueprint awaiting its image to be pushed out-of-band via docker push.

Bypasses the build pipeline entirely: no Dockerfile is composed and no image is
built. The Blueprint stays in the 'awaiting_upload' step until the push
completes.

Args:
name: Name of the Blueprint.

launch_parameters: Parameters to configure your Devbox at launch time.

metadata: (Optional) User defined metadata for the Blueprint.

extra_headers: Send extra headers

extra_query: Add additional query parameters to the request

extra_body: Add additional JSON properties to the request

timeout: Override the client-level default timeout for this request, in seconds

idempotency_key: Specify a custom idempotency key for this request
"""
return self._post(
"/v1/blueprints/register",
body=maybe_transform(
{
"name": name,
"launch_parameters": launch_parameters,
"metadata": metadata,
},
blueprint_register_params.BlueprintRegisterParams,
),
options=make_request_options(
extra_headers=extra_headers,
extra_query=extra_query,
extra_body=extra_body,
timeout=timeout,
idempotency_key=idempotency_key,
),
cast_to=BlueprintUploadView,
)

def retrieve(
self,
id: str,
Expand Down Expand Up @@ -312,7 +371,7 @@ def retrieve_blueprint() -> BlueprintView:
)

def is_done_building(blueprint: BlueprintView) -> bool:
return blueprint.status not in ["queued", "building", "provisioning"]
return blueprint.status not in ["queued", "building", "provisioning", "awaiting_upload"]

blueprint = poll_until(retrieve_blueprint, is_done_building, polling_config)

Expand Down Expand Up @@ -422,7 +481,7 @@ def list(

starting_after: Load the next page of data starting after the item with the given ID.

status: Filter by build status (queued, provisioning, building, failed, build_complete)
status: Filter by build status (queued, provisioning, building, awaiting_upload, failed, build_complete)

extra_headers: Send extra headers

Expand Down Expand Up @@ -525,7 +584,7 @@ def list_public(

starting_after: Load the next page of data starting after the item with the given ID.

status: Filter by build status (queued, provisioning, building, failed, build_complete)
status: Filter by build status (queued, provisioning, building, awaiting_upload, failed, build_complete)

extra_headers: Send extra headers

Expand Down Expand Up @@ -848,6 +907,63 @@ async def create(
cast_to=BlueprintView,
)

async def register(
self,
*,
name: str,
launch_parameters: Optional[LaunchParameters] | Omit = omit,
metadata: Optional[Dict[str, str]] | Omit = omit,
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
# The extra values given here take precedence over values defined on the client or passed to this method.
extra_headers: Headers | None = None,
extra_query: Query | None = None,
extra_body: Body | None = None,
timeout: float | httpx.Timeout | None | NotGiven = not_given,
idempotency_key: str | None = None,
) -> BlueprintUploadView:
"""Create a private Blueprint awaiting its image to be pushed out-of-band via docker push.

Bypasses the build pipeline entirely: no Dockerfile is composed and no image is
built. The Blueprint stays in the 'awaiting_upload' step until the push
completes.

Args:
name: Name of the Blueprint.

launch_parameters: Parameters to configure your Devbox at launch time.

metadata: (Optional) User defined metadata for the Blueprint.

extra_headers: Send extra headers

extra_query: Add additional query parameters to the request

extra_body: Add additional JSON properties to the request

timeout: Override the client-level default timeout for this request, in seconds

idempotency_key: Specify a custom idempotency key for this request
"""
return await self._post(
"/v1/blueprints/register",
body=await async_maybe_transform(
{
"name": name,
"launch_parameters": launch_parameters,
"metadata": metadata,
},
blueprint_register_params.BlueprintRegisterParams,
),
options=make_request_options(
extra_headers=extra_headers,
extra_query=extra_query,
extra_body=extra_body,
timeout=timeout,
idempotency_key=idempotency_key,
),
cast_to=BlueprintUploadView,
)

async def retrieve(
self,
id: str,
Expand Down Expand Up @@ -917,7 +1033,7 @@ async def retrieve_blueprint() -> BlueprintView:
)

def is_done_building(blueprint: BlueprintView) -> bool:
return blueprint.status not in ["queued", "building", "provisioning"]
return blueprint.status not in ["queued", "building", "provisioning", "awaiting_upload"]

blueprint = await async_poll_until(retrieve_blueprint, is_done_building, polling_config)

Expand Down Expand Up @@ -1027,7 +1143,7 @@ def list(

starting_after: Load the next page of data starting after the item with the given ID.

status: Filter by build status (queued, provisioning, building, failed, build_complete)
status: Filter by build status (queued, provisioning, building, awaiting_upload, failed, build_complete)

extra_headers: Send extra headers

Expand Down Expand Up @@ -1130,7 +1246,7 @@ def list_public(

starting_after: Load the next page of data starting after the item with the given ID.

status: Filter by build status (queued, provisioning, building, failed, build_complete)
status: Filter by build status (queued, provisioning, building, awaiting_upload, failed, build_complete)

extra_headers: Send extra headers

Expand Down Expand Up @@ -1319,6 +1435,9 @@ def __init__(self, blueprints: BlueprintsResource) -> None:
self.create = to_raw_response_wrapper(
blueprints.create,
)
self.register = to_raw_response_wrapper(
blueprints.register,
)
self.retrieve = to_raw_response_wrapper(
blueprints.retrieve,
)
Expand Down Expand Up @@ -1348,6 +1467,9 @@ def __init__(self, blueprints: AsyncBlueprintsResource) -> None:
self.create = async_to_raw_response_wrapper(
blueprints.create,
)
self.register = async_to_raw_response_wrapper(
blueprints.register,
)
self.retrieve = async_to_raw_response_wrapper(
blueprints.retrieve,
)
Expand Down Expand Up @@ -1377,6 +1499,9 @@ def __init__(self, blueprints: BlueprintsResource) -> None:
self.create = to_streamed_response_wrapper(
blueprints.create,
)
self.register = to_streamed_response_wrapper(
blueprints.register,
)
self.retrieve = to_streamed_response_wrapper(
blueprints.retrieve,
)
Expand Down Expand Up @@ -1406,6 +1531,9 @@ def __init__(self, blueprints: AsyncBlueprintsResource) -> None:
self.create = async_to_streamed_response_wrapper(
blueprints.create,
)
self.register = async_to_streamed_response_wrapper(
blueprints.register,
)
self.retrieve = async_to_streamed_response_wrapper(
blueprints.retrieve,
)
Expand Down
2 changes: 2 additions & 0 deletions src/runloop_api_client/types/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,7 @@
from .secret_update_params import SecretUpdateParams as SecretUpdateParams
from .benchmark_list_params import BenchmarkListParams as BenchmarkListParams
from .blueprint_list_params import BlueprintListParams as BlueprintListParams
from .blueprint_upload_view import BlueprintUploadView as BlueprintUploadView
from .devbox_execute_params import DevboxExecuteParams as DevboxExecuteParams
from .blueprint_preview_view import BlueprintPreviewView as BlueprintPreviewView
from .devbox_shutdown_params import DevboxShutdownParams as DevboxShutdownParams
Expand Down Expand Up @@ -103,6 +104,7 @@
from .axon_subscribe_sse_params import AxonSubscribeSseParams as AxonSubscribeSseParams
from .benchmark_job_list_params import BenchmarkJobListParams as BenchmarkJobListParams
from .benchmark_run_list_params import BenchmarkRunListParams as BenchmarkRunListParams
from .blueprint_register_params import BlueprintRegisterParams as BlueprintRegisterParams
from .devbox_send_std_in_result import DevboxSendStdInResult as DevboxSendStdInResult
from .devbox_snapshot_list_view import DevboxSnapshotListView as DevboxSnapshotListView
from .devbox_upload_file_params import DevboxUploadFileParams as DevboxUploadFileParams
Expand Down
2 changes: 1 addition & 1 deletion src/runloop_api_client/types/blueprint_list_params.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,4 +24,4 @@ class BlueprintListParams(TypedDict, total=False):
"""Load the next page of data starting after the item with the given ID."""

status: str
"""Filter by build status (queued, provisioning, building, failed, build_complete)"""
"""Filter by build status (queued, provisioning, building, awaiting_upload, failed, build_complete)"""
Original file line number Diff line number Diff line change
Expand Up @@ -24,4 +24,4 @@ class BlueprintListPublicParams(TypedDict, total=False):
"""Load the next page of data starting after the item with the given ID."""

status: str
"""Filter by build status (queued, provisioning, building, failed, build_complete)"""
"""Filter by build status (queued, provisioning, building, awaiting_upload, failed, build_complete)"""
21 changes: 21 additions & 0 deletions src/runloop_api_client/types/blueprint_register_params.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.

from __future__ import annotations

from typing import Dict, Optional
from typing_extensions import Required, TypedDict

from .shared_params.launch_parameters import LaunchParameters

__all__ = ["BlueprintRegisterParams"]


class BlueprintRegisterParams(TypedDict, total=False):
name: Required[str]
"""Name of the Blueprint."""

launch_parameters: Optional[LaunchParameters]
"""Parameters to configure your Devbox at launch time."""

metadata: Optional[Dict[str, str]]
"""(Optional) User defined metadata for the Blueprint."""
14 changes: 14 additions & 0 deletions src/runloop_api_client/types/blueprint_upload_view.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.

from .._models import BaseModel
from .blueprint_view import BlueprintView

__all__ = ["BlueprintUploadView"]


class BlueprintUploadView(BaseModel):
blueprint: BlueprintView
"""The created Blueprint, awaiting its image upload."""

push_reference: str
"""The reference to push the image to, e.g. via docker push."""
2 changes: 1 addition & 1 deletion src/runloop_api_client/types/blueprint_view.py
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ class BlueprintView(BaseModel):
state: Literal["created", "deleted"]
"""The state of the Blueprint."""

status: Literal["queued", "provisioning", "building", "failed", "build_complete"]
status: Literal["queued", "provisioning", "building", "awaiting_upload", "failed", "build_complete"]
"""The status of the Blueprint build."""

base_blueprint_id: Optional[str] = None
Expand Down
Loading