forked from infobloxopen/atlas-app-toolkit
-
Notifications
You must be signed in to change notification settings - Fork 0
/
collection_operators.proto
223 lines (202 loc) · 7.09 KB
/
collection_operators.proto
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
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
syntax = "proto3";
package infoblox.api;
import "protoc-gen-swagger/options/annotations.proto";
option go_package = "github.com/infobloxopen/atlas-app-toolkit/query;query";
// SortCriteria represents sort criteria
message SortCriteria {
// Tag is a JSON tag.
string tag = 1;
// Order is a sort order.
enum Order {
// ascending sort order
ASC = 0;
// descending sort order
DESC = 1;
}
Order order = 2;
}
// Sorting represents list of sort criterias.
message Sorting {
option (grpc.gateway.protoc_gen_swagger.options.openapiv2_schema) = {
json_schema: {
type: STRING;
description: "atlas.api.sorting";
};
};
repeated SortCriteria criterias = 1;
}
// FieldSelection represents a group of fields for some object.
// Main use case for if is to store information about object fields that
// need to be ratained prior to sending object as a response
message FieldSelection {
option (grpc.gateway.protoc_gen_swagger.options.openapiv2_schema) = {
json_schema: {
type: STRING;
description: "atlas.api.field_selection";
};
};
map<string, Field> fields = 1;
}
// Field represents a single field for an object.
// It contains fields name and also may contain a group of sub-fields for cases
// when a fields represents some structure.
message Field {
string name = 1;
map<string, Field> subs = 2;
}
// Filtering represents filtering expression.
// root could be either LogicalOperator or one of the supported conditions.
message Filtering {
option (grpc.gateway.protoc_gen_swagger.options.openapiv2_schema) = {
json_schema: {
type: STRING;
description: "atlas.api.filtering";
};
};
oneof root {
LogicalOperator operator = 1;
StringCondition string_condition = 2;
NumberCondition number_condition = 3;
NullCondition null_condition = 4;
StringArrayCondition string_array_condition = 5;
NumberArrayCondition number_array_condition = 6;
}
}
// LogicalOperator represents binary logical operator, either AND or OR depending on type.
// left and right are respectively left and right operands of the operator, could be
// either LogicalOperator or one of the supported conditions.
// is_negative is set to true if the operator is negated.
message LogicalOperator {
oneof left {
LogicalOperator left_operator = 1;
StringCondition left_string_condition = 2;
NumberCondition left_number_condition = 3;
NullCondition left_null_condition = 4;
StringArrayCondition left_string_array_condition = 11;
NumberArrayCondition left_number_array_condition = 12;
}
oneof right {
LogicalOperator right_operator = 5;
StringCondition right_string_condition = 6;
NumberCondition right_number_condition = 7;
NullCondition right_null_condition = 8;
StringArrayCondition right_string_array_condition = 13;
NumberArrayCondition right_number_array_condition = 14;
}
enum Type {
AND = 0;
OR = 1;
}
Type type = 9;
bool is_negative = 10;
}
// StringCondition represents a condition with a string literal, e.g. field == 'string'.
// field_path is a reference to a value of a resource.
// value is the string literal.
// type is a type of the condition.
// is_negative is set to true if the condition is negated.
message StringCondition {
repeated string field_path = 1;
string value = 2;
enum Type {
EQ = 0;
MATCH = 1;
GT = 2;
GE = 3;
LT = 4;
LE = 5;
IEQ = 6;
}
Type type = 3;
bool is_negative = 4;
}
// NumberCondition represents a condition with a number literal, e.g. field > 3.
// field_path is a reference to a value of a resource.
// value is the number literal.
// type is a type of the condition.
// is_negative is set to true if the condition is negated.
message NumberCondition {
repeated string field_path = 1;
double value = 2;
enum Type {
EQ = 0;
GT = 1;
GE = 2;
LT = 3;
LE = 4;
}
Type type = 3;
bool is_negative = 4;
}
// NullCondition represents a condition with a null literal, e.g. field == null.
// field_path is a reference to a value of a resource.
// is_negative is set to true if the condition is negated.
message NullCondition {
repeated string field_path = 1;
bool is_negative = 2;
}
// StringArrayCondition represents a condition with string arrays, e.g. field in ['hello','world']
// field_path is a reference to a value of a resource.
// is_negative is set to true if the condition is negated
message StringArrayCondition {
repeated string field_path = 1;
repeated string values = 2;
enum Type {
IN = 0;
}
Type type = 3;
bool is_negative = 4;
}
// NumberArrayCondition represents a condition with string arrays, e.g. field in [1, 5, 7]
// field_path is a reference to a value of a resource.
// is_negative is set to true if the condition is negated
message NumberArrayCondition {
repeated string field_path = 1;
repeated double values = 2;
enum Type {
IN = 0;
}
Type type = 3;
bool is_negative = 4;
}
// Pagination represents both server-driven and client-driven pagination request.
// Server-driven pagination is a model in which the server returns some
// amount of data along with an token indicating there is more data
// and where subsequent queries can get the next page of data.
// Client-driven pagination is a model in which rows are addressable by
// offset and page size (limit).
message Pagination {
option (grpc.gateway.protoc_gen_swagger.options.openapiv2_schema) = {
json_schema: {
type: STRING;
description: "atlas.api.paging";
};
};
// The service-defined string used to identify a page of resources.
// A null value indicates the first page.
string page_token = 1;
// The integer index of the offset into a collection of resources.
// If omitted or null the value is assumed to be "0".
int32 offset = 2;
// The integer number of resources to be returned in the response.
// The service may impose maximum value.
// If omitted the service may impose a default value.
int32 limit = 3;
}
// PageInfo represents both server-driven and client-driven pagination response.
// Server-driven pagination is a model in which the server returns some
// amount of data along with an token indicating there is more data
// and where subsequent queries can get the next page of data.
// Client-driven pagination is a model in which rows are addressable by
// offset and page size (limit).
message PageInfo {
// The service response should contain a string to indicate
// the next page of resources.
// A null value indicates no more pages.
string page_token = 1;
// The service may optionally include the total number of resources being paged.
int32 size = 2;
// The service may optionally include the offset of the next page of resources.
// A null value indicates no more pages.
int32 offset = 3;
}