1// Copyright 2018 Google LLC.
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
16syntax = "proto3";
17
18package google.api.expr.v1alpha1;
19
20import "google/protobuf/any.proto";
21import "google/protobuf/struct.proto";
22
23option cc_enable_arenas = true;
24option go_package = "google.golang.org/genproto/googleapis/api/expr/v1alpha1;expr";
25option java_multiple_files = true;
26option java_outer_classname = "ValueProto";
27option java_package = "com.google.api.expr.v1alpha1";
28
29// Contains representations for CEL runtime values.
30
31// Represents a CEL value.
32//
33// This is similar to `google.protobuf.Value`, but can represent CEL's full
34// range of values.
35message Value {
36  // Required. The valid kinds of values.
37  oneof kind {
38    // Null value.
39    google.protobuf.NullValue null_value = 1;
40
41    // Boolean value.
42    bool bool_value = 2;
43
44    // Signed integer value.
45    int64 int64_value = 3;
46
47    // Unsigned integer value.
48    uint64 uint64_value = 4;
49
50    // Floating point value.
51    double double_value = 5;
52
53    // UTF-8 string value.
54    string string_value = 6;
55
56    // Byte string value.
57    bytes bytes_value = 7;
58
59    // An enum value.
60    EnumValue enum_value = 9;
61
62    // The proto message backing an object value.
63    google.protobuf.Any object_value = 10;
64
65    // Map value.
66    MapValue map_value = 11;
67
68    // List value.
69    ListValue list_value = 12;
70
71    // Type value.
72    string type_value = 15;
73  }
74}
75
76// An enum value.
77message EnumValue {
78  // The fully qualified name of the enum type.
79  string type = 1;
80
81  // The value of the enum.
82  int32 value = 2;
83}
84
85// A list.
86//
87// Wrapped in a message so 'not set' and empty can be differentiated, which is
88// required for use in a 'oneof'.
89message ListValue {
90  // The ordered values in the list.
91  repeated Value values = 1;
92}
93
94// A map.
95//
96// Wrapped in a message so 'not set' and empty can be differentiated, which is
97// required for use in a 'oneof'.
98message MapValue {
99  // An entry in the map.
100  message Entry {
101    // The key.
102    //
103    // Must be unique with in the map.
104    // Currently only boolean, int, uint, and string values can be keys.
105    Value key = 1;
106
107    // The value.
108    Value value = 2;
109  }
110
111  // The set of map entries.
112  //
113  // CEL has fewer restrictions on keys, so a protobuf map represenation
114  // cannot be used.
115  repeated Entry entries = 1;
116}
117