Ë
    9àib   ã                   ó>   — d dl mZ d dlmZ ddlmZ  G d„ de«      Zy)é    )Ú	APIClient)ÚAPIErroré   )ÚModelc                   óF  ‡ — e Zd ZdZdZˆ fd„Zed„ «       Zd„ Ze	j                  j                  e_        	 	 	 dd„Z
d„ Ze	j                  j                  e_        d„ Ze	j                  j                  e_        d	„ Zd
„ Ze	j"                  j                  e_        	 	 dd„Zˆ xZS )ÚSwarmzu
    The server's Swarm state. This a singleton that must be reloaded to get
    the current state of the Swarm.
    ÚIDc                 ó¾   •— t        ‰| �  |i |¤Ž | j                  r	 | j                  «        y y # t        $ r#}|j
                  j                  dvr‚ Y d }~y d }~ww xY w)N)i–  i÷  )ÚsuperÚ__init__ÚclientÚreloadr   ÚresponseÚstatus_code)ÚselfÚargsÚkwargsÚeÚ	__class__s       €úT/home/factor_ks/STREAMA2026/venv/lib/python3.12/site-packages/docker/models/swarm.pyr   zSwarm.__init__   s[   ø€ Ü‰Ñ˜$Ð) &Ò)Ø�;Š;ðØ—‘•ð øô ò à—:‘:×)Ñ)°Ñ;Øô <ûðús   ž0 °	A¹AÁAc                 óV   — | j                   j                  d«      j                  d«      S )zÛ
        The version number of the swarm. If this is not the same as the
        server, the :py:meth:`update` function will not work and you will
        need to call :py:meth:`reload` before calling it again.
        ÚVersionÚIndex)ÚattrsÚget©r   s    r   ÚversionzSwarm.version   s"   € ð �z‰z�~‰~˜iÓ(×,Ñ,¨WÓ5Ð5ó    c                 óJ   — | j                   j                  j                  «       S ©N)r   ÚapiÚget_unlock_keyr   s    r   r"   zSwarm.get_unlock_key!   s   € Ø�{‰{�‰×-Ñ-Ó/Ð/r   c                 óØ   — |||||||dœ}	 | j                   j                  j                  di |¤Ž|	d<    | j                   j                  j                  di |	¤Ž}
| j	                  «        |
S )a  
        Initialize a new swarm on this Engine.

        Args:
            advertise_addr (str): Externally reachable address advertised to
                other nodes. This can either be an address/port combination in
                the form ``192.168.1.1:4567``, or an interface followed by a
                port number, like ``eth0:4567``. If the port number is omitted,
                the port number from the listen address is used.

                If not specified, it will be automatically detected when
                possible.
            listen_addr (str): Listen address used for inter-manager
                communication, as well as determining the networking interface
                used for the VXLAN Tunnel Endpoint (VTEP). This can either be
                an address/port combination in the form ``192.168.1.1:4567``,
                or an interface followed by a port number, like ``eth0:4567``.
                If the port number is omitted, the default swarm listening port
                is used. Default: ``0.0.0.0:2377``
            force_new_cluster (bool): Force creating a new Swarm, even if
                already part of one. Default: False
            default_addr_pool (list of str): Default Address Pool specifies
                default subnet pools for global scope networks. Each pool
                should be specified as a CIDR block, like '10.0.0.0/8'.
                Default: None
            subnet_size (int): SubnetSize specifies the subnet size of the
                networks created from the default subnet pool. Default: None
            data_path_addr (string): Address or interface to use for data path
                traffic. For example, 192.168.1.1, or an interface, like eth0.
            data_path_port (int): Port number to use for data path traffic.
                Acceptable port range is 1024 to 49151. If set to ``None`` or
                0, the default port 4789 will be used. Default: None
            task_history_retention_limit (int): Maximum number of tasks
                history stored.
            snapshot_interval (int): Number of logs entries between snapshot.
            keep_old_snapshots (int): Number of snapshots to keep beyond the
                current snapshot.
            log_entries_for_slow_followers (int): Number of log entries to
                keep around to sync up slow followers after a snapshot is
                created.
            heartbeat_tick (int): Amount of ticks (in seconds) between each
                heartbeat.
            election_tick (int): Amount of ticks (in seconds) needed without a
                leader to trigger a new election.
            dispatcher_heartbeat_period (int):  The delay for an agent to send
                a heartbeat to the dispatcher.
            node_cert_expiry (int): Automatic expiry for nodes certificates.
            external_ca (dict): Configuration for forwarding signing requests
                to an external certificate authority. Use
                ``docker.types.SwarmExternalCA``.
            name (string): Swarm's name
            labels (dict): User-defined key/value metadata.
            signing_ca_cert (str): The desired signing CA certificate for all
                swarm node TLS leaf certificates, in PEM format.
            signing_ca_key (str): The desired signing CA key for all swarm
                node TLS leaf certificates, in PEM format.
            ca_force_rotate (int): An integer whose purpose is to force swarm
                to generate a new signing CA certificate and key, if none have
                been specified.
            autolock_managers (boolean): If set, generate a key and use it to
                lock data stored on the managers.
            log_driver (DriverConfig): The default log driver to use for tasks
                created in the orchestrator.

        Returns:
            (str): The ID of the created node.

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

        Example:

            >>> client.swarm.init(
                advertise_addr='eth0', listen_addr='0.0.0.0:5000',
                force_new_cluster=False, default_addr_pool=['10.20.0.0/16],
                subnet_size=24, snapshot_interval=5000,
                log_entries_for_slow_followers=1200
            )

        )Úadvertise_addrÚlisten_addrÚforce_new_clusterÚdefault_addr_poolÚsubnet_sizeÚdata_path_addrÚdata_path_portÚ
