This was broken by bf6a790f00ab96bb8857e3c73502909ee5e36217
Signed-off-by: Brian Goff <cpuguy83@gmail.com>
| ... | ... |
@@ -22,7 +22,7 @@ func (v *volumeRouter) getVolumesList(ctx context.Context, w http.ResponseWriter |
| 22 | 22 |
if err != nil {
|
| 23 | 23 |
return err |
| 24 | 24 |
} |
| 25 |
- return httputils.WriteJSON(w, http.StatusOK, &volumetypes.VolumesListOKBody{Volumes: volumes, Warnings: warnings})
|
|
| 25 |
+ return httputils.WriteJSON(w, http.StatusOK, &volumetypes.VolumeListOKBody{Volumes: volumes, Warnings: warnings})
|
|
| 26 | 26 |
} |
| 27 | 27 |
|
| 28 | 28 |
func (v *volumeRouter) getVolumeByName(ctx context.Context, w http.ResponseWriter, r *http.Request, vars map[string]string) error {
|
| ... | ... |
@@ -46,7 +46,7 @@ func (v *volumeRouter) postVolumesCreate(ctx context.Context, w http.ResponseWri |
| 46 | 46 |
return err |
| 47 | 47 |
} |
| 48 | 48 |
|
| 49 |
- var req volumetypes.VolumesCreateBody |
|
| 49 |
+ var req volumetypes.VolumeCreateBody |
|
| 50 | 50 |
if err := json.NewDecoder(r.Body).Decode(&req); err != nil {
|
| 51 | 51 |
if err == io.EOF {
|
| 52 | 52 |
return errdefs.InvalidParameter(errors.New("got EOF while reading request body"))
|
| 53 | 53 |
new file mode 100644 |
| ... | ... |
@@ -0,0 +1,29 @@ |
| 0 |
+package volume |
|
| 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 |
+// VolumeCreateBody |
|
| 10 |
+// swagger:model VolumeCreateBody |
|
| 11 |
+type VolumeCreateBody struct {
|
|
| 12 |
+ |
|
| 13 |
+ // Name of the volume driver to use. |
|
| 14 |
+ // Required: true |
|
| 15 |
+ Driver string `json:"Driver"` |
|
| 16 |
+ |
|
| 17 |
+ // A mapping of driver options and values. These options are passed directly to the driver and are driver specific. |
|
| 18 |
+ // Required: true |
|
| 19 |
+ DriverOpts map[string]string `json:"DriverOpts"` |
|
| 20 |
+ |
|
| 21 |
+ // User-defined key/value metadata. |
|
| 22 |
+ // Required: true |
|
| 23 |
+ Labels map[string]string `json:"Labels"` |
|
| 24 |
+ |
|
| 25 |
+ // The new volume's name. If not specified, Docker generates a name. |
|
| 26 |
+ // Required: true |
|
| 27 |
+ Name string `json:"Name"` |
|
| 28 |
+} |
| 0 | 29 |
new file mode 100644 |
| ... | ... |
@@ -0,0 +1,23 @@ |
| 0 |
+package volume |
|
| 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 |
+import "github.com/docker/docker/api/types" |
|
| 10 |
+ |
|
| 11 |
+// VolumeListOKBody |
|
| 12 |
+// swagger:model VolumeListOKBody |
|
| 13 |
+type VolumeListOKBody struct {
|
|
| 14 |
+ |
|
| 15 |
+ // List of volumes |
|
| 16 |
+ // Required: true |
|
| 17 |
+ Volumes []*types.Volume `json:"Volumes"` |
|
| 18 |
+ |
|
| 19 |
+ // Warnings that occurred when fetching the list of volumes |
|
| 20 |
+ // Required: true |
|
| 21 |
+ Warnings []string `json:"Warnings"` |
|
| 22 |
+} |
| 0 | 23 |
deleted file mode 100644 |
| ... | ... |
@@ -1,29 +0,0 @@ |
| 1 |
-package volume // import "github.com/docker/docker/api/types/volume" |
|
| 2 |
- |
|
| 3 |
-// ---------------------------------------------------------------------------- |
|
| 4 |
-// DO NOT EDIT THIS FILE |
|
| 5 |
-// This file was generated by `swagger generate operation` |
|
| 6 |
-// |
|
| 7 |
-// See hack/generate-swagger-api.sh |
|
| 8 |
-// ---------------------------------------------------------------------------- |
|
| 9 |
- |
|
| 10 |
-// VolumesCreateBody volumes create body |
|
| 11 |
-// swagger:model VolumesCreateBody |
|
| 12 |
-type VolumesCreateBody struct {
|
|
| 13 |
- |
|
| 14 |
- // Name of the volume driver to use. |
|
| 15 |
- // Required: true |
|
| 16 |
- Driver string `json:"Driver"` |
|
| 17 |
- |
|
| 18 |
- // A mapping of driver options and values. These options are passed directly to the driver and are driver specific. |
|
| 19 |
- // Required: true |
|
| 20 |
- DriverOpts map[string]string `json:"DriverOpts"` |
|
| 21 |
- |
|
| 22 |
- // User-defined key/value metadata. |
|
| 23 |
- // Required: true |
|
| 24 |
- Labels map[string]string `json:"Labels"` |
|
| 25 |
- |
|
| 26 |
- // The new volume's name. If not specified, Docker generates a name. |
|
| 27 |
- // Required: true |
|
| 28 |
- Name string `json:"Name"` |
|
| 29 |
-} |
| 30 | 1 |
deleted file mode 100644 |
| ... | ... |
@@ -1,23 +0,0 @@ |
| 1 |
-package volume // import "github.com/docker/docker/api/types/volume" |
|
| 2 |
- |
|
| 3 |
-// ---------------------------------------------------------------------------- |
|
| 4 |
-// DO NOT EDIT THIS FILE |
|
| 5 |
-// This file was generated by `swagger generate operation` |
|
| 6 |
-// |
|
| 7 |
-// See hack/generate-swagger-api.sh |
|
| 8 |
-// ---------------------------------------------------------------------------- |
|
| 9 |
- |
|
| 10 |
-import "github.com/docker/docker/api/types" |
|
| 11 |
- |
|
| 12 |
-// VolumesListOKBody volumes list o k body |
|
| 13 |
-// swagger:model VolumesListOKBody |
|
| 14 |
-type VolumesListOKBody struct {
|
|
| 15 |
- |
|
| 16 |
- // List of volumes |
|
| 17 |
- // Required: true |
|
| 18 |
- Volumes []*types.Volume `json:"Volumes"` |
|
| 19 |
- |
|
| 20 |
- // Warnings that occurred when fetching the list of volumes |
|
| 21 |
- // Required: true |
|
| 22 |
- Warnings []string `json:"Warnings"` |
|
| 23 |
-} |
| ... | ... |
@@ -168,10 +168,10 @@ type SystemAPIClient interface {
|
| 168 | 168 |
|
| 169 | 169 |
// VolumeAPIClient defines API client methods for the volumes |
| 170 | 170 |
type VolumeAPIClient interface {
|
| 171 |
- VolumeCreate(ctx context.Context, options volumetypes.VolumesCreateBody) (types.Volume, error) |
|
| 171 |
+ VolumeCreate(ctx context.Context, options volumetypes.VolumeCreateBody) (types.Volume, error) |
|
| 172 | 172 |
VolumeInspect(ctx context.Context, volumeID string) (types.Volume, error) |
| 173 | 173 |
VolumeInspectWithRaw(ctx context.Context, volumeID string) (types.Volume, []byte, error) |
| 174 |
- VolumeList(ctx context.Context, filter filters.Args) (volumetypes.VolumesListOKBody, error) |
|
| 174 |
+ VolumeList(ctx context.Context, filter filters.Args) (volumetypes.VolumeListOKBody, error) |
|
| 175 | 175 |
VolumeRemove(ctx context.Context, volumeID string, force bool) error |
| 176 | 176 |
VolumesPrune(ctx context.Context, pruneFilter filters.Args) (types.VolumesPruneReport, error) |
| 177 | 177 |
} |
| ... | ... |
@@ -9,7 +9,7 @@ import ( |
| 9 | 9 |
) |
| 10 | 10 |
|
| 11 | 11 |
// VolumeCreate creates a volume in the docker host. |
| 12 |
-func (cli *Client) VolumeCreate(ctx context.Context, options volumetypes.VolumesCreateBody) (types.Volume, error) {
|
|
| 12 |
+func (cli *Client) VolumeCreate(ctx context.Context, options volumetypes.VolumeCreateBody) (types.Volume, error) {
|
|
| 13 | 13 |
var volume types.Volume |
| 14 | 14 |
resp, err := cli.post(ctx, "/volumes/create", nil, options, nil) |
| 15 | 15 |
if err != nil {
|
| ... | ... |
@@ -19,7 +19,7 @@ func TestVolumeCreateError(t *testing.T) {
|
| 19 | 19 |
client: newMockClient(errorMock(http.StatusInternalServerError, "Server error")), |
| 20 | 20 |
} |
| 21 | 21 |
|
| 22 |
- _, err := client.VolumeCreate(context.Background(), volumetypes.VolumesCreateBody{})
|
|
| 22 |
+ _, err := client.VolumeCreate(context.Background(), volumetypes.VolumeCreateBody{})
|
|
| 23 | 23 |
if err == nil || err.Error() != "Error response from daemon: Server error" {
|
| 24 | 24 |
t.Fatalf("expected a Server Error, got %v", err)
|
| 25 | 25 |
} |
| ... | ... |
@@ -53,7 +53,7 @@ func TestVolumeCreate(t *testing.T) {
|
| 53 | 53 |
}), |
| 54 | 54 |
} |
| 55 | 55 |
|
| 56 |
- volume, err := client.VolumeCreate(context.Background(), volumetypes.VolumesCreateBody{
|
|
| 56 |
+ volume, err := client.VolumeCreate(context.Background(), volumetypes.VolumeCreateBody{
|
|
| 57 | 57 |
Name: "myvolume", |
| 58 | 58 |
Driver: "mydriver", |
| 59 | 59 |
DriverOpts: map[string]string{
|
| ... | ... |
@@ -10,8 +10,8 @@ import ( |
| 10 | 10 |
) |
| 11 | 11 |
|
| 12 | 12 |
// VolumeList returns the volumes configured in the docker host. |
| 13 |
-func (cli *Client) VolumeList(ctx context.Context, filter filters.Args) (volumetypes.VolumesListOKBody, error) {
|
|
| 14 |
- var volumes volumetypes.VolumesListOKBody |
|
| 13 |
+func (cli *Client) VolumeList(ctx context.Context, filter filters.Args) (volumetypes.VolumeListOKBody, error) {
|
|
| 14 |
+ var volumes volumetypes.VolumeListOKBody |
|
| 15 | 15 |
query := url.Values{}
|
| 16 | 16 |
|
| 17 | 17 |
if filter.Len() > 0 {
|
| ... | ... |
@@ -69,7 +69,7 @@ func TestVolumeList(t *testing.T) {
|
| 69 | 69 |
if actualFilters != listCase.expectedFilters {
|
| 70 | 70 |
return nil, fmt.Errorf("filters not set in URL query properly. Expected '%s', got %s", listCase.expectedFilters, actualFilters)
|
| 71 | 71 |
} |
| 72 |
- content, err := json.Marshal(volumetypes.VolumesListOKBody{
|
|
| 72 |
+ content, err := json.Marshal(volumetypes.VolumeListOKBody{
|
|
| 73 | 73 |
Volumes: []*types.Volume{
|
| 74 | 74 |
{
|
| 75 | 75 |
Name: "volume", |
| ... | ... |
@@ -398,7 +398,7 @@ func (c *containerConfig) hostConfig() *enginecontainer.HostConfig {
|
| 398 | 398 |
} |
| 399 | 399 |
|
| 400 | 400 |
// This handles the case of volumes that are defined inside a service Mount |
| 401 |
-func (c *containerConfig) volumeCreateRequest(mount *api.Mount) *volumetypes.VolumesCreateBody {
|
|
| 401 |
+func (c *containerConfig) volumeCreateRequest(mount *api.Mount) *volumetypes.VolumeCreateBody {
|
|
| 402 | 402 |
var ( |
| 403 | 403 |
driverName string |
| 404 | 404 |
driverOpts map[string]string |
| ... | ... |
@@ -412,7 +412,7 @@ func (c *containerConfig) volumeCreateRequest(mount *api.Mount) *volumetypes.Vol |
| 412 | 412 |
} |
| 413 | 413 |
|
| 414 | 414 |
if mount.VolumeOptions != nil {
|
| 415 |
- return &volumetypes.VolumesCreateBody{
|
|
| 415 |
+ return &volumetypes.VolumeCreateBody{
|
|
| 416 | 416 |
Name: mount.Source, |
| 417 | 417 |
Driver: driverName, |
| 418 | 418 |
DriverOpts: driverOpts, |
| ... | ... |
@@ -41,7 +41,7 @@ func createTar(data map[string][]byte) (io.Reader, error) {
|
| 41 | 41 |
// which is attached to the container. |
| 42 | 42 |
func createVolumeWithData(cli *client.Client, volumeName string, data map[string][]byte, image string) error {
|
| 43 | 43 |
_, err := cli.VolumeCreate(context.Background(), |
| 44 |
- volume.VolumesCreateBody{
|
|
| 44 |
+ volume.VolumeCreateBody{
|
|
| 45 | 45 |
Driver: "local", |
| 46 | 46 |
Name: volumeName, |
| 47 | 47 |
}) |
| ... | ... |
@@ -77,7 +77,7 @@ func TestAuthZPluginV2Disable(t *testing.T) {
|
| 77 | 77 |
d.Restart(t, "--authorization-plugin="+authzPluginNameWithTag) |
| 78 | 78 |
d.LoadBusybox(t) |
| 79 | 79 |
|
| 80 |
- _, err = client.VolumeCreate(context.Background(), volumetypes.VolumesCreateBody{Driver: "local"})
|
|
| 80 |
+ _, err = client.VolumeCreate(context.Background(), volumetypes.VolumeCreateBody{Driver: "local"})
|
|
| 81 | 81 |
assert.Assert(t, err != nil) |
| 82 | 82 |
assert.Assert(t, strings.Contains(err.Error(), fmt.Sprintf("Error response from daemon: plugin %s failed with error:", authzPluginNameWithTag)))
|
| 83 | 83 |
|
| ... | ... |
@@ -86,7 +86,7 @@ func TestAuthZPluginV2Disable(t *testing.T) {
|
| 86 | 86 |
assert.NilError(t, err) |
| 87 | 87 |
|
| 88 | 88 |
// now test to see if the docker api works. |
| 89 |
- _, err = client.VolumeCreate(context.Background(), volumetypes.VolumesCreateBody{Driver: "local"})
|
|
| 89 |
+ _, err = client.VolumeCreate(context.Background(), volumetypes.VolumeCreateBody{Driver: "local"})
|
|
| 90 | 90 |
assert.NilError(t, err) |
| 91 | 91 |
} |
| 92 | 92 |
|
| ... | ... |
@@ -104,7 +104,7 @@ func TestAuthZPluginV2RejectVolumeRequests(t *testing.T) {
|
| 104 | 104 |
// restart the daemon with the plugin |
| 105 | 105 |
d.Restart(t, "--authorization-plugin="+authzPluginNameWithTag) |
| 106 | 106 |
|
| 107 |
- _, err = client.VolumeCreate(context.Background(), volumetypes.VolumesCreateBody{Driver: "local"})
|
|
| 107 |
+ _, err = client.VolumeCreate(context.Background(), volumetypes.VolumeCreateBody{Driver: "local"})
|
|
| 108 | 108 |
assert.Assert(t, err != nil) |
| 109 | 109 |
assert.Assert(t, strings.Contains(err.Error(), fmt.Sprintf("Error response from daemon: plugin %s failed with error:", authzPluginNameWithTag)))
|
| 110 | 110 |
|
| ... | ... |
@@ -26,7 +26,7 @@ func TestVolumesCreateAndList(t *testing.T) {
|
| 26 | 26 |
ctx := context.Background() |
| 27 | 27 |
|
| 28 | 28 |
name := t.Name() |
| 29 |
- vol, err := client.VolumeCreate(ctx, volumetypes.VolumesCreateBody{
|
|
| 29 |
+ vol, err := client.VolumeCreate(ctx, volumetypes.VolumeCreateBody{
|
|
| 30 | 30 |
Name: name, |
| 31 | 31 |
}) |
| 32 | 32 |
assert.NilError(t, err) |
| ... | ... |
@@ -83,7 +83,7 @@ func TestVolumesInspect(t *testing.T) {
|
| 83 | 83 |
now := time.Now().Truncate(time.Minute) |
| 84 | 84 |
|
| 85 | 85 |
name := t.Name() |
| 86 |
- _, err := client.VolumeCreate(ctx, volumetypes.VolumesCreateBody{
|
|
| 86 |
+ _, err := client.VolumeCreate(ctx, volumetypes.VolumeCreateBody{
|
|
| 87 | 87 |
Name: name, |
| 88 | 88 |
}) |
| 89 | 89 |
assert.NilError(t, err) |