mirror of
https://github.com/moby/moby.git
synced 2026-01-11 18:51:37 +00:00
22 lines
439 B
Go
22 lines
439 B
Go
package client
|
|
|
|
import (
|
|
"context"
|
|
"encoding/json"
|
|
|
|
"github.com/moby/moby/api/types/swarm"
|
|
)
|
|
|
|
// SwarmInspect inspects the swarm.
|
|
func (cli *Client) SwarmInspect(ctx context.Context) (swarm.Swarm, error) {
|
|
resp, err := cli.get(ctx, "/swarm", nil, nil)
|
|
defer ensureReaderClosed(resp)
|
|
if err != nil {
|
|
return swarm.Swarm{}, err
|
|
}
|
|
|
|
var response swarm.Swarm
|
|
err = json.NewDecoder(resp.Body).Decode(&response)
|
|
return response, err
|
|
}
|