2022-06-22 09:15:00 +02:00
|
|
|
module docker
|
2022-06-18 22:17:52 +02:00
|
|
|
|
|
|
|
import time
|
2023-01-05 13:11:41 +01:00
|
|
|
import types { Volume }
|
2022-06-18 22:17:52 +02:00
|
|
|
|
2022-06-21 20:28:25 +02:00
|
|
|
[params]
|
|
|
|
pub struct VolumeListFilter {
|
|
|
|
dangling bool
|
|
|
|
driver string
|
|
|
|
labels []string
|
|
|
|
name string
|
|
|
|
}
|
|
|
|
|
2022-06-18 22:17:52 +02:00
|
|
|
struct VolumeListResponse {
|
|
|
|
volumes []Volume [json: Volumes]
|
|
|
|
warnings []string [json: Warnings]
|
|
|
|
}
|
|
|
|
|
2022-11-01 19:19:52 +01:00
|
|
|
pub fn (mut d DockerConn) volume_list() !VolumeListResponse {
|
2023-01-05 16:31:48 +01:00
|
|
|
d.request(.get, '/volumes')
|
2023-01-05 12:53:30 +01:00
|
|
|
d.send()!
|
2022-06-18 22:17:52 +02:00
|
|
|
|
2022-11-01 19:19:52 +01:00
|
|
|
mut data := d.read_json_response<VolumeListResponse>()!
|
2022-06-18 22:48:09 +02:00
|
|
|
|
|
|
|
for mut vol in data.volumes {
|
2022-11-01 19:19:52 +01:00
|
|
|
vol.created_at = time.parse_rfc3339(vol.created_at_str)!
|
2022-06-18 22:48:09 +02:00
|
|
|
}
|
2022-06-18 22:17:52 +02:00
|
|
|
|
|
|
|
return data
|
|
|
|
}
|