summaryrefslogtreecommitdiff
path: root/pkg/bindings/system/info.go
diff options
context:
space:
mode:
authorBrent Baude <bbaude@redhat.com>2020-03-15 11:53:59 -0500
committerBrent Baude <bbaude@redhat.com>2020-04-06 12:45:42 -0500
commite20ecc733c878f0c4b67a21204f0d5ae11929bf0 (patch)
tree8686fd9c9f123cbed11f0589655caaa128b12061 /pkg/bindings/system/info.go
parente318b09b6800ddb013ddf3b9a2fb99ebc55bd920 (diff)
downloadpodman-e20ecc733c878f0c4b67a21204f0d5ae11929bf0.tar.gz
podman-e20ecc733c878f0c4b67a21204f0d5ae11929bf0.tar.bz2
podman-e20ecc733c878f0c4b67a21204f0d5ae11929bf0.zip
refactor info
the current implementation of info, while typed, is very loosely done so. we need stronger types for our apiv2 implmentation and bindings. Signed-off-by: Brent Baude <bbaude@redhat.com>
Diffstat (limited to 'pkg/bindings/system/info.go')
-rw-r--r--pkg/bindings/system/info.go23
1 files changed, 23 insertions, 0 deletions
diff --git a/pkg/bindings/system/info.go b/pkg/bindings/system/info.go
new file mode 100644
index 000000000..f8269cfd8
--- /dev/null
+++ b/pkg/bindings/system/info.go
@@ -0,0 +1,23 @@
+package system
+
+import (
+ "context"
+ "net/http"
+
+ "github.com/containers/libpod/libpod/define"
+ "github.com/containers/libpod/pkg/bindings"
+)
+
+// Info returns information about the libpod environment and its stores
+func Info(ctx context.Context) (define.Info, error) {
+ info := define.Info{}
+ conn, err := bindings.GetClient(ctx)
+ if err != nil {
+ return info, err
+ }
+ response, err := conn.DoRequest(nil, http.MethodGet, "/info", nil)
+ if err != nil {
+ return info, err
+ }
+ return info, response.Process(&info)
+}