userver: userver/alerts/handler.hpp Source File
Loading...
Searching...
No Matches
handler.hpp
1#pragma once
2
3/// @file userver/alert/handler.hpp
4/// @brief @copybrief alert::Handler
5
6#include <userver/alerts/storage.hpp>
7#include <userver/server/handlers/http_handler_json_base.hpp>
8
9USERVER_NAMESPACE_BEGIN
10
11namespace alerts {
12
13/// @ingroup userver_components userver_http_handlers
14///
15/// @brief Handler that returns the list of active fired alerts.
16class Handler final : public server::handlers::HttpHandlerJsonBase {
17public:
18 Handler(const components::ComponentConfig& config, const components::ComponentContext& context);
19
20 /// @ingroup userver_component_names
21 /// @brief The default name of alerts::Handler
22 static constexpr std::string_view kName = "handler-fired-alerts";
23
24 formats::json::Value HandleRequestJsonThrow(
25 const server::http::HttpRequest& request,
26 const formats::json::Value& request_json,
27 server::request::RequestContext& context
28 ) const override;
29
30private:
31 Storage& storage_;
32};
33
34} // namespace alerts
35
36template <>
37inline constexpr bool components::kHasValidate<alerts::Handler> = true;
38
39USERVER_NAMESPACE_END