diff options
Diffstat (limited to 'pkg/bindings')
-rw-r--r-- | pkg/bindings/bindings.go | 9 | ||||
-rw-r--r-- | pkg/bindings/containers.go | 8 |
2 files changed, 13 insertions, 4 deletions
diff --git a/pkg/bindings/bindings.go b/pkg/bindings/bindings.go new file mode 100644 index 000000000..e83c4a5e1 --- /dev/null +++ b/pkg/bindings/bindings.go @@ -0,0 +1,9 @@ +// Package bindings provides golang-based access +// to the Podman REST API. Users can then interact with API endpoints +// to manage containers, images, pods, etc. +// +// This package exposes a series of methods that allow users to firstly +// create their connection with the API endpoints. Once the connection +// is established, users can then manage the Podman container runtime. + +package bindings diff --git a/pkg/bindings/containers.go b/pkg/bindings/containers.go index 01f68f970..057580088 100644 --- a/pkg/bindings/containers.go +++ b/pkg/bindings/containers.go @@ -126,11 +126,11 @@ func (c Connection) ContainerExists(nameOrID string) (bool, error) { return false, nil } -func (c Connection) StopContainer(nameOrID string, timeout int) error { - // TODO we might need to distinguish whether a timeout is desired; a zero, the int - // zero value is valid; what do folks want to do? +func (c Connection) StopContainer(nameOrID string, timeout *int) error { params := make(map[string]string) - params["t"] = strconv.Itoa(timeout) + if timeout != nil { + params["t"] = strconv.Itoa(*timeout) + } response, err := c.newRequest(http.MethodPost, fmt.Sprintf("/containers/%s/stop", nameOrID), nil, params) if err != nil { return err |