proxmox_api/generated/cluster/firewall/ipset/name/
cidr.rs1#[derive(Debug, Clone)]
2pub struct CidrClient<T> {
3 client: T,
4 path: String,
5}
6impl<T> CidrClient<T>
7where
8 T: crate::client::Client,
9{
10 pub fn new(client: T, parent_path: &str, cidr: &str) -> Self {
11 Self {
12 client,
13 path: format!("{}/{}", parent_path, cidr),
14 }
15 }
16}
17impl<T> CidrClient<T>
18where
19 T: crate::client::Client,
20{
21 #[doc = "Remove IP or Network from IPSet."]
22 #[doc = ""]
23 #[doc = "Permission check: perm(\"/\", [\"Sys.Modify\"])"]
24 pub async fn delete(&self, params: DeleteParams) -> Result<(), T::Error> {
25 let path = self.path.to_string();
26 self.client.delete(&path, ¶ms).await
27 }
28}
29impl<T> CidrClient<T>
30where
31 T: crate::client::Client,
32{
33 #[doc = "Read IP or Network settings from IPSet."]
34 #[doc = ""]
35 #[doc = "Permission check: perm(\"/\", [\"Sys.Audit\"])"]
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> CidrClient<T>
42where
43 T: crate::client::Client,
44{
45 #[doc = "Update IP or Network settings"]
46 #[doc = ""]
47 #[doc = "Permission check: perm(\"/\", [\"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}
53#[derive(Clone, Debug, :: serde :: Serialize, :: serde :: Deserialize, Default)]
54pub struct DeleteParams {
55 #[serde(skip_serializing_if = "Option::is_none", default)]
56 #[doc = "Prevent changes if current configuration file has a different digest. This can be used to prevent concurrent modifications."]
57 #[doc = ""]
58 pub digest: Option<DigestStr>,
59 #[serde(
60 flatten,
61 default,
62 skip_serializing_if = "::std::collections::HashMap::is_empty"
63 )]
64 pub additional_properties: ::std::collections::HashMap<String, ::serde_json::Value>,
65}
66#[derive(Clone, Debug, :: serde :: Serialize, :: serde :: Deserialize, Default)]
67pub struct GetOutput {
68 #[serde(
69 flatten,
70 default,
71 skip_serializing_if = "::std::collections::HashMap::is_empty"
72 )]
73 pub additional_properties: ::std::collections::HashMap<String, ::serde_json::Value>,
74}
75#[derive(Clone, Debug, :: serde :: Serialize, :: serde :: Deserialize, Default)]
76pub struct PutParams {
77 #[serde(skip_serializing_if = "Option::is_none", default)]
78 pub comment: Option<String>,
79 #[serde(skip_serializing_if = "Option::is_none", default)]
80 #[doc = "Prevent changes if current configuration file has a different digest. This can be used to prevent concurrent modifications."]
81 #[doc = ""]
82 pub digest: Option<DigestStr>,
83 #[serde(
84 serialize_with = "crate::types::serialize_bool_optional",
85 deserialize_with = "crate::types::deserialize_bool_optional"
86 )]
87 #[serde(skip_serializing_if = "Option::is_none", default)]
88 pub nomatch: Option<bool>,
89 #[serde(
90 flatten,
91 default,
92 skip_serializing_if = "::std::collections::HashMap::is_empty"
93 )]
94 pub additional_properties: ::std::collections::HashMap<String, ::serde_json::Value>,
95}
96#[derive(Debug, Clone, PartialEq, PartialOrd)]
97pub struct DigestStr {
98 value: String,
99}
100impl crate::types::bounded_string::BoundedString for DigestStr {
101 const MIN_LENGTH: Option<usize> = None::<usize>;
102 const MAX_LENGTH: Option<usize> = Some(64usize);
103 const DEFAULT: Option<&'static str> = None::<&'static str>;
104 const PATTERN: Option<&'static str> = None::<&'static str>;
105 const TYPE_DESCRIPTION: &'static str = "a string with length at most 64";
106 fn get_value(&self) -> &str {
107 &self.value
108 }
109 fn new(value: String) -> Result<Self, crate::types::bounded_string::BoundedStringError> {
110 Self::validate(&value)?;
111 Ok(Self { value })
112 }
113}
114impl std::convert::TryFrom<String> for DigestStr {
115 type Error = crate::types::bounded_string::BoundedStringError;
116 fn try_from(value: String) -> Result<Self, Self::Error> {
117 crate::types::bounded_string::BoundedString::new(value)
118 }
119}
120impl ::serde::Serialize for DigestStr {
121 fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
122 where
123 S: ::serde::Serializer,
124 {
125 crate::types::bounded_string::serialize_bounded_string(self, serializer)
126 }
127}
128impl<'de> ::serde::Deserialize<'de> for DigestStr {
129 fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
130 where
131 D: ::serde::Deserializer<'de>,
132 {
133 crate::types::bounded_string::deserialize_bounded_string(deserializer)
134 }
135}