
    a                      >    S SK Jr  S SKJr  SSKJr   " S S\5      rg)    )	APIClient)APIError   )Modelc                   T  ^  \ rS rSrSrSrU 4S jr\S 5       rS r	\
R                  R                  \	l           SS jrS r\
R                  R                  \l        S	 r\
R                  R                  \l        S
 rS r\
R$                  R                  \l          SS jrSrU =r$ )Swarm   zi
The server's Swarm state. This a singleton that must be reloaded to get
the current state of the Swarm.
IDc                    > [         TU ]  " U0 UD6  U R                  (       a   U R                  5         g g ! [         a%  nUR
                  R                  S;  a  e  S nAg S nAff = f)N)i  i  )super__init__clientreloadr   responsestatus_code)selfargskwargse	__class__s       &lib/third_party/docker/models/swarm.pyr   Swarm.__init__   s[    $)&);;   ::)); <s   6 
A% A  A%c                 V    U R                   R                  S5      R                  S5      $ )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   versionSwarm.version   s"     zz~~i(,,W55    c                 J    U R                   R                  R                  5       $ N)r   apiget_unlock_keyr   s    r   r%   Swarm.get_unlock_key    s    {{--//r!   c                     UUUUUUUS.n	U R                   R                  R                  " S0 UD6U	S'   U R                   R                  R                  " S0 U	D6n
U R	                  5         U
$ )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   init
Swarm.init$   sl    l -&!2!2&,,
 %)KKOO$E$E$O$OL!++//,,;{;r!   c                 N    U R                   R                  R                  " U0 UD6$ r#   )r   r$   
join_swarmr   r   r   s      r   join
Swarm.join   s     {{))4:6::r!   c                 N    U R                   R                  R                  " U0 UD6$ r#   )r   r$   leave_swarmr9   s      r   leaveSwarm.leave   s     {{**D;F;;r!   c                 V    U R                   R                  R                  5       U l        g)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   Swarm.reload   s     [[__224
r!   c                 L    U R                   R                  R                  U5      $ r#   )r   r$   unlock_swarm)r   keys     r   unlockSwarm.unlock   s    {{++C00r!   c                     UR                  S5      c  SUS'   U R                  R                  R                  U R                  U R                  R                  R
                  " S0 UD6UUUS9$ )a8  
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_keyr0   )r   r   r$   update_swarmr   r1   )r   rJ   rK   rL   r   s        r   updateSwarm.update   sh    , ::()1)9F%&{{++LL{{88B6B 3!5&? , 
 	
r!   )r   )Nz0.0.0.0:2377FNNNN)FFF)__name__
__module____qualname____firstlineno____doc__id_attributer   propertyr   r%   r   r5   r:   r8   r>   r=   r   rF   rD   rN   __static_attributes____classcell__)r   s   @r   r   r      s     L 6 60&55==N4B8<CGaF;''//DL<))11EM	51++33FNEJ).
 
r!   r   N)
docker.apir   docker.errorsr   resourcer   r   r0   r!   r   <module>r\      s      " w
E w
r!   