runloop_api_client 0.61.0__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 (187) hide show
  1. runloop_api_client/__init__.py +92 -0
  2. runloop_api_client/_base_client.py +1995 -0
  3. runloop_api_client/_client.py +668 -0
  4. runloop_api_client/_compat.py +219 -0
  5. runloop_api_client/_constants.py +14 -0
  6. runloop_api_client/_exceptions.py +108 -0
  7. runloop_api_client/_files.py +123 -0
  8. runloop_api_client/_models.py +835 -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 +520 -0
  13. runloop_api_client/_types.py +260 -0
  14. runloop_api_client/_utils/__init__.py +64 -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/_logs.py +25 -0
  18. runloop_api_client/_utils/_proxy.py +65 -0
  19. runloop_api_client/_utils/_reflection.py +42 -0
  20. runloop_api_client/_utils/_resources_proxy.py +24 -0
  21. runloop_api_client/_utils/_streams.py +12 -0
  22. runloop_api_client/_utils/_sync.py +86 -0
  23. runloop_api_client/_utils/_transform.py +457 -0
  24. runloop_api_client/_utils/_typing.py +156 -0
  25. runloop_api_client/_utils/_utils.py +421 -0
  26. runloop_api_client/_version.py +4 -0
  27. runloop_api_client/lib/.keep +4 -0
  28. runloop_api_client/lib/polling.py +75 -0
  29. runloop_api_client/lib/polling_async.py +60 -0
  30. runloop_api_client/pagination.py +761 -0
  31. runloop_api_client/py.typed +0 -0
  32. runloop_api_client/resources/__init__.py +103 -0
  33. runloop_api_client/resources/benchmarks/__init__.py +33 -0
  34. runloop_api_client/resources/benchmarks/benchmarks.py +982 -0
  35. runloop_api_client/resources/benchmarks/runs.py +587 -0
  36. runloop_api_client/resources/blueprints.py +1206 -0
  37. runloop_api_client/resources/devboxes/__init__.py +89 -0
  38. runloop_api_client/resources/devboxes/browsers.py +267 -0
  39. runloop_api_client/resources/devboxes/computers.py +648 -0
  40. runloop_api_client/resources/devboxes/devboxes.py +3414 -0
  41. runloop_api_client/resources/devboxes/disk_snapshots.py +519 -0
  42. runloop_api_client/resources/devboxes/executions.py +1059 -0
  43. runloop_api_client/resources/devboxes/logs.py +197 -0
  44. runloop_api_client/resources/objects.py +860 -0
  45. runloop_api_client/resources/repositories.py +717 -0
  46. runloop_api_client/resources/scenarios/__init__.py +47 -0
  47. runloop_api_client/resources/scenarios/runs.py +949 -0
  48. runloop_api_client/resources/scenarios/scenarios.py +1079 -0
  49. runloop_api_client/resources/scenarios/scorers.py +629 -0
  50. runloop_api_client/resources/secrets.py +500 -0
  51. runloop_api_client/types/__init__.py +95 -0
  52. runloop_api_client/types/benchmark_create_params.py +40 -0
  53. runloop_api_client/types/benchmark_definitions_params.py +15 -0
  54. runloop_api_client/types/benchmark_list_params.py +15 -0
  55. runloop_api_client/types/benchmark_list_public_params.py +15 -0
  56. runloop_api_client/types/benchmark_run_list_view.py +19 -0
  57. runloop_api_client/types/benchmark_run_view.py +51 -0
  58. runloop_api_client/types/benchmark_start_run_params.py +25 -0
  59. runloop_api_client/types/benchmark_update_params.py +40 -0
  60. runloop_api_client/types/benchmark_view.py +45 -0
  61. runloop_api_client/types/benchmarks/__init__.py +6 -0
  62. runloop_api_client/types/benchmarks/run_list_params.py +18 -0
  63. runloop_api_client/types/benchmarks/run_list_scenario_runs_params.py +18 -0
  64. runloop_api_client/types/blueprint_build_log.py +16 -0
  65. runloop_api_client/types/blueprint_build_logs_list_view.py +16 -0
  66. runloop_api_client/types/blueprint_build_parameters.py +87 -0
  67. runloop_api_client/types/blueprint_create_params.py +90 -0
  68. runloop_api_client/types/blueprint_list_params.py +18 -0
  69. runloop_api_client/types/blueprint_list_public_params.py +18 -0
  70. runloop_api_client/types/blueprint_list_view.py +19 -0
  71. runloop_api_client/types/blueprint_preview_params.py +90 -0
  72. runloop_api_client/types/blueprint_preview_view.py +10 -0
  73. runloop_api_client/types/blueprint_view.py +86 -0
  74. runloop_api_client/types/devbox_async_execution_detail_view.py +40 -0
  75. runloop_api_client/types/devbox_create_params.py +70 -0
  76. runloop_api_client/types/devbox_create_ssh_key_response.py +16 -0
  77. runloop_api_client/types/devbox_create_tunnel_params.py +12 -0
  78. runloop_api_client/types/devbox_download_file_params.py +15 -0
  79. runloop_api_client/types/devbox_execute_async_params.py +25 -0
  80. runloop_api_client/types/devbox_execute_params.py +34 -0
  81. runloop_api_client/types/devbox_execute_sync_params.py +25 -0
  82. runloop_api_client/types/devbox_execution_detail_view.py +24 -0
  83. runloop_api_client/types/devbox_list_disk_snapshots_params.py +29 -0
  84. runloop_api_client/types/devbox_list_params.py +20 -0
  85. runloop_api_client/types/devbox_list_view.py +19 -0
  86. runloop_api_client/types/devbox_read_file_contents_params.py +15 -0
  87. runloop_api_client/types/devbox_read_file_contents_response.py +7 -0
  88. runloop_api_client/types/devbox_remove_tunnel_params.py +12 -0
  89. runloop_api_client/types/devbox_snapshot_disk_async_params.py +16 -0
  90. runloop_api_client/types/devbox_snapshot_disk_params.py +16 -0
  91. runloop_api_client/types/devbox_snapshot_list_view.py +19 -0
  92. runloop_api_client/types/devbox_snapshot_view.py +24 -0
  93. runloop_api_client/types/devbox_tunnel_view.py +16 -0
  94. runloop_api_client/types/devbox_update_params.py +16 -0
  95. runloop_api_client/types/devbox_upload_file_params.py +19 -0
  96. runloop_api_client/types/devbox_view.py +94 -0
  97. runloop_api_client/types/devbox_wait_for_command_params.py +25 -0
  98. runloop_api_client/types/devbox_write_file_contents_params.py +18 -0
  99. runloop_api_client/types/devboxes/__init__.py +32 -0
  100. runloop_api_client/types/devboxes/browser_create_params.py +13 -0
  101. runloop_api_client/types/devboxes/browser_view.py +25 -0
  102. runloop_api_client/types/devboxes/computer_create_params.py +24 -0
  103. runloop_api_client/types/devboxes/computer_keyboard_interaction_params.py +16 -0
  104. runloop_api_client/types/devboxes/computer_keyboard_interaction_response.py +15 -0
  105. runloop_api_client/types/devboxes/computer_mouse_interaction_params.py +30 -0
  106. runloop_api_client/types/devboxes/computer_mouse_interaction_response.py +15 -0
  107. runloop_api_client/types/devboxes/computer_screen_interaction_params.py +12 -0
  108. runloop_api_client/types/devboxes/computer_screen_interaction_response.py +15 -0
  109. runloop_api_client/types/devboxes/computer_view.py +19 -0
  110. runloop_api_client/types/devboxes/devbox_logs_list_view.py +39 -0
  111. runloop_api_client/types/devboxes/devbox_snapshot_async_status_view.py +20 -0
  112. runloop_api_client/types/devboxes/disk_snapshot_list_params.py +29 -0
  113. runloop_api_client/types/devboxes/disk_snapshot_update_params.py +16 -0
  114. runloop_api_client/types/devboxes/execution_execute_async_params.py +25 -0
  115. runloop_api_client/types/devboxes/execution_execute_sync_params.py +25 -0
  116. runloop_api_client/types/devboxes/execution_kill_params.py +18 -0
  117. runloop_api_client/types/devboxes/execution_retrieve_params.py +14 -0
  118. runloop_api_client/types/devboxes/execution_stream_stderr_updates_params.py +14 -0
  119. runloop_api_client/types/devboxes/execution_stream_stdout_updates_params.py +14 -0
  120. runloop_api_client/types/devboxes/execution_update_chunk.py +15 -0
  121. runloop_api_client/types/devboxes/log_list_params.py +15 -0
  122. runloop_api_client/types/input_context.py +15 -0
  123. runloop_api_client/types/input_context_param.py +16 -0
  124. runloop_api_client/types/input_context_update_param.py +16 -0
  125. runloop_api_client/types/object_create_params.py +19 -0
  126. runloop_api_client/types/object_download_params.py +12 -0
  127. runloop_api_client/types/object_download_url_view.py +10 -0
  128. runloop_api_client/types/object_list_params.py +27 -0
  129. runloop_api_client/types/object_list_public_params.py +27 -0
  130. runloop_api_client/types/object_list_view.py +22 -0
  131. runloop_api_client/types/object_view.py +28 -0
  132. runloop_api_client/types/repository_connection_list_view.py +19 -0
  133. runloop_api_client/types/repository_connection_view.py +16 -0
  134. runloop_api_client/types/repository_create_params.py +22 -0
  135. runloop_api_client/types/repository_inspection_details.py +77 -0
  136. runloop_api_client/types/repository_inspection_list_view.py +13 -0
  137. runloop_api_client/types/repository_list_params.py +21 -0
  138. runloop_api_client/types/repository_manifest_view.py +158 -0
  139. runloop_api_client/types/repository_refresh_params.py +16 -0
  140. runloop_api_client/types/scenario_create_params.py +53 -0
  141. runloop_api_client/types/scenario_definition_list_view.py +19 -0
  142. runloop_api_client/types/scenario_environment.py +25 -0
  143. runloop_api_client/types/scenario_environment_param.py +27 -0
  144. runloop_api_client/types/scenario_list_params.py +21 -0
  145. runloop_api_client/types/scenario_list_public_params.py +18 -0
  146. runloop_api_client/types/scenario_run_list_view.py +19 -0
  147. runloop_api_client/types/scenario_run_view.py +50 -0
  148. runloop_api_client/types/scenario_start_run_params.py +28 -0
  149. runloop_api_client/types/scenario_update_params.py +46 -0
  150. runloop_api_client/types/scenario_view.py +57 -0
  151. runloop_api_client/types/scenarios/__init__.py +14 -0
  152. runloop_api_client/types/scenarios/run_list_params.py +18 -0
  153. runloop_api_client/types/scenarios/scorer_create_params.py +18 -0
  154. runloop_api_client/types/scenarios/scorer_create_response.py +16 -0
  155. runloop_api_client/types/scenarios/scorer_list_params.py +15 -0
  156. runloop_api_client/types/scenarios/scorer_list_response.py +16 -0
  157. runloop_api_client/types/scenarios/scorer_retrieve_response.py +16 -0
  158. runloop_api_client/types/scenarios/scorer_update_params.py +18 -0
  159. runloop_api_client/types/scenarios/scorer_update_response.py +16 -0
  160. runloop_api_client/types/scenarios/scorer_validate_params.py +17 -0
  161. runloop_api_client/types/scenarios/scorer_validate_response.py +23 -0
  162. runloop_api_client/types/scoring_contract.py +13 -0
  163. runloop_api_client/types/scoring_contract_param.py +15 -0
  164. runloop_api_client/types/scoring_contract_result_view.py +16 -0
  165. runloop_api_client/types/scoring_contract_update_param.py +15 -0
  166. runloop_api_client/types/scoring_function.py +135 -0
  167. runloop_api_client/types/scoring_function_param.py +131 -0
  168. runloop_api_client/types/scoring_function_result_view.py +21 -0
  169. runloop_api_client/types/secret_create_params.py +23 -0
  170. runloop_api_client/types/secret_list_params.py +12 -0
  171. runloop_api_client/types/secret_list_view.py +22 -0
  172. runloop_api_client/types/secret_update_params.py +16 -0
  173. runloop_api_client/types/secret_view.py +22 -0
  174. runloop_api_client/types/shared/__init__.py +6 -0
  175. runloop_api_client/types/shared/after_idle.py +15 -0
  176. runloop_api_client/types/shared/code_mount_parameters.py +24 -0
  177. runloop_api_client/types/shared/launch_parameters.py +79 -0
  178. runloop_api_client/types/shared/run_profile.py +33 -0
  179. runloop_api_client/types/shared_params/__init__.py +6 -0
  180. runloop_api_client/types/shared_params/after_idle.py +15 -0
  181. runloop_api_client/types/shared_params/code_mount_parameters.py +25 -0
  182. runloop_api_client/types/shared_params/launch_parameters.py +81 -0
  183. runloop_api_client/types/shared_params/run_profile.py +34 -0
  184. runloop_api_client-0.61.0.dist-info/METADATA +496 -0
  185. runloop_api_client-0.61.0.dist-info/RECORD +187 -0
  186. runloop_api_client-0.61.0.dist-info/WHEEL +4 -0
  187. runloop_api_client-0.61.0.dist-info/licenses/LICENSE +7 -0
