From eaf1a604f25b84e941f06f24bd919cf6c28012b2 Mon Sep 17 00:00:00 2001 From: Sebastiaan van Stijn Date: Thu, 3 Mar 2022 10:27:23 +0100 Subject: [PATCH] client: use types/registry.AuthConfig Signed-off-by: Sebastiaan van Stijn --- client/image_build_test.go | 3 ++- client/interface.go | 2 +- client/login.go | 3 +-- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/client/image_build_test.go b/client/image_build_test.go index 3d6c0a972d..92822746ca 100644 --- a/client/image_build_test.go +++ b/client/image_build_test.go @@ -12,6 +12,7 @@ import ( "github.com/docker/docker/api/types" "github.com/docker/docker/api/types/container" + "github.com/docker/docker/api/types/registry" "github.com/docker/docker/errdefs" units "github.com/docker/go-units" ) @@ -144,7 +145,7 @@ func TestImageBuild(t *testing.T) { }, { buildOptions: types.ImageBuildOptions{ - AuthConfigs: map[string]types.AuthConfig{ + AuthConfigs: map[string]registry.AuthConfig{ "https://index.docker.io/v1/": { Auth: "dG90bwo=", }, diff --git a/client/interface.go b/client/interface.go index e9c1ed722e..96e274c9df 100644 --- a/client/interface.go +++ b/client/interface.go @@ -166,7 +166,7 @@ type SwarmAPIClient interface { type SystemAPIClient interface { Events(ctx context.Context, options types.EventsOptions) (<-chan events.Message, <-chan error) Info(ctx context.Context) (types.Info, error) - RegistryLogin(ctx context.Context, auth types.AuthConfig) (registry.AuthenticateOKBody, error) + RegistryLogin(ctx context.Context, auth registry.AuthConfig) (registry.AuthenticateOKBody, error) DiskUsage(ctx context.Context, options types.DiskUsageOptions) (types.DiskUsage, error) Ping(ctx context.Context) (types.Ping, error) } diff --git a/client/login.go b/client/login.go index f058520638..19e985e0b9 100644 --- a/client/login.go +++ b/client/login.go @@ -5,13 +5,12 @@ import ( "encoding/json" "net/url" - "github.com/docker/docker/api/types" "github.com/docker/docker/api/types/registry" ) // RegistryLogin authenticates the docker server with a given docker registry. // It returns unauthorizedError when the authentication fails. -func (cli *Client) RegistryLogin(ctx context.Context, auth types.AuthConfig) (registry.AuthenticateOKBody, error) { +func (cli *Client) RegistryLogin(ctx context.Context, auth registry.AuthConfig) (registry.AuthenticateOKBody, error) { resp, err := cli.post(ctx, "/auth", url.Values{}, auth, nil) defer ensureReaderClosed(resp)