oci_rust_sdk/core/models/
compute_host.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 ComputeHost {
11 pub availability_domain: String,
13
14 pub compartment_id: String,
16
17 pub id: String,
19
20 pub fault_domain: String,
22
23 pub shape: String,
25
26 pub health: ComputeHostHealth,
28
29 pub lifecycle_state: ComputeHostLifecycleState,
31
32 pub time_created: DateTime<Utc>,
34
35 pub time_updated: DateTime<Utc>,
37
38 #[serde(skip_serializing_if = "Option::is_none")]
40 pub hpc_island_id: Option<String>,
41
42 #[serde(skip_serializing_if = "Option::is_none")]
44 pub compute_host_group_id: Option<String>,
45
46 #[serde(skip_serializing_if = "Option::is_none")]
48 pub configuration_state: Option<ConfigurationState>,
49
50 #[serde(skip_serializing_if = "Option::is_none")]
52 pub time_configuration_check: Option<DateTime<Utc>>,
53
54 #[serde(skip_serializing_if = "Option::is_none")]
55 pub configuration_data: Option<ComputeHostConfigurationData>,
56
57 #[serde(skip_serializing_if = "Option::is_none")]
58 pub recycle_details: Option<RecycleDetails>,
59
60 #[serde(skip_serializing_if = "Option::is_none")]
62 pub network_block_id: Option<String>,
63
64 #[serde(skip_serializing_if = "Option::is_none")]
66 pub local_block_id: Option<String>,
67
68 #[serde(skip_serializing_if = "Option::is_none")]
70 pub gpu_memory_fabric_id: Option<String>,
71
72 #[serde(skip_serializing_if = "Option::is_none")]
74 pub instance_id: Option<String>,
75
76 #[serde(skip_serializing_if = "Option::is_none")]
78 pub additional_data: Option<HashMap<String, serde_json::Value>>,
79
80 #[serde(skip_serializing_if = "Option::is_none")]
82 pub lifecycle_details: Option<HashMap<String, serde_json::Value>>,
83
84 #[serde(skip_serializing_if = "Option::is_none")]
86 pub capacity_reservation_id: Option<String>,
87
88 #[serde(skip_serializing_if = "Option::is_none")]
90 pub impacted_component_details: Option<HashMap<String, serde_json::Value>>,
91
92 #[serde(skip_serializing_if = "Option::is_none")]
94 pub defined_tags: Option<HashMap<String, HashMap<String, serde_json::Value>>>,
95
96 #[serde(skip_serializing_if = "Option::is_none")]
98 pub display_name: Option<String>,
99
100 #[serde(skip_serializing_if = "Option::is_none")]
102 pub freeform_tags: Option<HashMap<String, String>>,
103}
104
105pub struct ComputeHostRequired {
107 pub availability_domain: String,
109
110 pub compartment_id: String,
112
113 pub id: String,
115
116 pub fault_domain: String,
118
119 pub shape: String,
121
122 pub health: ComputeHostHealth,
124
125 pub lifecycle_state: ComputeHostLifecycleState,
127
128 pub time_created: DateTime<Utc>,
130
131 pub time_updated: DateTime<Utc>,
133}
134
135impl ComputeHost {
136 pub fn new(required: ComputeHostRequired) -> Self {
138 Self {
139 availability_domain: required.availability_domain,
140
141 compartment_id: required.compartment_id,
142
143 id: required.id,
144
145 fault_domain: required.fault_domain,
146
147 shape: required.shape,
148
149 health: required.health,
150
151 lifecycle_state: required.lifecycle_state,
152
153 time_created: required.time_created,
154
155 time_updated: required.time_updated,
156
157 hpc_island_id: None,
158
159 compute_host_group_id: None,
160
161 configuration_state: None,
162
163 time_configuration_check: None,
164
165 configuration_data: None,
166
167 recycle_details: None,
168
169 network_block_id: None,
170
171 local_block_id: None,
172
173 gpu_memory_fabric_id: None,
174
175 instance_id: None,
176
177 additional_data: None,
178
179 lifecycle_details: None,
180
181 capacity_reservation_id: None,
182
183 impacted_component_details: None,
184
185 defined_tags: None,
186
187 display_name: None,
188
189 freeform_tags: None,
190 }
191 }
192
193 pub fn set_availability_domain(mut self, value: String) -> Self {
195 self.availability_domain = value;
196 self
197 }
198
199 pub fn set_compartment_id(mut self, value: String) -> Self {
201 self.compartment_id = value;
202 self
203 }
204
205 pub fn set_id(mut self, value: String) -> Self {
207 self.id = value;
208 self
209 }
210
211 pub fn set_fault_domain(mut self, value: String) -> Self {
213 self.fault_domain = value;
214 self
215 }
216
217 pub fn set_hpc_island_id(mut self, value: Option<String>) -> Self {
219 self.hpc_island_id = value;
220 self
221 }
222
223 pub fn set_compute_host_group_id(mut self, value: Option<String>) -> Self {
225 self.compute_host_group_id = value;
226 self
227 }
228
229 pub fn set_configuration_state(mut self, value: Option<ConfigurationState>) -> Self {
231 self.configuration_state = value;
232 self
233 }
234
235 pub fn set_time_configuration_check(mut self, value: Option<DateTime<Utc>>) -> Self {
237 self.time_configuration_check = value;
238 self
239 }
240
241 pub fn set_configuration_data(mut self, value: Option<ComputeHostConfigurationData>) -> Self {
243 self.configuration_data = value;
244 self
245 }
246
247 pub fn set_recycle_details(mut self, value: Option<RecycleDetails>) -> Self {
249 self.recycle_details = value;
250 self
251 }
252
253 pub fn set_network_block_id(mut self, value: Option<String>) -> Self {
255 self.network_block_id = value;
256 self
257 }
258
259 pub fn set_local_block_id(mut self, value: Option<String>) -> Self {
261 self.local_block_id = value;
262 self
263 }
264
265 pub fn set_gpu_memory_fabric_id(mut self, value: Option<String>) -> Self {
267 self.gpu_memory_fabric_id = value;
268 self
269 }
270
271 pub fn set_instance_id(mut self, value: Option<String>) -> Self {
273 self.instance_id = value;
274 self
275 }
276
277 pub fn set_shape(mut self, value: String) -> Self {
279 self.shape = value;
280 self
281 }
282
283 pub fn set_health(mut self, value: ComputeHostHealth) -> Self {
285 self.health = value;
286 self
287 }
288
289 pub fn set_additional_data(
291 mut self,
292 value: Option<HashMap<String, serde_json::Value>>,
293 ) -> Self {
294 self.additional_data = value;
295 self
296 }
297
298 pub fn set_lifecycle_state(mut self, value: ComputeHostLifecycleState) -> Self {
300 self.lifecycle_state = value;
301 self
302 }
303
304 pub fn set_lifecycle_details(
306 mut self,
307 value: Option<HashMap<String, serde_json::Value>>,
308 ) -> Self {
309 self.lifecycle_details = value;
310 self
311 }
312
313 pub fn set_capacity_reservation_id(mut self, value: Option<String>) -> Self {
315 self.capacity_reservation_id = value;
316 self
317 }
318
319 pub fn set_impacted_component_details(
321 mut self,
322 value: Option<HashMap<String, serde_json::Value>>,
323 ) -> Self {
324 self.impacted_component_details = value;
325 self
326 }
327
328 pub fn set_time_created(mut self, value: DateTime<Utc>) -> Self {
330 self.time_created = value;
331 self
332 }
333
334 pub fn set_time_updated(mut self, value: DateTime<Utc>) -> Self {
336 self.time_updated = value;
337 self
338 }
339
340 pub fn set_defined_tags(
342 mut self,
343 value: Option<HashMap<String, HashMap<String, serde_json::Value>>>,
344 ) -> Self {
345 self.defined_tags = value;
346 self
347 }
348
349 pub fn set_display_name(mut self, value: Option<String>) -> Self {
351 self.display_name = value;
352 self
353 }
354
355 pub fn set_freeform_tags(mut self, value: Option<HashMap<String, String>>) -> Self {
357 self.freeform_tags = value;
358 self
359 }
360
361 pub fn with_hpc_island_id(mut self, value: impl Into<String>) -> Self {
363 self.hpc_island_id = Some(value.into());
364 self
365 }
366
367 pub fn with_compute_host_group_id(mut self, value: impl Into<String>) -> Self {
369 self.compute_host_group_id = Some(value.into());
370 self
371 }
372
373 pub fn with_configuration_state(mut self, value: ConfigurationState) -> Self {
375 self.configuration_state = Some(value);
376 self
377 }
378
379 pub fn with_time_configuration_check(mut self, value: DateTime<Utc>) -> Self {
381 self.time_configuration_check = Some(value);
382 self
383 }
384
385 pub fn with_configuration_data(mut self, value: ComputeHostConfigurationData) -> Self {
387 self.configuration_data = Some(value);
388 self
389 }
390
391 pub fn with_recycle_details(mut self, value: RecycleDetails) -> Self {
393 self.recycle_details = Some(value);
394 self
395 }
396
397 pub fn with_network_block_id(mut self, value: impl Into<String>) -> Self {
399 self.network_block_id = Some(value.into());
400 self
401 }
402
403 pub fn with_local_block_id(mut self, value: impl Into<String>) -> Self {
405 self.local_block_id = Some(value.into());
406 self
407 }
408
409 pub fn with_gpu_memory_fabric_id(mut self, value: impl Into<String>) -> Self {
411 self.gpu_memory_fabric_id = Some(value.into());
412 self
413 }
414
415 pub fn with_instance_id(mut self, value: impl Into<String>) -> Self {
417 self.instance_id = Some(value.into());
418 self
419 }
420
421 pub fn with_additional_data(mut self, value: HashMap<String, serde_json::Value>) -> Self {
423 self.additional_data = Some(value);
424 self
425 }
426
427 pub fn with_lifecycle_details(mut self, value: HashMap<String, serde_json::Value>) -> Self {
429 self.lifecycle_details = Some(value);
430 self
431 }
432
433 pub fn with_capacity_reservation_id(mut self, value: impl Into<String>) -> Self {
435 self.capacity_reservation_id = Some(value.into());
436 self
437 }
438
439 pub fn with_impacted_component_details(
441 mut self,
442 value: HashMap<String, serde_json::Value>,
443 ) -> Self {
444 self.impacted_component_details = Some(value);
445 self
446 }
447
448 pub fn with_defined_tags(
450 mut self,
451 value: HashMap<String, HashMap<String, serde_json::Value>>,
452 ) -> Self {
453 self.defined_tags = Some(value);
454 self
455 }
456
457 pub fn with_display_name(mut self, value: impl Into<String>) -> Self {
459 self.display_name = Some(value.into());
460 self
461 }
462
463 pub fn with_freeform_tags(mut self, value: HashMap<String, String>) -> Self {
465 self.freeform_tags = Some(value);
466 self
467 }
468}