arcbox-protocol 0.1.4

Protocol definitions for ArcBox (ttrpc/protobuf)
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
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
// ArcBox API service protocol definitions.
//
// This file contains API-specific services and types that are used by
// arcbox CLI and other high-level clients communicating with the host daemon.
//
// Design sources:
// - internal-docs/architecture/cli-api.md
// - containerd API patterns

syntax = "proto3";

package arcbox.v1;

import "common.proto";

// =============================================================================
// Network Service
// =============================================================================

// NetworkService manages Docker networks.
service NetworkService {
    // Creates a new network.
    rpc Create(CreateNetworkRequest) returns (CreateNetworkResponse);

    // Removes a network.
    rpc Remove(RemoveNetworkRequest) returns (Empty);

    // Lists networks.
    rpc List(ListNetworksRequest) returns (ListNetworksResponse);

    // Inspects a network.
    rpc Inspect(InspectNetworkRequest) returns (NetworkInfo);
}

// Request to create a network.
message CreateNetworkRequest {
    // Network name.
    string name = 1;
    // Driver (e.g., "bridge", "host", "none").
    string driver = 2;
    // Internal network (not connected to external network).
    bool internal = 3;
    // Labels.
    map<string, string> labels = 4;
    // Enable IPv6.
    bool enable_ipv6 = 5;
    // IPAM configuration.
    IpamConfig ipam = 6;
}

// IPAM configuration.
message IpamConfig {
    // Driver name.
    string driver = 1;
    // IPAM options.
    map<string, string> options = 2;
    // Subnet configurations.
    repeated IpamSubnet subnets = 3;
}

// IPAM subnet configuration.
message IpamSubnet {
    // Subnet in CIDR format.
    string subnet = 1;
    // Gateway address.
    string gateway = 2;
    // IP range for allocation.
    string ip_range = 3;
}

// Response to create network.
message CreateNetworkResponse {
    // Network ID.
    string id = 1;
    // Warning messages.
    repeated string warnings = 2;
}

// Request to remove a network.
message RemoveNetworkRequest {
    // Network ID or name.
    string id = 1;
}

// Request to list networks.
message ListNetworksRequest {
    // Filter by labels.
    map<string, string> filters = 1;
}

// Response to list networks.
message ListNetworksResponse {
    // List of networks.
    repeated NetworkSummary networks = 1;
}

// Summary information about a network.
message NetworkSummary {
    // Network ID.
    string id = 1;
    // Network name.
    string name = 2;
    // Driver.
    string driver = 3;
    // Scope (local, global).
    string scope = 4;
    // Created timestamp (RFC3339).
    string created = 5;
    // Internal network.
    bool internal = 6;
    // Attachable.
    bool attachable = 7;
    // Labels.
    map<string, string> labels = 8;
}

// Request to inspect a network.
message InspectNetworkRequest {
    // Network ID or name.
    string id = 1;
    // Verbose output.
    bool verbose = 2;
}

// Detailed network information.
message NetworkInfo {
    // Network ID.
    string id = 1;
    // Network name.
    string name = 2;
    // Driver.
    string driver = 3;
    // Scope.
    string scope = 4;
    // Created timestamp (RFC3339).
    string created = 5;
    // Internal network.
    bool internal = 6;
    // Attachable.
    bool attachable = 7;
    // Labels.
    map<string, string> labels = 8;
    // IPAM configuration.
    IpamConfig ipam = 9;
    // Connected containers.
    map<string, NetworkContainer> containers = 10;
    // Driver options.
    map<string, string> options = 11;
}

// Container connected to a network.
message NetworkContainer {
    // Container name.
    string name = 1;
    // Container endpoint ID.
    string endpoint_id = 2;
    // IPv4 address.
    string ipv4_address = 3;
    // IPv6 address.
    string ipv6_address = 4;
    // MAC address.
    string mac_address = 5;
}

// =============================================================================
// System Service
// =============================================================================

// SystemService provides system-level operations.
service SystemService {
    // Gets system information.
    rpc GetInfo(GetInfoRequest) returns (GetInfoResponse);

    // Gets version information.
    rpc GetVersion(GetVersionRequest) returns (GetVersionResponse);

    // Pings the server.
    rpc Ping(SystemPingRequest) returns (SystemPingResponse);

    // Gets system events.
    rpc Events(EventsRequest) returns (stream Event);

    // Prunes unused resources.
    rpc Prune(PruneRequest) returns (PruneResponse);
}

// Request to get system info.
message GetInfoRequest {}

// Response to get system info.
message GetInfoResponse {
    // Number of containers.
    int64 containers = 1;
    // Running containers.
    int64 containers_running = 2;
    // Paused containers.
    int64 containers_paused = 3;
    // Stopped containers.
    int64 containers_stopped = 4;
    // Number of images.
    int64 images = 5;
    // Number of machines.
    int64 machines = 6;
    // Running machines.
    int64 machines_running = 7;
    // Server version.
    string server_version = 8;
    // Operating system.
    string os = 9;
    // Architecture.
    string arch = 10;
    // Total memory.
    int64 mem_total = 11;
    // Number of CPUs.
    int32 ncpu = 12;
    // Data directory.
    string data_dir = 13;
    // Kernel version.
    string kernel_version = 14;
    // Operating system type.
    string os_type = 15;
    // Logging driver.
    string logging_driver = 16;
    // Storage driver.
    string storage_driver = 17;
}

