omni_orchestrator/schemas/v1/api/
mod.rs

1//-----------------------------------------------------------------------------
2// OmniOrchestrator V1 API route registration module
3//-----------------------------------------------------------------------------
4// Authors: Tristan Poland, Maxine DeAndreade, Caznix
5//
6// This module contains the route registration for the V1 API of OmniOrchestrator.
7// It includes all the necessary routes for various functionalities such as
8// apps, alerts, notifications, instances, users, permissions, metadata,
9// audit logs, builds, regions, providers, workers, metrics, storage,
10// cost, deployments, and logging.
11//
12// Each module corresponds to a specific functionality and contains the
13// implementation of the routes related to that functionality.
14// The `routes` function aggregates all the routes from the individual
15// modules and returns them as a vector of Rocket routes.
16// The routes are defined using the Rocket framework, which is a web
17// framework for Rust.
18//
19// The modules are organized in a way that allows for easy navigation
20// and understanding of the different functionalities provided by
21// OmniOrchestrator. Each module is responsible for a specific area of
22// functionality, and the routes defined within that module are related
23// to that functionality.
24//
25// The `routes` function is the entry point for registering all the
26// routes in the V1 API. It uses the `routes!` macro from Rocket to
27// define the routes and their corresponding handlers. The routes
28// are then returned as a vector, which can be used to register the
29// routes with the Rocket application.
30//-----------------------------------------------------------------------------
31
32use rocket::routes;
33
34pub mod alerts;
35pub mod apps;
36pub mod audit_log;
37pub mod builds;
38pub mod control;
39pub mod cost;
40pub mod deploy;
41pub mod helpers;
42pub mod instances;
43pub mod metadata;
44pub mod metrics;
45pub mod notifications;
46pub mod permissions;
47pub mod deployments;
48pub mod index;
49pub mod logging;
50pub mod providers;
51pub mod regions;
52pub mod storage;
53pub mod users;
54pub mod workers;
55pub mod platforms;
56
57pub fn routes() -> Vec<rocket::Route> {
58    routes![
59        // apps
60        apps::release,    apps::get_app,    apps::stop_app,      apps::list_apps,
61        apps::start_app,  apps::scale_app,  apps::count_apps,    apps::create_app,
62        apps::update_app, apps::delete_app, apps::get_app_stats, apps::list_instances,
63        apps::get_app_with_instances,
64
65        // alerts
66        alerts::list_alerts,         alerts::get_alert,                     alerts::create_alert,
67        alerts::escalate_alert,      alerts::get_app_alerts,                alerts::get_org_active_alerts,
68        alerts::update_alert_status, alerts::acknowledge_alert,             alerts::resolve_alert,
69        alerts::get_org_alert_stats, alerts::get_alerts_needing_escalation, alerts::auto_resolve_old_alerts,
70        alerts::search_alerts,       alerts::bulk_update_alert_status,
71
72        // Notifications
73        notifications::list_user_notifications,        notifications::count_unread_user_notifications,
74        notifications::get_user_notification_by_id,    notifications::create_user_notification,
75        notifications::mark_user_notification_as_read, notifications::mark_all_user_notifications_as_read,
76        notifications::delete_user_notification,       notifications::delete_read_user_notifications,
77        notifications::list_role_notifications,        notifications::create_role_notification,
78        notifications::acknowledge_notification,       notifications::get_all_user_notifications_with_count,
79
80        // Instances
81        instances::list_instances_by_region, instances::count_instances, instances::get_instance,
82        // deploy
83        deploy::deploy_permissions,
84
85        // Users
86        users::handle_register,         users::handle_login, users::update_profile,   users::get_current_user,
87        users::change_password,         users::logout,       users::get_user_profile, users::list_user_sessions,
88        users::invalidate_user_session, users::list_users,
89
90        // permissions
91        permissions::list_permission,   permissions::get_permission_by_id,
92        permissions::create_permission, permissions::delete_permission,
93        // update_permission,
94
95        // Metadata
96        metadata::get_meta_value,
97        metadata::set_meta_value,
98
99        // Audit log
100        audit_log::create_audit_log,
101        audit_log::list_audit_logs,
102        audit_log::list_audit_logs_for_app,
103
104        //Builds
105        builds::list_builds,
106        builds::list_builds_for_app,
107        builds::get_build,
108
109        // Regions
110        regions::list_regions,
111        regions::list_provider_regions,
112        //        regions::get_region,
113        //        regions::delete_region,
114        //        regions::create_region,
115        //        regions::update_region,
116
117        // Providers
118        providers::list_providers,
119        providers::get_provider_instances,
120        providers::get_provider_audit_logs_paginated,
121
122        // TODO: @tristanpoland Migration broke these
123        //init_platform,
124        //check_platform_status,
125        //bootstrap_host,
126        //configure_network,
127        //setup_monitoring,
128        //setup_backups,
129
130        // Workers
131        workers::list_workers, workers::get_worker_by_id,
132
133        // Metrics
134        metrics::get_metrics, metrics::get_metrics_by_app_id,
135
136        // Storage
137        storage::list_storage_classes,              storage::get_storage_class,            storage::list_storage_volumes,
138        storage::get_volumes_by_storage_class,      storage::list_qos_policies,            storage::list_volumes_by_write_concern,
139        storage::list_volumes_by_persistence_level, storage::get_volumes_for_region_route, storage::get_storage_volumes_for_provider,
140
141        // Cost
142        cost::list_resource_types,        cost::count_resource_types,       cost::get_resource_type,
143        cost::create_resource_type,       cost::update_resource_type,       cost::delete_resource_type,
144        cost::list_cost_metrics,          cost::get_cost_metric,            cost::create_cost_metric,
145        cost::delete_cost_metric,         cost::analyze_costs_by_dimension, cost::analyze_cost_over_time,
146        cost::list_cost_budgets,          cost::get_cost_budget,            cost::create_cost_budget,
147        cost::update_cost_budget,         cost::delete_cost_budget,         cost::list_cost_projections,
148        cost::get_cost_projection,        cost::create_cost_projection,     cost::delete_cost_projection,
149        cost::list_resource_pricing,      cost::get_resource_pricing,       cost::create_resource_pricing,
150        cost::update_resource_pricing,    cost::delete_resource_pricing,    cost::get_cost_allocation_tags,
151        cost::create_cost_allocation_tag, cost::delete_cost_allocation_tag,
152
153        // CLI
154        // control::backup::get_backup,
155        // control::backup::list_backups,
156        // control::backup::create_backup,
157        // control::backup::list_backups_by_app_id,
158
159        deployments::list_deployments,     deployments::count_deployments, deployments::get_deployment,
160        deployments::list_app_deployments, deployments::create_deployment, deployments::update_deployment_status,
161        deployments::delete_deployment,
162
163        // Logging
164        logging::list_logs,     logging::list_platform_logs, logging::list_org_logs,
165        logging::list_app_logs, logging::list_instance_logs, logging::insert_logs,
166
167        platforms::list_platforms,
168        platforms::add_platform,
169        platforms::remove_platform,
170    ]
171}