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