mirror of
https://github.com/moby/moby.git
synced 2026-01-11 10:41:43 +00:00
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>
34 lines
773 B
Go
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
|
|
}
|