Skip to main content

openstack_keystone_core/assignment/
error.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//! # Assignment provider error types
15use thiserror::Error;
16
17use crate::identity::error::IdentityProviderError;
18use crate::resource::error::ResourceProviderError;
19use crate::revoke::error::RevokeProviderError;
20
21/// Assignment provider error.
22#[derive(Error, Debug)]
23pub enum AssignmentProviderError {
24    /// Assignment not found.
25    #[error("assignment not found: {0}")]
26    AssignmentNotFound(String),
27
28    /// Conflict.
29    #[error("conflict: {0}")]
30    Conflict(String),
31
32    /// Driver error.
33    #[error("backend driver error: {0}")]
34    Driver(String),
35
36    /// Identity provider error.
37    #[error(transparent)]
38    IdentityProvider {
39        #[from]
40        source: IdentityProviderError,
41    },
42
43    /// Invalid assignment type.
44    #[error("{0}")]
45    InvalidAssignmentType(String),
46
47    /// Resource provider error.
48    #[error(transparent)]
49    ResourceProvider {
50        #[from]
51        source: ResourceProviderError,
52    },
53
54    /// Revoke provider error.
55    #[error(transparent)]
56    RevokeProvider {
57        #[from]
58        source: RevokeProviderError,
59    },
60
61    /// Role not found.
62    #[error("role {0} not found")]
63    RoleNotFound(String),
64
65    /// Role provider error.
66    #[error(transparent)]
67    RoleProvider {
68        #[from]
69        source: crate::role::error::RoleProviderError,
70    },
71
72    /// (de)serialize error.
73    #[error(transparent)]
74    Serde {
75        #[from]
76        source: serde_json::Error,
77    },
78
79    /// Structures builder error.
80    #[error(transparent)]
81    StructBuilder {
82        /// The source of the error.
83        #[from]
84        source: crate::error::BuilderError,
85    },
86
87    /// Unsupported driver.
88    #[error("unsupported driver `{0}` for the assignment provider")]
89    UnsupportedDriver(String),
90
91    /// Validation error.
92    #[error("request validation error: {}", source)]
93    Validation {
94        /// The source of the error.
95        #[from]
96        source: validator::ValidationErrors,
97    },
98}