Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ class LogsIngestionClient(LogsIngestionClientOperationsMixin): # pylint: disabl
def __init__(self, endpoint: str, credential: "TokenCredential", **kwargs: Any) -> None:
_endpoint = "{endpoint}"
self._config = LogsIngestionClientConfiguration(endpoint=endpoint, credential=credential, **kwargs)
self._client = PipelineClient(base_url=_endpoint, config=self._config, **kwargs)
self._client: PipelineClient = PipelineClient(base_url=_endpoint, config=self._config, **kwargs)

self._serialize = Serializer()
self._deserialize = Deserializer()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ def __init__(self, endpoint: str, credential: "TokenCredential", **kwargs: Any)
self.credential = credential
self.api_version = api_version
self.credential_scopes = kwargs.pop("credential_scopes", ["user_impersonation"])
kwargs.setdefault("sdk_moniker", "logsingestionclient/{}".format(VERSION))
kwargs.setdefault("sdk_moniker", "monitor-ingestion/{}".format(VERSION))
self._configure(**kwargs)

def _configure(self, **kwargs: Any) -> None:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -155,8 +155,9 @@ def upload( # pylint: disable=inconsistent-return-statements
}
request.url = self._client.format_url(request.url, **path_format_arguments)

_stream = False
pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access
request, stream=False, **kwargs
request, stream=_stream, **kwargs
)

response = pipeline_response.http_response
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,10 +38,7 @@ def __init__(self, endpoint: str, credential: "TokenCredential", **kwargs: Any)
)


__all__ = [
"LogsIngestionClient",
"LogsUploadError"
]
__all__ = ["LogsIngestionClient", "LogsUploadError"]


def patch_sdk():
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -629,7 +629,7 @@ def _serialize(self, target_obj, data_type=None, **kwargs):
if xml_desc.get("attr", False):
if xml_ns:
ET.register_namespace(xml_prefix, xml_ns)
xml_name = "{}{}".format(xml_ns, xml_name)
xml_name = "{{{}}}{}".format(xml_ns, xml_name)
serialized.set(xml_name, new_attr) # type: ignore
continue
if xml_desc.get("text", False):
Expand Down Expand Up @@ -1271,7 +1271,7 @@ def _extract_name_from_internal_type(internal_type):
xml_name = internal_type_xml_map.get("name", internal_type.__name__)
xml_ns = internal_type_xml_map.get("ns", None)
if xml_ns:
xml_name = "{}{}".format(xml_ns, xml_name)
xml_name = "{{{}}}{}".format(xml_ns, xml_name)
return xml_name


Expand All @@ -1295,7 +1295,7 @@ def xml_key_extractor(attr, attr_desc, data):
# Integrate namespace if necessary
xml_ns = xml_desc.get("ns", internal_type_xml_map.get("ns", None))
if xml_ns:
xml_name = "{}{}".format(xml_ns, xml_name)
xml_name = "{{{}}}{}".format(xml_ns, xml_name)

# If it's an attribute, that's simple
if xml_desc.get("attr", False):
Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,9 @@
# coding=utf-8
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for
# license information.
#
# Licensed under the MIT License. See License.txt in the project root for license information.
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes may cause incorrect behavior and will be lost if the code is
# regenerated.
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------

VERSION = "1.0.1"
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ class LogsIngestionClient(LogsIngestionClientOperationsMixin): # pylint: disabl
def __init__(self, endpoint: str, credential: "AsyncTokenCredential", **kwargs: Any) -> None:
_endpoint = "{endpoint}"
self._config = LogsIngestionClientConfiguration(endpoint=endpoint, credential=credential, **kwargs)
self._client = AsyncPipelineClient(base_url=_endpoint, config=self._config, **kwargs)
self._client: AsyncPipelineClient = AsyncPipelineClient(base_url=_endpoint, config=self._config, **kwargs)

self._serialize = Serializer()
self._deserialize = Deserializer()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ def __init__(self, endpoint: str, credential: "AsyncTokenCredential", **kwargs:
self.credential = credential
self.api_version = api_version
self.credential_scopes = kwargs.pop("credential_scopes", ["user_impersonation"])
kwargs.setdefault("sdk_moniker", "logsingestionclient/{}".format(VERSION))
kwargs.setdefault("sdk_moniker", "monitor-ingestion/{}".format(VERSION))
self._configure(**kwargs)

def _configure(self, **kwargs: Any) -> None:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -109,8 +109,9 @@ async def upload( # pylint: disable=inconsistent-return-statements
}
request.url = self._client.format_url(request.url, **path_format_arguments)

_stream = False
pipeline_response: PipelineResponse = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access
request, stream=False, **kwargs
request, stream=_stream, **kwargs
)

response = pipeline_response.http_response
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
title: LogsIngestionClient
description: Azure Monitor Data Collection Python Client
generated-metadata: false

