Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[AutoPR azure-ai-anomalydetector] New API & Update Properties for Anomaly Detector #8014

Draft
wants to merge 1 commit into
base: release/v3
Choose a base branch
from
Draft
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
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": "a9e4cf01c27f2153eb2c2fc8afaac437d0f75b01",
"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 [email protected]/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,45 @@
# 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 msrest.exceptions import HttpOperationError
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'
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/v1.1-preview'

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,109 @@
# 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 AnomalyContributor
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 AnomalyContributor
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,
ModelStatus,
TimeGranularity,
)

__all__ = [
'AlignPolicy',
'AnomalyContributor',
'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',
'AlignMode',
'FillNAMethod',
'ModelStatus',
'DetectionStatus',
]
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
# 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 AlignMode(str, Enum):

inner = "Inner"
outer = "Outer"


class FillNAMethod(str, Enum):

previous = "Previous"
subsequent = "Subsequent"
linear = "Linear"
zero = "Zero"
pad = "Pad"
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