Browse code

Merge pull request #28409 from dnephin/swagger-gen-more

Generate more types from the swagger spec

Alexander Morozov authored on 2017/01/27 03:35:34
Showing 25 changed files
... ...
@@ -53,7 +53,7 @@ type monitorBackend interface {
53 53
 	ContainerInspect(name string, size bool, version string) (interface{}, error)
54 54
 	ContainerLogs(ctx context.Context, name string, config *backend.ContainerLogsConfig, started chan struct{}) error
55 55
 	ContainerStats(ctx context.Context, name string, config *backend.ContainerStatsConfig) error
56
-	ContainerTop(name string, psArgs string) (*types.ContainerProcessList, error)
56
+	ContainerTop(name string, psArgs string) (*container.ContainerTopOKBody, error)
57 57
 
58 58
 	Containers(config *types.ContainerListOptions) ([]*types.Container, error)
59 59
 }
... ...
@@ -6,6 +6,7 @@ import (
6 6
 	"github.com/docker/docker/api/types"
7 7
 	"github.com/docker/docker/api/types/backend"
8 8
 	"github.com/docker/docker/api/types/filters"
9
+	"github.com/docker/docker/api/types/image"
9 10
 	"github.com/docker/docker/api/types/registry"
10 11
 	"golang.org/x/net/context"
11 12
 )
... ...
@@ -24,8 +25,8 @@ type containerBackend interface {
24 24
 }
25 25
 
