def list(self, group_name: str, service_name: str, project_name: str, task_type: Optional[str]=None, **kwargs) -> AsyncIterable['models.TaskList']:
    'Get tasks in a service.\n\n        The services resource is the top-level resource that represents the Database Migration Service.\n        This method returns a list of tasks owned by a service resource. Some tasks may have a status\n        of Unknown, which indicates that an error occurred while querying the status of that task.\n\n        :param group_name: Name of the resource group.\n        :type group_name: str\n        :param service_name: Name of the service.\n        :type service_name: str\n        :param project_name: Name of the project.\n        :type project_name: str\n        :param task_type: Filter tasks by task type.\n        :type task_type: str\n        :keyword callable cls: A custom type or function that will be passed the direct response\n        :return: An iterator like instance of either TaskList or the result of cls(response)\n        :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.datamigration.models.TaskList]\n        :raises: ~azure.core.exceptions.HttpResponseError\n        '
    cls = kwargs.pop('cls', None)
    error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError}
    error_map.update(kwargs.pop('error_map', {}))
    api_version = '2021-10-30-preview'
    accept = 'application/json'

    def prepare_request(next_link=None):
        header_parameters = {}
        header_parameters['Accept'] = self._serialize.header('accept', accept, 'str')
        if (not next_link):
            url = self.list.metadata['url']
            path_format_arguments = {'subscriptionId': self._serialize.url('self._config.subscription_id', self._config.subscription_id, 'str'), 'groupName': self._serialize.url('group_name', group_name, 'str'), 'serviceName': self._serialize.url('service_name', service_name, 'str'), 'projectName': self._serialize.url('project_name', project_name, 'str')}
            url = self._client.format_url(url, **path_format_arguments)
            query_parameters = {}
            query_parameters['api-version'] = self._serialize.query('api_version', api_version, 'str')
            if (task_type is not None):
                query_parameters['taskType'] = self._serialize.query('task_type', task_type, 'str')
            request = self._client.get(url, query_parameters, header_parameters)
        else:
            url = next_link
            query_parameters = {}
            request = self._client.get(url, query_parameters, header_parameters)
        return request

    async def extract_data(pipeline_response):
        deserialized = self._deserialize('TaskList', pipeline_response)
        list_of_elem = deserialized.value
        if cls:
            list_of_elem = cls(list_of_elem)
        return ((deserialized.next_link or None), AsyncList(list_of_elem))

    async def get_next(next_link=None):
        request = prepare_request(next_link)
        pipeline_response = (await self._client._pipeline.run(request, stream=False, **kwargs))
        response = pipeline_response.http_response
        if (response.status_code not in [200]):
            error = self._deserialize(models.ApiError, response)
            map_error(status_code=response.status_code, response=response, error_map=error_map)
            raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
        return pipeline_response
    return AsyncItemPaged(get_next, extract_data)
Get tasks in a service.

The services resource is the top-level resource that represents the Database Migration Service.
This method returns a list of tasks owned by a service resource. Some tasks may have a status
of Unknown, which indicates that an error occurred while querying the status of that task.

:param group_name: Name of the resource group.
:type group_name: str
:param service_name: Name of the service.
:type service_name: str
:param project_name: Name of the project.
:type project_name: str
:param task_type: Filter tasks by task type.
:type task_type: str
:keyword callable cls: A custom type or function that will be passed the direct response
:return: An iterator like instance of either TaskList or the result of cls(response)
:rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.datamigration.models.TaskList]
:raises: ~azure.core.exceptions.HttpResponseError
def list(self, group_name: str, service_name: str, project_name: str, task_type: Optional[str]=None, **kwargs) -> AsyncIterable['models.TaskList']:
    'Get tasks in a service.\n\n        The services resource is the top-level resource that represents the Database Migration Service.\n        This method returns a list of tasks owned by a service resource. Some tasks may have a status\n        of Unknown, which indicates that an error occurred while querying the status of that task.\n\n        :param group_name: Name of the resource group.\n        :type group_name: str\n        :param service_name: Name of the service.\n        :type service_name: str\n        :param project_name: Name of the project.\n        :type project_name: str\n        :param task_type: Filter tasks by task type.\n        :type task_type: str\n        :keyword callable cls: A custom type or function that will be passed the direct response\n        :return: An iterator like instance of either TaskList or the result of cls(response)\n        :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.datamigration.models.TaskList]\n        :raises: ~azure.core.exceptions.HttpResponseError\n        '
    cls = kwargs.pop('cls', None)
    error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError}
    error_map.update(kwargs.pop('error_map', {}))
    api_version = '2021-10-30-preview'
    accept = 'application/json'

    def prepare_request(next_link=None):
        header_parameters = {}
        header_parameters['Accept'] = self._serialize.header('accept', accept, 'str')
        if (not next_link):
            url = self.list.metadata['url']
            path_format_arguments = {'subscriptionId': self._serialize.url('self._config.subscription_id', self._config.subscription_id, 'str'), 'groupName': self._serialize.url('group_name', group_name, 'str'), 'serviceName': self._serialize.url('service_name', service_name, 'str'), 'projectName': self._serialize.url('project_name', project_name, 'str')}
            url = self._client.format_url(url, **path_format_arguments)
            query_parameters = {}
            query_parameters['api-version'] = self._serialize.query('api_version', api_version, 'str')
            if (task_type is not None):
                query_parameters['taskType'] = self._serialize.query('task_type', task_type, 'str')
            request = self._client.get(url, query_parameters, header_parameters)
        else:
            url = next_link
            query_parameters = {}
            request = self._client.get(url, query_parameters, header_parameters)
        return request

    async def extract_data(pipeline_response):
        deserialized = self._deserialize('TaskList', pipeline_response)
        list_of_elem = deserialized.value
        if cls:
            list_of_elem = cls(list_of_elem)
        return ((deserialized.next_link or None), AsyncList(list_of_elem))

    async def get_next(next_link=None):
        request = prepare_request(next_link)
        pipeline_response = (await self._client._pipeline.run(request, stream=False, **kwargs))
        response = pipeline_response.http_response
        if (response.status_code not in [200]):
            error = self._deserialize(models.ApiError, response)
            map_error(status_code=response.status_code, response=response, error_map=error_map)
            raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
        return pipeline_response
    return AsyncItemPaged(get_next, extract_data)