proxmox_api/generated/nodes/node/qemu/vmid/agent/
exec.rs1pub struct ExecClient<T> {
2 client: T,
3 path: String,
4}
5impl<T> ExecClient<T>
6where
7 T: crate::client::Client,
8{
9 pub fn new(client: T, parent_path: &str) -> Self {
10 Self {
11 client,
12 path: format!("{}{}", parent_path, "/exec"),
13 }
14 }
15}
16impl<T> ExecClient<T>
17where
18 T: crate::client::Client,
19{
20 #[doc = "Executes the given command in the vm via the guest-agent and returns an object with the pid."]
21 pub fn post(&self, params: PostParams) -> Result<PostOutput, T::Error> {
22 let path = self.path.to_string();
23 self.client.post(&path, ¶ms)
24 }
25}
26impl PostOutput {
27 pub fn new(pid: u64) -> Self {
28 Self {
29 pid,
30 additional_properties: Default::default(),
31 }
32 }
33}
34#[derive(Clone, Debug, :: serde :: Serialize, :: serde :: Deserialize)]
35pub struct PostOutput {
36 #[serde(
37 serialize_with = "crate::types::serialize_int",
38 deserialize_with = "crate::types::deserialize_int"
39 )]
40 #[doc = "The PID of the process started by the guest-agent."]
41 pub pid: u64,
42 #[serde(
43 flatten,
44 default,
45 skip_serializing_if = "::std::collections::HashMap::is_empty"
46 )]
47 pub additional_properties: ::std::collections::HashMap<String, ::serde_json::Value>,
48}
49impl PostParams {
50 pub fn new(command: Vec<()>) -> Self {
51 Self {
52 command,
53 input_data: Default::default(),
54 additional_properties: Default::default(),
55 }
56 }
57}
58#[derive(Clone, Debug, :: serde :: Serialize, :: serde :: Deserialize)]
59pub struct PostParams {
60 #[serde(skip_serializing_if = "::std::vec::Vec::is_empty", default)]
61 #[doc = "The command as a list of program + arguments."]
62 pub command: Vec<()>,
63 #[serde(rename = "input-data")]
64 #[serde(skip_serializing_if = "Option::is_none", default)]
65 #[doc = "Data to pass as 'input-data' to the guest. Usually treated as STDIN to 'command'."]
66 pub input_data: Option<String>,
67 #[serde(
68 flatten,
69 default,
70 skip_serializing_if = "::std::collections::HashMap::is_empty"
71 )]
72 pub additional_properties: ::std::collections::HashMap<String, ::serde_json::Value>,
73}