pve/nodes/node/scan/
iscsi.rs

1#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)]
2pub struct GetParameters {
3    #[doc = "The iSCSI portal (IP or DNS name with optional port)."]
4    pub portal: String,
5}
6
7#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)]
8pub struct GetResponseItem {
9    #[doc = "The iSCSI portal name."]
10    pub portal: String,
11    #[doc = "The iSCSI target name."]
12    pub target: String,
13}
14
15#[derive(Debug, Clone)]
16pub struct IscsiClient<T> {
17    client: T,
18    path: String,
19}
20
21impl<T> IscsiClient<T>
22where
23    T: Clone,
24{
25    pub fn new(client: T, parent_path: &str) -> Self {
26        Self {
27            client,
28            path: format!("{}/{}", parent_path, "iscsi"),
29        }
30    }
31}
32impl<T> IscsiClient<T>
33where
34    T: crate::client::HttpClient,
35{
36    #[doc = "Scan remote iSCSI server."]
37    pub fn get(&self, parameters: GetParameters) -> Result<Vec<GetResponseItem>, T::Error> {
38        self.client.get(&self.path, &parameters)
39    }
40}
41#[derive(Debug, Clone)]
42pub struct AsyncIscsiClient<T> {
43    client: T,
44    path: String,
45}
46
47impl<T> AsyncIscsiClient<T>
48where
49    T: Clone,
50{
51    pub fn new(client: T, parent_path: &str) -> Self {
52        Self {
53            client,
54            path: format!("{}/{}", parent_path, "iscsi"),
55        }
56    }
57}
58impl<T> AsyncIscsiClient<T>
59where
60    T: crate::client::AsyncHttpClient,
61{
62    #[doc = "Scan remote iSCSI server."]
63    pub async fn get(&self, parameters: GetParameters) -> Result<Vec<GetResponseItem>, T::Error> {
64        self.client.get(&self.path, &parameters).await
65    }
66}