Line data Source code
1 : #include "source/extensions/matching/input_matchers/runtime_fraction/config.h" 2 : 3 : #include "envoy/extensions/matching/input_matchers/runtime_fraction/v3/runtime_fraction.pb.h" 4 : 5 : namespace Envoy { 6 : namespace Extensions { 7 : namespace Matching { 8 : namespace InputMatchers { 9 : namespace RuntimeFraction { 10 : 11 : Envoy::Matcher::InputMatcherFactoryCb 12 : Config::createInputMatcherFactoryCb(const Protobuf::Message& config, 13 0 : Server::Configuration::ServerFactoryContext& factory_context) { 14 0 : const auto& runtime_fraction_config = MessageUtil::downcastAndValidate< 15 0 : const envoy::extensions::matching::input_matchers::runtime_fraction::v3::RuntimeFraction&>( 16 0 : config, factory_context.messageValidationVisitor()); 17 : 18 0 : auto& runtime = factory_context.runtime(); 19 0 : return [runtime_fraction_config, &runtime]() { 20 0 : return std::make_unique<Matcher>(runtime, runtime_fraction_config.runtime_fraction(), 21 0 : runtime_fraction_config.seed()); 22 0 : }; 23 0 : } 24 : /** 25 : * Static registration for the runtime fraction matcher. @see RegisterFactory. 26 : */ 27 : REGISTER_FACTORY(Config, Envoy::Matcher::InputMatcherFactory); 28 : 29 : } // namespace RuntimeFraction 30 : } // namespace InputMatchers 31 : } // namespace Matching 32 : } // namespace Extensions 33 : } // namespace Envoy