Skip to main content

openstack_keystone_core/api/v3/
project.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//! Project API types.
15
16pub use openstack_keystone_api_types::v3::project::*;
17
18use crate::resource::types as provider_types;
19
20impl From<provider_types::Project> for ProjectShort {
21    fn from(value: provider_types::Project) -> Self {
22        Self {
23            domain_id: value.domain_id,
24            enabled: value.enabled,
25            id: value.id,
26            name: value.name,
27        }
28    }
29}
30
31impl From<&provider_types::Project> for ProjectShort {
32    fn from(value: &provider_types::Project) -> Self {
33        Self {
34            domain_id: value.domain_id.clone(),
35            enabled: value.enabled,
36            id: value.id.clone(),
37            name: value.name.clone(),
38        }
39    }
40}
41
42impl From<provider_types::Project> for Project {
43    fn from(value: provider_types::Project) -> Self {
44        Self {
45            description: value.description,
46            domain_id: value.domain_id,
47            enabled: value.enabled,
48            extra: value.extra,
49            id: value.id,
50            is_domain: value.is_domain,
51            name: value.name,
52            parent_id: value.parent_id,
53        }
54    }
55}
56
57impl From<ProjectCreate> for provider_types::ProjectCreate {
58    fn from(value: ProjectCreate) -> Self {
59        Self {
60            description: value.description,
61            domain_id: value.domain_id,
62            enabled: value.enabled,
63            extra: value.extra,
64            id: None,
65            is_domain: value.is_domain,
66            name: value.name,
67            parent_id: value.parent_id,
68        }
69    }
70}