o
    ɶdEh                     @   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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d.d/ Zejd0d/ Zed1d2 Zejd3d2 Zed4d5 Zejd6d5 Zd7d8 Z d9d: Z!d;d< Z"d=S )>ProtectionSettingsz1
    The settings used for protection rules.
    SHOW_ERROR_PAGESET_RESPONSE_CODEOPTIONSGETHEADPOSTPUTDELETETRACECONNECTPATCHPROPFINDc                 K   s   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 )a  
        Initializes a new ProtectionSettings object with values from keyword arguments.
        The following keyword arguments are supported (corresponding to the getters/setters of this class):

        :param block_action:
            The value to assign to the block_action property of this ProtectionSettings.
            Allowed values for this property are: "SHOW_ERROR_PAGE", "SET_RESPONSE_CODE", '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 ProtectionSettings.
        :type block_response_code: int

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

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

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

        :param max_argument_count:
            The value to assign to the max_argument_count property of this ProtectionSettings.
        :type max_argument_count: int

        :param max_name_length_per_argument:
            The value to assign to the max_name_length_per_argument property of this ProtectionSettings.
        :type max_name_length_per_argument: int

        :param max_total_name_length_of_arguments:
            The value to assign to the max_total_name_length_of_arguments property of this ProtectionSettings.
        :type max_total_name_length_of_arguments: int

        :param recommendations_period_in_days:
            The value to assign to the recommendations_period_in_days property of this ProtectionSettings.
        :type recommendations_period_in_days: int

        :param is_response_inspected:
            The value to assign to the is_response_inspected property of this ProtectionSettings.
        :type is_response_inspected: bool

        :param max_response_size_in_ki_b:
            The value to assign to the max_response_size_in_ki_b property of this ProtectionSettings.
        :type max_response_size_in_ki_b: int

        :param allowed_http_methods:
            The value to assign to the allowed_http_methods property of this ProtectionSettings.
            Allowed values for items in this list are: "OPTIONS", "GET", "HEAD", "POST", "PUT", "DELETE", "TRACE", "CONNECT", "PATCH", "PROPFIND", 'UNKNOWN_ENUM_VALUE'.
            Any unrecognized values returned by a service will be mapped to 'UNKNOWN_ENUM_VALUE'.
        :type allowed_http_methods: list[str]

        :param media_types:
            The value to assign to the media_types property of this ProtectionSettings.
        :type media_types: list[str]

        strintboolz	list[str])block_actionblock_response_codeblock_error_page_messageblock_error_page_codeblock_error_page_descriptionmax_argument_countmax_name_length_per_argument"max_total_name_length_of_argumentsrecommendations_period_in_daysis_response_inspectedmax_response_size_in_ki_ballowed_http_methodsmedia_typesZblockActionZblockResponseCodeZblockErrorPageMessageZblockErrorPageCodeZblockErrorPageDescriptionZmaxArgumentCountZmaxNameLengthPerArgumentZmaxTotalNameLengthOfArgumentsZrecommendationsPeriodInDaysZisResponseInspectedZmaxResponseSizeInKiBZallowedHttpMethodsZ
mediaTypesN)Zswagger_typesZattribute_map_block_action_block_response_code_block_error_page_message_block_error_page_code_block_error_page_description_max_argument_count_max_name_length_per_argument#_max_total_name_length_of_arguments_recommendations_period_in_days_is_response_inspected_max_response_size_in_ki_b_allowed_http_methods_media_types)selfkwargs r2   Gusr/lib/python3.10/site-packages/oci/waas/models/protection_settings.py__init__B   sR   ?
zProtectionSettings.__init__c                 C      | j S )a  
        Gets the block_action of this ProtectionSettings.
        If `action` is set to `BLOCK`, this specifies how the traffic is blocked when detected as malicious by a protection rule. If unspecified, defaults to `SET_RESPONSE_CODE`.

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


        :return: The block_action of this ProtectionSettings.
        :rtype: str
        )r#   r0   r2   r2   r3   r         zProtectionSettings.block_actionc                 C   s    ddg}t ||sd}|| _dS )aU  
        Sets the block_action of this ProtectionSettings.
        If `action` is set to `BLOCK`, this specifies how the traffic is blocked when detected as malicious by a protection rule. If unspecified, defaults to `SET_RESPONSE_CODE`.


        :param block_action: The block_action of this ProtectionSettings.
        :type: str
        r   r   UNKNOWN_ENUM_VALUEN)r   r#   )r0   r   allowed_valuesr2   r2   r3   r      s   