// Request to get version.
message GetVersionRequest {}

// Response to get version.
message GetVersionResponse {
    // Version string.
    string version = 1;
    // API version.
    string api_version = 2;
    // Minimum API version.
    string min_api_version = 3;
    // Git commit.
    string git_commit = 4;
    // Build time.
    string build_time = 5;
    // OS.
    string os = 6;
    // Architecture.
    string arch = 7;
    // Go version (for compatibility).
    string go_version = 8;
}

// Request to ping the server.
message SystemPingRequest {}

// Response to ping.
message SystemPingResponse {
    // API version.
    string api_version = 1;
    // Build version.
    string build_version = 2;
}

// Request to get events.
message EventsRequest {
    // Only events since this timestamp (Unix seconds).
    int64 since = 1;
    // Only events until this timestamp (Unix seconds).
    int64 until = 2;
    // Filters.
    map<string, string> filters = 3;
}

// System event.
message Event {
    // Event type (container, image, network, volume, daemon).
    string type = 1;
    // Action (create, start, stop, die, destroy, etc.).
    string action = 2;
    // Actor that generated the event.
    EventActor actor = 3;
    // Timestamp (Unix nanoseconds).
    int64 time_nano = 4;
}

// Event actor.
message EventActor {
    // ID of the object.
    string id = 1;
    // Attributes.
    map<string, string> attributes = 2;
}

// Request to prune resources.
message PruneRequest {
    // Types to prune: containers, images, networks, volumes, all.
    repeated string types = 1;
    // Remove all unused resources, not just dangling ones.
    bool all = 2;
    // Filters.
    map<string, string> filters = 3;
}

// Response to prune.
message PruneResponse {
    // Space reclaimed in bytes.
    uint64 space_reclaimed = 1;
    // Deleted containers.
    repeated string containers_deleted = 2;
    // Deleted images.
    repeated string images_deleted = 3;
    // Deleted networks.
    repeated string networks_deleted = 4;
    // Deleted volumes.
    repeated string volumes_deleted = 5;
}

// =============================================================================
// Volume Service
// =============================================================================

// VolumeService manages Docker volumes.
service VolumeService {
    // Creates a volume.
    rpc Create(CreateVolumeRequest) returns (CreateVolumeResponse);

    // Removes a volume.
    rpc Remove(RemoveVolumeRequest) returns (Empty);

    // Lists volumes.
    rpc List(ListVolumesRequest) returns (ListVolumesResponse);

    // Inspects a volume.
    rpc Inspect(InspectVolumeRequest) returns (VolumeInfo);
}

// Request to create a volume.
message CreateVolumeRequest {
    // Volume name.
    string name = 1;
    // Driver name.
    string driver = 2;
    // Driver options.
    map<string, string> driver_opts = 3;
    // Labels.
    map<string, string> labels = 4;
}

// Response to create volume.
message CreateVolumeResponse {
    // Volume name.
    string name = 1;
    // Driver.
    string driver = 2;
    // Mountpoint.
    string mountpoint = 3;
}

// Request to remove a volume.
message RemoveVolumeRequest {
    // Volume name.
    string name = 1;
    // Force removal.
    bool force = 2;
}

// Request to list volumes.
message ListVolumesRequest {
    // Filters.
    map<string, string> filters = 1;
}

// Response to list volumes.
message ListVolumesResponse {
    // List of volumes.
    repeated VolumeInfo volumes = 1;
    // Warnings.
    repeated string warnings = 2;
}

// Request to inspect a volume.
message InspectVolumeRequest {
    // Volume name.
    string name = 1;
}

// Volume information.
message VolumeInfo {
    // Volume name.
    string name = 1;
    // Driver.
    string driver = 2;
    // Mountpoint.
    string mountpoint = 3;
    // Created timestamp (RFC3339).
    string created = 4;
    // Status.
    map<string, string> status = 5;
    // Labels.
    map<string, string> labels = 6;
    // Scope (local, global).
    string scope = 7;
    // Driver options.
    map<string, string> options = 8;
    // Usage data.
    VolumeUsage usage = 9;
}

// Volume usage data.
message VolumeUsage {
    // Size in bytes.
    int64 size = 1;
    // Reference count.
    int64 ref_count = 2;
}

// =============================================================================
// Shell/Interactive Session Types
// =============================================================================

// Shell input for interactive sessions.
message ShellInput {
    // Input data.
    bytes data = 1;
    // Resize terminal.
    TerminalSize resize = 2;
}

// Shell output for interactive sessions.
message ShellOutput {
    // Output data.
    bytes data = 1;
    // Exit code (only set when done).
    int32 exit_code = 2;
    // Is this the final message.
    bool done = 3;
}

// Terminal size.
message TerminalSize {
    // Terminal width.
    uint32 width = 1;
    // Terminal height.
    uint32 height = 2;
}