github.com/afxcn/moby@v1.13.1/client/swarm_update.go (about)

     1  package client
     2  
     3  import (
     4  	"fmt"
     5  	"net/url"
     6  	"strconv"
     7  
     8  	"github.com/docker/docker/api/types/swarm"
     9  	"golang.org/x/net/context"
    10  )
    11  
    12  // SwarmUpdate updates the Swarm.
    13  func (cli *Client) SwarmUpdate(ctx context.Context, version swarm.Version, swarm swarm.Spec, flags swarm.UpdateFlags) error {
    14  	query := url.Values{}
    15  	query.Set("version", strconv.FormatUint(version.Index, 10))
    16  	query.Set("rotateWorkerToken", fmt.Sprintf("%v", flags.RotateWorkerToken))
    17  	query.Set("rotateManagerToken", fmt.Sprintf("%v", flags.RotateManagerToken))
    18  	query.Set("rotateManagerUnlockKey", fmt.Sprintf("%v", flags.RotateManagerUnlockKey))
    19  	resp, err := cli.post(ctx, "/swarm/update", query, swarm, nil)
    20  	ensureReaderClosed(resp)
    21  	return err
    22  }