github.com/ssdev-go/moby@v17.12.1-ce-rc2+incompatible/client/swarm_inspect.go (about) 1 package client 2 3 import ( 4 "encoding/json" 5 6 "github.com/docker/docker/api/types/swarm" 7 "golang.org/x/net/context" 8 ) 9 10 // SwarmInspect inspects the swarm. 11 func (cli *Client) SwarmInspect(ctx context.Context) (swarm.Swarm, error) { 12 serverResp, err := cli.get(ctx, "/swarm", nil, nil) 13 if err != nil { 14 return swarm.Swarm{}, err 15 } 16 17 var response swarm.Swarm 18 err = json.NewDecoder(serverResp.body).Decode(&response) 19 ensureReaderClosed(serverResp) 20 return response, err 21 }