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
use std::sync::Arc;
use crate::core::client::{VimClient, Result};
/// The *VslmServiceInstance* managed object is the root object of the
/// vSphere Storage Lifecycle Management(VSLM) service.
///
/// After you connect to
/// VSLM Server, you create a reference to the *VslmServiceInstance*, and use
/// that reference to retrieve the *VslmServiceInstanceContent* data
/// object. The *VslmServiceInstanceContent* object provides access to
/// VSLM managed objects.
#[derive(Clone)]
pub struct VslmServiceInstance {
client: Arc<dyn VimClient>,
mo_id: String,
}
impl VslmServiceInstance {
pub fn new(client: Arc<dyn VimClient>, mo_id: &str) -> Self {
Self {
client,
mo_id: mo_id.to_string(),
}
}
/// Retrieves the properties of the Storage Lifecycle Management service
/// instance.
///
/// ***Required privileges:*** System.Anonymous
///
/// ## Returns:
///
/// Service instance properties that provide access to
/// Storage Lifecycle Management managed objects.
pub async fn retrieve_content(&self) -> Result<crate::types::structs::VslmServiceInstanceContent> {
let bytes = self.client.invoke("vslm", "VslmServiceInstance", &self.mo_id, "RetrieveContent", None).await?;
let result: crate::types::structs::VslmServiceInstanceContent = crate::core::client::unmarshal(self.client.transport(), &bytes)?;
Ok(result)
}
/// Contains references to Storage Lifecycle Management managed objects.
///
/// ***Required privileges:*** System.Anonymous
pub async fn content(&self) -> Result<crate::types::structs::VslmServiceInstanceContent> {
let pv_opt = self.client.fetch_property_raw("vslm", "VslmServiceInstance", &self.mo_id, "content").await?;
let pv = pv_opt.ok_or_else(|| crate::core::client::VimError::ParseError("property content was empty".to_string()))?;
let result: crate::types::structs::VslmServiceInstanceContent = crate::core::client::extract_property(pv)?;
Ok(result)
}
}