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 {
17 public:
18 Handler(const components::ComponentConfig& config,
19 const components::ComponentContext& context);
20
21 /// @ingroup userver_component_names
22 /// @brief The default name of alerts::Handler
23 static constexpr std::string_view kName = "handler-fired-alerts";
24
25 formats::json::Value HandleRequestJsonThrow(
26 const server::http::HttpRequest& request,
27 const formats::json::Value& request_json,
28 server::request::RequestContext& context) const override;
29
30 private:
31 Storage& storage_;
32};
33
34} // namespace alerts
35
36template <>
37inline constexpr bool components::kHasValidate<alerts::Handler> = true;
38
39USERVER_NAMESPACE_END