File: //proc/1233/root/usr/lib/python3/dist-packages/docker/models/__pycache__/nodes.cpython-310.pyc
o
�h�_p � @ s4 d dl mZmZ G dd� de�ZG dd� de�ZdS )� )�Model�
Collectionc @ s2 e Zd ZdZdZedd� �Zdd� Zddd �Zd
S )�NodezA node in a swarm.�IDc C s | 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�version s zNode.versionc C s | j j�| 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
�update s zNode.updateFc C s | j jj| 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)r r �remove_noder )r r r r r
�remove, s zNode.removeN)F) �__name__�
__module__�__qualname__�__doc__�id_attribute�propertyr r r r r r r
r s
r c @ s$ e Zd ZdZeZdd� Zdd� ZdS )�NodeCollectionzNodes on the Docker server.c C s | � | 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_modelr r �inspect_node)r �node_idr r r
r D s zNodeCollection.getc s"