Skip to main content

oci_rust_sdk/core/models/
shape.rs

1use serde::{Deserialize, Serialize};
2
3#[allow(unused_imports)]
4use super::*;
5/// A compute instance shape that can be used in {@link #launchInstance(LaunchInstanceRequest) launchInstance}. For more information, see [Overview of the Compute Service](https://docs.oracle.com/iaas/Content/Compute/Concepts/computeoverview.htm) and [Compute Shapes](https://docs.oracle.com/iaas/Content/Compute/References/computeshapes.htm).
6#[derive(Debug, Clone, Serialize, Deserialize)]
7#[serde(rename_all = "camelCase")]
8pub struct Shape {
9    /// The name of the shape. You can enumerate all available shapes by calling {@link #listShapes(ListShapesRequest) listShapes}.
10    pub shape: String,
11
12    /// For a subcore burstable VM, the supported baseline OCPU utilization for instances that use this shape.
13    #[serde(skip_serializing_if = "Option::is_none")]
14    pub baseline_ocpu_utilizations: Option<Vec<ShapeBaselineOcpuUtilizations>>,
15
16    /// For a subcore burstable VM, the minimum total baseline OCPUs required. The total baseline OCPUs is equal to baselineOcpuUtilization chosen multiplied by the number of OCPUs chosen. Note: Numbers greater than Number.MAX_SAFE_INTEGER will result in rounding issues.
17    #[serde(skip_serializing_if = "Option::is_none")]
18    pub min_total_baseline_ocpus_required: Option<i64>,
19
20    /// A short description of the shape's processor (CPU).
21    #[serde(skip_serializing_if = "Option::is_none")]
22    pub processor_description: Option<String>,
23
24    /// The default number of OCPUs available for this shape. Note: Numbers greater than Number.MAX_SAFE_INTEGER will result in rounding issues.
25    #[serde(skip_serializing_if = "Option::is_none")]
26    pub ocpus: Option<i64>,
27
28    /// The default amount of memory available for this shape, in gigabytes. Note: Numbers greater than Number.MAX_SAFE_INTEGER will result in rounding issues.
29    #[serde(skip_serializing_if = "Option::is_none")]
30    pub memory_in_gbs: Option<i64>,
31
32    /// The number of physical network interface card (NIC) ports available for this shape. Note: Numbers greater than Number.MAX_SAFE_INTEGER will result in rounding issues.
33    #[serde(skip_serializing_if = "Option::is_none")]
34    pub network_ports: Option<i64>,
35
36    /// The networking bandwidth available for this shape, in gigabits per second. Note: Numbers greater than Number.MAX_SAFE_INTEGER will result in rounding issues.
37    #[serde(skip_serializing_if = "Option::is_none")]
38    pub networking_bandwidth_in_gbps: Option<i64>,
39
40    /// The maximum number of VNIC attachments available for this shape. Note: Numbers greater than Number.MAX_SAFE_INTEGER will result in rounding issues.
41    #[serde(skip_serializing_if = "Option::is_none")]
42    pub max_vnic_attachments: Option<i64>,
43
44    /// The number of GPUs available for this shape. Note: Numbers greater than Number.MAX_SAFE_INTEGER will result in rounding issues.
45    #[serde(skip_serializing_if = "Option::is_none")]
46    pub gpus: Option<i64>,
47
48    /// A short description of the graphics processing unit (GPU) available for this shape. <p> If the shape does not have any GPUs, this field is {@code null}.
49    #[serde(skip_serializing_if = "Option::is_none")]
50    pub gpu_description: Option<String>,
51
52    /// The number of local disks available for this shape. Note: Numbers greater than Number.MAX_SAFE_INTEGER will result in rounding issues.
53    #[serde(skip_serializing_if = "Option::is_none")]
54    pub local_disks: Option<i64>,
55
56    /// The aggregate size of the local disks available for this shape, in gigabytes. <p> If the shape does not have any local disks, this field is {@code null}. Note: Numbers greater than Number.MAX_SAFE_INTEGER will result in rounding issues.
57    #[serde(skip_serializing_if = "Option::is_none")]
58    pub local_disks_total_size_in_gbs: Option<i64>,
59
60    /// A short description of the local disks available for this shape. <p> If the shape does not have any local disks, this field is {@code null}.
61    #[serde(skip_serializing_if = "Option::is_none")]
62    pub local_disk_description: Option<String>,
63
64    /// The number of networking ports available for the remote direct memory access (RDMA) network between nodes in a high performance computing (HPC) cluster network. If the shape does not support cluster networks, this value is {@code 0}. Note: Numbers greater than Number.MAX_SAFE_INTEGER will result in rounding issues.
65    #[serde(skip_serializing_if = "Option::is_none")]
66    pub rdma_ports: Option<i64>,
67
68    /// The networking bandwidth available for the remote direct memory access (RDMA) network for this shape, in gigabits per second. Note: Numbers greater than Number.MAX_SAFE_INTEGER will result in rounding issues.
69    #[serde(skip_serializing_if = "Option::is_none")]
70    pub rdma_bandwidth_in_gbps: Option<i64>,
71
72    /// Whether live migration is supported for this shape.
73    #[serde(skip_serializing_if = "Option::is_none")]
74    pub is_live_migration_supported: Option<bool>,
75
76    #[serde(skip_serializing_if = "Option::is_none")]
77    pub ocpu_options: Option<ShapeOcpuOptions>,
78
79    #[serde(skip_serializing_if = "Option::is_none")]
80    pub memory_options: Option<ShapeMemoryOptions>,
81
82    #[serde(skip_serializing_if = "Option::is_none")]
83    pub networking_bandwidth_options: Option<ShapeNetworkingBandwidthOptions>,
84
85    #[serde(skip_serializing_if = "Option::is_none")]
86    pub max_vnic_attachment_options: Option<ShapeMaxVnicAttachmentOptions>,
87
88    #[serde(skip_serializing_if = "Option::is_none")]
89    pub platform_config_options: Option<ShapePlatformConfigOptions>,
90
91    /// Whether billing continues when the instances that use this shape are in the stopped state.
92    #[serde(skip_serializing_if = "Option::is_none")]
93    pub is_billed_for_stopped_instance: Option<bool>,
94
95    /// How instances that use this shape are charged.
96    #[serde(skip_serializing_if = "Option::is_none")]
97    pub billing_type: Option<ShapeBillingType>,
98
99    /// The list of of compartment quotas for the shape.
100    #[serde(skip_serializing_if = "Option::is_none")]
101    pub quota_names: Option<Vec<String>>,
102
103    /// Whether the shape supports creating subcore or burstable instances. A [burstable instance](https://docs.oracle.com/iaas/Content/Compute/References/burstable-instances.htm) is a virtual machine (VM) instance that provides a baseline level of CPU performance with the ability to burst to a higher level to support occasional spikes in usage.
104    #[serde(skip_serializing_if = "Option::is_none")]
105    pub is_subcore: Option<bool>,
106
107    /// Whether the shape supports creating flexible instances. A [flexible shape](https://docs.oracle.com/iaas/Content/Compute/References/computeshapes.htm#flexible) is a shape that lets you customize the number of OCPUs and the amount of memory when launching or resizing your instance.
108    #[serde(skip_serializing_if = "Option::is_none")]
109    pub is_flexible: Option<bool>,
110
111    /// The list of compatible shapes that this shape can be changed to. For more information, see [Changing the Shape of an Instance](https://docs.oracle.com/iaas/Content/Compute/Tasks/resizinginstances.htm).
112    #[serde(skip_serializing_if = "Option::is_none")]
113    pub resize_compatible_shapes: Option<Vec<String>>,
114
115    /// The list of shapes and shape details (if applicable) that Oracle recommends that you use as an alternative to the current shape.
116    #[serde(skip_serializing_if = "Option::is_none")]
117    pub recommended_alternatives: Option<Vec<ShapeAlternativeObject>>,
118}
119
120/// Required fields for Shape
121pub struct ShapeRequired {
122    /// The name of the shape. You can enumerate all available shapes by calling {@link #listShapes(ListShapesRequest) listShapes}.
123    pub shape: String,
124}
125
126impl Shape {
127    /// Create a new Shape with required fields
128    pub fn new(required: ShapeRequired) -> Self {
129        Self {
130            shape: required.shape,
131
132            baseline_ocpu_utilizations: None,
133
134            min_total_baseline_ocpus_required: None,
135
136            processor_description: None,
137
138            ocpus: None,
139
140            memory_in_gbs: None,
141
142            network_ports: None,
143
144            networking_bandwidth_in_gbps: None,
145
146            max_vnic_attachments: None,
147
148            gpus: None,
149
150            gpu_description: None,
151
152            local_disks: None,
153
154            local_disks_total_size_in_gbs: None,
155
156            local_disk_description: None,
157
158            rdma_ports: None,
159
160            rdma_bandwidth_in_gbps: None,
161
162            is_live_migration_supported: None,
163
164            ocpu_options: None,
165
166            memory_options: None,
167
168            networking_bandwidth_options: None,
169
170            max_vnic_attachment_options: None,
171
172            platform_config_options: None,
173
174            is_billed_for_stopped_instance: None,
175
176            billing_type: None,
177
178            quota_names: None,
179
180            is_subcore: None,
181
182            is_flexible: None,
183
184            resize_compatible_shapes: None,
185
186            recommended_alternatives: None,
187        }
188    }
189
190    /// Set baseline_ocpu_utilizations
191    pub fn set_baseline_ocpu_utilizations(
192        mut self,
193        value: Option<Vec<ShapeBaselineOcpuUtilizations>>,
194    ) -> Self {
195        self.baseline_ocpu_utilizations = value;
196        self
197    }
198
199    /// Set min_total_baseline_ocpus_required
200    pub fn set_min_total_baseline_ocpus_required(mut self, value: Option<i64>) -> Self {
201        self.min_total_baseline_ocpus_required = value;
202        self
203    }
204
205    /// Set shape
206    pub fn set_shape(mut self, value: String) -> Self {
207        self.shape = value;
208        self
209    }
210
211    /// Set processor_description
212    pub fn set_processor_description(mut self, value: Option<String>) -> Self {
213        self.processor_description = value;
214        self
215    }
216
217    /// Set ocpus
218    pub fn set_ocpus(mut self, value: Option<i64>) -> Self {
219        self.ocpus = value;
220        self
221    }
222
223    /// Set memory_in_gbs
224    pub fn set_memory_in_gbs(mut self, value: Option<i64>) -> Self {
225        self.memory_in_gbs = value;
226        self
227    }
228
229    /// Set network_ports
230    pub fn set_network_ports(mut self, value: Option<i64>) -> Self {
231        self.network_ports = value;
232        self
233    }
234
235    /// Set networking_bandwidth_in_gbps
236    pub fn set_networking_bandwidth_in_gbps(mut self, value: Option<i64>) -> Self {
237        self.networking_bandwidth_in_gbps = value;
238        self
239    }
240
241    /// Set max_vnic_attachments
242    pub fn set_max_vnic_attachments(mut self, value: Option<i64>) -> Self {
243        self.max_vnic_attachments = value;
244        self
245    }
246
247    /// Set gpus
248    pub fn set_gpus(mut self, value: Option<i64>) -> Self {
249        self.gpus = value;
250        self
251    }
252
253    /// Set gpu_description
254    pub fn set_gpu_description(mut self, value: Option<String>) -> Self {
255        self.gpu_description = value;
256        self
257    }
258
259    /// Set local_disks
260    pub fn set_local_disks(mut self, value: Option<i64>) -> Self {
261        self.local_disks = value;
262        self
263    }
264
265    /// Set local_disks_total_size_in_gbs
266    pub fn set_local_disks_total_size_in_gbs(mut self, value: Option<i64>) -> Self {
267        self.local_disks_total_size_in_gbs = value;
268        self
269    }
270
271    /// Set local_disk_description
272    pub fn set_local_disk_description(mut self, value: Option<String>) -> Self {
273        self.local_disk_description = value;
274        self
275    }
276
277    /// Set rdma_ports
278    pub fn set_rdma_ports(mut self, value: Option<i64>) -> Self {
279        self.rdma_ports = value;
280        self
281    }
282
283    /// Set rdma_bandwidth_in_gbps
284    pub fn set_rdma_bandwidth_in_gbps(mut self, value: Option<i64>) -> Self {
285        self.rdma_bandwidth_in_gbps = value;
286        self
287    }
288
289    /// Set is_live_migration_supported
290    pub fn set_is_live_migration_supported(mut self, value: Option<bool>) -> Self {
291        self.is_live_migration_supported = value;
292        self
293    }
294
295    /// Set ocpu_options
296    pub fn set_ocpu_options(mut self, value: Option<ShapeOcpuOptions>) -> Self {
297        self.ocpu_options = value;
298        self
299    }
300
301    /// Set memory_options
302    pub fn set_memory_options(mut self, value: Option<ShapeMemoryOptions>) -> Self {
303        self.memory_options = value;
304        self
305    }
306
307    /// Set networking_bandwidth_options
308    pub fn set_networking_bandwidth_options(
309        mut self,
310        value: Option<ShapeNetworkingBandwidthOptions>,
311    ) -> Self {
312        self.networking_bandwidth_options = value;
313        self
314    }
315
316    /// Set max_vnic_attachment_options
317    pub fn set_max_vnic_attachment_options(
318        mut self,
319        value: Option<ShapeMaxVnicAttachmentOptions>,
320    ) -> Self {
321        self.max_vnic_attachment_options = value;
322        self
323    }
324
325    /// Set platform_config_options
326    pub fn set_platform_config_options(
327        mut self,
328        value: Option<ShapePlatformConfigOptions>,
329    ) -> Self {
330        self.platform_config_options = value;
331        self
332    }
333
334    /// Set is_billed_for_stopped_instance
335    pub fn set_is_billed_for_stopped_instance(mut self, value: Option<bool>) -> Self {
336        self.is_billed_for_stopped_instance = value;
337        self
338    }
339
340    /// Set billing_type
341    pub fn set_billing_type(mut self, value: Option<ShapeBillingType>) -> Self {
342        self.billing_type = value;
343        self
344    }
345
346    /// Set quota_names
347    pub fn set_quota_names(mut self, value: Option<Vec<String>>) -> Self {
348        self.quota_names = value;
349        self
350    }
351
352    /// Set is_subcore
353    pub fn set_is_subcore(mut self, value: Option<bool>) -> Self {
354        self.is_subcore = value;
355        self
356    }
357
358    /// Set is_flexible
359    pub fn set_is_flexible(mut self, value: Option<bool>) -> Self {
360        self.is_flexible = value;
361        self
362    }
363
364    /// Set resize_compatible_shapes
365    pub fn set_resize_compatible_shapes(mut self, value: Option<Vec<String>>) -> Self {
366        self.resize_compatible_shapes = value;
367        self
368    }
369
370    /// Set recommended_alternatives
371    pub fn set_recommended_alternatives(
372        mut self,
373        value: Option<Vec<ShapeAlternativeObject>>,
374    ) -> Self {
375        self.recommended_alternatives = value;
376        self
377    }
378
379    /// Set baseline_ocpu_utilizations (unwraps Option)
380    pub fn with_baseline_ocpu_utilizations(
381        mut self,
382        value: Vec<ShapeBaselineOcpuUtilizations>,
383    ) -> Self {
384        self.baseline_ocpu_utilizations = Some(value);
385        self
386    }
387
388    /// Set min_total_baseline_ocpus_required (unwraps Option)
389    pub fn with_min_total_baseline_ocpus_required(mut self, value: i64) -> Self {
390        self.min_total_baseline_ocpus_required = Some(value);
391        self
392    }
393
394    /// Set processor_description (unwraps Option)
395    pub fn with_processor_description(mut self, value: impl Into<String>) -> Self {
396        self.processor_description = Some(value.into());
397        self
398    }
399
400    /// Set ocpus (unwraps Option)
401    pub fn with_ocpus(mut self, value: i64) -> Self {
402        self.ocpus = Some(value);
403        self
404    }
405
406    /// Set memory_in_gbs (unwraps Option)
407    pub fn with_memory_in_gbs(mut self, value: i64) -> Self {
408        self.memory_in_gbs = Some(value);
409        self
410    }
411
412    /// Set network_ports (unwraps Option)
413    pub fn with_network_ports(mut self, value: i64) -> Self {
414        self.network_ports = Some(value);
415        self
416    }
417
418    /// Set networking_bandwidth_in_gbps (unwraps Option)
419    pub fn with_networking_bandwidth_in_gbps(mut self, value: i64) -> Self {
420        self.networking_bandwidth_in_gbps = Some(value);
421        self
422    }
423
424    /// Set max_vnic_attachments (unwraps Option)
425    pub fn with_max_vnic_attachments(mut self, value: i64) -> Self {
426        self.max_vnic_attachments = Some(value);
427        self
428    }
429
430    /// Set gpus (unwraps Option)
431    pub fn with_gpus(mut self, value: i64) -> Self {
432        self.gpus = Some(value);
433        self
434    }
435
436    /// Set gpu_description (unwraps Option)
437    pub fn with_gpu_description(mut self, value: impl Into<String>) -> Self {
438        self.gpu_description = Some(value.into());
439        self
440    }
441
442    /// Set local_disks (unwraps Option)
443    pub fn with_local_disks(mut self, value: i64) -> Self {
444        self.local_disks = Some(value);
445        self
446    }
447
448    /// Set local_disks_total_size_in_gbs (unwraps Option)
449    pub fn with_local_disks_total_size_in_gbs(mut self, value: i64) -> Self {
450        self.local_disks_total_size_in_gbs = Some(value);
451        self
452    }
453
454    /// Set local_disk_description (unwraps Option)
455    pub fn with_local_disk_description(mut self, value: impl Into<String>) -> Self {
456        self.local_disk_description = Some(value.into());
457        self
458    }
459
460    /// Set rdma_ports (unwraps Option)
461    pub fn with_rdma_ports(mut self, value: i64) -> Self {
462        self.rdma_ports = Some(value);
463        self
464    }
465
466    /// Set rdma_bandwidth_in_gbps (unwraps Option)
467    pub fn with_rdma_bandwidth_in_gbps(mut self, value: i64) -> Self {
468        self.rdma_bandwidth_in_gbps = Some(value);
469        self
470    }
471
472    /// Set is_live_migration_supported (unwraps Option)
473    pub fn with_is_live_migration_supported(mut self, value: bool) -> Self {
474        self.is_live_migration_supported = Some(value);
475        self
476    }
477
478    /// Set ocpu_options (unwraps Option)
479    pub fn with_ocpu_options(mut self, value: ShapeOcpuOptions) -> Self {
480        self.ocpu_options = Some(value);
481        self
482    }
483
484    /// Set memory_options (unwraps Option)
485    pub fn with_memory_options(mut self, value: ShapeMemoryOptions) -> Self {
486        self.memory_options = Some(value);
487        self
488    }
489
490    /// Set networking_bandwidth_options (unwraps Option)
491    pub fn with_networking_bandwidth_options(
492        mut self,
493        value: ShapeNetworkingBandwidthOptions,
494    ) -> Self {
495        self.networking_bandwidth_options = Some(value);
496        self
497    }
498
499    /// Set max_vnic_attachment_options (unwraps Option)
500    pub fn with_max_vnic_attachment_options(
501        mut self,
502        value: ShapeMaxVnicAttachmentOptions,
503    ) -> Self {
504        self.max_vnic_attachment_options = Some(value);
505        self
506    }
507
508    /// Set platform_config_options (unwraps Option)
509    pub fn with_platform_config_options(mut self, value: ShapePlatformConfigOptions) -> Self {
510        self.platform_config_options = Some(value);
511        self
512    }
513
514    /// Set is_billed_for_stopped_instance (unwraps Option)
515    pub fn with_is_billed_for_stopped_instance(mut self, value: bool) -> Self {
516        self.is_billed_for_stopped_instance = Some(value);
517        self
518    }
519
520    /// Set billing_type (unwraps Option)
521    pub fn with_billing_type(mut self, value: ShapeBillingType) -> Self {
522        self.billing_type = Some(value);
523        self
524    }
525
526    /// Set quota_names (unwraps Option)
527    pub fn with_quota_names(mut self, value: Vec<String>) -> Self {
528        self.quota_names = Some(value);
529        self
530    }
531
532    /// Set is_subcore (unwraps Option)
533    pub fn with_is_subcore(mut self, value: bool) -> Self {
534        self.is_subcore = Some(value);
535        self
536    }
537
538    /// Set is_flexible (unwraps Option)
539    pub fn with_is_flexible(mut self, value: bool) -> Self {
540        self.is_flexible = Some(value);
541        self
542    }
543
544    /// Set resize_compatible_shapes (unwraps Option)
545    pub fn with_resize_compatible_shapes(mut self, value: Vec<String>) -> Self {
546        self.resize_compatible_shapes = Some(value);
547        self
548    }
549
550    /// Set recommended_alternatives (unwraps Option)
551    pub fn with_recommended_alternatives(mut self, value: Vec<ShapeAlternativeObject>) -> Self {
552        self.recommended_alternatives = Some(value);
553        self
554    }
555}