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/api/__pycache__/volume.cpython-310.pyc
o

q_a��@s*ddlmZddlmZGdd�d�ZdS)�)�errors)�utilsc@sJeZdZddd�Z		ddd�Zdd�Ze�d�dd	d
��Zddd
�Z	dS)�VolumeApiMixinNcCs6d|rt�|�ndi}|�d�}|�|j||d�d�S)a
        List volumes currently registered by the docker daemon. Similar to the
        ``docker volume ls`` command.

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

        Returns:
            (dict): Dictionary with list of volume objects as value of the
            ``Volumes`` key.

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

        Example:

            >>> client.api.volumes()
            {u'Volumes': [{u'Driver': u'local',
               u'Mountpoint': u'/var/lib/docker/volumes/foobar/_data',
               u'Name': u'foobar'},
              {u'Driver': u'local',
               u'Mountpoint': u'/var/lib/docker/volumes/baz/_data',
               u'Name': u'baz'}]}
        �filtersNz/volumes��paramsT)r�convert_filters�_url�_result�_get��selfrr�url�r�3/usr/lib/python3/dist-packages/docker/api/volume.py�volumess�
zVolumeApiMixin.volumescCs�|�d�}|durt|t�std��|||d�}|dur7t�d|j�dkr*t�d��t|t�s3td��||d	<|�	|j
||d
�d�S)a�
        Create and register a named volume

        Args:
            name (str): Name of the volume
            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:
            (dict): The created volume reference object

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

        Example:

            >>> volume = client.api.create_volume(name='foobar', driver='local',
                    driver_opts={'foo': 'bar', 'baz': 'false'},
                    labels={"key": "value"})
            >>> print(volume)
            {u'Driver': u'local',
             u'Labels': {u'key': u'value'},
             u'Mountpoint': u'/var/lib/docker/volumes/foobar/_data',
             u'Name': u'foobar',
             u'Scope': u'local'}

        z/volumes/createNz driver_opts must be a dictionary)�Name�Driver�
DriverOptsz1.23�z)volume labels were introduced in API 1.23zlabels must be a dictionary�Labels)�dataT)r	�
isinstance�dict�	TypeErrorr�compare_version�_versionr�InvalidVersionr
�
_post_json)r
�name�driver�driver_opts�labelsrrrrr�
create_volume's 
��
zVolumeApiMixin.create_volumecCs|�d|�}|�|�|�d�S)a�
        Retrieve volume info by name.

        Args:
            name (str): volume name

        Returns:
            (dict): Volume information dictionary

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

        Example:

            >>> client.api.inspect_volume('foobar')
            {u'Driver': u'local',
             u'Mountpoint': u'/var/lib/docker/volumes/foobar/_data',
             u'Name': u'foobar'}

        �/volumes/{0}T)r	r
r)r
rrrrr�inspect_volume[szVolumeApiMixin.inspect_volume�1.25cCs6i}|rt�|�|d<|�d�}|�|j||d�d�S)a�
        Delete unused volumes

        Args:
            filters (dict): Filters to process on the prune list.

        Returns:
            (dict): A dict containing a list of deleted volume names and
                the amount of disk space reclaimed in bytes.

        Raises:
            :py:class:`docker.errors.APIError`
                If the server returns an error.
        rz/volumes/prunerT)rrr	r
�_postrrrr�
prune_volumests

zVolumeApiMixin.prune_volumesFcCsPi}|rt�|jd�rt�d��d|i}|jd||d�}|�|�}|�|�dS)az
        Remove a volume. Similar to the ``docker volume rm`` command.

        Args:
            name (str): The volume's name
            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.
        r&z(force removal was introduced in API 1.25�forcer$rN)r�
version_ltrrrr	�_delete�_raise_for_status)r
rr)rr�resprrr�
remove_volume�s
�
zVolumeApiMixin.remove_volume)N)NNNN)F)
�__name__�
__module__�__qualname__rr#r%r�minimum_versionr(r.rrrrrs
!
�4rN)�rrrrrrr�<module>s