Ë
    ú}ài°)  ã                   óD   — d dl mZ d dlmZ d dlmZmZmZ  G d„ d«      Zy)é   )Úutils)ÚInvalidVersion)Úcheck_resourceÚminimum_versionÚ
version_ltc                   óÂ   — e Zd Zdd„Z	 	 	 	 dd„Z ed«      dd„«       Z ed«      d„ «       Z ed«      dd„«       Z	 ed	«      	 	 	 	 dd
„«       Z
 ed	«      	 dd„«       Zy)ÚNetworkApiMixinNc                 óÂ   — |€i }|r||d<   |r||d<   dt        j                  |«      i}| j                  d«      }| j                  ||¬«      }| j	                  |d¬«      S )aï  
        List networks. Similar to the ``docker network ls`` command.

        Args:
            names (:py:class:`list`): List of names to filter by
            ids (:py:class:`list`): List of ids to filter by
            filters (dict): Filters to be processed on the network list.
                Available filters:
                - ``driver=[<driver-name>]`` Matches a network's driver.
                - ``label=[<key>]``, ``label=[<key>=<value>]`` or a list of
                    such.
                - ``type=["custom"|"builtin"]`` Filters networks by type.

        Returns:
            (dict): List of network objects.

        Raises:
            :py:class:`docker.errors.APIError`
                If the server returns an error.
        ÚnameÚidÚfiltersz	/networks©ÚparamsT©Újson)r   Úconvert_filtersÚ_urlÚ_getÚ_result)ÚselfÚnamesÚidsr   r   ÚurlÚress          úY/home/factor_ks/STREAMA2026/tests/venv/lib/python3.12/site-packages/docker/api/network.pyÚnetworkszNetworkApiMixin.networks   sn   € ð, ˆ?ØˆGÙØ#ˆG�F‰OÙØˆG�D‰MØœU×2Ñ2°7Ó;Ð<ˆØ�i‰i˜Ó$ˆØ�i‰i˜ FˆiÓ+ˆØ�|‰|˜C dˆ|Ó+Ð+ó    c                 óÐ  — |�t        |t        «      st        d«      ‚|||||dœ}|�At        | j                  d«      rt        d«      ‚t        |t        «      st        d«      ‚||d<   |r&t        | j                  d«      rt        d«      ‚d|d	<   |r&t        | j                  d
«      rt        d«      ‚d|d<   |	�&t        | j                  d«      rt        d«      ‚|	|d<   |�&t        | j                  d«      rt        d«      ‚||d<   |
�&t        | j                  d«      rt        d«      ‚|
|d<   | j                  d«      }| j                  ||¬«      }| j                  |d¬«      S )a‹  
        Create a network. Similar to the ``docker network create``.

        Args:
            name (str): Name of the network
            driver (str): Name of the driver used to create the network
            options (dict): Driver options as a key-value dictionary
            ipam (IPAMConfig): Optional custom IP scheme for the network.
            check_duplicate (bool): Request daemon to check for networks with
                same name. Default: ``None``.
            internal (bool): Restrict external access to the network. Default
                ``False``.
            labels (dict): Map of labels to set on the network. Default
                ``None``.
            enable_ipv6 (bool): Enable IPv6 on the network. Default ``False``.
            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.
            scope (str): Specify the network's scope (``local``, ``global`` or
                ``swarm``)
            ingress (bool): If set, create an ingress network which provides
                the routing-mesh in swarm mode.

        Returns:
            (dict): The created network reference object

        Raises:
            :py:class:`docker.errors.APIError`
                If the server returns an error.

        Example:
            A network using the bridge driver:

                >>> client.api.create_network("network1", driver="bridge")

            You can also create more advanced networks with custom IPAM
            configurations. For example, setting the subnet to
            ``192.168.52.0/24`` and gateway address to ``192.168.52.254``.

            .. code-block:: python

                >>> ipam_pool = docker.types.IPAMPool(
                    subnet='192.168.52.0/24',
                    gateway='192.168.52.254'
                )
                >>> ipam_config = docker.types.IPAMConfig(
                    pool_configs=[ipam_pool]
                )
                >>> client.api.create_network("network1", driver="bridge",
                                                 ipam=ipam_config)
        zoptions must be a dictionary)ÚNameÚDriverÚOptionsÚIPAMÚCheckDuplicatez1.23z*network labels were introduced in API 1.23zlabels must be a dictionaryÚLabelsz&enable_ipv6 was introduced in API 1.23TÚ
