o
    ɶdm                     @   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ZdZdZdZ	dZ
d	Zd
Zd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ed-d. Zejd/d. Zed0d1 Zejd2d1 Zed3d4 Z e jd5d4 Z ed6d7 Z!e!jd8d7 Z!ed9d: Z"e"jd;d: Z"ed<d= Z#e#jd>d= Z#ed?d@ Z$e$jdAd@ Z$dBdC Z%dDdE Z&dFdG Z'dHS )I
AccessRulezy
    A content access rule. An access rule specifies an action to take if a set of criteria is matched by a request.
    ALLOWDETECTBLOCKBYPASSREDIRECTSHOW_CAPTCHASET_RESPONSE_CODESHOW_ERROR_PAGEJS_CHALLENGEDEVICE_FINGERPRINT_CHALLENGEHUMAN_INTERACTION_CHALLENGECAPTCHAMOVED_PERMANENTLYFOUNDc                 K   s0  i 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dd| _ i 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!dd"| _d#| _d#| _d#| _d#| _d#| _d#| _d#| _d#| _	d#| _
d#| _d#| _d#| _d#| _d#| _d#| _d#| _d#S )$am  
        Initializes a new AccessRule object with values from keyword arguments.
        The following keyword arguments are supported (corresponding to the getters/setters of this class):

        :param name:
            The value to assign to the name property of this AccessRule.
        :type name: str

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

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

        :param block_action:
            The value to assign to the block_action property of this AccessRule.
            Allowed values for this property are: "SET_RESPONSE_CODE", "SHOW_ERROR_PAGE", 'UNKNOWN_ENUM_VALUE'.
            Any unrecognized values returned by a service will be mapped to 'UNKNOWN_ENUM_VALUE'.
        :type block_action: str

        :param block_response_code:
            The value to assign to the block_response_code property of this AccessRule.
        :type block_response_code: int

        :param block_error_page_message:
            The value to assign to the block_error_page_message property of this AccessRule.
        :type block_error_page_message: str

        :param block_error_page_code:
            The value to assign to the block_error_page_code property of this AccessRule.
        :type block_error_page_code: str

        :param block_error_page_description:
            The value to assign to the block_error_page_description property of this AccessRule.
        :type block_error_page_description: str

        :param bypass_challenges:
            The value to assign to the bypass_challenges property of this AccessRule.
            Allowed values for items in this list are: "JS_CHALLENGE", "DEVICE_FINGERPRINT_CHALLENGE", "HUMAN_INTERACTION_CHALLENGE", "CAPTCHA", 'UNKNOWN_ENUM_VALUE'.
            Any unrecognized values returned by a service will be mapped to 'UNKNOWN_ENUM_VALUE'.
        :type bypass_challenges: list[str]

        :param redirect_url:
            The value to assign to the redirect_url property of this AccessRule.
        :type redirect_url: str

        :param redirect_response_code:
            The value to assign to the redirect_response_code property of this AccessRule.
            Allowed values for this property are: "MOVED_PERMANENTLY", "FOUND", 'UNKNOWN_ENUM_VALUE'.
            Any unrecognized values returned by a service will be mapped to 'UNKNOWN_ENUM_VALUE'.
        :type redirect_response_code: str

        :param captcha_title:
            The value to assign to the captcha_title property of this AccessRule.
        :type captcha_title: str

        :param captcha_header:
            The value to assign to the captcha_header property of this AccessRule.
        :type captcha_header: str

        :param captcha_footer:
            The value to assign to the captcha_footer property of this AccessRule.
        :type captcha_footer: str

        :param captcha_submit_label:
            The value to assign to the captcha_submit_label property of this AccessRule.
        :type captcha_submit_label: str

        :param response_header_manipulation:
            The value to assign to the response_header_manipulation property of this AccessRule.
        :type response_header_manipulation: list[oci.waas.models.HeaderManipulationAction]

        namestrcriteriazlist[AccessRuleCriteria]actionblock_actionblock_response_codeintblock_error_page_messageblock_error_page_codeblock_error_page_descriptionbypass_challengesz	list[str]redirect_urlredirect_response_codecaptcha_titlecaptcha_headercaptcha_footercaptcha_submit_labelresponse_header_manipulationzlist[HeaderManipulationAction]ZblockActionZblockResponseCodeZblockErrorPageMessageZblockErrorPageCodeZblockErrorPageDescriptionZbypassChallengesZredirectUrlZredirectResponseCodeZcaptchaTitleZcaptchaHeaderZcaptchaFooterZcaptchaSubmitLabelZresponseHeaderManipulationN)Zswagger_typesZattribute_map_name	_criteria_action_block_action_block_response_code_block_error_page_message_block_error_page_code_block_error_page_description_bypass_challenges_redirect_url_redirect_response_code_captcha_title_captcha_header_captcha_footer_captcha_submit_label_response_header_manipulation)selfkwargs r9   ?usr/lib/python3.10/site-packages/oci/waas/models/access_rule.py__init__J   s   N	
	

