diff --git a/containers.v b/containers.v index 545cce1..14d295f 100644 --- a/containers.v +++ b/containers.v @@ -1,6 +1,7 @@ module docker import time +import net.http import types { ContainerListItem } [params] diff --git a/images.v b/images.v index ec328bd..d879cd9 100644 --- a/images.v +++ b/images.v @@ -1,5 +1,6 @@ module docker +import net.http import types { Image } pub fn (mut d DockerConn) image_inspect(image string) !Image { @@ -11,8 +12,8 @@ pub fn (mut d DockerConn) image_inspect(image string) !Image { return data } -// image_pull pulls the given image:tag. -pub fn (mut d DockerConn) image_pull(image string, tag string) ! { +// pull_image pulls the given image:tag. +pub fn (mut d DockerConn) pull_image(image string, tag string) ! { d.request(.post, '/images/create', { 'fromImage': image 'tag': tag @@ -32,7 +33,7 @@ pub fn (mut d DockerConn) image_pull(image string, tag string) ! { } // create_image_from_container creates a new image from a container. -pub fn (mut d DockerConn) image_from_container(id string, repo string, tag string) !Image { +pub fn (mut d DockerConn) create_image_from_container(id string, repo string, tag string) !Image { d.request(.post, '/commit', { 'container': id 'repo': repo @@ -44,7 +45,7 @@ pub fn (mut d DockerConn) image_from_container(id string, repo string, tag strin } // remove_image removes the image with the given id. -pub fn (mut d DockerConn) image_remove(id string) ! { +pub fn (mut d DockerConn) remove_image(id string) ! { d.request(.delete, '/images/$id', {}) d.send()! d.read_response()! diff --git a/types/volume.v b/types/volume.v deleted file mode 100644 index 14bc012..0000000 --- a/types/volume.v +++ /dev/null @@ -1,22 +0,0 @@ -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] -} diff --git a/volumes.v b/volumes.v index 8442ef0..6ce9905 100644 --- a/volumes.v +++ b/volumes.v @@ -1,7 +1,26 @@ module docker +import net.http import time -import types { Volume } + +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] +} [params] pub struct VolumeListFilter {