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 InstanceProperties {
    #[serde(
        rename = "advancedMachineFeatures",
        skip_serializing_if = "Option::is_none"
    )]
    pub advanced_machine_features: Option<Box<models::AdvancedMachineFeatures>>,
    /// Enables instances created based on these properties to send packets with source IP addresses other than their own and receive packets with destination IP addresses other than their own. If these instances will be used as an IP gateway or it will be set as the next-hop in a Route resource, specify true. If unsure, leave this set to false. See the Enable IP forwarding documentation for more information.
    #[serde(rename = "canIpForward", skip_serializing_if = "Option::is_none")]
    pub can_ip_forward: Option<bool>,
    #[serde(
        rename = "confidentialInstanceConfig",
        skip_serializing_if = "Option::is_none"
    )]
    pub confidential_instance_config: Option<Box<models::ConfidentialInstanceConfig>>,
    /// An optional text description for the instances that are created from these properties.
    #[serde(rename = "description", skip_serializing_if = "Option::is_none")]
    pub description: Option<String>,
    /// An array of disks that are associated with the instances that are created from these properties.
    #[serde(rename = "disks", skip_serializing_if = "Option::is_none")]
    pub disks: Option<Vec<models::AttachedDisk>>,
    /// A list of guest accelerator cards' type and count to use for instances created from these properties.
    #[serde(rename = "guestAccelerators", skip_serializing_if = "Option::is_none")]
    pub guest_accelerators: Option<Vec<models::AcceleratorConfig>>,
    /// KeyRevocationActionType of the instance. Supported options are \"STOP\" and \"NONE\". The default value is \"NONE\" if it is not specified.
    #[serde(
        rename = "keyRevocationActionType",
        skip_serializing_if = "Option::is_none"
    )]
    pub key_revocation_action_type: Option<KeyRevocationActionType>,
    /// Labels to apply to instances that are created from these properties.
    #[serde(rename = "labels", skip_serializing_if = "Option::is_none")]
    pub labels: Option<std::collections::HashMap<String, String>>,
    /// The machine type to use for instances that are created from these properties.
    #[serde(rename = "machineType", skip_serializing_if = "Option::is_none")]
    pub machine_type: Option<String>,
    #[serde(rename = "metadata", skip_serializing_if = "Option::is_none")]
    pub metadata: Option<Box<models::Metadata>>,
    /// Minimum cpu/platform to be used by instances. The instance may be scheduled on the specified or newer cpu/platform. Applicable values are the friendly names of CPU platforms, such as minCpuPlatform: \"Intel Haswell\" or minCpuPlatform: \"Intel Sandy Bridge\". For more information, read Specifying a Minimum CPU Platform.
    #[serde(rename = "minCpuPlatform", skip_serializing_if = "Option::is_none")]
    pub min_cpu_platform: Option<String>,
    /// An array of network access configurations for this interface.
    #[serde(rename = "networkInterfaces", skip_serializing_if = "Option::is_none")]
    pub network_interfaces: Option<Vec<models::NetworkInterface>>,
    #[serde(
        rename = "networkPerformanceConfig",
        skip_serializing_if = "Option::is_none"
    )]
    pub network_performance_config: Option<Box<models::NetworkPerformanceConfig>>,
    /// The private IPv6 google access type for VMs. If not specified, use INHERIT_FROM_SUBNETWORK as default. Note that for MachineImage, this is not supported yet.
    #[serde(
        rename = "privateIpv6GoogleAccess",
        skip_serializing_if = "Option::is_none"
    )]
    pub private_ipv6_google_access: Option<PrivateIpv6GoogleAccess>,
    #[serde(
        rename = "reservationAffinity",
        skip_serializing_if = "Option::is_none"
    )]
    pub reservation_affinity: Option<Box<models::ReservationAffinity>>,
    /// Resource manager tags to be bound to the instance. Tag keys and values have the same definition as resource manager tags. Keys must be in the format `tagKeys/{tag_key_id}`, and values are in the format `tagValues/456`. The field is ignored (both PUT & PATCH) when empty.
    #[serde(
        rename = "resourceManagerTags",
        skip_serializing_if = "Option::is_none"
    )]
    pub resource_manager_tags: Option<std::collections::HashMap<String, String>>,
    /// Resource policies (names, not URLs) applied to instances created from these properties. Note that for MachineImage, this is not supported yet.
    #[serde(rename = "resourcePolicies", skip_serializing_if = "Option::is_none")]
    pub resource_policies: Option<Vec<String>>,
    #[serde(rename = "scheduling", skip_serializing_if = "Option::is_none")]
    pub scheduling: Option<Box<models::Scheduling>>,
    /// A list of service accounts with specified scopes. Access tokens for these service accounts are available to the instances that are created from these properties. Use metadata queries to obtain the access tokens for these instances.
    #[serde(rename = "serviceAccounts", skip_serializing_if = "Option::is_none")]
    pub service_accounts: Option<Vec<models::ServiceAccount>>,
    #[serde(
        rename = "shieldedInstanceConfig",
        skip_serializing_if = "Option::is_none"
    )]
    pub shielded_instance_config: Option<Box<models::ShieldedInstanceConfig>>,
    #[serde(rename = "tags", skip_serializing_if = "Option::is_none")]
    pub tags: Option<Box<models::Tags>>,
}

impl InstanceProperties {
    pub fn new() -> InstanceProperties {
        InstanceProperties {
            advanced_machine_features: None,
            can_ip_forward: None,
            confidential_instance_config: None,
            description: None,
            disks: None,
            guest_accelerators: None,
            key_revocation_action_type: None,
            labels: None,
            machine_type: None,
            metadata: None,
            min_cpu_platform: None,
            network_interfaces: None,
            network_performance_config: None,
            private_ipv6_google_access: None,
            reservation_affinity: None,
            resource_manager_tags: None,
            resource_policies: None,
            scheduling: None,
            service_accounts: None,
            shielded_instance_config: None,
            tags: None,
        }
    }
}
/// KeyRevocationActionType of the instance. Supported options are \"STOP\" and \"NONE\". The default value is \"NONE\" if it is not specified.
#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)]
pub enum KeyRevocationActionType {
    #[serde(rename = "KEY_REVOCATION_ACTION_TYPE_UNSPECIFIED")]
    KeyRevocationActionTypeUnspecified,
    #[serde(rename = "NONE")]
    None,
    #[serde(rename = "STOP")]
    Stop,
}

impl Default for KeyRevocationActionType {
    fn default() -> KeyRevocationActionType {
        Self::KeyRevocationActionTypeUnspecified
    }
}
/// The private IPv6 google access type for VMs. If not specified, use INHERIT_FROM_SUBNETWORK as default. Note that for MachineImage, this is not supported yet.
#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)]
pub enum PrivateIpv6GoogleAccess {
    #[serde(rename = "ENABLE_BIDIRECTIONAL_ACCESS_TO_GOOGLE")]
    EnableBidirectionalAccessToGoogle,
    #[serde(rename = "ENABLE_OUTBOUND_VM_ACCESS_TO_GOOGLE")]
    EnableOutboundVmAccessToGoogle,
    #[serde(rename = "INHERIT_FROM_SUBNETWORK")]
    InheritFromSubnetwork,
}

impl Default for PrivateIpv6GoogleAccess {
    fn default() -> PrivateIpv6GoogleAccess {
        Self::EnableBidirectionalAccessToGoogle
    }
}
