Fully functional hardcoded build command

This commit is contained in:
Jef Roosens 2022-02-20 21:09:06 +01:00
parent 4f705f5fb5
commit 941b30e7d2
Signed by untrusted user: Jef Roosens
GPG key ID: B580B976584B5F30
5 changed files with 65 additions and 24 deletions

View file

@ -37,7 +37,32 @@ pub fn create_container(c &NewContainer) ?string {
pub fn start_container(id string) ?bool {
res := request('POST', urllib.parse('/containers/$id/start') ?) ?
println(res)
return res.status_code == 204
}
struct ContainerInspect {
pub:
state ContainerState [json: State]
}
struct ContainerState {
pub:
running bool [json: Running]
}
pub fn inspect_container(id string) ?ContainerInspect {
res := request('GET', urllib.parse('/containers/$id/json') ?) ?
if res.status_code != 200 {
return error("Failed to inspect container.")
}
return json.decode(ContainerInspect, res.text)
}
pub fn remove_container(id string) ?bool {
res := request('DELETE', urllib.parse('/containers/$id') ?) ?
return res.status_code == 204
}