4545)
4646from ..models import *
4747from ..models import _models_py3 as generated_models
48+ from ..models ._patch import (
49+ AlertingResultQuery ,
50+ MetricDataQueryOptions ,
51+ AnomalyDimensionQuery ,
52+ DetectionAnomalyResultQuery ,
53+ DetectionIncidentResultQuery ,
54+ DetectionSeriesQuery ,
55+ EnrichmentStatusQueryOption ,
56+ IngestionProgressResetOptions ,
57+ IngestionStatusQueryOptions ,
58+ )
4859from msrest import Serializer
4960from azure .core .paging import ItemPaged
5061from azure .core .exceptions import (
@@ -121,10 +132,13 @@ def _construct_data_feed(self, **kwargs):
121132 def _deserialize_anomaly_detection_configuration (self , pipeline_response , ** kwargs ) -> AnomalyAlertConfiguration :
122133 cls = kwargs .pop ("cls" , None )
123134 response_json = pipeline_response .http_response .json ()
124- response_json ["metricAlertingConfigurations" ] = [
125- self ._deserialize (generated_models .MetricAlertConfiguration , m )
126- for m in response_json ["metricAlertingConfigurations" ]
127- ]
135+ try :
136+ response_json ["metricAlertingConfigurations" ] = [
137+ self ._deserialize (generated_models .MetricAlertConfiguration , m )
138+ for m in response_json ["metricAlertingConfigurations" ]
139+ ]
140+ except KeyError :
141+ raise ValueError (response_json )
128142 deserialized = self ._deserialize (generated_models .AnomalyAlertConfiguration , response_json )
129143 if cls :
130144 return cls (pipeline_response , deserialized , {})
@@ -270,7 +284,7 @@ def _update_alert_configuration_helper(
270284 alert_configuration_patch = alert_configuration ._to_generated ()
271285 content_type = kwargs .pop ("content_type" , "application/merge-patch+json" ) # type: Optional[str]
272286
273- _json = self ._serialize .body (alert_configuration_patch , "AnomalyAlertingConfigurationPatch " )
287+ _json = self ._serialize .body (alert_configuration_patch , "AnomalyAlertingConfiguration " )
274288
275289 request = build_update_alert_configuration_request (
276290 configuration_id = alert_configuration_id ,
@@ -831,9 +845,7 @@ def list_metric_enriched_series_data(
831845 )
832846
833847 return super ().list_metric_enriched_series_data ( # type: ignore
834- configuration_id = detection_configuration_id ,
835- body = detection_series_query ,
836- ** kwargs
848+ configuration_id = detection_configuration_id , body = detection_series_query , ** kwargs
837849 )
838850
839851 @distributed_trace
@@ -997,7 +1009,9 @@ def list_metric_series_definitions(self, metric_id, active_since, **kwargs):
9971009 # type: (str, datetime.datetime, Any) -> ItemPaged[MetricSeriesDefinition]
9981010 cls = kwargs .pop ("cls" , None )
9991011
1000- initial_request , kwargs = self ._list_metric_series_definitions_initial_request (metric_id , active_since , ** kwargs )
1012+ initial_request , kwargs = self ._list_metric_series_definitions_initial_request (
1013+ metric_id , active_since , ** kwargs
1014+ )
10011015
10021016 def extract_data (pipeline_response ):
10031017 deserialized = MetricSeriesList .deserialize (pipeline_response )
@@ -1009,10 +1023,7 @@ def extract_data(pipeline_response):
10091023 next_request = build_list_metric_series_definitions_request (metric_id = metric_id )
10101024 next_request .method = "POST"
10111025 return self ._paging_helper (
1012- extract_data = extract_data ,
1013- initial_request = initial_request ,
1014- next_request = next_request ,
1015- ** kwargs
1026+ extract_data = extract_data , initial_request = initial_request , next_request = next_request , ** kwargs
10161027 )
10171028
10181029 @distributed_trace
0 commit comments