Skip to main content

oci_rust_sdk/core/models/
instance_availability_config.rs

1use serde::{Deserialize, Serialize};
2
3#[allow(unused_imports)]
4use super::*;
5/// Options for defining the availabiity of a VM instance after a maintenance event that impacts the underlying hardware.
6#[derive(Debug, Clone, Serialize, Deserialize)]
7#[serde(rename_all = "camelCase")]
8pub struct InstanceAvailabilityConfig {
9    /// Whether to live migrate supported VM instances to a healthy physical VM host without disrupting running instances during infrastructure maintenance events. If null, Oracle chooses the best option for migrating the VM during infrastructure maintenance events.
10    #[serde(skip_serializing_if = "Option::is_none")]
11    pub is_live_migration_preferred: Option<bool>,
12
13    /// The lifecycle state for an instance when it is recovered after infrastructure maintenance. * {@code RESTORE_INSTANCE} - The instance is restored to the lifecycle state it was in before the maintenance event. If the instance was running, it is automatically rebooted. This is the default action when a value is not set. * {@code STOP_INSTANCE} - The instance is recovered in the stopped state.
14    #[serde(skip_serializing_if = "Option::is_none")]
15    pub recovery_action: Option<InstanceAvailabilityConfigRecoveryAction>,
16}
17
18impl InstanceAvailabilityConfig {
19    /// Create a new InstanceAvailabilityConfig
20    pub fn new() -> Self {
21        Self {
22            is_live_migration_preferred: None,
23
24            recovery_action: None,
25        }
26    }
27
28    /// Set is_live_migration_preferred
29    pub fn set_is_live_migration_preferred(mut self, value: Option<bool>) -> Self {
30        self.is_live_migration_preferred = value;
31        self
32    }
33
34    /// Set recovery_action
35    pub fn set_recovery_action(
36        mut self,
37        value: Option<InstanceAvailabilityConfigRecoveryAction>,
38    ) -> Self {
39        self.recovery_action = value;
40        self
41    }
42
43    /// Set is_live_migration_preferred (unwraps Option)
44    pub fn with_is_live_migration_preferred(mut self, value: bool) -> Self {
45        self.is_live_migration_preferred = Some(value);
46        self
47    }
48
49    /// Set recovery_action (unwraps Option)
50    pub fn with_recovery_action(mut self, value: InstanceAvailabilityConfigRecoveryAction) -> Self {
51        self.recovery_action = Some(value);
52        self
53    }
54}
55
56impl Default for InstanceAvailabilityConfig {
57    fn default() -> Self {
58        Self::new()
59    }
60}