userver: userver/clients/http/middlewares/pipeline_component.hpp Source File
Loading...
Searching...
No Matches
pipeline_component.hpp
Go to the documentation of this file.
1#pragma once
2
3/// @file userver/clients/http/middlewares/pipeline_component.hpp
4/// @brief @copybrief clients::http::MiddlewarePipelineComponent
5
6#include <userver/components/component_base.hpp>
7#include <userver/middlewares/impl/middleware_pipeline_config.hpp>
8
9USERVER_NAMESPACE_BEGIN
10
11namespace clients::http {
12
13/// @ingroup userver_components
14///
15/// @brief Component that provides list of common middlewares names for all @ref components::HttpClient instances
16///
17/// ## Static options of @ref clients::http::MiddlewarePipelineComponent :
18/// @include{doc} scripts/docs/en/components_schema/core/src/clients/http/middlewares/pipeline_component.md
19///
20/// ## Static configuration example:
21/// @snippet components/common_component_list_test.cpp Sample http client component config
22class MiddlewarePipelineComponent final : public components::ComponentBase {
23public:
24 /// @ingroup userver_component_names
25 /// @brief The default name of clients::http::MiddlewarePipelineComponent component
26 static constexpr std::string_view kName = "http-client-middleware-pipeline";
27
28 MiddlewarePipelineComponent(const components::ComponentConfig&, const components::ComponentContext&);
29
30 const USERVER_NAMESPACE::middlewares::impl::MiddlewaresConfig& GetMiddlewaresConfig() const;
31
32 static yaml_config::Schema GetStaticConfigSchema();
33
34private:
35 USERVER_NAMESPACE::middlewares::impl::MiddlewaresConfig config_;
36};
37
38} // namespace clients::http
39
40template <>
41inline constexpr bool components::kHasValidate<clients::http::MiddlewarePipelineComponent> = true;
42
43template <>
44inline constexpr auto
45 components::kConfigFileMode<clients::http::MiddlewarePipelineComponent> = ConfigFileMode::kNotRequired;
46
47USERVER_NAMESPACE_END