Skip to main content

oci_rust_sdk/core/models/
dedicated_capacity_source.rs

1use serde::{Deserialize, Serialize};
2
3#[allow(unused_imports)]
4use super::*;
5/// A capacity source of bare metal hosts that is dedicated to a user.
6#[derive(Debug, Clone, Serialize, Deserialize)]
7#[serde(rename_all = "camelCase")]
8pub struct DedicatedCapacitySource {
9    pub capacity_type: String,
10
11    /// The [OCID](https://docs.oracle.com/iaas/Content/General/Concepts/identifiers.htm) of the compartment of this capacity source.
12    #[serde(skip_serializing_if = "Option::is_none")]
13    pub compartment_id: Option<String>,
14}
15
16/// Required fields for DedicatedCapacitySource
17pub struct DedicatedCapacitySourceRequired {
18    pub capacity_type: String,
19}
20
21impl DedicatedCapacitySource {
22    /// Create a new DedicatedCapacitySource with required fields
23    pub fn new(required: DedicatedCapacitySourceRequired) -> Self {
24        Self {
25            capacity_type: required.capacity_type,
26
27            compartment_id: None,
28        }
29    }
30
31    /// Set compartment_id
32    pub fn set_compartment_id(mut self, value: Option<String>) -> Self {
33        self.compartment_id = value;
34        self
35    }
36
37    /// Set capacity_type
38    pub fn set_capacity_type(mut self, value: String) -> Self {
39        self.capacity_type = value;
40        self
41    }
42
43    /// Set compartment_id (unwraps Option)
44    pub fn with_compartment_id(mut self, value: impl Into<String>) -> Self {
45        self.compartment_id = Some(value.into());
46        self
47    }
48}