basaltic-sdk-python 0.1.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 (47) hide show
  1. basaltic/__init__.py +26 -0
  2. basaltic/_client.py +136 -0
  3. basaltic/_common.py +284 -0
  4. basaltic/_transport.py +196 -0
  5. basaltic/_version.py +3 -0
  6. basaltic/auth.py +231 -0
  7. basaltic/client.py +144 -0
  8. basaltic/config.py +151 -0
  9. basaltic/errors.py +73 -0
  10. basaltic/models/__init__.py +17 -0
  11. basaltic/models/audit.py +85 -0
  12. basaltic/models/billing.py +284 -0
  13. basaltic/models/catalog.py +35 -0
  14. basaltic/models/certificate.py +127 -0
  15. basaltic/models/compute.py +905 -0
  16. basaltic/models/dns.py +256 -0
  17. basaltic/models/iam.py +736 -0
  18. basaltic/models/kms.py +157 -0
  19. basaltic/models/loadbalancer.py +574 -0
  20. basaltic/models/network.py +985 -0
  21. basaltic/models/quota.py +30 -0
  22. basaltic/models/secrets.py +136 -0
  23. basaltic/models/storage.py +789 -0
  24. basaltic/models/telemetry.py +393 -0
  25. basaltic/models/workspace.py +734 -0
  26. basaltic/py.typed +0 -0
  27. basaltic/response.py +152 -0
  28. basaltic/services/__init__.py +1 -0
  29. basaltic/services/audit.py +211 -0
  30. basaltic/services/billing.py +777 -0
  31. basaltic/services/catalog.py +172 -0
  32. basaltic/services/certificate.py +395 -0
  33. basaltic/services/compute.py +2395 -0
  34. basaltic/services/dns.py +1079 -0
  35. basaltic/services/iam.py +3405 -0
  36. basaltic/services/kms.py +742 -0
  37. basaltic/services/loadbalancer.py +1727 -0
  38. basaltic/services/network.py +4691 -0
  39. basaltic/services/quota.py +75 -0
  40. basaltic/services/secrets.py +550 -0
  41. basaltic/services/storage.py +3059 -0
  42. basaltic/services/telemetry.py +1316 -0
  43. basaltic/services/workspace.py +3899 -0
  44. basaltic_sdk_python-0.1.1.dist-info/METADATA +211 -0
  45. basaltic_sdk_python-0.1.1.dist-info/RECORD +47 -0
  46. basaltic_sdk_python-0.1.1.dist-info/WHEEL +4 -0
  47. basaltic_sdk_python-0.1.1.dist-info/licenses/LICENSE +202 -0
