Skip to main content

basaltic/models/
compute.rs

1//! Generated typed wire models. Unknown string enum values are retained.
2#[derive(Clone, Debug, serde::Serialize, serde::Deserialize)]
3pub struct AttachInstanceInterfaceRequest {
4    /// Existing standalone interface UUID or complete VPC/subnet/interface CRN. Bare names lack the subnet parent and are rejected. It keeps its address, MAC, and security groups; detach returns it to standalone instead of destroying it.
5    #[serde(rename = "interface")]
6    pub interface: String,
7}
8impl AttachInstanceInterfaceRequest {
9    /// Set the required fields; optional fields start omitted.
10    #[allow(clippy::too_many_arguments)]
11    pub fn new(interface: String) -> Self {
12        Self { interface }
13    }
14}
15
16pub type AttachInstanceInterfaceBody = AttachInstanceInterfaceRequest;
17
18#[derive(Clone, Debug, serde::Serialize, serde::Deserialize)]
19pub struct InstanceInterfaceResponse {
20    #[serde(rename = "interface")]
21    pub interface: AttachedInterface,
22}
23
24#[derive(Clone, Debug, serde::Serialize, serde::Deserialize)]
25pub struct AttachedInterface {
26    #[serde(rename = "id")]
27    pub id: String,
28
29    #[serde(rename = "crn")]
30    pub crn: String,
31    /// Subnet containing this interface.
32    #[serde(rename = "subnet")]
33    pub subnet: ResourceRef,
34    /// Resource names must not start with the literal crn: prefix or be UUIDs (canonical, compact, braced, or urn:uuid: forms, in either case).
35    #[serde(rename = "name")]
36    pub name: String,
37
38    #[serde(
39        rename = "description",
40        default,
41        skip_serializing_if = "Option::is_none"
42    )]
43    pub description: Option<String>,
44
45    #[serde(rename = "mac")]
46    pub mac: String,
47    /// Instance holding this interface, including a stopped instance. Null when unbound. Floating IP attachments are tracked separately.
48    #[serde(rename = "attached_to")]
49    pub attached_to: AttachedInterfaceAttachedTo,
50
51    #[serde(rename = "tags")]
52    pub tags: std::collections::BTreeMap<String, String>,
53
54    #[serde(rename = "created_at")]
55    pub created_at: String,
56
57    #[serde(rename = "updated_at")]
58    pub updated_at: String,
59
60    #[serde(rename = "boot_index")]
61    pub boot_index: i64,
62    /// The lowest-boot-index NIC — the one carrying the guest's default and metadata routes.
63    #[serde(rename = "primary")]
64    pub primary: bool,
65    /// A customer-attached standalone interface — detach unbinds it instead of destroying it.
66    #[serde(rename = "external")]
67    pub external: bool,
68    /// The guest does not carry the interface yet and a hard reboot is what delivers it — an interface past the first is a network on the instance's launcher, and a launcher's networks are fixed for its lifetime. Set when the instance was running in a region that cannot attach to a running guest. Absent for a stopped instance, which comes up with the device, and absent where the region attaches live, where the running guest is given the device without a restart.
69    #[serde(
70        rename = "restart_required",
71        default,
72        skip_serializing_if = "Option::is_none"
73    )]
74    pub restart_required: Option<bool>,
75}
76
77#[derive(Clone, Debug, serde::Serialize, serde::Deserialize)]
78pub struct ResourceRef {
79    #[serde(rename = "id")]
80    pub id: String,
81
82    #[serde(rename = "crn")]
83    pub crn: String,
84    /// Display label at response time — the resource's name where it has one, otherwise its human label (an invoice number, an account display name). Absent when the target is gone. Not a lookup key.
85    #[serde(rename = "name", default, skip_serializing_if = "Option::is_none")]
86    pub name: Option<String>,
87}
88
89#[derive(Clone, Debug, serde::Serialize, serde::Deserialize)]
90#[serde(untagged)]
91pub enum AttachedInterfaceAttachedTo {
92    Variant1(Box<ResourceRef>),
93    Variant2(Box<crate::Nullable<serde_json::Value>>),
94}
95
96pub type AttachInstanceInterfaceResponse = InstanceInterfaceResponse;
97
98#[derive(Clone, Debug, serde::Serialize, serde::Deserialize)]
99pub struct InstancePoolFloatingIpAttachRequestInput {
100    /// An account-scoped floating IP UUID or CRN (bare names are not accepted), currently attached to nothing. This binds it to the pool; it does not allocate one.
101    #[serde(rename = "floating_ip")]
102    pub floating_ip: String,
103}
104impl InstancePoolFloatingIpAttachRequestInput {
105    /// Set the required fields; optional fields start omitted.
106    #[allow(clippy::too_many_arguments)]
107    pub fn new(floating_ip: String) -> Self {
108        Self { floating_ip }
109    }
110}
111
112pub type AttachInstancePoolFloatingIpBody = InstancePoolFloatingIpAttachRequestInput;
113
114#[derive(Clone, Debug, serde::Serialize, serde::Deserialize)]
115pub struct InstancePoolFloatingIpResponse {
116    #[serde(rename = "floating_ip")]
117    pub floating_ip: FloatingIp,
118}
119
120#[derive(Clone, Debug, serde::Serialize, serde::Deserialize)]
121pub struct FloatingIp {
122    #[serde(rename = "id")]
123    pub id: String,
124
125    #[serde(rename = "crn")]
126    pub crn: String,
127
128    #[serde(
129        rename = "description",
130        default,
131        skip_serializing_if = "Option::is_none"
132    )]
133    pub description: Option<String>,
134
135    #[serde(rename = "family")]
136    pub family: IpFamily,
137    /// Instance pool or load balancer that owns the address. Null for direct interface attachments and unattached addresses. An empty pool retains ownership.
138    #[serde(rename = "attached_to")]
139    pub attached_to: FloatingIpAttachedTo,
140
141    #[serde(rename = "tags")]
142    pub tags: std::collections::BTreeMap<String, String>,
143    /// The readiness check applied to this address's members. Absent when none is configured. See `FloatingIpHealthCheck`.
144    #[serde(
145        rename = "health_check",
146        default,
147        skip_serializing_if = "Option::is_none"
148    )]
149    pub health_check: Option<FloatingIpHealthCheck>,
150
151    #[serde(rename = "created_at")]
152    pub created_at: String,
153
154    #[serde(rename = "updated_at")]
155    pub updated_at: String,
156    /// Allocated public or private address.
157    #[serde(rename = "address")]
158    pub address: String,
159
160    #[serde(rename = "visibility")]
161    pub visibility: FloatingIpVisibility,
162    /// Allocation subnet for a private floating IP; null for public addresses.
163    #[serde(rename = "subnet")]
164    pub subnet: FloatingIpSubnet,
165    /// Allocation VPC for a private floating IP; null for public addresses.
166    #[serde(rename = "vpc")]
167    pub vpc: FloatingIpVpc,
168}
169
170#[derive(Clone, Debug, PartialEq, Eq)]
171pub enum IpFamily {
172    Ipv4,
173    Ipv6,
174    Unknown(String),
175}
176impl IpFamily {
177    pub fn as_str(&self) -> &str {
178        match self {
179            Self::Ipv4 => "ipv4",
180            Self::Ipv6 => "ipv6",
181            Self::Unknown(value) => value,
182        }
183    }
184}
185impl serde::Serialize for IpFamily {
186    fn serialize<S: serde::Serializer>(&self, serializer: S) -> Result<S::Ok, S::Error> {
187        serializer.serialize_str(self.as_str())
188    }
189}
190impl<'de> serde::Deserialize<'de> for IpFamily {
191    fn deserialize<D: serde::Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error> {
192        let value = <String as serde::Deserialize>::deserialize(deserializer)?;
193        Ok(match value.as_str() {
194            "ipv4" => Self::Ipv4,
195            "ipv6" => Self::Ipv6,
196            _ => Self::Unknown(value),
197        })
198    }
199}
200
201#[derive(Clone, Debug, serde::Serialize, serde::Deserialize)]
202#[serde(untagged)]
203pub enum FloatingIpAttachedTo {
204    Variant1(Box<ResourceRef>),
205    Variant2(Box<crate::Nullable<serde_json::Value>>),
206}
207
208#[derive(Clone, Debug, serde::Serialize, serde::Deserialize)]
209pub struct FloatingIpHealthCheck {
210    /// `tcp` opens a connection; `http`/`https` issue a GET and match the status against `matcher`. There is no `udp`: a readiness probe needs an answer — check a udp service on a tcp health port instead.
211    #[serde(rename = "protocol")]
212    pub protocol: FloatingIpHealthCheckProtocol,
213    /// HTTP path probed; ignored for tcp.
214    #[serde(rename = "path", default, skip_serializing_if = "Option::is_none")]
215    pub path: Option<String>,
216    /// Port probed on the member.
217    #[serde(rename = "port")]
218    pub port: i64,
219
220    #[serde(rename = "interval_sec")]
221    pub interval_sec: i64,
222    /// Per-probe timeout; must be less than interval_sec.
223    #[serde(rename = "timeout_sec")]
224    pub timeout_sec: i64,
225    /// Consecutive passes before a member flips healthy.
226    #[serde(rename = "healthy_threshold")]
227    pub healthy_threshold: i64,
228    /// Consecutive failures before a member flips unhealthy.
229    #[serde(rename = "unhealthy_threshold")]
230    pub unhealthy_threshold: i64,
231    /// HTTP status or range that counts as passing; ignored for tcp.
232    #[serde(rename = "matcher", default, skip_serializing_if = "Option::is_none")]
233    pub matcher: Option<String>,
234}
235
236#[derive(Clone, Debug, PartialEq, Eq)]
237pub enum FloatingIpHealthCheckProtocol {
238    Tcp,
239    Http,
240    Https,
241    Unknown(String),
242}
243impl FloatingIpHealthCheckProtocol {
244    pub fn as_str(&self) -> &str {
245        match self {
246            Self::Tcp => "tcp",
247            Self::Http => "http",
248            Self::Https => "https",
249            Self::Unknown(value) => value,
250        }
251    }
252}
253impl serde::Serialize for FloatingIpHealthCheckProtocol {
254    fn serialize<S: serde::Serializer>(&self, serializer: S) -> Result<S::Ok, S::Error> {
255        serializer.serialize_str(self.as_str())
256    }
257}
258impl<'de> serde::Deserialize<'de> for FloatingIpHealthCheckProtocol {
259    fn deserialize<D: serde::Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error> {
260        let value = <String as serde::Deserialize>::deserialize(deserializer)?;
261        Ok(match value.as_str() {
262            "tcp" => Self::Tcp,
263            "http" => Self::Http,
264            "https" => Self::Https,
265            _ => Self::Unknown(value),
266        })
267    }
268}
269
270#[derive(Clone, Debug, PartialEq, Eq)]
271pub enum FloatingIpVisibility {
272    Public,
273    Private,
274    Unknown(String),
275}
276impl FloatingIpVisibility {
277    pub fn as_str(&self) -> &str {
278        match self {
279            Self::Public => "public",
280            Self::Private => "private",
281            Self::Unknown(value) => value,
282        }
283    }
284}
285impl serde::Serialize for FloatingIpVisibility {
286    fn serialize<S: serde::Serializer>(&self, serializer: S) -> Result<S::Ok, S::Error> {
287        serializer.serialize_str(self.as_str())
288    }
289}
290impl<'de> serde::Deserialize<'de> for FloatingIpVisibility {
291    fn deserialize<D: serde::Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error> {
292        let value = <String as serde::Deserialize>::deserialize(deserializer)?;
293        Ok(match value.as_str() {
294            "public" => Self::Public,
295            "private" => Self::Private,
296            _ => Self::Unknown(value),
297        })
298    }
299}
300
301#[derive(Clone, Debug, serde::Serialize, serde::Deserialize)]
302#[serde(untagged)]
303pub enum FloatingIpSubnet {
304    Variant1(Box<ResourceRef>),
305    Variant2(Box<crate::Nullable<serde_json::Value>>),
306}
307
308#[derive(Clone, Debug, serde::Serialize, serde::Deserialize)]
309#[serde(untagged)]
310pub enum FloatingIpVpc {
311    Variant1(Box<ResourceRef>),
312    Variant2(Box<crate::Nullable<serde_json::Value>>),
313}
314
315pub type AttachInstancePoolFloatingIpResponse = InstancePoolFloatingIpResponse;
316
317#[derive(Clone, Debug, serde::Serialize, serde::Deserialize)]
318pub struct AttachInstanceVolumeRequest {
319    /// Account-scoped volume reference (UUID, CRN or exact name).
320    #[serde(rename = "volume")]
321    pub volume: String,
322    /// Optional device-name override; auto-picks the next free slot (vdb/vdc/…) when omitted.
323    #[serde(rename = "device", default, skip_serializing_if = "Option::is_none")]
324    pub device: Option<String>,
325    /// When set, the in-guest agent formats the disk (only if blank) and mounts it at this path. Empty attaches the block device only.
326    #[serde(
327        rename = "mount_path",
328        default,
329        skip_serializing_if = "Option::is_none"
330    )]
331    pub mount_path: Option<String>,
332    /// Filesystem the in-guest agent formats the disk with, and only when `mount_path` is set and the disk is blank. Rejected with 400 if it is neither value.
333    #[serde(rename = "fstype", default, skip_serializing_if = "Option::is_none")]
334    pub fstype: Option<AttachInstanceVolumeRequestFstype>,
335}
336impl AttachInstanceVolumeRequest {
337    /// Set the required fields; optional fields start omitted.
338    #[allow(clippy::too_many_arguments)]
339    pub fn new(volume: String) -> Self {
340        Self {
341            volume,
342            device: None,
343            mount_path: None,
344            fstype: None,
345        }
346    }
347}
348
349#[derive(Clone, Debug, PartialEq, Eq)]
350pub enum AttachInstanceVolumeRequestFstype {
351    Ext4,
352    Xfs,
353    Unknown(String),
354}
355impl AttachInstanceVolumeRequestFstype {
356    pub fn as_str(&self) -> &str {
357        match self {
358            Self::Ext4 => "ext4",
359            Self::Xfs => "xfs",
360            Self::Unknown(value) => value,
361        }
362    }
363}
364impl serde::Serialize for AttachInstanceVolumeRequestFstype {
365    fn serialize<S: serde::Serializer>(&self, serializer: S) -> Result<S::Ok, S::Error> {
366        serializer.serialize_str(self.as_str())
367    }
368}
369impl<'de> serde::Deserialize<'de> for AttachInstanceVolumeRequestFstype {
370    fn deserialize<D: serde::Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error> {
371        let value = <String as serde::Deserialize>::deserialize(deserializer)?;
372        Ok(match value.as_str() {
373            "ext4" => Self::Ext4,
374            "xfs" => Self::Xfs,
375            _ => Self::Unknown(value),
376        })
377    }
378}
379
380pub type AttachInstanceVolumeBody = AttachInstanceVolumeRequest;
381
382#[derive(Clone, Debug, serde::Serialize, serde::Deserialize)]
383pub struct InstanceVolumeResponse {
384    #[serde(rename = "volume")]
385    pub volume: AttachedVolume,
386}
387
388#[derive(Clone, Debug, serde::Serialize, serde::Deserialize)]
389pub struct AttachedVolume {
390    #[serde(rename = "id")]
391    pub id: String,
392    /// Cloud Resource Name (name-based, region-scoped).
393    #[serde(rename = "crn")]
394    pub crn: String,
395    /// Resource names must not start with the literal crn: prefix or be UUIDs (canonical, compact, braced, or urn:uuid: forms, in either case).
396    #[serde(rename = "name")]
397    pub name: String,
398
399    #[serde(
400        rename = "description",
401        default,
402        skip_serializing_if = "Option::is_none"
403    )]
404    pub description: Option<String>,
405
406    #[serde(rename = "tags")]
407    pub tags: Tags,
408
409    #[serde(rename = "volume_type")]
410    pub volume_type: VolumeTypeName,
411
412    #[serde(rename = "size_gb")]
413    pub size_gb: i64,
414
415    #[serde(rename = "performance")]
416    pub performance: VolumePerformance,
417
418    #[serde(rename = "included_io_limits")]
419    pub included_io_limits: IncludedIOLimits,
420
421    #[serde(rename = "status")]
422    pub status: VolumeStatus,
423    /// Set at create time when the volume is provisioned from a bootable image. Immutable after creation.
424    #[serde(rename = "bootable")]
425    pub bootable: bool,
426    /// Active faults, newest first. Empty when healthy. Status is error if and only if an active error-severity fault exists. Resolved history is retained internally.
427    #[serde(rename = "faults")]
428    pub faults: Vec<Fault>,
429
430    #[serde(rename = "created_at")]
431    pub created_at: String,
432
433    #[serde(rename = "updated_at")]
434    pub updated_at: String,
435    /// Source image identity, or null when this volume was not created from an image.
436    #[serde(rename = "source_image")]
437    pub source_image: AttachedVolumeSourceImage,
438    /// Source snapshot identity, or null when not created from a snapshot.
439    #[serde(rename = "source_snapshot")]
440    pub source_snapshot: AttachedVolumeSourceSnapshot,
441
442    #[serde(rename = "device")]
443    pub device: String,
444
445    #[serde(rename = "boot_index")]
446    pub boot_index: i64,
447
448    #[serde(rename = "delete_on_termination")]
449    pub delete_on_termination: bool,
450
451    #[serde(
452        rename = "mount_path",
453        default,
454        skip_serializing_if = "Option::is_none"
455    )]
456    pub mount_path: Option<String>,
457    /// Filesystem the in-guest agent formatted the volume with, or absent when the attachment did not name one and the agent used the ext4 default. Every write path — instance create, pool template and attach — refuses anything else, so this is the whole set the field can hold.
458    #[serde(rename = "fstype", default, skip_serializing_if = "Option::is_none")]
459    pub fstype: Option<AttachedVolumeFstype>,
460
461    #[serde(rename = "mount", default, skip_serializing_if = "Option::is_none")]
462    pub mount: Option<VolumeMount>,
463}
464
465pub type Tags = std::collections::BTreeMap<String, String>;
466
467#[derive(Clone, Debug, PartialEq, Eq)]
468pub enum VolumeTypeName {
469    Hdd,
470    Ssd,
471    Nvme,
472    Unknown(String),
473}
474impl VolumeTypeName {
475    pub fn as_str(&self) -> &str {
476        match self {
477            Self::Hdd => "hdd",
478            Self::Ssd => "ssd",
479            Self::Nvme => "nvme",
480            Self::Unknown(value) => value,
481        }
482    }
483}
484impl serde::Serialize for VolumeTypeName {
485    fn serialize<S: serde::Serializer>(&self, serializer: S) -> Result<S::Ok, S::Error> {
486        serializer.serialize_str(self.as_str())
487    }
488}
489impl<'de> serde::Deserialize<'de> for VolumeTypeName {
490    fn deserialize<D: serde::Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error> {
491        let value = <String as serde::Deserialize>::deserialize(deserializer)?;
492        Ok(match value.as_str() {
493            "hdd" => Self::Hdd,
494            "ssd" => Self::Ssd,
495            "nvme" => Self::Nvme,
496            _ => Self::Unknown(value),
497        })
498    }
499}
500
501#[derive(Clone, Debug, serde::Serialize, serde::Deserialize)]
502pub struct VolumePerformance {
503    #[serde(rename = "requested")]
504    pub requested: IncludedIOLimits,
505
506    #[serde(rename = "applied")]
507    pub applied: IncludedIOLimits,
508}
509
510#[derive(Clone, Debug, serde::Serialize, serde::Deserialize)]
511pub struct IncludedIOLimits {
512    #[serde(rename = "iops")]
513    pub iops: i64,
514
515    #[serde(rename = "bytes_per_sec")]
516    pub bytes_per_sec: i64,
517    /// Always zero for SSD and NVMe volumes; IOPS bursting is disabled.
518    #[serde(rename = "burst_iops")]
519    pub burst_iops: i64,
520    /// Always zero for SSD and NVMe volumes; throughput bursting is disabled.
521    #[serde(rename = "burst_bytes_per_sec")]
522    pub burst_bytes_per_sec: i64,
523    /// Always zero for SSD and NVMe volumes; no burst duration applies.
524    #[serde(rename = "burst_seconds")]
525    pub burst_seconds: i64,
526}
527
528#[derive(Clone, Debug, PartialEq, Eq)]
529pub enum VolumeStatus {
530    Creating,
531    Available,
532    InUse,
533    Extending,
534    Updating,
535    Deleting,
536    Error,
537    Unknown(String),
538}
539impl VolumeStatus {
540    pub fn as_str(&self) -> &str {
541        match self {
542            Self::Creating => "creating",
543            Self::Available => "available",
544            Self::InUse => "in_use",
545            Self::Extending => "extending",
546            Self::Updating => "updating",
547            Self::Deleting => "deleting",
548            Self::Error => "error",
549            Self::Unknown(value) => value,
550        }
551    }
552}
553impl serde::Serialize for VolumeStatus {
554    fn serialize<S: serde::Serializer>(&self, serializer: S) -> Result<S::Ok, S::Error> {
555        serializer.serialize_str(self.as_str())
556    }
557}
558impl<'de> serde::Deserialize<'de> for VolumeStatus {
559    fn deserialize<D: serde::Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error> {
560        let value = <String as serde::Deserialize>::deserialize(deserializer)?;
561        Ok(match value.as_str() {
562            "creating" => Self::Creating,
563            "available" => Self::Available,
564            "in_use" => Self::InUse,
565            "extending" => Self::Extending,
566            "updating" => Self::Updating,
567            "deleting" => Self::Deleting,
568            "error" => Self::Error,
569            _ => Self::Unknown(value),
570        })
571    }
572}
573
574#[derive(Clone, Debug, serde::Serialize, serde::Deserialize)]
575pub struct Fault {
576    /// Stable machine-readable code owned by the reporting operation.
577    #[serde(rename = "code")]
578    pub code: String,
579
580    #[serde(rename = "severity")]
581    pub severity: FaultSeverity,
582
583    #[serde(rename = "message")]
584    pub message: String,
585    /// Structured context; legacy strings are preserved in legacy_text.
586    #[serde(rename = "details")]
587    pub details: crate::Nullable<std::collections::BTreeMap<String, serde_json::Value>>,
588    /// First observation in this active occurrence series.
589    #[serde(rename = "first_at")]
590    pub first_at: String,
591    /// Latest observation in this active occurrence series.
592    #[serde(rename = "last_at")]
593    pub last_at: String,
594
595    #[serde(rename = "occurrences")]
596    pub occurrences: i64,
597}
598
599#[derive(Clone, Debug, PartialEq, Eq)]
600pub enum FaultSeverity {
601    Error,
602    Warning,
603    Unknown(String),
604}
605impl FaultSeverity {
606    pub fn as_str(&self) -> &str {
607        match self {
608            Self::Error => "error",
609            Self::Warning => "warning",
610            Self::Unknown(value) => value,
611        }
612    }
613}
614impl serde::Serialize for FaultSeverity {
615    fn serialize<S: serde::Serializer>(&self, serializer: S) -> Result<S::Ok, S::Error> {
616        serializer.serialize_str(self.as_str())
617    }
618}
619impl<'de> serde::Deserialize<'de> for FaultSeverity {
620    fn deserialize<D: serde::Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error> {
621        let value = <String as serde::Deserialize>::deserialize(deserializer)?;
622        Ok(match value.as_str() {
623            "error" => Self::Error,
624            "warning" => Self::Warning,
625            _ => Self::Unknown(value),
626        })
627    }
628}
629
630#[derive(Clone, Debug, serde::Serialize, serde::Deserialize)]
631#[serde(untagged)]
632pub enum AttachedVolumeSourceImage {
633    Variant1(Box<ResourceRef>),
634    Variant2(Box<crate::Nullable<serde_json::Value>>),
635}
636
637#[derive(Clone, Debug, serde::Serialize, serde::Deserialize)]
638#[serde(untagged)]
639pub enum AttachedVolumeSourceSnapshot {
640    Variant1(Box<ResourceRef>),
641    Variant2(Box<crate::Nullable<serde_json::Value>>),
642}
643
644#[derive(Clone, Debug, PartialEq, Eq)]
645pub enum AttachedVolumeFstype {
646    Ext4,
647    Xfs,
648    Unknown(String),
649}
650impl AttachedVolumeFstype {
651    pub fn as_str(&self) -> &str {
652        match self {
653            Self::Ext4 => "ext4",
654            Self::Xfs => "xfs",
655            Self::Unknown(value) => value,
656        }
657    }
658}
659impl serde::Serialize for AttachedVolumeFstype {
660    fn serialize<S: serde::Serializer>(&self, serializer: S) -> Result<S::Ok, S::Error> {
661        serializer.serialize_str(self.as_str())
662    }
663}
664impl<'de> serde::Deserialize<'de> for AttachedVolumeFstype {
665    fn deserialize<D: serde::Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error> {
666        let value = <String as serde::Deserialize>::deserialize(deserializer)?;
667        Ok(match value.as_str() {
668            "ext4" => Self::Ext4,
669            "xfs" => Self::Xfs,
670            _ => Self::Unknown(value),
671        })
672    }
673}
674
675#[derive(Clone, Debug, serde::Serialize, serde::Deserialize)]
676pub struct VolumeMount {
677    /// - `unknown` — no guest agent has ever reported on this volume. The agent may predate this feature, may have been removed (which is supported), or the guest may never have booted. - `pending` — the agent cannot mount it yet and expects that to change. The ordinary state for the first seconds after an attach, while the hot-plugged disk appears in the guest. - `mounted` — mounted at `mount_path`. May still carry a `code`. - `failed` — it will not mount until something changes. Either the agent reported a refusal that waiting cannot fix, or it has been unable to make progress for long enough that waiting is no longer the explanation. `code` says which.
678    #[serde(rename = "state")]
679    pub state: VolumeMountState,
680    /// Why the volume is in this state. Absent when there is nothing to say. Independent of `state` rather than something only a failure carries: `fstab_write_failed` accompanies a **mounted** volume whose fstab entry could not be written, which works now and will be gone after the next reboot. The commonest one to act on is `signatures_no_filesystem` — the disk carries a partition table or other signatures but no mountable filesystem, so the agent will not format it, because formatting would destroy what is there. A volume cloned from a boot disk and attached with a `mount_path` lands here. Partition and format it inside the guest, or attach it without a `mount_path` and mount it yourself. `unknown_error` is a code this platform does not recognise, reported by a guest agent newer than the region.
681    #[serde(rename = "code", default, skip_serializing_if = "Option::is_none")]
682    pub code: Option<VolumeMountCode>,
683    /// Human-readable detail from inside the guest — the failing command's output, the partition table type it found. Free text originating in the customer's own VM: sanitised and capped, but display it as text, never as markup.
684    #[serde(rename = "message", default, skip_serializing_if = "Option::is_none")]
685    pub message: Option<String>,
686    /// When the volume entered this condition. Absent when `state` is `unknown`.
687    #[serde(rename = "since", default, skip_serializing_if = "Option::is_none")]
688    pub since: Option<String>,
689    /// When the guest agent last reported, whether or not anything had changed. A `reported_at` far in the past means the agent has stopped talking to us, and the state beside it is what it last said rather than what is true now. Absent when `state` is `unknown`.
690    #[serde(
691        rename = "reported_at",
692        default,
693        skip_serializing_if = "Option::is_none"
694    )]
695    pub reported_at: Option<String>,
696}
697
698#[derive(Clone, Debug, PartialEq, Eq)]
699pub enum VolumeMountState {
700    Unknown1,
701    Pending,
702    Mounted,
703    Failed,
704    Unknown(String),
705}
706impl VolumeMountState {
707    pub fn as_str(&self) -> &str {
708        match self {
709            Self::Unknown1 => "unknown",
710            Self::Pending => "pending",
711            Self::Mounted => "mounted",
712            Self::Failed => "failed",
713            Self::Unknown(value) => value,
714        }
715    }
716}
717impl serde::Serialize for VolumeMountState {
718    fn serialize<S: serde::Serializer>(&self, serializer: S) -> Result<S::Ok, S::Error> {
719        serializer.serialize_str(self.as_str())
720    }
721}
722impl<'de> serde::Deserialize<'de> for VolumeMountState {
723    fn deserialize<D: serde::Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error> {
724        let value = <String as serde::Deserialize>::deserialize(deserializer)?;
725        Ok(match value.as_str() {
726            "unknown" => Self::Unknown1,
727            "pending" => Self::Pending,
728            "mounted" => Self::Mounted,
729            "failed" => Self::Failed,
730            _ => Self::Unknown(value),
731        })
732    }
733}
734
735#[derive(Clone, Debug, PartialEq, Eq)]
736pub enum VolumeMountCode {
737    UnsafeSerial,
738    DeviceAbsent,
739    ProbeFailed,
740    SignaturesNoFilesystem,
741    UnsupportedFstype,
742    MkfsFailed,
743    UnsafeMountPath,
744    MkdirFailed,
745    MountFailed,
746    FstabWriteFailed,
747    UnknownError,
748    Unknown(String),
749}
750impl VolumeMountCode {
751    pub fn as_str(&self) -> &str {
752        match self {
753            Self::UnsafeSerial => "unsafe_serial",
754            Self::DeviceAbsent => "device_absent",
755            Self::ProbeFailed => "probe_failed",
756            Self::SignaturesNoFilesystem => "signatures_no_filesystem",
757            Self::UnsupportedFstype => "unsupported_fstype",
758            Self::MkfsFailed => "mkfs_failed",
759            Self::UnsafeMountPath => "unsafe_mount_path",
760            Self::MkdirFailed => "mkdir_failed",
761            Self::MountFailed => "mount_failed",
762            Self::FstabWriteFailed => "fstab_write_failed",
763            Self::UnknownError => "unknown_error",
764            Self::Unknown(value) => value,
765        }
766    }
767}
768impl serde::Serialize for VolumeMountCode {
769    fn serialize<S: serde::Serializer>(&self, serializer: S) -> Result<S::Ok, S::Error> {
770        serializer.serialize_str(self.as_str())
771    }
772}
773impl<'de> serde::Deserialize<'de> for VolumeMountCode {
774    fn deserialize<D: serde::Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error> {
775        let value = <String as serde::Deserialize>::deserialize(deserializer)?;
776        Ok(match value.as_str() {
777            "unsafe_serial" => Self::UnsafeSerial,
778            "device_absent" => Self::DeviceAbsent,
779            "probe_failed" => Self::ProbeFailed,
780            "signatures_no_filesystem" => Self::SignaturesNoFilesystem,
781            "unsupported_fstype" => Self::UnsupportedFstype,
782            "mkfs_failed" => Self::MkfsFailed,
783            "unsafe_mount_path" => Self::UnsafeMountPath,
784            "mkdir_failed" => Self::MkdirFailed,
785            "mount_failed" => Self::MountFailed,
786            "fstab_write_failed" => Self::FstabWriteFailed,
787            "unknown_error" => Self::UnknownError,
788            _ => Self::Unknown(value),
789        })
790    }
791}
792
793pub type AttachInstanceVolumeResponse = InstanceVolumeResponse;
794
795#[derive(Clone, Debug, serde::Serialize, serde::Deserialize)]
796pub struct ImageCreateRequestInput {
797    /// Immutable image name (e.g. debian-13) whose current-version pointer can move; the new image becomes its current version. Names are shared across a tag's builds — one build is identified by owner, name, architecture and version. Resource names must not start with the literal crn: prefix or be UUIDs (canonical, compact, braced, or urn:uuid: forms, in either case).
798    #[serde(rename = "name")]
799    pub name: String,
800    /// Presigned https GET URL to the disk in an object store you control. Fetched once by the import worker (which rejects private/link-local targets). The worker detects qcow2, raw, vmdk, vhd, vhdx or vdi and converts it to raw storage. Unreadable or unsupported sources and images declaring backing files fail asynchronously with status error and an active conversion fault. Not retained after import.
801    #[serde(rename = "source_url")]
802    pub source_url: String,
803
804    #[serde(
805        rename = "description",
806        default,
807        skip_serializing_if = "Option::is_none"
808    )]
809    pub description: Option<String>,
810    /// Operating system distribution. Use linux for another or generic Linux distribution; os_version specifies the release separately.
811    #[serde(rename = "os", default, skip_serializing_if = "Option::is_none")]
812    pub os: Option<ImageCreateRequestInputOs>,
813
814    #[serde(
815        rename = "os_version",
816        default,
817        skip_serializing_if = "Option::is_none"
818    )]
819    pub os_version: Option<String>,
820    /// CPU architecture of the source image. Only amd64 (x86-64) is supported.
821    #[serde(
822        rename = "architecture",
823        default,
824        skip_serializing_if = "Option::is_none"
825    )]
826    pub architecture: Option<ImageCreateRequestInputArchitecture>,
827    /// Identifies this build within `name`, and must be unique there — re-publishing a version that a tag already carries is a 409. Omit it and the server stamps a UTC timestamp, so every build is addressable as `name:version` whether or not you labelled it.
828    #[serde(rename = "version", default, skip_serializing_if = "Option::is_none")]
829    pub version: Option<String>,
830    /// Make this the current version for its (name, architecture) once active.
831    #[serde(rename = "current", default, skip_serializing_if = "Option::is_none")]
832    pub current: Option<bool>,
833    /// The day this release stops receiving free security updates. Omit it and the image inherits the date the name's current version carries, so re-publishing a tag can't quietly stop tracking its release.
834    #[serde(rename = "eol_date", default, skip_serializing_if = "Option::is_none")]
835    pub eol_date: Option<String>,
836
837    #[serde(
838        rename = "min_disk_gb",
839        default,
840        skip_serializing_if = "Option::is_none"
841    )]
842    pub min_disk_gb: Option<i64>,
843
844    #[serde(
845        rename = "min_ram_mb",
846        default,
847        skip_serializing_if = "Option::is_none"
848    )]
849    pub min_ram_mb: Option<i64>,
850
851    #[serde(rename = "tags", default, skip_serializing_if = "Option::is_none")]
852    pub tags: Option<TagsInput>,
853
854    #[serde(
855        rename = "attributes",
856        default,
857        skip_serializing_if = "Option::is_none"
858    )]
859    pub attributes: Option<std::collections::BTreeMap<String, String>>,
860}
861impl ImageCreateRequestInput {
862    /// Set the required fields; optional fields start omitted.
863    #[allow(clippy::too_many_arguments)]
864    pub fn new(name: String, source_url: String) -> Self {
865        Self {
866            name,
867            source_url,
868            description: None,
869            os: None,
870            os_version: None,
871            architecture: None,
872            version: None,
873            current: None,
874            eol_date: None,
875            min_disk_gb: None,
876            min_ram_mb: None,
877            tags: None,
878            attributes: None,
879        }
880    }
881}
882
883#[derive(Clone, Debug, PartialEq, Eq)]
884pub enum ImageCreateRequestInputOs {
885    Almalinux,
886    Alpine,
887    Arch,
888    Centos,
889    Debian,
890    Fedora,
891    Opensuse,
892    Rhel,
893    Rocky,
894    Ubuntu,
895    Linux,
896    Unknown(String),
897}
898impl ImageCreateRequestInputOs {
899    pub fn as_str(&self) -> &str {
900        match self {
901            Self::Almalinux => "almalinux",
902            Self::Alpine => "alpine",
903            Self::Arch => "arch",
904            Self::Centos => "centos",
905            Self::Debian => "debian",
906            Self::Fedora => "fedora",
907            Self::Opensuse => "opensuse",
908            Self::Rhel => "rhel",
909            Self::Rocky => "rocky",
910            Self::Ubuntu => "ubuntu",
911            Self::Linux => "linux",
912            Self::Unknown(value) => value,
913        }
914    }
915}
916impl serde::Serialize for ImageCreateRequestInputOs {
917    fn serialize<S: serde::Serializer>(&self, serializer: S) -> Result<S::Ok, S::Error> {
918        serializer.serialize_str(self.as_str())
919    }
920}
921impl<'de> serde::Deserialize<'de> for ImageCreateRequestInputOs {
922    fn deserialize<D: serde::Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error> {
923        let value = <String as serde::Deserialize>::deserialize(deserializer)?;
924        Ok(match value.as_str() {
925            "almalinux" => Self::Almalinux,
926            "alpine" => Self::Alpine,
927            "arch" => Self::Arch,
928            "centos" => Self::Centos,
929            "debian" => Self::Debian,
930            "fedora" => Self::Fedora,
931            "opensuse" => Self::Opensuse,
932            "rhel" => Self::Rhel,
933            "rocky" => Self::Rocky,
934            "ubuntu" => Self::Ubuntu,
935            "linux" => Self::Linux,
936            _ => Self::Unknown(value),
937        })
938    }
939}
940
941#[derive(Clone, Debug, PartialEq, Eq)]
942pub enum ImageCreateRequestInputArchitecture {
943    Amd64,
944    Unknown(String),
945}
946impl ImageCreateRequestInputArchitecture {
947    pub fn as_str(&self) -> &str {
948        match self {
949            Self::Amd64 => "amd64",
950            Self::Unknown(value) => value,
951        }
952    }
953}
954impl serde::Serialize for ImageCreateRequestInputArchitecture {
955    fn serialize<S: serde::Serializer>(&self, serializer: S) -> Result<S::Ok, S::Error> {
956        serializer.serialize_str(self.as_str())
957    }
958}
959impl<'de> serde::Deserialize<'de> for ImageCreateRequestInputArchitecture {
960    fn deserialize<D: serde::Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error> {
961        let value = <String as serde::Deserialize>::deserialize(deserializer)?;
962        Ok(match value.as_str() {
963            "amd64" => Self::Amd64,
964            _ => Self::Unknown(value),
965        })
966    }
967}
968
969pub type TagsInput = std::collections::BTreeMap<String, String>;
970
971pub type CreateImageBody = ImageCreateRequestInput;
972
973#[derive(Clone, Debug, serde::Serialize, serde::Deserialize)]
974pub struct ImageResponse {
975    #[serde(rename = "image")]
976    pub image: Image,
977}
978
979#[derive(Clone, Debug, serde::Serialize, serde::Deserialize)]
980pub struct Image {
981    #[serde(rename = "id")]
982    pub id: String,
983
984    #[serde(rename = "crn")]
985    pub crn: String,
986    /// Resource names must not start with the literal crn: prefix or be UUIDs (canonical, compact, braced, or urn:uuid: forms, in either case).
987    #[serde(rename = "name")]
988    pub name: String,
989
990    #[serde(
991        rename = "description",
992        default,
993        skip_serializing_if = "Option::is_none"
994    )]
995    pub description: Option<String>,
996
997    #[serde(rename = "os", default, skip_serializing_if = "Option::is_none")]
998    pub os: Option<String>,
999
1000    #[serde(
1001        rename = "os_version",
1002        default,
1003        skip_serializing_if = "Option::is_none"
1004    )]
1005    pub os_version: Option<String>,
1006
1007    #[serde(rename = "architecture")]
1008    pub architecture: String,
1009    /// The build's identity within its name. Unique there: a name is a movable tag, so it can't also be what tells two builds apart. Stamped as a UTC timestamp when the uploader didn't choose one.
1010    #[serde(rename = "version")]
1011    pub version: String,
1012    /// Whether this is the version resolve-by-name returns for its (name, architecture) — i.e. the name's current tag target.
1013    #[serde(
1014        rename = "is_current",
1015        default,
1016        skip_serializing_if = "Option::is_none"
1017    )]
1018    pub is_current: Option<bool>,
1019    /// The day this image's OS release stops receiving free security updates for a default install. Absent when nobody has recorded one — which means unknown, not "supported indefinitely". Platform images are withdrawn from the catalog a grace period after this date. They stay bootable by id until then, and the date is published well ahead of it so you can plan the move.
1020    #[serde(rename = "eol_date", default, skip_serializing_if = "Option::is_none")]
1021    pub eol_date: Option<String>,
1022
1023    #[serde(
1024        rename = "size_bytes",
1025        default,
1026        skip_serializing_if = "Option::is_none"
1027    )]
1028    pub size_bytes: Option<i64>,
1029
1030    #[serde(
1031        rename = "min_disk_gb",
1032        default,
1033        skip_serializing_if = "Option::is_none"
1034    )]
1035    pub min_disk_gb: Option<i64>,
1036
1037    #[serde(
1038        rename = "min_ram_mb",
1039        default,
1040        skip_serializing_if = "Option::is_none"
1041    )]
1042    pub min_ram_mb: Option<i64>,
1043    /// Error exactly while an active error fault exists; import and deletion progress remain independently retryable.
1044    #[serde(rename = "status")]
1045    pub status: ImageStatus,
1046    /// Why this image was withdrawn. Present for withdrawn images, including those with an independent error fault: end_of_life for platform release withdrawal (see eol_date), or legacy for a migrated withdrawal whose original reason is unknown. Withdrawn images retain their data but cannot be launched.
1047    #[serde(
1048        rename = "withdrawal_reason",
1049        default,
1050        skip_serializing_if = "Option::is_none"
1051    )]
1052    pub withdrawal_reason: Option<String>,
1053    /// Present in owner list/detail responses while image deletion is waiting for existing instance, source-reservation, or instance-pool references. Counts include all referencing accounts without disclosing their identities. The backing data remains intact; cleanup resumes when references are gone. Independent faults may still set status to error.
1054    #[serde(
1055        rename = "deletion_retention",
1056        default,
1057        skip_serializing_if = "Option::is_none"
1058    )]
1059    pub deletion_retention: Option<ImageDeletionRetention>,
1060    /// Active faults, newest first. Empty for a healthy image. Error faults set status to error without disabling an eligible import or cleanup retry.
1061    #[serde(rename = "faults")]
1062    pub faults: Vec<Fault>,
1063
1064    #[serde(rename = "tags", default, skip_serializing_if = "Option::is_none")]
1065    pub tags: Option<Tags>,
1066
1067    #[serde(
1068        rename = "attributes",
1069        default,
1070        skip_serializing_if = "Option::is_none"
1071    )]
1072    pub attributes: Option<std::collections::BTreeMap<String, String>>,
1073
1074    #[serde(rename = "created_at")]
1075    pub created_at: String,
1076
1077    #[serde(rename = "updated_at")]
1078    pub updated_at: String,
1079}
1080
1081#[derive(Clone, Debug, PartialEq, Eq)]
1082pub enum ImageStatus {
1083    Pending,
1084    Importing,
1085    Active,
1086    Error,
1087    Deleting,
1088    Withdrawn,
1089    Unknown(String),
1090}
1091impl ImageStatus {
1092    pub fn as_str(&self) -> &str {
1093        match self {
1094            Self::Pending => "pending",
1095            Self::Importing => "importing",
1096            Self::Active => "active",
1097            Self::Error => "error",
1098            Self::Deleting => "deleting",
1099            Self::Withdrawn => "withdrawn",
1100            Self::Unknown(value) => value,
1101        }
1102    }
1103}
1104impl serde::Serialize for ImageStatus {
1105    fn serialize<S: serde::Serializer>(&self, serializer: S) -> Result<S::Ok, S::Error> {
1106        serializer.serialize_str(self.as_str())
1107    }
1108}
1109impl<'de> serde::Deserialize<'de> for ImageStatus {
1110    fn deserialize<D: serde::Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error> {
1111        let value = <String as serde::Deserialize>::deserialize(deserializer)?;
1112        Ok(match value.as_str() {
1113            "pending" => Self::Pending,
1114            "importing" => Self::Importing,
1115            "active" => Self::Active,
1116            "error" => Self::Error,
1117            "deleting" => Self::Deleting,
1118            "withdrawn" => Self::Withdrawn,
1119            _ => Self::Unknown(value),
1120        })
1121    }
1122}
1123
1124#[derive(Clone, Debug, serde::Serialize, serde::Deserialize)]
1125pub struct ImageDeletionRetention {
1126    #[serde(rename = "reason")]
1127    pub reason: ImageDeletionRetentionReason,
1128
1129    #[serde(rename = "instances")]
1130    pub instances: i64,
1131
1132    #[serde(rename = "instance_pools")]
1133    pub instance_pools: i64,
1134}
1135
1136#[derive(Clone, Debug, PartialEq, Eq)]
1137pub enum ImageDeletionRetentionReason {
1138    InUse,
1139    Unknown(String),
1140}
1141impl ImageDeletionRetentionReason {
1142    pub fn as_str(&self) -> &str {
1143        match self {
1144            Self::InUse => "in_use",
1145            Self::Unknown(value) => value,
1146        }
1147    }
1148}
1149impl serde::Serialize for ImageDeletionRetentionReason {
1150    fn serialize<S: serde::Serializer>(&self, serializer: S) -> Result<S::Ok, S::Error> {
1151        serializer.serialize_str(self.as_str())
1152    }
1153}
1154impl<'de> serde::Deserialize<'de> for ImageDeletionRetentionReason {
1155    fn deserialize<D: serde::Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error> {
1156        let value = <String as serde::Deserialize>::deserialize(deserializer)?;
1157        Ok(match value.as_str() {
1158            "in_use" => Self::InUse,
1159            _ => Self::Unknown(value),
1160        })
1161    }
1162}
1163
1164pub type CreateImageResponse = ImageResponse;
1165
1166#[derive(Clone, Debug, serde::Serialize, serde::Deserialize)]
1167pub struct InstanceCreateRequestInput {
1168    /// Resource names must not start with the literal crn: prefix or be UUIDs (canonical, compact, braced, or urn:uuid: forms, in either case).
1169    #[serde(rename = "name")]
1170    pub name: String,
1171
1172    #[serde(
1173        rename = "description",
1174        default,
1175        skip_serializing_if = "Option::is_none"
1176    )]
1177    pub description: Option<String>,
1178    /// Regional flavor reference (UUID, CRN or exact name)
1179    #[serde(rename = "flavor")]
1180    pub flavor: String,
1181    /// Architecture for image names and name:version tags (default amd64); a CRN pins its own architecture and version.
1182    #[serde(
1183        rename = "architecture",
1184        default,
1185        skip_serializing_if = "Option::is_none"
1186    )]
1187    pub architecture: Option<String>,
1188    /// Image to clone the boot disk from. Required unless volumes contains an existing boot volume; cannot be combined with an existing boot volume. Four forms are accepted: a complete image/name/architecture/arch/version/version CRN; an image id; `name:version`, which pins one build and is how you opt out of the tag moving under you; or a bare `name`, which follows the tag to whichever build is current when the instance is created. Names prefer a usable caller-owned build over a tagged platform catalog build for the requested architecture (default amd64). A CRN pins owner, name, architecture and version. Resolution never retries another reference kind; responses and stored templates retain the resolved image UUID.
1189    #[serde(rename = "image", default, skip_serializing_if = "Option::is_none")]
1190    pub image: Option<String>,
1191    /// Interfaces to attach, at least one. index 0 is the primary NIC. Required because an instance with no interface boots with no network at all, and nothing inside it can add one afterwards.
1192    #[serde(rename = "networks")]
1193    pub networks: Vec<NetworkConfigInput>,
1194    /// New or existing disks bound with the instance, the boot disk included — mark it with `boot: true`. At most one entry may. Omit the boot entry to take the image's minimum size and the region's default tier.
1195    #[serde(rename = "volumes", default, skip_serializing_if = "Option::is_none")]
1196    pub volumes: Option<Vec<InstanceLaunchVolumeInput>>,
1197
1198    #[serde(rename = "metadata", default, skip_serializing_if = "Option::is_none")]
1199    pub metadata: Option<MetadataInput>,
1200
1201    #[serde(rename = "tags", default, skip_serializing_if = "Option::is_none")]
1202    pub tags: Option<TagsInput>,
1203    /// Base64-encoded user data (cloud-init)
1204    #[serde(rename = "user_data", default, skip_serializing_if = "Option::is_none")]
1205    pub user_data: Option<String>,
1206    /// Attach an IAM role from the same account by UUID, CRN or exact name. The role's trust policy must permit `crn:compute:*:*:instance/*` (or the specific instance CRN). The instance's IMDS endpoint (169.254.169.254) mints short-lived STS credentials for this role from inside the VM.
1207    #[serde(rename = "iam_role", default, skip_serializing_if = "Option::is_none")]
1208    pub iam_role: Option<String>,
1209}
1210impl InstanceCreateRequestInput {
1211    /// Set the required fields; optional fields start omitted.
1212    #[allow(clippy::too_many_arguments)]
1213    pub fn new(name: String, flavor: String, networks: Vec<NetworkConfigInput>) -> Self {
1214        Self {
1215            name,
1216            description: None,
1217            flavor,
1218            architecture: None,
1219            image: None,
1220            networks,
1221            volumes: None,
1222            metadata: None,
1223            tags: None,
1224            user_data: None,
1225            iam_role: None,
1226        }
1227    }
1228}
1229
1230#[derive(Clone, Debug, serde::Serialize, serde::Deserialize)]
1231pub struct NetworkConfigInput {
1232    /// Subnet UUID or complete VPC/subnet CRN. Bare names require a VPC parent and are rejected here.
1233    #[serde(rename = "subnet")]
1234    pub subnet: String,
1235    /// Optional MAC address. Must be locally-administered (`X2:`, `X6:`, `XA:`, `XE:` in the first octet). Generated when omitted.
1236    #[serde(rename = "mac", default, skip_serializing_if = "Option::is_none")]
1237    pub mac: Option<String>,
1238    /// Account-scoped security group references (UUID, CRN or name) to attach to this NIC. Each must be owned by the same account. Empty list = no per-NIC ACLs (the platform's default-allow stays in force).
1239    #[serde(
1240        rename = "security_groups",
1241        default,
1242        skip_serializing_if = "Option::is_none"
1243    )]
1244    pub security_groups: Option<Vec<String>>,
1245    /// Allocate public floating IPs for this NIC at launch. Explicit families require matching guest addresses and internet routes. Detach leaves the FIP reserved. No ordinary public IPv4 mapping exists.
1246    #[serde(
1247        rename = "floating_ip_assignment",
1248        default,
1249        skip_serializing_if = "Option::is_none"
1250    )]
1251    pub floating_ip_assignment: Option<NetworkConfigInputFloatingIpAssignment>,
1252
1253    #[serde(rename = "addresses", default, skip_serializing_if = "Option::is_none")]
1254    pub addresses: Option<Vec<AddressRequestInput>>,
1255}
1256impl NetworkConfigInput {
1257    /// Set the required fields; optional fields start omitted.
1258    #[allow(clippy::too_many_arguments)]
1259    pub fn new(subnet: String) -> Self {
1260        Self {
1261            subnet,
1262            mac: None,
1263            security_groups: None,
1264            floating_ip_assignment: None,
1265            addresses: None,
1266        }
1267    }
1268}
1269
1270#[derive(Clone, Debug, PartialEq, Eq)]
1271pub enum NetworkConfigInputFloatingIpAssignment {
1272    None,
1273    Ipv4,
1274    Ipv6,
1275    DualStack,
1276    Auto,
1277    Unknown(String),
1278}
1279impl NetworkConfigInputFloatingIpAssignment {
1280    pub fn as_str(&self) -> &str {
1281        match self {
1282            Self::None => "none",
1283            Self::Ipv4 => "ipv4",
1284            Self::Ipv6 => "ipv6",
1285            Self::DualStack => "dual_stack",
1286            Self::Auto => "auto",
1287            Self::Unknown(value) => value,
1288        }
1289    }
1290}
1291impl serde::Serialize for NetworkConfigInputFloatingIpAssignment {
1292    fn serialize<S: serde::Serializer>(&self, serializer: S) -> Result<S::Ok, S::Error> {
1293        serializer.serialize_str(self.as_str())
1294    }
1295}
1296impl<'de> serde::Deserialize<'de> for NetworkConfigInputFloatingIpAssignment {
1297    fn deserialize<D: serde::Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error> {
1298        let value = <String as serde::Deserialize>::deserialize(deserializer)?;
1299        Ok(match value.as_str() {
1300            "none" => Self::None,
1301            "ipv4" => Self::Ipv4,
1302            "ipv6" => Self::Ipv6,
1303            "dual_stack" => Self::DualStack,
1304            "auto" => Self::Auto,
1305            _ => Self::Unknown(value),
1306        })
1307    }
1308}
1309
1310#[derive(Clone, Debug, serde::Serialize, serde::Deserialize)]
1311pub struct AddressRequestInput {
1312    #[serde(rename = "family")]
1313    pub family: AddressRequestInputFamily,
1314    /// Optional fixed address when creating an interface or instance NIC. For IPv6, use the first address of an aligned /96 inside the subnet /64 (last 32 bits zero); the first and last /96 ranges are reserved. Omit for automatic allocation. Managed database nodes and the add-address operation require automatic allocation.
1315    #[serde(rename = "address", default, skip_serializing_if = "Option::is_none")]
1316    pub address: Option<String>,
1317}
1318impl AddressRequestInput {
1319    /// Set the required fields; optional fields start omitted.
1320    #[allow(clippy::too_many_arguments)]
1321    pub fn new(family: AddressRequestInputFamily) -> Self {
1322        Self {
1323            family,
1324            address: None,
1325        }
1326    }
1327}
1328
1329#[derive(Clone, Debug, PartialEq, Eq)]
1330pub enum AddressRequestInputFamily {
1331    Ipv4,
1332    Ipv6,
1333    Unknown(String),
1334}
1335impl AddressRequestInputFamily {
1336    pub fn as_str(&self) -> &str {
1337        match self {
1338            Self::Ipv4 => "ipv4",
1339            Self::Ipv6 => "ipv6",
1340            Self::Unknown(value) => value,
1341        }
1342    }
1343}
1344impl serde::Serialize for AddressRequestInputFamily {
1345    fn serialize<S: serde::Serializer>(&self, serializer: S) -> Result<S::Ok, S::Error> {
1346        serializer.serialize_str(self.as_str())
1347    }
1348}
1349impl<'de> serde::Deserialize<'de> for AddressRequestInputFamily {
1350    fn deserialize<D: serde::Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error> {
1351        let value = <String as serde::Deserialize>::deserialize(deserializer)?;
1352        Ok(match value.as_str() {
1353            "ipv4" => Self::Ipv4,
1354            "ipv6" => Self::Ipv6,
1355            _ => Self::Unknown(value),
1356        })
1357    }
1358}
1359
1360#[derive(Clone, Debug, serde::Serialize, serde::Deserialize)]
1361#[serde(untagged)]
1362pub enum InstanceLaunchVolumeInput {
1363    Variant1(Box<InstanceLaunchVolumeInputVariant1>),
1364    Variant2(Box<InstanceLaunchVolumeInputVariant2>),
1365}
1366
1367#[derive(Clone, Debug, serde::Serialize, serde::Deserialize)]
1368pub struct InstanceLaunchVolumeInputVariant1 {
1369    /// Select the one boot disk. Boot disks cannot specify mount_path or fstype.
1370    #[serde(rename = "boot", default, skip_serializing_if = "Option::is_none")]
1371    pub boot: Option<bool>,
1372    /// Existing available volume UUID, name, or CRN. Mutually exclusive with new-disk settings.
1373    #[serde(rename = "volume")]
1374    pub volume: String,
1375    /// New disk capacity. Required for new data disks; boot disks default to the image minimum.
1376    #[serde(rename = "size_gb", default, skip_serializing_if = "Option::is_none")]
1377    pub size_gb: Option<i64>,
1378    /// New disk tier; omitted uses the region default.
1379    #[serde(
1380        rename = "volume_type",
1381        default,
1382        skip_serializing_if = "Option::is_none"
1383    )]
1384    pub volume_type: Option<InstanceLaunchVolumeInputVariant1VolumeType>,
1385
1386    #[serde(
1387        rename = "performance",
1388        default,
1389        skip_serializing_if = "Option::is_none"
1390    )]
1391    pub performance: Option<VolumePerformanceRequestInput>,
1392    /// Optional data disk mount path. The guest agent formats only blank disks.
1393    #[serde(
1394        rename = "mount_path",
1395        default,
1396        skip_serializing_if = "Option::is_none"
1397    )]
1398    pub mount_path: Option<String>,
1399    /// Optional filesystem for blank data disks; defaults to ext4.
1400    #[serde(rename = "fstype", default, skip_serializing_if = "Option::is_none")]
1401    pub fstype: Option<String>,
1402
1403    #[serde(
1404        rename = "delete_on_termination",
1405        default,
1406        skip_serializing_if = "Option::is_none"
1407    )]
1408    pub delete_on_termination: Option<serde_json::Value>,
1409    /// Independent schedules for a new disk. Names must be unique across the account and this launch. Requires storage:CreateSnapshotPolicy. Existing disks keep their schedules and cannot specify this field.
1410    #[serde(
1411        rename = "snapshot_schedules",
1412        default,
1413        skip_serializing_if = "Option::is_none"
1414    )]
1415    pub snapshot_schedules: Option<Vec<SnapshotScheduleSettingsInput>>,
1416}
1417impl InstanceLaunchVolumeInputVariant1 {
1418    /// Set the required fields; optional fields start omitted.
1419    #[allow(clippy::too_many_arguments)]
1420    pub fn new(volume: String) -> Self {
1421        Self {
1422            boot: None,
1423            volume,
1424            size_gb: None,
1425            volume_type: None,
1426            performance: None,
1427            mount_path: None,
1428            fstype: None,
1429            delete_on_termination: None,
1430            snapshot_schedules: None,
1431        }
1432    }
1433}
1434
1435#[derive(Clone, Debug, PartialEq, Eq)]
1436pub enum InstanceLaunchVolumeInputVariant1VolumeType {
1437    Ssd,
1438    Nvme,
1439    Unknown(String),
1440}
1441impl InstanceLaunchVolumeInputVariant1VolumeType {
1442    pub fn as_str(&self) -> &str {
1443        match self {
1444            Self::Ssd => "ssd",
1445            Self::Nvme => "nvme",
1446            Self::Unknown(value) => value,
1447        }
1448    }
1449}
1450impl serde::Serialize for InstanceLaunchVolumeInputVariant1VolumeType {
1451    fn serialize<S: serde::Serializer>(&self, serializer: S) -> Result<S::Ok, S::Error> {
1452        serializer.serialize_str(self.as_str())
1453    }
1454}
1455impl<'de> serde::Deserialize<'de> for InstanceLaunchVolumeInputVariant1VolumeType {
1456    fn deserialize<D: serde::Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error> {
1457        let value = <String as serde::Deserialize>::deserialize(deserializer)?;
1458        Ok(match value.as_str() {
1459            "ssd" => Self::Ssd,
1460            "nvme" => Self::Nvme,
1461            _ => Self::Unknown(value),
1462        })
1463    }
1464}
1465
1466#[derive(Clone, Debug, serde::Serialize, serde::Deserialize, Default)]
1467pub struct VolumePerformanceRequestInput {
1468    #[serde(rename = "iops", default, skip_serializing_if = "Option::is_none")]
1469    pub iops: Option<i64>,
1470
1471    #[serde(
1472        rename = "throughput_mib_s",
1473        default,
1474        skip_serializing_if = "Option::is_none"
1475    )]
1476    pub throughput_mib_s: Option<f64>,
1477}
1478
1479#[derive(Clone, Debug, serde::Serialize, serde::Deserialize)]
1480pub struct SnapshotScheduleSettingsInput {
1481    /// Account-unique snapshot policy name, subject to resource-name validation.
1482    #[serde(rename = "name")]
1483    pub name: String,
1484
1485    #[serde(
1486        rename = "description",
1487        default,
1488        skip_serializing_if = "Option::is_none"
1489    )]
1490    pub description: Option<String>,
1491
1492    #[serde(rename = "interval_minutes")]
1493    pub interval_minutes: SnapshotIntervalMinutesInput,
1494
1495    #[serde(rename = "retention_count")]
1496    pub retention_count: SnapshotRetentionCountInput,
1497
1498    #[serde(
1499        rename = "retention_days",
1500        default,
1501        skip_serializing_if = "Option::is_none"
1502    )]
1503    pub retention_days: Option<SnapshotRetentionDaysInput>,
1504
1505    #[serde(rename = "enabled", default, skip_serializing_if = "Option::is_none")]
1506    pub enabled: Option<bool>,
1507
1508    #[serde(rename = "tags", default, skip_serializing_if = "Option::is_none")]
1509    pub tags: Option<TagsInput>,
1510}
1511impl SnapshotScheduleSettingsInput {
1512    /// Set the required fields; optional fields start omitted.
1513    #[allow(clippy::too_many_arguments)]
1514    pub fn new(
1515        name: String,
1516        interval_minutes: SnapshotIntervalMinutesInput,
1517        retention_count: SnapshotRetentionCountInput,
1518    ) -> Self {
1519        Self {
1520            name,
1521            description: None,
1522            interval_minutes,
1523            retention_count,
1524            retention_days: None,
1525            enabled: None,
1526            tags: None,
1527        }
1528    }
1529}
1530
1531pub type SnapshotIntervalMinutesInput = i64;
1532
1533pub type SnapshotRetentionCountInput = i64;
1534
1535pub type SnapshotRetentionDaysInput = i64;
1536
1537#[derive(Clone, Debug, serde::Serialize, serde::Deserialize, Default)]
1538pub struct InstanceLaunchVolumeInputVariant2 {
1539    /// Select the one boot disk. Boot disks cannot specify mount_path or fstype.
1540    #[serde(rename = "boot", default, skip_serializing_if = "Option::is_none")]
1541    pub boot: Option<bool>,
1542    /// Existing available volume UUID, name, or CRN. Mutually exclusive with new-disk settings.
1543    #[serde(rename = "volume", default, skip_serializing_if = "Option::is_none")]
1544    pub volume: Option<String>,
1545    /// New disk capacity. Required for new data disks; boot disks default to the image minimum.
1546    #[serde(rename = "size_gb", default, skip_serializing_if = "Option::is_none")]
1547    pub size_gb: Option<i64>,
1548    /// New disk tier; omitted uses the region default.
1549    #[serde(
1550        rename = "volume_type",
1551        default,
1552        skip_serializing_if = "Option::is_none"
1553    )]
1554    pub volume_type: Option<InstanceLaunchVolumeInputVariant2VolumeType>,
1555
1556    #[serde(
1557        rename = "performance",
1558        default,
1559        skip_serializing_if = "Option::is_none"
1560    )]
1561    pub performance: Option<VolumePerformanceRequestInput>,
1562    /// Optional data disk mount path. The guest agent formats only blank disks.
1563    #[serde(
1564        rename = "mount_path",
1565        default,
1566        skip_serializing_if = "Option::is_none"
1567    )]
1568    pub mount_path: Option<String>,
1569    /// Optional filesystem for blank data disks; defaults to ext4.
1570    #[serde(rename = "fstype", default, skip_serializing_if = "Option::is_none")]
1571    pub fstype: Option<String>,
1572    /// Defaults true for new disks. Existing disks require false or omission and are retained.
1573    #[serde(
1574        rename = "delete_on_termination",
1575        default,
1576        skip_serializing_if = "Option::is_none"
1577    )]
1578    pub delete_on_termination: Option<bool>,
1579    /// Independent schedules for a new disk. Names must be unique across the account and this launch. Requires storage:CreateSnapshotPolicy. Existing disks keep their schedules and cannot specify this field.
1580    #[serde(
1581        rename = "snapshot_schedules",
1582        default,
1583        skip_serializing_if = "Option::is_none"
1584    )]
1585    pub snapshot_schedules: Option<Vec<SnapshotScheduleSettingsInput>>,
1586}
1587
1588#[derive(Clone, Debug, PartialEq, Eq)]
1589pub enum InstanceLaunchVolumeInputVariant2VolumeType {
1590    Ssd,
1591    Nvme,
1592    Unknown(String),
1593}
1594impl InstanceLaunchVolumeInputVariant2VolumeType {
1595    pub fn as_str(&self) -> &str {
1596        match self {
1597            Self::Ssd => "ssd",
1598            Self::Nvme => "nvme",
1599            Self::Unknown(value) => value,
1600        }
1601    }
1602}
1603impl serde::Serialize for InstanceLaunchVolumeInputVariant2VolumeType {
1604    fn serialize<S: serde::Serializer>(&self, serializer: S) -> Result<S::Ok, S::Error> {
1605        serializer.serialize_str(self.as_str())
1606    }
1607}
1608impl<'de> serde::Deserialize<'de> for InstanceLaunchVolumeInputVariant2VolumeType {
1609    fn deserialize<D: serde::Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error> {
1610        let value = <String as serde::Deserialize>::deserialize(deserializer)?;
1611        Ok(match value.as_str() {
1612            "ssd" => Self::Ssd,
1613            "nvme" => Self::Nvme,
1614            _ => Self::Unknown(value),
1615        })
1616    }
1617}
1618
1619pub type MetadataInput = std::collections::BTreeMap<String, String>;
1620
1621pub type CreateInstanceBody = InstanceCreateRequestInput;
1622
1623#[derive(Clone, Debug, serde::Serialize, serde::Deserialize)]
1624pub struct CreateInstanceResult {
1625    #[serde(rename = "instance")]
1626    pub instance: Instance,
1627}
1628
1629#[derive(Clone, Debug, serde::Serialize, serde::Deserialize)]
1630pub struct Instance {
1631    #[serde(rename = "id")]
1632    pub id: String,
1633    /// Cloud Resource Name
1634    #[serde(rename = "crn")]
1635    pub crn: String,
1636    /// Resource names must not start with the literal crn: prefix or be UUIDs (canonical, compact, braced, or urn:uuid: forms, in either case).
1637    #[serde(rename = "name")]
1638    pub name: String,
1639
1640    #[serde(
1641        rename = "description",
1642        default,
1643        skip_serializing_if = "Option::is_none"
1644    )]
1645    pub description: Option<String>,
1646    /// In-flight transition, if any; null when settled.
1647    #[serde(
1648        rename = "task_state",
1649        default,
1650        skip_serializing_if = "Option::is_none",
1651        deserialize_with = "crate::response::present_nullable"
1652    )]
1653    pub task_state: Option<crate::Nullable<String>>,
1654    /// Flavor identity. Every instance has a flavor; query the flavor resource for CPU and RAM.
1655    #[serde(rename = "flavor")]
1656    pub flavor: ResourceRef,
1657    /// Pinned source image identity, or null for a volume-only boot.
1658    #[serde(rename = "image")]
1659    pub image: InstanceImage,
1660    /// Base64-encoded cloud-init user-data supplied at launch.
1661    #[serde(rename = "user_data", default, skip_serializing_if = "Option::is_none")]
1662    pub user_data: Option<String>,
1663    /// Attached IAM role identity, or null when no role is attached. Deleted roles retain their identity without name.
1664    #[serde(rename = "iam_role")]
1665    pub iam_role: InstanceIamRole,
1666
1667    #[serde(rename = "metadata", default, skip_serializing_if = "Option::is_none")]
1668    pub metadata: Option<Metadata>,
1669
1670    #[serde(rename = "tags", default, skip_serializing_if = "Option::is_none")]
1671    pub tags: Option<Tags>,
1672    /// Active faults ordered by last_at descending, then internal history id descending for a stable tie-breaker. Healthy resources return \[\].
1673    #[serde(rename = "faults")]
1674    pub faults: Vec<Fault>,
1675
1676    #[serde(rename = "created_at")]
1677    pub created_at: String,
1678
1679    #[serde(rename = "updated_at")]
1680    pub updated_at: String,
1681
1682    #[serde(
1683        rename = "launched_at",
1684        default,
1685        skip_serializing_if = "Option::is_none",
1686        deserialize_with = "crate::response::present_nullable"
1687    )]
1688    pub launched_at: Option<crate::Nullable<String>>,
1689
1690    #[serde(
1691        rename = "terminated_at",
1692        default,
1693        skip_serializing_if = "Option::is_none",
1694        deserialize_with = "crate::response::present_nullable"
1695    )]
1696    pub terminated_at: Option<crate::Nullable<String>>,
1697    /// What was asked for. Only three values, because there are only three things you can ask an instance to be: Create/Start/Reboot ask for running, Stop for stopped, Delete for deleted.
1698    #[serde(rename = "desired_state")]
1699    pub desired_state: InstanceDesiredState,
1700    /// Where the instance actually is. Read this one to answer "is it up" — the transitional states live here, not on desired_state, because nobody asks for `stopping`. desired_state=running with current_state=stopped is an instance that was asked to start and has not come up yet.
1701    #[serde(rename = "current_state")]
1702    pub current_state: CurrentState,
1703}
1704
1705#[derive(Clone, Debug, serde::Serialize, serde::Deserialize)]
1706#[serde(untagged)]
1707pub enum InstanceImage {
1708    Variant1(Box<ResourceRef>),
1709    Variant2(Box<crate::Nullable<serde_json::Value>>),
1710}
1711
1712#[derive(Clone, Debug, serde::Serialize, serde::Deserialize)]
1713#[serde(untagged)]
1714pub enum InstanceIamRole {
1715    Variant1(Box<ResourceRef>),
1716    Variant2(Box<crate::Nullable<serde_json::Value>>),
1717}
1718
1719pub type Metadata = std::collections::BTreeMap<String, String>;
1720
1721#[derive(Clone, Debug, PartialEq, Eq)]
1722pub enum InstanceDesiredState {
1723    Running,
1724    Stopped,
1725    Deleted,
1726    Unknown(String),
1727}
1728impl InstanceDesiredState {
1729    pub fn as_str(&self) -> &str {
1730        match self {
1731            Self::Running => "running",
1732            Self::Stopped => "stopped",
1733            Self::Deleted => "deleted",
1734            Self::Unknown(value) => value,
1735        }
1736    }
1737}
1738impl serde::Serialize for InstanceDesiredState {
1739    fn serialize<S: serde::Serializer>(&self, serializer: S) -> Result<S::Ok, S::Error> {
1740        serializer.serialize_str(self.as_str())
1741    }
1742}
1743impl<'de> serde::Deserialize<'de> for InstanceDesiredState {
1744    fn deserialize<D: serde::Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error> {
1745        let value = <String as serde::Deserialize>::deserialize(deserializer)?;
1746        Ok(match value.as_str() {
1747            "running" => Self::Running,
1748            "stopped" => Self::Stopped,
1749            "deleted" => Self::Deleted,
1750            _ => Self::Unknown(value),
1751        })
1752    }
1753}
1754
1755#[derive(Clone, Debug, PartialEq, Eq)]
1756pub enum CurrentState {
1757    Pending,
1758    Building,
1759    Running,
1760    Stopping,
1761    Stopped,
1762    Rebooting,
1763    Migrating,
1764    Deleting,
1765    Deleted,
1766    Error,
1767    Crashed,
1768    Paused,
1769    Suspended,
1770    Unknown(String),
1771}
1772impl CurrentState {
1773    pub fn as_str(&self) -> &str {
1774        match self {
1775            Self::Pending => "pending",
1776            Self::Building => "building",
1777            Self::Running => "running",
1778            Self::Stopping => "stopping",
1779            Self::Stopped => "stopped",
1780            Self::Rebooting => "rebooting",
1781            Self::Migrating => "migrating",
1782            Self::Deleting => "deleting",
1783            Self::Deleted => "deleted",
1784            Self::Error => "error",
1785            Self::Crashed => "crashed",
1786            Self::Paused => "paused",
1787            Self::Suspended => "suspended",
1788            Self::Unknown(value) => value,
1789        }
1790    }
1791}
1792impl serde::Serialize for CurrentState {
1793    fn serialize<S: serde::Serializer>(&self, serializer: S) -> Result<S::Ok, S::Error> {
1794        serializer.serialize_str(self.as_str())
1795    }
1796}
1797impl<'de> serde::Deserialize<'de> for CurrentState {
1798    fn deserialize<D: serde::Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error> {
1799        let value = <String as serde::Deserialize>::deserialize(deserializer)?;
1800        Ok(match value.as_str() {
1801            "pending" => Self::Pending,
1802            "building" => Self::Building,
1803            "running" => Self::Running,
1804            "stopping" => Self::Stopping,
1805            "stopped" => Self::Stopped,
1806            "rebooting" => Self::Rebooting,
1807            "migrating" => Self::Migrating,
1808            "deleting" => Self::Deleting,
1809            "deleted" => Self::Deleted,
1810            "error" => Self::Error,
1811            "crashed" => Self::Crashed,
1812            "paused" => Self::Paused,
1813            "suspended" => Self::Suspended,
1814            _ => Self::Unknown(value),
1815        })
1816    }
1817}
1818
1819pub type CreateInstanceResponse = CreateInstanceResult;
1820
1821#[derive(Clone, Debug, serde::Serialize, serde::Deserialize)]
1822pub struct InstancePoolCreateRequestInput {
1823    /// Subnet UUIDs or CRNs in the same VPC.
1824    #[serde(rename = "subnets")]
1825    pub subnets: Vec<String>,
1826
1827    #[serde(
1828        rename = "autoscaling",
1829        default,
1830        skip_serializing_if = "Option::is_none"
1831    )]
1832    pub autoscaling: Option<AutoscalingPolicyInput>,
1833    /// Resource names must not start with the literal crn: prefix or be UUIDs (canonical, compact, braced, or urn:uuid: forms, in either case).
1834    #[serde(rename = "name")]
1835    pub name: String,
1836
1837    #[serde(
1838        rename = "description",
1839        default,
1840        skip_serializing_if = "Option::is_none"
1841    )]
1842    pub description: Option<String>,
1843    /// Labels on the pool resource, for IAM conditions (`basalt:RequestTag/<key>` here, `basalt:ResourceTag/<key>` on later operations) and cost attribution. They are not propagated to the instances the pool launches; `template.tags` is that set. A pool field, sent beside `template`. Replica tags are only reachable through `template.tags`.
1844    #[serde(rename = "tags", default, skip_serializing_if = "Option::is_none")]
1845    pub tags: Option<TagsInput>,
1846
1847    #[serde(rename = "template")]
1848    pub template: InstancePoolTemplateRequestInput,
1849
1850    #[serde(
1851        rename = "desired_count",
1852        default,
1853        skip_serializing_if = "Option::is_none"
1854    )]
1855    pub desired_count: Option<i64>,
1856
1857    #[serde(rename = "min_count", default, skip_serializing_if = "Option::is_none")]
1858    pub min_count: Option<i64>,
1859    /// A value of 0 means the pool holds no members until max_count is raised.
1860    #[serde(rename = "max_count", default, skip_serializing_if = "Option::is_none")]
1861    pub max_count: Option<i64>,
1862}
1863impl InstancePoolCreateRequestInput {
1864    /// Set the required fields; optional fields start omitted.
1865    #[allow(clippy::too_many_arguments)]
1866    pub fn new(
1867        subnets: Vec<String>,
1868        name: String,
1869        template: InstancePoolTemplateRequestInput,
1870    ) -> Self {
1871        Self {
1872            subnets,
1873            autoscaling: None,
1874            name,
1875            description: None,
1876            tags: None,
1877            template,
1878            desired_count: None,
1879            min_count: None,
1880            max_count: None,
1881        }
1882    }
1883}
1884
1885#[derive(Clone, Debug, serde::Serialize, serde::Deserialize)]
1886pub struct AutoscalingPolicyInput {
1887    #[serde(rename = "enabled")]
1888    pub enabled: bool,
1889
1890    #[serde(rename = "metrics")]
1891    pub metrics: Vec<ScalingMetricInput>,
1892
1893    #[serde(
1894        rename = "warmup_seconds",
1895        default,
1896        skip_serializing_if = "Option::is_none"
1897    )]
1898    pub warmup_seconds: Option<i64>,
1899
1900    #[serde(
1901        rename = "cooldown_seconds",
1902        default,
1903        skip_serializing_if = "Option::is_none"
1904    )]
1905    pub cooldown_seconds: Option<i64>,
1906
1907    #[serde(
1908        rename = "scale_down_stabilization_seconds",
1909        default,
1910        skip_serializing_if = "Option::is_none"
1911    )]
1912    pub scale_down_stabilization_seconds: Option<i64>,
1913
1914    #[serde(
1915        rename = "max_scale_out_step",
1916        default,
1917        skip_serializing_if = "Option::is_none"
1918    )]
1919    pub max_scale_out_step: Option<i64>,
1920
1921    #[serde(
1922        rename = "max_scale_in_step",
1923        default,
1924        skip_serializing_if = "Option::is_none"
1925    )]
1926    pub max_scale_in_step: Option<i64>,
1927    /// Grace period after route withdrawal and proxy acknowledgements, before deleting a retiring member. Long-lived TCP/UDP sessions may end at the deadline; arbitrary application shutdown hooks are not supported.
1928    #[serde(
1929        rename = "drain_seconds",
1930        default,
1931        skip_serializing_if = "Option::is_none"
1932    )]
1933    pub drain_seconds: Option<i64>,
1934}
1935impl AutoscalingPolicyInput {
1936    /// Set the required fields; optional fields start omitted.
1937    #[allow(clippy::too_many_arguments)]
1938    pub fn new(enabled: bool, metrics: Vec<ScalingMetricInput>) -> Self {
1939        Self {
1940            enabled,
1941            metrics,
1942            warmup_seconds: None,
1943            cooldown_seconds: None,
1944            scale_down_stabilization_seconds: None,
1945            max_scale_out_step: None,
1946            max_scale_in_step: None,
1947            drain_seconds: None,
1948        }
1949    }
1950}
1951
1952#[derive(Clone, Debug, serde::Serialize, serde::Deserialize)]
1953pub struct ScalingMetricInput {
1954    #[serde(rename = "source")]
1955    pub source: ScalingMetricInputSource,
1956
1957    #[serde(rename = "target_type")]
1958    pub target_type: ScalingMetricInputTargetType,
1959
1960    #[serde(rename = "target_value")]
1961    pub target_value: f64,
1962
1963    #[serde(rename = "name", default, skip_serializing_if = "Option::is_none")]
1964    pub name: Option<String>,
1965    /// Exact-match labels; tenancy labels and __name__ cannot be supplied.
1966    #[serde(rename = "labels", default, skip_serializing_if = "Option::is_none")]
1967    pub labels: Option<std::collections::BTreeMap<String, String>>,
1968    /// Use last for queue gauges; rate for monotonically increasing counters, with reset handling.
1969    #[serde(
1970        rename = "sample_aggregation",
1971        default,
1972        skip_serializing_if = "Option::is_none"
1973    )]
1974    pub sample_aggregation: Option<ScalingMetricInputSampleAggregation>,
1975
1976    #[serde(
1977        rename = "series_aggregation",
1978        default,
1979        skip_serializing_if = "Option::is_none"
1980    )]
1981    pub series_aggregation: Option<ScalingMetricInputSeriesAggregation>,
1982    /// Exact expected cardinality; incomplete or ambiguous selectors are unavailable.
1983    #[serde(
1984        rename = "expected_series",
1985        default,
1986        skip_serializing_if = "Option::is_none"
1987    )]
1988    pub expected_series: Option<i64>,
1989
1990    #[serde(
1991        rename = "window_seconds",
1992        default,
1993        skip_serializing_if = "Option::is_none"
1994    )]
1995    pub window_seconds: Option<i64>,
1996    /// Actual newest observation age per series; must not exceed window_seconds. Defaults to the smaller of 90 and the window.
1997    #[serde(
1998        rename = "max_age_seconds",
1999        default,
2000        skip_serializing_if = "Option::is_none"
2001    )]
2002    pub max_age_seconds: Option<i64>,
2003}
2004impl ScalingMetricInput {
2005    /// Set the required fields; optional fields start omitted.
2006    #[allow(clippy::too_many_arguments)]
2007    pub fn new(
2008        source: ScalingMetricInputSource,
2009        target_type: ScalingMetricInputTargetType,
2010        target_value: f64,
2011    ) -> Self {
2012        Self {
2013            source,
2014            target_type,
2015            target_value,
2016            name: None,
2017            labels: None,
2018            sample_aggregation: None,
2019            series_aggregation: None,
2020            expected_series: None,
2021            window_seconds: None,
2022            max_age_seconds: None,
2023        }
2024    }
2025}
2026
2027#[derive(Clone, Debug, PartialEq, Eq)]
2028pub enum ScalingMetricInputSource {
2029    Cpu,
2030    Telemetry,
2031    Unknown(String),
2032}
2033impl ScalingMetricInputSource {
2034    pub fn as_str(&self) -> &str {
2035        match self {
2036            Self::Cpu => "cpu",
2037            Self::Telemetry => "telemetry",
2038            Self::Unknown(value) => value,
2039        }
2040    }
2041}
2042impl serde::Serialize for ScalingMetricInputSource {
2043    fn serialize<S: serde::Serializer>(&self, serializer: S) -> Result<S::Ok, S::Error> {
2044        serializer.serialize_str(self.as_str())
2045    }
2046}
2047impl<'de> serde::Deserialize<'de> for ScalingMetricInputSource {
2048    fn deserialize<D: serde::Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error> {
2049        let value = <String as serde::Deserialize>::deserialize(deserializer)?;
2050        Ok(match value.as_str() {
2051            "cpu" => Self::Cpu,
2052            "telemetry" => Self::Telemetry,
2053            _ => Self::Unknown(value),
2054        })
2055    }
2056}
2057
2058#[derive(Clone, Debug, PartialEq, Eq)]
2059pub enum ScalingMetricInputTargetType {
2060    Utilization,
2061    AverageValue,
2062    Unknown(String),
2063}
2064impl ScalingMetricInputTargetType {
2065    pub fn as_str(&self) -> &str {
2066        match self {
2067            Self::Utilization => "utilization",
2068            Self::AverageValue => "average_value",
2069            Self::Unknown(value) => value,
2070        }
2071    }
2072}
2073impl serde::Serialize for ScalingMetricInputTargetType {
2074    fn serialize<S: serde::Serializer>(&self, serializer: S) -> Result<S::Ok, S::Error> {
2075        serializer.serialize_str(self.as_str())
2076    }
2077}
2078impl<'de> serde::Deserialize<'de> for ScalingMetricInputTargetType {
2079    fn deserialize<D: serde::Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error> {
2080        let value = <String as serde::Deserialize>::deserialize(deserializer)?;
2081        Ok(match value.as_str() {
2082            "utilization" => Self::Utilization,
2083            "average_value" => Self::AverageValue,
2084            _ => Self::Unknown(value),
2085        })
2086    }
2087}
2088
2089#[derive(Clone, Debug, PartialEq, Eq)]
2090pub enum ScalingMetricInputSampleAggregation {
2091    Last,
2092    Avg,
2093    Max,
2094    Rate,
2095    Unknown(String),
2096}
2097impl ScalingMetricInputSampleAggregation {
2098    pub fn as_str(&self) -> &str {
2099        match self {
2100            Self::Last => "last",
2101            Self::Avg => "avg",
2102            Self::Max => "max",
2103            Self::Rate => "rate",
2104            Self::Unknown(value) => value,
2105        }
2106    }
2107}
2108impl serde::Serialize for ScalingMetricInputSampleAggregation {
2109    fn serialize<S: serde::Serializer>(&self, serializer: S) -> Result<S::Ok, S::Error> {
2110        serializer.serialize_str(self.as_str())
2111    }
2112}
2113impl<'de> serde::Deserialize<'de> for ScalingMetricInputSampleAggregation {
2114    fn deserialize<D: serde::Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error> {
2115        let value = <String as serde::Deserialize>::deserialize(deserializer)?;
2116        Ok(match value.as_str() {
2117            "last" => Self::Last,
2118            "avg" => Self::Avg,
2119            "max" => Self::Max,
2120            "rate" => Self::Rate,
2121            _ => Self::Unknown(value),
2122        })
2123    }
2124}
2125
2126#[derive(Clone, Debug, PartialEq, Eq)]
2127pub enum ScalingMetricInputSeriesAggregation {
2128    Sum,
2129    Avg,
2130    Max,
2131    Unknown(String),
2132}
2133impl ScalingMetricInputSeriesAggregation {
2134    pub fn as_str(&self) -> &str {
2135        match self {
2136            Self::Sum => "sum",
2137            Self::Avg => "avg",
2138            Self::Max => "max",
2139            Self::Unknown(value) => value,
2140        }
2141    }
2142}
2143impl serde::Serialize for ScalingMetricInputSeriesAggregation {
2144    fn serialize<S: serde::Serializer>(&self, serializer: S) -> Result<S::Ok, S::Error> {
2145        serializer.serialize_str(self.as_str())
2146    }
2147}
2148impl<'de> serde::Deserialize<'de> for ScalingMetricInputSeriesAggregation {
2149    fn deserialize<D: serde::Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error> {
2150        let value = <String as serde::Deserialize>::deserialize(deserializer)?;
2151        Ok(match value.as_str() {
2152            "sum" => Self::Sum,
2153            "avg" => Self::Avg,
2154            "max" => Self::Max,
2155            _ => Self::Unknown(value),
2156        })
2157    }
2158}
2159
2160#[derive(Clone, Debug, serde::Serialize, serde::Deserialize)]
2161pub struct InstancePoolTemplateRequestInput {
2162    /// Regional flavor reference (UUID, CRN or exact name).
2163    #[serde(rename = "flavor")]
2164    pub flavor: String,
2165
2166    #[serde(
2167        rename = "architecture",
2168        default,
2169        skip_serializing_if = "Option::is_none"
2170    )]
2171    pub architecture: Option<String>,
2172    /// Image to clone each replica's boot disk from. Accepts the same four forms instance create does: an architecture-qualified CRN, an image id, `name:version`, or a bare `name`. Unlike instance create, the reference is resolved ONCE, when the pool is created, and the resulting image id is what every replica boots — including replacements spawned months later. A tag re-resolved per replica would let a heal boot a newer build than its siblings, and a pool whose members are quietly not identical is the premise of the primitive breaking silently. To move a pool to a new build, change the template.
2173    #[serde(rename = "image", default, skip_serializing_if = "Option::is_none")]
2174    pub image: Option<String>,
2175    /// Address families allocated per member; fixed addresses are not allowed.
2176    #[serde(rename = "addresses", default, skip_serializing_if = "Option::is_none")]
2177    pub addresses: Option<Vec<AddressRequestInput>>,
2178    /// Security group selectors applied to every member interface.
2179    #[serde(
2180        rename = "security_groups",
2181        default,
2182        skip_serializing_if = "Option::is_none"
2183    )]
2184    pub security_groups: Option<Vec<String>>,
2185    /// Per-member public floating IP assignment. Explicit families require addresses and internet routes in every selected subnet.
2186    #[serde(
2187        rename = "floating_ip_assignment",
2188        default,
2189        skip_serializing_if = "Option::is_none"
2190    )]
2191    pub floating_ip_assignment: Option<InstancePoolTemplateRequestInputFloatingIpAssignment>,
2192    /// Base64-encoded user data (cloud-init), stamped on every replica.
2193    #[serde(rename = "user_data", default, skip_serializing_if = "Option::is_none")]
2194    pub user_data: Option<String>,
2195
2196    #[serde(rename = "metadata", default, skip_serializing_if = "Option::is_none")]
2197    pub metadata: Option<MetadataInput>,
2198    /// Tags stamped on every instance this template launches. These are the replicas' tags, not the pool's — the pool's own labels are the top-level `tags`, and the two are independent. Changing them affects FUTURE launches only. The instances already running keep the tags they were launched with, so between the change and a refresh the pool holds members carrying two different tag sets; `stale_instance_count` is how many are still on the old one. POST /v1/instance-pools/{pool_id}/refresh rolls them onto the current template.
2199    #[serde(rename = "tags", default, skip_serializing_if = "Option::is_none")]
2200    pub tags: Option<TagsInput>,
2201    /// IAM role reference from the same account (UUID, CRN or exact name). PassRole and instance trust authorization apply.
2202    #[serde(rename = "iam_role", default, skip_serializing_if = "Option::is_none")]
2203    pub iam_role: Option<String>,
2204    /// Per-replica disks, the boot disk included — mark it with `boot: true`. Each new replica receives the configured provisioned performance. Omitted performance uses the included allowance. Existing volumes and snapshot schedules are not supported in pool templates.
2205    #[serde(rename = "volumes", default, skip_serializing_if = "Option::is_none")]
2206    pub volumes: Option<Vec<InstanceVolumeInput>>,
2207}
2208impl InstancePoolTemplateRequestInput {
2209    /// Set the required fields; optional fields start omitted.
2210    #[allow(clippy::too_many_arguments)]
2211    pub fn new(flavor: String) -> Self {
2212        Self {
2213            flavor,
2214            architecture: None,
2215            image: None,
2216            addresses: None,
2217            security_groups: None,
2218            floating_ip_assignment: None,
2219            user_data: None,
2220            metadata: None,
2221            tags: None,
2222            iam_role: None,
2223            volumes: None,
2224        }
2225    }
2226}
2227
2228#[derive(Clone, Debug, PartialEq, Eq)]
2229pub enum InstancePoolTemplateRequestInputFloatingIpAssignment {
2230    None,
2231    Ipv4,
2232    Ipv6,
2233    DualStack,
2234    Auto,
2235    Unknown(String),
2236}
2237impl InstancePoolTemplateRequestInputFloatingIpAssignment {
2238    pub fn as_str(&self) -> &str {
2239        match self {
2240            Self::None => "none",
2241            Self::Ipv4 => "ipv4",
2242            Self::Ipv6 => "ipv6",
2243            Self::DualStack => "dual_stack",
2244            Self::Auto => "auto",
2245            Self::Unknown(value) => value,
2246        }
2247    }
2248}
2249impl serde::Serialize for InstancePoolTemplateRequestInputFloatingIpAssignment {
2250    fn serialize<S: serde::Serializer>(&self, serializer: S) -> Result<S::Ok, S::Error> {
2251        serializer.serialize_str(self.as_str())
2252    }
2253}
2254impl<'de> serde::Deserialize<'de> for InstancePoolTemplateRequestInputFloatingIpAssignment {
2255    fn deserialize<D: serde::Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error> {
2256        let value = <String as serde::Deserialize>::deserialize(deserializer)?;
2257        Ok(match value.as_str() {
2258            "none" => Self::None,
2259            "ipv4" => Self::Ipv4,
2260            "ipv6" => Self::Ipv6,
2261            "dual_stack" => Self::DualStack,
2262            "auto" => Self::Auto,
2263            _ => Self::Unknown(value),
2264        })
2265    }
2266}
2267
2268#[derive(Clone, Debug, serde::Serialize, serde::Deserialize)]
2269pub struct InstanceVolumeInput {
2270    /// Marks the boot disk. It takes no mount_path or fstype — both come from the image — and sending either is refused rather than ignored.
2271    #[serde(rename = "boot", default, skip_serializing_if = "Option::is_none")]
2272    pub boot: Option<bool>,
2273
2274    #[serde(rename = "size_gb")]
2275    pub size_gb: i64,
2276    /// Tier; omitted = the region default.
2277    #[serde(
2278        rename = "volume_type",
2279        default,
2280        skip_serializing_if = "Option::is_none"
2281    )]
2282    pub volume_type: Option<String>,
2283
2284    #[serde(
2285        rename = "performance",
2286        default,
2287        skip_serializing_if = "Option::is_none"
2288    )]
2289    pub performance: Option<VolumePerformanceRequestInput>,
2290
2291    #[serde(
2292        rename = "mount_path",
2293        default,
2294        skip_serializing_if = "Option::is_none"
2295    )]
2296    pub mount_path: Option<String>,
2297    /// Filesystem the in-guest agent formats the volume with.
2298    #[serde(rename = "fstype", default, skip_serializing_if = "Option::is_none")]
2299    pub fstype: Option<String>,
2300    /// Destroyed with the instance unless set false.
2301    #[serde(
2302        rename = "delete_on_termination",
2303        default,
2304        skip_serializing_if = "Option::is_none"
2305    )]
2306    pub delete_on_termination: Option<bool>,
2307}
2308impl InstanceVolumeInput {
2309    /// Set the required fields; optional fields start omitted.
2310    #[allow(clippy::too_many_arguments)]
2311    pub fn new(size_gb: i64) -> Self {
2312        Self {
2313            boot: None,
2314            size_gb,
2315            volume_type: None,
2316            performance: None,
2317            mount_path: None,
2318            fstype: None,
2319            delete_on_termination: None,
2320        }
2321    }
2322}
2323
2324pub type CreateInstancePoolBody = InstancePoolCreateRequestInput;
2325
2326#[derive(Clone, Debug, serde::Serialize, serde::Deserialize)]
2327pub struct InstancePoolResponse {
2328    #[serde(rename = "instance_pool")]
2329    pub instance_pool: InstancePool,
2330}
2331
2332#[derive(Clone, Debug, serde::Serialize, serde::Deserialize)]
2333pub struct InstancePool {
2334    /// Eligible placement subnets in the same account, region and VPC.
2335    #[serde(rename = "subnets")]
2336    pub subnets: Vec<ResourceRef>,
2337
2338    #[serde(rename = "vpc")]
2339    pub vpc: InstancePoolVpc,
2340
2341    #[serde(
2342        rename = "autoscaling",
2343        default,
2344        skip_serializing_if = "Option::is_none"
2345    )]
2346    pub autoscaling: Option<AutoscalingPolicy>,
2347
2348    #[serde(
2349        rename = "autoscaling_status",
2350        default,
2351        skip_serializing_if = "Option::is_none"
2352    )]
2353    pub autoscaling_status: Option<AutoscalingStatus>,
2354    /// Temporary rollout capacity; desired_count remains the steady target.
2355    #[serde(
2356        rename = "rollout_surge",
2357        default,
2358        skip_serializing_if = "Option::is_none"
2359    )]
2360    pub rollout_surge: Option<bool>,
2361    /// Instance UUIDs protected from manual and automatic scale-in. Protection does not prevent refresh, failed-instance replacement, or explicit deletion.
2362    #[serde(
2363        rename = "scale_in_protected_instances",
2364        default,
2365        skip_serializing_if = "Option::is_none"
2366    )]
2367    pub scale_in_protected_instances: Option<Vec<String>>,
2368    /// Why scale-in protection currently prevents the requested reduction. Omitted when not blocked.
2369    #[serde(
2370        rename = "scale_in_blocked_reason",
2371        default,
2372        skip_serializing_if = "Option::is_none"
2373    )]
2374    pub scale_in_blocked_reason: Option<String>,
2375
2376    #[serde(
2377        rename = "retiring_instances",
2378        default,
2379        skip_serializing_if = "Option::is_none"
2380    )]
2381    pub retiring_instances: Option<Vec<RetiringPoolMember>>,
2382
2383    #[serde(rename = "id", default, skip_serializing_if = "Option::is_none")]
2384    pub id: Option<String>,
2385    /// Cloud Resource Name. This is the value an IAM policy statement must name to scope a permission to this pool alone; a policy written against anything else will not match.
2386    #[serde(rename = "crn", default, skip_serializing_if = "Option::is_none")]
2387    pub crn: Option<String>,
2388    /// Resource names must not start with the literal crn: prefix or be UUIDs (canonical, compact, braced, or urn:uuid: forms, in either case).
2389    #[serde(rename = "name", default, skip_serializing_if = "Option::is_none")]
2390    pub name: Option<String>,
2391
2392    #[serde(
2393        rename = "description",
2394        default,
2395        skip_serializing_if = "Option::is_none"
2396    )]
2397    pub description: Option<String>,
2398
2399    #[serde(
2400        rename = "desired_count",
2401        default,
2402        skip_serializing_if = "Option::is_none"
2403    )]
2404    pub desired_count: Option<i64>,
2405
2406    #[serde(rename = "min_count", default, skip_serializing_if = "Option::is_none")]
2407    pub min_count: Option<i64>,
2408    /// A value of 0 means the pool holds no members until max_count is raised.
2409    #[serde(rename = "max_count", default, skip_serializing_if = "Option::is_none")]
2410    pub max_count: Option<i64>,
2411    /// How many members are UP — bound instances whose current_state is `running`.
2412    #[serde(
2413        rename = "live_count",
2414        default,
2415        skip_serializing_if = "Option::is_none"
2416    )]
2417    pub live_count: Option<i64>,
2418    /// How many instances the pool holds, running or not. This is what the reconciler converges toward desired_count and what `status` reflects, so member_count == desired_count with live_count below it means the pool has the members it was asked for and some of them are not up.
2419    #[serde(
2420        rename = "member_count",
2421        default,
2422        skip_serializing_if = "Option::is_none"
2423    )]
2424    pub member_count: Option<i64>,
2425    /// True while a rolling replacement requested through POST /v1/instance-pools/{pool_id}/refresh is still running. It clears itself once every member is on the current template. The pool reads `scaling` for the duration, since it runs one instance over its target while a replacement comes up.
2426    #[serde(
2427        rename = "refresh_in_progress",
2428        default,
2429        skip_serializing_if = "Option::is_none"
2430    )]
2431    pub refresh_in_progress: Option<bool>,
2432    /// How many members were launched from a template other than the pool's current one — that is, how many a refresh would replace. Non-zero after editing `template` and before refreshing, which is the signal that a template change has not been rolled out yet.
2433    #[serde(
2434        rename = "stale_instance_count",
2435        default,
2436        skip_serializing_if = "Option::is_none"
2437    )]
2438    pub stale_instance_count: Option<i64>,
2439    /// Where the pool is against its target. `active` means member_count == desired_count — the pool holds the members it was asked for. It is not a claim that all of them are up; read live_count for that. `scaling` means it does not, and the reconciler is converging it: after a create, after a desired_count change, and for the length of an instance refresh, which runs the pool one instance over its target while a replacement comes up. `error` means an active error fault exists. Capacity failures remain eligible for reconciliation; failed deletion retains its teardown intent and never recreates members. `deleting` is teardown without an active error.
2440    #[serde(rename = "status", default, skip_serializing_if = "Option::is_none")]
2441    pub status: Option<InstancePoolStatus>,
2442    /// Active faults, newest first. Empty for a healthy pool. Recovery resolves only the successful operation's codes.
2443    #[serde(rename = "faults")]
2444    pub faults: Vec<Fault>,
2445
2446    #[serde(
2447        rename = "managed_by",
2448        default,
2449        skip_serializing_if = "Option::is_none"
2450    )]
2451    pub managed_by: Option<String>,
2452    /// Labels on the POOL itself, for IAM conditions (`basalt:ResourceTag/<key>`) and cost attribution. They are attached to nothing else: no instance the pool launches carries them. The tags a replica is launched with are `template.tags`. Unlike the other top-level fields beside this one, `tags` is not a projection of the launch template — it is the pool's own set, and PATCHable on its own.
2453    #[serde(rename = "tags", default, skip_serializing_if = "Option::is_none")]
2454    pub tags: Option<Tags>,
2455    /// The pool's launch config, in the shape instance create takes. The only place it appears: a flat copy of it beside this was two spellings of one thing, and two spellings drift.
2456    #[serde(rename = "template", default, skip_serializing_if = "Option::is_none")]
2457    pub template: Option<InstancePoolTemplate>,
2458}
2459
2460#[derive(Clone, Debug, serde::Serialize, serde::Deserialize)]
2461#[serde(untagged)]
2462pub enum InstancePoolVpc {
2463    Variant1(Box<ResourceRef>),
2464    Variant2(Box<crate::Nullable<serde_json::Value>>),
2465}
2466
2467#[derive(Clone, Debug, serde::Serialize, serde::Deserialize)]
2468pub struct AutoscalingPolicy {
2469    #[serde(rename = "enabled")]
2470    pub enabled: bool,
2471
2472    #[serde(rename = "metrics")]
2473    pub metrics: Vec<ScalingMetric>,
2474
2475    #[serde(
2476        rename = "warmup_seconds",
2477        default,
2478        skip_serializing_if = "Option::is_none"
2479    )]
2480    pub warmup_seconds: Option<i64>,
2481
2482    #[serde(
2483        rename = "cooldown_seconds",
2484        default,
2485        skip_serializing_if = "Option::is_none"
2486    )]
2487    pub cooldown_seconds: Option<i64>,
2488
2489    #[serde(
2490        rename = "scale_down_stabilization_seconds",
2491        default,
2492        skip_serializing_if = "Option::is_none"
2493    )]
2494    pub scale_down_stabilization_seconds: Option<i64>,
2495
2496    #[serde(
2497        rename = "max_scale_out_step",
2498        default,
2499        skip_serializing_if = "Option::is_none"
2500    )]
2501    pub max_scale_out_step: Option<i64>,
2502
2503    #[serde(
2504        rename = "max_scale_in_step",
2505        default,
2506        skip_serializing_if = "Option::is_none"
2507    )]
2508    pub max_scale_in_step: Option<i64>,
2509    /// Grace period after route withdrawal and proxy acknowledgements, before deleting a retiring member. Long-lived TCP/UDP sessions may end at the deadline; arbitrary application shutdown hooks are not supported.
2510    #[serde(
2511        rename = "drain_seconds",
2512        default,
2513        skip_serializing_if = "Option::is_none"
2514    )]
2515    pub drain_seconds: Option<i64>,
2516}
2517
2518#[derive(Clone, Debug, serde::Serialize, serde::Deserialize)]
2519pub struct ScalingMetric {
2520    #[serde(rename = "source")]
2521    pub source: ScalingMetricSource,
2522
2523    #[serde(rename = "target_type")]
2524    pub target_type: ScalingMetricTargetType,
2525
2526    #[serde(rename = "target_value")]
2527    pub target_value: f64,
2528
2529    #[serde(rename = "name", default, skip_serializing_if = "Option::is_none")]
2530    pub name: Option<String>,
2531    /// Exact-match labels; tenancy labels and __name__ cannot be supplied.
2532    #[serde(rename = "labels", default, skip_serializing_if = "Option::is_none")]
2533    pub labels: Option<std::collections::BTreeMap<String, String>>,
2534    /// Use last for queue gauges; rate for monotonically increasing counters, with reset handling.
2535    #[serde(
2536        rename = "sample_aggregation",
2537        default,
2538        skip_serializing_if = "Option::is_none"
2539    )]
2540    pub sample_aggregation: Option<ScalingMetricSampleAggregation>,
2541
2542    #[serde(
2543        rename = "series_aggregation",
2544        default,
2545        skip_serializing_if = "Option::is_none"
2546    )]
2547    pub series_aggregation: Option<ScalingMetricSeriesAggregation>,
2548    /// Exact expected cardinality; incomplete or ambiguous selectors are unavailable.
2549    #[serde(
2550        rename = "expected_series",
2551        default,
2552        skip_serializing_if = "Option::is_none"
2553    )]
2554    pub expected_series: Option<i64>,
2555
2556    #[serde(
2557        rename = "window_seconds",
2558        default,
2559        skip_serializing_if = "Option::is_none"
2560    )]
2561    pub window_seconds: Option<i64>,
2562    /// Actual newest observation age per series; must not exceed window_seconds. Defaults to the smaller of 90 and the window.
2563    #[serde(
2564        rename = "max_age_seconds",
2565        default,
2566        skip_serializing_if = "Option::is_none"
2567    )]
2568    pub max_age_seconds: Option<i64>,
2569}
2570
2571#[derive(Clone, Debug, PartialEq, Eq)]
2572pub enum ScalingMetricSource {
2573    Cpu,
2574    Telemetry,
2575    Unknown(String),
2576}
2577impl ScalingMetricSource {
2578    pub fn as_str(&self) -> &str {
2579        match self {
2580            Self::Cpu => "cpu",
2581            Self::Telemetry => "telemetry",
2582            Self::Unknown(value) => value,
2583        }
2584    }
2585}
2586impl serde::Serialize for ScalingMetricSource {
2587    fn serialize<S: serde::Serializer>(&self, serializer: S) -> Result<S::Ok, S::Error> {
2588        serializer.serialize_str(self.as_str())
2589    }
2590}
2591impl<'de> serde::Deserialize<'de> for ScalingMetricSource {
2592    fn deserialize<D: serde::Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error> {
2593        let value = <String as serde::Deserialize>::deserialize(deserializer)?;
2594        Ok(match value.as_str() {
2595            "cpu" => Self::Cpu,
2596            "telemetry" => Self::Telemetry,
2597            _ => Self::Unknown(value),
2598        })
2599    }
2600}
2601
2602#[derive(Clone, Debug, PartialEq, Eq)]
2603pub enum ScalingMetricTargetType {
2604    Utilization,
2605    AverageValue,
2606    Unknown(String),
2607}
2608impl ScalingMetricTargetType {
2609    pub fn as_str(&self) -> &str {
2610        match self {
2611            Self::Utilization => "utilization",
2612            Self::AverageValue => "average_value",
2613            Self::Unknown(value) => value,
2614        }
2615    }
2616}
2617impl serde::Serialize for ScalingMetricTargetType {
2618    fn serialize<S: serde::Serializer>(&self, serializer: S) -> Result<S::Ok, S::Error> {
2619        serializer.serialize_str(self.as_str())
2620    }
2621}
2622impl<'de> serde::Deserialize<'de> for ScalingMetricTargetType {
2623    fn deserialize<D: serde::Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error> {
2624        let value = <String as serde::Deserialize>::deserialize(deserializer)?;
2625        Ok(match value.as_str() {
2626            "utilization" => Self::Utilization,
2627            "average_value" => Self::AverageValue,
2628            _ => Self::Unknown(value),
2629        })
2630    }
2631}
2632
2633#[derive(Clone, Debug, PartialEq, Eq)]
2634pub enum ScalingMetricSampleAggregation {
2635    Last,
2636    Avg,
2637    Max,
2638    Rate,
2639    Unknown(String),
2640}
2641impl ScalingMetricSampleAggregation {
2642    pub fn as_str(&self) -> &str {
2643        match self {
2644            Self::Last => "last",
2645            Self::Avg => "avg",
2646            Self::Max => "max",
2647            Self::Rate => "rate",
2648            Self::Unknown(value) => value,
2649        }
2650    }
2651}
2652impl serde::Serialize for ScalingMetricSampleAggregation {
2653    fn serialize<S: serde::Serializer>(&self, serializer: S) -> Result<S::Ok, S::Error> {
2654        serializer.serialize_str(self.as_str())
2655    }
2656}
2657impl<'de> serde::Deserialize<'de> for ScalingMetricSampleAggregation {
2658    fn deserialize<D: serde::Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error> {
2659        let value = <String as serde::Deserialize>::deserialize(deserializer)?;
2660        Ok(match value.as_str() {
2661            "last" => Self::Last,
2662            "avg" => Self::Avg,
2663            "max" => Self::Max,
2664            "rate" => Self::Rate,
2665            _ => Self::Unknown(value),
2666        })
2667    }
2668}
2669
2670#[derive(Clone, Debug, PartialEq, Eq)]
2671pub enum ScalingMetricSeriesAggregation {
2672    Sum,
2673    Avg,
2674    Max,
2675    Unknown(String),
2676}
2677impl ScalingMetricSeriesAggregation {
2678    pub fn as_str(&self) -> &str {
2679        match self {
2680            Self::Sum => "sum",
2681            Self::Avg => "avg",
2682            Self::Max => "max",
2683            Self::Unknown(value) => value,
2684        }
2685    }
2686}
2687impl serde::Serialize for ScalingMetricSeriesAggregation {
2688    fn serialize<S: serde::Serializer>(&self, serializer: S) -> Result<S::Ok, S::Error> {
2689        serializer.serialize_str(self.as_str())
2690    }
2691}
2692impl<'de> serde::Deserialize<'de> for ScalingMetricSeriesAggregation {
2693    fn deserialize<D: serde::Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error> {
2694        let value = <String as serde::Deserialize>::deserialize(deserializer)?;
2695        Ok(match value.as_str() {
2696            "sum" => Self::Sum,
2697            "avg" => Self::Avg,
2698            "max" => Self::Max,
2699            _ => Self::Unknown(value),
2700        })
2701    }
2702}
2703
2704#[derive(Clone, Debug, serde::Serialize, serde::Deserialize)]
2705pub struct AutoscalingStatus {
2706    #[serde(rename = "status")]
2707    pub status: AutoscalingStatusStatus,
2708
2709    #[serde(rename = "reason")]
2710    pub reason: String,
2711
2712    #[serde(
2713        rename = "evaluated_at",
2714        default,
2715        skip_serializing_if = "Option::is_none"
2716    )]
2717    pub evaluated_at: Option<String>,
2718
2719    #[serde(
2720        rename = "last_scaled_at",
2721        default,
2722        skip_serializing_if = "Option::is_none"
2723    )]
2724    pub last_scaled_at: Option<String>,
2725
2726    #[serde(rename = "history")]
2727    pub history: Vec<AutoscalingStatusHistoryItem>,
2728}
2729
2730#[derive(Clone, Debug, PartialEq, Eq)]
2731pub enum AutoscalingStatusStatus {
2732    Pending,
2733    Disabled,
2734    Stable,
2735    Scaling,
2736    Waiting,
2737    WarmingUp,
2738    MetricsUnavailable,
2739    Stabilizing,
2740    Cooldown,
2741    Draining,
2742    ScaleInBlocked,
2743    Unknown(String),
2744}
2745impl AutoscalingStatusStatus {
2746    pub fn as_str(&self) -> &str {
2747        match self {
2748            Self::Pending => "pending",
2749            Self::Disabled => "disabled",
2750            Self::Stable => "stable",
2751            Self::Scaling => "scaling",
2752            Self::Waiting => "waiting",
2753            Self::WarmingUp => "warming_up",
2754            Self::MetricsUnavailable => "metrics_unavailable",
2755            Self::Stabilizing => "stabilizing",
2756            Self::Cooldown => "cooldown",
2757            Self::Draining => "draining",
2758            Self::ScaleInBlocked => "scale_in_blocked",
2759            Self::Unknown(value) => value,
2760        }
2761    }
2762}
2763impl serde::Serialize for AutoscalingStatusStatus {
2764    fn serialize<S: serde::Serializer>(&self, serializer: S) -> Result<S::Ok, S::Error> {
2765        serializer.serialize_str(self.as_str())
2766    }
2767}
2768impl<'de> serde::Deserialize<'de> for AutoscalingStatusStatus {
2769    fn deserialize<D: serde::Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error> {
2770        let value = <String as serde::Deserialize>::deserialize(deserializer)?;
2771        Ok(match value.as_str() {
2772            "pending" => Self::Pending,
2773            "disabled" => Self::Disabled,
2774            "stable" => Self::Stable,
2775            "scaling" => Self::Scaling,
2776            "waiting" => Self::Waiting,
2777            "warming_up" => Self::WarmingUp,
2778            "metrics_unavailable" => Self::MetricsUnavailable,
2779            "stabilizing" => Self::Stabilizing,
2780            "cooldown" => Self::Cooldown,
2781            "draining" => Self::Draining,
2782            "scale_in_blocked" => Self::ScaleInBlocked,
2783            _ => Self::Unknown(value),
2784        })
2785    }
2786}
2787
2788#[derive(Clone, Debug, serde::Serialize, serde::Deserialize)]
2789pub struct AutoscalingStatusHistoryItem {
2790    #[serde(rename = "at")]
2791    pub at: String,
2792
2793    #[serde(rename = "from")]
2794    pub from: i64,
2795
2796    #[serde(rename = "to")]
2797    pub to: i64,
2798
2799    #[serde(rename = "reason")]
2800    pub reason: String,
2801}
2802
2803#[derive(Clone, Debug, serde::Serialize, serde::Deserialize)]
2804pub struct RetiringPoolMember {
2805    #[serde(rename = "requested_at")]
2806    pub requested_at: String,
2807
2808    #[serde(rename = "drain_seconds")]
2809    pub drain_seconds: i64,
2810
2811    #[serde(
2812        rename = "agent_acknowledged_at",
2813        default,
2814        skip_serializing_if = "Option::is_none"
2815    )]
2816    pub agent_acknowledged_at: Option<String>,
2817    /// Earliest deletion time; absent while withdrawal is pending.
2818    #[serde(
2819        rename = "drain_until",
2820        default,
2821        skip_serializing_if = "Option::is_none"
2822    )]
2823    pub drain_until: Option<String>,
2824
2825    #[serde(rename = "instance_id")]
2826    pub instance_id: String,
2827}
2828
2829#[derive(Clone, Debug, PartialEq, Eq)]
2830pub enum InstancePoolStatus {
2831    Active,
2832    Scaling,
2833    Error,
2834    Deleting,
2835    Unknown(String),
2836}
2837impl InstancePoolStatus {
2838    pub fn as_str(&self) -> &str {
2839        match self {
2840            Self::Active => "active",
2841            Self::Scaling => "scaling",
2842            Self::Error => "error",
2843            Self::Deleting => "deleting",
2844            Self::Unknown(value) => value,
2845        }
2846    }
2847}
2848impl serde::Serialize for InstancePoolStatus {
2849    fn serialize<S: serde::Serializer>(&self, serializer: S) -> Result<S::Ok, S::Error> {
2850        serializer.serialize_str(self.as_str())
2851    }
2852}
2853impl<'de> serde::Deserialize<'de> for InstancePoolStatus {
2854    fn deserialize<D: serde::Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error> {
2855        let value = <String as serde::Deserialize>::deserialize(deserializer)?;
2856        Ok(match value.as_str() {
2857            "active" => Self::Active,
2858            "scaling" => Self::Scaling,
2859            "error" => Self::Error,
2860            "deleting" => Self::Deleting,
2861            _ => Self::Unknown(value),
2862        })
2863    }
2864}
2865
2866#[derive(Clone, Debug, serde::Serialize, serde::Deserialize)]
2867pub struct InstancePoolTemplate {
2868    /// Address families allocated on the member's sole interface. Fixed addresses are not allowed.
2869    #[serde(rename = "addresses", default, skip_serializing_if = "Option::is_none")]
2870    pub addresses: Option<Vec<AddressRequest>>,
2871
2872    #[serde(rename = "security_groups")]
2873    pub security_groups: Vec<ResourceRef>,
2874    /// Per-member public floating IP assignment. Explicit families require addresses and internet routes in every selected subnet.
2875    #[serde(rename = "floating_ip_assignment")]
2876    pub floating_ip_assignment: InstancePoolTemplateFloatingIpAssignment,
2877    /// Base64-encoded user data (cloud-init), stamped on every replica.
2878    #[serde(rename = "user_data", default, skip_serializing_if = "Option::is_none")]
2879    pub user_data: Option<String>,
2880
2881    #[serde(rename = "metadata", default, skip_serializing_if = "Option::is_none")]
2882    pub metadata: Option<Metadata>,
2883    /// Tags stamped on every instance this template launches. These are the replicas' tags, not the pool's — the pool's own labels are the top-level `tags`, and the two are independent. Changing them affects FUTURE launches only. The instances already running keep the tags they were launched with, so between the change and a refresh the pool holds members carrying two different tag sets; `stale_instance_count` is how many are still on the old one. POST /v1/instance-pools/{pool_id}/refresh rolls them onto the current template.
2884    #[serde(rename = "tags", default, skip_serializing_if = "Option::is_none")]
2885    pub tags: Option<Tags>,
2886    /// Role assigned to replicas, or null when none is configured.
2887    #[serde(rename = "iam_role")]
2888    pub iam_role: InstancePoolTemplateIamRole,
2889    /// Per-replica disks, the boot disk included — mark it with `boot: true`. Each new replica receives the configured provisioned performance. Omitted performance uses the included allowance. Existing volumes and snapshot schedules are not supported in pool templates.
2890    #[serde(rename = "volumes", default, skip_serializing_if = "Option::is_none")]
2891    pub volumes: Option<Vec<InstanceVolume>>,
2892
2893    #[serde(rename = "flavor")]
2894    pub flavor: ResourceRef,
2895    /// Source image pinned until the template is replaced, or null when no image is selected.
2896    #[serde(rename = "image")]
2897    pub image: InstancePoolTemplateImage,
2898}
2899
2900#[derive(Clone, Debug, serde::Serialize, serde::Deserialize)]
2901pub struct AddressRequest {
2902    #[serde(rename = "family")]
2903    pub family: AddressRequestFamily,
2904    /// Optional fixed address when creating an interface or instance NIC. For IPv6, use the first address of an aligned /96 inside the subnet /64 (last 32 bits zero); the first and last /96 ranges are reserved. Omit for automatic allocation. Managed database nodes and the add-address operation require automatic allocation.
2905    #[serde(rename = "address", default, skip_serializing_if = "Option::is_none")]
2906    pub address: Option<String>,
2907}
2908
2909#[derive(Clone, Debug, PartialEq, Eq)]
2910pub enum AddressRequestFamily {
2911    Ipv4,
2912    Ipv6,
2913    Unknown(String),
2914}
2915impl AddressRequestFamily {
2916    pub fn as_str(&self) -> &str {
2917        match self {
2918            Self::Ipv4 => "ipv4",
2919            Self::Ipv6 => "ipv6",
2920            Self::Unknown(value) => value,
2921        }
2922    }
2923}
2924impl serde::Serialize for AddressRequestFamily {
2925    fn serialize<S: serde::Serializer>(&self, serializer: S) -> Result<S::Ok, S::Error> {
2926        serializer.serialize_str(self.as_str())
2927    }
2928}
2929impl<'de> serde::Deserialize<'de> for AddressRequestFamily {
2930    fn deserialize<D: serde::Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error> {
2931        let value = <String as serde::Deserialize>::deserialize(deserializer)?;
2932        Ok(match value.as_str() {
2933            "ipv4" => Self::Ipv4,
2934            "ipv6" => Self::Ipv6,
2935            _ => Self::Unknown(value),
2936        })
2937    }
2938}
2939
2940#[derive(Clone, Debug, PartialEq, Eq)]
2941pub enum InstancePoolTemplateFloatingIpAssignment {
2942    None,
2943    Ipv4,
2944    Ipv6,
2945    DualStack,
2946    Auto,
2947    Unknown(String),
2948}
2949impl InstancePoolTemplateFloatingIpAssignment {
2950    pub fn as_str(&self) -> &str {
2951        match self {
2952            Self::None => "none",
2953            Self::Ipv4 => "ipv4",
2954            Self::Ipv6 => "ipv6",
2955            Self::DualStack => "dual_stack",
2956            Self::Auto => "auto",
2957            Self::Unknown(value) => value,
2958        }
2959    }
2960}
2961impl serde::Serialize for InstancePoolTemplateFloatingIpAssignment {
2962    fn serialize<S: serde::Serializer>(&self, serializer: S) -> Result<S::Ok, S::Error> {
2963        serializer.serialize_str(self.as_str())
2964    }
2965}
2966impl<'de> serde::Deserialize<'de> for InstancePoolTemplateFloatingIpAssignment {
2967    fn deserialize<D: serde::Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error> {
2968        let value = <String as serde::Deserialize>::deserialize(deserializer)?;
2969        Ok(match value.as_str() {
2970            "none" => Self::None,
2971            "ipv4" => Self::Ipv4,
2972            "ipv6" => Self::Ipv6,
2973            "dual_stack" => Self::DualStack,
2974            "auto" => Self::Auto,
2975            _ => Self::Unknown(value),
2976        })
2977    }
2978}
2979
2980#[derive(Clone, Debug, serde::Serialize, serde::Deserialize)]
2981#[serde(untagged)]
2982pub enum InstancePoolTemplateIamRole {
2983    Variant1(Box<ResourceRef>),
2984    Variant2(Box<crate::Nullable<serde_json::Value>>),
2985}
2986
2987#[derive(Clone, Debug, serde::Serialize, serde::Deserialize)]
2988pub struct InstanceVolume {
2989    /// Marks the boot disk. It takes no mount_path or fstype — both come from the image — and sending either is refused rather than ignored.
2990    #[serde(rename = "boot", default, skip_serializing_if = "Option::is_none")]
2991    pub boot: Option<bool>,
2992
2993    #[serde(rename = "size_gb")]
2994    pub size_gb: i64,
2995    /// Tier; omitted = the region default.
2996    #[serde(
2997        rename = "volume_type",
2998        default,
2999        skip_serializing_if = "Option::is_none"
3000    )]
3001    pub volume_type: Option<String>,
3002
3003    #[serde(
3004        rename = "performance",
3005        default,
3006        skip_serializing_if = "Option::is_none"
3007    )]
3008    pub performance: Option<VolumePerformanceRequest>,
3009
3010    #[serde(
3011        rename = "mount_path",
3012        default,
3013        skip_serializing_if = "Option::is_none"
3014    )]
3015    pub mount_path: Option<String>,
3016    /// Filesystem the in-guest agent formats the volume with.
3017    #[serde(rename = "fstype", default, skip_serializing_if = "Option::is_none")]
3018    pub fstype: Option<String>,
3019    /// Destroyed with the instance unless set false.
3020    #[serde(
3021        rename = "delete_on_termination",
3022        default,
3023        skip_serializing_if = "Option::is_none"
3024    )]
3025    pub delete_on_termination: Option<bool>,
3026}
3027
3028#[derive(Clone, Debug, serde::Serialize, serde::Deserialize, Default)]
3029pub struct VolumePerformanceRequest {
3030    #[serde(rename = "iops", default, skip_serializing_if = "Option::is_none")]
3031    pub iops: Option<i64>,
3032
3033    #[serde(
3034        rename = "throughput_mib_s",
3035        default,
3036        skip_serializing_if = "Option::is_none"
3037    )]
3038    pub throughput_mib_s: Option<f64>,
3039}
3040
3041#[derive(Clone, Debug, serde::Serialize, serde::Deserialize)]
3042#[serde(untagged)]
3043pub enum InstancePoolTemplateImage {
3044    Variant1(Box<ResourceRef>),
3045    Variant2(Box<crate::Nullable<serde_json::Value>>),
3046}
3047
3048pub type CreateInstancePoolResponse = InstancePoolResponse;
3049
3050#[derive(Clone, Debug, serde::Serialize, serde::Deserialize)]
3051pub struct SerialConsoleTicket {
3052    /// The credential. Opaque — do not parse it. Good for one instance and one minute; mint a new one per connection rather than storing it.
3053    #[serde(rename = "ticket")]
3054    pub ticket: String,
3055
3056    #[serde(rename = "expires_at")]
3057    pub expires_at: String,
3058    /// Seconds until it expires.
3059    #[serde(rename = "expires_in")]
3060    pub expires_in: i64,
3061}
3062
3063pub type CreateSerialConsoleTicketResponse = SerialConsoleTicket;
3064
3065pub type DeleteImageResponse = ImageResponse;
3066
3067#[derive(Clone, Debug, serde::Serialize, serde::Deserialize, Default)]
3068pub struct GetConsoleOutputParameters {
3069    #[serde(rename = "max_bytes", default, skip_serializing_if = "Option::is_none")]
3070    pub max_bytes: Option<i64>,
3071}
3072
3073pub type GetConsoleOutputQuery = GetConsoleOutputParameters;
3074
3075#[derive(Clone, Debug, serde::Serialize, serde::Deserialize)]
3076pub struct GetConsoleOutputResult {
3077    /// The transcript as plain text, newlines included. Empty when the instance has not booted yet.
3078    #[serde(rename = "output")]
3079    pub output: String,
3080    /// True when the transcript was longer than the requested size and its BEGINNING was dropped to fit. The end is always kept.
3081    #[serde(rename = "truncated")]
3082    pub truncated: bool,
3083}
3084
3085pub type GetConsoleOutputResponse = GetConsoleOutputResult;
3086
3087#[derive(Clone, Debug, serde::Serialize, serde::Deserialize)]
3088pub struct GetFlavorResult {
3089    #[serde(rename = "flavor")]
3090    pub flavor: Flavor,
3091}
3092
3093#[derive(Clone, Debug, serde::Serialize, serde::Deserialize)]
3094pub struct Flavor {
3095    #[serde(rename = "id")]
3096    pub id: String,
3097    /// Cloud Resource Name
3098    #[serde(rename = "crn")]
3099    pub crn: String,
3100    /// Resource names must not start with the literal crn: prefix or be UUIDs (canonical, compact, braced, or urn:uuid: forms, in either case).
3101    #[serde(rename = "name")]
3102    pub name: String,
3103
3104    #[serde(
3105        rename = "description",
3106        default,
3107        skip_serializing_if = "Option::is_none"
3108    )]
3109    pub description: Option<String>,
3110    /// Number of virtual CPUs
3111    #[serde(rename = "vcpus")]
3112    pub vcpus: i64,
3113    /// RAM in MB
3114    #[serde(rename = "ram_mb")]
3115    pub ram_mb: i64,
3116    /// Host-pool routing. "shared" oversubscribes CPU for higher density; "dedicated" pins each vCPU 1:1 to a physical core.
3117    #[serde(rename = "class")]
3118    pub class: FlavorClass,
3119    /// Which product can book the flavor. "general" flavors are for regular instances and instance pools; "loadbalancer" and "database" flavors are reserved for the managed products (their nodes are platform- operated and priced accordingly) and cannot be used for regular instances.
3120    #[serde(rename = "family")]
3121    pub family: FlavorFamily,
3122    /// Aggregate instance network throughput limit in megabits per second. Omitted when uncapped.
3123    #[serde(rename = "net_mbps", default, skip_serializing_if = "Option::is_none")]
3124    pub net_mbps: Option<i64>,
3125    /// Guaranteed CPU floor as a percentage of each vCPU. Omitted when no floor is guaranteed.
3126    #[serde(
3127        rename = "cpu_baseline_pct",
3128        default,
3129        skip_serializing_if = "Option::is_none"
3130    )]
3131    pub cpu_baseline_pct: Option<i64>,
3132    /// CPU ceiling as a percentage of each vCPU. A value of 100 or an omitted field allows the full vCPU count.
3133    #[serde(
3134        rename = "cpu_burst_pct",
3135        default,
3136        skip_serializing_if = "Option::is_none"
3137    )]
3138    pub cpu_burst_pct: Option<i64>,
3139    /// Active when capacity can currently place this flavor; unavailable when no capacity is available. Disabled flavors are excluded from the public catalog.
3140    #[serde(rename = "status")]
3141    pub status: FlavorStatus,
3142}
3143
3144#[derive(Clone, Debug, PartialEq, Eq)]
3145pub enum FlavorClass {
3146    Shared,
3147    Dedicated,
3148    Unknown(String),
3149}
3150impl FlavorClass {
3151    pub fn as_str(&self) -> &str {
3152        match self {
3153            Self::Shared => "shared",
3154            Self::Dedicated => "dedicated",
3155            Self::Unknown(value) => value,
3156        }
3157    }
3158}
3159impl serde::Serialize for FlavorClass {
3160    fn serialize<S: serde::Serializer>(&self, serializer: S) -> Result<S::Ok, S::Error> {
3161        serializer.serialize_str(self.as_str())
3162    }
3163}
3164impl<'de> serde::Deserialize<'de> for FlavorClass {
3165    fn deserialize<D: serde::Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error> {
3166        let value = <String as serde::Deserialize>::deserialize(deserializer)?;
3167        Ok(match value.as_str() {
3168            "shared" => Self::Shared,
3169            "dedicated" => Self::Dedicated,
3170            _ => Self::Unknown(value),
3171        })
3172    }
3173}
3174
3175#[derive(Clone, Debug, PartialEq, Eq)]
3176pub enum FlavorFamily {
3177    General,
3178    Loadbalancer,
3179    Database,
3180    Unknown(String),
3181}
3182impl FlavorFamily {
3183    pub fn as_str(&self) -> &str {
3184        match self {
3185            Self::General => "general",
3186            Self::Loadbalancer => "loadbalancer",
3187            Self::Database => "database",
3188            Self::Unknown(value) => value,
3189        }
3190    }
3191}
3192impl serde::Serialize for FlavorFamily {
3193    fn serialize<S: serde::Serializer>(&self, serializer: S) -> Result<S::Ok, S::Error> {
3194        serializer.serialize_str(self.as_str())
3195    }
3196}
3197impl<'de> serde::Deserialize<'de> for FlavorFamily {
3198    fn deserialize<D: serde::Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error> {
3199        let value = <String as serde::Deserialize>::deserialize(deserializer)?;
3200        Ok(match value.as_str() {
3201            "general" => Self::General,
3202            "loadbalancer" => Self::Loadbalancer,
3203            "database" => Self::Database,
3204            _ => Self::Unknown(value),
3205        })
3206    }
3207}
3208
3209#[derive(Clone, Debug, PartialEq, Eq)]
3210pub enum FlavorStatus {
3211    Active,
3212    Unavailable,
3213    Unknown(String),
3214}
3215impl FlavorStatus {
3216    pub fn as_str(&self) -> &str {
3217        match self {
3218            Self::Active => "active",
3219            Self::Unavailable => "unavailable",
3220            Self::Unknown(value) => value,
3221        }
3222    }
3223}
3224impl serde::Serialize for FlavorStatus {
3225    fn serialize<S: serde::Serializer>(&self, serializer: S) -> Result<S::Ok, S::Error> {
3226        serializer.serialize_str(self.as_str())
3227    }
3228}
3229impl<'de> serde::Deserialize<'de> for FlavorStatus {
3230    fn deserialize<D: serde::Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error> {
3231        let value = <String as serde::Deserialize>::deserialize(deserializer)?;
3232        Ok(match value.as_str() {
3233            "active" => Self::Active,
3234            "unavailable" => Self::Unavailable,
3235            _ => Self::Unknown(value),
3236        })
3237    }
3238}
3239
3240pub type GetFlavorResponse = GetFlavorResult;
3241
3242pub type GetFlavorResource = Flavor;
3243
3244#[derive(Clone, Debug, serde::Serialize, serde::Deserialize, Default)]
3245pub struct GetFlavorScope {
3246    #[serde(rename = "family", default, skip_serializing_if = "Option::is_none")]
3247    pub family: Option<GetFlavorScopeFamily>,
3248}
3249
3250#[derive(Clone, Debug, PartialEq, Eq)]
3251pub enum GetFlavorScopeFamily {
3252    General,
3253    Loadbalancer,
3254    Database,
3255    Unknown(String),
3256}
3257impl GetFlavorScopeFamily {
3258    pub fn as_str(&self) -> &str {
3259        match self {
3260            Self::General => "general",
3261            Self::Loadbalancer => "loadbalancer",
3262            Self::Database => "database",
3263            Self::Unknown(value) => value,
3264        }
3265    }
3266}
3267impl serde::Serialize for GetFlavorScopeFamily {
3268    fn serialize<S: serde::Serializer>(&self, serializer: S) -> Result<S::Ok, S::Error> {
3269        serializer.serialize_str(self.as_str())
3270    }
3271}
3272impl<'de> serde::Deserialize<'de> for GetFlavorScopeFamily {
3273    fn deserialize<D: serde::Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error> {
3274        let value = <String as serde::Deserialize>::deserialize(deserializer)?;
3275        Ok(match value.as_str() {
3276            "general" => Self::General,
3277            "loadbalancer" => Self::Loadbalancer,
3278            "database" => Self::Database,
3279            _ => Self::Unknown(value),
3280        })
3281    }
3282}
3283
3284pub type GetImageResponse = ImageResponse;
3285
3286pub type GetImageResource = Image;
3287
3288#[derive(Clone, Debug, serde::Serialize, serde::Deserialize, Default)]
3289pub struct GetImageScope {
3290    #[serde(rename = "limit", default, skip_serializing_if = "Option::is_none")]
3291    pub limit: Option<i64>,
3292
3293    #[serde(rename = "os", default, skip_serializing_if = "Option::is_none")]
3294    pub os: Option<String>,
3295
3296    #[serde(
3297        rename = "architecture",
3298        default,
3299        skip_serializing_if = "Option::is_none"
3300    )]
3301    pub architecture: Option<String>,
3302
3303    #[serde(rename = "status", default, skip_serializing_if = "Option::is_none")]
3304    pub status: Option<GetImageScopeStatus>,
3305
3306    #[serde(
3307        rename = "all_versions",
3308        default,
3309        skip_serializing_if = "Option::is_none"
3310    )]
3311    pub all_versions: Option<bool>,
3312}
3313
3314#[derive(Clone, Debug, PartialEq, Eq)]
3315pub enum GetImageScopeStatus {
3316    Pending,
3317    Importing,
3318    Active,
3319    Error,
3320    Deleting,
3321    Withdrawn,
3322    Unknown(String),
3323}
3324impl GetImageScopeStatus {
3325    pub fn as_str(&self) -> &str {
3326        match self {
3327            Self::Pending => "pending",
3328            Self::Importing => "importing",
3329            Self::Active => "active",
3330            Self::Error => "error",
3331            Self::Deleting => "deleting",
3332            Self::Withdrawn => "withdrawn",
3333            Self::Unknown(value) => value,
3334        }
3335    }
3336}
3337impl serde::Serialize for GetImageScopeStatus {
3338    fn serialize<S: serde::Serializer>(&self, serializer: S) -> Result<S::Ok, S::Error> {
3339        serializer.serialize_str(self.as_str())
3340    }
3341}
3342impl<'de> serde::Deserialize<'de> for GetImageScopeStatus {
3343    fn deserialize<D: serde::Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error> {
3344        let value = <String as serde::Deserialize>::deserialize(deserializer)?;
3345        Ok(match value.as_str() {
3346            "pending" => Self::Pending,
3347            "importing" => Self::Importing,
3348            "active" => Self::Active,
3349            "error" => Self::Error,
3350            "deleting" => Self::Deleting,
3351            "withdrawn" => Self::Withdrawn,
3352            _ => Self::Unknown(value),
3353        })
3354    }
3355}
3356
3357#[derive(Clone, Debug, serde::Serialize, serde::Deserialize)]
3358pub struct GetInstanceResult {
3359    #[serde(rename = "instance")]
3360    pub instance: Instance,
3361}
3362
3363pub type GetInstanceResponse = GetInstanceResult;
3364
3365pub type GetInstanceResource = Instance;
3366
3367#[derive(Clone, Debug, serde::Serialize, serde::Deserialize, Default)]
3368pub struct GetInstanceScope {
3369    #[serde(rename = "limit", default, skip_serializing_if = "Option::is_none")]
3370    pub limit: Option<i64>,
3371
3372    #[serde(
3373        rename = "current_state",
3374        default,
3375        skip_serializing_if = "Option::is_none"
3376    )]
3377    pub current_state: Option<CurrentStateInput>,
3378
3379    #[serde(rename = "flavor", default, skip_serializing_if = "Option::is_none")]
3380    pub flavor: Option<String>,
3381
3382    #[serde(rename = "image", default, skip_serializing_if = "Option::is_none")]
3383    pub image: Option<String>,
3384}
3385
3386#[derive(Clone, Debug, PartialEq, Eq)]
3387pub enum CurrentStateInput {
3388    Pending,
3389    Building,
3390    Running,
3391    Stopping,
3392    Stopped,
3393    Rebooting,
3394    Migrating,
3395    Deleting,
3396    Deleted,
3397    Error,
3398    Crashed,
3399    Paused,
3400    Suspended,
3401    Unknown(String),
3402}
3403impl CurrentStateInput {
3404    pub fn as_str(&self) -> &str {
3405        match self {
3406            Self::Pending => "pending",
3407            Self::Building => "building",
3408            Self::Running => "running",
3409            Self::Stopping => "stopping",
3410            Self::Stopped => "stopped",
3411            Self::Rebooting => "rebooting",
3412            Self::Migrating => "migrating",
3413            Self::Deleting => "deleting",
3414            Self::Deleted => "deleted",
3415            Self::Error => "error",
3416            Self::Crashed => "crashed",
3417            Self::Paused => "paused",
3418            Self::Suspended => "suspended",
3419            Self::Unknown(value) => value,
3420        }
3421    }
3422}
3423impl serde::Serialize for CurrentStateInput {
3424    fn serialize<S: serde::Serializer>(&self, serializer: S) -> Result<S::Ok, S::Error> {
3425        serializer.serialize_str(self.as_str())
3426    }
3427}
3428impl<'de> serde::Deserialize<'de> for CurrentStateInput {
3429    fn deserialize<D: serde::Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error> {
3430        let value = <String as serde::Deserialize>::deserialize(deserializer)?;
3431        Ok(match value.as_str() {
3432            "pending" => Self::Pending,
3433            "building" => Self::Building,
3434            "running" => Self::Running,
3435            "stopping" => Self::Stopping,
3436            "stopped" => Self::Stopped,
3437            "rebooting" => Self::Rebooting,
3438            "migrating" => Self::Migrating,
3439            "deleting" => Self::Deleting,
3440            "deleted" => Self::Deleted,
3441            "error" => Self::Error,
3442            "crashed" => Self::Crashed,
3443            "paused" => Self::Paused,
3444            "suspended" => Self::Suspended,
3445            _ => Self::Unknown(value),
3446        })
3447    }
3448}
3449
3450pub type GetInstancePoolResponse = InstancePoolResponse;
3451
3452pub type GetInstancePoolResource = InstancePool;
3453
3454#[derive(Clone, Debug, serde::Serialize, serde::Deserialize, Default)]
3455pub struct GetInstancePoolScope {
3456    #[serde(rename = "limit", default, skip_serializing_if = "Option::is_none")]
3457    pub limit: Option<i64>,
3458}
3459
3460#[derive(Clone, Debug, serde::Serialize, serde::Deserialize, Default)]
3461pub struct ListFlavorsParameters {
3462    #[serde(rename = "name", default, skip_serializing_if = "Option::is_none")]
3463    pub name: Option<String>,
3464
3465    #[serde(rename = "crn", default, skip_serializing_if = "Option::is_none")]
3466    pub crn: Option<String>,
3467
3468    #[serde(rename = "family", default, skip_serializing_if = "Option::is_none")]
3469    pub family: Option<ListFlavorsParametersFamily>,
3470}
3471
3472#[derive(Clone, Debug, PartialEq, Eq)]
3473pub enum ListFlavorsParametersFamily {
3474    General,
3475    Loadbalancer,
3476    Database,
3477    Unknown(String),
3478}
3479impl ListFlavorsParametersFamily {
3480    pub fn as_str(&self) -> &str {
3481        match self {
3482            Self::General => "general",
3483            Self::Loadbalancer => "loadbalancer",
3484            Self::Database => "database",
3485            Self::Unknown(value) => value,
3486        }
3487    }
3488}
3489impl serde::Serialize for ListFlavorsParametersFamily {
3490    fn serialize<S: serde::Serializer>(&self, serializer: S) -> Result<S::Ok, S::Error> {
3491        serializer.serialize_str(self.as_str())
3492    }
3493}
3494impl<'de> serde::Deserialize<'de> for ListFlavorsParametersFamily {
3495    fn deserialize<D: serde::Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error> {
3496        let value = <String as serde::Deserialize>::deserialize(deserializer)?;
3497        Ok(match value.as_str() {
3498            "general" => Self::General,
3499            "loadbalancer" => Self::Loadbalancer,
3500            "database" => Self::Database,
3501            _ => Self::Unknown(value),
3502        })
3503    }
3504}
3505
3506pub type ListFlavorsQuery = ListFlavorsParameters;
3507
3508#[derive(Clone, Debug, serde::Serialize, serde::Deserialize)]
3509pub struct FlavorListResponse {
3510    #[serde(rename = "flavors")]
3511    pub flavors: Vec<Flavor>,
3512
3513    #[serde(rename = "meta")]
3514    pub meta: PaginationMeta,
3515}
3516
3517#[derive(Clone, Debug, serde::Serialize, serde::Deserialize, Default)]
3518pub struct PaginationMeta {
3519    /// Total number of items
3520    #[serde(rename = "total", default, skip_serializing_if = "Option::is_none")]
3521    pub total: Option<i64>,
3522    /// Number of items per page
3523    #[serde(rename = "limit", default, skip_serializing_if = "Option::is_none")]
3524    pub limit: Option<i64>,
3525    /// Opaque cursor for the next page. Pass it back as the `marker` query parameter; treat it as a token, not a value to parse.
3526    #[serde(rename = "marker", default, skip_serializing_if = "Option::is_none")]
3527    pub marker: Option<String>,
3528    /// Whether there are more items
3529    #[serde(rename = "has_more", default, skip_serializing_if = "Option::is_none")]
3530    pub has_more: Option<bool>,
3531}
3532
3533pub type ListFlavorsResponse = FlavorListResponse;
3534
3535pub type ListFlavorsItem = Flavor;
3536
3537#[derive(Clone, Debug, serde::Serialize, serde::Deserialize, Default)]
3538pub struct ListImageCatalogParameters {
3539    #[serde(rename = "limit", default, skip_serializing_if = "Option::is_none")]
3540    pub limit: Option<i64>,
3541
3542    #[serde(rename = "marker", default, skip_serializing_if = "Option::is_none")]
3543    pub marker: Option<String>,
3544
3545    #[serde(rename = "name", default, skip_serializing_if = "Option::is_none")]
3546    pub name: Option<String>,
3547
3548    #[serde(rename = "os", default, skip_serializing_if = "Option::is_none")]
3549    pub os: Option<String>,
3550
3551    #[serde(
3552        rename = "architecture",
3553        default,
3554        skip_serializing_if = "Option::is_none"
3555    )]
3556    pub architecture: Option<String>,
3557}
3558
3559pub type ListImageCatalogQuery = ListImageCatalogParameters;
3560
3561#[derive(Clone, Debug, serde::Serialize, serde::Deserialize)]
3562pub struct ImageCatalogResponse {
3563    #[serde(rename = "categories")]
3564    pub categories: Vec<ImageCatalogCategory>,
3565
3566    #[serde(rename = "meta")]
3567    pub meta: PaginationMeta,
3568}
3569
3570#[derive(Clone, Debug, serde::Serialize, serde::Deserialize)]
3571pub struct ImageCatalogCategory {
3572    /// Catalog category. Currently platform or account; future categories may include apps.
3573    #[serde(rename = "name")]
3574    pub name: String,
3575
3576    #[serde(rename = "images")]
3577    pub images: Vec<CatalogImage>,
3578}
3579
3580#[derive(Clone, Debug, serde::Serialize, serde::Deserialize)]
3581pub struct CatalogImage {
3582    #[serde(rename = "id")]
3583    pub id: String,
3584
3585    #[serde(rename = "crn")]
3586    pub crn: String,
3587
3588    #[serde(rename = "name")]
3589    pub name: String,
3590
3591    #[serde(rename = "os", default, skip_serializing_if = "Option::is_none")]
3592    pub os: Option<String>,
3593
3594    #[serde(
3595        rename = "os_version",
3596        default,
3597        skip_serializing_if = "Option::is_none"
3598    )]
3599    pub os_version: Option<String>,
3600
3601    #[serde(rename = "architecture")]
3602    pub architecture: String,
3603
3604    #[serde(rename = "min_disk_gb")]
3605    pub min_disk_gb: i64,
3606
3607    #[serde(rename = "min_ram_mb")]
3608    pub min_ram_mb: i64,
3609
3610    #[serde(rename = "eol_date", default, skip_serializing_if = "Option::is_none")]
3611    pub eol_date: Option<String>,
3612}
3613
3614pub type ListImageCatalogResponse = ImageCatalogResponse;
3615
3616pub type ListImageCatalogItem = ImageCatalogCategory;
3617
3618#[derive(Clone, Debug, serde::Serialize, serde::Deserialize, Default)]
3619pub struct ListImagesParameters {
3620    #[serde(rename = "crn", default, skip_serializing_if = "Option::is_none")]
3621    pub crn: Option<String>,
3622
3623    #[serde(rename = "limit", default, skip_serializing_if = "Option::is_none")]
3624    pub limit: Option<i64>,
3625
3626    #[serde(rename = "marker", default, skip_serializing_if = "Option::is_none")]
3627    pub marker: Option<String>,
3628
3629    #[serde(rename = "os", default, skip_serializing_if = "Option::is_none")]
3630    pub os: Option<String>,
3631
3632    #[serde(
3633        rename = "architecture",
3634        default,
3635        skip_serializing_if = "Option::is_none"
3636    )]
3637    pub architecture: Option<String>,
3638
3639    #[serde(rename = "name", default, skip_serializing_if = "Option::is_none")]
3640    pub name: Option<String>,
3641
3642    #[serde(rename = "status", default, skip_serializing_if = "Option::is_none")]
3643    pub status: Option<ListImagesParametersStatus>,
3644
3645    #[serde(
3646        rename = "all_versions",
3647        default,
3648        skip_serializing_if = "Option::is_none"
3649    )]
3650    pub all_versions: Option<bool>,
3651}
3652
3653#[derive(Clone, Debug, PartialEq, Eq)]
3654pub enum ListImagesParametersStatus {
3655    Pending,
3656    Importing,
3657    Active,
3658    Error,
3659    Deleting,
3660    Withdrawn,
3661    Unknown(String),
3662}
3663impl ListImagesParametersStatus {
3664    pub fn as_str(&self) -> &str {
3665        match self {
3666            Self::Pending => "pending",
3667            Self::Importing => "importing",
3668            Self::Active => "active",
3669            Self::Error => "error",
3670            Self::Deleting => "deleting",
3671            Self::Withdrawn => "withdrawn",
3672            Self::Unknown(value) => value,
3673        }
3674    }
3675}
3676impl serde::Serialize for ListImagesParametersStatus {
3677    fn serialize<S: serde::Serializer>(&self, serializer: S) -> Result<S::Ok, S::Error> {
3678        serializer.serialize_str(self.as_str())
3679    }
3680}
3681impl<'de> serde::Deserialize<'de> for ListImagesParametersStatus {
3682    fn deserialize<D: serde::Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error> {
3683        let value = <String as serde::Deserialize>::deserialize(deserializer)?;
3684        Ok(match value.as_str() {
3685            "pending" => Self::Pending,
3686            "importing" => Self::Importing,
3687            "active" => Self::Active,
3688            "error" => Self::Error,
3689            "deleting" => Self::Deleting,
3690            "withdrawn" => Self::Withdrawn,
3691            _ => Self::Unknown(value),
3692        })
3693    }
3694}
3695
3696pub type ListImagesQuery = ListImagesParameters;
3697
3698#[derive(Clone, Debug, serde::Serialize, serde::Deserialize)]
3699pub struct ImageListResponse {
3700    #[serde(rename = "images")]
3701    pub images: Vec<Image>,
3702
3703    #[serde(rename = "meta", default, skip_serializing_if = "Option::is_none")]
3704    pub meta: Option<PaginationMeta>,
3705}
3706
3707pub type ListImagesResponse = ImageListResponse;
3708
3709pub type ListImagesItem = Image;
3710
3711#[derive(Clone, Debug, serde::Serialize, serde::Deserialize, Default)]
3712pub struct ListInstanceInterfacesParameters {
3713    #[serde(rename = "name", default, skip_serializing_if = "Option::is_none")]
3714    pub name: Option<String>,
3715
3716    #[serde(rename = "crn", default, skip_serializing_if = "Option::is_none")]
3717    pub crn: Option<String>,
3718}
3719
3720pub type ListInstanceInterfacesQuery = ListInstanceInterfacesParameters;
3721
3722#[derive(Clone, Debug, serde::Serialize, serde::Deserialize)]
3723pub struct InstanceInterfaceListResponse {
3724    #[serde(rename = "interfaces")]
3725    pub interfaces: Vec<AttachedInterface>,
3726
3727    #[serde(rename = "meta")]
3728    pub meta: PaginationMeta,
3729}
3730
3731pub type ListInstanceInterfacesResponse = InstanceInterfaceListResponse;
3732
3733pub type ListInstanceInterfacesItem = AttachedInterface;
3734
3735#[derive(Clone, Debug, serde::Serialize, serde::Deserialize, Default)]
3736pub struct ListInstancePoolFloatingIpsParameters {
3737    #[serde(rename = "name", default, skip_serializing_if = "Option::is_none")]
3738    pub name: Option<String>,
3739
3740    #[serde(rename = "crn", default, skip_serializing_if = "Option::is_none")]
3741    pub crn: Option<String>,
3742
3743    #[serde(rename = "limit", default, skip_serializing_if = "Option::is_none")]
3744    pub limit: Option<i64>,
3745
3746    #[serde(rename = "marker", default, skip_serializing_if = "Option::is_none")]
3747    pub marker: Option<String>,
3748}
3749
3750pub type ListInstancePoolFloatingIpsQuery = ListInstancePoolFloatingIpsParameters;
3751
3752#[derive(Clone, Debug, serde::Serialize, serde::Deserialize)]
3753pub struct FloatingIpListResponse {
3754    #[serde(rename = "floating_ips")]
3755    pub floating_ips: Vec<FloatingIp>,
3756
3757    #[serde(rename = "meta")]
3758    pub meta: PaginationMeta,
3759}
3760
3761pub type ListInstancePoolFloatingIpsResponse = FloatingIpListResponse;
3762
3763pub type ListInstancePoolFloatingIpsItem = FloatingIp;
3764
3765#[derive(Clone, Debug, serde::Serialize, serde::Deserialize, Default)]
3766pub struct ListInstancePoolsParameters {
3767    #[serde(rename = "name", default, skip_serializing_if = "Option::is_none")]
3768    pub name: Option<String>,
3769
3770    #[serde(rename = "crn", default, skip_serializing_if = "Option::is_none")]
3771    pub crn: Option<String>,
3772
3773    #[serde(rename = "limit", default, skip_serializing_if = "Option::is_none")]
3774    pub limit: Option<i64>,
3775
3776    #[serde(rename = "marker", default, skip_serializing_if = "Option::is_none")]
3777    pub marker: Option<String>,
3778}
3779
3780pub type ListInstancePoolsQuery = ListInstancePoolsParameters;
3781
3782#[derive(Clone, Debug, serde::Serialize, serde::Deserialize)]
3783pub struct InstancePoolListResponse {
3784    #[serde(rename = "instance_pools")]
3785    pub instance_pools: Vec<InstancePool>,
3786
3787    #[serde(rename = "meta")]
3788    pub meta: PaginationMeta,
3789}
3790
3791pub type ListInstancePoolsResponse = InstancePoolListResponse;
3792
3793pub type ListInstancePoolsItem = InstancePool;
3794
3795#[derive(Clone, Debug, serde::Serialize, serde::Deserialize, Default)]
3796pub struct ListInstanceVolumesParameters {
3797    #[serde(rename = "name", default, skip_serializing_if = "Option::is_none")]
3798    pub name: Option<String>,
3799
3800    #[serde(rename = "crn", default, skip_serializing_if = "Option::is_none")]
3801    pub crn: Option<String>,
3802}
3803
3804pub type ListInstanceVolumesQuery = ListInstanceVolumesParameters;
3805
3806#[derive(Clone, Debug, serde::Serialize, serde::Deserialize)]
3807pub struct InstanceVolumeListResponse {
3808    #[serde(rename = "volumes")]
3809    pub volumes: Vec<AttachedVolume>,
3810
3811    #[serde(rename = "meta")]
3812    pub meta: PaginationMeta,
3813}
3814
3815pub type ListInstanceVolumesResponse = InstanceVolumeListResponse;
3816
3817pub type ListInstanceVolumesItem = AttachedVolume;
3818
3819#[derive(Clone, Debug, serde::Serialize, serde::Deserialize, Default)]
3820pub struct ListInstancesParameters {
3821    #[serde(rename = "crn", default, skip_serializing_if = "Option::is_none")]
3822    pub crn: Option<String>,
3823
3824    #[serde(rename = "limit", default, skip_serializing_if = "Option::is_none")]
3825    pub limit: Option<i64>,
3826
3827    #[serde(rename = "marker", default, skip_serializing_if = "Option::is_none")]
3828    pub marker: Option<String>,
3829
3830    #[serde(rename = "name", default, skip_serializing_if = "Option::is_none")]
3831    pub name: Option<String>,
3832
3833    #[serde(
3834        rename = "current_state",
3835        default,
3836        skip_serializing_if = "Option::is_none"
3837    )]
3838    pub current_state: Option<CurrentStateInput>,
3839
3840    #[serde(rename = "flavor", default, skip_serializing_if = "Option::is_none")]
3841    pub flavor: Option<String>,
3842
3843    #[serde(rename = "image", default, skip_serializing_if = "Option::is_none")]
3844    pub image: Option<String>,
3845}
3846
3847pub type ListInstancesQuery = ListInstancesParameters;
3848
3849#[derive(Clone, Debug, serde::Serialize, serde::Deserialize)]
3850pub struct InstanceListResponse {
3851    #[serde(rename = "instances")]
3852    pub instances: Vec<Instance>,
3853
3854    #[serde(rename = "meta")]
3855    pub meta: PaginationMeta,
3856}
3857
3858pub type ListInstancesResponse = InstanceListResponse;
3859
3860pub type ListInstancesItem = Instance;
3861
3862#[derive(Clone, Debug, serde::Serialize, serde::Deserialize, Default)]
3863pub struct ListPoolInstancesParameters {
3864    #[serde(rename = "crn", default, skip_serializing_if = "Option::is_none")]
3865    pub crn: Option<String>,
3866
3867    #[serde(rename = "limit", default, skip_serializing_if = "Option::is_none")]
3868    pub limit: Option<i64>,
3869
3870    #[serde(rename = "marker", default, skip_serializing_if = "Option::is_none")]
3871    pub marker: Option<String>,
3872
3873    #[serde(rename = "name", default, skip_serializing_if = "Option::is_none")]
3874    pub name: Option<String>,
3875
3876    #[serde(
3877        rename = "current_state",
3878        default,
3879        skip_serializing_if = "Option::is_none"
3880    )]
3881    pub current_state: Option<CurrentStateInput>,
3882
3883    #[serde(rename = "flavor", default, skip_serializing_if = "Option::is_none")]
3884    pub flavor: Option<String>,
3885
3886    #[serde(rename = "image", default, skip_serializing_if = "Option::is_none")]
3887    pub image: Option<String>,
3888}
3889
3890pub type ListPoolInstancesQuery = ListPoolInstancesParameters;
3891
3892pub type ListPoolInstancesResponse = InstanceListResponse;
3893
3894pub type ListPoolInstancesItem = Instance;
3895
3896#[derive(Clone, Debug, serde::Serialize, serde::Deserialize, Default)]
3897pub struct InstanceRebootRequestInput {
3898    /// Force a power cycle (destroy + start, equivalent to a reset button) instead of the default ACPI graceful reboot the guest can act on.
3899    #[serde(rename = "hard", default, skip_serializing_if = "Option::is_none")]
3900    pub hard: Option<bool>,
3901}
3902
3903pub type RebootInstanceBody = InstanceRebootRequestInput;
3904
3905pub type RefreshInstancePoolResponse = InstancePoolResponse;
3906
3907#[derive(Clone, Debug, serde::Serialize, serde::Deserialize, Default)]
3908pub struct ReinstallInstanceRequest {
3909    /// Replacement image reference (UUID, architecture-qualified CRN, name or name:version). Omit to reinstall from the instance's current image.
3910    #[serde(rename = "image", default, skip_serializing_if = "Option::is_none")]
3911    pub image: Option<String>,
3912    /// Replacement boot disk size; omitted = the image's min_disk_gb. Must be within the volume size range (1..16384) and at least the image's min_disk_gb.
3913    #[serde(rename = "size_gb", default, skip_serializing_if = "Option::is_none")]
3914    pub size_gb: Option<i64>,
3915    /// Replacement boot disk tier; omitted = the region default.
3916    #[serde(
3917        rename = "volume_type",
3918        default,
3919        skip_serializing_if = "Option::is_none"
3920    )]
3921    pub volume_type: Option<ReinstallInstanceRequestVolumeType>,
3922}
3923
3924#[derive(Clone, Debug, PartialEq, Eq)]
3925pub enum ReinstallInstanceRequestVolumeType {
3926    Ssd,
3927    Nvme,
3928    Unknown(String),
3929}
3930impl ReinstallInstanceRequestVolumeType {
3931    pub fn as_str(&self) -> &str {
3932        match self {
3933            Self::Ssd => "ssd",
3934            Self::Nvme => "nvme",
3935            Self::Unknown(value) => value,
3936        }
3937    }
3938}
3939impl serde::Serialize for ReinstallInstanceRequestVolumeType {
3940    fn serialize<S: serde::Serializer>(&self, serializer: S) -> Result<S::Ok, S::Error> {
3941        serializer.serialize_str(self.as_str())
3942    }
3943}
3944impl<'de> serde::Deserialize<'de> for ReinstallInstanceRequestVolumeType {
3945    fn deserialize<D: serde::Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error> {
3946        let value = <String as serde::Deserialize>::deserialize(deserializer)?;
3947        Ok(match value.as_str() {
3948            "ssd" => Self::Ssd,
3949            "nvme" => Self::Nvme,
3950            _ => Self::Unknown(value),
3951        })
3952    }
3953}
3954
3955pub type ReinstallInstanceBody = ReinstallInstanceRequest;
3956
3957#[derive(Clone, Debug, serde::Serialize, serde::Deserialize)]
3958pub struct ResizeInstanceRequest {
3959    /// Regional flavor reference (UUID, CRN or exact name) to resize to.
3960    #[serde(rename = "flavor")]
3961    pub flavor: String,
3962}
3963impl ResizeInstanceRequest {
3964    /// Set the required fields; optional fields start omitted.
3965    #[allow(clippy::too_many_arguments)]
3966    pub fn new(flavor: String) -> Self {
3967        Self { flavor }
3968    }
3969}
3970
3971pub type ResizeInstanceBody = ResizeInstanceRequest;
3972
3973#[derive(Clone, Debug, serde::Serialize, serde::Deserialize, Default)]
3974pub struct StartSerialConsoleParameters {
3975    #[serde(
3976        rename = "backlog_bytes",
3977        default,
3978        skip_serializing_if = "Option::is_none"
3979    )]
3980    pub backlog_bytes: Option<i64>,
3981}
3982
3983pub type StartSerialConsoleQuery = StartSerialConsoleParameters;
3984
3985#[derive(Clone, Debug, serde::Serialize, serde::Deserialize, Default)]
3986pub struct ImageUpdateRequestInput {
3987    #[serde(
3988        rename = "description",
3989        default,
3990        skip_serializing_if = "Option::is_none"
3991    )]
3992    pub description: Option<String>,
3993    /// Switch the resolve-by-name pointer for this image's name. true promotes this version to current (the switch / rollback action) and demotes whatever else was current for the same (name, architecture); false clears the pointer. Only active images can be made current.
3994    #[serde(rename = "current", default, skip_serializing_if = "Option::is_none")]
3995    pub current: Option<bool>,
3996    /// Set the release's end-of-life date. An explicit null clears it; omitting the field leaves it unchanged. Clearing matters because the catalog withdraws platform images on this date — one recorded by mistake has to be removable.
3997    #[serde(
3998        rename = "eol_date",
3999        default,
4000        skip_serializing_if = "Option::is_none",
4001        deserialize_with = "crate::response::present_nullable"
4002    )]
4003    pub eol_date: Option<crate::Nullable<String>>,
4004
4005    #[serde(rename = "tags", default, skip_serializing_if = "Option::is_none")]
4006    pub tags: Option<TagsInput>,
4007
4008    #[serde(
4009        rename = "attributes",
4010        default,
4011        skip_serializing_if = "Option::is_none"
4012    )]
4013    pub attributes: Option<std::collections::BTreeMap<String, String>>,
4014}
4015
4016pub type UpdateImageBody = ImageUpdateRequestInput;
4017
4018pub type UpdateImageResponse = ImageResponse;
4019
4020#[derive(Clone, Debug, serde::Serialize, serde::Deserialize, Default)]
4021pub struct InstanceUpdateRequestInput {
4022    /// Attach or replace the instance workload role using its ID, name, or CRN. Omit this field to keep the current role; send an empty string to detach it. Null is not accepted. Requires compute:UpdateInstance; attach/replace also require iam:PassRole and a role trust policy allowing this instance. Only running or stopped customer-managed instances with no operation in progress support role edits. Pool members use the pool launch template. New IMDS requests observe the committed association immediately. Previously issued credentials are not revoked and remain valid until expiry (up to one hour); in-flight requests may complete with their prior association.
4023    #[serde(rename = "iam_role", default, skip_serializing_if = "Option::is_none")]
4024    pub iam_role: Option<String>,
4025
4026    #[serde(
4027        rename = "description",
4028        default,
4029        skip_serializing_if = "Option::is_none"
4030    )]
4031    pub description: Option<String>,
4032
4033    #[serde(rename = "metadata", default, skip_serializing_if = "Option::is_none")]
4034    pub metadata: Option<MetadataInput>,
4035
4036    #[serde(rename = "tags", default, skip_serializing_if = "Option::is_none")]
4037    pub tags: Option<TagsInput>,
4038}
4039
4040pub type UpdateInstanceBody = InstanceUpdateRequestInput;
4041
4042#[derive(Clone, Debug, serde::Serialize, serde::Deserialize)]
4043pub struct UpdateInstanceResult {
4044    #[serde(rename = "instance")]
4045    pub instance: Instance,
4046}
4047
4048pub type UpdateInstanceResponse = UpdateInstanceResult;
4049
4050#[derive(Clone, Debug, serde::Serialize, serde::Deserialize, Default)]
4051pub struct InstancePoolUpdateRequestInput {
4052    /// Exact member UUIDs to retire. Requires an explicit lower desired_count and exactly current desired_count minus new desired_count members. The pool must have converged membership and no retirement or refresh in progress. Selected members must belong to this pool and be unprotected. Only sizing and autoscaling fields may accompany selection. Selection and sizing are committed atomically; stale or protected selections return 409 without substituting another member. Use Idempotency-Key when retrying.
4053    #[serde(
4054        rename = "scale_in_instances",
4055        default,
4056        skip_serializing_if = "Option::is_none"
4057    )]
4058    pub scale_in_instances: Option<Vec<String>>,
4059    /// Replace the eligible placement set. Omit to preserve it. Affects future launches; run an explicit refresh to move existing members. All selected subnets must share a VPC.
4060    #[serde(rename = "subnets", default, skip_serializing_if = "Option::is_none")]
4061    pub subnets: Option<Vec<String>>,
4062
4063    #[serde(
4064        rename = "autoscaling",
4065        default,
4066        skip_serializing_if = "Option::is_none"
4067    )]
4068    pub autoscaling: Option<AutoscalingPolicyInput>,
4069    /// Customer note on the pool. Omit to preserve it; send an empty string to clear it. Changes no instances, sizing or launch configuration.
4070    #[serde(
4071        rename = "description",
4072        default,
4073        skip_serializing_if = "Option::is_none"
4074    )]
4075    pub description: Option<String>,
4076    /// REPLACES the pool's labels: the map you send becomes the whole set, an empty object clears them, and omitting the field leaves them alone. Replacement rather than a merge because a merge leaves no way to say a key should be removed. These label the pool, not its instances. To change what future replicas are tagged with, send `template.tags`.
4077    #[serde(rename = "tags", default, skip_serializing_if = "Option::is_none")]
4078    pub tags: Option<TagsInput>,
4079    /// New target size, bounded by the resulting min_count/max_count and the hard platform cap of 100.
4080    #[serde(
4081        rename = "desired_count",
4082        default,
4083        skip_serializing_if = "Option::is_none"
4084    )]
4085    pub desired_count: Option<i64>,
4086    /// New lower bound; omitted desired_count rises to this bound if needed.
4087    #[serde(rename = "min_count", default, skip_serializing_if = "Option::is_none")]
4088    pub min_count: Option<i64>,
4089    /// New upper bound; omitted desired_count falls to this bound if needed. A value of 0 means the pool holds no members until max_count is raised.
4090    #[serde(rename = "max_count", default, skip_serializing_if = "Option::is_none")]
4091    pub max_count: Option<i64>,
4092    /// Replaces the launch config WHOLESALE — the object you send is what the pool launches next, and anything you leave out is cleared rather than kept. Replacement rather than a deep merge so a shorter `networks` or `volumes` cannot be read as a truncation and silently drop an interface or a disk.
4093    #[serde(rename = "template", default, skip_serializing_if = "Option::is_none")]
4094    pub template: Option<InstancePoolTemplateRequestInput>,
4095}
4096
4097pub type UpdateInstancePoolBody = InstancePoolUpdateRequestInput;
4098
4099pub type UpdateInstancePoolResponse = InstancePoolResponse;
4100
4101#[derive(Clone, Debug, serde::Serialize, serde::Deserialize)]
4102pub struct InstancePoolMemberProtectionRequestInput {
4103    /// Protect this member from manual and automatic scale-in. Remove protection before selecting it for scale-in. Cannot change a retiring member. Explicit refresh, failed-instance replacement, instance deletion and pool deletion are unaffected. Replacement instances start unprotected.
4104    #[serde(rename = "scale_in_protected")]
4105    pub scale_in_protected: bool,
4106}
4107impl InstancePoolMemberProtectionRequestInput {
4108    /// Set the required fields; optional fields start omitted.
4109    #[allow(clippy::too_many_arguments)]
4110    pub fn new(scale_in_protected: bool) -> Self {
4111        Self { scale_in_protected }
4112    }
4113}
4114
4115pub type UpdateInstancePoolMemberProtectionBody = InstancePoolMemberProtectionRequestInput;
4116
4117pub type UpdateInstancePoolMemberProtectionResponse = InstancePoolResponse;
4118
4119#[derive(Clone, Debug, serde::Serialize, serde::Deserialize)]
4120pub struct UpdateInstanceVolumeAttachmentRequest {
4121    #[serde(rename = "delete_on_termination")]
4122    pub delete_on_termination: bool,
4123}
4124impl UpdateInstanceVolumeAttachmentRequest {
4125    /// Set the required fields; optional fields start omitted.
4126    #[allow(clippy::too_many_arguments)]
4127    pub fn new(delete_on_termination: bool) -> Self {
4128        Self {
4129            delete_on_termination,
4130        }
4131    }
4132}
4133
4134pub type UpdateInstanceVolumeAttachmentBody = UpdateInstanceVolumeAttachmentRequest;