# coding: utf-8

"""
    securityapi

    The security APIs help you detect and block security threats.  # noqa: E501

    OpenAPI spec version: v1
    
    Generated by: https://github.com/swagger-api/swagger-codegen.git
"""


from __future__ import absolute_import

import re  # noqa: F401

# python 2 and python 3 compatibility library
import six

from cloudmersive_security_api_client.api_client import ApiClient


class NetworkThreatDetectionApi(object):
    """NOTE: This class is auto generated by the swagger code generator program.

    Do not edit the class manually.
    Ref: https://github.com/swagger-api/swagger-codegen
    """

    def __init__(self, api_client=None):
        if api_client is None:
            api_client = ApiClient()
        self.api_client = api_client

    def network_threat_detection_detect_ssrf_url(self, request, **kwargs):  # noqa: E501
        """Check a URL for Server-side Request Forgery (SSRF) threats  # noqa: E501

        Checks if an input URL is at risk of being an SSRF (Server-side request forgery) threat or attack.  # noqa: E501
        This method makes a synchronous HTTP request by default. To make an
        asynchronous HTTP request, please pass async_req=True
        >>> thread = api.network_threat_detection_detect_ssrf_url(request, async_req=True)
        >>> result = thread.get()

        :param async_req bool
        :param UrlSsrfThreatDetectionRequestFull request: Input URL request (required)
        :return: UrlSsrfThreatDetectionResponseFull
                 If the method is called asynchronously,
                 returns the request thread.
        """
        kwargs['_return_http_data_only'] = True
        if kwargs.get('async_req'):
            return self.network_threat_detection_detect_ssrf_url_with_http_info(request, **kwargs)  # noqa: E501
        else:
            (data) = self.network_threat_detection_detect_ssrf_url_with_http_info(request, **kwargs)  # noqa: E501
            return data

    def network_threat_detection_detect_ssrf_url_with_http_info(self, request, **kwargs):  # noqa: E501
        """Check a URL for Server-side Request Forgery (SSRF) threats  # noqa: E501

        Checks if an input URL is at risk of being an SSRF (Server-side request forgery) threat or attack.  # noqa: E501
        This method makes a synchronous HTTP request by default. To make an
        asynchronous HTTP request, please pass async_req=True
        >>> thread = api.network_threat_detection_detect_ssrf_url_with_http_info(request, async_req=True)
        >>> result = thread.get()

        :param async_req bool
        :param UrlSsrfThreatDetectionRequestFull request: Input URL request (required)
        :return: UrlSsrfThreatDetectionResponseFull
                 If the method is called asynchronously,
                 returns the request thread.
        """

        all_params = ['request']  # noqa: E501
        all_params.append('async_req')
        all_params.append('_return_http_data_only')
        all_params.append('_preload_content')
        all_params.append('_request_timeout')

        params = locals()
        for key, val in six.iteritems(params['kwargs']):
            if key not in all_params:
                raise TypeError(
                    "Got an unexpected keyword argument '%s'"
                    " to method network_threat_detection_detect_ssrf_url" % key
                )
            params[key] = val
        del params['kwargs']
        # verify the required parameter 'request' is set
        if ('request' not in params or
                params['request'] is None):
            raise ValueError("Missing the required parameter `request` when calling `network_threat_detection_detect_ssrf_url`")  # noqa: E501

        collection_formats = {}

        path_params = {}

        query_params = []

        header_params = {}

        form_params = []
        local_var_files = {}

        body_params = None
        if 'request' in params:
            body_params = params['request']
        # HTTP header `Accept`
        header_params['Accept'] = self.api_client.select_header_accept(
            ['application/json', 'text/json', 'application/xml', 'text/xml'])  # noqa: E501

        # HTTP header `Content-Type`
        header_params['Content-Type'] = self.api_client.select_header_content_type(  # noqa: E501
            ['application/json', 'text/json'])  # noqa: E501

        # Authentication setting
        auth_settings = ['Apikey']  # noqa: E501

        return self.api_client.call_api(
            '/security/threat-detection/network/url/ssrf/detect', 'POST',
            path_params,
            query_params,
            header_params,
            body=body_params,
            post_params=form_params,
            files=local_var_files,
            response_type='UrlSsrfThreatDetectionResponseFull',  # noqa: E501
            auth_settings=auth_settings,
            async_req=params.get('async_req'),
            _return_http_data_only=params.get('_return_http_data_only'),
            _preload_content=params.get('_preload_content', True),
            _request_timeout=params.get('_request_timeout'),
            collection_formats=collection_formats)

    def network_threat_detection_is_bot(self, value, **kwargs):  # noqa: E501
        """Check if IP address is a Bot client threat  # noqa: E501

        Check if the input IP address is a Bot, robot, or otherwise a non-user entity.  Leverages real-time signals to check against known high-probability bots..  # noqa: E501
        This method makes a synchronous HTTP request by default. To make an
        asynchronous HTTP request, please pass async_req=True
        >>> thread = api.network_threat_detection_is_bot(value, async_req=True)
        >>> result = thread.get()

        :param async_req bool
        :param str value: IP address to check, e.g. \"55.55.55.55\".  The input is a string so be sure to enclose it in double-quotes. (required)
        :return: ThreatDetectionBotCheckResponse
                 If the method is called asynchronously,
                 returns the request thread.
        """
        kwargs['_return_http_data_only'] = True
        if kwargs.get('async_req'):
            return self.network_threat_detection_is_bot_with_http_info(value, **kwargs)  # noqa: E501
        else:
            (data) = self.network_threat_detection_is_bot_with_http_info(value, **kwargs)  # noqa: E501
            return data

    def network_threat_detection_is_bot_with_http_info(self, value, **kwargs):  # noqa: E501
        """Check if IP address is a Bot client threat  # noqa: E501

        Check if the input IP address is a Bot, robot, or otherwise a non-user entity.  Leverages real-time signals to check against known high-probability bots..  # noqa: E501
        This method makes a synchronous HTTP request by default. To make an
        asynchronous HTTP request, please pass async_req=True
        >>> thread = api.network_threat_detection_is_bot_with_http_info(value, async_req=True)
        >>> result = thread.get()

        :param async_req bool
        :param str value: IP address to check, e.g. \"55.55.55.55\".  The input is a string so be sure to enclose it in double-quotes. (required)
        :return: ThreatDetectionBotCheckResponse
                 If the method is called asynchronously,
                 returns the request thread.
        """

        all_params = ['value']  # noqa: E501
        all_params.append('async_req')
        all_params.append('_return_http_data_only')
        all_params.append('_preload_content')
        all_params.append('_request_timeout')

        params = locals()
        for key, val in six.iteritems(params['kwargs']):
            if key not in all_params:
                raise TypeError(
                    "Got an unexpected keyword argument '%s'"
                    " to method network_threat_detection_is_bot" % key
                )
            params[key] = val
        del params['kwargs']
        # verify the required parameter 'value' is set
        if ('value' not in params or
                params['value'] is None):
            raise ValueError("Missing the required parameter `value` when calling `network_threat_detection_is_bot`")  # noqa: E501

        collection_formats = {}

        path_params = {}

        query_params = []

        header_params = {}

        form_params = []
        local_var_files = {}

        body_params = None
        if 'value' in params:
            body_params = params['value']
        # HTTP header `Accept`
        header_params['Accept'] = self.api_client.select_header_accept(
            ['application/json', 'text/json', 'application/xml', 'text/xml'])  # noqa: E501

        # HTTP header `Content-Type`
        header_params['Content-Type'] = self.api_client.select_header_content_type(  # noqa: E501
            ['application/json', 'text/json'])  # noqa: E501

        # Authentication setting
        auth_settings = ['Apikey']  # noqa: E501

        return self.api_client.call_api(
            '/security/threat-detection/network/ip/is-bot', 'POST',
            path_params,
            query_params,
            header_params,
            body=body_params,
            post_params=form_params,
            files=local_var_files,
            response_type='ThreatDetectionBotCheckResponse',  # noqa: E501
            auth_settings=auth_settings,
            async_req=params.get('async_req'),
            _return_http_data_only=params.get('_return_http_data_only'),
            _preload_content=params.get('_preload_content', True),
            _request_timeout=params.get('_request_timeout'),
            collection_formats=collection_formats)

    def network_threat_detection_is_threat(self, value, **kwargs):  # noqa: E501
        """Check if IP address is a known threat  # noqa: E501

        Check if the input IP address is a known threat IP address.  Checks against known bad IPs, botnets, compromised servers, and other lists of threats.  # noqa: E501
        This method makes a synchronous HTTP request by default. To make an
        asynchronous HTTP request, please pass async_req=True
        >>> thread = api.network_threat_detection_is_threat(value, async_req=True)
        >>> result = thread.get()

        :param async_req bool
        :param str value: IP address to check, e.g. \"55.55.55.55\".  The input is a string so be sure to enclose it in double-quotes. (required)
        :return: IPThreatDetectionResponse
                 If the method is called asynchronously,
                 returns the request thread.
        """
        kwargs['_return_http_data_only'] = True
        if kwargs.get('async_req'):
            return self.network_threat_detection_is_threat_with_http_info(value, **kwargs)  # noqa: E501
        else:
            (data) = self.network_threat_detection_is_threat_with_http_info(value, **kwargs)  # noqa: E501
            return data

    def network_threat_detection_is_threat_with_http_info(self, value, **kwargs):  # noqa: E501
        """Check if IP address is a known threat  # noqa: E501

        Check if the input IP address is a known threat IP address.  Checks against known bad IPs, botnets, compromised servers, and other lists of threats.  # noqa: E501
        This method makes a synchronous HTTP request by default. To make an
        asynchronous HTTP request, please pass async_req=True
        >>> thread = api.network_threat_detection_is_threat_with_http_info(value, async_req=True)
        >>> result = thread.get()

        :param async_req bool
        :param str value: IP address to check, e.g. \"55.55.55.55\".  The input is a string so be sure to enclose it in double-quotes. (required)
        :return: IPThreatDetectionResponse
                 If the method is called asynchronously,
                 returns the request thread.
        """

        all_params = ['value']  # noqa: E501
        all_params.append('async_req')
        all_params.append('_return_http_data_only')
        all_params.append('_preload_content')
        all_params.append('_request_timeout')

        params = locals()
        for key, val in six.iteritems(params['kwargs']):
            if key not in all_params:
                raise TypeError(
                    "Got an unexpected keyword argument '%s'"
                    " to method network_threat_detection_is_threat" % key
                )
            params[key] = val
        del params['kwargs']
        # verify the required parameter 'value' is set
        if ('value' not in params or
                params['value'] is None):
            raise ValueError("Missing the required parameter `value` when calling `network_threat_detection_is_threat`")  # noqa: E501

        collection_formats = {}

        path_params = {}

        query_params = []

        header_params = {}

        form_params = []
        local_var_files = {}

        body_params = None
        if 'value' in params:
            body_params = params['value']
        # HTTP header `Accept`
        header_params['Accept'] = self.api_client.select_header_accept(
            ['application/json', 'text/json', 'application/xml', 'text/xml'])  # noqa: E501

        # HTTP header `Content-Type`
        header_params['Content-Type'] = self.api_client.select_header_content_type(  # noqa: E501
            ['application/json', 'text/json'])  # noqa: E501

        # Authentication setting
        auth_settings = ['Apikey']  # noqa: E501

        return self.api_client.call_api(
            '/security/threat-detection/network/ip/is-threat', 'POST',
            path_params,
            query_params,
            header_params,
            body=body_params,
            post_params=form_params,
            files=local_var_files,
            response_type='IPThreatDetectionResponse',  # noqa: E501
            auth_settings=auth_settings,
            async_req=params.get('async_req'),
            _return_http_data_only=params.get('_return_http_data_only'),
            _preload_content=params.get('_preload_content', True),
            _request_timeout=params.get('_request_timeout'),
            collection_formats=collection_formats)

    def network_threat_detection_is_tor_node(self, value, **kwargs):  # noqa: E501
        """Check if IP address is a Tor node server  # noqa: E501

        Check if the input IP address is a Tor exit node server.  Tor servers are a type of privacy-preserving technology that can hide the original IP address who makes a request.  # noqa: E501
        This method makes a synchronous HTTP request by default. To make an
        asynchronous HTTP request, please pass async_req=True
        >>> thread = api.network_threat_detection_is_tor_node(value, async_req=True)
        >>> result = thread.get()

        :param async_req bool
        :param str value: IP address to check, e.g. \"55.55.55.55\".  The input is a string so be sure to enclose it in double-quotes. (required)
        :return: ThreatDetectionTorNodeResponse
                 If the method is called asynchronously,
                 returns the request thread.
        """
        kwargs['_return_http_data_only'] = True
        if kwargs.get('async_req'):
            return self.network_threat_detection_is_tor_node_with_http_info(value, **kwargs)  # noqa: E501
        else:
            (data) = self.network_threat_detection_is_tor_node_with_http_info(value, **kwargs)  # noqa: E501
            return data

    def network_threat_detection_is_tor_node_with_http_info(self, value, **kwargs):  # noqa: E501
        """Check if IP address is a Tor node server  # noqa: E501

        Check if the input IP address is a Tor exit node server.  Tor servers are a type of privacy-preserving technology that can hide the original IP address who makes a request.  # noqa: E501
        This method makes a synchronous HTTP request by default. To make an
        asynchronous HTTP request, please pass async_req=True
        >>> thread = api.network_threat_detection_is_tor_node_with_http_info(value, async_req=True)
        >>> result = thread.get()

        :param async_req bool
        :param str value: IP address to check, e.g. \"55.55.55.55\".  The input is a string so be sure to enclose it in double-quotes. (required)
        :return: ThreatDetectionTorNodeResponse
                 If the method is called asynchronously,
                 returns the request thread.
        """

        all_params = ['value']  # noqa: E501
        all_params.append('async_req')
        all_params.append('_return_http_data_only')
        all_params.append('_preload_content')
        all_params.append('_request_timeout')

        params = locals()
        for key, val in six.iteritems(params['kwargs']):
            if key not in all_params:
                raise TypeError(
                    "Got an unexpected keyword argument '%s'"
                    " to method network_threat_detection_is_tor_node" % key
                )
            params[key] = val
        del params['kwargs']
        # verify the required parameter 'value' is set
        if ('value' not in params or
                params['value'] is None):
            raise ValueError("Missing the required parameter `value` when calling `network_threat_detection_is_tor_node`")  # noqa: E501

        collection_formats = {}

        path_params = {}

        query_params = []

        header_params = {}

        form_params = []
        local_var_files = {}

        body_params = None
        if 'value' in params:
            body_params = params['value']
        # HTTP header `Accept`
        header_params['Accept'] = self.api_client.select_header_accept(
            ['application/json', 'text/json', 'application/xml', 'text/xml'])  # noqa: E501

        # HTTP header `Content-Type`
        header_params['Content-Type'] = self.api_client.select_header_content_type(  # noqa: E501
            ['application/json', 'text/json'])  # noqa: E501

        # Authentication setting
        auth_settings = ['Apikey']  # noqa: E501

        return self.api_client.call_api(
            '/security/threat-detection/network/ip/is-tor-node', 'POST',
            path_params,
            query_params,
            header_params,
            body=body_params,
            post_params=form_params,
            files=local_var_files,
            response_type='ThreatDetectionTorNodeResponse',  # noqa: E501
            auth_settings=auth_settings,
            async_req=params.get('async_req'),
            _return_http_data_only=params.get('_return_http_data_only'),
            _preload_content=params.get('_preload_content', True),
            _request_timeout=params.get('_request_timeout'),
            collection_formats=collection_formats)
