1
0
Fork 0
mirror of https://github.com/moby/moby.git synced 2022-11-09 12:21:53 -05:00

imports: remove "volumetypes" aliases for api/types/volume

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
This commit is contained in:
Sebastiaan van Stijn 2022-03-05 10:51:34 +01:00
parent 7293857456
commit 3cae9fef16
No known key found for this signature in database
GPG key ID: 76698F39D527CE8C
5 changed files with 19 additions and 20 deletions

View file

@ -6,7 +6,7 @@ import (
"github.com/docker/docker/api/server/httputils" "github.com/docker/docker/api/server/httputils"
"github.com/docker/docker/api/types/filters" "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/docker/docker/volume/service/opts"
"github.com/pkg/errors" "github.com/pkg/errors"
) )
@ -24,7 +24,7 @@ func (v *volumeRouter) getVolumesList(ctx context.Context, w http.ResponseWriter
if err != nil { if err != nil {
return err 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 { 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 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 { if err != nil {
return err 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 { 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 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 { if err != nil {
return err 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 { func (v *volumeRouter) deleteVolumes(ctx context.Context, w http.ResponseWriter, r *http.Request, vars map[string]string) error {

View file

@ -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.NilError(t, err)
assert.Check(t, is.DeepEqual(expected, volume)) assert.Check(t, is.DeepEqual(expected, vol))
} }

View file

@ -6,12 +6,12 @@ import (
"net/url" "net/url"
"github.com/docker/docker/api/types/filters" "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. // VolumeList returns the volumes configured in the docker host.
func (cli *Client) VolumeList(ctx context.Context, filter filters.Args) (volumetypes.VolumeListOKBody, error) { func (cli *Client) VolumeList(ctx context.Context, filter filters.Args) (volume.VolumeListOKBody, error) {
var volumes volumetypes.VolumeListOKBody var volumes volume.VolumeListOKBody
query := url.Values{} query := url.Values{}
if filter.Len() > 0 { if filter.Len() > 0 {

View file

@ -7,8 +7,6 @@ import (
"strconv" "strconv"
"strings" "strings"
"github.com/sirupsen/logrus"
"github.com/docker/distribution/reference" "github.com/docker/distribution/reference"
"github.com/docker/docker/api/types" "github.com/docker/docker/api/types"
enginecontainer "github.com/docker/docker/api/types/container" enginecontainer "github.com/docker/docker/api/types/container"
@ -16,7 +14,7 @@ import (
"github.com/docker/docker/api/types/filters" "github.com/docker/docker/api/types/filters"
enginemount "github.com/docker/docker/api/types/mount" enginemount "github.com/docker/docker/api/types/mount"
"github.com/docker/docker/api/types/network" "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" "github.com/docker/docker/daemon/cluster/convert"
executorpkg "github.com/docker/docker/daemon/cluster/executor" executorpkg "github.com/docker/docker/daemon/cluster/executor"
clustertypes "github.com/docker/docker/daemon/cluster/provider" 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"
"github.com/moby/swarmkit/v2/api/genericresource" "github.com/moby/swarmkit/v2/api/genericresource"
"github.com/moby/swarmkit/v2/template" "github.com/moby/swarmkit/v2/template"
"github.com/sirupsen/logrus"
) )
const ( const (
@ -406,7 +405,7 @@ func (c *containerConfig) hostConfig() *enginecontainer.HostConfig {
} }
// This handles the case of volumes that are defined inside a service Mount // 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 ( var (
driverName string driverName string
driverOpts map[string]string driverOpts map[string]string
@ -420,7 +419,7 @@ func (c *containerConfig) volumeCreateRequest(mount *api.Mount) *volumetypes.Vol
} }
if mount.VolumeOptions != nil { if mount.VolumeOptions != nil {
return &volumetypes.VolumeCreateBody{ return &volume.VolumeCreateBody{
Name: mount.Source, Name: mount.Source,
Driver: driverName, Driver: driverName,
DriverOpts: driverOpts, DriverOpts: driverOpts,

View file

@ -13,7 +13,7 @@ import (
"github.com/docker/docker/api/types" "github.com/docker/docker/api/types"
"github.com/docker/docker/api/types/filters" "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/client"
"github.com/docker/docker/integration/internal/container" "github.com/docker/docker/integration/internal/container"
"github.com/docker/docker/integration/internal/requirement" "github.com/docker/docker/integration/internal/requirement"
@ -75,7 +75,7 @@ func TestAuthZPluginV2Disable(t *testing.T) {
d.Restart(t, "--authorization-plugin="+authzPluginNameWithTag) d.Restart(t, "--authorization-plugin="+authzPluginNameWithTag)
d.LoadBusybox(t) 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, err != nil)
assert.Assert(t, strings.Contains(err.Error(), fmt.Sprintf("Error response from daemon: plugin %s failed with error:", authzPluginNameWithTag))) 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) assert.NilError(t, err)
// now test to see if the docker api works. // 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) assert.NilError(t, err)
} }
@ -101,7 +101,7 @@ func TestAuthZPluginV2RejectVolumeRequests(t *testing.T) {
// restart the daemon with the plugin // restart the daemon with the plugin
d.Restart(t, "--authorization-plugin="+authzPluginNameWithTag) 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, err != nil)
assert.Assert(t, strings.Contains(err.Error(), fmt.Sprintf("Error response from daemon: plugin %s failed with error:", authzPluginNameWithTag))) assert.Assert(t, strings.Contains(err.Error(), fmt.Sprintf("Error response from daemon: plugin %s failed with error:", authzPluginNameWithTag)))