oci_rust_sdk/core/models/
instance_maintenance_event.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 InstanceMaintenanceEvent {
11 pub id: String,
13
14 pub instance_id: String,
16
17 pub compartment_id: String,
19
20 pub maintenance_category: InstanceMaintenanceEventMaintenanceCategory,
22
23 pub maintenance_reason: InstanceMaintenanceEventMaintenanceReason,
25
26 pub instance_action: InstanceMaintenanceEventInstanceAction,
28
29 pub alternative_resolution_actions: Vec<InstanceMaintenanceEventAlternativeResolutionActions>,
31
32 pub time_window_start: DateTime<Utc>,
34
35 pub can_reschedule: bool,
37
38 pub time_created: DateTime<Utc>,
40
41 pub lifecycle_state: InstanceMaintenanceEventLifecycleState,
43
44 pub created_by: InstanceMaintenanceEventCreatedBy,
46
47 #[serde(skip_serializing_if = "Option::is_none")]
49 pub display_name: Option<String>,
50
51 #[serde(skip_serializing_if = "Option::is_none")]
53 pub defined_tags: Option<HashMap<String, HashMap<String, serde_json::Value>>>,
54
55 #[serde(skip_serializing_if = "Option::is_none")]
57 pub freeform_tags: Option<HashMap<String, String>>,
58
59 #[serde(skip_serializing_if = "Option::is_none")]
61 pub time_started: Option<DateTime<Utc>>,
62
63 #[serde(skip_serializing_if = "Option::is_none")]
65 pub time_finished: Option<DateTime<Utc>>,
66
67 #[serde(skip_serializing_if = "Option::is_none")]
69 pub start_window_duration: Option<String>,
70
71 #[serde(skip_serializing_if = "Option::is_none")]
73 pub estimated_duration: Option<String>,
74
75 #[serde(skip_serializing_if = "Option::is_none")]
77 pub time_hard_due_date: Option<DateTime<Utc>>,
78
79 #[serde(skip_serializing_if = "Option::is_none")]
81 pub lifecycle_details: Option<String>,
82
83 #[serde(skip_serializing_if = "Option::is_none")]
85 pub description: Option<String>,
86
87 #[serde(skip_serializing_if = "Option::is_none")]
89 pub correlation_token: Option<String>,
90
91 #[serde(skip_serializing_if = "Option::is_none")]
93 pub can_delete_local_storage: Option<bool>,
94
95 #[serde(skip_serializing_if = "Option::is_none")]
97 pub additional_details: Option<HashMap<String, String>>,
98}
99
100pub struct InstanceMaintenanceEventRequired {
102 pub id: String,
104
105 pub instance_id: String,
107
108 pub compartment_id: String,
110
111 pub maintenance_category: InstanceMaintenanceEventMaintenanceCategory,
113
114 pub maintenance_reason: InstanceMaintenanceEventMaintenanceReason,
116
117 pub instance_action: InstanceMaintenanceEventInstanceAction,
119
120 pub alternative_resolution_actions: Vec<InstanceMaintenanceEventAlternativeResolutionActions>,
122
123 pub time_window_start: DateTime<Utc>,
125
126 pub can_reschedule: bool,
128
129 pub time_created: DateTime<Utc>,
131
132 pub lifecycle_state: InstanceMaintenanceEventLifecycleState,
134
135 pub created_by: InstanceMaintenanceEventCreatedBy,
137}
138
139impl InstanceMaintenanceEvent {
140 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 pub fn set_display_name(mut self, value: Option<String>) -> Self {
197 self.display_name = value;
198 self
199 }
200
201 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 pub fn set_freeform_tags(mut self, value: Option<HashMap<String, String>>) -> Self {
212 self.freeform_tags = value;
213 self
214 }
215
216 pub fn set_id(mut self, value: String) -> Self {
218 self.id = value;
219 self
220 }
221
222 pub fn set_instance_id(mut self, value: String) -> Self {
224 self.instance_id = value;
225 self
226 }
227
228 pub fn set_compartment_id(mut self, value: String) -> Self {
230 self.compartment_id = value;
231 self
232 }
233
234 pub fn set_maintenance_category(
236 mut self,
237 value: InstanceMaintenanceEventMaintenanceCategory,
238 ) -> Self {
239 self.maintenance_category = value;
240 self
241 }
242
243 pub fn set_maintenance_reason(
245 mut self,
246 value: InstanceMaintenanceEventMaintenanceReason,
247 ) -> Self {
248 self.maintenance_reason = value;
249 self
250 }
251
252 pub fn set_instance_action(mut self, value: InstanceMaintenanceEventInstanceAction) -> Self {
254 self.instance_action = value;
255 self
256 }
257
258 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 pub fn set_time_started(mut self, value: Option<DateTime<Utc>>) -> Self {
269 self.time_started = value;
270 self
271 }
272
273 pub fn set_time_finished(mut self, value: Option<DateTime<Utc>>) -> Self {
275 self.time_finished = value;
276 self
277 }
278
279 pub fn set_time_window_start(mut self, value: DateTime<Utc>) -> Self {
281 self.time_window_start = value;
282 self
283 }
284
285 pub fn set_start_window_duration(mut self, value: Option<String>) -> Self {
287 self.start_window_duration = value;
288 self
289 }
290
291 pub fn set_estimated_duration(mut self, value: Option<String>) -> Self {
293 self.estimated_duration = value;
294 self
295 }
296
297 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 pub fn set_can_reschedule(mut self, value: bool) -> Self {
305 self.can_reschedule = value;
306 self
307 }
308
309 pub fn set_time_created(mut self, value: DateTime<Utc>) -> Self {
311 self.time_created = value;
312 self
313 }
314
315 pub fn set_lifecycle_state(mut self, value: InstanceMaintenanceEventLifecycleState) -> Self {
317 self.lifecycle_state = value;
318 self
319 }
320
321 pub fn set_lifecycle_details(mut self, value: Option<String>) -> Self {
323 self.lifecycle_details = value;
324 self
325 }
326
327 pub fn set_created_by(mut self, value: InstanceMaintenanceEventCreatedBy) -> Self {
329 self.created_by = value;
330 self
331 }
332
333 pub fn set_description(mut self, value: Option<String>) -> Self {
335 self.description = value;
336 self
337 }
338
339 pub fn set_correlation_token(mut self, value: Option<String>) -> Self {
341 self.correlation_token = value;
342 self
343 }
344
345 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 pub fn set_additional_details(mut self, value: Option<HashMap<String, String>>) -> Self {
353 self.additional_details = value;
354 self
355 }
356
357 pub fn with_display_name(mut self, value: impl Into<String>) -> Self {
359 self.display_name = Some(value.into());
360 self
361 }
362
363 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 pub fn with_freeform_tags(mut self, value: HashMap<String, String>) -> Self {
374 self.freeform_tags = Some(value);
375 self
376 }
377
378 pub fn with_time_started(mut self, value: DateTime<Utc>) -> Self {
380 self.time_started = Some(value);
381 self
382 }
383
384 pub fn with_time_finished(mut self, value: DateTime<Utc>) -> Self {
386 self.time_finished = Some(value);
387 self
388 }
389
390 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 pub fn with_estimated_duration(mut self, value: impl Into<String>) -> Self {
398 self.estimated_duration = Some(value.into());
399 self
400 }
401
402 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 pub fn with_lifecycle_details(mut self, value: impl Into<String>) -> Self {
410 self.lifecycle_details = Some(value.into());
411 self
412 }
413
414 pub fn with_description(mut self, value: impl Into<String>) -> Self {
416 self.description = Some(value.into());
417 self
418 }
419
420 pub fn with_correlation_token(mut self, value: impl Into<String>) -> Self {
422 self.correlation_token = Some(value.into());
423 self
424 }
425
426 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 pub fn with_additional_details(mut self, value: HashMap<String, String>) -> Self {
434 self.additional_details = Some(value);
435 self
436 }
437}