EnableIPv6ú1.22z9Internal networks are not supported in API version < 1.22ÚInternalz1.24z1attachable is not supported in API version < 1.24Ú
Attachablez1.29z.ingress is not supported in API version < 1.29ÚIngressz1.30z,scope is not supported in API version < 1.30ÚScopez/networks/create©Údatar   )	Ú
isinstanceÚdictÚ	TypeErrorr   Ú_versionr   r   Ú
_post_jsonr   )r   r   ÚdriverÚoptionsÚipamÚcheck_duplicateÚinternalÚlabelsÚenable_ipv6Ú
attachableÚscopeÚingressr,   r   r   s                  r   Úcreate_networkzNetworkApiMixin.create_network(   sž  € ðn Ð¤z°'¼4Ô'@ÜÐ:Ó;Ð;ð ØØØØ-ñ
ˆð ÐÜ˜$Ÿ-™-¨Ô0Ü$Ø@óð ô ˜f¤dÔ+ÜÐ =Ó>Ð>Ø#ˆD�‰NáÜ˜$Ÿ-™-¨Ô0Ü$Ø<óð ð "&ˆD�ÑáÜ˜$Ÿ-™-¨Ô0Ü$ð &Gó Hð Hà#ˆD�ÑàÐ!Ü˜$Ÿ-™-¨Ô0Ü$ØGóð ð ",ˆD�ÑàÐÜ˜$Ÿ-™-¨Ô0Ü$ØDóð ð &ˆD�‰OàÐÜ˜$Ÿ-™-¨Ô0Ü$ØBóð ð "ˆD�‰Mà�i‰iÐ*Ó+ˆØ�o‰o˜c¨ˆoÓ-ˆØ�|‰|˜C dˆ|Ó+Ð+r   z1.25c                 ó¢   — i }|rt        j                  |«      |d<   | j                  d«      }| j                  | j	                  ||¬«      d«      S )a‚  
        Delete unused networks

        Args:
            filters (dict): Filters to process on the prune list.

        Returns:
            (dict): A dict containing a list of deleted network names and
                the amount of disk space reclaimed in bytes.

        Raises:
            :py:class:`docker.errors.APIError`
                If the server returns an error.
        r   z/networks/pruner   T)r   r   r   r   Ú_post)r   r   r   r   s       r   Úprune_networkszNetworkApiMixin.prune_networksš   sN   € ð  ˆÙÜ %× 5Ñ 5°gÓ >ˆF�9ÑØ�i‰iÐ)Ó*ˆØ�|‰|˜DŸJ™J s°6˜JÓ:¸DÓAÐAr   Únet_idc                 ól   — | j                  d|«      }| j                  |«      }| j                  |«       y)z‹
        Remove a network. Similar to the ``docker network rm`` command.

        Args:
            net_id (str): The network's id
        ú/networks/{0}N)r   Ú_deleteÚ_raise_for_status)r   r@   r   r   s       r   Úremove_networkzNetworkApiMixin.remove_network°   s0   € ð �i‰i˜¨Ó0ˆØ�l‰l˜3ÓˆØ×Ñ˜sÕ#r   c                 ó  — i }|�&t        | j                  d«      rt        d«      ‚||d<   |�&t        | j                  d«      rt        d«      ‚||d<   | j                  d|«      }| j	                  ||¬«      }| j                  |d	¬
