o
    ɶde/                     @   s8   d dl mZmZmZ d dlmZ eG dd deZdS )    )formatted_flat_dictNONE_SENTINEL#value_allowed_none_or_none_sentinel)init_model_state_from_kwargsc                   @   s"  e Zd ZdZdZdZdd Zedd Zej	dd Zed	d
 Z
e
j	dd
 Z
edd Zej	dd Zedd Zej	dd Zedd Zej	dd Zedd Zej	dd Zedd Zej	dd Zedd Zej	dd Zedd Zej	d d Zd!d" Zd#d$ Zd%d& Zd'S )(JsChallengez
    The JavaScript challenge settings. JavaScript Challenge is the function to filter abnormal or malicious bots and allow access to real clients.
    DETECTBLOCKc              
   K   sn   dddddddddd	| _ dd	d
ddddddd	| _d| _d| _d| _d| _d| _d| _d| _d| _	d| _
dS )aR  
        Initializes a new JsChallenge object with values from keyword arguments.
        The following keyword arguments are supported (corresponding to the getters/setters of this class):

        :param is_enabled:
            The value to assign to the is_enabled property of this JsChallenge.
        :type is_enabled: bool

        :param action:
            The value to assign to the action property of this JsChallenge.
            Allowed values for this property are: "DETECT", "BLOCK", 'UNKNOWN_ENUM_VALUE'.
            Any unrecognized values returned by a service will be mapped to 'UNKNOWN_ENUM_VALUE'.
        :type action: str

        :param failure_threshold:
            The value to assign to the failure_threshold property of this JsChallenge.
        :type failure_threshold: int

        :param action_expiration_in_seconds:
            The value to assign to the action_expiration_in_seconds property of this JsChallenge.
        :type action_expiration_in_seconds: int

        :param set_http_header:
            The value to assign to the set_http_header property of this JsChallenge.
        :type set_http_header: oci.waas.models.Header

        :param challenge_settings:
            The value to assign to the challenge_settings property of this JsChallenge.
        :type challenge_settings: oci.waas.models.BlockChallengeSettings

        :param are_redirects_challenged:
            The value to assign to the are_redirects_challenged property of this JsChallenge.
        :type are_redirects_challenged: bool

        :param criteria:
            The value to assign to the criteria property of this JsChallenge.
        :type criteria: list[oci.waas.models.AccessRuleCriteria]

        :param is_nat_enabled:
            The value to assign to the is_nat_enabled property of this JsChallenge.
        :type is_nat_enabled: bool

        boolstrintHeaderZBlockChallengeSettingszlist[AccessRuleCriteria])	
is_enabledactionfailure_thresholdaction_expiration_in_secondsset_http_headerchallenge_settingsare_redirects_challengedcriteriais_nat_enabledZ	isEnabledr   ZfailureThresholdZactionExpirationInSecondsZsetHttpHeaderZchallengeSettingsZareRedirectsChallengedr   ZisNatEnabledN)Zswagger_typesZattribute_map_is_enabled_action_failure_threshold_action_expiration_in_seconds_set_http_header_challenge_settings_are_redirects_challenged	_criteria_is_nat_enabled)selfkwargs r!   @usr/lib/python3.10/site-packages/oci/waas/models/js_challenge.py__init__   s:   -
zJsChallenge.__init__c                 C      | j S )z
        **[Required]** Gets the is_enabled of this JsChallenge.
        Enables or disables the JavaScript challenge Web Application Firewall feature.


        :return: The is_enabled of this JsChallenge.
        :rtype: bool
        r   r   r!   r!   r"   r   h      
zJsChallenge.is_enabledc                 C   
   || _ dS )z
        Sets the is_enabled of this JsChallenge.
        Enables or disables the JavaScript challenge Web Application Firewall feature.


        :param is_enabled: The is_enabled of this JsChallenge.
        :type: bool
        Nr%   )r   r   r!   r!   r"   r   t      

c                 C   r$   )a  
        Gets the action of this JsChallenge.
        The action to take against requests from detected bots. If unspecified, defaults to `DETECT`.

        Allowed values for this property are: "DETECT", "BLOCK", 'UNKNOWN_ENUM_VALUE'.
        Any unrecognized values returned by a service will be mapped to 'UNKNOWN_ENUM_VALUE'.


        :return: The action of this JsChallenge.
        :rtype: str
        )r   r&   r!   r!   r"   r      s   zJsChallenge.actionc                 C   s    ddg}t ||sd}|| _dS )z
        Sets the action of this JsChallenge.
        The action to take against requests from detected bots. If unspecified, defaults to `DETECT`.


        :param action: The action of this JsChallenge.
        :type: str
        r   r   ZUNKNOWN_ENUM_VALUEN)r   r   )r   r   Zallowed_valuesr!   r!   r"   r      s   


