use serde::{Deserialize, Serialize}; /*
                                      * Compute Engine API
                                      *
                                      * Creates and runs virtual machines on Google Cloud Platform.
                                      *
                                      * The version of the OpenAPI document: v1
                                      *
                                      * Generated by: https://openapi-generator.tech
                                      */

use crate::google_rest_apis::compute_v1::models;

#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)]
pub struct InstanceGroupManagerInstanceLifecyclePolicy {
    /// The action that a MIG performs on a failed or an unhealthy VM. A VM is marked as unhealthy when the application running on that VM fails a health check. Valid values are - REPAIR (default): MIG automatically repairs a failed or an unhealthy VM by recreating it. For more information, see About repairing VMs in a MIG. - DO_NOTHING: MIG does not repair a failed or an unhealthy VM.
    #[serde(
        rename = "defaultActionOnFailure",
        skip_serializing_if = "Option::is_none"
    )]
    pub default_action_on_failure: Option<DefaultActionOnFailure>,
    /// A bit indicating whether to forcefully apply the group's latest configuration when repairing a VM. Valid options are: - NO (default): If configuration updates are available, they are not forcefully applied during repair. Instead, configuration updates are applied according to the group's update policy. - YES: If configuration updates are available, they are applied during repair.
    #[serde(
        rename = "forceUpdateOnRepair",
        skip_serializing_if = "Option::is_none"
    )]
    pub force_update_on_repair: Option<ForceUpdateOnRepair>,
}

impl InstanceGroupManagerInstanceLifecyclePolicy {
    pub fn new() -> InstanceGroupManagerInstanceLifecyclePolicy {
        InstanceGroupManagerInstanceLifecyclePolicy {
            default_action_on_failure: None,
            force_update_on_repair: None,
        }
    }
}
/// The action that a MIG performs on a failed or an unhealthy VM. A VM is marked as unhealthy when the application running on that VM fails a health check. Valid values are - REPAIR (default): MIG automatically repairs a failed or an unhealthy VM by recreating it. For more information, see About repairing VMs in a MIG. - DO_NOTHING: MIG does not repair a failed or an unhealthy VM.
#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)]
pub enum DefaultActionOnFailure {
    #[serde(rename = "DO_NOTHING")]
    DoNothing,
    #[serde(rename = "REPAIR")]
    Repair,
}

impl Default for DefaultActionOnFailure {
    fn default() -> DefaultActionOnFailure {
        Self::DoNothing
    }
}
/// A bit indicating whether to forcefully apply the group's latest configuration when repairing a VM. Valid options are: - NO (default): If configuration updates are available, they are not forcefully applied during repair. Instead, configuration updates are applied according to the group's update policy. - YES: If configuration updates are available, they are applied during repair.
#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)]
pub enum ForceUpdateOnRepair {
    #[serde(rename = "false")]
    False,
    #[serde(rename = "true")]
    True,
}

impl Default for ForceUpdateOnRepair {
    fn default() -> ForceUpdateOnRepair {
        Self::False
    }
}
