HEX
Server: Apache/2.4.52 (Ubuntu)
System: Linux spn-python 5.15.0-89-generic #99-Ubuntu SMP Mon Oct 30 20:42:41 UTC 2023 x86_64
User: arjun (1000)
PHP: 8.1.2-1ubuntu2.20
Disabled: NONE
Upload Files
File: //lib/python3/dist-packages/docker/api/__pycache__/secret.cpython-310.pyc
o

�2.aC�@s2ddlZddlmZddlmZGdd�d�ZdS)�N�)�errors)�utilsc@sleZdZe�d�ddd��Ze�d�e�d�dd���Ze�d�e�d�dd	���Ze�d�d
d
d��Z	dS)�SecretApiMixinz1.25NcCs|t|t�s
|�d�}t�|�}|�d�}|||d�}|dur.t�|jd�r*t	�
d��||d<|�d�}|�|j
||d	�d
�S)a�
            Create a secret

            Args:
                name (string): Name of the secret
                data (bytes): Secret data to be stored
                labels (dict): A mapping of labels to assign to the secret
                driver (DriverConfig): A custom driver configuration. If
                    unspecified, the default ``internal`` driver will be used

            Returns (dict): ID of the newly created secret
        zutf-8�ascii)�Data�Name�LabelsNz1.31z6Secret driver is only available for API version > 1.31�Driverz/secrets/create)�dataT)�
isinstance�bytes�encode�base64�	b64encode�decoder�
version_lt�_versionr�InvalidVersion�_url�_result�
_post_json)�self�namer�labels�driver�body�url�r�3/usr/lib/python3/dist-packages/docker/api/secret.py�
create_secrets$



��
�zSecretApiMixin.create_secret�idcCs|�d|�}|�|�|�d�S)a2
            Retrieve secret metadata

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

            Returns (dict): A dictionary of metadata

            Raises:
                :py:class:`docker.errors.NotFound`
                    if no secret with that ID exists
        �/secrets/{0}T)rr�_get)rr!rrrr�inspect_secret.szSecretApiMixin.inspect_secretcCs$|�d|�}|�|�}|�|�dS)a%
            Remove a secret

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

            Returns (boolean): True if successful

            Raises:
                :py:class:`docker.errors.NotFound`
                    if no secret with that ID exists
        r"T)r�_delete�_raise_for_status)rr!r�resrrr�
remove_secret@s

zSecretApiMixin.remove_secretcCs6|�d�}i}|rt�|�|d<|�|j||d�d�S)z�
            List secrets

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

            Returns (list): A list of secrets
        z/secrets�filters)�paramsT)rr�convert_filtersrr#)rr)rr*rrr�secretsTs

zSecretApiMixin.secrets)NN)N)
�__name__�
__module__�__qualname__r�minimum_versionr �check_resourcer$r(r,rrrrrs%r)r�rrrrrrr�<module>s