
    h_                      L    d dl mZ ddlmZmZ  G d de      Z G d de      Zy)	   )	APIClient   )Model
Collectionc                   ,    e Zd ZdZdZed        ZddZy)Volumez	A volume.Namec                      | j                   d   S )zThe name of the volume.r	   )attrs)selfs    7/usr/lib/python3/dist-packages/docker/models/volumes.pynamezVolume.name	   s     zz&!!    c                 d    | j                   j                  j                  | j                  |      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   r   s     r   removezVolume.remove   s&     {{,,TWWE,BBr   N)F)__name__
__module____qualname____doc__id_attributepropertyr   r    r   r   r   r      s"    L" "Cr   r   c                   f    e Zd ZdZeZddZd Zd ZddZ	e
j                  j                  e	_        y)VolumeCollectionzVolumes on the Docker server.Nc                 r     | j                   j                  j                  |fi |}| j                  |      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"})

        )r   r   create_volumeprepare_model)r   r   kwargsobjs       r   createzVolumeCollection.create    s4    2 ,dkkoo++D;F;!!#&&r   c                 j    | j                  | j                  j                  j                  |            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.
        )r"   r   r   inspect_volume)r   	volume_ids     r   getzVolumeCollection.get<   s(      !!$++//"@"@"KLLr   c                      | j                   j                  j                  di |}|j                  d      sg S |d   D cg c]  }| j	                  |       c}S c c}w )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.
        Volumesr   )r   r   volumesr)   r"   )r   r#   respr$   s       r   listzVolumeCollection.listN   sU     't{{&&00xx	"I37	?CC""3'CCCs   Ac                 N    | j                   j                  j                  |      S )N)filters)r   r   prune_volumes)r   r0   s     r   prunezVolumeCollection.prunea   s    {{,,W,==r   )N)r   r   r   r   r   modelr%   r)   r.   r2   r   r1   r   r   r   r   r      s3    'E'8M$D&>++33EMr   r   N)r   r   resourcer   r   r   r   r   r   r   <module>r5      s'     'CU C.G4z G4r   