Kaydet (Commit) 32cd0161 authored tarafından Joffrey F's avatar Joffrey F Kaydeden (comit) GitHub

Merge pull request #1330 from docker/walkerlee-master

Add options to IPAMConfig
...@@ -50,6 +50,8 @@ class IPAMConfig(dict): ...@@ -50,6 +50,8 @@ class IPAMConfig(dict):
driver (str): The IPAM driver to use. Defaults to ``default``. driver (str): The IPAM driver to use. Defaults to ``default``.
pool_configs (list): A list of pool configurations pool_configs (list): A list of pool configurations
(:py:class:`~docker.types.IPAMPool`). Defaults to empty list. (:py:class:`~docker.types.IPAMPool`). Defaults to empty list.
options (dict): Driver options as a key-value dictionary.
Defaults to `None`.
Example: Example:
...@@ -57,12 +59,17 @@ class IPAMConfig(dict): ...@@ -57,12 +59,17 @@ class IPAMConfig(dict):
>>> network = client.create_network('network1', ipam=ipam_config) >>> network = client.create_network('network1', ipam=ipam_config)
""" """
def __init__(self, driver='default', pool_configs=None): def __init__(self, driver='default', pool_configs=None, options=None):
self.update({ self.update({
'Driver': driver, 'Driver': driver,
'Config': pool_configs or [] 'Config': pool_configs or []
}) })
if options:
if not isinstance(options, dict):
raise TypeError('IPAMConfig options must be a dictionary')
self['Options'] = options
class IPAMPool(dict): class IPAMPool(dict):
""" """
......
...@@ -100,7 +100,7 @@ class NetworkTest(BaseAPIClientTest): ...@@ -100,7 +100,7 @@ class NetworkTest(BaseAPIClientTest):
"Gateway": "192.168.52.254", "Gateway": "192.168.52.254",
"Subnet": "192.168.52.0/24", "Subnet": "192.168.52.0/24",
"AuxiliaryAddresses": None, "AuxiliaryAddresses": None,
}] }],
} }
}) })
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment