proxmox_api/generated/nodes/node/qemu/vmid/agent/
file_write.rs1pub struct FileWriteClient<T> {
2 client: T,
3 path: String,
4}
5impl<T> FileWriteClient<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, "/file-write"),
13 }
14 }
15}
16impl<T> FileWriteClient<T>
17where
18 T: crate::client::Client,
19{
20 #[doc = "Writes the given file via guest agent."]
21 pub fn post(&self, params: PostParams) -> Result<(), T::Error> {
22 let path = self.path.to_string();
23 self.client.post(&path, ¶ms)
24 }
25}
26impl PostParams {
27 pub fn new(content: String, file: String) -> Self {
28 Self {
29 content,
30 file,
31 encode: Default::default(),
32 additional_properties: Default::default(),
33 }
34 }
35}
36#[derive(Clone, Debug, :: serde :: Serialize, :: serde :: Deserialize)]
37pub struct PostParams {
38 #[doc = "The content to write into the file."]
39 pub content: String,
40 #[serde(
41 serialize_with = "crate::types::serialize_bool_optional",
42 deserialize_with = "crate::types::deserialize_bool_optional"
43 )]
44 #[serde(skip_serializing_if = "Option::is_none", default)]
45 #[doc = "If set, the content will be encoded as base64 (required by QEMU).Otherwise the content needs to be encoded beforehand - defaults to true."]
46 pub encode: Option<bool>,
47 #[doc = "The path to the file."]
48 pub file: String,
49 #[serde(
50 flatten,
51 default,
52 skip_serializing_if = "::std::collections::HashMap::is_empty"
53 )]
54 pub additional_properties: ::std::collections::HashMap<String, ::serde_json::Value>,
55}