diff options
author | OpenShift Merge Robot <openshift-merge-robot@users.noreply.github.com> | 2020-10-29 18:15:24 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-10-29 18:15:24 +0100 |
commit | c8f0e1dab602ed94af95dc4f604f161696f249e0 (patch) | |
tree | 1d8fe4e091300aa7c2c6e61fcb1a509c382974b0 /vendor/github.com/fsouza/go-dockerclient/container_inspect.go | |
parent | e439aec4fa867cda0672079dac0fe394dfb3306c (diff) | |
parent | 65a618886efc48562e5b9ff99ca630c83622419b (diff) | |
download | podman-c8f0e1dab602ed94af95dc4f604f161696f249e0.tar.gz podman-c8f0e1dab602ed94af95dc4f604f161696f249e0.tar.bz2 podman-c8f0e1dab602ed94af95dc4f604f161696f249e0.zip |
Merge pull request #8146 from vrothberg/image-mounts
new "image" mount type
Diffstat (limited to 'vendor/github.com/fsouza/go-dockerclient/container_inspect.go')
-rw-r--r-- | vendor/github.com/fsouza/go-dockerclient/container_inspect.go | 54 |
1 files changed, 54 insertions, 0 deletions
diff --git a/vendor/github.com/fsouza/go-dockerclient/container_inspect.go b/vendor/github.com/fsouza/go-dockerclient/container_inspect.go new file mode 100644 index 000000000..e8091f739 --- /dev/null +++ b/vendor/github.com/fsouza/go-dockerclient/container_inspect.go @@ -0,0 +1,54 @@ +package docker + +import ( + "context" + "encoding/json" + "net/http" +) + +// InspectContainer returns information about a container by its ID. +// +// Deprecated: Use InspectContainerWithOptions instead. +func (c *Client) InspectContainer(id string) (*Container, error) { + return c.InspectContainerWithOptions(InspectContainerOptions{ID: id}) +} + +// InspectContainerWithContext returns information about a container by its ID. +// The context object can be used to cancel the inspect request. +// +// Deprecated: Use InspectContainerWithOptions instead. +//nolint:golint +func (c *Client) InspectContainerWithContext(id string, ctx context.Context) (*Container, error) { + return c.InspectContainerWithOptions(InspectContainerOptions{ID: id, Context: ctx}) +} + +// InspectContainerWithOptions returns information about a container by its ID. +// +// See https://goo.gl/FaI5JT for more details. +func (c *Client) InspectContainerWithOptions(opts InspectContainerOptions) (*Container, error) { + path := "/containers/" + opts.ID + "/json?" + queryString(opts) + resp, err := c.do(http.MethodGet, path, doOptions{ + context: opts.Context, + }) + if err != nil { + if e, ok := err.(*Error); ok && e.Status == http.StatusNotFound { + return nil, &NoSuchContainer{ID: opts.ID} + } + return nil, err + } + defer resp.Body.Close() + var container Container + if err := json.NewDecoder(resp.Body).Decode(&container); err != nil { + return nil, err + } + return &container, nil +} + +// InspectContainerOptions specifies parameters for InspectContainerWithOptions. +// +// See https://goo.gl/FaI5JT for more details. +type InspectContainerOptions struct { + Context context.Context + ID string `qs:"-"` + Size bool +} |