Skip to main content

oci_rust_sdk/core/models/
instance_shape_config.rs

1use serde::{Deserialize, Serialize};
2
3#[allow(unused_imports)]
4use super::*;
5/// The shape configuration for an instance. The shape configuration determines the resources allocated to an instance.
6#[derive(Debug, Clone, Serialize, Deserialize)]
7#[serde(rename_all = "camelCase")]
8pub struct InstanceShapeConfig {
9    /// The total number of OCPUs available to the instance. Note: Numbers greater than Number.MAX_SAFE_INTEGER will result in rounding issues.
10    #[serde(skip_serializing_if = "Option::is_none")]
11    pub ocpus: Option<f64>,
12
13    /// The total amount of memory available to the instance, in gigabytes. Note: Numbers greater than Number.MAX_SAFE_INTEGER will result in rounding issues.
14    #[serde(skip_serializing_if = "Option::is_none")]
15    pub memory_in_gbs: Option<f64>,
16
17    /// The baseline OCPU utilization for a subcore burstable VM instance. Leave this attribute blank for a non-burstable instance, or explicitly specify non-burstable with {@code BASELINE_1_1}. <p> The following values are supported: - {@code BASELINE_1_8} - baseline usage is 1/8 of an OCPU. - {@code BASELINE_1_2} - baseline usage is 1/2 of an OCPU. - {@code BASELINE_1_1} - baseline usage is the entire OCPU. This represents a non-burstable instance.
18    #[serde(skip_serializing_if = "Option::is_none")]
19    pub baseline_ocpu_utilization: Option<InstanceShapeConfigBaselineOcpuUtilization>,
20
21    /// A short description of the instance's processor (CPU).
22    #[serde(skip_serializing_if = "Option::is_none")]
23    pub processor_description: Option<String>,
24
25    /// The networking bandwidth available to the instance, in gigabits per second. Note: Numbers greater than Number.MAX_SAFE_INTEGER will result in rounding issues.
26    #[serde(skip_serializing_if = "Option::is_none")]
27    pub networking_bandwidth_in_gbps: Option<f64>,
28
29    /// The maximum number of VNIC attachments for the instance. Note: Numbers greater than Number.MAX_SAFE_INTEGER will result in rounding issues.
30    #[serde(skip_serializing_if = "Option::is_none")]
31    pub max_vnic_attachments: Option<f64>,
32
33    /// The number of GPUs available to the instance. Note: Numbers greater than Number.MAX_SAFE_INTEGER will result in rounding issues.
34    #[serde(skip_serializing_if = "Option::is_none")]
35    pub gpus: Option<f64>,
36
37    /// A short description of the instance's graphics processing unit (GPU). <p> If the instance does not have any GPUs, this field is {@code null}.
38    #[serde(skip_serializing_if = "Option::is_none")]
39    pub gpu_description: Option<String>,
40
41    /// The number of local disks available to the instance. Note: Numbers greater than Number.MAX_SAFE_INTEGER will result in rounding issues.
42    #[serde(skip_serializing_if = "Option::is_none")]
43    pub local_disks: Option<f64>,
44
45    /// The aggregate size of all local disks, in gigabytes. <p> If the instance does not have any local disks, this field is {@code null}. Note: Numbers greater than Number.MAX_SAFE_INTEGER will result in rounding issues.
46    #[serde(skip_serializing_if = "Option::is_none")]
47    pub local_disks_total_size_in_gbs: Option<f64>,
48
49    /// A short description of the local disks available to this instance. <p> If the instance does not have any local disks, this field is {@code null}.
50    #[serde(skip_serializing_if = "Option::is_none")]
51    pub local_disk_description: Option<String>,
52
53    /// The total number of VCPUs available to the instance. This can be used instead of OCPUs, in which case the actual number of OCPUs will be calculated based on this value and the actual hardware. This must be a multiple of 2. Note: Numbers greater than Number.MAX_SAFE_INTEGER will result in rounding issues.
54    #[serde(skip_serializing_if = "Option::is_none")]
55    pub vcpus: Option<f64>,
56
57    /// This field is reserved for internal use.
58    #[serde(skip_serializing_if = "Option::is_none")]
59    pub resource_management: Option<InstanceShapeConfigResourceManagement>,
60}
61
62impl InstanceShapeConfig {
63    /// Create a new InstanceShapeConfig
64    pub fn new() -> Self {
65        Self {
66            ocpus: None,
67
68            memory_in_gbs: None,
69
70            baseline_ocpu_utilization: None,
71
72            processor_description: None,
73
74            networking_bandwidth_in_gbps: None,
75
76            max_vnic_attachments: None,
77
78            gpus: None,
79
80            gpu_description: None,
81
82            local_disks: None,
83
84            local_disks_total_size_in_gbs: None,
85
86            local_disk_description: None,
87
88            vcpus: None,
89
90            resource_management: None,
91        }
92    }
93
94    /// Set ocpus
95    pub fn set_ocpus(mut self, value: Option<f64>) -> Self {
96        self.ocpus = value;
97        self
98    }
99
100    /// Set memory_in_gbs
101    pub fn set_memory_in_gbs(mut self, value: Option<f64>) -> Self {
102        self.memory_in_gbs = value;
103        self
104    }
105
106    /// Set baseline_ocpu_utilization
107    pub fn set_baseline_ocpu_utilization(
108        mut self,
109        value: Option<InstanceShapeConfigBaselineOcpuUtilization>,
110    ) -> Self {
111        self.baseline_ocpu_utilization = value;
112        self
113    }
114
115    /// Set processor_description
116    pub fn set_processor_description(mut self, value: Option<String>) -> Self {
117        self.processor_description = value;
118        self
119    }
120
121    /// Set networking_bandwidth_in_gbps
122    pub fn set_networking_bandwidth_in_gbps(mut self, value: Option<f64>) -> Self {
123        self.networking_bandwidth_in_gbps = value;
124        self
125    }
126
127    /// Set max_vnic_attachments
128    pub fn set_max_vnic_attachments(mut self, value: Option<f64>) -> Self {
129        self.max_vnic_attachments = value;
130        self
131    }
132
133    /// Set gpus
134    pub fn set_gpus(mut self, value: Option<f64>) -> Self {
135        self.gpus = value;
136        self
137    }
138
139    /// Set gpu_description
140    pub fn set_gpu_description(mut self, value: Option<String>) -> Self {
141        self.gpu_description = value;
142        self
143    }
144
145    /// Set local_disks
146    pub fn set_local_disks(mut self, value: Option<f64>) -> Self {
147        self.local_disks = value;
148        self
149    }
150
151    /// Set local_disks_total_size_in_gbs
152    pub fn set_local_disks_total_size_in_gbs(mut self, value: Option<f64>) -> Self {
153        self.local_disks_total_size_in_gbs = value;
154        self
155    }
156
157    /// Set local_disk_description
158    pub fn set_local_disk_description(mut self, value: Option<String>) -> Self {
159        self.local_disk_description = value;
160        self
161    }
162
163    /// Set vcpus
164    pub fn set_vcpus(mut self, value: Option<f64>) -> Self {
165        self.vcpus = value;
166        self
167    }
168
169    /// Set resource_management
170    pub fn set_resource_management(
171        mut self,
172        value: Option<InstanceShapeConfigResourceManagement>,
173    ) -> Self {
174        self.resource_management = value;
175        self
176    }
177
178    /// Set ocpus (unwraps Option)
179    pub fn with_ocpus(mut self, value: f64) -> Self {
180        self.ocpus = Some(value);
181        self
182    }
183
184    /// Set memory_in_gbs (unwraps Option)
185    pub fn with_memory_in_gbs(mut self, value: f64) -> Self {
186        self.memory_in_gbs = Some(value);
187        self
188    }
189
190    /// Set baseline_ocpu_utilization (unwraps Option)
191    pub fn with_baseline_ocpu_utilization(
192        mut self,
193        value: InstanceShapeConfigBaselineOcpuUtilization,
194    ) -> Self {
195        self.baseline_ocpu_utilization = Some(value);
196        self
197    }
198
199    /// Set processor_description (unwraps Option)
200    pub fn with_processor_description(mut self, value: impl Into<String>) -> Self {
201        self.processor_description = Some(value.into());
202        self
203    }
204
205    /// Set networking_bandwidth_in_gbps (unwraps Option)
206    pub fn with_networking_bandwidth_in_gbps(mut self, value: f64) -> Self {
207        self.networking_bandwidth_in_gbps = Some(value);
208        self
209    }
210
211    /// Set max_vnic_attachments (unwraps Option)
212    pub fn with_max_vnic_attachments(mut self, value: f64) -> Self {
213        self.max_vnic_attachments = Some(value);
214        self
215    }
216
217    /// Set gpus (unwraps Option)
218    pub fn with_gpus(mut self, value: f64) -> Self {
219        self.gpus = Some(value);
220        self
221    }
222
223    /// Set gpu_description (unwraps Option)
224    pub fn with_gpu_description(mut self, value: impl Into<String>) -> Self {
225        self.gpu_description = Some(value.into());
226        self
227    }
228
229    /// Set local_disks (unwraps Option)
230    pub fn with_local_disks(mut self, value: f64) -> Self {
231        self.local_disks = Some(value);
232        self
233    }
234
235    /// Set local_disks_total_size_in_gbs (unwraps Option)
236    pub fn with_local_disks_total_size_in_gbs(mut self, value: f64) -> Self {
237        self.local_disks_total_size_in_gbs = Some(value);
238        self
239    }
240
241    /// Set local_disk_description (unwraps Option)
242    pub fn with_local_disk_description(mut self, value: impl Into<String>) -> Self {
243        self.local_disk_description = Some(value.into());
244        self
245    }
246
247    /// Set vcpus (unwraps Option)
248    pub fn with_vcpus(mut self, value: f64) -> Self {
249        self.vcpus = Some(value);
250        self
251    }
252
253    /// Set resource_management (unwraps Option)
254    pub fn with_resource_management(
255        mut self,
256        value: InstanceShapeConfigResourceManagement,
257    ) -> Self {
258        self.resource_management = Some(value);
259        self
260    }
261}
262
263impl Default for InstanceShapeConfig {
264    fn default() -> Self {
265        Self::new()
266    }
267}