20 lines
390 B
Go
20 lines
390 B
Go
|
package service
|
||
|
|
||
|
import (
|
||
|
"github.com/docker/docker/api/types"
|
||
|
"github.com/docker/docker/api/types/filters"
|
||
|
"github.com/docker/docker/api/types/swarm"
|
||
|
)
|
||
|
|
||
|
func (d *docker) NodeList() []swarm.Node {
|
||
|
var (
|
||
|
ctx = d.context
|
||
|
options = types.NodeListOptions{Filters: filters.NewArgs()}
|
||
|
)
|
||
|
nodes, err := d.client.NodeList(ctx, options)
|
||
|
if err != nil {
|
||
|
panic(err)
|
||
|
}
|
||
|
return nodes
|
||
|
}
|