LCOV - code coverage report
Current view: top level - source/extensions/matching/input_matchers/cel_matcher - matcher.h (source / functions) Hit Total Coverage
Test: coverage.dat Lines: 0 3 0.0 %
Date: 2024-01-05 06:35:25 Functions: 0 1 0.0 %

          Line data    Source code
       1             : #pragma once
       2             : 
       3             : #include <memory>
       4             : #include <string>
       5             : #include <variant>
       6             : 
       7             : #include "envoy/matcher/matcher.h"
       8             : 
       9             : #include "source/common/protobuf/utility.h"
      10             : #include "source/extensions/filters/common/expr/evaluator.h"
      11             : #include "source/extensions/matching/http/cel_input/cel_input.h"
      12             : 
      13             : #include "absl/types/variant.h"
      14             : #include "xds/type/matcher/v3/cel.pb.h"
      15             : 
      16             : namespace Envoy {
      17             : namespace Extensions {
      18             : namespace Matching {
      19             : namespace InputMatchers {
      20             : namespace CelMatcher {
      21             : 
      22             : using ::Envoy::Matcher::InputMatcher;
      23             : using ::Envoy::Matcher::InputMatcherFactoryCb;
      24             : using ::Envoy::Matcher::MatchingDataType;
      25             : 
      26             : using CelMatcher = ::xds::type::matcher::v3::CelMatcher;
      27             : using CompiledExpressionPtr = std::unique_ptr<google::api::expr::runtime::CelExpression>;
      28             : using BaseActivationPtr = std::unique_ptr<google::api::expr::runtime::BaseActivation>;
      29             : using CelMatcherSharedPtr = std::shared_ptr<::xds::type::matcher::v3::CelMatcher>;
      30             : 
      31             : class CelInputMatcher : public InputMatcher, public Logger::Loggable<Logger::Id::matcher> {
      32             : public:
      33             :   CelInputMatcher(CelMatcherSharedPtr cel_matcher,
      34             :                   Filters::Common::Expr::BuilderInstanceSharedPtr builder);
      35             : 
      36             :   bool match(const MatchingDataType& input) override;
      37             : 
      38             :   // TODO(tyxia) Formalize the validation approach. Use fixed string for now.
      39           0 :   absl::flat_hash_set<std::string> supportedDataInputTypes() const override {
      40           0 :     return absl::flat_hash_set<std::string>{"cel_data_input"};
      41           0 :   }
      42             : 
      43             : private:
      44             :   Filters::Common::Expr::BuilderInstanceSharedPtr builder_;
      45             :   // Expression proto must outlive the compiled expression.
      46             :   CelMatcherSharedPtr cel_matcher_;
      47             :   CompiledExpressionPtr compiled_expr_;
      48             : };
      49             : 
      50             : } // namespace CelMatcher
      51             : } // namespace InputMatchers
      52             : } // namespace Matching
      53             : } // namespace Extensions
      54             : } // namespace Envoy

Generated by: LCOV version 1.15