U
    ™K7\û  ã                   @   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é   )ÚModelÚ
Collectionc                   @   s0   e Zd ZdZdZdd„ Zedd„ ƒZdd„ Zd	S )
ÚConfigz	A config.ZIDc                 C   s   d| j j| jf S )Nz
<%s: '%s'>)Ú	__class__Ú__name__Úname©Úself© r   ú7/usr/lib/python3/dist-packages/docker/models/configs.pyÚ__repr__	   s    zConfig.__repr__c                 C   s   | j d d S )NZSpecÚName)Zattrsr
   r   r   r   r	      s    zConfig.namec                 C   s   | j j | j¡S )z‘
        Remove this config.

        Raises:
            :py:class:`docker.errors.APIError`
                If config failed to remove.
        )ÚclientÚapiZremove_configÚidr
   r   r   r   Úremove   s    zConfig.removeN)	r   Ú
__module__Ú__qualname__Ú__doc__Zid_attributer   Úpropertyr	   r   r   r   r   r   r      s   
r   c                   @   s6   e Zd ZdZeZdd„ Zejje_dd„ Z	dd„ Z
dS )	ÚConfigCollectionzConfigs on the Docker server.c                 K   s   | j jjf |Ž}|  |¡S )N)r   r   Úcreate_configÚprepare_model)r   ÚkwargsÚobjr   r   r   Úcreate   s    zConfigCollection.createc                 C   s   |   | jj |¡¡S )ac  
        Get a config.

        Args:
            config_id (str): Config ID.

        Returns:
            (:py:class:`Config`): The config.

        Raises:
            :py:class:`docker.errors.NotFound`
                If the config does not exist.
            :py:class:`docker.errors.APIError`
                If the server returns an error.
        )r   r   r   Zinspect_config)r   Z	config_idr   r   r   Úget$   s    zConfigCollection.getc                    s"   ˆ j jjf |Ž}‡ fdd„|D ƒS )aT  
        List configs. Similar to the ``docker config ls`` command.

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

        Returns:
            (list of :py:class:`Config`): The configs.

        Raises:
            :py:class:`docker.errors.APIError`
                If the server returns an error.
        c                    s   g | ]}ˆ   |¡‘qS r   )r   )Ú.0r   r
   r   r   Ú
<listcomp>E   s     z)ConfigCollection.list.<locals>.<listcomp>)r   r   Zconfigs)r   r   Zrespr   r
   r   Úlist6   s    zConfigCollection.listN)r   r   r   r   r   Zmodelr   r   r   r   r!   r   r   r   r   r      s   
r   N)r   r   Úresourcer   r   r   r   r   r   r   r   Ú<module>   s   