proxmox_api/generated/cluster/sdn/fabrics/
node.rs1pub mod fabric_id;
2#[derive(Debug, Clone)]
3pub struct NodeClient<T> {
4 client: T,
5 path: String,
6}
7impl<T> NodeClient<T>
8where
9 T: crate::client::Client,
10{
11 pub fn new(client: T, parent_path: &str) -> Self {
12 Self {
13 client,
14 path: format!("{}{}", parent_path, "/node"),
15 }
16 }
17}
18impl<T> NodeClient<T>
19where
20 T: crate::client::Client,
21{
22 #[doc = "SDN Fabrics Index"]
23 #[doc = ""]
24 #[doc = "Only list nodes where you have 'SDN.Audit' or 'SDN.Allocate' permissions on\n'/sdn/fabrics/\\<fabric\\>' and 'Sys.Audit' or 'Sys.Modify' on /nodes/\\<node_id\\>"]
25 pub async fn get(&self, params: GetParams) -> Result<Vec<GetOutputItems>, T::Error> {
26 let path = self.path.to_string();
27 let optional_vec: Option<Vec<GetOutputItems>> = self.client.get(&path, ¶ms).await?;
28 Ok(optional_vec.unwrap_or_default())
29 }
30}
31impl GetOutputItems {
32 pub fn new(fabric_id: String, node_id: String, protocol: Protocol) -> Self {
33 Self {
34 fabric_id,
35 node_id,
36 protocol,
37 digest: ::std::default::Default::default(),
38 ip: ::std::default::Default::default(),
39 ip6: ::std::default::Default::default(),
40 lock_token: ::std::default::Default::default(),
41 additional_properties: ::std::default::Default::default(),
42 }
43 }
44}
45#[derive(Clone, Debug, :: serde :: Serialize, :: serde :: Deserialize)]
46pub struct GetOutputItems {
47 #[serde(skip_serializing_if = "Option::is_none", default)]
48 #[doc = "Prevent changes if current configuration file has a different digest. This can be used to prevent concurrent modifications."]
49 #[doc = ""]
50 pub digest: Option<DigestStr>,
51 #[doc = "Identifier for SDN fabrics"]
52 #[doc = ""]
53 pub fabric_id: String,
54 #[serde(skip_serializing_if = "Option::is_none", default)]
55 #[doc = "IPv4 address for this node"]
56 #[doc = ""]
57 pub ip: Option<::std::net::Ipv4Addr>,
58 #[serde(skip_serializing_if = "Option::is_none", default)]
59 #[doc = "IPv6 address for this node"]
60 #[doc = ""]
61 pub ip6: Option<::std::net::Ipv6Addr>,
62 #[serde(rename = "lock-token")]
63 #[serde(skip_serializing_if = "Option::is_none", default)]
64 #[doc = "the token for unlocking the global SDN configuration"]
65 #[doc = ""]
66 pub lock_token: Option<String>,
67 #[doc = "Identifier for nodes in an SDN fabric"]
68 #[doc = ""]
69 pub node_id: String,
70 #[doc = "Type of configuration entry in an SDN Fabric section config"]
71 #[doc = ""]
72 pub protocol: Protocol,
73 #[serde(
74 flatten,
75 default,
76 skip_serializing_if = "::std::collections::HashMap::is_empty"
77 )]
78 pub additional_properties: ::std::collections::HashMap<String, ::serde_json::Value>,
79}
80#[derive(Clone, Debug, :: serde :: Serialize, :: serde :: Deserialize, Default)]
81pub struct GetParams {
82 #[serde(
83 serialize_with = "crate::types::serialize_bool_optional",
84 deserialize_with = "crate::types::deserialize_bool_optional"
85 )]
86 #[serde(skip_serializing_if = "Option::is_none", default)]
87 #[doc = "Display pending config."]
88 #[doc = ""]
89 pub pending: Option<bool>,
90 #[serde(
91 serialize_with = "crate::types::serialize_bool_optional",
92 deserialize_with = "crate::types::deserialize_bool_optional"
93 )]
94 #[serde(skip_serializing_if = "Option::is_none", default)]
95 #[doc = "Display running config."]
96 #[doc = ""]
97 pub running: Option<bool>,
98 #[serde(
99 flatten,
100 default,
101 skip_serializing_if = "::std::collections::HashMap::is_empty"
102 )]
103 pub additional_properties: ::std::collections::HashMap<String, ::serde_json::Value>,
104}
105#[derive(Clone, Debug, :: serde :: Serialize, :: serde :: Deserialize, PartialEq)]
106#[doc = "Type of configuration entry in an SDN Fabric section config"]
107#[doc = ""]
108pub enum Protocol {
109 #[serde(rename = "openfabric")]
110 Openfabric,
111 #[serde(rename = "ospf")]
112 Ospf,
113}
114impl TryFrom<&str> for Protocol {
115 type Error = String;
116 fn try_from(value: &str) -> Result<Self, <Self as TryFrom<&str>>::Error> {
117 match value {
118 "openfabric" => Ok(Self::Openfabric),
119 "ospf" => Ok(Self::Ospf),
120 v => Err(format!("Unknown variant {v}")),
121 }
122 }
123}
124#[derive(Debug, Clone, PartialEq, PartialOrd)]
125pub struct DigestStr {
126 value: String,
127}
128impl crate::types::bounded_string::BoundedString for DigestStr {
129 const MIN_LENGTH: Option<usize> = None::<usize>;
130 const MAX_LENGTH: Option<usize> = Some(64usize);
131 const DEFAULT: Option<&'static str> = None::<&'static str>;
132 const PATTERN: Option<&'static str> = None::<&'static str>;
133 const TYPE_DESCRIPTION: &'static str = "a string with length at most 64";
134 fn get_value(&self) -> &str {
135 &self.value
136 }
137 fn new(value: String) -> Result<Self, crate::types::bounded_string::BoundedStringError> {
138 Self::validate(&value)?;
139 Ok(Self { value })
140 }
141}
142impl std::convert::TryFrom<String> for DigestStr {
143 type Error = crate::types::bounded_string::BoundedStringError;
144 fn try_from(value: String) -> Result<Self, Self::Error> {
145 crate::types::bounded_string::BoundedString::new(value)
146 }
147}
148impl ::serde::Serialize for DigestStr {
149 fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
150 where
151 S: ::serde::Serializer,
152 {
153 crate::types::bounded_string::serialize_bounded_string(self, serializer)
154 }
155}
156impl<'de> ::serde::Deserialize<'de> for DigestStr {
157 fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
158 where
159 D: ::serde::Deserializer<'de>,
160 {
161 crate::types::bounded_string::deserialize_bounded_string(deserializer)
162 }
163}
164impl<T> NodeClient<T>
165where
166 T: crate::client::Client,
167{
168 pub fn fabric_id(&self, fabric_id: &str) -> fabric_id::FabricIdClient<T> {
169 fabric_id::FabricIdClient::<T>::new(self.client.clone(), &self.path, fabric_id)
170 }
171}