diff --git a/sdk/monitor/microsoft-opentelemetry-exporter-azuremonitor/microsoft/opentelemetry/exporter/azuremonitor/_generated/aio/__init__.py b/sdk/monitor/microsoft-opentelemetry-exporter-azuremonitor/microsoft/opentelemetry/exporter/azuremonitor/_generated/aio/__init__.py index d58717213ca8..6dca0f7c8419 100644 --- a/sdk/monitor/microsoft-opentelemetry-exporter-azuremonitor/microsoft/opentelemetry/exporter/azuremonitor/_generated/aio/__init__.py +++ b/sdk/monitor/microsoft-opentelemetry-exporter-azuremonitor/microsoft/opentelemetry/exporter/azuremonitor/_generated/aio/__init__.py @@ -6,5 +6,5 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from ._azure_monitor_client_async import AzureMonitorClient +from ._azure_monitor_client import AzureMonitorClient __all__ = ['AzureMonitorClient'] diff --git a/sdk/monitor/microsoft-opentelemetry-exporter-azuremonitor/microsoft/opentelemetry/exporter/azuremonitor/_generated/aio/_azure_monitor_client_async.py b/sdk/monitor/microsoft-opentelemetry-exporter-azuremonitor/microsoft/opentelemetry/exporter/azuremonitor/_generated/aio/_azure_monitor_client.py similarity index 92% rename from sdk/monitor/microsoft-opentelemetry-exporter-azuremonitor/microsoft/opentelemetry/exporter/azuremonitor/_generated/aio/_azure_monitor_client_async.py rename to sdk/monitor/microsoft-opentelemetry-exporter-azuremonitor/microsoft/opentelemetry/exporter/azuremonitor/_generated/aio/_azure_monitor_client.py index f895d52adb93..89d3561b2ed7 100644 --- a/sdk/monitor/microsoft-opentelemetry-exporter-azuremonitor/microsoft/opentelemetry/exporter/azuremonitor/_generated/aio/_azure_monitor_client_async.py +++ b/sdk/monitor/microsoft-opentelemetry-exporter-azuremonitor/microsoft/opentelemetry/exporter/azuremonitor/_generated/aio/_azure_monitor_client.py @@ -11,8 +11,8 @@ from azure.core import AsyncPipelineClient from msrest import Deserializer, Serializer -from ._configuration_async import AzureMonitorClientConfiguration -from .operations_async import AzureMonitorClientOperationsMixin +from ._configuration import AzureMonitorClientConfiguration +from .operations import AzureMonitorClientOperationsMixin from .. import models diff --git a/sdk/monitor/microsoft-opentelemetry-exporter-azuremonitor/microsoft/opentelemetry/exporter/azuremonitor/_generated/aio/_configuration_async.py b/sdk/monitor/microsoft-opentelemetry-exporter-azuremonitor/microsoft/opentelemetry/exporter/azuremonitor/_generated/aio/_configuration.py similarity index 100% rename from sdk/monitor/microsoft-opentelemetry-exporter-azuremonitor/microsoft/opentelemetry/exporter/azuremonitor/_generated/aio/_configuration_async.py rename to sdk/monitor/microsoft-opentelemetry-exporter-azuremonitor/microsoft/opentelemetry/exporter/azuremonitor/_generated/aio/_configuration.py diff --git a/sdk/monitor/microsoft-opentelemetry-exporter-azuremonitor/microsoft/opentelemetry/exporter/azuremonitor/_generated/aio/operations_async/__init__.py b/sdk/monitor/microsoft-opentelemetry-exporter-azuremonitor/microsoft/opentelemetry/exporter/azuremonitor/_generated/aio/operations/__init__.py similarity index 85% rename from sdk/monitor/microsoft-opentelemetry-exporter-azuremonitor/microsoft/opentelemetry/exporter/azuremonitor/_generated/aio/operations_async/__init__.py rename to sdk/monitor/microsoft-opentelemetry-exporter-azuremonitor/microsoft/opentelemetry/exporter/azuremonitor/_generated/aio/operations/__init__.py index f9551bb042bf..30cdb38f8dbb 100644 --- a/sdk/monitor/microsoft-opentelemetry-exporter-azuremonitor/microsoft/opentelemetry/exporter/azuremonitor/_generated/aio/operations_async/__init__.py +++ b/sdk/monitor/microsoft-opentelemetry-exporter-azuremonitor/microsoft/opentelemetry/exporter/azuremonitor/_generated/aio/operations/__init__.py @@ -6,7 +6,7 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from ._azure_monitor_client_operations_async import AzureMonitorClientOperationsMixin +from ._azure_monitor_client_operations import AzureMonitorClientOperationsMixin __all__ = [ 'AzureMonitorClientOperationsMixin', diff --git a/sdk/monitor/microsoft-opentelemetry-exporter-azuremonitor/microsoft/opentelemetry/exporter/azuremonitor/_generated/aio/operations_async/_azure_monitor_client_operations_async.py b/sdk/monitor/microsoft-opentelemetry-exporter-azuremonitor/microsoft/opentelemetry/exporter/azuremonitor/_generated/aio/operations/_azure_monitor_client_operations.py similarity index 81% rename from sdk/monitor/microsoft-opentelemetry-exporter-azuremonitor/microsoft/opentelemetry/exporter/azuremonitor/_generated/aio/operations_async/_azure_monitor_client_operations_async.py rename to sdk/monitor/microsoft-opentelemetry-exporter-azuremonitor/microsoft/opentelemetry/exporter/azuremonitor/_generated/aio/operations/_azure_monitor_client_operations.py index d371a949537e..e69f8839bd88 100644 --- a/sdk/monitor/microsoft-opentelemetry-exporter-azuremonitor/microsoft/opentelemetry/exporter/azuremonitor/_generated/aio/operations_async/_azure_monitor_client_operations_async.py +++ b/sdk/monitor/microsoft-opentelemetry-exporter-azuremonitor/microsoft/opentelemetry/exporter/azuremonitor/_generated/aio/operations/_azure_monitor_client_operations.py @@ -8,11 +8,11 @@ from typing import Any, Callable, Dict, Generic, List, Optional, TypeVar, Union import warnings -from azure.core.exceptions import HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest -from ... import models +from ... import models as _models T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -21,9 +21,9 @@ class AzureMonitorClientOperationsMixin: async def track( self, - body: List["models.TelemetryItem"], + body: List["_models.TelemetryItem"], **kwargs - ) -> "models.TrackResponse": + ) -> "_models.TrackResponse": """Track telemetry events. This operation sends a sequence of telemetry events that will be monitored by Azure Monitor. @@ -35,18 +35,20 @@ async def track( :rtype: ~azure_monitor_client.models.TrackResponse :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.TrackResponse"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.TrackResponse"] error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, - 400: lambda response: HttpResponseError(response=response, model=self._deserialize(models.TrackResponse, response)), - 402: lambda response: HttpResponseError(response=response, model=self._deserialize(models.TrackResponse, response)), - 429: lambda response: HttpResponseError(response=response, model=self._deserialize(models.TrackResponse, response)), - 500: lambda response: HttpResponseError(response=response, model=self._deserialize(models.TrackResponse, response)), - 503: lambda response: HttpResponseError(response=response, model=self._deserialize(models.TrackResponse, response)), + 400: lambda response: HttpResponseError(response=response, model=self._deserialize(_models.TrackResponse, response)), + 402: lambda response: HttpResponseError(response=response, model=self._deserialize(_models.TrackResponse, response)), + 429: lambda response: HttpResponseError(response=response, model=self._deserialize(_models.TrackResponse, response)), + 500: lambda response: HttpResponseError(response=response, model=self._deserialize(_models.TrackResponse, response)), + 503: lambda response: HttpResponseError(response=response, model=self._deserialize(_models.TrackResponse, response)), } error_map.update(kwargs.pop('error_map', {})) content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" # Construct URL url = self.track.metadata['url'] # type: ignore @@ -61,13 +63,12 @@ async def track( # Construct headers header_parameters = {} # type: Dict[str, Any] header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(body, '[TelemetryItem]') body_content_kwargs['content'] = body_content request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response diff --git a/sdk/monitor/microsoft-opentelemetry-exporter-azuremonitor/microsoft/opentelemetry/exporter/azuremonitor/_generated/operations/_azure_monitor_client_operations.py b/sdk/monitor/microsoft-opentelemetry-exporter-azuremonitor/microsoft/opentelemetry/exporter/azuremonitor/_generated/operations/_azure_monitor_client_operations.py index decd2ca532f7..0bbcb7bc7627 100644 --- a/sdk/monitor/microsoft-opentelemetry-exporter-azuremonitor/microsoft/opentelemetry/exporter/azuremonitor/_generated/operations/_azure_monitor_client_operations.py +++ b/sdk/monitor/microsoft-opentelemetry-exporter-azuremonitor/microsoft/opentelemetry/exporter/azuremonitor/_generated/operations/_azure_monitor_client_operations.py @@ -8,11 +8,11 @@ from typing import TYPE_CHECKING import warnings -from azure.core.exceptions import HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import HttpRequest, HttpResponse -from .. import models +from .. import models as _models if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports @@ -25,10 +25,10 @@ class AzureMonitorClientOperationsMixin(object): def track( self, - body, # type: List["models.TelemetryItem"] + body, # type: List["_models.TelemetryItem"] **kwargs # type: Any ): - # type: (...) -> "models.TrackResponse" + # type: (...) -> "_models.TrackResponse" """Track telemetry events. This operation sends a sequence of telemetry events that will be monitored by Azure Monitor. @@ -40,18 +40,20 @@ def track( :rtype: ~azure_monitor_client.models.TrackResponse :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.TrackResponse"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.TrackResponse"] error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, - 400: lambda response: HttpResponseError(response=response, model=self._deserialize(models.TrackResponse, response)), - 402: lambda response: HttpResponseError(response=response, model=self._deserialize(models.TrackResponse, response)), - 429: lambda response: HttpResponseError(response=response, model=self._deserialize(models.TrackResponse, response)), - 500: lambda response: HttpResponseError(response=response, model=self._deserialize(models.TrackResponse, response)), - 503: lambda response: HttpResponseError(response=response, model=self._deserialize(models.TrackResponse, response)), + 400: lambda response: HttpResponseError(response=response, model=self._deserialize(_models.TrackResponse, response)), + 402: lambda response: HttpResponseError(response=response, model=self._deserialize(_models.TrackResponse, response)), + 429: lambda response: HttpResponseError(response=response, model=self._deserialize(_models.TrackResponse, response)), + 500: lambda response: HttpResponseError(response=response, model=self._deserialize(_models.TrackResponse, response)), + 503: lambda response: HttpResponseError(response=response, model=self._deserialize(_models.TrackResponse, response)), } error_map.update(kwargs.pop('error_map', {})) content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" # Construct URL url = self.track.metadata['url'] # type: ignore @@ -66,13 +68,12 @@ def track( # Construct headers header_parameters = {} # type: Dict[str, Any] header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(body, '[TelemetryItem]') body_content_kwargs['content'] = body_content request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response diff --git a/sdk/monitor/microsoft-opentelemetry-exporter-azuremonitor/swagger/README.md b/sdk/monitor/microsoft-opentelemetry-exporter-azuremonitor/swagger/README.md index b7f578ae5551..767ef394be41 100644 --- a/sdk/monitor/microsoft-opentelemetry-exporter-azuremonitor/swagger/README.md +++ b/sdk/monitor/microsoft-opentelemetry-exporter-azuremonitor/swagger/README.md @@ -1,4 +1,4 @@ -# Opentelemtry Exporter for Azure Monitor Client for Python +# OpenTelemetry Exporter for Azure Monitor Client for Python > see https://aka.ms/autorest @@ -15,10 +15,11 @@ autorest ./swagger/README.md --python --v3 ```yaml title: AzureMonitorClient -description: Opentelemetry Exporter for Azure Monitor +description: OpenTelemetry Exporter for Azure Monitor generated-metadata: false license-header: MICROSOFT_MIT_NO_VERSION no-namespace-folders: true +trace: false output-folder: ../microsoft/opentelemetry/exporter/azuremonitor/_generated source-code-folder-path: ./microsoft/opentelemetry/exporter/azuremonitor/_generated input-file: @@ -26,5 +27,5 @@ input-file: python: true v3: true -use: "@autorest/python@5.1.0-preview.7" +use: "@autorest/python@5.5.0" ```