zAccessRule.__init__c                 C      | j S )z
        **[Required]** Gets the name of this AccessRule.
        The unique name of the access rule.


        :return: The name of this AccessRule.
        :rtype: str
        r'   r7   r9   r9   r:   r         
zAccessRule.namec                 C   
   || _ dS )z
        Sets the name of this AccessRule.
        The unique name of the access rule.


        :param name: The name of this AccessRule.
        :type: str
        Nr=   )r7   r   r9   r9   r:   r         

c                 C   r<   )a5  
        **[Required]** Gets the criteria of this AccessRule.
        The list of access rule criteria. The rule would be applied only for the requests that matched all the listed conditions.


        :return: The criteria of this AccessRule.
        :rtype: list[oci.waas.models.AccessRuleCriteria]
        r(   r>   r9   r9   r:   r      r?   zAccessRule.criteriac                 C   r@   )a-  
        Sets the criteria of this AccessRule.
        The list of access rule criteria. The rule would be applied only for the requests that matched all the listed conditions.


        :param criteria: The criteria of this AccessRule.
        :type: list[oci.waas.models.AccessRuleCriteria]
        NrB   )r7   r   r9   r9   r:   r      rA   c                 C   r<   )aX  
        **[Required]** Gets the action of this AccessRule.
        The action to take when the access criteria are met for a rule. If unspecified, defaults to `ALLOW`.

        - **ALLOW:** Takes no action, just logs the request.

        - **DETECT:** Takes no action, but creates an alert for the request.

        - **BLOCK:** Blocks the request by returning specified response code or showing error page.

        - **BYPASS:** Bypasses some or all challenges.

        - **REDIRECT:** Redirects the request to the specified URL. These fields are required when `REDIRECT` is selected: `redirectUrl`, `redirectResponseCode`.

        - **SHOW_CAPTCHA:** Show a CAPTCHA Challenge page instead of the requested page.

        Regardless of action, no further rules are processed once a rule is matched.

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


        :return: The action of this AccessRule.
        :rtype: str
        )r)   r>   r9   r9   r:   r      s   zAccessRule.actionc                 C   s    g d}t ||sd}|| _dS )ai  
        Sets the action of this AccessRule.
        The action to take when the access criteria are met for a rule. If unspecified, defaults to `ALLOW`.

        - **ALLOW:** Takes no action, just logs the request.

        - **DETECT:** Takes no action, but creates an alert for the request.

        - **BLOCK:** Blocks the request by returning specified response code or showing error page.

        - **BYPASS:** Bypasses some or all challenges.

        - **REDIRECT:** Redirects the request to the specified URL. These fields are required when `REDIRECT` is selected: `redirectUrl`, `redirectResponseCode`.

        - **SHOW_CAPTCHA:** Show a CAPTCHA Challenge page instead of the requested page.

        Regardless of action, no further rules are processed once a rule is matched.


        :param action: The action of this AccessRule.
        :type: str
        )r   r   r	   r
   r   r   UNKNOWN_ENUM_VALUEN)r   r)   )r7   r   allowed_valuesr9   r9   r:   r     s   

c                 C   r<   )a  
        Gets the block_action of this AccessRule.
        The method used to block requests if `action` is set to `BLOCK` and the access criteria are met. If unspecified, defaults to `SET_RESPONSE_CODE`.

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


        :return: The block_action of this AccessRule.
        :rtype: str
        )r*   r>   r9   r9   r:   r   9  s   zAccessRule.block_actionc                 C       ddg}t ||sd}|| _dS )a,  
        Sets the block_action of this AccessRule.
        The method used to block requests if `action` is set to `BLOCK` and the access criteria are met. If unspecified, defaults to `SET_RESPONSE_CODE`.


        :param block_action: The block_action of this AccessRule.
        :type: str
        r   r   rC   N)r   r*   )r7   r   rD   r9   r9   r:   r   H  s   


