Skip to content
Merged
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
121 changes: 82 additions & 39 deletions src/runloop_api_client/resources/devboxes/devboxes.py
Original file line number Diff line number Diff line change
Expand Up @@ -426,44 +426,61 @@ def is_done_booting(devbox: DevboxView) -> bool:
def create_and_await_running(
self,
*,
blueprint_id: str | NotGiven = NOT_GIVEN,
blueprint_name: str | NotGiven = NOT_GIVEN,
blueprint_id: Optional[str] | NotGiven = NOT_GIVEN,
blueprint_name: Optional[str] | NotGiven = NOT_GIVEN,
code_mounts: Optional[Iterable[CodeMountParameters]] | NotGiven = NOT_GIVEN,
entrypoint: str | NotGiven = NOT_GIVEN,
environment_variables: Dict[str, str] | NotGiven = NOT_GIVEN,
file_mounts: Dict[str, str] | NotGiven = NOT_GIVEN,
launch_parameters: LaunchParameters | NotGiven = NOT_GIVEN,
metadata: Dict[str, str] | NotGiven = NOT_GIVEN,
name: str | NotGiven = NOT_GIVEN,
prebuilt: str | NotGiven = NOT_GIVEN,
snapshot_id: str | NotGiven = NOT_GIVEN,
entrypoint: Optional[str] | NotGiven = NOT_GIVEN,
environment_variables: Optional[Dict[str, str]] | NotGiven = NOT_GIVEN,
file_mounts: Optional[Dict[str, str]] | NotGiven = NOT_GIVEN,
launch_parameters: Optional[LaunchParameters] | NotGiven = NOT_GIVEN,
metadata: Optional[Dict[str, str]] | NotGiven = NOT_GIVEN,
name: Optional[str] | NotGiven = NOT_GIVEN,
prebuilt: Optional[str] | NotGiven = NOT_GIVEN,
repo_connection_id: Optional[str] | NotGiven = NOT_GIVEN,
secrets: Optional[Dict[str, str]] | NotGiven = NOT_GIVEN,
snapshot_id: Optional[str] | NotGiven = NOT_GIVEN,
polling_config: PollingConfig | None = None,
# 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,
) -> DevboxView:
"""Create a new devbox and wait for it to be in running state.

Args:
blueprint_id: The ID of the blueprint to use
blueprint_name: The name of the blueprint to use
code_mounts: Code mount parameters
entrypoint: The entrypoint command
environment_variables: Environment variables
file_mounts: File mount parameters
launch_parameters: Launch parameters
metadata: Metadata key-value pairs
name: The name of the devbox
prebuilt: The prebuilt image to use
snapshot_id: The ID of the snapshot to restore from
blueprint_id: Blueprint ID to use for the Devbox. If none set, the Devbox will be created with
the default Runloop Devbox image. Only one of (Snapshot ID, Blueprint ID,
Blueprint name) should be specified.
blueprint_name: Name of Blueprint to use for the Devbox. When set, this will load the latest
successfully built Blueprint with the given name. Only one of (Snapshot ID,
Blueprint ID, Blueprint name) should be specified.
code_mounts: A list of code mounts to be included in the Devbox.
entrypoint: (Optional) When specified, the Devbox will run this script as its main
executable. The devbox lifecycle will be bound to entrypoint, shutting down when
the process is complete.
environment_variables: (Optional) Environment variables used to configure your Devbox.
file_mounts: (Optional) Map of paths and file contents to write before setup.
launch_parameters: Parameters to configure the resources and launch time behavior of the Devbox.
metadata: User defined metadata to attach to the devbox for organization.
name: (Optional) A user specified name to give the Devbox.
prebuilt: Reference to prebuilt Blueprint to create the Devbox from. Should not be used
together with (Snapshot ID, Blueprint ID, or Blueprint name).
repo_connection_id: Repository connection id the devbox should source its base image from.
secrets: (Optional) Map of environment variable names to secret names. The secret values
will be securely injected as environment variables in the Devbox. Example:
{"DB_PASS": "DATABASE_PASSWORD"} sets environment variable 'DB_PASS' to the
value of secret 'DATABASE_PASSWORD'.
snapshot_id: Snapshot ID to use for the Devbox. Only one of (Snapshot ID, Blueprint ID,
Blueprint name) should be specified.
polling_config: Optional polling configuration
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

Returns:
The devbox in running state
Expand All @@ -483,11 +500,14 @@ def create_and_await_running(
metadata=metadata,
name=name,
prebuilt=prebuilt,
repo_connection_id=repo_connection_id,
secrets=secrets,
snapshot_id=snapshot_id,
extra_headers=extra_headers,
extra_query=extra_query,
extra_body=extra_body,
timeout=timeout,
idempotency_key=idempotency_key,
)

return self.await_running(
Expand Down Expand Up @@ -1592,41 +1612,61 @@ async def retrieve(
async def create_and_await_running(
self,
*,
blueprint_id: str | NotGiven = NOT_GIVEN,
blueprint_name: str | NotGiven = NOT_GIVEN,
blueprint_id: Optional[str] | NotGiven = NOT_GIVEN,
blueprint_name: Optional[str] | NotGiven = NOT_GIVEN,
code_mounts: Optional[Iterable[CodeMountParameters]] | NotGiven = NOT_GIVEN,
entrypoint: str | NotGiven = NOT_GIVEN,
environment_variables: Dict[str, str] | NotGiven = NOT_GIVEN,
file_mounts: Dict[str, str] | NotGiven = NOT_GIVEN,
launch_parameters: LaunchParameters | NotGiven = NOT_GIVEN,
metadata: Dict[str, str] | NotGiven = NOT_GIVEN,
name: str | NotGiven = NOT_GIVEN,
prebuilt: str | NotGiven = NOT_GIVEN,
snapshot_id: str | NotGiven = NOT_GIVEN,
entrypoint: Optional[str] | NotGiven = NOT_GIVEN,
environment_variables: Optional[Dict[str, str]] | NotGiven = NOT_GIVEN,
file_mounts: Optional[Dict[str, str]] | NotGiven = NOT_GIVEN,
launch_parameters: Optional[LaunchParameters] | NotGiven = NOT_GIVEN,
metadata: Optional[Dict[str, str]] | NotGiven = NOT_GIVEN,
name: Optional[str] | NotGiven = NOT_GIVEN,
prebuilt: Optional[str] | NotGiven = NOT_GIVEN,
repo_connection_id: Optional[str] | NotGiven = NOT_GIVEN,
secrets: Optional[Dict[str, str]] | NotGiven = NOT_GIVEN,
snapshot_id: Optional[str] | NotGiven = NOT_GIVEN,
polling_config: PollingConfig | None = None,
# 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,
) -> DevboxView:
"""Create a devbox and wait for it to be in running state.