@@ -0,0 +1,2395 @@
1
+ """Generated typed API methods; do not edit."""
2
+
3
+ from __future__ import annotations
4
+
5
+ from collections.abc import AsyncIterator, Iterator
6
+ from typing import cast
7
+
8
+ import httpx
9
+
10
+ from .._common import UNSET, Operation, Unset, WebSocketConnection
11
+ from .._transport import AsyncTransport, SyncTransport
12
+ from ..config import RequestOptions
13
+ from ..models import compute as m
14
+ from ..response import (
15
+ ApiResponse,
16
+ Page,
17
+ aiterate_pages,
18
+ aresolve_reference,
19
+ iterate_pages,
20
+ reference_scope,
21
+ resolve_reference,
22
+ )
23
+
24
+ _OPS = {
25
+ "attachInstanceNIC": Operation(
26
+ id="attachInstanceNIC",
27
+ method="POST",
28
+ path="/v1/instances/{instance_id}/nics",
29
+ authenticated=True,
30
+ requiredQuery=[],
31
+ requiredHeaders=[],
32
+ queryEncoding={},
33
+ bodyRequired=True,
34
+ contentType="application/json",
35
+ accept="application/json",
36
+ ),
37
+ "attachInstancePoolFloatingIp": Operation(
38
+ id="attachInstancePoolFloatingIp",
39
+ method="POST",
40
+ path="/v1/instance-pools/{pool_id}/floating-ips",
41
+ authenticated=True,
42
+ requiredQuery=[],
43
+ requiredHeaders=[],
44
+ queryEncoding={},
45
+ bodyRequired=True,
46
+ contentType="application/json",
47
+ accept="application/json",
48
+ ),
49
+ "attachInstanceVolume": Operation(
50
+ id="attachInstanceVolume",
51
+ method="POST",
52
+ path="/v1/instances/{instance_id}/volumes",
53
+ authenticated=True,
54
+ requiredQuery=[],
55
+ requiredHeaders=[],
56
+ queryEncoding={},
57
+ bodyRequired=True,
58
+ contentType="application/json",
59
+ accept="application/json",
60
+ ),
61
+ "createImage": Operation(
62
+ id="createImage",
63
+ method="POST",
64
+ path="/v1/images",
65
+ authenticated=True,
66
+ requiredQuery=[],
67
+ requiredHeaders=[],
68
+ queryEncoding={},
69
+ bodyRequired=True,
70
+ contentType="application/json",
71
+ accept="application/json",
72
+ ),
73
+ "createInstance": Operation(
74
+ id="createInstance",
75
+ method="POST",
76
+ path="/v1/instances",
77
+ authenticated=True,
78
+ requiredQuery=[],
79
+ requiredHeaders=[],
80
+ queryEncoding={},
81
+ bodyRequired=True,
82
+ contentType="application/json",
83
+ accept="application/json",
84
+ ),
85
+ "createInstancePool": Operation(
86
+ id="createInstancePool",
87
+ method="POST",
88
+ path="/v1/instance-pools",
89
+ authenticated=True,
90
+ requiredQuery=[],
91
+ requiredHeaders=[],
92
+ queryEncoding={},
93
+ bodyRequired=True,
94
+ contentType="application/json",
95
+ accept="application/json",
96
+ ),
97
+ "createSerialConsoleTicket": Operation(
98
+ id="createSerialConsoleTicket",
99
+ method="POST",
100
+ path="/v1/instances/{instance_id}/console/ticket",
101
+ authenticated=True,
102
+ requiredQuery=[],
103
+ requiredHeaders=[],
104
+ queryEncoding={},
105
+ bodyRequired=False,
106
+ contentType="",
107
+ accept="application/json",
108
+ ),
109
+ "deleteImage": Operation(
110
+ id="deleteImage",
111
+ method="DELETE",
112
+ path="/v1/images/{image_id}",
113
+ authenticated=True,
114
+ requiredQuery=[],
115
+ requiredHeaders=[],
116
+ queryEncoding={},
117
+ bodyRequired=False,
118
+ contentType="",
119
+ accept="application/json",
120
+ ),
121
+ "deleteInstance": Operation(
122
+ id="deleteInstance",
123
+ method="DELETE",
124
+ path="/v1/instances/{instance_id}",
125
+ authenticated=True,
126
+ requiredQuery=[],
127
+ requiredHeaders=[],
128
+ queryEncoding={},
129
+ bodyRequired=False,
130
+ contentType="",
131
+ accept="application/json",
132
+ ),
133
+ "deleteInstancePool": Operation(
134
+ id="deleteInstancePool",
135
+ method="DELETE",
136
+ path="/v1/instance-pools/{pool_id}",
137
+ authenticated=True,
138
+ requiredQuery=[],
139
+ requiredHeaders=[],
140
+ queryEncoding={},
141
+ bodyRequired=False,
142
+ contentType="",
143
+ accept="application/json",
144
+ ),
145
+ "detachInstanceNIC": Operation(
146
+ id="detachInstanceNIC",
147
+ method="DELETE",
148
+ path="/v1/instances/{instance_id}/nics/{interface_id}",
149
+ authenticated=True,
150
+ requiredQuery=[],
151
+ requiredHeaders=[],
152
+ queryEncoding={},
153
+ bodyRequired=False,
154
+ contentType="",
155
+ accept="application/json",
156
+ ),
157
+ "detachInstancePoolFloatingIp": Operation(
158
+ id="detachInstancePoolFloatingIp",
159
+ method="DELETE",
160
+ path="/v1/instance-pools/{pool_id}/floating-ips/{floating_ip_id}",
161
+ authenticated=True,
162
+ requiredQuery=[],
163
+ requiredHeaders=[],
164
+ queryEncoding={},
165
+ bodyRequired=False,
166
+ contentType="",
167
+ accept="application/json",
168
+ ),
169
+ "detachInstanceVolume": Operation(
170
+ id="detachInstanceVolume",
171
+ method="DELETE",
172
+ path="/v1/instances/{instance_id}/volumes/{volume_id}",
173
+ authenticated=True,
174
+ requiredQuery=[],
175
+ requiredHeaders=[],
176
+ queryEncoding={},
177
+ bodyRequired=False,
178
+ contentType="",
179
+ accept="application/json",
180
+ ),
181
+ "getConsoleOutput": Operation(
182
+ id="getConsoleOutput",
183
+ method="GET",
184
+ path="/v1/instances/{instance_id}/console/output",
185
+ authenticated=True,
186
+ requiredQuery=[],
187
+ requiredHeaders=[],
188
+ queryEncoding={"max_bytes": {"style": "form", "explode": True}},
189
+ bodyRequired=False,
190
+ contentType="",
191
+ accept="application/json",
192
+ ),
193
+ "getConsoleScreenshot": Operation(
194
+ id="getConsoleScreenshot",
195
+ method="GET",
196
+ path="/v1/instances/{instance_id}/console/screenshot",
197
+ authenticated=True,
198
+ requiredQuery=[],
199
+ requiredHeaders=[],
200
+ queryEncoding={},
201
+ bodyRequired=False,
202
+ contentType="",
203
+ accept="*/*",
204
+ ),
205
+ "getFlavor": Operation(
206
+ id="getFlavor",
207
+ method="GET",
208
+ path="/v1/flavors/{flavor_id}",
209
+ authenticated=True,
210
+ requiredQuery=[],
211
+ requiredHeaders=[],
212
+ queryEncoding={},
213
+ bodyRequired=False,
214
+ contentType="",
215
+ accept="application/json",
216
+ ),
217
+ "getImage": Operation(
218
+ id="getImage",
219
+ method="GET",
220
+ path="/v1/images/{image_id}",
221
+ authenticated=True,
222
+ requiredQuery=[],
223
+ requiredHeaders=[],
224
+ queryEncoding={},
225
+ bodyRequired=False,
226
+ contentType="",
227
+ accept="application/json",
228
+ ),
229
+ "getInstance": Operation(
230
+ id="getInstance",
231
+ method="GET",
232
+ path="/v1/instances/{instance_id}",
233
+ authenticated=True,
234
+ requiredQuery=[],
235
+ requiredHeaders=[],
236
+ queryEncoding={},
237
+ bodyRequired=False,
238
+ contentType="",
239
+ accept="application/json",
240
+ ),
241
+ "getInstancePool": Operation(
242
+ id="getInstancePool",
243
+ method="GET",
244
+ path="/v1/instance-pools/{pool_id}",
245
+ authenticated=True,
246
+ requiredQuery=[],
247
+ requiredHeaders=[],
248
+ queryEncoding={},
249
+ bodyRequired=False,
250
+ contentType="",
251
+ accept="application/json",
252
+ ),
253
+ "listFlavors": Operation(
254
+ id="listFlavors",
255
+ method="GET",
256
+ path="/v1/flavors",
257
+ authenticated=True,
258
+ requiredQuery=[],
259
+ requiredHeaders=[],
260
+ queryEncoding={
261
+ "name": {"style": "form", "explode": True},
262
+ "crn": {"style": "form", "explode": True},
263
+ "family": {"style": "form", "explode": True},
264
+ },
265
+ bodyRequired=False,
266
+ contentType="",
267
+ accept="application/json",
268
+ itemsKey="flavors",
269
+ ),
270
+ "listImageCatalog": Operation(
271
+ id="listImageCatalog",
272
+ method="GET",
273
+ path="/v1/image-catalog",
274
+ authenticated=True,
275
+ requiredQuery=[],
276
+ requiredHeaders=[],
277
+ queryEncoding={
278
+ "limit": {"style": "form", "explode": True},
279
+ "marker": {"style": "form", "explode": True},
280
+ "name": {"style": "form", "explode": True},
281
+ "os": {"style": "form", "explode": True},
282
+ "architecture": {"style": "form", "explode": True},
283
+ },
284
+ bodyRequired=False,
285
+ contentType="",
286
+ accept="application/json",
287
+ itemsKey="categories",
288
+ ),
289
+ "listImages": Operation(
290
+ id="listImages",
291
+ method="GET",
292
+ path="/v1/images",
293
+ authenticated=True,
294
+ requiredQuery=[],
295
+ requiredHeaders=[],
296
+ queryEncoding={
297
+ "crn": {"style": "form", "explode": True},
298
+ "limit": {"style": "form", "explode": True},
299
+ "marker": {"style": "form", "explode": True},
300
+ "os": {"style": "form", "explode": True},
301
+ "architecture": {"style": "form", "explode": True},
302
+ "name": {"style": "form", "explode": True},
303
+ "status": {"style": "form", "explode": True},
304
+ "all_versions": {"style": "form", "explode": True},
305
+ },
306
+ bodyRequired=False,
307
+ contentType="",
308
+ accept="application/json",
309
+ itemsKey="images",
310
+ ),
311
+ "listInstanceNICs": Operation(
312
+ id="listInstanceNICs",
313
+ method="GET",
314
+ path="/v1/instances/{instance_id}/nics",
315
+ authenticated=True,
316
+ requiredQuery=[],
317
+ requiredHeaders=[],
318
+ queryEncoding={
319
+ "name": {"style": "form", "explode": True},
320
+ "crn": {"style": "form", "explode": True},
321
+ },
322
+ bodyRequired=False,
323
+ contentType="",
324
+ accept="application/json",
325
+ itemsKey="nics",
326
+ ),
327
+ "listInstancePoolFloatingIps": Operation(
328
+ id="listInstancePoolFloatingIps",
329
+ method="GET",
330
+ path="/v1/instance-pools/{pool_id}/floating-ips",
331
+ authenticated=True,
332
+ requiredQuery=[],
333
+ requiredHeaders=[],
334
+ queryEncoding={
335
+ "name": {"style": "form", "explode": True},
336
+ "crn": {"style": "form", "explode": True},
337
+ "limit": {"style": "form", "explode": True},
338
+ "marker": {"style": "form", "explode": True},
339
+ },
340
+ bodyRequired=False,
341
+ contentType="",
342
+ accept="application/json",
343
+ itemsKey="floating_ips",
344
+ ),
345
+ "listInstancePools": Operation(
346
+ id="listInstancePools",
347
+ method="GET",
348
+ path="/v1/instance-pools",
349
+ authenticated=True,
350
+ requiredQuery=[],
351
+ requiredHeaders=[],
352
+ queryEncoding={
353
+ "name": {"style": "form", "explode": True},
354
+ "crn": {"style": "form", "explode": True},
355
+ "limit": {"style": "form", "explode": True},
356
+ "marker": {"style": "form", "explode": True},
357
+ },
358
+ bodyRequired=False,
359
+ contentType="",
360
+ accept="application/json",
361
+ itemsKey="instance_pools",
362
+ ),
363
+ "listInstanceVolumes": Operation(
364
+ id="listInstanceVolumes",
365
+ method="GET",
366
+ path="/v1/instances/{instance_id}/volumes",
367
+ authenticated=True,
368
+ requiredQuery=[],
369
+ requiredHeaders=[],
370
+ queryEncoding={
371
+ "name": {"style": "form", "explode": True},
372
+ "crn": {"style": "form", "explode": True},
373
+ },
374
+ bodyRequired=False,
375
+ contentType="",
376
+ accept="application/json",
377
+ itemsKey="attachments",
378
+ ),
379
+ "listInstances": Operation(
380
+ id="listInstances",
381
+ method="GET",
382
+ path="/v1/instances",
383
+ authenticated=True,
384
+ requiredQuery=[],
385
+ requiredHeaders=[],
386
+ queryEncoding={
387
+ "crn": {"style": "form", "explode": True},
388
+ "limit": {"style": "form", "explode": True},
389
+ "marker": {"style": "form", "explode": True},
390
+ "name": {"style": "form", "explode": True},
391
+ "current_state": {"style": "form", "explode": True},
392
+ "flavor": {"style": "form", "explode": True},
393
+ "image": {"style": "form", "explode": True},
394
+ },
395
+ bodyRequired=False,
396
+ contentType="",
397
+ accept="application/json",
398
+ itemsKey="instances",
399
+ ),
400
+ "listPoolInstances": Operation(
401
+ id="listPoolInstances",
402
+ method="GET",
403
+ path="/v1/instance-pools/{pool_id}/instances",
404
+ authenticated=True,
405
+ requiredQuery=[],
406
+ requiredHeaders=[],
407
+ queryEncoding={
408
+ "crn": {"style": "form", "explode": True},
409
+ "limit": {"style": "form", "explode": True},
410
+ "marker": {"style": "form", "explode": True},
411
+ "name": {"style": "form", "explode": True},
412
+ "current_state": {"style": "form", "explode": True},
413
+ "flavor": {"style": "form", "explode": True},
414
+ "image": {"style": "form", "explode": True},
415
+ },
416
+ bodyRequired=False,
417
+ contentType="",
418
+ accept="application/json",
419
+ itemsKey="instances",
420
+ ),
421
+ "rebootInstance": Operation(
422
+ id="rebootInstance",
423
+ method="POST",
424
+ path="/v1/instances/{instance_id}/reboot",
425
+ authenticated=True,
426
+ requiredQuery=[],
427
+ requiredHeaders=[],
428
+ queryEncoding={},
429
+ bodyRequired=False,
430
+ contentType="application/json",
431
+ accept="application/json",
432
+ ),
433
+ "refreshInstancePool": Operation(
434
+ id="refreshInstancePool",
435
+ method="POST",
436
+ path="/v1/instance-pools/{pool_id}/refresh",
437
+ authenticated=True,
438
+ requiredQuery=[],
439
+ requiredHeaders=[],
440
+ queryEncoding={},
441
+ bodyRequired=False,
442
+ contentType="",
443
+ accept="application/json",
444
+ ),
445
+ "reinstallInstance": Operation(
446
+ id="reinstallInstance",
447
+ method="POST",
448
+ path="/v1/instances/{instance_id}/reinstall",
449
+ authenticated=True,
450
+ requiredQuery=[],
451
+ requiredHeaders=[],
452
+ queryEncoding={},
453
+ bodyRequired=False,
454
+ contentType="application/json",
455
+ accept="application/json",
456
+ ),
457
+ "resizeInstance": Operation(
458
+ id="resizeInstance",
459
+ method="POST",
460
+ path="/v1/instances/{instance_id}/resize",
461
+ authenticated=True,
462
+ requiredQuery=[],
463
+ requiredHeaders=[],
464
+ queryEncoding={},
465
+ bodyRequired=True,
466
+ contentType="application/json",
467
+ accept="application/json",
468
+ ),
469
+ "startInstance": Operation(
470
+ id="startInstance",
471
+ method="POST",
472
+ path="/v1/instances/{instance_id}/start",
473
+ authenticated=True,
474
+ requiredQuery=[],
475
+ requiredHeaders=[],
476
+ queryEncoding={},
477
+ bodyRequired=False,
478
+ contentType="",
479
+ accept="application/json",
480
+ ),
481
+ "startSerialConsole": Operation(
482
+ id="startSerialConsole",
483
+ method="GET",
484
+ path="/v1/instances/{instance_id}/console/serial",
485
+ authenticated=True,
486
+ requiredQuery=[],
487
+ requiredHeaders=[],
488
+ queryEncoding={"backlog_bytes": {"style": "form", "explode": True}},
489
+ bodyRequired=False,
490
+ contentType="",
491
+ accept="application/json",
492
+ ),
493
+ "stopInstance": Operation(
494
+ id="stopInstance",
495
+ method="POST",
496
+ path="/v1/instances/{instance_id}/stop",
497
+ authenticated=True,
498
+ requiredQuery=[],
499
+ requiredHeaders=[],
500
+ queryEncoding={},
501
+ bodyRequired=False,
502
+ contentType="",
503
+ accept="application/json",
504
+ ),
505
+ "updateImage": Operation(
506
+ id="updateImage",
507
+ method="PATCH",
508
+ path="/v1/images/{image_id}",
509
+ authenticated=True,
510
+ requiredQuery=[],
511
+ requiredHeaders=[],
512
+ queryEncoding={},
513
+ bodyRequired=True,
514
+ contentType="application/json",
515
+ accept="application/json",
516
+ ),
517
+ "updateInstance": Operation(
518
+ id="updateInstance",
519
+ method="PATCH",
520
+ path="/v1/instances/{instance_id}",
521
+ authenticated=True,
522
+ requiredQuery=[],
523
+ requiredHeaders=[],
524
+ queryEncoding={},
525
+ bodyRequired=True,
526
+ contentType="application/json",
527
+ accept="application/json",
528
+ ),
529
+ "updateInstancePool": Operation(
530
+ id="updateInstancePool",
531
+ method="PATCH",
532
+ path="/v1/instance-pools/{pool_id}",
533
+ authenticated=True,
534
+ requiredQuery=[],
535
+ requiredHeaders=[],
536
+ queryEncoding={},
537
+ bodyRequired=True,
538
+ contentType="application/json",
539
+ accept="application/json",
540
+ ),
541
+ "updateInstanceVolumeAttachment": Operation(
542
+ id="updateInstanceVolumeAttachment",
543
+ method="PATCH",
544
+ path="/v1/instances/{instance_id}/volumes/{volume_id}",
545
+ authenticated=True,
546
+ requiredQuery=[],
547
+ requiredHeaders=[],
548
+ queryEncoding={},
549
+ bodyRequired=True,
550
+ contentType="application/json",
551
+ accept="application/json",
552
+ ),
553
+ }
554
+
555
+
556
+ class ComputeService:
557
+ def __init__(self, transport: SyncTransport) -> None:
558
+ self._transport = transport
559
+
560
+ def attach_instance_nic(
561
+ self,
562
+ instance_id: str,
563
+ body: m.AttachInstanceNICBody,
564
+ *,
565
+ options: RequestOptions | None = None,
566
+ ) -> ApiResponse[m.AttachInstanceNICResponse]:
567
+ "Attach an existing NIC to an instance"
568
+ return cast(
569
+ ApiResponse[m.AttachInstanceNICResponse],
570
+ self._transport.request(
571
+ "compute",
572
+ "https://compute.{region}.basaltic.sh",
573
+ _OPS["attachInstanceNIC"],
574
+ "json",
575
+ {"instance_id": instance_id},
576
+ body,
577
+ None,
578
+ options,
579
+ ),
580
+ )
581
+
582
+ def attach_instance_pool_floating_ip(
583
+ self,
584
+ pool_id: str,
585
+ body: m.AttachInstancePoolFloatingIpBody,
586
+ *,
587
+ options: RequestOptions | None = None,
588
+ ) -> ApiResponse[m.AttachInstancePoolFloatingIpResponse]:
589
+ "Give the pool a shared public address"
590
+ return cast(
591
+ ApiResponse[m.AttachInstancePoolFloatingIpResponse],
592
+ self._transport.request(
593
+ "compute",
594
+ "https://compute.{region}.basaltic.sh",
595
+ _OPS["attachInstancePoolFloatingIp"],
596
+ "json",
597
+ {"pool_id": pool_id},
598
+ body,
599
+ None,
600
+ options,
601
+ ),
602
+ )
603
+
604
+ def attach_instance_volume(
605
+ self,
606
+ instance_id: str,
607
+ body: m.AttachInstanceVolumeBody,
608
+ *,
609
+ options: RequestOptions | None = None,
610
+ ) -> ApiResponse[m.AttachInstanceVolumeResponse]:
611
+ "Attach a data volume to an instance"
612
+ return cast(
613
+ ApiResponse[m.AttachInstanceVolumeResponse],
614
+ self._transport.request(
615
+ "compute",
616
+ "https://compute.{region}.basaltic.sh",
617
+ _OPS["attachInstanceVolume"],
618
+ "json",
619
+ {"instance_id": instance_id},
620
+ body,
621
+ None,
622
+ options,
623
+ ),
624
+ )
625
+
626
+ def create_image(
627
+ self, body: m.CreateImageBody, *, options: RequestOptions | None = None
628
+ ) -> ApiResponse[m.CreateImageResponse]:
629
+ "Import an image from an object URL"
630
+ return cast(
631
+ ApiResponse[m.CreateImageResponse],
632
+ self._transport.request(
633
+ "compute",
634
+ "https://compute.{region}.basaltic.sh",
635
+ _OPS["createImage"],
636
+ "json",
637
+ {},
638
+ body,
639
+ None,
640
+ options,
641
+ ),
642
+ )
643
+
644
+ def create_instance(
645
+ self, body: m.CreateInstanceBody, *, options: RequestOptions | None = None
646
+ ) -> ApiResponse[m.CreateInstanceResponse]:
647
+ "Create instance"
648
+ return cast(
649
+ ApiResponse[m.CreateInstanceResponse],
650
+ self._transport.request(
651
+ "compute",
652
+ "https://compute.{region}.basaltic.sh",
653
+ _OPS["createInstance"],
654
+ "json",
655
+ {},
656
+ body,
657
+ None,
658
+ options,
659
+ ),
660
+ )
661
+
662
+ def create_instance_pool(
663
+ self, body: m.CreateInstancePoolBody, *, options: RequestOptions | None = None
664
+ ) -> ApiResponse[m.CreateInstancePoolResponse]:
665
+ "Create an instance pool"
666
+ return cast(
667
+ ApiResponse[m.CreateInstancePoolResponse],
668
+ self._transport.request(
669
+ "compute",
670
+ "https://compute.{region}.basaltic.sh",
671
+ _OPS["createInstancePool"],
672
+ "json",
673
+ {},
674
+ body,
675
+ None,
676
+ options,
677
+ ),
678
+ )
679
+
680
+ def create_serial_console_ticket(
681
+ self, instance_id: str, *, options: RequestOptions | None = None
682
+ ) -> ApiResponse[m.CreateSerialConsoleTicketResponse]:
683
+ "Mint a ticket for the serial console"
684
+ return cast(
685
+ ApiResponse[m.CreateSerialConsoleTicketResponse],
686
+ self._transport.request(
687
+ "compute",
688
+ "https://compute.{region}.basaltic.sh",
689
+ _OPS["createSerialConsoleTicket"],
690
+ "json",
691
+ {"instance_id": instance_id},
692
+ UNSET,
693
+ None,
694
+ options,
695
+ ),
696
+ )
697
+
698
+ def delete_image(
699
+ self, image_id: str, *, options: RequestOptions | None = None
700
+ ) -> ApiResponse[m.DeleteImageResponse]:
701
+ "Delete an unused image"
702
+ return cast(
703
+ ApiResponse[m.DeleteImageResponse],
704
+ self._transport.request(
705
+ "compute",
706
+ "https://compute.{region}.basaltic.sh",
707
+ _OPS["deleteImage"],
708
+ "json",
709
+ {"image_id": image_id},
710
+ UNSET,
711
+ None,
712
+ options,
713
+ ),
714
+ )
715
+
716
+ def delete_instance(self, instance_id: str, *, options: RequestOptions | None = None) -> None:
717
+ "Delete instance"
718
+ return cast(
719
+ None,
720
+ self._transport.request(
721
+ "compute",
722
+ "https://compute.{region}.basaltic.sh",
723
+ _OPS["deleteInstance"],
724
+ "discard",
725
+ {"instance_id": instance_id},
726
+ UNSET,
727
+ None,
728
+ options,
729
+ ),
730
+ )
731
+
732
+ def delete_instance_pool(self, pool_id: str, *, options: RequestOptions | None = None) -> None:
733
+ "Delete an instance pool"
734
+ return cast(
735
+ None,
736
+ self._transport.request(
737
+ "compute",
738
+ "https://compute.{region}.basaltic.sh",
739
+ _OPS["deleteInstancePool"],
740
+ "discard",
741
+ {"pool_id": pool_id},
742
+ UNSET,
743
+ None,
744
+ options,
745
+ ),
746
+ )
747
+
748
+ def detach_instance_nic(
749
+ self, instance_id: str, interface_id: str, *, options: RequestOptions | None = None
750
+ ) -> None:
751
+ "Detach a NIC from a running instance"
752
+ return cast(
753
+ None,
754
+ self._transport.request(
755
+ "compute",
756
+ "https://compute.{region}.basaltic.sh",
757
+ _OPS["detachInstanceNIC"],
758
+ "discard",
759
+ {"instance_id": instance_id, "interface_id": interface_id},
760
+ UNSET,
761
+ None,
762
+ options,
763
+ ),
764
+ )
765
+
766
+ def detach_instance_pool_floating_ip(
767
+ self, pool_id: str, floating_ip_id: str, *, options: RequestOptions | None = None
768
+ ) -> None:
769
+ "Take a shared address off the pool"
770
+ return cast(
771
+ None,
772
+ self._transport.request(
773
+ "compute",
774
+ "https://compute.{region}.basaltic.sh",
775
+ _OPS["detachInstancePoolFloatingIp"],
776
+ "discard",
777
+ {"pool_id": pool_id, "floating_ip_id": floating_ip_id},
778
+ UNSET,
779
+ None,
780
+ options,
781
+ ),
782
+ )
783
+
784
+ def detach_instance_volume(
785
+ self, instance_id: str, volume_id: str, *, options: RequestOptions | None = None
786
+ ) -> None:
787
+ "Detach a data volume from an instance"
788
+ return cast(
789
+ None,
790
+ self._transport.request(
791
+ "compute",
792
+ "https://compute.{region}.basaltic.sh",
793
+ _OPS["detachInstanceVolume"],
794
+ "discard",
795
+ {"instance_id": instance_id, "volume_id": volume_id},
796
+ UNSET,
797
+ None,
798
+ options,
799
+ ),
800
+ )
801
+
802
+ def get_console_output(
803
+ self,
804
+ instance_id: str,
805
+ *,
806
+ query: m.GetConsoleOutputQuery | None = None,
807
+ options: RequestOptions | None = None,
808
+ ) -> ApiResponse[m.GetConsoleOutputResponse]:
809
+ "Get the instance's serial console output"
810
+ return cast(
811
+ ApiResponse[m.GetConsoleOutputResponse],
812
+ self._transport.request(
813
+ "compute",
814
+ "https://compute.{region}.basaltic.sh",
815
+ _OPS["getConsoleOutput"],
816
+ "json",
817
+ {"instance_id": instance_id},
818
+ UNSET,
819
+ query,
820
+ options,
821
+ ),
822
+ )
823
+
824
+ def get_console_screenshot(
825
+ self, instance_id: str, *, options: RequestOptions | None = None
826
+ ) -> httpx.Response:
827
+ "Capture the instance's display"
828
+ return cast(
829
+ httpx.Response,
830
+ self._transport.request(
831
+ "compute",
832
+ "https://compute.{region}.basaltic.sh",
833
+ _OPS["getConsoleScreenshot"],
834
+ "binary",
835
+ {"instance_id": instance_id},
836
+ UNSET,
837
+ None,
838
+ options,
839
+ ),
840
+ )
841
+
842
+ def get_flavor(
843
+ self, flavor_id: str, *, options: RequestOptions | None = None
844
+ ) -> ApiResponse[m.GetFlavorResponse]:
845
+ "Get flavor"
846
+ return cast(
847
+ ApiResponse[m.GetFlavorResponse],
848
+ self._transport.request(
849
+ "compute",
850
+ "https://compute.{region}.basaltic.sh",
851
+ _OPS["getFlavor"],
852
+ "json",
853
+ {"flavor_id": flavor_id},
854
+ UNSET,
855
+ None,
856
+ options,
857
+ ),
858
+ )
859
+
860
+ def get_flavor_by_reference(
861
+ self,
862
+ reference: str,
863
+ *,
864
+ scope: m.GetFlavorScope | None = None,
865
+ options: RequestOptions | None = None,
866
+ ) -> ApiResponse[m.GetFlavorResource]:
867
+ return cast(
868
+ ApiResponse[m.GetFlavorResource],
869
+ resolve_reference(
870
+ reference,
871
+ lambda id: self.get_flavor(id, options=options),
872
+ lambda match: self.list_flavors(
873
+ query=cast(m.ListFlavorsQuery, {**reference_scope(scope), **match}),
874
+ options=options,
875
+ ),
876
+ True,
877
+ "flavor",
878
+ ),
879
+ )
880
+
881
+ def get_image(
882
+ self, image_id: str, *, options: RequestOptions | None = None
883
+ ) -> ApiResponse[m.GetImageResponse]:
884
+ "Get an image"
885
+ return cast(
886
+ ApiResponse[m.GetImageResponse],
887
+ self._transport.request(
888
+ "compute",
889
+ "https://compute.{region}.basaltic.sh",
890
+ _OPS["getImage"],
891
+ "json",
892
+ {"image_id": image_id},
893
+ UNSET,
894
+ None,
895
+ options,
896
+ ),
897
+ )
898
+
899
+ def get_image_by_reference(
900
+ self,
901
+ reference: str,
902
+ *,
903
+ scope: m.GetImageScope | None = None,
904
+ options: RequestOptions | None = None,
905
+ ) -> ApiResponse[m.GetImageResource]:
906
+ return cast(
907
+ ApiResponse[m.GetImageResource],
908
+ resolve_reference(
909
+ reference,
910
+ lambda id: self.get_image(id, options=options),
911
+ lambda match: self.list_images(
912
+ query=cast(m.ListImagesQuery, {**reference_scope(scope), **match, "limit": 2}),
913
+ options=options,
914
+ ),
915
+ True,
916
+ "image",
917
+ ),
918
+ )
919
+
920
+ def get_instance(
921
+ self, instance_id: str, *, options: RequestOptions | None = None
922
+ ) -> ApiResponse[m.GetInstanceResponse]:
923
+ "Get instance"
924
+ return cast(
925
+ ApiResponse[m.GetInstanceResponse],
926
+ self._transport.request(
927
+ "compute",
928
+ "https://compute.{region}.basaltic.sh",
929
+ _OPS["getInstance"],
930
+ "json",
931
+ {"instance_id": instance_id},
932
+ UNSET,
933
+ None,
934
+ options,
935
+ ),
936
+ )
937
+
938
+ def get_instance_by_reference(
939
+ self,
940
+ reference: str,
941
+ *,
942
+ scope: m.GetInstanceScope | None = None,
943
+ options: RequestOptions | None = None,
944
+ ) -> ApiResponse[m.GetInstanceResource]:
945
+ return cast(
946
+ ApiResponse[m.GetInstanceResource],
947
+ resolve_reference(
948
+ reference,
949
+ lambda id: self.get_instance(id, options=options),
950
+ lambda match: self.list_instances(
951
+ query=cast(
952
+ m.ListInstancesQuery, {**reference_scope(scope), **match, "limit": 2}
953
+ ),
954
+ options=options,
955
+ ),
956
+ True,
957
+ "instance",
958
+ ),
959
+ )
960
+
961
+ def get_instance_pool(
962
+ self, pool_id: str, *, options: RequestOptions | None = None
963
+ ) -> ApiResponse[m.GetInstancePoolResponse]:
964
+ "Get an instance pool"
965
+ return cast(
966
+ ApiResponse[m.GetInstancePoolResponse],
967
+ self._transport.request(
968
+ "compute",
969
+ "https://compute.{region}.basaltic.sh",
970
+ _OPS["getInstancePool"],
971
+ "json",
972
+ {"pool_id": pool_id},
973
+ UNSET,
974
+ None,
975
+ options,
976
+ ),
977
+ )
978
+
979
+ def get_instance_pool_by_reference(
980
+ self,
981
+ reference: str,
982
+ *,
983
+ scope: m.GetInstancePoolScope | None = None,
984
+ options: RequestOptions | None = None,
985
+ ) -> ApiResponse[m.GetInstancePoolResource]:
986
+ return cast(
987
+ ApiResponse[m.GetInstancePoolResource],
988
+ resolve_reference(
989
+ reference,
990
+ lambda id: self.get_instance_pool(id, options=options),
991
+ lambda match: self.list_instance_pools(
992
+ query=cast(
993
+ m.ListInstancePoolsQuery, {**reference_scope(scope), **match, "limit": 2}
994
+ ),
995
+ options=options,
996
+ ),
997
+ True,
998
+ "instance_pool",
999
+ ),
1000
+ )
1001
+
1002
+ def list_flavors(
1003
+ self, *, query: m.ListFlavorsQuery | None = None, options: RequestOptions | None = None
1004
+ ) -> Page[m.ListFlavorsResponse, m.ListFlavorsItem]:
1005
+ "List flavors"
1006
+ return cast(
1007
+ Page[m.ListFlavorsResponse, m.ListFlavorsItem],
1008
+ self._transport.request(
1009
+ "compute",
1010
+ "https://compute.{region}.basaltic.sh",
1011
+ _OPS["listFlavors"],
1012
+ "page",
1013
+ {},
1014
+ UNSET,
1015
+ query,
1016
+ options,
1017
+ ),
1018
+ )
1019
+
1020
+ def list_image_catalog(
1021
+ self, *, query: m.ListImageCatalogQuery | None = None, options: RequestOptions | None = None
1022
+ ) -> Page[m.ListImageCatalogResponse, m.ListImageCatalogItem]:
1023
+ "List the launch image catalog"
1024
+ return cast(
1025
+ Page[m.ListImageCatalogResponse, m.ListImageCatalogItem],
1026
+ self._transport.request(
1027
+ "compute",
1028
+ "https://compute.{region}.basaltic.sh",
1029
+ _OPS["listImageCatalog"],
1030
+ "page",
1031
+ {},
1032
+ UNSET,
1033
+ query,
1034
+ options,
1035
+ ),
1036
+ )
1037
+
1038
+ def list_image_catalog_all(
1039
+ self, *, query: m.ListImageCatalogQuery | None = None, options: RequestOptions | None = None
1040
+ ) -> Iterator[m.ListImageCatalogItem]:
1041
+ return iterate_pages(
1042
+ lambda marker: self.list_image_catalog(
1043
+ query=cast(m.ListImageCatalogQuery, {**(query or {}), "marker": marker}),
1044
+ options=options,
1045
+ ),
1046
+ (query or {}).get("marker", ""),
1047
+ )
1048
+
1049
+ def list_images(
1050
+ self, *, query: m.ListImagesQuery | None = None, options: RequestOptions | None = None
1051
+ ) -> Page[m.ListImagesResponse, m.ListImagesItem]:
1052
+ "List images"
1053
+ return cast(
1054
+ Page[m.ListImagesResponse, m.ListImagesItem],
1055
+ self._transport.request(
1056
+ "compute",
1057
+ "https://compute.{region}.basaltic.sh",
1058
+ _OPS["listImages"],
1059
+ "page",
1060
+ {},
1061
+ UNSET,
1062
+ query,
1063
+ options,
1064
+ ),
1065
+ )
1066
+
1067
+ def list_images_all(
1068
+ self, *, query: m.ListImagesQuery | None = None, options: RequestOptions | None = None
1069
+ ) -> Iterator[m.ListImagesItem]:
1070
+ return iterate_pages(
1071
+ lambda marker: self.list_images(
1072
+ query=cast(m.ListImagesQuery, {**(query or {}), "marker": marker}), options=options
1073
+ ),
1074
+ (query or {}).get("marker", ""),
1075
+ )
1076
+
1077
+ def list_instance_ni_cs(
1078
+ self,
1079
+ instance_id: str,
1080
+ *,
1081
+ query: m.ListInstanceNICsQuery | None = None,
1082
+ options: RequestOptions | None = None,
1083
+ ) -> Page[m.ListInstanceNICsResponse, m.ListInstanceNICsItem]:
1084
+ "List the instance's network interfaces"
1085
+ return cast(
1086
+ Page[m.ListInstanceNICsResponse, m.ListInstanceNICsItem],
1087
+ self._transport.request(
1088
+ "compute",
1089
+ "https://compute.{region}.basaltic.sh",
1090
+ _OPS["listInstanceNICs"],
1091
+ "page",
1092
+ {"instance_id": instance_id},
1093
+ UNSET,
1094
+ query,
1095
+ options,
1096
+ ),
1097
+ )
1098
+
1099
+ def list_instance_pool_floating_ips(
1100
+ self,
1101
+ pool_id: str,
1102
+ *,
1103
+ query: m.ListInstancePoolFloatingIpsQuery | None = None,
1104
+ options: RequestOptions | None = None,
1105
+ ) -> Page[m.ListInstancePoolFloatingIpsResponse, m.ListInstancePoolFloatingIpsItem]:
1106
+ "List the pool's shared public addresses"
1107
+ return cast(
1108
+ Page[m.ListInstancePoolFloatingIpsResponse, m.ListInstancePoolFloatingIpsItem],
1109
+ self._transport.request(
1110
+ "compute",
1111
+ "https://compute.{region}.basaltic.sh",
1112
+ _OPS["listInstancePoolFloatingIps"],
1113
+ "page",
1114
+ {"pool_id": pool_id},
1115
+ UNSET,
1116
+ query,
1117
+ options,
1118
+ ),
1119
+ )
1120
+
1121
+ def list_instance_pool_floating_ips_all(
1122
+ self,
1123
+ pool_id: str,
1124
+ *,
1125
+ query: m.ListInstancePoolFloatingIpsQuery | None = None,
1126
+ options: RequestOptions | None = None,
1127
+ ) -> Iterator[m.ListInstancePoolFloatingIpsItem]:
1128
+ return iterate_pages(
1129
+ lambda marker: self.list_instance_pool_floating_ips(
1130
+ pool_id,
1131
+ query=cast(m.ListInstancePoolFloatingIpsQuery, {**(query or {}), "marker": marker}),
1132
+ options=options,
1133
+ ),
1134
+ (query or {}).get("marker", ""),
1135
+ )
1136
+
1137
+ def list_instance_pools(
1138
+ self,
1139
+ *,
1140
+ query: m.ListInstancePoolsQuery | None = None,
1141
+ options: RequestOptions | None = None,
1142
+ ) -> Page[m.ListInstancePoolsResponse, m.ListInstancePoolsItem]:
1143
+ "List instance pools"
1144
+ return cast(
1145
+ Page[m.ListInstancePoolsResponse, m.ListInstancePoolsItem],
1146
+ self._transport.request(
1147
+ "compute",
1148
+ "https://compute.{region}.basaltic.sh",
1149
+ _OPS["listInstancePools"],
1150
+ "page",
1151
+ {},
1152
+ UNSET,
1153
+ query,
1154
+ options,
1155
+ ),
1156
+ )
1157
+
1158
+ def list_instance_pools_all(
1159
+ self,
1160
+ *,
1161
+ query: m.ListInstancePoolsQuery | None = None,
1162
+ options: RequestOptions | None = None,
1163
+ ) -> Iterator[m.ListInstancePoolsItem]:
1164
+ return iterate_pages(
1165
+ lambda marker: self.list_instance_pools(
1166
+ query=cast(m.ListInstancePoolsQuery, {**(query or {}), "marker": marker}),
1167
+ options=options,
1168
+ ),
1169
+ (query or {}).get("marker", ""),
1170
+ )
1171
+
1172
+ def list_instance_volumes(
1173
+ self,
1174
+ instance_id: str,
1175
+ *,
1176
+ query: m.ListInstanceVolumesQuery | None = None,
1177
+ options: RequestOptions | None = None,
1178
+ ) -> Page[m.ListInstanceVolumesResponse, m.ListInstanceVolumesItem]:
1179
+ "List the instance's attached volumes"
1180
+ return cast(
1181
+ Page[m.ListInstanceVolumesResponse, m.ListInstanceVolumesItem],
1182
+ self._transport.request(
1183
+ "compute",
1184
+ "https://compute.{region}.basaltic.sh",
1185
+ _OPS["listInstanceVolumes"],
1186
+ "page",
1187
+ {"instance_id": instance_id},
1188
+ UNSET,
1189
+ query,
1190
+ options,
1191
+ ),
1192
+ )
1193
+
1194
+ def list_instances(
1195
+ self, *, query: m.ListInstancesQuery | None = None, options: RequestOptions | None = None
1196
+ ) -> Page[m.ListInstancesResponse, m.ListInstancesItem]:
1197
+ "List instances"
1198
+ return cast(
1199
+ Page[m.ListInstancesResponse, m.ListInstancesItem],
1200
+ self._transport.request(
1201
+ "compute",
1202
+ "https://compute.{region}.basaltic.sh",
1203
+ _OPS["listInstances"],
1204
+ "page",
1205
+ {},
1206
+ UNSET,
1207
+ query,
1208
+ options,
1209
+ ),
1210
+ )
1211
+
1212
+ def list_instances_all(
1213
+ self, *, query: m.ListInstancesQuery | None = None, options: RequestOptions | None = None
1214
+ ) -> Iterator[m.ListInstancesItem]:
1215
+ return iterate_pages(
1216
+ lambda marker: self.list_instances(
1217
+ query=cast(m.ListInstancesQuery, {**(query or {}), "marker": marker}),
1218
+ options=options,
1219
+ ),
1220
+ (query or {}).get("marker", ""),
1221
+ )
1222
+
1223
+ def list_pool_instances(
1224
+ self,
1225
+ pool_id: str,
1226
+ *,
1227
+ query: m.ListPoolInstancesQuery | None = None,
1228
+ options: RequestOptions | None = None,
1229
+ ) -> Page[m.ListPoolInstancesResponse, m.ListPoolInstancesItem]:
1230
+ "List a pool's instances"
1231
+ return cast(
1232
+ Page[m.ListPoolInstancesResponse, m.ListPoolInstancesItem],
1233
+ self._transport.request(
1234
+ "compute",
1235
+ "https://compute.{region}.basaltic.sh",
1236
+ _OPS["listPoolInstances"],
1237
+ "page",
1238
+ {"pool_id": pool_id},
1239
+ UNSET,
1240
+ query,
1241
+ options,
1242
+ ),
1243
+ )
1244
+
1245
+ def list_pool_instances_all(
1246
+ self,
1247
+ pool_id: str,
1248
+ *,
1249
+ query: m.ListPoolInstancesQuery | None = None,
1250
+ options: RequestOptions | None = None,
1251
+ ) -> Iterator[m.ListPoolInstancesItem]:
1252
+ return iterate_pages(
1253
+ lambda marker: self.list_pool_instances(
1254
+ pool_id,
1255
+ query=cast(m.ListPoolInstancesQuery, {**(query or {}), "marker": marker}),
1256
+ options=options,
1257
+ ),
1258
+ (query or {}).get("marker", ""),
1259
+ )
1260
+
1261
+ def reboot_instance(
1262
+ self,
1263
+ instance_id: str,
1264
+ body: m.RebootInstanceBody | Unset = UNSET,
1265
+ *,
1266
+ options: RequestOptions | None = None,
1267
+ ) -> None:
1268
+ "Reboot instance"
1269
+ return cast(
1270
+ None,
1271
+ self._transport.request(
1272
+ "compute",
1273
+ "https://compute.{region}.basaltic.sh",
1274
+ _OPS["rebootInstance"],
1275
+ "discard",
1276
+ {"instance_id": instance_id},
1277
+ body,
1278
+ None,
1279
+ options,
1280
+ ),
1281
+ )
1282
+
1283
+ def refresh_instance_pool(
1284
+ self, pool_id: str, *, options: RequestOptions | None = None
1285
+ ) -> ApiResponse[m.RefreshInstancePoolResponse]:
1286
+ "Roll every member onto the pool's current launch template"
1287
+ return cast(
1288
+ ApiResponse[m.RefreshInstancePoolResponse],
1289
+ self._transport.request(
1290
+ "compute",
1291
+ "https://compute.{region}.basaltic.sh",
1292
+ _OPS["refreshInstancePool"],
1293
+ "json",
1294
+ {"pool_id": pool_id},
1295
+ UNSET,
1296
+ None,
1297
+ options,
1298
+ ),
1299
+ )
1300
+
1301
+ def reinstall_instance(
1302
+ self,
1303
+ instance_id: str,
1304
+ body: m.ReinstallInstanceBody | Unset = UNSET,
1305
+ *,
1306
+ options: RequestOptions | None = None,
1307
+ ) -> None:
1308
+ "Reinstall instance"
1309
+ return cast(
1310
+ None,
1311
+ self._transport.request(
1312
+ "compute",
1313
+ "https://compute.{region}.basaltic.sh",
1314
+ _OPS["reinstallInstance"],
1315
+ "discard",
1316
+ {"instance_id": instance_id},
1317
+ body,
1318
+ None,
1319
+ options,
1320
+ ),
1321
+ )
1322
+
1323
+ def resize_instance(
1324
+ self, instance_id: str, body: m.ResizeInstanceBody, *, options: RequestOptions | None = None
1325
+ ) -> None:
1326
+ "Resize instance"
1327
+ return cast(
1328
+ None,
1329
+ self._transport.request(
1330
+ "compute",
1331
+ "https://compute.{region}.basaltic.sh",
1332
+ _OPS["resizeInstance"],
1333
+ "discard",
1334
+ {"instance_id": instance_id},
1335
+ body,
1336
+ None,
1337
+ options,
1338
+ ),
1339
+ )
1340
+
1341
+ def start_instance(self, instance_id: str, *, options: RequestOptions | None = None) -> None:
1342
+ "Start instance"
1343
+ return cast(
1344
+ None,
1345
+ self._transport.request(
1346
+ "compute",
1347
+ "https://compute.{region}.basaltic.sh",
1348
+ _OPS["startInstance"],
1349
+ "discard",
1350
+ {"instance_id": instance_id},
1351
+ UNSET,
1352
+ None,
1353
+ options,
1354
+ ),
1355
+ )
1356
+
1357
+ def start_serial_console(
1358
+ self,
1359
+ instance_id: str,
1360
+ *,
1361
+ query: m.StartSerialConsoleQuery | None = None,
1362
+ options: RequestOptions | None = None,
1363
+ ) -> WebSocketConnection:
1364
+ "Open an interactive serial console"
1365
+ return cast(
1366
+ WebSocketConnection,
1367
+ self._transport.request(
1368
+ "compute",
1369
+ "https://compute.{region}.basaltic.sh",
1370
+ _OPS["startSerialConsole"],
1371
+ "websocket",
1372
+ {"instance_id": instance_id},
1373
+ UNSET,
1374
+ query,
1375
+ options,
1376
+ ),
1377
+ )
1378
+
1379
+ def stop_instance(self, instance_id: str, *, options: RequestOptions | None = None) -> None:
1380
+ "Stop instance"
1381
+ return cast(
1382
+ None,
1383
+ self._transport.request(
1384
+ "compute",
1385
+ "https://compute.{region}.basaltic.sh",
1386
+ _OPS["stopInstance"],
1387
+ "discard",
1388
+ {"instance_id": instance_id},
1389
+ UNSET,
1390
+ None,
1391
+ options,
1392
+ ),
1393
+ )
1394
+
1395
+ def update_image(
1396
+ self, image_id: str, body: m.UpdateImageBody, *, options: RequestOptions | None = None
1397
+ ) -> ApiResponse[m.UpdateImageResponse]:
1398
+ "Update an image's metadata"
1399
+ return cast(
1400
+ ApiResponse[m.UpdateImageResponse],
1401
+ self._transport.request(
1402
+ "compute",
1403
+ "https://compute.{region}.basaltic.sh",
1404
+ _OPS["updateImage"],
1405
+ "json",
1406
+ {"image_id": image_id},
1407
+ body,
1408
+ None,
1409
+ options,
1410
+ ),
1411
+ )
1412
+
1413
+ def update_instance(
1414
+ self, instance_id: str, body: m.UpdateInstanceBody, *, options: RequestOptions | None = None
1415
+ ) -> ApiResponse[m.UpdateInstanceResponse]:
1416
+ "Update instance"
1417
+ return cast(
1418
+ ApiResponse[m.UpdateInstanceResponse],
1419
+ self._transport.request(
1420
+ "compute",
1421
+ "https://compute.{region}.basaltic.sh",
1422
+ _OPS["updateInstance"],
1423
+ "json",
1424
+ {"instance_id": instance_id},
1425
+ body,
1426
+ None,
1427
+ options,
1428
+ ),
1429
+ )
1430
+
1431
+ def update_instance_pool(
1432
+ self, pool_id: str, body: m.UpdateInstancePoolBody, *, options: RequestOptions | None = None
1433
+ ) -> ApiResponse[m.UpdateInstancePoolResponse]:
1434
+ "Update an instance pool's description, size, tags or launch template"
1435
+ return cast(
1436
+ ApiResponse[m.UpdateInstancePoolResponse],
1437
+ self._transport.request(
1438
+ "compute",
1439
+ "https://compute.{region}.basaltic.sh",
1440
+ _OPS["updateInstancePool"],
1441
+ "json",
1442
+ {"pool_id": pool_id},
1443
+ body,
1444
+ None,
1445
+ options,
1446
+ ),
1447
+ )
1448
+
1449
+ def update_instance_volume_attachment(
1450
+ self,
1451
+ instance_id: str,
1452
+ volume_id: str,
1453
+ body: m.UpdateInstanceVolumeAttachmentBody,
1454
+ *,
1455
+ options: RequestOptions | None = None,
1456
+ ) -> None:
1457
+ "Update a volume attachment's settings"
1458
+ return cast(
1459
+ None,
1460
+ self._transport.request(
1461
+ "compute",
1462
+ "https://compute.{region}.basaltic.sh",
1463
+ _OPS["updateInstanceVolumeAttachment"],
1464
+ "discard",
1465
+ {"instance_id": instance_id, "volume_id": volume_id},
1466
+ body,
1467
+ None,
1468
+ options,
1469
+ ),
1470
+ )
1471
+
1472
+
1473
+ class AsyncComputeService:
1474
+ def __init__(self, transport: AsyncTransport) -> None:
1475
+ self._transport = transport
1476
+
1477
+ async def attach_instance_nic(
1478
+ self,
1479
+ instance_id: str,
1480
+ body: m.AttachInstanceNICBody,
1481
+ *,
1482
+ options: RequestOptions | None = None,
1483
+ ) -> ApiResponse[m.AttachInstanceNICResponse]:
1484
+ "Attach an existing NIC to an instance"
1485
+ return cast(
1486
+ ApiResponse[m.AttachInstanceNICResponse],
1487
+ await self._transport.request(
1488
+ "compute",
1489
+ "https://compute.{region}.basaltic.sh",
1490
+ _OPS["attachInstanceNIC"],
1491
+ "json",
1492
+ {"instance_id": instance_id},
1493
+ body,
1494
+ None,
1495
+ options,
1496
+ ),
1497
+ )
1498
+
1499
+ async def attach_instance_pool_floating_ip(
1500
+ self,
1501
+ pool_id: str,
1502
+ body: m.AttachInstancePoolFloatingIpBody,
1503
+ *,
1504
+ options: RequestOptions | None = None,
1505
+ ) -> ApiResponse[m.AttachInstancePoolFloatingIpResponse]:
1506
+ "Give the pool a shared public address"
1507
+ return cast(
1508
+ ApiResponse[m.AttachInstancePoolFloatingIpResponse],
1509
+ await self._transport.request(
1510
+ "compute",
1511
+ "https://compute.{region}.basaltic.sh",
1512
+ _OPS["attachInstancePoolFloatingIp"],
1513
+ "json",
1514
+ {"pool_id": pool_id},
1515
+ body,
1516
+ None,
1517
+ options,
1518
+ ),
1519
+ )
1520
+
1521
+ async def attach_instance_volume(
1522
+ self,
1523
+ instance_id: str,
1524
+ body: m.AttachInstanceVolumeBody,
1525
+ *,
1526
+ options: RequestOptions | None = None,
1527
+ ) -> ApiResponse[m.AttachInstanceVolumeResponse]:
1528
+ "Attach a data volume to an instance"
1529
+ return cast(
1530
+ ApiResponse[m.AttachInstanceVolumeResponse],
1531
+ await self._transport.request(
1532
+ "compute",
1533
+ "https://compute.{region}.basaltic.sh",
1534
+ _OPS["attachInstanceVolume"],
1535
+ "json",
1536
+ {"instance_id": instance_id},
1537
+ body,
1538
+ None,
1539
+ options,
1540
+ ),
1541
+ )
1542
+
1543
+ async def create_image(
1544
+ self, body: m.CreateImageBody, *, options: RequestOptions | None = None
1545
+ ) -> ApiResponse[m.CreateImageResponse]:
1546
+ "Import an image from an object URL"
1547
+ return cast(
1548
+ ApiResponse[m.CreateImageResponse],
1549
+ await self._transport.request(
1550
+ "compute",
1551
+ "https://compute.{region}.basaltic.sh",
1552
+ _OPS["createImage"],
1553
+ "json",
1554
+ {},
1555
+ body,
1556
+ None,
1557
+ options,
1558
+ ),
1559
+ )
1560
+
1561
+ async def create_instance(
1562
+ self, body: m.CreateInstanceBody, *, options: RequestOptions | None = None
1563
+ ) -> ApiResponse[m.CreateInstanceResponse]:
1564
+ "Create instance"
1565
+ return cast(
1566
+ ApiResponse[m.CreateInstanceResponse],
1567
+ await self._transport.request(
1568
+ "compute",
1569
+ "https://compute.{region}.basaltic.sh",
1570
+ _OPS["createInstance"],
1571
+ "json",
1572
+ {},
1573
+ body,
1574
+ None,
1575
+ options,
1576
+ ),
1577
+ )
1578
+
1579
+ async def create_instance_pool(
1580
+ self, body: m.CreateInstancePoolBody, *, options: RequestOptions | None = None
1581
+ ) -> ApiResponse[m.CreateInstancePoolResponse]:
1582
+ "Create an instance pool"
1583
+ return cast(
1584
+ ApiResponse[m.CreateInstancePoolResponse],
1585
+ await self._transport.request(
1586
+ "compute",
1587
+ "https://compute.{region}.basaltic.sh",
1588
+ _OPS["createInstancePool"],
1589
+ "json",
1590
+ {},
1591
+ body,
1592
+ None,
1593
+ options,
1594
+ ),
1595
+ )
1596
+
1597
+ async def create_serial_console_ticket(
1598
+ self, instance_id: str, *, options: RequestOptions | None = None
1599
+ ) -> ApiResponse[m.CreateSerialConsoleTicketResponse]:
1600
+ "Mint a ticket for the serial console"
1601
+ return cast(
1602
+ ApiResponse[m.CreateSerialConsoleTicketResponse],
1603
+ await self._transport.request(
1604
+ "compute",
1605
+ "https://compute.{region}.basaltic.sh",
1606
+ _OPS["createSerialConsoleTicket"],
1607
+ "json",
1608
+ {"instance_id": instance_id},
1609
+ UNSET,
1610
+ None,
1611
+ options,
1612
+ ),
1613
+ )
1614
+
1615
+ async def delete_image(
1616
+ self, image_id: str, *, options: RequestOptions | None = None
1617
+ ) -> ApiResponse[m.DeleteImageResponse]:
1618
+ "Delete an unused image"
1619
+ return cast(
1620
+ ApiResponse[m.DeleteImageResponse],
1621
+ await self._transport.request(
1622
+ "compute",
1623
+ "https://compute.{region}.basaltic.sh",
1624
+ _OPS["deleteImage"],
1625
+ "json",
1626
+ {"image_id": image_id},
1627
+ UNSET,
1628
+ None,
1629
+ options,
1630
+ ),
1631
+ )
1632
+
1633
+ async def delete_instance(
1634
+ self, instance_id: str, *, options: RequestOptions | None = None
1635
+ ) -> None:
1636
+ "Delete instance"
1637
+ return cast(
1638
+ None,
1639
+ await self._transport.request(
1640
+ "compute",
1641
+ "https://compute.{region}.basaltic.sh",
1642
+ _OPS["deleteInstance"],
1643
+ "discard",
1644
+ {"instance_id": instance_id},
1645
+ UNSET,
1646
+ None,
1647
+ options,
1648
+ ),
1649
+ )
1650
+
1651
+ async def delete_instance_pool(
1652
+ self, pool_id: str, *, options: RequestOptions | None = None
1653
+ ) -> None:
1654
+ "Delete an instance pool"
1655
+ return cast(
1656
+ None,
1657
+ await self._transport.request(
1658
+ "compute",
1659
+ "https://compute.{region}.basaltic.sh",
1660
+ _OPS["deleteInstancePool"],
1661
+ "discard",
1662
+ {"pool_id": pool_id},
1663
+ UNSET,
1664
+ None,
1665
+ options,
1666
+ ),
1667
+ )
1668
+
1669
+ async def detach_instance_nic(
1670
+ self, instance_id: str, interface_id: str, *, options: RequestOptions | None = None
1671
+ ) -> None:
1672
+ "Detach a NIC from a running instance"
1673
+ return cast(
1674
+ None,
1675
+ await self._transport.request(
1676
+ "compute",
1677
+ "https://compute.{region}.basaltic.sh",
1678
+ _OPS["detachInstanceNIC"],
1679
+ "discard",
1680
+ {"instance_id": instance_id, "interface_id": interface_id},
1681
+ UNSET,
1682
+ None,
1683
+ options,
1684
+ ),
1685
+ )
1686
+
1687
+ async def detach_instance_pool_floating_ip(
1688
+ self, pool_id: str, floating_ip_id: str, *, options: RequestOptions | None = None
1689
+ ) -> None:
1690
+ "Take a shared address off the pool"
1691
+ return cast(
1692
+ None,
1693
+ await self._transport.request(
1694
+ "compute",
1695
+ "https://compute.{region}.basaltic.sh",
1696
+ _OPS["detachInstancePoolFloatingIp"],
1697
+ "discard",
1698
+ {"pool_id": pool_id, "floating_ip_id": floating_ip_id},
1699
+ UNSET,
1700
+ None,
1701
+ options,
1702
+ ),
1703
+ )
1704
+
1705
+ async def detach_instance_volume(
1706
+ self, instance_id: str, volume_id: str, *, options: RequestOptions | None = None
1707
+ ) -> None:
1708
+ "Detach a data volume from an instance"
1709
+ return cast(
1710
+ None,
1711
+ await self._transport.request(
1712
+ "compute",
1713
+ "https://compute.{region}.basaltic.sh",
1714
+ _OPS["detachInstanceVolume"],
1715
+ "discard",
1716
+ {"instance_id": instance_id, "volume_id": volume_id},
1717
+ UNSET,
1718
+ None,
1719
+ options,
1720
+ ),
1721
+ )
1722
+
1723
+ async def get_console_output(
1724
+ self,
1725
+ instance_id: str,
1726
+ *,
1727
+ query: m.GetConsoleOutputQuery | None = None,
1728
+ options: RequestOptions | None = None,
1729
+ ) -> ApiResponse[m.GetConsoleOutputResponse]:
1730
+ "Get the instance's serial console output"
1731
+ return cast(
1732
+ ApiResponse[m.GetConsoleOutputResponse],
1733
+ await self._transport.request(
1734
+ "compute",
1735
+ "https://compute.{region}.basaltic.sh",
1736
+ _OPS["getConsoleOutput"],
1737
+ "json",
1738
+ {"instance_id": instance_id},
1739
+ UNSET,
1740
+ query,
1741
+ options,
1742
+ ),
1743
+ )
1744
+
1745
+ async def get_console_screenshot(
1746
+ self, instance_id: str, *, options: RequestOptions | None = None
1747
+ ) -> httpx.Response:
1748
+ "Capture the instance's display"
1749
+ return cast(
1750
+ httpx.Response,
1751
+ await self._transport.request(
1752
+ "compute",
1753
+ "https://compute.{region}.basaltic.sh",
1754
+ _OPS["getConsoleScreenshot"],
1755
+ "binary",
1756
+ {"instance_id": instance_id},
1757
+ UNSET,
1758
+ None,
1759
+ options,
1760
+ ),
1761
+ )
1762
+
1763
+ async def get_flavor(
1764
+ self, flavor_id: str, *, options: RequestOptions | None = None
1765
+ ) -> ApiResponse[m.GetFlavorResponse]:
1766
+ "Get flavor"
1767
+ return cast(
1768
+ ApiResponse[m.GetFlavorResponse],
1769
+ await self._transport.request(
1770
+ "compute",
1771
+ "https://compute.{region}.basaltic.sh",
1772
+ _OPS["getFlavor"],
1773
+ "json",
1774
+ {"flavor_id": flavor_id},
1775
+ UNSET,
1776
+ None,
1777
+ options,
1778
+ ),
1779
+ )
1780
+
1781
+ async def get_flavor_by_reference(
1782
+ self,
1783
+ reference: str,
1784
+ *,
1785
+ scope: m.GetFlavorScope | None = None,
1786
+ options: RequestOptions | None = None,
1787
+ ) -> ApiResponse[m.GetFlavorResource]:
1788
+ return cast(
1789
+ ApiResponse[m.GetFlavorResource],
1790
+ await aresolve_reference(
1791
+ reference,
1792
+ lambda id: self.get_flavor(id, options=options),
1793
+ lambda match: self.list_flavors(
1794
+ query=cast(m.ListFlavorsQuery, {**reference_scope(scope), **match}),
1795
+ options=options,
1796
+ ),
1797
+ True,
1798
+ "flavor",
1799
+ ),
1800
+ )
1801
+
1802
+ async def get_image(
1803
+ self, image_id: str, *, options: RequestOptions | None = None
1804
+ ) -> ApiResponse[m.GetImageResponse]:
1805
+ "Get an image"
1806
+ return cast(
1807
+ ApiResponse[m.GetImageResponse],
1808
+ await self._transport.request(
1809
+ "compute",
1810
+ "https://compute.{region}.basaltic.sh",
1811
+ _OPS["getImage"],
1812
+ "json",
1813
+ {"image_id": image_id},
1814
+ UNSET,
1815
+ None,
1816
+ options,
1817
+ ),
1818
+ )
1819
+
1820
+ async def get_image_by_reference(
1821
+ self,
1822
+ reference: str,
1823
+ *,
1824
+ scope: m.GetImageScope | None = None,
1825
+ options: RequestOptions | None = None,
1826
+ ) -> ApiResponse[m.GetImageResource]:
1827
+ return cast(
1828
+ ApiResponse[m.GetImageResource],
1829
+ await aresolve_reference(
1830
+ reference,
1831
+ lambda id: self.get_image(id, options=options),
1832
+ lambda match: self.list_images(
1833
+ query=cast(m.ListImagesQuery, {**reference_scope(scope), **match, "limit": 2}),
1834
+ options=options,
1835
+ ),
1836
+ True,
1837
+ "image",
1838
+ ),
1839
+ )
1840
+
1841
+ async def get_instance(
1842
+ self, instance_id: str, *, options: RequestOptions | None = None
1843
+ ) -> ApiResponse[m.GetInstanceResponse]:
1844
+ "Get instance"
1845
+ return cast(
1846
+ ApiResponse[m.GetInstanceResponse],
1847
+ await self._transport.request(
1848
+ "compute",
1849
+ "https://compute.{region}.basaltic.sh",
1850
+ _OPS["getInstance"],
1851
+ "json",
1852
+ {"instance_id": instance_id},
1853
+ UNSET,
1854
+ None,
1855
+ options,
1856
+ ),
1857
+ )
1858
+
1859
+ async def get_instance_by_reference(
1860
+ self,
1861
+ reference: str,
1862
+ *,
1863
+ scope: m.GetInstanceScope | None = None,
1864
+ options: RequestOptions | None = None,
1865
+ ) -> ApiResponse[m.GetInstanceResource]:
1866
+ return cast(
1867
+ ApiResponse[m.GetInstanceResource],
1868
+ await aresolve_reference(
1869
+ reference,
1870
+ lambda id: self.get_instance(id, options=options),
1871
+ lambda match: self.list_instances(
1872
+ query=cast(
1873
+ m.ListInstancesQuery, {**reference_scope(scope), **match, "limit": 2}
1874
+ ),
1875
+ options=options,
1876
+ ),
1877
+ True,
1878
+ "instance",
1879
+ ),
1880
+ )
1881
+
1882
+ async def get_instance_pool(
1883
+ self, pool_id: str, *, options: RequestOptions | None = None
1884
+ ) -> ApiResponse[m.GetInstancePoolResponse]:
1885
+ "Get an instance pool"
1886
+ return cast(
1887
+ ApiResponse[m.GetInstancePoolResponse],
1888
+ await self._transport.request(
1889
+ "compute",
1890
+ "https://compute.{region}.basaltic.sh",
1891
+ _OPS["getInstancePool"],
1892
+ "json",
1893
+ {"pool_id": pool_id},
1894
+ UNSET,
1895
+ None,
1896
+ options,
1897
+ ),
1898
+ )
1899
+
1900
+ async def get_instance_pool_by_reference(
1901
+ self,
1902
+ reference: str,
1903
+ *,
1904
+ scope: m.GetInstancePoolScope | None = None,
1905
+ options: RequestOptions | None = None,
1906
+ ) -> ApiResponse[m.GetInstancePoolResource]:
1907
+ return cast(
1908
+ ApiResponse[m.GetInstancePoolResource],
1909
+ await aresolve_reference(
1910
+ reference,
1911
+ lambda id: self.get_instance_pool(id, options=options),
1912
+ lambda match: self.list_instance_pools(
1913
+ query=cast(
1914
+ m.ListInstancePoolsQuery, {**reference_scope(scope), **match, "limit": 2}
1915
+ ),
1916
+ options=options,
1917
+ ),
1918
+ True,
1919
+ "instance_pool",
1920
+ ),
1921
+ )
1922
+
1923
+ async def list_flavors(
1924
+ self, *, query: m.ListFlavorsQuery | None = None, options: RequestOptions | None = None
1925
+ ) -> Page[m.ListFlavorsResponse, m.ListFlavorsItem]:
1926
+ "List flavors"
1927
+ return cast(
1928
+ Page[m.ListFlavorsResponse, m.ListFlavorsItem],
1929
+ await self._transport.request(
1930
+ "compute",
1931
+ "https://compute.{region}.basaltic.sh",
1932
+ _OPS["listFlavors"],
1933
+ "page",
1934
+ {},
1935
+ UNSET,
1936
+ query,
1937
+ options,
1938
+ ),
1939
+ )
1940
+
1941
+ async def list_image_catalog(
1942
+ self, *, query: m.ListImageCatalogQuery | None = None, options: RequestOptions | None = None
1943
+ ) -> Page[m.ListImageCatalogResponse, m.ListImageCatalogItem]:
1944
+ "List the launch image catalog"
1945
+ return cast(
1946
+ Page[m.ListImageCatalogResponse, m.ListImageCatalogItem],
1947
+ await self._transport.request(
1948
+ "compute",
1949
+ "https://compute.{region}.basaltic.sh",
1950
+ _OPS["listImageCatalog"],
1951
+ "page",
1952
+ {},
1953
+ UNSET,
1954
+ query,
1955
+ options,
1956
+ ),
1957
+ )
1958
+
1959
+ def list_image_catalog_all(
1960
+ self, *, query: m.ListImageCatalogQuery | None = None, options: RequestOptions | None = None
1961
+ ) -> AsyncIterator[m.ListImageCatalogItem]:
1962
+ return aiterate_pages(
1963
+ lambda marker: self.list_image_catalog(
1964
+ query=cast(m.ListImageCatalogQuery, {**(query or {}), "marker": marker}),
1965
+ options=options,
1966
+ ),
1967
+ (query or {}).get("marker", ""),
1968
+ )
1969
+
1970
+ async def list_images(
1971
+ self, *, query: m.ListImagesQuery | None = None, options: RequestOptions | None = None
1972
+ ) -> Page[m.ListImagesResponse, m.ListImagesItem]:
1973
+ "List images"
1974
+ return cast(
1975
+ Page[m.ListImagesResponse, m.ListImagesItem],
1976
+ await self._transport.request(
1977
+ "compute",
1978
+ "https://compute.{region}.basaltic.sh",
1979
+ _OPS["listImages"],
1980
+ "page",
1981
+ {},
1982
+ UNSET,
1983
+ query,
1984
+ options,
1985
+ ),
1986
+ )
1987
+
1988
+ def list_images_all(
1989
+ self, *, query: m.ListImagesQuery | None = None, options: RequestOptions | None = None
1990
+ ) -> AsyncIterator[m.ListImagesItem]:
1991
+ return aiterate_pages(
1992
+ lambda marker: self.list_images(
1993
+ query=cast(m.ListImagesQuery, {**(query or {}), "marker": marker}), options=options
1994
+ ),
1995
+ (query or {}).get("marker", ""),
1996
+ )
1997
+
1998
+ async def list_instance_ni_cs(
1999
+ self,
2000
+ instance_id: str,
2001
+ *,
2002
+ query: m.ListInstanceNICsQuery | None = None,
2003
+ options: RequestOptions | None = None,
2004
+ ) -> Page[m.ListInstanceNICsResponse, m.ListInstanceNICsItem]:
2005
+ "List the instance's network interfaces"
2006
+ return cast(
2007
+ Page[m.ListInstanceNICsResponse, m.ListInstanceNICsItem],
2008
+ await self._transport.request(
2009
+ "compute",
2010
+ "https://compute.{region}.basaltic.sh",
2011
+ _OPS["listInstanceNICs"],
2012
+ "page",
2013
+ {"instance_id": instance_id},
2014
+ UNSET,
2015
+ query,
2016
+ options,
2017
+ ),
2018
+ )
2019
+
2020
+ async def list_instance_pool_floating_ips(
2021
+ self,
2022
+ pool_id: str,
2023
+ *,
2024
+ query: m.ListInstancePoolFloatingIpsQuery | None = None,
2025
+ options: RequestOptions | None = None,
2026
+ ) -> Page[m.ListInstancePoolFloatingIpsResponse, m.ListInstancePoolFloatingIpsItem]:
2027
+ "List the pool's shared public addresses"
2028
+ return cast(
2029
+ Page[m.ListInstancePoolFloatingIpsResponse, m.ListInstancePoolFloatingIpsItem],
2030
+ await self._transport.request(
2031
+ "compute",
2032
+ "https://compute.{region}.basaltic.sh",
2033
+ _OPS["listInstancePoolFloatingIps"],
2034
+ "page",
2035
+ {"pool_id": pool_id},
2036
+ UNSET,
2037
+ query,
2038
+ options,
2039
+ ),
2040
+ )
2041
+
2042
+ def list_instance_pool_floating_ips_all(
2043
+ self,
2044
+ pool_id: str,
2045
+ *,
2046
+ query: m.ListInstancePoolFloatingIpsQuery | None = None,
2047
+ options: RequestOptions | None = None,
2048
+ ) -> AsyncIterator[m.ListInstancePoolFloatingIpsItem]:
2049
+ return aiterate_pages(
2050
+ lambda marker: self.list_instance_pool_floating_ips(
2051
+ pool_id,
2052
+ query=cast(m.ListInstancePoolFloatingIpsQuery, {**(query or {}), "marker": marker}),
2053
+ options=options,
2054
+ ),
2055
+ (query or {}).get("marker", ""),
2056
+ )
2057
+
2058
+ async def list_instance_pools(
2059
+ self,
2060
+ *,
2061
+ query: m.ListInstancePoolsQuery | None = None,
2062
+ options: RequestOptions | None = None,
2063
+ ) -> Page[m.ListInstancePoolsResponse, m.ListInstancePoolsItem]:
2064
+ "List instance pools"
2065
+ return cast(
2066
+ Page[m.ListInstancePoolsResponse, m.ListInstancePoolsItem],
2067
+ await self._transport.request(
2068
+ "compute",
2069
+ "https://compute.{region}.basaltic.sh",
2070
+ _OPS["listInstancePools"],
2071
+ "page",
2072
+ {},
2073
+ UNSET,
2074
+ query,
2075
+ options,
2076
+ ),
2077
+ )
2078
+
2079
+ def list_instance_pools_all(
2080
+ self,
2081
+ *,
2082
+ query: m.ListInstancePoolsQuery | None = None,
2083
+ options: RequestOptions | None = None,
2084
+ ) -> AsyncIterator[m.ListInstancePoolsItem]:
2085
+ return aiterate_pages(
2086
+ lambda marker: self.list_instance_pools(
2087
+ query=cast(m.ListInstancePoolsQuery, {**(query or {}), "marker": marker}),
2088
+ options=options,
2089
+ ),
2090
+ (query or {}).get("marker", ""),
2091
+ )
2092
+
2093
+ async def list_instance_volumes(
2094
+ self,
2095
+ instance_id: str,
2096
+ *,
2097
+ query: m.ListInstanceVolumesQuery | None = None,
2098
+ options: RequestOptions | None = None,
2099
+ ) -> Page[m.ListInstanceVolumesResponse, m.ListInstanceVolumesItem]:
2100
+ "List the instance's attached volumes"
2101
+ return cast(
2102
+ Page[m.ListInstanceVolumesResponse, m.ListInstanceVolumesItem],
2103
+ await self._transport.request(
2104
+ "compute",
2105
+ "https://compute.{region}.basaltic.sh",
2106
+ _OPS["listInstanceVolumes"],
2107
+ "page",
2108
+ {"instance_id": instance_id},
2109
+ UNSET,
2110
+ query,
2111
+ options,
2112
+ ),
2113
+ )
2114
+
2115
+ async def list_instances(
2116
+ self, *, query: m.ListInstancesQuery | None = None, options: RequestOptions | None = None
2117
+ ) -> Page[m.ListInstancesResponse, m.ListInstancesItem]:
2118
+ "List instances"
2119
+ return cast(
2120
+ Page[m.ListInstancesResponse, m.ListInstancesItem],
2121
+ await self._transport.request(
2122
+ "compute",
2123
+ "https://compute.{region}.basaltic.sh",
2124
+ _OPS["listInstances"],
2125
+ "page",
2126
+ {},
2127
+ UNSET,
2128
+ query,
2129
+ options,
2130
+ ),
2131
+ )
2132
+
2133
+ def list_instances_all(
2134
+ self, *, query: m.ListInstancesQuery | None = None, options: RequestOptions | None = None
2135
+ ) -> AsyncIterator[m.ListInstancesItem]:
2136
+ return aiterate_pages(
2137
+ lambda marker: self.list_instances(
2138
+ query=cast(m.ListInstancesQuery, {**(query or {}), "marker": marker}),
2139
+ options=options,
2140
+ ),
2141
+ (query or {}).get("marker", ""),
2142
+ )
2143
+
2144
+ async def list_pool_instances(
2145
+ self,
2146
+ pool_id: str,
2147
+ *,
2148
+ query: m.ListPoolInstancesQuery | None = None,
2149
+ options: RequestOptions | None = None,
2150
+ ) -> Page[m.ListPoolInstancesResponse, m.ListPoolInstancesItem]:
2151
+ "List a pool's instances"
2152
+ return cast(
2153
+ Page[m.ListPoolInstancesResponse, m.ListPoolInstancesItem],
2154
+ await self._transport.request(
2155
+ "compute",
2156
+ "https://compute.{region}.basaltic.sh",
2157
+ _OPS["listPoolInstances"],
2158
+ "page",
2159
+ {"pool_id": pool_id},
2160
+ UNSET,
2161
+ query,
2162
+ options,
2163
+ ),
2164
+ )
2165
+
2166
+ def list_pool_instances_all(
2167
+ self,
2168
+ pool_id: str,
2169
+ *,
2170
+ query: m.ListPoolInstancesQuery | None = None,
2171
+ options: RequestOptions | None = None,
2172
+ ) -> AsyncIterator[m.ListPoolInstancesItem]:
2173
+ return aiterate_pages(
2174
+ lambda marker: self.list_pool_instances(
2175
+ pool_id,
2176
+ query=cast(m.ListPoolInstancesQuery, {**(query or {}), "marker": marker}),
2177
+ options=options,
2178
+ ),
2179
+ (query or {}).get("marker", ""),
2180
+ )
2181
+
2182
+ async def reboot_instance(
2183
+ self,
2184
+ instance_id: str,
2185
+ body: m.RebootInstanceBody | Unset = UNSET,
2186
+ *,
2187
+ options: RequestOptions | None = None,
2188
+ ) -> None:
2189
+ "Reboot instance"
2190
+ return cast(
2191
+ None,
2192
+ await self._transport.request(
2193
+ "compute",
2194
+ "https://compute.{region}.basaltic.sh",
2195
+ _OPS["rebootInstance"],
2196
+ "discard",
2197
+ {"instance_id": instance_id},
2198
+ body,
2199
+ None,
2200
+ options,
2201
+ ),
2202
+ )
2203
+
2204
+ async def refresh_instance_pool(
2205
+ self, pool_id: str, *, options: RequestOptions | None = None
2206
+ ) -> ApiResponse[m.RefreshInstancePoolResponse]:
2207
+ "Roll every member onto the pool's current launch template"
2208
+ return cast(
2209
+ ApiResponse[m.RefreshInstancePoolResponse],
2210
+ await self._transport.request(
2211
+ "compute",
2212
+ "https://compute.{region}.basaltic.sh",
2213
+ _OPS["refreshInstancePool"],
2214
+ "json",
2215
+ {"pool_id": pool_id},
2216
+ UNSET,
2217
+ None,
2218
+ options,
2219
+ ),
2220
+ )
2221
+
2222
+ async def reinstall_instance(
2223
+ self,
2224
+ instance_id: str,
2225
+ body: m.ReinstallInstanceBody | Unset = UNSET,
2226
+ *,
2227
+ options: RequestOptions | None = None,
2228
+ ) -> None:
2229
+ "Reinstall instance"
2230
+ return cast(
2231
+ None,
2232
+ await self._transport.request(
2233
+ "compute",
2234
+ "https://compute.{region}.basaltic.sh",
2235
+ _OPS["reinstallInstance"],
2236
+ "discard",
2237
+ {"instance_id": instance_id},
2238
+ body,
2239
+ None,
2240
+ options,
2241
+ ),
2242
+ )
2243
+
2244
+ async def resize_instance(
2245
+ self, instance_id: str, body: m.ResizeInstanceBody, *, options: RequestOptions | None = None
2246
+ ) -> None:
2247
+ "Resize instance"
2248
+ return cast(
2249
+ None,
2250
+ await self._transport.request(
2251
+ "compute",
2252
+ "https://compute.{region}.basaltic.sh",
2253
+ _OPS["resizeInstance"],
2254
+ "discard",
2255
+ {"instance_id": instance_id},
2256
+ body,
2257
+ None,
2258
+ options,
2259
+ ),
2260
+ )
2261
+
2262
+ async def start_instance(
2263
+ self, instance_id: str, *, options: RequestOptions | None = None
2264
+ ) -> None:
2265
+ "Start instance"
2266
+ return cast(
2267
+ None,
2268
+ await self._transport.request(
2269
+ "compute",
2270
+ "https://compute.{region}.basaltic.sh",
2271
+ _OPS["startInstance"],
2272
+ "discard",
2273
+ {"instance_id": instance_id},
2274
+ UNSET,
2275
+ None,
2276
+ options,
2277
+ ),
2278
+ )
2279
+
2280
+ async def start_serial_console(
2281
+ self,
2282
+ instance_id: str,
2283
+ *,
2284
+ query: m.StartSerialConsoleQuery | None = None,
2285
+ options: RequestOptions | None = None,
2286
+ ) -> WebSocketConnection:
2287
+ "Open an interactive serial console"
2288
+ return cast(
2289
+ WebSocketConnection,
2290
+ await self._transport.request(
2291
+ "compute",
2292
+ "https://compute.{region}.basaltic.sh",
2293
+ _OPS["startSerialConsole"],
2294
+ "websocket",
2295
+ {"instance_id": instance_id},
2296
+ UNSET,
2297
+ query,
2298
+ options,
2299
+ ),
2300
+ )
2301
+
2302
+ async def stop_instance(
2303
+ self, instance_id: str, *, options: RequestOptions | None = None
2304
+ ) -> None:
2305
+ "Stop instance"
2306
+ return cast(
2307
+ None,
2308
+ await self._transport.request(
2309
+ "compute",
2310
+ "https://compute.{region}.basaltic.sh",
2311
+ _OPS["stopInstance"],
2312
+ "discard",
2313
+ {"instance_id": instance_id},
2314
+ UNSET,
2315
+ None,
2316
+ options,
2317
+ ),
2318
+ )
2319
+
2320
+ async def update_image(
2321
+ self, image_id: str, body: m.UpdateImageBody, *, options: RequestOptions | None = None
2322
+ ) -> ApiResponse[m.UpdateImageResponse]:
2323
+ "Update an image's metadata"
2324
+ return cast(
2325
+ ApiResponse[m.UpdateImageResponse],
2326
+ await self._transport.request(
2327
+ "compute",
2328
+ "https://compute.{region}.basaltic.sh",
2329
+ _OPS["updateImage"],
2330
+ "json",
2331
+ {"image_id": image_id},
2332
+ body,
2333
+ None,
2334
+ options,
2335
+ ),
2336
+ )
2337
+
2338
+ async def update_instance(
2339
+ self, instance_id: str, body: m.UpdateInstanceBody, *, options: RequestOptions | None = None
2340
+ ) -> ApiResponse[m.UpdateInstanceResponse]:
2341
+ "Update instance"
2342
+ return cast(
2343
+ ApiResponse[m.UpdateInstanceResponse],
2344
+ await self._transport.request(
2345
+ "compute",
2346
+ "https://compute.{region}.basaltic.sh",
2347
+ _OPS["updateInstance"],
2348
+ "json",
2349
+ {"instance_id": instance_id},
2350
+ body,
2351
+ None,
2352
+ options,
2353
+ ),
2354
+ )
2355
+
2356
+ async def update_instance_pool(
2357
+ self, pool_id: str, body: m.UpdateInstancePoolBody, *, options: RequestOptions | None = None
2358
+ ) -> ApiResponse[m.UpdateInstancePoolResponse]:
2359
+ "Update an instance pool's description, size, tags or launch template"
2360
+ return cast(
2361
+ ApiResponse[m.UpdateInstancePoolResponse],
2362
+ await self._transport.request(
2363
+ "compute",
2364
+ "https://compute.{region}.basaltic.sh",
2365
+ _OPS["updateInstancePool"],
2366
+ "json",
2367
+ {"pool_id": pool_id},
2368
+ body,
2369
+ None,
2370
+ options,
2371
+ ),
2372
+ )
2373
+
2374
+ async def update_instance_volume_attachment(
2375
+ self,
2376
+ instance_id: str,
2377
+ volume_id: str,
2378
+ body: m.UpdateInstanceVolumeAttachmentBody,
2379
+ *,
2380
+ options: RequestOptions | None = None,
2381
+ ) -> None:
2382
+ "Update a volume attachment's settings"
2383
+ return cast(
2384
+ None,
2385
+ await self._transport.request(
2386
+ "compute",
2387
+ "https://compute.{region}.basaltic.sh",
2388
+ _OPS["updateInstanceVolumeAttachment"],
2389
+ "discard",
2390
+ {"instance_id": instance_id, "volume_id": volume_id},
2391
+ body,
2392
+ None,
2393
+ options,
2394
+ ),
2395
+ )