Files
opencloud/vendor/github.com/moby/moby/client/node_update.go
T
dependabot[bot] d88bd1aa59 build(deps): bump github.com/testcontainers/testcontainers-go/modules/opensearch
Bumps [github.com/testcontainers/testcontainers-go/modules/opensearch](https://github.com/testcontainers/testcontainers-go) from 0.41.0 to 0.42.0.
- [Release notes](https://github.com/testcontainers/testcontainers-go/releases)
- [Commits](https://github.com/testcontainers/testcontainers-go/compare/v0.41.0...v0.42.0)

---
updated-dependencies:
- dependency-name: github.com/testcontainers/testcontainers-go/modules/opensearch
  dependency-version: 0.42.0
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2026-04-22 11:29:03 +02:00

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
}