Prechádzať zdrojové kódy

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

Generate more types from the swagger spec
Alexander Morozov 8 rokov pred
rodič
commit
a69c4129e0

+ 1 - 1
api/server/router/container/backend.go

@@ -53,7 +53,7 @@ type monitorBackend interface {
 	ContainerInspect(name string, size bool, version string) (interface{}, error)
 	ContainerInspect(name string, size bool, version string) (interface{}, error)
 	ContainerLogs(ctx context.Context, name string, config *backend.ContainerLogsConfig, started chan struct{}) error
 	ContainerLogs(ctx context.Context, name string, config *backend.ContainerLogsConfig, started chan struct{}) error
 	ContainerStats(ctx context.Context, name string, config *backend.ContainerStatsConfig) error
 	ContainerStats(ctx context.Context, name string, config *backend.ContainerStatsConfig) error
-	ContainerTop(name string, psArgs string) (*types.ContainerProcessList, error)
+	ContainerTop(name string, psArgs string) (*container.ContainerTopOKBody, error)
 
 
 	Containers(config *types.ContainerListOptions) ([]*types.Container, error)
 	Containers(config *types.ContainerListOptions) ([]*types.Container, error)
 }
 }

+ 3 - 2
api/server/router/image/backend.go

@@ -6,6 +6,7 @@ import (
 	"github.com/docker/docker/api/types"
 	"github.com/docker/docker/api/types"
 	"github.com/docker/docker/api/types/backend"
 	"github.com/docker/docker/api/types/backend"
 	"github.com/docker/docker/api/types/filters"
 	"github.com/docker/docker/api/types/filters"
+	"github.com/docker/docker/api/types/image"
 	"github.com/docker/docker/api/types/registry"
 	"github.com/docker/docker/api/types/registry"
 	"golang.org/x/net/context"
 	"golang.org/x/net/context"
 )
 )
