1
#include "source/extensions/matching/input_matchers/metadata/config.h"
2

            
3
namespace Envoy {
4
namespace Extensions {
5
namespace Matching {
6
namespace InputMatchers {
7
namespace Metadata {
8

            
9
Envoy::Matcher::InputMatcherFactoryCb
10
Config::createInputMatcherFactoryCb(const Protobuf::Message& config,
11
11
                                    Server::Configuration::ServerFactoryContext& factory_context) {
12
11
  const auto& matcher_config = MessageUtil::downcastAndValidate<
13
11
      const envoy::extensions::matching::input_matchers::metadata::v3::Metadata&>(
14
11
      config, factory_context.messageValidationVisitor());
15
11
  const auto& value = matcher_config.value();
16
11
  const auto value_matcher = Envoy::Matchers::ValueMatcher::create(value, factory_context);
17
11
  const bool invert = matcher_config.invert();
18
11
  return [value_matcher, invert]() { return std::make_unique<Matcher>(value_matcher, invert); };
19
11
}
20
/**
21
 * Static registration for the Metadata matcher. @see RegisterFactory.
22
 */
23
REGISTER_FACTORY(Config, Envoy::Matcher::InputMatcherFactory);
24

            
25
} // namespace Metadata
26
} // namespace InputMatchers
27
} // namespace Matching
28
} // namespace Extensions
29
} // namespace Envoy