from GeoHealthCheck.probe import Probe
[docs]class HttpGet(Probe):
    """
    Do HTTP GET Request, to poll/ping any Resource bare url.
    """
    NAME = 'HTTP GET Resource URL'
    DESCRIPTION = 'Simple HTTP GET on Resource URL'
    RESOURCE_TYPE = '*:*'
    REQUEST_METHOD = 'GET'
    CHECKS_AVAIL = {
        'GeoHealthCheck.plugins.check.checks.HttpStatusNoError': {
            'default': True
        },
        'GeoHealthCheck.plugins.check.checks.ContainsStrings': {},
        'GeoHealthCheck.plugins.check.checks.NotContainsStrings': {},
        'GeoHealthCheck.plugins.check.checks.HttpHasContentType': {}
    }
    """Checks avail""" 
[docs]class HttpGetQuery(HttpGet):
    """
    Do HTTP GET Request, to poll/ping any Resource bare url with query string.
    """
    NAME = 'HTTP GET Resource URL with query'
    DESCRIPTION = """
        HTTP GET Resource URL with
        ?query string to be user-supplied (without ?)
        """
    REQUEST_TEMPLATE = '?{query}'
    PARAM_DEFS = {
        'query': {
            'type': 'string',
            'description': 'The query string to add to request (without ?)',
            'default': None,
            'required': True
        }
    }
    """Param defs""" 
[docs]class HttpPost(HttpGet):
    """
    Do HTTP POST Request, to send POST request to
    Resource bare url with POST body.
    """
    NAME = 'HTTP POST Resource URL with body'
    DESCRIPTION = """
        HTTP POST to Resource URL with body
        content(-type) to be user-supplied
        """
    REQUEST_METHOD = 'POST'
    REQUEST_HEADERS = {'content-type': '{post_content_type}'}
    REQUEST_TEMPLATE = '{body}'
    PARAM_DEFS = {
        'body': {
            'type': 'string',
            'description': 'The post body to send',
            'default': None,
            'required': True
        },
        'content_type': {
            'type': 'string',
            'description': 'The post content type to send',
            'default': 'text/xml;charset=UTF-8',
            'required': True
        }
    }
    """Param defs"""