File: //lib/python3/dist-packages/docker/models/__pycache__/volumes.cpython-310.pyc
o
�h�_ � @ s@ d dl mZ ddlmZmZ G dd� de�ZG dd� de�ZdS ) � )� APIClient� )�Model�
Collectionc @ s* e Zd ZdZdZedd� �Zd dd�ZdS )
�Volumez A volume.�Namec C s
| j d S )zThe name of the volume.r )�attrs��self� r �7/usr/lib/python3/dist-packages/docker/models/volumes.py�name s
zVolume.nameFc C s | j jj| 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
r r r r �remove s z
Volume.removeN)F)�__name__�
__module__�__qualname__�__doc__�id_attribute�propertyr
r r r r r r s
r c @ sB e Zd ZdZeZddd�Zdd� Zdd� Zdd d
�Z e
jje _dS )�VolumeCollectionzVolumes on the Docker server.Nc K s | j jj|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"})
)r r �
create_volume�
prepare_model)r
r
�kwargs�objr r r �create s
zVolumeCollection.createc C s | � | 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.
)r r r �inspect_volume)r
� volume_idr r r �get<