client: consolidate node options with their methods

Move them together, as we did for most of the other options.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
This commit is contained in:
Sebastiaan van Stijn
2025-10-24 13:03:21 +02:00
parent 832590155c
commit 875c577711
17 changed files with 42 additions and 52 deletions

View File

@@ -9,6 +9,9 @@ import (
"github.com/moby/moby/api/types/swarm" "github.com/moby/moby/api/types/swarm"
) )
// NodeInspectOptions holds parameters to inspect nodes with.
type NodeInspectOptions struct{}
type NodeInspectResult struct { type NodeInspectResult struct {
Node swarm.Node Node swarm.Node
Raw []byte Raw []byte

View File

@@ -8,6 +8,11 @@ import (
"github.com/moby/moby/api/types/swarm" "github.com/moby/moby/api/types/swarm"
) )
// NodeListOptions holds parameters to list nodes with.
type NodeListOptions struct {
Filters Filters
}
type NodeListResult struct { type NodeListResult struct {
Items []swarm.Node Items []swarm.Node
} }

View File

@@ -5,6 +5,10 @@ import (
"net/url" "net/url"
) )
// NodeRemoveOptions holds parameters to remove nodes with.
type NodeRemoveOptions struct {
Force bool
}
type NodeRemoveResult struct{} type NodeRemoveResult struct{}
// NodeRemove removes a Node. // NodeRemove removes a Node.

View File

@@ -3,8 +3,16 @@ package client
import ( import (
"context" "context"
"net/url" "net/url"
"github.com/moby/moby/api/types/swarm"
) )
// NodeUpdateOptions holds parameters to update nodes with.
type NodeUpdateOptions struct {
Version swarm.Version
Node swarm.NodeSpec
}
type NodeUpdateResult struct{} type NodeUpdateResult struct{}
// NodeUpdate updates a Node. // NodeUpdate updates a Node.

View File

@@ -1,4 +0,0 @@
package client
// NodeInspectOptions holds parameters to inspect nodes with.
type NodeInspectOptions struct{}

View File

@@ -1,6 +0,0 @@
package client
// NodeListOptions holds parameters to list nodes with.
type NodeListOptions struct {
Filters Filters
}

View File

@@ -1,6 +0,0 @@
package client
// NodeRemoveOptions holds parameters to remove nodes with.
type NodeRemoveOptions struct {
Force bool
}

View File

@@ -1,9 +0,0 @@
package client
import "github.com/moby/moby/api/types/swarm"
// NodeUpdateOptions holds parameters to update nodes with.
type NodeUpdateOptions struct {
Version swarm.Version
Node swarm.NodeSpec
}

View File

@@ -26,7 +26,7 @@ type ExecCreateOptions struct {
// ExecCreateResult holds the result of creating a container exec. // ExecCreateResult holds the result of creating a container exec.
type ExecCreateResult struct { type ExecCreateResult struct {
container.ExecCreateResponse ID string
} }
// ExecCreate creates a new exec configuration to run an exec process. // ExecCreate creates a new exec configuration to run an exec process.
@@ -58,7 +58,7 @@ func (cli *Client) ExecCreate(ctx context.Context, containerID string, options E
var response container.ExecCreateResponse var response container.ExecCreateResponse
err = json.NewDecoder(resp.Body).Decode(&response) err = json.NewDecoder(resp.Body).Decode(&response)
return ExecCreateResult{ExecCreateResponse: response}, err return ExecCreateResult{ID: response.ID}, err
} }
type execStartAttachOptions struct { type execStartAttachOptions struct {

View File

@@ -9,6 +9,9 @@ import (
"github.com/moby/moby/api/types/swarm" "github.com/moby/moby/api/types/swarm"
) )
// NodeInspectOptions holds parameters to inspect nodes with.
type NodeInspectOptions struct{}
type NodeInspectResult struct { type NodeInspectResult struct {
Node swarm.Node Node swarm.Node
Raw []byte Raw []byte

View File

@@ -8,6 +8,11 @@ import (
"github.com/moby/moby/api/types/swarm" "github.com/moby/moby/api/types/swarm"
) )
// NodeListOptions holds parameters to list nodes with.
type NodeListOptions struct {
Filters Filters
}
type NodeListResult struct { type NodeListResult struct {
Items []swarm.Node Items []swarm.Node
} }

View File

@@ -5,6 +5,10 @@ import (
"net/url" "net/url"
) )
// NodeRemoveOptions holds parameters to remove nodes with.
type NodeRemoveOptions struct {
Force bool
}
type NodeRemoveResult struct{} type NodeRemoveResult struct{}
// NodeRemove removes a Node. // NodeRemove removes a Node.

View File

@@ -3,8 +3,16 @@ package client
import ( import (
"context" "context"
"net/url" "net/url"
"github.com/moby/moby/api/types/swarm"
) )
// NodeUpdateOptions holds parameters to update nodes with.
type NodeUpdateOptions struct {
Version swarm.Version
Node swarm.NodeSpec
}
type NodeUpdateResult struct{} type NodeUpdateResult struct{}
// NodeUpdate updates a Node. // NodeUpdate updates a Node.

View File

@@ -1,4 +0,0 @@
package client
// NodeInspectOptions holds parameters to inspect nodes with.
type NodeInspectOptions struct{}

View File

@@ -1,6 +0,0 @@
package client
// NodeListOptions holds parameters to list nodes with.
type NodeListOptions struct {
Filters Filters
}

View File

@@ -1,6 +0,0 @@
package client
// NodeRemoveOptions holds parameters to remove nodes with.
type NodeRemoveOptions struct {
Force bool
}

View File

@@ -1,9 +0,0 @@
package client
import "github.com/moby/moby/api/types/swarm"
// NodeUpdateOptions holds parameters to update nodes with.
type NodeUpdateOptions struct {
Version swarm.Version
Node swarm.NodeSpec
}