o
    Nrf
                     @   s&   d dl Z ddlmZ G dd dZdS )    N   )utilsc                   @   sl   e Zd ZeddddZededdd Zededdd	 Zeddd
dZ	dS )ConfigApiMixinz1.30Nc                 C   sV   t |ts
|d}t|}|d}||||d}| d}| | j||ddS )a  
            Create a config

            Args:
                name (string): Name of the config
                data (bytes): Config data to be stored
                labels (dict): A mapping of labels to assign to the config
                templating (dict): dictionary containing the name of the
                                   templating driver to be used expressed as
                                   { name: <templating_driver_name>}

            Returns (dict): ID of the newly created config
        zutf-8ascii)ZDataNameZLabelsZ
Templatingz/configs/create)dataT)	
isinstancebytesencodebase64	b64encodedecode_url_resultZ
_post_json)selfnamer   labelsZ
templatingbodyurl r   Z/var/www/html/software/conda/envs/catlas/lib/python3.10/site-packages/docker/api/config.pycreate_config   s   




zConfigApiMixin.create_configidc                 C   s   |  d|}| | |dS )a2  
            Retrieve config metadata

            Args:
                id (string): Full ID of the config to inspect

            Returns (dict): A dictionary of metadata

            Raises:
                :py:class:`docker.errors.NotFound`
                    if no config with that ID exists
        /configs/{0}T)r   r   _get)r   r   r   r   r   r   inspect_config'   s   zConfigApiMixin.inspect_configc                 C   s$   |  d|}| |}| | dS )a%  
            Remove a config

            Args:
                id (string): Full ID of the config to remove

            Returns (boolean): True if successful

            Raises:
                :py:class:`docker.errors.NotFound`
                    if no config with that ID exists
        r   T)r   _deleteZ_raise_for_status)r   r   r   resr   r   r   remove_config9   s   

zConfigApiMixin.remove_configc                 C   s6   |  d}i }|rt||d< | | j||ddS )z
            List configs

            Args:
                filters (dict): A map of filters to process on the configs
                list. Available filters: ``names``

            Returns (list): A list of configs
        z/configsfilters)paramsT)r   r   Zconvert_filtersr   r   )r   r   r   r    r   r   r   configsM   s
   
zConfigApiMixin.configs)NN)N)
__name__
__module____qualname__r   minimum_versionr   Zcheck_resourcer   r   r!   r   r   r   r   r      s    r   )r    r   r   r   r   r   r   <module>   s    