Skip to main content

oci_rust_sdk/core/models/
instance_configuration_summary.rs

1use chrono::{DateTime, Utc};
2use serde::{Deserialize, Serialize};
3use std::collections::HashMap;
4
5#[allow(unused_imports)]
6use super::*;
7/// Summary information for an instance configuration.
8#[derive(Debug, Clone, Serialize, Deserialize)]
9#[serde(rename_all = "camelCase")]
10pub struct InstanceConfigurationSummary {
11    /// The OCID of the compartment containing the instance configuration.
12    pub compartment_id: String,
13
14    /// The OCID of the instance configuration.
15    pub id: String,
16
17    /// The date and time the instance configuration was created, in the format defined by [RFC3339](https://tools.ietf.org/html/rfc3339). Example: {@code 2016-08-25T21:10:29.600Z}
18    pub time_created: DateTime<Utc>,
19
20    /// A user-friendly name. Does not have to be unique, and it's changeable. Avoid entering confidential information.
21    #[serde(skip_serializing_if = "Option::is_none")]
22    pub display_name: Option<String>,
23
24    /// Defined tags for this resource. Each key is predefined and scoped to a namespace. For more information, see [Resource Tags](https://docs.oracle.com/iaas/Content/General/Concepts/resourcetags.htm). <p> Example: {@code {\"Operations\": {\"CostCenter\": \"42\"}}}
25    #[serde(skip_serializing_if = "Option::is_none")]
26    pub defined_tags: Option<HashMap<String, HashMap<String, serde_json::Value>>>,
27
28    /// Free-form tags for this resource. Each tag is a simple key-value pair with no predefined name, type, or namespace. For more information, see [Resource Tags](https://docs.oracle.com/iaas/Content/General/Concepts/resourcetags.htm). <p> Example: {@code {\"Department\": \"Finance\"}}
29    #[serde(skip_serializing_if = "Option::is_none")]
30    pub freeform_tags: Option<HashMap<String, String>>,
31}
32
33/// Required fields for InstanceConfigurationSummary
34pub struct InstanceConfigurationSummaryRequired {
35    /// The OCID of the compartment containing the instance configuration.
36    pub compartment_id: String,
37
38    /// The OCID of the instance configuration.
39    pub id: String,
40
41    /// The date and time the instance configuration was created, in the format defined by [RFC3339](https://tools.ietf.org/html/rfc3339). Example: {@code 2016-08-25T21:10:29.600Z}
42    pub time_created: DateTime<Utc>,
43}
44
45impl InstanceConfigurationSummary {
46    /// Create a new InstanceConfigurationSummary with required fields
47    pub fn new(required: InstanceConfigurationSummaryRequired) -> Self {
48        Self {
49            compartment_id: required.compartment_id,
50
51            id: required.id,
52
53            time_created: required.time_created,
54
55            display_name: None,
56
57            defined_tags: None,
58
59            freeform_tags: None,
60        }
61    }
62
63    /// Set compartment_id
64    pub fn set_compartment_id(mut self, value: String) -> Self {
65        self.compartment_id = value;
66        self
67    }
68
69    /// Set display_name
70    pub fn set_display_name(mut self, value: Option<String>) -> Self {
71        self.display_name = value;
72        self
73    }
74
75    /// Set id
76    pub fn set_id(mut self, value: String) -> Self {
77        self.id = value;
78        self
79    }
80
81    /// Set time_created
82    pub fn set_time_created(mut self, value: DateTime<Utc>) -> Self {
83        self.time_created = value;
84        self
85    }
86
87    /// Set defined_tags
88    pub fn set_defined_tags(
89        mut self,
90        value: Option<HashMap<String, HashMap<String, serde_json::Value>>>,
91    ) -> Self {
92        self.defined_tags = value;
93        self
94    }
95
96    /// Set freeform_tags
97    pub fn set_freeform_tags(mut self, value: Option<HashMap<String, String>>) -> Self {
98        self.freeform_tags = value;
99        self
100    }
101
102    /// Set display_name (unwraps Option)
103    pub fn with_display_name(mut self, value: impl Into<String>) -> Self {
104        self.display_name = Some(value.into());
105        self
106    }
107
108    /// Set defined_tags (unwraps Option)
109    pub fn with_defined_tags(
110        mut self,
111        value: HashMap<String, HashMap<String, serde_json::Value>>,
112    ) -> Self {
113        self.defined_tags = Some(value);
114        self
115    }
116
117    /// Set freeform_tags (unwraps Option)
118    pub fn with_freeform_tags(mut self, value: HashMap<String, String>) -> Self {
119        self.freeform_tags = Some(value);
120        self
121    }
122}