github.com/ssdev-go/moby@v17.12.1-ce-rc2+incompatible/client/config_update.go (about)

     1  package client
     2  
     3  import (
     4  	"net/url"
     5  	"strconv"
     6  
     7  	"github.com/docker/docker/api/types/swarm"
     8  	"golang.org/x/net/context"
     9  )
    10  
    11  // ConfigUpdate attempts to update a Config
    12  func (cli *Client) ConfigUpdate(ctx context.Context, id string, version swarm.Version, config swarm.ConfigSpec) error {
    13  	if err := cli.NewVersionError("1.30", "config update"); err != nil {
    14  		return err
    15  	}
    16  	query := url.Values{}
    17  	query.Set("version", strconv.FormatUint(version.Index, 10))
    18  	resp, err := cli.post(ctx, "/configs/"+id+"/update", query, config, nil)
    19  	ensureReaderClosed(resp)
    20  	return err
    21  }