Ë
    9ài  ã                   ód   — d dl mZ d dlmZ ddlmZ ddlmZmZ  G d„ de«      Z	 G d„ d	e«      Z
y
)é   )Ú	APIClient)Úversion_gteé   )Ú	Container)Ú
CollectionÚModelc                   óB   — e Zd ZdZed„ «       Zed„ «       Zd„ Zd„ Zd„ Z	y)ÚNetworkz
    A Docker network.
    c                 ó8   — | j                   j                  d«      S )z*
        The name of the network.
        ÚName)ÚattrsÚget©Úselfs    úW/home/factor_ks/STREAMA2026/venv/lib/python3.12/site-packages/docker/models/networks.pyÚnamezNetwork.name   s   € ð
 �z‰z�~‰~˜fÓ%Ð%ó    c                 óÈ   — | j                   j                  d«      xs i j                  «       D �cg c]'  }| j                  j                  j                  |«      ‘Œ) c}S c c}w )z‘
        The containers that are connected to the network, as a list of
        :py:class:`~docker.models.containers.Container` objects.
        Ú
Containers)r   r   ÚkeysÚclientÚ
containers)r   Úcids     r   r   zNetwork.containers   sQ   € ð �Z‰Z�^‰^˜LÓ)Ò/¨R×5Ñ5Ó7ö
Ø03ˆD�K‰K×"Ñ"×&Ñ& sÕ+ò
ð 	
ùò 
s   °,Ac                 ó¤   — t        |t        «      r|j                  } | j                  j                  j
                  || j                  g|¢­i |¤ŽS )a  
        Connect a container to this network.

        Args:
            container (str): Container to connect to this network, as either
                an ID, name, or :py:class:`~docker.models.containers.Container`
                object.
            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 linkedto 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.
            driver_opt (dict): A dictionary of options to provide to the
                network driver. Defaults to ``None``.

        Raises:
            :py:class:`docker.errors.APIError`
                If the server returns an error.
        )Ú
isinstancer   Úidr   ÚapiÚconnect_container_to_network©r   Ú	containerÚargsÚkwargss       r   ÚconnectzNetwork.connect   sM   € ô6 �i¤Ô+Ø!Ÿ™ˆIØ;ˆt�{‰{�‰×;Ñ;Ø�t—w‘wð
Ø!%ò
Ø)/ñ
ð 	
r   c                 ó¤   — t        |t        «      r|j                  } | j                  j                  j
                  || j                  g|¢­i |¤ŽS )aã  
        Disconnect a container from this network.

        Args:
            container (str): Container to disconnect from this network, as
                either an ID, name, or
                :py:class:`~docker.models.containers.Container` object.
            force (bool): Force the container to disconnect from a network.
                Default: ``False``

        Raises:
            :py:class:`docker.errors.APIError`
                If the server returns an error.
        )r   r   r   r   r   Ú!disconnect_container_from_networkr   s       r   Ú
disconnectzNetwork.disconnect>   sM   € ô �i¤Ô+Ø!Ÿ™ˆIØ@ˆt�{‰{�‰×@Ñ@Ø�t—w‘wð
Ø!%ò
Ø)/ñ
ð 	
r   c                 ó`   — | j                   j                  j                  | j                  «      S )z–
        Remove this network.

        Raises:
            :py:class:`docker.errors.APIError`
                If the server returns an error.
        )r   r   Úremove_networkr   r   s    r   ÚremovezNetwork.removeS   s!   € ð �{‰{�‰×-Ñ-¨d¯g©gÓ6Ð6r   N)
Ú__name__Ú
__module__Ú__qualname__Ú__doc__Úpropertyr   r   r#   r&   r)   © r   r   r
   r
      s?   „ ñð ñ&ó ð&ð ñ
ó ð
ò
òB
ó*7r   r
   c                   ód   — e Zd ZdZeZd„ Zd„ Zd„ Zdd„Z	e
j                  j                  e	_        y)ÚNetworkCollectionz(
    Networks on the Docker server.
    c                 ó~   —  | j                   j                  j                  |g|¢­i |¤Ž}| 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:
            (:py:class:`Network`): The network that was created.

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

        Example:
            A network using the bridge driver:

                >>> client.networks.create("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.networks.create(
                    "network1",
                    driver="bridge",
                    ipam=ipam_config
                )

        ÚId)r   r   Úcreate_networkr   )r   r   r!   r"   Úresps        r   ÚcreatezNetworkCollection.created   s<   € ðp .ˆt�{‰{�‰×-Ñ-¨dÐD°TÒD¸VÑDˆØ�x‰x˜˜T™
Ó#Ð#r   c                 ót   — | j                   | j                  j                  j                  |g|¢­i |¤Ž«      S )aU  
        Get a network by its ID.

        Args:
            network_id (str): The ID of the network.
            verbose (bool): Retrieve the service details across the cluster in
                swarm mode.
            scope (str): Filter the network by scope (``swarm``, ``global``
                or ``local``).

        Returns:
            (:py:class:`Network`) The network.

        Raises:
            :py:class:`docker.errors.NotFound`
                If the network does not exist.

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

        )Úprepare_modelr   r   Úinspect_network)r   Ú
network_idr!   r"   s       r   r   zNetworkCollection.getŸ   s9   € ð, ×!Ñ!Ø+ˆD�K‰K�O‰O×+Ñ+¨JÐH¸ÒHÀÑHó
ð 	
r   c                 óB  — |j                  dd«      } | j                  j                  j                  |i |¤Ž}|D �cg c]  }| j	                  |«      ‘Œ }}|rAt        | j                  j                  j                  d«      r|D ]  }|j                  «        Œ |S c c}w )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` (str|list): format either ``"key"``, ``"key=value"``
                    or a list of such.
                - ``type=["custom"|"builtin"]`` Filters networks by type.
            greedy (bool): Fetch more details for each network individually.
                You might want this to get the containers attached to them.

        Returns:
            (list of :py:class:`Network`) The networks on the server.

        Raises:
            :py:class:`docker.errors.APIError`
                If the server returns an error.
        ÚgreedyFz1.28)Úpopr   r   Únetworksr8   r   Ú_versionÚreload)r   r!   r"   r<   r5   Úitemr>   Únets           r   ÚlistzNetworkCollection.list¹   s�   € ð. —‘˜H eÓ,ˆØ'ˆt�{‰{�‰×'Ñ'¨Ð8°Ñ8ˆØ9=Ö>°�D×&Ñ& tÕ,Ð>ˆÐ>Ù”k $§+¡+§/¡/×":Ñ":¸FÔCØò �Ø—
‘
•ðàˆùò	 ?s   ½BNc                 óN   — | j                   j                  j                  |¬«      S )N)Úfilters)r   r   Úprune_networks)r   rE   s     r   ÚprunezNetworkCollection.pruneØ   s   € Ø�{‰{�‰×-Ñ-°gÐ-Ó>Ð>r   )N)r*   r+   r,   r-   r
   Úmodelr6   r   rC   rG   r   rF   r/   r   r   r1   r1   ^   s6   „ ñð €Eò9$òv
ò4ó>?à×,Ñ,×4Ñ4€E…Mr   r1   N)r   r   Úutilsr   r   r   Úresourcer   r   r
   r1   r/   r   r   ú<module>rK      s.   ðÝ Ý Ý !ß 'ôT7ˆeô T7ôn|5˜
õ |5r   