Line data Source code
1 : #pragma once 2 : 3 : #include "envoy/config/core/v3/substitution_format_string.pb.h" 4 : #include "envoy/config/core/v3/substitution_format_string.pb.validate.h" 5 : #include "envoy/formatter/substitution_formatter.h" 6 : #include "envoy/matcher/matcher.h" 7 : #include "envoy/server/factory_context.h" 8 : 9 : #include "source/common/matcher/matcher.h" 10 : 11 : namespace Envoy { 12 : namespace Extensions { 13 : namespace Matching { 14 : namespace Actions { 15 : namespace FormatString { 16 : 17 : class ActionImpl : public Matcher::ActionBase<envoy::config::core::v3::SubstitutionFormatString, 18 : Server::Configuration::FilterChainBaseAction> { 19 : public: 20 0 : ActionImpl(const Formatter::FormatterConstSharedPtr& formatter) : formatter_(formatter) {} 21 : const Network::FilterChain* 22 : get(const Server::Configuration::FilterChainsByName& filter_chains_by_name, 23 : const StreamInfo::StreamInfo& info) const override; 24 : 25 : private: 26 : const Formatter::FormatterConstSharedPtr formatter_; 27 : }; 28 : 29 : using FilterChainActionFactoryContext = Server::Configuration::ServerFactoryContext; 30 : class ActionFactory : public Matcher::ActionFactory<FilterChainActionFactoryContext> { 31 : public: 32 4 : std::string name() const override { return "envoy.matching.actions.format_string"; } 33 : Matcher::ActionFactoryCb 34 : createActionFactoryCb(const Protobuf::Message& proto_config, 35 : FilterChainActionFactoryContext& context, 36 : ProtobufMessage::ValidationVisitor& validator) override; 37 0 : ProtobufTypes::MessagePtr createEmptyConfigProto() override { 38 0 : return std::make_unique<envoy::config::core::v3::SubstitutionFormatString>(); 39 0 : } 40 : }; 41 : 42 : } // namespace FormatString 43 : } // namespace Actions 44 : } // namespace Matching 45 : } // namespace Extensions 46 : } // namespace Envoy