# coding: utf-8

"""
    Taurus Data Jobs

    The Taurus Data Jobs internal and Control Plane API. Data Jobs allows Data Engineers to implement automated pull ingestion (E in ELT) and batch data transformation into Data Warehouse (T in ELT). See also https://github.com/vmware/versatile-data-kit/wiki/Introduction  The API has resource-oriented URLs, JSON-encoded responses, and uses standard HTTP response codes, authentication, and verbs. The API enables creating, deploying, managing and executing Data Jobs in runtime environment.<br> <br> The API reflects the usual Data Job Development lifecycle:<br> <li> Create a new data job (webhook to further configure job -e.g authorize its createion, setup permissions, etc). <li> Download keytab. Develop and run the data job locally. <li> Deploy data job in cloud runtime enviornment to run on scheduled basis. <br><br> If Authentication is required pass OAuth2 access token in http header 'Authorization: Bearer [access-token-here]'  The API promotes some best practices (inspired by https://12factor.net ): <li> Explicitly declare and isolate dependencies <li> Strict separation of config from code. Config varies substantially across deploys, code does not. <li> Separation between the build, release/deploy, and run stages <li> Data Jobs are stateless and share-nothing processes. Any data that needs to persist must be stored in a stateful backing service (e.g IProperties). <li> Implementation is assumed to be be atomic and idempotent - should be OK for a job to fail somewhere in the middle; subsequent restart should not cause data corruption. <li> Keep development, staging, and production as similar as possible <br><br> <b>API Evolution</b><br> In the following sections, there are some terms that have a special meaning in the context of the APIs. <br><br> <li> <i>Stable</i> - The implementation of API has been battle-tested (has been in production for some time - probably at least a month)                      API is subject to the semantic versioning model and will follow                      deprecation policy <li> <i>Experimental</i> - May disappear without notice and is not subject to semantic versioning                            Implementation of the API is not considered stable nor well tested.                            Generally this is given to clients to experiment within testing environment. Must not be used in Production. <li> <i>Deprecated</i> - API is expected to be removed within next one or two major version upgrade.                          The deprecation notice/comment will say when the API will be removed and what alternatives should be used instead.   # noqa: E501

    The version of the OpenAPI document: 1.0
    Generated by: https://openapi-generator.tech
"""


from __future__ import absolute_import

import re  # noqa: F401

# python 2 and python 3 compatibility library
import six

from taurus_datajob_api.api_client import ApiClient
from taurus_datajob_api.exceptions import (  # noqa: F401
    ApiTypeError,
    ApiValueError
)