c                 C   r5   )a  
        Gets the block_response_code of this ProtectionSettings.
        The response code returned when `action` is set to `BLOCK`, `blockAction` is set to `SET_RESPONSE_CODE`, and the traffic is detected as malicious by a protection rule. If unspecified, defaults to `403`. The list of available response codes: `400`, `401`, `403`, `405`, `409`, `411`, `412`, `413`, `414`, `415`, `416`, `500`, `501`, `502`, `503`, `504`, `507`.


        :return: The block_response_code of this ProtectionSettings.
        :rtype: int
        r$   r6   r2   r2   r3   r         
z&ProtectionSettings.block_response_codec                 C   
   || _ dS )a'  
        Sets the block_response_code of this ProtectionSettings.
        The response code returned when `action` is set to `BLOCK`, `blockAction` is set to `SET_RESPONSE_CODE`, and the traffic is detected as malicious by a protection rule. If unspecified, defaults to `403`. The list of available response codes: `400`, `401`, `403`, `405`, `409`, `411`, `412`, `413`, `414`, `415`, `416`, `500`, `501`, `502`, `503`, `504`, `507`.


        :param block_response_code: The block_response_code of this ProtectionSettings.
        :type: int
        Nr:   )r0   r   r2   r2   r3   r         

c                 C   r5   )a  
        Gets the block_error_page_message of this ProtectionSettings.
        The message to show on the error page when `action` is set to `BLOCK`, `blockAction` is set to `SHOW_ERROR_PAGE`, and the traffic is detected as malicious by a protection rule. If unspecified, defaults to 'Access to the website is blocked.'


        :return: The block_error_page_message of this ProtectionSettings.
        :rtype: str
        r%   r6   r2   r2   r3   r      r;   z+ProtectionSettings.block_error_page_messagec                 C   r<   )a  
        Sets the block_error_page_message of this ProtectionSettings.
        The message to show on the error page when `action` is set to `BLOCK`, `blockAction` is set to `SHOW_ERROR_PAGE`, and the traffic is detected as malicious by a protection rule. If unspecified, defaults to 'Access to the website is blocked.'


        :param block_error_page_message: The block_error_page_message of this ProtectionSettings.
        :type: str
        Nr>   )r0   r   r2   r2   r3   r      r=   c                 C   r5   )a  
        Gets the block_error_page_code of this ProtectionSettings.
        The error code to show on the error page when `action` is set to `BLOCK`, `blockAction` is set to `SHOW_ERROR_PAGE`, and the traffic is detected as malicious by a protection rule. If unspecified, defaults to `403`.


        :return: The block_error_page_code of this ProtectionSettings.
        :rtype: str
        r&   r6   r2   r2   r3   r      r;   z(ProtectionSettings.block_error_page_codec                 C   r<   )a  
        Sets the block_error_page_code of this ProtectionSettings.
        The error code to show on the error page when `action` is set to `BLOCK`, `blockAction` is set to `SHOW_ERROR_PAGE`, and the traffic is detected as malicious by a protection rule. If unspecified, defaults to `403`.


        :param block_error_page_code: The block_error_page_code of this ProtectionSettings.
        :type: str
        Nr?   )r0   r   r2   r2   r3   r     r=   c                 C   r5   )a  
        Gets the block_error_page_description of this ProtectionSettings.
        The description text to show on the error page when `action` is set to `BLOCK`, `blockAction` is set to `SHOW_ERROR_PAGE`, and the traffic is detected as malicious by a protection rule. If unspecified, defaults to `Access blocked by website owner. Please contact support.`


        :return: The block_error_page_description of this ProtectionSettings.
        :rtype: str
        r'   r6   r2   r2   r3   r     r;   z/ProtectionSettings.block_error_page_descriptionc                 C   r<   )a  
        Sets the block_error_page_description of this ProtectionSettings.
        The description text to show on the error page when `action` is set to `BLOCK`, `blockAction` is set to `SHOW_ERROR_PAGE`, and the traffic is detected as malicious by a protection rule. If unspecified, defaults to `Access blocked by website owner. Please contact support.`


        :param block_error_page_description: The block_error_page_description of this ProtectionSettings.
        :type: str
        Nr@   )r0   r   r2   r2   r3   r      r=   c                 C   r5   )a7  
        Gets the max_argument_count of this ProtectionSettings.
        The maximum number of arguments allowed to be passed to your application before an action is taken. Arguements are query parameters or body parameters in a PUT or POST request. If unspecified, defaults to `255`. This setting only applies if a corresponding protection rule is enabled, such as the "Number of Arguments Limits" rule (key: 960335).

        Example: If `maxArgumentCount` to `2` for the Max Number of Arguments protection rule (key: 960335), the following requests would be blocked:
        `GET /myapp/path?query=one&query=two&query=three`
        `POST /myapp/path` with Body `{"argument1":"one","argument2":"two","argument3":"three"}`


        :return: The max_argument_count of this ProtectionSettings.
        :rtype: int
        r(   r6   r2   r2   r3   r   ,  s   z%ProtectionSettings.max_argument_countc                 C   r<   )aH  
        Sets the max_argument_count of this ProtectionSettings.
        The maximum number of arguments allowed to be passed to your application before an action is taken. Arguements are query parameters or body parameters in a PUT or POST request. If unspecified, defaults to `255`. This setting only applies if a corresponding protection rule is enabled, such as the "Number of Arguments Limits" rule (key: 960335).

        Example: If `maxArgumentCount` to `2` for the Max Number of Arguments protection rule (key: 960335), the following requests would be blocked:
        `GET /myapp/path?query=one&query=two&query=three`
        `POST /myapp/path` with Body `{"argument1":"one","argument2":"two","argument3":"three"}`


        :param max_argument_count: The max_argument_count of this ProtectionSettings.
        :type: int
        NrA   )r0   r   r2   r2   r3   r   <  s   
