pve/nodes/node/qemu/vmid/
spiceproxy.rs1#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize, Default)]
2pub struct PostParameters {
3 #[doc = "SPICE proxy server. This can be used by the client to specify the proxy server. All nodes in a cluster runs 'spiceproxy', so it is up to the client to choose one. By default, we return the node where the VM is currently running. As reasonable setting is to use same node you use to connect to the API (This is window.location.hostname for the JS GUI)."]
4 #[serde(skip_serializing_if = "Option::is_none", default)]
5 pub proxy: Option<String>,
6}
7
8#[doc = "Returned values can be directly passed to the 'remote-viewer' application."]
9#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)]
10pub struct PostResponseItem {
11 pub host: String,
12 pub password: String,
13 pub proxy: String,
14 #[serde(rename = "tls-port")]
15 pub tls_port: u64,
16 pub r#type: String,
17}
18
19#[derive(Debug, Clone)]
20pub struct SpiceproxyClient<T> {
21 client: T,
22 path: String,
23}
24
25impl<T> SpiceproxyClient<T>
26where
27 T: Clone,
28{
29 pub fn new(client: T, parent_path: &str) -> Self {
30 Self {
31 client,
32 path: format!("{}/{}", parent_path, "spiceproxy"),
33 }
34 }
35}
36impl<T> SpiceproxyClient<T>
37where
38 T: crate::client::HttpClient,
39{
40 #[doc = "Returns a SPICE configuration to connect to the VM."]
41 pub fn post(&self, parameters: PostParameters) -> Result<PostResponseItem, T::Error> {
42 self.client.post(&self.path, ¶meters)
43 }
44}
45#[derive(Debug, Clone)]
46pub struct AsyncSpiceproxyClient<T> {
47 client: T,
48 path: String,
49}
50
51impl<T> AsyncSpiceproxyClient<T>
52where
53 T: Clone,
54{
55 pub fn new(client: T, parent_path: &str) -> Self {
56 Self {
57 client,
58 path: format!("{}/{}", parent_path, "spiceproxy"),
59 }
60 }
61}
62impl<T> AsyncSpiceproxyClient<T>
63where
64 T: crate::client::AsyncHttpClient,
65{
66 #[doc = "Returns a SPICE configuration to connect to the VM."]
67 pub async fn post(&self, parameters: PostParameters) -> Result<PostResponseItem, T::Error> {
68 self.client.post(&self.path, ¶meters).await
69 }
70}