o
    Nrf                      @   s@   d dl mZ ddlmZmZ G dd deZG dd deZdS )	   )	APIClient   )
CollectionModelc                   @   s*   e Zd ZdZdZedd Zd	ddZdS )
Volumez	A volume.Namec                 C   s
   | j d S )zThe name of the volume.r   )attrsself r   ^/var/www/html/software/conda/envs/catlas/lib/python3.10/site-packages/docker/models/volumes.pyname	   s   
zVolume.nameFc                 C   s   | j jj| 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apiZremove_volumeid)r
   r   r   r   r   remove   s   zVolume.removeN)F)__name__
__module____qualname____doc__Zid_attributepropertyr   r   r   r   r   r   r      s    
r   c                   @   sB   e Zd ZdZeZdddZdd Zdd Zdd	d
Z	e
jje	_dS )VolumeCollectionzVolumes on the Docker server.Nc                 K   s    | j jj|fi |}| |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   Zcreate_volumeprepare_model)r
   r   kwargsobjr   r   r   create    s   
zVolumeCollection.createc                 C   s   |  | 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   Zinspect_volume)r
   Z	volume_idr   r   r   get<   s   zVolumeCollection.getc                    s8    j jjdi |}|dsg S  fdd|d D 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.
        ZVolumesc                    s   g | ]}  |qS r   )r   ).0r   r	   r   r   
<listcomp>_   s    z)VolumeCollection.list.<locals>.<listcomp>Nr   )r   r   Zvolumesr   )r
   r   respr   r	   r   listN   s   
zVolumeCollection.listc                 C   s   | j jj|dS )N)filters)r   r   prune_volumes)r
   r"   r   r   r   prunea   s   zVolumeCollection.prune)N)r   r   r   r   r   modelr   r   r!   r$   r   r#   r   r   r   r   r      s    

r   N)r   r   resourcer   r   r   r   r   r   r   r   <module>   s    