Skip to main content

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 multipart;
14mod objects;
15
16/// Returns `true` for internal endpoints that are exempt from metrics and concurrency limits.
17pub fn is_internal_route(route: &str) -> bool {
18    matches!(route, "/health" | "/ready" | "/keda")
19}
20
21/// Returns a router with all objectstore HTTP endpoints mounted.
22///
23/// Mounts health and KEDA endpoints at the root and all object/batch
24/// endpoints under `/v1/`.
25pub fn routes() -> Router<ServiceState> {
26    let routes_v1 = Router::new()
27        .merge(objects::router())
28        .merge(batch::router())
29        .merge(multipart::router());
30
31    Router::new()
32        .merge(health::router())
33        .merge(keda::router())
34        .nest("/v1/", routes_v1)
35}