vim_rs 0.4.4

Rust Bindings for the VMware by Broadcom vCenter VI JSON API
Documentation
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)
    }
}