proxmox_api/generated/nodes/node/
spiceshell.rs1#[derive(Debug, Clone)]
2pub struct SpiceshellClient<T> {
3 client: T,
4 path: String,
5}
6impl<T> SpiceshellClient<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, "/spiceshell"),
14 }
15 }
16}
17impl<T> SpiceshellClient<T>
18where
19 T: crate::client::Client,
20{
21 #[doc = "Creates a SPICE shell."]
22 #[doc = ""]
23 #[doc = "Permission check: perm(\"/nodes/{node}\", [\"Sys.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(host: String, password: String, proxy: String, tls_port: i64, ty: String) -> Self {
31 Self {
32 host,
33 password,
34 proxy,
35 tls_port,
36 ty,
37 additional_properties: ::std::default::Default::default(),
38 }
39 }
40}
41#[derive(Clone, Debug, :: serde :: Serialize, :: serde :: Deserialize)]
42pub struct PostOutput {
43 pub host: String,
44 pub password: String,
45 pub proxy: String,
46 #[serde(rename = "tls-port")]
47 #[serde(
48 serialize_with = "crate::types::serialize_int",
49 deserialize_with = "crate::types::deserialize_int"
50 )]
51 pub tls_port: i64,
52 #[serde(rename = "type")]
53 pub ty: String,
54 #[serde(
55 flatten,
56 default,
57 skip_serializing_if = "::std::collections::HashMap::is_empty"
58 )]
59 pub additional_properties: ::std::collections::HashMap<String, ::serde_json::Value>,
60}
61#[derive(Clone, Debug, :: serde :: Serialize, :: serde :: Deserialize, Default)]
62pub struct PostParams {
63 #[serde(skip_serializing_if = "Option::is_none", default)]
64 #[doc = "Run specific command or default to login (requires 'root@pam')"]
65 #[doc = ""]
66 pub cmd: Option<Cmd>,
67 #[serde(rename = "cmd-opts")]
68 #[serde(skip_serializing_if = "Option::is_none", default)]
69 #[doc = "Add parameters to a command. Encoded as null terminated strings."]
70 #[doc = ""]
71 pub cmd_opts: Option<String>,
72 #[serde(skip_serializing_if = "Option::is_none", default)]
73 #[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)."]
74 #[doc = ""]
75 pub proxy: Option<String>,
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}
83#[derive(Clone, Debug, :: serde :: Serialize, :: serde :: Deserialize, PartialEq, Default)]
84#[doc = "Run specific command or default to login (requires 'root@pam')"]
85#[doc = ""]
86pub enum Cmd {
87 #[serde(rename = "ceph_install")]
88 CephInstall,
89 #[serde(rename = "login")]
90 #[default]
91 Login,
92 #[serde(rename = "upgrade")]
93 Upgrade,
94}
95impl TryFrom<&str> for Cmd {
96 type Error = String;
97 fn try_from(value: &str) -> Result<Self, <Self as TryFrom<&str>>::Error> {
98 match value {
99 "ceph_install" => Ok(Self::CephInstall),
100 "login" => Ok(Self::Login),
101 "upgrade" => Ok(Self::Upgrade),
102 v => Err(format!("Unknown variant {v}")),
103 }
104 }
105}