mirror of
https://github.com/moby/moby.git
synced 2026-01-11 18:51:37 +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>
32 lines
807 B
Go
32 lines
807 B
Go
package client
|
|
|
|
import (
|
|
"context"
|
|
"net/url"
|
|
)
|
|
|
|
// PluginDisableOptions holds parameters to disable plugins.
|
|
type PluginDisableOptions struct {
|
|
Force bool
|
|
}
|
|
|
|
// PluginDisableResult represents the result of a plugin disable operation.
|
|
type PluginDisableResult struct {
|
|
// Currently empty; can be extended in the future if needed.
|
|
}
|
|
|
|
// PluginDisable disables a plugin
|
|
func (cli *Client) PluginDisable(ctx context.Context, name string, options PluginDisableOptions) (PluginDisableResult, error) {
|
|
name, err := trimID("plugin", name)
|
|
if err != nil {
|
|
return PluginDisableResult{}, err
|
|
}
|
|
query := url.Values{}
|
|
if options.Force {
|
|
query.Set("force", "1")
|
|
}
|
|
resp, err := cli.post(ctx, "/plugins/"+name+"/disable", query, nil, nil)
|
|
defer ensureReaderClosed(resp)
|
|
return PluginDisableResult{}, err
|
|
}
|