HEX
Server: Apache/2.4.52 (Ubuntu)
System: Linux spn-python 5.15.0-89-generic #99-Ubuntu SMP Mon Oct 30 20:42:41 UTC 2023 x86_64
User: arjun (1000)
PHP: 8.1.2-1ubuntu2.20
Disabled: NONE
Upload Files
File: //usr/lib/python3/dist-packages/docker/models/__pycache__/nodes.cpython-310.pyc
o

�h�_p�@s4ddlmZmZGdd�de�ZGdd�de�ZdS)�)�Model�
Collectionc@s2eZdZdZdZedd��Zdd�Zddd	�Zd
S)�NodezA node in a swarm.�IDcCs|j�d��d�S)z�
        The version number of the service. 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��self�r�5/usr/lib/python3/dist-packages/docker/models/nodes.py�versionszNode.versioncCs|jj�|j|j|�S)a�
        Update the node's configuration.

        Args:
            node_spec (dict): Configuration settings to update. Any values
                not provided will be removed. Default: ``None``

        Returns:
            `True` if the request went through.

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

        Example:

            >>> node_spec = {'Availability': 'active',
                             'Name': 'node-name',
                             'Role': 'manager',
                             'Labels': {'foo': 'bar'}
                            }
            >>> node.update(node_spec)

        )�client�api�update_node�idr)r�	node_specrrr
�updateszNode.updateFcCs|jjj|j|d�S)a�
        Remove this node from the swarm.

        Args:
            force (bool): Force remove an active node. Default: `False`

        Returns:
            `True` if the request was successful.

        Raises:
            :py:class:`docker.errors.NotFound`
                If the node doesn't exist in the swarm.

            :py:class:`docker.errors.APIError`
                If the server returns an error.
        )�force)rr�remove_noder)rrrrr
�remove,szNode.removeN)F)	�__name__�
__module__�__qualname__�__doc__�id_attribute�propertyrrrrrrr
rs
rc@s$eZdZdZeZdd�Zdd�ZdS)�NodeCollectionzNodes on the Docker server.cCs|�|jj�|��S)a
        Get a node.

        Args:
            node_id (string): ID of the node to be inspected.

        Returns:
            A :py:class:`Node` object.

        Raises:
            :py:class:`docker.errors.APIError`
                If the server returns an error.
        )�
prepare_modelrr�inspect_node)r�node_idrrr
r	DszNodeCollection.getcs"�fdd��jjj|i|��D�S)a�
        List swarm nodes.

        Args:
            filters (dict): Filters to process on the nodes list. Valid
                filters: ``id``, ``name``, ``membership`` and ``role``.
                Default: ``None``

        Returns:
            A list of :py:class:`Node` objects.

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

        Example:

            >>> client.nodes.list(filters={'role': 'manager'})
        csg|]}��|��qSr)r)�.0�nr
rr
�
<listcomp>hs��z'NodeCollection.list.<locals>.<listcomp>)rr�nodes)r�args�kwargsrr
r
�listTs
�zNodeCollection.listN)rrrrr�modelr	r(rrrr
r@s
rN)�resourcerrrrrrrr
�<module>s<