@@ -24,8 +25,8 @@ type containerBackend interface {
 }
 }
 
 
 type imageBackend interface {
 type imageBackend interface {
-	ImageDelete(imageRef string, force, prune bool) ([]types.ImageDelete, error)
-	ImageHistory(imageName string) ([]*types.ImageHistory, error)
+	ImageDelete(imageRef string, force, prune bool) ([]types.ImageDeleteResponseItem, error)
+	ImageHistory(imageName string) ([]*image.HistoryResponseItem, error)
 	Images(imageFilters filters.Args, all bool, withExtraAttrs bool) ([]*types.ImageSummary, error)
 	Images(imageFilters filters.Args, all bool, withExtraAttrs bool) ([]*types.ImageSummary, error)
 	LookupImage(name string) (*types.ImageInspect, error)
 	LookupImage(name string) (*types.ImageInspect, error)
 	TagImage(imageName, repository, tag string) error
 	TagImage(imageName, repository, tag string) error

+ 86 - 40
api/swagger.yaml

@@ -829,22 +829,40 @@ definitions:
         items:
         items:
           $ref: "#/definitions/Port"
           $ref: "#/definitions/Port"
 
 
-  GraphDriver:
-    description: "Information about this container's graph driver."
+  GraphDriverData:
+    description: "Information about a container's graph driver."
     type: "object"
     type: "object"
+    required: [Name, Data]
     properties:
     properties:
       Name:
       Name:
         type: "string"
         type: "string"
+        x-nullable: false
       Data:
       Data:
         type: "object"
         type: "object"
+        x-nullable: false
         additionalProperties:
         additionalProperties:
           type: "string"
           type: "string"
 
 
   Image:
   Image:
     type: "object"
     type: "object"
+    required:
+      - Id
+      - Parent
+      - Comment
+      - Created
+      - Container
+      - DockerVersion
+      - Author
+      - Architecture
+      - Os
+      - Size
+      - VirtualSize
+      - GraphDriver
+      - RootFS
     properties:
     properties:
       Id:
       Id:
         type: "string"
         type: "string"
+        x-nullable: false
       RepoTags:
       RepoTags:
         type: "array"
         type: "array"
         items:
         items:
@@ -855,37 +873,51 @@ definitions:
           type: "string"
           type: "string"
       Parent:
       Parent:
         type: "string"
         type: "string"
+        x-nullable: false
       Comment:
       Comment:
         type: "string"
         type: "string"
+        x-nullable: false
       Created:
       Created:
         type: "string"
         type: "string"
+        x-nullable: false
       Container:
       Container:
         type: "string"
         type: "string"
+        x-nullable: false
       ContainerConfig:
       ContainerConfig:
         $ref: "#/definitions/Config"
         $ref: "#/definitions/Config"
       DockerVersion:
       DockerVersion:
         type: "string"
         type: "string"
+        x-nullable: false
       Author:
       Author:
         type: "string"
         type: "string"
+        x-nullable: false
       Config:
       Config:
         $ref: "#/definitions/Config"
         $ref: "#/definitions/Config"
       Architecture:
       Architecture:
         type: "string"
         type: "string"
+        x-nullable: false
       Os:
       Os:
         type: "string"
         type: "string"
+        x-nullable: false
+      OsVersion:
+        type: "string"
       Size:
       Size:
         type: "integer"
         type: "integer"
         format: "int64"
         format: "int64"
+        x-nullable: false
       VirtualSize:
       VirtualSize:
         type: "integer"
         type: "integer"
         format: "int64"
         format: "int64"
+        x-nullable: false
       GraphDriver:
       GraphDriver:
-        $ref: "#/definitions/GraphDriver"
+        $ref: "#/definitions/GraphDriverData"
       RootFS:
       RootFS:
         type: "object"
         type: "object"
+        required: [Type]
         properties:
         properties:
           Type:
           Type:
             type: "string"
             type: "string"
+            x-nullable: false
           Layers:
           Layers:
             type: "array"
             type: "array"
             items:
             items:
@@ -2302,7 +2334,7 @@ definitions:
           -
           -
             NetworkID: "4qvuz4ko70xaltuqbt8956gd1"
             NetworkID: "4qvuz4ko70xaltuqbt8956gd1"
             Addr: "10.255.0.3/16"
             Addr: "10.255.0.3/16"
-  ImageDeleteResponse:
+  ImageDeleteResponseItem:
     type: "object"
     type: "object"
     properties:
     properties:
       Untagged:
       Untagged:
@@ -2899,7 +2931,7 @@ paths:
               HostConfig:
               HostConfig:
                 $ref: "#/definitions/HostConfig"
                 $ref: "#/definitions/HostConfig"
               GraphDriver:
               GraphDriver:
-                $ref: "#/definitions/GraphDriver"
+                $ref: "#/definitions/GraphDriverData"
               SizeRw:
               SizeRw:
                 description: "The size of files that have been created or changed by this container."
                 description: "The size of files that have been created or changed by this container."
                 type: "integer"
                 type: "integer"
@@ -3231,32 +3263,34 @@ paths:
     get:
     get:
       summary: "Get changes on a container’s filesystem"
       summary: "Get changes on a container’s filesystem"
       description: |
       description: |
-        Returns which files in a container's filesystem have been added, deleted, or modified. The `Kind` of modification can be one of:
+        Returns which files in a container's filesystem have been added, deleted,
+        or modified. The `Kind` of modification can be one of:
 
 
         - `0`: Modified
         - `0`: Modified
         - `1`: Added
         - `1`: Added
         - `2`: Deleted
         - `2`: Deleted
       operationId: "ContainerChanges"
       operationId: "ContainerChanges"
-      produces:
-        - "application/json"
+      produces: ["application/json"]
       responses:
       responses:
         200:
         200:
-          description: "no error"
+          description: "The list of changes"
           schema:
           schema:
             type: "array"
             type: "array"
             items:
             items:
               type: "object"
               type: "object"
+              x-go-name: "ContainerChangeResponseItem"
+              required: [Path, Kind]
               properties:
               properties:
                 Path:
                 Path:
                   description: "Path to file that has changed"
                   description: "Path to file that has changed"
                   type: "string"
                   type: "string"
+                  x-nullable: false
                 Kind:
                 Kind:
                   description: "Kind of change"
                   description: "Kind of change"
                   type: "integer"
                   type: "integer"
-                  enum:
-                    - 0
-                    - 1
-                    - 2
+                  format: "uint8"
+                  enum: [0, 1, 2]
+                  x-nullable: false
           examples:
           examples:
             application/json:
             application/json:
               - Path: "/dev"
               - Path: "/dev"
@@ -3315,12 +3349,14 @@ paths:
     get:
     get:
       summary: "Get container stats based on resource usage"
       summary: "Get container stats based on resource usage"
       description: |
       description: |
-        This endpoint returns a live stream of a container’s resource usage statistics.
+        This endpoint returns a live stream of a container’s resource usage
+        statistics.
 
 
-        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.
+        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.
       operationId: "ContainerStats"
       operationId: "ContainerStats"
-      produces:
-        - "application/json"
+      produces: ["application/json"]
       responses:
       responses:
         200:
         200:
           description: "no error"
           description: "no error"
@@ -4042,7 +4078,7 @@ paths:
     head:
     head:
       summary: "Get information about files in a container"
       summary: "Get information about files in a container"
       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."
       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."
-      operationId: "ContainerArchiveHead"
+      operationId: "ContainerArchiveInfo"
       responses:
       responses:
         200:
         200:
           description: "no error"
           description: "no error"
@@ -4087,9 +4123,8 @@ paths:
     get:
     get:
       summary: "Get an archive of a filesystem resource in a container"
       summary: "Get an archive of a filesystem resource in a container"
       description: "Get a tar archive of a resource in the filesystem of container id."
       description: "Get a tar archive of a resource in the filesystem of container id."
-      operationId: "ContainerGetArchive"
-      produces:
-        - "application/x-tar"
+      operationId: "ContainerArchive"
+      produces: ["application/x-tar"]
       responses:
       responses:
         200:
         200:
           description: "no error"
           description: "no error"
@@ -4130,10 +4165,8 @@ paths:
     put:
     put:
       summary: "Extract an archive of files or folders to a directory in a container"
       summary: "Extract an archive of files or folders to a directory in a container"
       description: "Upload a tar archive to be extracted to a path in the filesystem of container id."
       description: "Upload a tar archive to be extracted to a path in the filesystem of container id."
-      operationId: "ContainerPutArchive"
-      consumes:
-        - "application/x-tar"
-        - "application/octet-stream"
+      operationId: "PutContainerArchive"
+      consumes: ["application/x-tar", "application/octet-stream"]
       responses:
       responses:
         200:
         200:
           description: "The content was extracted successfully"
           description: "The content was extracted successfully"
@@ -4533,6 +4566,7 @@ paths:
               Created: "2015-09-10T08:30:53.26995814Z"
               Created: "2015-09-10T08:30:53.26995814Z"
               GraphDriver:
               GraphDriver:
                 Name: "aufs"
                 Name: "aufs"
+                Data: {}
               RepoDigests:
               RepoDigests:
                 - "localhost:5000/test/busybox/example@sha256:cbbf2f9a99b47fc460d422812b6a5adff7dfee951d8fa2e4a98caa0382cfbdbf"
                 - "localhost:5000/test/busybox/example@sha256:cbbf2f9a99b47fc460d422812b6a5adff7dfee951d8fa2e4a98caa0382cfbdbf"
               RepoTags:
               RepoTags:
@@ -4591,23 +4625,27 @@ paths:
       summary: "Get the history of an image"
       summary: "Get the history of an image"
       description: "Return parent layers of an image."
       description: "Return parent layers of an image."
       operationId: "ImageHistory"
       operationId: "ImageHistory"
-      produces:
-        - "application/json"
+      produces: ["application/json"]
       responses:
       responses:
         200:
         200:
-          description: "No error"
+          description: "List of image layers"
           schema:
           schema:
             type: "array"
             type: "array"
             items:
             items:
               type: "object"
               type: "object"
+              x-go-name: HistoryResponseItem
+              required: [Id, Created, CreatedBy, Tags, Size, Comment]
               properties:
               properties:
                 Id:
                 Id:
                   type: "string"
                   type: "string"
+                  x-nullable: false
                 Created:
                 Created:
                   type: "integer"
                   type: "integer"
                   format: "int64"
                   format: "int64"
+                  x-nullable: false
                 CreatedBy:
                 CreatedBy:
                   type: "string"
                   type: "string"
+                  x-nullable: false
                 Tags:
                 Tags:
                   type: "array"
                   type: "array"
                   items:
                   items:
@@ -4615,8 +4653,10 @@ paths:
                 Size:
                 Size:
                   type: "integer"
                   type: "integer"
                   format: "int64"
                   format: "int64"
+                  x-nullable: false
                 Comment:
                 Comment:
                   type: "string"
                   type: "string"
+                  x-nullable: false
           examples:
           examples:
             application/json:
             application/json:
               - Id: "3db9c44f45209632d6050b35958829c3a2aa256d81b9a7be45b362ff85c54710"
               - Id: "3db9c44f45209632d6050b35958829c3a2aa256d81b9a7be45b362ff85c54710"
@@ -4738,19 +4778,20 @@ paths:
     delete:
     delete:
       summary: "Remove an image"
       summary: "Remove an image"
       description: |
       description: |
-        Remove an image, along with any untagged parent images that were referenced by that image.
+        Remove an image, along with any untagged parent images that were
+        referenced by that image.
 
 
-        Images can't be removed if they have descendant images, are being used by a running container or are being used by a build.
+        Images can't be removed if they have descendant images, are being
+        used by a running container or are being used by a build.
       operationId: "ImageDelete"
       operationId: "ImageDelete"
-      produces:
-        - "application/json"
+      produces: ["application/json"]
       responses:
       responses:
         200:
         200:
-          description: "No error"
+          description: "The image was deleted successfully"
           schema:
           schema:
             type: "array"
             type: "array"
             items:
             items:
-              $ref: "#/definitions/ImageDeleteResponse"
+              $ref: "#/definitions/ImageDeleteResponseItem"
           examples:
           examples:
             application/json:
             application/json:
               - Untagged: "3e2f21a89f"
               - Untagged: "3e2f21a89f"
@@ -4879,7 +4920,7 @@ paths:
                 description: "Images that were deleted"
                 description: "Images that were deleted"
                 type: "array"
                 type: "array"
                 items:
                 items:
-                  $ref: "#/definitions/ImageDeleteResponse"
+                  $ref: "#/definitions/ImageDeleteResponseItem"
               SpaceReclaimed:
               SpaceReclaimed:
                 description: "Disk space reclaimed in bytes"
                 description: "Disk space reclaimed in bytes"
                 type: "integer"
                 type: "integer"
@@ -5145,8 +5186,7 @@ paths:
       summary: "Get version"
       summary: "Get version"
       description: "Returns the version of Docker that is running and various information about the system that Docker is running on."
       description: "Returns the version of Docker that is running and various information about the system that Docker is running on."
       operationId: "SystemVersion"
       operationId: "SystemVersion"
-      produces:
-        - "application/json"
+      produces: ["application/json"]
       responses:
       responses:
         200:
         200:
           description: "no error"
           description: "no error"
@@ -5195,14 +5235,20 @@ paths:
       summary: "Ping"
       summary: "Ping"
       description: "This is a dummy endpoint you can use to test if the server is accessible."
       description: "This is a dummy endpoint you can use to test if the server is accessible."
       operationId: "SystemPing"
       operationId: "SystemPing"
-      produces:
-        - "text/plain"
+      produces: ["text/plain"]
       responses:
       responses:
         200:
         200:
           description: "no error"
           description: "no error"
           schema:
           schema:
             type: "string"
             type: "string"
             example: "OK"
             example: "OK"
+          headers:
+            API-Version:
+              type: "string"
+              description: "Max API Version the server supports"
+            Docker-Experimental:
+              type: "boolean"
+              description: "If the server is running with experimental mode enabled"
         500:
         500:
           description: "server error"
           description: "server error"
           schema:
           schema:
@@ -7293,7 +7339,7 @@ paths:
         200:
         200:
           description: "no error"
           description: "no error"
           schema:
           schema:
-            $ref: "#/definitions/ImageDeleteResponse"
+            $ref: "#/definitions/ServiceUpdateResponse"
         400:
         400:
           description: "bad parameter"
           description: "bad parameter"
           schema:
           schema:

+ 21 - 0
api/types/container/container_changes.go

@@ -0,0 +1,21 @@
+package container
+
+// ----------------------------------------------------------------------------
+// DO NOT EDIT THIS FILE
+// This file was generated by `swagger generate operation`
+//
+// See hack/generate-swagger-api.sh
+// ----------------------------------------------------------------------------
+
+// ContainerChangeResponseItem container change response item
+// swagger:model ContainerChangeResponseItem
+type ContainerChangeResponseItem struct {
+
+	// Kind of change
+	// Required: true
+	Kind uint8 `json:"Kind"`
+
+	// Path to file that has changed
+	// Required: true
+	Path string `json:"Path"`
+}

+ 21 - 0
api/types/container/container_top.go

@@ -0,0 +1,21 @@
+package container
+
+// ----------------------------------------------------------------------------
+// DO NOT EDIT THIS FILE
+// This file was generated by `swagger generate operation`
+//
+// See hack/generate-swagger-api.sh
+// ----------------------------------------------------------------------------
+
+// ContainerTopOKBody container top o k body
+// swagger:model ContainerTopOKBody
+type ContainerTopOKBody struct {
+
+	// Each process running in the container, where each is process is an array of values corresponding to the titles
+	// Required: true
+	Processes [][]string `json:"Processes"`
+
+	// The ps column titles
+	// Required: true
+	Titles []string `json:"Titles"`
+}

+ 17 - 0
api/types/graph_driver_data.go

@@ -0,0 +1,17 @@
+package types
+
+// This file was generated by the swagger tool.
+// Editing this file might prove futile when you re-run the swagger generate command
+
+// GraphDriverData Information about a container's graph driver.
+// swagger:model GraphDriverData
+type GraphDriverData struct {
+
+	// data
+	// Required: true
+	Data map[string]string `json:"Data"`
+
+	// name
+	// Required: true
+	Name string `json:"Name"`
+}

+ 37 - 0
api/types/image/image_history.go

@@ -0,0 +1,37 @@
+package image
+
+// ----------------------------------------------------------------------------
+// DO NOT EDIT THIS FILE
+// This file was generated by `swagger generate operation`
+//
+// See hack/generate-swagger-api.sh
+// ----------------------------------------------------------------------------
+
+// HistoryResponseItem history response item
+// swagger:model HistoryResponseItem
+type HistoryResponseItem struct {
+
+	// comment
+	// Required: true
+	Comment string `json:"Comment"`
+
+	// created
+	// Required: true
+	Created int64 `json:"Created"`
+
+	// created by
+	// Required: true
+	CreatedBy string `json:"CreatedBy"`
+
+	// Id
+	// Required: true
+	ID string `json:"Id"`
+
+	// size
+	// Required: true
+	Size int64 `json:"Size"`
+
+	// tags
+	// Required: true
+	Tags []string `json:"Tags"`
+}

+ 15 - 0
api/types/image_delete_response_item.go

@@ -0,0 +1,15 @@
+package types
+
+// This file was generated by the swagger tool.
+// Editing this file might prove futile when you re-run the swagger generate command
+
+// ImageDeleteResponseItem image delete response item
+// swagger:model ImageDeleteResponseItem
+type ImageDeleteResponseItem struct {
+
+	// The image ID of an image that was deleted
+	Deleted string `json:"Deleted,omitempty"`
+
+	// The image ID of an image that was untagged
+	Untagged string `json:"Untagged,omitempty"`
+}

+ 1 - 40
api/types/types.go

@@ -17,38 +17,6 @@ import (
 	"github.com/docker/go-connections/nat"
 	"github.com/docker/go-connections/nat"
 )
 )
 
 
-// ContainerChange contains response of Engine API:
-// GET "/containers/{name:.*}/changes"
-type ContainerChange struct {
-	Kind int
-	Path string
-}
-
-// ImageHistory contains response of Engine API:
-// GET "/images/{name:.*}/history"
-type ImageHistory struct {
-	ID        string `json:"Id"`
-	Created   int64
-	CreatedBy string
-	Tags      []string
-	Size      int64
-	Comment   string
-}
-
-// ImageDelete contains response of Engine API:
-// DELETE "/images/{name:.*}"
-type ImageDelete struct {
-	Untagged string `json:",omitempty"`
-	Deleted  string `json:",omitempty"`
-}
-
-// GraphDriverData returns Image's graph driver config info
-// when calling inspect command
-type GraphDriverData struct {
-	Name string
-	Data map[string]string
-}
-
 // RootFS returns Image's RootFS description including the layer IDs.
 // RootFS returns Image's RootFS description including the layer IDs.
 type RootFS struct {
 type RootFS struct {
 	Type      string
 	Type      string
@@ -125,13 +93,6 @@ type ContainerStats struct {
 	OSType string        `json:"ostype"`
 	OSType string        `json:"ostype"`
 }
 }
 
 
-// ContainerProcessList contains response of Engine API:
-// GET "/containers/{name:.*}/top"
-type ContainerProcessList struct {
-	Processes [][]string
-	Titles    []string
-}
-
 // Ping contains response of Engine API:
 // Ping contains response of Engine API:
 // GET "/_ping"
 // GET "/_ping"
 type Ping struct {
 type Ping struct {
@@ -526,7 +487,7 @@ type VolumesPruneReport struct {
 // ImagesPruneReport contains the response for Engine API:
 // ImagesPruneReport contains the response for Engine API:
 // POST "/images/prune"
 // POST "/images/prune"
 type ImagesPruneReport struct {
 type ImagesPruneReport struct {
-	ImagesDeleted  []ImageDelete
+	ImagesDeleted  []ImageDeleteResponseItem
 	SpaceReclaimed uint64
 	SpaceReclaimed uint64
 }
 }
 
 

+ 3 - 3
client/container_diff.go

@@ -4,13 +4,13 @@ import (
 	"encoding/json"
 	"encoding/json"
 	"net/url"
 	"net/url"
 
 
-	"github.com/docker/docker/api/types"
+	"github.com/docker/docker/api/types/container"
 	"golang.org/x/net/context"
 	"golang.org/x/net/context"
 )
 )
 
 
 // ContainerDiff shows differences in a container filesystem since it was started.
 // ContainerDiff shows differences in a container filesystem since it was started.
-func (cli *Client) ContainerDiff(ctx context.Context, containerID string) ([]types.ContainerChange, error) {
-	var changes []types.ContainerChange
+func (cli *Client) ContainerDiff(ctx context.Context, containerID string) ([]container.ContainerChangeResponseItem, error) {
+	var changes []container.ContainerChangeResponseItem
 
 
 	serverResp, err := cli.get(ctx, "/containers/"+containerID+"/changes", url.Values{}, nil)
 	serverResp, err := cli.get(ctx, "/containers/"+containerID+"/changes", url.Values{}, nil)
 	if err != nil {
 	if err != nil {

+ 2 - 2
client/container_diff_test.go

@@ -9,7 +9,7 @@ import (
 	"strings"
 	"strings"
 	"testing"
 	"testing"
 
 
-	"github.com/docker/docker/api/types"
+	"github.com/docker/docker/api/types/container"
 	"golang.org/x/net/context"
 	"golang.org/x/net/context"
 )
 )
 
 
@@ -31,7 +31,7 @@ func TestContainerDiff(t *testing.T) {
 			if !strings.HasPrefix(req.URL.Path, expectedURL) {
 			if !strings.HasPrefix(req.URL.Path, expectedURL) {
 				return nil, fmt.Errorf("Expected URL '%s', got '%s'", expectedURL, req.URL)
 				return nil, fmt.Errorf("Expected URL '%s', got '%s'", expectedURL, req.URL)
 			}
 			}
-			b, err := json.Marshal([]types.ContainerChange{
+			b, err := json.Marshal([]container.ContainerChangeResponseItem{
 				{
 				{
 					Kind: 0,
 					Kind: 0,
 					Path: "/path/1",
 					Path: "/path/1",

+ 3 - 3
client/container_top.go

@@ -5,13 +5,13 @@ import (
 	"net/url"
 	"net/url"
 	"strings"
 	"strings"
 
 
-	"github.com/docker/docker/api/types"
+	"github.com/docker/docker/api/types/container"
 	"golang.org/x/net/context"
 	"golang.org/x/net/context"
 )
 )
 
 
 // ContainerTop shows process information from within a container.
 // ContainerTop shows process information from within a container.
-func (cli *Client) ContainerTop(ctx context.Context, containerID string, arguments []string) (types.ContainerProcessList, error) {
-	var response types.ContainerProcessList
+func (cli *Client) ContainerTop(ctx context.Context, containerID string, arguments []string) (container.ContainerTopOKBody, error) {
+	var response container.ContainerTopOKBody
 	query := url.Values{}
 	query := url.Values{}
 	if len(arguments) > 0 {
 	if len(arguments) > 0 {
 		query.Set("ps_args", strings.Join(arguments, " "))
 		query.Set("ps_args", strings.Join(arguments, " "))

+ 2 - 2
client/container_top_test.go

@@ -10,7 +10,7 @@ import (
 	"strings"
 	"strings"
 	"testing"
 	"testing"
 
 
-	"github.com/docker/docker/api/types"
+	"github.com/docker/docker/api/types/container"
 	"golang.org/x/net/context"
 	"golang.org/x/net/context"
 )
 )
 
 
@@ -43,7 +43,7 @@ func TestContainerTop(t *testing.T) {
 				return nil, fmt.Errorf("args not set in URL query properly. Expected 'arg1 arg2', got %v", args)
 				return nil, fmt.Errorf("args not set in URL query properly. Expected 'arg1 arg2', got %v", args)
 			}
 			}
 
 
-			b, err := json.Marshal(types.ContainerProcessList{
+			b, err := json.Marshal(container.ContainerTopOKBody{
 				Processes: [][]string{
 				Processes: [][]string{
 					{"p1", "p2"},
 					{"p1", "p2"},
 					{"p3"},
 					{"p3"},

+ 3 - 3
client/image_history.go

@@ -4,13 +4,13 @@ import (
 	"encoding/json"
 	"encoding/json"
 	"net/url"
 	"net/url"
 
 
-	"github.com/docker/docker/api/types"
+	"github.com/docker/docker/api/types/image"
 	"golang.org/x/net/context"
 	"golang.org/x/net/context"
 )
 )
 
 
 // ImageHistory returns the changes in an image in history format.
 // ImageHistory returns the changes in an image in history format.
-func (cli *Client) ImageHistory(ctx context.Context, imageID string) ([]types.ImageHistory, error) {
-	var history []types.ImageHistory
+func (cli *Client) ImageHistory(ctx context.Context, imageID string) ([]image.HistoryResponseItem, error) {
+	var history []image.HistoryResponseItem
 	serverResp, err := cli.get(ctx, "/images/"+imageID+"/history", url.Values{}, nil)
 	serverResp, err := cli.get(ctx, "/images/"+imageID+"/history", url.Values{}, nil)
 	if err != nil {
 	if err != nil {
 		return history, err
 		return history, err

+ 2 - 2
client/image_history_test.go

@@ -9,7 +9,7 @@ import (
 	"strings"
 	"strings"
 	"testing"
 	"testing"
 
 
-	"github.com/docker/docker/api/types"
+	"github.com/docker/docker/api/types/image"
 	"golang.org/x/net/context"
 	"golang.org/x/net/context"
 )
 )
 
 
@@ -30,7 +30,7 @@ func TestImageHistory(t *testing.T) {
 			if !strings.HasPrefix(r.URL.Path, expectedURL) {
 			if !strings.HasPrefix(r.URL.Path, expectedURL) {
 				return nil, fmt.Errorf("Expected URL '%s', got '%s'", expectedURL, r.URL)
 				return nil, fmt.Errorf("Expected URL '%s', got '%s'", expectedURL, r.URL)
 			}
 			}
-			b, err := json.Marshal([]types.ImageHistory{
+			b, err := json.Marshal([]image.HistoryResponseItem{
 				{
 				{
 					ID:   "image_id1",
 					ID:   "image_id1",
 					Tags: []string{"tag1", "tag2"},
 					Tags: []string{"tag1", "tag2"},

+ 2 - 2
client/image_remove.go

@@ -9,7 +9,7 @@ import (
 )
 )
 
 
 // ImageRemove removes an image from the docker host.
 // ImageRemove removes an image from the docker host.
-func (cli *Client) ImageRemove(ctx context.Context, imageID string, options types.ImageRemoveOptions) ([]types.ImageDelete, error) {
+func (cli *Client) ImageRemove(ctx context.Context, imageID string, options types.ImageRemoveOptions) ([]types.ImageDeleteResponseItem, error) {
 	query := url.Values{}
 	query := url.Values{}
 
 
 	if options.Force {
 	if options.Force {
@@ -24,7 +24,7 @@ func (cli *Client) ImageRemove(ctx context.Context, imageID string, options type
 		return nil, err
 		return nil, err
 	}
 	}
 
 
-	var dels []types.ImageDelete
+	var dels []types.ImageDeleteResponseItem
 	err = json.NewDecoder(resp.body).Decode(&dels)
 	err = json.NewDecoder(resp.body).Decode(&dels)
 	ensureReaderClosed(resp)
 	ensureReaderClosed(resp)
 	return dels, err
 	return dels, err

+ 1 - 1
client/image_remove_test.go

@@ -63,7 +63,7 @@ func TestImageRemove(t *testing.T) {
 						return nil, fmt.Errorf("%s not set in URL query properly. Expected '%s', got %s", key, expected, actual)
 						return nil, fmt.Errorf("%s not set in URL query properly. Expected '%s', got %s", key, expected, actual)
 					}
 					}
 				}
 				}
-				b, err := json.Marshal([]types.ImageDelete{
+				b, err := json.Marshal([]types.ImageDeleteResponseItem{
 					{
 					{
 						Untagged: "image_id1",
 						Untagged: "image_id1",
 					},
 					},

+ 5 - 4
client/interface.go

@@ -8,6 +8,7 @@ import (
 	"github.com/docker/docker/api/types/container"
 	"github.com/docker/docker/api/types/container"
 	"github.com/docker/docker/api/types/events"
 	"github.com/docker/docker/api/types/events"
 	"github.com/docker/docker/api/types/filters"
 	"github.com/docker/docker/api/types/filters"
+	"github.com/docker/docker/api/types/image"
 	"github.com/docker/docker/api/types/network"
 	"github.com/docker/docker/api/types/network"
 	"github.com/docker/docker/api/types/registry"
 	"github.com/docker/docker/api/types/registry"
 	"github.com/docker/docker/api/types/swarm"
 	"github.com/docker/docker/api/types/swarm"
@@ -37,7 +38,7 @@ type ContainerAPIClient interface {
 	ContainerAttach(ctx context.Context, container string, options types.ContainerAttachOptions) (types.HijackedResponse, error)
 	ContainerAttach(ctx context.Context, container string, options types.ContainerAttachOptions) (types.HijackedResponse, error)
 	ContainerCommit(ctx context.Context, container string, options types.ContainerCommitOptions) (types.IDResponse, error)
 	ContainerCommit(ctx context.Context, container string, options types.ContainerCommitOptions) (types.IDResponse, error)
 	ContainerCreate(ctx context.Context, config *container.Config, hostConfig *container.HostConfig, networkingConfig *network.NetworkingConfig, containerName string) (container.ContainerCreateCreatedBody, error)
 	ContainerCreate(ctx context.Context, config *container.Config, hostConfig *container.HostConfig, networkingConfig *network.NetworkingConfig, containerName string) (container.ContainerCreateCreatedBody, error)
-	ContainerDiff(ctx context.Context, container string) ([]types.ContainerChange, error)
+	ContainerDiff(ctx context.Context, container string) ([]container.ContainerChangeResponseItem, error)
 	ContainerExecAttach(ctx context.Context, execID string, config types.ExecConfig) (types.HijackedResponse, error)
 	ContainerExecAttach(ctx context.Context, execID string, config types.ExecConfig) (types.HijackedResponse, error)
 	ContainerExecCreate(ctx context.Context, container string, config types.ExecConfig) (types.IDResponse, error)
 	ContainerExecCreate(ctx context.Context, container string, config types.ExecConfig) (types.IDResponse, error)
 	ContainerExecInspect(ctx context.Context, execID string) (types.ContainerExecInspect, error)
 	ContainerExecInspect(ctx context.Context, execID string) (types.ContainerExecInspect, error)
@@ -58,7 +59,7 @@ type ContainerAPIClient interface {
 	ContainerStats(ctx context.Context, container string, stream bool) (types.ContainerStats, error)
 	ContainerStats(ctx context.Context, container string, stream bool) (types.ContainerStats, error)
 	ContainerStart(ctx context.Context, container string, options types.ContainerStartOptions) error
 	ContainerStart(ctx context.Context, container string, options types.ContainerStartOptions) error
 	ContainerStop(ctx context.Context, container string, timeout *time.Duration) error
 	ContainerStop(ctx context.Context, container string, timeout *time.Duration) error
-	ContainerTop(ctx context.Context, container string, arguments []string) (types.ContainerProcessList, error)
+	ContainerTop(ctx context.Context, container string, arguments []string) (container.ContainerTopOKBody, error)
 	ContainerUnpause(ctx context.Context, container string) error
 	ContainerUnpause(ctx context.Context, container string) error
 	ContainerUpdate(ctx context.Context, container string, updateConfig container.UpdateConfig) (container.ContainerUpdateOKBody, error)
 	ContainerUpdate(ctx context.Context, container string, updateConfig container.UpdateConfig) (container.ContainerUpdateOKBody, error)
 	ContainerWait(ctx context.Context, container string) (int64, error)
 	ContainerWait(ctx context.Context, container string) (int64, error)
@@ -71,14 +72,14 @@ type ContainerAPIClient interface {
 type ImageAPIClient interface {
 type ImageAPIClient interface {
 	ImageBuild(ctx context.Context, context io.Reader, options types.ImageBuildOptions) (types.ImageBuildResponse, error)
 	ImageBuild(ctx context.Context, context io.Reader, options types.ImageBuildOptions) (types.ImageBuildResponse, error)
 	ImageCreate(ctx context.Context, parentReference string, options types.ImageCreateOptions) (io.ReadCloser, error)
 	ImageCreate(ctx context.Context, parentReference string, options types.ImageCreateOptions) (io.ReadCloser, error)
-	ImageHistory(ctx context.Context, image string) ([]types.ImageHistory, error)
+	ImageHistory(ctx context.Context, image string) ([]image.HistoryResponseItem, error)
 	ImageImport(ctx context.Context, source types.ImageImportSource, ref string, options types.ImageImportOptions) (io.ReadCloser, error)
 	ImageImport(ctx context.Context, source types.ImageImportSource, ref string, options types.ImageImportOptions) (io.ReadCloser, error)
 	ImageInspectWithRaw(ctx context.Context, image string) (types.ImageInspect, []byte, error)
 	ImageInspectWithRaw(ctx context.Context, image string) (types.ImageInspect, []byte, error)
 	ImageList(ctx context.Context, options types.ImageListOptions) ([]types.ImageSummary, error)
 	ImageList(ctx context.Context, options types.ImageListOptions) ([]types.ImageSummary, error)
 	ImageLoad(ctx context.Context, input io.Reader, quiet bool) (types.ImageLoadResponse, error)
 	ImageLoad(ctx context.Context, input io.Reader, quiet bool) (types.ImageLoadResponse, error)
 	ImagePull(ctx context.Context, ref string, options types.ImagePullOptions) (io.ReadCloser, error)
 	ImagePull(ctx context.Context, ref string, options types.ImagePullOptions) (io.ReadCloser, error)
 	ImagePush(ctx context.Context, ref string, options types.ImagePushOptions) (io.ReadCloser, error)
 	ImagePush(ctx context.Context, ref string, options types.ImagePushOptions) (io.ReadCloser, error)
-	ImageRemove(ctx context.Context, image string, options types.ImageRemoveOptions) ([]types.ImageDelete, error)
+	ImageRemove(ctx context.Context, image string, options types.ImageRemoveOptions) ([]types.ImageDeleteResponseItem, error)
 	ImageSearch(ctx context.Context, term string, options types.ImageSearchOptions) ([]registry.SearchResult, error)
 	ImageSearch(ctx context.Context, term string, options types.ImageSearchOptions) ([]registry.SearchResult, error)
 	ImageSave(ctx context.Context, images []string) (io.ReadCloser, error)
 	ImageSave(ctx context.Context, images []string) (io.ReadCloser, error)
 	ImageTag(ctx context.Context, image, ref string) error
 	ImageTag(ctx context.Context, image, ref string) error

+ 11 - 11
daemon/image_delete.go

@@ -61,9 +61,9 @@ const (
 // FIXME: remove ImageDelete's dependency on Daemon, then move to the graph
 // FIXME: remove ImageDelete's dependency on Daemon, then move to the graph
 // package. This would require that we no longer need the daemon to determine
 // package. This would require that we no longer need the daemon to determine
 // whether images are being used by a stopped or running container.
 // whether images are being used by a stopped or running container.
-func (daemon *Daemon) ImageDelete(imageRef string, force, prune bool) ([]types.ImageDelete, error) {
+func (daemon *Daemon) ImageDelete(imageRef string, force, prune bool) ([]types.ImageDeleteResponseItem, error) {
 	start := time.Now()
 	start := time.Now()
-	records := []types.ImageDelete{}
+	records := []types.ImageDeleteResponseItem{}
 
 
 	imgID, err := daemon.GetImageID(imageRef)
 	imgID, err := daemon.GetImageID(imageRef)
 	if err != nil {
 	if err != nil {
@@ -99,7 +99,7 @@ func (daemon *Daemon) ImageDelete(imageRef string, force, prune bool) ([]types.I
 			return nil, err
 			return nil, err
 		}
 		}
 
 
-		untaggedRecord := types.ImageDelete{Untagged: parsedRef.String()}
+		untaggedRecord := types.ImageDeleteResponseItem{Untagged: parsedRef.String()}
 
 
 		daemon.LogImageEvent(imgID.String(), imgID.String(), "untag")
 		daemon.LogImageEvent(imgID.String(), imgID.String(), "untag")
 		records = append(records, untaggedRecord)
 		records = append(records, untaggedRecord)
@@ -126,7 +126,7 @@ func (daemon *Daemon) ImageDelete(imageRef string, force, prune bool) ([]types.I
 							return records, err
 							return records, err
 						}
 						}
 
 
-						untaggedRecord := types.ImageDelete{Untagged: repoRef.String()}
+						untaggedRecord := types.ImageDeleteResponseItem{Untagged: repoRef.String()}
 						records = append(records, untaggedRecord)
 						records = append(records, untaggedRecord)
 					} else {
 					} else {
 						remainingRefs = append(remainingRefs, repoRef)
 						remainingRefs = append(remainingRefs, repoRef)
@@ -162,7 +162,7 @@ func (daemon *Daemon) ImageDelete(imageRef string, force, prune bool) ([]types.I
 					return nil, err
 					return nil, err
 				}
 				}
 
 
-				untaggedRecord := types.ImageDelete{Untagged: parsedRef.String()}
+				untaggedRecord := types.ImageDeleteResponseItem{Untagged: parsedRef.String()}
 
 
 				daemon.LogImageEvent(imgID.String(), imgID.String(), "untag")
 				daemon.LogImageEvent(imgID.String(), imgID.String(), "untag")
 				records = append(records, untaggedRecord)
 				records = append(records, untaggedRecord)
@@ -244,9 +244,9 @@ func (daemon *Daemon) removeImageRef(ref reference.Named) (reference.Named, erro
 // removeAllReferencesToImageID attempts to remove every reference to the given
 // removeAllReferencesToImageID attempts to remove every reference to the given
 // imgID from this daemon's store of repository tag/digest references. Returns
 // imgID from this daemon's store of repository tag/digest references. Returns
 // on the first encountered error. Removed references are logged to this
 // on the first encountered error. Removed references are logged to this
-// daemon's event service. An "Untagged" types.ImageDelete is added to the
+// daemon's event service. An "Untagged" types.ImageDeleteResponseItem is added to the
 // given list of records.
 // given list of records.
-func (daemon *Daemon) removeAllReferencesToImageID(imgID image.ID, records *[]types.ImageDelete) error {
+func (daemon *Daemon) removeAllReferencesToImageID(imgID image.ID, records *[]types.ImageDeleteResponseItem) error {
 	imageRefs := daemon.referenceStore.References(imgID.Digest())
 	imageRefs := daemon.referenceStore.References(imgID.Digest())
 
 
 	for _, imageRef := range imageRefs {
 	for _, imageRef := range imageRefs {
@@ -255,7 +255,7 @@ func (daemon *Daemon) removeAllReferencesToImageID(imgID image.ID, records *[]ty
 			return err
 			return err
 		}
 		}
 
 
-		untaggedRecord := types.ImageDelete{Untagged: parsedRef.String()}
+		untaggedRecord := types.ImageDeleteResponseItem{Untagged: parsedRef.String()}
 
 
 		daemon.LogImageEvent(imgID.String(), imgID.String(), "untag")
 		daemon.LogImageEvent(imgID.String(), imgID.String(), "untag")
 		*records = append(*records, untaggedRecord)
 		*records = append(*records, untaggedRecord)
@@ -295,7 +295,7 @@ func (idc *imageDeleteConflict) Error() string {
 // conflict is encountered, it will be returned immediately without deleting
 // conflict is encountered, it will be returned immediately without deleting
 // the image. If quiet is true, any encountered conflicts will be ignored and
 // the image. If quiet is true, any encountered conflicts will be ignored and
 // the function will return nil immediately without deleting the image.
 // the function will return nil immediately without deleting the image.
-func (daemon *Daemon) imageDeleteHelper(imgID image.ID, records *[]types.ImageDelete, force, prune, quiet bool) error {
+func (daemon *Daemon) imageDeleteHelper(imgID image.ID, records *[]types.ImageDeleteResponseItem, force, prune, quiet bool) error {
 	// First, determine if this image has any conflicts. Ignore soft conflicts
 	// First, determine if this image has any conflicts. Ignore soft conflicts
 	// if force is true.
 	// if force is true.
 	c := conflictHard
 	c := conflictHard
@@ -331,9 +331,9 @@ func (daemon *Daemon) imageDeleteHelper(imgID image.ID, records *[]types.ImageDe
 	}
 	}
 
 
 	daemon.LogImageEvent(imgID.String(), imgID.String(), "delete")
 	daemon.LogImageEvent(imgID.String(), imgID.String(), "delete")
-	*records = append(*records, types.ImageDelete{Deleted: imgID.String()})
+	*records = append(*records, types.ImageDeleteResponseItem{Deleted: imgID.String()})
 	for _, removedLayer := range removedLayers {
 	for _, removedLayer := range removedLayers {
-		*records = append(*records, types.ImageDelete{Deleted: removedLayer.ChainID.String()})
+		*records = append(*records, types.ImageDeleteResponseItem{Deleted: removedLayer.ChainID.String()})
 	}
 	}
 
 
 	if !prune || parent == "" {
 	if !prune || parent == "" {

+ 4 - 4
daemon/image_history.go

@@ -4,21 +4,21 @@ import (
 	"fmt"
 	"fmt"
 	"time"
 	"time"
 
 
-	"github.com/docker/docker/api/types"
+	"github.com/docker/docker/api/types/image"
 	"github.com/docker/docker/layer"
 	"github.com/docker/docker/layer"
 	"github.com/docker/docker/reference"
 	"github.com/docker/docker/reference"
 )
 )
 
 
 // ImageHistory returns a slice of ImageHistory structures for the specified image
 // ImageHistory returns a slice of ImageHistory structures for the specified image
 // name by walking the image lineage.
 // name by walking the image lineage.
-func (daemon *Daemon) ImageHistory(name string) ([]*types.ImageHistory, error) {
+func (daemon *Daemon) ImageHistory(name string) ([]*image.HistoryResponseItem, error) {
 	start := time.Now()
 	start := time.Now()
 	img, err := daemon.GetImage(name)
 	img, err := daemon.GetImage(name)
 	if err != nil {
 	if err != nil {
 		return nil, err
 		return nil, err
 	}
 	}
 
 
-	history := []*types.ImageHistory{}
+	history := []*image.HistoryResponseItem{}
 
 
 	layerCounter := 0
 	layerCounter := 0
 	rootFS := *img.RootFS
 	rootFS := *img.RootFS
@@ -46,7 +46,7 @@ func (daemon *Daemon) ImageHistory(name string) ([]*types.ImageHistory, error) {
 			layerCounter++
 			layerCounter++
 		}
 		}
 
 
-		history = append([]*types.ImageHistory{{
+		history = append([]*image.HistoryResponseItem{{
 			ID:        "<missing>",
 			ID:        "<missing>",
 			Created:   h.Created.Unix(),
 			Created:   h.Created.Unix(),
 			CreatedBy: h.CreatedBy,
 			CreatedBy: h.CreatedBy,

+ 1 - 1
daemon/prune.go

@@ -132,7 +132,7 @@ func (daemon *Daemon) ImagesPrune(pruneFilters filters.Args) (*types.ImagesPrune
 			continue
 			continue
 		}
 		}
 
 
-		deletedImages := []types.ImageDelete{}
+		deletedImages := []types.ImageDeleteResponseItem{}
 		refs := daemon.referenceStore.References(dgst)
 		refs := daemon.referenceStore.References(dgst)
 		if len(refs) > 0 {
 		if len(refs) > 0 {
 			shouldDelete := !danglingOnly
 			shouldDelete := !danglingOnly

+ 4 - 4
daemon/top_unix.go

@@ -9,7 +9,7 @@ import (
 	"strconv"
 	"strconv"
 	"strings"
 	"strings"
 
 
-	"github.com/docker/docker/api/types"
+	"github.com/docker/docker/api/types/container"
 )
 )
 
 
 func validatePSArgs(psArgs string) error {
 func validatePSArgs(psArgs string) error {
@@ -41,8 +41,8 @@ func fieldsASCII(s string) []string {
 	return strings.FieldsFunc(s, fn)
 	return strings.FieldsFunc(s, fn)
 }
 }
 
 
-func parsePSOutput(output []byte, pids []int) (*types.ContainerProcessList, error) {
-	procList := &types.ContainerProcessList{}
+func parsePSOutput(output []byte, pids []int) (*container.ContainerTopOKBody, error) {
+	procList := &container.ContainerTopOKBody{}
 
 
 	lines := strings.Split(string(output), "\n")
 	lines := strings.Split(string(output), "\n")
 	procList.Titles = fieldsASCII(lines[0])
 	procList.Titles = fieldsASCII(lines[0])
@@ -86,7 +86,7 @@ func parsePSOutput(output []byte, pids []int) (*types.ContainerProcessList, erro
 // "-ef" if no args are given.  An error is returned if the container
 // "-ef" if no args are given.  An error is returned if the container
 // is not found, or is not running, or if there are any problems
 // is not found, or is not running, or if there are any problems
 // running ps, or parsing the output.
 // running ps, or parsing the output.
-func (daemon *Daemon) ContainerTop(name string, psArgs string) (*types.ContainerProcessList, error) {
+func (daemon *Daemon) ContainerTop(name string, psArgs string) (*container.ContainerTopOKBody, error) {
 	if psArgs == "" {
 	if psArgs == "" {
 		psArgs = "-ef"
 		psArgs = "-ef"
 	}
 	}

+ 3 - 3
daemon/top_windows.go

@@ -5,7 +5,7 @@ import (
 	"fmt"
 	"fmt"
 	"time"
 	"time"
 
 
-	"github.com/docker/docker/api/types"
+	containertypes "github.com/docker/docker/api/types/container"
 	"github.com/docker/go-units"
 	"github.com/docker/go-units"
 )
 )
 
 
@@ -23,7 +23,7 @@ import (
 //    task manager does and use the private working set as the memory counter.
 //    task manager does and use the private working set as the memory counter.
 //    We could return more info for those who really understand how memory
 //    We could return more info for those who really understand how memory
 //    management works in Windows if we introduced a "raw" stats (above).
 //    management works in Windows if we introduced a "raw" stats (above).
-func (daemon *Daemon) ContainerTop(name string, psArgs string) (*types.ContainerProcessList, error) {
+func (daemon *Daemon) ContainerTop(name string, psArgs string) (*containertypes.ContainerTopOKBody, error) {
 	// It's not at all an equivalent to linux 'ps' on Windows
 	// It's not at all an equivalent to linux 'ps' on Windows
 	if psArgs != "" {
 	if psArgs != "" {
 		return nil, errors.New("Windows does not support arguments to top")
 		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
 	if err != nil {
 	if err != nil {
 		return nil, err
 		return nil, err
 	}
 	}
-	procList := &types.ContainerProcessList{}
+	procList := &containertypes.ContainerTopOKBody{}
 	procList.Titles = []string{"Name", "PID", "CPU", "Private Working Set"}
 	procList.Titles = []string{"Name", "PID", "CPU", "Private Working Set"}
 
 
 	for _, j := range s {
 	for _, j := range s {

+ 14 - 9
hack/generate-swagger-api.sh

@@ -3,20 +3,25 @@ set -eu
 
 
 swagger generate model -f api/swagger.yaml \
 swagger generate model -f api/swagger.yaml \
     -t api -m types --skip-validator -C api/swagger-gen.yaml \
     -t api -m types --skip-validator -C api/swagger-gen.yaml \
-    -n Volume \
-    -n Port \
-    -n ImageSummary \
-    -n Plugin -n PluginDevice -n PluginMount -n PluginEnv -n PluginInterfaceType \
     -n ErrorResponse \
     -n ErrorResponse \
+    -n GraphDriverData \
     -n IdResponse \
     -n IdResponse \
-    -n ServiceUpdateResponse
+    -n ImageDeleteResponseItem \
+    -n ImageSummary \
+    -n Plugin -n PluginDevice -n PluginMount -n PluginEnv -n PluginInterfaceType \
+    -n Port \
+    -n ServiceUpdateResponse \
+    -n Volume
 
 
 swagger generate operation -f api/swagger.yaml \
 swagger generate operation -f api/swagger.yaml \
     -t api -a types -m types -C api/swagger-gen.yaml \
     -t api -a types -m types -C api/swagger-gen.yaml \
     -T api/templates --skip-responses --skip-parameters --skip-validator \
     -T api/templates --skip-responses --skip-parameters --skip-validator \
-    -n VolumesList \
-    -n VolumesCreate \
+    -n Authenticate \
+    -n ContainerChanges \
     -n ContainerCreate \
     -n ContainerCreate \
+    -n ContainerTop \
     -n ContainerUpdate \
     -n ContainerUpdate \
-    -n Authenticate \
-    -n ContainerWait
+    -n ContainerWait \
+    -n ImageHistory \
+    -n VolumesCreate \
+    -n VolumesList

+ 2 - 1
integration-cli/docker_api_images_test.go

@@ -7,6 +7,7 @@ import (
 	"strings"
 	"strings"
 
 
 	"github.com/docker/docker/api/types"
 	"github.com/docker/docker/api/types"
+	"github.com/docker/docker/api/types/image"
 	"github.com/docker/docker/integration-cli/checker"
 	"github.com/docker/docker/integration-cli/checker"
 	"github.com/docker/docker/integration-cli/request"
 	"github.com/docker/docker/integration-cli/request"
 	"github.com/go-check/check"
 	"github.com/go-check/check"
@@ -106,7 +107,7 @@ func (s *DockerSuite) TestAPIImagesHistory(c *check.C) {
 	c.Assert(err, checker.IsNil)
 	c.Assert(err, checker.IsNil)
 	c.Assert(status, checker.Equals, http.StatusOK)
 	c.Assert(status, checker.Equals, http.StatusOK)
 
 
-	var historydata []types.ImageHistory
+	var historydata []image.HistoryResponseItem
 	err = json.Unmarshal(body, &historydata)
 	err = json.Unmarshal(body, &historydata)
 	c.Assert(err, checker.IsNil, check.Commentf("Error on unmarshal"))
 	c.Assert(err, checker.IsNil, check.Commentf("Error on unmarshal"))