Skip to content

Commit cd5dca4

Browse files
authored
[Monitor][Ingestion] Regen using new swagger file (Azure#28471)
The package was regenerated using the newly created stable API spec for the ingestion API and a small update in autorest. Change UploadLogsError failed_logs typing to be Mapping instead of MutableMapping since we don't expect changes to be made to it. Signed-off-by: Paul Van Eck <paulvaneck@microsoft.com>
1 parent 00030a8 commit cd5dca4

File tree

11 files changed

+31
-41
lines changed

11 files changed

+31
-41
lines changed

sdk/monitor/azure-monitor-ingestion/assets.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,5 +2,5 @@
22
"AssetsRepo": "Azure/azure-sdk-assets",
33
"AssetsRepoPrefixPath": "python",
44
"TagPrefix": "python/monitor/azure-monitor-ingestion",
5-
"Tag": "python/monitor/azure-monitor-ingestion_8aeeee2d98"
5+
"Tag": "python/monitor/azure-monitor-ingestion_70c5ade383"
66
}

sdk/monitor/azure-monitor-ingestion/azure/monitor/ingestion/_client.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -29,8 +29,8 @@ class LogsIngestionClient(LogsIngestionClientOperationsMixin): # pylint: disabl
2929
:type endpoint: str
3030
:param credential: Credential needed for the client to connect to Azure. Required.
3131
:type credential: ~azure.core.credentials.TokenCredential
32-
:keyword api_version: Api Version. Default value is "2021-11-01-preview". Note that overriding
33-
this default value may result in unsupported behavior.
32+
:keyword api_version: Api Version. Default value is "2023-01-01". Note that overriding this
33+
default value may result in unsupported behavior.
3434
:paramtype api_version: str
3535
"""
3636

@@ -76,5 +76,5 @@ def __enter__(self) -> "LogsIngestionClient":
7676
self._client.__enter__()
7777
return self
7878

79-
def __exit__(self, *exc_details) -> None:
79+
def __exit__(self, *exc_details: Any) -> None:
8080
self._client.__exit__(*exc_details)

sdk/monitor/azure-monitor-ingestion/azure/monitor/ingestion/_configuration.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -35,14 +35,14 @@ class LogsIngestionClientConfiguration(Configuration): # pylint: disable=too-ma
3535
:type endpoint: str
3636
:param credential: Credential needed for the client to connect to Azure. Required.
3737
:type credential: ~azure.core.credentials.TokenCredential
38-
:keyword api_version: Api Version. Default value is "2021-11-01-preview". Note that overriding
39-
this default value may result in unsupported behavior.
38+
:keyword api_version: Api Version. Default value is "2023-01-01". Note that overriding this
39+
default value may result in unsupported behavior.
4040
:paramtype api_version: str
4141
"""
4242

4343
def __init__(self, endpoint: str, credential: "TokenCredential", **kwargs: Any) -> None:
4444
super(LogsIngestionClientConfiguration, self).__init__(**kwargs)
45-
api_version: Literal["2021-11-01-preview"] = kwargs.pop("api_version", "2021-11-01-preview")
45+
api_version: Literal["2023-01-01"] = kwargs.pop("api_version", "2023-01-01")
4646

4747
if endpoint is None:
4848
raise ValueError("Parameter 'endpoint' must not be None.")

sdk/monitor/azure-monitor-ingestion/azure/monitor/ingestion/_models.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,11 @@
66
from typing import Any, List
77

88
if sys.version_info >= (3, 9):
9-
from collections.abc import MutableMapping
9+
from collections.abc import Mapping
1010
else:
11-
from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports
11+
from typing import Mapping # type: ignore # pylint: disable=ungrouped-imports
1212

13-
JSON = MutableMapping[str, Any] # pylint: disable=unsubscriptable-object
13+
JSON = Mapping[str, Any] # pylint: disable=unsubscriptable-object
1414

1515

1616
class UploadLogsError:

