Files
moby/client/plugin_remove.go
Austin Vazquez 909e32b27d client: refactor plugin api client functions to define options/results structs
Co-authored-by: Claude <noreply@anthropic.com>
Signed-off-by: Austin Vazquez <austin.vazquez@docker.com>
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-10-22 13:45:03 +02:00

34 lines
773 B
Go

package client
import (
"context"
"net/url"
)
// PluginRemoveOptions holds parameters to remove plugins.
type PluginRemoveOptions struct {
Force bool
}
// PluginRemoveResult represents the result of a plugin removal.
type PluginRemoveResult struct {
// Currently empty; can be extended in the future if needed.
}
// PluginRemove removes a plugin
func (cli *Client) PluginRemove(ctx context.Context, name string, options PluginRemoveOptions) (PluginRemoveResult, error) {
name, err := trimID("plugin", name)
if err != nil {
return PluginRemoveResult{}, err
}
query := url.Values{}
if options.Force {
query.Set("force", "1")
}
resp, err := cli.delete(ctx, "/plugins/"+name, query, nil)
defer ensureReaderClosed(resp)
return PluginRemoveResult{}, err
}