/
models.rs
6787 lines (5478 loc) · 261 KB
/
models.rs
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
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
#![allow(unused_imports, unused_qualifications, unused_extern_crates)]
use serde::{Deserialize, Serialize};
use serde::ser::Serializer;
use serde::de::{DeserializeOwned, Deserializer};
use std::cmp::Eq;
use std::collections::HashMap;
use std::default::Default;
use std::hash::Hash;
use time::OffsetDateTime;
fn deserialize_nonoptional_vec<'de, D: Deserializer<'de>, T: DeserializeOwned>(
d: D,
) -> Result<Vec<T>, D::Error> {
serde::Deserialize::deserialize(d).map(|x: Option<_>| x.unwrap_or(Vec::new()))
}
fn deserialize_nonoptional_map<'de, D: Deserializer<'de>, T: DeserializeOwned>(
d: D,
) -> Result<HashMap<String, T>, D::Error> {
serde::Deserialize::deserialize(d).map(|x: Option<_>| x.unwrap_or(HashMap::new()))
}
fn deserialize_timestamp<'de, D: Deserializer<'de>>(
d: D
) -> Result<Option<OffsetDateTime>, D::Error> {
let opt: Option<String> = serde::Deserialize::deserialize(d)?;
if let Some(s) = opt {
Ok(Some(
OffsetDateTime::parse(&s, &time::format_description::well_known::Rfc3339)
.map_err(|e| serde::de::Error::custom(format!("{:?}", e)))?,
))
} else {
Ok(None)
}
}
fn serialize_timestamp<S: Serializer>(date: &Option<OffsetDateTime>, s: S) -> Result<S::Ok, S::Error> {
match date {
Some(inner) => Ok(s.serialize_str(&inner.format(&time::format_description::well_known::Rfc3339)
.map_err(|e| serde::ser::Error::custom(format!("{:?}", e)))?)?),
None => Ok(s.serialize_str("")?)
}
}
/// Address represents an IPv4 or IPv6 IP address.
#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)]
pub struct Address {
/// IP address.
#[serde(rename = "Addr")]
#[serde(skip_serializing_if="Option::is_none")]
pub addr: Option<String>,
/// Mask length of the IP address.
#[serde(rename = "PrefixLen")]
#[serde(skip_serializing_if="Option::is_none")]
pub prefix_len: Option<i64>,
}
#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)]
pub struct AuthConfig {
#[serde(rename = "username")]
#[serde(skip_serializing_if="Option::is_none")]
pub username: Option<String>,
#[serde(rename = "password")]
#[serde(skip_serializing_if="Option::is_none")]
pub password: Option<String>,
#[serde(rename = "email")]
#[serde(skip_serializing_if="Option::is_none")]
pub email: Option<String>,
#[serde(rename = "serveraddress")]
#[serde(skip_serializing_if="Option::is_none")]
pub serveraddress: Option<String>,
}
/// Describes a permission accepted by the user upon installing the plugin.
#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)]
pub struct Body {
#[serde(rename = "Name")]
#[serde(skip_serializing_if="Option::is_none")]
pub name: Option<String>,
#[serde(rename = "Description")]
#[serde(skip_serializing_if="Option::is_none")]
pub description: Option<String>,
#[serde(rename = "Value")]
#[serde(skip_serializing_if="Option::is_none")]
pub value: Option<Vec<String>>,
}
#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)]
pub struct Body1 {
/// Listen address used for inter-manager communication, as well as determining the networking interface used for the VXLAN Tunnel Endpoint (VTEP). This can either be an address/port combination in the form `192.168.1.1:4567`, or an interface followed by a port number, like `eth0:4567`. If the port number is omitted, the default swarm listening port is used.
#[serde(rename = "ListenAddr")]
#[serde(skip_serializing_if="Option::is_none")]
pub listen_addr: Option<String>,
/// Externally reachable address advertised to other nodes. This can either be an address/port combination in the form `192.168.1.1:4567`, or an interface followed by a port number, like `eth0:4567`. If the port number is omitted, the port number from the listen address is used. If `AdvertiseAddr` is not specified, it will be automatically detected when possible.
#[serde(rename = "AdvertiseAddr")]
#[serde(skip_serializing_if="Option::is_none")]
pub advertise_addr: Option<String>,
/// Address or interface to use for data path traffic (format: `<ip|interface>`), for example, `192.168.1.1`, or an interface, like `eth0`. If `DataPathAddr` is unspecified, the same address as `AdvertiseAddr` is used. The `DataPathAddr` specifies the address that global scope network drivers will publish towards other nodes in order to reach the containers running on this node. Using this parameter it is possible to separate the container data traffic from the management traffic of the cluster.
#[serde(rename = "DataPathAddr")]
#[serde(skip_serializing_if="Option::is_none")]
pub data_path_addr: Option<String>,
/// DataPathPort specifies the data path port number for data traffic. Acceptable port range is 1024 to 49151. if no port is set or is set to 0, default port 4789 will be used.
#[serde(rename = "DataPathPort")]
#[serde(skip_serializing_if="Option::is_none")]
pub data_path_port: Option<u32>,
/// Default Address Pool specifies default subnet pools for global scope networks.
#[serde(rename = "DefaultAddrPool")]
#[serde(skip_serializing_if="Option::is_none")]
pub default_addr_pool: Option<Vec<String>>,
/// Force creation of a new swarm.
#[serde(rename = "ForceNewCluster")]
#[serde(skip_serializing_if="Option::is_none")]
pub force_new_cluster: Option<bool>,
/// SubnetSize specifies the subnet size of the networks created from the default subnet pool.
#[serde(rename = "SubnetSize")]
#[serde(skip_serializing_if="Option::is_none")]
pub subnet_size: Option<u32>,
#[serde(rename = "Spec")]
#[serde(skip_serializing_if="Option::is_none")]
pub spec: Option<SwarmSpec>,
}
#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)]
pub struct Body2 {
/// Listen address used for inter-manager communication if the node gets promoted to manager, as well as determining the networking interface used for the VXLAN Tunnel Endpoint (VTEP).
#[serde(rename = "ListenAddr")]
#[serde(skip_serializing_if="Option::is_none")]
pub listen_addr: Option<String>,
/// Externally reachable address advertised to other nodes. This can either be an address/port combination in the form `192.168.1.1:4567`, or an interface followed by a port number, like `eth0:4567`. If the port number is omitted, the port number from the listen address is used. If `AdvertiseAddr` is not specified, it will be automatically detected when possible.
#[serde(rename = "AdvertiseAddr")]
#[serde(skip_serializing_if="Option::is_none")]
pub advertise_addr: Option<String>,
/// Address or interface to use for data path traffic (format: `<ip|interface>`), for example, `192.168.1.1`, or an interface, like `eth0`. If `DataPathAddr` is unspecified, the same addres as `AdvertiseAddr` is used. The `DataPathAddr` specifies the address that global scope network drivers will publish towards other nodes in order to reach the containers running on this node. Using this parameter it is possible to separate the container data traffic from the management traffic of the cluster.
#[serde(rename = "DataPathAddr")]
#[serde(skip_serializing_if="Option::is_none")]
pub data_path_addr: Option<String>,
/// Addresses of manager nodes already participating in the swarm.
#[serde(rename = "RemoteAddrs")]
#[serde(skip_serializing_if="Option::is_none")]
pub remote_addrs: Option<Vec<String>>,
/// Secret token for joining this swarm.
#[serde(rename = "JoinToken")]
#[serde(skip_serializing_if="Option::is_none")]
pub join_token: Option<String>,
}
#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)]
pub struct Body3 {
/// The swarm's unlock key.
#[serde(rename = "UnlockKey")]
#[serde(skip_serializing_if="Option::is_none")]
pub unlock_key: Option<String>,
}
#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)]
pub struct BuildCache {
#[serde(rename = "ID")]
#[serde(skip_serializing_if="Option::is_none")]
pub id: Option<String>,
#[serde(rename = "Parent")]
#[serde(skip_serializing_if="Option::is_none")]
pub parent: Option<String>,
#[serde(rename = "Type")]
#[serde(skip_serializing_if="Option::is_none")]
pub typ: Option<String>,
#[serde(rename = "Description")]
#[serde(skip_serializing_if="Option::is_none")]
pub description: Option<String>,
#[serde(rename = "InUse")]
#[serde(skip_serializing_if="Option::is_none")]
pub in_use: Option<bool>,
#[serde(rename = "Shared")]
#[serde(skip_serializing_if="Option::is_none")]
pub shared: Option<bool>,
/// Amount of disk space used by the build cache (in bytes).
#[serde(rename = "Size")]
#[serde(skip_serializing_if="Option::is_none")]
pub size: Option<i64>,
/// Date and time at which the build cache was created in [RFC 3339](https://www.ietf.org/rfc/rfc3339.txt) format with nano-seconds.
#[serde(rename = "CreatedAt")]
#[serde(skip_serializing_if="Option::is_none")]
#[serde(default, deserialize_with = "deserialize_timestamp", serialize_with = "serialize_timestamp")]
pub created_at: Option<OffsetDateTime>,
/// Date and time at which the build cache was last used in [RFC 3339](https://www.ietf.org/rfc/rfc3339.txt) format with nano-seconds.
#[serde(rename = "LastUsedAt")]
#[serde(skip_serializing_if="Option::is_none")]
#[serde(default, deserialize_with = "deserialize_timestamp", serialize_with = "serialize_timestamp")]
pub last_used_at: Option<OffsetDateTime>,
#[serde(rename = "UsageCount")]
#[serde(skip_serializing_if="Option::is_none")]
pub usage_count: Option<i64>,
}
#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)]
pub struct BuildInfo {
#[serde(rename = "id")]
#[serde(skip_serializing_if="Option::is_none")]
pub id: Option<String>,
#[serde(rename = "stream")]
#[serde(skip_serializing_if="Option::is_none")]
pub stream: Option<String>,
#[serde(rename = "error")]
#[serde(skip_serializing_if="Option::is_none")]
pub error: Option<String>,
#[serde(rename = "errorDetail")]
#[serde(skip_serializing_if="Option::is_none")]
pub error_detail: Option<ErrorDetail>,
#[serde(rename = "status")]
#[serde(skip_serializing_if="Option::is_none")]
pub status: Option<String>,
#[serde(rename = "progress")]
#[serde(skip_serializing_if="Option::is_none")]
pub progress: Option<String>,
#[serde(rename = "progressDetail")]
#[serde(skip_serializing_if="Option::is_none")]
pub progress_detail: Option<ProgressDetail>,
#[serde(rename = "aux")]
#[serde(skip_serializing_if="Option::is_none")]
pub aux: Option<ImageId>,
}
#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)]
pub struct BuildPruneResponse {
#[serde(rename = "CachesDeleted")]
#[serde(skip_serializing_if="Option::is_none")]
pub caches_deleted: Option<Vec<String>>,
/// Disk space reclaimed in bytes
#[serde(rename = "SpaceReclaimed")]
#[serde(skip_serializing_if="Option::is_none")]
pub space_reclaimed: Option<i64>,
}
/// ClusterInfo represents information about the swarm as is returned by the \"/info\" endpoint. Join-tokens are not included.
#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)]
pub struct ClusterInfo {
/// The ID of the swarm.
#[serde(rename = "ID")]
#[serde(skip_serializing_if="Option::is_none")]
pub id: Option<String>,
#[serde(rename = "Version")]
#[serde(skip_serializing_if="Option::is_none")]
pub version: Option<ObjectVersion>,
/// Date and time at which the swarm was initialised in [RFC 3339](https://www.ietf.org/rfc/rfc3339.txt) format with nano-seconds.
#[serde(rename = "CreatedAt")]
#[serde(skip_serializing_if="Option::is_none")]
#[serde(default, deserialize_with = "deserialize_timestamp", serialize_with = "serialize_timestamp")]
pub created_at: Option<OffsetDateTime>,
/// Date and time at which the swarm was last updated in [RFC 3339](https://www.ietf.org/rfc/rfc3339.txt) format with nano-seconds.
#[serde(rename = "UpdatedAt")]
#[serde(skip_serializing_if="Option::is_none")]
#[serde(default, deserialize_with = "deserialize_timestamp", serialize_with = "serialize_timestamp")]
pub updated_at: Option<OffsetDateTime>,
#[serde(rename = "Spec")]
#[serde(skip_serializing_if="Option::is_none")]
pub spec: Option<SwarmSpec>,
#[serde(rename = "TLSInfo")]
#[serde(skip_serializing_if="Option::is_none")]
pub tls_info: Option<TlsInfo>,
/// Whether there is currently a root CA rotation in progress for the swarm
#[serde(rename = "RootRotationInProgress")]
#[serde(skip_serializing_if="Option::is_none")]
pub root_rotation_in_progress: Option<bool>,
/// DataPathPort specifies the data path port number for data traffic. Acceptable port range is 1024 to 49151. If no port is set or is set to 0, the default port (4789) is used.
#[serde(rename = "DataPathPort")]
#[serde(skip_serializing_if="Option::is_none")]
pub data_path_port: Option<u32>,
/// Default Address Pool specifies default subnet pools for global scope networks.
#[serde(rename = "DefaultAddrPool")]
#[serde(skip_serializing_if="Option::is_none")]
pub default_addr_pool: Option<Vec<String>>,
/// SubnetSize specifies the subnet size of the networks created from the default subnet pool.
#[serde(rename = "SubnetSize")]
#[serde(skip_serializing_if="Option::is_none")]
pub subnet_size: Option<u32>,
}
/// Commit holds the Git-commit (SHA1) that a binary was built from, as reported in the version-string of external tools, such as `containerd`, or `runC`.
#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)]
pub struct Commit {
/// Actual commit ID of external tool.
#[serde(rename = "ID")]
#[serde(skip_serializing_if="Option::is_none")]
pub id: Option<String>,
/// Commit ID of external tool expected by dockerd as set at build time.
#[serde(rename = "Expected")]
#[serde(skip_serializing_if="Option::is_none")]
pub expected: Option<String>,
}
#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)]
pub struct Config {
#[serde(rename = "ID")]
#[serde(skip_serializing_if="Option::is_none")]
pub id: Option<String>,
#[serde(rename = "Version")]
#[serde(skip_serializing_if="Option::is_none")]
pub version: Option<ObjectVersion>,
#[serde(rename = "CreatedAt")]
#[serde(skip_serializing_if="Option::is_none")]
#[serde(default, deserialize_with = "deserialize_timestamp", serialize_with = "serialize_timestamp")]
pub created_at: Option<OffsetDateTime>,
#[serde(rename = "UpdatedAt")]
#[serde(skip_serializing_if="Option::is_none")]
#[serde(default, deserialize_with = "deserialize_timestamp", serialize_with = "serialize_timestamp")]
pub updated_at: Option<OffsetDateTime>,
#[serde(rename = "Spec")]
#[serde(skip_serializing_if="Option::is_none")]
pub spec: Option<ConfigSpec>,
}
#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)]
pub struct ConfigSpec {
/// User-defined name of the config.
#[serde(rename = "Name")]
#[serde(skip_serializing_if="Option::is_none")]
pub name: Option<String>,
/// User-defined key/value metadata.
#[serde(rename = "Labels")]
#[serde(skip_serializing_if="Option::is_none")]
pub labels: Option<HashMap<String, String>>,
/// Base64-url-safe-encoded ([RFC 4648](https://tools.ietf.org/html/rfc4648#section-5)) config data.
#[serde(rename = "Data")]
#[serde(skip_serializing_if="Option::is_none")]
pub data: Option<String>,
/// Templating driver, if applicable Templating controls whether and how to evaluate the config payload as a template. If no driver is set, no templating is used.
#[serde(rename = "Templating")]
#[serde(skip_serializing_if="Option::is_none")]
pub templating: Option<Driver>,
}
#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)]
pub struct Container {
/// The ID or name of the container to connect to the network.
#[serde(rename = "Container")]
#[serde(skip_serializing_if="Option::is_none")]
pub container: Option<String>,
#[serde(rename = "EndpointConfig")]
#[serde(skip_serializing_if="Option::is_none")]
pub endpoint_config: Option<EndpointSettings>,
}
#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)]
pub struct Container1 {
/// The ID or name of the container to disconnect from the network.
#[serde(rename = "Container")]
#[serde(skip_serializing_if="Option::is_none")]
pub container: Option<String>,
/// Force the container to disconnect from the network.
#[serde(rename = "Force")]
#[serde(skip_serializing_if="Option::is_none")]
pub force: Option<bool>,
}
/// change item in response to ContainerChanges operation
#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)]
pub struct ContainerChangeResponseItem {
/// Path to file that has changed
#[serde(rename = "Path")]
pub path: String,
/// Kind of change
#[serde(rename = "Kind")]
pub kind: i64,
}
/// Configuration for a container that is portable between hosts
#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)]
pub struct ContainerConfig {
/// The hostname to use for the container, as a valid RFC 1123 hostname.
#[serde(rename = "Hostname")]
#[serde(skip_serializing_if="Option::is_none")]
pub hostname: Option<String>,
/// The domain name to use for the container.
#[serde(rename = "Domainname")]
#[serde(skip_serializing_if="Option::is_none")]
pub domainname: Option<String>,
/// The user that commands are run as inside the container.
#[serde(rename = "User")]
#[serde(skip_serializing_if="Option::is_none")]
pub user: Option<String>,
/// Whether to attach to `stdin`.
#[serde(rename = "AttachStdin")]
#[serde(skip_serializing_if="Option::is_none")]
pub attach_stdin: Option<bool>,
/// Whether to attach to `stdout`.
#[serde(rename = "AttachStdout")]
#[serde(skip_serializing_if="Option::is_none")]
pub attach_stdout: Option<bool>,
/// Whether to attach to `stderr`.
#[serde(rename = "AttachStderr")]
#[serde(skip_serializing_if="Option::is_none")]
pub attach_stderr: Option<bool>,
/// An object mapping ports to an empty object in the form: `{\"<port>/<tcp|udp|sctp>\": {}}`
#[serde(rename = "ExposedPorts")]
#[serde(skip_serializing_if="Option::is_none")]
pub exposed_ports: Option<HashMap<String, HashMap<(), ()>>>,
/// Attach standard streams to a TTY, including `stdin` if it is not closed.
#[serde(rename = "Tty")]
#[serde(skip_serializing_if="Option::is_none")]
pub tty: Option<bool>,
/// Open `stdin`
#[serde(rename = "OpenStdin")]
#[serde(skip_serializing_if="Option::is_none")]
pub open_stdin: Option<bool>,
/// Close `stdin` after one attached client disconnects
#[serde(rename = "StdinOnce")]
#[serde(skip_serializing_if="Option::is_none")]
pub stdin_once: Option<bool>,
/// A list of environment variables to set inside the container in the form `[\"VAR=value\", ...]`. A variable without `=` is removed from the environment, rather than to have an empty value.
#[serde(rename = "Env")]
#[serde(skip_serializing_if="Option::is_none")]
pub env: Option<Vec<String>>,
/// Command to run specified as a string or an array of strings.
#[serde(rename = "Cmd")]
#[serde(skip_serializing_if="Option::is_none")]
pub cmd: Option<Vec<String>>,
#[serde(rename = "Healthcheck")]
#[serde(skip_serializing_if="Option::is_none")]
pub healthcheck: Option<HealthConfig>,
/// Command is already escaped (Windows only)
#[serde(rename = "ArgsEscaped")]
#[serde(skip_serializing_if="Option::is_none")]
pub args_escaped: Option<bool>,
/// The name of the image to use when creating the container/
#[serde(rename = "Image")]
#[serde(skip_serializing_if="Option::is_none")]
pub image: Option<String>,
/// An object mapping mount point paths inside the container to empty objects.
#[serde(rename = "Volumes")]
#[serde(skip_serializing_if="Option::is_none")]
pub volumes: Option<HashMap<String, HashMap<(), ()>>>,
/// The working directory for commands to run in.
#[serde(rename = "WorkingDir")]
#[serde(skip_serializing_if="Option::is_none")]
pub working_dir: Option<String>,
/// The entry point for the container as a string or an array of strings. If the array consists of exactly one empty string (`[\"\"]`) then the entry point is reset to system default (i.e., the entry point used by docker when there is no `ENTRYPOINT` instruction in the `Dockerfile`).
#[serde(rename = "Entrypoint")]
#[serde(skip_serializing_if="Option::is_none")]
pub entrypoint: Option<Vec<String>>,
/// Disable networking for the container.
#[serde(rename = "NetworkDisabled")]
#[serde(skip_serializing_if="Option::is_none")]
pub network_disabled: Option<bool>,
/// MAC address of the container.
#[serde(rename = "MacAddress")]
#[serde(skip_serializing_if="Option::is_none")]
pub mac_address: Option<String>,
/// `ONBUILD` metadata that were defined in the image's `Dockerfile`.
#[serde(rename = "OnBuild")]
#[serde(skip_serializing_if="Option::is_none")]
pub on_build: Option<Vec<String>>,
/// User-defined key/value metadata.
#[serde(rename = "Labels")]
#[serde(skip_serializing_if="Option::is_none")]
pub labels: Option<HashMap<String, String>>,
/// Signal to stop a container as a string or unsigned integer.
#[serde(rename = "StopSignal")]
#[serde(skip_serializing_if="Option::is_none")]
pub stop_signal: Option<String>,
/// Timeout to stop a container in seconds.
#[serde(rename = "StopTimeout")]
#[serde(skip_serializing_if="Option::is_none")]
pub stop_timeout: Option<i64>,
/// Shell for when `RUN`, `CMD`, and `ENTRYPOINT` uses a shell.
#[serde(rename = "Shell")]
#[serde(skip_serializing_if="Option::is_none")]
pub shell: Option<Vec<String>>,
}
/// OK response to ContainerCreate operation
#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)]
pub struct ContainerCreateResponse {
/// The ID of the created container
#[serde(rename = "Id")]
pub id: String,
/// Warnings encountered when creating the container
#[serde(rename = "Warnings")]
#[serde(deserialize_with = "deserialize_nonoptional_vec")]
pub warnings: Vec<String>,
}
#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)]
pub struct ContainerInspectResponse {
/// The ID of the container
#[serde(rename = "Id")]
#[serde(skip_serializing_if="Option::is_none")]
pub id: Option<String>,
/// The time the container was created
#[serde(rename = "Created")]
#[serde(skip_serializing_if="Option::is_none")]
pub created: Option<String>,
/// The path to the command being run
#[serde(rename = "Path")]
#[serde(skip_serializing_if="Option::is_none")]
pub path: Option<String>,
/// The arguments to the command being run
#[serde(rename = "Args")]
#[serde(skip_serializing_if="Option::is_none")]
pub args: Option<Vec<String>>,
#[serde(rename = "State")]
#[serde(skip_serializing_if="Option::is_none")]
pub state: Option<ContainerState>,
/// The container's image ID
#[serde(rename = "Image")]
#[serde(skip_serializing_if="Option::is_none")]
pub image: Option<String>,
#[serde(rename = "ResolvConfPath")]
#[serde(skip_serializing_if="Option::is_none")]
pub resolv_conf_path: Option<String>,
#[serde(rename = "HostnamePath")]
#[serde(skip_serializing_if="Option::is_none")]
pub hostname_path: Option<String>,
#[serde(rename = "HostsPath")]
#[serde(skip_serializing_if="Option::is_none")]
pub hosts_path: Option<String>,
#[serde(rename = "LogPath")]
#[serde(skip_serializing_if="Option::is_none")]
pub log_path: Option<String>,
#[serde(rename = "Name")]
#[serde(skip_serializing_if="Option::is_none")]
pub name: Option<String>,
#[serde(rename = "RestartCount")]
#[serde(skip_serializing_if="Option::is_none")]
pub restart_count: Option<i64>,
#[serde(rename = "Driver")]
#[serde(skip_serializing_if="Option::is_none")]
pub driver: Option<String>,
#[serde(rename = "Platform")]
#[serde(skip_serializing_if="Option::is_none")]
pub platform: Option<String>,
#[serde(rename = "MountLabel")]
#[serde(skip_serializing_if="Option::is_none")]
pub mount_label: Option<String>,
#[serde(rename = "ProcessLabel")]
#[serde(skip_serializing_if="Option::is_none")]
pub process_label: Option<String>,
#[serde(rename = "AppArmorProfile")]
#[serde(skip_serializing_if="Option::is_none")]
pub app_armor_profile: Option<String>,
/// IDs of exec instances that are running in the container.
#[serde(rename = "ExecIDs")]
#[serde(skip_serializing_if="Option::is_none")]
pub exec_ids: Option<Vec<String>>,
#[serde(rename = "HostConfig")]
#[serde(skip_serializing_if="Option::is_none")]
pub host_config: Option<HostConfig>,
#[serde(rename = "GraphDriver")]
#[serde(skip_serializing_if="Option::is_none")]
pub graph_driver: Option<GraphDriverData>,
/// The size of files that have been created or changed by this container.
#[serde(rename = "SizeRw")]
#[serde(skip_serializing_if="Option::is_none")]
pub size_rw: Option<i64>,
/// The total size of all the files in this container.
#[serde(rename = "SizeRootFs")]
#[serde(skip_serializing_if="Option::is_none")]
pub size_root_fs: Option<i64>,
#[serde(rename = "Mounts")]
#[serde(skip_serializing_if="Option::is_none")]
pub mounts: Option<Vec<MountPoint>>,
#[serde(rename = "Config")]
#[serde(skip_serializing_if="Option::is_none")]
pub config: Option<ContainerConfig>,
#[serde(rename = "NetworkSettings")]
#[serde(skip_serializing_if="Option::is_none")]
pub network_settings: Option<NetworkSettings>,
}
#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)]
pub struct ContainerPruneResponse {
/// Container IDs that were deleted
#[serde(rename = "ContainersDeleted")]
#[serde(skip_serializing_if="Option::is_none")]
pub containers_deleted: Option<Vec<String>>,
/// Disk space reclaimed in bytes
#[serde(rename = "SpaceReclaimed")]
#[serde(skip_serializing_if="Option::is_none")]
pub space_reclaimed: Option<i64>,
}
/// ContainerState stores container's running state. It's part of ContainerJSONBase and will be returned by the \"inspect\" command.
#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)]
pub struct ContainerState {
/// String representation of the container state. Can be one of \"created\", \"running\", \"paused\", \"restarting\", \"removing\", \"exited\", or \"dead\".
#[serde(rename = "Status")]
#[serde(skip_serializing_if="Option::is_none")]
pub status: Option<ContainerStateStatusEnum>,
/// Whether this container is running. Note that a running container can be _paused_. The `Running` and `Paused` booleans are not mutually exclusive: When pausing a container (on Linux), the freezer cgroup is used to suspend all processes in the container. Freezing the process requires the process to be running. As a result, paused containers are both `Running` _and_ `Paused`. Use the `Status` field instead to determine if a container's state is \"running\".
#[serde(rename = "Running")]
#[serde(skip_serializing_if="Option::is_none")]
pub running: Option<bool>,
/// Whether this container is paused.
#[serde(rename = "Paused")]
#[serde(skip_serializing_if="Option::is_none")]
pub paused: Option<bool>,
/// Whether this container is restarting.
#[serde(rename = "Restarting")]
#[serde(skip_serializing_if="Option::is_none")]
pub restarting: Option<bool>,
/// Whether this container has been killed because it ran out of memory.
#[serde(rename = "OOMKilled")]
#[serde(skip_serializing_if="Option::is_none")]
pub oom_killed: Option<bool>,
#[serde(rename = "Dead")]
#[serde(skip_serializing_if="Option::is_none")]
pub dead: Option<bool>,
/// The process ID of this container
#[serde(rename = "Pid")]
#[serde(skip_serializing_if="Option::is_none")]
pub pid: Option<i64>,
/// The last exit code of this container
#[serde(rename = "ExitCode")]
#[serde(skip_serializing_if="Option::is_none")]
pub exit_code: Option<i64>,
#[serde(rename = "Error")]
#[serde(skip_serializing_if="Option::is_none")]
pub error: Option<String>,
/// The time when this container was last started.
#[serde(rename = "StartedAt")]
#[serde(skip_serializing_if="Option::is_none")]
pub started_at: Option<String>,
/// The time when this container last exited.
#[serde(rename = "FinishedAt")]
#[serde(skip_serializing_if="Option::is_none")]
pub finished_at: Option<String>,
#[serde(rename = "Health")]
#[serde(skip_serializing_if="Option::is_none")]
pub health: Option<Health>,
}
#[allow(non_camel_case_types)]
#[derive(Debug, Clone, Copy, PartialEq, PartialOrd, Serialize, Deserialize, Eq, Ord)]
pub enum ContainerStateStatusEnum {
#[serde(rename = "")]
EMPTY,
#[serde(rename = "created")]
CREATED,
#[serde(rename = "running")]
RUNNING,
#[serde(rename = "paused")]
PAUSED,
#[serde(rename = "restarting")]
RESTARTING,
#[serde(rename = "removing")]
REMOVING,
#[serde(rename = "exited")]
EXITED,
#[serde(rename = "dead")]
DEAD,
}
impl ::std::fmt::Display for ContainerStateStatusEnum {
fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result {
match *self {
ContainerStateStatusEnum::EMPTY => write!(f, ""),
ContainerStateStatusEnum::CREATED => write!(f, "{}", "created"),
ContainerStateStatusEnum::RUNNING => write!(f, "{}", "running"),
ContainerStateStatusEnum::PAUSED => write!(f, "{}", "paused"),
ContainerStateStatusEnum::RESTARTING => write!(f, "{}", "restarting"),
ContainerStateStatusEnum::REMOVING => write!(f, "{}", "removing"),
ContainerStateStatusEnum::EXITED => write!(f, "{}", "exited"),
ContainerStateStatusEnum::DEAD => write!(f, "{}", "dead"),
}
}
}
impl ::std::str::FromStr for ContainerStateStatusEnum {
type Err = String;
fn from_str(s: &str) -> Result<Self, Self::Err> {
match s {
"" => Ok(ContainerStateStatusEnum::EMPTY),
"created" => Ok(ContainerStateStatusEnum::CREATED),
"running" => Ok(ContainerStateStatusEnum::RUNNING),
"paused" => Ok(ContainerStateStatusEnum::PAUSED),
"restarting" => Ok(ContainerStateStatusEnum::RESTARTING),
"removing" => Ok(ContainerStateStatusEnum::REMOVING),
"exited" => Ok(ContainerStateStatusEnum::EXITED),
"dead" => Ok(ContainerStateStatusEnum::DEAD),
x => Err(format!("Invalid enum type: {}", x)),
}
}
}
impl ::std::convert::AsRef<str> for ContainerStateStatusEnum {
fn as_ref(&self) -> &str {
match self {
ContainerStateStatusEnum::EMPTY => "",
ContainerStateStatusEnum::CREATED => "created",
ContainerStateStatusEnum::RUNNING => "running",
ContainerStateStatusEnum::PAUSED => "paused",
ContainerStateStatusEnum::RESTARTING => "restarting",
ContainerStateStatusEnum::REMOVING => "removing",
ContainerStateStatusEnum::EXITED => "exited",
ContainerStateStatusEnum::DEAD => "dead",
}
}
}
pub type ContainerSummary = ContainerSummaryInner;
#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)]
pub struct ContainerSummaryInner {
/// The ID of this container
#[serde(rename = "Id")]
#[serde(skip_serializing_if="Option::is_none")]
pub id: Option<String>,
/// The names that this container has been given
#[serde(rename = "Names")]
#[serde(skip_serializing_if="Option::is_none")]
pub names: Option<Vec<String>>,
/// The name of the image used when creating this container
#[serde(rename = "Image")]
#[serde(skip_serializing_if="Option::is_none")]
pub image: Option<String>,
/// The ID of the image that this container was created from
#[serde(rename = "ImageID")]
#[serde(skip_serializing_if="Option::is_none")]
pub image_id: Option<String>,
/// Command to run when starting the container
#[serde(rename = "Command")]
#[serde(skip_serializing_if="Option::is_none")]
pub command: Option<String>,
/// When the container was created
#[serde(rename = "Created")]
#[serde(skip_serializing_if="Option::is_none")]
pub created: Option<i64>,
/// The ports exposed by this container
#[serde(rename = "Ports")]
#[serde(skip_serializing_if="Option::is_none")]
pub ports: Option<Vec<Port>>,
/// The size of files that have been created or changed by this container
#[serde(rename = "SizeRw")]
#[serde(skip_serializing_if="Option::is_none")]
pub size_rw: Option<i64>,
/// The total size of all the files in this container
#[serde(rename = "SizeRootFs")]
#[serde(skip_serializing_if="Option::is_none")]
pub size_root_fs: Option<i64>,
/// User-defined key/value metadata.
#[serde(rename = "Labels")]
#[serde(skip_serializing_if="Option::is_none")]
pub labels: Option<HashMap<String, String>>,
/// The state of this container (e.g. `Exited`)
#[serde(rename = "State")]
#[serde(skip_serializing_if="Option::is_none")]
pub state: Option<String>,
/// Additional human-readable status of this container (e.g. `Exit 0`)
#[serde(rename = "Status")]
#[serde(skip_serializing_if="Option::is_none")]
pub status: Option<String>,
#[serde(rename = "HostConfig")]
#[serde(skip_serializing_if="Option::is_none")]
pub host_config: Option<ContainerSummaryInnerHostConfig>,
#[serde(rename = "NetworkSettings")]
#[serde(skip_serializing_if="Option::is_none")]
pub network_settings: Option<ContainerSummaryInnerNetworkSettings>,
#[serde(rename = "Mounts")]
#[serde(skip_serializing_if="Option::is_none")]
pub mounts: Option<Vec<Mount>>,
}
#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)]
pub struct ContainerSummaryInnerHostConfig {
#[serde(rename = "NetworkMode")]
#[serde(skip_serializing_if="Option::is_none")]
pub network_mode: Option<String>,
}
/// A summary of the container's network settings
#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)]
pub struct ContainerSummaryInnerNetworkSettings {
#[serde(rename = "Networks")]
#[serde(skip_serializing_if="Option::is_none")]
pub networks: Option<HashMap<String, EndpointSettings>>,
}
/// OK response to ContainerTop operation
#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)]
pub struct ContainerTopResponse {
/// The ps column titles
#[serde(rename = "Titles")]
#[serde(skip_serializing_if="Option::is_none")]
pub titles: Option<Vec<String>>,
/// Each process running in the container, where each is process is an array of values corresponding to the titles.
#[serde(rename = "Processes")]
#[serde(skip_serializing_if="Option::is_none")]
pub processes: Option<Vec<Vec<String>>>,
}
/// OK response to ContainerUpdate operation
#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)]
pub struct ContainerUpdateResponse {
#[serde(rename = "Warnings")]
#[serde(skip_serializing_if="Option::is_none")]
pub warnings: Option<Vec<String>>,
}
/// OK response to ContainerWait operation
#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)]
pub struct ContainerWaitResponse {
/// Exit code of the container
#[serde(rename = "StatusCode")]
pub status_code: i64,
#[serde(rename = "Error")]
#[serde(skip_serializing_if="Option::is_none")]
pub error: Option<ContainerWaitResponseError>,
}
/// container waiting error, if any
#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)]
pub struct ContainerWaitResponseError {
/// Details of an error
#[serde(rename = "Message")]
#[serde(skip_serializing_if="Option::is_none")]
pub message: Option<String>,
}
#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)]
pub struct CreateImageInfo {
#[serde(rename = "id")]
#[serde(skip_serializing_if="Option::is_none")]
pub id: Option<String>,
#[serde(rename = "error")]
#[serde(skip_serializing_if="Option::is_none")]
pub error: Option<String>,
#[serde(rename = "status")]
#[serde(skip_serializing_if="Option::is_none")]
pub status: Option<String>,
#[serde(rename = "progress")]
#[serde(skip_serializing_if="Option::is_none")]
pub progress: Option<String>,
#[serde(rename = "progressDetail")]