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