imports: remove "volumetypes" aliases for api/types/volume
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
This commit is contained in:
parent
7293857456
commit
3cae9fef16
5 changed files with 19 additions and 20 deletions
|
@ -6,7 +6,7 @@ import (
|
|||
|
||||
"github.com/docker/docker/api/server/httputils"
|
||||
"github.com/docker/docker/api/types/filters"
|
||||
volumetypes "github.com/docker/docker/api/types/volume"
|
||||
"github.com/docker/docker/api/types/volume"
|
||||
"github.com/docker/docker/volume/service/opts"
|
||||
"github.com/pkg/errors"
|
||||
)
|
||||
|
@ -24,7 +24,7 @@ func (v *volumeRouter) getVolumesList(ctx context.Context, w http.ResponseWriter
|
|||
if err != nil {
|
||||
return err
|
||||
}
|
||||
return httputils.WriteJSON(w, http.StatusOK, &volumetypes.VolumeListOKBody{Volumes: volumes, Warnings: warnings})
|
||||
return httputils.WriteJSON(w, http.StatusOK, &volume.VolumeListOKBody{Volumes: volumes, Warnings: warnings})
|
||||
}
|
||||
|
||||
func (v *volumeRouter) getVolumeByName(ctx context.Context, w http.ResponseWriter, r *http.Request, vars map[string]string) error {
|
||||
|
@ -32,11 +32,11 @@ func (v *volumeRouter) getVolumeByName(ctx context.Context, w http.ResponseWrite
|
|||
return err
|
||||
}
|
||||
|
||||
volume, err := v.backend.Get(ctx, vars["name"], opts.WithGetResolveStatus)
|
||||
vol, err := v.backend.Get(ctx, vars["name"], opts.WithGetResolveStatus)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
return httputils.WriteJSON(w, http.StatusOK, volume)
|
||||
return httputils.WriteJSON(w, http.StatusOK, vol)
|
||||
}
|
||||
|
||||
func (v *volumeRouter) postVolumesCreate(ctx context.Context, w http.ResponseWriter, r *http.Request, vars map[string]string) error {
|
||||
|
@ -49,11 +49,11 @@ func (v *volumeRouter) postVolumesCreate(ctx context.Context, w http.ResponseWri
|
|||
return err
|
||||
}
|
||||
|
||||
volume, err := v.backend.Create(ctx, req.Name, req.Driver, opts.WithCreateOptions(req.DriverOpts), opts.WithCreateLabels(req.Labels))
|
||||
vol, err := v.backend.Create(ctx, req.Name, req.Driver, opts.WithCreateOptions(req.DriverOpts), opts.WithCreateLabels(req.Labels))
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
return httputils.WriteJSON(w, http.StatusCreated, volume)
|
||||
return httputils.WriteJSON(w, http.StatusCreated, vol)
|
||||
}
|
||||
|
||||
func (v *volumeRouter) deleteVolumes(ctx context.Context, w http.ResponseWriter, r *http.Request, vars map[string]string) error {
|
||||
|
|
|
@ -76,7 +76,7 @@ func TestVolumeInspect(t *testing.T) {
|
|||
}),
|
||||
}
|
||||
|
||||
volume, err := client.VolumeInspect(context.Background(), "volume_id")
|
||||
vol, err := client.VolumeInspect(context.Background(), "volume_id")
|
||||
assert.NilError(t, err)
|
||||
assert.Check(t, is.DeepEqual(expected, volume))
|
||||
assert.Check(t, is.DeepEqual(expected, vol))
|
||||
}
|
||||
|
|
|
@ -6,12 +6,12 @@ import (
|
|||
"net/url"
|
||||
|
||||
"github.com/docker/docker/api/types/filters"
|
||||
volumetypes "github.com/docker/docker/api/types/volume"
|
||||
"github.com/docker/docker/api/types/volume"
|
||||
)
|
||||
|
||||
// VolumeList returns the volumes configured in the docker host.
|
||||
func (cli *Client) VolumeList(ctx context.Context, filter filters.Args) (volumetypes.VolumeListOKBody, error) {
|
||||
var volumes volumetypes.VolumeListOKBody
|
||||
func (cli *Client) VolumeList(ctx context.Context, filter filters.Args) (volume.VolumeListOKBody, error) {
|
||||
var volumes volume.VolumeListOKBody
|
||||
query := url.Values{}
|
||||
|
||||
if filter.Len() > 0 {
|
||||
|
|
|
@ -7,8 +7,6 @@ import (
|
|||
"strconv"
|
||||
"strings"
|
||||
|
||||
"github.com/sirupsen/logrus"
|
||||
|
||||
"github.com/docker/distribution/reference"
|
||||
"github.com/docker/docker/api/types"
|
||||
enginecontainer "github.com/docker/docker/api/types/container"
|
||||
|
@ -16,7 +14,7 @@ import (
|
|||
"github.com/docker/docker/api/types/filters"
|
||||
enginemount "github.com/docker/docker/api/types/mount"
|
||||
"github.com/docker/docker/api/types/network"
|
||||
volumetypes "github.com/docker/docker/api/types/volume"
|
||||
"github.com/docker/docker/api/types/volume"
|
||||
"github.com/docker/docker/daemon/cluster/convert"
|
||||
executorpkg "github.com/docker/docker/daemon/cluster/executor"
|
||||
clustertypes "github.com/docker/docker/daemon/cluster/provider"
|
||||
|
@ -28,6 +26,7 @@ import (
|
|||
"github.com/moby/swarmkit/v2/api"
|
||||
"github.com/moby/swarmkit/v2/api/genericresource"
|
||||
"github.com/moby/swarmkit/v2/template"
|
||||
"github.com/sirupsen/logrus"
|
||||
)
|
||||
|
||||
const (
|
||||
|
@ -406,7 +405,7 @@ func (c *containerConfig) hostConfig() *enginecontainer.HostConfig {
|
|||
}
|
||||
|
||||
// This handles the case of volumes that are defined inside a service Mount
|
||||
func (c *containerConfig) volumeCreateRequest(mount *api.Mount) *volumetypes.VolumeCreateBody {
|
||||
func (c *containerConfig) volumeCreateRequest(mount *api.Mount) *volume.VolumeCreateBody {
|
||||
var (
|
||||
driverName string
|
||||
driverOpts map[string]string
|
||||
|
@ -420,7 +419,7 @@ func (c *containerConfig) volumeCreateRequest(mount *api.Mount) *volumetypes.Vol
|
|||
}
|
||||
|
||||
if mount.VolumeOptions != nil {
|
||||
return &volumetypes.VolumeCreateBody{
|
||||
return &volume.VolumeCreateBody{
|
||||
Name: mount.Source,
|
||||
Driver: driverName,
|
||||
DriverOpts: driverOpts,
|
||||
|
|
|
@ -13,7 +13,7 @@ import (
|
|||
|
||||
"github.com/docker/docker/api/types"
|
||||
"github.com/docker/docker/api/types/filters"
|
||||
volumetypes "github.com/docker/docker/api/types/volume"
|
||||
"github.com/docker/docker/api/types/volume"
|
||||
"github.com/docker/docker/client"
|
||||
"github.com/docker/docker/integration/internal/container"
|
||||
"github.com/docker/docker/integration/internal/requirement"
|
||||
|
@ -75,7 +75,7 @@ func TestAuthZPluginV2Disable(t *testing.T) {
|
|||
d.Restart(t, "--authorization-plugin="+authzPluginNameWithTag)
|
||||
d.LoadBusybox(t)
|
||||
|
||||
_, err = c.VolumeCreate(context.Background(), volumetypes.VolumeCreateBody{Driver: "local"})
|
||||
_, err = c.VolumeCreate(context.Background(), volume.VolumeCreateBody{Driver: "local"})
|
||||
assert.Assert(t, err != nil)
|
||||
assert.Assert(t, strings.Contains(err.Error(), fmt.Sprintf("Error response from daemon: plugin %s failed with error:", authzPluginNameWithTag)))
|
||||
|
||||
|
@ -84,7 +84,7 @@ func TestAuthZPluginV2Disable(t *testing.T) {
|
|||
assert.NilError(t, err)
|
||||
|
||||
// now test to see if the docker api works.
|
||||
_, err = c.VolumeCreate(context.Background(), volumetypes.VolumeCreateBody{Driver: "local"})
|
||||
_, err = c.VolumeCreate(context.Background(), volume.VolumeCreateBody{Driver: "local"})
|
||||
assert.NilError(t, err)
|
||||
}
|
||||
|
||||
|
@ -101,7 +101,7 @@ func TestAuthZPluginV2RejectVolumeRequests(t *testing.T) {
|
|||
// restart the daemon with the plugin
|
||||
d.Restart(t, "--authorization-plugin="+authzPluginNameWithTag)
|
||||
|
||||
_, err = c.VolumeCreate(context.Background(), volumetypes.VolumeCreateBody{Driver: "local"})
|
||||
_, err = c.VolumeCreate(context.Background(), volume.VolumeCreateBody{Driver: "local"})
|
||||
assert.Assert(t, err != nil)
|
||||
assert.Assert(t, strings.Contains(err.Error(), fmt.Sprintf("Error response from daemon: plugin %s failed with error:", authzPluginNameWithTag)))
|
||||
|
||||
|
|
Loading…
Reference in a new issue