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
use std::sync::Arc;
use crate::core::client::{VimClient, Result};
/// *View* is the base class for session-specific view objects.
///
/// A view is a mechanism that supports selection of objects on the server
/// and subsequently, access to those objects.
/// To create a view, use the *ViewManager* methods.
/// A view exists until you terminate it by calling the *View.DestroyView* method,
/// or until the end of the session.
/// Access to a view is limited to the session in which it is created.
///
/// There are three types of views:
/// - *ContainerView*
/// - *ListView*
/// - *InventoryView*
///
/// A view maintains a *ManagedObjectView.view* list that contains
/// managed object references. You can use a view
/// with the *PropertyCollector* to retrieve data and
/// obtain notification of changes to the virtual environment.
/// For information about using views with the PropertyCollector,
/// see the description of *ViewManager*.
#[derive(Clone)]
pub struct View {
client: Arc<dyn VimClient>,
mo_id: String,
}
impl View {
pub fn new(client: Arc<dyn VimClient>, mo_id: &str) -> Self {
Self {
client,
mo_id: mo_id.to_string(),
}
}
/// Destroy this view.
///
/// ***Required privileges:*** System.View
pub async fn destroy_view(&self) -> Result<()> {
self.client.invoke_void("", "View", &self.mo_id, "DestroyView", None).await
}
}