From 5a26ad0bc493de67d0d08ead25b52992730cd472 Mon Sep 17 00:00:00 2001 From: Tyler Rockwood Date: Wed, 6 Sep 2023 13:01:04 -0500 Subject: [PATCH] Stub out the Admin API for transforms Just do the initial wiring up and boilerplate of registering the routes. Currently all the routes will throw a 404. Signed-off-by: Tyler Rockwood --- src/v/redpanda/CMakeLists.txt | 3 ++- src/v/redpanda/admin_server.cc | 35 ++++++++++++++++++++++++++++++++++ src/v/redpanda/admin_server.h | 9 +++++++++ 3 files changed, 46 insertions(+), 1 deletion(-) diff --git a/src/v/redpanda/CMakeLists.txt b/src/v/redpanda/CMakeLists.txt index 68d5fd1a9cee1..7e00997820486 100644 --- a/src/v/redpanda/CMakeLists.txt +++ b/src/v/redpanda/CMakeLists.txt @@ -12,7 +12,8 @@ set(swags cluster debug usage - shadow_indexing) + shadow_indexing + transform) set(swag_files) foreach(swag ${swags}) diff --git a/src/v/redpanda/admin_server.cc b/src/v/redpanda/admin_server.cc index c0326d7412bd3..dd796287aab92 100644 --- a/src/v/redpanda/admin_server.cc +++ b/src/v/redpanda/admin_server.cc @@ -80,6 +80,7 @@ #include "redpanda/admin/api-doc/shadow_indexing.json.hh" #include "redpanda/admin/api-doc/status.json.hh" #include "redpanda/admin/api-doc/transaction.json.hh" +#include "redpanda/admin/api-doc/transform.json.hh" #include "redpanda/admin/api-doc/usage.json.hh" #include "resource_mgmt/memory_sampling.h" #include "rpc/errc.h" @@ -323,6 +324,8 @@ void admin_server::configure_admin_routes() { rb->register_api_file(_server._routes, "debug"); rb->register_function(_server._routes, insert_comma); rb->register_api_file(_server._routes, "cluster"); + rb->register_function(_server._routes, insert_comma); + rb->register_api_file(_server._routes, "transform"); register_config_routes(); register_cluster_config_routes(); register_raft_routes(); @@ -339,6 +342,7 @@ void admin_server::configure_admin_routes() { register_self_test_routes(); register_cluster_routes(); register_shadow_indexing_routes(); + register_wasm_transform_routes(); } namespace { @@ -5445,3 +5449,34 @@ admin_server::sampled_memory_profile_handler( co_return co_await ss::make_ready_future( std::move(resp)); } + +void admin_server::register_wasm_transform_routes() { + register_route_raw_async( + ss::httpd::transform_json::deploy_transform, + [this]( + std::unique_ptr req, + std::unique_ptr rep) { + return deploy_transform(std::move(req), std::move(rep)); + }); + register_route( + ss::httpd::transform_json::list_transforms, + [this](auto req) { return list_transforms(std::move(req)); }); + register_route( + ss::httpd::transform_json::delete_transform, + [this](auto req) { return delete_transform(std::move(req)); }); +} + +ss::future +admin_server::delete_transform(std::unique_ptr) { + throw ss::httpd::bad_request_exception("data transforms not enabled"); +} + +ss::future +admin_server::list_transforms(std::unique_ptr) { + throw ss::httpd::bad_request_exception("data transforms not enabled"); +} + +ss::future> admin_server::deploy_transform( + std::unique_ptr, std::unique_ptr) { + throw ss::httpd::bad_request_exception("data transforms not enabled"); +} diff --git a/src/v/redpanda/admin_server.h b/src/v/redpanda/admin_server.h index bdad25c7ec4ad..564ef8f5569cd 100644 --- a/src/v/redpanda/admin_server.h +++ b/src/v/redpanda/admin_server.h @@ -348,6 +348,7 @@ class admin_server { void register_self_test_routes(); void register_cluster_routes(); void register_shadow_indexing_routes(); + void register_wasm_transform_routes(); ss::future patch_cluster_config_handler( std::unique_ptr, const request_auth_result&); @@ -484,6 +485,14 @@ class admin_server { ss::future sampled_memory_profile_handler(std::unique_ptr); + // Transform routes + ss::future> deploy_transform( + std::unique_ptr, std::unique_ptr); + ss::future + list_transforms(std::unique_ptr); + ss::future + delete_transform(std::unique_ptr); + ss::future<> throw_on_error( ss::http::request& req, std::error_code ec,