manta_server/server/handlers/
cluster.rs1use axum::{Json, extract::Query, http::StatusCode, response::IntoResponse};
9
10use super::{ErrorResponse, RequestCtx, SiteHeader, to_handler_error};
11use crate::service;
12
13pub use manta_shared::types::api::queries::ClusterQuery;
18
19#[utoipa::path(get, path = "/groups/nodes", tag = "groups",
21 params(ClusterQuery, SiteHeader),
22 security(("bearerAuth" = [])),
23 responses(
24 (status = 200, description = "List of group nodes", body = Vec<manta_shared::types::dto::NodeDetails>),
25 (status = 401, description = "Unauthorized", body = ErrorResponse),
26 (status = 500, description = "Internal error", body = ErrorResponse),
27 )
28)]
29#[tracing::instrument(skip_all)]
30pub async fn get_groups_nodes(
31 ctx: RequestCtx,
32 Query(q): Query<ClusterQuery>,
33) -> Result<impl IntoResponse, (StatusCode, Json<ErrorResponse>)> {
34 let infra = ctx.infra();
35
36 let params = service::cluster::GetClusterParams {
37 group_name: q.hsm_group,
38 settings_group_name: None,
39 status_filter: q.status,
40 };
41
42 let nodes = service::cluster::get_cluster_nodes(&infra, &ctx.token, ¶ms)
43 .await
44 .map_err(to_handler_error)?;
45
46 Ok(Json(nodes))
47}
48
49#[utoipa::path(get, path = "/clusters", tag = "clusters",
53 params(ClusterQuery, SiteHeader),
54 security(("bearerAuth" = [])),
55 responses(
56 (status = 200, description = "[DEPRECATED] use /groups/nodes — list of group nodes", body = Vec<manta_shared::types::dto::NodeDetails>),
57 (status = 401, description = "Unauthorized", body = ErrorResponse),
58 (status = 500, description = "Internal error", body = ErrorResponse),
59 )
60)]
61#[tracing::instrument(skip_all)]
62pub async fn get_clusters_deprecated(
63 ctx: RequestCtx,
64 q: Query<ClusterQuery>,
65) -> Result<impl IntoResponse, (StatusCode, Json<ErrorResponse>)> {
66 tracing::warn!(
67 "deprecated endpoint: GET /clusters — use /groups/nodes instead"
68 );
69 get_groups_nodes(ctx, q).await
70}