Args:
code_mount_parameters: Parameters for mounting code into the devbox
environment_variables: Environment variables to set in the devbox
file_mounts: Files to mount into the devbox
launch_parameters: Parameters for launching the devbox
metadata: Metadata to attach to the devbox
name: Name of the devbox
prebuilt: Whether to use a prebuilt image
snapshot_id: ID of snapshot to create devbox from
blueprint_id: Blueprint ID to use for the Devbox. If none set, the Devbox will be created with
the default Runloop Devbox image. Only one of (Snapshot ID, Blueprint ID,
Blueprint name) should be specified.
blueprint_name: Name of Blueprint to use for the Devbox. When set, this will load the latest
successfully built Blueprint with the given name. Only one of (Snapshot ID,
Blueprint ID, Blueprint name) should be specified.
code_mounts: A list of code mounts to be included in the Devbox.
entrypoint: (Optional) When specified, the Devbox will run this script as its main
executable. The devbox lifecycle will be bound to entrypoint, shutting down when
the process is complete.
environment_variables: (Optional) Environment variables used to configure your Devbox.
file_mounts: (Optional) Map of paths and file contents to write before setup.
launch_parameters: Parameters to configure the resources and launch time behavior of the Devbox.
metadata: User defined metadata to attach to the devbox for organization.
name: (Optional) A user specified name to give the Devbox.
prebuilt: Reference to prebuilt Blueprint to create the Devbox from. Should not be used
together with (Snapshot ID, Blueprint ID, or Blueprint name).
repo_connection_id: Repository connection id the devbox should source its base image from.
secrets: (Optional) Map of environment variable names to secret names. The secret values
will be securely injected as environment variables in the Devbox. Example:
{"DB_PASS": "DATABASE_PASSWORD"} sets environment variable 'DB_PASS' to the
value of secret 'DATABASE_PASSWORD'.
snapshot_id: Snapshot ID to use for the Devbox. Only one of (Snapshot ID, Blueprint ID,
Blueprint name) should be specified.
polling_config: Optional polling configuration
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

Returns:
The devbox in running state
Expand All @@ -1646,11 +1686,14 @@ async def create_and_await_running(
metadata=metadata,
name=name,
prebuilt=prebuilt,
repo_connection_id=repo_connection_id,
secrets=secrets,
snapshot_id=snapshot_id,
extra_headers=extra_headers,
extra_query=extra_query,
extra_body=extra_body,
timeout=timeout,
idempotency_key=idempotency_key,
)

return await self.await_running(
Expand Down
Loading