summaryrefslogtreecommitdiff
path: root/vendor/github.com/fsouza/go-dockerclient/system.go
diff options
context:
space:
mode:
authorValentin Rothberg <rothberg@redhat.com>2019-06-24 11:29:13 +0200
committerValentin Rothberg <rothberg@redhat.com>2019-06-24 13:20:59 +0200
commitd697456dc90adbaf68224ed7c115b38d5855e582 (patch)
tree5fd88c48b34e7bead0028fa97e39f43f03880642 /vendor/github.com/fsouza/go-dockerclient/system.go
parenta3211b73c62a9fcc13f09305bf629ef507b26d34 (diff)
downloadpodman-d697456dc90adbaf68224ed7c115b38d5855e582.tar.gz
podman-d697456dc90adbaf68224ed7c115b38d5855e582.tar.bz2
podman-d697456dc90adbaf68224ed7c115b38d5855e582.zip
migrate to go-modules
Signed-off-by: Valentin Rothberg <rothberg@redhat.com>
Diffstat (limited to 'vendor/github.com/fsouza/go-dockerclient/system.go')
-rw-r--r--vendor/github.com/fsouza/go-dockerclient/system.go72
1 files changed, 72 insertions, 0 deletions
diff --git a/vendor/github.com/fsouza/go-dockerclient/system.go b/vendor/github.com/fsouza/go-dockerclient/system.go
new file mode 100644
index 000000000..a43dfb5a2
--- /dev/null
+++ b/vendor/github.com/fsouza/go-dockerclient/system.go
@@ -0,0 +1,72 @@
+package docker
+
+import (
+ "context"
+ "encoding/json"
+)
+
+// VolumeUsageData represents usage data from the docker system api
+// More Info Here https://dockr.ly/2PNzQyO
+type VolumeUsageData struct {
+
+ // The number of containers referencing this volume. This field
+ // is set to `-1` if the reference-count is not available.
+ //
+ // Required: true
+ RefCount int64 `json:"RefCount"`
+
+ // Amount of disk space used by the volume (in bytes). This information
+ // is only available for volumes created with the `"local"` volume
+ // driver. For volumes created with other volume drivers, this field
+ // is set to `-1` ("not available")
+ //
+ // Required: true
+ Size int64 `json:"Size"`
+}
+
+// ImageSummary represents data about what images are
+// currently known to docker
+// More Info Here https://dockr.ly/2PNzQyO
+type ImageSummary struct {
+ Containers int64 `json:"Containers"`
+ Created int64 `json:"Created"`
+ ID string `json:"Id"`
+ Labels map[string]string `json:"Labels"`
+ ParentID string `json:"ParentId"`
+ RepoDigests []string `json:"RepoDigests"`
+ RepoTags []string `json:"RepoTags"`
+ SharedSize int64 `json:"SharedSize"`
+ Size int64 `json:"Size"`
+ VirtualSize int64 `json:"VirtualSize"`
+}
+
+// DiskUsage holds information about what docker is using disk space on.
+// More Info Here https://dockr.ly/2PNzQyO
+type DiskUsage struct {
+ LayersSize int64
+ Images []*ImageSummary
+ Containers []*APIContainers
+ Volumes []*Volume
+}
+
+// DiskUsageOptions only contains a context for canceling.
+type DiskUsageOptions struct {
+ Context context.Context
+}
+
+// DiskUsage returns a *DiskUsage describing what docker is using disk on.
+//
+// More Info Here https://dockr.ly/2PNzQyO
+func (c *Client) DiskUsage(opts DiskUsageOptions) (*DiskUsage, error) {
+ path := "/system/df"
+ resp, err := c.do("GET", path, doOptions{context: opts.Context})
+ if err != nil {
+ return nil, err
+ }
+ defer resp.Body.Close()
+ var du *DiskUsage
+ if err := json.NewDecoder(resp.Body).Decode(&du); err != nil {
+ return nil, err
+ }
+ return du, nil
+}