c                 C   r<   )a{  
        Gets the block_response_code of this AccessRule.
        The response status code to return when `action` is set to `BLOCK`, `blockAction` is set to `SET_RESPONSE_CODE`, and the access criteria are met. If unspecified, defaults to `403`. The list of available response codes: `200`, `201`, `202`, `204`, `206`, `300`, `301`, `302`, `303`, `304`, `307`, `400`, `401`, `403`, `404`, `405`, `408`, `409`, `411`, `412`, `413`, `414`, `415`, `416`, `422`, `444`, `494`, `495`, `496`, `497`, `499`, `500`, `501`, `502`, `503`, `504`, `507`.


        :return: The block_response_code of this AccessRule.
        :rtype: int
        r+   r>   r9   r9   r:   r   W  r?   zAccessRule.block_response_codec                 C   r@   )a  
        Sets the block_response_code of this AccessRule.
        The response status code to return when `action` is set to `BLOCK`, `blockAction` is set to `SET_RESPONSE_CODE`, and the access criteria are met. If unspecified, defaults to `403`. The list of available response codes: `200`, `201`, `202`, `204`, `206`, `300`, `301`, `302`, `303`, `304`, `307`, `400`, `401`, `403`, `404`, `405`, `408`, `409`, `411`, `412`, `413`, `414`, `415`, `416`, `422`, `444`, `494`, `495`, `496`, `497`, `499`, `500`, `501`, `502`, `503`, `504`, `507`.


        :param block_response_code: The block_response_code of this AccessRule.
        :type: int
        NrF   )r7   r   r9   r9   r:   r   c  rA   c                 C   r<   )az  
        Gets the block_error_page_message of this AccessRule.
        The message to show on the error page when `action` is set to `BLOCK`, `blockAction` is set to `SHOW_ERROR_PAGE`, and the access criteria are met. If unspecified, defaults to 'Access to the website is blocked.'


        :return: The block_error_page_message of this AccessRule.
        :rtype: str
        r,   r>   r9   r9   r:   r   o  r?   z#AccessRule.block_error_page_messagec                 C   r@   )a  
        Sets the block_error_page_message of this AccessRule.
        The message to show on the error page when `action` is set to `BLOCK`, `blockAction` is set to `SHOW_ERROR_PAGE`, and the access criteria are met. If unspecified, defaults to 'Access to the website is blocked.'


        :param block_error_page_message: The block_error_page_message of this AccessRule.
        :type: str
        NrG   )r7   r   r9   r9   r:   r   {  rA   c                 C   r<   )ac  
        Gets the block_error_page_code of this AccessRule.
        The error code to show on the error page when `action` is set to `BLOCK`, `blockAction` is set to `SHOW_ERROR_PAGE`, and the access criteria are met. If unspecified, defaults to 'Access rules'.


        :return: The block_error_page_code of this AccessRule.
        :rtype: str
        r-   r>   r9   r9   r:   r     r?   z AccessRule.block_error_page_codec                 C   r@   )aw  
        Sets the block_error_page_code of this AccessRule.
        The error code to show on the error page when `action` is set to `BLOCK`, `blockAction` is set to `SHOW_ERROR_PAGE`, and the access criteria are met. If unspecified, defaults to 'Access rules'.


        :param block_error_page_code: The block_error_page_code of this AccessRule.
        :type: str
        NrH   )r7   r   r9   r9   r:   r     rA   c                 C   r<   )a  
        Gets the block_error_page_description of this AccessRule.
        The description text to show on the error page when `action` is set to `BLOCK`, `blockAction` is set to `SHOW_ERROR_PAGE`, and the access criteria are met. If unspecified, defaults to 'Access blocked by website owner. Please contact support.'


        :return: The block_error_page_description of this AccessRule.
        :rtype: str
        r.   r>   r9   r9   r:   r     r?   z'AccessRule.block_error_page_descriptionc                 C   r@   )a  
        Sets the block_error_page_description of this AccessRule.
        The description text to show on the error page when `action` is set to `BLOCK`, `blockAction` is set to `SHOW_ERROR_PAGE`, and the access criteria are met. If unspecified, defaults to 'Access blocked by website owner. Please contact support.'


        :param block_error_page_description: The block_error_page_description of this AccessRule.
        :type: str
        NrI   )r7   r   r9   r9   r:   r     rA   c                 C   r<   )a0  
        Gets the bypass_challenges of this AccessRule.
        The list of challenges to bypass when `action` is set to `BYPASS`. If unspecified or empty, all challenges are bypassed.

        - **JS_CHALLENGE:** Bypasses JavaScript Challenge.

        - **DEVICE_FINGERPRINT_CHALLENGE:** Bypasses Device Fingerprint Challenge.

        - **HUMAN_INTERACTION_CHALLENGE:** Bypasses Human Interaction Challenge.

        - **CAPTCHA:** Bypasses CAPTCHA Challenge.

        Allowed values for items in this list are: "JS_CHALLENGE", "DEVICE_FINGERPRINT_CHALLENGE", "HUMAN_INTERACTION_CHALLENGE", "CAPTCHA", 'UNKNOWN_ENUM_VALUE'.
        Any unrecognized values returned by a service will be mapped to 'UNKNOWN_ENUM_VALUE'.


        :return: The bypass_challenges of this AccessRule.
        :rtype: list[str]
        r/   r>   r9   r9   r:   r     s   zAccessRule.bypass_challengesc                    s0   g d |r fdd|D |dd< || _ dS )a>  
        Sets the bypass_challenges of this AccessRule.
        The list of challenges to bypass when `action` is set to `BYPASS`. If unspecified or empty, all challenges are bypassed.

        - **JS_CHALLENGE:** Bypasses JavaScript Challenge.

        - **DEVICE_FINGERPRINT_CHALLENGE:** Bypasses Device Fingerprint Challenge.

        - **HUMAN_INTERACTION_CHALLENGE:** Bypasses Human Interaction Challenge.

        - **CAPTCHA:** Bypasses CAPTCHA Challenge.


        :param bypass_challenges: The bypass_challenges of this AccessRule.
        :type: list[str]
        )r   r   r   r   c                    s   g | ]}t | sd n|qS )rC   )r   ).0xrD   r9   r:   
