MCPcopy Create free account
hub / github.com/docker/docker-py / IPAMConfig

Class IPAMConfig

docker/types/networks.py:60–88  ·  view source on GitHub ↗

Create an IPAM (IP Address Management) config dictionary to be used with :py:meth:`~docker.api.network.NetworkApiMixin.create_network`. Args: driver (str): The IPAM driver to use. Defaults to ``default``. pool_configs (:py:class:`list`): A list of pool configurations

Source from the content-addressed store, hash-verified

58
59
60class IPAMConfig(dict):
61 """
62 Create an IPAM (IP Address Management) config dictionary to be used with
63 :py:meth:`~docker.api.network.NetworkApiMixin.create_network`.
64
65 Args:
66
67 driver (str): The IPAM driver to use. Defaults to ``default``.
68 pool_configs (:py:class:`list`): A list of pool configurations
69 (:py:class:`~docker.types.IPAMPool`). Defaults to empty list.
70 options (dict): Driver options as a key-value dictionary.
71 Defaults to `None`.
72
73 Example:
74
75 >>> ipam_config = docker.types.IPAMConfig(driver='default')
76 >>> network = client.create_network('network1', ipam=ipam_config)
77
78 """
79 def __init__(self, driver='default', pool_configs=None, options=None):
80 self.update({
81 'Driver': driver,
82 'Config': pool_configs or []
83 })
84
85 if options:
86 if not isinstance(options, dict):
87 raise TypeError('IPAMConfig options must be a dictionary')
88 self['Options'] = options
89
90
91class IPAMPool(dict):

Calls

no outgoing calls