-
Notifications
You must be signed in to change notification settings - Fork 2
/
asset_service.proto
303 lines (253 loc) · 11.2 KB
/
asset_service.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
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
syntax = "proto3";
package hiber.asset;
import "google/protobuf/struct.proto";
import "base.proto";
import "asset.proto";
import "file.proto";
import "device.proto";
import "tag.proto";
import "value.proto";
option java_multiple_files = false;
option java_package = "global.hiber.api.grpc.asset";
option java_outer_classname = "AssetServiceApi";
option go_package = ".;hiber";
/* Manage Assets in your organization, creating new assets,
* updating or deleting them in bulk and changing assigned tags and devices.
*/
service AssetService {
/* List the assets in your organization. */
rpc List (ListAsset.Request) returns (ListAsset.Response);
/* Create assets in your organization. */
rpc Create (CreateAsset.Request) returns (CreateAsset.Response);
/* Update assets in your organization. */
rpc Update(UpdateAsset.Request) returns (UpdateAsset.Response);
/* Delete assets in your organization. */
rpc Delete(DeleteAsset.Request) returns (DeleteAsset.Response);
/* Assign (a) tag(s) to an asset. */
rpc AssignTag (AssignAssetTags.Request) returns (AssignAssetTags.Response);
/* Unassign (a) tag(s) from an asset. */
rpc UnassignTag (UnassignAssetTags.Request) returns (UnassignAssetTags.Response);
/* Assign (a) device(s) to an asset. */
rpc AssignDevice (AssignAssetDevices.Request) returns (AssignAssetDevices.Response);
/* Unassign (a) device(s) from an asset. */
rpc UnassignDevice (UnassignAssetDevices.Request) returns (UnassignAssetDevices.Response);
}
/* List the assets in your (selected) organization.
*/
message ListAsset {
enum Sort {
/* Sort alphabetically on the name of the asset, in ascending order. Default. */
NAME_ASC = 0;
/* Sort alphabetically on the name of the asset, in descending order. */
NAME_DESC = 1;
/* Sort assets on most recent activity first (e.g. newest value received). */
ACTIVITY = 2;
/* Sort assets on least recent activity first (e.g. longest no value received). */
INACTIVITY = 3;
/* Sort alphabetically on the asset type, in ascending order. */
TYPE_ASC = 4;
/* Sort alphabetically on the asset type, in descending order. */
TYPE_DESC = 5;
/* Sort alphabetically on any tags of type 'well', in ascending order. */
TAG_TYPE_WELL_ASC = 6;
/* Sort alphabetically on any tags of type 'well', in descending order. */
TAG_TYPE_WELL_DESC = 7;
/* Sort alphabetically on any tags of type 'site', in ascending order. */
TAG_TYPE_SITE_ASC = 8;
/* Sort alphabetically on any tags of type 'site', in descending order. */
TAG_TYPE_SITE_DESC = 9;
/* Sort alphabetically on any tags of type 'production_area', in ascending order. */
TAG_TYPE_PRODUCTION_AREA_ASC = 10;
/* Sort alphabetically on any tags of type 'production_area', in descending order. */
TAG_TYPE_PRODUCTION_AREA_DESC = 11;
}
message Request {
/* Pick the organization to use (/impersonate). If unset, your default organization is used. */
optional string organization = 1;
/* Select which assets to return.
* Optional, when omitted or empty everything is included.
*/
optional asset.AssetSelection selection = 2;
/* Paginate through results. */
optional Pagination pagination = 3;
/* Sort the assets with the given sort options. */
repeated Sort sort_by = 4;
/* Include assets from the selected child organizations. */
optional Filter.ChildOrganizations child_organizations = 5;
}
message Response {
repeated Asset assets = 1;
Pagination.Result pagination = 2;
Request request = 3;
}
}
/* Create one or more assets in your (selected) organization.
*/
message CreateAsset {
optional string name = 1;
optional Asset.Type type = 2;
optional string description = 3;
optional string notes = 4;
optional string time_zone = 5;
optional value.Value.Numeric.Rate expected_transmission_rate = 6;
optional google.protobuf.Struct metadata = 7;
optional Location location = 8;
repeated file.File files = 9;
message Request {
/* Pick the organization to use (/impersonate). If unset, your default organization is used. */
optional string organization = 1;
/* Assets to create. */
repeated CreateAsset create = 2;
}
message Response {
repeated Asset created = 1;
Request request = 2;
}
}
/* Update one or more assets in your (selected) organization. */
message UpdateAsset {
optional string update_name = 1;
optional Asset.Type update_type = 2;
optional string update_description = 3;
optional string update_notes = 4;
optional string update_time_zone = 5;
optional value.Value.Numeric.Rate update_expected_transmission_rate = 6;
map<string, google.protobuf.Value> add_metadata = 7;
map<string, string> add_metadata_text = 8;
repeated string remove_metadata_keys = 9;
optional Location location = 10;
optional bool remove_location = 11;
repeated file.File add_files = 12;
repeated string delete_files = 13;
message Request {
/* Pick the organization to use (/impersonate). If unset, your default organization is used. */
optional string organization = 1;
/* Select which assets to update. Not optional and cannot be empty. */
asset.AssetSelection selection = 2;
/* The update to apply to the selected assets. */
UpdateAsset update = 3;
/* Paginate through results (for the Response, not the actual update).
* To get the next pages, use the List call with the same selection and pagination for the next page.
*/
optional Pagination pagination = 4;
}
message Response {
repeated Asset assets = 1;
Pagination.Result pagination = 2;
Request request = 3;
}
}
/* Delete assets in your (selected) organization. */
message DeleteAsset {
message Request {
/* Pick the organization to use (/impersonate). If unset, your default organization is used. */
optional string organization = 1;
/* Select which assets to delete. Not optional and cannot be empty. */
asset.AssetSelection selection = 2;
}
message Response {
uint32 deleted = 1;
Request request = 2;
}
}
/* Change the assigned tags for a selection of assets in your (selected) organization. */
message AssignAssetTags {
message Request {
/* Pick the organization to use (/impersonate). If unset, your default organization is used. */
optional string organization = 1;
/* Select which assets to assign. Not optional and cannot be empty. */
asset.AssetSelection selection = 2;
/* Select which tags to assign this asset to. */
tag.TagSelection tags = 3;
/* Paginate through results (for the Response, not the actual update).
* To get the next pages, use the List call with the same selection and pagination for the next page.
*/
optional Pagination pagination = 4;
}
message Response {
repeated Asset assets = 1;
Pagination.Result pagination = 2;
Request request = 3;
}
}
/* Change the assigned tags for a selection of assets in your (selected) organization. */
message UnassignAssetTags {
message Request {
/* Pick the organization to use (/impersonate). If unset, your default organization is used. */
optional string organization = 1;
/* Select which assets to unassign. Not optional and cannot be empty. */
asset.AssetSelection selection = 2;
/* Select which tags to unassign this asset from. */
tag.TagSelection tags = 3;
/* Paginate through results (for the Response, not the actual update).
* To get the next pages, use the List call with the same selection and pagination for the next page.
*/
optional Pagination pagination = 4;
}
message Response {
repeated Asset assets = 1;
Pagination.Result pagination = 2;
Request request = 3;
}
}
/* Change the assigned devices for a selection of assets in your (selected) organization. */
message AssignAssetDevices {
message Request {
/* Pick the organization to use (/impersonate). If unset, your default organization is used. */
optional string organization = 1;
/* Select which assets to assign. Not optional and cannot be empty. */
asset.AssetSelection selection = 2;
/* Select which devices to assign this asset to. */
device.DeviceSelection devices = 3;
/* Paginate through results (for the Response, not the actual update).
* To get the next pages, use the List call with the same selection and pagination for the next page.
*/
optional Pagination pagination = 4;
/* Time that the assignment should be active.
* This sets the assignment to start in the past, but would not have effect in the past for assignments like
* parsers and alarms (they will only be triggered for new messages / values).
* It would however work for assets having access to device data.
* This is not allowed to be a value in the future at the moment.
*/
optional Timestamp override_time = 5;
/* Time that the assignment ended.
* This marks the assignment as ended at the given moment in the past, but would not have effect in the past
* for assignments like parsers and alarms (i.e. no alarm events are removed).
* It would however work for assets having access to device data.
* This is not allowed to be a value in the future at the moment.
*/
optional Timestamp end_time = 6;
}
message Response {
repeated Asset assets = 1;
Pagination.Result pagination = 2;
Request request = 3;
}
}
/* Change the assigned devices for a selection of assets in your (selected) organization. */
message UnassignAssetDevices {
message Request {
/* Pick the organization to use (/impersonate). If unset, your default organization is used. */
optional string organization = 1;
/* Select which assets to unassign. Not optional and cannot be empty. */
asset.AssetSelection selection = 2;
/* Select which devices to unassign this asset from. */
device.DeviceSelection devices = 3;
/* Paginate through results (for the Response, not the actual update).
* To get the next pages, use the List call with the same selection and pagination for the next page.
*/
optional Pagination pagination = 4;
/* Time that the assignment ended.
* This marks the assignment as ended at the given moment in the past, but would not have effect in the past
* for assignments like parsers and alarms (i.e. no alarm events are removed).
* It would however work for assets having access to device data.
* This is not allowed to be a value in the future at the moment.
*/
optional Timestamp override_time = 5;
}
message Response {
repeated Asset assets = 1;
Pagination.Result pagination = 2;
Request request = 3;
}
}