feat: fully implemented volume_list
ci/woodpecker/push/lint Pipeline failed Details

jef
Jef Roosens 2022-06-18 22:48:09 +02:00
parent 843db9e3ec
commit 26357f47b5
Signed by: Jef Roosens
GPG Key ID: B75D4F293C7052DB
2 changed files with 22 additions and 6 deletions

View File

@ -61,7 +61,7 @@ reference](https://docs.docker.com/engine/api/v1.41/).
- [ ] Delete unused networks - [ ] Delete unused networks
* Volumes * Volumes
- [ ] List volumes - [*] List volumes
- [ ] Create a volume - [ ] Create a volume
- [ ] Inspect a volume - [ ] Inspect a volume
- [ ] Remove a volume - [ ] Remove a volume

View File

@ -5,11 +5,23 @@ import net.urllib
import json import json
import time import time
struct UsageData {
size int [json: Size]
ref_count int [json: RefCount]
}
struct Volume { struct Volume {
created_at_str string [json: CreatedAt]
pub mut:
name string [json: Name] name string [json: Name]
driver string [json: Driver] driver string [json: Driver]
mountpoint string [json: Mountpoint] mountpoint string [json: Mountpoint]
created_at time.Time [json: CreatedAt] created_at time.Time [skip]
status map[string]string [json: Status]
labels map[string]string [json: Labels]
scope string [json: Scope]
options map[string]string [json: Options]
usage_data UsageData [json: UsageData]
} }
struct VolumeListResponse { struct VolumeListResponse {
@ -27,7 +39,11 @@ pub fn (mut d DockerConn) volume_list() ?VolumeListResponse {
return error(data.message) return error(data.message)
} }
data := json.decode(VolumeListResponse, body)? mut data := json.decode(VolumeListResponse, body)?
for mut vol in data.volumes {
vol.created_at = time.parse_rfc3339(vol.created_at_str)?
}
return data return data
} }