Skip to main content

openmetadata_rs_sdk/
connection.rs

1use crate::crud::Crud;
2use crate::entities::Entity;
3use crate::errors::OpenMetadataError;
4use futures::Future;
5use uuid::Uuid;
6
7// Authentication and connection handling
8#[derive(serde::Serialize, serde::Deserialize)]
9pub struct OpenMetadataClient {
10    base_url: String,
11    auth_token: String,
12    // client: reqwest::Client,
13}
14
15impl Entity for OpenMetadataClient {
16    fn entity_type() -> &'static str {
17        "openmetadata_client"
18    }
19}
20
21impl Crud for OpenMetadataClient {
22    type Entity = OpenMetadataClient;
23
24    fn create<T: Entity>(
25        &self,
26        _entity: &T,
27    ) -> impl Future<Output = Result<Uuid, OpenMetadataError>> {
28        async move { Ok(Uuid::new_v4()) }
29    }
30    fn read<T: Entity>(
31        &self,
32        _id: &Uuid,
33    ) -> impl Future<Output = Result<Option<T>, OpenMetadataError>> {
34        async move { Ok(None) }
35    }
36    fn update<T: Entity>(
37        &self,
38        _id: &Uuid,
39        _entity: &T,
40    ) -> impl Future<Output = Result<(), OpenMetadataError>> {
41        async move { Ok(()) }
42    }
43    fn delete<T: Entity>(&self, _id: &Uuid) -> impl Future<Output = Result<(), OpenMetadataError>> {
44        async move { Ok(()) }
45    }
46}