@distributed_trace_async
async def create_or_update(self, tag_name: str, **kwargs: Any) -> '_models.TagDetails':
    'Creates a tag in the subscription.\n\n        The tag name can have a maximum of 512 characters and is case insensitive. Tag names created by\n        Azure have prefixes of microsoft, azure, or windows. You cannot create tags with one of these\n        prefixes.\n\n        :param tag_name: The name of the tag to create.\n        :type tag_name: str\n        :keyword callable cls: A custom type or function that will be passed the direct response\n        :return: TagDetails, or the result of cls(response)\n        :rtype: ~azure.mgmt.resource.resources.v2019_08_01.models.TagDetails\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')
    request = build_tags_create_or_update_request(tag_name=tag_name, subscription_id=self._config.subscription_id, api_version=api_version, template_url=self.create_or_update.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, 201]):
        map_error(status_code=response.status_code, response=response, error_map=error_map)
        raise HttpResponseError(response=response, error_format=ARMErrorFormat)
    if (response.status_code == 200):
        deserialized = self._deserialize('TagDetails', pipeline_response)
    if (response.status_code == 201):
        deserialized = self._deserialize('TagDetails', pipeline_response)
    if cls:
        return cls(pipeline_response, deserialized, {})
    return deserialized
Creates a tag in the subscription.

The tag name can have a maximum of 512 characters and is case insensitive. Tag names created by
Azure have prefixes of microsoft, azure, or windows. You cannot create tags with one of these
prefixes.

:param tag_name: The name of the tag to create.
:type tag_name: str
:keyword callable cls: A custom type or function that will be passed the direct response
:return: TagDetails, or the result of cls(response)
:rtype: ~azure.mgmt.resource.resources.v2019_08_01.models.TagDetails
:raises: ~azure.core.exceptions.HttpResponseError
@distributed_trace_async
async def create_or_update(self, tag_name: str, **kwargs: Any) -> '_models.TagDetails':
    'Creates a tag in the subscription.\n\n        The tag name can have a maximum of 512 characters and is case insensitive. Tag names created by\n        Azure have prefixes of microsoft, azure, or windows. You cannot create tags with one of these\n        prefixes.\n\n        :param tag_name: The name of the tag to create.\n        :type tag_name: str\n        :keyword callable cls: A custom type or function that will be passed the direct response\n        :return: TagDetails, or the result of cls(response)\n        :rtype: ~azure.mgmt.resource.resources.v2019_08_01.models.TagDetails\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')
    request = build_tags_create_or_update_request(tag_name=tag_name, subscription_id=self._config.subscription_id, api_version=api_version, template_url=self.create_or_update.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, 201]):
        map_error(status_code=response.status_code, response=response, error_map=error_map)
        raise HttpResponseError(response=response, error_format=ARMErrorFormat)
    if (response.status_code == 200):
        deserialized = self._deserialize('TagDetails', pipeline_response)
    if (response.status_code == 201):
        deserialized = self._deserialize('TagDetails', pipeline_response)
    if cls:
        return cls(pipeline_response, deserialized, {})
    return deserialized