github.com/Prakhar-Agarwal-byte/moby@v0.0.0-20231027092010-a14e3e8ab87e/client/config_update.go (about) 1 package client // import "github.com/Prakhar-Agarwal-byte/moby/client" 2 3 import ( 4 "context" 5 "net/url" 6 7 "github.com/Prakhar-Agarwal-byte/moby/api/types/swarm" 8 ) 9 10 // ConfigUpdate attempts to update a config 11 func (cli *Client) ConfigUpdate(ctx context.Context, id string, version swarm.Version, config swarm.ConfigSpec) error { 12 if err := cli.NewVersionError(ctx, "1.30", "config update"); err != nil { 13 return err 14 } 15 query := url.Values{} 16 query.Set("version", version.String()) 17 resp, err := cli.post(ctx, "/configs/"+id+"/update", query, config, nil) 18 ensureReaderClosed(resp) 19 return err 20 }