Skip to main content

oci_rust_sdk/core/models/
compute_host.rs

1use chrono::{DateTime, Utc};
2use serde::{Deserialize, Serialize};
3use std::collections::HashMap;
4
5#[allow(unused_imports)]
6use super::*;
7/// The customer facing object includes host details.
8#[derive(Debug, Clone, Serialize, Deserialize)]
9#[serde(rename_all = "camelCase")]
10pub struct ComputeHost {
11    /// The availability domain of the compute host. <p> Example: {@code Uocm:US-CHICAGO-1-AD-2}
12    pub availability_domain: String,
13
14    /// The [OCID](https://docs.oracle.com/iaas/Content/General/Concepts/identifiers.htm) for the compartment. This should always be the root compartment.
15    pub compartment_id: String,
16
17    /// The [OCID](https://docs.oracle.com/iaas/Content/General/Concepts/identifiers.htm) for the Customer-unique host
18    pub id: String,
19
20    /// A fault domain is a grouping of hardware and infrastructure within an availability domain. Each availability domain contains three fault domains. Fault domains let you distribute your instances so that they are not on the same physical hardware within a single availability domain. A hardware failure or Compute hardware maintenance that affects one fault domain does not affect instances in other fault domains. <p> This field is the Fault domain of the host
21    pub fault_domain: String,
22
23    /// The shape of host
24    pub shape: String,
25
26    /// The heathy state of the host
27    pub health: ComputeHostHealth,
28
29    /// The lifecycle state of the host
30    pub lifecycle_state: ComputeHostLifecycleState,
31
32    /// The date and time that the compute host record was created, in the format defined by [RFC3339](https://tools .ietf.org/html/rfc3339). <p> Example: {@code 2016-08-25T21:10:29.600Z}
33    pub time_created: DateTime<Utc>,
34
35    /// The date and time that the compute host record was updated, in the format defined by [RFC3339](https://tools.ietf.org/html/rfc3339). <p> Example: {@code 2016-08-25T21:10:29.600Z}
36    pub time_updated: DateTime<Utc>,
37
38    /// The [OCID](https://docs.oracle.com/iaas/Content/General/Concepts/identifiers.htm) for Customer-unique HPC Island
39    #[serde(skip_serializing_if = "Option::is_none")]
40    pub hpc_island_id: Option<String>,
41
42    /// The [OCID](https://docs.oracle.com/iaas/Content/General/Concepts/identifiers.htm) for the Customer-unique host group associated with the Compute Bare Metal Host.
43    #[serde(skip_serializing_if = "Option::is_none")]
44    pub compute_host_group_id: Option<String>,
45
46    /// Configuration state of the Compute Bare Metal Host.
47    #[serde(skip_serializing_if = "Option::is_none")]
48    pub configuration_state: Option<ConfigurationState>,
49
50    /// The date and time that the compute bare metal host configuration check was updated, in the format defined by [RFC3339](https://tools.ietf.org/html/rfc3339). <p> Example: {@code 2016-08-25T21:10:29.600Z}
51    #[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    /// The [OCID](https://docs.oracle.com/iaas/Content/General/Concepts/identifiers.htm) for Customer-unique Network Block
61    #[serde(skip_serializing_if = "Option::is_none")]
62    pub network_block_id: Option<String>,
63
64    /// The [OCID](https://docs.oracle.com/iaas/Content/General/Concepts/identifiers.htm) for Customer-unique Local Block
65    #[serde(skip_serializing_if = "Option::is_none")]
66    pub local_block_id: Option<String>,
67
68    /// The [OCID](https://docs.oracle.com/iaas/Content/General/Concepts/identifiers.htm) for Customer-unique GPU Memory Fabric
69    #[serde(skip_serializing_if = "Option::is_none")]
70    pub gpu_memory_fabric_id: Option<String>,
71
72    /// The public [OCID](https://docs.oracle.com/iaas/Content/General/Concepts/identifiers.htm) for the Virtual Machine or Bare Metal instance
73    #[serde(skip_serializing_if = "Option::is_none")]
74    pub instance_id: Option<String>,
75
76    /// Additional data that can be exposed to the customer.  Will include raw fault codes for strategic customers
77    #[serde(skip_serializing_if = "Option::is_none")]
78    pub additional_data: Option<HashMap<String, serde_json::Value>>,
79
80    /// A free-form description detailing why the host is in its current state.
81    #[serde(skip_serializing_if = "Option::is_none")]
82    pub lifecycle_details: Option<HashMap<String, serde_json::Value>>,
83
84    /// The [OCID](https://docs.oracle.com/iaas/Content/General/Concepts/identifiers.htm) for the Capacity Reserver that is currently on host
85    #[serde(skip_serializing_if = "Option::is_none")]
86    pub capacity_reservation_id: Option<String>,
87
88    /// A list that contains impacted components related to an unhealthy host. An impacted component will be a free-form structure of key values pairs that will provide more or less details based on data tiering
89    #[serde(skip_serializing_if = "Option::is_none")]
90    pub impacted_component_details: Option<HashMap<String, serde_json::Value>>,
91
92    /// 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\"}}}
93    #[serde(skip_serializing_if = "Option::is_none")]
94    pub defined_tags: Option<HashMap<String, HashMap<String, serde_json::Value>>>,
95
96    /// A user-friendly name. Does not have to be unique, and it's changeable. Avoid entering confidential information.
97    #[serde(skip_serializing_if = "Option::is_none")]
98    pub display_name: Option<String>,
99
100    /// 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\"}}
101    #[serde(skip_serializing_if = "Option::is_none")]
102    pub freeform_tags: Option<HashMap<String, String>>,
103}
104
105/// Required fields for ComputeHost
106pub struct ComputeHostRequired {
107    /// The availability domain of the compute host. <p> Example: {@code Uocm:US-CHICAGO-1-AD-2}
108    pub availability_domain: String,
109
110    /// The [OCID](https://docs.oracle.com/iaas/Content/General/Concepts/identifiers.htm) for the compartment. This should always be the root compartment.
111    pub compartment_id: String,
112
113    /// The [OCID](https://docs.oracle.com/iaas/Content/General/Concepts/identifiers.htm) for the Customer-unique host
114    pub id: String,
115
116    /// A fault domain is a grouping of hardware and infrastructure within an availability domain. Each availability domain contains three fault domains. Fault domains let you distribute your instances so that they are not on the same physical hardware within a single availability domain. A hardware failure or Compute hardware maintenance that affects one fault domain does not affect instances in other fault domains. <p> This field is the Fault domain of the host
117    pub fault_domain: String,
118
119    /// The shape of host
120    pub shape: String,
121
122    /// The heathy state of the host
123    pub health: ComputeHostHealth,
124
125    /// The lifecycle state of the host
126    pub lifecycle_state: ComputeHostLifecycleState,
127
128    /// The date and time that the compute host record was created, in the format defined by [RFC3339](https://tools .ietf.org/html/rfc3339). <p> Example: {@code 2016-08-25T21:10:29.600Z}
129    pub time_created: DateTime<Utc>,
130
131    /// The date and time that the compute host record was updated, in the format defined by [RFC3339](https://tools.ietf.org/html/rfc3339). <p> Example: {@code 2016-08-25T21:10:29.600Z}
132    pub time_updated: DateTime<Utc>,
133}
134
135impl ComputeHost {
136    /// Create a new ComputeHost with required fields
137    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    /// Set availability_domain
194    pub fn set_availability_domain(mut self, value: String) -> Self {
195        self.availability_domain = value;
196        self
197    }
198
199    /// Set compartment_id
200    pub fn set_compartment_id(mut self, value: String) -> Self {
201        self.compartment_id = value;
202        self
203    }
204
205    /// Set id
206    pub fn set_id(mut self, value: String) -> Self {
207        self.id = value;
208        self
209    }
210
211    /// Set fault_domain
212    pub fn set_fault_domain(mut self, value: String) -> Self {
213        self.fault_domain = value;
214        self
215    }
216
217    /// Set hpc_island_id
218    pub fn set_hpc_island_id(mut self, value: Option<String>) -> Self {
219        self.hpc_island_id = value;
220        self
221    }
222
223    /// Set compute_host_group_id
224    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    /// Set configuration_state
230    pub fn set_configuration_state(mut self, value: Option<ConfigurationState>) -> Self {
231        self.configuration_state = value;
232        self
233    }
234
235    /// Set time_configuration_check
236    pub fn set_time_configuration_check(mut self, value: Option<DateTime<Utc>>) -> Self {
237        self.time_configuration_check = value;
238        self
239    }
240
241    /// Set configuration_data
242    pub fn set_configuration_data(mut self, value: Option<ComputeHostConfigurationData>) -> Self {
243        self.configuration_data = value;
244        self
245    }
246
247    /// Set recycle_details
248    pub fn set_recycle_details(mut self, value: Option<RecycleDetails>) -> Self {
249        self.recycle_details = value;
250        self
251    }
252
253    /// Set network_block_id
254    pub fn set_network_block_id(mut self, value: Option<String>) -> Self {
255        self.network_block_id = value;
256        self
257    }
258
259    /// Set local_block_id
260    pub fn set_local_block_id(mut self, value: Option<String>) -> Self {
261        self.local_block_id = value;
262        self
263    }
264
265    /// Set gpu_memory_fabric_id
266    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    /// Set instance_id
272    pub fn set_instance_id(mut self, value: Option<String>) -> Self {
273        self.instance_id = value;
274        self
275    }
276
277    /// Set shape
278    pub fn set_shape(mut self, value: String) -> Self {
279        self.shape = value;
280        self
281    }
282
283    /// Set health
284    pub fn set_health(mut self, value: ComputeHostHealth) -> Self {
285        self.health = value;
286        self
287    }
288
289    /// Set additional_data
290    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    /// Set lifecycle_state
299    pub fn set_lifecycle_state(mut self, value: ComputeHostLifecycleState) -> Self {
300        self.lifecycle_state = value;
301        self
302    }
303
304    /// Set lifecycle_details
305    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    /// Set capacity_reservation_id
314    pub fn set_capacity_reservation_id(mut self, value: Option<String>) -> Self {
315        self.capacity_reservation_id = value;
316        self
317    }
318
319    /// Set impacted_component_details
320    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    /// Set time_created
329    pub fn set_time_created(mut self, value: DateTime<Utc>) -> Self {
330        self.time_created = value;
331        self
332    }
333
334    /// Set time_updated
335    pub fn set_time_updated(mut self, value: DateTime<Utc>) -> Self {
336        self.time_updated = value;
337        self
338    }
339
340    /// Set defined_tags
341    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    /// Set display_name
350    pub fn set_display_name(mut self, value: Option<String>) -> Self {
351        self.display_name = value;
352        self
353    }
354
355    /// Set freeform_tags
356    pub fn set_freeform_tags(mut self, value: Option<HashMap<String, String>>) -> Self {
357        self.freeform_tags = value;
358        self
359    }
360
361    /// Set hpc_island_id (unwraps Option)
362    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    /// Set compute_host_group_id (unwraps Option)
368    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    /// Set configuration_state (unwraps Option)
374    pub fn with_configuration_state(mut self, value: ConfigurationState) -> Self {
375        self.configuration_state = Some(value);
376        self
377    }
378
379    /// Set time_configuration_check (unwraps Option)
380    pub fn with_time_configuration_check(mut self, value: DateTime<Utc>) -> Self {
381        self.time_configuration_check = Some(value);
382        self
383    }
384
385    /// Set configuration_data (unwraps Option)
386    pub fn with_configuration_data(mut self, value: ComputeHostConfigurationData) -> Self {
387        self.configuration_data = Some(value);
388        self
389    }
390
391    /// Set recycle_details (unwraps Option)
392    pub fn with_recycle_details(mut self, value: RecycleDetails) -> Self {
393        self.recycle_details = Some(value);
394        self
395    }
396
397    /// Set network_block_id (unwraps Option)
398    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    /// Set local_block_id (unwraps Option)
404    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    /// Set gpu_memory_fabric_id (unwraps Option)
410    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    /// Set instance_id (unwraps Option)
416    pub fn with_instance_id(mut self, value: impl Into<String>) -> Self {
417        self.instance_id = Some(value.into());
418        self
419    }
420
421    /// Set additional_data (unwraps Option)
422    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    /// Set lifecycle_details (unwraps Option)
428    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    /// Set capacity_reservation_id (unwraps Option)
434    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    /// Set impacted_component_details (unwraps Option)
440    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    /// Set defined_tags (unwraps Option)
449    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    /// Set display_name (unwraps Option)
458    pub fn with_display_name(mut self, value: impl Into<String>) -> Self {
459        self.display_name = Some(value.into());
460        self
461    }
462
463    /// Set freeform_tags (unwraps Option)
464    pub fn with_freeform_tags(mut self, value: HashMap<String, String>) -> Self {
465        self.freeform_tags = Some(value);
466        self
467    }
468}