proxmox_api/generated/nodes/node/lxc/vmid/
vncwebsocket.rs1#[derive(Debug, Clone)]
2pub struct VncwebsocketClient<T> {
3 client: T,
4 path: String,
5}
6impl<T> VncwebsocketClient<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, "/vncwebsocket"),
14 }
15 }
16}
17impl<T> VncwebsocketClient<T>
18where
19 T: crate::client::Client,
20{
21 #[doc = "Opens a websocket for VNC traffic."]
22 #[doc = ""]
23 #[doc = "Permission check: perm(\"/vms/{vmid}\", [\"VM.Console\"])"]
24 #[doc = "You also need to pass a valid ticket (vncticket)."]
25 pub async fn get(&self, params: GetParams) -> Result<GetOutput, T::Error> {
26 let path = self.path.to_string();
27 self.client.get(&path, ¶ms).await
28 }
29}
30impl GetOutput {
31 pub fn new(port: String) -> Self {
32 Self {
33 port,
34 additional_properties: ::std::default::Default::default(),
35 }
36 }
37}
38#[derive(Clone, Debug, :: serde :: Serialize, :: serde :: Deserialize)]
39pub struct GetOutput {
40 pub port: String,
41 #[serde(
42 flatten,
43 default,
44 skip_serializing_if = "::std::collections::HashMap::is_empty"
45 )]
46 pub additional_properties: ::std::collections::HashMap<String, ::serde_json::Value>,
47}
48impl GetParams {
49 pub fn new(port: PortInt, vncticket: VncticketStr) -> Self {
50 Self {
51 port,
52 vncticket,
53 additional_properties: ::std::default::Default::default(),
54 }
55 }
56}
57#[derive(Clone, Debug, :: serde :: Serialize, :: serde :: Deserialize)]
58pub struct GetParams {
59 #[doc = "Port number returned by previous vncproxy call."]
60 #[doc = ""]
61 pub port: PortInt,
62 #[doc = "Ticket from previous call to vncproxy."]
63 #[doc = ""]
64 pub vncticket: VncticketStr,
65 #[serde(
66 flatten,
67 default,
68 skip_serializing_if = "::std::collections::HashMap::is_empty"
69 )]
70 pub additional_properties: ::std::collections::HashMap<String, ::serde_json::Value>,
71}
72#[derive(Debug, Clone, Copy, PartialEq, PartialOrd)]
73pub struct PortInt(i128);
74impl crate::types::bounded_integer::BoundedInteger for PortInt {
75 const MIN: Option<i128> = Some(5900i128);
76 const MAX: Option<i128> = Some(5999i128);
77 const DEFAULT: Option<i128> = None::<i128>;
78 const TYPE_DESCRIPTION: &'static str = "an integer between 5900 and 5999";
79 fn get(&self) -> i128 {
80 self.0
81 }
82 fn new(value: i128) -> Result<Self, crate::types::bounded_integer::BoundedIntegerError> {
83 Self::validate(value)?;
84 Ok(Self(value))
85 }
86}
87impl std::convert::TryFrom<i128> for PortInt {
88 type Error = crate::types::bounded_integer::BoundedIntegerError;
89 fn try_from(value: i128) -> Result<Self, Self::Error> {
90 crate::types::bounded_integer::BoundedInteger::new(value)
91 }
92}
93impl ::serde::Serialize for PortInt {
94 fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
95 where
96 S: ::serde::Serializer,
97 {
98 crate::types::bounded_integer::serialize_bounded_integer(self, serializer)
99 }
100}
101impl<'de> ::serde::Deserialize<'de> for PortInt {
102 fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
103 where
104 D: ::serde::Deserializer<'de>,
105 {
106 crate::types::bounded_integer::deserialize_bounded_integer(deserializer)
107 }
108}
109#[derive(Debug, Clone, PartialEq, PartialOrd)]
110pub struct VncticketStr {
111 value: String,
112}
113impl crate::types::bounded_string::BoundedString for VncticketStr {
114 const MIN_LENGTH: Option<usize> = None::<usize>;
115 const MAX_LENGTH: Option<usize> = Some(512usize);
116 const DEFAULT: Option<&'static str> = None::<&'static str>;
117 const PATTERN: Option<&'static str> = None::<&'static str>;
118 const TYPE_DESCRIPTION: &'static str = "a string with length at most 512";
119 fn get_value(&self) -> &str {
120 &self.value
121 }
122 fn new(value: String) -> Result<Self, crate::types::bounded_string::BoundedStringError> {
123 Self::validate(&value)?;
124 Ok(Self { value })
125 }
126}
127impl std::convert::TryFrom<String> for VncticketStr {
128 type Error = crate::types::bounded_string::BoundedStringError;
129 fn try_from(value: String) -> Result<Self, Self::Error> {
130 crate::types::bounded_string::BoundedString::new(value)
131 }
132}
133impl ::serde::Serialize for VncticketStr {
134 fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
135 where
136 S: ::serde::Serializer,
137 {
138 crate::types::bounded_string::serialize_bounded_string(self, serializer)
139 }
140}
141impl<'de> ::serde::Deserialize<'de> for VncticketStr {
142 fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
143 where
144 D: ::serde::Deserializer<'de>,
145 {
146 crate::types::bounded_string::deserialize_bounded_string(deserializer)
147 }
148}