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
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
use std::sync::Arc;
use crate::core::client::{VimClient, Result};
/// VsanPhoneHomeSystem contains a collection of APIs to perform online health
/// checks.
///
/// The Managed Entity can be accessed through MOID of
/// vsan-phonehome-system through vSAN service at vCenter server side.
#[derive(Clone)]
pub struct VsanPhoneHomeSystem {
client: Arc<dyn VimClient>,
mo_id: String,
}
impl VsanPhoneHomeSystem {
pub fn new(client: Arc<dyn VimClient>, mo_id: &str) -> Self {
Self {
client,
mo_id: mo_id.to_string(),
}
}
/// QueryVsanCloudHealthStatus returns a VsanCloudHealthStatus object
/// with various states of the vSAN CEIP Collector Agent.
///
/// When checking for internet connectivity, a connection to
/// https://vcsa.vmware.com/ will be attempted with timeout of 10 seconds.
///
/// ***Required privileges:*** Global.Diagnostics
///
/// ## Returns:
///
/// vim.vsan.VsanCloudHealthStatus
///
/// ## Errors:
///
/// Failure
pub async fn query_vsan_cloud_health_status(&self) -> Result<Option<crate::types::structs::VsanCloudHealthStatus>> {
let bytes_opt = self.client.invoke_optional("vsan", "VsanPhoneHomeSystem", &self.mo_id, "QueryVsanCloudHealthStatus", None).await?;
match bytes_opt {
Some(ref b) => Ok(Some(crate::core::client::unmarshal(self.client.transport(), b)?)),
None => Ok(None),
}
}
/// An asynchronous API for performing vSAN online health checks.
///
/// This API generates a task to collect current vSAN environment settings and
/// performance data driven by a manifest, and send the collected data to VMware
/// for data streaming analysis. It then queries the analyzed results back to
/// help customer have the best vSAN practices.
/// This task usually takes about 1 minute for a typical 4 nodes vSAN cluster.
/// However, this task can take more time based on the size of vSAN cluster, the
/// size of queried data driven by manifest and the customer Internet speed.
///
/// ## Parameters:
///
/// ### cluster
/// The target vSAN cluster
///
/// ***Required privileges:*** Host.Inventory.EditCluster
///
/// Refers instance of *ClusterComputeResource*.
///
/// ## Returns:
///
/// task vCenter Task
///
/// Refers instance of *Task*.
///
/// ## Errors:
///
/// Failure
pub async fn vsan_perform_online_health_check(&self, cluster: &crate::types::structs::ManagedObjectReference) -> Result<crate::types::structs::ManagedObjectReference> {
let input = VsanPerformOnlineHealthCheckRequestType {cluster, };
let bytes = self.client.invoke("vsan", "VsanPhoneHomeSystem", &self.mo_id, "VsanPerformOnlineHealthCheck", Some(&input)).await?;
let result: crate::types::structs::ManagedObjectReference = crate::core::client::unmarshal(self.client.transport(), &bytes)?;
Ok(result)
}
/// It is a VC level API that iterates over all hosts
/// in the clusters to get LSOM wbSize through the
/// host level API.
///
/// Only supported in vSAN OSA
/// Example:
/// {
/// host-29 :{
/// "5257a570-922c-9a38-e79a-3ab2871ab0b8": {
/// "wbSize": 16105168896 },
/// "521530b5-91cf-0dfe-d469-9cdfc9146b64": {
/// "wbSize": 0 },
/// "521446ca-e8bb-e369-912c-abb02b97001f": {
/// "wbSize": 0 },
/// },
/// host-30:{
/// "5257a570-922c-9a38-e79a-3ab2871ab0b8": {
/// "wbSize": 16105168896 },
/// "521530b5-91cf-0dfe-d469-9cdfc9146b64": {
/// "wbSize": 0 },
/// "521446ca-e8bb-e369-912c-abb02b97001f": {
/// "wbSize": 0 }
/// }
/// }
///
/// ***Since:*** 8.0.0.4
///
/// ## Parameters:
///
/// ### cluster
/// ***Required privileges:*** System.Read
///
/// Refers instance of *ClusterComputeResource*.
///
/// ## Errors:
///
/// Failure
pub async fn vsan_query_lso_mwbsize(&self, cluster: &crate::types::structs::ManagedObjectReference) -> Result<Option<String>> {
let input = VsanQueryLsoMwbsizeRequestType {cluster, };
let bytes_opt = self.client.invoke_optional("vsan", "VsanPhoneHomeSystem", &self.mo_id, "VsanQueryLSOMwbsize", Some(&input)).await?;
match bytes_opt {
Some(ref b) => Ok(Some(crate::core::client::unmarshal(self.client.transport(), b)?)),
None => Ok(None),
}
}
/// API to Enhance DDH health state monitoring for
/// VSAN NVMe disks to check the NVMe critical warnings.
///
/// This API iterates over each host to call the Host
/// Level API to collect the data
/// Note: This data is collected for only VSAN NVMe devices
///
/// ***Since:*** 8.0.0.4
///
/// ## Parameters:
///
/// ### cluster
/// Target cluster
///
/// ***Required privileges:*** System.Read
///
/// Refers instance of *ClusterComputeResource*.
///
/// ## Returns:
///
/// string of json format data, for example:
/// { "host-29":{
/// "eui.3c22afd568ada7e3000c29675e8e0701": {
/// "spare\_space": 0,
/// "temp\_exceeded\_threshold": 0,
/// "subsystem\_reliability\_degraded": 0,
/// "read\_only": 0,
/// "backup\_failed": 0
/// },
/// "eui.1c29f18de63cdc84000c2965dd62c898": {
/// "spare\_space": 0,
/// "temp\_exceeded\_threshold": 0,
/// "subsystem\_reliability\_degraded": 0,
/// "read\_only": 0,
/// "backup\_failed": 0
/// }
/// }
/// "host-30":{
/// "eui.3c22afd568ada7e3000c29675e8e0701": {
/// "spare\_space": 0,
/// "temp\_exceeded\_threshold": 0,
/// "subsystem\_reliability\_degraded": 0,
/// "read\_only": 0,
/// "backup\_failed": 0
/// },
/// "eui.1c29f18de63cdc84000c2965dd62c898": {
/// "spare\_space": 0,
/// "temp\_exceeded\_threshold": 0,
/// "subsystem\_reliability\_degraded": 0,
/// "read\_only": 0,
/// "backup\_failed": 0
/// }
/// }
/// }
///
/// ## Errors:
///
/// Failure
pub async fn vsan_query_nvme_critical_warning_stats(&self, cluster: &crate::types::structs::ManagedObjectReference) -> Result<Option<String>> {
let input = VsanQueryNvmeCriticalWarningStatsRequestType {cluster, };
let bytes_opt = self.client.invoke_optional("vsan", "VsanPhoneHomeSystem", &self.mo_id, "VsanQueryNvmeCriticalWarningStats", Some(&input)).await?;
match bytes_opt {
Some(ref b) => Ok(Some(crate::core::client::unmarshal(self.client.transport(), b)?)),
None => Ok(None),
}
}
/// API to get vSAN object snapshot information in a vSAN cluster
///
/// ## Parameters:
///
/// ### cluster
/// Target cluster
///
/// ***Required privileges:*** System.Read
///
/// Refers instance of *ClusterComputeResource*.
///
/// ## Returns:
///
/// string of json format data, for example:
/// {"summary" : {
/// "TotalObjects" : ,
/// "TotalSnapshots" :
/// },
/// "detail" : {
/// "snapshot\_count\_0" : count,
/// "snapshot\_count\_1" : count,
/// "snapshot\_count\_2" : count
/// }
/// }
///
/// ## Errors:
///
/// ***InvalidArgument***: Exception for invalid input arguments, for example,
/// if the given argument is not passed correctly.
///
/// ***InvalidType***: Exception for invalid type arguments, for example,
/// if the given argument is not type of cluster moId.
///
/// ***ManagedObjectNotFound***: Exception for invalid reference argument,
/// for example, if the given cluster is not
/// found.
pub async fn vsan_query_object_snapshots_info(&self, cluster: &crate::types::structs::ManagedObjectReference) -> Result<Option<String>> {
let input = VsanQueryObjectSnapshotsInfoRequestType {cluster, };
let bytes_opt = self.client.invoke_optional("vsan", "VsanPhoneHomeSystem", &self.mo_id, "VsanQueryObjectSnapshotsInfo", Some(&input)).await?;
match bytes_opt {
Some(ref b) => Ok(Some(crate::core::client::unmarshal(self.client.transport(), b)?)),
None => Ok(None),
}
}
/// VC API to iterate over all hots to collect zDOMscrubber stats
/// from the path "/vmkModules/vsan/zdom/zdomObjects/<ObjectUuid>/zdomPaused"
/// Note: This data is collected for hosts which are part of VSAN ESA cluster only
///
/// ***Since:*** 8.0.0.4
///
/// ## Parameters:
///
/// ### cluster
/// Target cluster
///
/// ***Required privileges:*** System.Read
///
/// Refers instance of *ClusterComputeResource*.
///
/// ## Returns:
///
/// string of json format data, for example:
/// {
/// "<host1\_name>" : \[{'Object\_uuid': <value>,
/// 'state': <value>}, {'Object\_uuid': <value>,
/// 'state': <value>}\],
/// "<host2\_name>" : \[{'Object\_uuid': <value>,
/// 'state': <value>}\]
/// }
///
/// ## Errors:
///
/// Failure
pub async fn vsan_query_zdom_scrubber_data(&self, cluster: &crate::types::structs::ManagedObjectReference) -> Result<Option<String>> {
let input = VsanQueryZdomScrubberDataRequestType {cluster, };
let bytes_opt = self.client.invoke_optional("vsan", "VsanPhoneHomeSystem", &self.mo_id, "VsanQueryZdomScrubberData", Some(&input)).await?;
match bytes_opt {
Some(ref b) => Ok(Some(crate::core::client::unmarshal(self.client.transport(), b)?)),
None => Ok(None),
}
}
}
struct VsanPerformOnlineHealthCheckRequestType<'a> {
cluster: &'a crate::types::structs::ManagedObjectReference,
}
impl<'a> miniserde::Serialize for VsanPerformOnlineHealthCheckRequestType<'a> {
fn begin(&self) -> miniserde::ser::Fragment<'_> {
miniserde::ser::Fragment::Map(Box::new(VsanPerformOnlineHealthCheckRequestTypeSer { data: self, seq: 0 }))
}
}
struct VsanPerformOnlineHealthCheckRequestTypeSer<'b, 'a> {
data: &'b VsanPerformOnlineHealthCheckRequestType<'a>,
seq: usize,
}
impl<'b, 'a> miniserde::ser::Map for VsanPerformOnlineHealthCheckRequestTypeSer<'b, 'a> {
fn next(&mut self) -> Option<(std::borrow::Cow<'_, str>, &dyn miniserde::Serialize)> {
let seq = self.seq;
self.seq += 1;
match seq {
0 => return Some((std::borrow::Cow::Borrowed("_typeName"), &"VsanPerformOnlineHealthCheckRequestType")),
1 => return Some((std::borrow::Cow::Borrowed("cluster"), &self.data.cluster as &dyn miniserde::Serialize)),
_ => return None,
}
}
}
struct VsanQueryLsoMwbsizeRequestType<'a> {
cluster: &'a crate::types::structs::ManagedObjectReference,
}
impl<'a> miniserde::Serialize for VsanQueryLsoMwbsizeRequestType<'a> {
fn begin(&self) -> miniserde::ser::Fragment<'_> {
miniserde::ser::Fragment::Map(Box::new(VsanQueryLsoMwbsizeRequestTypeSer { data: self, seq: 0 }))
}
}
struct VsanQueryLsoMwbsizeRequestTypeSer<'b, 'a> {
data: &'b VsanQueryLsoMwbsizeRequestType<'a>,
seq: usize,
}
impl<'b, 'a> miniserde::ser::Map for VsanQueryLsoMwbsizeRequestTypeSer<'b, 'a> {
fn next(&mut self) -> Option<(std::borrow::Cow<'_, str>, &dyn miniserde::Serialize)> {
let seq = self.seq;
self.seq += 1;
match seq {
0 => return Some((std::borrow::Cow::Borrowed("_typeName"), &"VsanQueryLSOMwbsizeRequestType")),
1 => return Some((std::borrow::Cow::Borrowed("cluster"), &self.data.cluster as &dyn miniserde::Serialize)),
_ => return None,
}
}
}
struct VsanQueryNvmeCriticalWarningStatsRequestType<'a> {
cluster: &'a crate::types::structs::ManagedObjectReference,
}
impl<'a> miniserde::Serialize for VsanQueryNvmeCriticalWarningStatsRequestType<'a> {
fn begin(&self) -> miniserde::ser::Fragment<'_> {
miniserde::ser::Fragment::Map(Box::new(VsanQueryNvmeCriticalWarningStatsRequestTypeSer { data: self, seq: 0 }))
}
}
struct VsanQueryNvmeCriticalWarningStatsRequestTypeSer<'b, 'a> {
data: &'b VsanQueryNvmeCriticalWarningStatsRequestType<'a>,
seq: usize,
}
impl<'b, 'a> miniserde::ser::Map for VsanQueryNvmeCriticalWarningStatsRequestTypeSer<'b, 'a> {
fn next(&mut self) -> Option<(std::borrow::Cow<'_, str>, &dyn miniserde::Serialize)> {
let seq = self.seq;
self.seq += 1;
match seq {
0 => return Some((std::borrow::Cow::Borrowed("_typeName"), &"VsanQueryNvmeCriticalWarningStatsRequestType")),
1 => return Some((std::borrow::Cow::Borrowed("cluster"), &self.data.cluster as &dyn miniserde::Serialize)),
_ => return None,
}
}
}
struct VsanQueryObjectSnapshotsInfoRequestType<'a> {
cluster: &'a crate::types::structs::ManagedObjectReference,
}
impl<'a> miniserde::Serialize for VsanQueryObjectSnapshotsInfoRequestType<'a> {
fn begin(&self) -> miniserde::ser::Fragment<'_> {
miniserde::ser::Fragment::Map(Box::new(VsanQueryObjectSnapshotsInfoRequestTypeSer { data: self, seq: 0 }))
}
}
struct VsanQueryObjectSnapshotsInfoRequestTypeSer<'b, 'a> {
data: &'b VsanQueryObjectSnapshotsInfoRequestType<'a>,
seq: usize,
}
impl<'b, 'a> miniserde::ser::Map for VsanQueryObjectSnapshotsInfoRequestTypeSer<'b, 'a> {
fn next(&mut self) -> Option<(std::borrow::Cow<'_, str>, &dyn miniserde::Serialize)> {
let seq = self.seq;
self.seq += 1;
match seq {
0 => return Some((std::borrow::Cow::Borrowed("_typeName"), &"VsanQueryObjectSnapshotsInfoRequestType")),
1 => return Some((std::borrow::Cow::Borrowed("cluster"), &self.data.cluster as &dyn miniserde::Serialize)),
_ => return None,
}
}
}
struct VsanQueryZdomScrubberDataRequestType<'a> {
cluster: &'a crate::types::structs::ManagedObjectReference,
}
impl<'a> miniserde::Serialize for VsanQueryZdomScrubberDataRequestType<'a> {
fn begin(&self) -> miniserde::ser::Fragment<'_> {
miniserde::ser::Fragment::Map(Box::new(VsanQueryZdomScrubberDataRequestTypeSer { data: self, seq: 0 }))
}
}
struct VsanQueryZdomScrubberDataRequestTypeSer<'b, 'a> {
data: &'b VsanQueryZdomScrubberDataRequestType<'a>,
seq: usize,
}
impl<'b, 'a> miniserde::ser::Map for VsanQueryZdomScrubberDataRequestTypeSer<'b, 'a> {
fn next(&mut self) -> Option<(std::borrow::Cow<'_, str>, &dyn miniserde::Serialize)> {
let seq = self.seq;
self.seq += 1;
match seq {
0 => return Some((std::borrow::Cow::Borrowed("_typeName"), &"VsanQueryZdomScrubberDataRequestType")),
1 => return Some((std::borrow::Cow::Borrowed("cluster"), &self.data.cluster as &dyn miniserde::Serialize)),
_ => return None,
}
}
}