Skip to main content

oci_rust_sdk/core/models/
instance_maintenance_event.rs

1use chrono::{DateTime, Utc};
2use serde::{Deserialize, Serialize};
3use std::collections::HashMap;
4
5#[allow(unused_imports)]
6use super::*;
7/// It is the event in which the maintenance action will be be performed on the customer instance on the scheduled date and time.
8#[derive(Debug, Clone, Serialize, Deserialize)]
9#[serde(rename_all = "camelCase")]
10pub struct InstanceMaintenanceEvent {
11    /// The [OCID](https://docs.oracle.com/iaas/Content/General/Concepts/identifiers.htm) of the maintenance event.
12    pub id: String,
13
14    /// The OCID of the instance.
15    pub instance_id: String,
16
17    /// The OCID of the compartment that contains the instance.
18    pub compartment_id: String,
19
20    /// This indicates the priority and allowed actions for this Maintenance. Higher priority forms of Maintenance have tighter restrictions and may not be rescheduled, while lower priority/severity Maintenance can be rescheduled, deferred, or even cancelled. Please see the [Instance Maintenance](https://docs.oracle.com/iaas/Content/Compute/Tasks/placeholder.htm) documentation for details.
21    pub maintenance_category: InstanceMaintenanceEventMaintenanceCategory,
22
23    /// This is the reason that Maintenance is being performed. See [Instance Maintenance](https://docs.oracle.com/iaas/Content/Compute/Tasks/placeholder.htm) documentation for details.
24    pub maintenance_reason: InstanceMaintenanceEventMaintenanceReason,
25
26    /// This is the action that will be performed on the Instance by OCI when the Maintenance begins.
27    pub instance_action: InstanceMaintenanceEventInstanceAction,
28
29    /// These are alternative actions to the requested instanceAction that can be taken to resolve the Maintenance.
30    pub alternative_resolution_actions: Vec<InstanceMaintenanceEventAlternativeResolutionActions>,
31
32    /// The beginning of the time window when Maintenance is scheduled to begin. The Maintenance will not begin before this time.
33    pub time_window_start: DateTime<Utc>,
34
35    /// Indicates if this MaintenanceEvent is capable of being rescheduled up to the timeHardDueDate.
36    pub can_reschedule: bool,
37
38    /// The date and time the maintenance event was created, in the format defined by [RFC3339](https://tools.ietf.org/html/rfc3339). Example: {@code 2016-08-25T21:10:29.600Z}
39    pub time_created: DateTime<Utc>,
40
41    /// The current state of the maintenance event.
42    pub lifecycle_state: InstanceMaintenanceEventLifecycleState,
43
44    /// The creator of the maintenance event.
45    pub created_by: InstanceMaintenanceEventCreatedBy,
46
47    /// A user-friendly name. Does not have to be unique, and it's changeable. Avoid entering confidential information.
48    #[serde(skip_serializing_if = "Option::is_none")]
49    pub display_name: Option<String>,
50
51    /// 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\"}}}
52    #[serde(skip_serializing_if = "Option::is_none")]
53    pub defined_tags: Option<HashMap<String, HashMap<String, serde_json::Value>>>,
54
55    /// 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\"}}
56    #[serde(skip_serializing_if = "Option::is_none")]
57    pub freeform_tags: Option<HashMap<String, String>>,
58
59    /// The time at which the Maintenance actually started.
60    #[serde(skip_serializing_if = "Option::is_none")]
61    pub time_started: Option<DateTime<Utc>>,
62
63    /// The time at which the Maintenance actually finished.
64    #[serde(skip_serializing_if = "Option::is_none")]
65    pub time_finished: Option<DateTime<Utc>>,
66
67    /// The duration of the time window Maintenance is scheduled to begin within.
68    #[serde(skip_serializing_if = "Option::is_none")]
69    pub start_window_duration: Option<String>,
70
71    /// This is the estimated duration of the Maintenance, once the Maintenance has entered the STARTED state.
72    #[serde(skip_serializing_if = "Option::is_none")]
73    pub estimated_duration: Option<String>,
74
75    /// It is the scheduled hard due date and time of the maintenance event. The maintenance event will happen at this time and the due date will not be extended.
76    #[serde(skip_serializing_if = "Option::is_none")]
77    pub time_hard_due_date: Option<DateTime<Utc>>,
78
79    /// Provides more details about the state of the maintenance event.
80    #[serde(skip_serializing_if = "Option::is_none")]
81    pub lifecycle_details: Option<String>,
82
83    /// It is the descriptive information about the maintenance taking place on the customer instance.
84    #[serde(skip_serializing_if = "Option::is_none")]
85    pub description: Option<String>,
86
87    /// A unique identifier that will group Instances that have a relationship with one another and must be scheduled together for the Maintenance to proceed. Any Instances that have a relationship with one another from a Maintenance perspective will have a matching correlationToken.
88    #[serde(skip_serializing_if = "Option::is_none")]
89    pub correlation_token: Option<String>,
90
91    /// For Instances that have local storage, this field is set to true when local storage will be deleted as a result of the Maintenance.
92    #[serde(skip_serializing_if = "Option::is_none")]
93    pub can_delete_local_storage: Option<bool>,
94
95    /// Additional details of the maintenance in the form of json.
96    #[serde(skip_serializing_if = "Option::is_none")]
97    pub additional_details: Option<HashMap<String, String>>,
98}
99
100/// Required fields for InstanceMaintenanceEvent
101pub struct InstanceMaintenanceEventRequired {
102    /// The [OCID](https://docs.oracle.com/iaas/Content/General/Concepts/identifiers.htm) of the maintenance event.
103    pub id: String,
104
105    /// The OCID of the instance.
106    pub instance_id: String,
107
108    /// The OCID of the compartment that contains the instance.
109    pub compartment_id: String,
110
111    /// This indicates the priority and allowed actions for this Maintenance. Higher priority forms of Maintenance have tighter restrictions and may not be rescheduled, while lower priority/severity Maintenance can be rescheduled, deferred, or even cancelled. Please see the [Instance Maintenance](https://docs.oracle.com/iaas/Content/Compute/Tasks/placeholder.htm) documentation for details.
112    pub maintenance_category: InstanceMaintenanceEventMaintenanceCategory,
113
114    /// This is the reason that Maintenance is being performed. See [Instance Maintenance](https://docs.oracle.com/iaas/Content/Compute/Tasks/placeholder.htm) documentation for details.
115    pub maintenance_reason: InstanceMaintenanceEventMaintenanceReason,
116
117    /// This is the action that will be performed on the Instance by OCI when the Maintenance begins.
118    pub instance_action: InstanceMaintenanceEventInstanceAction,
119
120    /// These are alternative actions to the requested instanceAction that can be taken to resolve the Maintenance.
121    pub alternative_resolution_actions: Vec<InstanceMaintenanceEventAlternativeResolutionActions>,
122
123    /// The beginning of the time window when Maintenance is scheduled to begin. The Maintenance will not begin before this time.
124    pub time_window_start: DateTime<Utc>,
125
126    /// Indicates if this MaintenanceEvent is capable of being rescheduled up to the timeHardDueDate.
127    pub can_reschedule: bool,
128
129    /// The date and time the maintenance event was created, in the format defined by [RFC3339](https://tools.ietf.org/html/rfc3339). Example: {@code 2016-08-25T21:10:29.600Z}
130    pub time_created: DateTime<Utc>,
131
132    /// The current state of the maintenance event.
133    pub lifecycle_state: InstanceMaintenanceEventLifecycleState,
134
135    /// The creator of the maintenance event.
136    pub created_by: InstanceMaintenanceEventCreatedBy,
137}
138
139impl InstanceMaintenanceEvent {
140    /// Create a new InstanceMaintenanceEvent with required fields
141    pub fn new(required: InstanceMaintenanceEventRequired) -> Self {
142        Self {
143            id: required.id,
144
145            instance_id: required.instance_id,
146
147            compartment_id: required.compartment_id,
148
149            maintenance_category: required.maintenance_category,
150
151            maintenance_reason: required.maintenance_reason,
152
153            instance_action: required.instance_action,
154
155            alternative_resolution_actions: required.alternative_resolution_actions,
156
157            time_window_start: required.time_window_start,
158
159            can_reschedule: required.can_reschedule,
160
161            time_created: required.time_created,
162
163            lifecycle_state: required.lifecycle_state,
164
165            created_by: required.created_by,
166
167            display_name: None,
168
169            defined_tags: None,
170
171            freeform_tags: None,
172
173            time_started: None,
174
175            time_finished: None,
176
177            start_window_duration: None,
178
179            estimated_duration: None,
180
181            time_hard_due_date: None,
182
183            lifecycle_details: None,
184
185            description: None,
186
187            correlation_token: None,
188
189            can_delete_local_storage: None,
190
191            additional_details: None,
192        }
193    }
194
195    /// Set display_name
196    pub fn set_display_name(mut self, value: Option<String>) -> Self {
197        self.display_name = value;
198        self
199    }
200
201    /// Set defined_tags
202    pub fn set_defined_tags(
203        mut self,
204        value: Option<HashMap<String, HashMap<String, serde_json::Value>>>,
205    ) -> Self {
206        self.defined_tags = value;
207        self
208    }
209
210    /// Set freeform_tags
211    pub fn set_freeform_tags(mut self, value: Option<HashMap<String, String>>) -> Self {
212        self.freeform_tags = value;
213        self
214    }
215
216    /// Set id
217    pub fn set_id(mut self, value: String) -> Self {
218        self.id = value;
219        self
220    }
221
222    /// Set instance_id
223    pub fn set_instance_id(mut self, value: String) -> Self {
224        self.instance_id = value;
225        self
226    }
227
228    /// Set compartment_id
229    pub fn set_compartment_id(mut self, value: String) -> Self {
230        self.compartment_id = value;
231        self
232    }
233
234    /// Set maintenance_category
235    pub fn set_maintenance_category(
236        mut self,
237        value: InstanceMaintenanceEventMaintenanceCategory,
238    ) -> Self {
239        self.maintenance_category = value;
240        self
241    }
242
243    /// Set maintenance_reason
244    pub fn set_maintenance_reason(
245        mut self,
246        value: InstanceMaintenanceEventMaintenanceReason,
247    ) -> Self {
248        self.maintenance_reason = value;
249        self
250    }
251
252    /// Set instance_action
253    pub fn set_instance_action(mut self, value: InstanceMaintenanceEventInstanceAction) -> Self {
254        self.instance_action = value;
255        self
256    }
257
258    /// Set alternative_resolution_actions
259    pub fn set_alternative_resolution_actions(
260        mut self,
261        value: Vec<InstanceMaintenanceEventAlternativeResolutionActions>,
262    ) -> Self {
263        self.alternative_resolution_actions = value;
264        self
265    }
266
267    /// Set time_started
268    pub fn set_time_started(mut self, value: Option<DateTime<Utc>>) -> Self {
269        self.time_started = value;
270        self
271    }
272
273    /// Set time_finished
274    pub fn set_time_finished(mut self, value: Option<DateTime<Utc>>) -> Self {
275        self.time_finished = value;
276        self
277    }
278
279    /// Set time_window_start
280    pub fn set_time_window_start(mut self, value: DateTime<Utc>) -> Self {
281        self.time_window_start = value;
282        self
283    }
284
285    /// Set start_window_duration
286    pub fn set_start_window_duration(mut self, value: Option<String>) -> Self {
287        self.start_window_duration = value;
288        self
289    }
290
291    /// Set estimated_duration
292    pub fn set_estimated_duration(mut self, value: Option<String>) -> Self {
293        self.estimated_duration = value;
294        self
295    }
296
297    /// Set time_hard_due_date
298    pub fn set_time_hard_due_date(mut self, value: Option<DateTime<Utc>>) -> Self {
299        self.time_hard_due_date = value;
300        self
301    }
302
303    /// Set can_reschedule
304    pub fn set_can_reschedule(mut self, value: bool) -> Self {
305        self.can_reschedule = value;
306        self
307    }
308
309    /// Set time_created
310    pub fn set_time_created(mut self, value: DateTime<Utc>) -> Self {
311        self.time_created = value;
312        self
313    }
314
315    /// Set lifecycle_state
316    pub fn set_lifecycle_state(mut self, value: InstanceMaintenanceEventLifecycleState) -> Self {
317        self.lifecycle_state = value;
318        self
319    }
320
321    /// Set lifecycle_details
322    pub fn set_lifecycle_details(mut self, value: Option<String>) -> Self {
323        self.lifecycle_details = value;
324        self
325    }
326
327    /// Set created_by
328    pub fn set_created_by(mut self, value: InstanceMaintenanceEventCreatedBy) -> Self {
329        self.created_by = value;
330        self
331    }
332
333    /// Set description
334    pub fn set_description(mut self, value: Option<String>) -> Self {
335        self.description = value;
336        self
337    }
338
339    /// Set correlation_token
340    pub fn set_correlation_token(mut self, value: Option<String>) -> Self {
341        self.correlation_token = value;
342        self
343    }
344
345    /// Set can_delete_local_storage
346    pub fn set_can_delete_local_storage(mut self, value: Option<bool>) -> Self {
347        self.can_delete_local_storage = value;
348        self
349    }
350
351    /// Set additional_details
352    pub fn set_additional_details(mut self, value: Option<HashMap<String, String>>) -> Self {
353        self.additional_details = value;
354        self
355    }
356
357    /// Set display_name (unwraps Option)
358    pub fn with_display_name(mut self, value: impl Into<String>) -> Self {
359        self.display_name = Some(value.into());
360        self
361    }
362
363    /// Set defined_tags (unwraps Option)
364    pub fn with_defined_tags(
365        mut self,
366        value: HashMap<String, HashMap<String, serde_json::Value>>,
367    ) -> Self {
368        self.defined_tags = Some(value);
369        self
370    }
371
372    /// Set freeform_tags (unwraps Option)
373    pub fn with_freeform_tags(mut self, value: HashMap<String, String>) -> Self {
374        self.freeform_tags = Some(value);
375        self
376    }
377
378    /// Set time_started (unwraps Option)
379    pub fn with_time_started(mut self, value: DateTime<Utc>) -> Self {
380        self.time_started = Some(value);
381        self
382    }
383
384    /// Set time_finished (unwraps Option)
385    pub fn with_time_finished(mut self, value: DateTime<Utc>) -> Self {
386        self.time_finished = Some(value);
387        self
388    }
389
390    /// Set start_window_duration (unwraps Option)
391    pub fn with_start_window_duration(mut self, value: impl Into<String>) -> Self {
392        self.start_window_duration = Some(value.into());
393        self
394    }
395
396    /// Set estimated_duration (unwraps Option)
397    pub fn with_estimated_duration(mut self, value: impl Into<String>) -> Self {
398        self.estimated_duration = Some(value.into());
399        self
400    }
401
402    /// Set time_hard_due_date (unwraps Option)
403    pub fn with_time_hard_due_date(mut self, value: DateTime<Utc>) -> Self {
404        self.time_hard_due_date = Some(value);
405        self
406    }
407
408    /// Set lifecycle_details (unwraps Option)
409    pub fn with_lifecycle_details(mut self, value: impl Into<String>) -> Self {
410        self.lifecycle_details = Some(value.into());
411        self
412    }
413
414    /// Set description (unwraps Option)
415    pub fn with_description(mut self, value: impl Into<String>) -> Self {
416        self.description = Some(value.into());
417        self
418    }
419
420    /// Set correlation_token (unwraps Option)
421    pub fn with_correlation_token(mut self, value: impl Into<String>) -> Self {
422        self.correlation_token = Some(value.into());
423        self
424    }
425
426    /// Set can_delete_local_storage (unwraps Option)
427    pub fn with_can_delete_local_storage(mut self, value: bool) -> Self {
428        self.can_delete_local_storage = Some(value);
429        self
430    }
431
432    /// Set additional_details (unwraps Option)
433    pub fn with_additional_details(mut self, value: HashMap<String, String>) -> Self {
434        self.additional_details = Some(value);
435        self
436    }
437}