@@ -0,0 +1,1206 @@
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
+ )
15
+ from .._types import NOT_GIVEN, Body, Omit, Query, Headers, NotGiven, SequenceNotStr, omit, not_given
16
+ from .._utils import maybe_transform, async_maybe_transform
17
+ from .._compat import cached_property
18
+ from .._resource import SyncAPIResource, AsyncAPIResource
19
+ from .._response import (
20
+ to_raw_response_wrapper,
21
+ to_streamed_response_wrapper,
22
+ async_to_raw_response_wrapper,
23
+ async_to_streamed_response_wrapper,
24
+ )
25
+ from ..pagination import SyncBlueprintsCursorIDPage, AsyncBlueprintsCursorIDPage
26
+ from .._exceptions import RunloopError
27
+ from ..lib.polling import PollingConfig, poll_until
28
+ from .._base_client import AsyncPaginator, make_request_options
29
+ from ..lib.polling_async import async_poll_until
30
+ from ..types.blueprint_view import BlueprintView
31
+ from ..types.blueprint_preview_view import BlueprintPreviewView
32
+ from ..types.blueprint_build_logs_list_view import BlueprintBuildLogsListView
33
+ from ..types.shared_params.launch_parameters import LaunchParameters
34
+ from ..types.shared_params.code_mount_parameters import CodeMountParameters
35
+
36
+
37
+ # Type for request arguments that combine polling config with additional request options
38
+ class BlueprintRequestArgs(TypedDict, total=False):
39
+ polling_config: PollingConfig | None
40
+ # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
41
+ # The extra values given here take precedence over values defined on the client or passed to this method.
42
+ extra_headers: Headers | None
43
+ extra_query: Query | None
44
+ extra_body: Body | None
45
+ timeout: float | httpx.Timeout | None | NotGiven
46
+
47
+
48
+ __all__ = ["BlueprintsResource", "AsyncBlueprintsResource", "BlueprintRequestArgs"]
49
+
50
+
51
+ class BlueprintsResource(SyncAPIResource):
52
+ @cached_property
53
+ def with_raw_response(self) -> BlueprintsResourceWithRawResponse:
54
+ """
55
+ This property can be used as a prefix for any HTTP method call to return
56
+ the raw response object instead of the parsed content.
57
+
58
+ For more information, see https://www.github.com/runloopai/api-client-python#accessing-raw-response-data-eg-headers
59
+ """
60
+ return BlueprintsResourceWithRawResponse(self)
61
+
62
+ @cached_property
63
+ def with_streaming_response(self) -> BlueprintsResourceWithStreamingResponse:
64
+ """
65
+ An alternative to `.with_raw_response` that doesn't eagerly read the response body.
66
+
67
+ For more information, see https://www.github.com/runloopai/api-client-python#with_streaming_response
68
+ """
69
+ return BlueprintsResourceWithStreamingResponse(self)
70
+
71
+ def create(
72
+ self,
73
+ *,
74
+ name: str,
75
+ base_blueprint_id: Optional[str] | Omit = omit,
76
+ base_blueprint_name: Optional[str] | Omit = omit,
77
+ build_args: Optional[Dict[str, str]] | Omit = omit,
78
+ code_mounts: Optional[Iterable[CodeMountParameters]] | Omit = omit,
79
+ dockerfile: Optional[str] | Omit = omit,
80
+ file_mounts: Optional[Dict[str, str]] | Omit = omit,
81
+ launch_parameters: Optional[LaunchParameters] | Omit = omit,
82
+ metadata: Optional[Dict[str, str]] | Omit = omit,
83
+ services: Optional[Iterable[blueprint_create_params.Service]] | Omit = omit,
84
+ system_setup_commands: Optional[SequenceNotStr[str]] | Omit = omit,
85
+ # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
86
+ # The extra values given here take precedence over values defined on the client or passed to this method.
87
+ extra_headers: Headers | None = None,
88
+ extra_query: Query | None = None,
89
+ extra_body: Body | None = None,
90
+ timeout: float | httpx.Timeout | None | NotGiven = not_given,
91
+ idempotency_key: str | None = None,
92
+ ) -> BlueprintView:
93
+ """Starts build of custom defined container Blueprint.
94
+
95
+ The Blueprint will begin in
96
+ the 'provisioning' step and transition to the 'building' step once it is
97
+ selected off the build queue., Upon build complete it will transition to
98
+ 'building_complete' if the build is successful.
99
+
100
+ Args:
101
+ name: Name of the Blueprint.
102
+
103
+ base_blueprint_id: (Optional) ID of previously built blueprint to use as a base blueprint for this
104
+ build.
105
+
106
+ base_blueprint_name: (Optional) Name of previously built blueprint to use as a base blueprint for
107
+ this build. When set, this will load the latest successfully built Blueprint
108
+ with the given name. Only one of (base_blueprint_id, base_blueprint_name) should
109
+ be specified.
110
+
111
+ build_args: (Optional) Arbitrary Docker build args to pass during build.
112
+
113
+ code_mounts: A list of code mounts to be included in the Blueprint.
114
+
115
+ dockerfile: Dockerfile contents to be used to build the Blueprint.
116
+
117
+ file_mounts: (Optional) Map of paths and file contents to write before setup.
118
+
119
+ launch_parameters: Parameters to configure your Devbox at launch time.
120
+
121
+ metadata: (Optional) User defined metadata for the Blueprint.
122
+
123
+ services: (Optional) List of containerized services to include in the Blueprint. These
124
+ services will be pre-pulled during the build phase for optimized startup
125
+ performance.
126
+
127
+ system_setup_commands: A list of commands to run to set up your system.
128
+
129
+ extra_headers: Send extra headers
130
+
131
+ extra_query: Add additional query parameters to the request
132
+
133
+ extra_body: Add additional JSON properties to the request
134
+
135
+ timeout: Override the client-level default timeout for this request, in seconds
136
+
137
+ idempotency_key: Specify a custom idempotency key for this request
138
+ """
139
+ return self._post(
140
+ "/v1/blueprints",
141
+ body=maybe_transform(
142
+ {
143
+ "name": name,
144
+ "base_blueprint_id": base_blueprint_id,
145
+ "base_blueprint_name": base_blueprint_name,
146
+ "build_args": build_args,
147
+ "code_mounts": code_mounts,
148
+ "dockerfile": dockerfile,
149
+ "file_mounts": file_mounts,
150
+ "launch_parameters": launch_parameters,
151
+ "metadata": metadata,
152
+ "services": services,
153
+ "system_setup_commands": system_setup_commands,
154
+ },
155
+ blueprint_create_params.BlueprintCreateParams,
156
+ ),
157
+ options=make_request_options(
158
+ extra_headers=extra_headers,
159
+ extra_query=extra_query,
160
+ extra_body=extra_body,
161
+ timeout=timeout,
162
+ idempotency_key=idempotency_key,
163
+ ),
164
+ cast_to=BlueprintView,
165
+ )
166
+
167
+ def retrieve(
168
+ self,
169
+ id: str,
170
+ *,
171
+ # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
172
+ # The extra values given here take precedence over values defined on the client or passed to this method.
173
+ extra_headers: Headers | None = None,
174
+ extra_query: Query | None = None,
175
+ extra_body: Body | None = None,
176
+ timeout: float | httpx.Timeout | None | NotGiven = not_given,
177
+ ) -> BlueprintView:
178
+ """
179
+ Get the details of a previously created Blueprint including the build status.
180
+
181
+ Args:
182
+ extra_headers: Send extra headers
183
+
184
+ extra_query: Add additional query parameters to the request
185
+
186
+ extra_body: Add additional JSON properties to the request
187
+
188
+ timeout: Override the client-level default timeout for this request, in seconds
189
+ """
190
+ if not id:
191
+ raise ValueError(f"Expected a non-empty value for `id` but received {id!r}")
192
+ return self._get(
193
+ f"/v1/blueprints/{id}",
194
+ options=make_request_options(
195
+ extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
196
+ ),
197
+ cast_to=BlueprintView,
198
+ )
199
+
200
+ def await_build_complete(
201
+ self,
202
+ id: str,
203
+ *,
204
+ polling_config: PollingConfig | None = None,
205
+ # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
206
+ # The extra values given here take precedence over values defined on the client or passed to this method.
207
+ extra_headers: Headers | None = None,
208
+ extra_query: Query | None = None,
209
+ extra_body: Body | None = None,
210
+ timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
211
+ ) -> BlueprintView:
212
+ """Wait for a blueprint to finish building.
213
+
214
+ Args:
215
+ id: The ID of the blueprint to wait for
216
+ polling_config: Optional polling configuration
217
+ extra_headers: Send extra headers
218
+ extra_query: Add additional query parameters to the request
219
+ extra_body: Add additional JSON properties to the request
220
+ timeout: Override the client-level default timeout for this request, in seconds
221
+
222
+ Returns:
223
+ The blueprint in built state
224
+
225
+ Raises:
226
+ PollingTimeout: If polling times out before blueprint is built
227
+ RunloopError: If blueprint enters a non-built terminal state
228
+ """
229
+
230
+ def retrieve_blueprint() -> BlueprintView:
231
+ return self.retrieve(
232
+ id, extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
233
+ )
234
+
235
+ def is_done_building(blueprint: BlueprintView) -> bool:
236
+ return blueprint.status not in ["building", "provisioning"]
237
+
238
+ blueprint = poll_until(retrieve_blueprint, is_done_building, polling_config)
239
+
240
+ if blueprint.status != "build_complete":
241
+ raise RunloopError(f"Blueprint entered non-built terminal state: {blueprint.status}")
242
+
243
+ return blueprint
244
+
245
+ def create_and_await_build_complete(
246
+ self,
247
+ *,
248
+ name: str,
249
+ base_blueprint_id: Optional[str] | NotGiven = NOT_GIVEN,
250
+ code_mounts: Optional[Iterable[CodeMountParameters]] | NotGiven = NOT_GIVEN,
251
+ dockerfile: Optional[str] | NotGiven = NOT_GIVEN,
252
+ file_mounts: Optional[Dict[str, str]] | NotGiven = NOT_GIVEN,
253
+ launch_parameters: Optional[LaunchParameters] | NotGiven = NOT_GIVEN,
254
+ polling_config: PollingConfig | None = None,
255
+ services: Optional[Iterable[blueprint_create_params.Service]] | NotGiven = NOT_GIVEN,
256
+ system_setup_commands: Optional[SequenceNotStr[str]] | NotGiven = NOT_GIVEN,
257
+ # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
258
+ # The extra values given here take precedence over values defined on the client or passed to this method.
259
+ extra_headers: Headers | None = None,
260
+ extra_query: Query | None = None,
261
+ extra_body: Body | None = None,
262
+ timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
263
+ idempotency_key: str | None = None,
264
+ ) -> BlueprintView:
265
+ """Create a new Blueprint and wait for it to finish building.
266
+
267
+ This is a wrapper around the `create` method that waits for the blueprint to finish building.
268
+
269
+ Args:
270
+ See the `create` method for detailed documentation.
271
+ polling_config: Optional polling configuration
272
+
273
+ Returns:
274
+ The built blueprint
275
+
276
+ Raises:
277
+ PollingTimeout: If polling times out before blueprint is built
278
+ RunloopError: If blueprint enters a non-built terminal state
279
+ """
280
+ # Pass all create_args to the underlying create method
281
+ blueprint = self.create(
282
+ name=name,
283
+ base_blueprint_id=base_blueprint_id,
284
+ code_mounts=code_mounts,
285
+ dockerfile=dockerfile,
286
+ file_mounts=file_mounts,
287
+ launch_parameters=launch_parameters,
288
+ services=services,
289
+ system_setup_commands=system_setup_commands,
290
+ extra_headers=extra_headers,
291
+ extra_query=extra_query,
292
+ extra_body=extra_body,
293
+ timeout=timeout,
294
+ idempotency_key=idempotency_key,
295
+ )
296
+
297
+ return self.await_build_complete(
298
+ blueprint.id,
299
+ polling_config=polling_config,
300
+ extra_headers=extra_headers,
301
+ extra_query=extra_query,
302
+ extra_body=extra_body,
303
+ timeout=timeout,
304
+ )
305
+
306
+ def list(
307
+ self,
308
+ *,
309
+ limit: int | Omit = omit,
310
+ name: str | Omit = omit,
311
+ starting_after: str | Omit = omit,
312
+ # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
313
+ # The extra values given here take precedence over values defined on the client or passed to this method.
314
+ extra_headers: Headers | None = None,
315
+ extra_query: Query | None = None,
316
+ extra_body: Body | None = None,
317
+ timeout: float | httpx.Timeout | None | NotGiven = not_given,
318
+ ) -> SyncBlueprintsCursorIDPage[BlueprintView]:
319
+ """
320
+ List all Blueprints or filter by name.
321
+
322
+ Args:
323
+ limit: The limit of items to return. Default is 20.
324
+
325
+ name: Filter by name
326
+
327
+ starting_after: Load the next page of data starting after the item with the given ID.
328
+
329
+ extra_headers: Send extra headers
330
+
331
+ extra_query: Add additional query parameters to the request
332
+
333
+ extra_body: Add additional JSON properties to the request
334
+
335
+ timeout: Override the client-level default timeout for this request, in seconds
336
+ """
337
+ return self._get_api_list(
338
+ "/v1/blueprints",
339
+ page=SyncBlueprintsCursorIDPage[BlueprintView],
340
+ options=make_request_options(
341
+ extra_headers=extra_headers,
342
+ extra_query=extra_query,
343
+ extra_body=extra_body,
344
+ timeout=timeout,
345
+ query=maybe_transform(
346
+ {
347
+ "limit": limit,
348
+ "name": name,
349
+ "starting_after": starting_after,
350
+ },
351
+ blueprint_list_params.BlueprintListParams,
352
+ ),
353
+ ),
354
+ model=BlueprintView,
355
+ )
356
+
357
+ def delete(
358
+ self,
359
+ id: str,
360
+ *,
361
+ # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
362
+ # The extra values given here take precedence over values defined on the client or passed to this method.
363
+ extra_headers: Headers | None = None,
364
+ extra_query: Query | None = None,
365
+ extra_body: Body | None = None,
366
+ timeout: float | httpx.Timeout | None | NotGiven = not_given,
367
+ idempotency_key: str | None = None,
368
+ ) -> object:
369
+ """
370
+ Delete a previously created Blueprint.
371
+
372
+ Args:
373
+ extra_headers: Send extra headers
374
+
375
+ extra_query: Add additional query parameters to the request
376
+
377
+ extra_body: Add additional JSON properties to the request
378
+
379
+ timeout: Override the client-level default timeout for this request, in seconds
380
+
381
+ idempotency_key: Specify a custom idempotency key for this request
382
+ """
383
+ if not id:
384
+ raise ValueError(f"Expected a non-empty value for `id` but received {id!r}")
385
+ return self._post(
386
+ f"/v1/blueprints/{id}/delete",
387
+ options=make_request_options(
388
+ extra_headers=extra_headers,
389
+ extra_query=extra_query,
390
+ extra_body=extra_body,
391
+ timeout=timeout,
392
+ idempotency_key=idempotency_key,
393
+ ),
394
+ cast_to=object,
395
+ )
396
+
397
+ def list_public(
398
+ self,
399
+ *,
400
+ limit: int | Omit = omit,
401
+ name: str | Omit = omit,
402
+ starting_after: 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 public Blueprints that are available to all users.
412
+
413
+ Args:
414
+ limit: The limit of items to return. Default is 20.
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
+ extra_headers: Send extra headers
421
+
422
+ extra_query: Add additional query parameters to the request
423
+
424
+ extra_body: Add additional JSON properties to the request
425
+
426
+ timeout: Override the client-level default timeout for this request, in seconds
427
+ """
428
+ return self._get_api_list(
429
+ "/v1/blueprints/list_public",
430
+ page=SyncBlueprintsCursorIDPage[BlueprintView],
431
+ options=make_request_options(
432
+ extra_headers=extra_headers,
433
+ extra_query=extra_query,
434
+ extra_body=extra_body,
435
+ timeout=timeout,
436
+ query=maybe_transform(
437
+ {
438
+ "limit": limit,
439
+ "name": name,
440
+ "starting_after": starting_after,
441
+ },
442
+ blueprint_list_public_params.BlueprintListPublicParams,
443
+ ),
444
+ ),
445
+ model=BlueprintView,
446
+ )
447
+
448
+ def logs(
449
+ self,
450
+ id: str,
451
+ *,
452
+ # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
453
+ # The extra values given here take precedence over values defined on the client or passed to this method.
454
+ extra_headers: Headers | None = None,
455
+ extra_query: Query | None = None,
456
+ extra_body: Body | None = None,
457
+ timeout: float | httpx.Timeout | None | NotGiven = not_given,
458
+ ) -> BlueprintBuildLogsListView:
459
+ """
460
+ Get all logs from the building of a Blueprint.
461
+
462
+ Args:
463
+ extra_headers: Send extra headers
464
+
465
+ extra_query: Add additional query parameters to the request
466
+
467
+ extra_body: Add additional JSON properties to the request
468
+
469
+ timeout: Override the client-level default timeout for this request, in seconds
470
+ """
471
+ if not id:
472
+ raise ValueError(f"Expected a non-empty value for `id` but received {id!r}")
473
+ return self._get(
474
+ f"/v1/blueprints/{id}/logs",
475
+ options=make_request_options(
476
+ extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
477
+ ),
478
+ cast_to=BlueprintBuildLogsListView,
479
+ )
480
+
481
+ def preview(
482
+ self,
483
+ *,
484
+ name: str,
485
+ base_blueprint_id: Optional[str] | Omit = omit,
486
+ base_blueprint_name: Optional[str] | Omit = omit,
487
+ build_args: Optional[Dict[str, str]] | Omit = omit,
488
+ code_mounts: Optional[Iterable[CodeMountParameters]] | Omit = omit,
489
+ dockerfile: Optional[str] | Omit = omit,
490
+ file_mounts: Optional[Dict[str, str]] | Omit = omit,
491
+ launch_parameters: Optional[LaunchParameters] | Omit = omit,
492
+ metadata: Optional[Dict[str, str]] | Omit = omit,
493
+ services: Optional[Iterable[blueprint_preview_params.Service]] | Omit = omit,
494
+ system_setup_commands: Optional[SequenceNotStr[str]] | Omit = omit,
495
+ # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
496
+ # The extra values given here take precedence over values defined on the client or passed to this method.
497
+ extra_headers: Headers | None = None,
498
+ extra_query: Query | None = None,
499
+ extra_body: Body | None = None,
500
+ timeout: float | httpx.Timeout | None | NotGiven = not_given,
501
+ idempotency_key: str | None = None,
502
+ ) -> BlueprintPreviewView:
503
+ """Preview building a Blueprint with the specified configuration.
504
+
505
+ You can take the
506
+ resulting Dockerfile and test out your build using any local docker tooling.
507
+
508
+ Args:
509
+ name: Name of the Blueprint.
510
+
511
+ base_blueprint_id: (Optional) ID of previously built blueprint to use as a base blueprint for this
512
+ build.
513
+
514
+ base_blueprint_name: (Optional) Name of previously built blueprint to use as a base blueprint for
515
+ this build. When set, this will load the latest successfully built Blueprint
516
+ with the given name. Only one of (base_blueprint_id, base_blueprint_name) should
517
+ be specified.
518
+
519
+ build_args: (Optional) Arbitrary Docker build args to pass during build.
520
+
521
+ code_mounts: A list of code mounts to be included in the Blueprint.
522
+
523
+ dockerfile: Dockerfile contents to be used to build the Blueprint.
524
+
525
+ file_mounts: (Optional) Map of paths and file contents to write before setup.
526
+
527
+ launch_parameters: Parameters to configure your Devbox at launch time.
528
+
529
+ metadata: (Optional) User defined metadata for the Blueprint.
530
+
531
+ services: (Optional) List of containerized services to include in the Blueprint. These
532
+ services will be pre-pulled during the build phase for optimized startup
533
+ performance.
534
+
535
+ system_setup_commands: A list of commands to run to set up your system.
536
+
537
+ extra_headers: Send extra headers
538
+
539
+ extra_query: Add additional query parameters to the request
540
+
541
+ extra_body: Add additional JSON properties to the request
542
+
543
+ timeout: Override the client-level default timeout for this request, in seconds
544
+
545
+ idempotency_key: Specify a custom idempotency key for this request
546
+ """
547
+ return self._post(
548
+ "/v1/blueprints/preview",
549
+ body=maybe_transform(
550
+ {
551
+ "name": name,
552
+ "base_blueprint_id": base_blueprint_id,
553
+ "base_blueprint_name": base_blueprint_name,
554
+ "build_args": build_args,
555
+ "code_mounts": code_mounts,
556
+ "dockerfile": dockerfile,
557
+ "file_mounts": file_mounts,
558
+ "launch_parameters": launch_parameters,
559
+ "metadata": metadata,
560
+ "services": services,
561
+ "system_setup_commands": system_setup_commands,
562
+ },
563
+ blueprint_preview_params.BlueprintPreviewParams,
564
+ ),
565
+ options=make_request_options(
566
+ extra_headers=extra_headers,
567
+ extra_query=extra_query,
568
+ extra_body=extra_body,
569
+ timeout=timeout,
570
+ idempotency_key=idempotency_key,
571
+ ),
572
+ cast_to=BlueprintPreviewView,
573
+ )
574
+
575
+
576
+ class AsyncBlueprintsResource(AsyncAPIResource):
577
+ @cached_property
578
+ def with_raw_response(self) -> AsyncBlueprintsResourceWithRawResponse:
579
+ """
580
+ This property can be used as a prefix for any HTTP method call to return
581
+ the raw response object instead of the parsed content.
582
+
583
+ For more information, see https://www.github.com/runloopai/api-client-python#accessing-raw-response-data-eg-headers
584
+ """
585
+ return AsyncBlueprintsResourceWithRawResponse(self)
586
+
587
+ @cached_property
588
+ def with_streaming_response(self) -> AsyncBlueprintsResourceWithStreamingResponse:
589
+ """
590
+ An alternative to `.with_raw_response` that doesn't eagerly read the response body.
591
+
592
+ For more information, see https://www.github.com/runloopai/api-client-python#with_streaming_response
593
+ """
594
+ return AsyncBlueprintsResourceWithStreamingResponse(self)
595
+
596
+ async def create(
597
+ self,
598
+ *,
599
+ name: str,
600
+ base_blueprint_id: Optional[str] | Omit = omit,
601
+ base_blueprint_name: Optional[str] | Omit = omit,
602
+ build_args: Optional[Dict[str, str]] | Omit = omit,
603
+ code_mounts: Optional[Iterable[CodeMountParameters]] | Omit = omit,
604
+ dockerfile: Optional[str] | Omit = omit,
605
+ file_mounts: Optional[Dict[str, str]] | Omit = omit,
606
+ launch_parameters: Optional[LaunchParameters] | Omit = omit,
607
+ metadata: Optional[Dict[str, str]] | Omit = omit,
608
+ services: Optional[Iterable[blueprint_create_params.Service]] | Omit = omit,
609
+ system_setup_commands: Optional[SequenceNotStr[str]] | Omit = omit,
610
+ # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
611
+ # The extra values given here take precedence over values defined on the client or passed to this method.
612
+ extra_headers: Headers | None = None,
613
+ extra_query: Query | None = None,
614
+ extra_body: Body | None = None,
615
+ timeout: float | httpx.Timeout | None | NotGiven = not_given,
616
+ idempotency_key: str | None = None,
617
+ ) -> BlueprintView:
618
+ """Starts build of custom defined container Blueprint.
619
+
620
+ The Blueprint will begin in
621
+ the 'provisioning' step and transition to the 'building' step once it is
622
+ selected off the build queue., Upon build complete it will transition to
623
+ 'building_complete' if the build is successful.
624
+
625
+ Args:
626
+ name: Name of the Blueprint.
627
+
628
+ base_blueprint_id: (Optional) ID of previously built blueprint to use as a base blueprint for this
629
+ build.
630
+
631
+ base_blueprint_name: (Optional) Name of previously built blueprint to use as a base blueprint for
632
+ this build. When set, this will load the latest successfully built Blueprint
633
+ with the given name. Only one of (base_blueprint_id, base_blueprint_name) should
634
+ be specified.
635
+
636
+ build_args: (Optional) Arbitrary Docker build args to pass during build.
637
+
638
+ code_mounts: A list of code mounts to be included in the Blueprint.
639
+
640
+ dockerfile: Dockerfile contents to be used to build the Blueprint.
641
+
642
+ file_mounts: (Optional) Map of paths and file contents to write before setup.
643
+
644
+ launch_parameters: Parameters to configure your Devbox at launch time.
645
+
646
+ metadata: (Optional) User defined metadata for the Blueprint.
647
+
648
+ services: (Optional) List of containerized services to include in the Blueprint. These
649
+ services will be pre-pulled during the build phase for optimized startup
650
+ performance.
651
+
652
+ system_setup_commands: A list of commands to run to set up your system.
653
+
654
+ extra_headers: Send extra headers
655
+
656
+ extra_query: Add additional query parameters to the request
657
+
658
+ extra_body: Add additional JSON properties to the request
659
+
660
+ timeout: Override the client-level default timeout for this request, in seconds
661
+
662
+ idempotency_key: Specify a custom idempotency key for this request
663
+ """
664
+ return await self._post(
665
+ "/v1/blueprints",
666
+ body=await async_maybe_transform(
667
+ {
668
+ "name": name,
669
+ "base_blueprint_id": base_blueprint_id,
670
+ "base_blueprint_name": base_blueprint_name,
671
+ "build_args": build_args,
672
+ "code_mounts": code_mounts,
673
+ "dockerfile": dockerfile,
674
+ "file_mounts": file_mounts,
675
+ "launch_parameters": launch_parameters,
676
+ "metadata": metadata,
677
+ "services": services,
678
+ "system_setup_commands": system_setup_commands,
679
+ },
680
+ blueprint_create_params.BlueprintCreateParams,
681
+ ),
682
+ options=make_request_options(
683
+ extra_headers=extra_headers,
684
+ extra_query=extra_query,
685
+ extra_body=extra_body,
686
+ timeout=timeout,
687
+ idempotency_key=idempotency_key,
688
+ ),
689
+ cast_to=BlueprintView,
690
+ )
691
+
692
+ async def retrieve(
693
+ self,
694
+ id: str,
695
+ *,
696
+ # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
697
+ # The extra values given here take precedence over values defined on the client or passed to this method.
698
+ extra_headers: Headers | None = None,
699
+ extra_query: Query | None = None,
700
+ extra_body: Body | None = None,
701
+ timeout: float | httpx.Timeout | None | NotGiven = not_given,
702
+ ) -> BlueprintView:
703
+ """
704
+ Get the details of a previously created Blueprint including the build status.
705
+
706
+ Args:
707
+ extra_headers: Send extra headers
708
+
709
+ extra_query: Add additional query parameters to the request
710
+
711
+ extra_body: Add additional JSON properties to the request
712
+
713
+ timeout: Override the client-level default timeout for this request, in seconds
714
+ """
715
+ if not id:
716
+ raise ValueError(f"Expected a non-empty value for `id` but received {id!r}")
717
+ return await self._get(
718
+ f"/v1/blueprints/{id}",
719
+ options=make_request_options(
720
+ extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
721
+ ),
722
+ cast_to=BlueprintView,
723
+ )
724
+
725
+ async def await_build_complete(
726
+ self,
727
+ id: str,
728
+ *,
729
+ polling_config: PollingConfig | None = None,
730
+ # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
731
+ # The extra values given here take precedence over values defined on the client or passed to this method.
732
+ extra_headers: Headers | None = None,
733
+ extra_query: Query | None = None,
734
+ extra_body: Body | None = None,
735
+ timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
736
+ ) -> BlueprintView:
737
+ """Wait for a blueprint to finish building.
738
+
739
+ Args:
740
+ id: The ID of the blueprint to wait for
741
+ polling_config: Optional polling configuration
742
+ extra_headers: Send extra headers
743
+ extra_query: Add additional query parameters to the request
744
+ extra_body: Add additional JSON properties to the request
745
+ timeout: Override the client-level default timeout for this request, in seconds
746
+
747
+ Returns:
748
+ The blueprint in built state
749
+
750
+ Raises:
751
+ PollingTimeout: If polling times out before blueprint is built
752
+ RunloopError: If blueprint enters a non-built terminal state
753
+ """
754
+
755
+ async def retrieve_blueprint() -> BlueprintView:
756
+ return await self.retrieve(
757
+ id, extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
758
+ )
759
+
760
+ def is_done_building(blueprint: BlueprintView) -> bool:
761
+ return blueprint.status not in ["building", "provisioning"]
762
+
763
+ blueprint = await async_poll_until(retrieve_blueprint, is_done_building, polling_config)
764
+
765
+ if blueprint.status != "build_complete":
766
+ raise RunloopError(f"Blueprint entered non-built terminal state: {blueprint.status}")
767
+
768
+ return blueprint
769
+
770
+ async def create_and_await_build_complete(
771
+ self,
772
+ *,
773
+ name: str,
774
+ base_blueprint_id: Optional[str] | NotGiven = NOT_GIVEN,
775
+ code_mounts: Optional[Iterable[CodeMountParameters]] | NotGiven = NOT_GIVEN,
776
+ dockerfile: Optional[str] | NotGiven = NOT_GIVEN,
777
+ file_mounts: Optional[Dict[str, str]] | NotGiven = NOT_GIVEN,
778
+ launch_parameters: Optional[LaunchParameters] | NotGiven = NOT_GIVEN,
779
+ polling_config: PollingConfig | None = None,
780
+ services: Optional[Iterable[blueprint_create_params.Service]] | NotGiven = NOT_GIVEN,
781
+ system_setup_commands: Optional[SequenceNotStr[str]] | NotGiven = NOT_GIVEN,
782
+ # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
783
+ # The extra values given here take precedence over values defined on the client or passed to this method.
784
+ extra_headers: Headers | None = None,
785
+ extra_query: Query | None = None,
786
+ extra_body: Body | None = None,
787
+ timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
788
+ idempotency_key: str | None = None,
789
+ ) -> BlueprintView:
790
+ """Create a new Blueprint and wait for it to finish building.
791
+
792
+ This is a wrapper around the `create` method that waits for the blueprint to finish building.
793
+
794
+ Args:
795
+ See the `create` method for detailed documentation.
796
+ polling_config: Optional polling configuration
797
+
798
+ Returns:
799
+ The built blueprint
800
+
801
+ Raises:
802
+ PollingTimeout: If polling times out before blueprint is built
803
+ RunloopError: If blueprint enters a non-built terminal state
804
+ """
805
+ # Pass all create_args to the underlying create method
806
+ blueprint = await self.create(
807
+ name=name,
808
+ base_blueprint_id=base_blueprint_id,
809
+ code_mounts=code_mounts,
810
+ dockerfile=dockerfile,
811
+ file_mounts=file_mounts,
812
+ launch_parameters=launch_parameters,
813
+ services=services,
814
+ system_setup_commands=system_setup_commands,
815
+ extra_headers=extra_headers,
816
+ extra_query=extra_query,
817
+ extra_body=extra_body,
818
+ timeout=timeout,
819
+ idempotency_key=idempotency_key,
820
+ )
821
+
822
+ return await self.await_build_complete(
823
+ blueprint.id,
824
+ polling_config=polling_config,
825
+ extra_headers=extra_headers,
826
+ extra_query=extra_query,
827
+ extra_body=extra_body,
828
+ timeout=timeout,
829
+ )
830
+
831
+ def list(
832
+ self,
833
+ *,
834
+ limit: int | Omit = omit,
835
+ name: str | Omit = omit,
836
+ starting_after: str | Omit = omit,
837
+ # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
838
+ # The extra values given here take precedence over values defined on the client or passed to this method.
839
+ extra_headers: Headers | None = None,
840
+ extra_query: Query | None = None,
841
+ extra_body: Body | None = None,
842
+ timeout: float | httpx.Timeout | None | NotGiven = not_given,
843
+ ) -> AsyncPaginator[BlueprintView, AsyncBlueprintsCursorIDPage[BlueprintView]]:
844
+ """
845
+ List all Blueprints or filter by name.
846
+
847
+ Args:
848
+ limit: The limit of items to return. Default is 20.
849
+
850
+ name: Filter by name
851
+
852
+ starting_after: Load the next page of data starting after the item with the given ID.
853
+
854
+ extra_headers: Send extra headers
855
+
856
+ extra_query: Add additional query parameters to the request
857
+
858
+ extra_body: Add additional JSON properties to the request
859
+
860
+ timeout: Override the client-level default timeout for this request, in seconds
861
+ """
862
+ return self._get_api_list(
863
+ "/v1/blueprints",
864
+ page=AsyncBlueprintsCursorIDPage[BlueprintView],
865
+ options=make_request_options(
866
+ extra_headers=extra_headers,
867
+ extra_query=extra_query,
868
+ extra_body=extra_body,
869
+ timeout=timeout,
870
+ query=maybe_transform(
871
+ {
872
+ "limit": limit,
873
+ "name": name,
874
+ "starting_after": starting_after,
875
+ },
876
+ blueprint_list_params.BlueprintListParams,
877
+ ),
878
+ ),
879
+ model=BlueprintView,
880
+ )
881
+
882
+ async def delete(
883
+ self,
884
+ id: str,
885
+ *,
886
+ # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
887
+ # The extra values given here take precedence over values defined on the client or passed to this method.
888
+ extra_headers: Headers | None = None,
889
+ extra_query: Query | None = None,
890
+ extra_body: Body | None = None,
891
+ timeout: float | httpx.Timeout | None | NotGiven = not_given,
892
+ idempotency_key: str | None = None,
893
+ ) -> object:
894
+ """
895
+ Delete a previously created Blueprint.
896
+
897
+ Args:
898
+ extra_headers: Send extra headers
899
+
900
+ extra_query: Add additional query parameters to the request
901
+
902
+ extra_body: Add additional JSON properties to the request
903
+
904
+ timeout: Override the client-level default timeout for this request, in seconds
905
+
906
+ idempotency_key: Specify a custom idempotency key for this request
907
+ """
908
+ if not id:
909
+ raise ValueError(f"Expected a non-empty value for `id` but received {id!r}")
910
+ return await self._post(
911
+ f"/v1/blueprints/{id}/delete",
912
+ options=make_request_options(
913
+ extra_headers=extra_headers,
914
+ extra_query=extra_query,
915
+ extra_body=extra_body,
916
+ timeout=timeout,
917
+ idempotency_key=idempotency_key,
918
+ ),
919
+ cast_to=object,
920
+ )
921
+
922
+ def list_public(
923
+ self,
924
+ *,
925
+ limit: int | Omit = omit,
926
+ name: str | Omit = omit,
927
+ starting_after: str | Omit = omit,
928
+ # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
929
+ # The extra values given here take precedence over values defined on the client or passed to this method.
930
+ extra_headers: Headers | None = None,
931
+ extra_query: Query | None = None,
932
+ extra_body: Body | None = None,
933
+ timeout: float | httpx.Timeout | None | NotGiven = not_given,
934
+ ) -> AsyncPaginator[BlueprintView, AsyncBlueprintsCursorIDPage[BlueprintView]]:
935
+ """
936
+ List all public Blueprints that are available to all users.
937
+
938
+ Args:
939
+ limit: The limit of items to return. Default is 20.
940
+
941
+ name: Filter by name
942
+
943
+ starting_after: Load the next page of data starting after the item with the given ID.
944
+
945
+ extra_headers: Send extra headers
946
+
947
+ extra_query: Add additional query parameters to the request
948
+
949
+ extra_body: Add additional JSON properties to the request
950
+
951
+ timeout: Override the client-level default timeout for this request, in seconds
952
+ """
953
+ return self._get_api_list(
954
+ "/v1/blueprints/list_public",
955
+ page=AsyncBlueprintsCursorIDPage[BlueprintView],
956
+ options=make_request_options(
957
+ extra_headers=extra_headers,
958
+ extra_query=extra_query,
959
+ extra_body=extra_body,
960
+ timeout=timeout,
961
+ query=maybe_transform(
962
+ {
963
+ "limit": limit,
964
+ "name": name,
965
+ "starting_after": starting_after,
966
+ },
967
+ blueprint_list_public_params.BlueprintListPublicParams,
968
+ ),
969
+ ),
970
+ model=BlueprintView,
971
+ )
972
+
973
+ async def logs(
974
+ self,
975
+ id: str,
976
+ *,
977
+ # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
978
+ # The extra values given here take precedence over values defined on the client or passed to this method.
979
+ extra_headers: Headers | None = None,
980
+ extra_query: Query | None = None,
981
+ extra_body: Body | None = None,
982
+ timeout: float | httpx.Timeout | None | NotGiven = not_given,
983
+ ) -> BlueprintBuildLogsListView:
984
+ """
985
+ Get all logs from the building of a Blueprint.
986
+
987
+ Args:
988
+ extra_headers: Send extra headers
989
+
990
+ extra_query: Add additional query parameters to the request
991
+
992
+ extra_body: Add additional JSON properties to the request
993
+
994
+ timeout: Override the client-level default timeout for this request, in seconds
995
+ """
996
+ if not id:
997
+ raise ValueError(f"Expected a non-empty value for `id` but received {id!r}")
998
+ return await self._get(
999
+ f"/v1/blueprints/{id}/logs",
1000
+ options=make_request_options(
1001
+ extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
1002
+ ),
1003
+ cast_to=BlueprintBuildLogsListView,
1004
+ )
1005
+
1006
+ async def preview(
1007
+ self,
1008
+ *,
1009
+ name: str,
1010
+ base_blueprint_id: Optional[str] | Omit = omit,
1011
+ base_blueprint_name: Optional[str] | Omit = omit,
1012
+ build_args: Optional[Dict[str, str]] | Omit = omit,
1013
+ code_mounts: Optional[Iterable[CodeMountParameters]] | Omit = omit,
1014
+ dockerfile: Optional[str] | Omit = omit,
1015
+ file_mounts: Optional[Dict[str, str]] | Omit = omit,
1016
+ launch_parameters: Optional[LaunchParameters] | Omit = omit,
1017
+ metadata: Optional[Dict[str, str]] | Omit = omit,
1018
+ services: Optional[Iterable[blueprint_preview_params.Service]] | Omit = omit,
1019
+ system_setup_commands: Optional[SequenceNotStr[str]] | Omit = omit,
1020
+ # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
1021
+ # The extra values given here take precedence over values defined on the client or passed to this method.
1022
+ extra_headers: Headers | None = None,
1023
+ extra_query: Query | None = None,
1024
+ extra_body: Body | None = None,
1025
+ timeout: float | httpx.Timeout | None | NotGiven = not_given,
1026
+ idempotency_key: str | None = None,
1027
+ ) -> BlueprintPreviewView:
1028
+ """Preview building a Blueprint with the specified configuration.
1029
+
1030
+ You can take the
1031
+ resulting Dockerfile and test out your build using any local docker tooling.
1032
+
1033
+ Args:
1034
+ name: Name of the Blueprint.
1035
+
1036
+ base_blueprint_id: (Optional) ID of previously built blueprint to use as a base blueprint for this
1037
+ build.
1038
+
1039
+ base_blueprint_name: (Optional) Name of previously built blueprint to use as a base blueprint for
1040
+ this build. When set, this will load the latest successfully built Blueprint
1041
+ with the given name. Only one of (base_blueprint_id, base_blueprint_name) should
1042
+ be specified.
1043
+
1044
+ build_args: (Optional) Arbitrary Docker build args to pass during build.
1045
+
1046
+ code_mounts: A list of code mounts to be included in the Blueprint.
1047
+
1048
+ dockerfile: Dockerfile contents to be used to build the Blueprint.
1049
+
1050
+ file_mounts: (Optional) Map of paths and file contents to write before setup.
1051
+
1052
+ launch_parameters: Parameters to configure your Devbox at launch time.
1053
+
1054
+ metadata: (Optional) User defined metadata for the Blueprint.
1055
+
1056
+ services: (Optional) List of containerized services to include in the Blueprint. These
1057
+ services will be pre-pulled during the build phase for optimized startup
1058
+ performance.
1059
+
1060
+ system_setup_commands: A list of commands to run to set up your system.
1061
+
1062
+ extra_headers: Send extra headers
1063
+
1064
+ extra_query: Add additional query parameters to the request
1065
+
1066
+ extra_body: Add additional JSON properties to the request
1067
+
1068
+ timeout: Override the client-level default timeout for this request, in seconds
1069
+
1070
+ idempotency_key: Specify a custom idempotency key for this request
1071
+ """
1072
+ return await self._post(
1073
+ "/v1/blueprints/preview",
1074
+ body=await async_maybe_transform(
1075
+ {
1076
+ "name": name,
1077
+ "base_blueprint_id": base_blueprint_id,
1078
+ "base_blueprint_name": base_blueprint_name,
1079
+ "build_args": build_args,
1080
+ "code_mounts": code_mounts,
1081
+ "dockerfile": dockerfile,
1082
+ "file_mounts": file_mounts,
1083
+ "launch_parameters": launch_parameters,
1084
+ "metadata": metadata,
1085
+ "services": services,
1086
+ "system_setup_commands": system_setup_commands,
1087
+ },
1088
+ blueprint_preview_params.BlueprintPreviewParams,
1089
+ ),
1090
+ options=make_request_options(
1091
+ extra_headers=extra_headers,
1092
+ extra_query=extra_query,
1093
+ extra_body=extra_body,
1094
+ timeout=timeout,
1095
+ idempotency_key=idempotency_key,
1096
+ ),
1097
+ cast_to=BlueprintPreviewView,
1098
+ )
1099
+
1100
+
1101
+ class BlueprintsResourceWithRawResponse:
1102
+ def __init__(self, blueprints: BlueprintsResource) -> None:
1103
+ self._blueprints = blueprints
1104
+
1105
+ self.create = to_raw_response_wrapper(
1106
+ blueprints.create,
1107
+ )
1108
+ self.retrieve = to_raw_response_wrapper(
1109
+ blueprints.retrieve,
1110
+ )
1111
+ self.list = to_raw_response_wrapper(
1112
+ blueprints.list,
1113
+ )
1114
+ self.delete = to_raw_response_wrapper(
1115
+ blueprints.delete,
1116
+ )
1117
+ self.list_public = to_raw_response_wrapper(
1118
+ blueprints.list_public,
1119
+ )
1120
+ self.logs = to_raw_response_wrapper(
1121
+ blueprints.logs,
1122
+ )
1123
+ self.preview = to_raw_response_wrapper(
1124
+ blueprints.preview,
1125
+ )
1126
+
1127
+
1128
+ class AsyncBlueprintsResourceWithRawResponse:
1129
+ def __init__(self, blueprints: AsyncBlueprintsResource) -> None:
1130
+ self._blueprints = blueprints
1131
+
1132
+ self.create = async_to_raw_response_wrapper(
1133
+ blueprints.create,
1134
+ )
1135
+ self.retrieve = async_to_raw_response_wrapper(
1136
+ blueprints.retrieve,
1137
+ )
1138
+ self.list = async_to_raw_response_wrapper(
1139
+ blueprints.list,
1140
+ )
1141
+ self.delete = async_to_raw_response_wrapper(
1142
+ blueprints.delete,
1143
+ )
1144
+ self.list_public = async_to_raw_response_wrapper(
1145
+ blueprints.list_public,
1146
+ )
1147
+ self.logs = async_to_raw_response_wrapper(
1148
+ blueprints.logs,
1149
+ )
1150
+ self.preview = async_to_raw_response_wrapper(
1151
+ blueprints.preview,
1152
+ )
1153
+
1154
+
1155
+ class BlueprintsResourceWithStreamingResponse:
1156
+ def __init__(self, blueprints: BlueprintsResource) -> None:
1157
+ self._blueprints = blueprints
1158
+
1159
+ self.create = to_streamed_response_wrapper(
1160
+ blueprints.create,
1161
+ )
1162
+ self.retrieve = to_streamed_response_wrapper(
1163
+ blueprints.retrieve,
1164
+ )
1165
+ self.list = to_streamed_response_wrapper(
1166
+ blueprints.list,
1167
+ )
1168
+ self.delete = to_streamed_response_wrapper(
1169
+ blueprints.delete,
1170
+ )
1171
+ self.list_public = to_streamed_response_wrapper(
1172
+ blueprints.list_public,
1173
+ )
1174
+ self.logs = to_streamed_response_wrapper(
1175
+ blueprints.logs,
1176
+ )
1177
+ self.preview = to_streamed_response_wrapper(
1178
+ blueprints.preview,
1179
+ )
1180
+
1181
+
1182
+ class AsyncBlueprintsResourceWithStreamingResponse:
1183
+ def __init__(self, blueprints: AsyncBlueprintsResource) -> None:
1184
+ self._blueprints = blueprints
1185
+
1186
+ self.create = async_to_streamed_response_wrapper(
1187
+ blueprints.create,
1188
+ )
1189
+ self.retrieve = async_to_streamed_response_wrapper(
1190
+ blueprints.retrieve,
1191
+ )
1192
+ self.list = async_to_streamed_response_wrapper(
1193
+ blueprints.list,
1194
+ )
1195
+ self.delete = async_to_streamed_response_wrapper(
1196
+ blueprints.delete,
1197
+ )
1198
+ self.list_public = async_to_streamed_response_wrapper(
1199
+ blueprints.list_public,
1200
+ )
1201
+ self.logs = async_to_streamed_response_wrapper(
1202
+ blueprints.logs,
1203
+ )
1204
+ self.preview = async_to_streamed_response_wrapper(
1205
+ blueprints.preview,
1206
+ )