/*
 * Hetzner Cloud API
 *
 * Copied from the official API documentation for the Public Hetzner Cloud.
 *
 * The version of the OpenAPI document: 4b3f595
 *
 * Generated by: https://openapi-generator.tech
 */

use crate::models;
use serde::{Deserialize, Serialize};

/// Route : Request for POST https://api.hetzner.cloud/v1/networks/{id}/actions/add_route | Request for POST https://api.hetzner.cloud/v1/networks/{id}/actions/delete_route
#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)]
pub struct Route {
    /// Destination network or host of the route.  Packages addressed for IPs matching the destination IP prefix will be send to the specified gateway.  Must be one of * private IPv4 ranges of RFC1918 * or `0.0.0.0/0`.  Must not overlap with * an existing ip_range in any subnets * or with any destinations in other routes * or with `172.31.1.1`.  `172.31.1.1` is being used as a gateway for the public network interface of Servers.
    #[serde(rename = "destination")]
    pub destination: String,
    /// Gateway of the route.  Packages addressed for the specified destination will be send to this IP address.  Cannot be * the first IP of the networks ip_range, * an IP behind a vSwitch or * `172.31.1.1`.  `172.31.1.1` is being used as a gateway for the public network interface of Servers.
    #[serde(rename = "gateway")]
    pub gateway: String,
}

impl Route {
    /// Request for POST https://api.hetzner.cloud/v1/networks/{id}/actions/add_route | Request for POST https://api.hetzner.cloud/v1/networks/{id}/actions/delete_route
    pub fn new(destination: String, gateway: String) -> Route {
        Route {
            destination,
            gateway,
        }
    }
}
