diff --git a/sdk/anomalydetector/azure-ai-anomalydetector/CHANGELOG.md b/sdk/anomalydetector/azure-ai-anomalydetector/CHANGELOG.md index 96441d6e520d..5f0898b937c3 100644 --- a/sdk/anomalydetector/azure-ai-anomalydetector/CHANGELOG.md +++ b/sdk/anomalydetector/azure-ai-anomalydetector/CHANGELOG.md @@ -1,6 +1,19 @@ # Release History -## 3.0.0b2 (Unreleased) +## 3.0.0b2 (2020-08-27) + + **Bug Fixes** + - Fixed an issue with ChangePointDetect + + **Breaking Changes** + - Renamed `entire_detect` to `detect_entire_series` + - Renamed `APIError` to `AnomalyDetectorError` + - Renamed `Request` to `DetectRequest` + - Renamed `LastDetect` to `DetectLastPoint` + - Renamed `ChangePointDetect` to `DetectChangePoint` + - Renamed `Granularity` to `TimeGranularity` + - Renamed `minutely` and `secondly` to `per_minute` and `per_second` + - Renamed `Point` to `TimeSeriesPoint` ## 3.0.0b1 (2020-08-17) diff --git a/sdk/anomalydetector/azure-ai-anomalydetector/azure/ai/anomalydetector/aio/operations_async/_anomaly_detector_client_operations_async.py b/sdk/anomalydetector/azure-ai-anomalydetector/azure/ai/anomalydetector/aio/operations_async/_anomaly_detector_client_operations_async.py index d50db418eac5..cdc004782055 100644 --- a/sdk/anomalydetector/azure-ai-anomalydetector/azure/ai/anomalydetector/aio/operations_async/_anomaly_detector_client_operations_async.py +++ b/sdk/anomalydetector/azure-ai-anomalydetector/azure/ai/anomalydetector/aio/operations_async/_anomaly_detector_client_operations_async.py @@ -19,9 +19,9 @@ class AnomalyDetectorClientOperationsMixin: - async def entire_detect( + async def detect_entire_series( self, - body: "models.Request", + body: "models.DetectRequest", **kwargs ) -> "models.EntireDetectResponse": """Detect anomalies for the entire series in batch. @@ -32,7 +32,7 @@ async def entire_detect( :param body: Time series points and period if needed. Advanced model parameters can also be set in the request. - :type body: ~azure.ai.anomalydetector.models.Request + :type body: ~azure.ai.anomalydetector.models.DetectRequest :keyword callable cls: A custom type or function that will be passed the direct response :return: EntireDetectResponse, or the result of cls(response) :rtype: ~azure.ai.anomalydetector.models.EntireDetectResponse @@ -44,7 +44,7 @@ async def entire_detect( content_type = kwargs.pop("content_type", "application/json") # Construct URL - url = self.entire_detect.metadata['url'] # type: ignore + url = self.detect_entire_series.metadata['url'] # type: ignore path_format_arguments = { 'Endpoint': self._serialize.url("self._config.endpoint", self._config.endpoint, 'str', skip_quote=True), } @@ -59,7 +59,7 @@ async def entire_detect( header_parameters['Accept'] = 'application/json' body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(body, 'Request') + body_content = self._serialize.body(body, 'DetectRequest') body_content_kwargs['content'] = body_content request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) @@ -68,7 +68,7 @@ async def entire_detect( if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(models.APIError, response) + error = self._deserialize(models.AnomalyDetectorError, response) raise HttpResponseError(response=response, model=error) deserialized = self._deserialize('EntireDetectResponse', pipeline_response) @@ -77,11 +77,11 @@ async def entire_detect( return cls(pipeline_response, deserialized, {}) return deserialized - entire_detect.metadata = {'url': '/timeseries/entire/detect'} # type: ignore + detect_entire_series.metadata = {'url': '/timeseries/entire/detect'} # type: ignore - async def last_detect( + async def detect_last_point( self, - body: "models.Request", + body: "models.DetectRequest", **kwargs ) -> "models.LastDetectResponse": """Detect anomaly status of the latest point in time series. @@ -92,7 +92,7 @@ async def last_detect( :param body: Time series points and period if needed. Advanced model parameters can also be set in the request. - :type body: ~azure.ai.anomalydetector.models.Request + :type body: ~azure.ai.anomalydetector.models.DetectRequest :keyword callable cls: A custom type or function that will be passed the direct response :return: LastDetectResponse, or the result of cls(response) :rtype: ~azure.ai.anomalydetector.models.LastDetectResponse @@ -104,7 +104,7 @@ async def last_detect( content_type = kwargs.pop("content_type", "application/json") # Construct URL - url = self.last_detect.metadata['url'] # type: ignore + url = self.detect_last_point.metadata['url'] # type: ignore path_format_arguments = { 'Endpoint': self._serialize.url("self._config.endpoint", self._config.endpoint, 'str', skip_quote=True), } @@ -119,7 +119,7 @@ async def last_detect( header_parameters['Accept'] = 'application/json' body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(body, 'Request') + body_content = self._serialize.body(body, 'DetectRequest') body_content_kwargs['content'] = body_content request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) @@ -128,7 +128,7 @@ async def last_detect( if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(models.APIError, response) + error = self._deserialize(models.AnomalyDetectorError, response) raise HttpResponseError(response=response, model=error) deserialized = self._deserialize('LastDetectResponse', pipeline_response) @@ -137,9 +137,9 @@ async def last_detect( return cls(pipeline_response, deserialized, {}) return deserialized - last_detect.metadata = {'url': '/timeseries/last/detect'} # type: ignore + detect_last_point.metadata = {'url': '/timeseries/last/detect'} # type: ignore - async def change_point_detect( + async def detect_change_point( self, body: "models.ChangePointDetectRequest", **kwargs @@ -162,7 +162,7 @@ async def change_point_detect( content_type = kwargs.pop("content_type", "application/json") # Construct URL - url = self.change_point_detect.metadata['url'] # type: ignore + url = self.detect_change_point.metadata['url'] # type: ignore path_format_arguments = { 'Endpoint': self._serialize.url("self._config.endpoint", self._config.endpoint, 'str', skip_quote=True), } @@ -186,7 +186,7 @@ async def change_point_detect( if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(models.APIError, response) + error = self._deserialize(models.AnomalyDetectorError, response) raise HttpResponseError(response=response, model=error) deserialized = self._deserialize('ChangePointDetectResponse', pipeline_response) @@ -195,4 +195,4 @@ async def change_point_detect( return cls(pipeline_response, deserialized, {}) return deserialized - change_point_detect.metadata = {'url': '/timeseries/changePoint/detect'} # type: ignore + detect_change_point.metadata = {'url': '/timeseries/changepoint/detect'} # type: ignore diff --git a/sdk/anomalydetector/azure-ai-anomalydetector/azure/ai/anomalydetector/models/__init__.py b/sdk/anomalydetector/azure-ai-anomalydetector/azure/ai/anomalydetector/models/__init__.py index 5e200ece70fe..f81f16ff8cb1 100644 --- a/sdk/anomalydetector/azure-ai-anomalydetector/azure/ai/anomalydetector/models/__init__.py +++ b/sdk/anomalydetector/azure-ai-anomalydetector/azure/ai/anomalydetector/models/__init__.py @@ -7,35 +7,35 @@ # -------------------------------------------------------------------------- try: - from ._models_py3 import APIError + from ._models_py3 import AnomalyDetectorError from ._models_py3 import ChangePointDetectRequest from ._models_py3 import ChangePointDetectResponse + from ._models_py3 import DetectRequest from ._models_py3 import EntireDetectResponse from ._models_py3 import LastDetectResponse - from ._models_py3 import Point - from ._models_py3 import Request + from ._models_py3 import TimeSeriesPoint except (SyntaxError, ImportError): - from ._models import APIError # type: ignore + from ._models import AnomalyDetectorError # type: ignore from ._models import ChangePointDetectRequest # type: ignore from ._models import ChangePointDetectResponse # type: ignore + from ._models import DetectRequest # type: ignore from ._models import EntireDetectResponse # type: ignore from ._models import LastDetectResponse # type: ignore - from ._models import Point # type: ignore - from ._models import Request # type: ignore + from ._models import TimeSeriesPoint # type: ignore from ._anomaly_detector_client_enums import ( AnomalyDetectorErrorCodes, - Granularity, + TimeGranularity, ) __all__ = [ - 'APIError', + 'AnomalyDetectorError', 'ChangePointDetectRequest', 'ChangePointDetectResponse', + 'DetectRequest', 'EntireDetectResponse', 'LastDetectResponse', - 'Point', - 'Request', + 'TimeSeriesPoint', 'AnomalyDetectorErrorCodes', - 'Granularity', + 'TimeGranularity', ] diff --git a/sdk/anomalydetector/azure-ai-anomalydetector/azure/ai/anomalydetector/models/_anomaly_detector_client_enums.py b/sdk/anomalydetector/azure-ai-anomalydetector/azure/ai/anomalydetector/models/_anomaly_detector_client_enums.py index 5b10529c5ee3..5dc5bbf98800 100644 --- a/sdk/anomalydetector/azure-ai-anomalydetector/azure/ai/anomalydetector/models/_anomaly_detector_client_enums.py +++ b/sdk/anomalydetector/azure-ai-anomalydetector/azure/ai/anomalydetector/models/_anomaly_detector_client_enums.py @@ -40,7 +40,7 @@ class AnomalyDetectorErrorCodes(with_metaclass(_CaseInsensitiveEnumMeta, str, En REQUIRED_GRANULARITY = "RequiredGranularity" REQUIRED_SERIES = "RequiredSeries" -class Granularity(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class TimeGranularity(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): """Can only be one of yearly, monthly, weekly, daily, hourly, minutely or secondly. Granularity is used for verify whether input series is valid. """ @@ -50,5 +50,5 @@ class Granularity(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): WEEKLY = "weekly" DAILY = "daily" HOURLY = "hourly" - MINUTELY = "minutely" - SECONDLY = "secondly" + PER_MINUTE = "minutely" + PER_SECOND = "secondly" diff --git a/sdk/anomalydetector/azure-ai-anomalydetector/azure/ai/anomalydetector/models/_models.py b/sdk/anomalydetector/azure-ai-anomalydetector/azure/ai/anomalydetector/models/_models.py index 9d78d6220e31..e2eec215a189 100644 --- a/sdk/anomalydetector/azure-ai-anomalydetector/azure/ai/anomalydetector/models/_models.py +++ b/sdk/anomalydetector/azure-ai-anomalydetector/azure/ai/anomalydetector/models/_models.py @@ -10,7 +10,7 @@ import msrest.serialization -class APIError(msrest.serialization.Model): +class AnomalyDetectorError(msrest.serialization.Model): """Error information returned by the API. :param code: The error code. Possible values include: "InvalidCustomInterval", "BadArgument", @@ -30,7 +30,7 @@ def __init__( self, **kwargs ): - super(APIError, self).__init__(**kwargs) + super(AnomalyDetectorError, self).__init__(**kwargs) self.code = kwargs.get('code', None) self.message = kwargs.get('message', None) @@ -42,11 +42,11 @@ class ChangePointDetectRequest(msrest.serialization.Model): :param series: Required. Time series data points. Points should be sorted by timestamp in ascending order to match the change point detection result. - :type series: list[~azure.ai.anomalydetector.models.Point] + :type series: list[~azure.ai.anomalydetector.models.TimeSeriesPoint] :param granularity: Required. Can only be one of yearly, monthly, weekly, daily, hourly, minutely or secondly. Granularity is used for verify whether input series is valid. Possible values include: "yearly", "monthly", "weekly", "daily", "hourly", "minutely", "secondly". - :type granularity: str or ~azure.ai.anomalydetector.models.Granularity + :type granularity: str or ~azure.ai.anomalydetector.models.TimeGranularity :param custom_interval: Custom Interval is used to set non-standard time interval, for example, if the series is 5 minutes, request can be set as {"granularity":"minutely", "customInterval":5}. @@ -68,7 +68,7 @@ class ChangePointDetectRequest(msrest.serialization.Model): } _attribute_map = { - 'series': {'key': 'series', 'type': '[Point]'}, + 'series': {'key': 'series', 'type': '[TimeSeriesPoint]'}, 'granularity': {'key': 'granularity', 'type': 'str'}, 'custom_interval': {'key': 'customInterval', 'type': 'int'}, 'period': {'key': 'period', 'type': 'int'}, @@ -127,6 +127,62 @@ def __init__( self.confidence_scores = kwargs['confidence_scores'] +class DetectRequest(msrest.serialization.Model): + """DetectRequest. + + All required parameters must be populated in order to send to Azure. + + :param series: Required. Time series data points. Points should be sorted by timestamp in + ascending order to match the anomaly detection result. If the data is not sorted correctly or + there is duplicated timestamp, the API will not work. In such case, an error message will be + returned. + :type series: list[~azure.ai.anomalydetector.models.TimeSeriesPoint] + :param granularity: Required. Can only be one of yearly, monthly, weekly, daily, hourly, + minutely or secondly. Granularity is used for verify whether input series is valid. Possible + values include: "yearly", "monthly", "weekly", "daily", "hourly", "minutely", "secondly". + :type granularity: str or ~azure.ai.anomalydetector.models.TimeGranularity + :param custom_interval: Custom Interval is used to set non-standard time interval, for example, + if the series is 5 minutes, request can be set as {"granularity":"minutely", + "customInterval":5}. + :type custom_interval: int + :param period: Optional argument, periodic value of a time series. If the value is null or does + not present, the API will determine the period automatically. + :type period: int + :param max_anomaly_ratio: Optional argument, advanced model parameter, max anomaly ratio in a + time series. + :type max_anomaly_ratio: float + :param sensitivity: Optional argument, advanced model parameter, between 0-99, the lower the + value is, the larger the margin value will be which means less anomalies will be accepted. + :type sensitivity: int + """ + + _validation = { + 'series': {'required': True}, + 'granularity': {'required': True}, + } + + _attribute_map = { + 'series': {'key': 'series', 'type': '[TimeSeriesPoint]'}, + 'granularity': {'key': 'granularity', 'type': 'str'}, + 'custom_interval': {'key': 'customInterval', 'type': 'int'}, + 'period': {'key': 'period', 'type': 'int'}, + 'max_anomaly_ratio': {'key': 'maxAnomalyRatio', 'type': 'float'}, + 'sensitivity': {'key': 'sensitivity', 'type': 'int'}, + } + + def __init__( + self, + **kwargs + ): + super(DetectRequest, self).__init__(**kwargs) + self.series = kwargs['series'] + self.granularity = kwargs['granularity'] + self.custom_interval = kwargs.get('custom_interval', None) + self.period = kwargs.get('period', None) + self.max_anomaly_ratio = kwargs.get('max_anomaly_ratio', None) + self.sensitivity = kwargs.get('sensitivity', None) + + class EntireDetectResponse(msrest.serialization.Model): """EntireDetectResponse. @@ -268,8 +324,8 @@ def __init__( self.is_positive_anomaly = kwargs['is_positive_anomaly'] -class Point(msrest.serialization.Model): - """Point. +class TimeSeriesPoint(msrest.serialization.Model): + """TimeSeriesPoint. All required parameters must be populated in order to send to Azure. @@ -293,62 +349,6 @@ def __init__( self, **kwargs ): - super(Point, self).__init__(**kwargs) + super(TimeSeriesPoint, self).__init__(**kwargs) self.timestamp = kwargs['timestamp'] self.value = kwargs['value'] - - -class Request(msrest.serialization.Model): - """Request. - - All required parameters must be populated in order to send to Azure. - - :param series: Required. Time series data points. Points should be sorted by timestamp in - ascending order to match the anomaly detection result. If the data is not sorted correctly or - there is duplicated timestamp, the API will not work. In such case, an error message will be - returned. - :type series: list[~azure.ai.anomalydetector.models.Point] - :param granularity: Required. Can only be one of yearly, monthly, weekly, daily, hourly, - minutely or secondly. Granularity is used for verify whether input series is valid. Possible - values include: "yearly", "monthly", "weekly", "daily", "hourly", "minutely", "secondly". - :type granularity: str or ~azure.ai.anomalydetector.models.Granularity - :param custom_interval: Custom Interval is used to set non-standard time interval, for example, - if the series is 5 minutes, request can be set as {"granularity":"minutely", - "customInterval":5}. - :type custom_interval: int - :param period: Optional argument, periodic value of a time series. If the value is null or does - not present, the API will determine the period automatically. - :type period: int - :param max_anomaly_ratio: Optional argument, advanced model parameter, max anomaly ratio in a - time series. - :type max_anomaly_ratio: float - :param sensitivity: Optional argument, advanced model parameter, between 0-99, the lower the - value is, the larger the margin value will be which means less anomalies will be accepted. - :type sensitivity: int - """ - - _validation = { - 'series': {'required': True}, - 'granularity': {'required': True}, - } - - _attribute_map = { - 'series': {'key': 'series', 'type': '[Point]'}, - 'granularity': {'key': 'granularity', 'type': 'str'}, - 'custom_interval': {'key': 'customInterval', 'type': 'int'}, - 'period': {'key': 'period', 'type': 'int'}, - 'max_anomaly_ratio': {'key': 'maxAnomalyRatio', 'type': 'float'}, - 'sensitivity': {'key': 'sensitivity', 'type': 'int'}, - } - - def __init__( - self, - **kwargs - ): - super(Request, self).__init__(**kwargs) - self.series = kwargs['series'] - self.granularity = kwargs['granularity'] - self.custom_interval = kwargs.get('custom_interval', None) - self.period = kwargs.get('period', None) - self.max_anomaly_ratio = kwargs.get('max_anomaly_ratio', None) - self.sensitivity = kwargs.get('sensitivity', None) diff --git a/sdk/anomalydetector/azure-ai-anomalydetector/azure/ai/anomalydetector/models/_models_py3.py b/sdk/anomalydetector/azure-ai-anomalydetector/azure/ai/anomalydetector/models/_models_py3.py index 9ec3fcb94623..4b149229f2a0 100644 --- a/sdk/anomalydetector/azure-ai-anomalydetector/azure/ai/anomalydetector/models/_models_py3.py +++ b/sdk/anomalydetector/azure-ai-anomalydetector/azure/ai/anomalydetector/models/_models_py3.py @@ -15,7 +15,7 @@ from ._anomaly_detector_client_enums import * -class APIError(msrest.serialization.Model): +class AnomalyDetectorError(msrest.serialization.Model): """Error information returned by the API. :param code: The error code. Possible values include: "InvalidCustomInterval", "BadArgument", @@ -38,7 +38,7 @@ def __init__( message: Optional[str] = None, **kwargs ): - super(APIError, self).__init__(**kwargs) + super(AnomalyDetectorError, self).__init__(**kwargs) self.code = code self.message = message @@ -50,11 +50,11 @@ class ChangePointDetectRequest(msrest.serialization.Model): :param series: Required. Time series data points. Points should be sorted by timestamp in ascending order to match the change point detection result. - :type series: list[~azure.ai.anomalydetector.models.Point] + :type series: list[~azure.ai.anomalydetector.models.TimeSeriesPoint] :param granularity: Required. Can only be one of yearly, monthly, weekly, daily, hourly, minutely or secondly. Granularity is used for verify whether input series is valid. Possible values include: "yearly", "monthly", "weekly", "daily", "hourly", "minutely", "secondly". - :type granularity: str or ~azure.ai.anomalydetector.models.Granularity + :type granularity: str or ~azure.ai.anomalydetector.models.TimeGranularity :param custom_interval: Custom Interval is used to set non-standard time interval, for example, if the series is 5 minutes, request can be set as {"granularity":"minutely", "customInterval":5}. @@ -76,7 +76,7 @@ class ChangePointDetectRequest(msrest.serialization.Model): } _attribute_map = { - 'series': {'key': 'series', 'type': '[Point]'}, + 'series': {'key': 'series', 'type': '[TimeSeriesPoint]'}, 'granularity': {'key': 'granularity', 'type': 'str'}, 'custom_interval': {'key': 'customInterval', 'type': 'int'}, 'period': {'key': 'period', 'type': 'int'}, @@ -87,8 +87,8 @@ class ChangePointDetectRequest(msrest.serialization.Model): def __init__( self, *, - series: List["Point"], - granularity: Union[str, "Granularity"], + series: List["TimeSeriesPoint"], + granularity: Union[str, "TimeGranularity"], custom_interval: Optional[int] = None, period: Optional[int] = None, stable_trend_window: Optional[int] = None, @@ -146,6 +146,69 @@ def __init__( self.confidence_scores = confidence_scores +class DetectRequest(msrest.serialization.Model): + """DetectRequest. + + All required parameters must be populated in order to send to Azure. + + :param series: Required. Time series data points. Points should be sorted by timestamp in + ascending order to match the anomaly detection result. If the data is not sorted correctly or + there is duplicated timestamp, the API will not work. In such case, an error message will be + returned. + :type series: list[~azure.ai.anomalydetector.models.TimeSeriesPoint] + :param granularity: Required. Can only be one of yearly, monthly, weekly, daily, hourly, + minutely or secondly. Granularity is used for verify whether input series is valid. Possible + values include: "yearly", "monthly", "weekly", "daily", "hourly", "minutely", "secondly". + :type granularity: str or ~azure.ai.anomalydetector.models.TimeGranularity + :param custom_interval: Custom Interval is used to set non-standard time interval, for example, + if the series is 5 minutes, request can be set as {"granularity":"minutely", + "customInterval":5}. + :type custom_interval: int + :param period: Optional argument, periodic value of a time series. If the value is null or does + not present, the API will determine the period automatically. + :type period: int + :param max_anomaly_ratio: Optional argument, advanced model parameter, max anomaly ratio in a + time series. + :type max_anomaly_ratio: float + :param sensitivity: Optional argument, advanced model parameter, between 0-99, the lower the + value is, the larger the margin value will be which means less anomalies will be accepted. + :type sensitivity: int + """ + + _validation = { + 'series': {'required': True}, + 'granularity': {'required': True}, + } + + _attribute_map = { + 'series': {'key': 'series', 'type': '[TimeSeriesPoint]'}, + 'granularity': {'key': 'granularity', 'type': 'str'}, + 'custom_interval': {'key': 'customInterval', 'type': 'int'}, + 'period': {'key': 'period', 'type': 'int'}, + 'max_anomaly_ratio': {'key': 'maxAnomalyRatio', 'type': 'float'}, + 'sensitivity': {'key': 'sensitivity', 'type': 'int'}, + } + + def __init__( + self, + *, + series: List["TimeSeriesPoint"], + granularity: Union[str, "TimeGranularity"], + custom_interval: Optional[int] = None, + period: Optional[int] = None, + max_anomaly_ratio: Optional[float] = None, + sensitivity: Optional[int] = None, + **kwargs + ): + super(DetectRequest, self).__init__(**kwargs) + self.series = series + self.granularity = granularity + self.custom_interval = custom_interval + self.period = period + self.max_anomaly_ratio = max_anomaly_ratio + self.sensitivity = sensitivity + + class EntireDetectResponse(msrest.serialization.Model): """EntireDetectResponse. @@ -304,8 +367,8 @@ def __init__( self.is_positive_anomaly = is_positive_anomaly -class Point(msrest.serialization.Model): - """Point. +class TimeSeriesPoint(msrest.serialization.Model): + """TimeSeriesPoint. All required parameters must be populated in order to send to Azure. @@ -332,69 +395,6 @@ def __init__( value: float, **kwargs ): - super(Point, self).__init__(**kwargs) + super(TimeSeriesPoint, self).__init__(**kwargs) self.timestamp = timestamp self.value = value - - -class Request(msrest.serialization.Model): - """Request. - - All required parameters must be populated in order to send to Azure. - - :param series: Required. Time series data points. Points should be sorted by timestamp in - ascending order to match the anomaly detection result. If the data is not sorted correctly or - there is duplicated timestamp, the API will not work. In such case, an error message will be - returned. - :type series: list[~azure.ai.anomalydetector.models.Point] - :param granularity: Required. Can only be one of yearly, monthly, weekly, daily, hourly, - minutely or secondly. Granularity is used for verify whether input series is valid. Possible - values include: "yearly", "monthly", "weekly", "daily", "hourly", "minutely", "secondly". - :type granularity: str or ~azure.ai.anomalydetector.models.Granularity - :param custom_interval: Custom Interval is used to set non-standard time interval, for example, - if the series is 5 minutes, request can be set as {"granularity":"minutely", - "customInterval":5}. - :type custom_interval: int - :param period: Optional argument, periodic value of a time series. If the value is null or does - not present, the API will determine the period automatically. - :type period: int - :param max_anomaly_ratio: Optional argument, advanced model parameter, max anomaly ratio in a - time series. - :type max_anomaly_ratio: float - :param sensitivity: Optional argument, advanced model parameter, between 0-99, the lower the - value is, the larger the margin value will be which means less anomalies will be accepted. - :type sensitivity: int - """ - - _validation = { - 'series': {'required': True}, - 'granularity': {'required': True}, - } - - _attribute_map = { - 'series': {'key': 'series', 'type': '[Point]'}, - 'granularity': {'key': 'granularity', 'type': 'str'}, - 'custom_interval': {'key': 'customInterval', 'type': 'int'}, - 'period': {'key': 'period', 'type': 'int'}, - 'max_anomaly_ratio': {'key': 'maxAnomalyRatio', 'type': 'float'}, - 'sensitivity': {'key': 'sensitivity', 'type': 'int'}, - } - - def __init__( - self, - *, - series: List["Point"], - granularity: Union[str, "Granularity"], - custom_interval: Optional[int] = None, - period: Optional[int] = None, - max_anomaly_ratio: Optional[float] = None, - sensitivity: Optional[int] = None, - **kwargs - ): - super(Request, self).__init__(**kwargs) - self.series = series - self.granularity = granularity - self.custom_interval = custom_interval - self.period = period - self.max_anomaly_ratio = max_anomaly_ratio - self.sensitivity = sensitivity diff --git a/sdk/anomalydetector/azure-ai-anomalydetector/azure/ai/anomalydetector/operations/_anomaly_detector_client_operations.py b/sdk/anomalydetector/azure-ai-anomalydetector/azure/ai/anomalydetector/operations/_anomaly_detector_client_operations.py index c5e1bd5b483f..faacc3f97119 100644 --- a/sdk/anomalydetector/azure-ai-anomalydetector/azure/ai/anomalydetector/operations/_anomaly_detector_client_operations.py +++ b/sdk/anomalydetector/azure-ai-anomalydetector/azure/ai/anomalydetector/operations/_anomaly_detector_client_operations.py @@ -23,9 +23,9 @@ class AnomalyDetectorClientOperationsMixin(object): - def entire_detect( + def detect_entire_series( self, - body, # type: "models.Request" + body, # type: "models.DetectRequest" **kwargs # type: Any ): # type: (...) -> "models.EntireDetectResponse" @@ -37,7 +37,7 @@ def entire_detect( :param body: Time series points and period if needed. Advanced model parameters can also be set in the request. - :type body: ~azure.ai.anomalydetector.models.Request + :type body: ~azure.ai.anomalydetector.models.DetectRequest :keyword callable cls: A custom type or function that will be passed the direct response :return: EntireDetectResponse, or the result of cls(response) :rtype: ~azure.ai.anomalydetector.models.EntireDetectResponse @@ -49,7 +49,7 @@ def entire_detect( content_type = kwargs.pop("content_type", "application/json") # Construct URL - url = self.entire_detect.metadata['url'] # type: ignore + url = self.detect_entire_series.metadata['url'] # type: ignore path_format_arguments = { 'Endpoint': self._serialize.url("self._config.endpoint", self._config.endpoint, 'str', skip_quote=True), } @@ -64,7 +64,7 @@ def entire_detect( header_parameters['Accept'] = 'application/json' body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(body, 'Request') + body_content = self._serialize.body(body, 'DetectRequest') body_content_kwargs['content'] = body_content request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) @@ -73,7 +73,7 @@ def entire_detect( if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(models.APIError, response) + error = self._deserialize(models.AnomalyDetectorError, response) raise HttpResponseError(response=response, model=error) deserialized = self._deserialize('EntireDetectResponse', pipeline_response) @@ -82,11 +82,11 @@ def entire_detect( return cls(pipeline_response, deserialized, {}) return deserialized - entire_detect.metadata = {'url': '/timeseries/entire/detect'} # type: ignore + detect_entire_series.metadata = {'url': '/timeseries/entire/detect'} # type: ignore - def last_detect( + def detect_last_point( self, - body, # type: "models.Request" + body, # type: "models.DetectRequest" **kwargs # type: Any ): # type: (...) -> "models.LastDetectResponse" @@ -98,7 +98,7 @@ def last_detect( :param body: Time series points and period if needed. Advanced model parameters can also be set in the request. - :type body: ~azure.ai.anomalydetector.models.Request + :type body: ~azure.ai.anomalydetector.models.DetectRequest :keyword callable cls: A custom type or function that will be passed the direct response :return: LastDetectResponse, or the result of cls(response) :rtype: ~azure.ai.anomalydetector.models.LastDetectResponse @@ -110,7 +110,7 @@ def last_detect( content_type = kwargs.pop("content_type", "application/json") # Construct URL - url = self.last_detect.metadata['url'] # type: ignore + url = self.detect_last_point.metadata['url'] # type: ignore path_format_arguments = { 'Endpoint': self._serialize.url("self._config.endpoint", self._config.endpoint, 'str', skip_quote=True), } @@ -125,7 +125,7 @@ def last_detect( header_parameters['Accept'] = 'application/json' body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(body, 'Request') + body_content = self._serialize.body(body, 'DetectRequest') body_content_kwargs['content'] = body_content request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) @@ -134,7 +134,7 @@ def last_detect( if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(models.APIError, response) + error = self._deserialize(models.AnomalyDetectorError, response) raise HttpResponseError(response=response, model=error) deserialized = self._deserialize('LastDetectResponse', pipeline_response) @@ -143,9 +143,9 @@ def last_detect( return cls(pipeline_response, deserialized, {}) return deserialized - last_detect.metadata = {'url': '/timeseries/last/detect'} # type: ignore + detect_last_point.metadata = {'url': '/timeseries/last/detect'} # type: ignore - def change_point_detect( + def detect_change_point( self, body, # type: "models.ChangePointDetectRequest" **kwargs # type: Any @@ -169,7 +169,7 @@ def change_point_detect( content_type = kwargs.pop("content_type", "application/json") # Construct URL - url = self.change_point_detect.metadata['url'] # type: ignore + url = self.detect_change_point.metadata['url'] # type: ignore path_format_arguments = { 'Endpoint': self._serialize.url("self._config.endpoint", self._config.endpoint, 'str', skip_quote=True), } @@ -193,7 +193,7 @@ def change_point_detect( if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(models.APIError, response) + error = self._deserialize(models.AnomalyDetectorError, response) raise HttpResponseError(response=response, model=error) deserialized = self._deserialize('ChangePointDetectResponse', pipeline_response) @@ -202,4 +202,4 @@ def change_point_detect( return cls(pipeline_response, deserialized, {}) return deserialized - change_point_detect.metadata = {'url': '/timeseries/changePoint/detect'} # type: ignore + detect_change_point.metadata = {'url': '/timeseries/changepoint/detect'} # type: ignore