-
Notifications
You must be signed in to change notification settings - Fork 73
Expand file tree
/
Copy pathcel_attribute.h
More file actions
63 lines (50 loc) · 2.14 KB
/
Copy pathcel_attribute.h
File metadata and controls
63 lines (50 loc) · 2.14 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
#ifndef THIRD_PARTY_CEL_CPP_EVAL_PUBLIC_CEL_ATTRIBUTE_PATTERN_H_
#define THIRD_PARTY_CEL_CPP_EVAL_PUBLIC_CEL_ATTRIBUTE_PATTERN_H_
#include <sys/types.h>
#include <algorithm>
#include <cstddef>
#include <initializer_list>
#include <memory>
#include <optional>
#include <string>
#include <utility>
#include <variant>
#include <vector>
#include "google/api/expr/v1alpha1/syntax.pb.h"
#include "absl/strings/str_cat.h"
#include "absl/strings/str_format.h"
#include "absl/strings/string_view.h"
#include "absl/strings/substitute.h"
#include "absl/types/optional.h"
#include "absl/types/variant.h"
#include "base/attribute.h"
#include "eval/public/cel_value.h"
namespace google::api::expr::runtime {
// CelAttributeQualifier represents a segment in
// attribute resolutuion path. A segment can be qualified by values of
// following types: string/int64_t/uint64/bool.
using CelAttributeQualifier = ::cel::AttributeQualifier;
// CelAttribute represents resolved attribute path.
using CelAttribute = ::cel::Attribute;
// CelAttributeQualifierPattern matches a segment in
// attribute resolutuion path. CelAttributeQualifierPattern is capable of
// matching path elements of types string/int64_t/uint64/bool.
using CelAttributeQualifierPattern = ::cel::AttributeQualifierPattern;
// CelAttributePattern is a fully-qualified absolute attribute path pattern.
// Supported segments steps in the path are:
// - field selection;
// - map lookup by key;
// - list access by index.
using CelAttributePattern = ::cel::AttributePattern;
CelAttributeQualifierPattern CreateCelAttributeQualifierPattern(
const CelValue& value);
CelAttributeQualifier CreateCelAttributeQualifier(const CelValue& value);
// Short-hand helper for creating |CelAttributePattern|s. string_view arguments
// must outlive the returned pattern.
CelAttributePattern CreateCelAttributePattern(
absl::string_view variable,
std::initializer_list<absl::variant<absl::string_view, int64_t, uint64_t, bool,
CelAttributeQualifierPattern>>
path_spec = {});
} // namespace google::api::expr::runtime
#endif // THIRD_PARTY_CEL_CPP_EVAL_PUBLIC_CEL_ATTRIBUTE_PATTERN_H_