Repository: docker/docker-py

Issue:
Check resource error in container network API
```
docker python client v2.4.2
python v2.7.12
docker v17.03.1-ce
Ubuntu 16.04
```

PR #1649 updated the `check_resource` decorator to handle different resource names.  Container network API functions  `connect_container_to_network()` and `disconnect_container_from_network()` check 'image' as resource ID and not 'container'.

Reproduce using the following snippet:
```python
import docker

cli = docker.APIClient(base_url='unix:///var/run/docker.sock')
cli.pull(repository='ubuntu', tag='latest')

name = 'my_ubuntu'
container = cli.create_container(image='ubuntu:latest', name=name)
cli.connect_container_to_network(container=name, net_id='bridge')
```

This causes:
```
Traceback (most recent call last):
  File "test.py", line 8, in <module>
    cli.connect_container_to_network(container=name, net_id='bridge')
  File "/home/mberry/scratch/virtualenv/docker_py/local/lib/python2.7/site-packages/docker/utils/decorators.py", line 17, in wrapped
    'Resource ID was not provided'
docker.errors.NullResource: Resource ID was not provided
```
Check resource error in container network API
```
docker python client v2.4.2
python v2.7.12
docker v17.03.1-ce
Ubuntu 16.04
```

PR #1649 updated the `check_resource` decorator to handle different resource names.  Container network API functions  `connect_container_to_network()` and `disconnect_container_from_network()` check 'image' as resource ID and not 'container'.

Reproduce using the following snippet:
```python
import docker

cli = docker.APIClient(base_url='unix:///var/run/docker.sock')
cli.pull(repository='ubuntu', tag='latest')

name = 'my_ubuntu'
container = cli.create_container(image='ubuntu:latest', name=name)
cli.connect_container_to_network(container=name, net_id='bridge')
```

This causes:
```
Traceback (most recent call last):
  File "test.py", line 8, in <module>
    cli.connect_container_to_network(container=name, net_id='bridge')
  File "/home/mberry/scratch/virtualenv/docker_py/local/lib/python2.7/site-packages/docker/utils/decorators.py", line 17, in wrapped
    'Resource ID was not provided'
docker.errors.NullResource: Resource ID was not provided
```


Discussion:

Resolving patch:
diff --git a/docker/api/network.py b/docker/api/network.py
--- a/docker/api/network.py
+++ b/docker/api/network.py
@@ -200,7 +200,7 @@ def inspect_network(self, net_id, verbose=None):
         res = self._get(url, params=params)
         return self._result(res, json=True)
 
-    @check_resource('image')
+    @check_resource('container')
     @minimum_version('1.21')
     def connect_container_to_network(self, container, net_id,
                                      ipv4_address=None, ipv6_address=None,
@@ -237,7 +237,7 @@ def connect_container_to_network(self, container, net_id,
         res = self._post_json(url, data=data)
         self._raise_for_status(res)
 
-    @check_resource('image')
+    @check_resource('container')
     @minimum_version('1.21')
     def disconnect_container_from_network(self, container, net_id,
                                           force=False):


Test patch:
diff --git a/tests/unit/api_network_test.py b/tests/unit/api_network_test.py
--- a/tests/unit/api_network_test.py
+++ b/tests/unit/api_network_test.py
@@ -147,8 +147,8 @@ def test_connect_container_to_network(self):
 
         with mock.patch('docker.api.client.APIClient.post', post):
             self.client.connect_container_to_network(
-                {'Id': container_id},
-                network_id,
+                container={'Id': container_id},
+                net_id=network_id,
                 aliases=['foo', 'bar'],
                 links=[('baz', 'quux')]
             )
@@ -176,7 +176,7 @@ def test_disconnect_container_from_network(self):
 
         with mock.patch('docker.api.client.APIClient.post', post):
             self.client.disconnect_container_from_network(
-                {'Id': container_id}, network_id)
+                container={'Id': container_id}, net_id=network_id)
 
         self.assertEqual(
             post.call_args[0][0],