c                 C   r5   )a  
        Gets the max_name_length_per_argument of this ProtectionSettings.
        The maximum length allowed for each argument name, in characters. Arguements are query parameters or body parameters in a PUT or POST request. If unspecified, defaults to `400`. This setting only applies if a corresponding protection rule is enabled, such as the "Values Limits" rule (key: 960208).


        :return: The max_name_length_per_argument of this ProtectionSettings.
        :rtype: int
        r)   r6   r2   r2   r3   r   L  r;   z/ProtectionSettings.max_name_length_per_argumentc                 C   r<   )a  
        Sets the max_name_length_per_argument of this ProtectionSettings.
        The maximum length allowed for each argument name, in characters. Arguements are query parameters or body parameters in a PUT or POST request. If unspecified, defaults to `400`. This setting only applies if a corresponding protection rule is enabled, such as the "Values Limits" rule (key: 960208).


        :param max_name_length_per_argument: The max_name_length_per_argument of this ProtectionSettings.
        :type: int
        NrB   )r0   r   r2   r2   r3   r   X  r=   c                 C   r5   )a  
        Gets the max_total_name_length_of_arguments of this ProtectionSettings.
        The maximum length allowed for the sum of the argument name and value, in characters. Arguements are query parameters or body parameters in a PUT or POST request. If unspecified, defaults to `64000`. This setting only applies if a corresponding protection rule is enabled, such as the "Total Arguments Limits" rule (key: 960341).


        :return: The max_total_name_length_of_arguments of this ProtectionSettings.
        :rtype: int
        r*   r6   r2   r2   r3   r   d  r;   z5ProtectionSettings.max_total_name_length_of_argumentsc                 C   r<   )a6  
        Sets the max_total_name_length_of_arguments of this ProtectionSettings.
        The maximum length allowed for the sum of the argument name and value, in characters. Arguements are query parameters or body parameters in a PUT or POST request. If unspecified, defaults to `64000`. This setting only applies if a corresponding protection rule is enabled, such as the "Total Arguments Limits" rule (key: 960341).


        :param max_total_name_length_of_arguments: The max_total_name_length_of_arguments of this ProtectionSettings.
        :type: int
        NrC   )r0   r   r2   r2   r3   r   p  r=   c                 C   r5   )a  
        Gets the recommendations_period_in_days of this ProtectionSettings.
        The length of time to analyze traffic traffic, in days. After the analysis period, `WafRecommendations` will be populated. If unspecified, defaults to `10`.

        Use `GET /waasPolicies/{waasPolicyId}/wafRecommendations` to view WAF recommendations.


        :return: The recommendations_period_in_days of this ProtectionSettings.
        :rtype: int
        r+   r6   r2   r2   r3   r   |     z1ProtectionSettings.recommendations_period_in_daysc                 C   r<   )a  
        Sets the recommendations_period_in_days of this ProtectionSettings.
        The length of time to analyze traffic traffic, in days. After the analysis period, `WafRecommendations` will be populated. If unspecified, defaults to `10`.

        Use `GET /waasPolicies/{waasPolicyId}/wafRecommendations` to view WAF recommendations.


        :param recommendations_period_in_days: The recommendations_period_in_days of this ProtectionSettings.
        :type: int
        NrD   )r0   r   r2   r2   r3   r        
