proxmox_api/generated/cluster/sdn/vnets/vnet/
subnets.rs

1pub mod subnet;
2pub struct SubnetsClient<T> {
3    client: T,
4    path: String,
5}
6impl<T> SubnetsClient<T>
7where
8    T: crate::client::Client,
9{
10    pub fn new(client: T, parent_path: &str) -> Self {
11        Self {
12            client,
13            path: format!("{}{}", parent_path, "/subnets"),
14        }
15    }
16}
17impl<T> SubnetsClient<T>
18where
19    T: crate::client::Client,
20{
21    #[doc = "SDN subnets index."]
22    pub fn get(&self, params: GetParams) -> Result<Vec<GetOutputItems>, T::Error> {
23        let path = self.path.to_string();
24        self.client.get(&path, &params)
25    }
26}
27impl<T> SubnetsClient<T>
28where
29    T: crate::client::Client,
30{
31    #[doc = "Create a new sdn subnet object."]
32    pub fn post(&self, params: PostParams) -> Result<(), T::Error> {
33        let path = self.path.to_string();
34        self.client.post(&path, &params)
35    }
36}
37#[derive(Clone, Debug, :: serde :: Serialize, :: serde :: Deserialize, Default)]
38pub struct GetOutputItems {
39    #[serde(
40        flatten,
41        default,
42        skip_serializing_if = "::std::collections::HashMap::is_empty"
43    )]
44    pub additional_properties: ::std::collections::HashMap<String, ::serde_json::Value>,
45}
46#[derive(Clone, Debug, :: serde :: Serialize, :: serde :: Deserialize, Default)]
47pub struct GetParams {
48    #[serde(
49        serialize_with = "crate::types::serialize_bool_optional",
50        deserialize_with = "crate::types::deserialize_bool_optional"
51    )]
52    #[serde(skip_serializing_if = "Option::is_none", default)]
53    #[doc = "Display pending config."]
54    pub pending: Option<bool>,
55    #[serde(
56        serialize_with = "crate::types::serialize_bool_optional",
57        deserialize_with = "crate::types::deserialize_bool_optional"
58    )]
59    #[serde(skip_serializing_if = "Option::is_none", default)]
60    #[doc = "Display running config."]
61    pub running: Option<bool>,
62    #[serde(
63        flatten,
64        default,
65        skip_serializing_if = "::std::collections::HashMap::is_empty"
66    )]
67    pub additional_properties: ::std::collections::HashMap<String, ::serde_json::Value>,
68}
69impl PostParams {
70    pub fn new(subnet: String, ty: Type) -> Self {
71        Self {
72            subnet,
73            ty,
74            dhcp_dns_server: Default::default(),
75            dhcp_range: Default::default(),
76            dnszoneprefix: Default::default(),
77            gateway: Default::default(),
78            snat: Default::default(),
79            additional_properties: Default::default(),
80        }
81    }
82}
83#[derive(Clone, Debug, :: serde :: Serialize, :: serde :: Deserialize)]
84pub struct PostParams {
85    #[serde(rename = "dhcp-dns-server")]
86    #[serde(skip_serializing_if = "Option::is_none", default)]
87    #[doc = "IP address for the DNS server"]
88    pub dhcp_dns_server: Option<::std::net::IpAddr>,
89    #[serde(rename = "dhcp-range")]
90    #[serde(skip_serializing_if = "::std::vec::Vec::is_empty", default)]
91    #[doc = "A list of DHCP ranges for this subnet"]
92    pub dhcp_range: Vec<String>,
93    #[serde(skip_serializing_if = "Option::is_none", default)]
94    #[doc = "dns domain zone prefix  ex: 'adm' -\\> \\<hostname\\>.adm.mydomain.com"]
95    pub dnszoneprefix: Option<String>,
96    #[serde(skip_serializing_if = "Option::is_none", default)]
97    #[doc = "Subnet Gateway: Will be assign on vnet for layer3 zones"]
98    pub gateway: Option<::std::net::IpAddr>,
99    #[serde(
100        serialize_with = "crate::types::serialize_bool_optional",
101        deserialize_with = "crate::types::deserialize_bool_optional"
102    )]
103    #[serde(skip_serializing_if = "Option::is_none", default)]
104    #[doc = "enable masquerade for this subnet if pve-firewall"]
105    pub snat: Option<bool>,
106    #[doc = "The SDN subnet object identifier."]
107    pub subnet: String,
108    #[serde(rename = "type")]
109    pub ty: Type,
110    #[serde(
111        flatten,
112        default,
113        skip_serializing_if = "::std::collections::HashMap::is_empty"
114    )]
115    pub additional_properties: ::std::collections::HashMap<String, ::serde_json::Value>,
116}
117#[derive(Clone, Debug, :: serde :: Serialize, :: serde :: Deserialize)]
118pub enum Type {
119    #[serde(rename = "subnet")]
120    Subnet,
121}
122impl<T> SubnetsClient<T>
123where
124    T: crate::client::Client,
125{
126    pub fn subnet(&self, subnet: &str) -> subnet::SubnetClient<T> {
127        subnet::SubnetClient::<T>::new(self.client.clone(), &self.path, subnet)
128    }
129}