-
Notifications
You must be signed in to change notification settings - Fork 0
Action Routes #288
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
Merged
Merged
Action Routes #288
Changes from all commits
Commits
Show all changes
21 commits
Select commit
Hold shift + click to select a range
b95e934
feat: added action configuration implementation
raphael-goetz eb51245
feat: wip action configuration service server
raphael-goetz a5ebafa
dependencies: updated to tucana 0.0.53
raphael-goetz 2ed3d94
feat: finished action configuration server implementation
raphael-goetz d34cff9
dependencies: added futures-core
raphael-goetz 1f0e45d
feat: started to work on action transfer server
raphael-goetz 0d861a7
drop: removed body validation part
raphael-goetz a384652
fix: made has_action function not consume itself
raphael-goetz 8f9cab3
fix: added missing project_id to flow identifier
raphael-goetz 0ba5d3c
feat: added wip action configuration
raphael-goetz 52eed39
feat: added project id to execution flow
raphael-goetz 0f519b4
feat: connected flow with action stream to transfer action configs
raphael-goetz f183855
feat: completed action endpoint
raphael-goetz 2414769
drop: removed unused stream logic
raphael-goetz 00679e1
feat: correct params for aquila server
raphael-goetz 16773b8
ref: cargo clippy & fmt
raphael-goetz 8e37624
feat: added example action config
raphael-goetz 79c989a
fix: correct reqeust/reply logic
raphael-goetz eebf840
Update src/server/action_transfer_service_server_impl.rs
raphael-goetz cef07dc
Update src/server/action_transfer_service_server_impl.rs
raphael-goetz cc60592
Update src/flow/mod.rs
raphael-goetz 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
Large diffs are not rendered by default.
Oops, something went wrong.
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,8 @@ | ||
| { | ||
| "actions": [ | ||
| { | ||
| "token": "token", | ||
| "service_name": "example" | ||
| } | ||
| ] | ||
| } | ||
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 |
|---|---|---|
| @@ -1,3 +1,3 @@ | ||
| pub mod action; | ||
| pub mod state; | ||
| pub mod config; | ||
| pub mod state; |
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 |
|---|---|---|
| @@ -1,7 +1,10 @@ | ||
| use tucana::shared::ValidationFlow; | ||
|
|
||
| /// Every flow identifier has this key | ||
| /// <type>.<project_slug>.<flow_id> | ||
| /// <type>.<project_slug>.<project_id>.<flow_id> | ||
| pub fn get_flow_identifier(flow: &ValidationFlow) -> String { | ||
| format!("{}.{}.{}", flow.r#type, flow.project_slug, flow.flow_id) | ||
| format!( | ||
| "{}.{}.{}.{}", | ||
| flow.r#type, flow.project_slug, flow.project_id, flow.flow_id | ||
| ) | ||
| } |
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
53 changes: 53 additions & 0 deletions
53
src/sagittarius/action_configuration_service_client_impl.rs
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,53 @@ | ||
| use crate::authorization::authorization::get_authorization_metadata; | ||
| use tonic::transport::Channel; | ||
| use tonic::{Extensions, Request}; | ||
| use tucana::shared::ActionConfigurationDefinition; | ||
|
|
||
| pub struct SagittariusActionConfigurationServiceClient { | ||
| client: | ||
| tucana::sagittarius::action_configuration_service_client::ActionConfigurationServiceClient< | ||
| Channel, | ||
| >, | ||
| token: String, | ||
| } | ||
|
|
||
| impl SagittariusActionConfigurationServiceClient { | ||
| pub fn new(channel: Channel, token: String) -> Self { | ||
| let client = tucana::sagittarius::action_configuration_service_client::ActionConfigurationServiceClient::new(channel); | ||
|
|
||
| Self { client, token } | ||
| } | ||
|
|
||
| pub async fn update_action_configuration( | ||
| &mut self, | ||
| action_identifier: String, | ||
| configs: Vec<ActionConfigurationDefinition>, | ||
| ) -> bool { | ||
| let request = Request::from_parts( | ||
| get_authorization_metadata(&self.token), | ||
| Extensions::new(), | ||
| tucana::sagittarius::ActionConfigurationUpdateRequest { | ||
| action_identifier: action_identifier, | ||
| action_configurations: configs, | ||
| }, | ||
| ); | ||
|
|
||
| let response = match self.client.update(request).await { | ||
| Ok(response) => { | ||
| log::info!("Successfully transferred action configuration update.",); | ||
| response.into_inner() | ||
| } | ||
| Err(err) => { | ||
| log::error!("Failed to update action configurations: {:?}", err); | ||
| return true; | ||
|
raphael-goetz marked this conversation as resolved.
|
||
| } | ||
| }; | ||
|
|
||
| match response.success { | ||
| true => log::info!("Sagittarius successfully updated ActionConfiguration."), | ||
| false => log::error!("Sagittarius didn't update any ActionConfiguration."), | ||
| }; | ||
|
|
||
| response.success | ||
| } | ||
| } | ||
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
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.