# coding: utf-8

"""
    Processing Project

    This is the api for the processing project backend.  # noqa: E501

    OpenAPI spec version: 1.0.0
    
    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 swagger_client.api_client import ApiClient


class ModelConfigurationsApi(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 create_configuration(self, **kwargs):  # noqa: E501
        """Creates a model configuration.  # noqa: E501

        Adds an item to the system  # noqa: E501
        This method makes a synchronous HTTP request by default. To make an
        asynchronous HTTP request, please pass async_req=True
        >>> thread = api.create_configuration(async_req=True)
        >>> result = thread.get()

        :param async_req bool
        :param ParamSet body: Model Configuration to add
        :return: ParamSetResponse
                 If the method is called asynchronously,
                 returns the request thread.
        """
        kwargs['_return_http_data_only'] = True
        if kwargs.get('async_req'):
            return self.create_configuration_with_http_info(**kwargs)  # noqa: E501
        else:
            (data) = self.create_configuration_with_http_info(**kwargs)  # noqa: E501
            return data

    def create_configuration_with_http_info(self, **kwargs):  # noqa: E501
        """Creates a model configuration.  # noqa: E501

        Adds an item to the system  # noqa: E501
        This method makes a synchronous HTTP request by default. To make an
        asynchronous HTTP request, please pass async_req=True
        >>> thread = api.create_configuration_with_http_info(async_req=True)
        >>> result = thread.get()

        :param async_req bool
        :param ParamSet body: Model Configuration to add
        :return: ParamSetResponse
                 If the method is called asynchronously,
                 returns the request thread.
        """

        all_params = ['body']  # 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 create_configuration" % key
                )
            params[key] = val
        del params['kwargs']

        collection_formats = {}

        path_params = {}

        query_params = []

        header_params = {}

        form_params = []
        local_var_files = {}

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

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

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

        return self.api_client.call_api(
            '/configuration', 'POST',
            path_params,
            query_params,
            header_params,
            body=body_params,
            post_params=form_params,
            files=local_var_files,
            response_type='ParamSetResponse',  # 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 download_configuration(self, configuration_id, **kwargs):  # noqa: E501
        """Retreive signed url to download binary  # noqa: E501

        In order to download the computer binary from S3, you need to get a signed url (as the bucket is private).   # noqa: E501
        This method makes a synchronous HTTP request by default. To make an
        asynchronous HTTP request, please pass async_req=True
        >>> thread = api.download_configuration(configuration_id, async_req=True)
        >>> result = thread.get()

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

    def download_configuration_with_http_info(self, configuration_id, **kwargs):  # noqa: E501
        """Retreive signed url to download binary  # noqa: E501

        In order to download the computer binary from S3, you need to get a signed url (as the bucket is private).   # noqa: E501
        This method makes a synchronous HTTP request by default. To make an
        asynchronous HTTP request, please pass async_req=True
        >>> thread = api.download_configuration_with_http_info(configuration_id, async_req=True)
        >>> result = thread.get()

        :param async_req bool
        :param str configuration_id: (required)
        :return: InlineResponse200
                 If the method is called asynchronously,
                 returns the request thread.
        """

        all_params = ['configuration_id']  # 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 download_configuration" % key
                )
            params[key] = val
        del params['kwargs']
        # verify the required parameter 'configuration_id' is set
        if ('configuration_id' not in params or
                params['configuration_id'] is None):
            raise ValueError("Missing the required parameter `configuration_id` when calling `download_configuration`")  # noqa: E501

        collection_formats = {}

        path_params = {}
        if 'configuration_id' in params:
            path_params['configurationId'] = params['configuration_id']  # noqa: E501

        query_params = []

        header_params = {}

        form_params = []
        local_var_files = {}

        body_params = None
        # HTTP header `Accept`
        header_params['Accept'] = self.api_client.select_header_accept(
            ['application/json'])  # noqa: E501

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

        return self.api_client.call_api(
            '/configuration/{configurationId}/download', 'GET',
            path_params,
            query_params,
            header_params,
            body=body_params,
            post_params=form_params,
            files=local_var_files,
            response_type='InlineResponse200',  # 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 get_configuration(self, configuration_id, **kwargs):  # noqa: E501
        """Returns a model configuration  # noqa: E501

        By passing in the appropriate options, you can search for available model configurations in the system   # noqa: E501
        This method makes a synchronous HTTP request by default. To make an
        asynchronous HTTP request, please pass async_req=True
        >>> thread = api.get_configuration(configuration_id, async_req=True)
        >>> result = thread.get()

        :param async_req bool
        :param str configuration_id: (required)
        :param str status_only: pass an optional statusOnly to just retun status for polling.
        :return: ParamSetResponse
                 If the method is called asynchronously,
                 returns the request thread.
        """
        kwargs['_return_http_data_only'] = True
        if kwargs.get('async_req'):
            return self.get_configuration_with_http_info(configuration_id, **kwargs)  # noqa: E501
        else:
            (data) = self.get_configuration_with_http_info(configuration_id, **kwargs)  # noqa: E501
            return data

    def get_configuration_with_http_info(self, configuration_id, **kwargs):  # noqa: E501
        """Returns a model configuration  # noqa: E501

        By passing in the appropriate options, you can search for available model configurations in the system   # noqa: E501
        This method makes a synchronous HTTP request by default. To make an
        asynchronous HTTP request, please pass async_req=True
        >>> thread = api.get_configuration_with_http_info(configuration_id, async_req=True)
        >>> result = thread.get()

        :param async_req bool
        :param str configuration_id: (required)
        :param str status_only: pass an optional statusOnly to just retun status for polling.
        :return: ParamSetResponse
                 If the method is called asynchronously,
                 returns the request thread.
        """

        all_params = ['configuration_id', 'status_only']  # 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 get_configuration" % key
                )
            params[key] = val
        del params['kwargs']
        # verify the required parameter 'configuration_id' is set
        if ('configuration_id' not in params or
                params['configuration_id'] is None):
            raise ValueError("Missing the required parameter `configuration_id` when calling `get_configuration`")  # noqa: E501

        collection_formats = {}

        path_params = {}
        if 'configuration_id' in params:
            path_params['configurationId'] = params['configuration_id']  # noqa: E501

        query_params = []
        if 'status_only' in params:
            query_params.append(('statusOnly', params['status_only']))  # noqa: E501

        header_params = {}

        form_params = []
        local_var_files = {}

        body_params = None
        # HTTP header `Accept`
        header_params['Accept'] = self.api_client.select_header_accept(
            ['application/json'])  # noqa: E501

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

        return self.api_client.call_api(
            '/configuration/{configurationId}', 'GET',
            path_params,
            query_params,
            header_params,
            body=body_params,
            post_params=form_params,
            files=local_var_files,
            response_type='ParamSetResponse',  # 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 get_configurations(self, **kwargs):  # noqa: E501
        """Returns all of a users model configurations.  # noqa: E501

        Grab all of a users model configurations. User identiy is grabbed from cookies or auth token.   # noqa: E501
        This method makes a synchronous HTTP request by default. To make an
        asynchronous HTTP request, please pass async_req=True
        >>> thread = api.get_configurations(async_req=True)
        >>> result = thread.get()

        :param async_req bool
        :return: list[ParamSetResponse]
                 If the method is called asynchronously,
                 returns the request thread.
        """
        kwargs['_return_http_data_only'] = True
        if kwargs.get('async_req'):
            return self.get_configurations_with_http_info(**kwargs)  # noqa: E501
        else:
            (data) = self.get_configurations_with_http_info(**kwargs)  # noqa: E501
            return data

    def get_configurations_with_http_info(self, **kwargs):  # noqa: E501
        """Returns all of a users model configurations.  # noqa: E501

        Grab all of a users model configurations. User identiy is grabbed from cookies or auth token.   # noqa: E501
        This method makes a synchronous HTTP request by default. To make an
        asynchronous HTTP request, please pass async_req=True
        >>> thread = api.get_configurations_with_http_info(async_req=True)
        >>> result = thread.get()

        :param async_req bool
        :return: list[ParamSetResponse]
                 If the method is called asynchronously,
                 returns the request thread.
        """

        all_params = []  # 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 get_configurations" % key
                )
            params[key] = val
        del params['kwargs']

        collection_formats = {}

        path_params = {}

        query_params = []

        header_params = {}

        form_params = []
        local_var_files = {}

        body_params = None
        # HTTP header `Accept`
        header_params['Accept'] = self.api_client.select_header_accept(
            ['application/json'])  # noqa: E501

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

        return self.api_client.call_api(
            '/configuration/index', 'GET',
            path_params,
            query_params,
            header_params,
            body=body_params,
            post_params=form_params,
            files=local_var_files,
            response_type='list[ParamSetResponse]',  # 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 launch_configuration(self, configuration_id, **kwargs):  # noqa: E501
        """Launch a configuration to one of the workers to be processed.  # noqa: E501

        Patching the model configuration, will put a job in an AWS SQS Queue. Worker computers poll the job Queue. And when a job is found it will process, and then upload the binary to S3. To grab the binary access the GET /configuration/{uuid}/download for signed S3 urls.   # noqa: E501
        This method makes a synchronous HTTP request by default. To make an
        asynchronous HTTP request, please pass async_req=True
        >>> thread = api.launch_configuration(configuration_id, async_req=True)
        >>> result = thread.get()

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

    def launch_configuration_with_http_info(self, configuration_id, **kwargs):  # noqa: E501
        """Launch a configuration to one of the workers to be processed.  # noqa: E501

        Patching the model configuration, will put a job in an AWS SQS Queue. Worker computers poll the job Queue. And when a job is found it will process, and then upload the binary to S3. To grab the binary access the GET /configuration/{uuid}/download for signed S3 urls.   # noqa: E501
        This method makes a synchronous HTTP request by default. To make an
        asynchronous HTTP request, please pass async_req=True
        >>> thread = api.launch_configuration_with_http_info(configuration_id, async_req=True)
        >>> result = thread.get()

        :param async_req bool
        :param str configuration_id: (required)
        :return: None
                 If the method is called asynchronously,
                 returns the request thread.
        """

        all_params = ['configuration_id']  # 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 launch_configuration" % key
                )
            params[key] = val
        del params['kwargs']
        # verify the required parameter 'configuration_id' is set
        if ('configuration_id' not in params or
                params['configuration_id'] is None):
            raise ValueError("Missing the required parameter `configuration_id` when calling `launch_configuration`")  # noqa: E501

        collection_formats = {}

        path_params = {}
        if 'configuration_id' in params:
            path_params['configurationId'] = params['configuration_id']  # noqa: E501

        query_params = []

        header_params = {}

        form_params = []
        local_var_files = {}

        body_params = None
        # Authentication setting
        auth_settings = ['ApiKeyAuth']  # noqa: E501

        return self.api_client.call_api(
            '/configuration/{configurationId}', 'PATCH',
            path_params,
            query_params,
            header_params,
            body=body_params,
            post_params=form_params,
            files=local_var_files,
            response_type=None,  # 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 update_configuration(self, configuration_id, **kwargs):  # noqa: E501
        """Update and replace a model configuration  # noqa: E501

        By passing in the appropriate options, you can update an existing model configuration   # noqa: E501
        This method makes a synchronous HTTP request by default. To make an
        asynchronous HTTP request, please pass async_req=True
        >>> thread = api.update_configuration(configuration_id, async_req=True)
        >>> result = thread.get()

        :param async_req bool
        :param str configuration_id: (required)
        :param ParamSet body: Model Configuration parameters to update.
        :return: ParamSetResponse
                 If the method is called asynchronously,
                 returns the request thread.
        """
        kwargs['_return_http_data_only'] = True
        if kwargs.get('async_req'):
            return self.update_configuration_with_http_info(configuration_id, **kwargs)  # noqa: E501
        else:
            (data) = self.update_configuration_with_http_info(configuration_id, **kwargs)  # noqa: E501
            return data

    def update_configuration_with_http_info(self, configuration_id, **kwargs):  # noqa: E501
        """Update and replace a model configuration  # noqa: E501

        By passing in the appropriate options, you can update an existing model configuration   # noqa: E501
        This method makes a synchronous HTTP request by default. To make an
        asynchronous HTTP request, please pass async_req=True
        >>> thread = api.update_configuration_with_http_info(configuration_id, async_req=True)
        >>> result = thread.get()

        :param async_req bool
        :param str configuration_id: (required)
        :param ParamSet body: Model Configuration parameters to update.
        :return: ParamSetResponse
                 If the method is called asynchronously,
                 returns the request thread.
        """

        all_params = ['configuration_id', 'body']  # 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 update_configuration" % key
                )
            params[key] = val
        del params['kwargs']
        # verify the required parameter 'configuration_id' is set
        if ('configuration_id' not in params or
                params['configuration_id'] is None):
            raise ValueError("Missing the required parameter `configuration_id` when calling `update_configuration`")  # noqa: E501

        collection_formats = {}

        path_params = {}
        if 'configuration_id' in params:
            path_params['configurationId'] = params['configuration_id']  # noqa: E501

        query_params = []

        header_params = {}

        form_params = []
        local_var_files = {}

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

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

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

        return self.api_client.call_api(
            '/configuration/{configurationId}', 'PUT',
            path_params,
            query_params,
            header_params,
            body=body_params,
            post_params=form_params,
            files=local_var_files,
            response_type='ParamSetResponse',  # 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)
