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 RouterBgpPeer {
    /// User-specified flag to indicate which mode to use for advertisement.
    #[serde(rename = "advertiseMode", skip_serializing_if = "Option::is_none")]
    pub advertise_mode: Option<AdvertiseMode>,
    /// User-specified list of prefix groups to advertise in custom mode, which currently supports the following option: - ALL_SUBNETS: Advertises all of the router's own VPC subnets. This excludes any routes learned for subnets that use VPC Network Peering. Note that this field can only be populated if advertise_mode is CUSTOM and overrides the list defined for the router (in the \"bgp\" message). These groups are advertised in addition to any specified prefixes. Leave this field blank to advertise no custom groups.
    #[serde(rename = "advertisedGroups", skip_serializing_if = "Option::is_none")]
    pub advertised_groups: Option<Vec<AdvertisedGroups>>,
    /// User-specified list of individual IP ranges to advertise in custom mode. This field can only be populated if advertise_mode is CUSTOM and overrides the list defined for the router (in the \"bgp\" message). These IP ranges are advertised in addition to any specified groups. Leave this field blank to advertise no custom IP ranges.
    #[serde(rename = "advertisedIpRanges", skip_serializing_if = "Option::is_none")]
    pub advertised_ip_ranges: Option<Vec<models::RouterAdvertisedIpRange>>,
    /// The priority of routes advertised to this BGP peer. Where there is more than one matching route of maximum length, the routes with the lowest priority value win.
    #[serde(
        rename = "advertisedRoutePriority",
        skip_serializing_if = "Option::is_none"
    )]
    pub advertised_route_priority: Option<i32>,
    #[serde(rename = "bfd", skip_serializing_if = "Option::is_none")]
    pub bfd: Option<Box<models::RouterBgpPeerBfd>>,
    /// A list of user-defined custom learned route IP address ranges for a BGP session.
    #[serde(
        rename = "customLearnedIpRanges",
        skip_serializing_if = "Option::is_none"
    )]
    pub custom_learned_ip_ranges: Option<Vec<models::RouterBgpPeerCustomLearnedIpRange>>,
    /// The user-defined custom learned route priority for a BGP session. This value is applied to all custom learned route ranges for the session. You can choose a value from `0` to `65335`. If you don't provide a value, Google Cloud assigns a priority of `100` to the ranges.
    #[serde(
        rename = "customLearnedRoutePriority",
        skip_serializing_if = "Option::is_none"
    )]
    pub custom_learned_route_priority: Option<i32>,
    /// The status of the BGP peer connection. If set to FALSE, any active session with the peer is terminated and all associated routing information is removed. If set to TRUE, the peer connection can be established with routing information. The default is TRUE.
    #[serde(rename = "enable", skip_serializing_if = "Option::is_none")]
    pub enable: Option<Enable>,
    /// Enable IPv6 traffic over BGP Peer. If not specified, it is disabled by default.
    #[serde(rename = "enableIpv6", skip_serializing_if = "Option::is_none")]
    pub enable_ipv6: Option<bool>,
    /// Name of the interface the BGP peer is associated with.
    #[serde(rename = "interfaceName", skip_serializing_if = "Option::is_none")]
    pub interface_name: Option<String>,
    /// IP address of the interface inside Google Cloud Platform. Only IPv4 is supported.
    #[serde(rename = "ipAddress", skip_serializing_if = "Option::is_none")]
    pub ip_address: Option<String>,
    /// IPv6 address of the interface inside Google Cloud Platform.
    #[serde(rename = "ipv6NexthopAddress", skip_serializing_if = "Option::is_none")]
    pub ipv6_nexthop_address: Option<String>,
    /// [Output Only] The resource that configures and manages this BGP peer. - MANAGED_BY_USER is the default value and can be managed by you or other users - MANAGED_BY_ATTACHMENT is a BGP peer that is configured and managed by Cloud Interconnect, specifically by an InterconnectAttachment of type PARTNER. Google automatically creates, updates, and deletes this type of BGP peer when the PARTNER InterconnectAttachment is created, updated, or deleted.
    #[serde(rename = "managementType", skip_serializing_if = "Option::is_none")]
    pub management_type: Option<ManagementType>,
    /// Present if MD5 authentication is enabled for the peering. Must be the name of one of the entries in the Router.md5_authentication_keys. The field must comply with RFC1035.
    #[serde(
        rename = "md5AuthenticationKeyName",
        skip_serializing_if = "Option::is_none"
    )]
    pub md5_authentication_key_name: Option<String>,
    /// Name of this BGP peer. 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>,
    /// Peer BGP Autonomous System Number (ASN). Each BGP interface may use a different value.
    #[serde(rename = "peerAsn", skip_serializing_if = "Option::is_none")]
    pub peer_asn: Option<i32>,
    /// IP address of the BGP interface outside Google Cloud Platform. Only IPv4 is supported.
    #[serde(rename = "peerIpAddress", skip_serializing_if = "Option::is_none")]
    pub peer_ip_address: Option<String>,
    /// IPv6 address of the BGP interface outside Google Cloud Platform.
    #[serde(
        rename = "peerIpv6NexthopAddress",
        skip_serializing_if = "Option::is_none"
    )]
    pub peer_ipv6_nexthop_address: Option<String>,
    /// URI of the VM instance that is used as third-party router appliances such as Next Gen Firewalls, Virtual Routers, or Router Appliances. The VM instance must be located in zones contained in the same region as this Cloud Router. The VM instance is the peer side of the BGP session.
    #[serde(
        rename = "routerApplianceInstance",
        skip_serializing_if = "Option::is_none"
    )]
    pub router_appliance_instance: Option<String>,
}

