@distributed_trace_async
async def get_by_id(self, resource_id: str, api_version: str, **kwargs: Any) -> '_models.GenericResource':
    'Gets a resource by ID.\n\n        :param resource_id: The fully qualified ID of the resource, including the resource name and\n         resource type. Use the format,\n         /subscriptions/{guid}/resourceGroups/{resource-group-name}/{resource-provider-namespace}/{resource-type}/{resource-name}.\n        :type resource_id: str\n        :param api_version: The API version to use for the operation.\n        :type api_version: str\n        :keyword callable cls: A custom type or function that will be passed the direct response\n        :return: GenericResource, or the result of cls(response)\n        :rtype: ~azure.mgmt.resource.resources.v2019_08_01.models.GenericResource\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', {}))
    request = build_resources_get_by_id_request(resource_id=resource_id, api_version=api_version, template_url=self.get_by_id.metadata['url'])
    request = _convert_request(request)
    request.url = self._client.format_url(request.url)
    pipeline_response = (await self._client._pipeline.run(request, stream=False, **kwargs))
    response = pipeline_response.http_response
    if (response.status_code not in [200]):
        map_error(status_code=response.status_code, response=response, error_map=error_map)
        raise HttpResponseError(response=response, error_format=ARMErrorFormat)
    deserialized = self._deserialize('GenericResource', pipeline_response)
    if cls:
        return cls(pipeline_response, deserialized, {})
    return deserialized
Gets a resource by ID.

:param resource_id: The fully qualified ID of the resource, including the resource name and
 resource type. Use the format,
 /subscriptions/{guid}/resourceGroups/{resource-group-name}/{resource-provider-namespace}/{resource-type}/{resource-name}.
:type resource_id: str
:param api_version: The API version to use for the operation.
:type api_version: str
:keyword callable cls: A custom type or function that will be passed the direct response
:return: GenericResource, or the result of cls(response)
:rtype: ~azure.mgmt.resource.resources.v2019_08_01.models.GenericResource
:raises: ~azure.core.exceptions.HttpResponseError
@distributed_trace_async
async def get_by_id(self, resource_id: str, api_version: str, **kwargs: Any) -> '_models.GenericResource':
    'Gets a resource by ID.\n\n        :param resource_id: The fully qualified ID of the resource, including the resource name and\n         resource type. Use the format,\n         /subscriptions/{guid}/resourceGroups/{resource-group-name}/{resource-provider-namespace}/{resource-type}/{resource-name}.\n        :type resource_id: str\n        :param api_version: The API version to use for the operation.\n        :type api_version: str\n        :keyword callable cls: A custom type or function that will be passed the direct response\n        :return: GenericResource, or the result of cls(response)\n        :rtype: ~azure.mgmt.resource.resources.v2019_08_01.models.GenericResource\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', {}))
    request = build_resources_get_by_id_request(resource_id=resource_id, api_version=api_version, template_url=self.get_by_id.metadata['url'])
    request = _convert_request(request)
    request.url = self._client.format_url(request.url)
    pipeline_response = (await self._client._pipeline.run(request, stream=False, **kwargs))
    response = pipeline_response.http_response
    if (response.status_code not in [200]):
        map_error(status_code=response.status_code, response=response, error_map=error_map)
        raise HttpResponseError(response=response, error_format=ARMErrorFormat)
    deserialized = self._deserialize('GenericResource', pipeline_response)
    if cls:
        return cls(pipeline_response, deserialized, {})
    return deserialized