Compare commits

...

2 Commits

Author SHA1 Message Date
Jef Roosens 9258bb8146
refactor: moving some stuff
ci/woodpecker/push/lint Pipeline was successful Details
2023-01-05 13:11:41 +01:00
Jef Roosens 6b578a80cd
refactor: rename some image functions 2023-01-05 13:00:18 +01:00
4 changed files with 27 additions and 26 deletions

View File

@ -1,7 +1,6 @@
module docker
import time
import net.http
import types { ContainerListItem }
[params]

View File

@ -1,6 +1,5 @@
module docker
import net.http
import types { Image }
pub fn (mut d DockerConn) image_inspect(image string) !Image {
@ -12,8 +11,8 @@ pub fn (mut d DockerConn) image_inspect(image string) !Image {
return data
}
// pull_image pulls the given image:tag.
pub fn (mut d DockerConn) pull_image(image string, tag string) ! {
// image_pull pulls the given image:tag.
pub fn (mut d DockerConn) image_pull(image string, tag string) ! {
d.request(.post, '/images/create', {
'fromImage': image
'tag': tag
@ -33,7 +32,7 @@ pub fn (mut d DockerConn) pull_image(image string, tag string) ! {
}
// create_image_from_container creates a new image from a container.
pub fn (mut d DockerConn) create_image_from_container(id string, repo string, tag string) !Image {
pub fn (mut d DockerConn) image_from_container(id string, repo string, tag string) !Image {
d.request(.post, '/commit', {
'container': id
'repo': repo
@ -45,7 +44,7 @@ pub fn (mut d DockerConn) create_image_from_container(id string, repo string, ta
}
// remove_image removes the image with the given id.
pub fn (mut d DockerConn) remove_image(id string) ! {
pub fn (mut d DockerConn) image_remove(id string) ! {
d.request(.delete, '/images/$id', {})
d.send()!
d.read_response()!

22
types/volume.v 100644
View File

@ -0,0 +1,22 @@
module types
import time
pub struct UsageData {
size int [json: Size]
ref_count int [json: RefCount]
}
pub struct Volume {
pub mut:
created_at_str string [json: CreatedAt]
created_at time.Time [skip]
name string [json: Name]
driver string [json: Driver]
mountpoint string [json: Mountpoint]
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]
}

View File

@ -1,26 +1,7 @@
module docker
import net.http
import time
struct UsageData {
size int [json: Size]
ref_count int [json: RefCount]
}
struct Volume {
created_at_str string [json: CreatedAt]
pub mut:
created_at time.Time [skip]
name string [json: Name]
driver string [json: Driver]
mountpoint string [json: Mountpoint]
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]
}
import types { Volume }
[params]
pub struct VolumeListFilter {