openstack_keystone_core/application_credential/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//! # Application credential provider backend
15
16use async_trait::async_trait;
17
18use crate::application_credential::ApplicationCredentialProviderError;
19use crate::application_credential::types::*;
20use crate::keystone::ServiceState;
21
22/// Application Credential backend driver interface.
23#[cfg_attr(test, mockall::automock)]
24#[async_trait]
25pub trait ApplicationCredentialBackend: Send + Sync {
26 /// Create a new application credential.
27 async fn create_application_credential(
28 &self,
29 state: &ServiceState,
30 rec: ApplicationCredentialCreate,
31 ) -> Result<ApplicationCredentialCreateResponse, ApplicationCredentialProviderError>;
32
33 /// Get a single application credential by ID.
34 async fn get_application_credential<'a>(
35 &self,
36 state: &ServiceState,
37 id: &'a str,
38 ) -> Result<Option<ApplicationCredential>, ApplicationCredentialProviderError>;
39
40 /// List application credentials.
41 async fn list_application_credentials(
42 &self,
43 state: &ServiceState,
44 params: &ApplicationCredentialListParameters,
45 ) -> Result<Vec<ApplicationCredential>, ApplicationCredentialProviderError>;
46}