Add support for swarm init lock and swarm unlock

Signed-off-by: Tonis Tiigi <tonistiigi@gmail.com>
This commit is contained in:
Tonis Tiigi 2016-10-21 18:07:55 -07:00 committed by Aaron Lehmann
parent ab6c38e014
commit dd81022c23
2 changed files with 18 additions and 0 deletions

View File

@ -119,6 +119,7 @@ type ServiceAPIClient interface {
type SwarmAPIClient interface {
SwarmInit(ctx context.Context, req swarm.InitRequest) (string, error)
SwarmJoin(ctx context.Context, req swarm.JoinRequest) error
SwarmUnlock(ctx context.Context, req swarm.UnlockRequest) error
SwarmLeave(ctx context.Context, force bool) error
SwarmInspect(ctx context.Context) (swarm.Swarm, error)
SwarmUpdate(ctx context.Context, version swarm.Version, swarm swarm.Spec, flags swarm.UpdateFlags) error

17
swarm_unlock.go Normal file
View File

@ -0,0 +1,17 @@
package client
import (
"github.com/docker/docker/api/types/swarm"
"golang.org/x/net/context"
)
// SwarmUnlock unlockes locked swarm.
func (cli *Client) SwarmUnlock(ctx context.Context, req swarm.UnlockRequest) error {
serverResp, err := cli.post(ctx, "/swarm/unlock", nil, req, nil)
if err != nil {
return err
}
ensureReaderClosed(serverResp)
return err
}