# Path: ndscheduler/corescheduler/job.py
# class JobBase:
#     def __init__(self, job_id, execution_id):
#     def create_test_instance(cls):
#     def get_scheduled_description(cls):
#     def get_scheduled_error_description(cls):
#     def get_running_description(cls):
#     def get_failed_description(cls):
#     def get_succeeded_description(cls, result=None):
#     def get_scheduled_error_result(cls):
#     def get_failed_result(cls):
#     def meta_info(cls):
#     def run_job(cls, job_id, execution_id, *args, **kwargs):
#     def run(self, *args, **kwargs):


import logging
import requests
from ndscheduler.corescheduler import job
    def meta_info(cls):
        return {
            'job_class_string': '%s.%s' % (cls.__module__, cls.__name__),
            'notes': 'This sends a HTTP request to a particular URL',
            'arguments': [
                # url
                {'type': 'string', 'description': 'What URL you want to make a GET call?'},
                # Request Type
                {'type': 'string', 'description': 'What request type do you want? '
                                                  '(currently supported: GET/DELETE)'},

            ],
            'example_arguments': ('["http://localhost:8888/api/v1/jobs", "GET"]'
                                  '["http://localhost:8888/api/v1/jobs/ba12e", "DELETE"]')
        }

    def run(self, url, request_type,  *args, **kwargs):
        print('Calling GET on url: %s' % (url))

        session = requests.Session()
        result = session.request(request_type,
                                 url,
                                 timeout=self.TIMEOUT,
                                 headers=None,
                                 data=None)
        return result.text


if __name__ == "__main__":
    job = CurlJob.create_test_instance()

# Path: ndscheduler/corescheduler/job.py
# class JobBase:
#     def __init__(self, job_id, execution_id):
#     def create_test_instance(cls):
#     def get_scheduled_description(cls):
#     def get_scheduled_error_description(cls):
#     def get_running_description(cls):
#     def get_failed_description(cls):
#     def get_succeeded_description(cls, result=None):
#     def get_scheduled_error_result(cls):
#     def get_failed_result(cls):
#     def meta_info(cls):
#     def run_job(cls, job_id, execution_id, *args, **kwargs):
#     def run(self, *args, **kwargs):


# Path: simple_scheduler/jobs/curl_job.py
import logging
import requests
from ndscheduler.corescheduler import job

    def meta_info(cls):
        return {
            'job_class_string': '%s.%s' % (cls.__module__, cls.__name__),
            'notes': 'This sends a HTTP request to a particular URL',
            'arguments': [
                # url
                {'type': 'string', 'description': 'What URL you want to make a GET call?'},
                # Request Type
                {'type': 'string', 'description': 'What request type do you want? '
                                                  '(currently supported: GET/DELETE)'},

            ],
            'example_arguments': ('["http://localhost:8888/api/v1/jobs", "GET"]'
                                  '["http://localhost:8888/api/v1/jobs/ba12e", "DELETE"]')
        }

    def run(self, url, request_type,  *args, **kwargs):
        print('Calling GET on url: %s' % (url))

        session = requests.Session()
        result = session.request(request_type,
                                 url,
                                 timeout=self.TIMEOUT,
                                 headers=None,
                                 data=None)
        return result.text


if __name__ == "__main__":
    job = CurlJob.create_test_instance()

    job.run('http://localhost:888/api/v1/jobs')