@distributed_trace_async
async def calculate_template_hash(self, template: Any, **kwargs: Any) -> '_models.TemplateHashResult':
    'Calculate the hash of the given template.\n\n        :param template: The template provided to calculate hash.\n        :type template: any\n        :keyword callable cls: A custom type or function that will be passed the direct response\n        :return: TemplateHashResult, or the result of cls(response)\n        :rtype: ~azure.mgmt.resource.resources.v2019_08_01.models.TemplateHashResult\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 = kwargs.pop('api_version', '2019-08-01')
    content_type = kwargs.pop('content_type', 'application/json')
    _json = self._serialize.body(template, 'object')
    request = build_deployments_calculate_template_hash_request(api_version=api_version, content_type=content_type, json=_json, template_url=self.calculate_template_hash.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('TemplateHashResult', pipeline_response)
    if cls:
        return cls(pipeline_response, deserialized, {})
    return deserialized
Calculate the hash of the given template.

:param template: The template provided to calculate hash.
:type template: any
:keyword callable cls: A custom type or function that will be passed the direct response
:return: TemplateHashResult, or the result of cls(response)
:rtype: ~azure.mgmt.resource.resources.v2019_08_01.models.TemplateHashResult
:raises: ~azure.core.exceptions.HttpResponseError
@distributed_trace_async
async def calculate_template_hash(self, template: Any, **kwargs: Any) -> '_models.TemplateHashResult':
    'Calculate the hash of the given template.\n\n        :param template: The template provided to calculate hash.\n        :type template: any\n        :keyword callable cls: A custom type or function that will be passed the direct response\n        :return: TemplateHashResult, or the result of cls(response)\n        :rtype: ~azure.mgmt.resource.resources.v2019_08_01.models.TemplateHashResult\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 = kwargs.pop('api_version', '2019-08-01')
    content_type = kwargs.pop('content_type', 'application/json')
    _json = self._serialize.body(template, 'object')
    request = build_deployments_calculate_template_hash_request(api_version=api_version, content_type=content_type, json=_json, template_url=self.calculate_template_hash.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('TemplateHashResult', pipeline_response)
    if cls:
        return cls(pipeline_response, deserialized, {})
    return deserialized