c                 C   r5   )a  
        Gets the is_response_inspected of this ProtectionSettings.
        Inspects the response body of origin responses. Can be used to detect leakage of sensitive data. If unspecified, defaults to `false`.

        **Note:** Only origin responses with a Content-Type matching a value in `mediaTypes` will be inspected.


        :return: The is_response_inspected of this ProtectionSettings.
        :rtype: bool
        r,   r6   r2   r2   r3   r     rE   z(ProtectionSettings.is_response_inspectedc                 C   r<   )a  
        Sets the is_response_inspected of this ProtectionSettings.
        Inspects the response body of origin responses. Can be used to detect leakage of sensitive data. If unspecified, defaults to `false`.

        **Note:** Only origin responses with a Content-Type matching a value in `mediaTypes` will be inspected.


        :param is_response_inspected: The is_response_inspected of this ProtectionSettings.
        :type: bool
        NrG   )r0   r   r2   r2   r3   r     rF   c                 C   r5   )a_  
        Gets the max_response_size_in_ki_b of this ProtectionSettings.
        The maximum response size to be fully inspected, in binary kilobytes (KiB). Anything over this limit will be partially inspected. If unspecified, defaults to `1024`.


        :return: The max_response_size_in_ki_b of this ProtectionSettings.
        :rtype: int
        r-   r6   r2   r2   r3   r      r;   z,ProtectionSettings.max_response_size_in_ki_bc                 C   r<   )aw  
        Sets the max_response_size_in_ki_b of this ProtectionSettings.
        The maximum response size to be fully inspected, in binary kilobytes (KiB). Anything over this limit will be partially inspected. If unspecified, defaults to `1024`.


        :param max_response_size_in_ki_b: The max_response_size_in_ki_b of this ProtectionSettings.
        :type: int
        NrH   )r0   r    r2   r2   r3   r      r=   c                 C   r5   )a  
        Gets the allowed_http_methods of this ProtectionSettings.
        The list of allowed HTTP methods. If unspecified, default to `[OPTIONS, GET, HEAD, POST]`. This setting only applies if a corresponding protection rule is enabled, such as the "Restrict HTTP Request Methods" rule (key: 911100).

        Allowed values for items in this list are: "OPTIONS", "GET", "HEAD", "POST", "PUT", "DELETE", "TRACE", "CONNECT", "PATCH", "PROPFIND", 'UNKNOWN_ENUM_VALUE'.
        Any unrecognized values returned by a service will be mapped to 'UNKNOWN_ENUM_VALUE'.


        :return: The allowed_http_methods of this ProtectionSettings.
        :rtype: list[str]
        r.   r6   r2   r2   r3   r!     r7   z'ProtectionSettings.allowed_http_methodsc                    s0   g d |r fdd|D |dd< || _ dS )a  
        Sets the allowed_http_methods of this ProtectionSettings.
        The list of allowed HTTP methods. If unspecified, default to `[OPTIONS, GET, HEAD, POST]`. This setting only applies if a corresponding protection rule is enabled, such as the "Restrict HTTP Request Methods" rule (key: 911100).


        :param allowed_http_methods: The allowed_http_methods of this ProtectionSettings.
        :type: list[str]
        )
