proxmox_api/generated/cluster/sdn/
ipams.rs1pub mod ipam;
2pub struct IpamsClient<T> {
3 client: T,
4 path: String,
5}
6impl<T> IpamsClient<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, "/ipams"),
14 }
15 }
16}
17impl<T> IpamsClient<T>
18where
19 T: crate::client::Client,
20{
21 #[doc = "SDN ipams 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, ¶ms)
25 }
26}
27impl<T> IpamsClient<T>
28where
29 T: crate::client::Client,
30{
31 #[doc = "Create a new sdn ipam object."]
32 pub fn post(&self, params: PostParams) -> Result<(), T::Error> {
33 let path = self.path.to_string();
34 self.client.post(&path, ¶ms)
35 }
36}
37impl GetOutputItems {
38 pub fn new(ipam: String, ty: String) -> Self {
39 Self {
40 ipam,
41 ty,
42 additional_properties: Default::default(),
43 }
44 }
45}
46#[derive(Clone, Debug, :: serde :: Serialize, :: serde :: Deserialize)]
47pub struct GetOutputItems {
48 pub ipam: String,
49 #[serde(rename = "type")]
50 pub ty: String,
51 #[serde(
52 flatten,
53 default,
54 skip_serializing_if = "::std::collections::HashMap::is_empty"
55 )]
56 pub additional_properties: ::std::collections::HashMap<String, ::serde_json::Value>,
57}
58#[derive(Clone, Debug, :: serde :: Serialize, :: serde :: Deserialize, Default)]
59pub struct GetParams {
60 #[serde(rename = "type")]
61 #[serde(skip_serializing_if = "Option::is_none", default)]
62 #[doc = "Only list sdn ipams of specific type"]
63 pub ty: Option<Type>,
64 #[serde(
65 flatten,
66 default,
67 skip_serializing_if = "::std::collections::HashMap::is_empty"
68 )]
69 pub additional_properties: ::std::collections::HashMap<String, ::serde_json::Value>,
70}
71impl PostParams {
72 pub fn new(ipam: String, ty: Type) -> Self {
73 Self {
74 ipam,
75 ty,
76 section: Default::default(),
77 token: Default::default(),
78 url: Default::default(),
79 additional_properties: Default::default(),
80 }
81 }
82}
83#[derive(Clone, Debug, :: serde :: Serialize, :: serde :: Deserialize)]
84pub struct PostParams {
85 #[doc = "The SDN ipam object identifier."]
86 pub ipam: String,
87 #[serde(
88 serialize_with = "crate::types::serialize_int_optional",
89 deserialize_with = "crate::types::deserialize_int_optional"
90 )]
91 #[serde(skip_serializing_if = "Option::is_none", default)]
92 pub section: Option<u64>,
93 #[serde(skip_serializing_if = "Option::is_none", default)]
94 pub token: Option<String>,
95 #[serde(rename = "type")]
96 #[doc = "Plugin type."]
97 pub ty: Type,
98 #[serde(skip_serializing_if = "Option::is_none", default)]
99 pub url: Option<String>,
100 #[serde(
101 flatten,
102 default,
103 skip_serializing_if = "::std::collections::HashMap::is_empty"
104 )]
105 pub additional_properties: ::std::collections::HashMap<String, ::serde_json::Value>,
106}
107#[derive(Clone, Debug, :: serde :: Serialize, :: serde :: Deserialize)]
108pub enum Type {
109 #[serde(rename = "netbox")]
110 Netbox,
111 #[serde(rename = "phpipam")]
112 Phpipam,
113 #[serde(rename = "pve")]
114 Pve,
115}
116impl<T> IpamsClient<T>
117where
118 T: crate::client::Client,
119{
120 pub fn ipam(&self, ipam: &str) -> ipam::IpamClient<T> {
121 ipam::IpamClient::<T>::new(self.client.clone(), &self.path, ipam)
122 }
123}