c                 C   r$   )z
        Gets the failure_threshold of this JsChallenge.
        The number of failed requests before taking action. If unspecified, defaults to `10`.


        :return: The failure_threshold of this JsChallenge.
        :rtype: int
        r   r&   r!   r!   r"   r      r'   zJsChallenge.failure_thresholdc                 C   r(   )a  
        Sets the failure_threshold of this JsChallenge.
        The number of failed requests before taking action. If unspecified, defaults to `10`.


        :param failure_threshold: The failure_threshold of this JsChallenge.
        :type: int
        Nr*   )r   r   r!   r!   r"   r      r)   c                 C   r$   )a  
        Gets the action_expiration_in_seconds of this JsChallenge.
        The number of seconds between challenges from the same IP address. If unspecified, defaults to `60`.


        :return: The action_expiration_in_seconds of this JsChallenge.
        :rtype: int
        r   r&   r!   r!   r"   r      r'   z(JsChallenge.action_expiration_in_secondsc                 C   r(   )a1  
        Sets the action_expiration_in_seconds of this JsChallenge.
        The number of seconds between challenges from the same IP address. If unspecified, defaults to `60`.


        :param action_expiration_in_seconds: The action_expiration_in_seconds of this JsChallenge.
        :type: int
        Nr+   )r   r   r!   r!   r"   r      r)   c                 C   r$   )aF  
        Gets the set_http_header of this JsChallenge.
        Adds an additional HTTP header to requests that fail the challenge before being passed to the origin. Only applicable when the `action` is set to `DETECT`.


        :return: The set_http_header of this JsChallenge.
        :rtype: oci.waas.models.Header
        r   r&   r!   r!   r"   r      r'   zJsChallenge.set_http_headerc                 C   r(   )aT  
        Sets the set_http_header of this JsChallenge.
        Adds an additional HTTP header to requests that fail the challenge before being passed to the origin. Only applicable when the `action` is set to `DETECT`.


        :param set_http_header: The set_http_header of this JsChallenge.
        :type: oci.waas.models.Header
        Nr,   )r   r   r!   r!   r"   r      r)   c                 C   r$   )z
        Gets the challenge_settings of this JsChallenge.

        :return: The challenge_settings of this JsChallenge.
        :rtype: oci.waas.models.BlockChallengeSettings
        r   r&   r!   r!   r"   r      s   zJsChallenge.challenge_settingsc                 C   r(   )z
        Sets the challenge_settings of this JsChallenge.

        :param challenge_settings: The challenge_settings of this JsChallenge.
        :type: oci.waas.models.BlockChallengeSettings
        Nr-   )r   r   r!   r!   r"   r      s   
c                 C   r$   )an  
        Gets the are_redirects_challenged of this JsChallenge.
        When enabled, redirect responses from the origin will also be challenged. This will change HTTP 301/302 responses from origin to HTTP 200 with an HTML body containing JavaScript page redirection.


        :return: The are_redirects_challenged of this JsChallenge.
        :rtype: bool
        r   r&   r!   r!   r"   r      r'   z$JsChallenge.are_redirects_challengedc                 C   r(   )a  
        Sets the are_redirects_challenged of this JsChallenge.
        When enabled, redirect responses from the origin will also be challenged. This will change HTTP 301/302 responses from origin to HTTP 200 with an HTML body containing JavaScript page redirection.


        :param are_redirects_challenged: The are_redirects_challenged of this JsChallenge.
        :type: bool
        Nr.   )r   r   r!   r!   r"   r     r)   c                 C   r$   )a$  
        Gets the criteria of this JsChallenge.
        When defined, the JavaScript Challenge would be applied only for the requests that matched all the listed conditions.


        :return: The criteria of this JsChallenge.
        :rtype: list[oci.waas.models.AccessRuleCriteria]
        r   r&   r!   r!   r"   r     r'   zJsChallenge.criteriac                 C   r(   )a+  
        Sets the criteria of this JsChallenge.
        When defined, the JavaScript Challenge would be applied only for the requests that matched all the listed conditions.


        :param criteria: The criteria of this JsChallenge.
        :type: list[oci.waas.models.AccessRuleCriteria]
        Nr/   )r   r   r!   r!   r"   r     r)   c                 C   r$   )a8  
        Gets the is_nat_enabled of this JsChallenge.
        When enabled, the user is identified not only by the IP address but also by an unique additional hash, which prevents blocking visitors with shared IP addresses.


        :return: The is_nat_enabled of this JsChallenge.
        :rtype: bool
        r   r&   r!   r!   r"   r   *  r'   zJsChallenge.is_nat_enabledc                 C   r(   )aE  
        Sets the is_nat_enabled of this JsChallenge.
        When enabled, the user is identified not only by the IP address but also by an unique additional hash, which prevents blocking visitors with shared IP addresses.


        :param is_nat_enabled: The is_nat_enabled of this JsChallenge.
        :type: bool
        Nr0   )r   r   r!   r!   r"   r   6  r)   c                 C   s   t | S N)r   r&   r!   r!   r"   __repr__B  s   zJsChallenge.__repr__c                 C   s   |d u rdS | j |j kS )NF)__dict__r   otherr!   r!   r"   __eq__E  s   zJsChallenge.__eq__c                 C   s
   | |k S r1   r!   r4   r!   r!   r"   __ne__K  s   
zJsChallenge.__ne__N)__name__
__module____qualname____doc__ZACTION_DETECTZACTION_BLOCKr#   propertyr   setterr   r   r   r   r   r   r   r   r2   r6   r7   r!   r!   r!   r"   r      sX    N










	
	





r   N)Zoci.utilr   r   r   Zoci.decoratorsr   objectr   r!   r!   r!   r"   <module>   s   