
    2.a                     L    d dl mZ ddlmZmZ  G d de      Z G d de      Zy)	   )errors   )
CollectionModelc                   p    e Zd ZdZd Zed        Zed        Zed        Zd Z	d Z
ddZd	 Zdd
ZddZy)Pluginz!
    A plugin on the server.
    c                 P    d| j                   j                   d| j                   dS )N<z: 'z'>)	__class____name__nameselfs    7/usr/lib/python3/dist-packages/docker/models/plugins.py__repr__zPlugin.__repr__	   s&    4>>**+3tyyk<<    c                 8    | j                   j                  d      S )z$
        The plugin's name.
        Nameattrsgetr   s    r   r   zPlugin.name   s    
 zz~~f%%r   c                 8    | j                   j                  d      S )z0
        Whether the plugin is enabled.
        Enabledr   r   s    r   enabledzPlugin.enabled   s    
 zz~~i((r   c                 8    | j                   j                  d      S )zG
        A dictionary representing the plugin's configuration.
        Settingsr   r   s    r   settingszPlugin.settings   s    
 zz~~j))r   c                     | j                   j                  j                  | j                  |       | j	                          y)a  
            Update the plugin's settings.

            Args:
                options (dict): A key-value mapping of options.

            Raises:
                :py:class:`docker.errors.APIError`
                    If the server returns an error.
        N)clientapiconfigure_pluginr   reload)r   optionss     r   	configurezPlugin.configure!   s)     	((G<r   c                     | j                   j                  j                  | j                         | j	                          y)z
            Disable the plugin.

            Raises:
                :py:class:`docker.errors.APIError`
                    If the server returns an error.
        N)r   r    disable_pluginr   r"   r   s    r   disablezPlugin.disable/   s'     	&&tyy1r   c                     | j                   j                  j                  | j                  |       | j	                          y)z
            Enable the plugin.

            Args:
                timeout (int): Timeout in seconds. Default: 0

            Raises:
                :py:class:`docker.errors.APIError`
                    If the server returns an error.
        N)r   r    enable_pluginr   r"   )r   timeouts     r   enablezPlugin.enable;   s)     	%%dii9r   c                 `    | j                   j                  j                  | j                        S )a  
            Push the plugin to a remote registry.

            Returns:
                A dict iterator streaming the status of the upload.

            Raises:
                :py:class:`docker.errors.APIError`
                    If the server returns an error.
        )r   r    push_pluginr   r   s    r   pushzPlugin.pushI   s!     {{**49955r   c                 d    | j                   j                  j                  | j                  |      S )a.  
            Remove the plugin from the server.

            Args:
                force (bool): Remove even if the plugin is enabled.
                    Default: False

            Raises:
                :py:class:`docker.errors.APIError`
                    If the server returns an error.
        )force)r   r    remove_pluginr   )r   r0   s     r   removezPlugin.removeV   s&     {{,,TYYe,DDr   Nc              #   J  K   | j                   rt        j                  d      || j                  }| j                  j
                  j                  |      }| j                  j
                  j                  | j                  ||      E d{    | j                          y7 w)aR  
            Upgrade the plugin.

            Args:
                remote (string): Remote reference to upgrade to. The
                    ``:latest`` tag is optional and is the default if omitted.
                    Default: this plugin's name.

            Returns:
                A generator streaming the decoded API logs
        z)Plugin must be disabled before upgrading.N)	r   r   DockerErrorr   r   r    plugin_privilegesupgrade_pluginr"   )r   remote
privilegess      r   upgradezPlugin.upgraded   s      <<$$;  >YYF[[__66v>
;;??11$))VZPPP 	Qs   B	B#B!B#)    FN)r   
__module____qualname____doc__r   propertyr   r   r   r$   r'   r+   r.   r2   r9    r   r   r   r      sg    = & & ) ) * *
6Er   r   c                   ,    e Zd ZeZddZd ZddZd Zy)PluginCollectionc                 r    | j                   j                  j                  |||       | j                  |      S )aC  
            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:
                (:py:class:`Plugin`): The newly created plugin.
        )r   r    create_pluginr   )r   r   plugin_data_dirgzips       r   createzPluginCollection.create   s,     	%%dOTBxx~r   c                 j    | j                  | j                  j                  j                  |            S )ah  
        Gets a plugin.

        Args:
            name (str): The name of the plugin.

        Returns:
            (:py:class:`Plugin`): The plugin.

        Raises:
            :py:class:`docker.errors.NotFound` If the plugin does not
            exist.
            :py:class:`docker.errors.APIError`
                If the server returns an error.
        )prepare_modelr   r    inspect_plugin)r   r   s     r   r   zPluginCollection.get   s(      !!$++//"@"@"FGGr   Nc                     | j                   j                  j                  |      }| j                   j                  j                  |||      }|D ]  } | j	                  |xs |      S )a  
            Pull and install a plugin.

            Args:
                remote_name (string): Remote reference for the plugin to
                    install. The ``:latest`` tag is optional, and is the
                    default if omitted.
                local_name (string): Local name for the pulled plugin.
                    The ``:latest`` tag is optional, and is the default if
                    omitted. Optional.

            Returns:
                (:py:class:`Plugin`): The installed plugin
            Raises:
                :py:class:`docker.errors.APIError`
                    If the server returns an error.
        )r   r    r5   pull_pluginr   )r   remote_name
local_namer8   itdatas         r   installzPluginCollection.install   s^    $ [[__66{C
[[__((j*M 	D	xx
1k22r   c                     | j                   j                  j                         }|D cg c]  }| j                  |       c}S c c}w )z
        List plugins installed on the server.

        Returns:
            (list of :py:class:`Plugin`): The plugins.

        Raises:
            :py:class:`docker.errors.APIError`
                If the server returns an error.
        )r   r    pluginsrJ   )r   resprs      r   listzPluginCollection.list   s9     {{&&(/34!""1%444s   Ar;   r<   )	r   r=   r>   r   modelrH   r   rR   rW   rA   r   r   rC   rC   |   s    E$H$305r   rC   N) r   resourcer   r   r   rC   rA   r   r   <module>r[      s(     'tU tnK5z K5r   