1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
/*
* Hetzner Cloud API
*
* Copied from the official API documentation for the Public Hetzner Cloud.
*
* The version of the OpenAPI document: 0.28.0
*
* Generated by: https://openapi-generator.tech
*/
use crate::models;
use serde::{Deserialize, Serialize};
#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)]
pub struct SubnetWithGateway {
/// Gateway for Servers attached to this subnet. For subnets of type `server` this is always the first IP of the subnets IP range.
#[serde(rename = "gateway")]
pub gateway: String,
/// IP range of the subnet. Uses CIDR notation.
#[serde(rename = "ip_range", skip_serializing_if = "Option::is_none")]
pub ip_range: Option<String>,
/// Name of the Network Zone. The Location contains the `network_zone` property it belongs to.
#[serde(rename = "network_zone")]
pub network_zone: String,
/// Type of subnet. - `cloud` - Used to connect cloud Servers and Load Balancers. - `server` - Same as the `cloud` type. **Deprecated**, use the `cloud` type instead. - `vswitch` - Used to [connect cloud Servers and Load Balancers with dedicated Servers](https://docs.hetzner.com/cloud/networks/connect-dedi-vswitch).
#[serde(rename = "type")]
pub r#type: Type,
/// ID of the robot vSwitch if the subnet is of type `vswitch`.
#[serde(
rename = "vswitch_id",
default,
with = "::serde_with::rust::double_option",
skip_serializing_if = "Option::is_none"
)]
pub vswitch_id: Option<Option<i64>>,
}
impl SubnetWithGateway {
pub fn new(gateway: String, network_zone: String, r#type: Type) -> SubnetWithGateway {
SubnetWithGateway {
gateway,
ip_range: None,
network_zone,
r#type,
vswitch_id: None,
}
}
}
/// Type of subnet. - `cloud` - Used to connect cloud Servers and Load Balancers. - `server` - Same as the `cloud` type. **Deprecated**, use the `cloud` type instead. - `vswitch` - Used to [connect cloud Servers and Load Balancers with dedicated Servers](https://docs.hetzner.com/cloud/networks/connect-dedi-vswitch).
#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)]
pub enum Type {
#[serde(rename = "cloud")]
Cloud,
#[serde(rename = "server")]
Server,
#[serde(rename = "vswitch")]
Vswitch,
}
impl Default for Type {
fn default() -> Type {
Self::Cloud
}
}