-
Notifications
You must be signed in to change notification settings - Fork 26
feat(meroctl): support alias listing #1276
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
miraclx
merged 21 commits into
calimero-network:master
from
cy4n1d3-p1x3l:meroctl-list-alias
Jun 10, 2025
Merged
Changes from 17 commits
Commits
Show all changes
21 commits
Select commit
Hold shift + click to select a range
eb355fd
init
cy4n1d3-p1x3l ffa4ba5
Merge branch 'calimero-network:master' into meroctl-list-alias
cy4n1d3-p1x3l b1502ee
api added to server
cy4n1d3-p1x3l 219f993
Merge remote-tracking branch 'upstream/master' into meroctl-list-alias
cy4n1d3-p1x3l e1b00cf
fixes
cy4n1d3-p1x3l a74ab12
Merge branch 'master' into meroctl-list-alias
cy4n1d3-p1x3l 8cf8328
long arg
cy4n1d3-p1x3l 585f92e
minor fix
cy4n1d3-p1x3l 4f46604
Merge branch 'master' into meroctl-list-alias
cy4n1d3-p1x3l 26383d3
fixes
cy4n1d3-p1x3l e886f27
Merge branch 'meroctl-list-alias' of https://github.com/cy4n1d3-p1x3l…
cy4n1d3-p1x3l a36edd7
ctx issue
cy4n1d3-p1x3l 3ff016a
merod error fix
cy4n1d3-p1x3l 40f5e59
minor changes
cy4n1d3-p1x3l 5342824
Merge branch 'master' into meroctl-list-alias
cy4n1d3-p1x3l 428fc26
Merge branch 'meroctl-list-alias' of https://github.com/cy4n1d3-p1x3l…
cy4n1d3-p1x3l 429e15a
improve
cy4n1d3-p1x3l 9b36fb6
fixes
cy4n1d3-p1x3l 69750d0
Merge branch 'master' into meroctl-list-alias
miraclx 2ac0dc2
context alias ls and other changes
miraclx 45f7829
fix scoped url & mitigate weird Option<Path<T>> behaviour
miraclx 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
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,37 @@ | ||
use std::sync::Arc; | ||
|
||
use axum::extract::Path; | ||
use axum::response::IntoResponse; | ||
use axum::Extension; | ||
use calimero_server_primitives::admin::{AliasRecord, ListAliasesResponse}; | ||
use calimero_store::key::{Aliasable, StoreScopeCompat}; | ||
use serde::{Deserialize, Serialize}; | ||
|
||
use crate::admin::service::{parse_api_error, ApiResponse}; | ||
use crate::AdminState; | ||
|
||
pub async fn handler<T>( | ||
Extension(state): Extension<Arc<AdminState>>, | ||
maybe_scope: Option<Path<T::Scope>>, | ||
) -> impl IntoResponse | ||
where | ||
T: Aliasable + Serialize + Clone + From<[u8; 32]>, | ||
T::Scope: Copy + PartialEq + StoreScopeCompat, | ||
{ | ||
let scope = maybe_scope.map(|Path(s)| s); | ||
|
||
let aliases_raw = match state.node_client.list_aliases::<T>(scope) { | ||
Ok(a) => a, | ||
Err(err) => return parse_api_error(err).into_response(), | ||
}; | ||
|
||
let aliases: Vec<AliasRecord<T>> = aliases_raw | ||
.into_iter() | ||
.map(|(alias, value, _scope)| AliasRecord { alias, value }) | ||
.collect(); | ||
|
||
ApiResponse { | ||
payload: ListAliasesResponse::new(aliases), | ||
} | ||
.into_response() | ||
} |
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.