manta_server/server/handlers/
analysis.rs

1//! Cross-resource analyses:
2//! - GET /api/v1/analysis/images — image-centric link graph.
3
4use axum::{Json, http::StatusCode, response::IntoResponse};
5
6use super::{ErrorResponse, RequestCtx, SiteHeader, to_handler_error};
7use crate::service;
8use manta_shared::types::api::analysis::BackendSummary;
9
10/// GET /analysis/images — image-centric flat projection of every CFS
11/// configuration, CFS session, BOS session template, and IMS image
12/// visible to the caller. One row per IMS image; see
13/// [`BackendSummary`] for column semantics.
14#[utoipa::path(get, path = "/analysis/images", tag = "analysis",
15  params(SiteHeader),
16  security(("bearerAuth" = [])),
17  responses(
18    (status = 200, description = "Image-analysis rows",   body = Vec<BackendSummary>),
19    (status = 401, description = "Unauthorized",          body = ErrorResponse),
20    (status = 500, description = "Internal error",        body = ErrorResponse),
21  )
22)]
23#[tracing::instrument(skip_all)]
24pub async fn get_image_analysis(
25  ctx: RequestCtx,
26) -> Result<impl IntoResponse, (StatusCode, Json<ErrorResponse>)> {
27  let infra = ctx.infra();
28  let rows = service::analysis::get_image_analysis(&infra, &ctx.token)
29    .await
30    .map_err(to_handler_error)?;
31  Ok((StatusCode::OK, Json(rows)))
32}