mirror of
https://github.com/moby/moby.git
synced 2026-01-11 18:51:37 +00:00
client: rename ConfigListResult.Configs to ConfigListResult.Items
Also consolidate the options with the method. Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
This commit is contained in:
@@ -8,14 +8,18 @@ import (
|
||||
"github.com/moby/moby/api/types/swarm"
|
||||
)
|
||||
|
||||
// ConfigListResult holds the result from the ConfigList method.
|
||||
// ConfigListOptions holds parameters to list configs
|
||||
type ConfigListOptions struct {
|
||||
Filters Filters
|
||||
}
|
||||
|
||||
// ConfigListResult holds the result from the [client.ConfigList] method.
|
||||
type ConfigListResult struct {
|
||||
Configs []swarm.Config
|
||||
Items []swarm.Config
|
||||
}
|
||||
|
||||
// ConfigList returns the list of configs.
|
||||
func (cli *Client) ConfigList(ctx context.Context, options ConfigListOptions) (ConfigListResult, error) {
|
||||
var out ConfigListResult
|
||||
query := url.Values{}
|
||||
options.Filters.updateURLValues(query)
|
||||
|
||||
@@ -25,7 +29,8 @@ func (cli *Client) ConfigList(ctx context.Context, options ConfigListOptions) (C
|
||||
return ConfigListResult{}, err
|
||||
}
|
||||
|
||||
err = json.NewDecoder(resp.Body).Decode(&out.Configs)
|
||||
var out ConfigListResult
|
||||
err = json.NewDecoder(resp.Body).Decode(&out.Items)
|
||||
if err != nil {
|
||||
return ConfigListResult{}, err
|
||||
}
|
||||
|
||||
@@ -83,6 +83,6 @@ func TestConfigList(t *testing.T) {
|
||||
|
||||
result, err := client.ConfigList(context.Background(), listCase.options)
|
||||
assert.NilError(t, err)
|
||||
assert.Check(t, is.Len(result.Configs, 2))
|
||||
assert.Check(t, is.Len(result.Items, 2))
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,9 +2,13 @@ package client
|
||||
|
||||
import "context"
|
||||
|
||||
type ConfigRemoveOptions struct{}
|
||||
type ConfigRemoveOptions struct {
|
||||
// Add future optional parameters here
|
||||
}
|
||||
|
||||
type ConfigRemoveResult struct{}
|
||||
type ConfigRemoveResult struct {
|
||||
// Add future fields here
|
||||
}
|
||||
|
||||
// ConfigRemove removes a config.
|
||||
func (cli *Client) ConfigRemove(ctx context.Context, id string, options ConfigRemoveOptions) (ConfigRemoveResult, error) {
|
||||
|
||||
@@ -1,6 +0,0 @@
|
||||
package client
|
||||
|
||||
// ConfigListOptions holds parameters to list configs
|
||||
type ConfigListOptions struct {
|
||||
Filters Filters
|
||||
}
|
||||
Reference in New Issue
Block a user