class DataJobsSourcesApi(object):
    """NOTE: This class is auto generated by OpenAPI Generator
    Ref: https://openapi-generator.tech

    Do not edit the class manually.
    """

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

    def data_job_sources_download(self, team_name, job_name, **kwargs):  # noqa: E501
        """Download data job source code. | (Not Implemented)  # noqa: E501

        <i>(Introduced in v1.0)</i>  # noqa: E501
        This method makes a synchronous HTTP request by default. To make an
        asynchronous HTTP request, please pass async_req=True
        >>> thread = api.data_job_sources_download(team_name, job_name, async_req=True)
        >>> result = thread.get()

        :param async_req bool: execute request asynchronously
        :param str team_name: Team Name (required)
        :param str job_name: DataJob Name. (required)
        :param _preload_content: if False, the urllib3.HTTPResponse object will
                                 be returned without reading/decoding response
                                 data. Default is True.
        :param _request_timeout: timeout setting for this request. If one
                                 number provided, it will be total request
                                 timeout. It can also be a pair (tuple) of
                                 (connection, read) timeouts.
        :return: file
                 If the method is called asynchronously,
                 returns the request thread.
        """
        kwargs['_return_http_data_only'] = True
        return self.data_job_sources_download_with_http_info(team_name, job_name, **kwargs)  # noqa: E501

    def data_job_sources_download_with_http_info(self, team_name, job_name, **kwargs):  # noqa: E501
        """Download data job source code. | (Not Implemented)  # noqa: E501

        <i>(Introduced in v1.0)</i>  # noqa: E501
        This method makes a synchronous HTTP request by default. To make an
        asynchronous HTTP request, please pass async_req=True
        >>> thread = api.data_job_sources_download_with_http_info(team_name, job_name, async_req=True)
        >>> result = thread.get()

        :param async_req bool: execute request asynchronously
        :param str team_name: Team Name (required)
        :param str job_name: DataJob Name. (required)
        :param _return_http_data_only: response data without head status code
                                       and headers
        :param _preload_content: if False, the urllib3.HTTPResponse object will
                                 be returned without reading/decoding response
                                 data. Default is True.
        :param _request_timeout: timeout setting for this request. If one
                                 number provided, it will be total request
                                 timeout. It can also be a pair (tuple) of
                                 (connection, read) timeouts.
        :return: tuple(file, status_code(int), headers(HTTPHeaderDict))
                 If the method is called asynchronously,
                 returns the request thread.
        """

        local_var_params = locals()

        all_params = [
            'team_name',
            'job_name'
        ]
        all_params.extend(
            [
                'async_req',
                '_return_http_data_only',
                '_preload_content',
                '_request_timeout'
            ]
        )

        for key, val in six.iteritems(local_var_params['kwargs']):
            if key not in all_params:
                raise ApiTypeError(
                    "Got an unexpected keyword argument '%s'"
                    " to method data_job_sources_download" % key
                )
            local_var_params[key] = val
        del local_var_params['kwargs']
        # verify the required parameter 'team_name' is set
        if self.api_client.client_side_validation and ('team_name' not in local_var_params or  # noqa: E501
                                                        local_var_params['team_name'] is None):  # noqa: E501
            raise ApiValueError("Missing the required parameter `team_name` when calling `data_job_sources_download`")  # noqa: E501
        # verify the required parameter 'job_name' is set
        if self.api_client.client_side_validation and ('job_name' not in local_var_params or  # noqa: E501
                                                        local_var_params['job_name'] is None):  # noqa: E501
            raise ApiValueError("Missing the required parameter `job_name` when calling `data_job_sources_download`")  # noqa: E501

        collection_formats = {}

        path_params = {}
        if 'team_name' in local_var_params:
            path_params['team_name'] = local_var_params['team_name']  # noqa: E501
        if 'job_name' in local_var_params:
            path_params['job_name'] = local_var_params['job_name']  # 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/octet-stream', 'application/json'])  # noqa: E501

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

        return self.api_client.call_api(
            '/data-jobs/for-team/{team_name}/jobs/{job_name}/sources', 'GET',
            path_params,
            query_params,
            header_params,
            body=body_params,
            post_params=form_params,
            files=local_var_files,
            response_type='file',  # noqa: E501
            auth_settings=auth_settings,
            async_req=local_var_params.get('async_req'),
            _return_http_data_only=local_var_params.get('_return_http_data_only'),  # noqa: E501
            _preload_content=local_var_params.get('_preload_content', True),
            _request_timeout=local_var_params.get('_request_timeout'),
            collection_formats=collection_formats)

    def data_job_sources_download_deprecated(self, team_name, job_name, **kwargs):  # noqa: E501
        """Download data job source code. | (Not Implemented)  # noqa: E501

        <i>(Introduced in v1.0)</i>  # noqa: E501
        This method makes a synchronous HTTP request by default. To make an
        asynchronous HTTP request, please pass async_req=True
        >>> thread = api.data_job_sources_download_deprecated(team_name, job_name, async_req=True)
        >>> result = thread.get()

        :param async_req bool: execute request asynchronously
        :param str team_name: Team Name (required)
        :param str job_name: DataJob Name. (required)
        :param _preload_content: if False, the urllib3.HTTPResponse object will
                                 be returned without reading/decoding response
                                 data. Default is True.
        :param _request_timeout: timeout setting for this request. If one
                                 number provided, it will be total request
                                 timeout. It can also be a pair (tuple) of
                                 (connection, read) timeouts.
        :return: file
                 If the method is called asynchronously,
                 returns the request thread.
        """
        kwargs['_return_http_data_only'] = True
        return self.data_job_sources_download_deprecated_with_http_info(team_name, job_name, **kwargs)  # noqa: E501

    def data_job_sources_download_deprecated_with_http_info(self, team_name, job_name, **kwargs):  # noqa: E501
        """Download data job source code. | (Not Implemented)  # noqa: E501

        <i>(Introduced in v1.0)</i>  # noqa: E501
        This method makes a synchronous HTTP request by default. To make an
        asynchronous HTTP request, please pass async_req=True
        >>> thread = api.data_job_sources_download_deprecated_with_http_info(team_name, job_name, async_req=True)
        >>> result = thread.get()

        :param async_req bool: execute request asynchronously
        :param str team_name: Team Name (required)
        :param str job_name: DataJob Name. (required)
        :param _return_http_data_only: response data without head status code
                                       and headers
        :param _preload_content: if False, the urllib3.HTTPResponse object will
                                 be returned without reading/decoding response
                                 data. Default is True.
        :param _request_timeout: timeout setting for this request. If one
                                 number provided, it will be total request
                                 timeout. It can also be a pair (tuple) of
                                 (connection, read) timeouts.
        :return: tuple(file, status_code(int), headers(HTTPHeaderDict))
                 If the method is called asynchronously,
                 returns the request thread.
        """

        local_var_params = locals()

        all_params = [
            'team_name',
            'job_name'
        ]
        all_params.extend(
            [
                'async_req',
                '_return_http_data_only',
                '_preload_content',
                '_request_timeout'
            ]
        )

        for key, val in six.iteritems(local_var_params['kwargs']):
            if key not in all_params:
                raise ApiTypeError(
                    "Got an unexpected keyword argument '%s'"
                    " to method data_job_sources_download_deprecated" % key
                )
            local_var_params[key] = val
        del local_var_params['kwargs']
        # verify the required parameter 'team_name' is set
        if self.api_client.client_side_validation and ('team_name' not in local_var_params or  # noqa: E501
                                                        local_var_params['team_name'] is None):  # noqa: E501
            raise ApiValueError("Missing the required parameter `team_name` when calling `data_job_sources_download_deprecated`")  # noqa: E501
        # verify the required parameter 'job_name' is set
        if self.api_client.client_side_validation and ('job_name' not in local_var_params or  # noqa: E501
                                                        local_var_params['job_name'] is None):  # noqa: E501
            raise ApiValueError("Missing the required parameter `job_name` when calling `data_job_sources_download_deprecated`")  # noqa: E501

        collection_formats = {}

        path_params = {}
        if 'team_name' in local_var_params:
            path_params['team_name'] = local_var_params['team_name']  # noqa: E501
        if 'job_name' in local_var_params:
            path_params['job_name'] = local_var_params['job_name']  # 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/octet-stream', 'application/json'])  # noqa: E501

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

        return self.api_client.call_api(
            '/data-jobs/for-team/{team_name}/name/{job_name}/sources', 'GET',
            path_params,
            query_params,
            header_params,
            body=body_params,
            post_params=form_params,
            files=local_var_files,
            response_type='file',  # noqa: E501
            auth_settings=auth_settings,
            async_req=local_var_params.get('async_req'),
            _return_http_data_only=local_var_params.get('_return_http_data_only'),  # noqa: E501
            _preload_content=local_var_params.get('_preload_content', True),
            _request_timeout=local_var_params.get('_request_timeout'),
            collection_formats=collection_formats)

    def sources_delete(self, team_name, job_name, **kwargs):  # noqa: E501
        """Delete Data Job source.  # noqa: E501

        <i>(Introduced in v1.0)</i> | Data Job Source is persisted in version control.<br> Delete removes the Data Job Source code.   # noqa: E501
        This method makes a synchronous HTTP request by default. To make an
        asynchronous HTTP request, please pass async_req=True
        >>> thread = api.sources_delete(team_name, job_name, async_req=True)
        >>> result = thread.get()

        :param async_req bool: execute request asynchronously
        :param str team_name: Team Name (required)
        :param str job_name: DataJob Name. (required)
        :param str reason: The reason for executing the request
        :param _preload_content: if False, the urllib3.HTTPResponse object will
                                 be returned without reading/decoding response
                                 data. Default is True.
        :param _request_timeout: timeout setting for this request. If one
                                 number provided, it will be total request
                                 timeout. It can also be a pair (tuple) of
                                 (connection, read) timeouts.
        :return: None
                 If the method is called asynchronously,
                 returns the request thread.
        """
        kwargs['_return_http_data_only'] = True
        return self.sources_delete_with_http_info(team_name, job_name, **kwargs)  # noqa: E501

    def sources_delete_with_http_info(self, team_name, job_name, **kwargs):  # noqa: E501
        """Delete Data Job source.  # noqa: E501

        <i>(Introduced in v1.0)</i> | Data Job Source is persisted in version control.<br> Delete removes the Data Job Source code.   # noqa: E501
        This method makes a synchronous HTTP request by default. To make an
        asynchronous HTTP request, please pass async_req=True
        >>> thread = api.sources_delete_with_http_info(team_name, job_name, async_req=True)
        >>> result = thread.get()

        :param async_req bool: execute request asynchronously
        :param str team_name: Team Name (required)
        :param str job_name: DataJob Name. (required)
        :param str reason: The reason for executing the request
        :param _return_http_data_only: response data without head status code
                                       and headers
        :param _preload_content: if False, the urllib3.HTTPResponse object will
                                 be returned without reading/decoding response
                                 data. Default is True.
        :param _request_timeout: timeout setting for this request. If one
                                 number provided, it will be total request
                                 timeout. It can also be a pair (tuple) of
                                 (connection, read) timeouts.
        :return: None
                 If the method is called asynchronously,
                 returns the request thread.
        """

        local_var_params = locals()

        all_params = [
            'team_name',
            'job_name',
            'reason'
        ]
        all_params.extend(
            [
                'async_req',
                '_return_http_data_only',
                '_preload_content',
                '_request_timeout'
            ]
        )

        for key, val in six.iteritems(local_var_params['kwargs']):
            if key not in all_params:
                raise ApiTypeError(
                    "Got an unexpected keyword argument '%s'"
                    " to method sources_delete" % key
                )
            local_var_params[key] = val
        del local_var_params['kwargs']
        # verify the required parameter 'team_name' is set
        if self.api_client.client_side_validation and ('team_name' not in local_var_params or  # noqa: E501
                                                        local_var_params['team_name'] is None):  # noqa: E501
            raise ApiValueError("Missing the required parameter `team_name` when calling `sources_delete`")  # noqa: E501
        # verify the required parameter 'job_name' is set
        if self.api_client.client_side_validation and ('job_name' not in local_var_params or  # noqa: E501
                                                        local_var_params['job_name'] is None):  # noqa: E501
            raise ApiValueError("Missing the required parameter `job_name` when calling `sources_delete`")  # noqa: E501

        collection_formats = {}

        path_params = {}
        if 'team_name' in local_var_params:
            path_params['team_name'] = local_var_params['team_name']  # noqa: E501
        if 'job_name' in local_var_params:
            path_params['job_name'] = local_var_params['job_name']  # noqa: E501

        query_params = []
        if 'reason' in local_var_params and local_var_params['reason'] is not None:  # noqa: E501
            query_params.append(('reason', local_var_params['reason']))  # 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 = ['bearerAuth']  # noqa: E501

        return self.api_client.call_api(
            '/data-jobs/for-team/{team_name}/jobs/{job_name}/sources', 'DELETE',
            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=local_var_params.get('async_req'),
            _return_http_data_only=local_var_params.get('_return_http_data_only'),  # noqa: E501
            _preload_content=local_var_params.get('_preload_content', True),
            _request_timeout=local_var_params.get('_request_timeout'),
            collection_formats=collection_formats)

    def sources_delete_deprecated(self, team_name, job_name, **kwargs):  # noqa: E501
        """Delete Data Job source.  # noqa: E501

        <i>(Introduced in v1.0)</i> | Data Job Source is persisted in version control.<br> Delete removes the Data Job Source code.   # noqa: E501
        This method makes a synchronous HTTP request by default. To make an
        asynchronous HTTP request, please pass async_req=True
        >>> thread = api.sources_delete_deprecated(team_name, job_name, async_req=True)
        >>> result = thread.get()

        :param async_req bool: execute request asynchronously
        :param str team_name: Team Name (required)
        :param str job_name: DataJob Name. (required)
        :param str reason: The reason for executing the request
        :param _preload_content: if False, the urllib3.HTTPResponse object will
                                 be returned without reading/decoding response
                                 data. Default is True.
        :param _request_timeout: timeout setting for this request. If one
                                 number provided, it will be total request
                                 timeout. It can also be a pair (tuple) of
                                 (connection, read) timeouts.
        :return: None
                 If the method is called asynchronously,
                 returns the request thread.
        """
        kwargs['_return_http_data_only'] = True
        return self.sources_delete_deprecated_with_http_info(team_name, job_name, **kwargs)  # noqa: E501

    def sources_delete_deprecated_with_http_info(self, team_name, job_name, **kwargs):  # noqa: E501
        """Delete Data Job source.  # noqa: E501

        <i>(Introduced in v1.0)</i> | Data Job Source is persisted in version control.<br> Delete removes the Data Job Source code.   # noqa: E501
        This method makes a synchronous HTTP request by default. To make an
        asynchronous HTTP request, please pass async_req=True
        >>> thread = api.sources_delete_deprecated_with_http_info(team_name, job_name, async_req=True)
        >>> result = thread.get()

        :param async_req bool: execute request asynchronously
        :param str team_name: Team Name (required)
        :param str job_name: DataJob Name. (required)
        :param str reason: The reason for executing the request
        :param _return_http_data_only: response data without head status code
                                       and headers
        :param _preload_content: if False, the urllib3.HTTPResponse object will
                                 be returned without reading/decoding response
                                 data. Default is True.
        :param _request_timeout: timeout setting for this request. If one
                                 number provided, it will be total request
                                 timeout. It can also be a pair (tuple) of
                                 (connection, read) timeouts.
        :return: None
                 If the method is called asynchronously,
                 returns the request thread.
        """

        local_var_params = locals()

        all_params = [
            'team_name',
            'job_name',
            'reason'
        ]
        all_params.extend(
            [
                'async_req',
                '_return_http_data_only',
                '_preload_content',
                '_request_timeout'
            ]
        )

        for key, val in six.iteritems(local_var_params['kwargs']):
            if key not in all_params:
                raise ApiTypeError(
                    "Got an unexpected keyword argument '%s'"
                    " to method sources_delete_deprecated" % key
                )
            local_var_params[key] = val
        del local_var_params['kwargs']
        # verify the required parameter 'team_name' is set
        if self.api_client.client_side_validation and ('team_name' not in local_var_params or  # noqa: E501
                                                        local_var_params['team_name'] is None):  # noqa: E501
            raise ApiValueError("Missing the required parameter `team_name` when calling `sources_delete_deprecated`")  # noqa: E501
        # verify the required parameter 'job_name' is set
        if self.api_client.client_side_validation and ('job_name' not in local_var_params or  # noqa: E501
                                                        local_var_params['job_name'] is None):  # noqa: E501
            raise ApiValueError("Missing the required parameter `job_name` when calling `sources_delete_deprecated`")  # noqa: E501

        collection_formats = {}

        path_params = {}
        if 'team_name' in local_var_params:
            path_params['team_name'] = local_var_params['team_name']  # noqa: E501
        if 'job_name' in local_var_params:
            path_params['job_name'] = local_var_params['job_name']  # noqa: E501

        query_params = []
        if 'reason' in local_var_params and local_var_params['reason'] is not None:  # noqa: E501
            query_params.append(('reason', local_var_params['reason']))  # 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 = ['bearerAuth']  # noqa: E501

        return self.api_client.call_api(
            '/data-jobs/for-team/{team_name}/name/{job_name}/sources', 'DELETE',
            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=local_var_params.get('async_req'),
            _return_http_data_only=local_var_params.get('_return_http_data_only'),  # noqa: E501
            _preload_content=local_var_params.get('_preload_content', True),
            _request_timeout=local_var_params.get('_request_timeout'),
            collection_formats=collection_formats)

    def sources_upload(self, team_name, job_name, body, **kwargs):  # noqa: E501
        """Upload Data Job source code. | (Stable)  # noqa: E501

        <i>(Introduced in v1.0)</i> | Uploads Data Job source code and returns its version. Upload is persisted in source (git) repo so that all deployed code is versioned. The format of the payload is expected to be a zip in which the directory content can be found. <br>Example:<br> <br> If zip is <br> foo/file.txt<br> foo/nested_dir/file2.txt<br> <br>then data job dir uploaded will look like <br> job-name/file.txt<br> job-name/nested_dir/file2.txt<br>   # noqa: E501
        This method makes a synchronous HTTP request by default. To make an
        asynchronous HTTP request, please pass async_req=True
        >>> thread = api.sources_upload(team_name, job_name, body, async_req=True)
        >>> result = thread.get()

        :param async_req bool: execute request asynchronously
        :param str team_name: Team Name (required)
        :param str job_name: DataJob Name. (required)
        :param file body: (required)
        :param str reason: The reason for executing the request
        :param _preload_content: if False, the urllib3.HTTPResponse object will
                                 be returned without reading/decoding response
                                 data. Default is True.
        :param _request_timeout: timeout setting for this request. If one
                                 number provided, it will be total request
                                 timeout. It can also be a pair (tuple) of
                                 (connection, read) timeouts.
        :return: DataJobVersion
                 If the method is called asynchronously,
                 returns the request thread.
        """
        kwargs['_return_http_data_only'] = True
        return self.sources_upload_with_http_info(team_name, job_name, body, **kwargs)  # noqa: E501

    def sources_upload_with_http_info(self, team_name, job_name, body, **kwargs):  # noqa: E501
        """Upload Data Job source code. | (Stable)  # noqa: E501

        <i>(Introduced in v1.0)</i> | Uploads Data Job source code and returns its version. Upload is persisted in source (git) repo so that all deployed code is versioned. The format of the payload is expected to be a zip in which the directory content can be found. <br>Example:<br> <br> If zip is <br> foo/file.txt<br> foo/nested_dir/file2.txt<br> <br>then data job dir uploaded will look like <br> job-name/file.txt<br> job-name/nested_dir/file2.txt<br>   # noqa: E501
        This method makes a synchronous HTTP request by default. To make an
        asynchronous HTTP request, please pass async_req=True
        >>> thread = api.sources_upload_with_http_info(team_name, job_name, body, async_req=True)
        >>> result = thread.get()

        :param async_req bool: execute request asynchronously
        :param str team_name: Team Name (required)
        :param str job_name: DataJob Name. (required)
        :param file body: (required)
        :param str reason: The reason for executing the request
        :param _return_http_data_only: response data without head status code
                                       and headers
        :param _preload_content: if False, the urllib3.HTTPResponse object will
                                 be returned without reading/decoding response
                                 data. Default is True.
        :param _request_timeout: timeout setting for this request. If one
                                 number provided, it will be total request
                                 timeout. It can also be a pair (tuple) of
                                 (connection, read) timeouts.
        :return: tuple(DataJobVersion, status_code(int), headers(HTTPHeaderDict))
                 If the method is called asynchronously,
                 returns the request thread.
        """

        local_var_params = locals()

        all_params = [
            'team_name',
            'job_name',
            'body',
            'reason'
        ]
        all_params.extend(
            [
                'async_req',
                '_return_http_data_only',
                '_preload_content',
                '_request_timeout'
            ]
        )

        for key, val in six.iteritems(local_var_params['kwargs']):
            if key not in all_params:
                raise ApiTypeError(
                    "Got an unexpected keyword argument '%s'"
                    " to method sources_upload" % key
                )
            local_var_params[key] = val
        del local_var_params['kwargs']
        # verify the required parameter 'team_name' is set
        if self.api_client.client_side_validation and ('team_name' not in local_var_params or  # noqa: E501
                                                        local_var_params['team_name'] is None):  # noqa: E501
            raise ApiValueError("Missing the required parameter `team_name` when calling `sources_upload`")  # noqa: E501
        # verify the required parameter 'job_name' is set
        if self.api_client.client_side_validation and ('job_name' not in local_var_params or  # noqa: E501
                                                        local_var_params['job_name'] is None):  # noqa: E501
            raise ApiValueError("Missing the required parameter `job_name` when calling `sources_upload`")  # noqa: E501
        # verify the required parameter 'body' is set
        if self.api_client.client_side_validation and ('body' not in local_var_params or  # noqa: E501
                                                        local_var_params['body'] is None):  # noqa: E501
            raise ApiValueError("Missing the required parameter `body` when calling `sources_upload`")  # noqa: E501

        collection_formats = {}

        path_params = {}
        if 'team_name' in local_var_params:
            path_params['team_name'] = local_var_params['team_name']  # noqa: E501
        if 'job_name' in local_var_params:
            path_params['job_name'] = local_var_params['job_name']  # noqa: E501

        query_params = []
        if 'reason' in local_var_params and local_var_params['reason'] is not None:  # noqa: E501
            query_params.append(('reason', local_var_params['reason']))  # noqa: E501

        header_params = {}

        form_params = []
        local_var_files = {}

        body_params = None
        if 'body' in local_var_params:
            body_params = local_var_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/octet-stream'])  # noqa: E501

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

        return self.api_client.call_api(
            '/data-jobs/for-team/{team_name}/jobs/{job_name}/sources', 'POST',
            path_params,
            query_params,
            header_params,
            body=body_params,
            post_params=form_params,
            files=local_var_files,
            response_type='DataJobVersion',  # noqa: E501
            auth_settings=auth_settings,
            async_req=local_var_params.get('async_req'),
            _return_http_data_only=local_var_params.get('_return_http_data_only'),  # noqa: E501
            _preload_content=local_var_params.get('_preload_content', True),
            _request_timeout=local_var_params.get('_request_timeout'),
            collection_formats=collection_formats)

    def sources_upload_deprecated(self, team_name, job_name, body, **kwargs):  # noqa: E501
        """Upload Data Job source code. | (Stable)  # noqa: E501

        <i>(Introduced in v1.0)</i> | Uploads Data Job source code and returns its version. Upload is persisted in source (git) repo so that all deployed code is versioned. The format of the payload is expected to be a zip in which the directory content can be found. <br>Example:<br> <br> If zip is <br> foo/file.txt<br> foo/nested_dir/file2.txt<br> <br>then data job dir uploaded will look like <br> job-name/file.txt<br> job-name/nested_dir/file2.txt<br>   # noqa: E501
        This method makes a synchronous HTTP request by default. To make an
        asynchronous HTTP request, please pass async_req=True
        >>> thread = api.sources_upload_deprecated(team_name, job_name, body, async_req=True)
        >>> result = thread.get()

        :param async_req bool: execute request asynchronously
        :param str team_name: Team Name (required)
        :param str job_name: DataJob Name. (required)
        :param file body: (required)
        :param str reason: The reason for executing the request
        :param _preload_content: if False, the urllib3.HTTPResponse object will
                                 be returned without reading/decoding response
                                 data. Default is True.
        :param _request_timeout: timeout setting for this request. If one
                                 number provided, it will be total request
                                 timeout. It can also be a pair (tuple) of
                                 (connection, read) timeouts.
        :return: DataJobVersion
                 If the method is called asynchronously,
                 returns the request thread.
        """
        kwargs['_return_http_data_only'] = True
        return self.sources_upload_deprecated_with_http_info(team_name, job_name, body, **kwargs)  # noqa: E501

    def sources_upload_deprecated_with_http_info(self, team_name, job_name, body, **kwargs):  # noqa: E501
        """Upload Data Job source code. | (Stable)  # noqa: E501

        <i>(Introduced in v1.0)</i> | Uploads Data Job source code and returns its version. Upload is persisted in source (git) repo so that all deployed code is versioned. The format of the payload is expected to be a zip in which the directory content can be found. <br>Example:<br> <br> If zip is <br> foo/file.txt<br> foo/nested_dir/file2.txt<br> <br>then data job dir uploaded will look like <br> job-name/file.txt<br> job-name/nested_dir/file2.txt<br>   # noqa: E501
        This method makes a synchronous HTTP request by default. To make an
        asynchronous HTTP request, please pass async_req=True
        >>> thread = api.sources_upload_deprecated_with_http_info(team_name, job_name, body, async_req=True)
        >>> result = thread.get()

        :param async_req bool: execute request asynchronously
        :param str team_name: Team Name (required)
        :param str job_name: DataJob Name. (required)
        :param file body: (required)
        :param str reason: The reason for executing the request
        :param _return_http_data_only: response data without head status code
                                       and headers
        :param _preload_content: if False, the urllib3.HTTPResponse object will
                                 be returned without reading/decoding response
                                 data. Default is True.
        :param _request_timeout: timeout setting for this request. If one
                                 number provided, it will be total request
                                 timeout. It can also be a pair (tuple) of
                                 (connection, read) timeouts.
        :return: tuple(DataJobVersion, status_code(int), headers(HTTPHeaderDict))
                 If the method is called asynchronously,
                 returns the request thread.
        """

        local_var_params = locals()

        all_params = [
            'team_name',
            'job_name',
            'body',
            'reason'
        ]
        all_params.extend(
            [
                'async_req',
                '_return_http_data_only',
                '_preload_content',
                '_request_timeout'
            ]
        )

        for key, val in six.iteritems(local_var_params['kwargs']):
            if key not in all_params:
                raise ApiTypeError(
                    "Got an unexpected keyword argument '%s'"
                    " to method sources_upload_deprecated" % key
                )
            local_var_params[key] = val
        del local_var_params['kwargs']
        # verify the required parameter 'team_name' is set
        if self.api_client.client_side_validation and ('team_name' not in local_var_params or  # noqa: E501
                                                        local_var_params['team_name'] is None):  # noqa: E501
            raise ApiValueError("Missing the required parameter `team_name` when calling `sources_upload_deprecated`")  # noqa: E501
        # verify the required parameter 'job_name' is set
        if self.api_client.client_side_validation and ('job_name' not in local_var_params or  # noqa: E501
                                                        local_var_params['job_name'] is None):  # noqa: E501
            raise ApiValueError("Missing the required parameter `job_name` when calling `sources_upload_deprecated`")  # noqa: E501
        # verify the required parameter 'body' is set
        if self.api_client.client_side_validation and ('body' not in local_var_params or  # noqa: E501
                                                        local_var_params['body'] is None):  # noqa: E501
            raise ApiValueError("Missing the required parameter `body` when calling `sources_upload_deprecated`")  # noqa: E501

        collection_formats = {}

        path_params = {}
        if 'team_name' in local_var_params:
            path_params['team_name'] = local_var_params['team_name']  # noqa: E501
        if 'job_name' in local_var_params:
            path_params['job_name'] = local_var_params['job_name']  # noqa: E501

        query_params = []
        if 'reason' in local_var_params and local_var_params['reason'] is not None:  # noqa: E501
            query_params.append(('reason', local_var_params['reason']))  # noqa: E501

        header_params = {}

        form_params = []
        local_var_files = {}

        body_params = None
        if 'body' in local_var_params:
            body_params = local_var_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/octet-stream'])  # noqa: E501

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

        return self.api_client.call_api(
            '/data-jobs/for-team/{team_name}/name/{job_name}/sources', 'POST',
            path_params,
            query_params,
            header_params,
            body=body_params,
            post_params=form_params,
            files=local_var_files,
            response_type='DataJobVersion',  # noqa: E501
            auth_settings=auth_settings,
            async_req=local_var_params.get('async_req'),
            _return_http_data_only=local_var_params.get('_return_http_data_only'),  # noqa: E501
            _preload_content=local_var_params.get('_preload_content', True),
            _request_timeout=local_var_params.get('_request_timeout'),
            collection_formats=collection_formats)
