objectstore_server/endpoints/
mod.rs

1//! Contains all HTTP endpoint handlers.
2//!
3//! Use [`routes`] to create a router with all endpoints.
4
5use axum::Router;
6
7use crate::state::ServiceState;
8
9mod batch;
10pub mod common;
11pub mod health;
12mod keda;
13mod objects;
14
15/// Returns `true` for internal endpoints that are exempt from metrics and concurrency limits.
16pub fn is_internal_route(route: &str) -> bool {
17    matches!(route, "/health" | "/ready" | "/keda")
18}
19
20/// Returns a router with all objectstore HTTP endpoints mounted.
21///
22/// Mounts health and KEDA endpoints at the root and all object/batch
23/// endpoints under `/v1/`.
24pub fn routes() -> Router<ServiceState> {
25    let routes_v1 = Router::new()
26        .merge(objects::router())
27        .merge(batch::router());
28
29    Router::new()
30        .merge(health::router())
31        .merge(keda::router())
32        .nest("/v1/", routes_v1)
33}