From d121e14ccded94cf01c21a7a22e7e43f91fd9838 Mon Sep 17 00:00:00 2001 From: Zhang Wei Date: Tue, 1 Nov 2016 22:01:16 +0800 Subject: [PATCH] Replace all "Filter" field with "Filters" for consistency In file `api/types/client.go`, some of the "*Options{}" structs own a `Filters` field while some else have the name of `Filter`, this commit will rename all `Filter` to `Filters` for consistency. Also `Filters` is consistent with API with format `/xxx?filters=xxx`, that's why `Filters` is the right name. Signed-off-by: Zhang Wei --- container_list.go | 4 ++-- container_list_test.go | 8 ++++---- node_list.go | 4 ++-- node_list_test.go | 2 +- service_list.go | 4 ++-- service_list_test.go | 2 +- task_list.go | 4 ++-- task_list_test.go | 2 +- 8 files changed, 15 insertions(+), 15 deletions(-) diff --git a/container_list.go b/container_list.go index a8945d84f1..4398912197 100644 --- a/container_list.go +++ b/container_list.go @@ -34,8 +34,8 @@ func (cli *Client) ContainerList(ctx context.Context, options types.ContainerLis query.Set("size", "1") } - if options.Filter.Len() > 0 { - filterJSON, err := filters.ToParamWithVersion(cli.version, options.Filter) + if options.Filters.Len() > 0 { + filterJSON, err := filters.ToParamWithVersion(cli.version, options.Filters) if err != nil { return nil, err diff --git a/container_list_test.go b/container_list_test.go index 5068b7573e..e41c6874b5 100644 --- a/container_list_test.go +++ b/container_list_test.go @@ -82,10 +82,10 @@ func TestContainerList(t *testing.T) { filters.Add("label", "label2") filters.Add("before", "container") containers, err := client.ContainerList(context.Background(), types.ContainerListOptions{ - Size: true, - All: true, - Since: "container", - Filter: filters, + Size: true, + All: true, + Since: "container", + Filters: filters, }) if err != nil { t.Fatal(err) diff --git a/node_list.go b/node_list.go index 0716875ccc..3e8440f08e 100644 --- a/node_list.go +++ b/node_list.go @@ -14,8 +14,8 @@ import ( func (cli *Client) NodeList(ctx context.Context, options types.NodeListOptions) ([]swarm.Node, error) { query := url.Values{} - if options.Filter.Len() > 0 { - filterJSON, err := filters.ToParam(options.Filter) + if options.Filters.Len() > 0 { + filterJSON, err := filters.ToParam(options.Filters) if err != nil { return nil, err diff --git a/node_list_test.go b/node_list_test.go index 1b3b35f357..0251b5cce4 100644 --- a/node_list_test.go +++ b/node_list_test.go @@ -45,7 +45,7 @@ func TestNodeList(t *testing.T) { }, { options: types.NodeListOptions{ - Filter: filters, + Filters: filters, }, expectedQueryParams: map[string]string{ "filters": `{"label":{"label1":true,"label2":true}}`, diff --git a/service_list.go b/service_list.go index 4ebc9f3011..c29e6d407d 100644 --- a/service_list.go +++ b/service_list.go @@ -14,8 +14,8 @@ import ( func (cli *Client) ServiceList(ctx context.Context, options types.ServiceListOptions) ([]swarm.Service, error) { query := url.Values{} - if options.Filter.Len() > 0 { - filterJSON, err := filters.ToParam(options.Filter) + if options.Filters.Len() > 0 { + filterJSON, err := filters.ToParam(options.Filters) if err != nil { return nil, err } diff --git a/service_list_test.go b/service_list_test.go index 728187919f..213981ef70 100644 --- a/service_list_test.go +++ b/service_list_test.go @@ -45,7 +45,7 @@ func TestServiceList(t *testing.T) { }, { options: types.ServiceListOptions{ - Filter: filters, + Filters: filters, }, expectedQueryParams: map[string]string{ "filters": `{"label":{"label1":true,"label2":true}}`, diff --git a/task_list.go b/task_list.go index 07c8324c83..66324da959 100644 --- a/task_list.go +++ b/task_list.go @@ -14,8 +14,8 @@ import ( func (cli *Client) TaskList(ctx context.Context, options types.TaskListOptions) ([]swarm.Task, error) { query := url.Values{} - if options.Filter.Len() > 0 { - filterJSON, err := filters.ToParam(options.Filter) + if options.Filters.Len() > 0 { + filterJSON, err := filters.ToParam(options.Filters) if err != nil { return nil, err } diff --git a/task_list_test.go b/task_list_test.go index 2d9b812bc2..2a9a4c4346 100644 --- a/task_list_test.go +++ b/task_list_test.go @@ -45,7 +45,7 @@ func TestTaskList(t *testing.T) { }, { options: types.TaskListOptions{ - Filter: filters, + Filters: filters, }, expectedQueryParams: map[string]string{ "filters": `{"label":{"label1":true,"label2":true}}`,