oci_rust_sdk/core/models/
instance_configuration.rs1use chrono::{DateTime, Utc};
2use serde::{Deserialize, Serialize};
3use std::collections::HashMap;
4
5#[allow(unused_imports)]
6use super::*;
7#[derive(Debug, Clone, Serialize, Deserialize)]
9#[serde(rename_all = "camelCase")]
10pub struct InstanceConfiguration {
11 pub compartment_id: String,
13
14 pub id: String,
16
17 pub time_created: DateTime<Utc>,
19
20 #[serde(skip_serializing_if = "Option::is_none")]
22 pub defined_tags: Option<HashMap<String, HashMap<String, serde_json::Value>>>,
23
24 #[serde(skip_serializing_if = "Option::is_none")]
26 pub display_name: Option<String>,
27
28 #[serde(skip_serializing_if = "Option::is_none")]
30 pub freeform_tags: Option<HashMap<String, String>>,
31
32 #[serde(skip_serializing_if = "Option::is_none")]
33 pub instance_details: Option<ComputeInstanceOptions>,
34
35 #[serde(skip_serializing_if = "Option::is_none")]
37 pub deferred_fields: Option<Vec<String>>,
38}
39
40pub struct InstanceConfigurationRequired {
42 pub compartment_id: String,
44
45 pub id: String,
47
48 pub time_created: DateTime<Utc>,
50}
51
52impl InstanceConfiguration {
53 pub fn new(required: InstanceConfigurationRequired) -> Self {
55 Self {
56 compartment_id: required.compartment_id,
57
58 id: required.id,
59
60 time_created: required.time_created,
61
62 defined_tags: None,
63
64 display_name: None,
65
66 freeform_tags: None,
67
68 instance_details: None,
69
70 deferred_fields: None,
71 }
72 }
73
74 pub fn set_compartment_id(mut self, value: String) -> Self {
76 self.compartment_id = value;
77 self
78 }
79
80 pub fn set_defined_tags(
82 mut self,
83 value: Option<HashMap<String, HashMap<String, serde_json::Value>>>,
84 ) -> Self {
85 self.defined_tags = value;
86 self
87 }
88
89 pub fn set_display_name(mut self, value: Option<String>) -> Self {
91 self.display_name = value;
92 self
93 }
94
95 pub fn set_freeform_tags(mut self, value: Option<HashMap<String, String>>) -> Self {
97 self.freeform_tags = value;
98 self
99 }
100
101 pub fn set_id(mut self, value: String) -> Self {
103 self.id = value;
104 self
105 }
106
107 pub fn set_instance_details(mut self, value: Option<ComputeInstanceOptions>) -> Self {
109 self.instance_details = value;
110 self
111 }
112
113 pub fn set_deferred_fields(mut self, value: Option<Vec<String>>) -> Self {
115 self.deferred_fields = value;
116 self
117 }
118
119 pub fn set_time_created(mut self, value: DateTime<Utc>) -> Self {
121 self.time_created = value;
122 self
123 }
124
125 pub fn with_defined_tags(
127 mut self,
128 value: HashMap<String, HashMap<String, serde_json::Value>>,
129 ) -> Self {
130 self.defined_tags = Some(value);
131 self
132 }
133
134 pub fn with_display_name(mut self, value: impl Into<String>) -> Self {
136 self.display_name = Some(value.into());
137 self
138 }
139
140 pub fn with_freeform_tags(mut self, value: HashMap<String, String>) -> Self {
142 self.freeform_tags = Some(value);
143 self
144 }
145
146 pub fn with_instance_details(mut self, value: ComputeInstanceOptions) -> Self {
148 self.instance_details = Some(value);
149 self
150 }
151
152 pub fn with_deferred_fields(mut self, value: Vec<String>) -> Self {
154 self.deferred_fields = Some(value);
155 self
156 }
157}