«      S )aD  
        Get detailed information about a network.

        Args:
            net_id (str): ID of network
            verbose (bool): Show the service details across the cluster in
                swarm mode.
            scope (str): Filter the network by scope (``swarm``, ``global``
                or ``local``).
        z1.28z"verbose was introduced in API 1.28Úverbosez1.31z scope was introduced in API 1.31r:   rB   r   Tr   )r   r0   r   r   r   r   )r   r@   rG   r:   r   r   r   s          r   Úinspect_networkzNetworkApiMixin.inspect_network¼   s‘   € ð ˆØÐÜ˜$Ÿ-™-¨Ô0Ü$Ð%IÓJÐJØ 'ˆF�9ÑØÐÜ˜$Ÿ-™-¨Ô0Ü$Ð%GÓHÐHØ#ˆF�7‰Oà�i‰i˜¨Ó0ˆØ�i‰i˜ FˆiÓ+ˆØ�|‰|˜C dˆ|Ó+Ð+r   Ú	containerc
           
      ó¦   — || j                  |||||||	¬«      dœ}
| j                  d|«      }| j                  ||
¬«      }| j                  |«       y)aF  
        Connect a container to a network.

        Args:
            container (str): container-id/name to be connected to the network
            net_id (str): network id
            aliases (:py:class:`list`): A list of aliases for this endpoint.
                Names in that list can be used within the network to reach the
                container. Defaults to ``None``.
            links (:py:class:`list`): A list of links for this endpoint.
                Containers declared in this list will be linked to this
                container. Defaults to ``None``.
            ipv4_address (str): The IP address of this container on the
                network, using the IPv4 protocol. Defaults to ``None``.
            ipv6_address (str): The IP address of this container on the
                network, using the IPv6 protocol. Defaults to ``None``.
            link_local_ips (:py:class:`list`): A list of link-local
                (IPv4/IPv6) addresses.
            mac_address (str): The MAC address of this container on the
                network. Defaults to ``None``.
        )ÚaliasesÚlinksÚipv4_addressÚipv6_addressÚlink_local_ipsÚ
driver_optÚmac_address)Ú	ContainerÚEndpointConfigz/networks/{0}/connectr+   N)Úcreate_endpoint_configr   r1   rD   )r   rI   r@   rM   rN   rK   rL   rO   rP   rQ   r,   r   r   s                r   Úconnect_container_to_networkz,NetworkApiMixin.connect_container_to_networkÖ   sf   € ð8 #Ø"×9Ñ9Ø u¸<Ø)¸.Ø%Ø'ð	 :ó ñ
ˆð �i‰iÐ/°Ó8ˆØ�o‰o˜c¨ˆoÓ-ˆØ×Ñ˜sÕ#r   c                 óÈ   — d|i}|r&t        | j                  d«      rt        d«      ‚||d<   | j                  d|«      }| j	                  ||¬«      }| j                  |«       y)aA  
        Disconnect a container from a network.

        Args:
            container (str): container ID or name to be disconnected from the
                network
            net_id (str): network ID
            force (bool): Force the container to disconnect from a network.
                Default: ``False``
        rR   r&   z,Forced disconnect was introduced in API 1.22ÚForcez/networks/{0}/disconnectr+   N)r   r0   r   r   r1   rD   )r   rI   r@   Úforcer,   r   r   s          r   Ú!disconnect_container_from_networkz1NetworkApiMixin.disconnect_container_from_networkÿ   sk   € ð ˜YÐ'ˆÙÜ˜$Ÿ-™-¨Ô0Ü$ØBóð ð "ˆD�‰MØ�i‰iÐ2°FÓ;ˆØ�o‰o˜c¨ˆoÓ-ˆØ×Ñ˜sÕ#r   )NNN)
NNNNFNFNNN)N)NN)NNNNNNN)F)Ú__name__Ú
__module__Ú__qualname__r   r<   r   r?   r   rE   rH   rU   rY   © r   r   r	   r	      s®   „ ó,ðB DHØDHØAEØ#óp,ñd �VÓòBó ðBñ* �HÓñ	$ó ð	$ñ �HÓò,ó ð,ñ2 �KÓ àEIØ9=ØEIØ15ò	&$ó !ð&$ñP �KÓ à05ò$ó !ñ$r   r	   N)Ú r   Úerrorsr   r   r   r   r	   r]   r   r   ú<module>r`      s   ðÝ Ý #ß ?Ñ ?÷O$ò O$r   