HEX
Server: LiteSpeed
System: Linux php-prod-1.spaceapp.ru 5.15.0-157-generic #167-Ubuntu SMP Wed Sep 17 21:35:53 UTC 2025 x86_64
User: xnsbb3110 (1041)
PHP: 8.1.33
Disabled: NONE
Upload Files
File: //usr/local/CyberCP/lib/python3.10/site-packages/docker/api/__pycache__/plugin.cpython-310.pyc
o

�h#�@s"ddlmZmZGdd�d�ZdS)�)�auth�utilsc@seZdZe�d�e�d�dd���Ze�d�ddd��Ze�d�ddd	��Ze�d�ddd��Z	e�d�d
d��Z
e�d�ddd��Ze�d�dd��Ze�d�dd��Z
e�d�e�d�dd���Ze�d�e�d�ddd���Ze�d�e�d�dd���ZdS) �PluginApiMixinz1.25�namecCsH|�d|�}|}t|t�rdd�|��D�}|j||d�}|�|�dS)aC
            Configure a plugin.

            Args:
                name (string): The name of the plugin. The ``:latest`` tag is
                    optional, and is the default if omitted.
                options (dict): A key-value mapping of options

            Returns:
                ``True`` if successful
        z/plugins/{0}/setcSsg|]\}}|�d|���qS)�=�)�.0�k�vrr�D/usr/local/CyberCP/lib/python3.10/site-packages/docker/api/plugin.py�
<listcomp>sz3PluginApiMixin.configure_plugin.<locals>.<listcomp>)�dataT)�_url�
isinstance�dict�items�
_post_json�_raise_for_status)�selfr�options�urlr
�resrrr�configure_plugins

zPluginApiMixin.configure_pluginFcCsj|�d�}tj||ttj�|g��d��}|j|d|i|d�}Wd�n1s)wY|�|�dS)a*
            Create a new plugin.

            Args:
                name (string): The name of the plugin. The ``:latest`` tag is
                    optional, and is the default if omitted.
                plugin_data_dir (string): Path to the plugin data directory.
                    Plugin data directory must contain the ``config.json``
                    manifest file and the ``rootfs`` directory.
                gzip (bool): Compress the context using gzip. Default: False

            Returns:
                ``True`` if successful
        z/plugins/create)�root�gzip�filesr)�paramsr
NT)rr�create_archive�set�build�walk�_postr)rr�plugin_data_dirrr�archvrrrr�
create_plugins
��
zPluginApiMixin.create_plugincC�,|�d|�}|j|d|id�}|�|�dS)aP
            Disable an installed plugin.

            Args:
                name (string): The name of the plugin. The ``:latest`` tag is
                    optional, and is the default if omitted.
                force (bool): To enable the force query parameter.

            Returns:
                ``True`` if successful
        z/plugins/{0}/disable�force�rT�rr!r�rrr&rrrrr�disable_plugin5s

zPluginApiMixin.disable_plugin�cCs0|�d|�}d|i}|j||d�}|�|�dS)aV
            Enable an installed plugin.

            Args:
                name (string): The name of the plugin. The ``:latest`` tag is
                    optional, and is the default if omitted.
                timeout (int): Operation timeout (in seconds). Default: 0

            Returns:
                ``True`` if successful
        z/plugins/{0}/enable�timeoutr'Tr()rrr,rrrrrr�
enable_pluginGs


zPluginApiMixin.enable_plugincCs|�d|�}|�|�|�d�S)a
            Retrieve plugin metadata.

            Args:
                name (string): The name of the plugin. The ``:latest`` tag is
                    optional, and is the default if omitted.

            Returns:
                A dict containing plugin info
        z/plugins/{0}/jsonT�r�_result�_get)rrrrrr�inspect_pluginZszPluginApiMixin.inspect_pluginNcCst|�d�}d|i}|r||d<i}t�|�\}}t�||�}	|	r$|	|d<|j||||dd�}
|�|
�|j|
dd�S)a
            Pull and install a plugin. After the plugin is installed, it can be
            enabled using :py:meth:`~enable_plugin`.

            Args:
                remote (string): Remote reference for the plugin to install.
                    The ``:latest`` tag is optional, and is the default if
                    omitted.
                privileges (:py:class:`list`): A list of privileges the user
                    consents to grant to the plugin. Can be retrieved using
                    :py:meth:`~plugin_privileges`.
                name (string): Local name for the pulled plugin. The
                    ``:latest`` tag is optional, and is the default if omitted.

            Returns:
                An iterable object streaming the decoded API logs
        z
/plugins/pull�remoter�X-Registry-AuthT�r�headersr
�stream��decode�rr�resolve_repository_name�get_config_headerrr�_stream_helper)rr2�
privilegesrrrr5�registry�	repo_name�header�responserrr�pull_pluginis 
��
zPluginApiMixin.pull_plugincCs|�d�}|�|�|�d�S)z�
            Retrieve a list of installed plugins.

            Returns:
                A list of dicts, one per plugin
        z/pluginsTr.)rrrrr�plugins�s
zPluginApiMixin.pluginscCsTd|i}i}t�|�\}}t�||�}|r||d<|�d�}|�|j|||d�d�S)al
            Retrieve list of privileges to be granted to a plugin.

            Args:
                name (string): Name of the remote plugin to examine. The
                    ``:latest`` tag is optional, and is the default if omitted.

            Returns:
                A list of dictionaries representing the plugin's
                permissions

        r2r3z/plugins/privileges)rr5T)rr:r;rr/r0)rrrr5r>r?r@rrrr�plugin_privileges�s�
�z PluginApiMixin.plugin_privilegescCs\|�d|�}i}t�|�\}}t�||�}|r||d<|j||d�}|�|�|j|dd�S)a
            Push a plugin to the registry.

            Args:
                name (string): Name of the plugin to upload. The ``:latest``
                    tag is optional, and is the default if omitted.

            Returns:
                ``True`` if successful
        z/plugins/{0}/pullr3)r5Tr7)rrr:r;r!rr<)rrrr5r>r?r@rrrr�push_plugin�s

zPluginApiMixin.push_plugincCr%)a�
            Remove an installed plugin.

            Args:
                name (string): Name of the plugin to remove. The ``:latest``
                    tag is optional, and is the default if omitted.
                force (bool): Disable the plugin before removing. This may
                    result in issues if the plugin is in use by a container.

            Returns:
                ``True`` if successful
        z/plugins/{0}r&r'T)r�_deleterr)rrr�
remove_plugin�s
zPluginApiMixin.remove_pluginz1.26cCsj|�d|�}d|i}i}t�|�\}}t�||�}	|	r|	|d<|j||||dd�}
|�|
�|j|
dd�S)a�
            Upgrade an installed plugin.

            Args:
                name (string): Name of the plugin to upgrade. The ``:latest``
                    tag is optional and is the default if omitted.
                remote (string): Remote reference to upgrade to. The
                    ``:latest`` tag is optional and is the default if omitted.
                privileges (:py:class:`list`): A list of privileges the user
                    consents to grant to the plugin. Can be retrieved using
                    :py:meth:`~plugin_privileges`.

            Returns:
                An iterable object streaming the decoded API logs
        z/plugins/{0}/upgrader2r3Tr4r7r9)rrr2r=rrr5r>r?r@rArrr�upgrade_plugin�s��
zPluginApiMixin.upgrade_plugin)F)r+)N)�__name__�
__module__�__qualname__r�minimum_version�check_resourcerr$r*r-r1rBrCrDrErGrHrrrrrs6
%


rN)�rrrrrrr�<module>s