package-name: azure-monitor-ingestion
license-header: MICROSOFT_MIT_NO_VERSION
no-namespace-folders: true
output-folder: ../azure/monitor/ingestion
Expand All @@ -18,4 +18,5 @@ input-file:
python: true
version-tolerant: true
python3-only: true
black: true
```
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ def __init__( # pylint: disable=missing-client-constructor-parameter-credential
self, *, endpoint: str = "https://api.loganalytics.io/v1", **kwargs: Any
) -> None:
self._config = MonitorQueryClientConfiguration(**kwargs)
self._client = PipelineClient(base_url=endpoint, config=self._config, **kwargs)
self._client: PipelineClient = PipelineClient(base_url=endpoint, config=self._config, **kwargs)

self._serialize = Serializer()
self._deserialize = Deserializer()
Expand Down Expand Up @@ -69,5 +69,5 @@ def __enter__(self) -> "MonitorQueryClient":
self._client.__enter__()
return self

def __exit__(self, *exc_details) -> None:
def __exit__(self, *exc_details: Any) -> None:
self._client.__exit__(*exc_details)
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ class MonitorQueryClientConfiguration(Configuration): # pylint: disable=too-man
def __init__(self, **kwargs: Any) -> None:
super(MonitorQueryClientConfiguration, self).__init__(**kwargs)

kwargs.setdefault("sdk_moniker", "monitorqueryclient/{}".format(VERSION))
kwargs.setdefault("sdk_moniker", "monitor-query/{}".format(VERSION))
self._configure(**kwargs)

def _configure(self, **kwargs: Any) -> None:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@
import isodate # type: ignore

from azure.core.exceptions import DeserializationError, SerializationError, raise_with_traceback
from azure.core.serialization import NULL as AzureCoreNull

_BOM = codecs.BOM_UTF8.decode(encoding="utf-8")

Expand Down Expand Up @@ -628,7 +629,7 @@ def _serialize(self, target_obj, data_type=None, **kwargs):
if xml_desc.get("attr", False):
if xml_ns:
ET.register_namespace(xml_prefix, xml_ns)
xml_name = "{}{}".format(xml_ns, xml_name)
xml_name = "{{{}}}{}".format(xml_ns, xml_name)
serialized.set(xml_name, new_attr) # type: ignore
continue
if xml_desc.get("text", False):
Expand Down Expand Up @@ -802,6 +803,8 @@ def serialize_data(self, data, data_type, **kwargs):
raise ValueError("No value for given attribute")

try:
if data is AzureCoreNull:
return None
if data_type in self.basic_types.values():
return self.serialize_basic(data, data_type, **kwargs)

Expand Down Expand Up @@ -1268,7 +1271,7 @@ def _extract_name_from_internal_type(internal_type):
xml_name = internal_type_xml_map.get("name", internal_type.__name__)
xml_ns = internal_type_xml_map.get("ns", None)
if xml_ns:
xml_name = "{}{}".format(xml_ns, xml_name)
xml_name = "{{{}}}{}".format(xml_ns, xml_name)
return xml_name


Expand All @@ -1292,7 +1295,7 @@ def xml_key_extractor(attr, attr_desc, data):
# Integrate namespace if necessary
xml_ns = xml_desc.get("ns", internal_type_xml_map.get("ns", None))
if xml_ns:
xml_name = "{}{}".format(xml_ns, xml_name)
xml_name = "{{{}}}{}".format(xml_ns, xml_name)

# If it's an attribute, that's simple
if xml_desc.get("attr", False):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ def __init__( # pylint: disable=missing-client-constructor-parameter-credential
self, *, endpoint: str = "https://api.loganalytics.io/v1", **kwargs: Any
) -> None:
self._config = MonitorQueryClientConfiguration(**kwargs)
self._client = AsyncPipelineClient(base_url=endpoint, config=self._config, **kwargs)
self._client: AsyncPipelineClient = AsyncPipelineClient(base_url=endpoint, config=self._config, **kwargs)

self._serialize = Serializer()
self._deserialize = Deserializer()
Expand Down Expand Up @@ -69,5 +69,5 @@ async def __aenter__(self) -> "MonitorQueryClient":
await self._client.__aenter__()
return self

async def __aexit__(self, *exc_details) -> None:
async def __aexit__(self, *exc_details: Any) -> None:
await self._client.__aexit__(*exc_details)
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ class MonitorQueryClientConfiguration(Configuration): # pylint: disable=too-man
def __init__(self, **kwargs: Any) -> None:
super(MonitorQueryClientConfiguration, self).__init__(**kwargs)

kwargs.setdefault("sdk_moniker", "monitorqueryclient/{}".format(VERSION))
kwargs.setdefault("sdk_moniker", "monitor-query/{}".format(VERSION))
self._configure(**kwargs)

def _configure(self, **kwargs: Any) -> None:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -153,8 +153,9 @@ async def get(
)
request.url = self._client.format_url(request.url)

_stream = False
pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access
request, stream=False, **kwargs
request, stream=_stream, **kwargs
)

response = pipeline_response.http_response
Expand Down Expand Up @@ -368,7 +369,7 @@ async def execute(
:type workspace_id: str
:param body: The Analytics query. Learn more about the `Analytics query syntax
<https://azure.microsoft.com/documentation/articles/app-insights-analytics-reference/>`_. Is
either a model type or a IO type. Required.
either a JSON type or a IO type. Required.
:type body: JSON or IO
:keyword prefer: Optional. The prefer header to set server timeout, query statistics and
visualization information. Default value is None.
Expand All @@ -383,6 +384,18 @@ async def execute(
Example:
.. code-block:: python

# JSON input template you can fill out and use as your body input.
body = {
"query": "str", # The query to execute. Required.
"timespan": "str", # Optional. Optional. The timespan over which to query
data. This is an ISO8601 time period value. This timespan is applied in addition
to any that are specified in the query expression.
"workspaces": [
"str" # Optional. A list of workspaces that are included in the
query.
]
}

# response body for status code(s): 200
response == {
"tables": [
Expand Down Expand Up @@ -463,8 +476,9 @@ async def execute(
)
request.url = self._client.format_url(request.url)

_stream = False
pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access
request, stream=False, **kwargs
request, stream=_stream, **kwargs
)

response = pipeline_response.http_response
Expand Down Expand Up @@ -701,7 +715,7 @@ async def batch(self, body: Union[JSON, IO], **kwargs: Any) -> JSON:
<https://dev.loganalytics.io/documentation/Using-the-API>`_ is an example for using POST with
an Analytics query.

:param body: The batch request body. Is either a model type or a IO type. Required.
:param body: The batch request body. Is either a JSON type or a IO type. Required.
:type body: JSON or IO
:keyword content_type: Body Parameter content-type. Known values are: 'application/json'.
Default value is None.
Expand All @@ -713,6 +727,34 @@ async def batch(self, body: Union[JSON, IO], **kwargs: Any) -> JSON:
Example:
.. code-block:: python

# JSON input template you can fill out and use as your body input.
body = {
"requests": [
{
"body": {
"query": "str", # The query to execute. Required.
"timespan": "str", # Optional. Optional. The
timespan over which to query data. This is an ISO8601 time period
value. This timespan is applied in addition to any that are
specified in the query expression.
"workspaces": [
"str" # Optional. A list of workspaces that
are included in the query.
]
},
"id": "str", # The error details. Required.
"workspace": "str", # Workspace Id to be included in the
query. Required.
"headers": {
"str": "str" # Optional. Dictionary of
:code:`<string>`.
},
"method": "str", # Optional. "POST"
"path": "str" # Optional. "/query"
}
]
}

# response body for status code(s): 200
response == {
"responses": [
Expand Down Expand Up @@ -814,8 +856,9 @@ async def batch(self, body: Union[JSON, IO], **kwargs: Any) -> JSON:
)
request.url = self._client.format_url(request.url)

_stream = False
pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access
request, stream=False, **kwargs
request, stream=_stream, **kwargs
)

response = pipeline_response.http_response
Expand Down Expand Up @@ -1230,8 +1273,9 @@ async def get(self, workspace_id: str, **kwargs: Any) -> JSON:
)
request.url = self._client.format_url(request.url)

_stream = False
pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access
request, stream=False, **kwargs
request, stream=_stream, **kwargs
)

