proxmox_api/generated/nodes/node/qemu/vmid/
termproxy.rs1#[derive(Debug, Clone)]
2pub struct TermproxyClient<T> {
3 client: T,
4 path: String,
5}
6impl<T> TermproxyClient<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, "/termproxy"),
14 }
15 }
16}
17impl<T> TermproxyClient<T>
18where
19 T: crate::client::Client,
20{
21 #[doc = "Creates a TCP 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, ¶ms).await
27 }
28}
29impl PostOutput {
30 pub fn new(port: i64, ticket: String, upid: String, user: String) -> Self {
31 Self {
32 port,
33 ticket,
34 upid,
35 user,
36 }
37 }
38}
39#[derive(Clone, Debug, :: serde :: Serialize, :: serde :: Deserialize)]
40pub struct PostOutput {
41 #[serde(
42 serialize_with = "crate::types::serialize_int",
43 deserialize_with = "crate::types::deserialize_int"
44 )]
45 pub port: i64,
46 pub ticket: String,
47 pub upid: String,
48 pub user: String,
49}
50#[derive(Clone, Debug, :: serde :: Serialize, :: serde :: Deserialize, Default)]
51pub struct PostParams {
52 #[serde(skip_serializing_if = "Option::is_none", default)]
53 #[doc = "opens a serial terminal (defaults to display)"]
54 #[doc = ""]
55 pub serial: Option<Serial>,
56 #[serde(
57 flatten,
58 default,
59 skip_serializing_if = "::std::collections::HashMap::is_empty"
60 )]
61 pub additional_properties: ::std::collections::HashMap<String, ::serde_json::Value>,
62}
63#[derive(Clone, Debug, :: serde :: Serialize, :: serde :: Deserialize, PartialEq)]
64#[doc = "opens a serial terminal (defaults to display)"]
65#[doc = ""]
66pub enum Serial {
67 #[serde(rename = "serial0")]
68 Serial0,
69 #[serde(rename = "serial1")]
70 Serial1,
71 #[serde(rename = "serial2")]
72 Serial2,
73 #[serde(rename = "serial3")]
74 Serial3,
75}
76impl TryFrom<&str> for Serial {
77 type Error = String;
78 fn try_from(value: &str) -> Result<Self, <Self as TryFrom<&str>>::Error> {
79 match value {
80 "serial0" => Ok(Self::Serial0),
81 "serial1" => Ok(Self::Serial1),
82 "serial2" => Ok(Self::Serial2),
83 "serial3" => Ok(Self::Serial3),
84 v => Err(format!("Unknown variant {v}")),
85 }
86 }
87}