Skip to main content

proxmox_api/generated/nodes/node/lxc/vmid/
vncproxy.rs

1#[derive(Debug, Clone)]
2pub struct VncproxyClient<T> {
3    client: T,
4    path: String,
5}
6impl<T> VncproxyClient<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, "/vncproxy"),
14        }
15    }
16}
17impl<T> VncproxyClient<T>
18where
19    T: crate::client::Client,
20{
21    #[doc = "Creates a TCP VNC proxy connections."]
22    #[doc = ""]
23    #[doc = "Permission check: perm(\"/vms/{vmid}\", [\"VM.Console\"])"]
24    pub async fn post(&self, params: PostParams) -> Result<PostOutput, T::Error> {
25        let path = self.path.to_string();
26        self.client.post(&path, &params).await
27    }
28}
29impl PostOutput {
30    pub fn new(cert: String, port: i64, ticket: String, upid: String, user: String) -> Self {
31        Self {
32            cert,
33            port,
34            ticket,
35            upid,
36            user,
37        }
38    }
39}
40#[derive(Clone, Debug, :: serde :: Serialize, :: serde :: Deserialize)]
41pub struct PostOutput {
42    pub cert: String,
43    #[serde(
44        serialize_with = "crate::types::serialize_int",
45        deserialize_with = "crate::types::deserialize_int"
46    )]
47    pub port: i64,
48    pub ticket: String,
49    pub upid: String,
50    pub user: String,
51}
52#[derive(Clone, Debug, :: serde :: Serialize, :: serde :: Deserialize, Default)]
53pub struct PostParams {
54    #[serde(skip_serializing_if = "Option::is_none", default)]
55    #[doc = "sets the height of the console in pixels."]
56    #[doc = ""]
57    pub height: Option<HeightInt>,
58    #[serde(
59        serialize_with = "crate::types::serialize_bool_optional",
60        deserialize_with = "crate::types::deserialize_bool_optional"
61    )]
62    #[serde(skip_serializing_if = "Option::is_none", default)]
63    #[doc = "use websocket instead of standard VNC."]
64    #[doc = ""]
65    pub websocket: Option<bool>,
66    #[serde(skip_serializing_if = "Option::is_none", default)]
67    #[doc = "sets the width of the console in pixels."]
68    #[doc = ""]
69    pub width: Option<WidthInt>,
70    #[serde(
71        flatten,
72        default,
73        skip_serializing_if = "::std::collections::HashMap::is_empty"
74    )]
75    pub additional_properties: ::std::collections::HashMap<String, ::serde_json::Value>,
76}
77#[derive(Debug, Clone, Copy, PartialEq, PartialOrd)]
78pub struct HeightInt(i128);
79impl crate::types::bounded_integer::BoundedInteger for HeightInt {
80    const MIN: Option<i128> = Some(16i128);
81    const MAX: Option<i128> = Some(2160i128);
82    const DEFAULT: Option<i128> = None::<i128>;
83    const TYPE_DESCRIPTION: &'static str = "an integer between 16 and 2160";
84    fn get(&self) -> i128 {
85        self.0
86    }
87    fn new(value: i128) -> Result<Self, crate::types::bounded_integer::BoundedIntegerError> {
88        Self::validate(value)?;
89        Ok(Self(value))
90    }
91}
92impl std::convert::TryFrom<i128> for HeightInt {
93    type Error = crate::types::bounded_integer::BoundedIntegerError;
94    fn try_from(value: i128) -> Result<Self, Self::Error> {
95        crate::types::bounded_integer::BoundedInteger::new(value)
96    }
97}
98impl ::serde::Serialize for HeightInt {
99    fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
100    where
101        S: ::serde::Serializer,
102    {
103        crate::types::bounded_integer::serialize_bounded_integer(self, serializer)
104    }
105}
106impl<'de> ::serde::Deserialize<'de> for HeightInt {
107    fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
108    where
109        D: ::serde::Deserializer<'de>,
110    {
111        crate::types::bounded_integer::deserialize_bounded_integer(deserializer)
112    }
113}
114#[derive(Debug, Clone, Copy, PartialEq, PartialOrd)]
115pub struct WidthInt(i128);
116impl crate::types::bounded_integer::BoundedInteger for WidthInt {
117    const MIN: Option<i128> = Some(16i128);
118    const MAX: Option<i128> = Some(4096i128);
119    const DEFAULT: Option<i128> = None::<i128>;
120    const TYPE_DESCRIPTION: &'static str = "an integer between 16 and 4096";
121    fn get(&self) -> i128 {
122        self.0
123    }
124    fn new(value: i128) -> Result<Self, crate::types::bounded_integer::BoundedIntegerError> {
125        Self::validate(value)?;
126        Ok(Self(value))
127    }
128}
129impl std::convert::TryFrom<i128> for WidthInt {
130    type Error = crate::types::bounded_integer::BoundedIntegerError;
131    fn try_from(value: i128) -> Result<Self, Self::Error> {
132        crate::types::bounded_integer::BoundedInteger::new(value)
133    }
134}
135impl ::serde::Serialize for WidthInt {
136    fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
137    where
138        S: ::serde::Serializer,
139    {
140        crate::types::bounded_integer::serialize_bounded_integer(self, serializer)
141    }
142}
143impl<'de> ::serde::Deserialize<'de> for WidthInt {
144    fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
145    where
146        D: ::serde::Deserializer<'de>,
147    {
148        crate::types::bounded_integer::deserialize_bounded_integer(deserializer)
149    }
150}