
    R                     L    S SK Jr  SSKJrJr   " S S\5      r " S S\5      rg)	   )errors   )
CollectionModelc                       \ rS rSrSrS r\S 5       r\S 5       r\S 5       r	S r
SS jrSS	 jrS
 rSS jrSS jrSrg)Plugin   z
A plugin on the server.
c                 P    SU R                   R                   SU R                   S3$ )N<z: 'z'>)	__class____name__nameselfs    (lib/third_party/docker/models/plugins.py__repr__Plugin.__repr__	   s&    4>>**+3tyyk<<    c                 8    U R                   R                  S5      $ )z
The plugin's name.
Nameattrsgetr   s    r   r   Plugin.name   s    
 zz~~f%%r   c                 8    U R                   R                  S5      $ )z 
Whether the plugin is enabled.
Enabledr   r   s    r   enabledPlugin.enabled   s    
 zz~~i((r   c                 8    U R                   R                  S5      $ )z7
A dictionary representing the plugin's configuration.
Settingsr   r   s    r   settingsPlugin.settings   s    
 zz~~j))r   c                     U R                   R                  R                  U R                  U5        U R	                  5         g)z
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   	configurePlugin.configure!   s)     	((G<r   c                     U R                   R                  R                  U R                  U5        U R	                  5         g)z
Disable the plugin.

Args:
    force (bool): Force disable. Default: False

Raises:
    :py:class:`docker.errors.APIError`
        If the server returns an error.
N)r$   r%   disable_pluginr   r'   r   forces     r   disablePlugin.disable/   s)     	&&tyy%8r   c                     U R                   R                  R                  U R                  U5        U R	                  5         g)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   enablePlugin.enable>   s)     	%%dii9r   c                 `    U R                   R                  R                  U R                  5      $ )z
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   pushPlugin.pushL   s!     {{**49955r   c                 ^    U R                   R                  R                  U R                  US9$ )z
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.
)r.   )r$   r%   remove_pluginr   r-   s     r   removePlugin.removeY   s&     {{,,TYYe,DDr   Nc              #   X  #    U R                   (       a  [        R                  " S5      eUc  U R                  nU R                  R
                  R                  U5      nU R                  R
                  R                  U R                  UU5       Sh  vN   U R                  5         g N7f)z
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   upgradePlugin.upgradeg   s      <<$$;  >YYF[[__66v>
;;??11II
 	
 	

 		
s   BB*B(B* F)    N)r   
__module____qualname____firstlineno____doc__r   propertyr   r   r!   r)   r/   r4   r8   r<   rD   __static_attributes__rF   r   r   r   r      sg    = & & ) ) * *6Er   r   c                   8    \ rS rSr\rSS jrS rS	S jrS r	Sr
g)
PluginCollection   c                 p    U R                   R                  R                  XU5        U R                  U5      $ )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:
    (:py:class:`Plugin`): The newly created plugin.
)r$   r%   create_pluginr   )r   r   plugin_data_dirgzips       r   createPluginCollection.create   s*     	%%dTBxx~r   c                 j    U R                  U R                  R                  R                  U5      5      $ )a  
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   PluginCollection.get   s(      !!$++//"@"@"FGGr   Nc                     U R                   R                  R                  U5      nU R                   R                  R                  XU5      nU H  nM     U R	                  U=(       d    U5      $ )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%   r@   pull_pluginr   )r   remote_name
local_namerC   itdatas         r   installPluginCollection.install   sW    $ [[__66{C
[[__((*MD xx
1k22r   c                     U R                   R                  R                  5       nU Vs/ s H  o R                  U5      PM     sn$ s  snf )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%   pluginsrZ   )r   resprs      r   listPluginCollection.list   s;     {{&&(/34t!""1%t444s   ArF   rG   rI   )r   rJ   rK   rL   r   modelrW   r   rc   ri   rO   rF   r   r   rQ   rQ      s    E$H$305r   rQ   N) r   resourcer   r   r   rQ   rF   r   r   <module>rn      s(     '{U {|K5z K5r   