Skip to content

Commit

Permalink
Anomaly detector codegen (#14472)
Browse files Browse the repository at this point in the history
* Initial commit for anomaly detector

* Fix module name

* Update jacoco coverage check

* Ignore swagger README verification
  • Loading branch information
srnagar authored Aug 26, 2020
1 parent c91d0a6 commit 3fcb476
Show file tree
Hide file tree
Showing 28 changed files with 2,346 additions and 0 deletions.
1 change: 1 addition & 0 deletions eng/.docsettings.yml
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,7 @@ known_presence_issues:

known_content_issues:
- ['README.md', '#3113']
- ['sdk/anomalydetector/azure-ai-anomalydetector/swagger/README.md', '#3113']
- ['sdk/applicationinsights/microsoft-azure-applicationinsights-query/README.md', '#3113']
- ['sdk/authorization/microsoft-azure-authentication-msi-token-provider/README.md', '#3113']
- ['sdk/batch/microsoft-azure-batch/README.md', '#3113']
Expand Down
5 changes: 5 additions & 0 deletions eng/jacoco-test-coverage/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,11 @@
</scm>

<dependencies>
<dependency>
<groupId>com.azure</groupId>
<artifactId>azure-ai-anomalydetector</artifactId>
<version>1.0.0-beta.1</version> <!-- {x-version-update;com.azure:azure-ai-anomalydetector;current} -->
</dependency>
<dependency>
<groupId>com.azure</groupId>
<artifactId>azure-ai-formrecognizer</artifactId>
Expand Down
1 change: 1 addition & 0 deletions eng/versioning/version_client.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
com.azure:azure-sdk-all;1.0.0;1.0.0
com.azure:azure-sdk-parent;1.6.0;1.6.0
com.azure:azure-client-sdk-parent;1.7.0;1.7.0
com.azure:azure-ai-anomalydetector;1.0.0-beta.1;1.0.0-beta.1
com.azure:azure-ai-formrecognizer;3.0.0;3.1.0-beta.1
com.azure:azure-ai-textanalytics;5.0.0;5.1.0-beta.1
com.azure:azure-core;1.7.0;1.8.0-beta.1
Expand Down
3 changes: 3 additions & 0 deletions sdk/anomalydetector/azure-ai-anomalydetector/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# Release History

## 1.0.0-beta.1 (Unreleased)
44 changes: 44 additions & 0 deletions sdk/anomalydetector/azure-ai-anomalydetector/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
# Azure Anomaly Detector client library for Java
TODO

## Getting started

### Prerequisites

- Java Development Kit (JDK) with version 8 or above
- [Azure Subscription][azure_subscription]

### Include the Package

[//]: # ({x-version-update-start;com.azure:azure-ai-anomalydetector;current})
```xml
<dependency>
<groupId>com.azure</groupId>
<artifactId>azure-ai-anomalydetector</artifactId>
<version>1.0.0-beta.1</version>
</dependency>
```
[//]: # ({x-version-update-end})

## Key concepts

## Examples

## Troubleshooting

## Next steps

## Contributing

This project welcomes contributions and suggestions. Most contributions require you to agree to a [Contributor License Agreement (CLA)][cla] declaring that you have the right to, and actually do, grant us the rights to use your contribution.

When you submit a pull request, a CLA-bot will automatically determine whether you need to provide a CLA and decorate the PR appropriately (e.g., label, comment). Simply follow the instructions provided by the bot. You will only need to do this once across all repos using our CLA.

This project has adopted the [Microsoft Open Source Code of Conduct][coc]. For more information see the [Code of Conduct FAQ][coc_faq] or contact [[email protected]][coc_contact] with any additional questions or comments.

<!-- LINKS -->
[samples]: src/samples/java/com/azure/ai/anomalydetector
[samples_readme]: src/samples/README.md
[source_code]: src

![Impressions](https://azure-sdk-impressions.azurewebsites.net/api/impressions/azure-sdk-for-java%2Fsdk%2Fanomalydetector%2Fazure-ai-anomalydetector%2FREADME.png)
69 changes: 69 additions & 0 deletions sdk/anomalydetector/azure-ai-anomalydetector/pom.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>

<parent>
<groupId>com.azure</groupId>
<artifactId>azure-client-sdk-parent</artifactId>
<version>1.7.0</version> <!-- {x-version-update;com.azure:azure-client-sdk-parent;current} -->
<relativePath>../../parents/azure-client-sdk-parent</relativePath>
</parent>

<groupId>com.azure</groupId>
<artifactId>azure-ai-anomalydetector</artifactId>
<version>1.0.0-beta.1</version> <!-- {x-version-update;com.azure:azure-ai-anomalydetector;current} -->

<name>Microsoft Azure client library for Anomaly Detector</name>
<description>This package contains Microsoft Azure Anomaly Detector client library.</description>

<distributionManagement>
<site>
<id>azure-java-build-docs</id>
<url>${site.url}/site/${project.artifactId}</url>
</site>
</distributionManagement>

<scm>
<url>scm:git:https://github.com/Azure/azure-sdk-for-java</url>
<connection>scm:git:[email protected]:Azure/azure-sdk-for-java.git</connection>
<tag>HEAD</tag>
</scm>

<properties>
<!-- Anomaly detector temporarily skipping code coverage until tests are added -->
<jacoco.skip.coverage.check>true</jacoco.skip.coverage.check>
</properties>

<dependencies>
<dependency>
<groupId>com.azure</groupId>
<artifactId>azure-core</artifactId>
<version>1.7.0</version> <!-- {x-version-update;com.azure:azure-core;dependency} -->
</dependency>
<dependency>
<groupId>com.azure</groupId>
<artifactId>azure-core-http-netty</artifactId>
<version>1.5.4</version> <!-- {x-version-update;com.azure:azure-core-http-netty;dependency} -->
</dependency>

<!-- Test dependencies -->
<dependency>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter-api</artifactId>
<version>5.6.2</version> <!-- {x-version-update;org.junit.jupiter:junit-jupiter-api;external_dependency} -->
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter-engine</artifactId>
<version>5.6.2</version> <!-- {x-version-update;org.junit.jupiter:junit-jupiter-engine;external_dependency} -->
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter-params</artifactId>
<version>5.6.2</version> <!-- {x-version-update;org.junit.jupiter:junit-jupiter-params;external_dependency} -->
<scope>test</scope>
</dependency>
</dependencies>
</project>
Original file line number Diff line number Diff line change
@@ -0,0 +1,123 @@
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License.
// Code generated by Microsoft (R) AutoRest Code Generator.

package com.azure.ai.anomalydetector;

import com.azure.ai.anomalydetector.implementation.AnomalyDetectorClientImpl;
import com.azure.ai.anomalydetector.models.ApiErrorException;
import com.azure.ai.anomalydetector.models.ChangePointDetectRequest;
import com.azure.ai.anomalydetector.models.ChangePointDetectResponse;
import com.azure.ai.anomalydetector.models.EntireDetectResponse;
import com.azure.ai.anomalydetector.models.LastDetectResponse;
import com.azure.ai.anomalydetector.models.Request;
import com.azure.core.annotation.ReturnType;
import com.azure.core.annotation.ServiceClient;
import com.azure.core.annotation.ServiceMethod;
import com.azure.core.http.rest.Response;
import reactor.core.publisher.Mono;

/** Initializes a new instance of the asynchronous AnomalyDetectorClient type. */
@ServiceClient(builder = AnomalyDetectorClientBuilder.class, isAsync = true)
public final class AnomalyDetectorAsyncClient {
private AnomalyDetectorClientImpl serviceClient;

/** Initializes an instance of AnomalyDetectorClient client. */
AnomalyDetectorAsyncClient(AnomalyDetectorClientImpl serviceClient) {
this.serviceClient = serviceClient;
}

/**
* This operation generates a model using an entire series, each point is detected with the same model. With this
* method, points before and after a certain point are used to determine whether it is an anomaly. The entire
* detection can give user an overall status of the time series.
*
* @param body Time series points and period if needed. Advanced model parameters can also be set in the request.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws ApiErrorException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return the response.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public Mono<Response<EntireDetectResponse>> entireDetectWithResponse(Request body) {
return this.serviceClient.entireDetectWithResponseAsync(body);
}

/**
* This operation generates a model using an entire series, each point is detected with the same model. With this
* method, points before and after a certain point are used to determine whether it is an anomaly. The entire
* detection can give user an overall status of the time series.
*
* @param body Time series points and period if needed. Advanced model parameters can also be set in the request.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws ApiErrorException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return the response.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public Mono<EntireDetectResponse> entireDetect(Request body) {
return this.serviceClient.entireDetectAsync(body);
}

/**
* This operation generates a model using points before the latest one. With this method, only historical points are
* used to determine whether the target point is an anomaly. The latest point detecting operation matches the
* scenario of real-time monitoring of business metrics.
*
* @param body Time series points and period if needed. Advanced model parameters can also be set in the request.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws ApiErrorException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return the response.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public Mono<Response<LastDetectResponse>> lastDetectWithResponse(Request body) {
return this.serviceClient.lastDetectWithResponseAsync(body);
}

/**
* This operation generates a model using points before the latest one. With this method, only historical points are
* used to determine whether the target point is an anomaly. The latest point detecting operation matches the
* scenario of real-time monitoring of business metrics.
*
* @param body Time series points and period if needed. Advanced model parameters can also be set in the request.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws ApiErrorException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return the response.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public Mono<LastDetectResponse> lastDetect(Request body) {
return this.serviceClient.lastDetectAsync(body);
}

/**
* Evaluate change point score of every series point.
*
* @param body Time series points and granularity is needed. Advanced model parameters can also be set in the
* request if needed.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws ApiErrorException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return the response.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public Mono<Response<ChangePointDetectResponse>> changePointDetectWithResponse(ChangePointDetectRequest body) {
return this.serviceClient.changePointDetectWithResponseAsync(body);
}

/**
* Evaluate change point score of every series point.
*
* @param body Time series points and granularity is needed. Advanced model parameters can also be set in the
* request if needed.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws ApiErrorException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return the response.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public Mono<ChangePointDetectResponse> changePointDetect(ChangePointDetectRequest body) {
return this.serviceClient.changePointDetectAsync(body);
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,127 @@
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License.
// Code generated by Microsoft (R) AutoRest Code Generator.

package com.azure.ai.anomalydetector;

import com.azure.ai.anomalydetector.implementation.AnomalyDetectorClientImpl;
import com.azure.ai.anomalydetector.models.ApiErrorException;
import com.azure.ai.anomalydetector.models.ChangePointDetectRequest;
import com.azure.ai.anomalydetector.models.ChangePointDetectResponse;
import com.azure.ai.anomalydetector.models.EntireDetectResponse;
import com.azure.ai.anomalydetector.models.LastDetectResponse;
import com.azure.ai.anomalydetector.models.Request;
import com.azure.core.annotation.ReturnType;
import com.azure.core.annotation.ServiceClient;
import com.azure.core.annotation.ServiceMethod;
import com.azure.core.http.rest.Response;
import com.azure.core.util.Context;

/** Initializes a new instance of the synchronous AnomalyDetectorClient type. */
@ServiceClient(builder = AnomalyDetectorClientBuilder.class)
public final class AnomalyDetectorClient {
private AnomalyDetectorClientImpl serviceClient;

/** Initializes an instance of AnomalyDetectorClient client. */
AnomalyDetectorClient(AnomalyDetectorClientImpl serviceClient) {
this.serviceClient = serviceClient;
}

/**
* This operation generates a model using an entire series, each point is detected with the same model. With this
* method, points before and after a certain point are used to determine whether it is an anomaly. The entire
* detection can give user an overall status of the time series.
*
* @param body Time series points and period if needed. Advanced model parameters can also be set in the request.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws ApiErrorException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return the response.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public EntireDetectResponse entireDetect(Request body) {
return this.serviceClient.entireDetect(body);
}

/**
* This operation generates a model using an entire series, each point is detected with the same model. With this
* method, points before and after a certain point are used to determine whether it is an anomaly. The entire
* detection can give user an overall status of the time series.
*
* @param body Time series points and period if needed. Advanced model parameters can also be set in the request.
* @param context The context to associate with this operation.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws ApiErrorException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return the response.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public Response<EntireDetectResponse> entireDetectWithResponse(Request body, Context context) {
return this.serviceClient.entireDetectWithResponse(body, context);
}

/**
* This operation generates a model using points before the latest one. With this method, only historical points are
* used to determine whether the target point is an anomaly. The latest point detecting operation matches the
* scenario of real-time monitoring of business metrics.
*
* @param body Time series points and period if needed. Advanced model parameters can also be set in the request.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws ApiErrorException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return the response.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public LastDetectResponse lastDetect(Request body) {
return this.serviceClient.lastDetect(body);
}

/**
* This operation generates a model using points before the latest one. With this method, only historical points are
* used to determine whether the target point is an anomaly. The latest point detecting operation matches the
* scenario of real-time monitoring of business metrics.
*
* @param body Time series points and period if needed. Advanced model parameters can also be set in the request.
* @param context The context to associate with this operation.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws ApiErrorException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return the response.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public Response<LastDetectResponse> lastDetectWithResponse(Request body, Context context) {
return this.serviceClient.lastDetectWithResponse(body, context);
}

/**
* Evaluate change point score of every series point.
*
* @param body Time series points and granularity is needed. Advanced model parameters can also be set in the
* request if needed.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws ApiErrorException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return the response.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public ChangePointDetectResponse changePointDetect(ChangePointDetectRequest body) {
return this.serviceClient.changePointDetect(body);
}

/**
* Evaluate change point score of every series point.
*
* @param body Time series points and granularity is needed. Advanced model parameters can also be set in the
* request if needed.
* @param context The context to associate with this operation.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws ApiErrorException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return the response.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public Response<ChangePointDetectResponse> changePointDetectWithResponse(
ChangePointDetectRequest body, Context context) {
return this.serviceClient.changePointDetectWithResponse(body, context);
}
}
Loading

0 comments on commit 3fcb476

Please sign in to comment.