o
    gZh                     @   sH   d dl Zd dlmZ ddlmZ ddlmZmZm	Z	 G dd deZ
dS )    N)ObjectApiResponse   )NamespacedClient)SKIP_IN_PATH_quote_rewrite_parametersc                   @   s  e Zd Ze dddddd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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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dejeejf 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dS )AutoscalingClientN)error_tracefilter_pathhumanprettynamer	   r
   r   r   returnc          	      C   |   |t v rtddt| }i }|dur||d< |dur!||d< |dur)||d< |dur1||d< dd	i}| jd
|||dS )a2  
        Deletes an autoscaling policy. Designed for indirect use by ECE/ESS and ECK.
        Direct use is not supported.

        `<https://www.elastic.co/guide/en/elasticsearch/reference/8.11/autoscaling-delete-autoscaling-policy.html>`_

        :param name: the name of the autoscaling policy
        'Empty value passed for parameter 'name'/_autoscaling/policy/Nr	   r
   r   r   acceptapplication/jsonDELETEparamsheadersr   
ValueErrorr   perform_request	selfr   r	   r
   r   r   _AutoscalingClient__path_AutoscalingClient__query_AutoscalingClient__headers r    ]/var/www/html/lang_env/lib/python3.10/site-packages/elasticsearch/_sync/client/autoscaling.pydelete_autoscaling_policy       z+AutoscalingClient.delete_autoscaling_policyc                C   sb   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 )a+  
        Gets the current autoscaling capacity based on the configured autoscaling policy.
        Designed for indirect use by ECE/ESS and ECK. Direct use is not supported.

        `<https://www.elastic.co/guide/en/elasticsearch/reference/8.11/autoscaling-get-autoscaling-capacity.html>`_
        z/_autoscaling/capacityNr	   r
   r   r   r   r   GETr   )r   )r   r	   r
   r   r   r   r   r   r    r    r!   get_autoscaling_capacity>   s   z*AutoscalingClient.get_autoscaling_capacityc          	      C   r   )a3  
        Retrieves an autoscaling policy. Designed for indirect use by ECE/ESS and ECK.
        Direct use is not supported.

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

        :param name: the name of the autoscaling policy
        r   r   Nr	   r
   r   r   r   r   r$   r   r   r   r    r    r!   get_autoscaling_policy\   r#   z(AutoscalingClient.get_autoscaling_policypolicy)Z	body_namec                C   s   |t v rtd|du rtddt| }i }|dur!||d< |dur)||d< |dur1||d< |dur9||d< |}	d	d	d
}
| jd|||
|	dS )aI  
        Creates a new autoscaling policy. Designed for indirect use by ECE/ESS and ECK.
        Direct use is not supported.

        `<https://www.elastic.co/guide/en/elasticsearch/reference/8.11/autoscaling-put-autoscaling-policy.html>`_

        :param name: the name of the autoscaling policy
        :param policy:
        r   Nz)Empty value passed for parameter 'policy'r   r	   r
   r   r   r   )r   zcontent-typePUT)r   r   bodyr   )r   r   r'   r	   r
   r   r   r   r   Z_AutoscalingClient__bodyr   r    r    r!   put_autoscaling_policy   s&   

z(AutoscalingClient.put_autoscaling_policy)__name__
__module____qualname__r   strtOptionalboolUnionSequencer   Anyr"   r%   r&   Mappingr*   r    r    r    r!   r      s    ""	r   )typingr/   Zelastic_transportr   _baser   utilsr   r   r   r   r    r    r    r!   <module>   s
   