sdk/monitor/azure-monitor-ingestion/azure/monitor/ingestion/_operations/_operations.py

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -54,9 +54,7 @@ def build_logs_ingestion_upload_request(
5454
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
5555

5656
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
57-
api_version: Literal["2021-11-01-preview"] = kwargs.pop(
58-
"api_version", _params.pop("api-version", "2021-11-01-preview")
59-
)
57+
api_version: Literal["2023-01-01"] = kwargs.pop("api_version", _params.pop("api-version", "2023-01-01"))
6058
accept = _headers.pop("Accept", "application/json")
6159

6260
# Construct URL
@@ -180,7 +178,7 @@ def upload( # pylint: disable=inconsistent-return-statements
180178
:param stream: The streamDeclaration name as defined in the Data Collection Rule. Required.
181179
:type stream: str
182180
:param body: An array of objects matching the schema defined by the provided stream. Is either
183-
a list type or a IO type. Required.
181+
a [JSON] type or a IO type. Required.
184182
:type body: list[JSON] or IO
185183
:keyword content_encoding: gzip. Default value is None.
186184
:paramtype content_encoding: str

sdk/monitor/azure-monitor-ingestion/azure/monitor/ingestion/_operations/_patch.py

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -16,17 +16,17 @@
1616
from .._models import UploadLogsError
1717

1818
if sys.version_info >= (3, 9):
19-
from collections.abc import MutableMapping
19+
from collections.abc import Mapping, MutableMapping
2020
else:
21-
from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports
21+
from typing import Mapping, MutableMapping # type: ignore # pylint: disable=ungrouped-imports
2222

2323

2424
_LOGGER = logging.getLogger(__name__)
2525
JSON = MutableMapping[str, Any] # pylint: disable=unsubscriptable-object
2626

2727

2828
class LogsIngestionClientOperationsMixin(GeneratedOps):
29-
def upload( # type:ignore[override] # pylint: disable=arguments-renamed, arguments-differ
29+
def upload( # type: ignore[override] # pylint: disable=arguments-renamed, arguments-differ
3030
self,
3131
rule_id: str,
3232
stream_name: str,
@@ -70,15 +70,11 @@ def upload( # type:ignore[override] # pylint: disable=arguments-renamed, argume
7070
for gzip_data, log_chunk in _create_gzip_requests(cast(List[JSON], logs)):
7171
try:
7272
super().upload(
73-
rule_id,
74-
stream=stream_name,
75-
body=gzip_data, # type: ignore
76-
content_encoding="gzip",
77-
**kwargs
73+
rule_id, stream=stream_name, body=gzip_data, content_encoding="gzip", **kwargs # type: ignore
7874
)
7975
except Exception as err: # pylint: disable=broad-except
8076
if on_error:
81-
on_error(UploadLogsError(error=err, failed_logs=log_chunk))
77+
on_error(UploadLogsError(error=err, failed_logs=cast(List[Mapping[str, Any]], log_chunk)))
8278
else:
8379
_LOGGER.error("Failed to upload chunk containing %d log entries", len(log_chunk))
8480
raise err

sdk/monitor/azure-monitor-ingestion/azure/monitor/ingestion/aio/_client.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -29,8 +29,8 @@ class LogsIngestionClient(LogsIngestionClientOperationsMixin): # pylint: disabl
2929
:type endpoint: str
3030
:param credential: Credential needed for the client to connect to Azure. Required.
3131
:type credential: ~azure.core.credentials_async.AsyncTokenCredential
32-
:keyword api_version: Api Version. Default value is "2021-11-01-preview". Note that overriding
33-
this default value may result in unsupported behavior.
32+
:keyword api_version: Api Version. Default value is "2023-01-01". Note that overriding this
33+
default value may result in unsupported behavior.
3434
:paramtype api_version: str
3535
"""
3636

@@ -76,5 +76,5 @@ async def __aenter__(self) -> "LogsIngestionClient":
7676
await self._client.__aenter__()
7777
return self
7878

79-
async def __aexit__(self, *exc_details) -> None:
79+
async def __aexit__(self, *exc_details: Any) -> None:
8080
await self._client.__aexit__(*exc_details)

sdk/monitor/azure-monitor-ingestion/azure/monitor/ingestion/aio/_configuration.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -35,14 +35,14 @@ class LogsIngestionClientConfiguration(Configuration): # pylint: disable=too-ma
3535
:type endpoint: str
3636
:param credential: Credential needed for the client to connect to Azure. Required.
3737
:type credential: ~azure.core.credentials_async.AsyncTokenCredential
38-
:keyword api_version: Api Version. Default value is "2021-11-01-preview". Note that overriding
39-
this default value may result in unsupported behavior.
38+
:keyword api_version: Api Version. Default value is "2023-01-01". Note that overriding this
39+
default value may result in unsupported behavior.
4040
:paramtype api_version: str
4141
"""
4242

4343
def __init__(self, endpoint: str, credential: "AsyncTokenCredential", **kwargs: Any) -> None:
4444
super(LogsIngestionClientConfiguration, self).__init__(**kwargs)
45-
api_version: Literal["2021-11-01-preview"] = kwargs.pop("api_version", "2021-11-01-preview")
45+
api_version: Literal["2023-01-01"] = kwargs.pop("api_version", "2023-01-01")
4646

4747
if endpoint is None:
4848
raise ValueError("Parameter 'endpoint' must not be None.")

sdk/monitor/azure-monitor-ingestion/azure/monitor/ingestion/aio/_operations/_operations.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -132,7 +132,7 @@ async def upload( # pylint: disable=inconsistent-return-statements
132132
:param stream: The streamDeclaration name as defined in the Data Collection Rule. Required.
133133
:type stream: str
134134
:param body: An array of objects matching the schema defined by the provided stream. Is either
135-
a list type or a IO type. Required.
135+
a [JSON] type or a IO type. Required.
136136
:type body: list[JSON] or IO
137137
:keyword content_encoding: gzip. Default value is None.
138138
:paramtype content_encoding: str

sdk/monitor/azure-monitor-ingestion/azure/monitor/ingestion/aio/_operations/_patch.py

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -16,17 +16,17 @@
1616
from ..._models import UploadLogsError
1717

1818
if sys.version_info >= (3, 9):
19-
from collections.abc import MutableMapping
19+
from collections.abc import Mapping, MutableMapping
2020
else:
21-
from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports
21+
from typing import Mapping, MutableMapping # type: ignore # pylint: disable=ungrouped-imports
2222

2323

2424
_LOGGER = logging.getLogger(__name__)
2525
JSON = MutableMapping[str, Any] # pylint: disable=unsubscriptable-object
2626

2727

2828
class LogsIngestionClientOperationsMixin(GeneratedOps):
29-
async def upload( # type:ignore[override] # pylint: disable=arguments-renamed, arguments-differ
29+
async def upload( # type: ignore[override] # pylint: disable=arguments-renamed, arguments-differ
3030
self,
3131
rule_id: str,
3232
stream_name: str,
@@ -70,15 +70,11 @@ async def upload( # type:ignore[override] # pylint: disable=arguments-renamed,
7070
for gzip_data, log_chunk in _create_gzip_requests(cast(List[JSON], logs)):
7171
try:
7272
await super().upload(
73-
rule_id,
74-
stream=stream_name,
75-
body=gzip_data, # type: ignore
76-
content_encoding="gzip",
77-
**kwargs
73+
rule_id, stream=stream_name, body=gzip_data, content_encoding="gzip", **kwargs # type: ignore
7874
)
7975
except Exception as err: # pylint: disable=broad-except
8076
if on_error:
81-
await on_error(UploadLogsError(error=err, failed_logs=log_chunk))
77+
await on_error(UploadLogsError(error=err, failed_logs=cast(List[Mapping[str, Any]], log_chunk)))
8278
else:
8379
_LOGGER.error("Failed to upload chunk containing %d log entries", len(log_chunk))
8480
raise err

0 commit comments

Comments
 (0)