From 23fa39749356ad5ad41a159bbb2a8f5fc76a50ca Mon Sep 17 00:00:00 2001 From: Ashish Kolhe <35160958+oasisk@users.noreply.github.com> Date: Mon, 24 Apr 2023 17:33:38 +0530 Subject: [PATCH] fix: shorten api names (#622) * fix: shorten api names * build fixes --- .../http/request/alerts/destinations.rs | 8 +++---- src/handler/http/request/alerts/mod.rs | 10 ++++---- src/handler/http/request/alerts/templates.rs | 8 +++---- src/handler/http/request/dashboards/mod.rs | 10 ++++---- src/handler/http/request/kv/mod.rs | 8 +++---- src/handler/http/request/logs/ingest.rs | 24 ++++++++++++++++--- src/handler/http/request/organization/mod.rs | 8 +++---- src/handler/http/request/stream/mod.rs | 8 +++---- src/handler/http/request/traces/mod.rs | 2 +- src/handler/http/request/users/mod.rs | 12 +++++----- src/handler/http/router/openapi.rs | 4 ++++ 11 files changed, 62 insertions(+), 40 deletions(-) diff --git a/src/handler/http/request/alerts/destinations.rs b/src/handler/http/request/alerts/destinations.rs index a3efe5f5f9..2dd3528737 100644 --- a/src/handler/http/request/alerts/destinations.rs +++ b/src/handler/http/request/alerts/destinations.rs @@ -19,7 +19,7 @@ use crate::meta::http::HttpResponse as MetaHttpResponse; use crate::service::db; use crate::{meta::alert::AlertDestination, service::alerts::destinations}; -/** Create new alert destination */ +/** createDestination */ #[utoipa::path( context_path = "/api", tag = "Alerts", @@ -60,7 +60,7 @@ pub async fn save_destination( } } -/** List all destinations */ +/** listDestinations */ #[utoipa::path( context_path = "/api", tag = "Alerts", @@ -81,7 +81,7 @@ async fn list_destinations(path: web::Path) -> impl Responder { destinations::list_destinations(org_id).await } -/** Get alert destination by name */ +/** getDestination */ #[utoipa::path( context_path = "/api", tag = "Alerts", @@ -104,7 +104,7 @@ async fn get_destination(path: web::Path<(String, String)>) -> impl Responder { destinations::get_destination(org_id, name).await } -/** Delete alert destination by name */ +/** deleteDestination */ #[utoipa::path( context_path = "/api", tag = "Alerts", diff --git a/src/handler/http/request/alerts/mod.rs b/src/handler/http/request/alerts/mod.rs index 1424a59448..de6e169f26 100644 --- a/src/handler/http/request/alerts/mod.rs +++ b/src/handler/http/request/alerts/mod.rs @@ -23,7 +23,7 @@ use crate::{ service::alerts, }; -/** Create new alert for a stream */ +/** createAlert */ #[utoipa::path( context_path = "/api", tag = "Alerts", @@ -73,7 +73,7 @@ pub async fn save_alert( ) .await } -/** List all alerts of a stream */ +/** listStreamAlerts */ #[utoipa::path( context_path = "/api", tag = "Alerts", @@ -110,7 +110,7 @@ async fn list_stream_alerts(path: web::Path<(String, String)>, req: HttpRequest) alerts::list_alert(org_id, Some(stream_name.as_str()), stream_type).await } -/** List all alerts of an organization */ +/** listAlerts */ #[utoipa::path( context_path = "/api", tag = "Alerts", @@ -146,7 +146,7 @@ async fn list_alerts(path: web::Path, req: HttpRequest) -> impl Responde alerts::list_alert(org_id, None, stream_type).await } -/** Get alert by alert name */ +/** getAlertByName */ #[utoipa::path( context_path = "/api", tag = "Alerts", @@ -185,7 +185,7 @@ async fn get_alert(path: web::Path<(String, String, String)>, req: HttpRequest) alerts::get_alert(org_id, stream_name, stream_type.unwrap(), name).await } -/** Delete alert by alert name */ +/** deleteAlert */ #[utoipa::path( context_path = "/api", tag = "Alerts", diff --git a/src/handler/http/request/alerts/templates.rs b/src/handler/http/request/alerts/templates.rs index 33b636c50e..7128da5ef6 100644 --- a/src/handler/http/request/alerts/templates.rs +++ b/src/handler/http/request/alerts/templates.rs @@ -17,7 +17,7 @@ use std::io::Error; use crate::{meta::alert::DestinationTemplate, service::alerts::templates}; -/** Create new alert template */ +/** createTemplate */ #[utoipa::path( context_path = "/api", tag = "Alerts", @@ -43,7 +43,7 @@ pub async fn save_template( templates::save_template(org_id, name, alert.into_inner()).await } -/** List all templates for an organization */ +/** listTemplates */ #[utoipa::path( context_path = "/api", tag = "Alerts", @@ -64,7 +64,7 @@ async fn list_templates(path: web::Path) -> impl Responder { templates::list_templates(org_id).await } -/** Get alert template by name */ +/** getTemplateByName */ #[utoipa::path( context_path = "/api", tag = "Alerts", @@ -87,7 +87,7 @@ async fn get_template(path: web::Path<(String, String)>) -> impl Responder { templates::get_template(org_id, name).await } -/** Delete alert template by alert name */ +/** deleteTemplate */ #[utoipa::path( context_path = "/api", tag = "Alerts", diff --git a/src/handler/http/request/dashboards/mod.rs b/src/handler/http/request/dashboards/mod.rs index 7135e841b8..9239d70d37 100644 --- a/src/handler/http/request/dashboards/mod.rs +++ b/src/handler/http/request/dashboards/mod.rs @@ -17,7 +17,7 @@ use std::io::Error; use crate::{meta::dashboards::Dashboard, service::dashboards}; -/// Create a dashboard +/** createDashboard */ #[utoipa::path( context_path = "/api", tag = "Dashboards", @@ -50,7 +50,7 @@ pub async fn create_dashboard( dashboards::create_dashboard(&org_id, details.into_inner()).await } -/// Update a dashboard +/// updateDashboard #[utoipa::path( context_path = "/api", tag = "Dashboards", @@ -81,7 +81,7 @@ async fn update_dashboard( dashboards::update_dashboard(&org_id, &dashboard_id, &details.into_inner()).await } -/// List dashboards +/// listDashboards #[utoipa::path( context_path = "/api", tag = "Dashboards", @@ -101,7 +101,7 @@ async fn list_dashboards(org_id: web::Path) -> impl Responder { dashboards::list_dashboards(&org_id.into_inner()).await } -/// Get a dashboard +/// getDashboard #[utoipa::path( context_path = "/api", tag = "Dashboards", @@ -125,7 +125,7 @@ async fn get_dashboard(path: web::Path<(String, String)>) -> impl Responder { dashboards::get_dashboard(&org_id, &dashboard_id).await } -/// Delete a dashboard +/// deleteDashboard #[utoipa::path( context_path = "/api", tag = "Dashboards", diff --git a/src/handler/http/request/kv/mod.rs b/src/handler/http/request/kv/mod.rs index 914c216ff8..08b75c50d9 100644 --- a/src/handler/http/request/kv/mod.rs +++ b/src/handler/http/request/kv/mod.rs @@ -19,7 +19,7 @@ use std::io::Error; use crate::service::kv; -/** Get KV value */ +/** getValue */ #[utoipa::path( context_path = "/api", tag = "KV", @@ -49,7 +49,7 @@ pub async fn get(path: web::Path<(String, String)>) -> Result) -> Result, diff --git a/src/handler/http/request/organization/mod.rs b/src/handler/http/request/organization/mod.rs index d83fc639ab..0db3586f4d 100644 --- a/src/handler/http/request/organization/mod.rs +++ b/src/handler/http/request/organization/mod.rs @@ -27,7 +27,7 @@ use crate::service::organization::{self, update_passcode}; pub mod es; -/** Get user organizations */ +/** getOrganizations */ #[utoipa::path( context_path = "/api", tag = "Organizations", @@ -101,7 +101,7 @@ pub async fn organizations(credentials: BasicAuth) -> Result) -> Result { Ok(HttpResponse::Ok().json(org_summary)) } -/** Get ingest token for current user */ +/** getIngestToken */ #[utoipa::path( context_path = "/api", tag = "Organizations", @@ -153,7 +153,7 @@ async fn get_user_passcode( Ok(HttpResponse::Ok().json(PasscodeResponse { data: passcode })) } -/** Update ingest token for current user */ +/** updateIngestToken */ #[utoipa::path( context_path = "/api", tag = "Organizations", diff --git a/src/handler/http/request/stream/mod.rs b/src/handler/http/request/stream/mod.rs index 60a343c982..7ba90cefc8 100644 --- a/src/handler/http/request/stream/mod.rs +++ b/src/handler/http/request/stream/mod.rs @@ -21,7 +21,7 @@ use crate::common::http::get_stream_type_from_request; use crate::meta::{self, stream::StreamSettings, StreamType}; use crate::service::stream; -/** Get schema of stream by stream name */ +/** getSchema */ #[utoipa::path( context_path = "/api", tag = "Streams", @@ -60,7 +60,7 @@ async fn schema( stream::get_stream(&org_id, &stream_name, stream_type).await } -/** Update stream settings */ +/** updateStreamSettings */ #[utoipa::path( context_path = "/api", tag = "Streams", @@ -101,7 +101,7 @@ async fn settings( stream::save_stream_settings(&org_id, &stream_name, stream_type, settings.into_inner()).await } -/** Delete stream by stream name */ +/** deleteStream */ #[utoipa::path( context_path = "/api", tag = "Streams", @@ -140,7 +140,7 @@ async fn delete( stream::delete_stream(&org_id, &stream_name, stream_type).await } -/** List all streams of an organization */ +/** listStreams */ #[utoipa::path( context_path = "/api", tag = "Streams", diff --git a/src/handler/http/request/traces/mod.rs b/src/handler/http/request/traces/mod.rs index f239197e01..6718d949f4 100644 --- a/src/handler/http/request/traces/mod.rs +++ b/src/handler/http/request/traces/mod.rs @@ -20,7 +20,7 @@ use crate::{meta, service::traces::otlp_http}; pub const CONTENT_TYPE_JSON: &str = "application/json"; pub const CONTENT_TYPE_PROTO: &str = "application/x-protobuf"; -/** ingestion endpoint for traces */ +/** ingest traces */ #[utoipa::path( context_path = "/api", tag = "Traces", diff --git a/src/handler/http/request/users/mod.rs b/src/handler/http/request/users/mod.rs index aa6b6d418e..b5c075233f 100644 --- a/src/handler/http/request/users/mod.rs +++ b/src/handler/http/request/users/mod.rs @@ -23,7 +23,7 @@ use crate::meta::user::UserRequest; use crate::meta::user::{SignInResponse, SignInUser}; use crate::service::users; -/** List all users of an organization */ +/** listUsers */ #[utoipa::path( context_path = "/api", tag = "Users", @@ -44,7 +44,7 @@ pub async fn list(org_id: web::Path) -> Result { users::list_users(&org_id).await } -/** Create new user for an organization */ +/** createUser */ #[utoipa::path( context_path = "/api", tag = "Users", @@ -70,7 +70,7 @@ pub async fn save( users::post_user(&org_id, user).await } -/** Update existing user */ +/** updateUser */ #[utoipa::path( context_path = "/api", tag = "Users", @@ -108,7 +108,7 @@ pub async fn update( users::update_user(&org_id, &email_id, self_update, initiator_id, user).await } -/** Add existing user to an organization */ +/** addUserToOrganization */ #[utoipa::path( context_path = "/api", tag = "Users", @@ -137,7 +137,7 @@ pub async fn add_user_to_org( users::add_user_to_org(&org_id, &email_id, role, initiator_id).await } -/** Remove a user from an organization */ +/** removeUserFromOrganization */ #[utoipa::path( context_path = "/api", tag = "Users", @@ -160,7 +160,7 @@ pub async fn delete(path: web::Path<(String, String)>) -> Result