o
    2.a                     @   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 d| j dS )N<z: 'z'>)	__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di |}| |S )Nr   )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di |} 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>Nr   )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   Zresourcer   r   r   r   r   r   r   r   <module>   s    