o
    gZh)                     @   s@   d dl Zd dlmZ ddlmZ ddlmZ G dd deZdS )    N)ObjectApiResponse   )NamespacedClient)_rewrite_parametersc                   @   s   e Zd Ze ddddddeje dejejeej	e f  deje deje de
ej f
dd	Ze ddddddd
deje deje dejejeej	e f  deje deje deje de
ej fddZe ddddddeje dejejeej	e f  deje deje de
ej f
ddZe ddddddeje dejejeej	e f  deje deje de
ej f
ddZedddddddddddeje deje dejejeej	e f  deje dejejeejf  dejej	ejeejf   deje de
ej fddZe dddddddeje deje dejejeej	e f  deje deje de
ej fddZe ddddddddeje deje dejejeej	e f  deje deje deje de
ej fd d!ZdS )"LicenseClientN)error_tracefilter_pathhumanprettyr   r   r	   r
   returnc                C   b   d}i }|dur||d< |dur||d< |dur||d< |dur$||d< ddi}| j d	|||d
S )z
        Deletes licensing information for the cluster

        `<https://www.elastic.co/guide/en/elasticsearch/reference/8.11/delete-license.html>`_
        	/_licenseNr   r   r	   r
   acceptapplication/jsonDELETEparamsheadersZperform_requestselfr   r   r	   r
   _LicenseClient__path_LicenseClient__query_LicenseClient__headers r   Y/var/www/html/lang_env/lib/python3.10/site-packages/elasticsearch/_sync/client/license.pydelete      zLicenseClient.delete)accept_enterpriser   r   r	   localr
   r   r   c          
      C      d}i }|dur||d< |dur||d< |dur||d< |dur$||d< |dur,||d< |dur4||d< d	d
i}	| j d|||	dS )a  
        Retrieves licensing information for the cluster

        `<https://www.elastic.co/guide/en/elasticsearch/reference/8.11/get-license.html>`_

        :param accept_enterprise: If `true`, this parameter returns enterprise for Enterprise
            license types. If `false`, this parameter returns platinum for both platinum
            and enterprise license types. This behavior is maintained for backwards compatibility.
            This parameter is deprecated and will always be set to true in 8.x.
        :param local: Specifies whether to retrieve local information. The default value
            is `false`, which means the information is retrieved from the master node.
        r   Nr   r   r   r	   r   r
   r   r   GETr   r   )
r   r   r   r   r	   r   r
   r   r   r   r   r   r   get8   s$   zLicenseClient.getc                C   r   )z
        Retrieves information about the status of the basic license.

        `<https://www.elastic.co/guide/en/elasticsearch/reference/8.11/get-basic-status.html>`_
        z/_license/basic_statusNr   r   r	   r
   r   r   r!   r   r   r   r   r   r   get_basic_statusb   r   zLicenseClient.get_basic_statusc                C   r   )z
        Retrieves information about the status of the trial license.

        `<https://www.elastic.co/guide/en/elasticsearch/reference/8.11/get-trial-status.html>`_
        z/_license/trial_statusNr   r   r	   r
   r   r   r!   r   r   r   r   r   r   get_trial_status   r   zLicenseClient.get_trial_statusT)Zbody_fields)acknowledger   r   r	   licenselicensesr
   r%   r&   r'   c                C   s   d}i }	i }
|dur||	d< |dur||	d< |dur||	d< |dur&||	d< |dur.||
d< |dur6||
d< |dur>||	d	< |
sBd}
d
di}|
durNd|d< | j d||	||
dS )as  
        Updates the license for the cluster.

        `<https://www.elastic.co/guide/en/elasticsearch/reference/8.11/update-license.html>`_

        :param acknowledge: Specifies whether you acknowledge the license changes.
        :param license:
        :param licenses: A sequence of one or more JSON documents containing the license
            information.
        r   Nr%   r   r   r	   r&   r'   r
   r   r   zcontent-typePUT)r   r   bodyr   )r   r%   r   r   r	   r&   r'   r
   r   r   Z_LicenseClient__bodyr   r   r   r   post   s2   
zLicenseClient.post)r%   r   r   r	   r
   c          	      C   sr   d}i }|dur||d< |dur||d< |dur||d< |dur$||d< |dur,||d< dd	i}| j d
|||dS )a  
        Starts an indefinite basic license.

        `<https://www.elastic.co/guide/en/elasticsearch/reference/8.11/start-basic.html>`_

        :param acknowledge: whether the user has acknowledged acknowledge messages (default:
            false)
        z/_license/start_basicNr%   r   r   r	   r
   r   r   POSTr   r   )	r   r%   r   r   r	   r
   r   r   r   r   r   r   post_start_basic   s    zLicenseClient.post_start_basic)r%   r   r   r	   r
   type_query_stringr-   c          
      C   r    )a%  
        starts a limited time trial license.

        `<https://www.elastic.co/guide/en/elasticsearch/reference/8.11/start-trial.html>`_

        :param acknowledge: whether the user has acknowledged acknowledge messages (default:
            false)
        :param type_query_string:
        z/_license/start_trialNr%   r   r   r	   r
   r-   r   r   r+   r   r   )
r   r%   r   r   r	   r
   r-   r   r   r   r   r   r   post_start_trial   s$   zLicenseClient.post_start_trial)__name__
__module____qualname__r   tOptionalboolUnionstrSequencer   Anyr   r"   r#   r$   Mappingr*   r,   r.   r   r   r   r   r      s   	)	
/"	r   )	typingr2   Zelastic_transportr   _baser   utilsr   r   r   r   r   r   <module>   s
   