swarm_spec© )r   r!   Úcreate_swarm_specÚ
init_swarmr   )r   r$   r%   r&   r'   r(   r)   r*   r   Úinit_kwargsÚnode_ids              r   Úinitz
Swarm.init%   sq   € ðl -Ø&Ø!2Ø!2Ø&Ø,Ø,ñ
ˆð %F D§K¡K§O¡O×$EÑ$EÑ$OÈÑ$Oˆ�LÑ!Ø,�$—+‘+—/‘/×,Ñ,Ñ;¨{Ñ;ˆØ�‰ŒØˆr   c                 óN   —  | j                   j                  j                  |i |¤ŽS r    )r   r!   Ú
join_swarm©r   r   r   s      r   Újoinz
Swarm.joinˆ   s"   € Ø)ˆt�{‰{�‰×)Ñ)¨4Ð:°6Ñ:Ð:r   c                 óN   —  | j                   j                  j                  |i |¤ŽS r    )r   r!   Úleave_swarmr4   s      r   ÚleavezSwarm.leaveŒ   s"   € Ø*ˆt�{‰{�‰×*Ñ*¨DÐ;°FÑ;Ð;r   c                 óV   — | j                   j                  j                  «       | _        y)zÕ
        Inspect the swarm on the server and store the response in
        :py:attr:`attrs`.

        Raises:
            :py:class:`docker.errors.APIError`
                If the server returns an error.
        N)r   r!   Úinspect_swarmr   r   s    r   r   zSwarm.reload�   s   € ð —[‘[—_‘_×2Ñ2Ó4ˆ�
r   c                 óL   — | j                   j                  j                  |«      S r    )r   r!   Úunlock_swarm)r   Úkeys     r   ÚunlockzSwarm.unlock›   s   € Ø�{‰{�‰×+Ñ+¨CÓ0Ð0r   c                 óÞ   — |j                  d«      €d|d<   | j                  j                  j                  | j                   | j                  j                  j
                  di |¤Ž|||¬«      S )a°  
        Update the swarm's configuration.

        It takes the same arguments as :py:meth:`init`, except
        ``advertise_addr``, ``listen_addr``, and ``force_new_cluster``. In
        addition, it takes these arguments:

        Args:
            rotate_worker_token (bool): Rotate the worker join token. Default:
                ``False``.
            rotate_manager_token (bool): Rotate the manager join token.
                Default: ``False``.
            rotate_manager_unlock_key (bool): Rotate the manager unlock key.
                Default: ``False``.
        Raises:
            :py:class:`docker.errors.APIError`
                If the server returns an error.

        Únode_cert_expiryl     Œ+ì Ý )r   r+   Úrotate_worker_tokenÚrotate_manager_tokenÚrotate_manager_unlock_keyr,   )r   r   r!   Úupdate_swarmr   r-   )r   rA   rB   rC   r   s        r   ÚupdatezSwarm.updateŸ   sj   € ð, �:‰:Ð(Ó)Ð1Ø)9ˆFÐ%Ñ&à�{‰{�‰×+Ñ+Ø—L‘LØ8�t—{‘{—‘×8Ñ8ÑB¸6ÑBØ 3Ø!5Ø&?ð ,ó 
ð 	
r   )Nz0.0.0.0:2377FNNNN)FFF)Ú__name__Ú
__module__Ú__qualname__Ú__doc__Úid_attributer   Úpropertyr   r"   r   r1   r5   r3   r8   r7   r   r>   r<   rE   Ú__classcell__)r   s   @r   r   r      s©   ø„ ñð €Lôð ñ6ó ð6ò0à&×5Ñ5×=Ñ=€NÔà4BØ8<ØCGóaòF;à×'Ñ'×/Ñ/€D„Lò<à×)Ñ)×1Ñ1€E„Mò	5ò1à×+Ñ+×3Ñ3€F„NàEJØ).÷
r   r   N)Ú
docker.apir   Údocker.errorsr   Úresourcer   r   r,   r   r   ú<module>rP      s   ðÝ  Ý "å ôw
ˆEõ w
r   