<listcomp>  s    z0AccessRule.bypass_challenges.<locals>.<listcomp>NrJ   )r7   r   r9   rM   r:   r     s   
c                 C   r<   )a  
        Gets the redirect_url of this AccessRule.
        The target to which the request should be redirected, represented as a URI reference. Required when `action` is `REDIRECT`.


        :return: The redirect_url of this AccessRule.
        :rtype: str
        r0   r>   r9   r9   r:   r      r?   zAccessRule.redirect_urlc                 C   r@   )a  
        Sets the redirect_url of this AccessRule.
        The target to which the request should be redirected, represented as a URI reference. Required when `action` is `REDIRECT`.


        :param redirect_url: The redirect_url of this AccessRule.
        :type: str
        NrO   )r7   r    r9   r9   r:   r      rA   c                 C   r<   )a  
        Gets the redirect_response_code of this AccessRule.
        The response status code to return when `action` is set to `REDIRECT`.

        - **MOVED_PERMANENTLY:** Used for designating the permanent movement of a page (numerical code - 301).

        - **FOUND:** Used for designating the temporary movement of a page (numerical code - 302).

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


        :return: The redirect_response_code of this AccessRule.
        :rtype: str
        )r1   r>   r9   r9   r:   r!     s   z!AccessRule.redirect_response_codec                 C   rE   )a  
        Sets the redirect_response_code of this AccessRule.
        The response status code to return when `action` is set to `REDIRECT`.

        - **MOVED_PERMANENTLY:** Used for designating the permanent movement of a page (numerical code - 301).

        - **FOUND:** Used for designating the temporary movement of a page (numerical code - 302).


        :param redirect_response_code: The redirect_response_code of this AccessRule.
        :type: str
        r   r   rC   N)r   r1   )r7   r!   rD   r9   r9   r:   r!     s   

