runloop_api_client 1.5.1__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (261) hide show
  1. runloop_api_client/__init__.py +95 -0
  2. runloop_api_client/_base_client.py +2127 -0
  3. runloop_api_client/_client.py +866 -0
  4. runloop_api_client/_compat.py +219 -0
  5. runloop_api_client/_constants.py +23 -0
  6. runloop_api_client/_exceptions.py +108 -0
  7. runloop_api_client/_files.py +123 -0
  8. runloop_api_client/_models.py +872 -0
  9. runloop_api_client/_qs.py +150 -0
  10. runloop_api_client/_resource.py +43 -0
  11. runloop_api_client/_response.py +832 -0
  12. runloop_api_client/_streaming.py +518 -0
  13. runloop_api_client/_types.py +270 -0
  14. runloop_api_client/_utils/__init__.py +65 -0
  15. runloop_api_client/_utils/_compat.py +45 -0
  16. runloop_api_client/_utils/_datetime_parse.py +136 -0
  17. runloop_api_client/_utils/_json.py +35 -0
  18. runloop_api_client/_utils/_logs.py +25 -0
  19. runloop_api_client/_utils/_proxy.py +65 -0
  20. runloop_api_client/_utils/_reflection.py +42 -0
  21. runloop_api_client/_utils/_resources_proxy.py +24 -0
  22. runloop_api_client/_utils/_streams.py +12 -0
  23. runloop_api_client/_utils/_sync.py +58 -0
  24. runloop_api_client/_utils/_transform.py +457 -0
  25. runloop_api_client/_utils/_typing.py +156 -0
  26. runloop_api_client/_utils/_utils.py +421 -0
  27. runloop_api_client/_utils/_validation.py +31 -0
  28. runloop_api_client/_version.py +4 -0
  29. runloop_api_client/lib/.keep +4 -0
  30. runloop_api_client/lib/__init__.py +3 -0
  31. runloop_api_client/lib/_ignore.py +496 -0
  32. runloop_api_client/lib/context_loader.py +78 -0
  33. runloop_api_client/lib/polling.py +75 -0
  34. runloop_api_client/lib/polling_async.py +60 -0
  35. runloop_api_client/pagination.py +986 -0
  36. runloop_api_client/py.typed +0 -0
  37. runloop_api_client/resources/__init__.py +173 -0
  38. runloop_api_client/resources/agents.py +431 -0
  39. runloop_api_client/resources/benchmark_jobs.py +394 -0
  40. runloop_api_client/resources/benchmark_runs.py +595 -0
  41. runloop_api_client/resources/benchmarks.py +1085 -0
  42. runloop_api_client/resources/blueprints.py +1563 -0
  43. runloop_api_client/resources/devboxes/__init__.py +89 -0
  44. runloop_api_client/resources/devboxes/browsers.py +267 -0
  45. runloop_api_client/resources/devboxes/computers.py +648 -0
  46. runloop_api_client/resources/devboxes/devboxes.py +3784 -0
  47. runloop_api_client/resources/devboxes/disk_snapshots.py +602 -0
  48. runloop_api_client/resources/devboxes/executions.py +1212 -0
  49. runloop_api_client/resources/devboxes/logs.py +197 -0
  50. runloop_api_client/resources/gateway_configs.py +658 -0
  51. runloop_api_client/resources/network_policies.py +680 -0
  52. runloop_api_client/resources/objects.py +870 -0
  53. runloop_api_client/resources/repositories.py +918 -0
  54. runloop_api_client/resources/scenarios/__init__.py +47 -0
  55. runloop_api_client/resources/scenarios/runs.py +973 -0
  56. runloop_api_client/resources/scenarios/scenarios.py +1101 -0
  57. runloop_api_client/resources/scenarios/scorers.py +629 -0
  58. runloop_api_client/resources/secrets.py +500 -0
  59. runloop_api_client/sdk/__init__.py +117 -0
  60. runloop_api_client/sdk/_helpers.py +49 -0
  61. runloop_api_client/sdk/_types.py +264 -0
  62. runloop_api_client/sdk/agent.py +70 -0
  63. runloop_api_client/sdk/async_.py +1036 -0
  64. runloop_api_client/sdk/async_agent.py +70 -0
  65. runloop_api_client/sdk/async_benchmark.py +169 -0
  66. runloop_api_client/sdk/async_benchmark_run.py +127 -0
  67. runloop_api_client/sdk/async_blueprint.py +104 -0
  68. runloop_api_client/sdk/async_devbox.py +797 -0
  69. runloop_api_client/sdk/async_execution.py +144 -0
  70. runloop_api_client/sdk/async_execution_result.py +175 -0
  71. runloop_api_client/sdk/async_network_policy.py +80 -0
  72. runloop_api_client/sdk/async_scenario.py +118 -0
  73. runloop_api_client/sdk/async_scenario_builder.py +480 -0
  74. runloop_api_client/sdk/async_scenario_run.py +242 -0
  75. runloop_api_client/sdk/async_scorer.py +77 -0
  76. runloop_api_client/sdk/async_snapshot.py +125 -0
  77. runloop_api_client/sdk/async_storage_object.py +188 -0
  78. runloop_api_client/sdk/benchmark.py +167 -0
  79. runloop_api_client/sdk/benchmark_run.py +127 -0
  80. runloop_api_client/sdk/blueprint.py +104 -0
  81. runloop_api_client/sdk/devbox.py +800 -0
  82. runloop_api_client/sdk/execution.py +132 -0
  83. runloop_api_client/sdk/execution_result.py +173 -0
  84. runloop_api_client/sdk/network_policy.py +80 -0
  85. runloop_api_client/sdk/scenario.py +118 -0
  86. runloop_api_client/sdk/scenario_builder.py +480 -0
  87. runloop_api_client/sdk/scenario_run.py +242 -0
  88. runloop_api_client/sdk/scorer.py +77 -0
  89. runloop_api_client/sdk/snapshot.py +125 -0
  90. runloop_api_client/sdk/storage_object.py +188 -0
  91. runloop_api_client/sdk/sync.py +1061 -0
  92. runloop_api_client/types/__init__.py +130 -0
  93. runloop_api_client/types/agent_create_params.py +21 -0
  94. runloop_api_client/types/agent_list_params.py +27 -0
  95. runloop_api_client/types/agent_list_view.py +24 -0
  96. runloop_api_client/types/agent_view.py +30 -0
  97. runloop_api_client/types/benchmark_create_params.py +40 -0
  98. runloop_api_client/types/benchmark_definitions_params.py +15 -0
  99. runloop_api_client/types/benchmark_job_create_params.py +220 -0
  100. runloop_api_client/types/benchmark_job_list_params.py +18 -0
  101. runloop_api_client/types/benchmark_job_list_view.py +19 -0
  102. runloop_api_client/types/benchmark_job_view.py +344 -0
  103. runloop_api_client/types/benchmark_list_params.py +18 -0
  104. runloop_api_client/types/benchmark_list_public_params.py +15 -0
  105. runloop_api_client/types/benchmark_run_list_params.py +21 -0
  106. runloop_api_client/types/benchmark_run_list_scenario_runs_params.py +18 -0
  107. runloop_api_client/types/benchmark_run_list_view.py +19 -0
  108. runloop_api_client/types/benchmark_run_view.py +58 -0
  109. runloop_api_client/types/benchmark_start_run_params.py +29 -0
  110. runloop_api_client/types/benchmark_update_params.py +42 -0
  111. runloop_api_client/types/benchmark_update_scenarios_params.py +18 -0
  112. runloop_api_client/types/benchmark_view.py +49 -0
  113. runloop_api_client/types/blueprint_build_log.py +16 -0
  114. runloop_api_client/types/blueprint_build_logs_list_view.py +16 -0
  115. runloop_api_client/types/blueprint_build_parameters.py +119 -0
  116. runloop_api_client/types/blueprint_create_from_inspection_params.py +49 -0
  117. runloop_api_client/types/blueprint_create_params.py +121 -0
  118. runloop_api_client/types/blueprint_list_params.py +21 -0
  119. runloop_api_client/types/blueprint_list_public_params.py +21 -0
  120. runloop_api_client/types/blueprint_list_view.py +19 -0
  121. runloop_api_client/types/blueprint_preview_params.py +121 -0
  122. runloop_api_client/types/blueprint_preview_view.py +10 -0
  123. runloop_api_client/types/blueprint_view.py +93 -0
  124. runloop_api_client/types/devbox_async_execution_detail_view.py +46 -0
  125. runloop_api_client/types/devbox_create_params.py +124 -0
  126. runloop_api_client/types/devbox_create_ssh_key_response.py +19 -0
  127. runloop_api_client/types/devbox_create_tunnel_params.py +12 -0
  128. runloop_api_client/types/devbox_download_file_params.py +15 -0
  129. runloop_api_client/types/devbox_enable_tunnel_params.py +13 -0
  130. runloop_api_client/types/devbox_execute_async_params.py +33 -0
  131. runloop_api_client/types/devbox_execute_params.py +37 -0
  132. runloop_api_client/types/devbox_execute_sync_params.py +31 -0
  133. runloop_api_client/types/devbox_execution_detail_view.py +24 -0
  134. runloop_api_client/types/devbox_list_disk_snapshots_params.py +32 -0
  135. runloop_api_client/types/devbox_list_params.py +20 -0
  136. runloop_api_client/types/devbox_list_view.py +19 -0
  137. runloop_api_client/types/devbox_read_file_contents_params.py +15 -0
  138. runloop_api_client/types/devbox_read_file_contents_response.py +7 -0
  139. runloop_api_client/types/devbox_remove_tunnel_params.py +12 -0
  140. runloop_api_client/types/devbox_send_std_in_result.py +16 -0
  141. runloop_api_client/types/devbox_snapshot_disk_async_params.py +19 -0
  142. runloop_api_client/types/devbox_snapshot_disk_params.py +19 -0
  143. runloop_api_client/types/devbox_snapshot_list_view.py +19 -0
  144. runloop_api_client/types/devbox_snapshot_view.py +30 -0
  145. runloop_api_client/types/devbox_tunnel_view.py +16 -0
  146. runloop_api_client/types/devbox_update_params.py +16 -0
  147. runloop_api_client/types/devbox_upload_file_params.py +19 -0
  148. runloop_api_client/types/devbox_view.py +121 -0
  149. runloop_api_client/types/devbox_wait_for_command_params.py +28 -0
  150. runloop_api_client/types/devbox_write_file_contents_params.py +18 -0
  151. runloop_api_client/types/devboxes/__init__.py +33 -0
  152. runloop_api_client/types/devboxes/browser_create_params.py +13 -0
  153. runloop_api_client/types/devboxes/browser_view.py +29 -0
  154. runloop_api_client/types/devboxes/computer_create_params.py +26 -0
  155. runloop_api_client/types/devboxes/computer_keyboard_interaction_params.py +16 -0
  156. runloop_api_client/types/devboxes/computer_keyboard_interaction_response.py +15 -0
  157. runloop_api_client/types/devboxes/computer_mouse_interaction_params.py +35 -0
  158. runloop_api_client/types/devboxes/computer_mouse_interaction_response.py +15 -0
  159. runloop_api_client/types/devboxes/computer_screen_interaction_params.py +12 -0
  160. runloop_api_client/types/devboxes/computer_screen_interaction_response.py +15 -0
  161. runloop_api_client/types/devboxes/computer_view.py +23 -0
  162. runloop_api_client/types/devboxes/devbox_logs_list_view.py +39 -0
  163. runloop_api_client/types/devboxes/devbox_snapshot_async_status_view.py +20 -0
  164. runloop_api_client/types/devboxes/disk_snapshot_list_params.py +32 -0
  165. runloop_api_client/types/devboxes/disk_snapshot_update_params.py +19 -0
  166. runloop_api_client/types/devboxes/execution_execute_async_params.py +31 -0
  167. runloop_api_client/types/devboxes/execution_execute_sync_params.py +31 -0
  168. runloop_api_client/types/devboxes/execution_kill_params.py +18 -0
  169. runloop_api_client/types/devboxes/execution_retrieve_params.py +14 -0
  170. runloop_api_client/types/devboxes/execution_send_std_in_params.py +18 -0
  171. runloop_api_client/types/devboxes/execution_stream_stderr_updates_params.py +17 -0
  172. runloop_api_client/types/devboxes/execution_stream_stdout_updates_params.py +17 -0
  173. runloop_api_client/types/devboxes/execution_update_chunk.py +15 -0
  174. runloop_api_client/types/devboxes/log_list_params.py +15 -0
  175. runloop_api_client/types/gateway_config_create_params.py +41 -0
  176. runloop_api_client/types/gateway_config_list_params.py +21 -0
  177. runloop_api_client/types/gateway_config_list_view.py +21 -0
  178. runloop_api_client/types/gateway_config_update_params.py +32 -0
  179. runloop_api_client/types/gateway_config_view.py +47 -0
  180. runloop_api_client/types/input_context.py +19 -0
  181. runloop_api_client/types/input_context_param.py +20 -0
  182. runloop_api_client/types/input_context_update_param.py +16 -0
  183. runloop_api_client/types/inspection_source_param.py +18 -0
  184. runloop_api_client/types/network_policy_create_params.py +40 -0
  185. runloop_api_client/types/network_policy_list_params.py +21 -0
  186. runloop_api_client/types/network_policy_list_view.py +21 -0
  187. runloop_api_client/types/network_policy_update_params.py +30 -0
  188. runloop_api_client/types/network_policy_view.py +52 -0
  189. runloop_api_client/types/object_create_params.py +30 -0
  190. runloop_api_client/types/object_download_params.py +12 -0
  191. runloop_api_client/types/object_download_url_view.py +12 -0
  192. runloop_api_client/types/object_list_params.py +27 -0
  193. runloop_api_client/types/object_list_public_params.py +27 -0
  194. runloop_api_client/types/object_list_view.py +24 -0
  195. runloop_api_client/types/object_view.py +36 -0
  196. runloop_api_client/types/repository_connection_list_view.py +19 -0
  197. runloop_api_client/types/repository_connection_view.py +18 -0
  198. runloop_api_client/types/repository_create_params.py +22 -0
  199. runloop_api_client/types/repository_inspect_params.py +13 -0
  200. runloop_api_client/types/repository_inspection_details.py +83 -0
  201. runloop_api_client/types/repository_inspection_list_view.py +13 -0
  202. runloop_api_client/types/repository_list_params.py +21 -0
  203. runloop_api_client/types/repository_manifest_view.py +174 -0
  204. runloop_api_client/types/repository_refresh_params.py +16 -0
  205. runloop_api_client/types/scenario_create_params.py +53 -0
  206. runloop_api_client/types/scenario_definition_list_view.py +19 -0
  207. runloop_api_client/types/scenario_environment.py +29 -0
  208. runloop_api_client/types/scenario_environment_param.py +31 -0
  209. runloop_api_client/types/scenario_list_params.py +24 -0
  210. runloop_api_client/types/scenario_list_public_params.py +18 -0
  211. runloop_api_client/types/scenario_run_list_view.py +19 -0
  212. runloop_api_client/types/scenario_run_view.py +55 -0
  213. runloop_api_client/types/scenario_start_run_params.py +30 -0
  214. runloop_api_client/types/scenario_update_params.py +49 -0
  215. runloop_api_client/types/scenario_view.py +61 -0
  216. runloop_api_client/types/scenarios/__init__.py +14 -0
  217. runloop_api_client/types/scenarios/run_list_params.py +27 -0
  218. runloop_api_client/types/scenarios/scorer_create_params.py +18 -0
  219. runloop_api_client/types/scenarios/scorer_create_response.py +18 -0
  220. runloop_api_client/types/scenarios/scorer_list_params.py +15 -0
  221. runloop_api_client/types/scenarios/scorer_list_response.py +18 -0
  222. runloop_api_client/types/scenarios/scorer_retrieve_response.py +18 -0
  223. runloop_api_client/types/scenarios/scorer_update_params.py +18 -0
  224. runloop_api_client/types/scenarios/scorer_update_response.py +18 -0
  225. runloop_api_client/types/scenarios/scorer_validate_params.py +17 -0
  226. runloop_api_client/types/scenarios/scorer_validate_response.py +23 -0
  227. runloop_api_client/types/scoring_contract.py +17 -0
  228. runloop_api_client/types/scoring_contract_param.py +19 -0
  229. runloop_api_client/types/scoring_contract_result_view.py +20 -0
  230. runloop_api_client/types/scoring_contract_update_param.py +15 -0
  231. runloop_api_client/types/scoring_function.py +157 -0
  232. runloop_api_client/types/scoring_function_param.py +153 -0
  233. runloop_api_client/types/scoring_function_result_view.py +25 -0
  234. runloop_api_client/types/secret_create_params.py +23 -0
  235. runloop_api_client/types/secret_list_params.py +12 -0
  236. runloop_api_client/types/secret_list_view.py +24 -0
  237. runloop_api_client/types/secret_update_params.py +16 -0
  238. runloop_api_client/types/secret_view.py +26 -0
  239. runloop_api_client/types/shared/__init__.py +10 -0
  240. runloop_api_client/types/shared/after_idle.py +15 -0
  241. runloop_api_client/types/shared/agent_mount.py +31 -0
  242. runloop_api_client/types/shared/agent_source.py +75 -0
  243. runloop_api_client/types/shared/code_mount_parameters.py +24 -0
  244. runloop_api_client/types/shared/launch_parameters.py +86 -0
  245. runloop_api_client/types/shared/mount.py +43 -0
  246. runloop_api_client/types/shared/object_mount.py +21 -0
  247. runloop_api_client/types/shared/run_profile.py +37 -0
  248. runloop_api_client/types/shared_params/__init__.py +10 -0
  249. runloop_api_client/types/shared_params/after_idle.py +15 -0
  250. runloop_api_client/types/shared_params/agent_mount.py +31 -0
  251. runloop_api_client/types/shared_params/agent_source.py +78 -0
  252. runloop_api_client/types/shared_params/code_mount_parameters.py +25 -0
  253. runloop_api_client/types/shared_params/launch_parameters.py +88 -0
  254. runloop_api_client/types/shared_params/mount.py +43 -0
  255. runloop_api_client/types/shared_params/object_mount.py +21 -0
  256. runloop_api_client/types/shared_params/run_profile.py +38 -0
  257. runloop_api_client/types/tunnel_view.py +34 -0
  258. runloop_api_client-1.5.1.dist-info/METADATA +522 -0
  259. runloop_api_client-1.5.1.dist-info/RECORD +261 -0
  260. runloop_api_client-1.5.1.dist-info/WHEEL +4 -0
  261. runloop_api_client-1.5.1.dist-info/licenses/LICENSE +7 -0
