Skip to main content

oci_rust_sdk/core/models/
capacity_config.rs

1use serde::{Deserialize, Serialize};
2
3#[allow(unused_imports)]
4use super::*;
5/// Specifies the capacity configs that the Dedicated Virtual Machine Host (DVMH) Shape could support.
6#[derive(Debug, Clone, Serialize, Deserialize)]
7#[serde(rename_all = "camelCase")]
8pub struct CapacityConfig {
9    /// The name of each capacity config.
10    #[serde(skip_serializing_if = "Option::is_none")]
11    pub capacity_config_name: Option<String>,
12
13    #[serde(skip_serializing_if = "Option::is_none")]
14    pub supported_capabilities: Option<SupportedCapabilities>,
15
16    /// Whether this capacity config is the default config.
17    #[serde(skip_serializing_if = "Option::is_none")]
18    pub is_default: Option<bool>,
19
20    /// A list of total CPU and memory per capacity bucket.
21    #[serde(skip_serializing_if = "Option::is_none")]
22    pub capacity_bins: Option<Vec<CapacityBinPreview>>,
23}
24
25impl CapacityConfig {
26    /// Create a new CapacityConfig
27    pub fn new() -> Self {
28        Self {
29            capacity_config_name: None,
30
31            supported_capabilities: None,
32
33            is_default: None,
34
35            capacity_bins: None,
36        }
37    }
38
39    /// Set capacity_config_name
40    pub fn set_capacity_config_name(mut self, value: Option<String>) -> Self {
41        self.capacity_config_name = value;
42        self
43    }
44
45    /// Set supported_capabilities
46    pub fn set_supported_capabilities(mut self, value: Option<SupportedCapabilities>) -> Self {
47        self.supported_capabilities = value;
48        self
49    }
50
51    /// Set is_default
52    pub fn set_is_default(mut self, value: Option<bool>) -> Self {
53        self.is_default = value;
54        self
55    }
56
57    /// Set capacity_bins
58    pub fn set_capacity_bins(mut self, value: Option<Vec<CapacityBinPreview>>) -> Self {
59        self.capacity_bins = value;
60        self
61    }
62
63    /// Set capacity_config_name (unwraps Option)
64    pub fn with_capacity_config_name(mut self, value: impl Into<String>) -> Self {
65        self.capacity_config_name = Some(value.into());
66        self
67    }
68
69    /// Set supported_capabilities (unwraps Option)
70    pub fn with_supported_capabilities(mut self, value: SupportedCapabilities) -> Self {
71        self.supported_capabilities = Some(value);
72        self
73    }
74
75    /// Set is_default (unwraps Option)
76    pub fn with_is_default(mut self, value: bool) -> Self {
77        self.is_default = Some(value);
78        self
79    }
80
81    /// Set capacity_bins (unwraps Option)
82    pub fn with_capacity_bins(mut self, value: Vec<CapacityBinPreview>) -> Self {
83        self.capacity_bins = Some(value);
84        self
85    }
86}
87
88impl Default for CapacityConfig {
89    fn default() -> Self {
90        Self::new()
91    }
92}