diff options
-rw-r--r-- | docker/types/networks.py | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/docker/types/networks.py b/docker/types/networks.py index a539ac0..628ea65 100644 --- a/docker/types/networks.py +++ b/docker/types/networks.py @@ -50,6 +50,8 @@ class IPAMConfig(dict): driver (str): The IPAM driver to use. Defaults to ``default``. pool_configs (list): A list of pool configurations (:py:class:`~docker.types.IPAMPool`). Defaults to empty list. + options (dict): Driver options as a key-value dictionary. + Defaults to `None`. Example: @@ -57,12 +59,17 @@ class IPAMConfig(dict): >>> 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({ 'Driver': driver, '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): """ |