-
Notifications
You must be signed in to change notification settings - Fork 12
refactor(spider-core)!: Unify external resource group credentials (fixes #468). #469
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
sitaowang1998
wants to merge
6
commits into
y-scope:main
Choose a base branch
from
sitaowang1998:unify-em-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 2 commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
157a106
Use external rg credential for add resource group proto
sitaowang1998 4ad532c
Consilidate external rg credential into core
sitaowang1998 7754046
Reexport external resource group credential
sitaowang1998 8405a1e
Use secrecy for password
sitaowang1998 f805c46
Add from_env for resource group credentials
sitaowang1998 2a45463
Merge branch 'main' into unify-em-credential
sitaowang1998 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 |
|---|---|---|
| @@ -1,3 +1,4 @@ | ||
| pub mod id; | ||
| pub mod io; | ||
| pub mod resource_group; | ||
| pub mod scheduler; |
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,11 @@ | ||
| //! Resource group types shared across Spider components. | ||
|
|
||
| /// Credentials identifying and authenticating an external resource group. | ||
| #[derive(Debug, Clone, PartialEq, Eq)] | ||
| pub struct ExternalResourceGroupCredentials { | ||
| /// The external resource group ID. | ||
| pub external_resource_group_id: String, | ||
|
|
||
| /// The resource group password. | ||
| pub password: Vec<u8>, | ||
| } |
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,48 @@ | ||
| //! Conversions between protobuf and Spider core resource group types. | ||
|
|
||
| use spider_core::types::resource_group::ExternalResourceGroupCredentials; | ||
|
|
||
| use crate::storage; | ||
|
|
||
| impl From<ExternalResourceGroupCredentials> for storage::ExternalResourceGroupCredentials { | ||
| fn from(credentials: ExternalResourceGroupCredentials) -> Self { | ||
| Self { | ||
| external_resource_group_id: credentials.external_resource_group_id, | ||
| password: credentials.password, | ||
| } | ||
| } | ||
| } | ||
|
|
||
| impl From<storage::ExternalResourceGroupCredentials> for ExternalResourceGroupCredentials { | ||
| fn from(credentials: storage::ExternalResourceGroupCredentials) -> Self { | ||
| Self { | ||
| external_resource_group_id: credentials.external_resource_group_id, | ||
| password: credentials.password, | ||
| } | ||
| } | ||
| } | ||
|
|
||
| #[cfg(test)] | ||
| mod tests { | ||
| use prost::Message; | ||
| use spider_core::types::resource_group::ExternalResourceGroupCredentials; | ||
|
|
||
| use crate::storage; | ||
|
|
||
| #[test] | ||
| fn test_external_resource_group_credentials_protocol_round_trip() { | ||
| let credentials = ExternalResourceGroupCredentials { | ||
| external_resource_group_id: "external-resource-group".to_owned(), | ||
| password: vec![0, 1, 2, 255], | ||
| }; | ||
|
|
||
| let encoded = | ||
| storage::ExternalResourceGroupCredentials::from(credentials.clone()).encode_to_vec(); | ||
| let decoded = ExternalResourceGroupCredentials::from( | ||
| storage::ExternalResourceGroupCredentials::decode(encoded.as_slice()) | ||
| .expect("external resource group credentials should decode"), | ||
| ); | ||
|
|
||
| assert_eq!(decoded, credentials); | ||
| } | ||
| } |
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
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
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
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.
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.