Skip to main content

openstack_keystone_core/trust/
backend.rs

1// Licensed under the Apache License, Version 2.0 (the "License");
2// you may not use this file except in compliance with the License.
3// You may obtain a copy of the License at
4//
5//     http://www.apache.org/licenses/LICENSE-2.0
6//
7// Unless required by applicable law or agreed to in writing, software
8// distributed under the License is distributed on an "AS IS" BASIS,
9// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
10// See the License for the specific language governing permissions and
11// limitations under the License.
12//
13// SPDX-License-Identifier: Apache-2.0
14//! Trust provider Backend trait.
15use async_trait::async_trait;
16
17use crate::keystone::ServiceState;
18use crate::trust::{TrustProviderError, types::*};
19
20/// TrustBackend trait.
21///
22/// Backend driver interface expected by the trust provider.
23#[cfg_attr(test, mockall::automock)]
24#[async_trait]
25pub trait TrustBackend: Send + Sync {
26    /// Get trust by ID.
27    async fn get_trust<'a>(
28        &self,
29        state: &ServiceState,
30        id: &'a str,
31    ) -> Result<Option<Trust>, TrustProviderError>;
32
33    /// Resolve trust chain by the trust ID.
34    async fn get_trust_delegation_chain<'a>(
35        &self,
36        state: &ServiceState,
37        id: &'a str,
38    ) -> Result<Option<Vec<Trust>>, TrustProviderError>;
39
40    /// List trusts.
41    async fn list_trusts(
42        &self,
43        state: &ServiceState,
44        params: &TrustListParameters,
45    ) -> Result<Vec<Trust>, TrustProviderError>;
46}