Skip to main content

openstack_keystone_core/identity_mapping/
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
15use async_trait::async_trait;
16
17use crate::identity_mapping::{IdentityMappingProviderError, types::*};
18use crate::keystone::ServiceState;
19
20#[cfg_attr(test, mockall::automock)]
21#[async_trait]
22pub trait IdentityMappingBackend: Send + Sync {
23    /// Get the `IdMapping` by the local data.
24    async fn get_by_local_id<'a>(
25        &self,
26        state: &ServiceState,
27        local_id: &'a str,
28        domain_id: &'a str,
29        entity_type: IdMappingEntityType,
30    ) -> Result<Option<IdMapping>, IdentityMappingProviderError>;
31
32    /// Get the IdMapping by the public_id.
33    async fn get_by_public_id<'a>(
34        &self,
35        state: &ServiceState,
36        public_id: &'a str,
37    ) -> Result<Option<IdMapping>, IdentityMappingProviderError>;
38}