Skip to content
Open
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
2 changes: 2 additions & 0 deletions sdk/monitor/azure-monitor-querymetrics/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@

### Other Changes

- Bump minimum dependency on `azure-core` to `>=1.37.0`.

## 1.0.0 (2025-07-28)

### Features Added
Expand Down
5 changes: 4 additions & 1 deletion sdk/monitor/azure-monitor-querymetrics/_metadata.json
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
{
"apiVersion": "2024-02-01"
"apiVersion": "2024-02-01",
"apiVersions": {
"MonitorQueryMetrics": "2024-02-01"
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
from azure.core.rest import HttpRequest, HttpResponse

from ._configuration import MetricsClientConfiguration
from ._operations._operations import _MetricsClientOperationsMixin
from ._operations import _MetricsClientOperationsMixin
from ._utils.serialization import Deserializer, Serializer

if TYPE_CHECKING:
Expand All @@ -27,14 +27,14 @@ class MetricsClient(_MetricsClientOperationsMixin):

:param endpoint: The regional endpoint to use, for example
`https://eastus.metrics.monitor.azure.com <https://eastus.metrics.monitor.azure.com>`_. The
region should match
the region of the requested resources. For global resources, the region should be 'global'.
Required.
region should match the region of the requested resources. For global resources, the region
should be 'global'. Required.
:type endpoint: str
:param credential: Credential used to authenticate requests to the service. Required.
:type credential: ~azure.core.credentials.TokenCredential
:keyword api_version: The API version to use for this operation. Default value is "2024-02-01".
Note that overriding this default value may result in unsupported behavior.
:keyword api_version: The API version to use for this operation. Known values are "2024-02-01".
Default value is "2024-02-01". Note that overriding this default value may result in
unsupported behavior.
:paramtype api_version: str
"""

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,14 +24,14 @@ class MetricsClientConfiguration: # pylint: disable=too-many-instance-attribute

:param endpoint: The regional endpoint to use, for example
`https://eastus.metrics.monitor.azure.com <https://eastus.metrics.monitor.azure.com>`_. The
region should match
the region of the requested resources. For global resources, the region should be 'global'.
Required.
region should match the region of the requested resources. For global resources, the region
should be 'global'. Required.
:type endpoint: str
:param credential: Credential used to authenticate requests to the service. Required.
:type credential: ~azure.core.credentials.TokenCredential
:keyword api_version: The API version to use for this operation. Default value is "2024-02-01".
Note that overriding this default value may result in unsupported behavior.
:keyword api_version: The API version to use for this operation. Known values are "2024-02-01".
Default value is "2024-02-01". Note that overriding this default value may result in
unsupported behavior.
:paramtype api_version: str
"""

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
if TYPE_CHECKING:
from ._patch import * # pylint: disable=unused-wildcard-import

from ._operations import _MetricsClientOperationsMixin # type: ignore # pylint: disable=unused-import

from ._patch import __all__ as _patch_all
from ._patch import *
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
# pylint: disable=too-many-locals,protected-access
# coding=utf-8
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
Expand All @@ -9,7 +8,7 @@
from collections.abc import MutableMapping
from io import IOBase
import json
from typing import Any, Callable, Dict, IO, List, Optional, TypeVar, Union, overload
from typing import Any, Callable, IO, Optional, TypeVar, Union, overload

from azure.core import PipelineClient
from azure.core.exceptions import (
Expand All @@ -35,7 +34,7 @@

JSON = MutableMapping[str, Any]
T = TypeVar("T")
ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]]
ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, dict[str, Any]], Any]]

_SERIALIZER = Serializer()
_SERIALIZER.client_side_validation = False
Expand All @@ -45,7 +44,7 @@ def build_metrics_query_resources_request(
subscription_id: str,
*,
metric_namespace: str,
metric_names: List[str],
metric_names: list[str],
start_time: Optional[str] = None,
end_time: Optional[str] = None,
interval: Optional[str] = None,
Expand Down Expand Up @@ -111,7 +110,7 @@ def _query_resources(
batch_request: _models._models.ResourceIdList,
*,
metric_namespace: str,
metric_names: List[str],
metric_names: list[str],
start_time: Optional[str] = None,
end_time: Optional[str] = None,
interval: Optional[str] = None,
Expand All @@ -130,7 +129,7 @@ def _query_resources(
batch_request: JSON,
*,
metric_namespace: str,
metric_names: List[str],
metric_names: list[str],
start_time: Optional[str] = None,
end_time: Optional[str] = None,
interval: Optional[str] = None,
Expand All @@ -149,7 +148,7 @@ def _query_resources(
batch_request: IO[bytes],
*,
metric_namespace: str,
metric_names: List[str],
metric_names: list[str],
start_time: Optional[str] = None,
end_time: Optional[str] = None,
interval: Optional[str] = None,
Expand All @@ -163,13 +162,13 @@ def _query_resources(
) -> _models._models.MetricResultsResponse: ...

@distributed_trace
def _query_resources(
def _query_resources( # pylint: disable=too-many-locals
self,
subscription_id: str,
batch_request: Union[_models._models.ResourceIdList, JSON, IO[bytes]],
*,
metric_namespace: str,
metric_names: List[str],
metric_names: list[str],
start_time: Optional[str] = None,
end_time: Optional[str] = None,
interval: Optional[str] = None,
Expand Down Expand Up @@ -281,6 +280,7 @@ def _query_resources(
}
_request.url = self._client.format_url(_request.url, **path_format_arguments)

_decompress = kwargs.pop("decompress", True)
_stream = kwargs.pop("stream", False)
pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access
_request, stream=_stream, **kwargs
Expand All @@ -295,11 +295,14 @@ def _query_resources(
except (StreamConsumedError, StreamClosedError):
pass
map_error(status_code=response.status_code, response=response, error_map=error_map)
error = _failsafe_deserialize(_models._models.ErrorResponse, response.json())
error = _failsafe_deserialize(
_models._models.ErrorResponse, # pylint: disable=protected-access
response,
)
raise HttpResponseError(response=response, model=error)

if _stream:
deserialized = response.iter_bytes()
deserialized = response.iter_bytes() if _decompress else response.iter_raw()
else:
deserialized = _deserialize(
_models._models.MetricResultsResponse, response.json() # pylint: disable=protected-access
Expand Down
Loading