Browse code

api: add Info struct for v1.24

Signed-off-by: Antonio Murdaca <runcom@redhat.com>

Antonio Murdaca authored on 2016/11/07 18:01:14
Showing 2 changed files
... ...
@@ -16,6 +16,7 @@ import (
16 16
 	"github.com/docker/docker/api/types/registry"
17 17
 	timetypes "github.com/docker/docker/api/types/time"
18 18
 	"github.com/docker/docker/api/types/versions"
19
+	"github.com/docker/docker/api/types/versions/v1p24"
19 20
 	"github.com/docker/docker/pkg/ioutils"
20 21
 	"golang.org/x/net/context"
21 22
 )
... ...
@@ -41,21 +42,16 @@ func (s *systemRouter) getInfo(ctx context.Context, w http.ResponseWriter, r *ht
41 41
 
42 42
 	if versions.LessThan(httputils.VersionFromContext(ctx), "1.25") {
43 43
 		// TODO: handle this conversion in engine-api
44
-		type oldInfo struct {
45
-			*types.InfoBase
46
-			ExecutionDriver string
47
-			SecurityOptions []string
48
-		}
49
-		old := &oldInfo{
44
+		oldInfo := &v1p24.Info{
50 45
 			InfoBase:        info.InfoBase,
51 46
 			ExecutionDriver: "<not supported>",
52 47
 		}
53 48
 		for _, s := range info.SecurityOptions {
54 49
 			if s.Key == "Name" {
55
-				old.SecurityOptions = append(old.SecurityOptions, s.Value)
50
+				oldInfo.SecurityOptions = append(oldInfo.SecurityOptions, s.Value)
56 51
 			}
57 52
 		}
58
-		return httputils.WriteJSON(w, http.StatusOK, old)
53
+		return httputils.WriteJSON(w, http.StatusOK, oldInfo)
59 54
 	}
60 55
 	return httputils.WriteJSON(w, http.StatusOK, info)
61 56
 }
62 57
new file mode 100644
... ...
@@ -0,0 +1,10 @@
0
+// Package v1p24 provides specific API types for the API version 1, patch 24.
1
+package v1p24
2
+
3
+import "github.com/docker/docker/api/types"
4
+
5
+type Info struct {
6
+	*types.InfoBase
7
+	ExecutionDriver string
8
+	SecurityOptions []string
9
+}