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
                                      */

/// ReservationAffinity : Specifies the reservations that this instance can consume from.

#[derive(Clone, Debug, PartialEq, Default, Serialize, Deserialize)]
pub struct ReservationAffinity {
    /// Specifies the type of reservation from which this instance can consume resources: ANY_RESERVATION (default), SPECIFIC_RESERVATION, or NO_RESERVATION. See Consuming reserved instances for examples.
    #[serde(
        rename = "consumeReservationType",
        skip_serializing_if = "Option::is_none"
    )]
    pub consume_reservation_type: Option<ConsumeReservationType>,
    /// Corresponds to the label key of a reservation resource. To target a SPECIFIC_RESERVATION by name, specify googleapis.com/reservation-name as the key and specify the name of your reservation as its value.
    #[serde(rename = "key", skip_serializing_if = "Option::is_none")]
    pub key: Option<String>,
    /// Corresponds to the label values of a reservation resource. This can be either a name to a reservation in the same project or \"projects/different-project/reservations/some-reservation-name\" to target a shared reservation in the same zone but in a different project.
    #[serde(rename = "values", skip_serializing_if = "Option::is_none")]
    pub values: Option<Vec<String>>,
}

impl ReservationAffinity {
    /// Specifies the reservations that this instance can consume from.
    pub fn new() -> ReservationAffinity {
        ReservationAffinity {
            consume_reservation_type: None,
            key: None,
            values: None,
        }
    }
}

/// Specifies the type of reservation from which this instance can consume resources: ANY_RESERVATION (default), SPECIFIC_RESERVATION, or NO_RESERVATION. See Consuming reserved instances for examples.
#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)]
pub enum ConsumeReservationType {
    #[serde(rename = "ANY_RESERVATION")]
    AnyReservation,
    #[serde(rename = "NO_RESERVATION")]
    NoReservation,
    #[serde(rename = "SPECIFIC_RESERVATION")]
    SpecificReservation,
    #[serde(rename = "UNSPECIFIED")]
    Unspecified,
}

impl Default for ConsumeReservationType {
    fn default() -> ConsumeReservationType {
        Self::AnyReservation
    }
}
