userver
C++ Async Framework
Loading...
Searching...
No Matches
dns_client_control.hpp
Go to the documentation of this file.
1
#
pragma
once
2
3
/// @file userver/server/handlers/dns_client_control.hpp
4
/// @brief @copybrief server::handlers::DnsClientControl
5
6
#
include
<
userver
/
server
/
handlers
/
http_handler_base
.
hpp
>
7
8
USERVER_NAMESPACE_BEGIN
9
10
namespace
clients::
dns
{
11
class
Resolver
;
12
}
// namespace clients::dns
13
14
namespace
server::handlers {
15
16
// clang-format off
17
18
/// @ingroup userver_components userver_http_handlers
19
///
20
/// @brief Handlers that controls the DNS client.
21
///
22
/// The component has no service configuration except the
23
/// @ref userver_http_handlers "common handler options".
24
///
25
/// ## Static configuration example:
26
///
27
/// @snippet components/common_server_component_list_test.cpp Sample handler dns client control component config
28
///
29
/// ## Schema
30
/// Set an URL path argument `command` to one of the following values:
31
/// * `reload_hosts` - to reload hosts file cache
32
/// * `flush_cache` - to remove network cache records for `name` specified as a query parameter
33
/// * `flush_cache_full` - to completely wipe network cache
34
35
// clang-format on
36
37
class
DnsClientControl
final
:
public
HttpHandlerBase
{
38
public
:
39
/// @ingroup userver_component_names
40
/// @brief The default name of server::handlers::DnsClientControl
41
static
constexpr
std
::
string_view
kName
=
"handler-dns-client-control"
;
42
43
DnsClientControl(
const
components
::ComponentConfig&,
const
components
::ComponentContext&);
44
45
std::string
HandleRequestThrow
(
const
http
::HttpRequest&,
request
::RequestContext&)
const
override
;
46
47
static
yaml_config
::Schema GetStaticConfigSchema();
48
49
private
:
50
clients::
dns
::
Resolver
* resolver_;
51
};
52
53
}
// namespace server::handlers
54
55
template
<>
56
inline
constexpr
bool
components
::kHasValidate<server::handlers::DnsClientControl> =
true
;
57
58
USERVER_NAMESPACE_END
userver
server
handlers
dns_client_control.hpp
Generated on Wed Dec 4 2024 18:45:55 for userver by
Doxygen
1.10.0