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
use containers_api::opts::{Filter, FilterItem};
use containers_api::{impl_filter_func, impl_map_field, impl_opts_builder, impl_str_field};
impl_opts_builder!(url =>
VolumeList
);
#[derive(Debug)]
pub enum VolumeListFilter {
Driver(String),
LabelKey(String),
LabelKeyVal(String, String),
NoLabelKey(String),
NoLabelKeyVal(String, String),
Name(String),
Opt(String),
Until(String),
}
impl Filter for VolumeListFilter {
fn query_item(&self) -> FilterItem {
use VolumeListFilter::*;
match &self {
Driver(driver) => FilterItem::new("driver", driver.clone()),
LabelKey(key) => FilterItem::new("label", key.clone()),
LabelKeyVal(key, val) => FilterItem::new("label", format!("{}={}", key, val)),
NoLabelKey(key) => FilterItem::new("label!", key.clone()),
NoLabelKeyVal(key, val) => FilterItem::new("label!", format!("{}={}", key, val)),
Name(name) => FilterItem::new("name", name.clone()),
Opt(opt) => FilterItem::new("opt", opt.clone()),
Until(t) => FilterItem::new("until", t.clone()),
}
}
}
impl VolumeListOptsBuilder {
impl_filter_func!(VolumeListFilter);
}
impl_opts_builder!(json =>
VolumeCreate
);
impl VolumeCreateOptsBuilder {
impl_str_field!(
driver => "Driver"
);
impl_map_field!(json
labels => "Labels"
);
impl_str_field!(
name => "Name"
);
impl_map_field!(json
options => "Options"
);
}
impl_opts_builder!(url =>
VolumePrune
);
#[derive(Debug)]
pub enum VolumePruneFilter {
LabelKey(String),
LabelKeyVal(String, String),
NoLabelKey(String),
NoLabelKeyVal(String, String),
Until(String),
}
impl Filter for VolumePruneFilter {
fn query_item(&self) -> FilterItem {
use VolumePruneFilter::*;
match &self {
LabelKey(key) => FilterItem::new("label", key.clone()),
LabelKeyVal(key, val) => FilterItem::new("label", format!("{}={}", key, val)),
NoLabelKey(key) => FilterItem::new("label", key.clone()),
NoLabelKeyVal(key, val) => FilterItem::new("label", format!("{}={}", key, val)),
Until(t) => FilterItem::new("until", t.clone()),
}
}
}
impl VolumePruneOptsBuilder {
impl_filter_func!(VolumePruneFilter);
}