@@ -0,0 +1,1563 @@
1
+ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2
+
3
+ from __future__ import annotations
4
+
5
+ from typing import Dict, Iterable, Optional, TypedDict
6
+
7
+ import httpx
8
+
9
+ from ..types import (
10
+ blueprint_list_params,
11
+ blueprint_create_params,
12
+ blueprint_preview_params,
13
+ blueprint_list_public_params,
14
+ blueprint_create_from_inspection_params,
15
+ )
16
+ from .._types import NOT_GIVEN, Body, Omit, Query, Headers, NotGiven, SequenceNotStr, omit, not_given
17
+ from .._utils import is_given, maybe_transform, async_maybe_transform
18
+ from .._compat import cached_property
19
+ from .._resource import SyncAPIResource, AsyncAPIResource
20
+ from .._response import (
21
+ to_raw_response_wrapper,
22
+ to_streamed_response_wrapper,
23
+ async_to_raw_response_wrapper,
24
+ async_to_streamed_response_wrapper,
25
+ )
26
+ from .._constants import FILE_MOUNT_MAX_SIZE_BYTES, FILE_MOUNT_TOTAL_MAX_SIZE_BYTES
27
+ from ..pagination import SyncBlueprintsCursorIDPage, AsyncBlueprintsCursorIDPage
28
+ from .._exceptions import RunloopError
29
+ from ..lib.polling import PollingConfig, poll_until
30
+ from .._base_client import AsyncPaginator, make_request_options
31
+ from ..lib.polling_async import async_poll_until
32
+ from .._utils._validation import ValidationNotification
33
+ from ..types.blueprint_view import BlueprintView
34
+ from ..types.blueprint_preview_view import BlueprintPreviewView
35
+ from ..types.inspection_source_param import InspectionSourceParam
36
+ from ..types.blueprint_build_logs_list_view import BlueprintBuildLogsListView
37
+ from ..types.shared_params.launch_parameters import LaunchParameters
38
+ from ..types.shared_params.code_mount_parameters import CodeMountParameters
39
+
40
+
41
+ # Type for request arguments that combine polling config with additional request options
42
+ class BlueprintRequestArgs(TypedDict, total=False):
43
+ polling_config: PollingConfig | None
44
+ # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
45
+ # The extra values given here take precedence over values defined on the client or passed to this method.
46
+ extra_headers: Headers | None
47
+ extra_query: Query | None
48
+ extra_body: Body | None
49
+ timeout: float | httpx.Timeout | None | NotGiven
50
+
51
+
52
+ __all__ = ["BlueprintsResource", "AsyncBlueprintsResource", "BlueprintRequestArgs"]
53
+
54
+
55
+ def _format_bytes(num_bytes: int) -> str:
56
+ """Format a byte count in a human-friendly way (KB/MB/GB).
57
+
58
+ Uses binary units (1024). Avoids decimals when exact.
59
+ """
60
+ if num_bytes < 1024:
61
+ return f"{num_bytes} bytes"
62
+ for factor, unit in ((1 << 30, "GB"), (1 << 20, "MB"), (1 << 10, "KB")):
63
+ if num_bytes >= factor:
64
+ value = num_bytes / factor
65
+ if float(value).is_integer():
66
+ return f"{int(value)} {unit}"
67
+ return f"{value:.1f} {unit}"
68
+ return f"{num_bytes} bytes"
69
+
70
+
71
+ def _validate_file_mounts(file_mounts: Optional[Dict[str, str]] | Omit) -> ValidationNotification:
72
+ """Validate file_mounts are within size constraints: returns validation failures.
73
+
74
+ Currently enforces a maximum per-file size to avoid server-side issues with
75
+ large inline file contents. Also enforces a maximum total size across all
76
+ file_mounts.
77
+ """
78
+
79
+ note = ValidationNotification()
80
+
81
+ if file_mounts is None or not is_given(file_mounts):
82
+ return note
83
+
84
+ total_size_bytes = 0
85
+ for mount_path, content in file_mounts.items():
86
+ # Measure size in bytes using UTF-8 encoding since payloads are JSON strings
87
+ size_bytes = len(content.encode("utf-8"))
88
+ if size_bytes > FILE_MOUNT_MAX_SIZE_BYTES:
89
+ over = size_bytes - FILE_MOUNT_MAX_SIZE_BYTES
90
+ note.add_error(
91
+ f"file_mount '{mount_path}' is {_format_bytes(over)} over the limit "
92
+ f"({_format_bytes(size_bytes)} / {_format_bytes(FILE_MOUNT_MAX_SIZE_BYTES)}). Use object_mounts instead."
93
+ )
94
+ total_size_bytes += size_bytes
95
+
96
+ if total_size_bytes > FILE_MOUNT_TOTAL_MAX_SIZE_BYTES:
97
+ total_over = total_size_bytes - FILE_MOUNT_TOTAL_MAX_SIZE_BYTES
98
+ note.add_error(
99
+ f"total file_mounts size is {_format_bytes(total_over)} over the limit "
100
+ f"({_format_bytes(total_size_bytes)} / {_format_bytes(FILE_MOUNT_TOTAL_MAX_SIZE_BYTES)}). Use object_mounts instead."
101
+ )
102
+
103
+ return note
104
+
105
+
106
+ class BlueprintsResource(SyncAPIResource):
107
+ @cached_property
108
+ def with_raw_response(self) -> BlueprintsResourceWithRawResponse:
109
+ """
110
+ This property can be used as a prefix for any HTTP method call to return
111
+ the raw response object instead of the parsed content.
112
+
113
+ For more information, see https://www.github.com/runloopai/api-client-python#accessing-raw-response-data-eg-headers
114
+ """
115
+ return BlueprintsResourceWithRawResponse(self)
116
+
117
+ @cached_property
118
+ def with_streaming_response(self) -> BlueprintsResourceWithStreamingResponse:
119
+ """
120
+ An alternative to `.with_raw_response` that doesn't eagerly read the response body.
121
+
122
+ For more information, see https://www.github.com/runloopai/api-client-python#with_streaming_response
123
+ """
124
+ return BlueprintsResourceWithStreamingResponse(self)
125
+
126
+ def create(
127
+ self,
128
+ *,
129
+ name: str,
130
+ base_blueprint_id: Optional[str] | Omit = omit,
131
+ base_blueprint_name: Optional[str] | Omit = omit,
132
+ build_args: Optional[Dict[str, str]] | Omit = omit,
133
+ build_context: Optional[blueprint_create_params.BuildContext] | Omit = omit,
134
+ code_mounts: Optional[Iterable[CodeMountParameters]] | Omit = omit,
135
+ dockerfile: Optional[str] | Omit = omit,
136
+ file_mounts: Optional[Dict[str, str]] | Omit = omit,
137
+ launch_parameters: Optional[LaunchParameters] | Omit = omit,
138
+ metadata: Optional[Dict[str, str]] | Omit = omit,
139
+ network_policy_id: Optional[str] | Omit = omit,
140
+ secrets: Optional[Dict[str, str]] | Omit = omit,
141
+ services: Optional[Iterable[blueprint_create_params.Service]] | Omit = omit,
142
+ system_setup_commands: Optional[SequenceNotStr[str]] | Omit = omit,
143
+ # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
144
+ # The extra values given here take precedence over values defined on the client or passed to this method.
145
+ extra_headers: Headers | None = None,
146
+ extra_query: Query | None = None,
147
+ extra_body: Body | None = None,
148
+ timeout: float | httpx.Timeout | None | NotGiven = not_given,
149
+ idempotency_key: str | None = None,
150
+ ) -> BlueprintView:
151
+ """Starts build of custom defined container Blueprint.
152
+
153
+ The Blueprint will begin in
154
+ the 'provisioning' step and transition to the 'building' step once it is
155
+ selected off the build queue., Upon build complete it will transition to
156
+ 'building_complete' if the build is successful.
157
+
158
+ Args:
159
+ name: Name of the Blueprint.
160
+
161
+ base_blueprint_id: (Optional) ID of previously built blueprint to use as a base blueprint for this
162
+ build.
163
+
164
+ base_blueprint_name: (Optional) Name of previously built blueprint to use as a base blueprint for
165
+ this build. When set, this will load the latest successfully built Blueprint
166
+ with the given name. Only one of (base_blueprint_id, base_blueprint_name) should
167
+ be specified.
168
+
169
+ build_args: (Optional) Arbitrary Docker build args to pass during build.
170
+
171
+ build_context: A build context backed by an Object.
172
+
173
+ code_mounts: A list of code mounts to be included in the Blueprint.
174
+
175
+ dockerfile: Dockerfile contents to be used to build the Blueprint.
176
+
177
+ file_mounts: (Optional) Map of paths and file contents to write before setup.
178
+
179
+ launch_parameters: Parameters to configure your Devbox at launch time.
180
+
181
+ metadata: (Optional) User defined metadata for the Blueprint.
182
+
183
+ network_policy_id: (Optional) ID of the network policy to apply during blueprint build. This
184
+ restricts network access during the build process. This does not affect devboxes
185
+ created from this blueprint; if you want devboxes created from this blueprint to
186
+ inherit the network policy, set the network_policy_id on the blueprint launch
187
+ parameters.
188
+
189
+ secrets: (Optional) Map of mount IDs/environment variable names to secret names. Secrets
190
+ will be available to commands during the build. Secrets are NOT stored in the
191
+ blueprint image. Example: {"DB_PASS": "DATABASE_PASSWORD"} makes the secret
192
+ 'DATABASE_PASSWORD' available as environment variable 'DB_PASS'.
193
+
194
+ services: (Optional) List of containerized services to include in the Blueprint. These
195
+ services will be pre-pulled during the build phase for optimized startup
196
+ performance.
197
+
198
+ system_setup_commands: A list of commands to run to set up your system.
199
+
200
+ extra_headers: Send extra headers
201
+
202
+ extra_query: Add additional query parameters to the request
203
+
204
+ extra_body: Add additional JSON properties to the request
205
+
206
+ timeout: Override the client-level default timeout for this request, in seconds
207
+
208
+ idempotency_key: Specify a custom idempotency key for this request
209
+ """
210
+ note = _validate_file_mounts(file_mounts)
211
+ if note.has_errors():
212
+ raise ValueError(note.error_message())
213
+
214
+ return self._post(
215
+ "/v1/blueprints",
216
+ body=maybe_transform(
217
+ {
218
+ "name": name,
219
+ "base_blueprint_id": base_blueprint_id,
220
+ "base_blueprint_name": base_blueprint_name,
221
+ "build_args": build_args,
222
+ "build_context": build_context,
223
+ "code_mounts": code_mounts,
224
+ "dockerfile": dockerfile,
225
+ "file_mounts": file_mounts,
226
+ "launch_parameters": launch_parameters,
227
+ "metadata": metadata,
228
+ "network_policy_id": network_policy_id,
229
+ "secrets": secrets,
230
+ "services": services,
231
+ "system_setup_commands": system_setup_commands,
232
+ },
233
+ blueprint_create_params.BlueprintCreateParams,
234
+ ),
235
+ options=make_request_options(
236
+ extra_headers=extra_headers,
237
+ extra_query=extra_query,
238
+ extra_body=extra_body,
239
+ timeout=timeout,
240
+ idempotency_key=idempotency_key,
241
+ ),
242
+ cast_to=BlueprintView,
243
+ )
244
+
245
+ def retrieve(
246
+ self,
247
+ id: str,
248
+ *,
249
+ # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
250
+ # The extra values given here take precedence over values defined on the client or passed to this method.
251
+ extra_headers: Headers | None = None,
252
+ extra_query: Query | None = None,
253
+ extra_body: Body | None = None,
254
+ timeout: float | httpx.Timeout | None | NotGiven = not_given,
255
+ ) -> BlueprintView:
256
+ """
257
+ Get the details of a previously created Blueprint including the build status.
258
+
259
+ Args:
260
+ extra_headers: Send extra headers
261
+
262
+ extra_query: Add additional query parameters to the request
263
+
264
+ extra_body: Add additional JSON properties to the request
265
+
266
+ timeout: Override the client-level default timeout for this request, in seconds
267
+ """
268
+ if not id:
269
+ raise ValueError(f"Expected a non-empty value for `id` but received {id!r}")
270
+ return self._get(
271
+ f"/v1/blueprints/{id}",
272
+ options=make_request_options(
273
+ extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
274
+ ),
275
+ cast_to=BlueprintView,
276
+ )
277
+
278
+ def await_build_complete(
279
+ self,
280
+ id: str,
281
+ *,
282
+ polling_config: PollingConfig | None = None,
283
+ # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
284
+ # The extra values given here take precedence over values defined on the client or passed to this method.
285
+ extra_headers: Headers | None = None,
286
+ extra_query: Query | None = None,
287
+ extra_body: Body | None = None,
288
+ timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
289
+ ) -> BlueprintView:
290
+ """Wait for a blueprint to finish building.
291
+
292
+ Args:
293
+ id: The ID of the blueprint to wait for
294
+ polling_config: Optional polling configuration
295
+ extra_headers: Send extra headers
296
+ extra_query: Add additional query parameters to the request
297
+ extra_body: Add additional JSON properties to the request
298
+ timeout: Override the client-level default timeout for this request, in seconds
299
+
300
+ Returns:
301
+ The blueprint in built state
302
+
303
+ Raises:
304
+ PollingTimeout: If polling times out before blueprint is built
305
+ RunloopError: If blueprint enters a non-built terminal state
306
+ """
307
+
308
+ def retrieve_blueprint() -> BlueprintView:
309
+ return self.retrieve(
310
+ id, extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
311
+ )
312
+
313
+ def is_done_building(blueprint: BlueprintView) -> bool:
314
+ return blueprint.status not in ["queued", "building", "provisioning"]
315
+
316
+ blueprint = poll_until(retrieve_blueprint, is_done_building, polling_config)
317
+
318
+ if blueprint.status != "build_complete":
319
+ raise RunloopError(f"Blueprint entered non-built terminal state: {blueprint.status}")
320
+
321
+ return blueprint
322
+
323
+ def create_and_await_build_complete(
324
+ self,
325
+ *,
326
+ name: str,
327
+ base_blueprint_id: Optional[str] | Omit = omit,
328
+ base_blueprint_name: Optional[str] | Omit = omit,
329
+ build_args: Optional[Dict[str, str]] | Omit = omit,
330
+ build_context: Optional[blueprint_create_params.BuildContext] | Omit = omit,
331
+ code_mounts: Optional[Iterable[CodeMountParameters]] | Omit = omit,
332
+ dockerfile: Optional[str] | Omit = omit,
333
+ file_mounts: Optional[Dict[str, str]] | Omit = omit,
334
+ launch_parameters: Optional[LaunchParameters] | Omit = omit,
335
+ metadata: Optional[Dict[str, str]] | Omit = omit,
336
+ network_policy_id: Optional[str] | Omit = omit,
337
+ secrets: Optional[Dict[str, str]] | Omit = omit,
338
+ services: Optional[Iterable[blueprint_create_params.Service]] | Omit = omit,
339
+ system_setup_commands: Optional[SequenceNotStr[str]] | Omit = omit,
340
+ polling_config: PollingConfig | None = None,
341
+ # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
342
+ # The extra values given here take precedence over values defined on the client or passed to this method.
343
+ extra_headers: Headers | None = None,
344
+ extra_query: Query | None = None,
345
+ extra_body: Body | None = None,
346
+ timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
347
+ idempotency_key: str | None = None,
348
+ ) -> BlueprintView:
349
+ """Create a new Blueprint and wait for it to finish building.
350
+
351
+ This is a wrapper around the `create` method that waits for the blueprint to finish building.
352
+
353
+ Args:
354
+ See the `create` method for detailed documentation.
355
+ polling_config: Optional polling configuration
356
+
357
+ Returns:
358
+ The built blueprint
359
+
360
+ Raises:
361
+ PollingTimeout: If polling times out before blueprint is built
362
+ RunloopError: If blueprint enters a non-built terminal state
363
+ """
364
+ # Pass all create_args to the underlying create method
365
+ blueprint = self.create(
366
+ name=name,
367
+ base_blueprint_id=base_blueprint_id,
368
+ base_blueprint_name=base_blueprint_name,
369
+ build_args=build_args,
370
+ build_context=build_context,
371
+ code_mounts=code_mounts,
372
+ dockerfile=dockerfile,
373
+ file_mounts=file_mounts,
374
+ launch_parameters=launch_parameters,
375
+ metadata=metadata,
376
+ network_policy_id=network_policy_id,
377
+ secrets=secrets,
378
+ services=services,
379
+ system_setup_commands=system_setup_commands,
380
+ extra_headers=extra_headers,
381
+ extra_query=extra_query,
382
+ extra_body=extra_body,
383
+ timeout=timeout,
384
+ idempotency_key=idempotency_key,
385
+ )
386
+
387
+ return self.await_build_complete(
388
+ blueprint.id,
389
+ polling_config=polling_config,
390
+ extra_headers=extra_headers,
391
+ extra_query=extra_query,
392
+ extra_body=extra_body,
393
+ timeout=timeout,
394
+ )
395
+
396
+ def list(
397
+ self,
398
+ *,
399
+ limit: int | Omit = omit,
400
+ name: str | Omit = omit,
401
+ starting_after: str | Omit = omit,
402
+ status: str | Omit = omit,
403
+ # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
404
+ # The extra values given here take precedence over values defined on the client or passed to this method.
405
+ extra_headers: Headers | None = None,
406
+ extra_query: Query | None = None,
407
+ extra_body: Body | None = None,
408
+ timeout: float | httpx.Timeout | None | NotGiven = not_given,
409
+ ) -> SyncBlueprintsCursorIDPage[BlueprintView]:
410
+ """
411
+ List all Blueprints or filter by name.
412
+
413
+ Args:
414
+ limit: The limit of items to return. Default is 20. Max is 5000.
415
+
416
+ name: Filter by name
417
+
418
+ starting_after: Load the next page of data starting after the item with the given ID.
419
+
420
+ status: Filter by build status (queued, provisioning, building, failed, build_complete)
421
+
422
+ extra_headers: Send extra headers
423
+
424
+ extra_query: Add additional query parameters to the request
425
+
426
+ extra_body: Add additional JSON properties to the request
427
+
428
+ timeout: Override the client-level default timeout for this request, in seconds
429
+ """
430
+ return self._get_api_list(
431
+ "/v1/blueprints",
432
+ page=SyncBlueprintsCursorIDPage[BlueprintView],
433
+ options=make_request_options(
434
+ extra_headers=extra_headers,
435
+ extra_query=extra_query,
436
+ extra_body=extra_body,
437
+ timeout=timeout,
438
+ query=maybe_transform(
439
+ {
440
+ "limit": limit,
441
+ "name": name,
442
+ "starting_after": starting_after,
443
+ "status": status,
444
+ },
445
+ blueprint_list_params.BlueprintListParams,
446
+ ),
447
+ ),
448
+ model=BlueprintView,
449
+ )
450
+
451
+ def delete(
452
+ self,
453
+ id: str,
454
+ *,
455
+ # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
456
+ # The extra values given here take precedence over values defined on the client or passed to this method.
457
+ extra_headers: Headers | None = None,
458
+ extra_query: Query | None = None,
459
+ extra_body: Body | None = None,
460
+ timeout: float | httpx.Timeout | None | NotGiven = not_given,
461
+ idempotency_key: str | None = None,
462
+ ) -> object:
463
+ """Delete a previously created Blueprint.
464
+
465
+ If a blueprint has dependent snapshots,
466
+ it cannot be deleted. You can find them by querying: GET
467
+ /v1/devboxes/disk_snapshots?source_blueprint_id={blueprint_id}.
468
+
469
+ Args:
470
+ extra_headers: Send extra headers
471
+
472
+ extra_query: Add additional query parameters to the request
473
+
474
+ extra_body: Add additional JSON properties to the request
475
+
476
+ timeout: Override the client-level default timeout for this request, in seconds
477
+
478
+ idempotency_key: Specify a custom idempotency key for this request
479
+ """
480
+ if not id:
481
+ raise ValueError(f"Expected a non-empty value for `id` but received {id!r}")
482
+ return self._post(
483
+ f"/v1/blueprints/{id}/delete",
484
+ options=make_request_options(
485
+ extra_headers=extra_headers,
486
+ extra_query=extra_query,
487
+ extra_body=extra_body,
488
+ timeout=timeout,
489
+ idempotency_key=idempotency_key,
490
+ ),
491
+ cast_to=object,
492
+ )
493
+
494
+ def create_from_inspection(
495
+ self,
496
+ *,
497
+ inspection_source: InspectionSourceParam,
498
+ name: str,
499
+ file_mounts: Optional[Dict[str, str]] | Omit = omit,
500
+ launch_parameters: Optional[LaunchParameters] | Omit = omit,
501
+ metadata: Optional[Dict[str, str]] | Omit = omit,
502
+ network_policy_id: Optional[str] | Omit = omit,
503
+ secrets: Optional[Dict[str, str]] | Omit = omit,
504
+ system_setup_commands: Optional[SequenceNotStr[str]] | Omit = omit,
505
+ # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
506
+ # The extra values given here take precedence over values defined on the client or passed to this method.
507
+ extra_headers: Headers | None = None,
508
+ extra_query: Query | None = None,
509
+ extra_body: Body | None = None,
510
+ timeout: float | httpx.Timeout | None | NotGiven = not_given,
511
+ idempotency_key: str | None = None,
512
+ ) -> BlueprintView:
513
+ """
514
+ Starts build of custom defined container Blueprint using a RepositoryConnection
515
+ Inspection as a source container specification.
516
+
517
+ Args:
518
+ inspection_source: (Optional) Use a RepositoryInspection a source of a Blueprint build. The
519
+ Dockerfile will be automatically created based on the RepositoryInspection
520
+ contents.
521
+
522
+ name: Name of the Blueprint.
523
+
524
+ file_mounts: (Optional) Map of paths and file contents to write before setup.
525
+
526
+ launch_parameters: Parameters to configure your Devbox at launch time.
527
+
528
+ metadata: (Optional) User defined metadata for the Blueprint.
529
+
530
+ network_policy_id: (Optional) ID of the network policy to apply during blueprint build. This
531
+ restricts network access during the build process.
532
+
533
+ secrets: (Optional) Map of mount IDs/environment variable names to secret names. Secrets
534
+ can be used as environment variables in system_setup_commands. Example:
535
+ {"GITHUB_TOKEN": "gh_secret"} makes 'gh_secret' available as GITHUB_TOKEN.
536
+
537
+ system_setup_commands: A list of commands to run to set up your system.
538
+
539
+ extra_headers: Send extra headers
540
+
541
+ extra_query: Add additional query parameters to the request
542
+
543
+ extra_body: Add additional JSON properties to the request
544
+
545
+ timeout: Override the client-level default timeout for this request, in seconds
546
+
547
+ idempotency_key: Specify a custom idempotency key for this request
548
+ """
549
+ return self._post(
550
+ "/v1/blueprints/create_from_inspection",
551
+ body=maybe_transform(
552
+ {
553
+ "inspection_source": inspection_source,
554
+ "name": name,
555
+ "file_mounts": file_mounts,
556
+ "launch_parameters": launch_parameters,
557
+ "metadata": metadata,
558
+ "network_policy_id": network_policy_id,
559
+ "secrets": secrets,
560
+ "system_setup_commands": system_setup_commands,
561
+ },
562
+ blueprint_create_from_inspection_params.BlueprintCreateFromInspectionParams,
563
+ ),
564
+ options=make_request_options(
565
+ extra_headers=extra_headers,
566
+ extra_query=extra_query,
567
+ extra_body=extra_body,
568
+ timeout=timeout,
569
+ idempotency_key=idempotency_key,
570
+ ),
571
+ cast_to=BlueprintView,
572
+ )
573
+
574
+ def list_public(
575
+ self,
576
+ *,
577
+ limit: int | Omit = omit,
578
+ name: str | Omit = omit,
579
+ starting_after: str | Omit = omit,
580
+ status: str | Omit = omit,
581
+ # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
582
+ # The extra values given here take precedence over values defined on the client or passed to this method.
583
+ extra_headers: Headers | None = None,
584
+ extra_query: Query | None = None,
585
+ extra_body: Body | None = None,
586
+ timeout: float | httpx.Timeout | None | NotGiven = not_given,
587
+ ) -> SyncBlueprintsCursorIDPage[BlueprintView]:
588
+ """
589
+ List all public Blueprints that are available to all users.
590
+
591
+ Args:
592
+ limit: The limit of items to return. Default is 20. Max is 5000.
593
+
594
+ name: Filter by name
595
+
596
+ starting_after: Load the next page of data starting after the item with the given ID.
597
+
598
+ status: Filter by build status (queued, provisioning, building, failed, build_complete)
599
+
600
+ extra_headers: Send extra headers
601
+
602
+ extra_query: Add additional query parameters to the request
603
+
604
+ extra_body: Add additional JSON properties to the request
605
+
606
+ timeout: Override the client-level default timeout for this request, in seconds
607
+ """
608
+ return self._get_api_list(
609
+ "/v1/blueprints/list_public",
610
+ page=SyncBlueprintsCursorIDPage[BlueprintView],
611
+ options=make_request_options(
612
+ extra_headers=extra_headers,
613
+ extra_query=extra_query,
614
+ extra_body=extra_body,
615
+ timeout=timeout,
616
+ query=maybe_transform(
617
+ {
618
+ "limit": limit,
619
+ "name": name,
620
+ "starting_after": starting_after,
621
+ "status": status,
622
+ },
623
+ blueprint_list_public_params.BlueprintListPublicParams,
624
+ ),
625
+ ),
626
+ model=BlueprintView,
627
+ )
628
+
629
+ def logs(
630
+ self,
631
+ id: str,
632
+ *,
633
+ # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
634
+ # The extra values given here take precedence over values defined on the client or passed to this method.
635
+ extra_headers: Headers | None = None,
636
+ extra_query: Query | None = None,
637
+ extra_body: Body | None = None,
638
+ timeout: float | httpx.Timeout | None | NotGiven = not_given,
639
+ ) -> BlueprintBuildLogsListView:
640
+ """
641
+ Get all logs from the building of a Blueprint.
642
+
643
+ Args:
644
+ extra_headers: Send extra headers
645
+
646
+ extra_query: Add additional query parameters to the request
647
+
648
+ extra_body: Add additional JSON properties to the request
649
+
650
+ timeout: Override the client-level default timeout for this request, in seconds
651
+ """
652
+ if not id:
653
+ raise ValueError(f"Expected a non-empty value for `id` but received {id!r}")
654
+ return self._get(
655
+ f"/v1/blueprints/{id}/logs",
656
+ options=make_request_options(
657
+ extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
658
+ ),
659
+ cast_to=BlueprintBuildLogsListView,
660
+ )
661
+
662
+ def preview(
663
+ self,
664
+ *,
665
+ name: str,
666
+ base_blueprint_id: Optional[str] | Omit = omit,
667
+ base_blueprint_name: Optional[str] | Omit = omit,
668
+ build_args: Optional[Dict[str, str]] | Omit = omit,
669
+ build_context: Optional[blueprint_preview_params.BuildContext] | Omit = omit,
670
+ code_mounts: Optional[Iterable[CodeMountParameters]] | Omit = omit,
671
+ dockerfile: Optional[str] | Omit = omit,
672
+ file_mounts: Optional[Dict[str, str]] | Omit = omit,
673
+ launch_parameters: Optional[LaunchParameters] | Omit = omit,
674
+ metadata: Optional[Dict[str, str]] | Omit = omit,
675
+ network_policy_id: Optional[str] | Omit = omit,
676
+ secrets: Optional[Dict[str, str]] | Omit = omit,
677
+ services: Optional[Iterable[blueprint_preview_params.Service]] | Omit = omit,
678
+ system_setup_commands: Optional[SequenceNotStr[str]] | Omit = omit,
679
+ # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
680
+ # The extra values given here take precedence over values defined on the client or passed to this method.
681
+ extra_headers: Headers | None = None,
682
+ extra_query: Query | None = None,
683
+ extra_body: Body | None = None,
684
+ timeout: float | httpx.Timeout | None | NotGiven = not_given,
685
+ idempotency_key: str | None = None,
686
+ ) -> BlueprintPreviewView:
687
+ """Preview building a Blueprint with the specified configuration.
688
+
689
+ You can take the
690
+ resulting Dockerfile and test out your build using any local docker tooling.
691
+
692
+ Args:
693
+ name: Name of the Blueprint.
694
+
695
+ base_blueprint_id: (Optional) ID of previously built blueprint to use as a base blueprint for this
696
+ build.
697
+
698
+ base_blueprint_name: (Optional) Name of previously built blueprint to use as a base blueprint for
699
+ this build. When set, this will load the latest successfully built Blueprint
700
+ with the given name. Only one of (base_blueprint_id, base_blueprint_name) should
701
+ be specified.
702
+
703
+ build_args: (Optional) Arbitrary Docker build args to pass during build.
704
+
705
+ build_context: A build context backed by an Object.
706
+
707
+ code_mounts: A list of code mounts to be included in the Blueprint.
708
+
709
+ dockerfile: Dockerfile contents to be used to build the Blueprint.
710
+
711
+ file_mounts: (Optional) Map of paths and file contents to write before setup.
712
+
713
+ launch_parameters: Parameters to configure your Devbox at launch time.
714
+
715
+ metadata: (Optional) User defined metadata for the Blueprint.
716
+
717
+ network_policy_id: (Optional) ID of the network policy to apply during blueprint build. This
718
+ restricts network access during the build process. This does not affect devboxes
719
+ created from this blueprint; if you want devboxes created from this blueprint to
720
+ inherit the network policy, set the network_policy_id on the blueprint launch
721
+ parameters.
722
+
723
+ secrets: (Optional) Map of mount IDs/environment variable names to secret names. Secrets
724
+ will be available to commands during the build. Secrets are NOT stored in the
725
+ blueprint image. Example: {"DB_PASS": "DATABASE_PASSWORD"} makes the secret
726
+ 'DATABASE_PASSWORD' available as environment variable 'DB_PASS'.
727
+
728
+ services: (Optional) List of containerized services to include in the Blueprint. These
729
+ services will be pre-pulled during the build phase for optimized startup
730
+ performance.
731
+
732
+ system_setup_commands: A list of commands to run to set up your system.
733
+
734
+ extra_headers: Send extra headers
735
+
736
+ extra_query: Add additional query parameters to the request
737
+
738
+ extra_body: Add additional JSON properties to the request
739
+
740
+ timeout: Override the client-level default timeout for this request, in seconds
741
+
742
+ idempotency_key: Specify a custom idempotency key for this request
743
+ """
744
+ return self._post(
745
+ "/v1/blueprints/preview",
746
+ body=maybe_transform(
747
+ {
748
+ "name": name,
749
+ "base_blueprint_id": base_blueprint_id,
750
+ "base_blueprint_name": base_blueprint_name,
751
+ "build_args": build_args,
752
+ "build_context": build_context,
753
+ "code_mounts": code_mounts,
754
+ "dockerfile": dockerfile,
755
+ "file_mounts": file_mounts,
756
+ "launch_parameters": launch_parameters,
757
+ "metadata": metadata,
758
+ "network_policy_id": network_policy_id,
759
+ "secrets": secrets,
760
+ "services": services,
761
+ "system_setup_commands": system_setup_commands,
762
+ },
763
+ blueprint_preview_params.BlueprintPreviewParams,
764
+ ),
765
+ options=make_request_options(
766
+ extra_headers=extra_headers,
767
+ extra_query=extra_query,
768
+ extra_body=extra_body,
769
+ timeout=timeout,
770
+ idempotency_key=idempotency_key,
771
+ ),
772
+ cast_to=BlueprintPreviewView,
773
+ )
774
+
775
+
776
+ class AsyncBlueprintsResource(AsyncAPIResource):
777
+ @cached_property
778
+ def with_raw_response(self) -> AsyncBlueprintsResourceWithRawResponse:
779
+ """
780
+ This property can be used as a prefix for any HTTP method call to return
781
+ the raw response object instead of the parsed content.
782
+
783
+ For more information, see https://www.github.com/runloopai/api-client-python#accessing-raw-response-data-eg-headers
784
+ """
785
+ return AsyncBlueprintsResourceWithRawResponse(self)
786
+
787
+ @cached_property
788
+ def with_streaming_response(self) -> AsyncBlueprintsResourceWithStreamingResponse:
789
+ """
790
+ An alternative to `.with_raw_response` that doesn't eagerly read the response body.
791
+
792
+ For more information, see https://www.github.com/runloopai/api-client-python#with_streaming_response
793
+ """
794
+ return AsyncBlueprintsResourceWithStreamingResponse(self)
795
+
796
+ async def create(
797
+ self,
798
+ *,
799
+ name: str,
800
+ base_blueprint_id: Optional[str] | Omit = omit,
801
+ base_blueprint_name: Optional[str] | Omit = omit,
802
+ build_args: Optional[Dict[str, str]] | Omit = omit,
803
+ build_context: Optional[blueprint_create_params.BuildContext] | Omit = omit,
804
+ code_mounts: Optional[Iterable[CodeMountParameters]] | Omit = omit,
805
+ dockerfile: Optional[str] | Omit = omit,
806
+ file_mounts: Optional[Dict[str, str]] | Omit = omit,
807
+ launch_parameters: Optional[LaunchParameters] | Omit = omit,
808
+ metadata: Optional[Dict[str, str]] | Omit = omit,
809
+ network_policy_id: Optional[str] | Omit = omit,
810
+ secrets: Optional[Dict[str, str]] | Omit = omit,
811
+ services: Optional[Iterable[blueprint_create_params.Service]] | Omit = omit,
812
+ system_setup_commands: Optional[SequenceNotStr[str]] | Omit = omit,
813
+ # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
814
+ # The extra values given here take precedence over values defined on the client or passed to this method.
815
+ extra_headers: Headers | None = None,
816
+ extra_query: Query | None = None,
817
+ extra_body: Body | None = None,
818
+ timeout: float | httpx.Timeout | None | NotGiven = not_given,
819
+ idempotency_key: str | None = None,
820
+ ) -> BlueprintView:
821
+ """Starts build of custom defined container Blueprint.
822
+
823
+ The Blueprint will begin in
824
+ the 'provisioning' step and transition to the 'building' step once it is
825
+ selected off the build queue., Upon build complete it will transition to
826
+ 'building_complete' if the build is successful.
827
+
828
+ Args:
829
+ name: Name of the Blueprint.
830
+
831
+ base_blueprint_id: (Optional) ID of previously built blueprint to use as a base blueprint for this
832
+ build.
833
+
834
+ base_blueprint_name: (Optional) Name of previously built blueprint to use as a base blueprint for
835
+ this build. When set, this will load the latest successfully built Blueprint
836
+ with the given name. Only one of (base_blueprint_id, base_blueprint_name) should
837
+ be specified.
838
+
839
+ build_args: (Optional) Arbitrary Docker build args to pass during build.
840
+
841
+ build_context: A build context backed by an Object.
842
+
843
+ code_mounts: A list of code mounts to be included in the Blueprint.
844
+
845
+ dockerfile: Dockerfile contents to be used to build the Blueprint.
846
+
847
+ file_mounts: (Optional) Map of paths and file contents to write before setup.
848
+
849
+ launch_parameters: Parameters to configure your Devbox at launch time.
850
+
851
+ metadata: (Optional) User defined metadata for the Blueprint.
852
+
853
+ network_policy_id: (Optional) ID of the network policy to apply during blueprint build. This
854
+ restricts network access during the build process. This does not affect devboxes
855
+ created from this blueprint; if you want devboxes created from this blueprint to
856
+ inherit the network policy, set the network_policy_id on the blueprint launch
857
+ parameters.
858
+
859
+ secrets: (Optional) Map of mount IDs/environment variable names to secret names. Secrets
860
+ will be available to commands during the build. Secrets are NOT stored in the
861
+ blueprint image. Example: {"DB_PASS": "DATABASE_PASSWORD"} makes the secret
862
+ 'DATABASE_PASSWORD' available as environment variable 'DB_PASS'.
863
+
864
+ services: (Optional) List of containerized services to include in the Blueprint. These
865
+ services will be pre-pulled during the build phase for optimized startup
866
+ performance.
867
+
868
+ system_setup_commands: A list of commands to run to set up your system.
869
+
870
+ extra_headers: Send extra headers
871
+
872
+ extra_query: Add additional query parameters to the request
873
+
874
+ extra_body: Add additional JSON properties to the request
875
+
876
+ timeout: Override the client-level default timeout for this request, in seconds
877
+
878
+ idempotency_key: Specify a custom idempotency key for this request
879
+ """
880
+ note = _validate_file_mounts(file_mounts)
881
+ if note.has_errors():
882
+ raise ValueError(note.error_message())
883
+
884
+ return await self._post(
885
+ "/v1/blueprints",
886
+ body=await async_maybe_transform(
887
+ {
888
+ "name": name,
889
+ "base_blueprint_id": base_blueprint_id,
890
+ "base_blueprint_name": base_blueprint_name,
891
+ "build_args": build_args,
892
+ "build_context": build_context,
893
+ "code_mounts": code_mounts,
894
+ "dockerfile": dockerfile,
895
+ "file_mounts": file_mounts,
896
+ "launch_parameters": launch_parameters,
897
+ "metadata": metadata,
898
+ "network_policy_id": network_policy_id,
899
+ "secrets": secrets,
900
+ "services": services,
901
+ "system_setup_commands": system_setup_commands,
902
+ },
903
+ blueprint_create_params.BlueprintCreateParams,
904
+ ),
905
+ options=make_request_options(
906
+ extra_headers=extra_headers,
907
+ extra_query=extra_query,
908
+ extra_body=extra_body,
909
+ timeout=timeout,
910
+ idempotency_key=idempotency_key,
911
+ ),
912
+ cast_to=BlueprintView,
913
+ )
914
+
915
+ async def retrieve(
916
+ self,
917
+ id: str,
918
+ *,
919
+ # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
920
+ # The extra values given here take precedence over values defined on the client or passed to this method.
921
+ extra_headers: Headers | None = None,
922
+ extra_query: Query | None = None,
923
+ extra_body: Body | None = None,
924
+ timeout: float | httpx.Timeout | None | NotGiven = not_given,
925
+ ) -> BlueprintView:
926
+ """
927
+ Get the details of a previously created Blueprint including the build status.
928
+
929
+ Args:
930
+ extra_headers: Send extra headers
931
+
932
+ extra_query: Add additional query parameters to the request
933
+
934
+ extra_body: Add additional JSON properties to the request
935
+
936
+ timeout: Override the client-level default timeout for this request, in seconds
937
+ """
938
+ if not id:
939
+ raise ValueError(f"Expected a non-empty value for `id` but received {id!r}")
940
+ return await self._get(
941
+ f"/v1/blueprints/{id}",
942
+ options=make_request_options(
943
+ extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
944
+ ),
945
+ cast_to=BlueprintView,
946
+ )
947
+
948
+ async def await_build_complete(
949
+ self,
950
+ id: str,
951
+ *,
952
+ polling_config: PollingConfig | None = None,
953
+ # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
954
+ # The extra values given here take precedence over values defined on the client or passed to this method.
955
+ extra_headers: Headers | None = None,
956
+ extra_query: Query | None = None,
957
+ extra_body: Body | None = None,
958
+ timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
959
+ ) -> BlueprintView:
960
+ """Wait for a blueprint to finish building.
961
+
962
+ Args:
963
+ id: The ID of the blueprint to wait for
964
+ polling_config: Optional polling configuration
965
+ extra_headers: Send extra headers
966
+ extra_query: Add additional query parameters to the request
967
+ extra_body: Add additional JSON properties to the request
968
+ timeout: Override the client-level default timeout for this request, in seconds
969
+
970
+ Returns:
971
+ The blueprint in built state
972
+
973
+ Raises:
974
+ PollingTimeout: If polling times out before blueprint is built
975
+ RunloopError: If blueprint enters a non-built terminal state
976
+ """
977
+
978
+ async def retrieve_blueprint() -> BlueprintView:
979
+ return await self.retrieve(
980
+ id, extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
981
+ )
982
+
983
+ def is_done_building(blueprint: BlueprintView) -> bool:
984
+ return blueprint.status not in ["queued", "building", "provisioning"]
985
+
986
+ blueprint = await async_poll_until(retrieve_blueprint, is_done_building, polling_config)
987
+
988
+ if blueprint.status != "build_complete":
989
+ raise RunloopError(f"Blueprint entered non-built terminal state: {blueprint.status}")
990
+
991
+ return blueprint
992
+
993
+ async def create_and_await_build_complete(
994
+ self,
995
+ *,
996
+ name: str,
997
+ base_blueprint_id: Optional[str] | Omit = omit,
998
+ base_blueprint_name: Optional[str] | Omit = omit,
999
+ build_args: Optional[Dict[str, str]] | Omit = omit,
1000
+ build_context: Optional[blueprint_create_params.BuildContext] | Omit = omit,
1001
+ code_mounts: Optional[Iterable[CodeMountParameters]] | Omit = omit,
1002
+ dockerfile: Optional[str] | Omit = omit,
1003
+ file_mounts: Optional[Dict[str, str]] | Omit = omit,
1004
+ launch_parameters: Optional[LaunchParameters] | Omit = omit,
1005
+ metadata: Optional[Dict[str, str]] | Omit = omit,
1006
+ network_policy_id: Optional[str] | Omit = omit,
1007
+ secrets: Optional[Dict[str, str]] | Omit = omit,
1008
+ services: Optional[Iterable[blueprint_create_params.Service]] | Omit = omit,
1009
+ system_setup_commands: Optional[SequenceNotStr[str]] | Omit = omit,
1010
+ polling_config: PollingConfig | None = None,
1011
+ # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
1012
+ # The extra values given here take precedence over values defined on the client or passed to this method.
1013
+ extra_headers: Headers | None = None,
1014
+ extra_query: Query | None = None,
1015
+ extra_body: Body | None = None,
1016
+ timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
1017
+ idempotency_key: str | None = None,
1018
+ ) -> BlueprintView:
1019
+ """Create a new Blueprint and wait for it to finish building.
1020
+
1021
+ This is a wrapper around the `create` method that waits for the blueprint to finish building.
1022
+
1023
+ Args:
1024
+ See the `create` method for detailed documentation.
1025
+ polling_config: Optional polling configuration
1026
+
1027
+ Returns:
1028
+ The built blueprint
1029
+
1030
+ Raises:
1031
+ PollingTimeout: If polling times out before blueprint is built
1032
+ RunloopError: If blueprint enters a non-built terminal state
1033
+ """
1034
+ # Pass all create_args to the underlying create method
1035
+ blueprint = await self.create(
1036
+ name=name,
1037
+ base_blueprint_id=base_blueprint_id,
1038
+ base_blueprint_name=base_blueprint_name,
1039
+ build_args=build_args,
1040
+ build_context=build_context,
1041
+ code_mounts=code_mounts,
1042
+ dockerfile=dockerfile,
1043
+ file_mounts=file_mounts,
1044
+ launch_parameters=launch_parameters,
1045
+ metadata=metadata,
1046
+ network_policy_id=network_policy_id,
1047
+ secrets=secrets,
1048
+ services=services,
1049
+ system_setup_commands=system_setup_commands,
1050
+ extra_headers=extra_headers,
1051
+ extra_query=extra_query,
1052
+ extra_body=extra_body,
1053
+ timeout=timeout,
1054
+ idempotency_key=idempotency_key,
1055
+ )
1056
+
1057
+ return await self.await_build_complete(
1058
+ blueprint.id,
1059
+ polling_config=polling_config,
1060
+ extra_headers=extra_headers,
1061
+ extra_query=extra_query,
1062
+ extra_body=extra_body,
1063
+ timeout=timeout,
1064
+ )
1065
+
1066
+ def list(
1067
+ self,
1068
+ *,
1069
+ limit: int | Omit = omit,
1070
+ name: str | Omit = omit,
1071
+ starting_after: str | Omit = omit,
1072
+ status: str | Omit = omit,
1073
+ # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
1074
+ # The extra values given here take precedence over values defined on the client or passed to this method.
1075
+ extra_headers: Headers | None = None,
1076
+ extra_query: Query | None = None,
1077
+ extra_body: Body | None = None,
1078
+ timeout: float | httpx.Timeout | None | NotGiven = not_given,
1079
+ ) -> AsyncPaginator[BlueprintView, AsyncBlueprintsCursorIDPage[BlueprintView]]:
1080
+ """
1081
+ List all Blueprints or filter by name.
1082
+
1083
+ Args:
1084
+ limit: The limit of items to return. Default is 20. Max is 5000.
1085
+
1086
+ name: Filter by name
1087
+
1088
+ starting_after: Load the next page of data starting after the item with the given ID.
1089
+
1090
+ status: Filter by build status (queued, provisioning, building, failed, build_complete)
1091
+
1092
+ extra_headers: Send extra headers
1093
+
1094
+ extra_query: Add additional query parameters to the request
1095
+
1096
+ extra_body: Add additional JSON properties to the request
1097
+
1098
+ timeout: Override the client-level default timeout for this request, in seconds
1099
+ """
1100
+ return self._get_api_list(
1101
+ "/v1/blueprints",
1102
+ page=AsyncBlueprintsCursorIDPage[BlueprintView],
1103
+ options=make_request_options(
1104
+ extra_headers=extra_headers,
1105
+ extra_query=extra_query,
1106
+ extra_body=extra_body,
1107
+ timeout=timeout,
1108
+ query=maybe_transform(
1109
+ {
1110
+ "limit": limit,
1111
+ "name": name,
1112
+ "starting_after": starting_after,
1113
+ "status": status,
1114
+ },
1115
+ blueprint_list_params.BlueprintListParams,
1116
+ ),
1117
+ ),
1118
+ model=BlueprintView,
1119
+ )
1120
+
1121
+ async def delete(
1122
+ self,
1123
+ id: str,
1124
+ *,
1125
+ # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
1126
+ # The extra values given here take precedence over values defined on the client or passed to this method.
1127
+ extra_headers: Headers | None = None,
1128
+ extra_query: Query | None = None,
1129
+ extra_body: Body | None = None,
1130
+ timeout: float | httpx.Timeout | None | NotGiven = not_given,
1131
+ idempotency_key: str | None = None,
1132
+ ) -> object:
1133
+ """Delete a previously created Blueprint.
1134
+
1135
+ If a blueprint has dependent snapshots,
1136
+ it cannot be deleted. You can find them by querying: GET
1137
+ /v1/devboxes/disk_snapshots?source_blueprint_id={blueprint_id}.
1138
+
1139
+ Args:
1140
+ extra_headers: Send extra headers
1141
+
1142
+ extra_query: Add additional query parameters to the request
1143
+
1144
+ extra_body: Add additional JSON properties to the request
1145
+
1146
+ timeout: Override the client-level default timeout for this request, in seconds
1147
+
1148
+ idempotency_key: Specify a custom idempotency key for this request
1149
+ """
1150
+ if not id:
1151
+ raise ValueError(f"Expected a non-empty value for `id` but received {id!r}")
1152
+ return await self._post(
1153
+ f"/v1/blueprints/{id}/delete",
1154
+ options=make_request_options(
1155
+ extra_headers=extra_headers,
1156
+ extra_query=extra_query,
1157
+ extra_body=extra_body,
1158
+ timeout=timeout,
1159
+ idempotency_key=idempotency_key,
1160
+ ),
1161
+ cast_to=object,
1162
+ )
1163
+
1164
+ async def create_from_inspection(
1165
+ self,
1166
+ *,
1167
+ inspection_source: InspectionSourceParam,
1168
+ name: str,
1169
+ file_mounts: Optional[Dict[str, str]] | Omit = omit,
1170
+ launch_parameters: Optional[LaunchParameters] | Omit = omit,
1171
+ metadata: Optional[Dict[str, str]] | Omit = omit,
1172
+ network_policy_id: Optional[str] | Omit = omit,
1173
+ secrets: Optional[Dict[str, str]] | Omit = omit,
1174
+ system_setup_commands: Optional[SequenceNotStr[str]] | Omit = omit,
1175
+ # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
1176
+ # The extra values given here take precedence over values defined on the client or passed to this method.
1177
+ extra_headers: Headers | None = None,
1178
+ extra_query: Query | None = None,
1179
+ extra_body: Body | None = None,
1180
+ timeout: float | httpx.Timeout | None | NotGiven = not_given,
1181
+ idempotency_key: str | None = None,
1182
+ ) -> BlueprintView:
1183
+ """
1184
+ Starts build of custom defined container Blueprint using a RepositoryConnection
1185
+ Inspection as a source container specification.
1186
+
1187
+ Args:
1188
+ inspection_source: (Optional) Use a RepositoryInspection a source of a Blueprint build. The
1189
+ Dockerfile will be automatically created based on the RepositoryInspection
1190
+ contents.
1191
+
1192
+ name: Name of the Blueprint.
1193
+
1194
+ file_mounts: (Optional) Map of paths and file contents to write before setup.
1195
+
1196
+ launch_parameters: Parameters to configure your Devbox at launch time.
1197
+
1198
+ metadata: (Optional) User defined metadata for the Blueprint.
1199
+
1200
+ network_policy_id: (Optional) ID of the network policy to apply during blueprint build. This
1201
+ restricts network access during the build process.
1202
+
1203
+ secrets: (Optional) Map of mount IDs/environment variable names to secret names. Secrets
1204
+ can be used as environment variables in system_setup_commands. Example:
1205
+ {"GITHUB_TOKEN": "gh_secret"} makes 'gh_secret' available as GITHUB_TOKEN.
1206
+
1207
+ system_setup_commands: A list of commands to run to set up your system.
1208
+
1209
+ extra_headers: Send extra headers
1210
+
1211
+ extra_query: Add additional query parameters to the request
1212
+
1213
+ extra_body: Add additional JSON properties to the request
1214
+
1215
+ timeout: Override the client-level default timeout for this request, in seconds
1216
+
1217
+ idempotency_key: Specify a custom idempotency key for this request
1218
+ """
1219
+ return await self._post(
1220
+ "/v1/blueprints/create_from_inspection",
1221
+ body=await async_maybe_transform(
1222
+ {
1223
+ "inspection_source": inspection_source,
1224
+ "name": name,
1225
+ "file_mounts": file_mounts,
1226
+ "launch_parameters": launch_parameters,
1227
+ "metadata": metadata,
1228
+ "network_policy_id": network_policy_id,
1229
+ "secrets": secrets,
1230
+ "system_setup_commands": system_setup_commands,
1231
+ },
1232
+ blueprint_create_from_inspection_params.BlueprintCreateFromInspectionParams,
1233
+ ),
1234
+ options=make_request_options(
1235
+ extra_headers=extra_headers,
1236
+ extra_query=extra_query,
1237
+ extra_body=extra_body,
1238
+ timeout=timeout,
1239
+ idempotency_key=idempotency_key,
1240
+ ),
1241
+ cast_to=BlueprintView,
1242
+ )
1243
+
1244
+ def list_public(
1245
+ self,
1246
+ *,
1247
+ limit: int | Omit = omit,
1248
+ name: str | Omit = omit,
1249
+ starting_after: str | Omit = omit,
1250
+ status: str | Omit = omit,
1251
+ # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
1252
+ # The extra values given here take precedence over values defined on the client or passed to this method.
1253
+ extra_headers: Headers | None = None,
1254
+ extra_query: Query | None = None,
1255
+ extra_body: Body | None = None,
1256
+ timeout: float | httpx.Timeout | None | NotGiven = not_given,
1257
+ ) -> AsyncPaginator[BlueprintView, AsyncBlueprintsCursorIDPage[BlueprintView]]:
1258
+ """
1259
+ List all public Blueprints that are available to all users.
1260
+
1261
+ Args:
1262
+ limit: The limit of items to return. Default is 20. Max is 5000.
1263
+
1264
+ name: Filter by name
1265
+
1266
+ starting_after: Load the next page of data starting after the item with the given ID.
1267
+
1268
+ status: Filter by build status (queued, provisioning, building, failed, build_complete)
1269
+
1270
+ extra_headers: Send extra headers
1271
+
1272
+ extra_query: Add additional query parameters to the request
1273
+
1274
+ extra_body: Add additional JSON properties to the request
1275
+
1276
+ timeout: Override the client-level default timeout for this request, in seconds
1277
+ """
1278
+ return self._get_api_list(
1279
+ "/v1/blueprints/list_public",
1280
+ page=AsyncBlueprintsCursorIDPage[BlueprintView],
1281
+ options=make_request_options(
1282
+ extra_headers=extra_headers,
1283
+ extra_query=extra_query,
1284
+ extra_body=extra_body,
1285
+ timeout=timeout,
1286
+ query=maybe_transform(
1287
+ {
1288
+ "limit": limit,
1289
+ "name": name,
1290
+ "starting_after": starting_after,
1291
+ "status": status,
1292
+ },
1293
+ blueprint_list_public_params.BlueprintListPublicParams,
1294
+ ),
1295
+ ),
1296
+ model=BlueprintView,
1297
+ )
1298
+
1299
+ async def logs(
1300
+ self,
1301
+ id: str,
1302
+ *,
1303
+ # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
1304
+ # The extra values given here take precedence over values defined on the client or passed to this method.
1305
+ extra_headers: Headers | None = None,
1306
+ extra_query: Query | None = None,
1307
+ extra_body: Body | None = None,
1308
+ timeout: float | httpx.Timeout | None | NotGiven = not_given,
1309
+ ) -> BlueprintBuildLogsListView:
1310
+ """
1311
+ Get all logs from the building of a Blueprint.
1312
+
1313
+ Args:
1314
+ extra_headers: Send extra headers
1315
+
1316
+ extra_query: Add additional query parameters to the request
1317
+
1318
+ extra_body: Add additional JSON properties to the request
1319
+
1320
+ timeout: Override the client-level default timeout for this request, in seconds
1321
+ """
1322
+ if not id:
1323
+ raise ValueError(f"Expected a non-empty value for `id` but received {id!r}")
1324
+ return await self._get(
1325
+ f"/v1/blueprints/{id}/logs",
1326
+ options=make_request_options(
1327
+ extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
1328
+ ),
1329
+ cast_to=BlueprintBuildLogsListView,
1330
+ )
1331
+
1332
+ async def preview(
1333
+ self,
1334
+ *,
1335
+ name: str,
1336
+ base_blueprint_id: Optional[str] | Omit = omit,
1337
+ base_blueprint_name: Optional[str] | Omit = omit,
1338
+ build_args: Optional[Dict[str, str]] | Omit = omit,
1339
+ build_context: Optional[blueprint_preview_params.BuildContext] | Omit = omit,
1340
+ code_mounts: Optional[Iterable[CodeMountParameters]] | Omit = omit,
1341
+ dockerfile: Optional[str] | Omit = omit,
1342
+ file_mounts: Optional[Dict[str, str]] | Omit = omit,
1343
+ launch_parameters: Optional[LaunchParameters] | Omit = omit,
1344
+ metadata: Optional[Dict[str, str]] | Omit = omit,
1345
+ network_policy_id: Optional[str] | Omit = omit,
1346
+ secrets: Optional[Dict[str, str]] | Omit = omit,
1347
+ services: Optional[Iterable[blueprint_preview_params.Service]] | Omit = omit,
1348
+ system_setup_commands: Optional[SequenceNotStr[str]] | Omit = omit,
1349
+ # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
1350
+ # The extra values given here take precedence over values defined on the client or passed to this method.
1351
+ extra_headers: Headers | None = None,
1352
+ extra_query: Query | None = None,
1353
+ extra_body: Body | None = None,
1354
+ timeout: float | httpx.Timeout | None | NotGiven = not_given,
1355
+ idempotency_key: str | None = None,
1356
+ ) -> BlueprintPreviewView:
1357
+ """Preview building a Blueprint with the specified configuration.
1358
+
1359
+ You can take the
1360
+ resulting Dockerfile and test out your build using any local docker tooling.
1361
+
1362
+ Args:
1363
+ name: Name of the Blueprint.
1364
+
1365
+ base_blueprint_id: (Optional) ID of previously built blueprint to use as a base blueprint for this
1366
+ build.
1367
+
1368
+ base_blueprint_name: (Optional) Name of previously built blueprint to use as a base blueprint for
1369
+ this build. When set, this will load the latest successfully built Blueprint
1370
+ with the given name. Only one of (base_blueprint_id, base_blueprint_name) should
1371
+ be specified.
1372
+
1373
+ build_args: (Optional) Arbitrary Docker build args to pass during build.
1374
+
1375
+ build_context: A build context backed by an Object.
1376
+
1377
+ code_mounts: A list of code mounts to be included in the Blueprint.
1378
+
1379
+ dockerfile: Dockerfile contents to be used to build the Blueprint.
1380
+
1381
+ file_mounts: (Optional) Map of paths and file contents to write before setup.
1382
+
1383
+ launch_parameters: Parameters to configure your Devbox at launch time.
1384
+
1385
+ metadata: (Optional) User defined metadata for the Blueprint.
1386
+
1387
+ network_policy_id: (Optional) ID of the network policy to apply during blueprint build. This
1388
+ restricts network access during the build process. This does not affect devboxes
1389
+ created from this blueprint; if you want devboxes created from this blueprint to
1390
+ inherit the network policy, set the network_policy_id on the blueprint launch
1391
+ parameters.
1392
+
1393
+ secrets: (Optional) Map of mount IDs/environment variable names to secret names. Secrets
1394
+ will be available to commands during the build. Secrets are NOT stored in the
1395
+ blueprint image. Example: {"DB_PASS": "DATABASE_PASSWORD"} makes the secret
1396
+ 'DATABASE_PASSWORD' available as environment variable 'DB_PASS'.
1397
+
1398
+ services: (Optional) List of containerized services to include in the Blueprint. These
1399
+ services will be pre-pulled during the build phase for optimized startup
1400
+ performance.
1401
+
1402
+ system_setup_commands: A list of commands to run to set up your system.
1403
+
1404
+ extra_headers: Send extra headers
1405
+
1406
+ extra_query: Add additional query parameters to the request
1407
+
1408
+ extra_body: Add additional JSON properties to the request
1409
+
1410
+ timeout: Override the client-level default timeout for this request, in seconds
1411
+
1412
+ idempotency_key: Specify a custom idempotency key for this request
1413
+ """
1414
+ return await self._post(
1415
+ "/v1/blueprints/preview",
1416
+ body=await async_maybe_transform(
1417
+ {
1418
+ "name": name,
1419
+ "base_blueprint_id": base_blueprint_id,
1420
+ "base_blueprint_name": base_blueprint_name,
1421
+ "build_args": build_args,
1422
+ "build_context": build_context,
1423
+ "code_mounts": code_mounts,
1424
+ "dockerfile": dockerfile,
1425
+ "file_mounts": file_mounts,
1426
+ "launch_parameters": launch_parameters,
1427
+ "metadata": metadata,
1428
+ "network_policy_id": network_policy_id,
1429
+ "secrets": secrets,
1430
+ "services": services,
1431
+ "system_setup_commands": system_setup_commands,
1432
+ },
1433
+ blueprint_preview_params.BlueprintPreviewParams,
1434
+ ),
1435
+ options=make_request_options(
1436
+ extra_headers=extra_headers,
1437
+ extra_query=extra_query,
1438
+ extra_body=extra_body,
1439
+ timeout=timeout,
1440
+ idempotency_key=idempotency_key,
1441
+ ),
1442
+ cast_to=BlueprintPreviewView,
1443
+ )
1444
+
1445
+
1446
+ class BlueprintsResourceWithRawResponse:
1447
+ def __init__(self, blueprints: BlueprintsResource) -> None:
1448
+ self._blueprints = blueprints
1449
+
1450
+ self.create = to_raw_response_wrapper(
1451
+ blueprints.create,
1452
+ )
1453
+ self.retrieve = to_raw_response_wrapper(
1454
+ blueprints.retrieve,
1455
+ )
1456
+ self.list = to_raw_response_wrapper(
1457
+ blueprints.list,
1458
+ )
1459
+ self.delete = to_raw_response_wrapper(
1460
+ blueprints.delete,
1461
+ )
1462
+ self.create_from_inspection = to_raw_response_wrapper(
1463
+ blueprints.create_from_inspection,
1464
+ )
1465
+ self.list_public = to_raw_response_wrapper(
1466
+ blueprints.list_public,
1467
+ )
1468
+ self.logs = to_raw_response_wrapper(
1469
+ blueprints.logs,
1470
+ )
1471
+ self.preview = to_raw_response_wrapper(
1472
+ blueprints.preview,
1473
+ )
1474
+
1475
+
1476
+ class AsyncBlueprintsResourceWithRawResponse:
1477
+ def __init__(self, blueprints: AsyncBlueprintsResource) -> None:
1478
+ self._blueprints = blueprints
1479
+
1480
+ self.create = async_to_raw_response_wrapper(
1481
+ blueprints.create,
1482
+ )
1483
+ self.retrieve = async_to_raw_response_wrapper(
1484
+ blueprints.retrieve,
1485
+ )
1486
+ self.list = async_to_raw_response_wrapper(
1487
+ blueprints.list,
1488
+ )
1489
+ self.delete = async_to_raw_response_wrapper(
1490
+ blueprints.delete,
1491
+ )
1492
+ self.create_from_inspection = async_to_raw_response_wrapper(
1493
+ blueprints.create_from_inspection,
1494
+ )
1495
+ self.list_public = async_to_raw_response_wrapper(
1496
+ blueprints.list_public,
1497
+ )
1498
+ self.logs = async_to_raw_response_wrapper(
1499
+ blueprints.logs,
1500
+ )
1501
+ self.preview = async_to_raw_response_wrapper(
1502
+ blueprints.preview,
1503
+ )
1504
+
1505
+
1506
+ class BlueprintsResourceWithStreamingResponse:
1507
+ def __init__(self, blueprints: BlueprintsResource) -> None:
1508
+ self._blueprints = blueprints
1509
+
1510
+ self.create = to_streamed_response_wrapper(
1511
+ blueprints.create,
1512
+ )
1513
+ self.retrieve = to_streamed_response_wrapper(
1514
+ blueprints.retrieve,
1515
+ )
1516
+ self.list = to_streamed_response_wrapper(
1517
+ blueprints.list,
1518
+ )
1519
+ self.delete = to_streamed_response_wrapper(
1520
+ blueprints.delete,
1521
+ )
1522
+ self.create_from_inspection = to_streamed_response_wrapper(
1523
+ blueprints.create_from_inspection,
1524
+ )
1525
+ self.list_public = to_streamed_response_wrapper(
1526
+ blueprints.list_public,
1527
+ )
1528
+ self.logs = to_streamed_response_wrapper(
1529
+ blueprints.logs,
1530
+ )
1531
+ self.preview = to_streamed_response_wrapper(
1532
+ blueprints.preview,
1533
+ )
1534
+
1535
+
1536
+ class AsyncBlueprintsResourceWithStreamingResponse:
1537
+ def __init__(self, blueprints: AsyncBlueprintsResource) -> None:
1538
+ self._blueprints = blueprints
1539
+
1540
+ self.create = async_to_streamed_response_wrapper(
1541
+ blueprints.create,
1542
+ )
1543
+ self.retrieve = async_to_streamed_response_wrapper(
1544
+ blueprints.retrieve,
1545
+ )
1546
+ self.list = async_to_streamed_response_wrapper(
1547
+ blueprints.list,
1548
+ )
1549
+ self.delete = async_to_streamed_response_wrapper(
1550
+ blueprints.delete,
1551
+ )
1552
+ self.create_from_inspection = async_to_streamed_response_wrapper(
1553
+ blueprints.create_from_inspection,
1554
+ )
1555
+ self.list_public = async_to_streamed_response_wrapper(
1556
+ blueprints.list_public,
1557
+ )
1558
+ self.logs = async_to_streamed_response_wrapper(
1559
+ blueprints.logs,
1560
+ )
1561
+ self.preview = async_to_streamed_response_wrapper(
1562
+ blueprints.preview,
1563
+ )