Skip to main content

oci_rust_sdk/core/models/
shape_ocpu_options.rs

1use serde::{Deserialize, Serialize};
2
3#[allow(unused_imports)]
4use super::*;
5/// For a flexible shape, the number of OCPUs available for instances that use this shape. <p> If this field is null, then this shape has a fixed number of OCPUs equal to {@code ocpus}.
6#[derive(Debug, Clone, Serialize, Deserialize)]
7#[serde(rename_all = "camelCase")]
8pub struct ShapeOcpuOptions {
9    /// The minimum number of OCPUs. Note: Numbers greater than Number.MAX_SAFE_INTEGER will result in rounding issues.
10    #[serde(skip_serializing_if = "Option::is_none")]
11    pub min: Option<i64>,
12
13    /// The maximum number of OCPUs. Note: Numbers greater than Number.MAX_SAFE_INTEGER will result in rounding issues.
14    #[serde(skip_serializing_if = "Option::is_none")]
15    pub max: Option<i64>,
16
17    /// The maximum number of cores available per NUMA node. Note: Numbers greater than Number.MAX_SAFE_INTEGER will result in rounding issues.
18    #[serde(skip_serializing_if = "Option::is_none")]
19    pub max_per_numa_node: Option<i64>,
20}
21
22impl ShapeOcpuOptions {
23    /// Create a new ShapeOcpuOptions
24    pub fn new() -> Self {
25        Self {
26            min: None,
27
28            max: None,
29
30            max_per_numa_node: None,
31        }
32    }
33
34    /// Set min
35    pub fn set_min(mut self, value: Option<i64>) -> Self {
36        self.min = value;
37        self
38    }
39
40    /// Set max
41    pub fn set_max(mut self, value: Option<i64>) -> Self {
42        self.max = value;
43        self
44    }
45
46    /// Set max_per_numa_node
47    pub fn set_max_per_numa_node(mut self, value: Option<i64>) -> Self {
48        self.max_per_numa_node = value;
49        self
50    }
51
52    /// Set min (unwraps Option)
53    pub fn with_min(mut self, value: i64) -> Self {
54        self.min = Some(value);
55        self
56    }
57
58    /// Set max (unwraps Option)
59    pub fn with_max(mut self, value: i64) -> Self {
60        self.max = Some(value);
61        self
62    }
63
64    /// Set max_per_numa_node (unwraps Option)
65    pub fn with_max_per_numa_node(mut self, value: i64) -> Self {
66        self.max_per_numa_node = Some(value);
67        self
68    }
69}
70
71impl Default for ShapeOcpuOptions {
72    fn default() -> Self {
73        Self::new()
74    }
75}