Commit Graph

14 Commits

Author SHA1 Message Date
Sebastiaan van Stijn 97c5ae25c4
Replace uses of filters.Include() with filters.Contains()
The `filters.Include()` method was deprecated in favor of `filters.Contains()`
in 065118390a, but still used in various
locations.

This patch replaces uses of `filters.Include()` with `filters.Contains()`.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2017-09-26 13:39:56 +02:00
Brian Goff ebcb7d6b40 Remove string checking in API error handling
Use strongly typed errors to set HTTP status codes.
Error interfaces are defined in the api/errors package and errors
returned from controllers are checked against these interfaces.

Errors can be wraeped in a pkg/errors.Causer, as long as somewhere in the
line of causes one of the interfaces is implemented. The special error
interfaces take precedence over Causer, meaning if both Causer and one
of the new error interfaces are implemented, the Causer is not
traversed.

Signed-off-by: Brian Goff <cpuguy83@gmail.com>
2017-08-15 16:01:11 -04:00
Yong Tang 704ea8f6b4 Add `--filter scope=swarm|local` for `docker network ls`
This fix tries to address the request in 31324 by adding
`--filter scope=swarm|local` for `docker network ls`.

As `docker network ls` has a `SCOPE` column by default,
it is natural to add the support of `--filter scope=swarm|local`.

This fix adds the `scope=swarm|local` support for
`docker network ls --filter`.

Related docs has been updated.

Additional unit test cases have been added.

This fix fixes 31324.

Signed-off-by: Yong Tang <yong.tang.github@outlook.com>
2017-03-23 18:48:11 -07:00
Yong Tang 6ae709bf10 Return `[]` instead of `null` in case filterNetworks returns empty
This fix tries to address the issue raised in 29946 where
listing networks from API will return `null` if the result of
network filter is empty.

The reason for the issue was that inside the `filterNetworks()`,
the return value was initialized as `nil`:
```
 var typeNet []types.NetworkResource
```

This is inconsistent with other places where return value was
initialized with `[]`
```
displayNet := []types.NetworkResource{}
```

This fix addresses the issue by changing `typeNet` to `[]` as well.

This fix fixes 29946.

Signed-off-by: Yong Tang <yong.tang.github@outlook.com>
2017-01-11 01:56:11 -08:00
allencloud ee2925e2f9 fail fast when network filter invalid
Signed-off-by: allencloud <allen.sun@daocloud.io>
2016-12-29 17:34:53 +08:00
Vincent Demeester e517d7975e
AcceptedFilters in router/network/filter.go should not be exported
It's not used elsewhere and doesn't need to be exported.

Signed-off-by: Vincent Demeester <vincent@sbr.pm>
2016-11-28 14:14:50 +01:00
Michael Crosby 7c36a1af03 Move engine-api client package
This moves the engine-api client package to `/docker/docker/client`.

Signed-off-by: Michael Crosby <crosbymichael@gmail.com>
2016-09-07 11:05:58 -07:00
Vincent Demeester a7043ac5c4
Return an empty network list if nothing matches filter
Initializing the network list struct in order to return an empty list
instead of a nil object.

Signed-off-by: Vincent Demeester <vincent@sbr.pm>
2016-06-29 00:06:44 +02:00
Alexander Morozov ed5d335e22 api,daemon: cleanup some unused stuff
Signed-off-by: Alexander Morozov <lk4d4@docker.com>
2016-06-21 14:15:19 -07:00
Tonis Tiigi 534a90a993 Add Swarm management backend
As described in our ROADMAP.md, introduce new Swarm management API
endpoints relying on swarmkit to deploy services. It currently vendors
docker/engine-api changes.

This PR is fully backward compatible (joining a Swarm is an optional
feature of the Engine, and existing commands are not impacted).

Signed-off-by: Tonis Tiigi <tonistiigi@gmail.com>
Signed-off-by: Victor Vieux <vieux@docker.com>
Signed-off-by: Daniel Nephin <dnephin@docker.com>
Signed-off-by: Jana Radhakrishnan <mrjana@docker.com>
Signed-off-by: Madhu Venugopal <madhu@docker.com>
2016-06-13 22:16:18 -07:00
David Calavera 3ca29823d4 Remove runconfig dependency from network routes.
Signed-off-by: David Calavera <david.calavera@gmail.com>
2016-03-28 16:23:50 -04:00
allencloud 2736f77a94 fix typos
Signed-off-by: allencloud <allen.sun@daocloud.io>
2016-03-06 00:59:11 +08:00
David Calavera 907407d0b2 Modify import paths to point to the new engine-api package.
Signed-off-by: David Calavera <david.calavera@gmail.com>
2016-01-06 19:48:59 -05:00
Zhang Wei 26dd026bd7 Add filter for `network ls` to hide predefined net
Add filter support for `network ls` to hide predefined network,
then user can use "docker network rm `docker network ls -f type=custom`"
to delete a bundle of userdefined networks.

Signed-off-by: Zhang Wei <zhangwei555@huawei.com>
2015-12-23 13:26:40 +08:00