summaryrefslogtreecommitdiff
path: root/docker/api/network.py
diff options
context:
space:
mode:
authorJoffrey F <joffrey@docker.com>2017-05-17 15:23:36 -0700
committerJoffrey F <joffrey@docker.com>2017-05-17 15:25:10 -0700
commitff718f5dac2ba00ffbb52c0f3b1af5b687f07930 (patch)
treec06c1657c4935af6905f1ae7c22c1d5a88a7e228 /docker/api/network.py
parent7af7e1b73adbbe9385ee052ebd3755a1a62652f2 (diff)
downloaddocker-py-ff718f5dac2ba00ffbb52c0f3b1af5b687f07930.tar.gz
Add support for ingress in create_networkcreate-ingress-network
Signed-off-by: Joffrey F <joffrey@docker.com>
Diffstat (limited to 'docker/api/network.py')
-rw-r--r--docker/api/network.py13
1 files changed, 12 insertions, 1 deletions
diff --git a/docker/api/network.py b/docker/api/network.py
index 74f4cd2..3a45454 100644
--- a/docker/api/network.py
+++ b/docker/api/network.py
@@ -41,7 +41,8 @@ class NetworkApiMixin(object):
@minimum_version('1.21')
def create_network(self, name, driver=None, options=None, ipam=None,
check_duplicate=None, internal=False, labels=None,
- enable_ipv6=False, attachable=None, scope=None):
+ enable_ipv6=False, attachable=None, scope=None,
+ ingress=None):
"""
Create a network. Similar to the ``docker network create``.
@@ -60,6 +61,8 @@ class NetworkApiMixin(object):
attachable (bool): If enabled, and the network is in the global
scope, non-service containers on worker nodes will be able to
connect to the network.
+ ingress (bool): If set, create an ingress network which provides
+ the routing-mesh in swarm mode.
Returns:
(dict): The created network reference object
@@ -129,6 +132,14 @@ class NetworkApiMixin(object):
)
data['Attachable'] = attachable
+ if ingress is not None:
+ if version_lt(self._version, '1.29'):
+ raise InvalidVersion(
+ 'ingress is not supported in API version < 1.29'
+ )
+
+ data['Ingress'] = ingress
+
url = self._url("/networks/create")
res = self._post_json(url, data=data)
return self._result(res, json=True)