1use 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 Instance {
11 pub availability_domain: String,
13
14 pub compartment_id: String,
16
17 pub id: String,
19
20 pub lifecycle_state: InstanceLifecycleState,
22
23 pub region: String,
25
26 pub shape: String,
28
29 pub time_created: DateTime<Utc>,
31
32 #[serde(skip_serializing_if = "Option::is_none")]
34 pub capacity_reservation_id: Option<String>,
35
36 #[serde(skip_serializing_if = "Option::is_none")]
37 pub placement_constraint_details: Option<HostGroupPlacementConstraintDetails>,
38
39 #[serde(skip_serializing_if = "Option::is_none")]
41 pub is_aienterprise_enabled: Option<bool>,
42
43 #[serde(skip_serializing_if = "Option::is_none")]
45 pub cluster_placement_group_id: Option<String>,
46
47 #[serde(skip_serializing_if = "Option::is_none")]
49 pub dedicated_vm_host_id: 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 security_attributes: Option<HashMap<String, HashMap<String, serde_json::Value>>>,
58
59 #[serde(skip_serializing_if = "Option::is_none")]
61 pub security_attributes_state: Option<InstanceSecurityAttributesState>,
62
63 #[serde(skip_serializing_if = "Option::is_none")]
65 pub display_name: Option<String>,
66
67 #[serde(skip_serializing_if = "Option::is_none")]
69 pub extended_metadata: Option<HashMap<String, serde_json::Value>>,
70
71 #[serde(skip_serializing_if = "Option::is_none")]
73 pub fault_domain: Option<String>,
74
75 #[serde(skip_serializing_if = "Option::is_none")]
77 pub freeform_tags: Option<HashMap<String, String>>,
78
79 #[serde(skip_serializing_if = "Option::is_none")]
81 pub image_id: Option<String>,
82
83 #[serde(skip_serializing_if = "Option::is_none")]
85 pub ipxe_script: Option<String>,
86
87 #[serde(skip_serializing_if = "Option::is_none")]
89 pub launch_mode: Option<InstanceLaunchMode>,
90
91 #[serde(skip_serializing_if = "Option::is_none")]
92 pub launch_options: Option<LaunchOptions>,
93
94 #[serde(skip_serializing_if = "Option::is_none")]
95 pub instance_options: Option<InstanceOptions>,
96
97 #[serde(skip_serializing_if = "Option::is_none")]
98 pub availability_config: Option<InstanceAvailabilityConfig>,
99
100 #[serde(skip_serializing_if = "Option::is_none")]
101 pub preemptible_instance_config: Option<PreemptibleInstanceConfigDetails>,
102
103 #[serde(skip_serializing_if = "Option::is_none")]
105 pub metadata: Option<HashMap<String, String>>,
106
107 #[serde(skip_serializing_if = "Option::is_none")]
108 pub shape_config: Option<InstanceShapeConfig>,
109
110 #[serde(skip_serializing_if = "Option::is_none")]
112 pub is_cross_numa_node: Option<bool>,
113
114 #[serde(skip_serializing_if = "Option::is_none")]
115 pub source_details: Option<InstanceSourceViaImageDetails>,
116
117 #[serde(skip_serializing_if = "Option::is_none")]
119 pub system_tags: Option<HashMap<String, HashMap<String, serde_json::Value>>>,
120
121 #[serde(skip_serializing_if = "Option::is_none")]
122 pub agent_config: Option<InstanceAgentConfig>,
123
124 #[serde(skip_serializing_if = "Option::is_none")]
126 pub time_maintenance_reboot_due: Option<DateTime<Utc>>,
127
128 #[serde(skip_serializing_if = "Option::is_none")]
129 pub platform_config: Option<AmdMilanBmPlatformConfig>,
130
131 #[serde(skip_serializing_if = "Option::is_none")]
133 pub instance_configuration_id: Option<String>,
134
135 #[serde(skip_serializing_if = "Option::is_none")]
137 pub licensing_configs: Option<Vec<LicensingConfig>>,
138}
139
140pub struct InstanceRequired {
142 pub availability_domain: String,
144
145 pub compartment_id: String,
147
148 pub id: String,
150
151 pub lifecycle_state: InstanceLifecycleState,
153
154 pub region: String,
156
157 pub shape: String,
159
160 pub time_created: DateTime<Utc>,
162}
163
164impl Instance {
165 pub fn new(required: InstanceRequired) -> Self {
167 Self {
168 availability_domain: required.availability_domain,
169
170 compartment_id: required.compartment_id,
171
172 id: required.id,
173
174 lifecycle_state: required.lifecycle_state,
175
176 region: required.region,
177
178 shape: required.shape,
179
180 time_created: required.time_created,
181
182 capacity_reservation_id: None,
183
184 placement_constraint_details: None,
185
186 is_aienterprise_enabled: None,
187
188 cluster_placement_group_id: None,
189
190 dedicated_vm_host_id: None,
191
192 defined_tags: None,
193
194 security_attributes: None,
195
196 security_attributes_state: None,
197
198 display_name: None,
199
200 extended_metadata: None,
201
202 fault_domain: None,
203
204 freeform_tags: None,
205
206 image_id: None,
207
208 ipxe_script: None,
209
210 launch_mode: None,
211
212 launch_options: None,
213
214 instance_options: None,
215
216 availability_config: None,
217
218 preemptible_instance_config: None,
219
220 metadata: None,
221
222 shape_config: None,
223
224 is_cross_numa_node: None,
225
226 source_details: None,
227
228 system_tags: None,
229
230 agent_config: None,
231
232 time_maintenance_reboot_due: None,
233
234 platform_config: None,
235
236 instance_configuration_id: None,
237
238 licensing_configs: None,
239 }
240 }
241
242 pub fn set_availability_domain(mut self, value: String) -> Self {
244 self.availability_domain = value;
245 self
246 }
247
248 pub fn set_capacity_reservation_id(mut self, value: Option<String>) -> Self {
250 self.capacity_reservation_id = value;
251 self
252 }
253
254 pub fn set_compartment_id(mut self, value: String) -> Self {
256 self.compartment_id = value;
257 self
258 }
259
260 pub fn set_placement_constraint_details(
262 mut self,
263 value: Option<HostGroupPlacementConstraintDetails>,
264 ) -> Self {
265 self.placement_constraint_details = value;
266 self
267 }
268
269 pub fn set_is_aienterprise_enabled(mut self, value: Option<bool>) -> Self {
271 self.is_aienterprise_enabled = value;
272 self
273 }
274
275 pub fn set_cluster_placement_group_id(mut self, value: Option<String>) -> Self {
277 self.cluster_placement_group_id = value;
278 self
279 }
280
281 pub fn set_dedicated_vm_host_id(mut self, value: Option<String>) -> Self {
283 self.dedicated_vm_host_id = value;
284 self
285 }
286
287 pub fn set_defined_tags(
289 mut self,
290 value: Option<HashMap<String, HashMap<String, serde_json::Value>>>,
291 ) -> Self {
292 self.defined_tags = value;
293 self
294 }
295
296 pub fn set_security_attributes(
298 mut self,
299 value: Option<HashMap<String, HashMap<String, serde_json::Value>>>,
300 ) -> Self {
301 self.security_attributes = value;
302 self
303 }
304
305 pub fn set_security_attributes_state(
307 mut self,
308 value: Option<InstanceSecurityAttributesState>,
309 ) -> Self {
310 self.security_attributes_state = value;
311 self
312 }
313
314 pub fn set_display_name(mut self, value: Option<String>) -> Self {
316 self.display_name = value;
317 self
318 }
319
320 pub fn set_extended_metadata(
322 mut self,
323 value: Option<HashMap<String, serde_json::Value>>,
324 ) -> Self {
325 self.extended_metadata = value;
326 self
327 }
328
329 pub fn set_fault_domain(mut self, value: Option<String>) -> Self {
331 self.fault_domain = value;
332 self
333 }
334
335 pub fn set_freeform_tags(mut self, value: Option<HashMap<String, String>>) -> Self {
337 self.freeform_tags = value;
338 self
339 }
340
341 pub fn set_id(mut self, value: String) -> Self {
343 self.id = value;
344 self
345 }
346
347 pub fn set_image_id(mut self, value: Option<String>) -> Self {
349 self.image_id = value;
350 self
351 }
352
353 pub fn set_ipxe_script(mut self, value: Option<String>) -> Self {
355 self.ipxe_script = value;
356 self
357 }
358
359 pub fn set_launch_mode(mut self, value: Option<InstanceLaunchMode>) -> Self {
361 self.launch_mode = value;
362 self
363 }
364
365 pub fn set_launch_options(mut self, value: Option<LaunchOptions>) -> Self {
367 self.launch_options = value;
368 self
369 }
370
371 pub fn set_instance_options(mut self, value: Option<InstanceOptions>) -> Self {
373 self.instance_options = value;
374 self
375 }
376
377 pub fn set_availability_config(mut self, value: Option<InstanceAvailabilityConfig>) -> Self {
379 self.availability_config = value;
380 self
381 }
382
383 pub fn set_preemptible_instance_config(
385 mut self,
386 value: Option<PreemptibleInstanceConfigDetails>,
387 ) -> Self {
388 self.preemptible_instance_config = value;
389 self
390 }
391
392 pub fn set_lifecycle_state(mut self, value: InstanceLifecycleState) -> Self {
394 self.lifecycle_state = value;
395 self
396 }
397
398 pub fn set_metadata(mut self, value: Option<HashMap<String, String>>) -> Self {
400 self.metadata = value;
401 self
402 }
403
404 pub fn set_region(mut self, value: String) -> Self {
406 self.region = value;
407 self
408 }
409
410 pub fn set_shape(mut self, value: String) -> Self {
412 self.shape = value;
413 self
414 }
415
416 pub fn set_shape_config(mut self, value: Option<InstanceShapeConfig>) -> Self {
418 self.shape_config = value;
419 self
420 }
421
422 pub fn set_is_cross_numa_node(mut self, value: Option<bool>) -> Self {
424 self.is_cross_numa_node = value;
425 self
426 }
427
428 pub fn set_source_details(mut self, value: Option<InstanceSourceViaImageDetails>) -> Self {
430 self.source_details = value;
431 self
432 }
433
434 pub fn set_system_tags(
436 mut self,
437 value: Option<HashMap<String, HashMap<String, serde_json::Value>>>,
438 ) -> Self {
439 self.system_tags = value;
440 self
441 }
442
443 pub fn set_time_created(mut self, value: DateTime<Utc>) -> Self {
445 self.time_created = value;
446 self
447 }
448
449 pub fn set_agent_config(mut self, value: Option<InstanceAgentConfig>) -> Self {
451 self.agent_config = value;
452 self
453 }
454
455 pub fn set_time_maintenance_reboot_due(mut self, value: Option<DateTime<Utc>>) -> Self {
457 self.time_maintenance_reboot_due = value;
458 self
459 }
460
461 pub fn set_platform_config(mut self, value: Option<AmdMilanBmPlatformConfig>) -> Self {
463 self.platform_config = value;
464 self
465 }
466
467 pub fn set_instance_configuration_id(mut self, value: Option<String>) -> Self {
469 self.instance_configuration_id = value;
470 self
471 }
472
473 pub fn set_licensing_configs(mut self, value: Option<Vec<LicensingConfig>>) -> Self {
475 self.licensing_configs = value;
476 self
477 }
478
479 pub fn with_capacity_reservation_id(mut self, value: impl Into<String>) -> Self {
481 self.capacity_reservation_id = Some(value.into());
482 self
483 }
484
485 pub fn with_placement_constraint_details(
487 mut self,
488 value: HostGroupPlacementConstraintDetails,
489 ) -> Self {
490 self.placement_constraint_details = Some(value);
491 self
492 }
493
494 pub fn with_is_aienterprise_enabled(mut self, value: bool) -> Self {
496 self.is_aienterprise_enabled = Some(value);
497 self
498 }
499
500 pub fn with_cluster_placement_group_id(mut self, value: impl Into<String>) -> Self {
502 self.cluster_placement_group_id = Some(value.into());
503 self
504 }
505
506 pub fn with_dedicated_vm_host_id(mut self, value: impl Into<String>) -> Self {
508 self.dedicated_vm_host_id = Some(value.into());
509 self
510 }
511
512 pub fn with_defined_tags(
514 mut self,
515 value: HashMap<String, HashMap<String, serde_json::Value>>,
516 ) -> Self {
517 self.defined_tags = Some(value);
518 self
519 }
520
521 pub fn with_security_attributes(
523 mut self,
524 value: HashMap<String, HashMap<String, serde_json::Value>>,
525 ) -> Self {
526 self.security_attributes = Some(value);
527 self
528 }
529
530 pub fn with_security_attributes_state(
532 mut self,
533 value: InstanceSecurityAttributesState,
534 ) -> Self {
535 self.security_attributes_state = Some(value);
536 self
537 }
538
539 pub fn with_display_name(mut self, value: impl Into<String>) -> Self {
541 self.display_name = Some(value.into());
542 self
543 }
544
545 pub fn with_extended_metadata(mut self, value: HashMap<String, serde_json::Value>) -> Self {
547 self.extended_metadata = Some(value);
548 self
549 }
550
551 pub fn with_fault_domain(mut self, value: impl Into<String>) -> Self {
553 self.fault_domain = Some(value.into());
554 self
555 }
556
557 pub fn with_freeform_tags(mut self, value: HashMap<String, String>) -> Self {
559 self.freeform_tags = Some(value);
560 self
561 }
562
563 pub fn with_image_id(mut self, value: impl Into<String>) -> Self {
565 self.image_id = Some(value.into());
566 self
567 }
568
569 pub fn with_ipxe_script(mut self, value: impl Into<String>) -> Self {
571 self.ipxe_script = Some(value.into());
572 self
573 }
574
575 pub fn with_launch_mode(mut self, value: InstanceLaunchMode) -> Self {
577 self.launch_mode = Some(value);
578 self
579 }
580
581 pub fn with_launch_options(mut self, value: LaunchOptions) -> Self {
583 self.launch_options = Some(value);
584 self
585 }
586
587 pub fn with_instance_options(mut self, value: InstanceOptions) -> Self {
589 self.instance_options = Some(value);
590 self
591 }
592
593 pub fn with_availability_config(mut self, value: InstanceAvailabilityConfig) -> Self {
595 self.availability_config = Some(value);
596 self
597 }
598
599 pub fn with_preemptible_instance_config(
601 mut self,
602 value: PreemptibleInstanceConfigDetails,
603 ) -> Self {
604 self.preemptible_instance_config = Some(value);
605 self
606 }
607
608 pub fn with_metadata(mut self, value: HashMap<String, String>) -> Self {
610 self.metadata = Some(value);
611 self
612 }
613
614 pub fn with_shape_config(mut self, value: InstanceShapeConfig) -> Self {
616 self.shape_config = Some(value);
617 self
618 }
619
620 pub fn with_is_cross_numa_node(mut self, value: bool) -> Self {
622 self.is_cross_numa_node = Some(value);
623 self
624 }
625
626 pub fn with_source_details(mut self, value: InstanceSourceViaImageDetails) -> Self {
628 self.source_details = Some(value);
629 self
630 }
631
632 pub fn with_system_tags(
634 mut self,
635 value: HashMap<String, HashMap<String, serde_json::Value>>,
636 ) -> Self {
637 self.system_tags = Some(value);
638 self
639 }
640
641 pub fn with_agent_config(mut self, value: InstanceAgentConfig) -> Self {
643 self.agent_config = Some(value);
644 self
645 }
646
647 pub fn with_time_maintenance_reboot_due(mut self, value: DateTime<Utc>) -> Self {
649 self.time_maintenance_reboot_due = Some(value);
650 self
651 }
652
653 pub fn with_platform_config(mut self, value: AmdMilanBmPlatformConfig) -> Self {
655 self.platform_config = Some(value);
656 self
657 }
658
659 pub fn with_instance_configuration_id(mut self, value: impl Into<String>) -> Self {
661 self.instance_configuration_id = Some(value.into());
662 self
663 }
664
665 pub fn with_licensing_configs(mut self, value: Vec<LicensingConfig>) -> Self {
667 self.licensing_configs = Some(value);
668 self
669 }
670}