26 26
 type imageBackend interface {
27
-	ImageDelete(imageRef string, force, prune bool) ([]types.ImageDelete, error)
28
-	ImageHistory(imageName string) ([]*types.ImageHistory, error)
27
+	ImageDelete(imageRef string, force, prune bool) ([]types.ImageDeleteResponseItem, error)
28
+	ImageHistory(imageName string) ([]*image.HistoryResponseItem, error)
29 29
 	Images(imageFilters filters.Args, all bool, withExtraAttrs bool) ([]*types.ImageSummary, error)
30 30
 	LookupImage(name string) (*types.ImageInspect, error)
31 31
 	TagImage(imageName, repository, tag string) error
... ...
@@ -829,22 +829,40 @@ definitions:
829 829
         items:
830 830
           $ref: "#/definitions/Port"
831 831
 
832
-  GraphDriver:
833
-    description: "Information about this container's graph driver."
832
+  GraphDriverData:
833
+    description: "Information about a container's graph driver."
834 834
     type: "object"
835
+    required: [Name, Data]
835 836
     properties:
836 837
       Name:
837 838
         type: "string"
839
+        x-nullable: false
838 840
       Data:
839 841
         type: "object"
842
+        x-nullable: false
840 843
         additionalProperties:
841 844
           type: "string"
842 845
 
843 846
   Image:
844 847
     type: "object"
848
+    required:
849
+      - Id
850
+      - Parent
851
+      - Comment
852
+      - Created
853
+      - Container
854
+      - DockerVersion
855
+      - Author
856
+      - Architecture
857
+      - Os
858
+      - Size
859
+      - VirtualSize
860
+      - GraphDriver
861
+      - RootFS
845 862
     properties:
846 863
       Id:
847 864
         type: "string"
865
+        x-nullable: false
848 866
       RepoTags:
849 867
         type: "array"
850 868
         items:
... ...
@@ -855,37 +873,51 @@ definitions:
855 855
           type: "string"
856 856
       Parent:
857 857
         type: "string"
858
+        x-nullable: false
858 859
       Comment:
859 860
         type: "string"
861
+        x-nullable: false
860 862
       Created:
861 863
         type: "string"
864
+        x-nullable: false
862 865
       Container:
863 866
         type: "string"
867
+        x-nullable: false
864 868
       ContainerConfig:
865 869
         $ref: "#/definitions/Config"
866 870
       DockerVersion:
867 871
         type: "string"
872
+        x-nullable: false
868 873
       Author:
869 874
         type: "string"
875
+        x-nullable: false
870 876
       Config:
871 877
         $ref: "#/definitions/Config"
872 878
       Architecture:
873 879
         type: "string"
880
+        x-nullable: false
874 881
       Os:
875 882
         type: "string"
883
+        x-nullable: false
884
+      OsVersion:
885
+        type: "string"
876 886
       Size:
877 887
         type: "integer"
878 888
         format: "int64"
889
+        x-nullable: false
879 890
       VirtualSize:
880 891
         type: "integer"
881 892
         format: "int64"
893
+        x-nullable: false
882 894
       GraphDriver:
883
-        $ref: "#/definitions/GraphDriver"
895
+        $ref: "#/definitions/GraphDriverData"
884 896
       RootFS:
885 897
         type: "object"
898
+        required: [Type]
886 899
         properties:
887 900
           Type:
888 901
             type: "string"
902
+            x-nullable: false
889 903
           Layers:
890 904
             type: "array"
891 905
             items:
... ...
@@ -2302,7 +2334,7 @@ definitions:
2302 2302
           -
2303 2303
             NetworkID: "4qvuz4ko70xaltuqbt8956gd1"
2304 2304
             Addr: "10.255.0.3/16"
2305
-  ImageDeleteResponse:
2305
+  ImageDeleteResponseItem:
2306 2306
     type: "object"
2307 2307
     properties:
2308 2308
       Untagged:
... ...
@@ -2899,7 +2931,7 @@ paths:
2899 2899
               HostConfig:
2900 2900
                 $ref: "#/definitions/HostConfig"
2901 2901
               GraphDriver:
2902
-                $ref: "#/definitions/GraphDriver"
2902
+                $ref: "#/definitions/GraphDriverData"
2903 2903
               SizeRw:
2904 2904
                 description: "The size of files that have been created or changed by this container."
2905 2905
                 type: "integer"
... ...
@@ -3231,32 +3263,34 @@ paths:
3231 3231
     get:
3232 3232
       summary: "Get changes on a container’s filesystem"
3233 3233
       description: |
3234
-        Returns which files in a container's filesystem have been added, deleted, or modified. The `Kind` of modification can be one of:
3234
+        Returns which files in a container's filesystem have been added, deleted,
3235
+        or modified. The `Kind` of modification can be one of:
3235 3236
 
3236 3237
         - `0`: Modified
3237 3238
         - `1`: Added
3238 3239
         - `2`: Deleted
3239 3240
       operationId: "ContainerChanges"
3240
-      produces:
3241
-        - "application/json"
3241
+      produces: ["application/json"]
3242 3242
       responses:
3243 3243
         200:
3244
-          description: "no error"
3244
+          description: "The list of changes"
3245 3245
           schema:
3246 3246
             type: "array"
3247 3247
             items:
3248 3248
               type: "object"
3249
+              x-go-name: "ContainerChangeResponseItem"
3250
+              required: [Path, Kind]
3249 3251
               properties:
3250 3252
                 Path:
3251 3253
                   description: "Path to file that has changed"
3252 3254
                   type: "string"
3255
+                  x-nullable: false
3253 3256
                 Kind:
3254 3257
                   description: "Kind of change"
3255 3258
                   type: "integer"
3256
-                  enum:
3257
-                    - 0
3258
-                    - 1
3259
-                    - 2
3259
+                  format: "uint8"
3260
+                  enum: [0, 1, 2]
3261
+                  x-nullable: false
3260 3262
           examples:
3261 3263
             application/json:
3262 3264
               - Path: "/dev"
... ...
@@ -3315,12 +3349,14 @@ paths:
3315 3315
     get:
3316 3316
       summary: "Get container stats based on resource usage"
3317 3317
       description: |
3318
-        This endpoint returns a live stream of a container’s resource usage statistics.
3318
+        This endpoint returns a live stream of a container’s resource usage
3319
+        statistics.
3319 3320
 
3320
-        The `precpu_stats` is the CPU statistic of last read, which is used for calculating the CPU usage percentage. It is not the same as the `cpu_stats` field.
3321
+        The `precpu_stats` is the CPU statistic of last read, which is used
3322
+        for calculating the CPU usage percentage. It is not the same as the
3323
+        `cpu_stats` field.
3321 3324
       operationId: "ContainerStats"
3322
-      produces:
3323
-        - "application/json"
3325
+      produces: ["application/json"]
3324 3326
       responses:
3325 3327
         200:
3326 3328
           description: "no error"
... ...
@@ -4042,7 +4078,7 @@ paths:
4042 4042
     head:
4043 4043
       summary: "Get information about files in a container"
4044 4044
       description: "A response header `X-Docker-Container-Path-Stat` is return containing a base64 - encoded JSON object with some filesystem header information about the path."
4045
-      operationId: "ContainerArchiveHead"
4045
+      operationId: "ContainerArchiveInfo"
4046 4046
       responses:
4047 4047
         200:
4048 4048
           description: "no error"
... ...
@@ -4087,9 +4123,8 @@ paths:
4087 4087
     get:
4088 4088
       summary: "Get an archive of a filesystem resource in a container"
4089 4089
       description: "Get a tar archive of a resource in the filesystem of container id."
4090
-      operationId: "ContainerGetArchive"
4091
-      produces:
4092
-        - "application/x-tar"
4090
+      operationId: "ContainerArchive"
4091
+      produces: ["application/x-tar"]
4093 4092
       responses:
4094 4093
         200:
4095 4094
           description: "no error"
... ...
@@ -4130,10 +4165,8 @@ paths:
4130 4130
     put:
4131 4131
       summary: "Extract an archive of files or folders to a directory in a container"
4132 4132
       description: "Upload a tar archive to be extracted to a path in the filesystem of container id."
4133
-      operationId: "ContainerPutArchive"
4134
-      consumes:
4135
-        - "application/x-tar"
4136
-        - "application/octet-stream"
4133
+      operationId: "PutContainerArchive"
4134
+      consumes: ["application/x-tar", "application/octet-stream"]
4137 4135
       responses:
4138 4136
         200:
4139 4137
           description: "The content was extracted successfully"
... ...
@@ -4533,6 +4566,7 @@ paths:
4533 4533
               Created: "2015-09-10T08:30:53.26995814Z"
4534 4534
               GraphDriver:
4535 4535
                 Name: "aufs"
4536
+                Data: {}
4536 4537
               RepoDigests:
4537 4538
                 - "localhost:5000/test/busybox/example@sha256:cbbf2f9a99b47fc460d422812b6a5adff7dfee951d8fa2e4a98caa0382cfbdbf"
4538 4539
               RepoTags:
... ...
@@ -4591,23 +4625,27 @@ paths:
4591 4591
       summary: "Get the history of an image"
4592 4592
       description: "Return parent layers of an image."
4593 4593
       operationId: "ImageHistory"
4594
-      produces:
4595
-        - "application/json"
4594
+      produces: ["application/json"]
4596 4595
       responses:
4597 4596
         200:
4598
-          description: "No error"
4597
+          description: "List of image layers"
4599 4598
           schema:
4600 4599
             type: "array"
4601 4600
             items:
4602 4601
               type: "object"
4602
+              x-go-name: HistoryResponseItem
4603
+              required: [Id, Created, CreatedBy, Tags, Size, Comment]
4603 4604
               properties:
4604 4605
                 Id:
4605 4606
                   type: "string"
4607
+                  x-nullable: false
4606 4608
                 Created:
4607 4609
                   type: "integer"
4608 4610
                   format: "int64"
4611
+                  x-nullable: false
4609 4612
                 CreatedBy:
4610 4613
                   type: "string"
4614
+                  x-nullable: false
4611 4615
                 Tags:
4612 4616
                   type: "array"
4613 4617
                   items:
... ...
@@ -4615,8 +4653,10 @@ paths:
4615 4615
                 Size:
4616 4616
                   type: "integer"
4617 4617
                   format: "int64"
4618
+                  x-nullable: false
4618 4619
                 Comment:
4619 4620
                   type: "string"
4621
+                  x-nullable: false
4620 4622
           examples:
4621 4623
             application/json:
4622 4624
               - Id: "3db9c44f45209632d6050b35958829c3a2aa256d81b9a7be45b362ff85c54710"
... ...
@@ -4738,19 +4778,20 @@ paths:
4738 4738
     delete:
4739 4739
       summary: "Remove an image"
4740 4740
       description: |
4741
-        Remove an image, along with any untagged parent images that were referenced by that image.
4741
+        Remove an image, along with any untagged parent images that were
4742
+        referenced by that image.
4742 4743
 
4743
-        Images can't be removed if they have descendant images, are being used by a running container or are being used by a build.
4744
+        Images can't be removed if they have descendant images, are being
4745
+        used by a running container or are being used by a build.
4744 4746
       operationId: "ImageDelete"
4745
-      produces:
4746
-        - "application/json"
4747
+      produces: ["application/json"]
4747 4748
       responses:
4748 4749
         200:
4749
-          description: "No error"
4750
+          description: "The image was deleted successfully"
4750 4751
           schema:
4751 4752
             type: "array"
4752 4753
             items:
4753
-              $ref: "#/definitions/ImageDeleteResponse"
4754
+              $ref: "#/definitions/ImageDeleteResponseItem"
4754 4755
           examples:
4755 4756
             application/json:
4756 4757
               - Untagged: "3e2f21a89f"
... ...
@@ -4879,7 +4920,7 @@ paths:
4879 4879
                 description: "Images that were deleted"
4880 4880
                 type: "array"
4881 4881
                 items:
4882
-                  $ref: "#/definitions/ImageDeleteResponse"
4882
+                  $ref: "#/definitions/ImageDeleteResponseItem"
4883 4883
               SpaceReclaimed:
4884 4884
                 description: "Disk space reclaimed in bytes"
4885 4885
                 type: "integer"
... ...
@@ -5145,8 +5186,7 @@ paths:
5145 5145
       summary: "Get version"
5146 5146
       description: "Returns the version of Docker that is running and various information about the system that Docker is running on."
5147 5147
       operationId: "SystemVersion"
5148
-      produces:
5149
-        - "application/json"
5148
+      produces: ["application/json"]
5150 5149
       responses:
5151 5150
         200:
5152 5151
           description: "no error"
... ...
@@ -5195,14 +5235,20 @@ paths:
5195 5195
       summary: "Ping"
5196 5196
       description: "This is a dummy endpoint you can use to test if the server is accessible."
5197 5197
       operationId: "SystemPing"
5198
-      produces:
5199
-        - "text/plain"
5198
+      produces: ["text/plain"]
5200 5199
       responses:
5201 5200
         200:
5202 5201
           description: "no error"
5203 5202
           schema:
5204 5203
             type: "string"
5205 5204
             example: "OK"
5205
+          headers:
5206
+            API-Version:
5207
+              type: "string"
5208
+              description: "Max API Version the server supports"
5209
+            Docker-Experimental:
5210
+              type: "boolean"
5211
+              description: "If the server is running with experimental mode enabled"
5206 5212
         500:
5207 5213
           description: "server error"
5208 5214
           schema:
... ...
@@ -7293,7 +7339,7 @@ paths:
7293 7293
         200:
7294 7294
           description: "no error"
7295 7295
           schema:
7296
-            $ref: "#/definitions/ImageDeleteResponse"
7296
+            $ref: "#/definitions/ServiceUpdateResponse"
7297 7297
         400:
7298 7298
           description: "bad parameter"
7299 7299
           schema:
7300 7300
new file mode 100644
... ...
@@ -0,0 +1,21 @@
0
+package container
1
+
2
+// ----------------------------------------------------------------------------
3
+// DO NOT EDIT THIS FILE
4
+// This file was generated by `swagger generate operation`
5
+//
6
+// See hack/generate-swagger-api.sh
7
+// ----------------------------------------------------------------------------
8
+
9
+// ContainerChangeResponseItem container change response item
10
+// swagger:model ContainerChangeResponseItem
11
+type ContainerChangeResponseItem struct {
12
+
13
+	// Kind of change
14
+	// Required: true
15
+	Kind uint8 `json:"Kind"`
16
+
17
+	// Path to file that has changed
18
+	// Required: true
19
+	Path string `json:"Path"`
20
+}
0 21
new file mode 100644
... ...
@@ -0,0 +1,21 @@
0
+package container
1
+
2
+// ----------------------------------------------------------------------------
3
+// DO NOT EDIT THIS FILE
4
+// This file was generated by `swagger generate operation`
5
+//
6
+// See hack/generate-swagger-api.sh
7
+// ----------------------------------------------------------------------------
8
+
9
+// ContainerTopOKBody container top o k body
10
+// swagger:model ContainerTopOKBody
11
+type ContainerTopOKBody struct {
12
+
13
+	// Each process running in the container, where each is process is an array of values corresponding to the titles
14
+	// Required: true
15
+	Processes [][]string `json:"Processes"`
16
+
17
+	// The ps column titles
18
+	// Required: true
19
+	Titles []string `json:"Titles"`
20
+}
0 21
new file mode 100644
... ...
@@ -0,0 +1,17 @@
0
+package types
1
+
2
+// This file was generated by the swagger tool.
3
+// Editing this file might prove futile when you re-run the swagger generate command
4
+
5
+// GraphDriverData Information about a container's graph driver.
6
+// swagger:model GraphDriverData
7
+type GraphDriverData struct {
8
+
9
+	// data
10
+	// Required: true
11
+	Data map[string]string `json:"Data"`
12
+
13
+	// name
14
+	// Required: true
15
+	Name string `json:"Name"`
16
+}
0 17
new file mode 100644
... ...
@@ -0,0 +1,37 @@
0
+package image
1
+
2
+// ----------------------------------------------------------------------------
3
+// DO NOT EDIT THIS FILE
4
+// This file was generated by `swagger generate operation`
5
+//
6
+// See hack/generate-swagger-api.sh
7
+// ----------------------------------------------------------------------------
8
+
9
+// HistoryResponseItem history response item
10
+// swagger:model HistoryResponseItem
11
+type HistoryResponseItem struct {
12
+
13
+	// comment
14
+	// Required: true
15
+	Comment string `json:"Comment"`
16
+
17
+	// created
18
+	// Required: true
19
+	Created int64 `json:"Created"`
20
+
21
+	// created by
22
+	// Required: true
23
+	CreatedBy string `json:"CreatedBy"`
24
+
25
+	// Id
26
+	// Required: true
27
+	ID string `json:"Id"`
28
+
29
+	// size
30
+	// Required: true
31
+	Size int64 `json:"Size"`
32
+
33
+	// tags
34
+	// Required: true
35
+	Tags []string `json:"Tags"`
36
+}
0 37
new file mode 100644
... ...
@@ -0,0 +1,15 @@
0
+package types
1
+
2
+// This file was generated by the swagger tool.
3
+// Editing this file might prove futile when you re-run the swagger generate command
4
+
5
+// ImageDeleteResponseItem image delete response item
6
+// swagger:model ImageDeleteResponseItem
7
+type ImageDeleteResponseItem struct {
8
+
9
+	// The image ID of an image that was deleted
10
+	Deleted string `json:"Deleted,omitempty"`
11
+
12
+	// The image ID of an image that was untagged
13
+	Untagged string `json:"Untagged,omitempty"`
14
+}
... ...
@@ -17,38 +17,6 @@ import (
17 17
 	"github.com/docker/go-connections/nat"
18 18
 )
19 19
 
20
-// ContainerChange contains response of Engine API:
21
-// GET "/containers/{name:.*}/changes"
22
-type ContainerChange struct {
23
-	Kind int
24
-	Path string
25
-}
26
-
27
-// ImageHistory contains response of Engine API:
28
-// GET "/images/{name:.*}/history"
29
-type ImageHistory struct {
30
-	ID        string `json:"Id"`
31
-	Created   int64
32
-	CreatedBy string
33
-	Tags      []string
34
-	Size      int64
35
-	Comment   string
36
-}
37
-
38
-// ImageDelete contains response of Engine API:
39
-// DELETE "/images/{name:.*}"
40
-type ImageDelete struct {
41
-	Untagged string `json:",omitempty"`
42
-	Deleted  string `json:",omitempty"`
43
-}
44
-
45
-// GraphDriverData returns Image's graph driver config info
46
-// when calling inspect command
47
-type GraphDriverData struct {
48
-	Name string
49
-	Data map[string]string
50
-}
51
-
52 20
 // RootFS returns Image's RootFS description including the layer IDs.
53 21
 type RootFS struct {
54 22
 	Type      string
... ...
@@ -125,13 +93,6 @@ type ContainerStats struct {
125 125
 	OSType string        `json:"ostype"`
126 126
 }
127 127
 
128
-// ContainerProcessList contains response of Engine API:
129
-// GET "/containers/{name:.*}/top"
130
-type ContainerProcessList struct {
131
-	Processes [][]string
132
-	Titles    []string
133
-}
134
-
135 128
 // Ping contains response of Engine API:
136 129
 // GET "/_ping"
137 130
 type Ping struct {
... ...
@@ -526,7 +487,7 @@ type VolumesPruneReport struct {
526 526
 // ImagesPruneReport contains the response for Engine API:
527 527
 // POST "/images/prune"
528 528
 type ImagesPruneReport struct {
529
-	ImagesDeleted  []ImageDelete
529
+	ImagesDeleted  []ImageDeleteResponseItem
530 530
 	SpaceReclaimed uint64
531 531
 }
532 532
 
... ...
@@ -4,13 +4,13 @@ import (
4 4
 	"encoding/json"
5 5
 	"net/url"
6 6
 
7
-	"github.com/docker/docker/api/types"
7
+	"github.com/docker/docker/api/types/container"
8 8
 	"golang.org/x/net/context"
9 9
 )
10 10
 
11 11
 // ContainerDiff shows differences in a container filesystem since it was started.
12
-func (cli *Client) ContainerDiff(ctx context.Context, containerID string) ([]types.ContainerChange, error) {
13
-	var changes []types.ContainerChange
12
+func (cli *Client) ContainerDiff(ctx context.Context, containerID string) ([]container.ContainerChangeResponseItem, error) {
13
+	var changes []container.ContainerChangeResponseItem
14 14
 
15 15
 	serverResp, err := cli.get(ctx, "/containers/"+containerID+"/changes", url.Values{}, nil)
16 16
 	if err != nil {
... ...
@@ -9,7 +9,7 @@ import (
9 9
 	"strings"
10 10
 	"testing"
11 11
 
12
-	"github.com/docker/docker/api/types"
12
+	"github.com/docker/docker/api/types/container"
13 13
 	"golang.org/x/net/context"
14 14
 )
15 15
 
... ...
@@ -31,7 +31,7 @@ func TestContainerDiff(t *testing.T) {
31 31
 			if !strings.HasPrefix(req.URL.Path, expectedURL) {
32 32
 				return nil, fmt.Errorf("Expected URL '%s', got '%s'", expectedURL, req.URL)
33 33
 			}
34
-			b, err := json.Marshal([]types.ContainerChange{
34
+			b, err := json.Marshal([]container.ContainerChangeResponseItem{
35 35
 				{
36 36
 					Kind: 0,
37 37
 					Path: "/path/1",
... ...
@@ -5,13 +5,13 @@ import (
5 5
 	"net/url"
6 6
 	"strings"
7 7
 
8
-	"github.com/docker/docker/api/types"
8
+	"github.com/docker/docker/api/types/container"
9 9
 	"golang.org/x/net/context"
10 10
 )
11 11
 
12 12
 // ContainerTop shows process information from within a container.
13
-func (cli *Client) ContainerTop(ctx context.Context, containerID string, arguments []string) (types.ContainerProcessList, error) {
14
-	var response types.ContainerProcessList
13
+func (cli *Client) ContainerTop(ctx context.Context, containerID string, arguments []string) (container.ContainerTopOKBody, error) {
14
+	var response container.ContainerTopOKBody
15 15
 	query := url.Values{}
16 16
 	if len(arguments) > 0 {
17 17
 		query.Set("ps_args", strings.Join(arguments, " "))
... ...
@@ -10,7 +10,7 @@ import (
10 10
 	"strings"
11 11
 	"testing"
12 12
 
13
-	"github.com/docker/docker/api/types"
13
+	"github.com/docker/docker/api/types/container"
14 14
 	"golang.org/x/net/context"
15 15
 )
16 16
 
... ...
@@ -43,7 +43,7 @@ func TestContainerTop(t *testing.T) {
43 43
 				return nil, fmt.Errorf("args not set in URL query properly. Expected 'arg1 arg2', got %v", args)
44 44
 			}
45 45
 
46
-			b, err := json.Marshal(types.ContainerProcessList{
46
+			b, err := json.Marshal(container.ContainerTopOKBody{
47 47
 				Processes: [][]string{
48 48
 					{"p1", "p2"},
49 49
 					{"p3"},
... ...
@@ -4,13 +4,13 @@ import (
4 4
 	"encoding/json"
5 5
 	"net/url"
6 6
 
7
-	"github.com/docker/docker/api/types"
7
+	"github.com/docker/docker/api/types/image"
8 8
 	"golang.org/x/net/context"
9 9
 )
10 10
 
11 11
 // ImageHistory returns the changes in an image in history format.
12
-func (cli *Client) ImageHistory(ctx context.Context, imageID string) ([]types.ImageHistory, error) {
13
-	var history []types.ImageHistory
12
+func (cli *Client) ImageHistory(ctx context.Context, imageID string) ([]image.HistoryResponseItem, error) {
13
+	var history []image.HistoryResponseItem
14 14
 	serverResp, err := cli.get(ctx, "/images/"+imageID+"/history", url.Values{}, nil)
15 15
 	if err != nil {
16 16
 		return history, err
... ...
@@ -9,7 +9,7 @@ import (
9 9
 	"strings"
10 10
 	"testing"
11 11
 
12
-	"github.com/docker/docker/api/types"
12
+	"github.com/docker/docker/api/types/image"
13 13
 	"golang.org/x/net/context"
14 14
 )
15 15
 
... ...
@@ -30,7 +30,7 @@ func TestImageHistory(t *testing.T) {
30 30
 			if !strings.HasPrefix(r.URL.Path, expectedURL) {
31 31
 				return nil, fmt.Errorf("Expected URL '%s', got '%s'", expectedURL, r.URL)
32 32
 			}
33
-			b, err := json.Marshal([]types.ImageHistory{
33
+			b, err := json.Marshal([]image.HistoryResponseItem{
34 34
 				{
35 35
 					ID:   "image_id1",
36 36
 					Tags: []string{"tag1", "tag2"},
... ...
@@ -9,7 +9,7 @@ import (
9 9
 )
10 10
 
11 11
 // ImageRemove removes an image from the docker host.
12
-func (cli *Client) ImageRemove(ctx context.Context, imageID string, options types.ImageRemoveOptions) ([]types.ImageDelete, error) {
12
+func (cli *Client) ImageRemove(ctx context.Context, imageID string, options types.ImageRemoveOptions) ([]types.ImageDeleteResponseItem, error) {
13 13
 	query := url.Values{}
14 14
 
15 15
 	if options.Force {
... ...
@@ -24,7 +24,7 @@ func (cli *Client) ImageRemove(ctx context.Context, imageID string, options type
24 24
 		return nil, err
25 25
 	}
26 26
 
27
-	var dels []types.ImageDelete
27
+	var dels []types.ImageDeleteResponseItem
28 28
 	err = json.NewDecoder(resp.body).Decode(&dels)
29 29
 	ensureReaderClosed(resp)
30 30
 	return dels, err
... ...
@@ -63,7 +63,7 @@ func TestImageRemove(t *testing.T) {
63 63
 						return nil, fmt.Errorf("%s not set in URL query properly. Expected '%s', got %s", key, expected, actual)
64 64
 					}
65 65
 				}
66
-				b, err := json.Marshal([]types.ImageDelete{
66
+				b, err := json.Marshal([]types.ImageDeleteResponseItem{
67 67
 					{
68 68
 						Untagged: "image_id1",
69 69
 					},
... ...
@@ -8,6 +8,7 @@ import (
8 8
 	"github.com/docker/docker/api/types/container"
9 9
 	"github.com/docker/docker/api/types/events"
10 10
 	"github.com/docker/docker/api/types/filters"
11
+	"github.com/docker/docker/api/types/image"
11 12
 	"github.com/docker/docker/api/types/network"
12 13
 	"github.com/docker/docker/api/types/registry"
13 14
 	"github.com/docker/docker/api/types/swarm"
... ...
@@ -37,7 +38,7 @@ type ContainerAPIClient interface {
37 37
 	ContainerAttach(ctx context.Context, container string, options types.ContainerAttachOptions) (types.HijackedResponse, error)
38 38
 	ContainerCommit(ctx context.Context, container string, options types.ContainerCommitOptions) (types.IDResponse, error)
39 39
 	ContainerCreate(ctx context.Context, config *container.Config, hostConfig *container.HostConfig, networkingConfig *network.NetworkingConfig, containerName string) (container.ContainerCreateCreatedBody, error)
40
-	ContainerDiff(ctx context.Context, container string) ([]types.ContainerChange, error)
40
+	ContainerDiff(ctx context.Context, container string) ([]container.ContainerChangeResponseItem, error)
41 41
 	ContainerExecAttach(ctx context.Context, execID string, config types.ExecConfig) (types.HijackedResponse, error)
42 42
 	ContainerExecCreate(ctx context.Context, container string, config types.ExecConfig) (types.IDResponse, error)
43 43
 	ContainerExecInspect(ctx context.Context, execID string) (types.ContainerExecInspect, error)
... ...
@@ -58,7 +59,7 @@ type ContainerAPIClient interface {
58 58
 	ContainerStats(ctx context.Context, container string, stream bool) (types.ContainerStats, error)
59 59
 	ContainerStart(ctx context.Context, container string, options types.ContainerStartOptions) error
60 60
 	ContainerStop(ctx context.Context, container string, timeout *time.Duration) error
61
-	ContainerTop(ctx context.Context, container string, arguments []string) (types.ContainerProcessList, error)
61
+	ContainerTop(ctx context.Context, container string, arguments []string) (container.ContainerTopOKBody, error)
62 62
 	ContainerUnpause(ctx context.Context, container string) error
63 63
 	ContainerUpdate(ctx context.Context, container string, updateConfig container.UpdateConfig) (container.ContainerUpdateOKBody, error)
64 64
 	ContainerWait(ctx context.Context, container string) (int64, error)
... ...
@@ -71,14 +72,14 @@ type ContainerAPIClient interface {
71 71
 type ImageAPIClient interface {
72 72
 	ImageBuild(ctx context.Context, context io.Reader, options types.ImageBuildOptions) (types.ImageBuildResponse, error)
73 73
 	ImageCreate(ctx context.Context, parentReference string, options types.ImageCreateOptions) (io.ReadCloser, error)
74
-	ImageHistory(ctx context.Context, image string) ([]types.ImageHistory, error)
74
+	ImageHistory(ctx context.Context, image string) ([]image.HistoryResponseItem, error)
75 75
 	ImageImport(ctx context.Context, source types.ImageImportSource, ref string, options types.ImageImportOptions) (io.ReadCloser, error)
76 76
 	ImageInspectWithRaw(ctx context.Context, image string) (types.ImageInspect, []byte, error)
77 77
 	ImageList(ctx context.Context, options types.ImageListOptions) ([]types.ImageSummary, error)
78 78
 	ImageLoad(ctx context.Context, input io.Reader, quiet bool) (types.ImageLoadResponse, error)
79 79
 	ImagePull(ctx context.Context, ref string, options types.ImagePullOptions) (io.ReadCloser, error)
80 80
 	ImagePush(ctx context.Context, ref string, options types.ImagePushOptions) (io.ReadCloser, error)
81
-	ImageRemove(ctx context.Context, image string, options types.ImageRemoveOptions) ([]types.ImageDelete, error)
81
+	ImageRemove(ctx context.Context, image string, options types.ImageRemoveOptions) ([]types.ImageDeleteResponseItem, error)
82 82
 	ImageSearch(ctx context.Context, term string, options types.ImageSearchOptions) ([]registry.SearchResult, error)
83 83
 	ImageSave(ctx context.Context, images []string) (io.ReadCloser, error)
84 84
 	ImageTag(ctx context.Context, image, ref string) error
... ...
@@ -61,9 +61,9 @@ const (
61 61
 // FIXME: remove ImageDelete's dependency on Daemon, then move to the graph
62 62
 // package. This would require that we no longer need the daemon to determine
63 63
 // whether images are being used by a stopped or running container.
64
-func (daemon *Daemon) ImageDelete(imageRef string, force, prune bool) ([]types.ImageDelete, error) {
64
+func (daemon *Daemon) ImageDelete(imageRef string, force, prune bool) ([]types.ImageDeleteResponseItem, error) {
65 65
 	start := time.Now()
66
-	records := []types.ImageDelete{}
66
+	records := []types.ImageDeleteResponseItem{}
67 67
 
68 68
 	imgID, err := daemon.GetImageID(imageRef)
69 69
 	if err != nil {
... ...
@@ -99,7 +99,7 @@ func (daemon *Daemon) ImageDelete(imageRef string, force, prune bool) ([]types.I
99 99
 			return nil, err
100 100
 		}
101 101
 
102
-		untaggedRecord := types.ImageDelete{Untagged: parsedRef.String()}
102
+		untaggedRecord := types.ImageDeleteResponseItem{Untagged: parsedRef.String()}
103 103
 
104 104
 		daemon.LogImageEvent(imgID.String(), imgID.String(), "untag")
105 105
 		records = append(records, untaggedRecord)
... ...
@@ -126,7 +126,7 @@ func (daemon *Daemon) ImageDelete(imageRef string, force, prune bool) ([]types.I
126 126
 							return records, err
127 127
 						}
128 128
 
129
-						untaggedRecord := types.ImageDelete{Untagged: repoRef.String()}
129
+						untaggedRecord := types.ImageDeleteResponseItem{Untagged: repoRef.String()}
130 130
 						records = append(records, untaggedRecord)
131 131
 					} else {
132 132
 						remainingRefs = append(remainingRefs, repoRef)
... ...
@@ -162,7 +162,7 @@ func (daemon *Daemon) ImageDelete(imageRef string, force, prune bool) ([]types.I
162 162
 					return nil, err
163 163
 				}
164 164
 
165
-				untaggedRecord := types.ImageDelete{Untagged: parsedRef.String()}
165
+				untaggedRecord := types.ImageDeleteResponseItem{Untagged: parsedRef.String()}
166 166
 
167 167
 				daemon.LogImageEvent(imgID.String(), imgID.String(), "untag")
168 168
 				records = append(records, untaggedRecord)
... ...
@@ -244,9 +244,9 @@ func (daemon *Daemon) removeImageRef(ref reference.Named) (reference.Named, erro
244 244
 // removeAllReferencesToImageID attempts to remove every reference to the given
245 245
 // imgID from this daemon's store of repository tag/digest references. Returns
246 246
 // on the first encountered error. Removed references are logged to this
247
-// daemon's event service. An "Untagged" types.ImageDelete is added to the
247
+// daemon's event service. An "Untagged" types.ImageDeleteResponseItem is added to the
248 248
 // given list of records.
249
-func (daemon *Daemon) removeAllReferencesToImageID(imgID image.ID, records *[]types.ImageDelete) error {
249
+func (daemon *Daemon) removeAllReferencesToImageID(imgID image.ID, records *[]types.ImageDeleteResponseItem) error {
250 250
 	imageRefs := daemon.referenceStore.References(imgID.Digest())
251 251
 
252 252
 	for _, imageRef := range imageRefs {
... ...
@@ -255,7 +255,7 @@ func (daemon *Daemon) removeAllReferencesToImageID(imgID image.ID, records *[]ty
255 255
 			return err
256 256
 		}
257 257
 
258
-		untaggedRecord := types.ImageDelete{Untagged: parsedRef.String()}
258
+		untaggedRecord := types.ImageDeleteResponseItem{Untagged: parsedRef.String()}
259 259
 
260 260
 		daemon.LogImageEvent(imgID.String(), imgID.String(), "untag")
261 261
 		*records = append(*records, untaggedRecord)
... ...
@@ -295,7 +295,7 @@ func (idc *imageDeleteConflict) Error() string {
295 295
 // conflict is encountered, it will be returned immediately without deleting
296 296
 // the image. If quiet is true, any encountered conflicts will be ignored and
297 297
 // the function will return nil immediately without deleting the image.
298
-func (daemon *Daemon) imageDeleteHelper(imgID image.ID, records *[]types.ImageDelete, force, prune, quiet bool) error {
298
+func (daemon *Daemon) imageDeleteHelper(imgID image.ID, records *[]types.ImageDeleteResponseItem, force, prune, quiet bool) error {
299 299
 	// First, determine if this image has any conflicts. Ignore soft conflicts
300 300
 	// if force is true.
301 301
 	c := conflictHard
... ...
@@ -331,9 +331,9 @@ func (daemon *Daemon) imageDeleteHelper(imgID image.ID, records *[]types.ImageDe
331 331
 	}
332 332
 
333 333
 	daemon.LogImageEvent(imgID.String(), imgID.String(), "delete")
334
-	*records = append(*records, types.ImageDelete{Deleted: imgID.String()})
334
+	*records = append(*records, types.ImageDeleteResponseItem{Deleted: imgID.String()})
335 335
 	for _, removedLayer := range removedLayers {
336
-		*records = append(*records, types.ImageDelete{Deleted: removedLayer.ChainID.String()})
336
+		*records = append(*records, types.ImageDeleteResponseItem{Deleted: removedLayer.ChainID.String()})
337 337
 	}
338 338
 
339 339
 	if !prune || parent == "" {
... ...
@@ -4,21 +4,21 @@ import (
4 4
 	"fmt"
5 5
 	"time"
6 6
 
7
-	"github.com/docker/docker/api/types"
7
+	"github.com/docker/docker/api/types/image"
8 8
 	"github.com/docker/docker/layer"
9 9
 	"github.com/docker/docker/reference"
10 10
 )
11 11
 
12 12
 // ImageHistory returns a slice of ImageHistory structures for the specified image
13 13
 // name by walking the image lineage.
14
-func (daemon *Daemon) ImageHistory(name string) ([]*types.ImageHistory, error) {
14
+func (daemon *Daemon) ImageHistory(name string) ([]*image.HistoryResponseItem, error) {
15 15
 	start := time.Now()
16 16
 	img, err := daemon.GetImage(name)
17 17
 	if err != nil {
18 18
 		return nil, err
19 19
 	}
20 20
 
21
-	history := []*types.ImageHistory{}
21
+	history := []*image.HistoryResponseItem{}
22 22
 
23 23
 	layerCounter := 0
24 24
 	rootFS := *img.RootFS
... ...
@@ -46,7 +46,7 @@ func (daemon *Daemon) ImageHistory(name string) ([]*types.ImageHistory, error) {
46 46
 			layerCounter++
47 47
 		}
48 48
 
49
-		history = append([]*types.ImageHistory{{
49
+		history = append([]*image.HistoryResponseItem{{
50 50
 			ID:        "<missing>",
51 51
 			Created:   h.Created.Unix(),
52 52
 			CreatedBy: h.CreatedBy,
... ...
@@ -132,7 +132,7 @@ func (daemon *Daemon) ImagesPrune(pruneFilters filters.Args) (*types.ImagesPrune
132 132
 			continue
133 133
 		}
134 134
 
135
-		deletedImages := []types.ImageDelete{}
135
+		deletedImages := []types.ImageDeleteResponseItem{}
136 136
 		refs := daemon.referenceStore.References(dgst)
137 137
 		if len(refs) > 0 {
138 138
 			shouldDelete := !danglingOnly
... ...
@@ -9,7 +9,7 @@ import (
9 9
 	"strconv"
10 10
 	"strings"
11 11
 
12
-	"github.com/docker/docker/api/types"
12
+	"github.com/docker/docker/api/types/container"
13 13
 )
14 14
 
15 15
 func validatePSArgs(psArgs string) error {
... ...
@@ -41,8 +41,8 @@ func fieldsASCII(s string) []string {
41 41
 	return strings.FieldsFunc(s, fn)
42 42
 }
43 43
 
44
-func parsePSOutput(output []byte, pids []int) (*types.ContainerProcessList, error) {
45
-	procList := &types.ContainerProcessList{}
44
+func parsePSOutput(output []byte, pids []int) (*container.ContainerTopOKBody, error) {
45
+	procList := &container.ContainerTopOKBody{}
46 46
 
47 47
 	lines := strings.Split(string(output), "\n")
48 48
 	procList.Titles = fieldsASCII(lines[0])
... ...
@@ -86,7 +86,7 @@ func parsePSOutput(output []byte, pids []int) (*types.ContainerProcessList, erro
86 86
 // "-ef" if no args are given.  An error is returned if the container
87 87
 // is not found, or is not running, or if there are any problems
88 88
 // running ps, or parsing the output.
89
-func (daemon *Daemon) ContainerTop(name string, psArgs string) (*types.ContainerProcessList, error) {
89
+func (daemon *Daemon) ContainerTop(name string, psArgs string) (*container.ContainerTopOKBody, error) {
90 90
 	if psArgs == "" {
91 91
 		psArgs = "-ef"
92 92
 	}
... ...
@@ -5,7 +5,7 @@ import (
5 5
 	"fmt"
6 6
 	"time"
7 7
 
8
-	"github.com/docker/docker/api/types"
8
+	containertypes "github.com/docker/docker/api/types/container"
9 9
 	"github.com/docker/go-units"
10 10
 )
11 11
 
... ...
@@ -23,7 +23,7 @@ import (
23 23
 //    task manager does and use the private working set as the memory counter.
24 24
 //    We could return more info for those who really understand how memory
25 25
 //    management works in Windows if we introduced a "raw" stats (above).
26
-func (daemon *Daemon) ContainerTop(name string, psArgs string) (*types.ContainerProcessList, error) {
26
+func (daemon *Daemon) ContainerTop(name string, psArgs string) (*containertypes.ContainerTopOKBody, error) {
27 27
 	// It's not at all an equivalent to linux 'ps' on Windows
28 28
 	if psArgs != "" {
29 29
 		return nil, errors.New("Windows does not support arguments to top")
... ...
@@ -38,7 +38,7 @@ func (daemon *Daemon) ContainerTop(name string, psArgs string) (*types.Container
38 38
 	if err != nil {
39 39
 		return nil, err
40 40
 	}
41
-	procList := &types.ContainerProcessList{}
41
+	procList := &containertypes.ContainerTopOKBody{}
42 42
 	procList.Titles = []string{"Name", "PID", "CPU", "Private Working Set"}
43 43
 
44 44
 	for _, j := range s {
... ...
@@ -3,20 +3,25 @@ set -eu
3 3
 
4 4
 swagger generate model -f api/swagger.yaml \
5 5
     -t api -m types --skip-validator -C api/swagger-gen.yaml \
6
-    -n Volume \
7
-    -n Port \
8
-    -n ImageSummary \
9
-    -n Plugin -n PluginDevice -n PluginMount -n PluginEnv -n PluginInterfaceType \
10 6
     -n ErrorResponse \
7
+    -n GraphDriverData \
11 8
     -n IdResponse \
12
-    -n ServiceUpdateResponse
9
+    -n ImageDeleteResponseItem \
10
+    -n ImageSummary \
11
+    -n Plugin -n PluginDevice -n PluginMount -n PluginEnv -n PluginInterfaceType \
12
+    -n Port \
13
+    -n ServiceUpdateResponse \
14
+    -n Volume
13 15
 
14 16
 swagger generate operation -f api/swagger.yaml \
15 17
     -t api -a types -m types -C api/swagger-gen.yaml \
16 18
     -T api/templates --skip-responses --skip-parameters --skip-validator \
17
-    -n VolumesList \
18
-    -n VolumesCreate \
19
+    -n Authenticate \
20
+    -n ContainerChanges \
19 21
     -n ContainerCreate \
22
+    -n ContainerTop \
20 23
     -n ContainerUpdate \
21
-    -n Authenticate \
22
-    -n ContainerWait
24
+    -n ContainerWait \
25
+    -n ImageHistory \
26
+    -n VolumesCreate \
27
+    -n VolumesList
... ...
@@ -7,6 +7,7 @@ import (
7 7
 	"strings"
8 8
 
9 9
 	"github.com/docker/docker/api/types"
10
+	"github.com/docker/docker/api/types/image"
10 11
 	"github.com/docker/docker/integration-cli/checker"
11 12
 	"github.com/docker/docker/integration-cli/request"
12 13
 	"github.com/go-check/check"
... ...
@@ -106,7 +107,7 @@ func (s *DockerSuite) TestAPIImagesHistory(c *check.C) {
106 106
 	c.Assert(err, checker.IsNil)
107 107
 	c.Assert(status, checker.Equals, http.StatusOK)
108 108
 
109
-	var historydata []types.ImageHistory
109
+	var historydata []image.HistoryResponseItem
110 110
 	err = json.Unmarshal(body, &historydata)
111 111
 	c.Assert(err, checker.IsNil, check.Commentf("Error on unmarshal"))
112 112