Exemplo n.º 1
0
    def delete_pool_with_http_info(self, pool_name, **kwargs):  # noqa: E501
        """Delete a pool  # noqa: E501

        This method makes a synchronous HTTP request by default. To make an
        asynchronous HTTP request, please pass async_req=True
        >>> thread = api.delete_pool_with_http_info(pool_name, async_req=True)
        >>> result = thread.get()

        :param async_req bool: execute request asynchronously
        :param str pool_name: The Pool 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: None
                 If the method is called asynchronously,
                 returns the request thread.
        """

        local_var_params = locals()

        all_params = ['pool_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 delete_pool" % key)
            local_var_params[key] = val
        del local_var_params['kwargs']
        # verify the required parameter 'pool_name' is set
        if self.api_client.client_side_validation and (
                'pool_name' not in local_var_params or  # noqa: E501
                local_var_params['pool_name'] is None):  # noqa: E501
            raise ApiValueError(
                "Missing the required parameter `pool_name` when calling `delete_pool`"
            )  # noqa: E501

        collection_formats = {}

        path_params = {}
        if 'pool_name' in local_var_params:
            path_params['pool_name'] = local_var_params[
                'pool_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/json'])  # noqa: E501

        # Authentication setting
        auth_settings = []  # noqa: E501

        return self.api_client.call_api(
            '/pools/{pool_name}',
            '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)
Exemplo n.º 2
0
    def get_config_with_http_info(self, **kwargs):  # noqa: E501
        """Get current 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.get_config_with_http_info(async_req=True)
        >>> result = thread.get()

        :param async_req bool: execute request asynchronously
        :param int limit: The numbers of items to return.
        :param int offset: The number of items to skip before starting to collect the result set.
        :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(Config, status_code(int), headers(HTTPHeaderDict))
                 If the method is called asynchronously,
                 returns the request thread.
        """

        local_var_params = locals()

        all_params = ['limit', 'offset']
        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 get_config" % key)
            local_var_params[key] = val
        del local_var_params['kwargs']

        if self.api_client.client_side_validation and 'limit' in local_var_params and local_var_params[
                'limit'] < 1:  # noqa: E501
            raise ApiValueError(
                "Invalid value for parameter `limit` when calling `get_config`, must be a value greater than or equal to `1`"
            )  # noqa: E501
        if self.api_client.client_side_validation and 'offset' in local_var_params and local_var_params[
                'offset'] < 0:  # noqa: E501
            raise ApiValueError(
                "Invalid value for parameter `offset` when calling `get_config`, must be a value greater than or equal to `0`"
            )  # noqa: E501
        collection_formats = {}

        path_params = {}

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

        # Authentication setting
        auth_settings = []  # noqa: E501

        return self.api_client.call_api(
            '/config',
            'GET',
            path_params,
            query_params,
            header_params,
            body=body_params,
            post_params=form_params,
            files=local_var_files,
            response_type='Config',  # 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)
Exemplo n.º 3
0
    def call_with_http_info(self, **kwargs):

        try:
            index = self.api_client.configuration.server_operation_index.get(
                self.settings['operation_id'],
                self.api_client.configuration.server_index
            ) if kwargs['_host_index'] is None else kwargs['_host_index']
            server_variables = self.api_client.configuration.server_operation_variables.get(
                self.settings['operation_id'],
                self.api_client.configuration.server_variables)
            _host = self.api_client.configuration.get_host_from_settings(
                index,
                variables=server_variables,
                servers=self.settings['servers'])
        except IndexError:
            if self.settings['servers']:
                raise ApiValueError(
                    "Invalid host index. Must be 0 <= index < %s" %
                    len(self.settings['servers']))
            _host = None

        for key, value in kwargs.items():
            if key not in self.params_map['all']:
                raise ApiTypeError("Got an unexpected parameter '%s'"
                                   " to method `%s`" %
                                   (key, self.settings['operation_id']))
            # only throw this nullable ApiValueError if _check_input_type
            # is False, if _check_input_type==True we catch this case
            # in self.__validate_inputs
            if (key not in self.params_map['nullable'] and value is None
                    and kwargs['_check_input_type'] is False):
                raise ApiValueError(
                    "Value may not be None for non-nullable parameter `%s`"
                    " when calling `%s`" %
                    (key, self.settings['operation_id']))

        for key in self.params_map['required']:
            if key not in kwargs.keys():
                raise ApiValueError(
                    "Missing the required parameter `%s` when calling "
                    "`%s`" % (key, self.settings['operation_id']))

        self.__validate_inputs(kwargs)

        params = self.__gather_params(kwargs)

        accept_headers_list = self.headers_map['accept']
        if accept_headers_list:
            params['header']['Accept'] = self.api_client.select_header_accept(
                accept_headers_list)

        content_type_headers_list = self.headers_map['content_type']
        if content_type_headers_list:
            header_list = self.api_client.select_header_content_type(
                content_type_headers_list)
            params['header']['Content-Type'] = header_list

        return self.api_client.call_api(
            self.settings['endpoint_path'],
            self.settings['http_method'],
            params['path'],
            params['query'],
            params['header'],
            body=params['body'],
            post_params=params['form'],
            files=params['file'],
            response_type=self.settings['response_type'],
            auth_settings=self.settings['auth'],
            async_req=kwargs['async_req'],
            _check_type=kwargs['_check_return_type'],
            _return_http_data_only=kwargs['_return_http_data_only'],
            _preload_content=kwargs['_preload_content'],
            _request_timeout=kwargs['_request_timeout'],
            _host=_host,
            collection_formats=params['collection_format'])
Exemplo n.º 4
0
    def patch_pool_with_http_info(self, pool_name, pool,
                                  **kwargs):  # noqa: E501
        """Update a pool  # noqa: E501

        This method makes a synchronous HTTP request by default. To make an
        asynchronous HTTP request, please pass async_req=True
        >>> thread = api.patch_pool_with_http_info(pool_name, pool, async_req=True)
        >>> result = thread.get()

        :param async_req bool: execute request asynchronously
        :param str pool_name: The Pool name. (required)
        :param Pool pool: (required)
        :param list[str] update_mask: The fields to update on the connection (connection, pool etc). If absent or empty, all modifiable fields are updated. A comma-separated list of fully qualified names of fields. 
        :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(Pool, status_code(int), headers(HTTPHeaderDict))
                 If the method is called asynchronously,
                 returns the request thread.
        """

        local_var_params = locals()

        all_params = ['pool_name', 'pool', 'update_mask']
        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 patch_pool" % key)
            local_var_params[key] = val
        del local_var_params['kwargs']
        # verify the required parameter 'pool_name' is set
        if self.api_client.client_side_validation and (
                'pool_name' not in local_var_params or  # noqa: E501
                local_var_params['pool_name'] is None):  # noqa: E501
            raise ApiValueError(
                "Missing the required parameter `pool_name` when calling `patch_pool`"
            )  # noqa: E501
        # verify the required parameter 'pool' is set
        if self.api_client.client_side_validation and (
                'pool' not in local_var_params or  # noqa: E501
                local_var_params['pool'] is None):  # noqa: E501
            raise ApiValueError(
                "Missing the required parameter `pool` when calling `patch_pool`"
            )  # noqa: E501

        collection_formats = {}

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

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

        header_params = {}

        form_params = []
        local_var_files = {}

        body_params = None
        if 'pool' in local_var_params:
            body_params = local_var_params['pool']
        # 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 = []  # noqa: E501

        return self.api_client.call_api(
            '/pools/{pool_name}',
            'PATCH',
            path_params,
            query_params,
            header_params,
            body=body_params,
            post_params=form_params,
            files=local_var_files,
            response_type='Pool',  # 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)
Exemplo n.º 5
0
 def request(self,
             method,
             url,
             query_params=None,
             headers=None,
             post_params=None,
             body=None,
             _preload_content=True,
             _request_timeout=None):
     """Makes the HTTP request using RESTClient."""
     if method == "GET":
         return self.rest_client.GET(url,
                                     query_params=query_params,
                                     _preload_content=_preload_content,
                                     _request_timeout=_request_timeout,
                                     headers=headers)
     elif method == "HEAD":
         return self.rest_client.HEAD(url,
                                      query_params=query_params,
                                      _preload_content=_preload_content,
                                      _request_timeout=_request_timeout,
                                      headers=headers)
     elif method == "OPTIONS":
         return self.rest_client.OPTIONS(url,
                                         query_params=query_params,
                                         headers=headers,
                                         post_params=post_params,
                                         _preload_content=_preload_content,
                                         _request_timeout=_request_timeout,
                                         body=body)
     elif method == "POST":
         return self.rest_client.POST(url,
                                      query_params=query_params,
                                      headers=headers,
                                      post_params=post_params,
                                      _preload_content=_preload_content,
                                      _request_timeout=_request_timeout,
                                      body=body)
     elif method == "PUT":
         return self.rest_client.PUT(url,
                                     query_params=query_params,
                                     headers=headers,
                                     post_params=post_params,
                                     _preload_content=_preload_content,
                                     _request_timeout=_request_timeout,
                                     body=body)
     elif method == "PATCH":
         return self.rest_client.PATCH(url,
                                       query_params=query_params,
                                       headers=headers,
                                       post_params=post_params,
                                       _preload_content=_preload_content,
                                       _request_timeout=_request_timeout,
                                       body=body)
     elif method == "DELETE":
         return self.rest_client.DELETE(url,
                                        query_params=query_params,
                                        headers=headers,
                                        _preload_content=_preload_content,
                                        _request_timeout=_request_timeout,
                                        body=body)
     else:
         raise ApiValueError("http method must be `GET`, `HEAD`, `OPTIONS`,"
                             " `POST`, `PATCH`, `PUT` or `DELETE`.")
Exemplo n.º 6
0
    def request(self,
                method,
                url,
                query_params=None,
                headers=None,
                body=None,
                post_params=None,
                _preload_content=True,
                _request_timeout=None):
        """Perform requests.

        :param method: http request method
        :param url: http request url
        :param query_params: query parameters in the url
        :param headers: http request headers
        :param body: request json body, for `application/json`
        :param post_params: request post parameters,
                            `application/x-www-form-urlencoded`
                            and `multipart/form-data`
        :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.
        """
        method = method.upper()
        assert method in [
            'GET', 'HEAD', 'DELETE', 'POST', 'PUT', 'PATCH', 'OPTIONS'
        ]

        if post_params and body:
            raise ApiValueError(
                "body parameter cannot be used with post_params parameter.")

        post_params = post_params or {}
        headers = headers or {}

        timeout = None
        if _request_timeout:
            if isinstance(_request_timeout, (int, float)):  # noqa: E501,F821
                timeout = urllib3.Timeout(total=_request_timeout)
            elif (isinstance(_request_timeout, tuple)
                  and len(_request_timeout) == 2):
                timeout = urllib3.Timeout(connect=_request_timeout[0],
                                          read=_request_timeout[1])

        if 'Content-Type' not in headers:
            headers['Content-Type'] = 'application/json'

        try:
            # For `POST`, `PUT`, `PATCH`, `OPTIONS`, `DELETE`
            if method in ['POST', 'PUT', 'PATCH', 'OPTIONS', 'DELETE']:
                if query_params:
                    url += '?' + urlencode(query_params)
                if re.search('json', headers['Content-Type'], re.IGNORECASE):
                    request_body = None
                    if body is not None:
                        request_body = json.dumps(body)
                    r = self.pool_manager.request(
                        method,
                        url,
                        body=request_body,
                        preload_content=_preload_content,
                        timeout=timeout,
                        headers=headers)
                elif headers[
                        'Content-Type'] == 'application/x-www-form-urlencoded':  # noqa: E501
                    r = self.pool_manager.request(
                        method,
                        url,
                        fields=post_params,
                        encode_multipart=False,
                        preload_content=_preload_content,
                        timeout=timeout,
                        headers=headers)
                elif headers['Content-Type'] == 'multipart/form-data':
                    # must del headers['Content-Type'], or the correct
                    # Content-Type which generated by urllib3 will be
                    # overwritten.
                    del headers['Content-Type']
                    r = self.pool_manager.request(
                        method,
                        url,
                        fields=post_params,
                        encode_multipart=True,
                        preload_content=_preload_content,
                        timeout=timeout,
                        headers=headers)
                # Pass a `string` parameter directly in the body to support
                # other content types than Json when `body` argument is
                # provided in serialized form
                elif isinstance(body, str) or isinstance(body, bytes):
                    request_body = body
                    r = self.pool_manager.request(
                        method,
                        url,
                        body=request_body,
                        preload_content=_preload_content,
                        timeout=timeout,
                        headers=headers)
                else:
                    # Cannot generate the request from given parameters
                    msg = """Cannot prepare a request message for provided
                             arguments. Please check that your arguments match
                             declared content type."""
                    raise ApiException(status=0, reason=msg)
            # For `GET`, `HEAD`
            else:
                r = self.pool_manager.request(method,
                                              url,
                                              fields=query_params,
                                              preload_content=_preload_content,
                                              timeout=timeout,
                                              headers=headers)
        except urllib3.exceptions.SSLError as e:
            msg = "{0}\n{1}".format(type(e).__name__, str(e))
            raise ApiException(status=0, reason=msg)

        if _preload_content:
            r = RESTResponse(r)

            # log response body
            logger.debug("response body: %s", r.data)

        if not 200 <= r.status <= 299:
            if r.status == 401:
                raise UnauthorizedException(http_resp=r)

            if r.status == 403:
                raise ForbiddenException(http_resp=r)

            if r.status == 404:
                raise NotFoundException(http_resp=r)

            if 500 <= r.status <= 599:
                raise ServiceException(http_resp=r)

            raise ApiException(http_resp=r)

        return r
Exemplo n.º 7
0
    def get_task_instances_batch_with_http_info(self, list_task_instance_form,
                                                **kwargs):  # noqa: E501
        """Get list of task instances from all DAGs and DAG Runs.  # noqa: E501

        This endpoint is a POST to allow filtering across a large number of DAG IDs, where as a GET it would run in to maximum HTTP request URL lengthlimits   # 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_task_instances_batch_with_http_info(list_task_instance_form, async_req=True)
        >>> result = thread.get()

        :param async_req bool: execute request asynchronously
        :param ListTaskInstanceForm list_task_instance_form: (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(TaskInstanceCollection, status_code(int), headers(HTTPHeaderDict))
                 If the method is called asynchronously,
                 returns the request thread.
        """

        local_var_params = locals()

        all_params = ['list_task_instance_form']
        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 get_task_instances_batch" % key)
            local_var_params[key] = val
        del local_var_params['kwargs']
        # verify the required parameter 'list_task_instance_form' is set
        if self.api_client.client_side_validation and (
                'list_task_instance_form' not in local_var_params
                or  # noqa: E501
                local_var_params['list_task_instance_form'] is None
        ):  # noqa: E501
            raise ApiValueError(
                "Missing the required parameter `list_task_instance_form` when calling `get_task_instances_batch`"
            )  # noqa: E501

        collection_formats = {}

        path_params = {}

        query_params = []

        header_params = {}

        form_params = []
        local_var_files = {}

        body_params = None
        if 'list_task_instance_form' in local_var_params:
            body_params = local_var_params['list_task_instance_form']
        # 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 = []  # noqa: E501

        return self.api_client.call_api(
            '/dags/~/dagRuns/~/taskInstances/list',
            'POST',
            path_params,
            query_params,
            header_params,
            body=body_params,
            post_params=form_params,
            files=local_var_files,
            response_type='TaskInstanceCollection',  # 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)
Exemplo n.º 8
0
    def get_extra_links_with_http_info(self, dag_id, dag_run_id, task_id,
                                       **kwargs):  # noqa: E501
        """Get extra links for task instance  # 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_extra_links_with_http_info(dag_id, dag_run_id, task_id, async_req=True)
        >>> result = thread.get()

        :param async_req bool: execute request asynchronously
        :param str dag_id: The DAG ID. (required)
        :param str dag_run_id: The DAG Run ID. (required)
        :param str task_id: The Task ID. (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(ExtraLinkCollection, status_code(int), headers(HTTPHeaderDict))
                 If the method is called asynchronously,
                 returns the request thread.
        """

        local_var_params = locals()

        all_params = ['dag_id', 'dag_run_id', 'task_id']
        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 get_extra_links" % key)
            local_var_params[key] = val
        del local_var_params['kwargs']
        # verify the required parameter 'dag_id' is set
        if self.api_client.client_side_validation and (
                'dag_id' not in local_var_params or  # noqa: E501
                local_var_params['dag_id'] is None):  # noqa: E501
            raise ApiValueError(
                "Missing the required parameter `dag_id` when calling `get_extra_links`"
            )  # noqa: E501
        # verify the required parameter 'dag_run_id' is set
        if self.api_client.client_side_validation and (
                'dag_run_id' not in local_var_params or  # noqa: E501
                local_var_params['dag_run_id'] is None):  # noqa: E501
            raise ApiValueError(
                "Missing the required parameter `dag_run_id` when calling `get_extra_links`"
            )  # noqa: E501
        # verify the required parameter 'task_id' is set
        if self.api_client.client_side_validation and (
                'task_id' not in local_var_params or  # noqa: E501
                local_var_params['task_id'] is None):  # noqa: E501
            raise ApiValueError(
                "Missing the required parameter `task_id` when calling `get_extra_links`"
            )  # noqa: E501

        collection_formats = {}

        path_params = {}
        if 'dag_id' in local_var_params:
            path_params['dag_id'] = local_var_params['dag_id']  # noqa: E501
        if 'dag_run_id' in local_var_params:
            path_params['dag_run_id'] = local_var_params[
                'dag_run_id']  # noqa: E501
        if 'task_id' in local_var_params:
            path_params['task_id'] = local_var_params['task_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 = []  # noqa: E501

        return self.api_client.call_api(
            '/dags/{dag_id}/dagRuns/{dag_run_id}/taskInstances/{task_id}/links',
            'GET',
            path_params,
            query_params,
            header_params,
            body=body_params,
            post_params=form_params,
            files=local_var_files,
            response_type='ExtraLinkCollection',  # 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)
Exemplo n.º 9
0
    def get_task_instances_with_http_info(self, dag_id, dag_run_id,
                                          **kwargs):  # noqa: E501
        """Get a list of task instance of DAG.  # noqa: E501

        This endpoint allows specifying `~` as the dag_id, dag_run_id to retrieve DAG Runs for all DAGs and DAG Runs.   # 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_task_instances_with_http_info(dag_id, dag_run_id, async_req=True)
        >>> result = thread.get()

        :param async_req bool: execute request asynchronously
        :param str dag_id: The DAG ID. (required)
        :param str dag_run_id: The DAG Run ID. (required)
        :param datetime execution_date_gte: Returns objects greater or equal to the specified date. This can be combined with execution_date_lte parameter to receive only the selected period. 
        :param datetime execution_date_lte: Returns objects less than or equal to the specified date. This can be combined with execution_date_gte parameter to receive only the selected period. 
        :param datetime start_date_gte: Returns objects greater or equal the specified date. This can be combined with startd_ate_lte parameter to receive only the selected period. 
        :param datetime start_date_lte: Returns objects less or equal the specified date. This can be combined with start_date_gte parameter to receive only the selected period. 
        :param datetime end_date_gte: Returns objects greater or equal the specified date. This can be combined with start_date_lte parameter to receive only the selected period. 
        :param datetime end_date_lte: Returns objects less than or equal to the specified date. This can be combined with start_date_gte parameter to receive only the selected period. 
        :param float duration_gte: Returns objects greater than or equal to the specified values. This can be combined with duration_lte parameter to receive only the selected period. 
        :param float duration_lte: Returns objects less than or equal to the specified values. This can be combined with duration_gte parameter to receive only the selected range. 
        :param list[str] state: The value can be repeated to retrieve multiple matching values (OR condition).
        :param list[str] pool: The value can be repeated to retrieve multiple matching values (OR condition).
        :param list[str] queue: The value can be repeated to retrieve multiple matching values (OR condition).
        :param int limit: The numbers of items to return.
        :param int offset: The number of items to skip before starting to collect the result set.
        :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(TaskInstanceCollection, status_code(int), headers(HTTPHeaderDict))
                 If the method is called asynchronously,
                 returns the request thread.
        """

        local_var_params = locals()

        all_params = [
            'dag_id', 'dag_run_id', 'execution_date_gte', 'execution_date_lte',
            'start_date_gte', 'start_date_lte', 'end_date_gte', 'end_date_lte',
            'duration_gte', 'duration_lte', 'state', 'pool', 'queue', 'limit',
            'offset'
        ]
        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 get_task_instances" % key)
            local_var_params[key] = val
        del local_var_params['kwargs']
        # verify the required parameter 'dag_id' is set
        if self.api_client.client_side_validation and (
                'dag_id' not in local_var_params or  # noqa: E501
                local_var_params['dag_id'] is None):  # noqa: E501
            raise ApiValueError(
                "Missing the required parameter `dag_id` when calling `get_task_instances`"
            )  # noqa: E501
        # verify the required parameter 'dag_run_id' is set
        if self.api_client.client_side_validation and (
                'dag_run_id' not in local_var_params or  # noqa: E501
                local_var_params['dag_run_id'] is None):  # noqa: E501
            raise ApiValueError(
                "Missing the required parameter `dag_run_id` when calling `get_task_instances`"
            )  # noqa: E501

        if self.api_client.client_side_validation and 'limit' in local_var_params and local_var_params[
                'limit'] < 1:  # noqa: E501
            raise ApiValueError(
                "Invalid value for parameter `limit` when calling `get_task_instances`, must be a value greater than or equal to `1`"
            )  # noqa: E501
        if self.api_client.client_side_validation and 'offset' in local_var_params and local_var_params[
                'offset'] < 0:  # noqa: E501
            raise ApiValueError(
                "Invalid value for parameter `offset` when calling `get_task_instances`, must be a value greater than or equal to `0`"
            )  # noqa: E501
        collection_formats = {}

        path_params = {}
        if 'dag_id' in local_var_params:
            path_params['dag_id'] = local_var_params['dag_id']  # noqa: E501
        if 'dag_run_id' in local_var_params:
            path_params['dag_run_id'] = local_var_params[
                'dag_run_id']  # noqa: E501

        query_params = []
        if 'execution_date_gte' in local_var_params and local_var_params[
                'execution_date_gte'] is not None:  # noqa: E501
            query_params.append(
                ('execution_date_gte',
                 local_var_params['execution_date_gte']))  # noqa: E501
        if 'execution_date_lte' in local_var_params and local_var_params[
                'execution_date_lte'] is not None:  # noqa: E501
            query_params.append(
                ('execution_date_lte',
                 local_var_params['execution_date_lte']))  # noqa: E501
        if 'start_date_gte' in local_var_params and local_var_params[
                'start_date_gte'] is not None:  # noqa: E501
            query_params.append(
                ('start_date_gte',
                 local_var_params['start_date_gte']))  # noqa: E501
        if 'start_date_lte' in local_var_params and local_var_params[
                'start_date_lte'] is not None:  # noqa: E501
            query_params.append(
                ('start_date_lte',
                 local_var_params['start_date_lte']))  # noqa: E501
        if 'end_date_gte' in local_var_params and local_var_params[
                'end_date_gte'] is not None:  # noqa: E501
            query_params.append(
                ('end_date_gte',
                 local_var_params['end_date_gte']))  # noqa: E501
        if 'end_date_lte' in local_var_params and local_var_params[
                'end_date_lte'] is not None:  # noqa: E501
            query_params.append(
                ('end_date_lte',
                 local_var_params['end_date_lte']))  # noqa: E501
        if 'duration_gte' in local_var_params and local_var_params[
                'duration_gte'] is not None:  # noqa: E501
            query_params.append(
                ('duration_gte',
                 local_var_params['duration_gte']))  # noqa: E501
        if 'duration_lte' in local_var_params and local_var_params[
                'duration_lte'] is not None:  # noqa: E501
            query_params.append(
                ('duration_lte',
                 local_var_params['duration_lte']))  # noqa: E501
        if 'state' in local_var_params and local_var_params[
                'state'] is not None:  # noqa: E501
            query_params.append(
                ('state', local_var_params['state']))  # noqa: E501
            collection_formats['state'] = 'multi'  # noqa: E501
        if 'pool' in local_var_params and local_var_params[
                'pool'] is not None:  # noqa: E501
            query_params.append(
                ('pool', local_var_params['pool']))  # noqa: E501
            collection_formats['pool'] = 'multi'  # noqa: E501
        if 'queue' in local_var_params and local_var_params[
                'queue'] is not None:  # noqa: E501
            query_params.append(
                ('Queue', local_var_params['queue']))  # noqa: E501
            collection_formats['Queue'] = 'multi'  # noqa: E501
        if 'limit' in local_var_params and local_var_params[
                'limit'] is not None:  # noqa: E501
            query_params.append(
                ('limit', local_var_params['limit']))  # noqa: E501
        if 'offset' in local_var_params and local_var_params[
                'offset'] is not None:  # noqa: E501
            query_params.append(
                ('offset', local_var_params['offset']))  # 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 = []  # noqa: E501

        return self.api_client.call_api(
            '/dags/{dag_id}/dagRuns/{dag_run_id}/taskInstances',
            'GET',
            path_params,
            query_params,
            header_params,
            body=body_params,
            post_params=form_params,
            files=local_var_files,
            response_type='TaskInstanceCollection',  # 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)