Skip to content

Commit

Permalink
CodeGen from PR 16543 in Azure/azure-rest-api-specs
Browse files Browse the repository at this point in the history
Update Anomaly Detection API (Azure#16543)

* update example

* update result structure

* update

* update...

* change version

* delete test files

* reset version

* update last detect parameters

* fix break changes

* fix errors

* update examples

* add impute strategy

* Add severity definition

* update MultivariateAnomalyDetector.json

* update examples

* update swagger

* update path

* Revert "Merge branch 'main' into juaduan/mvad_swagger_latest"

This reverts commit 9524fe794fb190bb7aea196d954203c55604efc5, reversing
changes made to fef9721866e175d220def5ddfff69e15ce39add5.

* fix merge errors

* Create MultivariateAnomalyDetector.json

* Revert "Create MultivariateAnomalyDetector.json"

This reverts commit 35316761a348ea19c0ac585ebb5c17286ca603fb.

* modify prop. of last detect request

* uvad changes

* Fix the brace problem

* Fix uvad check errors

* fix the x-ms-enum issue

* Add impute strategy to examples

* update swagger

* update model

* update readme

* update example

* update

* update example

* rename folder

* update readme

* update version of mvad

* Update uvad to new version

* update mvad json

* change back

* add api version

* update api version

* update examples

* Fix version in uvad spec

* fix api version in example

* fix readme

* update x-ms-parameterized-hots

* update apiversion description

* modify standard location

* update nvad severity x-nullable

* update uvad required fields

* change name to body

* modify standard location

* change the x-nullable for impute

* change error from list to obj

* change x-nullable

* remove nullable-false; modelAsString ture for enum

* remove x-nullable false

* Add severity to required fields of EntireDetectResponse and LastDetectResponse

* remove the severity from required

* update exmple name

* update readme

* Revert "update readme"

This reverts commit 9d2790229b3280a7ea678cf4b1211d5a093b1b73.

* add x-ms-error-code in examples

* add x-ms-error-code

* fix errors

* update

* update error responses

* update

* prettier

* update default response

* fix DetectAnomaly.json

* Add x-ms-error-code and descriptions

* fix the description typo

* resolve comments

* remove x-ms-error-response

Co-authored-by: juaduan <juaduan@microsoft.com>
Co-authored-by: Meng Ai <mengai@microsoft.com>
Co-authored-by: jr-MS <81400625+jr-MS@users.noreply.github.com>
Co-authored-by: Xia Zhu <zhuxia@microsoft.com>
  • Loading branch information
5 people committed Dec 15, 2021
1 parent 3a14782 commit f20dd2f
Show file tree
Hide file tree
Showing 20 changed files with 3,273 additions and 0 deletions.
5 changes: 5 additions & 0 deletions sdk/anomalydetector/azure-ai-anomalydetector/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# Release History

## 0.1.0 (1970-01-01)

* Initial Release
6 changes: 6 additions & 0 deletions sdk/anomalydetector/azure-ai-anomalydetector/MANIFEST.in
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
include _meta.json
recursive-include tests *.py *.yaml
include *.md
include azure/__init__.py
include azure/ai/__init__.py

27 changes: 27 additions & 0 deletions sdk/anomalydetector/azure-ai-anomalydetector/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
# Microsoft Azure SDK for Python

This is the Microsoft Azure MyService Management Client Library.
This package has been tested with Python 2.7, 3.5, 3.6, 3.7 and 3.8.
For a more complete view of Azure libraries, see the [azure sdk python release](https://aka.ms/azsdk/python/all).


# Usage


To learn how to use this package, see the [quickstart guide](https://aka.ms/azsdk/python/mgmt)



For docs and references, see [Python SDK References](https://docs.microsoft.com/python/api/overview/azure/)
Code samples for this package can be found at [MyService Management](https://docs.microsoft.com/samples/browse/?languages=python&term=Getting%20started%20-%20Managing&terms=Getting%20started%20-%20Managing) on docs.microsoft.com.
Additional code samples for different Azure services are available at [Samples Repo](https://aka.ms/azsdk/python/mgmt/samples)


# Provide Feedback

If you encounter any bugs or have suggestions, please file an issue in the
[Issues](https://github.com/Azure/azure-sdk-for-python/issues)
section of the project.


![Impressions](https://azure-sdk-impressions.azurewebsites.net/api/impressions/azure-sdk-for-python%2Fazure-ai-anomalydetector%2FREADME.png)
8 changes: 8 additions & 0 deletions sdk/anomalydetector/azure-ai-anomalydetector/_meta.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"autorest": "V2",
"use": "@microsoft.azure/autorest.python@~4.0.71",
"commit": "725b20c866d7f4a6512adff8d0647f0fe3baa069",
"repository_url": "https://github.com/Azure/azure-rest-api-specs",
"autorest_command": "autorest specification/cognitiveservices/data-plane/AnomalyDetector/readme.md --keep-version-file --multiapi --no-async --python --python-mode=update --python-sdks-folder=/home/vsts/work/1/s/azure-sdk-for-python/sdk --use=@microsoft.azure/autorest.python@~4.0.71 --version=V2",
"readme": "specification/cognitiveservices/data-plane/AnomalyDetector/readme.md"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
__path__ = __import__('pkgutil').extend_path(__path__, __name__)
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
__path__ = __import__('pkgutil').extend_path(__path__, __name__)
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
# coding=utf-8
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for
# license information.
#
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes may cause incorrect behavior and will be lost if the code is
# regenerated.
# --------------------------------------------------------------------------

from ._configuration import AnomalyDetectorClientConfiguration
from ._anomaly_detector_client import AnomalyDetectorClient
__all__ = ['AnomalyDetectorClient', 'AnomalyDetectorClientConfiguration']

from .version import VERSION

__version__ = VERSION

Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
# coding=utf-8
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for
# license information.
#
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes may cause incorrect behavior and will be lost if the code is
# regenerated.
# --------------------------------------------------------------------------

from msrest.service_client import SDKClient
from msrest import Serializer, Deserializer

from ._configuration import AnomalyDetectorClientConfiguration
from .operations import AnomalyDetectorClientOperationsMixin
from . import models


class AnomalyDetectorClient(AnomalyDetectorClientOperationsMixin, SDKClient):
"""The Anomaly Detector API detects anomalies automatically in time series data. It supports two kinds of mode, one is for stateless using, another is for stateful using. In stateless mode, there are three functionalities. Entire Detect is for detecting the whole series with model trained by the time series, Last Detect is detecting last point with model trained by points before. ChangePoint Detect is for detecting trend changes in time series. In stateful mode, user can store time series, the stored time series will be used for detection anomalies. Under this mode, user can still use the above three functionalities by only giving a time range without preparing time series in client side. Besides the above three functionalities, stateful model also provide group based detection and labeling service. By leveraging labeling service user can provide labels for each detection result, these labels will be used for retuning or regenerating detection models. Inconsistency detection is a kind of group based detection, this detection will find inconsistency ones in a set of time series. By using anomaly detector service, business customers can discover incidents and establish a logic flow for root cause analysis.
:ivar config: Configuration for client.
:vartype config: AnomalyDetectorClientConfiguration
:param endpoint: Supported Cognitive Services endpoints (protocol and
hostname, for example: https://westus2.api.cognitive.microsoft.com).
:type endpoint: str
:param credentials: Subscription credentials which uniquely identify
client subscription.
:type credentials: None
"""

def __init__(
self, endpoint, credentials):

self.config = AnomalyDetectorClientConfiguration(endpoint, credentials)
super(AnomalyDetectorClient, self).__init__(self.config.credentials, self.config)

client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)}
self.api_version = '1.1-preview.1'
self._serialize = Serializer(client_models)
self._deserialize = Deserializer(client_models)

Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
# coding=utf-8
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for
# license information.
#
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes may cause incorrect behavior and will be lost if the code is
# regenerated.
# --------------------------------------------------------------------------

from msrest import Configuration

from .version import VERSION


class AnomalyDetectorClientConfiguration(Configuration):
"""Configuration for AnomalyDetectorClient
Note that all parameters used to create this instance are saved as instance
attributes.
:param endpoint: Supported Cognitive Services endpoints (protocol and
hostname, for example: https://westus2.api.cognitive.microsoft.com).
:type endpoint: str
:param credentials: Subscription credentials which uniquely identify
client subscription.
:type credentials: None
"""

def __init__(
self, endpoint, credentials):

if endpoint is None:
raise ValueError("Parameter 'endpoint' must not be None.")
if credentials is None:
raise ValueError("Parameter 'credentials' must not be None.")
base_url = '{Endpoint}/anomalydetector/{ApiVersion}'

super(AnomalyDetectorClientConfiguration, self).__init__(base_url)

# Starting Autorest.Python 4.0.64, make connection pool activated by default
self.keep_alive = True

self.add_user_agent('azure-ai-anomalydetector/{}'.format(VERSION))

self.endpoint = endpoint
self.credentials = credentials
Original file line number Diff line number Diff line change
@@ -0,0 +1,108 @@
# coding=utf-8
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for
# license information.
#
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes may cause incorrect behavior and will be lost if the code is
# regenerated.
# --------------------------------------------------------------------------

try:
from ._models_py3 import AlignPolicy
from ._models_py3 import AnomalyDetectorError, AnomalyDetectorErrorException
from ._models_py3 import AnomalyInterpretation
from ._models_py3 import AnomalyState
from ._models_py3 import AnomalyValue
from ._models_py3 import ChangePointDetectRequest
from ._models_py3 import ChangePointDetectResponse
from ._models_py3 import CorrelationChanges
from ._models_py3 import DetectionRequest
from ._models_py3 import DetectionResult
from ._models_py3 import DetectionResultSummary
from ._models_py3 import DetectRequest
from ._models_py3 import DiagnosticsInfo
from ._models_py3 import EntireDetectResponse
from ._models_py3 import ErrorResponse, ErrorResponseException
from ._models_py3 import LastDetectionRequest
from ._models_py3 import LastDetectionResult
from ._models_py3 import LastDetectResponse
from ._models_py3 import Model
from ._models_py3 import ModelInfo
from ._models_py3 import ModelList
from ._models_py3 import ModelSnapshot
from ._models_py3 import ModelState
from ._models_py3 import TimeSeriesPoint
from ._models_py3 import VariableState
from ._models_py3 import VariableValues
except (SyntaxError, ImportError):
from ._models import AlignPolicy
from ._models import AnomalyDetectorError, AnomalyDetectorErrorException
from ._models import AnomalyInterpretation
from ._models import AnomalyState
from ._models import AnomalyValue
from ._models import ChangePointDetectRequest
from ._models import ChangePointDetectResponse
from ._models import CorrelationChanges
from ._models import DetectionRequest
from ._models import DetectionResult
from ._models import DetectionResultSummary
from ._models import DetectRequest
from ._models import DiagnosticsInfo
from ._models import EntireDetectResponse
from ._models import ErrorResponse, ErrorResponseException
from ._models import LastDetectionRequest
from ._models import LastDetectionResult
from ._models import LastDetectResponse
from ._models import Model
from ._models import ModelInfo
from ._models import ModelList
from ._models import ModelSnapshot
from ._models import ModelState
from ._models import TimeSeriesPoint
from ._models import VariableState
from ._models import VariableValues
from ._anomaly_detector_client_enums import (
AlignMode,
DetectionStatus,
FillNAMethod,
ImputeMode,
ModelStatus,
TimeGranularity,
)

__all__ = [
'AlignPolicy',
'AnomalyDetectorError', 'AnomalyDetectorErrorException',
'AnomalyInterpretation',
'AnomalyState',
'AnomalyValue',
'ChangePointDetectRequest',
'ChangePointDetectResponse',
'CorrelationChanges',
'DetectionRequest',
'DetectionResult',
'DetectionResultSummary',
'DetectRequest',
'DiagnosticsInfo',
'EntireDetectResponse',
'ErrorResponse', 'ErrorResponseException',
'LastDetectionRequest',
'LastDetectionResult',
'LastDetectResponse',
'Model',
'ModelInfo',
'ModelList',
'ModelSnapshot',
'ModelState',
'TimeSeriesPoint',
'VariableState',
'VariableValues',
'TimeGranularity',
'ImputeMode',
'AlignMode',
'FillNAMethod',
'ModelStatus',
'DetectionStatus',
]
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
# coding=utf-8
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for
# license information.
#
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes may cause incorrect behavior and will be lost if the code is
# regenerated.
# --------------------------------------------------------------------------

from enum import Enum


class TimeGranularity(str, Enum):

yearly = "yearly"
monthly = "monthly"
weekly = "weekly"
daily = "daily"
hourly = "hourly"
per_minute = "minutely"
per_second = "secondly"
microsecond = "microsecond"
none = "none"


class ImputeMode(str, Enum):

auto = "auto"
previous = "previous"
linear = "linear"
fixed = "fixed"
zero = "zero"
not_fill = "notFill"


class AlignMode(str, Enum):

inner = "Inner"
outer = "Outer"


class FillNAMethod(str, Enum):

previous = "Previous"
subsequent = "Subsequent"
linear = "Linear"
zero = "Zero"
fixed = "Fixed"
not_fill = "NotFill"


class ModelStatus(str, Enum):

created = "CREATED"
running = "RUNNING"
ready = "READY"
failed = "FAILED"


class DetectionStatus(str, Enum):

created = "CREATED"
running = "RUNNING"
ready = "READY"
failed = "FAILED"
Loading

0 comments on commit f20dd2f

Please sign in to comment.