[Monitor Query] Update swagger (#34614)
The swagger file are updated and the code is regenerated. Signed-off-by: Paul Van Eck <paulvaneck@microsoft.com>
This commit is contained in:
Родитель
4207b9f110
Коммит
8f8ec650f0
|
@ -2,5 +2,5 @@
|
|||
"AssetsRepo": "Azure/azure-sdk-assets",
|
||||
"AssetsRepoPrefixPath": "python",
|
||||
"TagPrefix": "python/monitor/azure-monitor-query",
|
||||
"Tag": "python/monitor/azure-monitor-query_152690fb22"
|
||||
"Tag": "python/monitor/azure-monitor-query_8640f7c705"
|
||||
}
|
||||
|
|
|
@ -170,13 +170,6 @@ class RawDeserializer:
|
|||
return None
|
||||
|
||||
|
||||
try:
|
||||
basestring # type: ignore
|
||||
unicode_str = unicode # type: ignore
|
||||
except NameError:
|
||||
basestring = str
|
||||
unicode_str = str
|
||||
|
||||
_LOGGER = logging.getLogger(__name__)
|
||||
|
||||
try:
|
||||
|
@ -545,7 +538,7 @@ class Serializer(object):
|
|||
"multiple": lambda x, y: x % y != 0,
|
||||
}
|
||||
|
||||
def __init__(self, classes: Optional[Mapping[str, Type[ModelType]]] = None):
|
||||
def __init__(self, classes: Optional[Mapping[str, type]] = None):
|
||||
self.serialize_type = {
|
||||
"iso-8601": Serializer.serialize_iso,
|
||||
"rfc-1123": Serializer.serialize_rfc,
|
||||
|
@ -561,7 +554,7 @@ class Serializer(object):
|
|||
"[]": self.serialize_iter,
|
||||
"{}": self.serialize_dict,
|
||||
}
|
||||
self.dependencies: Dict[str, Type[ModelType]] = dict(classes) if classes else {}
|
||||
self.dependencies: Dict[str, type] = dict(classes) if classes else {}
|
||||
self.key_transformer = full_restapi_key_transformer
|
||||
self.client_side_validation = True
|
||||
|
||||
|
@ -649,7 +642,7 @@ class Serializer(object):
|
|||
else: # That's a basic type
|
||||
# Integrate namespace if necessary
|
||||
local_node = _create_xml_node(xml_name, xml_prefix, xml_ns)
|
||||
local_node.text = unicode_str(new_attr)
|
||||
local_node.text = str(new_attr)
|
||||
serialized.append(local_node) # type: ignore
|
||||
else: # JSON
|
||||
for k in reversed(keys): # type: ignore
|
||||
|
@ -994,7 +987,7 @@ class Serializer(object):
|
|||
return self.serialize_basic(attr, self.basic_types[obj_type], **kwargs)
|
||||
if obj_type is _long_type:
|
||||
return self.serialize_long(attr)
|
||||
if obj_type is unicode_str:
|
||||
if obj_type is str:
|
||||
return self.serialize_unicode(attr)
|
||||
if obj_type is datetime.datetime:
|
||||
return self.serialize_iso(attr)
|
||||
|
@ -1370,7 +1363,7 @@ class Deserializer(object):
|
|||
|
||||
valid_date = re.compile(r"\d{4}[-]\d{2}[-]\d{2}T\d{2}:\d{2}:\d{2}" r"\.?\d*Z?[-+]?[\d{2}]?:?[\d{2}]?")
|
||||
|
||||
def __init__(self, classes: Optional[Mapping[str, Type[ModelType]]] = None):
|
||||
def __init__(self, classes: Optional[Mapping[str, type]] = None):
|
||||
self.deserialize_type = {
|
||||
"iso-8601": Deserializer.deserialize_iso,
|
||||
"rfc-1123": Deserializer.deserialize_rfc,
|
||||
|
@ -1390,7 +1383,7 @@ class Deserializer(object):
|
|||
"duration": (isodate.Duration, datetime.timedelta),
|
||||
"iso-8601": (datetime.datetime),
|
||||
}
|
||||
self.dependencies: Dict[str, Type[ModelType]] = dict(classes) if classes else {}
|
||||
self.dependencies: Dict[str, type] = dict(classes) if classes else {}
|
||||
self.key_extractors = [rest_key_extractor, xml_key_extractor]
|
||||
# Additional properties only works if the "rest_key_extractor" is used to
|
||||
# extract the keys. Making it to work whatever the key extractor is too much
|
||||
|
@ -1443,7 +1436,7 @@ class Deserializer(object):
|
|||
|
||||
response, class_name = self._classify_target(target_obj, data)
|
||||
|
||||
if isinstance(response, basestring):
|
||||
if isinstance(response, str):
|
||||
return self.deserialize_data(data, response)
|
||||
elif isinstance(response, type) and issubclass(response, Enum):
|
||||
return self.deserialize_enum(data, response)
|
||||
|
@ -1514,14 +1507,14 @@ class Deserializer(object):
|
|||
if target is None:
|
||||
return None, None
|
||||
|
||||
if isinstance(target, basestring):
|
||||
if isinstance(target, str):
|
||||
try:
|
||||
target = self.dependencies[target]
|
||||
except KeyError:
|
||||
return target, target
|
||||
|
||||
try:
|
||||
target = target._classify(data, self.dependencies)
|
||||
target = target._classify(data, self.dependencies) # type: ignore
|
||||
except AttributeError:
|
||||
pass # Target is not a Model, no classify
|
||||
return target, target.__class__.__name__ # type: ignore
|
||||
|
@ -1577,7 +1570,7 @@ class Deserializer(object):
|
|||
if hasattr(raw_data, "_content_consumed"):
|
||||
return RawDeserializer.deserialize_from_http_generics(raw_data.text, raw_data.headers)
|
||||
|
||||
if isinstance(raw_data, (basestring, bytes)) or hasattr(raw_data, "read"):
|
||||
if isinstance(raw_data, (str, bytes)) or hasattr(raw_data, "read"):
|
||||
return RawDeserializer.deserialize_from_text(raw_data, content_type) # type: ignore
|
||||
return raw_data
|
||||
|
||||
|
@ -1699,7 +1692,7 @@ class Deserializer(object):
|
|||
if isinstance(attr, ET.Element):
|
||||
# Do no recurse on XML, just return the tree as-is
|
||||
return attr
|
||||
if isinstance(attr, basestring):
|
||||
if isinstance(attr, str):
|
||||
return self.deserialize_basic(attr, "str")
|
||||
obj_type = type(attr)
|
||||
if obj_type in self.basic_types:
|
||||
|
@ -1756,7 +1749,7 @@ class Deserializer(object):
|
|||
if data_type == "bool":
|
||||
if attr in [True, False, 1, 0]:
|
||||
return bool(attr)
|
||||
elif isinstance(attr, basestring):
|
||||
elif isinstance(attr, str):
|
||||
if attr.lower() in ["true", "1"]:
|
||||
return True
|
||||
elif attr.lower() in ["false", "0"]:
|
||||
|
|
|
@ -384,9 +384,6 @@ class QueryOperations:
|
|||
:keyword prefer: Optional. The prefer header to set server timeout, query statistics and
|
||||
visualization information. Default value is None.
|
||||
:paramtype prefer: str
|
||||
:keyword content_type: Body Parameter content-type. Known values are: 'application/json'.
|
||||
Default value is None.
|
||||
:paramtype content_type: str
|
||||
:return: JSON object
|
||||
:rtype: JSON
|
||||
:raises ~azure.core.exceptions.HttpResponseError:
|
||||
|
@ -829,9 +826,6 @@ class QueryOperations:
|
|||
:keyword prefer: Optional. The prefer header to set server timeout, query statistics and
|
||||
visualization information. Default value is None.
|
||||
:paramtype prefer: str
|
||||
:keyword content_type: Body Parameter content-type. Known values are: 'application/json'.
|
||||
Default value is None.
|
||||
:paramtype content_type: str
|
||||
:return: JSON object
|
||||
:rtype: JSON
|
||||
:raises ~azure.core.exceptions.HttpResponseError:
|
||||
|
@ -1182,9 +1176,6 @@ class QueryOperations:
|
|||
|
||||
:param body: The batch request body. Is either a JSON type or a IO[bytes] type. Required.
|
||||
:type body: JSON or IO[bytes]
|
||||
:keyword content_type: Body Parameter content-type. Known values are: 'application/json'.
|
||||
Default value is None.
|
||||
:paramtype content_type: str
|
||||
:return: JSON object
|
||||
:rtype: JSON
|
||||
:raises ~azure.core.exceptions.HttpResponseError:
|
||||
|
@ -1669,9 +1660,6 @@ class QueryOperations:
|
|||
:keyword prefer: Optional. The prefer header to set server timeout, query statistics and
|
||||
visualization information. Default value is None.
|
||||
:paramtype prefer: str
|
||||
:keyword content_type: Body Parameter content-type. Known values are: 'application/json'.
|
||||
Default value is None.
|
||||
:paramtype content_type: str
|
||||
:return: JSON object
|
||||
:rtype: JSON
|
||||
:raises ~azure.core.exceptions.HttpResponseError:
|
||||
|
|
|
@ -29,6 +29,9 @@ class MonitorMetricsClient: # pylint: disable=client-accepts-api-version-keywor
|
|||
:vartype metric_namespaces: monitor_metrics_client.operations.MetricNamespacesOperations
|
||||
:keyword endpoint: Service URL. Default value is "https://management.azure.com".
|
||||
:paramtype endpoint: str
|
||||
:keyword api_version: Api Version. Default value is "2024-02-01". Note that overriding this
|
||||
default value may result in unsupported behavior.
|
||||
:paramtype api_version: str
|
||||
"""
|
||||
|
||||
def __init__( # pylint: disable=missing-client-constructor-parameter-credential
|
||||
|
|
|
@ -18,10 +18,16 @@ class MonitorMetricsClientConfiguration: # pylint: disable=too-many-instance-at
|
|||
|
||||
Note that all parameters used to create this instance are saved as instance
|
||||
attributes.
|
||||
|
||||
:keyword api_version: Api Version. Default value is "2024-02-01". Note that overriding this
|
||||
default value may result in unsupported behavior.
|
||||
:paramtype api_version: str
|
||||
"""
|
||||
|
||||
def __init__(self, **kwargs: Any) -> None:
|
||||
api_version: str = kwargs.pop("api_version", "2024-02-01")
|
||||
|
||||
self.api_version = api_version
|
||||
kwargs.setdefault("sdk_moniker", "monitor-query/{}".format(VERSION))
|
||||
self.polling_interval = kwargs.get("polling_interval", 30)
|
||||
self._configure(**kwargs)
|
||||
|
|
|
@ -170,13 +170,6 @@ class RawDeserializer:
|
|||
return None
|
||||
|
||||
|
||||
try:
|
||||
basestring # type: ignore
|
||||
unicode_str = unicode # type: ignore
|
||||
except NameError:
|
||||
basestring = str
|
||||
unicode_str = str
|
||||
|
||||
_LOGGER = logging.getLogger(__name__)
|
||||
|
||||
try:
|
||||
|
@ -545,7 +538,7 @@ class Serializer(object):
|
|||
"multiple": lambda x, y: x % y != 0,
|
||||
}
|
||||
|
||||
def __init__(self, classes: Optional[Mapping[str, Type[ModelType]]] = None):
|
||||
def __init__(self, classes: Optional[Mapping[str, type]] = None):
|
||||
self.serialize_type = {
|
||||
"iso-8601": Serializer.serialize_iso,
|
||||
"rfc-1123": Serializer.serialize_rfc,
|
||||
|
@ -561,7 +554,7 @@ class Serializer(object):
|
|||
"[]": self.serialize_iter,
|
||||
"{}": self.serialize_dict,
|
||||
}
|
||||
self.dependencies: Dict[str, Type[ModelType]] = dict(classes) if classes else {}
|
||||
self.dependencies: Dict[str, type] = dict(classes) if classes else {}
|
||||
self.key_transformer = full_restapi_key_transformer
|
||||
self.client_side_validation = True
|
||||
|
||||
|
@ -649,7 +642,7 @@ class Serializer(object):
|
|||
else: # That's a basic type
|
||||
# Integrate namespace if necessary
|
||||
local_node = _create_xml_node(xml_name, xml_prefix, xml_ns)
|
||||
local_node.text = unicode_str(new_attr)
|
||||
local_node.text = str(new_attr)
|
||||
serialized.append(local_node) # type: ignore
|
||||
else: # JSON
|
||||
for k in reversed(keys): # type: ignore
|
||||
|
@ -994,7 +987,7 @@ class Serializer(object):
|
|||
return self.serialize_basic(attr, self.basic_types[obj_type], **kwargs)
|
||||
if obj_type is _long_type:
|
||||
return self.serialize_long(attr)
|
||||
if obj_type is unicode_str:
|
||||
if obj_type is str:
|
||||
return self.serialize_unicode(attr)
|
||||
if obj_type is datetime.datetime:
|
||||
return self.serialize_iso(attr)
|
||||
|
@ -1370,7 +1363,7 @@ class Deserializer(object):
|
|||
|
||||
valid_date = re.compile(r"\d{4}[-]\d{2}[-]\d{2}T\d{2}:\d{2}:\d{2}" r"\.?\d*Z?[-+]?[\d{2}]?:?[\d{2}]?")
|
||||
|
||||
def __init__(self, classes: Optional[Mapping[str, Type[ModelType]]] = None):
|
||||
def __init__(self, classes: Optional[Mapping[str, type]] = None):
|
||||
self.deserialize_type = {
|
||||
"iso-8601": Deserializer.deserialize_iso,
|
||||
"rfc-1123": Deserializer.deserialize_rfc,
|
||||
|
@ -1390,7 +1383,7 @@ class Deserializer(object):
|
|||
"duration": (isodate.Duration, datetime.timedelta),
|
||||
"iso-8601": (datetime.datetime),
|
||||
}
|
||||
self.dependencies: Dict[str, Type[ModelType]] = dict(classes) if classes else {}
|
||||
self.dependencies: Dict[str, type] = dict(classes) if classes else {}
|
||||
self.key_extractors = [rest_key_extractor, xml_key_extractor]
|
||||
# Additional properties only works if the "rest_key_extractor" is used to
|
||||
# extract the keys. Making it to work whatever the key extractor is too much
|
||||
|
@ -1443,7 +1436,7 @@ class Deserializer(object):
|
|||
|
||||
response, class_name = self._classify_target(target_obj, data)
|
||||
|
||||
if isinstance(response, basestring):
|
||||
if isinstance(response, str):
|
||||
return self.deserialize_data(data, response)
|
||||
elif isinstance(response, type) and issubclass(response, Enum):
|
||||
return self.deserialize_enum(data, response)
|
||||
|
@ -1514,14 +1507,14 @@ class Deserializer(object):
|
|||
if target is None:
|
||||
return None, None
|
||||
|
||||
if isinstance(target, basestring):
|
||||
if isinstance(target, str):
|
||||
try:
|
||||
target = self.dependencies[target]
|
||||
except KeyError:
|
||||
return target, target
|
||||
|
||||
try:
|
||||
target = target._classify(data, self.dependencies)
|
||||
target = target._classify(data, self.dependencies) # type: ignore
|
||||
except AttributeError:
|
||||
pass # Target is not a Model, no classify
|
||||
return target, target.__class__.__name__ # type: ignore
|
||||
|
@ -1577,7 +1570,7 @@ class Deserializer(object):
|
|||
if hasattr(raw_data, "_content_consumed"):
|
||||
return RawDeserializer.deserialize_from_http_generics(raw_data.text, raw_data.headers)
|
||||
|
||||
if isinstance(raw_data, (basestring, bytes)) or hasattr(raw_data, "read"):
|
||||
if isinstance(raw_data, (str, bytes)) or hasattr(raw_data, "read"):
|
||||
return RawDeserializer.deserialize_from_text(raw_data, content_type) # type: ignore
|
||||
return raw_data
|
||||
|
||||
|
@ -1699,7 +1692,7 @@ class Deserializer(object):
|
|||
if isinstance(attr, ET.Element):
|
||||
# Do no recurse on XML, just return the tree as-is
|
||||
return attr
|
||||
if isinstance(attr, basestring):
|
||||
if isinstance(attr, str):
|
||||
return self.deserialize_basic(attr, "str")
|
||||
obj_type = type(attr)
|
||||
if obj_type in self.basic_types:
|
||||
|
@ -1756,7 +1749,7 @@ class Deserializer(object):
|
|||
if data_type == "bool":
|
||||
if attr in [True, False, 1, 0]:
|
||||
return bool(attr)
|
||||
elif isinstance(attr, basestring):
|
||||
elif isinstance(attr, str):
|
||||
if attr.lower() in ["true", "1"]:
|
||||
return True
|
||||
elif attr.lower() in ["false", "0"]:
|
||||
|
|
|
@ -29,6 +29,9 @@ class MonitorMetricsClient: # pylint: disable=client-accepts-api-version-keywor
|
|||
:vartype metric_namespaces: monitor_metrics_client.aio.operations.MetricNamespacesOperations
|
||||
:keyword endpoint: Service URL. Default value is "https://management.azure.com".
|
||||
:paramtype endpoint: str
|
||||
:keyword api_version: Api Version. Default value is "2024-02-01". Note that overriding this
|
||||
default value may result in unsupported behavior.
|
||||
:paramtype api_version: str
|
||||
"""
|
||||
|
||||
def __init__( # pylint: disable=missing-client-constructor-parameter-credential
|
||||
|
|
|
@ -18,10 +18,16 @@ class MonitorMetricsClientConfiguration: # pylint: disable=too-many-instance-at
|
|||
|
||||
Note that all parameters used to create this instance are saved as instance
|
||||
attributes.
|
||||
|
||||
:keyword api_version: Api Version. Default value is "2024-02-01". Note that overriding this
|
||||
default value may result in unsupported behavior.
|
||||
:paramtype api_version: str
|
||||
"""
|
||||
|
||||
def __init__(self, **kwargs: Any) -> None:
|
||||
api_version: str = kwargs.pop("api_version", "2024-02-01")
|
||||
|
||||
self.api_version = api_version
|
||||
kwargs.setdefault("sdk_moniker", "monitor-query/{}".format(VERSION))
|
||||
self.polling_interval = kwargs.get("polling_interval", 30)
|
||||
self._configure(**kwargs)
|
||||
|
|
|
@ -9,6 +9,7 @@
|
|||
import datetime
|
||||
import sys
|
||||
from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar, cast
|
||||
import urllib.parse
|
||||
|
||||
from azure.core.async_paging import AsyncItemPaged, AsyncList
|
||||
from azure.core.exceptions import (
|
||||
|
@ -121,9 +122,8 @@ class MetricDefinitionsOperations:
|
|||
}
|
||||
"""
|
||||
_headers = kwargs.pop("headers", {}) or {}
|
||||
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
|
||||
_params = kwargs.pop("params", {}) or {}
|
||||
|
||||
api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-10-01"))
|
||||
cls: ClsType[JSON] = kwargs.pop("cls", None)
|
||||
|
||||
error_map = {
|
||||
|
@ -140,14 +140,25 @@ class MetricDefinitionsOperations:
|
|||
_request = build_metric_definitions_list_request(
|
||||
resource_uri=resource_uri,
|
||||
metricnamespace=metricnamespace,
|
||||
api_version=api_version,
|
||||
api_version=self._config.api_version,
|
||||
headers=_headers,
|
||||
params=_params,
|
||||
)
|
||||
_request.url = self._client.format_url(_request.url)
|
||||
|
||||
else:
|
||||
_request = HttpRequest("GET", next_link)
|
||||
# make call to next link with the client's api-version
|
||||
_parsed_next_link = urllib.parse.urlparse(next_link)
|
||||
_next_request_params = case_insensitive_dict(
|
||||
{
|
||||
key: [urllib.parse.quote(v) for v in value]
|
||||
for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items()
|
||||
}
|
||||
)
|
||||
_next_request_params["api-version"] = self._config.api_version
|
||||
_request = HttpRequest(
|
||||
"GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params
|
||||
)
|
||||
_request.url = self._client.format_url(_request.url)
|
||||
|
||||
return _request
|
||||
|
@ -365,9 +376,8 @@ class MetricsOperations:
|
|||
error_map.update(kwargs.pop("error_map", {}) or {})
|
||||
|
||||
_headers = kwargs.pop("headers", {}) or {}
|
||||
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
|
||||
_params = kwargs.pop("params", {}) or {}
|
||||
|
||||
api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-10-01"))
|
||||
cls: ClsType[JSON] = kwargs.pop("cls", None)
|
||||
|
||||
_request = build_metrics_list_request(
|
||||
|
@ -384,7 +394,7 @@ class MetricsOperations:
|
|||
auto_adjust_timegrain=auto_adjust_timegrain,
|
||||
validate_dimensions=validate_dimensions,
|
||||
rollupby=rollupby,
|
||||
api_version=api_version,
|
||||
api_version=self._config.api_version,
|
||||
headers=_headers,
|
||||
params=_params,
|
||||
)
|
||||
|
@ -460,9 +470,8 @@ class MetricNamespacesOperations:
|
|||
}
|
||||
"""
|
||||
_headers = kwargs.pop("headers", {}) or {}
|
||||
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
|
||||
_params = kwargs.pop("params", {}) or {}
|
||||
|
||||
api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2017-12-01-preview"))
|
||||
cls: ClsType[JSON] = kwargs.pop("cls", None)
|
||||
|
||||
error_map = {
|
||||
|
@ -479,14 +488,25 @@ class MetricNamespacesOperations:
|
|||
_request = build_metric_namespaces_list_request(
|
||||
resource_uri=resource_uri,
|
||||
start_time=start_time,
|
||||
api_version=api_version,
|
||||
api_version=self._config.api_version,
|
||||
headers=_headers,
|
||||
params=_params,
|
||||
)
|
||||
_request.url = self._client.format_url(_request.url)
|
||||
|
||||
else:
|
||||
_request = HttpRequest("GET", next_link)
|
||||
# make call to next link with the client's api-version
|
||||
_parsed_next_link = urllib.parse.urlparse(next_link)
|
||||
_next_request_params = case_insensitive_dict(
|
||||
{
|
||||
key: [urllib.parse.quote(v) for v in value]
|
||||
for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items()
|
||||
}
|
||||
)
|
||||
_next_request_params["api-version"] = self._config.api_version
|
||||
_request = HttpRequest(
|
||||
"GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params
|
||||
)
|
||||
_request.url = self._client.format_url(_request.url)
|
||||
|
||||
return _request
|
||||
|
|
|
@ -27,7 +27,7 @@ class MonitorBatchMetricsClient: # pylint: disable=client-accepts-api-version-k
|
|||
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.
|
||||
:type endpoint: str
|
||||
:keyword api_version: Api Version. Default value is "2023-10-01". Note that overriding this
|
||||
:keyword api_version: Api Version. Default value is "2024-02-01". Note that overriding this
|
||||
default value may result in unsupported behavior.
|
||||
:paramtype api_version: str
|
||||
"""
|
||||
|
|
|
@ -23,13 +23,13 @@ class MonitorBatchMetricsClientConfiguration: # pylint: disable=too-many-instan
|
|||
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.
|
||||
:type endpoint: str
|
||||
:keyword api_version: Api Version. Default value is "2023-10-01". Note that overriding this
|
||||
:keyword api_version: Api Version. Default value is "2024-02-01". Note that overriding this
|
||||
default value may result in unsupported behavior.
|
||||
:paramtype api_version: str
|
||||
"""
|
||||
|
||||
def __init__(self, endpoint: str, **kwargs: Any) -> None:
|
||||
api_version: str = kwargs.pop("api_version", "2023-10-01")
|
||||
api_version: str = kwargs.pop("api_version", "2024-02-01")
|
||||
|
||||
if endpoint is None:
|
||||
raise ValueError("Parameter 'endpoint' must not be None.")
|
||||
|
|
|
@ -170,13 +170,6 @@ class RawDeserializer:
|
|||
return None
|
||||
|
||||
|
||||
try:
|
||||
basestring # type: ignore
|
||||
unicode_str = unicode # type: ignore
|
||||
except NameError:
|
||||
basestring = str
|
||||
unicode_str = str
|
||||
|
||||
_LOGGER = logging.getLogger(__name__)
|
||||
|
||||
try:
|
||||
|
@ -545,7 +538,7 @@ class Serializer(object):
|
|||
"multiple": lambda x, y: x % y != 0,
|
||||
}
|
||||
|
||||
def __init__(self, classes: Optional[Mapping[str, Type[ModelType]]] = None):
|
||||
def __init__(self, classes: Optional[Mapping[str, type]] = None):
|
||||
self.serialize_type = {
|
||||
"iso-8601": Serializer.serialize_iso,
|
||||
"rfc-1123": Serializer.serialize_rfc,
|
||||
|
@ -561,7 +554,7 @@ class Serializer(object):
|
|||
"[]": self.serialize_iter,
|
||||
"{}": self.serialize_dict,
|
||||
}
|
||||
self.dependencies: Dict[str, Type[ModelType]] = dict(classes) if classes else {}
|
||||
self.dependencies: Dict[str, type] = dict(classes) if classes else {}
|
||||
self.key_transformer = full_restapi_key_transformer
|
||||
self.client_side_validation = True
|
||||
|
||||
|
@ -649,7 +642,7 @@ class Serializer(object):
|
|||
else: # That's a basic type
|
||||
# Integrate namespace if necessary
|
||||
local_node = _create_xml_node(xml_name, xml_prefix, xml_ns)
|
||||
local_node.text = unicode_str(new_attr)
|
||||
local_node.text = str(new_attr)
|
||||
serialized.append(local_node) # type: ignore
|
||||
else: # JSON
|
||||
for k in reversed(keys): # type: ignore
|
||||
|
@ -994,7 +987,7 @@ class Serializer(object):
|
|||
return self.serialize_basic(attr, self.basic_types[obj_type], **kwargs)
|
||||
if obj_type is _long_type:
|
||||
return self.serialize_long(attr)
|
||||
if obj_type is unicode_str:
|
||||
if obj_type is str:
|
||||
return self.serialize_unicode(attr)
|
||||
if obj_type is datetime.datetime:
|
||||
return self.serialize_iso(attr)
|
||||
|
@ -1370,7 +1363,7 @@ class Deserializer(object):
|
|||
|
||||
valid_date = re.compile(r"\d{4}[-]\d{2}[-]\d{2}T\d{2}:\d{2}:\d{2}" r"\.?\d*Z?[-+]?[\d{2}]?:?[\d{2}]?")
|
||||
|
||||
def __init__(self, classes: Optional[Mapping[str, Type[ModelType]]] = None):
|
||||
def __init__(self, classes: Optional[Mapping[str, type]] = None):
|
||||
self.deserialize_type = {
|
||||
"iso-8601": Deserializer.deserialize_iso,
|
||||
"rfc-1123": Deserializer.deserialize_rfc,
|
||||
|
@ -1390,7 +1383,7 @@ class Deserializer(object):
|
|||
"duration": (isodate.Duration, datetime.timedelta),
|
||||
"iso-8601": (datetime.datetime),
|
||||
}
|
||||
self.dependencies: Dict[str, Type[ModelType]] = dict(classes) if classes else {}
|
||||
self.dependencies: Dict[str, type] = dict(classes) if classes else {}
|
||||
self.key_extractors = [rest_key_extractor, xml_key_extractor]
|
||||
# Additional properties only works if the "rest_key_extractor" is used to
|
||||
# extract the keys. Making it to work whatever the key extractor is too much
|
||||
|
@ -1443,7 +1436,7 @@ class Deserializer(object):
|
|||
|
||||
response, class_name = self._classify_target(target_obj, data)
|
||||
|
||||
if isinstance(response, basestring):
|
||||
if isinstance(response, str):
|
||||
return self.deserialize_data(data, response)
|
||||
elif isinstance(response, type) and issubclass(response, Enum):
|
||||
return self.deserialize_enum(data, response)
|
||||
|
@ -1514,14 +1507,14 @@ class Deserializer(object):
|
|||
if target is None:
|
||||
return None, None
|
||||
|
||||
if isinstance(target, basestring):
|
||||
if isinstance(target, str):
|
||||
try:
|
||||
target = self.dependencies[target]
|
||||
except KeyError:
|
||||
return target, target
|
||||
|
||||
try:
|
||||
target = target._classify(data, self.dependencies)
|
||||
target = target._classify(data, self.dependencies) # type: ignore
|
||||
except AttributeError:
|
||||
pass # Target is not a Model, no classify
|
||||
return target, target.__class__.__name__ # type: ignore
|
||||
|
@ -1577,7 +1570,7 @@ class Deserializer(object):
|
|||
if hasattr(raw_data, "_content_consumed"):
|
||||
return RawDeserializer.deserialize_from_http_generics(raw_data.text, raw_data.headers)
|
||||
|
||||
if isinstance(raw_data, (basestring, bytes)) or hasattr(raw_data, "read"):
|
||||
if isinstance(raw_data, (str, bytes)) or hasattr(raw_data, "read"):
|
||||
return RawDeserializer.deserialize_from_text(raw_data, content_type) # type: ignore
|
||||
return raw_data
|
||||
|
||||
|
@ -1699,7 +1692,7 @@ class Deserializer(object):
|
|||
if isinstance(attr, ET.Element):
|
||||
# Do no recurse on XML, just return the tree as-is
|
||||
return attr
|
||||
if isinstance(attr, basestring):
|
||||
if isinstance(attr, str):
|
||||
return self.deserialize_basic(attr, "str")
|
||||
obj_type = type(attr)
|
||||
if obj_type in self.basic_types:
|
||||
|
@ -1756,7 +1749,7 @@ class Deserializer(object):
|
|||
if data_type == "bool":
|
||||
if attr in [True, False, 1, 0]:
|
||||
return bool(attr)
|
||||
elif isinstance(attr, basestring):
|
||||
elif isinstance(attr, str):
|
||||
if attr.lower() in ["true", "1"]:
|
||||
return True
|
||||
elif attr.lower() in ["false", "0"]:
|
||||
|
|
|
@ -27,7 +27,7 @@ class MonitorBatchMetricsClient: # pylint: disable=client-accepts-api-version-k
|
|||
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.
|
||||
:type endpoint: str
|
||||
:keyword api_version: Api Version. Default value is "2023-10-01". Note that overriding this
|
||||
:keyword api_version: Api Version. Default value is "2024-02-01". Note that overriding this
|
||||
default value may result in unsupported behavior.
|
||||
:paramtype api_version: str
|
||||
"""
|
||||
|
|
|
@ -23,13 +23,13 @@ class MonitorBatchMetricsClientConfiguration: # pylint: disable=too-many-instan
|
|||
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.
|
||||
:type endpoint: str
|
||||
:keyword api_version: Api Version. Default value is "2023-10-01". Note that overriding this
|
||||
:keyword api_version: Api Version. Default value is "2024-02-01". Note that overriding this
|
||||
default value may result in unsupported behavior.
|
||||
:paramtype api_version: str
|
||||
"""
|
||||
|
||||
def __init__(self, endpoint: str, **kwargs: Any) -> None:
|
||||
api_version: str = kwargs.pop("api_version", "2023-10-01")
|
||||
api_version: str = kwargs.pop("api_version", "2024-02-01")
|
||||
|
||||
if endpoint is None:
|
||||
raise ValueError("Parameter 'endpoint' must not be None.")
|
||||
|
|
|
@ -465,9 +465,6 @@ class MetricsBatchOperations:
|
|||
separate values for each city, you can specify 'RollUpBy=City' to see the results for Seattle
|
||||
and Tacoma rolled up into one timeseries. Default value is None.
|
||||
:paramtype rollupby: str
|
||||
:keyword content_type: Body Parameter content-type. Known values are: 'application/json'.
|
||||
Default value is None.
|
||||
:paramtype content_type: str
|
||||
:return: JSON object
|
||||
:rtype: JSON
|
||||
:raises ~azure.core.exceptions.HttpResponseError:
|
||||
|
|
|
@ -57,7 +57,7 @@ def build_metrics_batch_batch_request(
|
|||
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
|
||||
|
||||
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
|
||||
api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-10-01"))
|
||||
api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-02-01"))
|
||||
accept = _headers.pop("Accept", "application/json")
|
||||
|
||||
# Construct URL
|
||||
|
@ -527,9 +527,6 @@ class MetricsBatchOperations:
|
|||
separate values for each city, you can specify 'RollUpBy=City' to see the results for Seattle
|
||||
and Tacoma rolled up into one timeseries. Default value is None.
|
||||
:paramtype rollupby: str
|
||||
:keyword content_type: Body Parameter content-type. Known values are: 'application/json'.
|
||||
Default value is None.
|
||||
:paramtype content_type: str
|
||||
:return: JSON object
|
||||
:rtype: JSON
|
||||
:raises ~azure.core.exceptions.HttpResponseError:
|
||||
|
|
|
@ -9,6 +9,7 @@
|
|||
import datetime
|
||||
import sys
|
||||
from typing import Any, Callable, Dict, Iterable, Optional, TypeVar, cast
|
||||
import urllib.parse
|
||||
|
||||
from azure.core.exceptions import (
|
||||
ClientAuthenticationError,
|
||||
|
@ -44,7 +45,7 @@ def build_metric_definitions_list_request(
|
|||
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
|
||||
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
|
||||
|
||||
api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-10-01"))
|
||||
api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-02-01"))
|
||||
accept = _headers.pop("Accept", "application/json")
|
||||
|
||||
# Construct URL
|
||||
|
@ -86,7 +87,7 @@ def build_metrics_list_request(
|
|||
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
|
||||
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
|
||||
|
||||
api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-10-01"))
|
||||
api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-02-01"))
|
||||
accept = _headers.pop("Accept", "application/json")
|
||||
|
||||
# Construct URL
|
||||
|
@ -136,7 +137,7 @@ def build_metric_namespaces_list_request(
|
|||
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
|
||||
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
|
||||
|
||||
api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2017-12-01-preview"))
|
||||
api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-02-01"))
|
||||
accept = _headers.pop("Accept", "application/json")
|
||||
|
||||
# Construct URL
|
||||
|
@ -239,9 +240,8 @@ class MetricDefinitionsOperations:
|
|||
}
|
||||
"""
|
||||
_headers = kwargs.pop("headers", {}) or {}
|
||||
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
|
||||
_params = kwargs.pop("params", {}) or {}
|
||||
|
||||
api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-10-01"))
|
||||
cls: ClsType[JSON] = kwargs.pop("cls", None)
|
||||
|
||||
error_map = {
|
||||
|
@ -258,14 +258,25 @@ class MetricDefinitionsOperations:
|
|||
_request = build_metric_definitions_list_request(
|
||||
resource_uri=resource_uri,
|
||||
metricnamespace=metricnamespace,
|
||||
api_version=api_version,
|
||||
api_version=self._config.api_version,
|
||||
headers=_headers,
|
||||
params=_params,
|
||||
)
|
||||
_request.url = self._client.format_url(_request.url)
|
||||
|
||||
else:
|
||||
_request = HttpRequest("GET", next_link)
|
||||
# make call to next link with the client's api-version
|
||||
_parsed_next_link = urllib.parse.urlparse(next_link)
|
||||
_next_request_params = case_insensitive_dict(
|
||||
{
|
||||
key: [urllib.parse.quote(v) for v in value]
|
||||
for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items()
|
||||
}
|
||||
)
|
||||
_next_request_params["api-version"] = self._config.api_version
|
||||
_request = HttpRequest(
|
||||
"GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params
|
||||
)
|
||||
_request.url = self._client.format_url(_request.url)
|
||||
|
||||
return _request
|
||||
|
@ -483,9 +494,8 @@ class MetricsOperations:
|
|||
error_map.update(kwargs.pop("error_map", {}) or {})
|
||||
|
||||
_headers = kwargs.pop("headers", {}) or {}
|
||||
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
|
||||
_params = kwargs.pop("params", {}) or {}
|
||||
|
||||
api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-10-01"))
|
||||
cls: ClsType[JSON] = kwargs.pop("cls", None)
|
||||
|
||||
_request = build_metrics_list_request(
|
||||
|
@ -502,7 +512,7 @@ class MetricsOperations:
|
|||
auto_adjust_timegrain=auto_adjust_timegrain,
|
||||
validate_dimensions=validate_dimensions,
|
||||
rollupby=rollupby,
|
||||
api_version=api_version,
|
||||
api_version=self._config.api_version,
|
||||
headers=_headers,
|
||||
params=_params,
|
||||
)
|
||||
|
@ -578,9 +588,8 @@ class MetricNamespacesOperations:
|
|||
}
|
||||
"""
|
||||
_headers = kwargs.pop("headers", {}) or {}
|
||||
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
|
||||
_params = kwargs.pop("params", {}) or {}
|
||||
|
||||
api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2017-12-01-preview"))
|
||||
cls: ClsType[JSON] = kwargs.pop("cls", None)
|
||||
|
||||
error_map = {
|
||||
|
@ -597,14 +606,25 @@ class MetricNamespacesOperations:
|
|||
_request = build_metric_namespaces_list_request(
|
||||
resource_uri=resource_uri,
|
||||
start_time=start_time,
|
||||
api_version=api_version,
|
||||
api_version=self._config.api_version,
|
||||
headers=_headers,
|
||||
params=_params,
|
||||
)
|
||||
_request.url = self._client.format_url(_request.url)
|
||||
|
||||
else:
|
||||
_request = HttpRequest("GET", next_link)
|
||||
# make call to next link with the client's api-version
|
||||
_parsed_next_link = urllib.parse.urlparse(next_link)
|
||||
_next_request_params = case_insensitive_dict(
|
||||
{
|
||||
key: [urllib.parse.quote(v) for v in value]
|
||||
for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items()
|
||||
}
|
||||
)
|
||||
_next_request_params["api-version"] = self._config.api_version
|
||||
_request = HttpRequest(
|
||||
"GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params
|
||||
)
|
||||
_request.url = self._client.format_url(_request.url)
|
||||
|
||||
return _request
|
||||
|
|
|
@ -589,9 +589,6 @@ class QueryOperations:
|
|||
:keyword prefer: Optional. The prefer header to set server timeout, query statistics and
|
||||
visualization information. Default value is None.
|
||||
:paramtype prefer: str
|
||||
:keyword content_type: Body Parameter content-type. Known values are: 'application/json'.
|
||||
Default value is None.
|
||||
:paramtype content_type: str
|
||||
:return: JSON object
|
||||
:rtype: JSON
|
||||
:raises ~azure.core.exceptions.HttpResponseError:
|
||||
|
@ -1034,9 +1031,6 @@ class QueryOperations:
|
|||
:keyword prefer: Optional. The prefer header to set server timeout, query statistics and
|
||||
visualization information. Default value is None.
|
||||
:paramtype prefer: str
|
||||
:keyword content_type: Body Parameter content-type. Known values are: 'application/json'.
|
||||
Default value is None.
|
||||
:paramtype content_type: str
|
||||
:return: JSON object
|
||||
:rtype: JSON
|
||||
:raises ~azure.core.exceptions.HttpResponseError:
|
||||
|
@ -1387,9 +1381,6 @@ class QueryOperations:
|
|||
|
||||
:param body: The batch request body. Is either a JSON type or a IO[bytes] type. Required.
|
||||
:type body: JSON or IO[bytes]
|
||||
:keyword content_type: Body Parameter content-type. Known values are: 'application/json'.
|
||||
Default value is None.
|
||||
:paramtype content_type: str
|
||||
:return: JSON object
|
||||
:rtype: JSON
|
||||
:raises ~azure.core.exceptions.HttpResponseError:
|
||||
|
@ -1874,9 +1865,6 @@ class QueryOperations:
|
|||
:keyword prefer: Optional. The prefer header to set server timeout, query statistics and
|
||||
visualization information. Default value is None.
|
||||
:paramtype prefer: str
|
||||
:keyword content_type: Body Parameter content-type. Known values are: 'application/json'.
|
||||
Default value is None.
|
||||
:paramtype content_type: str
|
||||
:return: JSON object
|
||||
:rtype: JSON
|
||||
:raises ~azure.core.exceptions.HttpResponseError:
|
||||
|
|
|
@ -35,7 +35,7 @@ These settings apply only when `--tag=release_query` is specified on the command
|
|||
|
||||
```yaml $(tag) == 'release_query'
|
||||
input-file:
|
||||
- https://github.com/Azure/azure-rest-api-specs/blob/0373f0edc4414fd402603fac51d0df93f1f70507/specification/operationalinsights/data-plane/Microsoft.OperationalInsights/stable/2022-10-27/OperationalInsights.json
|
||||
- https://github.com/Azure/azure-rest-api-specs/blob/0b64ca7cbe3af8cd13228dfb783a16b8272b8be2/specification/operationalinsights/data-plane/Microsoft.OperationalInsights/stable/2022-10-27/OperationalInsights.json
|
||||
output-folder: ../azure/monitor/query/_generated
|
||||
title: MonitorQueryClient
|
||||
description: Azure Monitor Query Python Client
|
||||
|
@ -47,9 +47,9 @@ These settings apply only when `--tag=release_metrics` is specified on the comma
|
|||
|
||||
```yaml $(tag) == 'release_metrics'
|
||||
input-file:
|
||||
- https://github.com/Azure/azure-rest-api-specs/blob/0373f0edc4414fd402603fac51d0df93f1f70507/specification/monitor/resource-manager/Microsoft.Insights/stable/2023-10-01/metricDefinitions_API.json
|
||||
- https://github.com/Azure/azure-rest-api-specs/blob/0373f0edc4414fd402603fac51d0df93f1f70507/specification/monitor/resource-manager/Microsoft.Insights/stable/2023-10-01/metrics_API.json
|
||||
- https://github.com/Azure/azure-rest-api-specs/blob/0373f0edc4414fd402603fac51d0df93f1f70507/specification/monitor/resource-manager/Microsoft.Insights/preview/2017-12-01-preview/metricNamespaces_API.json
|
||||
- https://github.com/Azure/azure-rest-api-specs/blob/0b64ca7cbe3af8cd13228dfb783a16b8272b8be2/specification/monitor/resource-manager/Microsoft.Insights/stable/2024-02-01/metricDefinitions_API.json
|
||||
- https://github.com/Azure/azure-rest-api-specs/blob/0b64ca7cbe3af8cd13228dfb783a16b8272b8be2/specification/monitor/resource-manager/Microsoft.Insights/stable/2024-02-01/metrics_API.json
|
||||
- https://github.com/Azure/azure-rest-api-specs/blob/0b64ca7cbe3af8cd13228dfb783a16b8272b8be2/specification/monitor/resource-manager/Microsoft.Insights/stable/2024-02-01/metricNamespaces_API.json
|
||||
output-folder: ../azure/monitor/query/_generated/metrics
|
||||
title: MonitorMetricsClient
|
||||
description: Azure Monitor Metrics Python Client
|
||||
|
@ -61,7 +61,7 @@ These settings apply only when `--tag=release_metrics` is specified on the comma
|
|||
|
||||
```yaml $(tag) == 'release_metrics_batch'
|
||||
input-file:
|
||||
- https://github.com/Azure/azure-rest-api-specs/blob/0373f0edc4414fd402603fac51d0df93f1f70507/specification/monitor/data-plane/Microsoft.Insights/stable/2023-10-01/metricBatch.json
|
||||
- https://github.com/Azure/azure-rest-api-specs/blob/0b64ca7cbe3af8cd13228dfb783a16b8272b8be2/specification/monitor/data-plane/Microsoft.Insights/stable/2024-02-01/metricBatch.json
|
||||
output-folder: ../azure/monitor/query/_generated/metrics/batch
|
||||
title: MonitorBatchMetricsClient
|
||||
description: Azure Monitor Batch Metrics Python Client
|
||||
|
|
Загрузка…
Ссылка в новой задаче