Skip to main content

proxmox_api/generated/nodes/node/qemu/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            password: ::std::default::Default::default(),
38        }
39    }
40}
41#[derive(Clone, Debug, :: serde :: Serialize, :: serde :: Deserialize)]
42pub struct PostOutput {
43    pub cert: String,
44    #[serde(skip_serializing_if = "Option::is_none", default)]
45    #[doc = "Returned if requested with 'generate-password' param. Consists of printable ASCII characters ('!' .. '~')."]
46    #[doc = ""]
47    pub password: Option<String>,
48    #[serde(
49        serialize_with = "crate::types::serialize_int",
50        deserialize_with = "crate::types::deserialize_int"
51    )]
52    pub port: i64,
53    pub ticket: String,
54    pub upid: String,
55    pub user: String,
56}
57#[derive(Clone, Debug, :: serde :: Serialize, :: serde :: Deserialize, Default)]
58pub struct PostParams {
59    #[serde(rename = "generate-password")]
60    #[serde(
61        serialize_with = "crate::types::serialize_bool_optional",
62        deserialize_with = "crate::types::deserialize_bool_optional"
63    )]
64    #[serde(skip_serializing_if = "Option::is_none", default)]
65    #[doc = "Generates a random password to be used as ticket instead of the API ticket."]
66    #[doc = ""]
67    pub generate_password: Option<bool>,
68    #[serde(
69        serialize_with = "crate::types::serialize_bool_optional",
70        deserialize_with = "crate::types::deserialize_bool_optional"
71    )]
72    #[serde(skip_serializing_if = "Option::is_none", default)]
73    #[doc = "Prepare for websocket upgrade (only required when using serial terminal, otherwise upgrade is always possible)."]
74    #[doc = ""]
75    pub websocket: Option<bool>,
76    #[serde(
77        flatten,
78        default,
79        skip_serializing_if = "::std::collections::HashMap::is_empty"
80    )]
81    pub additional_properties: ::std::collections::HashMap<String, ::serde_json::Value>,
82}