Skip to content

Commit 9477941

Browse files
committed
cli/command/context: remove deprecated types and functions
These functions and types are shallow wrappers around the context store and were intended for internal use as implementation for the CLI itself. They were exported in 3126920 to be used by plugins and Docker Desktop. However, there's currently no public uses of this, and Docker Desktop does not use these functions. These were deprecated in 95eeafa and are no longer used. This patch removes the deprecated functions as they were meant to be implementation specific for the CLI. If there's a need to provide utilities for manipulating the context-store other than through the CLI itself, we can consider creating an SDK for that purpose. This removes: - `RunCreate` and `CreateOptions` - `RunExport` and `ExportOptions` - `RunImport` - `RunRemove` and `RemoveOptions` - `RunUpdate` and `UpdateOptions` - `RunUse` Signed-off-by: Sebastiaan van Stijn <[email protected]>
1 parent ba21666 commit 9477941

File tree

6 files changed

+0
-99
lines changed

6 files changed

+0
-99
lines changed

cli/command/context/create.go

Lines changed: 0 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -17,20 +17,6 @@ import (
1717
"github.com/spf13/cobra"
1818
)
1919

20-
// CreateOptions are the options used for creating a context
21-
//
22-
// Deprecated: this type was for internal use and will be removed in the next release.
23-
type CreateOptions struct {
24-
Name string
25-
Description string
26-
Docker map[string]string
27-
From string
28-
29-
// Additional Metadata to store in the context. This option is not
30-
// currently exposed to the user.
31-
metaData map[string]any
32-
}
33-
3420
// createOptions are the options used for creating a context
3521
type createOptions struct {
3622
name string
@@ -76,22 +62,6 @@ func newCreateCommand(dockerCLI command.Cli) *cobra.Command {
7662
return cmd
7763
}
7864

79-
// RunCreate creates a Docker context
80-
81-
// Deprecated: this function was for internal use and will be removed in the next release.
82-
func RunCreate(dockerCLI command.Cli, o *CreateOptions) error {
83-
if o == nil {
84-
o = &CreateOptions{}
85-
}
86-
87-
return runCreate(dockerCLI, &createOptions{
88-
name: o.Name,
89-
description: o.Description,
90-
endpoint: o.Docker,
91-
metaData: o.metaData,
92-
})
93-
}
94-
9565
// runCreate creates a Docker context
9666
func runCreate(dockerCLI command.Cli, opts *createOptions) error {
9767
s := dockerCLI.ContextStore()

cli/command/context/export.go

Lines changed: 0 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -12,14 +12,6 @@ import (
1212
"github.com/spf13/cobra"
1313
)
1414

15-
// ExportOptions are the options used for exporting a context
16-
//
17-
// Deprecated: this type was for internal use and will be removed in the next release.
18-
type ExportOptions struct {
19-
ContextName string
20-
Dest string
21-
}
22-
2315
func newExportCommand(dockerCLI command.Cli) *cobra.Command {
2416
return &cobra.Command{
2517
Use: "export [OPTIONS] CONTEXT [FILE|-]",
@@ -65,16 +57,6 @@ func writeTo(dockerCli command.Cli, reader io.Reader, dest string) error {
6557
return nil
6658
}
6759

68-
// RunExport exports a Docker context
69-
//
70-
// Deprecated: this function was for internal use and will be removed in the next release.
71-
func RunExport(dockerCli command.Cli, opts *ExportOptions) error {
72-
if opts == nil {
73-
opts = &ExportOptions{}
74-
}
75-
return runExport(dockerCli, opts.ContextName, opts.Dest)
76-
}
77-
7860
// runExport exports a Docker context.
7961
func runExport(dockerCLI command.Cli, contextName string, dest string) error {
8062
if err := store.ValidateContextName(contextName); err != nil && contextName != command.DefaultContextName {

cli/command/context/import.go

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -26,13 +26,6 @@ func newImportCommand(dockerCli command.Cli) *cobra.Command {
2626
return cmd
2727
}
2828

29-
// RunImport imports a Docker context
30-
//
31-
// Deprecated: this function was for internal use and will be removed in the next release.
32-
func RunImport(dockerCLI command.Cli, name string, source string) error {
33-
return runImport(dockerCLI, name, source)
34-
}
35-
3629
// runImport imports a Docker context.
3730
func runImport(dockerCLI command.Cli, name string, source string) error {
3831
if err := checkContextNameForCreation(dockerCLI.ContextStore(), name); err != nil {

cli/command/context/remove.go

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -10,13 +10,6 @@ import (
1010
"github.com/spf13/cobra"
1111
)
1212

13-
// RemoveOptions are the options used to remove contexts
14-
//
15-
// Deprecated: this type was for internal use and will be removed in the next release.
16-
type RemoveOptions struct {
17-
Force bool
18-
}
19-
2013
// removeOptions are the options used to remove contexts.
2114
type removeOptions struct {
2215
force bool
@@ -38,13 +31,6 @@ func newRemoveCommand(dockerCLI command.Cli) *cobra.Command {
3831
return cmd
3932
}
4033

41-
// RunRemove removes one or more contexts
42-
//
43-
// Deprecated: this function was for internal use and will be removed in the next release.
44-
func RunRemove(dockerCLI command.Cli, opts removeOptions, names []string) error {
45-
return runRemove(dockerCLI, opts, names)
46-
}
47-
4834
// runRemove removes one or more contexts.
4935
func runRemove(dockerCLI command.Cli, opts removeOptions, names []string) error {
5036
var errs []error

cli/command/context/update.go

Lines changed: 0 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -12,15 +12,6 @@ import (
1212
"github.com/spf13/cobra"
1313
)
1414

15-
// UpdateOptions are the options used to update a context
16-
//
17-
// Deprecated: this type was for internal use and will be removed in the next release.
18-
type UpdateOptions struct {
19-
Name string
20-
Description string
21-
Docker map[string]string
22-
}
23-
2415
// updateOptions are the options used to update a context.
2516
type updateOptions struct {
2617
name string
@@ -60,20 +51,6 @@ func newUpdateCommand(dockerCLI command.Cli) *cobra.Command {
6051
return cmd
6152
}
6253

63-
// RunUpdate updates a Docker context
64-
//
65-
// Deprecated: this function was for internal use and will be removed in the next release.
66-
func RunUpdate(dockerCLI command.Cli, o *UpdateOptions) error {
67-
if o == nil {
68-
o = &UpdateOptions{}
69-
}
70-
return runUpdate(dockerCLI, &updateOptions{
71-
name: o.Name,
72-
description: o.Description,
73-
endpoint: o.Docker,
74-
})
75-
}
76-
7754
// runUpdate updates a Docker context.
7855
func runUpdate(dockerCLI command.Cli, opts *updateOptions) error {
7956
if err := store.ValidateContextName(opts.name); err != nil {

cli/command/context/use.go

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -24,13 +24,6 @@ func newUseCommand(dockerCLI command.Cli) *cobra.Command {
2424
return cmd
2525
}
2626

27-
// RunUse set the current Docker context
28-
//
29-
// Deprecated: this function was for internal use and will be removed in the next release.
30-
func RunUse(dockerCLI command.Cli, name string) error {
31-
return runUse(dockerCLI, name)
32-
}
33-
3427
// runUse set the current Docker context
3528
func runUse(dockerCLI command.Cli, name string) error {
3629
// configValue uses an empty string for "default"

0 commit comments

Comments
 (0)