proxmox_api/generated/cluster/sdn/fabrics/node/fabric_id/
node_id.rs1#[derive(Debug, Clone)]
2pub struct NodeIdClient<T> {
3 client: T,
4 path: String,
5}
6impl<T> NodeIdClient<T>
7where
8 T: crate::client::Client,
9{
10 pub fn new(client: T, parent_path: &str, node_id: &str) -> Self {
11 Self {
12 client,
13 path: format!("{}/{}", parent_path, node_id),
14 }
15 }
16}
17impl<T> NodeIdClient<T>
18where
19 T: crate::client::Client,
20{
21 #[doc = "Add a node"]
22 #[doc = ""]
23 #[doc = "Permission check: and(perm(\"/sdn/fabrics/{fabric_id}\", [\"SDN.Allocate\"]), perm(\"/nodes/{node_id}\", [\"Sys.Modify\"]))"]
24 pub async fn delete(&self) -> Result<(), T::Error> {
25 let path = self.path.to_string();
26 self.client.delete(&path, &()).await
27 }
28}
29impl<T> NodeIdClient<T>
30where
31 T: crate::client::Client,
32{
33 #[doc = "Get a node"]
34 #[doc = ""]
35 #[doc = "Permission check: and(perm(\"/sdn/fabrics/{fabric_id}\", [\"SDN.Audit\", \"SDN.Allocate\"], any), perm(\"/nodes/{node_id}\", [\"Sys.Audit\", \"Sys.Modify\"], any))"]
36 pub async fn get(&self) -> Result<GetOutput, T::Error> {
37 let path = self.path.to_string();
38 self.client.get(&path, &()).await
39 }
40}
41impl<T> NodeIdClient<T>
42where
43 T: crate::client::Client,
44{
45 #[doc = "Update a node"]
46 #[doc = ""]
47 #[doc = "Permission check: and(perm(\"/sdn/fabrics/{fabric_id}\", [\"SDN.Allocate\"]), perm(\"/nodes/{node_id}\", [\"Sys.Modify\"]))"]
48 pub async fn put(&self, params: PutParams) -> Result<(), T::Error> {
49 let path = self.path.to_string();
50 self.client.put(&path, ¶ms).await
51 }
52}
53impl GetOutput {
54 pub fn new(fabric_id: String, node_id: String, protocol: Protocol) -> Self {
55 Self {
56 fabric_id,
57 node_id,
58 protocol,
59 digest: ::std::default::Default::default(),
60 ip: ::std::default::Default::default(),
61 ip6: ::std::default::Default::default(),
62 lock_token: ::std::default::Default::default(),
63 additional_properties: ::std::default::Default::default(),
64 }
65 }
66}
67#[derive(Clone, Debug, :: serde :: Serialize, :: serde :: Deserialize)]
68pub struct GetOutput {
69 #[serde(skip_serializing_if = "Option::is_none", default)]
70 #[doc = "Prevent changes if current configuration file has a different digest. This can be used to prevent concurrent modifications."]
71 #[doc = ""]
72 pub digest: Option<DigestStr>,
73 #[doc = "Identifier for SDN fabrics"]
74 #[doc = ""]
75 pub fabric_id: String,
76 #[serde(skip_serializing_if = "Option::is_none", default)]
77 #[doc = "IPv4 address for this node"]
78 #[doc = ""]
79 pub ip: Option<::std::net::Ipv4Addr>,
80 #[serde(skip_serializing_if = "Option::is_none", default)]
81 #[doc = "IPv6 address for this node"]
82 #[doc = ""]
83 pub ip6: Option<::std::net::Ipv6Addr>,
84 #[serde(rename = "lock-token")]
85 #[serde(skip_serializing_if = "Option::is_none", default)]
86 #[doc = "the token for unlocking the global SDN configuration"]
87 #[doc = ""]
88 pub lock_token: Option<String>,
89 #[doc = "Identifier for nodes in an SDN fabric"]
90 #[doc = ""]
91 pub node_id: String,
92 #[doc = "Type of configuration entry in an SDN Fabric section config"]
93 #[doc = ""]
94 pub protocol: Protocol,
95 #[serde(
96 flatten,
97 default,
98 skip_serializing_if = "::std::collections::HashMap::is_empty"
99 )]
100 pub additional_properties: ::std::collections::HashMap<String, ::serde_json::Value>,
101}
102impl PutParams {
103 pub fn new(protocol: Protocol) -> Self {
104 Self {
105 protocol,
106 delete: ::std::default::Default::default(),
107 digest: ::std::default::Default::default(),
108 ip: ::std::default::Default::default(),
109 ip6: ::std::default::Default::default(),
110 lock_token: ::std::default::Default::default(),
111 additional_properties: ::std::default::Default::default(),
112 }
113 }
114}
115#[derive(Clone, Debug, :: serde :: Serialize, :: serde :: Deserialize)]
116pub struct PutParams {
117 #[serde(skip_serializing_if = "::std::vec::Vec::is_empty", default)]
118 pub delete: Vec<Delete>,
119 #[serde(skip_serializing_if = "Option::is_none", default)]
120 #[doc = "Prevent changes if current configuration file has a different digest. This can be used to prevent concurrent modifications."]
121 #[doc = ""]
122 pub digest: Option<DigestStr>,
123 #[serde(skip_serializing_if = "Option::is_none", default)]
124 #[doc = "IPv4 address for this node"]
125 #[doc = ""]
126 pub ip: Option<::std::net::Ipv4Addr>,
127 #[serde(skip_serializing_if = "Option::is_none", default)]
128 #[doc = "IPv6 address for this node"]
129 #[doc = ""]
130 pub ip6: Option<::std::net::Ipv6Addr>,
131 #[serde(rename = "lock-token")]
132 #[serde(skip_serializing_if = "Option::is_none", default)]
133 #[doc = "the token for unlocking the global SDN configuration"]
134 #[doc = ""]
135 pub lock_token: Option<String>,
136 #[doc = "Type of configuration entry in an SDN Fabric section config"]
137 #[doc = ""]
138 pub protocol: Protocol,
139 #[serde(
140 flatten,
141 default,
142 skip_serializing_if = "::std::collections::HashMap::is_empty"
143 )]
144 pub additional_properties: ::std::collections::HashMap<String, ::serde_json::Value>,
145}
146#[derive(Clone, Debug, :: serde :: Serialize, :: serde :: Deserialize, PartialEq)]
147pub enum Delete {
148 #[serde(rename = "interfaces")]
149 Interfaces,
150 #[serde(rename = "ip")]
151 Ip,
152 #[serde(rename = "ip6")]
153 Ip6,
154}
155impl TryFrom<&str> for Delete {
156 type Error = String;
157 fn try_from(value: &str) -> Result<Self, <Self as TryFrom<&str>>::Error> {
158 match value {
159 "interfaces" => Ok(Self::Interfaces),
160 "ip" => Ok(Self::Ip),
161 "ip6" => Ok(Self::Ip6),
162 v => Err(format!("Unknown variant {v}")),
163 }
164 }
165}
166#[derive(Clone, Debug, :: serde :: Serialize, :: serde :: Deserialize, PartialEq)]
167#[doc = "Type of configuration entry in an SDN Fabric section config"]
168#[doc = ""]
169pub enum Protocol {
170 #[serde(rename = "openfabric")]
171 Openfabric,
172 #[serde(rename = "ospf")]
173 Ospf,
174}
175impl TryFrom<&str> for Protocol {
176 type Error = String;
177 fn try_from(value: &str) -> Result<Self, <Self as TryFrom<&str>>::Error> {
178 match value {
179 "openfabric" => Ok(Self::Openfabric),
180 "ospf" => Ok(Self::Ospf),
181 v => Err(format!("Unknown variant {v}")),
182 }
183 }
184}
185#[derive(Debug, Clone, PartialEq, PartialOrd)]
186pub struct DigestStr {
187 value: String,
188}
189impl crate::types::bounded_string::BoundedString for DigestStr {
190 const MIN_LENGTH: Option<usize> = None::<usize>;
191 const MAX_LENGTH: Option<usize> = Some(64usize);
192 const DEFAULT: Option<&'static str> = None::<&'static str>;
193 const PATTERN: Option<&'static str> = None::<&'static str>;
194 const TYPE_DESCRIPTION: &'static str = "a string with length at most 64";
195 fn get_value(&self) -> &str {
196 &self.value
197 }
198 fn new(value: String) -> Result<Self, crate::types::bounded_string::BoundedStringError> {
199 Self::validate(&value)?;
200 Ok(Self { value })
201 }
202}
203impl std::convert::TryFrom<String> for DigestStr {
204 type Error = crate::types::bounded_string::BoundedStringError;
205 fn try_from(value: String) -> Result<Self, Self::Error> {
206 crate::types::bounded_string::BoundedString::new(value)
207 }
208}
209impl ::serde::Serialize for DigestStr {
210 fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
211 where
212 S: ::serde::Serializer,
213 {
214 crate::types::bounded_string::serialize_bounded_string(self, serializer)
215 }
216}
217impl<'de> ::serde::Deserialize<'de> for DigestStr {
218 fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
219 where
220 D: ::serde::Deserializer<'de>,
221 {
222 crate::types::bounded_string::deserialize_bounded_string(deserializer)
223 }
224}