Skip to main content

proxmox_api/generated/access/
vncticket.rs

1#[derive(Debug, Clone)]
2pub struct VncticketClient<T> {
3    client: T,
4    path: String,
5}
6impl<T> VncticketClient<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, "/vncticket"),
14        }
15    }
16}
17impl<T> VncticketClient<T>
18where
19    T: crate::client::Client,
20{
21    #[doc = "verify VNC authentication ticket."]
22    #[doc = ""]
23    #[doc = "Accessible without authentication."]
24    pub async fn post(&self, params: PostParams) -> Result<(), T::Error> {
25        let path = self.path.to_string();
26        self.client.post(&path, &params).await
27    }
28}
29impl PostParams {
30    pub fn new(authid: AuthidStr, path: PathStr, privs: PrivsStr, vncticket: String) -> Self {
31        Self {
32            authid,
33            path,
34            privs,
35            vncticket,
36            additional_properties: ::std::default::Default::default(),
37        }
38    }
39}
40#[derive(Clone, Debug, :: serde :: Serialize, :: serde :: Deserialize)]
41pub struct PostParams {
42    #[doc = "UserId or token"]
43    #[doc = ""]
44    pub authid: AuthidStr,
45    #[doc = "Verify ticket, and check if user have access 'privs' on 'path'"]
46    #[doc = ""]
47    pub path: PathStr,
48    #[doc = "Verify ticket, and check if user have access 'privs' on 'path'"]
49    #[doc = ""]
50    pub privs: PrivsStr,
51    #[doc = "The VNC ticket."]
52    #[doc = ""]
53    pub vncticket: String,
54    #[serde(
55        flatten,
56        default,
57        skip_serializing_if = "::std::collections::HashMap::is_empty"
58    )]
59    pub additional_properties: ::std::collections::HashMap<String, ::serde_json::Value>,
60}
61#[derive(Debug, Clone, PartialEq, PartialOrd)]
62pub struct AuthidStr {
63    value: String,
64}
65impl crate::types::bounded_string::BoundedString for AuthidStr {
66    const MIN_LENGTH: Option<usize> = None::<usize>;
67    const MAX_LENGTH: Option<usize> = Some(64usize);
68    const DEFAULT: Option<&'static str> = None::<&'static str>;
69    const PATTERN: Option<&'static str> = None::<&'static str>;
70    const TYPE_DESCRIPTION: &'static str = "a string with length at most 64";
71    fn get_value(&self) -> &str {
72        &self.value
73    }
74    fn new(value: String) -> Result<Self, crate::types::bounded_string::BoundedStringError> {
75        Self::validate(&value)?;
76        Ok(Self { value })
77    }
78}
79impl std::convert::TryFrom<String> for AuthidStr {
80    type Error = crate::types::bounded_string::BoundedStringError;
81    fn try_from(value: String) -> Result<Self, Self::Error> {
82        crate::types::bounded_string::BoundedString::new(value)
83    }
84}
85impl ::serde::Serialize for AuthidStr {
86    fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
87    where
88        S: ::serde::Serializer,
89    {
90        crate::types::bounded_string::serialize_bounded_string(self, serializer)
91    }
92}
93impl<'de> ::serde::Deserialize<'de> for AuthidStr {
94    fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
95    where
96        D: ::serde::Deserializer<'de>,
97    {
98        crate::types::bounded_string::deserialize_bounded_string(deserializer)
99    }
100}
101#[derive(Debug, Clone, PartialEq, PartialOrd)]
102pub struct PathStr {
103    value: String,
104}
105impl crate::types::bounded_string::BoundedString for PathStr {
106    const MIN_LENGTH: Option<usize> = None::<usize>;
107    const MAX_LENGTH: Option<usize> = Some(64usize);
108    const DEFAULT: Option<&'static str> = None::<&'static str>;
109    const PATTERN: Option<&'static str> = None::<&'static str>;
110    const TYPE_DESCRIPTION: &'static str = "a string with length at most 64";
111    fn get_value(&self) -> &str {
112        &self.value
113    }
114    fn new(value: String) -> Result<Self, crate::types::bounded_string::BoundedStringError> {
115        Self::validate(&value)?;
116        Ok(Self { value })
117    }
118}
119impl std::convert::TryFrom<String> for PathStr {
120    type Error = crate::types::bounded_string::BoundedStringError;
121    fn try_from(value: String) -> Result<Self, Self::Error> {
122        crate::types::bounded_string::BoundedString::new(value)
123    }
124}
125impl ::serde::Serialize for PathStr {
126    fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
127    where
128        S: ::serde::Serializer,
129    {
130        crate::types::bounded_string::serialize_bounded_string(self, serializer)
131    }
132}
133impl<'de> ::serde::Deserialize<'de> for PathStr {
134    fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
135    where
136        D: ::serde::Deserializer<'de>,
137    {
138        crate::types::bounded_string::deserialize_bounded_string(deserializer)
139    }
140}
141#[derive(Debug, Clone, PartialEq, PartialOrd)]
142pub struct PrivsStr {
143    value: String,
144}
145impl crate::types::bounded_string::BoundedString for PrivsStr {
146    const MIN_LENGTH: Option<usize> = None::<usize>;
147    const MAX_LENGTH: Option<usize> = Some(64usize);
148    const DEFAULT: Option<&'static str> = None::<&'static str>;
149    const PATTERN: Option<&'static str> = None::<&'static str>;
150    const TYPE_DESCRIPTION: &'static str = "a string with length at most 64";
151    fn get_value(&self) -> &str {
152        &self.value
153    }
154    fn new(value: String) -> Result<Self, crate::types::bounded_string::BoundedStringError> {
155        Self::validate(&value)?;
156        Ok(Self { value })
157    }
158}
159impl std::convert::TryFrom<String> for PrivsStr {
160    type Error = crate::types::bounded_string::BoundedStringError;
161    fn try_from(value: String) -> Result<Self, Self::Error> {
162        crate::types::bounded_string::BoundedString::new(value)
163    }
164}
165impl ::serde::Serialize for PrivsStr {
166    fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
167    where
168        S: ::serde::Serializer,
169    {
170        crate::types::bounded_string::serialize_bounded_string(self, serializer)
171    }
172}
173impl<'de> ::serde::Deserialize<'de> for PrivsStr {
174    fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
175    where
176        D: ::serde::Deserializer<'de>,
177    {
178        crate::types::bounded_string::deserialize_bounded_string(deserializer)
179    }
180}