diff --git a/cli/command/cli.go b/cli/command/cli.go index 1452e1a24..dfb4fba69 100644 --- a/cli/command/cli.go +++ b/cli/command/cli.go @@ -25,7 +25,6 @@ import ( manifeststore "github.com/docker/cli/cli/manifest/store" registryclient "github.com/docker/cli/cli/registry/client" "github.com/docker/cli/cli/streams" - "github.com/docker/cli/cli/trust" "github.com/docker/cli/cli/version" dopts "github.com/docker/cli/opts" "github.com/docker/docker/api" @@ -36,7 +35,6 @@ import ( "github.com/docker/go-connections/tlsconfig" "github.com/pkg/errors" "github.com/spf13/cobra" - notaryclient "github.com/theupdateframework/notary/client" ) const defaultInitTimeout = 2 * time.Second @@ -56,7 +54,6 @@ type Cli interface { Apply(ops ...CLIOption) error ConfigFile() *configfile.ConfigFile ServerInfo() ServerInfo - NotaryClient(imgRefAndAuth trust.ImageRefAndAuth, actions []string) (notaryclient.Repository, error) DefaultVersion() string CurrentVersion() string ManifestStore() manifeststore.Store @@ -67,6 +64,7 @@ type Cli interface { CurrentContext() string DockerEndpoint() docker.Endpoint TelemetryClient + DeprecatedNotaryClient } // DockerCli is an instance the docker command line client. @@ -405,11 +403,6 @@ func (cli *DockerCli) initializeFromClient() { cli.client.NegotiateAPIVersionPing(ping) } -// NotaryClient provides a Notary Repository to interact with signed metadata for an image -func (cli *DockerCli) NotaryClient(imgRefAndAuth trust.ImageRefAndAuth, actions []string) (notaryclient.Repository, error) { - return trust.GetNotaryRepository(cli.In(), cli.Out(), UserAgent(), imgRefAndAuth.RepoInfo(), imgRefAndAuth.AuthConfig(), actions...) -} - // ContextStore returns the ContextStore func (cli *DockerCli) ContextStore() store.Store { return cli.contextStore diff --git a/cli/command/cli_deprecated.go b/cli/command/cli_deprecated.go new file mode 100644 index 000000000..d179f42f2 --- /dev/null +++ b/cli/command/cli_deprecated.go @@ -0,0 +1,18 @@ +package command + +import ( + "github.com/docker/cli/cli/trust" + notaryclient "github.com/theupdateframework/notary/client" +) + +type DeprecatedNotaryClient interface { + // NotaryClient provides a Notary Repository to interact with signed metadata for an image + // + // Deprecated: use [trust.GetNotaryRepository] instead. This method is no longer used and will be removed in the next release. + NotaryClient(imgRefAndAuth trust.ImageRefAndAuth, actions []string) (notaryclient.Repository, error) +} + +// NotaryClient provides a Notary Repository to interact with signed metadata for an image +func (cli *DockerCli) NotaryClient(imgRefAndAuth trust.ImageRefAndAuth, actions []string) (notaryclient.Repository, error) { + return trust.GetNotaryRepository(cli.In(), cli.Out(), UserAgent(), imgRefAndAuth.RepoInfo(), imgRefAndAuth.AuthConfig(), actions...) +}