Skip to main content

proxmox_api/generated/nodes/node/qemu/vmid/agent/
file_read.rs

1#[derive(Debug, Clone)]
2pub struct FileReadClient<T> {
3    client: T,
4    path: String,
5}
6impl<T> FileReadClient<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, "/file-read"),
14        }
15    }
16}
17impl<T> FileReadClient<T>
18where
19    T: crate::client::Client,
20{
21    #[doc = "Reads the given file via guest agent. Is limited to 16777216 bytes."]
22    #[doc = ""]
23    #[doc = "Permission check: perm(\"/vms/{vmid}\", [\"VM.GuestAgent.FileRead\", \"VM.GuestAgent.Unrestricted\"], any)"]
24    pub async fn get(&self, params: GetParams) -> Result<GetOutput, T::Error> {
25        let path = self.path.to_string();
26        self.client.get(&path, &params).await
27    }
28}
29impl GetOutput {
30    pub fn new(content: String) -> Self {
31        Self {
32            content,
33            truncated: ::std::default::Default::default(),
34            additional_properties: ::std::default::Default::default(),
35        }
36    }
37}
38#[derive(Clone, Debug, :: serde :: Serialize, :: serde :: Deserialize)]
39pub struct GetOutput {
40    #[doc = "The content of the file, maximum 16777216"]
41    #[doc = ""]
42    pub content: String,
43    #[serde(
44        serialize_with = "crate::types::serialize_bool_optional",
45        deserialize_with = "crate::types::deserialize_bool_optional"
46    )]
47    #[serde(skip_serializing_if = "Option::is_none", default)]
48    #[doc = "If set to 1, the output is truncated and not complete"]
49    #[doc = ""]
50    pub truncated: Option<bool>,
51    #[serde(
52        flatten,
53        default,
54        skip_serializing_if = "::std::collections::HashMap::is_empty"
55    )]
56    pub additional_properties: ::std::collections::HashMap<String, ::serde_json::Value>,
57}
58impl GetParams {
59    pub fn new(file: String) -> Self {
60        Self {
61            file,
62            additional_properties: ::std::default::Default::default(),
63        }
64    }
65}
66#[derive(Clone, Debug, :: serde :: Serialize, :: serde :: Deserialize)]
67pub struct GetParams {
68    #[doc = "The path to the file"]
69    #[doc = ""]
70    pub file: String,
71    #[serde(
72        flatten,
73        default,
74        skip_serializing_if = "::std::collections::HashMap::is_empty"
75    )]
76    pub additional_properties: ::std::collections::HashMap<String, ::serde_json::Value>,
77}