r	   r
   r   r   r   r   r   r   r   r   c                    s   g | ]}t | sd n|qS )r8   )r   ).0xr9   r2   r3   
<listcomp>  s    z;ProtectionSettings.allowed_http_methods.<locals>.<listcomp>NrI   )r0   r!   r2   rL   r3   r!     s   

c                 C   r5   )a  
        Gets the media_types of this ProtectionSettings.
        The list of media types to allow for inspection, if `isResponseInspected` is enabled. Only responses with MIME types in this list will be inspected. If unspecified, defaults to `["text/html", "text/plain", "text/xml"]`.

            Supported MIME types include:

            - text/html
            - text/plain
            - text/asp
            - text/css
            - text/x-script
            - application/json
            - text/webviewhtml
            - text/x-java-source
            - application/x-javascript
            - application/javascript
            - application/ecmascript
            - text/javascript
            - text/ecmascript
            - text/x-script.perl
            - text/x-script.phyton
            - application/plain
            - application/xml
            - text/xml


        :return: The media_types of this ProtectionSettings.
        :rtype: list[str]
        r/   r6   r2   r2   r3   r"     s   zProtectionSettings.media_typesc                 C   r<   )a  
        Sets the media_types of this ProtectionSettings.
        The list of media types to allow for inspection, if `isResponseInspected` is enabled. Only responses with MIME types in this list will be inspected. If unspecified, defaults to `["text/html", "text/plain", "text/xml"]`.

            Supported MIME types include:

            - text/html
            - text/plain
            - text/asp
            - text/css
            - text/x-script
            - application/json
            - text/webviewhtml
            - text/x-java-source
            - application/x-javascript
            - application/javascript
            - application/ecmascript
            - text/javascript
            - text/ecmascript
            - text/x-script.perl
            - text/x-script.phyton
            - application/plain
            - application/xml
            - text/xml


        :param media_types: The media_types of this ProtectionSettings.
        :type: list[str]
        NrN   )r0   r"   r2   r2   r3   r"     s   
c                 C   s   t | S N)r   r6   r2   r2   r3   __repr__,  s   zProtectionSettings.__repr__c                 C   s   |d u rdS | j |j kS )NF)__dict__r0   otherr2   r2   r3   __eq__/  s   zProtectionSettings.__eq__c                 C   s
   | |k S rO   r2   rR   r2   r2   r3   __ne__5  s   
zProtectionSettings.__ne__N)#__name__
__module____qualname____doc__ZBLOCK_ACTION_SHOW_ERROR_PAGEZBLOCK_ACTION_SET_RESPONSE_CODEZALLOWED_HTTP_METHODS_OPTIONSZALLOWED_HTTP_METHODS_GETZALLOWED_HTTP_METHODS_HEADZALLOWED_HTTP_METHODS_POSTZALLOWED_HTTP_METHODS_PUTZALLOWED_HTTP_METHODS_DELETEZALLOWED_HTTP_METHODS_TRACEZALLOWED_HTTP_METHODS_CONNECTZALLOWED_HTTP_METHODS_PATCHZALLOWED_HTTP_METHODS_PROPFINDr4   propertyr   setterr   r   r   r   r   r   r   r   r   r    r!   r"   rP   rT   rU   r2   r2   r2   r3   r      s    l
























 
 r   N)Zoci.utilr   r   r   Zoci.decoratorsr   objectr   r2   r2   r2   r3   <module>   s   