response = pipeline_response.http_response
Expand Down Expand Up @@ -1628,8 +1672,9 @@ async def post(self, workspace_id: str, **kwargs: Any) -> JSON:
)
request.url = self._client.format_url(request.url)

_stream = False
pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access
request, stream=False, **kwargs
request, stream=_stream, **kwargs
)

response = pipeline_response.http_response
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ def __init__( # pylint: disable=missing-client-constructor-parameter-credential
self, *, endpoint: str = "https://management.azure.com", **kwargs: Any
) -> None:
self._config = MonitorMetricsClientConfiguration(**kwargs)
self._client = PipelineClient(base_url=endpoint, config=self._config, **kwargs)
self._client: PipelineClient = PipelineClient(base_url=endpoint, config=self._config, **kwargs)

self._serialize = Serializer()
self._deserialize = Deserializer()
Expand Down Expand Up @@ -76,5 +76,5 @@ def __enter__(self) -> "MonitorMetricsClient":
self._client.__enter__()
return self

def __exit__(self, *exc_details) -> None:
def __exit__(self, *exc_details: Any) -> None:
self._client.__exit__(*exc_details)
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ class MonitorMetricsClientConfiguration(Configuration): # pylint: disable=too-m
def __init__(self, **kwargs: Any) -> None:
super(MonitorMetricsClientConfiguration, self).__init__(**kwargs)

kwargs.setdefault("sdk_moniker", "monitormetricsclient/{}".format(VERSION))
kwargs.setdefault("sdk_moniker", "monitor-query/{}".format(VERSION))
self._configure(**kwargs)

def _configure(self, **kwargs: Any) -> None:
Expand Down
Loading