fix: shorten api names (#622)

* fix: shorten api names

* build fixes
This commit is contained in:
Ashish Kolhe
2023-04-24 17:33:38 +05:30
committed by GitHub
parent 1020e09a07
commit 23fa397493
11 changed files with 62 additions and 40 deletions
@@ -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<String>) -> 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",
+5 -5
View File
@@ -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<String>, 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",
+4 -4
View File
@@ -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<String>) -> 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",
+5 -5
View File
@@ -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<String>) -> 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",
+4 -4
View File
@@ -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<HttpResponse, Erro
}
}
/** Set KV value */
/** setValue */
#[utoipa::path(
context_path = "/api",
tag = "KV",
@@ -86,7 +86,7 @@ pub async fn set(
}
}
/** Remove a KV value */
/** removeValue */
#[utoipa::path(
context_path = "/api",
tag = "KV",
@@ -116,7 +116,7 @@ pub async fn delete(path: web::Path<(String, String)>) -> Result<HttpResponse, E
}
}
/** list KV keys with prefix */
/** listKeys */
#[utoipa::path(
context_path = "/api",
tag = "KV",
+21 -3
View File
@@ -17,7 +17,7 @@ use std::io::Error;
use crate::{meta::ingestion::KinesisFHRequest, service::logs};
/** ES compatible _bulk ingestion API */
/** _bulk ES compatible ingestion API */
#[utoipa::path(
context_path = "/api",
tag = "Logs",
@@ -44,7 +44,7 @@ pub async fn bulk(
logs::bulk::ingest(&org_id, body, thread_id).await
}
/** ndjson multi ingestion API */
/** _multi ingestion API */
#[utoipa::path(
context_path = "/api",
tag = "Logs",
@@ -72,7 +72,7 @@ pub async fn multi(
logs::multi::ingest(&org_id, &stream_name, body, thread_id).await
}
/** json ingestion API */
/** _json ingestion API */
#[utoipa::path(
context_path = "/api",
tag = "Logs",
@@ -100,6 +100,24 @@ pub async fn json(
logs::json::ingest(&org_id, &stream_name, body, thread_id).await
}
/** _kinesis_firehose ingestion API*/
#[utoipa::path(
context_path = "/api",
tag = "Logs",
operation_id = "AWSLogsIngestion",
security(
("Authorization"= [])
),
params(
("org_id" = String, Path, description = "Organization name"),
("stream_name" = String, Path, description = "Stream name"),
),
request_body(content = KinesisFHRequest, description = "Ingest data (json array)", content_type = "application/json"),
responses(
(status = 200, description="Success", content_type = "application/json", body = KinesisFHIngestionResponse, example = json!({ "requestId": "ed4acda5-034f-9f42-bba1-f29aea6d7d8f","timestamp": 1578090903599_i64})),
(status = 500, description="Failure", content_type = "application/json", body = HttpResponse, example = json!({ "requestId": "ed4acda5-034f-9f42-bba1-f29aea6d7d8f", "timestamp": 1578090903599_i64, "errorMessage": "error processing request"})),
)
)]
#[post("/{org_id}/{stream_name}/_kinesis_firehose")]
pub async fn handle_kinesis_request(
path: web::Path<(String, String)>,
+4 -4
View File
@@ -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<HttpResponse, Error
Ok(HttpResponse::Ok().json(org_response))
}
/** Get organization summary */
/** getOrganizationSummary */
#[utoipa::path(
context_path = "/api",
tag = "Organizations",
@@ -123,7 +123,7 @@ async fn org_summary(org_id: web::Path<String>) -> Result<HttpResponse, Error> {
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",
+4 -4
View File
@@ -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",
+1 -1
View File
@@ -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",
+6 -6
View File
@@ -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<String>) -> Result<HttpResponse, Error> {
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<HttpResponse, E
users::remove_user_from_org(&org_id, &email_id).await
}
/** Authenticate a user */
/** authenticateUser */
#[utoipa::path(
context_path = "/auth",
tag = "Auth",
+4
View File
@@ -26,6 +26,7 @@ use crate::meta;
request::stream::settings,
request::stream::delete,
request::logs::ingest::bulk,
request::logs::ingest::handle_kinesis_request,
request::logs::ingest::multi,
request::logs::ingest::json,
request::dashboards::create_dashboard,
@@ -84,6 +85,9 @@ use crate::meta;
meta::stream::StreamSettings,
meta::stream::ListStream,
meta::ingestion::RecordStatus,
meta::ingestion::KinesisFHRequest,
meta::ingestion::KinesisFHIngestionResponse,
meta::ingestion::KFHRecordRequest,
meta::ingestion::StreamStatus,
meta::ingestion::IngestionResponse,
meta::dashboards::AggregationFunc,