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: //lib/python3/dist-packages/docker/models/__pycache__/volumes.cpython-310.pyc
o

�h�_ �@s@ddlmZddlmZmZGdd�de�ZGdd�de�ZdS)	�)�	APIClient�)�Model�
Collectionc@s*eZdZdZdZedd��Zd	dd�ZdS)
�Volumez	A volume.�NamecCs
|jdS)zThe name of the volume.r)�attrs��self�r�7/usr/lib/python3/dist-packages/docker/models/volumes.py�name	s
zVolume.nameFcCs|jjj|j|d�S)a%
        Remove this volume.

        Args:
            force (bool): Force removal of volumes that were already removed
                out of band by the volume driver plugin.
        Raises:
            :py:class:`docker.errors.APIError`
                If volume failed to remove.
        )�force)�client�api�
remove_volume�id)r
rrrr�removesz
Volume.removeN)F)�__name__�
__module__�__qualname__�__doc__�id_attribute�propertyr
rrrrrrs
rc@sBeZdZdZeZddd�Zdd�Zdd�Zdd	d
�Z	e
jje	_dS)�VolumeCollectionzVolumes on the Docker server.NcKs |jjj|fi|��}|�|�S)a�
        Create a volume.

        Args:
            name (str): Name of the volume.  If not specified, the engine
                generates a name.
            driver (str): Name of the driver used to create the volume
            driver_opts (dict): Driver options as a key-value dictionary
            labels (dict): Labels to set on the volume

        Returns:
            (:py:class:`Volume`): The volume created.

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

        Example:

            >>> volume = client.volumes.create(name='foobar', driver='local',
                    driver_opts={'foo': 'bar', 'baz': 'false'},
                    labels={"key": "value"})

        )rr�
create_volume�
prepare_model)r
r
�kwargs�objrrr�create s
zVolumeCollection.createcCs|�|jj�|��S)ae
        Get a volume.

        Args:
            volume_id (str): Volume name.

        Returns:
            (:py:class:`Volume`): The volume.

        Raises:
            :py:class:`docker.errors.NotFound`
                If the volume does not exist.
            :py:class:`docker.errors.APIError`
                If the server returns an error.
        )rrr�inspect_volume)r
�	volume_idrrr�get<szVolumeCollection.getcs8�jjjdi|��}|�d�sgS�fdd�|dD�S)aT
        List volumes. Similar to the ``docker volume ls`` command.

        Args:
            filters (dict): Server-side list filtering options.

        Returns:
            (list of :py:class:`Volume`): The volumes.

        Raises:
            :py:class:`docker.errors.APIError`
                If the server returns an error.
        �Volumescsg|]}��|��qSr)r)�.0rr	rr�
<listcomp>_sz)VolumeCollection.list.<locals>.<listcomp>Nr)rr�volumesr")r
r�resprr	r�listNs
zVolumeCollection.listcCs|jjj|d�S)N)�filters)rr�
prune_volumes)r
r)rrr�pruneaszVolumeCollection.prune)N)rrrrr�modelrr"r(r+rr*rrrrrs

rN)rr�resourcerrrrrrrr�<module>s