-
Notifications
You must be signed in to change notification settings - Fork 9
Feature/expose app credential #948
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
konac-hamza
wants to merge
10
commits into
openstack-experimental:main
Choose a base branch
from
konac-hamza:feature/expose-app-credential
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
10 commits
Select commit
Hold shift + click to select a range
fe0a815
feat: Add api types of App Cred
konac-hamza a38db8e
feat: Complete api layer implementtaions
konac-hamza 17ff978
feat: Implement app cred APIs
konac-hamza 8cf5b35
fix: Fix the unit test
konac-hamza 1ff948a
fix: Fix the issues
konac-hamza 30c2934
fix: Update backend tests
konac-hamza b6b2297
fix: Remove id from AppCredentialCreate
konac-hamza 8eacf25
fix: Fix mismatch policy enforcer calling
konac-hamza 33b1c81
fix: Add secret into ApplicationCredentialCreate
konac-hamza ebf048b
fix: Fix small nits
konac-hamza File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,16 @@ | ||
| // Licensed under the Apache License, Version 2.0 (the "License"); | ||
| // you may not use this file except in compliance with the License. | ||
| // You may obtain a copy of the License at | ||
| // | ||
| // http://www.apache.org/licenses/LICENSE-2.0 | ||
| // | ||
| // Unless required by applicable law or agreed to in writing, software | ||
| // distributed under the License is distributed on an "AS IS" BASIS, | ||
| // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
| // See the License for the specific language governing permissions and | ||
| // limitations under the License. | ||
| // | ||
| // SPDX-License-Identifier: Apache-2.0 | ||
|
|
||
| pub mod access_rule; | ||
| pub mod application_credential; | ||
114 changes: 114 additions & 0 deletions
114
crates/api-types/src/v3/application_credential/access_rule.rs
|
gtema marked this conversation as resolved.
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,114 @@ | ||
| // Licensed under the Apache License, Version 2.0 (the "License"); | ||
| // you may not use this file except in compliance with the License. | ||
| // You may obtain a copy of the License at | ||
| // | ||
| // http://www.apache.org/licenses/LICENSE-2.0 | ||
| // | ||
| // Unless required by applicable law or agreed to in writing, software | ||
| // distributed under the License is distributed on an "AS IS" BASIS, | ||
| // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
| // See the License for the specific language governing permissions and | ||
| // limitations under the License. | ||
| // | ||
| // SPDX-License-Identifier: Apache-2.0 | ||
|
|
||
| use serde::{Deserialize, Serialize}; | ||
| /// Short access rule representation. | ||
| /// | ||
| /// Access rules are fine-grained permissions attached to application | ||
| /// credentials. Each rule constrains the credential to a specific service | ||
| /// type, HTTP method, and API path. Once created, an access rule can be | ||
| /// viewed and deleted independently of the application credential. | ||
| #[derive(Clone, Debug, Deserialize, PartialEq, Serialize)] | ||
| #[cfg_attr( | ||
| feature = "builder", | ||
| derive(derive_builder::Builder), | ||
| builder( | ||
| build_fn(error = "crate::error::BuilderError"), | ||
| setter(strip_option, into) | ||
| ) | ||
| )] | ||
| #[cfg_attr(feature = "openapi", derive(utoipa::ToSchema))] | ||
| #[cfg_attr(feature = "validate", derive(validator::Validate))] | ||
| pub struct AccessRule { | ||
| /// Unique identifier of the access rule. This ID can be used to reuse an | ||
| /// existing access rule when creating a new application credential. | ||
| #[cfg_attr(feature = "validate", validate(length(min = 1, max = 64)))] | ||
| pub id: String, | ||
|
|
||
| /// HTTP method that this access rule permits (e.g., `GET`, `POST`, `PUT`, | ||
| /// `DELETE`, `PATCH`). | ||
| #[cfg_attr(feature = "builder", builder(default))] | ||
| #[serde(skip_serializing_if = "Option::is_none")] | ||
| #[cfg_attr(feature = "validate", validate(length(min = 1, max = 16)))] | ||
| pub method: Option<String>, | ||
|
|
||
| /// API path pattern that this access rule permits. Supports wildcard | ||
| /// syntax: `*` matches a single path segment, `**` matches any number | ||
| /// of segments recursively, and `{variable}` matches a named path | ||
| /// parameter. For example, `/v2.1/servers/*/ips` or `/v2.1/**`. | ||
| #[cfg_attr(feature = "builder", builder(default))] | ||
| #[serde(skip_serializing_if = "Option::is_none")] | ||
| #[cfg_attr(feature = "validate", validate(length(min = 1, max = 128)))] | ||
| pub path: Option<String>, | ||
|
|
||
| /// OpenStack service type that this access rule applies to | ||
| /// (e.g., `compute`, `monitoring`, `identity`). Matched against the | ||
| /// service catalog. | ||
| #[cfg_attr(feature = "builder", builder(default))] | ||
| #[serde(skip_serializing_if = "Option::is_none")] | ||
| #[cfg_attr(feature = "validate", validate(length(min = 1, max = 64)))] | ||
| pub service: Option<String>, | ||
| } | ||
|
|
||
| /// Access rule for creation (id is optional). | ||
| /// | ||
| /// When creating an application credential, access rules can either be | ||
| /// defined inline (with `method`, `path`, and `service`) or reference an | ||
| /// existing rule by its `id`. All fields are optional so that both creation | ||
| /// patterns are supported. | ||
| #[derive(Clone, Debug, Deserialize, PartialEq, Serialize)] | ||
| #[cfg_attr( | ||
| feature = "builder", | ||
| derive(derive_builder::Builder), | ||
| builder( | ||
| build_fn(error = "crate::error::BuilderError"), | ||
| setter(strip_option, into) | ||
| ) | ||
| )] | ||
| #[cfg_attr(feature = "openapi", derive(utoipa::ToSchema))] | ||
| #[cfg_attr(feature = "validate", derive(validator::Validate))] | ||
| pub struct AccessRuleCreate { | ||
| /// Optional identifier of an existing access rule to reuse. When | ||
| /// provided, the other fields (`method`, `path`, `service`) are ignored | ||
| /// and the referenced rule is attached to the new application credential. | ||
| #[cfg_attr(feature = "builder", builder(default))] | ||
| #[serde(skip_serializing_if = "Option::is_none")] | ||
| #[cfg_attr(feature = "validate", validate(length(min = 1, max = 64)))] | ||
| pub id: Option<String>, | ||
|
|
||
| /// HTTP method that this access rule permits (e.g., `GET`, `POST`, `PUT`, | ||
| /// `DELETE`, `PATCH`). Required when creating a new rule inline (i.e., | ||
| /// without specifying `id`). | ||
| #[cfg_attr(feature = "builder", builder(default))] | ||
| #[serde(skip_serializing_if = "Option::is_none")] | ||
| #[cfg_attr(feature = "validate", validate(length(min = 1, max = 16)))] | ||
| pub method: Option<String>, | ||
|
|
||
| /// API path pattern that this access rule permits. Supports wildcard | ||
| /// syntax: `*` matches a single path segment, `**` matches any number | ||
| /// of segments recursively, and `{variable}` matches a named path | ||
| /// parameter. Required when creating a new rule inline. | ||
| #[cfg_attr(feature = "builder", builder(default))] | ||
| #[serde(skip_serializing_if = "Option::is_none")] | ||
| #[cfg_attr(feature = "validate", validate(length(min = 1, max = 128)))] | ||
| pub path: Option<String>, | ||
|
|
||
| /// OpenStack service type that this access rule applies to | ||
| /// (e.g., `compute`, `monitoring`, `identity`). Matched against the | ||
| /// service catalog. Required when creating a new rule inline. | ||
| #[cfg_attr(feature = "builder", builder(default))] | ||
| #[serde(skip_serializing_if = "Option::is_none")] | ||
| #[cfg_attr(feature = "validate", validate(length(min = 1, max = 64)))] | ||
| pub service: Option<String>, | ||
| } |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.