c                 C   r<   )a  
        Gets the captcha_title of this AccessRule.
        The title used when showing a CAPTCHA challenge when `action` is set to `SHOW_CAPTCHA` and the request is challenged.


        :return: The captcha_title of this AccessRule.
        :rtype: str
        r2   r>   r9   r9   r:   r"   #  r?   zAccessRule.captcha_titlec                 C   r@   )a  
        Sets the captcha_title of this AccessRule.
        The title used when showing a CAPTCHA challenge when `action` is set to `SHOW_CAPTCHA` and the request is challenged.


        :param captcha_title: The captcha_title of this AccessRule.
        :type: str
        NrP   )r7   r"   r9   r9   r:   r"   /  rA   c                 C   r<   )a  
        Gets the captcha_header of this AccessRule.
        The text to show in the header when showing a CAPTCHA challenge when `action` is set to `SHOW_CAPTCHA` and the request is challenged.


        :return: The captcha_header of this AccessRule.
        :rtype: str
        r3   r>   r9   r9   r:   r#   ;  r?   zAccessRule.captcha_headerc                 C   r@   )a&  
        Sets the captcha_header of this AccessRule.
        The text to show in the header when showing a CAPTCHA challenge when `action` is set to `SHOW_CAPTCHA` and the request is challenged.


        :param captcha_header: The captcha_header of this AccessRule.
        :type: str
        NrQ   )r7   r#   r9   r9   r:   r#   G  rA   c                 C   r<   )a  
        Gets the captcha_footer of this AccessRule.
        The text to show in the footer when showing a CAPTCHA challenge when `action` is set to `SHOW_CAPTCHA` and the request is challenged.


        :return: The captcha_footer of this AccessRule.
        :rtype: str
        r4   r>   r9   r9   r:   r$   S  r?   zAccessRule.captcha_footerc                 C   r@   )a&  
        Sets the captcha_footer of this AccessRule.
        The text to show in the footer when showing a CAPTCHA challenge when `action` is set to `SHOW_CAPTCHA` and the request is challenged.


        :param captcha_footer: The captcha_footer of this AccessRule.
        :type: str
        NrR   )r7   r$   r9   r9   r:   r$   _  rA   c                 C   r<   )a*  
        Gets the captcha_submit_label of this AccessRule.
        The text to show on the label of the CAPTCHA challenge submit button when `action` is set to `SHOW_CAPTCHA` and the request is challenged.


        :return: The captcha_submit_label of this AccessRule.
        :rtype: str
        r5   r>   r9   r9   r:   r%   k  r?   zAccessRule.captcha_submit_labelc                 C   r@   )a=  
        Sets the captcha_submit_label of this AccessRule.
        The text to show on the label of the CAPTCHA challenge submit button when `action` is set to `SHOW_CAPTCHA` and the request is challenged.


        :param captcha_submit_label: The captcha_submit_label of this AccessRule.
        :type: str
        NrS   )r7   r%   r9   r9   r:   r%   w  rA   c                 C   r<   )af  
        Gets the response_header_manipulation of this AccessRule.
        An object that represents an action to apply to an HTTP response headers if all rule criteria will be matched regardless of `action` value.


        :return: The response_header_manipulation of this AccessRule.
        :rtype: list[oci.waas.models.HeaderManipulationAction]
        r6   r>   r9   r9   r:   r&     r?   z'AccessRule.response_header_manipulationc                 C   r@   )a  
        Sets the response_header_manipulation of this AccessRule.
        An object that represents an action to apply to an HTTP response headers if all rule criteria will be matched regardless of `action` value.


        :param response_header_manipulation: The response_header_manipulation of this AccessRule.
        :type: list[oci.waas.models.HeaderManipulationAction]
        NrT   )r7   r&   r9   r9   r:   r&     rA   c                 C   s   t | S N)r   r>   r9   r9   r:   __repr__  s   zAccessRule.__repr__c                 C   s   |d u rdS | j |j kS )NF)__dict__r7   otherr9   r9   r:   __eq__  s   zAccessRule.__eq__c                 C   s
   | |k S rU   r9   rX   r9   r9   r:   __ne__  s   
zAccessRule.__ne__N)(__name__
__module____qualname____doc__ZACTION_ALLOWZACTION_DETECTZACTION_BLOCKZACTION_BYPASSZACTION_REDIRECTZACTION_SHOW_CAPTCHAZBLOCK_ACTION_SET_RESPONSE_CODEZBLOCK_ACTION_SHOW_ERROR_PAGEZBYPASS_CHALLENGES_JS_CHALLENGEZ.BYPASS_CHALLENGES_DEVICE_FINGERPRINT_CHALLENGEZ-BYPASS_CHALLENGES_HUMAN_INTERACTION_CHALLENGEZBYPASS_CHALLENGES_CAPTCHAZ(REDIRECT_RESPONSE_CODE_MOVED_PERMANENTLYZREDIRECT_RESPONSE_CODE_FOUNDr;   propertyr   setterr   r   r   r   r   r   r   r   r    r!   r"   r#   r$   r%   r&   rV   rZ   r[   r9   r9   r9   r:   r      s     































r   N)Zoci.utilr   r   r   Zoci.decoratorsr   objectr   r9   r9   r9   r:   <module>   s   