1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
pub mod exec;
pub mod exec_status;
pub mod file_read;
pub mod file_write;
pub mod fsfreeze_freeze;
pub mod fsfreeze_status;
pub mod fsfreeze_thaw;
pub mod fstrim;
pub mod get_fsinfo;
pub mod get_host_name;
pub mod get_memory_block_info;
pub mod get_memory_blocks;
pub mod get_osinfo;
pub mod get_time;
pub mod get_timezone;
pub mod get_users;
pub mod get_vcpus;
pub mod info;
pub mod network_get_interfaces;
pub mod ping;
pub mod set_user_password;
pub mod shutdown;
pub mod suspend_disk;
pub mod suspend_hybrid;
pub mod suspend_ram;
pub struct AgentClient<T> {
    client: T,
    path: String,
}
impl<T> AgentClient<T>
where
    T: crate::client::Client,
{
    pub fn new(client: T, parent_path: &str) -> Self {
        Self {
            client,
            path: format!("{}{}", parent_path, "/agent"),
        }
    }
}
impl<T> AgentClient<T>
where
    T: crate::client::Client,
{
    #[doc = "QEMU Guest Agent command index."]
    pub fn get(&self) -> Result<Vec<GetOutputItems>, T::Error> {
        let path = self.path.to_string();
        self.client.get(&path, &())
    }
}
impl<T> AgentClient<T>
where
    T: crate::client::Client,
{
    #[doc = "Execute QEMU Guest Agent commands."]
    pub fn post(&self, params: PostParams) -> Result<PostOutput, T::Error> {
        let path = self.path.to_string();
        self.client.post(&path, &params)
    }
}
#[derive(Clone, Debug, :: serde :: Serialize, :: serde :: Deserialize, Default)]
pub struct GetOutputItems {
    #[serde(
        flatten,
        default,
        skip_serializing_if = "::std::collections::HashMap::is_empty"
    )]
    pub additional_properties: ::std::collections::HashMap<String, ::serde_json::Value>,
}
#[derive(Clone, Debug, :: serde :: Serialize, :: serde :: Deserialize, Default)]
pub struct PostOutput {
    #[serde(
        flatten,
        default,
        skip_serializing_if = "::std::collections::HashMap::is_empty"
    )]
    pub additional_properties: ::std::collections::HashMap<String, ::serde_json::Value>,
}
impl PostParams {
    pub fn new(command: Command) -> Self {
        Self {
            command,
            additional_properties: Default::default(),
        }
    }
}
#[derive(Clone, Debug, :: serde :: Serialize, :: serde :: Deserialize)]
pub struct PostParams {
    #[doc = "The QGA command."]
    pub command: Command,
    #[serde(
        flatten,
        default,
        skip_serializing_if = "::std::collections::HashMap::is_empty"
    )]
    pub additional_properties: ::std::collections::HashMap<String, ::serde_json::Value>,
}
#[derive(Clone, Debug, :: serde :: Serialize, :: serde :: Deserialize)]
pub enum Command {
    #[serde(rename = "fsfreeze-freeze")]
    FsfreezeFreeze,
    #[serde(rename = "fsfreeze-status")]
    FsfreezeStatus,
    #[serde(rename = "fsfreeze-thaw")]
    FsfreezeThaw,
    #[serde(rename = "fstrim")]
    Fstrim,
    #[serde(rename = "get-fsinfo")]
    GetFsinfo,
    #[serde(rename = "get-host-name")]
    GetHostName,
    #[serde(rename = "get-memory-block-info")]
    GetMemoryBlockInfo,
    #[serde(rename = "get-memory-blocks")]
    GetMemoryBlocks,
    #[serde(rename = "get-osinfo")]
    GetOsinfo,
    #[serde(rename = "get-time")]
    GetTime,
    #[serde(rename = "get-timezone")]
    GetTimezone,
    #[serde(rename = "get-users")]
    GetUsers,
    #[serde(rename = "get-vcpus")]
    GetVcpus,
    #[serde(rename = "info")]
    Info,
    #[serde(rename = "network-get-interfaces")]
    NetworkGetInterfaces,
    #[serde(rename = "ping")]
    Ping,
    #[serde(rename = "shutdown")]
    Shutdown,
    #[serde(rename = "suspend-disk")]
    SuspendDisk,
    #[serde(rename = "suspend-hybrid")]
    SuspendHybrid,
    #[serde(rename = "suspend-ram")]
    SuspendRam,
}
impl<T> AgentClient<T>
where
    T: crate::client::Client,
{
    pub fn fsfreeze_freeze(&self) -> fsfreeze_freeze::FsfreezeFreezeClient<T> {
        fsfreeze_freeze::FsfreezeFreezeClient::<T>::new(self.client.clone(), &self.path)
    }
}
impl<T> AgentClient<T>
where
    T: crate::client::Client,
{
    pub fn fsfreeze_status(&self) -> fsfreeze_status::FsfreezeStatusClient<T> {
        fsfreeze_status::FsfreezeStatusClient::<T>::new(self.client.clone(), &self.path)
    }
}
impl<T> AgentClient<T>
where
    T: crate::client::Client,
{
    pub fn fsfreeze_thaw(&self) -> fsfreeze_thaw::FsfreezeThawClient<T> {
        fsfreeze_thaw::FsfreezeThawClient::<T>::new(self.client.clone(), &self.path)
    }
}
impl<T> AgentClient<T>
where
    T: crate::client::Client,
{
    pub fn fstrim(&self) -> fstrim::FstrimClient<T> {
        fstrim::FstrimClient::<T>::new(self.client.clone(), &self.path)
    }
}
impl<T> AgentClient<T>
where
    T: crate::client::Client,
{
    pub fn get_fsinfo(&self) -> get_fsinfo::GetFsinfoClient<T> {
        get_fsinfo::GetFsinfoClient::<T>::new(self.client.clone(), &self.path)
    }
}
impl<T> AgentClient<T>
where
    T: crate::client::Client,
{
    pub fn get_host_name(&self) -> get_host_name::GetHostNameClient<T> {
        get_host_name::GetHostNameClient::<T>::new(self.client.clone(), &self.path)
    }
}
impl<T> AgentClient<T>
where
    T: crate::client::Client,
{
    pub fn get_memory_block_info(&self) -> get_memory_block_info::GetMemoryBlockInfoClient<T> {
        get_memory_block_info::GetMemoryBlockInfoClient::<T>::new(self.client.clone(), &self.path)
    }
}
impl<T> AgentClient<T>
where
    T: crate::client::Client,
{
    pub fn get_memory_blocks(&self) -> get_memory_blocks::GetMemoryBlocksClient<T> {
        get_memory_blocks::GetMemoryBlocksClient::<T>::new(self.client.clone(), &self.path)
    }
}
impl<T> AgentClient<T>
where
    T: crate::client::Client,
{
    pub fn get_osinfo(&self) -> get_osinfo::GetOsinfoClient<T> {
        get_osinfo::GetOsinfoClient::<T>::new(self.client.clone(), &self.path)
    }
}
impl<T> AgentClient<T>
where
    T: crate::client::Client,
{
    pub fn get_time(&self) -> get_time::GetTimeClient<T> {
        get_time::GetTimeClient::<T>::new(self.client.clone(), &self.path)
    }
}
impl<T> AgentClient<T>
where
    T: crate::client::Client,
{
    pub fn get_timezone(&self) -> get_timezone::GetTimezoneClient<T> {
        get_timezone::GetTimezoneClient::<T>::new(self.client.clone(), &self.path)
    }
}
impl<T> AgentClient<T>
where
    T: crate::client::Client,
{
    pub fn get_users(&self) -> get_users::GetUsersClient<T> {
        get_users::GetUsersClient::<T>::new(self.client.clone(), &self.path)
    }
}
impl<T> AgentClient<T>
where
    T: crate::client::Client,
{
    pub fn get_vcpus(&self) -> get_vcpus::GetVcpusClient<T> {
        get_vcpus::GetVcpusClient::<T>::new(self.client.clone(), &self.path)
    }
}
impl<T> AgentClient<T>
where
    T: crate::client::Client,
{
    pub fn info(&self) -> info::InfoClient<T> {
        info::InfoClient::<T>::new(self.client.clone(), &self.path)
    }
}
impl<T> AgentClient<T>
where
    T: crate::client::Client,
{
    pub fn network_get_interfaces(&self) -> network_get_interfaces::NetworkGetInterfacesClient<T> {
        network_get_interfaces::NetworkGetInterfacesClient::<T>::new(
            self.client.clone(),
            &self.path,
        )
    }
}
impl<T> AgentClient<T>
where
    T: crate::client::Client,
{
    pub fn ping(&self) -> ping::PingClient<T> {
        ping::PingClient::<T>::new(self.client.clone(), &self.path)
    }
}
impl<T> AgentClient<T>
where
    T: crate::client::Client,
{
    pub fn shutdown(&self) -> shutdown::ShutdownClient<T> {
        shutdown::ShutdownClient::<T>::new(self.client.clone(), &self.path)
    }
}
impl<T> AgentClient<T>
where
    T: crate::client::Client,
{
    pub fn suspend_disk(&self) -> suspend_disk::SuspendDiskClient<T> {
        suspend_disk::SuspendDiskClient::<T>::new(self.client.clone(), &self.path)
    }
}
impl<T> AgentClient<T>
where
    T: crate::client::Client,
{
    pub fn suspend_hybrid(&self) -> suspend_hybrid::SuspendHybridClient<T> {
        suspend_hybrid::SuspendHybridClient::<T>::new(self.client.clone(), &self.path)
    }
}
impl<T> AgentClient<T>
where
    T: crate::client::Client,
{
    pub fn suspend_ram(&self) -> suspend_ram::SuspendRamClient<T> {
        suspend_ram::SuspendRamClient::<T>::new(self.client.clone(), &self.path)
    }
}
impl<T> AgentClient<T>
where
    T: crate::client::Client,
{
    pub fn set_user_password(&self) -> set_user_password::SetUserPasswordClient<T> {
        set_user_password::SetUserPasswordClient::<T>::new(self.client.clone(), &self.path)
    }
}
impl<T> AgentClient<T>
where
    T: crate::client::Client,
{
    pub fn exec(&self) -> exec::ExecClient<T> {
        exec::ExecClient::<T>::new(self.client.clone(), &self.path)
    }
}
impl<T> AgentClient<T>
where
    T: crate::client::Client,
{
    pub fn exec_status(&self) -> exec_status::ExecStatusClient<T> {
        exec_status::ExecStatusClient::<T>::new(self.client.clone(), &self.path)
    }
}
impl<T> AgentClient<T>
where
    T: crate::client::Client,
{
    pub fn file_read(&self) -> file_read::FileReadClient<T> {
        file_read::FileReadClient::<T>::new(self.client.clone(), &self.path)
    }
}
impl<T> AgentClient<T>
where
    T: crate::client::Client,
{
    pub fn file_write(&self) -> file_write::FileWriteClient<T> {
        file_write::FileWriteClient::<T>::new(self.client.clone(), &self.path)
    }
}