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>
26 lines
594 B
Go
26 lines
594 B
Go
package client
|
|
|
|
import (
|
|
"context"
|
|
"net/url"
|
|
)
|
|
|
|
// SwarmLeaveOptions contains options for leaving a swarm.
|
|
type SwarmLeaveOptions struct {
|
|
Force bool
|
|
}
|
|
|
|
// SwarmLeaveResult represents the result of a SwarmLeave operation.
|
|
type SwarmLeaveResult struct{}
|
|
|
|
// SwarmLeave leaves the swarm.
|
|
func (cli *Client) SwarmLeave(ctx context.Context, options SwarmLeaveOptions) (SwarmLeaveResult, error) {
|
|
query := url.Values{}
|
|
if options.Force {
|
|
query.Set("force", "1")
|
|
}
|
|
resp, err := cli.post(ctx, "/swarm/leave", query, nil, nil)
|
|
defer ensureReaderClosed(resp)
|
|
return SwarmLeaveResult{}, err
|
|
}
|