pve/nodes/node/qemu/vmid/
termproxy.rs1#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize, Default)]
2pub struct PostParameters {
3 #[doc = "opens a serial terminal (defaults to display)"]
4 #[serde(skip_serializing_if = "Option::is_none", default)]
5 pub serial: Option<String>,
6}
7
8#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)]
9pub struct PostResponseItem {
10 pub port: u64,
11 pub ticket: String,
12 pub upid: String,
13 pub user: String,
14}
15
16#[derive(Debug, Clone)]
17pub struct TermproxyClient<T> {
18 client: T,
19 path: String,
20}
21
22impl<T> TermproxyClient<T>
23where
24 T: Clone,
25{
26 pub fn new(client: T, parent_path: &str) -> Self {
27 Self {
28 client,
29 path: format!("{}/{}", parent_path, "termproxy"),
30 }
31 }
32}
33impl<T> TermproxyClient<T>
34where
35 T: crate::client::HttpClient,
36{
37 #[doc = "Creates a TCP proxy connections."]
38 pub fn post(&self, parameters: PostParameters) -> Result<PostResponseItem, T::Error> {
39 self.client.post(&self.path, ¶meters)
40 }
41}
42#[derive(Debug, Clone)]
43pub struct AsyncTermproxyClient<T> {
44 client: T,
45 path: String,
46}
47
48impl<T> AsyncTermproxyClient<T>
49where
50 T: Clone,
51{
52 pub fn new(client: T, parent_path: &str) -> Self {
53 Self {
54 client,
55 path: format!("{}/{}", parent_path, "termproxy"),
56 }
57 }
58}
59impl<T> AsyncTermproxyClient<T>
60where
61 T: crate::client::AsyncHttpClient,
62{
63 #[doc = "Creates a TCP proxy connections."]
64 pub async fn post(&self, parameters: PostParameters) -> Result<PostResponseItem, T::Error> {
65 self.client.post(&self.path, ¶meters).await
66 }
67}