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 @@ -22,6 +22,7 @@
EnrichmentStatusQueryOption,
SeriesIdentity,
FeedbackDimensionFilter,
DimensionGroupIdentity,
)
from ._generated import MicrosoftAzureMetricsAdvisorRESTAPIOpenAPIV2 as _Client
from ._helpers import convert_to_sub_feedback, convert_datetime, get_authentication_policy
Expand Down Expand Up @@ -378,7 +379,8 @@ def _list_anomalies_for_detection_configuration(self, detection_configuration_id
# type: (...) -> ItemPaged[DataPointAnomaly]

skip = kwargs.pop('skip', None)
filter_condition = kwargs.pop('filter', None)
condition = kwargs.pop('filter', None)
filter_condition = condition._to_generated() if condition else None
converted_start_time = convert_datetime(start_time)
converted_end_time = convert_datetime(end_time)
detection_anomaly_result_query = DetectionAnomalyResultQuery(
Expand Down Expand Up @@ -496,7 +498,7 @@ def list_anomaly_dimension_values(
:param Union[str, datetime.datetime] start_time: start time filter under chosen time mode.
:param Union[str, datetime.datetime] end_time: end time filter under chosen time mode.
:keyword int skip:
:paramtype dimension_filter: ~azure.ai.metricsadvisor.models.DimensionGroupIdentity
:keyword Dict[str, str] dimension_filter: filter specfic dimension name and values.
:return: Dimension values of anomalies.
:rtype: ~azure.core.paging.ItemPaged[str]
:raises ~azure.core.exceptions.HttpResponseError:
Expand All @@ -512,7 +514,8 @@ def list_anomaly_dimension_values(
"""

skip = kwargs.pop('skip', None)
dimension_filter = kwargs.pop('dimension_filter', None)
dimension = kwargs.pop('dimension_filter', None)
dimension_filter = DimensionGroupIdentity(dimension=dimension)
converted_start_time = convert_datetime(start_time)
converted_end_time = convert_datetime(end_time)
anomaly_dimension_query = AnomalyDimensionQuery(
Expand Down Expand Up @@ -543,7 +546,8 @@ def _list_incidents_for_alert(self, alert_configuration_id, alert_id, **kwargs):
def _list_incidents_for_detection_configuration(self, detection_configuration_id, start_time, end_time, **kwargs):
# type: (str, Union[str, datetime.datetime], Union[str, datetime.datetime], Any) -> ItemPaged[AnomalyIncident]

filter_condition = kwargs.pop('filter', None)
condition = kwargs.pop('filter', None)
filter_condition = condition._to_generated() if condition else None
converted_start_time = convert_datetime(start_time)
converted_end_time = convert_datetime(end_time)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
TimeMode as AlertQueryTimeMode,
SeriesIdentity,
FeedbackDimensionFilter,
DimensionGroupIdentity,
)
from .._generated.aio import MicrosoftAzureMetricsAdvisorRESTAPIOpenAPIV2 as _ClientAsync
from .._helpers import convert_to_sub_feedback, convert_datetime, get_authentication_policy
Expand Down Expand Up @@ -378,7 +379,8 @@ def _list_anomalies_for_detection_configuration(
# type: (...) -> AsyncItemPaged[DataPointAnomaly]

skip = kwargs.pop('skip', None)
filter_condition = kwargs.pop('filter', None)
condition = kwargs.pop('filter', None)
filter_condition = condition._to_generated() if condition else None
converted_start_time = convert_datetime(start_time)
converted_end_time = convert_datetime(end_time)
detection_anomaly_result_query = DetectionAnomalyResultQuery(
Expand Down Expand Up @@ -494,7 +496,7 @@ def list_anomaly_dimension_values(
:param Union[str, datetime.datetime] start_time: start time filter under chosen time mode.
:param Union[str, datetime.datetime] end_time: end time filter under chosen time mode.
:keyword int skip:
:paramtype dimension_filter: ~azure.ai.metricsadvisor.models.DimensionGroupIdentity
:keyword Dict[str, str] dimension_filter: filter specfic dimension name and values.
:return: Dimension values of anomalies.
:rtype: ~azure.core.async_paging.AsyncItemPaged[str]
:raises ~azure.core.exceptions.HttpResponseError:
Expand All @@ -510,7 +512,8 @@ def list_anomaly_dimension_values(
"""

skip = kwargs.pop('skip', None)
dimension_filter = kwargs.pop('dimension_filter', None)
dimension = kwargs.pop('dimension_filter', None)
dimension_filter = DimensionGroupIdentity(dimension=dimension)
converted_start_time = convert_datetime(start_time)
converted_end_time = convert_datetime(end_time)
anomaly_dimension_query = AnomalyDimensionQuery(
Expand Down Expand Up @@ -545,7 +548,8 @@ def _list_incidents_for_detection_configuration(
**kwargs: Any
) -> AsyncItemPaged[AnomalyIncident]:

filter_condition = kwargs.pop('filter', None)
condition = kwargs.pop('filter', None)
filter_condition = condition._to_generated() if condition else None
converted_start_time = convert_datetime(start_time)
converted_end_time = convert_datetime(end_time)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,6 @@
from .._generated.models import (
FeedbackQueryTimeMode,
RootCause,
DetectionAnomalyFilterCondition,
DimensionGroupIdentity,
DetectionIncidentFilterCondition,
EnrichmentStatus,
Expand Down Expand Up @@ -120,6 +119,7 @@
DatasourceServicePrincipalInKeyVault,
DatasourceCredential,
DataFeedSource,
DetectionAnomalyFilterCondition,
)


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,7 @@
ServicePrincipalInKVParamPatch as _ServicePrincipalInKVParamPatch,
ServicePrincipalInKVCredential as _ServicePrincipalInKVCredential,
ServicePrincipalInKVParam as _ServicePrincipalInKVParam,
DetectionAnomalyFilterCondition as _DetectionAnomalyFilterCondition,
)

if TYPE_CHECKING:
Expand Down Expand Up @@ -3841,3 +3842,40 @@ def _to_generated_patch(self):
data_source_credential_description=self.description,
parameters=param_patch,
)

class DetectionAnomalyFilterCondition(msrest.serialization.Model):
"""DetectionAnomalyFilterCondition.

:param series_group_key: dimension filter.
:type series_group_key: dict[str, str]
:param severity_filter:
:type severity_filter: ~azure.ai.metricsadvisor.models.SeverityFilterCondition
"""

_attribute_map = {
'series_group_key': {'key': 'seriesGroupKey', 'type': '{str}'},
'severity_filter': {'key': 'severityFilter', 'type': 'SeverityFilterCondition'},
}

def __init__(
self,
**kwargs
):
super(DetectionAnomalyFilterCondition, self).__init__(**kwargs)
self.series_group_key = kwargs.get('series_group_key', None)
self.severity_filter = kwargs.get('severity_filter', None)

@classmethod
def _from_generated(cls, source):
series_group_key = source.dimension_filter.dimension if source.dimension_filter else None
return cls(
series_group_key=series_group_key,
severity_filter=source.severity_filter.key_vault_endpoint
)

def _to_generated(self):
dimension_filter = _DimensionGroupIdentity(dimension=self.series_group_key)
return _DetectionAnomalyFilterCondition(
dimension_filter=dimension_filter,
severity_filter=self.severity_filter
)