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

/// NetworkEndpointGroup : Represents a collection of network endpoints. A network endpoint group (NEG) defines how a set of endpoints should be reached, whether they are reachable, and where they are located. For more information about using NEGs for different use cases, see Network endpoint groups overview.

#[derive(Clone, Debug, PartialEq, Default, Serialize, Deserialize)]
pub struct NetworkEndpointGroup {
    /// Metadata defined as annotations on the network endpoint group.
    #[serde(rename = "annotations", skip_serializing_if = "Option::is_none")]
    pub annotations: Option<::std::collections::HashMap<String, String>>,
    #[serde(rename = "appEngine", skip_serializing_if = "Option::is_none")]
    pub app_engine:
        Option<Box<crate::google_rest_apis::compute_v1::models::NetworkEndpointGroupAppEngine>>,
    #[serde(rename = "cloudFunction", skip_serializing_if = "Option::is_none")]
    pub cloud_function:
        Option<Box<crate::google_rest_apis::compute_v1::models::NetworkEndpointGroupCloudFunction>>,
    #[serde(rename = "cloudRun", skip_serializing_if = "Option::is_none")]
    pub cloud_run:
        Option<Box<crate::google_rest_apis::compute_v1::models::NetworkEndpointGroupCloudRun>>,
    /// [Output Only] Creation timestamp in RFC3339 text format.
    #[serde(rename = "creationTimestamp", skip_serializing_if = "Option::is_none")]
    pub creation_timestamp: Option<String>,
    /// The default port used if the port number is not specified in the network endpoint.
    #[serde(rename = "defaultPort", skip_serializing_if = "Option::is_none")]
    pub default_port: Option<i32>,
    /// An optional description of this resource. Provide this property when you create the resource.
    #[serde(rename = "description", skip_serializing_if = "Option::is_none")]
    pub description: 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>,
    /// [Output Only] Type of the resource. Always compute#networkEndpointGroup for network endpoint group.
    #[serde(rename = "kind", skip_serializing_if = "Option::is_none")]
    pub kind: Option<String>,
    /// 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])?` which means the first character must be a lowercase letter, and all following characters must be a dash, lowercase letter, or digit, except the last character, which cannot be a dash.
    #[serde(rename = "name", skip_serializing_if = "Option::is_none")]
    pub name: Option<String>,
    /// The URL of the network to which all network endpoints in the NEG belong. Uses \"default\" project network if unspecified.
    #[serde(rename = "network", skip_serializing_if = "Option::is_none")]
    pub network: Option<String>,
    /// Type of network endpoints in this network endpoint group. Can be one of GCE_VM_IP, GCE_VM_IP_PORT, NON_GCP_PRIVATE_IP_PORT, INTERNET_FQDN_PORT, INTERNET_IP_PORT, SERVERLESS, PRIVATE_SERVICE_CONNECT.
    #[serde(
        rename = "networkEndpointType",
        skip_serializing_if = "Option::is_none"
    )]
    pub network_endpoint_type: Option<NetworkEndpointType>,
    #[serde(rename = "pscData", skip_serializing_if = "Option::is_none")]
    pub psc_data:
        Option<Box<crate::google_rest_apis::compute_v1::models::NetworkEndpointGroupPscData>>,
    /// The target service url used to set up private service connection to a Google API or a PSC Producer Service Attachment. An example value is: \"asia-northeast3-cloudkms.googleapis.com\"
    #[serde(rename = "pscTargetService", skip_serializing_if = "Option::is_none")]
    pub psc_target_service: Option<String>,
    /// [Output Only] The URL of the region where the network endpoint group is located.
    #[serde(rename = "region", skip_serializing_if = "Option::is_none")]
    pub region: Option<String>,
    /// [Output Only] Server-defined URL for the resource.
    #[serde(rename = "selfLink", skip_serializing_if = "Option::is_none")]
    pub self_link: Option<String>,
    /// [Output only] Number of network endpoints in the network endpoint group.
    #[serde(rename = "size", skip_serializing_if = "Option::is_none")]
    pub size: Option<i32>,
    /// Optional URL of the subnetwork to which all network endpoints in the NEG belong.
    #[serde(rename = "subnetwork", skip_serializing_if = "Option::is_none")]
    pub subnetwork: Option<String>,
    /// [Output Only] The URL of the zone where the network endpoint group is located.
    #[serde(rename = "zone", skip_serializing_if = "Option::is_none")]
    pub zone: Option<String>,
}

impl NetworkEndpointGroup {
    /// Represents a collection of network endpoints. A network endpoint group (NEG) defines how a set of endpoints should be reached, whether they are reachable, and where they are located. For more information about using NEGs for different use cases, see Network endpoint groups overview.
    pub fn new() -> NetworkEndpointGroup {
        NetworkEndpointGroup {
            annotations: None,
            app_engine: None,
            cloud_function: None,
            cloud_run: None,
            creation_timestamp: None,
            default_port: None,
            description: None,
            id: None,
            kind: None,
            name: None,
            network: None,
            network_endpoint_type: None,
            psc_data: None,
            psc_target_service: None,
            region: None,
            self_link: None,
            size: None,
            subnetwork: None,
            zone: None,
        }
    }
}

/// Type of network endpoints in this network endpoint group. Can be one of GCE_VM_IP, GCE_VM_IP_PORT, NON_GCP_PRIVATE_IP_PORT, INTERNET_FQDN_PORT, INTERNET_IP_PORT, SERVERLESS, PRIVATE_SERVICE_CONNECT.
#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)]
pub enum NetworkEndpointType {
    #[serde(rename = "GCE_VM_IP")]
    GceVmIp,
    #[serde(rename = "GCE_VM_IP_PORT")]
    GceVmIpPort,
    #[serde(rename = "INTERNET_FQDN_PORT")]
    InternetFqdnPort,
    #[serde(rename = "INTERNET_IP_PORT")]
    InternetIpPort,
    #[serde(rename = "NON_GCP_PRIVATE_IP_PORT")]
    NonGcpPrivateIpPort,
    #[serde(rename = "PRIVATE_SERVICE_CONNECT")]
    PrivateServiceConnect,
    #[serde(rename = "SERVERLESS")]
    Serverless,
}

impl Default for NetworkEndpointType {
    fn default() -> NetworkEndpointType {
        Self::GceVmIp
    }
}
