openstack_keystone_core/k8s_auth/
backend.rs1use async_trait::async_trait;
16
17use crate::k8s_auth::{K8sAuthProviderError, types::*};
18use crate::keystone::ServiceState;
19
20#[cfg_attr(test, mockall::automock)]
24#[async_trait]
25pub trait K8sAuthBackend: Send + Sync {
26 async fn create_auth_instance(
28 &self,
29 state: &ServiceState,
30 auth_instance: K8sAuthInstanceCreate,
31 ) -> Result<K8sAuthInstance, K8sAuthProviderError>;
32
33 async fn create_auth_role(
35 &self,
36 state: &ServiceState,
37 role: K8sAuthRoleCreate,
38 ) -> Result<K8sAuthRole, K8sAuthProviderError>;
39
40 async fn delete_auth_instance<'a>(
42 &self,
43 state: &ServiceState,
44 id: &'a str,
45 ) -> Result<(), K8sAuthProviderError>;
46
47 async fn delete_auth_role<'a>(
49 &self,
50 state: &ServiceState,
51 id: &'a str,
52 ) -> Result<(), K8sAuthProviderError>;
53
54 async fn get_auth_instance<'a>(
56 &self,
57 state: &ServiceState,
58 id: &'a str,
59 ) -> Result<Option<K8sAuthInstance>, K8sAuthProviderError>;
60
61 async fn get_auth_role<'a>(
63 &self,
64 state: &ServiceState,
65 id: &'a str,
66 ) -> Result<Option<K8sAuthRole>, K8sAuthProviderError>;
67
68 async fn list_auth_instances(
70 &self,
71 state: &ServiceState,
72 params: &K8sAuthInstanceListParameters,
73 ) -> Result<Vec<K8sAuthInstance>, K8sAuthProviderError>;
74
75 async fn list_auth_roles(
77 &self,
78 state: &ServiceState,
79 params: &K8sAuthRoleListParameters,
80 ) -> Result<Vec<K8sAuthRole>, K8sAuthProviderError>;
81
82 async fn update_auth_instance<'a>(
84 &self,
85 state: &ServiceState,
86 id: &'a str,
87 data: K8sAuthInstanceUpdate,
88 ) -> Result<K8sAuthInstance, K8sAuthProviderError>;
89
90 async fn update_auth_role<'a>(
92 &self,
93 state: &ServiceState,
94 id: &'a str,
95 data: K8sAuthRoleUpdate,
96 ) -> Result<K8sAuthRole, K8sAuthProviderError>;
97}