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

/// Network : Represents a VPC Network resource. Networks connect resources to each other and to the internet. For more information, read Virtual Private Cloud (VPC) Network.

#[derive(Clone, Debug, PartialEq, Default, Serialize, Deserialize)]
pub struct Network {
    /// Deprecated in favor of subnet mode networks. The range of internal addresses that are legal on this network. This range is a CIDR specification, for example: 192.168.0.0/16. Provided by the client when the network is created.
    #[serde(rename = "IPv4Range", skip_serializing_if = "Option::is_none")]
    pub ipv4_range: Option<String>,
    /// Must be set to create a VPC network. If not set, a legacy network is created. When set to true, the VPC network is created in auto mode. When set to false, the VPC network is created in custom mode. An auto mode VPC network starts with one subnet per region. Each subnet has a predetermined range as described in Auto mode VPC network IP ranges. For custom mode VPC networks, you can add subnets using the subnetworks insert method.
    #[serde(
        rename = "autoCreateSubnetworks",
        skip_serializing_if = "Option::is_none"
    )]
    pub auto_create_subnetworks: Option<bool>,
    /// [Output Only] Creation timestamp in RFC3339 text format.
    #[serde(rename = "creationTimestamp", skip_serializing_if = "Option::is_none")]
    pub creation_timestamp: Option<String>,
    /// An optional description of this resource. Provide this field when you create the resource.
    #[serde(rename = "description", skip_serializing_if = "Option::is_none")]
    pub description: Option<String>,
    /// Enable ULA internal ipv6 on this network. Enabling this feature will assign a /48 from google defined ULA prefix fd20::/20. .
    #[serde(
        rename = "enableUlaInternalIpv6",
        skip_serializing_if = "Option::is_none"
    )]
    pub enable_ula_internal_ipv6: Option<bool>,
    /// [Output Only] URL of the firewall policy the network is associated with.
    #[serde(rename = "firewallPolicy", skip_serializing_if = "Option::is_none")]
    pub firewall_policy: Option<String>,
    /// [Output Only] The gateway address for default routing out of the network, selected by Google Cloud.
    #[serde(rename = "gatewayIPv4", skip_serializing_if = "Option::is_none")]
    pub gateway_ipv4: Option<String>,
    /// [Output Only] The unique identifier for the resource. This identifier is defined by the server.
    #[serde(rename = "id", skip_serializing_if = "Option::is_none")]
    pub id: Option<String>,
    /// When enabling ula internal ipv6, caller optionally can specify the /48 range they want from the google defined ULA prefix fd20::/20. The input must be a valid /48 ULA IPv6 address and must be within the fd20::/20. Operation will fail if the speficied /48 is already in used by another resource. If the field is not speficied, then a /48 range will be randomly allocated from fd20::/20 and returned via this field. .
    #[serde(rename = "internalIpv6Range", skip_serializing_if = "Option::is_none")]
    pub internal_ipv6_range: Option<String>,
    /// [Output Only] Type of the resource. Always compute#network for networks.
    #[serde(rename = "kind", skip_serializing_if = "Option::is_none")]
    pub kind: Option<String>,
    /// Maximum Transmission Unit in bytes. The minimum value for this field is 1300 and the maximum value is 8896. The suggested value is 1500, which is the default MTU used on the Internet, or 8896 if you want to use Jumbo frames. If unspecified, the value defaults to 1460.
    #[serde(rename = "mtu", skip_serializing_if = "Option::is_none")]
    pub mtu: Option<i32>,
    /// Name of the resource. Provided by the client when the resource is created. The name must be 1-63 characters long, and comply with RFC1035. Specifically, the name must be 1-63 characters long and match the regular expression `[a-z]([-a-z0-9]*[a-z0-9])?`. The first character must be a lowercase letter, and all following characters (except for the last character) must be a dash, lowercase letter, or digit. The last character must be a lowercase letter or digit.
    #[serde(rename = "name", skip_serializing_if = "Option::is_none")]
    pub name: Option<String>,
    /// The network firewall policy enforcement order. Can be either AFTER_CLASSIC_FIREWALL or BEFORE_CLASSIC_FIREWALL. Defaults to AFTER_CLASSIC_FIREWALL if the field is not specified.
    #[serde(
        rename = "networkFirewallPolicyEnforcementOrder",
        skip_serializing_if = "Option::is_none"
    )]
    pub network_firewall_policy_enforcement_order: Option<NetworkFirewallPolicyEnforcementOrder>,
    /// [Output Only] A list of network peerings for the resource.
    #[serde(rename = "peerings", skip_serializing_if = "Option::is_none")]
    pub peerings: Option<Vec<crate::google_rest_apis::compute_v1::models::NetworkPeering>>,
    #[serde(rename = "routingConfig", skip_serializing_if = "Option::is_none")]
    pub routing_config:
        Option<Box<crate::google_rest_apis::compute_v1::models::NetworkRoutingConfig>>,
    /// [Output Only] Server-defined URL for the resource.
    #[serde(rename = "selfLink", skip_serializing_if = "Option::is_none")]
    pub self_link: Option<String>,
    /// [Output Only] Server-defined URL for this resource with the resource id.
    #[serde(rename = "selfLinkWithId", skip_serializing_if = "Option::is_none")]
    pub self_link_with_id: Option<String>,
    /// [Output Only] Server-defined fully-qualified URLs for all subnetworks in this VPC network.
    #[serde(rename = "subnetworks", skip_serializing_if = "Option::is_none")]
    pub subnetworks: Option<Vec<String>>,
}

impl Network {
    /// Represents a VPC Network resource. Networks connect resources to each other and to the internet. For more information, read Virtual Private Cloud (VPC) Network.
    pub fn new() -> Network {
        Network {
            ipv4_range: None,
            auto_create_subnetworks: None,
            creation_timestamp: None,
            description: None,
            enable_ula_internal_ipv6: None,
            firewall_policy: None,
            gateway_ipv4: None,
            id: None,
            internal_ipv6_range: None,
            kind: None,
            mtu: None,
            name: None,
            network_firewall_policy_enforcement_order: None,
            peerings: None,
            routing_config: None,
            self_link: None,
            self_link_with_id: None,
            subnetworks: None,
        }
    }
}

/// The network firewall policy enforcement order. Can be either AFTER_CLASSIC_FIREWALL or BEFORE_CLASSIC_FIREWALL. Defaults to AFTER_CLASSIC_FIREWALL if the field is not specified.
#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)]
pub enum NetworkFirewallPolicyEnforcementOrder {
    #[serde(rename = "AFTER_CLASSIC_FIREWALL")]
    AfterClassicFirewall,
    #[serde(rename = "BEFORE_CLASSIC_FIREWALL")]
    BeforeClassicFirewall,
}

impl Default for NetworkFirewallPolicyEnforcementOrder {
    fn default() -> NetworkFirewallPolicyEnforcementOrder {
        Self::AfterClassicFirewall
    }
}
