mirror of
https://github.com/moby/moby.git
synced 2026-08-09 09:33:50 +00:00
Add missing Go doc comments to the exported option and result types in config_remove.go, config_update.go, secret_remove.go, secret_update.go, node_inspect.go, node_list.go, node_remove.go, and node_update.go. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Signed-off-by: Poyraz Küçükarslan <83272398+PoyrazK@users.noreply.github.com>
32 lines
789 B
Go
32 lines
789 B
Go
package client
|
|
|
|
import (
|
|
"context"
|
|
"net/url"
|
|
|
|
"github.com/moby/moby/api/types/swarm"
|
|
)
|
|
|
|
// NodeUpdateOptions holds parameters to update nodes with.
|
|
type NodeUpdateOptions struct {
|
|
Version swarm.Version
|
|
Spec swarm.NodeSpec
|
|
}
|
|
|
|
// NodeUpdateResult holds the result of [Client.NodeUpdate].
|
|
type NodeUpdateResult struct{}
|
|
|
|
// NodeUpdate updates a Node.
|
|
func (cli *Client) NodeUpdate(ctx context.Context, nodeID string, options NodeUpdateOptions) (NodeUpdateResult, error) {
|
|
nodeID, err := trimID("node", nodeID)
|
|
if err != nil {
|
|
return NodeUpdateResult{}, err
|
|
}
|
|
|
|
query := url.Values{}
|
|
query.Set("version", options.Version.String())
|
|
resp, err := cli.post(ctx, "/nodes/"+nodeID+"/update", query, options.Spec, nil)
|
|
defer ensureReaderClosed(resp)
|
|
return NodeUpdateResult{}, err
|
|
}
|