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

#[derive(Clone, Debug, PartialEq, Default, Serialize, Deserialize)]
pub struct RouterInterface {
    /// IP address and range of the interface. The IP range must be in the RFC3927 link-local IP address space. The value must be a CIDR-formatted string, for example: 169.254.0.1/30. NOTE: Do not truncate the address as it represents the IP address of the interface.
    #[serde(rename = "ipRange", skip_serializing_if = "Option::is_none")]
    pub ip_range: Option<String>,
    /// URI of the linked Interconnect attachment. It must be in the same region as the router. Each interface can have one linked resource, which can be a VPN tunnel, an Interconnect attachment, or a subnetwork.
    #[serde(
        rename = "linkedInterconnectAttachment",
        skip_serializing_if = "Option::is_none"
    )]
    pub linked_interconnect_attachment: Option<String>,
    /// URI of the linked VPN tunnel, which must be in the same region as the router. Each interface can have one linked resource, which can be a VPN tunnel, an Interconnect attachment, or a subnetwork.
    #[serde(rename = "linkedVpnTunnel", skip_serializing_if = "Option::is_none")]
    pub linked_vpn_tunnel: Option<String>,
    /// [Output Only] The resource that configures and manages this interface. - MANAGED_BY_USER is the default value and can be managed directly by users. - MANAGED_BY_ATTACHMENT is an interface that is configured and managed by Cloud Interconnect, specifically, by an InterconnectAttachment of type PARTNER. Google automatically creates, updates, and deletes this type of interface when the PARTNER InterconnectAttachment is created, updated, or deleted.
    #[serde(rename = "managementType", skip_serializing_if = "Option::is_none")]
    pub management_type: Option<ManagementType>,
    /// Name of this interface entry. 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 regional private internal IP address that is used to establish BGP sessions to a VM instance acting as a third-party Router Appliance, such as a Next Gen Firewall, a Virtual Router, or an SD-WAN VM.
    #[serde(rename = "privateIpAddress", skip_serializing_if = "Option::is_none")]
    pub private_ip_address: Option<String>,
    /// Name of the interface that will be redundant with the current interface you are creating. The redundantInterface must belong to the same Cloud Router as the interface here. To establish the BGP session to a Router Appliance VM, you must create two BGP peers. The two BGP peers must be attached to two separate interfaces that are redundant with each other. The redundant_interface must be 1-63 characters long, and comply with RFC1035. Specifically, the redundant_interface 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 = "redundantInterface", skip_serializing_if = "Option::is_none")]
    pub redundant_interface: Option<String>,
    /// The URI of the subnetwork resource that this interface belongs to, which must be in the same region as the Cloud Router. When you establish a BGP session to a VM instance using this interface, the VM instance must belong to the same subnetwork as the subnetwork specified here.
    #[serde(rename = "subnetwork", skip_serializing_if = "Option::is_none")]
    pub subnetwork: Option<String>,
}

impl RouterInterface {
    pub fn new() -> RouterInterface {
        RouterInterface {
            ip_range: None,
            linked_interconnect_attachment: None,
            linked_vpn_tunnel: None,
            management_type: None,
            name: None,
            private_ip_address: None,
            redundant_interface: None,
            subnetwork: None,
        }
    }
}

/// [Output Only] The resource that configures and manages this interface. - MANAGED_BY_USER is the default value and can be managed directly by users. - MANAGED_BY_ATTACHMENT is an interface that is configured and managed by Cloud Interconnect, specifically, by an InterconnectAttachment of type PARTNER. Google automatically creates, updates, and deletes this type of interface when the PARTNER InterconnectAttachment is created, updated, or deleted.
#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)]
pub enum ManagementType {
    #[serde(rename = "MANAGED_BY_ATTACHMENT")]
    Attachment,
    #[serde(rename = "MANAGED_BY_USER")]
    User,
}

impl Default for ManagementType {
    fn default() -> ManagementType {
        Self::Attachment
    }
}
