cel_expression.h
Go to the documentation of this file.
1 // Copyright 2020 gRPC authors.
2 //
3 // Licensed under the Apache License, Version 2.0 (the "License");
4 // you may not use this file except in compliance with the License.
5 // You may obtain a copy of the License at
6 //
7 // http://www.apache.org/licenses/LICENSE-2.0
8 //
9 // Unless required by applicable law or agreed to in writing, software
10 // distributed under the License is distributed on an "AS IS" BASIS,
11 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 // See the License for the specific language governing permissions and
13 // limitations under the License.
14 
15 #ifndef GRPC_CORE_LIB_SECURITY_AUTHORIZATION_MOCK_CEL_CEL_EXPRESSION_H
16 #define GRPC_CORE_LIB_SECURITY_AUTHORIZATION_MOCK_CEL_CEL_EXPRESSION_H
17 
19 
20 #include <memory>
21 #include <vector>
22 
23 #include "absl/status/status.h"
24 #include "absl/status/statusor.h"
26 
29 
30 namespace grpc_core {
31 namespace mock_cel {
32 
33 // This is a temporary stub implementation of CEL APIs.
34 // Once gRPC imports the CEL library, this file will be removed.
35 
36 // Base interface for expression evaluating objects.
38  public:
39  virtual ~CelExpression() = default;
40 
41  // Evaluates expression and returns value.
42  // activation contains bindings from parameter names to values
44  const BaseActivation& activation) const = 0;
45 };
46 
47 // Base class for Expression Builder implementations
48 // Provides user with factory to register extension functions.
49 // ExpressionBuilder MUST NOT be destroyed before CelExpression objects
50 // it built.
52  public:
53  virtual ~CelExpressionBuilder() = default;
54 
55  // Creates CelExpression object from AST tree.
56  // expr specifies root of AST tree
59  const google_api_expr_v1alpha1_SourceInfo* source_info) const = 0;
60 
63  const google_api_expr_v1alpha1_SourceInfo* source_info,
64  std::vector<absl::Status>* warnings) const = 0;
65 };
66 
67 } // namespace mock_cel
68 } // namespace grpc_core
69 
70 #endif // GRPC_CORE_LIB_SECURITY_AUTHORIZATION_MOCK_CEL_CEL_EXPRESSION_H
syntax.upb.h
grpc_core
Definition: call_metric_recorder.h:31
grpc_core::mock_cel::CelExpression::Evaluate
virtual absl::StatusOr< CelValue > Evaluate(const BaseActivation &activation) const =0
grpc_core::mock_cel::BaseActivation
Definition: activation.h:29
activation.h
google_api_expr_v1alpha1_SourceInfo
struct google_api_expr_v1alpha1_SourceInfo google_api_expr_v1alpha1_SourceInfo
Definition: syntax.upb.h:47
grpc_core::mock_cel::CelExpression::~CelExpression
virtual ~CelExpression()=default
grpc_core::mock_cel::CelExpressionBuilder::~CelExpressionBuilder
virtual ~CelExpressionBuilder()=default
grpc_core::mock_cel::CelExpression
Definition: cel_expression.h:37
google_api_expr_v1alpha1_Expr
struct google_api_expr_v1alpha1_Expr google_api_expr_v1alpha1_Expr
Definition: syntax.upb.h:38
absl::StatusOr
Definition: abseil-cpp/absl/status/statusor.h:187
cel_value.h
grpc_core::mock_cel::CelExpressionBuilder
Definition: cel_expression.h:51
grpc_core::mock_cel::CelExpressionBuilder::CreateExpression
virtual absl::StatusOr< std::unique_ptr< CelExpression > > CreateExpression(const google_api_expr_v1alpha1_Expr *expr, const google_api_expr_v1alpha1_SourceInfo *source_info) const =0
port_platform.h


grpc
Author(s):
autogenerated on Thu Mar 13 2025 02:58:43