1pub mod flags;
2pub mod metadata;
3pub mod status;
4
5#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize, Default)]
6pub struct GetResponseItem {}
7
8#[derive(Debug, Clone)]
9pub struct CephClient<T> {
10 client: T,
11 path: String,
12}
13
14impl<T> CephClient<T>
15where
16 T: Clone,
17{
18 pub fn new(client: T, parent_path: &str) -> Self {
19 Self {
20 client,
21 path: format!("{}/{}", parent_path, "ceph"),
22 }
23 }
24
25 pub fn metadata(&self) -> metadata::MetadataClient<T> {
26 metadata::MetadataClient::<T>::new(self.client.clone(), &self.path)
27 }
28
29 pub fn status(&self) -> status::StatusClient<T> {
30 status::StatusClient::<T>::new(self.client.clone(), &self.path)
31 }
32
33 pub fn flags(&self) -> flags::FlagsClient<T> {
34 flags::FlagsClient::<T>::new(self.client.clone(), &self.path)
35 }
36}
37impl<T> CephClient<T>
38where
39 T: crate::client::HttpClient,
40{
41 #[doc = "Cluster ceph index."]
42 pub fn get(&self) -> Result<Vec<GetResponseItem>, T::Error> {
43 self.client.get(&self.path, &())
44 }
45}
46#[derive(Debug, Clone)]
47pub struct AsyncCephClient<T> {
48 client: T,
49 path: String,
50}
51
52impl<T> AsyncCephClient<T>
53where
54 T: Clone,
55{
56 pub fn new(client: T, parent_path: &str) -> Self {
57 Self {
58 client,
59 path: format!("{}/{}", parent_path, "ceph"),
60 }
61 }
62
63 pub fn metadata(&self) -> metadata::AsyncMetadataClient<T> {
64 metadata::AsyncMetadataClient::<T>::new(self.client.clone(), &self.path)
65 }
66
67 pub fn status(&self) -> status::AsyncStatusClient<T> {
68 status::AsyncStatusClient::<T>::new(self.client.clone(), &self.path)
69 }
70
71 pub fn flags(&self) -> flags::AsyncFlagsClient<T> {
72 flags::AsyncFlagsClient::<T>::new(self.client.clone(), &self.path)
73 }
74}
75impl<T> AsyncCephClient<T>
76where
77 T: crate::client::AsyncHttpClient,
78{
79 #[doc = "Cluster ceph index."]
80 pub async fn get(&self) -> Result<Vec<GetResponseItem>, T::Error> {
81 self.client.get(&self.path, &()).await
82 }
83}