impl RouterBgpPeer {
    pub fn new() -> RouterBgpPeer {
        RouterBgpPeer {
            advertise_mode: None,
            advertised_groups: None,
            advertised_ip_ranges: None,
            advertised_route_priority: None,
            bfd: None,
            custom_learned_ip_ranges: None,
            custom_learned_route_priority: None,
            enable: None,
            enable_ipv6: None,
            interface_name: None,
            ip_address: None,
            ipv6_nexthop_address: None,
            management_type: None,
            md5_authentication_key_name: None,
            name: None,
            peer_asn: None,
            peer_ip_address: None,
            peer_ipv6_nexthop_address: None,
            router_appliance_instance: None,
        }
    }
}
/// User-specified flag to indicate which mode to use for advertisement.
#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)]
pub enum AdvertiseMode {
    #[serde(rename = "CUSTOM")]
    Custom,
    #[serde(rename = "DEFAULT")]
    Default,
}

impl Default for AdvertiseMode {
    fn default() -> AdvertiseMode {
        Self::Custom
    }
}
/// User-specified list of prefix groups to advertise in custom mode, which currently supports the following option: - ALL_SUBNETS: Advertises all of the router's own VPC subnets. This excludes any routes learned for subnets that use VPC Network Peering. Note that this field can only be populated if advertise_mode is CUSTOM and overrides the list defined for the router (in the \"bgp\" message). These groups are advertised in addition to any specified prefixes. Leave this field blank to advertise no custom groups.
#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)]
pub enum AdvertisedGroups {
    #[serde(rename = "ALL_SUBNETS")]
    AllSubnets,
}

impl Default for AdvertisedGroups {
    fn default() -> AdvertisedGroups {
        Self::AllSubnets
    }
}
/// The status of the BGP peer connection. If set to FALSE, any active session with the peer is terminated and all associated routing information is removed. If set to TRUE, the peer connection can be established with routing information. The default is TRUE.
#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)]
pub enum Enable {
    #[serde(rename = "FALSE")]
    False,
    #[serde(rename = "TRUE")]
    True,
}

impl Default for Enable {
    fn default() -> Enable {
        Self::False
    }
}
/// [Output Only] The resource that configures and manages this BGP peer. - MANAGED_BY_USER is the default value and can be managed by you or other users - MANAGED_BY_ATTACHMENT is a BGP peer that is configured and managed by Cloud Interconnect, specifically by an InterconnectAttachment of type PARTNER. Google automatically creates, updates, and deletes this type of BGP peer 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
    }
}
