Merge pull request #27948 from WeiZhang555/consistent-filters

Replace all "Filter" field with "Filters" for consistency
This commit is contained in:
Sebastiaan van Stijn 2016-11-02 00:53:15 -07:00 committed by GitHub
commit 732006e113
8 changed files with 15 additions and 15 deletions

View File

@ -34,8 +34,8 @@ func (cli *Client) ContainerList(ctx context.Context, options types.ContainerLis
query.Set("size", "1") query.Set("size", "1")
} }
if options.Filter.Len() > 0 { if options.Filters.Len() > 0 {
filterJSON, err := filters.ToParamWithVersion(cli.version, options.Filter) filterJSON, err := filters.ToParamWithVersion(cli.version, options.Filters)
if err != nil { if err != nil {
return nil, err return nil, err

View File

@ -82,10 +82,10 @@ func TestContainerList(t *testing.T) {
filters.Add("label", "label2") filters.Add("label", "label2")
filters.Add("before", "container") filters.Add("before", "container")
containers, err := client.ContainerList(context.Background(), types.ContainerListOptions{ containers, err := client.ContainerList(context.Background(), types.ContainerListOptions{
Size: true, Size: true,
All: true, All: true,
Since: "container", Since: "container",
Filter: filters, Filters: filters,
}) })
if err != nil { if err != nil {
t.Fatal(err) t.Fatal(err)

View File

@ -14,8 +14,8 @@ import (
func (cli *Client) NodeList(ctx context.Context, options types.NodeListOptions) ([]swarm.Node, error) { func (cli *Client) NodeList(ctx context.Context, options types.NodeListOptions) ([]swarm.Node, error) {
query := url.Values{} query := url.Values{}
if options.Filter.Len() > 0 { if options.Filters.Len() > 0 {
filterJSON, err := filters.ToParam(options.Filter) filterJSON, err := filters.ToParam(options.Filters)
if err != nil { if err != nil {
return nil, err return nil, err

View File

@ -45,7 +45,7 @@ func TestNodeList(t *testing.T) {
}, },
{ {
options: types.NodeListOptions{ options: types.NodeListOptions{
Filter: filters, Filters: filters,
}, },
expectedQueryParams: map[string]string{ expectedQueryParams: map[string]string{
"filters": `{"label":{"label1":true,"label2":true}}`, "filters": `{"label":{"label1":true,"label2":true}}`,

View File

@ -14,8 +14,8 @@ import (
func (cli *Client) ServiceList(ctx context.Context, options types.ServiceListOptions) ([]swarm.Service, error) { func (cli *Client) ServiceList(ctx context.Context, options types.ServiceListOptions) ([]swarm.Service, error) {
query := url.Values{} query := url.Values{}
if options.Filter.Len() > 0 { if options.Filters.Len() > 0 {
filterJSON, err := filters.ToParam(options.Filter) filterJSON, err := filters.ToParam(options.Filters)
if err != nil { if err != nil {
return nil, err return nil, err
} }

View File

@ -45,7 +45,7 @@ func TestServiceList(t *testing.T) {
}, },
{ {
options: types.ServiceListOptions{ options: types.ServiceListOptions{
Filter: filters, Filters: filters,
}, },
expectedQueryParams: map[string]string{ expectedQueryParams: map[string]string{
"filters": `{"label":{"label1":true,"label2":true}}`, "filters": `{"label":{"label1":true,"label2":true}}`,

View File

@ -14,8 +14,8 @@ import (
func (cli *Client) TaskList(ctx context.Context, options types.TaskListOptions) ([]swarm.Task, error) { func (cli *Client) TaskList(ctx context.Context, options types.TaskListOptions) ([]swarm.Task, error) {
query := url.Values{} query := url.Values{}
if options.Filter.Len() > 0 { if options.Filters.Len() > 0 {
filterJSON, err := filters.ToParam(options.Filter) filterJSON, err := filters.ToParam(options.Filters)
if err != nil { if err != nil {
return nil, err return nil, err
} }

View File

@ -45,7 +45,7 @@ func TestTaskList(t *testing.T) {
}, },
{ {
options: types.TaskListOptions{ options: types.TaskListOptions{
Filter: filters, Filters: filters,
}, },
expectedQueryParams: map[string]string{ expectedQueryParams: map[string]string{
"filters": `{"label":{"label1":true,"label2":true}}`, "filters": `{"label":{"label1":true,"label2":true}}`,