1#![allow(unused_imports)]
3use crate::models::compute as m;
4use crate::transport::{Core, Operation, Payload, QueryEncoding};
5use crate::{BinaryRequest, Client, EmptyRequest, PagedRequest, Request, WebSocketRequest};
6const ENDPOINT: &str = "https://compute.{region}.basaltic.sh";
7static OP_0: Operation = Operation {
8 id: "attachInstanceInterface",
9 method: "POST",
10 path: "/v1/instances/{instance_id}/interfaces",
11 authenticated: true,
12 required_query: &[],
13 required_headers: &[],
14 content_type: "application/json",
15 accept: "application/json",
16 query_encoding: &[],
17};
18static OP_1: Operation = Operation {
19 id: "attachInstancePoolFloatingIp",
20 method: "POST",
21 path: "/v1/instance-pools/{pool_id}/floating-ips",
22 authenticated: true,
23 required_query: &[],
24 required_headers: &[],
25 content_type: "application/json",
26 accept: "application/json",
27 query_encoding: &[],
28};
29static OP_2: Operation = Operation {
30 id: "attachInstanceVolume",
31 method: "POST",
32 path: "/v1/instances/{instance_id}/volumes",
33 authenticated: true,
34 required_query: &[],
35 required_headers: &[],
36 content_type: "application/json",
37 accept: "application/json",
38 query_encoding: &[],
39};
40static OP_3: Operation = Operation {
41 id: "createImage",
42 method: "POST",
43 path: "/v1/images",
44 authenticated: true,
45 required_query: &[],
46 required_headers: &[],
47 content_type: "application/json",
48 accept: "application/json",
49 query_encoding: &[],
50};
51static OP_4: Operation = Operation {
52 id: "createInstance",
53 method: "POST",
54 path: "/v1/instances",
55 authenticated: true,
56 required_query: &[],
57 required_headers: &[],
58 content_type: "application/json",
59 accept: "application/json",
60 query_encoding: &[],
61};
62static OP_5: Operation = Operation {
63 id: "createInstancePool",
64 method: "POST",
65 path: "/v1/instance-pools",
66 authenticated: true,
67 required_query: &[],
68 required_headers: &[],
69 content_type: "application/json",
70 accept: "application/json",
71 query_encoding: &[],
72};
73static OP_6: Operation = Operation {
74 id: "createSerialConsoleTicket",
75 method: "POST",
76 path: "/v1/instances/{instance_id}/console/ticket",
77 authenticated: true,
78 required_query: &[],
79 required_headers: &[],
80 content_type: "",
81 accept: "application/json",
82 query_encoding: &[],
83};
84static OP_7: Operation = Operation {
85 id: "deleteImage",
86 method: "DELETE",
87 path: "/v1/images/{image_id}",
88 authenticated: true,
89 required_query: &[],
90 required_headers: &[],
91 content_type: "",
92 accept: "application/json",
93 query_encoding: &[],
94};
95static OP_8: Operation = Operation {
96 id: "deleteInstance",
97 method: "DELETE",
98 path: "/v1/instances/{instance_id}",
99 authenticated: true,
100 required_query: &[],
101 required_headers: &[],
102 content_type: "",
103 accept: "application/json",
104 query_encoding: &[],
105};
106static OP_9: Operation = Operation {
107 id: "deleteInstancePool",
108 method: "DELETE",
109 path: "/v1/instance-pools/{pool_id}",
110 authenticated: true,
111 required_query: &[],
112 required_headers: &[],
113 content_type: "",
114 accept: "application/json",
115 query_encoding: &[],
116};
117static OP_10: Operation = Operation {
118 id: "detachInstanceInterface",
119 method: "DELETE",
120 path: "/v1/instances/{instance_id}/interfaces/{interface_id}",
121 authenticated: true,
122 required_query: &[],
123 required_headers: &[],
124 content_type: "",
125 accept: "application/json",
126 query_encoding: &[],
127};
128static OP_11: Operation = Operation {
129 id: "detachInstancePoolFloatingIp",
130 method: "DELETE",
131 path: "/v1/instance-pools/{pool_id}/floating-ips/{floating_ip_id}",
132 authenticated: true,
133 required_query: &[],
134 required_headers: &[],
135 content_type: "",
136 accept: "application/json",
137 query_encoding: &[],
138};
139static OP_12: Operation = Operation {
140 id: "detachInstanceVolume",
141 method: "DELETE",
142 path: "/v1/instances/{instance_id}/volumes/{volume_id}",
143 authenticated: true,
144 required_query: &[],
145 required_headers: &[],
146 content_type: "",
147 accept: "application/json",
148 query_encoding: &[],
149};
150static OP_13: Operation = Operation {
151 id: "getConsoleOutput",
152 method: "GET",
153 path: "/v1/instances/{instance_id}/console/output",
154 authenticated: true,
155 required_query: &[],
156 required_headers: &[],
157 content_type: "",
158 accept: "application/json",
159 query_encoding: &[QueryEncoding {
160 name: "max_bytes",
161 style: "form",
162 explode: true,
163 }],
164};
165static OP_14: Operation = Operation {
166 id: "getConsoleScreenshot",
167 method: "GET",
168 path: "/v1/instances/{instance_id}/console/screenshot",
169 authenticated: true,
170 required_query: &[],
171 required_headers: &[],
172 content_type: "",
173 accept: "*/*",
174 query_encoding: &[],
175};
176static OP_15: Operation = Operation {
177 id: "getFlavor",
178 method: "GET",
179 path: "/v1/flavors/{flavor_id}",
180 authenticated: true,
181 required_query: &[],
182 required_headers: &[],
183 content_type: "",
184 accept: "application/json",
185 query_encoding: &[],
186};
187static OP_16: Operation = Operation {
188 id: "getImage",
189 method: "GET",
190 path: "/v1/images/{image_id}",
191 authenticated: true,
192 required_query: &[],
193 required_headers: &[],
194 content_type: "",
195 accept: "application/json",
196 query_encoding: &[],
197};
198static OP_17: Operation = Operation {
199 id: "getInstance",
200 method: "GET",
201 path: "/v1/instances/{instance_id}",
202 authenticated: true,
203 required_query: &[],
204 required_headers: &[],
205 content_type: "",
206 accept: "application/json",
207 query_encoding: &[],
208};
209static OP_18: Operation = Operation {
210 id: "getInstancePool",
211 method: "GET",
212 path: "/v1/instance-pools/{pool_id}",
213 authenticated: true,
214 required_query: &[],
215 required_headers: &[],
216 content_type: "",
217 accept: "application/json",
218 query_encoding: &[],
219};
220static OP_19: Operation = Operation {
221 id: "listFlavors",
222 method: "GET",
223 path: "/v1/flavors",
224 authenticated: true,
225 required_query: &[],
226 required_headers: &[],
227 content_type: "",
228 accept: "application/json",
229 query_encoding: &[
230 QueryEncoding {
231 name: "name",
232 style: "form",
233 explode: true,
234 },
235 QueryEncoding {
236 name: "crn",
237 style: "form",
238 explode: true,
239 },
240 QueryEncoding {
241 name: "family",
242 style: "form",
243 explode: true,
244 },
245 ],
246};
247static OP_20: Operation = Operation {
248 id: "listImageCatalog",
249 method: "GET",
250 path: "/v1/image-catalog",
251 authenticated: true,
252 required_query: &[],
253 required_headers: &[],
254 content_type: "",
255 accept: "application/json",
256 query_encoding: &[
257 QueryEncoding {
258 name: "limit",
259 style: "form",
260 explode: true,
261 },
262 QueryEncoding {
263 name: "marker",
264 style: "form",
265 explode: true,
266 },
267 QueryEncoding {
268 name: "name",
269 style: "form",
270 explode: true,
271 },
272 QueryEncoding {
273 name: "os",
274 style: "form",
275 explode: true,
276 },
277 QueryEncoding {
278 name: "architecture",
279 style: "form",
280 explode: true,
281 },
282 ],
283};
284static OP_21: Operation = Operation {
285 id: "listImages",
286 method: "GET",
287 path: "/v1/images",
288 authenticated: true,
289 required_query: &[],
290 required_headers: &[],
291 content_type: "",
292 accept: "application/json",
293 query_encoding: &[
294 QueryEncoding {
295 name: "crn",
296 style: "form",
297 explode: true,
298 },
299 QueryEncoding {
300 name: "limit",
301 style: "form",
302 explode: true,
303 },
304 QueryEncoding {
305 name: "marker",
306 style: "form",
307 explode: true,
308 },
309 QueryEncoding {
310 name: "os",
311 style: "form",
312 explode: true,
313 },
314 QueryEncoding {
315 name: "architecture",
316 style: "form",
317 explode: true,
318 },
319 QueryEncoding {
320 name: "name",
321 style: "form",
322 explode: true,
323 },
324 QueryEncoding {
325 name: "status",
326 style: "form",
327 explode: true,
328 },
329 QueryEncoding {
330 name: "all_versions",
331 style: "form",
332 explode: true,
333 },
334 ],
335};
336static OP_22: Operation = Operation {
337 id: "listInstanceInterfaces",
338 method: "GET",
339 path: "/v1/instances/{instance_id}/interfaces",
340 authenticated: true,
341 required_query: &[],
342 required_headers: &[],
343 content_type: "",
344 accept: "application/json",
345 query_encoding: &[
346 QueryEncoding {
347 name: "name",
348 style: "form",
349 explode: true,
350 },
351 QueryEncoding {
352 name: "crn",
353 style: "form",
354 explode: true,
355 },
356 ],
357};
358static OP_23: Operation = Operation {
359 id: "listInstancePoolFloatingIps",
360 method: "GET",
361 path: "/v1/instance-pools/{pool_id}/floating-ips",
362 authenticated: true,
363 required_query: &[],
364 required_headers: &[],
365 content_type: "",
366 accept: "application/json",
367 query_encoding: &[
368 QueryEncoding {
369 name: "name",
370 style: "form",
371 explode: true,
372 },
373 QueryEncoding {
374 name: "crn",
375 style: "form",
376 explode: true,
377 },
378 QueryEncoding {
379 name: "limit",
380 style: "form",
381 explode: true,
382 },
383 QueryEncoding {
384 name: "marker",
385 style: "form",
386 explode: true,
387 },
388 ],
389};
390static OP_24: Operation = Operation {
391 id: "listInstancePools",
392 method: "GET",
393 path: "/v1/instance-pools",
394 authenticated: true,
395 required_query: &[],
396 required_headers: &[],
397 content_type: "",
398 accept: "application/json",
399 query_encoding: &[
400 QueryEncoding {
401 name: "name",
402 style: "form",
403 explode: true,
404 },
405 QueryEncoding {
406 name: "crn",
407 style: "form",
408 explode: true,
409 },
410 QueryEncoding {
411 name: "limit",
412 style: "form",
413 explode: true,
414 },
415 QueryEncoding {
416 name: "marker",
417 style: "form",
418 explode: true,
419 },
420 ],
421};
422static OP_25: Operation = Operation {
423 id: "listInstanceVolumes",
424 method: "GET",
425 path: "/v1/instances/{instance_id}/volumes",
426 authenticated: true,
427 required_query: &[],
428 required_headers: &[],
429 content_type: "",
430 accept: "application/json",
431 query_encoding: &[
432 QueryEncoding {
433 name: "name",
434 style: "form",
435 explode: true,
436 },
437 QueryEncoding {
438 name: "crn",
439 style: "form",
440 explode: true,
441 },
442 ],
443};
444static OP_26: Operation = Operation {
445 id: "listInstances",
446 method: "GET",
447 path: "/v1/instances",
448 authenticated: true,
449 required_query: &[],
450 required_headers: &[],
451 content_type: "",
452 accept: "application/json",
453 query_encoding: &[
454 QueryEncoding {
455 name: "crn",
456 style: "form",
457 explode: true,
458 },
459 QueryEncoding {
460 name: "limit",
461 style: "form",
462 explode: true,
463 },
464 QueryEncoding {
465 name: "marker",
466 style: "form",
467 explode: true,
468 },
469 QueryEncoding {
470 name: "name",
471 style: "form",
472 explode: true,
473 },
474 QueryEncoding {
475 name: "current_state",
476 style: "form",
477 explode: true,
478 },
479 QueryEncoding {
480 name: "flavor",
481 style: "form",
482 explode: true,
483 },
484 QueryEncoding {
485 name: "image",
486 style: "form",
487 explode: true,
488 },
489 ],
490};
491static OP_27: Operation = Operation {
492 id: "listPoolInstances",
493 method: "GET",
494 path: "/v1/instance-pools/{pool_id}/instances",
495 authenticated: true,
496 required_query: &[],
497 required_headers: &[],
498 content_type: "",
499 accept: "application/json",
500 query_encoding: &[
501 QueryEncoding {
502 name: "crn",
503 style: "form",
504 explode: true,
505 },
506 QueryEncoding {
507 name: "limit",
508 style: "form",
509 explode: true,
510 },
511 QueryEncoding {
512 name: "marker",
513 style: "form",
514 explode: true,
515 },
516 QueryEncoding {
517 name: "name",
518 style: "form",
519 explode: true,
520 },
521 QueryEncoding {
522 name: "current_state",
523 style: "form",
524 explode: true,
525 },
526 QueryEncoding {
527 name: "flavor",
528 style: "form",
529 explode: true,
530 },
531 QueryEncoding {
532 name: "image",
533 style: "form",
534 explode: true,
535 },
536 ],
537};
538static OP_28: Operation = Operation {
539 id: "rebootInstance",
540 method: "POST",
541 path: "/v1/instances/{instance_id}/reboot",
542 authenticated: true,
543 required_query: &[],
544 required_headers: &[],
545 content_type: "application/json",
546 accept: "application/json",
547 query_encoding: &[],
548};
549static OP_29: Operation = Operation {
550 id: "refreshInstancePool",
551 method: "POST",
552 path: "/v1/instance-pools/{pool_id}/refresh",
553 authenticated: true,
554 required_query: &[],
555 required_headers: &[],
556 content_type: "",
557 accept: "application/json",
558 query_encoding: &[],
559};
560static OP_30: Operation = Operation {
561 id: "reinstallInstance",
562 method: "POST",
563 path: "/v1/instances/{instance_id}/reinstall",
564 authenticated: true,
565 required_query: &[],
566 required_headers: &[],
567 content_type: "application/json",
568 accept: "application/json",
569 query_encoding: &[],
570};
571static OP_31: Operation = Operation {
572 id: "resizeInstance",
573 method: "POST",
574 path: "/v1/instances/{instance_id}/resize",
575 authenticated: true,
576 required_query: &[],
577 required_headers: &[],
578 content_type: "application/json",
579 accept: "application/json",
580 query_encoding: &[],
581};
582static OP_32: Operation = Operation {
583 id: "startInstance",
584 method: "POST",
585 path: "/v1/instances/{instance_id}/start",
586 authenticated: true,
587 required_query: &[],
588 required_headers: &[],
589 content_type: "",
590 accept: "application/json",
591 query_encoding: &[],
592};
593static OP_33: Operation = Operation {
594 id: "startSerialConsole",
595 method: "GET",
596 path: "/v1/instances/{instance_id}/console/serial",
597 authenticated: true,
598 required_query: &[],
599 required_headers: &[],
600 content_type: "",
601 accept: "application/json",
602 query_encoding: &[QueryEncoding {
603 name: "backlog_bytes",
604 style: "form",
605 explode: true,
606 }],
607};
608static OP_34: Operation = Operation {
609 id: "stopInstance",
610 method: "POST",
611 path: "/v1/instances/{instance_id}/stop",
612 authenticated: true,
613 required_query: &[],
614 required_headers: &[],
615 content_type: "",
616 accept: "application/json",
617 query_encoding: &[],
618};
619static OP_35: Operation = Operation {
620 id: "updateImage",
621 method: "PATCH",
622 path: "/v1/images/{image_id}",
623 authenticated: true,
624 required_query: &[],
625 required_headers: &[],
626 content_type: "application/json",
627 accept: "application/json",
628 query_encoding: &[],
629};
630static OP_36: Operation = Operation {
631 id: "updateInstance",
632 method: "PATCH",
633 path: "/v1/instances/{instance_id}",
634 authenticated: true,
635 required_query: &[],
636 required_headers: &[],
637 content_type: "application/json",
638 accept: "application/json",
639 query_encoding: &[],
640};
641static OP_37: Operation = Operation {
642 id: "updateInstancePool",
643 method: "PATCH",
644 path: "/v1/instance-pools/{pool_id}",
645 authenticated: true,
646 required_query: &[],
647 required_headers: &[],
648 content_type: "application/json",
649 accept: "application/json",
650 query_encoding: &[],
651};
652static OP_38: Operation = Operation {
653 id: "updateInstancePoolMemberProtection",
654 method: "PATCH",
655 path: "/v1/instance-pools/{pool_id}/instances/{instance_id}",
656 authenticated: true,
657 required_query: &[],
658 required_headers: &[],
659 content_type: "application/json",
660 accept: "application/json",
661 query_encoding: &[],
662};
663static OP_39: Operation = Operation {
664 id: "updateInstanceVolumeAttachment",
665 method: "PATCH",
666 path: "/v1/instances/{instance_id}/volumes/{volume_id}",
667 authenticated: true,
668 required_query: &[],
669 required_headers: &[],
670 content_type: "application/json",
671 accept: "application/json",
672 query_encoding: &[],
673};
674#[derive(Clone, Debug)]
675pub struct ComputeService {
676 pub(crate) client: Client,
677}
678impl ComputeService {
679 pub fn attach_instance_interface(
681 &self,
682 instance_id: &str,
683 body: &m::AttachInstanceInterfaceBody,
684 ) -> Request<m::AttachInstanceInterfaceResponse> {
685 Request::new(Core::new(
686 self.client.clone(),
687 "compute",
688 ENDPOINT,
689 &OP_0,
690 &[("instance_id", instance_id)],
691 Payload::json(body),
692 Ok(serde_json::json!({})),
693 ))
694 }
695 pub fn attach_instance_pool_floating_ip(
697 &self,
698 pool_id: &str,
699 body: &m::AttachInstancePoolFloatingIpBody,
700 ) -> Request<m::AttachInstancePoolFloatingIpResponse> {
701 Request::new(Core::new(
702 self.client.clone(),
703 "compute",
704 ENDPOINT,
705 &OP_1,
706 &[("pool_id", pool_id)],
707 Payload::json(body),
708 Ok(serde_json::json!({})),
709 ))
710 }
711 pub fn attach_instance_volume(
713 &self,
714 instance_id: &str,
715 body: &m::AttachInstanceVolumeBody,
716 ) -> Request<m::AttachInstanceVolumeResponse> {
717 Request::new(Core::new(
718 self.client.clone(),
719 "compute",
720 ENDPOINT,
721 &OP_2,
722 &[("instance_id", instance_id)],
723 Payload::json(body),
724 Ok(serde_json::json!({})),
725 ))
726 }
727 pub fn create_image(&self, body: &m::CreateImageBody) -> Request<m::CreateImageResponse> {
729 Request::new(Core::new(
730 self.client.clone(),
731 "compute",
732 ENDPOINT,
733 &OP_3,
734 &[],
735 Payload::json(body),
736 Ok(serde_json::json!({})),
737 ))
738 }
739 pub fn create_instance(
741 &self,
742 body: &m::CreateInstanceBody,
743 ) -> Request<m::CreateInstanceResponse> {
744 Request::new(Core::new(
745 self.client.clone(),
746 "compute",
747 ENDPOINT,
748 &OP_4,
749 &[],
750 Payload::json(body),
751 Ok(serde_json::json!({})),
752 ))
753 }
754 pub fn create_instance_pool(
756 &self,
757 body: &m::CreateInstancePoolBody,
758 ) -> Request<m::CreateInstancePoolResponse> {
759 Request::new(Core::new(
760 self.client.clone(),
761 "compute",
762 ENDPOINT,
763 &OP_5,
764 &[],
765 Payload::json(body),
766 Ok(serde_json::json!({})),
767 ))
768 }
769 pub fn create_serial_console_ticket(
771 &self,
772 instance_id: &str,
773 ) -> Request<m::CreateSerialConsoleTicketResponse> {
774 Request::new(Core::new(
775 self.client.clone(),
776 "compute",
777 ENDPOINT,
778 &OP_6,
779 &[("instance_id", instance_id)],
780 Ok(Payload::Empty),
781 Ok(serde_json::json!({})),
782 ))
783 }
784 pub fn delete_image(&self, image_id: &str) -> Request<m::DeleteImageResponse> {
786 Request::new(Core::new(
787 self.client.clone(),
788 "compute",
789 ENDPOINT,
790 &OP_7,
791 &[("image_id", image_id)],
792 Ok(Payload::Empty),
793 Ok(serde_json::json!({})),
794 ))
795 }
796 pub fn delete_instance(&self, instance_id: &str) -> EmptyRequest {
798 EmptyRequest::new(Core::new(
799 self.client.clone(),
800 "compute",
801 ENDPOINT,
802 &OP_8,
803 &[("instance_id", instance_id)],
804 Ok(Payload::Empty),
805 Ok(serde_json::json!({})),
806 ))
807 }
808 pub fn delete_instance_pool(&self, pool_id: &str) -> EmptyRequest {
810 EmptyRequest::new(Core::new(
811 self.client.clone(),
812 "compute",
813 ENDPOINT,
814 &OP_9,
815 &[("pool_id", pool_id)],
816 Ok(Payload::Empty),
817 Ok(serde_json::json!({})),
818 ))
819 }
820 pub fn detach_instance_interface(&self, instance_id: &str, interface_id: &str) -> EmptyRequest {
822 EmptyRequest::new(Core::new(
823 self.client.clone(),
824 "compute",
825 ENDPOINT,
826 &OP_10,
827 &[("instance_id", instance_id), ("interface_id", interface_id)],
828 Ok(Payload::Empty),
829 Ok(serde_json::json!({})),
830 ))
831 }
832 pub fn detach_instance_pool_floating_ip(
834 &self,
835 pool_id: &str,
836 floating_ip_id: &str,
837 ) -> EmptyRequest {
838 EmptyRequest::new(Core::new(
839 self.client.clone(),
840 "compute",
841 ENDPOINT,
842 &OP_11,
843 &[("pool_id", pool_id), ("floating_ip_id", floating_ip_id)],
844 Ok(Payload::Empty),
845 Ok(serde_json::json!({})),
846 ))
847 }
848 pub fn detach_instance_volume(&self, instance_id: &str, volume_id: &str) -> EmptyRequest {
850 EmptyRequest::new(Core::new(
851 self.client.clone(),
852 "compute",
853 ENDPOINT,
854 &OP_12,
855 &[("instance_id", instance_id), ("volume_id", volume_id)],
856 Ok(Payload::Empty),
857 Ok(serde_json::json!({})),
858 ))
859 }
860 pub fn get_console_output(
862 &self,
863 instance_id: &str,
864 query: &m::GetConsoleOutputQuery,
865 ) -> Request<m::GetConsoleOutputResponse> {
866 Request::new(Core::new(
867 self.client.clone(),
868 "compute",
869 ENDPOINT,
870 &OP_13,
871 &[("instance_id", instance_id)],
872 Ok(Payload::Empty),
873 serde_json::to_value(query).map_err(crate::Error::from),
874 ))
875 }
876 pub fn get_console_screenshot(&self, instance_id: &str) -> BinaryRequest {
878 BinaryRequest::new(Core::new(
879 self.client.clone(),
880 "compute",
881 ENDPOINT,
882 &OP_14,
883 &[("instance_id", instance_id)],
884 Ok(Payload::Empty),
885 Ok(serde_json::json!({})),
886 ))
887 }
888 pub fn get_flavor(&self, flavor_id: &str) -> Request<m::GetFlavorResponse> {
890 Request::new(Core::new(
891 self.client.clone(),
892 "compute",
893 ENDPOINT,
894 &OP_15,
895 &[("flavor_id", flavor_id)],
896 Ok(Payload::Empty),
897 Ok(serde_json::json!({})),
898 ))
899 }
900 pub fn get_flavor_by_reference(
902 &self,
903 reference: &str,
904 scope: &m::GetFlavorScope,
905 ) -> Request<m::GetFlavorResource> {
906 let (core, extract) = crate::request::reference_core(
907 Core::new(
908 self.client.clone(),
909 "compute",
910 ENDPOINT,
911 &OP_15,
912 &[("flavor_id", reference)],
913 Ok(Payload::Empty),
914 Ok(serde_json::json!({})),
915 ),
916 Core::new(
917 self.client.clone(),
918 "compute",
919 ENDPOINT,
920 &OP_19,
921 &[],
922 Ok(Payload::Empty),
923 serde_json::to_value(scope).map_err(crate::Error::from),
924 ),
925 reference,
926 true,
927 Some("flavor"),
928 "flavors",
929 );
930 Request::reference(core, extract)
931 }
932 pub fn get_image(&self, image_id: &str) -> Request<m::GetImageResponse> {
934 Request::new(Core::new(
935 self.client.clone(),
936 "compute",
937 ENDPOINT,
938 &OP_16,
939 &[("image_id", image_id)],
940 Ok(Payload::Empty),
941 Ok(serde_json::json!({})),
942 ))
943 }
944 pub fn get_image_by_reference(
946 &self,
947 reference: &str,
948 scope: &m::GetImageScope,
949 ) -> Request<m::GetImageResource> {
950 let (core, extract) = crate::request::reference_core(
951 Core::new(
952 self.client.clone(),
953 "compute",
954 ENDPOINT,
955 &OP_16,
956 &[("image_id", reference)],
957 Ok(Payload::Empty),
958 Ok(serde_json::json!({})),
959 ),
960 Core::new(
961 self.client.clone(),
962 "compute",
963 ENDPOINT,
964 &OP_21,
965 &[],
966 Ok(Payload::Empty),
967 serde_json::to_value(scope).map_err(crate::Error::from),
968 ),
969 reference,
970 true,
971 Some("image"),
972 "images",
973 );
974 Request::reference(core, extract)
975 }
976 pub fn get_instance(&self, instance_id: &str) -> Request<m::GetInstanceResponse> {
978 Request::new(Core::new(
979 self.client.clone(),
980 "compute",
981 ENDPOINT,
982 &OP_17,
983 &[("instance_id", instance_id)],
984 Ok(Payload::Empty),
985 Ok(serde_json::json!({})),
986 ))
987 }
988 pub fn get_instance_by_reference(
990 &self,
991 reference: &str,
992 scope: &m::GetInstanceScope,
993 ) -> Request<m::GetInstanceResource> {
994 let (core, extract) = crate::request::reference_core(
995 Core::new(
996 self.client.clone(),
997 "compute",
998 ENDPOINT,
999 &OP_17,
1000 &[("instance_id", reference)],
1001 Ok(Payload::Empty),
1002 Ok(serde_json::json!({})),
1003 ),
1004 Core::new(
1005 self.client.clone(),
1006 "compute",
1007 ENDPOINT,
1008 &OP_26,
1009 &[],
1010 Ok(Payload::Empty),
1011 serde_json::to_value(scope).map_err(crate::Error::from),
1012 ),
1013 reference,
1014 true,
1015 Some("instance"),
1016 "instances",
1017 );
1018 Request::reference(core, extract)
1019 }
1020 pub fn get_instance_pool(&self, pool_id: &str) -> Request<m::GetInstancePoolResponse> {
1022 Request::new(Core::new(
1023 self.client.clone(),
1024 "compute",
1025 ENDPOINT,
1026 &OP_18,
1027 &[("pool_id", pool_id)],
1028 Ok(Payload::Empty),
1029 Ok(serde_json::json!({})),
1030 ))
1031 }
1032 pub fn get_instance_pool_by_reference(
1034 &self,
1035 reference: &str,
1036 scope: &m::GetInstancePoolScope,
1037 ) -> Request<m::GetInstancePoolResource> {
1038 let (core, extract) = crate::request::reference_core(
1039 Core::new(
1040 self.client.clone(),
1041 "compute",
1042 ENDPOINT,
1043 &OP_18,
1044 &[("pool_id", reference)],
1045 Ok(Payload::Empty),
1046 Ok(serde_json::json!({})),
1047 ),
1048 Core::new(
1049 self.client.clone(),
1050 "compute",
1051 ENDPOINT,
1052 &OP_24,
1053 &[],
1054 Ok(Payload::Empty),
1055 serde_json::to_value(scope).map_err(crate::Error::from),
1056 ),
1057 reference,
1058 true,
1059 Some("instance_pool"),
1060 "instance_pools",
1061 );
1062 Request::reference(core, extract)
1063 }
1064 pub fn list_flavors(
1066 &self,
1067 query: &m::ListFlavorsQuery,
1068 ) -> PagedRequest<m::ListFlavorsResponse, m::ListFlavorsItem> {
1069 PagedRequest::new(
1070 Core::new(
1071 self.client.clone(),
1072 "compute",
1073 ENDPOINT,
1074 &OP_19,
1075 &[],
1076 Ok(Payload::Empty),
1077 serde_json::to_value(query).map_err(crate::Error::from),
1078 ),
1079 "flavors",
1080 )
1081 }
1082 pub fn list_image_catalog(
1084 &self,
1085 query: &m::ListImageCatalogQuery,
1086 ) -> PagedRequest<m::ListImageCatalogResponse, m::ListImageCatalogItem> {
1087 PagedRequest::new(
1088 Core::new(
1089 self.client.clone(),
1090 "compute",
1091 ENDPOINT,
1092 &OP_20,
1093 &[],
1094 Ok(Payload::Empty),
1095 serde_json::to_value(query).map_err(crate::Error::from),
1096 ),
1097 "categories",
1098 )
1099 }
1100 pub fn list_images(
1102 &self,
1103 query: &m::ListImagesQuery,
1104 ) -> PagedRequest<m::ListImagesResponse, m::ListImagesItem> {
1105 PagedRequest::new(
1106 Core::new(
1107 self.client.clone(),
1108 "compute",
1109 ENDPOINT,
1110 &OP_21,
1111 &[],
1112 Ok(Payload::Empty),
1113 serde_json::to_value(query).map_err(crate::Error::from),
1114 ),
1115 "images",
1116 )
1117 }
1118 pub fn list_instance_interfaces(
1120 &self,
1121 instance_id: &str,
1122 query: &m::ListInstanceInterfacesQuery,
1123 ) -> PagedRequest<m::ListInstanceInterfacesResponse, m::ListInstanceInterfacesItem> {
1124 PagedRequest::new(
1125 Core::new(
1126 self.client.clone(),
1127 "compute",
1128 ENDPOINT,
1129 &OP_22,
1130 &[("instance_id", instance_id)],
1131 Ok(Payload::Empty),
1132 serde_json::to_value(query).map_err(crate::Error::from),
1133 ),
1134 "interfaces",
1135 )
1136 }
1137 pub fn list_instance_pool_floating_ips(
1139 &self,
1140 pool_id: &str,
1141 query: &m::ListInstancePoolFloatingIpsQuery,
1142 ) -> PagedRequest<m::ListInstancePoolFloatingIpsResponse, m::ListInstancePoolFloatingIpsItem>
1143 {
1144 PagedRequest::new(
1145 Core::new(
1146 self.client.clone(),
1147 "compute",
1148 ENDPOINT,
1149 &OP_23,
1150 &[("pool_id", pool_id)],
1151 Ok(Payload::Empty),
1152 serde_json::to_value(query).map_err(crate::Error::from),
1153 ),
1154 "floating_ips",
1155 )
1156 }
1157 pub fn list_instance_pools(
1159 &self,
1160 query: &m::ListInstancePoolsQuery,
1161 ) -> PagedRequest<m::ListInstancePoolsResponse, m::ListInstancePoolsItem> {
1162 PagedRequest::new(
1163 Core::new(
1164 self.client.clone(),
1165 "compute",
1166 ENDPOINT,
1167 &OP_24,
1168 &[],
1169 Ok(Payload::Empty),
1170 serde_json::to_value(query).map_err(crate::Error::from),
1171 ),
1172 "instance_pools",
1173 )
1174 }
1175 pub fn list_instance_volumes(
1177 &self,
1178 instance_id: &str,
1179 query: &m::ListInstanceVolumesQuery,
1180 ) -> PagedRequest<m::ListInstanceVolumesResponse, m::ListInstanceVolumesItem> {
1181 PagedRequest::new(
1182 Core::new(
1183 self.client.clone(),
1184 "compute",
1185 ENDPOINT,
1186 &OP_25,
1187 &[("instance_id", instance_id)],
1188 Ok(Payload::Empty),
1189 serde_json::to_value(query).map_err(crate::Error::from),
1190 ),
1191 "volumes",
1192 )
1193 }
1194 pub fn list_instances(
1196 &self,
1197 query: &m::ListInstancesQuery,
1198 ) -> PagedRequest<m::ListInstancesResponse, m::ListInstancesItem> {
1199 PagedRequest::new(
1200 Core::new(
1201 self.client.clone(),
1202 "compute",
1203 ENDPOINT,
1204 &OP_26,
1205 &[],
1206 Ok(Payload::Empty),
1207 serde_json::to_value(query).map_err(crate::Error::from),
1208 ),
1209 "instances",
1210 )
1211 }
1212 pub fn list_pool_instances(
1214 &self,
1215 pool_id: &str,
1216 query: &m::ListPoolInstancesQuery,
1217 ) -> PagedRequest<m::ListPoolInstancesResponse, m::ListPoolInstancesItem> {
1218 PagedRequest::new(
1219 Core::new(
1220 self.client.clone(),
1221 "compute",
1222 ENDPOINT,
1223 &OP_27,
1224 &[("pool_id", pool_id)],
1225 Ok(Payload::Empty),
1226 serde_json::to_value(query).map_err(crate::Error::from),
1227 ),
1228 "instances",
1229 )
1230 }
1231 pub fn reboot_instance(
1233 &self,
1234 instance_id: &str,
1235 body: Option<&m::RebootInstanceBody>,
1236 ) -> EmptyRequest {
1237 EmptyRequest::new(Core::new(
1238 self.client.clone(),
1239 "compute",
1240 ENDPOINT,
1241 &OP_28,
1242 &[("instance_id", instance_id)],
1243 body.map(Payload::json).unwrap_or(Ok(Payload::Empty)),
1244 Ok(serde_json::json!({})),
1245 ))
1246 }
1247 pub fn refresh_instance_pool(&self, pool_id: &str) -> Request<m::RefreshInstancePoolResponse> {
1249 Request::new(Core::new(
1250 self.client.clone(),
1251 "compute",
1252 ENDPOINT,
1253 &OP_29,
1254 &[("pool_id", pool_id)],
1255 Ok(Payload::Empty),
1256 Ok(serde_json::json!({})),
1257 ))
1258 }
1259 pub fn reinstall_instance(
1261 &self,
1262 instance_id: &str,
1263 body: Option<&m::ReinstallInstanceBody>,
1264 ) -> EmptyRequest {
1265 EmptyRequest::new(Core::new(
1266 self.client.clone(),
1267 "compute",
1268 ENDPOINT,
1269 &OP_30,
1270 &[("instance_id", instance_id)],
1271 body.map(Payload::json).unwrap_or(Ok(Payload::Empty)),
1272 Ok(serde_json::json!({})),
1273 ))
1274 }
1275 pub fn resize_instance(&self, instance_id: &str, body: &m::ResizeInstanceBody) -> EmptyRequest {
1277 EmptyRequest::new(Core::new(
1278 self.client.clone(),
1279 "compute",
1280 ENDPOINT,
1281 &OP_31,
1282 &[("instance_id", instance_id)],
1283 Payload::json(body),
1284 Ok(serde_json::json!({})),
1285 ))
1286 }
1287 pub fn start_instance(&self, instance_id: &str) -> EmptyRequest {
1289 EmptyRequest::new(Core::new(
1290 self.client.clone(),
1291 "compute",
1292 ENDPOINT,
1293 &OP_32,
1294 &[("instance_id", instance_id)],
1295 Ok(Payload::Empty),
1296 Ok(serde_json::json!({})),
1297 ))
1298 }
1299 pub fn start_serial_console(
1301 &self,
1302 instance_id: &str,
1303 query: &m::StartSerialConsoleQuery,
1304 ) -> WebSocketRequest {
1305 WebSocketRequest::new(Core::new(
1306 self.client.clone(),
1307 "compute",
1308 ENDPOINT,
1309 &OP_33,
1310 &[("instance_id", instance_id)],
1311 Ok(Payload::Empty),
1312 serde_json::to_value(query).map_err(crate::Error::from),
1313 ))
1314 }
1315 pub fn stop_instance(&self, instance_id: &str) -> EmptyRequest {
1317 EmptyRequest::new(Core::new(
1318 self.client.clone(),
1319 "compute",
1320 ENDPOINT,
1321 &OP_34,
1322 &[("instance_id", instance_id)],
1323 Ok(Payload::Empty),
1324 Ok(serde_json::json!({})),
1325 ))
1326 }
1327 pub fn update_image(
1329 &self,
1330 image_id: &str,
1331 body: &m::UpdateImageBody,
1332 ) -> Request<m::UpdateImageResponse> {
1333 Request::new(Core::new(
1334 self.client.clone(),
1335 "compute",
1336 ENDPOINT,
1337 &OP_35,
1338 &[("image_id", image_id)],
1339 Payload::json(body),
1340 Ok(serde_json::json!({})),
1341 ))
1342 }
1343 pub fn update_instance(
1345 &self,
1346 instance_id: &str,
1347 body: &m::UpdateInstanceBody,
1348 ) -> Request<m::UpdateInstanceResponse> {
1349 Request::new(Core::new(
1350 self.client.clone(),
1351 "compute",
1352 ENDPOINT,
1353 &OP_36,
1354 &[("instance_id", instance_id)],
1355 Payload::json(body),
1356 Ok(serde_json::json!({})),
1357 ))
1358 }
1359 pub fn update_instance_pool(
1361 &self,
1362 pool_id: &str,
1363 body: &m::UpdateInstancePoolBody,
1364 ) -> Request<m::UpdateInstancePoolResponse> {
1365 Request::new(Core::new(
1366 self.client.clone(),
1367 "compute",
1368 ENDPOINT,
1369 &OP_37,
1370 &[("pool_id", pool_id)],
1371 Payload::json(body),
1372 Ok(serde_json::json!({})),
1373 ))
1374 }
1375 pub fn update_instance_pool_member_protection(
1377 &self,
1378 pool_id: &str,
1379 instance_id: &str,
1380 body: &m::UpdateInstancePoolMemberProtectionBody,
1381 ) -> Request<m::UpdateInstancePoolMemberProtectionResponse> {
1382 Request::new(Core::new(
1383 self.client.clone(),
1384 "compute",
1385 ENDPOINT,
1386 &OP_38,
1387 &[("pool_id", pool_id), ("instance_id", instance_id)],
1388 Payload::json(body),
1389 Ok(serde_json::json!({})),
1390 ))
1391 }
1392 pub fn update_instance_volume_attachment(
1394 &self,
1395 instance_id: &str,
1396 volume_id: &str,
1397 body: &m::UpdateInstanceVolumeAttachmentBody,
1398 ) -> EmptyRequest {
1399 EmptyRequest::new(Core::new(
1400 self.client.clone(),
1401 "compute",
1402 ENDPOINT,
1403 &OP_39,
1404 &[("instance_id", instance_id), ("volume_id", volume_id)],
1405 Payload::json(body),
1406 Ok(serde_json::json!({})),
1407 ))
1408 }
1409}