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
810 B
Go
32 lines
810 B
Go
package client
|
|
|
|
import (
|
|
"context"
|
|
"net/url"
|
|
"strconv"
|
|
)
|
|
|
|
// PluginEnableOptions holds parameters to enable plugins.
|
|
type PluginEnableOptions struct {
|
|
Timeout int
|
|
}
|
|
|
|
// PluginEnableResult represents the result of a plugin enable operation.
|
|
type PluginEnableResult struct {
|
|
// Currently empty; can be extended in the future if needed.
|
|
}
|
|
|
|
// PluginEnable enables a plugin
|
|
func (cli *Client) PluginEnable(ctx context.Context, name string, options PluginEnableOptions) (PluginEnableResult, error) {
|
|
name, err := trimID("plugin", name)
|
|
if err != nil {
|
|
return PluginEnableResult{}, err
|
|
}
|
|
query := url.Values{}
|
|
query.Set("timeout", strconv.Itoa(options.Timeout))
|
|
|
|
resp, err := cli.post(ctx, "/plugins/"+name+"/enable", query, nil, nil)
|
|
defer ensureReaderClosed(resp)
|
|
return PluginEnableResult{}, err
|
|
}
|