From 1dcf1c8b0ca6d9fb6391b977c9ad972cd1e9019b Mon Sep 17 00:00:00 2001 From: SDKAuto Date: Thu, 7 Apr 2022 05:43:19 +0000 Subject: [PATCH] CodeGen from PR 18037 in Azure/azure-rest-api-specs Add multidimensional Root Cause Analysis APIs in Anomaly Detector Service (#18037) * add multidimentional RCA API * update to 4 tab * update swagger * update swagger with kind * update * update wording * add derived decoration * update schema definition * add more polymorphism * update create dataset * add kin for train, inference, data * update * update * update * update according to review * update query filter * remove nextLinkName * add error code * update * update verion so v1.2-preview * update spelling * update list partition meta * update * update version * update partition * update * update * merge with 1.1-preview.1 version * update * sync with 1.1-preview.1 * update train response * update inference * update version * update description of timestamp * update * update readme * update * update version * update * add x-ms-error-code * update filter description * add 201 response and add kind list * update * update * update comment * update * update * update * upate * format * add emtpy line at end of file * add dataset Id in required for dataset * update * update --- eng/versioning/version_client.txt | 3 + .../CHANGELOG.md | 13 + .../README.md | 63 + .../pom.xml | 73 + .../AnomalyDetectorAsyncClient.java | 449 ++++ .../AnomalyDetectorClient.java | 446 ++++ .../AnomalyDetectorClientBuilder.java | 287 +++ .../AnomalyDetectorServiceVersion.java | 33 + .../AnomalyDetectorClientImpl.java | 1862 +++++++++++++++++ .../implementation/package-info.java | 19 + .../package-info.java | 19 + .../src/main/java/module-info.java | 9 + ...ces-multivariateanomalydetector.properties | 2 + .../ReadmeSamples.java | 12 + .../generated/DeleteMultivariateModel.java | 25 + .../DetectAnomalyWithMultivariateModel.java | 29 + .../generated/ExportModel.java | 22 + .../generated/GetDetectionResult.java | 25 + .../generated/GetMultivariateModel.java | 26 + .../generated/ListMultivariateModel.java | 24 + .../generated/TrainMultivariateModel.java | 27 + .../AnomalyDetectorClientTestBase.java | 33 + .../DeleteMultivariateModelTests.java | 23 + ...tectAnomalyWithMultivariateModelTests.java | 30 + .../generated/ExportModelTests.java | 23 + .../generated/GetDetectionResultTests.java | 29 + .../generated/GetMultivariateModelTests.java | 29 + .../generated/ListMultivariateModelTests.java | 27 + .../TrainMultivariateModelTests.java | 28 + .../swagger/README_SPEC.md | 30 + sdk/cognitiveservices/ci.yml | 9 + sdk/cognitiveservices/pom.xml | 3 + 32 files changed, 3732 insertions(+) create mode 100644 sdk/cognitiveservices/azure-cognitiveservices-multivariateanomalydetector/CHANGELOG.md create mode 100644 sdk/cognitiveservices/azure-cognitiveservices-multivariateanomalydetector/README.md create mode 100644 sdk/cognitiveservices/azure-cognitiveservices-multivariateanomalydetector/pom.xml create mode 100644 sdk/cognitiveservices/azure-cognitiveservices-multivariateanomalydetector/src/main/java/com/azure/cognitiveservices/multivariateanomalydetector/AnomalyDetectorAsyncClient.java create mode 100644 sdk/cognitiveservices/azure-cognitiveservices-multivariateanomalydetector/src/main/java/com/azure/cognitiveservices/multivariateanomalydetector/AnomalyDetectorClient.java create mode 100644 sdk/cognitiveservices/azure-cognitiveservices-multivariateanomalydetector/src/main/java/com/azure/cognitiveservices/multivariateanomalydetector/AnomalyDetectorClientBuilder.java create mode 100644 sdk/cognitiveservices/azure-cognitiveservices-multivariateanomalydetector/src/main/java/com/azure/cognitiveservices/multivariateanomalydetector/AnomalyDetectorServiceVersion.java create mode 100644 sdk/cognitiveservices/azure-cognitiveservices-multivariateanomalydetector/src/main/java/com/azure/cognitiveservices/multivariateanomalydetector/implementation/AnomalyDetectorClientImpl.java create mode 100644 sdk/cognitiveservices/azure-cognitiveservices-multivariateanomalydetector/src/main/java/com/azure/cognitiveservices/multivariateanomalydetector/implementation/package-info.java create mode 100644 sdk/cognitiveservices/azure-cognitiveservices-multivariateanomalydetector/src/main/java/com/azure/cognitiveservices/multivariateanomalydetector/package-info.java create mode 100644 sdk/cognitiveservices/azure-cognitiveservices-multivariateanomalydetector/src/main/java/module-info.java create mode 100644 sdk/cognitiveservices/azure-cognitiveservices-multivariateanomalydetector/src/main/resources/azure-cognitiveservices-multivariateanomalydetector.properties create mode 100644 sdk/cognitiveservices/azure-cognitiveservices-multivariateanomalydetector/src/samples/java/com/azure/cognitiveservices/multivariateanomalydetector/ReadmeSamples.java create mode 100644 sdk/cognitiveservices/azure-cognitiveservices-multivariateanomalydetector/src/samples/java/com/azure/cognitiveservices/multivariateanomalydetector/generated/DeleteMultivariateModel.java create mode 100644 sdk/cognitiveservices/azure-cognitiveservices-multivariateanomalydetector/src/samples/java/com/azure/cognitiveservices/multivariateanomalydetector/generated/DetectAnomalyWithMultivariateModel.java create mode 100644 sdk/cognitiveservices/azure-cognitiveservices-multivariateanomalydetector/src/samples/java/com/azure/cognitiveservices/multivariateanomalydetector/generated/ExportModel.java create mode 100644 sdk/cognitiveservices/azure-cognitiveservices-multivariateanomalydetector/src/samples/java/com/azure/cognitiveservices/multivariateanomalydetector/generated/GetDetectionResult.java create mode 100644 sdk/cognitiveservices/azure-cognitiveservices-multivariateanomalydetector/src/samples/java/com/azure/cognitiveservices/multivariateanomalydetector/generated/GetMultivariateModel.java create mode 100644 sdk/cognitiveservices/azure-cognitiveservices-multivariateanomalydetector/src/samples/java/com/azure/cognitiveservices/multivariateanomalydetector/generated/ListMultivariateModel.java create mode 100644 sdk/cognitiveservices/azure-cognitiveservices-multivariateanomalydetector/src/samples/java/com/azure/cognitiveservices/multivariateanomalydetector/generated/TrainMultivariateModel.java create mode 100644 sdk/cognitiveservices/azure-cognitiveservices-multivariateanomalydetector/src/test/java/com/azure/cognitiveservices/multivariateanomalydetector/generated/AnomalyDetectorClientTestBase.java create mode 100644 sdk/cognitiveservices/azure-cognitiveservices-multivariateanomalydetector/src/test/java/com/azure/cognitiveservices/multivariateanomalydetector/generated/DeleteMultivariateModelTests.java create mode 100644 sdk/cognitiveservices/azure-cognitiveservices-multivariateanomalydetector/src/test/java/com/azure/cognitiveservices/multivariateanomalydetector/generated/DetectAnomalyWithMultivariateModelTests.java create mode 100644 sdk/cognitiveservices/azure-cognitiveservices-multivariateanomalydetector/src/test/java/com/azure/cognitiveservices/multivariateanomalydetector/generated/ExportModelTests.java create mode 100644 sdk/cognitiveservices/azure-cognitiveservices-multivariateanomalydetector/src/test/java/com/azure/cognitiveservices/multivariateanomalydetector/generated/GetDetectionResultTests.java create mode 100644 sdk/cognitiveservices/azure-cognitiveservices-multivariateanomalydetector/src/test/java/com/azure/cognitiveservices/multivariateanomalydetector/generated/GetMultivariateModelTests.java create mode 100644 sdk/cognitiveservices/azure-cognitiveservices-multivariateanomalydetector/src/test/java/com/azure/cognitiveservices/multivariateanomalydetector/generated/ListMultivariateModelTests.java create mode 100644 sdk/cognitiveservices/azure-cognitiveservices-multivariateanomalydetector/src/test/java/com/azure/cognitiveservices/multivariateanomalydetector/generated/TrainMultivariateModelTests.java create mode 100644 sdk/cognitiveservices/azure-cognitiveservices-multivariateanomalydetector/swagger/README_SPEC.md diff --git a/eng/versioning/version_client.txt b/eng/versioning/version_client.txt index 9094ba44d3b97..60c3504a2ede3 100644 --- a/eng/versioning/version_client.txt +++ b/eng/versioning/version_client.txt @@ -146,6 +146,9 @@ com.azure:azure-template-perf;1.0.0-beta.1;1.0.0-beta.1 com.azure:azure-media-videoanalyzer-edge;1.0.0-beta.5;1.0.0-beta.6 com.azure:azure-verticals-agrifood-farming;1.0.0-beta.2;1.0.0-beta.3 com.azure:perf-test-core;1.0.0-beta.1;1.0.0-beta.1 +com.azure:azure-cognitiveservices-anomalydetector;1.0.0-beta.1;1.0.0-beta.1 +com.azure:azure-cognitiveservices-multivariateanomalydetector;1.0.0-beta.1;1.0.0-beta.1 +com.azure:azure-cognitiveservices-rootcauseanalysis;1.0.0-beta.1;1.0.0-beta.1 com.microsoft.azure:spring-cloud-azure-appconfiguration-config-web;1.3.0;1.4.0-beta.1 com.microsoft.azure:spring-cloud-azure-appconfiguration-config;1.3.0;1.4.0-beta.1 com.microsoft.azure:spring-cloud-azure-feature-management-web;1.3.0;1.4.0-beta.1 diff --git a/sdk/cognitiveservices/azure-cognitiveservices-multivariateanomalydetector/CHANGELOG.md b/sdk/cognitiveservices/azure-cognitiveservices-multivariateanomalydetector/CHANGELOG.md new file mode 100644 index 0000000000000..5350cdc0924ff --- /dev/null +++ b/sdk/cognitiveservices/azure-cognitiveservices-multivariateanomalydetector/CHANGELOG.md @@ -0,0 +1,13 @@ +# Release History + +## 1.0.0-beta.1 (Unreleased) + +- Azure AnomalyDetectorClient client library for Java. This package contains Microsoft Azure AnomalyDetectorClient client library. + +### Features Added + +### Breaking Changes + +### Bugs Fixed + +### Other Changes diff --git a/sdk/cognitiveservices/azure-cognitiveservices-multivariateanomalydetector/README.md b/sdk/cognitiveservices/azure-cognitiveservices-multivariateanomalydetector/README.md new file mode 100644 index 0000000000000..5f93da5a80a4f --- /dev/null +++ b/sdk/cognitiveservices/azure-cognitiveservices-multivariateanomalydetector/README.md @@ -0,0 +1,63 @@ +# Azure AnomalyDetectorClient client library for Java + +Azure AnomalyDetectorClient client library for Java. + +This package contains Microsoft Azure AnomalyDetectorClient client library. + +## Documentation + +Various documentation is available to help you get started + +- [API reference documentation][docs] +- [Product documentation][product_documentation] + +## Getting started + +### Prerequisites + +- [Java Development Kit (JDK)][jdk] with version 8 or above +- [Azure Subscription][azure_subscription] + +### Adding the package to your product + +[//]: # ({x-version-update-start;com.azure:azure-cognitiveservices-multivariateanomalydetector;current}) +```xml + + com.azure + azure-cognitiveservices-multivariateanomalydetector + 1.0.0-beta.1 + +``` +[//]: # ({x-version-update-end}) + +### Authentication + +[Azure Identity][azure_identity] package provides the default implementation for authenticating the client. + +## Key concepts + +## Examples + +```java com.azure.cognitiveservices.multivariateanomalydetector.readme +``` + +## Troubleshooting + +## Next steps + +## Contributing + +For details on contributing to this repository, see the [contributing guide](https://github.com/Azure/azure-sdk-for-java/blob/main/CONTRIBUTING.md). + +1. Fork it +1. Create your feature branch (`git checkout -b my-new-feature`) +1. Commit your changes (`git commit -am 'Add some feature'`) +1. Push to the branch (`git push origin my-new-feature`) +1. Create new Pull Request + + +[product_documentation]: https://azure.microsoft.com/services/ +[docs]: https://azure.github.io/azure-sdk-for-java/ +[jdk]: https://docs.microsoft.com/java/azure/jdk/ +[azure_subscription]: https://azure.microsoft.com/free/ +[azure_identity]: https://github.com/Azure/azure-sdk-for-java/blob/main/sdk/identity/azure-identity diff --git a/sdk/cognitiveservices/azure-cognitiveservices-multivariateanomalydetector/pom.xml b/sdk/cognitiveservices/azure-cognitiveservices-multivariateanomalydetector/pom.xml new file mode 100644 index 0000000000000..aaf8093c4a2f3 --- /dev/null +++ b/sdk/cognitiveservices/azure-cognitiveservices-multivariateanomalydetector/pom.xml @@ -0,0 +1,73 @@ + + 4.0.0 + + com.azure + azure-client-sdk-parent + 1.7.0 + ../../parents/azure-client-sdk-parent + + + com.azure + azure-cognitiveservices-multivariateanomalydetector + 1.0.0-beta.1 + jar + + Microsoft Azure SDK for AnomalyDetectorClient Management + This package contains Microsoft Azure AnomalyDetectorClient client library. + https://github.com/Azure/azure-sdk-for-java + + + + The MIT License (MIT) + http://opensource.org/licenses/MIT + repo + + + + + https://github.com/Azure/azure-sdk-for-java + scm:git:git@github.com:Azure/azure-sdk-for-java.git + scm:git:git@github.com:Azure/azure-sdk-for-java.git + HEAD + + + + microsoft + Microsoft + + + + UTF-8 + true + + + + com.azure + azure-core + 1.27.0 + + + com.azure + azure-core-http-netty + 1.11.9 + + + org.junit.jupiter + junit-jupiter-engine + 5.8.2 + test + + + com.azure + azure-core-test + 1.7.10 + test + + + com.azure + azure-identity + 1.5.0 + test + + + diff --git a/sdk/cognitiveservices/azure-cognitiveservices-multivariateanomalydetector/src/main/java/com/azure/cognitiveservices/multivariateanomalydetector/AnomalyDetectorAsyncClient.java b/sdk/cognitiveservices/azure-cognitiveservices-multivariateanomalydetector/src/main/java/com/azure/cognitiveservices/multivariateanomalydetector/AnomalyDetectorAsyncClient.java new file mode 100644 index 0000000000000..1710491a69d84 --- /dev/null +++ b/sdk/cognitiveservices/azure-cognitiveservices-multivariateanomalydetector/src/main/java/com/azure/cognitiveservices/multivariateanomalydetector/AnomalyDetectorAsyncClient.java @@ -0,0 +1,449 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.cognitiveservices.multivariateanomalydetector; + +import com.azure.cognitiveservices.multivariateanomalydetector.implementation.AnomalyDetectorClientImpl; +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceClient; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.exception.ClientAuthenticationException; +import com.azure.core.exception.HttpResponseException; +import com.azure.core.exception.ResourceModifiedException; +import com.azure.core.exception.ResourceNotFoundException; +import com.azure.core.http.rest.PagedFlux; +import com.azure.core.http.rest.RequestOptions; +import com.azure.core.http.rest.Response; +import com.azure.core.util.BinaryData; +import reactor.core.publisher.Mono; + +/** Initializes a new instance of the asynchronous AnomalyDetectorClient type. */ +@ServiceClient(builder = AnomalyDetectorClientBuilder.class, isAsync = true) +public final class AnomalyDetectorAsyncClient { + @Generated private final AnomalyDetectorClientImpl serviceClient; + + /** + * Initializes an instance of AnomalyDetectorAsyncClient class. + * + * @param serviceClient the service client implementation. + */ + @Generated + AnomalyDetectorAsyncClient(AnomalyDetectorClientImpl serviceClient) { + this.serviceClient = serviceClient; + } + + /** + * Create and train a multivariate anomaly detection model. The request must include a source parameter to indicate + * an externally accessible Azure storage Uri (preferably a Shared Access Signature Uri). All time-series used in + * generate the model must be zipped into one single file. Each time-series will be in a single CSV file in which + * the first column is timestamp and the second column is value. + * + *

Request Body Schema + * + *

{@code
+     * {
+     *     slidingWindow: Integer
+     *     alignPolicy: {
+     *         alignMode: String(Inner/Outer)
+     *         fillNAMethod: String(Previous/Subsequent/Linear/Zero/Fixed/NotFill)
+     *         paddingValue: Float
+     *     }
+     *     source: String
+     *     startTime: String
+     *     endTime: String
+     *     displayName: String
+     *     status: String(CREATED/RUNNING/READY/FAILED)
+     *     errors: [
+     *         {
+     *             code: String
+     *             message: String
+     *         }
+     *     ]
+     *     diagnosticsInfo: {
+     *         modelState: {
+     *             epochIds: [
+     *                 int
+     *             ]
+     *             trainLosses: [
+     *                 float
+     *             ]
+     *             validationLosses: [
+     *                 float
+     *             ]
+     *             latenciesInSeconds: [
+     *                 float
+     *             ]
+     *         }
+     *         variableStates: [
+     *             {
+     *                 variable: String
+     *                 filledNARatio: Float
+     *                 effectiveCount: Integer
+     *                 startTime: String
+     *                 endTime: String
+     *             }
+     *         ]
+     *     }
+     * }
+     * }
+ * + * @param body Training request. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> trainMultivariateModelWithResponse(BinaryData body, RequestOptions requestOptions) { + return this.serviceClient.trainMultivariateModelWithResponseAsync(body, requestOptions); + } + + /** + * List models of a subscription. + * + *

Query Parameters + * + * + * + * + * + * + *
Query Parameters
NameTypeRequiredDescription
$skipStringNo$skip indicates how many models will be skipped.
$topStringNo$top indicates how many models will be fetched.
+ * + *

Response Body Schema + * + *

{@code
+     * {
+     *     models: [
+     *         {
+     *             modelId: String
+     *             createdTime: String
+     *             lastUpdatedTime: String
+     *             status: String(CREATED/RUNNING/READY/FAILED)
+     *             displayName: String
+     *             variablesCount: int
+     *         }
+     *     ]
+     *     currentCount: int
+     *     maxCount: int
+     *     nextLink: String
+     * }
+     * }
+ * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return response of listing models as paginated response with {@link PagedFlux}. + */ + @Generated + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedFlux listMultivariateModel(RequestOptions requestOptions) { + return this.serviceClient.listMultivariateModelAsync(requestOptions); + } + + /** + * Get detailed information of multivariate model, including the training status and variables used in the model. + * + *

Response Body Schema + * + *

{@code
+     * {
+     *     modelId: String
+     *     createdTime: String
+     *     lastUpdatedTime: String
+     *     modelInfo: {
+     *         slidingWindow: Integer
+     *         alignPolicy: {
+     *             alignMode: String(Inner/Outer)
+     *             fillNAMethod: String(Previous/Subsequent/Linear/Zero/Fixed/NotFill)
+     *             paddingValue: Float
+     *         }
+     *         source: String
+     *         startTime: String
+     *         endTime: String
+     *         displayName: String
+     *         status: String(CREATED/RUNNING/READY/FAILED)
+     *         errors: [
+     *             {
+     *                 code: String
+     *                 message: String
+     *             }
+     *         ]
+     *         diagnosticsInfo: {
+     *             modelState: {
+     *                 epochIds: [
+     *                     int
+     *                 ]
+     *                 trainLosses: [
+     *                     float
+     *                 ]
+     *                 validationLosses: [
+     *                     float
+     *                 ]
+     *                 latenciesInSeconds: [
+     *                     float
+     *                 ]
+     *             }
+     *             variableStates: [
+     *                 {
+     *                     variable: String
+     *                     filledNARatio: Float
+     *                     effectiveCount: Integer
+     *                     startTime: String
+     *                     endTime: String
+     *                 }
+     *             ]
+     *         }
+     *     }
+     * }
+     * }
+ * + * @param modelId Model identifier. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return detailed information of multivariate model, including the training status and variables used in the model + * along with {@link Response} on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> getMultivariateModelWithResponse(String modelId, RequestOptions requestOptions) { + return this.serviceClient.getMultivariateModelWithResponseAsync(modelId, requestOptions); + } + + /** + * Delete an existing multivariate model according to the modelId. + * + * @param modelId Model identifier. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> deleteMultivariateModelWithResponse(String modelId, RequestOptions requestOptions) { + return this.serviceClient.deleteMultivariateModelWithResponseAsync(modelId, requestOptions); + } + + /** + * Submit detection multivariate anomaly task with the trained model of modelId, the input schema should be the same + * with the training request. Thus request will be complete asynchronously and will return a resultId for querying + * the detection result.The request should be a source link to indicate an externally accessible Azure storage Uri + * (preferably a Shared Access Signature Uri). All time-series used in generate the model must be zipped into one + * single file. Each time-series will be as follows: the first column is timestamp and the second column is value. + * + *

Request Body Schema + * + *

{@code
+     * {
+     *     source: String
+     *     startTime: String
+     *     endTime: String
+     * }
+     * }
+ * + * @param modelId Model identifier. + * @param body Detect anomaly request. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> detectAnomalyWithResponse( + String modelId, BinaryData body, RequestOptions requestOptions) { + return this.serviceClient.detectAnomalyWithResponseAsync(modelId, body, requestOptions); + } + + /** + * Get multivariate anomaly detection result based on resultId returned by the DetectAnomalyAsync api. + * + *

Response Body Schema + * + *

{@code
+     * {
+     *     resultId: String
+     *     summary: {
+     *         status: String(CREATED/RUNNING/READY/FAILED)
+     *         errors: [
+     *             {
+     *                 code: String
+     *                 message: String
+     *             }
+     *         ]
+     *         variableStates: [
+     *             {
+     *                 variable: String
+     *                 filledNARatio: Float
+     *                 effectiveCount: Integer
+     *                 startTime: String
+     *                 endTime: String
+     *             }
+     *         ]
+     *         setupInfo: {
+     *             source: String
+     *             startTime: String
+     *             endTime: String
+     *         }
+     *     }
+     *     results: [
+     *         {
+     *             timestamp: String
+     *             value: {
+     *                 isAnomaly: boolean
+     *                 severity: float
+     *                 score: float
+     *                 interpretation: [
+     *                     {
+     *                         variable: String
+     *                         contributionScore: Float
+     *                         correlationChanges: {
+     *                             changedVariables: [
+     *                                 String
+     *                             ]
+     *                             changedValues: [
+     *                                 float
+     *                             ]
+     *                         }
+     *                     }
+     *                 ]
+     *             }
+     *             errors: [
+     *                 (recursive schema, see above)
+     *             ]
+     *         }
+     *     ]
+     * }
+     * }
+ * + * @param resultId Result identifier. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return multivariate anomaly detection result based on resultId returned by the DetectAnomalyAsync api along with + * {@link Response} on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> getDetectionResultWithResponse(String resultId, RequestOptions requestOptions) { + return this.serviceClient.getDetectionResultWithResponseAsync(resultId, requestOptions); + } + + /** + * Export multivariate anomaly detection model based on modelId. + * + * @param modelId Model identifier. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> exportModelWithResponse(String modelId, RequestOptions requestOptions) { + return this.serviceClient.exportModelWithResponseAsync(modelId, requestOptions); + } + + /** + * Synchronized API for anomaly detection. + * + *

Request Body Schema + * + *

{@code
+     * {
+     *     variables: [
+     *         {
+     *             name: String
+     *             timestamps: [
+     *                 String
+     *             ]
+     *             values: [
+     *                 float
+     *             ]
+     *         }
+     *     ]
+     *     detectingPoints: int
+     * }
+     * }
+ * + *

Response Body Schema + * + *

{@code
+     * {
+     *     variableStates: [
+     *         {
+     *             variable: String
+     *             filledNARatio: Float
+     *             effectiveCount: Integer
+     *             startTime: String
+     *             endTime: String
+     *         }
+     *     ]
+     *     results: [
+     *         {
+     *             timestamp: String
+     *             value: {
+     *                 isAnomaly: boolean
+     *                 severity: float
+     *                 score: float
+     *                 interpretation: [
+     *                     {
+     *                         variable: String
+     *                         contributionScore: Float
+     *                         correlationChanges: {
+     *                             changedVariables: [
+     *                                 String
+     *                             ]
+     *                             changedValues: [
+     *                                 float
+     *                             ]
+     *                         }
+     *                     }
+     *                 ]
+     *             }
+     *             errors: [
+     *                 {
+     *                     code: String
+     *                     message: String
+     *                 }
+     *             ]
+     *         }
+     *     ]
+     * }
+     * }
+ * + * @param modelId Model identifier. + * @param body Request for last detection. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the response body along with {@link Response} on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> lastDetectAnomalyWithResponse( + String modelId, BinaryData body, RequestOptions requestOptions) { + return this.serviceClient.lastDetectAnomalyWithResponseAsync(modelId, body, requestOptions); + } +} diff --git a/sdk/cognitiveservices/azure-cognitiveservices-multivariateanomalydetector/src/main/java/com/azure/cognitiveservices/multivariateanomalydetector/AnomalyDetectorClient.java b/sdk/cognitiveservices/azure-cognitiveservices-multivariateanomalydetector/src/main/java/com/azure/cognitiveservices/multivariateanomalydetector/AnomalyDetectorClient.java new file mode 100644 index 0000000000000..f9163e7f61756 --- /dev/null +++ b/sdk/cognitiveservices/azure-cognitiveservices-multivariateanomalydetector/src/main/java/com/azure/cognitiveservices/multivariateanomalydetector/AnomalyDetectorClient.java @@ -0,0 +1,446 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.cognitiveservices.multivariateanomalydetector; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceClient; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.exception.ClientAuthenticationException; +import com.azure.core.exception.HttpResponseException; +import com.azure.core.exception.ResourceModifiedException; +import com.azure.core.exception.ResourceNotFoundException; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.RequestOptions; +import com.azure.core.http.rest.Response; +import com.azure.core.util.BinaryData; + +/** Initializes a new instance of the synchronous AnomalyDetectorClient type. */ +@ServiceClient(builder = AnomalyDetectorClientBuilder.class) +public final class AnomalyDetectorClient { + @Generated private final AnomalyDetectorAsyncClient asyncClient; + + /** + * Initializes an instance of AnomalyDetectorClient class. + * + * @param asyncClient the async client. + */ + @Generated + AnomalyDetectorClient(AnomalyDetectorAsyncClient asyncClient) { + this.asyncClient = asyncClient; + } + + /** + * Create and train a multivariate anomaly detection model. The request must include a source parameter to indicate + * an externally accessible Azure storage Uri (preferably a Shared Access Signature Uri). All time-series used in + * generate the model must be zipped into one single file. Each time-series will be in a single CSV file in which + * the first column is timestamp and the second column is value. + * + *

Request Body Schema + * + *

{@code
+     * {
+     *     slidingWindow: Integer
+     *     alignPolicy: {
+     *         alignMode: String(Inner/Outer)
+     *         fillNAMethod: String(Previous/Subsequent/Linear/Zero/Fixed/NotFill)
+     *         paddingValue: Float
+     *     }
+     *     source: String
+     *     startTime: String
+     *     endTime: String
+     *     displayName: String
+     *     status: String(CREATED/RUNNING/READY/FAILED)
+     *     errors: [
+     *         {
+     *             code: String
+     *             message: String
+     *         }
+     *     ]
+     *     diagnosticsInfo: {
+     *         modelState: {
+     *             epochIds: [
+     *                 int
+     *             ]
+     *             trainLosses: [
+     *                 float
+     *             ]
+     *             validationLosses: [
+     *                 float
+     *             ]
+     *             latenciesInSeconds: [
+     *                 float
+     *             ]
+     *         }
+     *         variableStates: [
+     *             {
+     *                 variable: String
+     *                 filledNARatio: Float
+     *                 effectiveCount: Integer
+     *                 startTime: String
+     *                 endTime: String
+     *             }
+     *         ]
+     *     }
+     * }
+     * }
+ * + * @param body Training request. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response trainMultivariateModelWithResponse(BinaryData body, RequestOptions requestOptions) { + return this.asyncClient.trainMultivariateModelWithResponse(body, requestOptions).block(); + } + + /** + * List models of a subscription. + * + *

Query Parameters + * + * + * + * + * + * + *
Query Parameters
NameTypeRequiredDescription
$skipStringNo$skip indicates how many models will be skipped.
$topStringNo$top indicates how many models will be fetched.
+ * + *

Response Body Schema + * + *

{@code
+     * {
+     *     models: [
+     *         {
+     *             modelId: String
+     *             createdTime: String
+     *             lastUpdatedTime: String
+     *             status: String(CREATED/RUNNING/READY/FAILED)
+     *             displayName: String
+     *             variablesCount: int
+     *         }
+     *     ]
+     *     currentCount: int
+     *     maxCount: int
+     *     nextLink: String
+     * }
+     * }
+ * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return response of listing models as paginated response with {@link PagedIterable}. + */ + @Generated + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listMultivariateModel(RequestOptions requestOptions) { + return new PagedIterable<>(this.asyncClient.listMultivariateModel(requestOptions)); + } + + /** + * Get detailed information of multivariate model, including the training status and variables used in the model. + * + *

Response Body Schema + * + *

{@code
+     * {
+     *     modelId: String
+     *     createdTime: String
+     *     lastUpdatedTime: String
+     *     modelInfo: {
+     *         slidingWindow: Integer
+     *         alignPolicy: {
+     *             alignMode: String(Inner/Outer)
+     *             fillNAMethod: String(Previous/Subsequent/Linear/Zero/Fixed/NotFill)
+     *             paddingValue: Float
+     *         }
+     *         source: String
+     *         startTime: String
+     *         endTime: String
+     *         displayName: String
+     *         status: String(CREATED/RUNNING/READY/FAILED)
+     *         errors: [
+     *             {
+     *                 code: String
+     *                 message: String
+     *             }
+     *         ]
+     *         diagnosticsInfo: {
+     *             modelState: {
+     *                 epochIds: [
+     *                     int
+     *                 ]
+     *                 trainLosses: [
+     *                     float
+     *                 ]
+     *                 validationLosses: [
+     *                     float
+     *                 ]
+     *                 latenciesInSeconds: [
+     *                     float
+     *                 ]
+     *             }
+     *             variableStates: [
+     *                 {
+     *                     variable: String
+     *                     filledNARatio: Float
+     *                     effectiveCount: Integer
+     *                     startTime: String
+     *                     endTime: String
+     *                 }
+     *             ]
+     *         }
+     *     }
+     * }
+     * }
+ * + * @param modelId Model identifier. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return detailed information of multivariate model, including the training status and variables used in the model + * along with {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getMultivariateModelWithResponse(String modelId, RequestOptions requestOptions) { + return this.asyncClient.getMultivariateModelWithResponse(modelId, requestOptions).block(); + } + + /** + * Delete an existing multivariate model according to the modelId. + * + * @param modelId Model identifier. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response deleteMultivariateModelWithResponse(String modelId, RequestOptions requestOptions) { + return this.asyncClient.deleteMultivariateModelWithResponse(modelId, requestOptions).block(); + } + + /** + * Submit detection multivariate anomaly task with the trained model of modelId, the input schema should be the same + * with the training request. Thus request will be complete asynchronously and will return a resultId for querying + * the detection result.The request should be a source link to indicate an externally accessible Azure storage Uri + * (preferably a Shared Access Signature Uri). All time-series used in generate the model must be zipped into one + * single file. Each time-series will be as follows: the first column is timestamp and the second column is value. + * + *

Request Body Schema + * + *

{@code
+     * {
+     *     source: String
+     *     startTime: String
+     *     endTime: String
+     * }
+     * }
+ * + * @param modelId Model identifier. + * @param body Detect anomaly request. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response detectAnomalyWithResponse(String modelId, BinaryData body, RequestOptions requestOptions) { + return this.asyncClient.detectAnomalyWithResponse(modelId, body, requestOptions).block(); + } + + /** + * Get multivariate anomaly detection result based on resultId returned by the DetectAnomalyAsync api. + * + *

Response Body Schema + * + *

{@code
+     * {
+     *     resultId: String
+     *     summary: {
+     *         status: String(CREATED/RUNNING/READY/FAILED)
+     *         errors: [
+     *             {
+     *                 code: String
+     *                 message: String
+     *             }
+     *         ]
+     *         variableStates: [
+     *             {
+     *                 variable: String
+     *                 filledNARatio: Float
+     *                 effectiveCount: Integer
+     *                 startTime: String
+     *                 endTime: String
+     *             }
+     *         ]
+     *         setupInfo: {
+     *             source: String
+     *             startTime: String
+     *             endTime: String
+     *         }
+     *     }
+     *     results: [
+     *         {
+     *             timestamp: String
+     *             value: {
+     *                 isAnomaly: boolean
+     *                 severity: float
+     *                 score: float
+     *                 interpretation: [
+     *                     {
+     *                         variable: String
+     *                         contributionScore: Float
+     *                         correlationChanges: {
+     *                             changedVariables: [
+     *                                 String
+     *                             ]
+     *                             changedValues: [
+     *                                 float
+     *                             ]
+     *                         }
+     *                     }
+     *                 ]
+     *             }
+     *             errors: [
+     *                 (recursive schema, see above)
+     *             ]
+     *         }
+     *     ]
+     * }
+     * }
+ * + * @param resultId Result identifier. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return multivariate anomaly detection result based on resultId returned by the DetectAnomalyAsync api along with + * {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getDetectionResultWithResponse(String resultId, RequestOptions requestOptions) { + return this.asyncClient.getDetectionResultWithResponse(resultId, requestOptions).block(); + } + + /** + * Export multivariate anomaly detection model based on modelId. + * + * @param modelId Model identifier. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response exportModelWithResponse(String modelId, RequestOptions requestOptions) { + return this.asyncClient.exportModelWithResponse(modelId, requestOptions).block(); + } + + /** + * Synchronized API for anomaly detection. + * + *

Request Body Schema + * + *

{@code
+     * {
+     *     variables: [
+     *         {
+     *             name: String
+     *             timestamps: [
+     *                 String
+     *             ]
+     *             values: [
+     *                 float
+     *             ]
+     *         }
+     *     ]
+     *     detectingPoints: int
+     * }
+     * }
+ * + *

Response Body Schema + * + *

{@code
+     * {
+     *     variableStates: [
+     *         {
+     *             variable: String
+     *             filledNARatio: Float
+     *             effectiveCount: Integer
+     *             startTime: String
+     *             endTime: String
+     *         }
+     *     ]
+     *     results: [
+     *         {
+     *             timestamp: String
+     *             value: {
+     *                 isAnomaly: boolean
+     *                 severity: float
+     *                 score: float
+     *                 interpretation: [
+     *                     {
+     *                         variable: String
+     *                         contributionScore: Float
+     *                         correlationChanges: {
+     *                             changedVariables: [
+     *                                 String
+     *                             ]
+     *                             changedValues: [
+     *                                 float
+     *                             ]
+     *                         }
+     *                     }
+     *                 ]
+     *             }
+     *             errors: [
+     *                 {
+     *                     code: String
+     *                     message: String
+     *                 }
+     *             ]
+     *         }
+     *     ]
+     * }
+     * }
+ * + * @param modelId Model identifier. + * @param body Request for last detection. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the response body along with {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response lastDetectAnomalyWithResponse( + String modelId, BinaryData body, RequestOptions requestOptions) { + return this.asyncClient.lastDetectAnomalyWithResponse(modelId, body, requestOptions).block(); + } +} diff --git a/sdk/cognitiveservices/azure-cognitiveservices-multivariateanomalydetector/src/main/java/com/azure/cognitiveservices/multivariateanomalydetector/AnomalyDetectorClientBuilder.java b/sdk/cognitiveservices/azure-cognitiveservices-multivariateanomalydetector/src/main/java/com/azure/cognitiveservices/multivariateanomalydetector/AnomalyDetectorClientBuilder.java new file mode 100644 index 0000000000000..6cfbd795fc38d --- /dev/null +++ b/sdk/cognitiveservices/azure-cognitiveservices-multivariateanomalydetector/src/main/java/com/azure/cognitiveservices/multivariateanomalydetector/AnomalyDetectorClientBuilder.java @@ -0,0 +1,287 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.cognitiveservices.multivariateanomalydetector; + +import com.azure.cognitiveservices.multivariateanomalydetector.implementation.AnomalyDetectorClientImpl; +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.ServiceClientBuilder; +import com.azure.core.http.HttpClient; +import com.azure.core.http.HttpHeaders; +import com.azure.core.http.HttpPipeline; +import com.azure.core.http.HttpPipelineBuilder; +import com.azure.core.http.HttpPipelinePosition; +import com.azure.core.http.policy.AddHeadersPolicy; +import com.azure.core.http.policy.CookiePolicy; +import com.azure.core.http.policy.HttpLogOptions; +import com.azure.core.http.policy.HttpLoggingPolicy; +import com.azure.core.http.policy.HttpPipelinePolicy; +import com.azure.core.http.policy.HttpPolicyProviders; +import com.azure.core.http.policy.RetryPolicy; +import com.azure.core.http.policy.UserAgentPolicy; +import com.azure.core.util.ClientOptions; +import com.azure.core.util.Configuration; +import com.azure.core.util.CoreUtils; +import com.azure.core.util.serializer.JacksonAdapter; +import java.util.ArrayList; +import java.util.List; +import java.util.Map; +import java.util.stream.Collectors; + +/** A builder for creating a new instance of the AnomalyDetectorClient type. */ +@ServiceClientBuilder(serviceClients = {AnomalyDetectorClient.class, AnomalyDetectorAsyncClient.class}) +public final class AnomalyDetectorClientBuilder { + @Generated private static final String SDK_NAME = "name"; + + @Generated private static final String SDK_VERSION = "version"; + + @Generated + private final Map properties = + CoreUtils.getProperties("azure-cognitiveservices-multivariateanomalydetector.properties"); + + /** Create an instance of the AnomalyDetectorClientBuilder. */ + @Generated + public AnomalyDetectorClientBuilder() { + this.pipelinePolicies = new ArrayList<>(); + } + + /* + * Supported Cognitive Services endpoints (protocol and hostname, for + * example: https://westus2.api.cognitive.microsoft.com). + */ + @Generated private String endpoint; + + /** + * Sets Supported Cognitive Services endpoints (protocol and hostname, for example: + * https://westus2.api.cognitive.microsoft.com). + * + * @param endpoint the endpoint value. + * @return the AnomalyDetectorClientBuilder. + */ + @Generated + public AnomalyDetectorClientBuilder endpoint(String endpoint) { + this.endpoint = endpoint; + return this; + } + + /* + * Service version + */ + @Generated private AnomalyDetectorServiceVersion serviceVersion; + + /** + * Sets Service version. + * + * @param serviceVersion the serviceVersion value. + * @return the AnomalyDetectorClientBuilder. + */ + @Generated + public AnomalyDetectorClientBuilder serviceVersion(AnomalyDetectorServiceVersion serviceVersion) { + this.serviceVersion = serviceVersion; + return this; + } + + /* + * The HTTP pipeline to send requests through + */ + @Generated private HttpPipeline pipeline; + + /** + * Sets The HTTP pipeline to send requests through. + * + * @param pipeline the pipeline value. + * @return the AnomalyDetectorClientBuilder. + */ + @Generated + public AnomalyDetectorClientBuilder pipeline(HttpPipeline pipeline) { + this.pipeline = pipeline; + return this; + } + + /* + * The HTTP client used to send the request. + */ + @Generated private HttpClient httpClient; + + /** + * Sets The HTTP client used to send the request. + * + * @param httpClient the httpClient value. + * @return the AnomalyDetectorClientBuilder. + */ + @Generated + public AnomalyDetectorClientBuilder httpClient(HttpClient httpClient) { + this.httpClient = httpClient; + return this; + } + + /* + * The configuration store that is used during construction of the service + * client. + */ + @Generated private Configuration configuration; + + /** + * Sets The configuration store that is used during construction of the service client. + * + * @param configuration the configuration value. + * @return the AnomalyDetectorClientBuilder. + */ + @Generated + public AnomalyDetectorClientBuilder configuration(Configuration configuration) { + this.configuration = configuration; + return this; + } + + /* + * The logging configuration for HTTP requests and responses. + */ + @Generated private HttpLogOptions httpLogOptions; + + /** + * Sets The logging configuration for HTTP requests and responses. + * + * @param httpLogOptions the httpLogOptions value. + * @return the AnomalyDetectorClientBuilder. + */ + @Generated + public AnomalyDetectorClientBuilder httpLogOptions(HttpLogOptions httpLogOptions) { + this.httpLogOptions = httpLogOptions; + return this; + } + + /* + * The retry policy that will attempt to retry failed requests, if + * applicable. + */ + @Generated private RetryPolicy retryPolicy; + + /** + * Sets The retry policy that will attempt to retry failed requests, if applicable. + * + * @param retryPolicy the retryPolicy value. + * @return the AnomalyDetectorClientBuilder. + */ + @Generated + public AnomalyDetectorClientBuilder retryPolicy(RetryPolicy retryPolicy) { + this.retryPolicy = retryPolicy; + return this; + } + + /* + * The list of Http pipeline policies to add. + */ + @Generated private final List pipelinePolicies; + + /* + * The client options such as application ID and custom headers to set on a + * request. + */ + @Generated private ClientOptions clientOptions; + + /** + * Sets The client options such as application ID and custom headers to set on a request. + * + * @param clientOptions the clientOptions value. + * @return the AnomalyDetectorClientBuilder. + */ + @Generated + public AnomalyDetectorClientBuilder clientOptions(ClientOptions clientOptions) { + this.clientOptions = clientOptions; + return this; + } + + /** + * Adds a custom Http pipeline policy. + * + * @param customPolicy The custom Http pipeline policy to add. + * @return the AnomalyDetectorClientBuilder. + */ + @Generated + public AnomalyDetectorClientBuilder addPolicy(HttpPipelinePolicy customPolicy) { + pipelinePolicies.add(customPolicy); + return this; + } + + /** + * Builds an instance of AnomalyDetectorClientImpl with the provided parameters. + * + * @return an instance of AnomalyDetectorClientImpl. + */ + @Generated + private AnomalyDetectorClientImpl buildInnerClient() { + if (serviceVersion == null) { + this.serviceVersion = AnomalyDetectorServiceVersion.getLatest(); + } + if (pipeline == null) { + this.pipeline = createHttpPipeline(); + } + AnomalyDetectorClientImpl client = + new AnomalyDetectorClientImpl( + pipeline, JacksonAdapter.createDefaultSerializerAdapter(), endpoint, serviceVersion); + return client; + } + + @Generated + private HttpPipeline createHttpPipeline() { + Configuration buildConfiguration = + (configuration == null) ? Configuration.getGlobalConfiguration() : configuration; + if (httpLogOptions == null) { + httpLogOptions = new HttpLogOptions(); + } + if (clientOptions == null) { + clientOptions = new ClientOptions(); + } + List policies = new ArrayList<>(); + String clientName = properties.getOrDefault(SDK_NAME, "UnknownName"); + String clientVersion = properties.getOrDefault(SDK_VERSION, "UnknownVersion"); + String applicationId = CoreUtils.getApplicationId(clientOptions, httpLogOptions); + policies.add(new UserAgentPolicy(applicationId, clientName, clientVersion, buildConfiguration)); + HttpHeaders headers = new HttpHeaders(); + clientOptions.getHeaders().forEach(header -> headers.set(header.getName(), header.getValue())); + if (headers.getSize() > 0) { + policies.add(new AddHeadersPolicy(headers)); + } + policies.addAll( + this.pipelinePolicies.stream() + .filter(p -> p.getPipelinePosition() == HttpPipelinePosition.PER_CALL) + .collect(Collectors.toList())); + HttpPolicyProviders.addBeforeRetryPolicies(policies); + policies.add(retryPolicy == null ? new RetryPolicy() : retryPolicy); + policies.add(new CookiePolicy()); + policies.addAll( + this.pipelinePolicies.stream() + .filter(p -> p.getPipelinePosition() == HttpPipelinePosition.PER_RETRY) + .collect(Collectors.toList())); + HttpPolicyProviders.addAfterRetryPolicies(policies); + policies.add(new HttpLoggingPolicy(httpLogOptions)); + HttpPipeline httpPipeline = + new HttpPipelineBuilder() + .policies(policies.toArray(new HttpPipelinePolicy[0])) + .httpClient(httpClient) + .clientOptions(clientOptions) + .build(); + return httpPipeline; + } + + /** + * Builds an instance of AnomalyDetectorAsyncClient class. + * + * @return an instance of AnomalyDetectorAsyncClient. + */ + @Generated + public AnomalyDetectorAsyncClient buildAsyncClient() { + return new AnomalyDetectorAsyncClient(buildInnerClient()); + } + + /** + * Builds an instance of AnomalyDetectorClient class. + * + * @return an instance of AnomalyDetectorClient. + */ + @Generated + public AnomalyDetectorClient buildClient() { + return new AnomalyDetectorClient(new AnomalyDetectorAsyncClient(buildInnerClient())); + } +} diff --git a/sdk/cognitiveservices/azure-cognitiveservices-multivariateanomalydetector/src/main/java/com/azure/cognitiveservices/multivariateanomalydetector/AnomalyDetectorServiceVersion.java b/sdk/cognitiveservices/azure-cognitiveservices-multivariateanomalydetector/src/main/java/com/azure/cognitiveservices/multivariateanomalydetector/AnomalyDetectorServiceVersion.java new file mode 100644 index 0000000000000..22291ea55fef7 --- /dev/null +++ b/sdk/cognitiveservices/azure-cognitiveservices-multivariateanomalydetector/src/main/java/com/azure/cognitiveservices/multivariateanomalydetector/AnomalyDetectorServiceVersion.java @@ -0,0 +1,33 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.cognitiveservices.multivariateanomalydetector; + +import com.azure.core.util.ServiceVersion; + +/** Service version of AnomalyDetectorClient. */ +public enum AnomalyDetectorServiceVersion implements ServiceVersion { + /** Enum value 1.1-preview.2. */ + V1_1_PREVIEW_2("1.1-preview.2"); + + private final String version; + + AnomalyDetectorServiceVersion(String version) { + this.version = version; + } + + @Override + public String getVersion() { + return this.version; + } + + /** + * Gets the latest service version supported by this client library. + * + * @return The latest {@link AnomalyDetectorServiceVersion}. + */ + public static AnomalyDetectorServiceVersion getLatest() { + return V1_1_PREVIEW_2; + } +} diff --git a/sdk/cognitiveservices/azure-cognitiveservices-multivariateanomalydetector/src/main/java/com/azure/cognitiveservices/multivariateanomalydetector/implementation/AnomalyDetectorClientImpl.java b/sdk/cognitiveservices/azure-cognitiveservices-multivariateanomalydetector/src/main/java/com/azure/cognitiveservices/multivariateanomalydetector/implementation/AnomalyDetectorClientImpl.java new file mode 100644 index 0000000000000..e48a9be332610 --- /dev/null +++ b/sdk/cognitiveservices/azure-cognitiveservices-multivariateanomalydetector/src/main/java/com/azure/cognitiveservices/multivariateanomalydetector/implementation/AnomalyDetectorClientImpl.java @@ -0,0 +1,1862 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.cognitiveservices.multivariateanomalydetector.implementation; + +import com.azure.cognitiveservices.multivariateanomalydetector.AnomalyDetectorServiceVersion; +import com.azure.core.annotation.BodyParam; +import com.azure.core.annotation.Delete; +import com.azure.core.annotation.ExpectedResponses; +import com.azure.core.annotation.Get; +import com.azure.core.annotation.Host; +import com.azure.core.annotation.HostParam; +import com.azure.core.annotation.PathParam; +import com.azure.core.annotation.Post; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceInterface; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.annotation.UnexpectedResponseExceptionType; +import com.azure.core.exception.ClientAuthenticationException; +import com.azure.core.exception.HttpResponseException; +import com.azure.core.exception.ResourceModifiedException; +import com.azure.core.exception.ResourceNotFoundException; +import com.azure.core.http.HttpPipeline; +import com.azure.core.http.HttpPipelineBuilder; +import com.azure.core.http.policy.CookiePolicy; +import com.azure.core.http.policy.RetryPolicy; +import com.azure.core.http.policy.UserAgentPolicy; +import com.azure.core.http.rest.PagedFlux; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.PagedResponse; +import com.azure.core.http.rest.PagedResponseBase; +import com.azure.core.http.rest.RequestOptions; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.RestProxy; +import com.azure.core.util.BinaryData; +import com.azure.core.util.Context; +import com.azure.core.util.FluxUtil; +import com.azure.core.util.serializer.JacksonAdapter; +import com.azure.core.util.serializer.SerializerAdapter; +import java.util.List; +import java.util.Map; +import java.util.stream.Collectors; +import reactor.core.publisher.Mono; + +/** Initializes a new instance of the AnomalyDetectorClient type. */ +public final class AnomalyDetectorClientImpl { + /** The proxy service used to perform REST calls. */ + private final AnomalyDetectorClientService service; + + /** + * Supported Cognitive Services endpoints (protocol and hostname, for example: + * https://westus2.api.cognitive.microsoft.com). + */ + private final String endpoint; + + /** + * Gets Supported Cognitive Services endpoints (protocol and hostname, for example: + * https://westus2.api.cognitive.microsoft.com). + * + * @return the endpoint value. + */ + public String getEndpoint() { + return this.endpoint; + } + + /** Service version. */ + private final AnomalyDetectorServiceVersion serviceVersion; + + /** + * Gets Service version. + * + * @return the serviceVersion value. + */ + public AnomalyDetectorServiceVersion getServiceVersion() { + return this.serviceVersion; + } + + /** The HTTP pipeline to send requests through. */ + private final HttpPipeline httpPipeline; + + /** + * Gets The HTTP pipeline to send requests through. + * + * @return the httpPipeline value. + */ + public HttpPipeline getHttpPipeline() { + return this.httpPipeline; + } + + /** The serializer to serialize an object into a string. */ + private final SerializerAdapter serializerAdapter; + + /** + * Gets The serializer to serialize an object into a string. + * + * @return the serializerAdapter value. + */ + public SerializerAdapter getSerializerAdapter() { + return this.serializerAdapter; + } + + /** + * Initializes an instance of AnomalyDetectorClient client. + * + * @param endpoint Supported Cognitive Services endpoints (protocol and hostname, for example: + * https://westus2.api.cognitive.microsoft.com). + * @param serviceVersion Service version. + */ + public AnomalyDetectorClientImpl(String endpoint, AnomalyDetectorServiceVersion serviceVersion) { + this( + new HttpPipelineBuilder() + .policies(new UserAgentPolicy(), new RetryPolicy(), new CookiePolicy()) + .build(), + JacksonAdapter.createDefaultSerializerAdapter(), + endpoint, + serviceVersion); + } + + /** + * Initializes an instance of AnomalyDetectorClient client. + * + * @param httpPipeline The HTTP pipeline to send requests through. + * @param endpoint Supported Cognitive Services endpoints (protocol and hostname, for example: + * https://westus2.api.cognitive.microsoft.com). + * @param serviceVersion Service version. + */ + public AnomalyDetectorClientImpl( + HttpPipeline httpPipeline, String endpoint, AnomalyDetectorServiceVersion serviceVersion) { + this(httpPipeline, JacksonAdapter.createDefaultSerializerAdapter(), endpoint, serviceVersion); + } + + /** + * Initializes an instance of AnomalyDetectorClient client. + * + * @param httpPipeline The HTTP pipeline to send requests through. + * @param serializerAdapter The serializer to serialize an object into a string. + * @param endpoint Supported Cognitive Services endpoints (protocol and hostname, for example: + * https://westus2.api.cognitive.microsoft.com). + * @param serviceVersion Service version. + */ + public AnomalyDetectorClientImpl( + HttpPipeline httpPipeline, + SerializerAdapter serializerAdapter, + String endpoint, + AnomalyDetectorServiceVersion serviceVersion) { + this.httpPipeline = httpPipeline; + this.serializerAdapter = serializerAdapter; + this.endpoint = endpoint; + this.serviceVersion = serviceVersion; + this.service = + RestProxy.create(AnomalyDetectorClientService.class, this.httpPipeline, this.getSerializerAdapter()); + } + + /** + * The interface defining all the services for AnomalyDetectorClient to be used by the proxy service to perform REST + * calls. + */ + @Host("{Endpoint}/anomalydetector/{ApiVersion}") + @ServiceInterface(name = "AnomalyDetectorClien") + private interface AnomalyDetectorClientService { + @Post("/multivariate/models") + @ExpectedResponses({201}) + @UnexpectedResponseExceptionType( + value = ClientAuthenticationException.class, + code = {401}) + @UnexpectedResponseExceptionType( + value = ResourceNotFoundException.class, + code = {404}) + @UnexpectedResponseExceptionType( + value = ResourceModifiedException.class, + code = {409}) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> trainMultivariateModel( + @HostParam("Endpoint") String endpoint, + @HostParam("ApiVersion") String apiVersion, + @BodyParam("application/json") BinaryData body, + RequestOptions requestOptions, + Context context); + + @Get("/multivariate/models") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType( + value = ClientAuthenticationException.class, + code = {401}) + @UnexpectedResponseExceptionType( + value = ResourceNotFoundException.class, + code = {404}) + @UnexpectedResponseExceptionType( + value = ResourceModifiedException.class, + code = {409}) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> listMultivariateModel( + @HostParam("Endpoint") String endpoint, + @HostParam("ApiVersion") String apiVersion, + RequestOptions requestOptions, + Context context); + + @Get("/multivariate/models/{modelId}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType( + value = ClientAuthenticationException.class, + code = {401}) + @UnexpectedResponseExceptionType( + value = ResourceNotFoundException.class, + code = {404}) + @UnexpectedResponseExceptionType( + value = ResourceModifiedException.class, + code = {409}) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> getMultivariateModel( + @HostParam("Endpoint") String endpoint, + @HostParam("ApiVersion") String apiVersion, + @PathParam("modelId") String modelId, + RequestOptions requestOptions, + Context context); + + @Delete("/multivariate/models/{modelId}") + @ExpectedResponses({204}) + @UnexpectedResponseExceptionType( + value = ClientAuthenticationException.class, + code = {401}) + @UnexpectedResponseExceptionType( + value = ResourceNotFoundException.class, + code = {404}) + @UnexpectedResponseExceptionType( + value = ResourceModifiedException.class, + code = {409}) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> deleteMultivariateModel( + @HostParam("Endpoint") String endpoint, + @HostParam("ApiVersion") String apiVersion, + @PathParam("modelId") String modelId, + RequestOptions requestOptions, + Context context); + + @Post("/multivariate/models/{modelId}/detect") + @ExpectedResponses({201}) + @UnexpectedResponseExceptionType( + value = ClientAuthenticationException.class, + code = {401}) + @UnexpectedResponseExceptionType( + value = ResourceNotFoundException.class, + code = {404}) + @UnexpectedResponseExceptionType( + value = ResourceModifiedException.class, + code = {409}) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> detectAnomaly( + @HostParam("Endpoint") String endpoint, + @HostParam("ApiVersion") String apiVersion, + @PathParam("modelId") String modelId, + @BodyParam("application/json") BinaryData body, + RequestOptions requestOptions, + Context context); + + @Get("/multivariate/results/{resultId}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType( + value = ClientAuthenticationException.class, + code = {401}) + @UnexpectedResponseExceptionType( + value = ResourceNotFoundException.class, + code = {404}) + @UnexpectedResponseExceptionType( + value = ResourceModifiedException.class, + code = {409}) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> getDetectionResult( + @HostParam("Endpoint") String endpoint, + @HostParam("ApiVersion") String apiVersion, + @PathParam("resultId") String resultId, + RequestOptions requestOptions, + Context context); + + @Get("/multivariate/models/{modelId}/export") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType( + value = ClientAuthenticationException.class, + code = {401}) + @UnexpectedResponseExceptionType( + value = ResourceNotFoundException.class, + code = {404}) + @UnexpectedResponseExceptionType( + value = ResourceModifiedException.class, + code = {409}) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> exportModel( + @HostParam("Endpoint") String endpoint, + @HostParam("ApiVersion") String apiVersion, + @PathParam("modelId") String modelId, + RequestOptions requestOptions, + Context context); + + @Post("/multivariate/models/{modelId}/last/detect") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType( + value = ClientAuthenticationException.class, + code = {401}) + @UnexpectedResponseExceptionType( + value = ResourceNotFoundException.class, + code = {404}) + @UnexpectedResponseExceptionType( + value = ResourceModifiedException.class, + code = {409}) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> lastDetectAnomaly( + @HostParam("Endpoint") String endpoint, + @HostParam("ApiVersion") String apiVersion, + @PathParam("modelId") String modelId, + @BodyParam("application/json") BinaryData body, + RequestOptions requestOptions, + Context context); + + @Get("{nextLink}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType( + value = ClientAuthenticationException.class, + code = {401}) + @UnexpectedResponseExceptionType( + value = ResourceNotFoundException.class, + code = {404}) + @UnexpectedResponseExceptionType( + value = ResourceModifiedException.class, + code = {409}) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> listMultivariateModelNext( + @PathParam(value = "nextLink", encoded = true) String nextLink, + @HostParam("Endpoint") String endpoint, + @HostParam("ApiVersion") String apiVersion, + RequestOptions requestOptions, + Context context); + } + + /** + * Create and train a multivariate anomaly detection model. The request must include a source parameter to indicate + * an externally accessible Azure storage Uri (preferably a Shared Access Signature Uri). All time-series used in + * generate the model must be zipped into one single file. Each time-series will be in a single CSV file in which + * the first column is timestamp and the second column is value. + * + *

Request Body Schema + * + *

{@code
+     * {
+     *     slidingWindow: Integer
+     *     alignPolicy: {
+     *         alignMode: String(Inner/Outer)
+     *         fillNAMethod: String(Previous/Subsequent/Linear/Zero/Fixed/NotFill)
+     *         paddingValue: Float
+     *     }
+     *     source: String
+     *     startTime: String
+     *     endTime: String
+     *     displayName: String
+     *     status: String(CREATED/RUNNING/READY/FAILED)
+     *     errors: [
+     *         {
+     *             code: String
+     *             message: String
+     *         }
+     *     ]
+     *     diagnosticsInfo: {
+     *         modelState: {
+     *             epochIds: [
+     *                 int
+     *             ]
+     *             trainLosses: [
+     *                 float
+     *             ]
+     *             validationLosses: [
+     *                 float
+     *             ]
+     *             latenciesInSeconds: [
+     *                 float
+     *             ]
+     *         }
+     *         variableStates: [
+     *             {
+     *                 variable: String
+     *                 filledNARatio: Float
+     *                 effectiveCount: Integer
+     *                 startTime: String
+     *                 endTime: String
+     *             }
+     *         ]
+     *     }
+     * }
+     * }
+ * + * @param body Training request. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> trainMultivariateModelWithResponseAsync( + BinaryData body, RequestOptions requestOptions) { + return FluxUtil.withContext( + context -> + service.trainMultivariateModel( + this.getEndpoint(), + this.getServiceVersion().getVersion(), + body, + requestOptions, + context)); + } + + /** + * Create and train a multivariate anomaly detection model. The request must include a source parameter to indicate + * an externally accessible Azure storage Uri (preferably a Shared Access Signature Uri). All time-series used in + * generate the model must be zipped into one single file. Each time-series will be in a single CSV file in which + * the first column is timestamp and the second column is value. + * + *

Request Body Schema + * + *

{@code
+     * {
+     *     slidingWindow: Integer
+     *     alignPolicy: {
+     *         alignMode: String(Inner/Outer)
+     *         fillNAMethod: String(Previous/Subsequent/Linear/Zero/Fixed/NotFill)
+     *         paddingValue: Float
+     *     }
+     *     source: String
+     *     startTime: String
+     *     endTime: String
+     *     displayName: String
+     *     status: String(CREATED/RUNNING/READY/FAILED)
+     *     errors: [
+     *         {
+     *             code: String
+     *             message: String
+     *         }
+     *     ]
+     *     diagnosticsInfo: {
+     *         modelState: {
+     *             epochIds: [
+     *                 int
+     *             ]
+     *             trainLosses: [
+     *                 float
+     *             ]
+     *             validationLosses: [
+     *                 float
+     *             ]
+     *             latenciesInSeconds: [
+     *                 float
+     *             ]
+     *         }
+     *         variableStates: [
+     *             {
+     *                 variable: String
+     *                 filledNARatio: Float
+     *                 effectiveCount: Integer
+     *                 startTime: String
+     *                 endTime: String
+     *             }
+     *         ]
+     *     }
+     * }
+     * }
+ * + * @param body Training request. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @param context The context to associate with this operation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> trainMultivariateModelWithResponseAsync( + BinaryData body, RequestOptions requestOptions, Context context) { + return service.trainMultivariateModel( + this.getEndpoint(), this.getServiceVersion().getVersion(), body, requestOptions, context); + } + + /** + * Create and train a multivariate anomaly detection model. The request must include a source parameter to indicate + * an externally accessible Azure storage Uri (preferably a Shared Access Signature Uri). All time-series used in + * generate the model must be zipped into one single file. Each time-series will be in a single CSV file in which + * the first column is timestamp and the second column is value. + * + *

Request Body Schema + * + *

{@code
+     * {
+     *     slidingWindow: Integer
+     *     alignPolicy: {
+     *         alignMode: String(Inner/Outer)
+     *         fillNAMethod: String(Previous/Subsequent/Linear/Zero/Fixed/NotFill)
+     *         paddingValue: Float
+     *     }
+     *     source: String
+     *     startTime: String
+     *     endTime: String
+     *     displayName: String
+     *     status: String(CREATED/RUNNING/READY/FAILED)
+     *     errors: [
+     *         {
+     *             code: String
+     *             message: String
+     *         }
+     *     ]
+     *     diagnosticsInfo: {
+     *         modelState: {
+     *             epochIds: [
+     *                 int
+     *             ]
+     *             trainLosses: [
+     *                 float
+     *             ]
+     *             validationLosses: [
+     *                 float
+     *             ]
+     *             latenciesInSeconds: [
+     *                 float
+     *             ]
+     *         }
+     *         variableStates: [
+     *             {
+     *                 variable: String
+     *                 filledNARatio: Float
+     *                 effectiveCount: Integer
+     *                 startTime: String
+     *                 endTime: String
+     *             }
+     *         ]
+     *     }
+     * }
+     * }
+ * + * @param body Training request. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response trainMultivariateModelWithResponse(BinaryData body, RequestOptions requestOptions) { + return trainMultivariateModelWithResponseAsync(body, requestOptions).block(); + } + + /** + * List models of a subscription. + * + *

Query Parameters + * + * + * + * + * + * + *
Query Parameters
NameTypeRequiredDescription
$skipStringNo$skip indicates how many models will be skipped.
$topStringNo$top indicates how many models will be fetched.
+ * + *

Response Body Schema + * + *

{@code
+     * {
+     *     models: [
+     *         {
+     *             modelId: String
+     *             createdTime: String
+     *             lastUpdatedTime: String
+     *             status: String(CREATED/RUNNING/READY/FAILED)
+     *             displayName: String
+     *             variablesCount: int
+     *         }
+     *     ]
+     *     currentCount: int
+     *     maxCount: int
+     *     nextLink: String
+     * }
+     * }
+ * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return response of listing models along with {@link PagedResponse} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> listMultivariateModelSinglePageAsync(RequestOptions requestOptions) { + return FluxUtil.withContext( + context -> + service.listMultivariateModel( + this.getEndpoint(), + this.getServiceVersion().getVersion(), + requestOptions, + context)) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + getValues(res.getValue(), "models"), + getNextLink(res.getValue(), "nextLink"), + null)); + } + + /** + * List models of a subscription. + * + *

Query Parameters + * + * + * + * + * + * + *
Query Parameters
NameTypeRequiredDescription
$skipStringNo$skip indicates how many models will be skipped.
$topStringNo$top indicates how many models will be fetched.
+ * + *

Response Body Schema + * + *

{@code
+     * {
+     *     models: [
+     *         {
+     *             modelId: String
+     *             createdTime: String
+     *             lastUpdatedTime: String
+     *             status: String(CREATED/RUNNING/READY/FAILED)
+     *             displayName: String
+     *             variablesCount: int
+     *         }
+     *     ]
+     *     currentCount: int
+     *     maxCount: int
+     *     nextLink: String
+     * }
+     * }
+ * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @param context The context to associate with this operation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return response of listing models along with {@link PagedResponse} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> listMultivariateModelSinglePageAsync( + RequestOptions requestOptions, Context context) { + return service.listMultivariateModel( + this.getEndpoint(), this.getServiceVersion().getVersion(), requestOptions, context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + getValues(res.getValue(), "models"), + getNextLink(res.getValue(), "nextLink"), + null)); + } + + /** + * List models of a subscription. + * + *

Query Parameters + * + * + * + * + * + * + *
Query Parameters
NameTypeRequiredDescription
$skipStringNo$skip indicates how many models will be skipped.
$topStringNo$top indicates how many models will be fetched.
+ * + *

Response Body Schema + * + *

{@code
+     * {
+     *     models: [
+     *         {
+     *             modelId: String
+     *             createdTime: String
+     *             lastUpdatedTime: String
+     *             status: String(CREATED/RUNNING/READY/FAILED)
+     *             displayName: String
+     *             variablesCount: int
+     *         }
+     *     ]
+     *     currentCount: int
+     *     maxCount: int
+     *     nextLink: String
+     * }
+     * }
+ * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return response of listing models as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedFlux listMultivariateModelAsync(RequestOptions requestOptions) { + return new PagedFlux<>( + () -> listMultivariateModelSinglePageAsync(requestOptions), + nextLink -> listMultivariateModelNextSinglePageAsync(nextLink, null)); + } + + /** + * List models of a subscription. + * + *

Query Parameters + * + * + * + * + * + * + *
Query Parameters
NameTypeRequiredDescription
$skipStringNo$skip indicates how many models will be skipped.
$topStringNo$top indicates how many models will be fetched.
+ * + *

Response Body Schema + * + *

{@code
+     * {
+     *     models: [
+     *         {
+     *             modelId: String
+     *             createdTime: String
+     *             lastUpdatedTime: String
+     *             status: String(CREATED/RUNNING/READY/FAILED)
+     *             displayName: String
+     *             variablesCount: int
+     *         }
+     *     ]
+     *     currentCount: int
+     *     maxCount: int
+     *     nextLink: String
+     * }
+     * }
+ * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @param context The context to associate with this operation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return response of listing models as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedFlux listMultivariateModelAsync(RequestOptions requestOptions, Context context) { + return new PagedFlux<>( + () -> listMultivariateModelSinglePageAsync(requestOptions, context), + nextLink -> listMultivariateModelNextSinglePageAsync(nextLink, null, context)); + } + + /** + * List models of a subscription. + * + *

Query Parameters + * + * + * + * + * + * + *
Query Parameters
NameTypeRequiredDescription
$skipStringNo$skip indicates how many models will be skipped.
$topStringNo$top indicates how many models will be fetched.
+ * + *

Response Body Schema + * + *

{@code
+     * {
+     *     models: [
+     *         {
+     *             modelId: String
+     *             createdTime: String
+     *             lastUpdatedTime: String
+     *             status: String(CREATED/RUNNING/READY/FAILED)
+     *             displayName: String
+     *             variablesCount: int
+     *         }
+     *     ]
+     *     currentCount: int
+     *     maxCount: int
+     *     nextLink: String
+     * }
+     * }
+ * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return response of listing models as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listMultivariateModel(RequestOptions requestOptions) { + return new PagedIterable<>(listMultivariateModelAsync(requestOptions)); + } + + /** + * Get detailed information of multivariate model, including the training status and variables used in the model. + * + *

Response Body Schema + * + *

{@code
+     * {
+     *     modelId: String
+     *     createdTime: String
+     *     lastUpdatedTime: String
+     *     modelInfo: {
+     *         slidingWindow: Integer
+     *         alignPolicy: {
+     *             alignMode: String(Inner/Outer)
+     *             fillNAMethod: String(Previous/Subsequent/Linear/Zero/Fixed/NotFill)
+     *             paddingValue: Float
+     *         }
+     *         source: String
+     *         startTime: String
+     *         endTime: String
+     *         displayName: String
+     *         status: String(CREATED/RUNNING/READY/FAILED)
+     *         errors: [
+     *             {
+     *                 code: String
+     *                 message: String
+     *             }
+     *         ]
+     *         diagnosticsInfo: {
+     *             modelState: {
+     *                 epochIds: [
+     *                     int
+     *                 ]
+     *                 trainLosses: [
+     *                     float
+     *                 ]
+     *                 validationLosses: [
+     *                     float
+     *                 ]
+     *                 latenciesInSeconds: [
+     *                     float
+     *                 ]
+     *             }
+     *             variableStates: [
+     *                 {
+     *                     variable: String
+     *                     filledNARatio: Float
+     *                     effectiveCount: Integer
+     *                     startTime: String
+     *                     endTime: String
+     *                 }
+     *             ]
+     *         }
+     *     }
+     * }
+     * }
+ * + * @param modelId Model identifier. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return detailed information of multivariate model, including the training status and variables used in the model + * along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> getMultivariateModelWithResponseAsync( + String modelId, RequestOptions requestOptions) { + return FluxUtil.withContext( + context -> + service.getMultivariateModel( + this.getEndpoint(), + this.getServiceVersion().getVersion(), + modelId, + requestOptions, + context)); + } + + /** + * Get detailed information of multivariate model, including the training status and variables used in the model. + * + *

Response Body Schema + * + *

{@code
+     * {
+     *     modelId: String
+     *     createdTime: String
+     *     lastUpdatedTime: String
+     *     modelInfo: {
+     *         slidingWindow: Integer
+     *         alignPolicy: {
+     *             alignMode: String(Inner/Outer)
+     *             fillNAMethod: String(Previous/Subsequent/Linear/Zero/Fixed/NotFill)
+     *             paddingValue: Float
+     *         }
+     *         source: String
+     *         startTime: String
+     *         endTime: String
+     *         displayName: String
+     *         status: String(CREATED/RUNNING/READY/FAILED)
+     *         errors: [
+     *             {
+     *                 code: String
+     *                 message: String
+     *             }
+     *         ]
+     *         diagnosticsInfo: {
+     *             modelState: {
+     *                 epochIds: [
+     *                     int
+     *                 ]
+     *                 trainLosses: [
+     *                     float
+     *                 ]
+     *                 validationLosses: [
+     *                     float
+     *                 ]
+     *                 latenciesInSeconds: [
+     *                     float
+     *                 ]
+     *             }
+     *             variableStates: [
+     *                 {
+     *                     variable: String
+     *                     filledNARatio: Float
+     *                     effectiveCount: Integer
+     *                     startTime: String
+     *                     endTime: String
+     *                 }
+     *             ]
+     *         }
+     *     }
+     * }
+     * }
+ * + * @param modelId Model identifier. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @param context The context to associate with this operation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return detailed information of multivariate model, including the training status and variables used in the model + * along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> getMultivariateModelWithResponseAsync( + String modelId, RequestOptions requestOptions, Context context) { + return service.getMultivariateModel( + this.getEndpoint(), this.getServiceVersion().getVersion(), modelId, requestOptions, context); + } + + /** + * Get detailed information of multivariate model, including the training status and variables used in the model. + * + *

Response Body Schema + * + *

{@code
+     * {
+     *     modelId: String
+     *     createdTime: String
+     *     lastUpdatedTime: String
+     *     modelInfo: {
+     *         slidingWindow: Integer
+     *         alignPolicy: {
+     *             alignMode: String(Inner/Outer)
+     *             fillNAMethod: String(Previous/Subsequent/Linear/Zero/Fixed/NotFill)
+     *             paddingValue: Float
+     *         }
+     *         source: String
+     *         startTime: String
+     *         endTime: String
+     *         displayName: String
+     *         status: String(CREATED/RUNNING/READY/FAILED)
+     *         errors: [
+     *             {
+     *                 code: String
+     *                 message: String
+     *             }
+     *         ]
+     *         diagnosticsInfo: {
+     *             modelState: {
+     *                 epochIds: [
+     *                     int
+     *                 ]
+     *                 trainLosses: [
+     *                     float
+     *                 ]
+     *                 validationLosses: [
+     *                     float
+     *                 ]
+     *                 latenciesInSeconds: [
+     *                     float
+     *                 ]
+     *             }
+     *             variableStates: [
+     *                 {
+     *                     variable: String
+     *                     filledNARatio: Float
+     *                     effectiveCount: Integer
+     *                     startTime: String
+     *                     endTime: String
+     *                 }
+     *             ]
+     *         }
+     *     }
+     * }
+     * }
+ * + * @param modelId Model identifier. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return detailed information of multivariate model, including the training status and variables used in the model + * along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getMultivariateModelWithResponse(String modelId, RequestOptions requestOptions) { + return getMultivariateModelWithResponseAsync(modelId, requestOptions).block(); + } + + /** + * Delete an existing multivariate model according to the modelId. + * + * @param modelId Model identifier. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> deleteMultivariateModelWithResponseAsync( + String modelId, RequestOptions requestOptions) { + return FluxUtil.withContext( + context -> + service.deleteMultivariateModel( + this.getEndpoint(), + this.getServiceVersion().getVersion(), + modelId, + requestOptions, + context)); + } + + /** + * Delete an existing multivariate model according to the modelId. + * + * @param modelId Model identifier. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @param context The context to associate with this operation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> deleteMultivariateModelWithResponseAsync( + String modelId, RequestOptions requestOptions, Context context) { + return service.deleteMultivariateModel( + this.getEndpoint(), this.getServiceVersion().getVersion(), modelId, requestOptions, context); + } + + /** + * Delete an existing multivariate model according to the modelId. + * + * @param modelId Model identifier. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response deleteMultivariateModelWithResponse(String modelId, RequestOptions requestOptions) { + return deleteMultivariateModelWithResponseAsync(modelId, requestOptions).block(); + } + + /** + * Submit detection multivariate anomaly task with the trained model of modelId, the input schema should be the same + * with the training request. Thus request will be complete asynchronously and will return a resultId for querying + * the detection result.The request should be a source link to indicate an externally accessible Azure storage Uri + * (preferably a Shared Access Signature Uri). All time-series used in generate the model must be zipped into one + * single file. Each time-series will be as follows: the first column is timestamp and the second column is value. + * + *

Request Body Schema + * + *

{@code
+     * {
+     *     source: String
+     *     startTime: String
+     *     endTime: String
+     * }
+     * }
+ * + * @param modelId Model identifier. + * @param body Detect anomaly request. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> detectAnomalyWithResponseAsync( + String modelId, BinaryData body, RequestOptions requestOptions) { + return FluxUtil.withContext( + context -> + service.detectAnomaly( + this.getEndpoint(), + this.getServiceVersion().getVersion(), + modelId, + body, + requestOptions, + context)); + } + + /** + * Submit detection multivariate anomaly task with the trained model of modelId, the input schema should be the same + * with the training request. Thus request will be complete asynchronously and will return a resultId for querying + * the detection result.The request should be a source link to indicate an externally accessible Azure storage Uri + * (preferably a Shared Access Signature Uri). All time-series used in generate the model must be zipped into one + * single file. Each time-series will be as follows: the first column is timestamp and the second column is value. + * + *

Request Body Schema + * + *

{@code
+     * {
+     *     source: String
+     *     startTime: String
+     *     endTime: String
+     * }
+     * }
+ * + * @param modelId Model identifier. + * @param body Detect anomaly request. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @param context The context to associate with this operation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> detectAnomalyWithResponseAsync( + String modelId, BinaryData body, RequestOptions requestOptions, Context context) { + return service.detectAnomaly( + this.getEndpoint(), this.getServiceVersion().getVersion(), modelId, body, requestOptions, context); + } + + /** + * Submit detection multivariate anomaly task with the trained model of modelId, the input schema should be the same + * with the training request. Thus request will be complete asynchronously and will return a resultId for querying + * the detection result.The request should be a source link to indicate an externally accessible Azure storage Uri + * (preferably a Shared Access Signature Uri). All time-series used in generate the model must be zipped into one + * single file. Each time-series will be as follows: the first column is timestamp and the second column is value. + * + *

Request Body Schema + * + *

{@code
+     * {
+     *     source: String
+     *     startTime: String
+     *     endTime: String
+     * }
+     * }
+ * + * @param modelId Model identifier. + * @param body Detect anomaly request. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response detectAnomalyWithResponse(String modelId, BinaryData body, RequestOptions requestOptions) { + return detectAnomalyWithResponseAsync(modelId, body, requestOptions).block(); + } + + /** + * Get multivariate anomaly detection result based on resultId returned by the DetectAnomalyAsync api. + * + *

Response Body Schema + * + *

{@code
+     * {
+     *     resultId: String
+     *     summary: {
+     *         status: String(CREATED/RUNNING/READY/FAILED)
+     *         errors: [
+     *             {
+     *                 code: String
+     *                 message: String
+     *             }
+     *         ]
+     *         variableStates: [
+     *             {
+     *                 variable: String
+     *                 filledNARatio: Float
+     *                 effectiveCount: Integer
+     *                 startTime: String
+     *                 endTime: String
+     *             }
+     *         ]
+     *         setupInfo: {
+     *             source: String
+     *             startTime: String
+     *             endTime: String
+     *         }
+     *     }
+     *     results: [
+     *         {
+     *             timestamp: String
+     *             value: {
+     *                 isAnomaly: boolean
+     *                 severity: float
+     *                 score: float
+     *                 interpretation: [
+     *                     {
+     *                         variable: String
+     *                         contributionScore: Float
+     *                         correlationChanges: {
+     *                             changedVariables: [
+     *                                 String
+     *                             ]
+     *                             changedValues: [
+     *                                 float
+     *                             ]
+     *                         }
+     *                     }
+     *                 ]
+     *             }
+     *             errors: [
+     *                 (recursive schema, see above)
+     *             ]
+     *         }
+     *     ]
+     * }
+     * }
+ * + * @param resultId Result identifier. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return multivariate anomaly detection result based on resultId returned by the DetectAnomalyAsync api along with + * {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> getDetectionResultWithResponseAsync( + String resultId, RequestOptions requestOptions) { + return FluxUtil.withContext( + context -> + service.getDetectionResult( + this.getEndpoint(), + this.getServiceVersion().getVersion(), + resultId, + requestOptions, + context)); + } + + /** + * Get multivariate anomaly detection result based on resultId returned by the DetectAnomalyAsync api. + * + *

Response Body Schema + * + *

{@code
+     * {
+     *     resultId: String
+     *     summary: {
+     *         status: String(CREATED/RUNNING/READY/FAILED)
+     *         errors: [
+     *             {
+     *                 code: String
+     *                 message: String
+     *             }
+     *         ]
+     *         variableStates: [
+     *             {
+     *                 variable: String
+     *                 filledNARatio: Float
+     *                 effectiveCount: Integer
+     *                 startTime: String
+     *                 endTime: String
+     *             }
+     *         ]
+     *         setupInfo: {
+     *             source: String
+     *             startTime: String
+     *             endTime: String
+     *         }
+     *     }
+     *     results: [
+     *         {
+     *             timestamp: String
+     *             value: {
+     *                 isAnomaly: boolean
+     *                 severity: float
+     *                 score: float
+     *                 interpretation: [
+     *                     {
+     *                         variable: String
+     *                         contributionScore: Float
+     *                         correlationChanges: {
+     *                             changedVariables: [
+     *                                 String
+     *                             ]
+     *                             changedValues: [
+     *                                 float
+     *                             ]
+     *                         }
+     *                     }
+     *                 ]
+     *             }
+     *             errors: [
+     *                 (recursive schema, see above)
+     *             ]
+     *         }
+     *     ]
+     * }
+     * }
+ * + * @param resultId Result identifier. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @param context The context to associate with this operation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return multivariate anomaly detection result based on resultId returned by the DetectAnomalyAsync api along with + * {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> getDetectionResultWithResponseAsync( + String resultId, RequestOptions requestOptions, Context context) { + return service.getDetectionResult( + this.getEndpoint(), this.getServiceVersion().getVersion(), resultId, requestOptions, context); + } + + /** + * Get multivariate anomaly detection result based on resultId returned by the DetectAnomalyAsync api. + * + *

Response Body Schema + * + *

{@code
+     * {
+     *     resultId: String
+     *     summary: {
+     *         status: String(CREATED/RUNNING/READY/FAILED)
+     *         errors: [
+     *             {
+     *                 code: String
+     *                 message: String
+     *             }
+     *         ]
+     *         variableStates: [
+     *             {
+     *                 variable: String
+     *                 filledNARatio: Float
+     *                 effectiveCount: Integer
+     *                 startTime: String
+     *                 endTime: String
+     *             }
+     *         ]
+     *         setupInfo: {
+     *             source: String
+     *             startTime: String
+     *             endTime: String
+     *         }
+     *     }
+     *     results: [
+     *         {
+     *             timestamp: String
+     *             value: {
+     *                 isAnomaly: boolean
+     *                 severity: float
+     *                 score: float
+     *                 interpretation: [
+     *                     {
+     *                         variable: String
+     *                         contributionScore: Float
+     *                         correlationChanges: {
+     *                             changedVariables: [
+     *                                 String
+     *                             ]
+     *                             changedValues: [
+     *                                 float
+     *                             ]
+     *                         }
+     *                     }
+     *                 ]
+     *             }
+     *             errors: [
+     *                 (recursive schema, see above)
+     *             ]
+     *         }
+     *     ]
+     * }
+     * }
+ * + * @param resultId Result identifier. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return multivariate anomaly detection result based on resultId returned by the DetectAnomalyAsync api along with + * {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getDetectionResultWithResponse(String resultId, RequestOptions requestOptions) { + return getDetectionResultWithResponseAsync(resultId, requestOptions).block(); + } + + /** + * Export multivariate anomaly detection model based on modelId. + * + * @param modelId Model identifier. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> exportModelWithResponseAsync(String modelId, RequestOptions requestOptions) { + return FluxUtil.withContext( + context -> + service.exportModel( + this.getEndpoint(), + this.getServiceVersion().getVersion(), + modelId, + requestOptions, + context)); + } + + /** + * Export multivariate anomaly detection model based on modelId. + * + * @param modelId Model identifier. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @param context The context to associate with this operation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> exportModelWithResponseAsync( + String modelId, RequestOptions requestOptions, Context context) { + return service.exportModel( + this.getEndpoint(), this.getServiceVersion().getVersion(), modelId, requestOptions, context); + } + + /** + * Export multivariate anomaly detection model based on modelId. + * + * @param modelId Model identifier. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response exportModelWithResponse(String modelId, RequestOptions requestOptions) { + return exportModelWithResponseAsync(modelId, requestOptions).block(); + } + + /** + * Synchronized API for anomaly detection. + * + *

Request Body Schema + * + *

{@code
+     * {
+     *     variables: [
+     *         {
+     *             name: String
+     *             timestamps: [
+     *                 String
+     *             ]
+     *             values: [
+     *                 float
+     *             ]
+     *         }
+     *     ]
+     *     detectingPoints: int
+     * }
+     * }
+ * + *

Response Body Schema + * + *

{@code
+     * {
+     *     variableStates: [
+     *         {
+     *             variable: String
+     *             filledNARatio: Float
+     *             effectiveCount: Integer
+     *             startTime: String
+     *             endTime: String
+     *         }
+     *     ]
+     *     results: [
+     *         {
+     *             timestamp: String
+     *             value: {
+     *                 isAnomaly: boolean
+     *                 severity: float
+     *                 score: float
+     *                 interpretation: [
+     *                     {
+     *                         variable: String
+     *                         contributionScore: Float
+     *                         correlationChanges: {
+     *                             changedVariables: [
+     *                                 String
+     *                             ]
+     *                             changedValues: [
+     *                                 float
+     *                             ]
+     *                         }
+     *                     }
+     *                 ]
+     *             }
+     *             errors: [
+     *                 {
+     *                     code: String
+     *                     message: String
+     *                 }
+     *             ]
+     *         }
+     *     ]
+     * }
+     * }
+ * + * @param modelId Model identifier. + * @param body Request for last detection. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the response body along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> lastDetectAnomalyWithResponseAsync( + String modelId, BinaryData body, RequestOptions requestOptions) { + return FluxUtil.withContext( + context -> + service.lastDetectAnomaly( + this.getEndpoint(), + this.getServiceVersion().getVersion(), + modelId, + body, + requestOptions, + context)); + } + + /** + * Synchronized API for anomaly detection. + * + *

Request Body Schema + * + *

{@code
+     * {
+     *     variables: [
+     *         {
+     *             name: String
+     *             timestamps: [
+     *                 String
+     *             ]
+     *             values: [
+     *                 float
+     *             ]
+     *         }
+     *     ]
+     *     detectingPoints: int
+     * }
+     * }
+ * + *

Response Body Schema + * + *

{@code
+     * {
+     *     variableStates: [
+     *         {
+     *             variable: String
+     *             filledNARatio: Float
+     *             effectiveCount: Integer
+     *             startTime: String
+     *             endTime: String
+     *         }
+     *     ]
+     *     results: [
+     *         {
+     *             timestamp: String
+     *             value: {
+     *                 isAnomaly: boolean
+     *                 severity: float
+     *                 score: float
+     *                 interpretation: [
+     *                     {
+     *                         variable: String
+     *                         contributionScore: Float
+     *                         correlationChanges: {
+     *                             changedVariables: [
+     *                                 String
+     *                             ]
+     *                             changedValues: [
+     *                                 float
+     *                             ]
+     *                         }
+     *                     }
+     *                 ]
+     *             }
+     *             errors: [
+     *                 {
+     *                     code: String
+     *                     message: String
+     *                 }
+     *             ]
+     *         }
+     *     ]
+     * }
+     * }
+ * + * @param modelId Model identifier. + * @param body Request for last detection. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @param context The context to associate with this operation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the response body along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> lastDetectAnomalyWithResponseAsync( + String modelId, BinaryData body, RequestOptions requestOptions, Context context) { + return service.lastDetectAnomaly( + this.getEndpoint(), this.getServiceVersion().getVersion(), modelId, body, requestOptions, context); + } + + /** + * Synchronized API for anomaly detection. + * + *

Request Body Schema + * + *

{@code
+     * {
+     *     variables: [
+     *         {
+     *             name: String
+     *             timestamps: [
+     *                 String
+     *             ]
+     *             values: [
+     *                 float
+     *             ]
+     *         }
+     *     ]
+     *     detectingPoints: int
+     * }
+     * }
+ * + *

Response Body Schema + * + *

{@code
+     * {
+     *     variableStates: [
+     *         {
+     *             variable: String
+     *             filledNARatio: Float
+     *             effectiveCount: Integer
+     *             startTime: String
+     *             endTime: String
+     *         }
+     *     ]
+     *     results: [
+     *         {
+     *             timestamp: String
+     *             value: {
+     *                 isAnomaly: boolean
+     *                 severity: float
+     *                 score: float
+     *                 interpretation: [
+     *                     {
+     *                         variable: String
+     *                         contributionScore: Float
+     *                         correlationChanges: {
+     *                             changedVariables: [
+     *                                 String
+     *                             ]
+     *                             changedValues: [
+     *                                 float
+     *                             ]
+     *                         }
+     *                     }
+     *                 ]
+     *             }
+     *             errors: [
+     *                 {
+     *                     code: String
+     *                     message: String
+     *                 }
+     *             ]
+     *         }
+     *     ]
+     * }
+     * }
+ * + * @param modelId Model identifier. + * @param body Request for last detection. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the response body along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response lastDetectAnomalyWithResponse( + String modelId, BinaryData body, RequestOptions requestOptions) { + return lastDetectAnomalyWithResponseAsync(modelId, body, requestOptions).block(); + } + + /** + * Get the next page of items. + * + *

Response Body Schema + * + *

{@code
+     * {
+     *     models: [
+     *         {
+     *             modelId: String
+     *             createdTime: String
+     *             lastUpdatedTime: String
+     *             status: String(CREATED/RUNNING/READY/FAILED)
+     *             displayName: String
+     *             variablesCount: int
+     *         }
+     *     ]
+     *     currentCount: int
+     *     maxCount: int
+     *     nextLink: String
+     * }
+     * }
+ * + * @param nextLink The nextLink parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return response of listing models along with {@link PagedResponse} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> listMultivariateModelNextSinglePageAsync( + String nextLink, RequestOptions requestOptions) { + return FluxUtil.withContext( + context -> + service.listMultivariateModelNext( + nextLink, + this.getEndpoint(), + this.getServiceVersion().getVersion(), + requestOptions, + context)) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + getValues(res.getValue(), "models"), + getNextLink(res.getValue(), "nextLink"), + null)); + } + + /** + * Get the next page of items. + * + *

Response Body Schema + * + *

{@code
+     * {
+     *     models: [
+     *         {
+     *             modelId: String
+     *             createdTime: String
+     *             lastUpdatedTime: String
+     *             status: String(CREATED/RUNNING/READY/FAILED)
+     *             displayName: String
+     *             variablesCount: int
+     *         }
+     *     ]
+     *     currentCount: int
+     *     maxCount: int
+     *     nextLink: String
+     * }
+     * }
+ * + * @param nextLink The nextLink parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @param context The context to associate with this operation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return response of listing models along with {@link PagedResponse} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> listMultivariateModelNextSinglePageAsync( + String nextLink, RequestOptions requestOptions, Context context) { + return service.listMultivariateModelNext( + nextLink, this.getEndpoint(), this.getServiceVersion().getVersion(), requestOptions, context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + getValues(res.getValue(), "models"), + getNextLink(res.getValue(), "nextLink"), + null)); + } + + private List getValues(BinaryData binaryData, String path) { + try { + Map obj = binaryData.toObject(Map.class); + List values = (List) obj.get(path); + return values.stream().map(BinaryData::fromObject).collect(Collectors.toList()); + } catch (RuntimeException e) { + return null; + } + } + + private String getNextLink(BinaryData binaryData, String path) { + try { + Map obj = binaryData.toObject(Map.class); + return (String) obj.get(path); + } catch (RuntimeException e) { + return null; + } + } +} diff --git a/sdk/cognitiveservices/azure-cognitiveservices-multivariateanomalydetector/src/main/java/com/azure/cognitiveservices/multivariateanomalydetector/implementation/package-info.java b/sdk/cognitiveservices/azure-cognitiveservices-multivariateanomalydetector/src/main/java/com/azure/cognitiveservices/multivariateanomalydetector/implementation/package-info.java new file mode 100644 index 0000000000000..de42fcb26eea3 --- /dev/null +++ b/sdk/cognitiveservices/azure-cognitiveservices-multivariateanomalydetector/src/main/java/com/azure/cognitiveservices/multivariateanomalydetector/implementation/package-info.java @@ -0,0 +1,19 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +/** + * Package containing the implementations for AnomalyDetectorClient. 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. + */ +package com.azure.cognitiveservices.multivariateanomalydetector.implementation; diff --git a/sdk/cognitiveservices/azure-cognitiveservices-multivariateanomalydetector/src/main/java/com/azure/cognitiveservices/multivariateanomalydetector/package-info.java b/sdk/cognitiveservices/azure-cognitiveservices-multivariateanomalydetector/src/main/java/com/azure/cognitiveservices/multivariateanomalydetector/package-info.java new file mode 100644 index 0000000000000..e5890231deb8d --- /dev/null +++ b/sdk/cognitiveservices/azure-cognitiveservices-multivariateanomalydetector/src/main/java/com/azure/cognitiveservices/multivariateanomalydetector/package-info.java @@ -0,0 +1,19 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +/** + * Package containing the classes for AnomalyDetectorClient. 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. + */ +package com.azure.cognitiveservices.multivariateanomalydetector; diff --git a/sdk/cognitiveservices/azure-cognitiveservices-multivariateanomalydetector/src/main/java/module-info.java b/sdk/cognitiveservices/azure-cognitiveservices-multivariateanomalydetector/src/main/java/module-info.java new file mode 100644 index 0000000000000..5f29c77adcedb --- /dev/null +++ b/sdk/cognitiveservices/azure-cognitiveservices-multivariateanomalydetector/src/main/java/module-info.java @@ -0,0 +1,9 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +module com.azure.cognitiveservices.multivariateanomalydetector { + requires transitive com.azure.core; + + exports com.azure.cognitiveservices.multivariateanomalydetector; +} diff --git a/sdk/cognitiveservices/azure-cognitiveservices-multivariateanomalydetector/src/main/resources/azure-cognitiveservices-multivariateanomalydetector.properties b/sdk/cognitiveservices/azure-cognitiveservices-multivariateanomalydetector/src/main/resources/azure-cognitiveservices-multivariateanomalydetector.properties new file mode 100644 index 0000000000000..ca812989b4f27 --- /dev/null +++ b/sdk/cognitiveservices/azure-cognitiveservices-multivariateanomalydetector/src/main/resources/azure-cognitiveservices-multivariateanomalydetector.properties @@ -0,0 +1,2 @@ +name=${project.artifactId} +version=${project.version} diff --git a/sdk/cognitiveservices/azure-cognitiveservices-multivariateanomalydetector/src/samples/java/com/azure/cognitiveservices/multivariateanomalydetector/ReadmeSamples.java b/sdk/cognitiveservices/azure-cognitiveservices-multivariateanomalydetector/src/samples/java/com/azure/cognitiveservices/multivariateanomalydetector/ReadmeSamples.java new file mode 100644 index 0000000000000..8a3cce23e5261 --- /dev/null +++ b/sdk/cognitiveservices/azure-cognitiveservices-multivariateanomalydetector/src/samples/java/com/azure/cognitiveservices/multivariateanomalydetector/ReadmeSamples.java @@ -0,0 +1,12 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.cognitiveservices.multivariateanomalydetector; + +public final class ReadmeSamples { + public void readmeSamples() { + // BEGIN: com.azure.cognitiveservices.multivariateanomalydetector.readme + // END: com.azure.cognitiveservices.multivariateanomalydetector.readme + } +} diff --git a/sdk/cognitiveservices/azure-cognitiveservices-multivariateanomalydetector/src/samples/java/com/azure/cognitiveservices/multivariateanomalydetector/generated/DeleteMultivariateModel.java b/sdk/cognitiveservices/azure-cognitiveservices-multivariateanomalydetector/src/samples/java/com/azure/cognitiveservices/multivariateanomalydetector/generated/DeleteMultivariateModel.java new file mode 100644 index 0000000000000..6188315c37662 --- /dev/null +++ b/sdk/cognitiveservices/azure-cognitiveservices-multivariateanomalydetector/src/samples/java/com/azure/cognitiveservices/multivariateanomalydetector/generated/DeleteMultivariateModel.java @@ -0,0 +1,25 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.cognitiveservices.multivariateanomalydetector.generated; + +import com.azure.cognitiveservices.multivariateanomalydetector.AnomalyDetectorClient; +import com.azure.cognitiveservices.multivariateanomalydetector.AnomalyDetectorClientBuilder; +import com.azure.core.http.rest.RequestOptions; +import com.azure.core.http.rest.Response; + +public class DeleteMultivariateModel { + public static void main(String[] args) { + // BEGIN: + // com.azure.cognitiveservices.multivariateanomalydetector.generated.deletemultivariatemodel.deletemultivariatemodel + AnomalyDetectorClient anomalyDetectorClient = + new AnomalyDetectorClientBuilder().endpoint("{Endpoint}").buildClient(); + RequestOptions requestOptions = new RequestOptions(); + Response response = + anomalyDetectorClient.deleteMultivariateModelWithResponse( + "45aad126-aafd-11ea-b8fb-d89ef3400c5f", requestOptions); + // END: + // com.azure.cognitiveservices.multivariateanomalydetector.generated.deletemultivariatemodel.deletemultivariatemodel + } +} diff --git a/sdk/cognitiveservices/azure-cognitiveservices-multivariateanomalydetector/src/samples/java/com/azure/cognitiveservices/multivariateanomalydetector/generated/DetectAnomalyWithMultivariateModel.java b/sdk/cognitiveservices/azure-cognitiveservices-multivariateanomalydetector/src/samples/java/com/azure/cognitiveservices/multivariateanomalydetector/generated/DetectAnomalyWithMultivariateModel.java new file mode 100644 index 0000000000000..be7dbe6cff7ee --- /dev/null +++ b/sdk/cognitiveservices/azure-cognitiveservices-multivariateanomalydetector/src/samples/java/com/azure/cognitiveservices/multivariateanomalydetector/generated/DetectAnomalyWithMultivariateModel.java @@ -0,0 +1,29 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.cognitiveservices.multivariateanomalydetector.generated; + +import com.azure.cognitiveservices.multivariateanomalydetector.AnomalyDetectorClient; +import com.azure.cognitiveservices.multivariateanomalydetector.AnomalyDetectorClientBuilder; +import com.azure.core.http.rest.RequestOptions; +import com.azure.core.http.rest.Response; +import com.azure.core.util.BinaryData; + +public class DetectAnomalyWithMultivariateModel { + public static void main(String[] args) { + // BEGIN: + // com.azure.cognitiveservices.multivariateanomalydetector.generated.detectanomaly.detectanomalywithmultivariatemodel + AnomalyDetectorClient anomalyDetectorClient = + new AnomalyDetectorClientBuilder().endpoint("{Endpoint}").buildClient(); + BinaryData body = + BinaryData.fromString( + "{\"endTime\":\"2019-04-01T00:40:00Z\",\"source\":\"https://multiadsample.blob.core.windows.net/data/sample_data_2_1000.zip?sp=rl&st=2020-12-04T06:03:47Z&se=2022-12-05T06:03:00Z&sv=2019-12-12&sr=b&sig=AZTbvZ7fcp3MdqGY%2FvGHJXJjUgjS4DneCGl7U5omq5c%3D\",\"startTime\":\"2019-04-01T00:15:00Z\"}"); + RequestOptions requestOptions = new RequestOptions(); + Response response = + anomalyDetectorClient.detectAnomalyWithResponse( + "45aad126-aafd-11ea-b8fb-d89ef3400c5f", body, requestOptions); + // END: + // com.azure.cognitiveservices.multivariateanomalydetector.generated.detectanomaly.detectanomalywithmultivariatemodel + } +} diff --git a/sdk/cognitiveservices/azure-cognitiveservices-multivariateanomalydetector/src/samples/java/com/azure/cognitiveservices/multivariateanomalydetector/generated/ExportModel.java b/sdk/cognitiveservices/azure-cognitiveservices-multivariateanomalydetector/src/samples/java/com/azure/cognitiveservices/multivariateanomalydetector/generated/ExportModel.java new file mode 100644 index 0000000000000..28be0e2143f9f --- /dev/null +++ b/sdk/cognitiveservices/azure-cognitiveservices-multivariateanomalydetector/src/samples/java/com/azure/cognitiveservices/multivariateanomalydetector/generated/ExportModel.java @@ -0,0 +1,22 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.cognitiveservices.multivariateanomalydetector.generated; + +import com.azure.cognitiveservices.multivariateanomalydetector.AnomalyDetectorClient; +import com.azure.cognitiveservices.multivariateanomalydetector.AnomalyDetectorClientBuilder; +import com.azure.core.http.rest.RequestOptions; +import com.azure.core.http.rest.Response; + +public class ExportModel { + public static void main(String[] args) { + // BEGIN: com.azure.cognitiveservices.multivariateanomalydetector.generated.exportmodel.exportmodel + AnomalyDetectorClient anomalyDetectorClient = + new AnomalyDetectorClientBuilder().endpoint("{Endpoint}").buildClient(); + RequestOptions requestOptions = new RequestOptions(); + Response response = + anomalyDetectorClient.exportModelWithResponse("45aad126-aafd-11ea-b8fb-d89ef3400c5f", requestOptions); + // END: com.azure.cognitiveservices.multivariateanomalydetector.generated.exportmodel.exportmodel + } +} diff --git a/sdk/cognitiveservices/azure-cognitiveservices-multivariateanomalydetector/src/samples/java/com/azure/cognitiveservices/multivariateanomalydetector/generated/GetDetectionResult.java b/sdk/cognitiveservices/azure-cognitiveservices-multivariateanomalydetector/src/samples/java/com/azure/cognitiveservices/multivariateanomalydetector/generated/GetDetectionResult.java new file mode 100644 index 0000000000000..39885b1859dd0 --- /dev/null +++ b/sdk/cognitiveservices/azure-cognitiveservices-multivariateanomalydetector/src/samples/java/com/azure/cognitiveservices/multivariateanomalydetector/generated/GetDetectionResult.java @@ -0,0 +1,25 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.cognitiveservices.multivariateanomalydetector.generated; + +import com.azure.cognitiveservices.multivariateanomalydetector.AnomalyDetectorClient; +import com.azure.cognitiveservices.multivariateanomalydetector.AnomalyDetectorClientBuilder; +import com.azure.core.http.rest.RequestOptions; +import com.azure.core.http.rest.Response; +import com.azure.core.util.BinaryData; + +public class GetDetectionResult { + public static void main(String[] args) { + // BEGIN: + // com.azure.cognitiveservices.multivariateanomalydetector.generated.getdetectionresult.getdetectionresult + AnomalyDetectorClient anomalyDetectorClient = + new AnomalyDetectorClientBuilder().endpoint("{Endpoint}").buildClient(); + RequestOptions requestOptions = new RequestOptions(); + Response response = + anomalyDetectorClient.getDetectionResultWithResponse( + "663884e6-b117-11ea-b3de-0242ac130004", requestOptions); + // END: com.azure.cognitiveservices.multivariateanomalydetector.generated.getdetectionresult.getdetectionresult + } +} diff --git a/sdk/cognitiveservices/azure-cognitiveservices-multivariateanomalydetector/src/samples/java/com/azure/cognitiveservices/multivariateanomalydetector/generated/GetMultivariateModel.java b/sdk/cognitiveservices/azure-cognitiveservices-multivariateanomalydetector/src/samples/java/com/azure/cognitiveservices/multivariateanomalydetector/generated/GetMultivariateModel.java new file mode 100644 index 0000000000000..1dfeaf082717e --- /dev/null +++ b/sdk/cognitiveservices/azure-cognitiveservices-multivariateanomalydetector/src/samples/java/com/azure/cognitiveservices/multivariateanomalydetector/generated/GetMultivariateModel.java @@ -0,0 +1,26 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.cognitiveservices.multivariateanomalydetector.generated; + +import com.azure.cognitiveservices.multivariateanomalydetector.AnomalyDetectorClient; +import com.azure.cognitiveservices.multivariateanomalydetector.AnomalyDetectorClientBuilder; +import com.azure.core.http.rest.RequestOptions; +import com.azure.core.http.rest.Response; +import com.azure.core.util.BinaryData; + +public class GetMultivariateModel { + public static void main(String[] args) { + // BEGIN: + // com.azure.cognitiveservices.multivariateanomalydetector.generated.getmultivariatemodel.getmultivariatemodel + AnomalyDetectorClient anomalyDetectorClient = + new AnomalyDetectorClientBuilder().endpoint("{Endpoint}").buildClient(); + RequestOptions requestOptions = new RequestOptions(); + Response response = + anomalyDetectorClient.getMultivariateModelWithResponse( + "45aad126-aafd-11ea-b8fb-d89ef3400c5f", requestOptions); + // END: + // com.azure.cognitiveservices.multivariateanomalydetector.generated.getmultivariatemodel.getmultivariatemodel + } +} diff --git a/sdk/cognitiveservices/azure-cognitiveservices-multivariateanomalydetector/src/samples/java/com/azure/cognitiveservices/multivariateanomalydetector/generated/ListMultivariateModel.java b/sdk/cognitiveservices/azure-cognitiveservices-multivariateanomalydetector/src/samples/java/com/azure/cognitiveservices/multivariateanomalydetector/generated/ListMultivariateModel.java new file mode 100644 index 0000000000000..ec18f80f74c6e --- /dev/null +++ b/sdk/cognitiveservices/azure-cognitiveservices-multivariateanomalydetector/src/samples/java/com/azure/cognitiveservices/multivariateanomalydetector/generated/ListMultivariateModel.java @@ -0,0 +1,24 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.cognitiveservices.multivariateanomalydetector.generated; + +import com.azure.cognitiveservices.multivariateanomalydetector.AnomalyDetectorClient; +import com.azure.cognitiveservices.multivariateanomalydetector.AnomalyDetectorClientBuilder; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.RequestOptions; +import com.azure.core.util.BinaryData; + +public class ListMultivariateModel { + public static void main(String[] args) { + // BEGIN: + // com.azure.cognitiveservices.multivariateanomalydetector.generated.listmultivariatemodel.listmultivariatemodel + AnomalyDetectorClient anomalyDetectorClient = + new AnomalyDetectorClientBuilder().endpoint("{Endpoint}").buildClient(); + RequestOptions requestOptions = new RequestOptions(); + PagedIterable response = anomalyDetectorClient.listMultivariateModel(requestOptions); + // END: + // com.azure.cognitiveservices.multivariateanomalydetector.generated.listmultivariatemodel.listmultivariatemodel + } +} diff --git a/sdk/cognitiveservices/azure-cognitiveservices-multivariateanomalydetector/src/samples/java/com/azure/cognitiveservices/multivariateanomalydetector/generated/TrainMultivariateModel.java b/sdk/cognitiveservices/azure-cognitiveservices-multivariateanomalydetector/src/samples/java/com/azure/cognitiveservices/multivariateanomalydetector/generated/TrainMultivariateModel.java new file mode 100644 index 0000000000000..5ae07e56808c7 --- /dev/null +++ b/sdk/cognitiveservices/azure-cognitiveservices-multivariateanomalydetector/src/samples/java/com/azure/cognitiveservices/multivariateanomalydetector/generated/TrainMultivariateModel.java @@ -0,0 +1,27 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.cognitiveservices.multivariateanomalydetector.generated; + +import com.azure.cognitiveservices.multivariateanomalydetector.AnomalyDetectorClient; +import com.azure.cognitiveservices.multivariateanomalydetector.AnomalyDetectorClientBuilder; +import com.azure.core.http.rest.RequestOptions; +import com.azure.core.http.rest.Response; +import com.azure.core.util.BinaryData; + +public class TrainMultivariateModel { + public static void main(String[] args) { + // BEGIN: + // com.azure.cognitiveservices.multivariateanomalydetector.generated.trainmultivariatemodel.trainmultivariatemodel + AnomalyDetectorClient anomalyDetectorClient = + new AnomalyDetectorClientBuilder().endpoint("{Endpoint}").buildClient(); + BinaryData body = + BinaryData.fromString( + "{\"alignPolicy\":{\"alignMode\":\"Outer\",\"fillNAMethod\":\"Linear\",\"paddingValue\":0},\"displayName\":\"Devops-MultiAD\",\"endTime\":\"2019-04-02T00:00:00Z\",\"slidingWindow\":20,\"source\":\"https://multiadsample.blob.core.windows.net/data/sample_data_2_1000.zip?sp=rl&st=2020-12-04T06:03:47Z&se=2022-12-05T06:03:00Z&sv=2019-12-12&sr=b&sig=AZTbvZ7fcp3MdqGY%2FvGHJXJjUgjS4DneCGl7U5omq5c%3D\",\"startTime\":\"2019-04-01T00:00:00Z\"}"); + RequestOptions requestOptions = new RequestOptions(); + Response response = anomalyDetectorClient.trainMultivariateModelWithResponse(body, requestOptions); + // END: + // com.azure.cognitiveservices.multivariateanomalydetector.generated.trainmultivariatemodel.trainmultivariatemodel + } +} diff --git a/sdk/cognitiveservices/azure-cognitiveservices-multivariateanomalydetector/src/test/java/com/azure/cognitiveservices/multivariateanomalydetector/generated/AnomalyDetectorClientTestBase.java b/sdk/cognitiveservices/azure-cognitiveservices-multivariateanomalydetector/src/test/java/com/azure/cognitiveservices/multivariateanomalydetector/generated/AnomalyDetectorClientTestBase.java new file mode 100644 index 0000000000000..9b8c928496423 --- /dev/null +++ b/sdk/cognitiveservices/azure-cognitiveservices-multivariateanomalydetector/src/test/java/com/azure/cognitiveservices/multivariateanomalydetector/generated/AnomalyDetectorClientTestBase.java @@ -0,0 +1,33 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.cognitiveservices.multivariateanomalydetector.generated; + +import com.azure.cognitiveservices.multivariateanomalydetector.AnomalyDetectorClient; +import com.azure.cognitiveservices.multivariateanomalydetector.AnomalyDetectorClientBuilder; +import com.azure.core.http.HttpClient; +import com.azure.core.http.policy.HttpLogDetailLevel; +import com.azure.core.http.policy.HttpLogOptions; +import com.azure.core.test.TestBase; +import com.azure.core.test.TestMode; +import com.azure.core.util.Configuration; + +class AnomalyDetectorClientTestBase extends TestBase { + protected AnomalyDetectorClient anomalyDetectorClient; + + @Override + protected void beforeTest() { + AnomalyDetectorClientBuilder anomalyDetectorClientbuilder = + new AnomalyDetectorClientBuilder() + .endpoint(Configuration.getGlobalConfiguration().get("ENDPOINT", "endpoint")) + .httpClient(HttpClient.createDefault()) + .httpLogOptions(new HttpLogOptions().setLogLevel(HttpLogDetailLevel.BASIC)); + if (getTestMode() == TestMode.PLAYBACK) { + anomalyDetectorClientbuilder.httpClient(interceptorManager.getPlaybackClient()); + } else if (getTestMode() == TestMode.RECORD) { + anomalyDetectorClientbuilder.addPolicy(interceptorManager.getRecordPolicy()); + } + anomalyDetectorClient = anomalyDetectorClientbuilder.buildClient(); + } +} diff --git a/sdk/cognitiveservices/azure-cognitiveservices-multivariateanomalydetector/src/test/java/com/azure/cognitiveservices/multivariateanomalydetector/generated/DeleteMultivariateModelTests.java b/sdk/cognitiveservices/azure-cognitiveservices-multivariateanomalydetector/src/test/java/com/azure/cognitiveservices/multivariateanomalydetector/generated/DeleteMultivariateModelTests.java new file mode 100644 index 0000000000000..33c9e6c48ffed --- /dev/null +++ b/sdk/cognitiveservices/azure-cognitiveservices-multivariateanomalydetector/src/test/java/com/azure/cognitiveservices/multivariateanomalydetector/generated/DeleteMultivariateModelTests.java @@ -0,0 +1,23 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.cognitiveservices.multivariateanomalydetector.generated; + +import com.azure.core.http.rest.RequestOptions; +import com.azure.core.http.rest.Response; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + +public final class DeleteMultivariateModelTests extends AnomalyDetectorClientTestBase { + @Test + @Disabled + public void testDeleteMultivariateModelTests() { + RequestOptions requestOptions = new RequestOptions(); + Response response = + anomalyDetectorClient.deleteMultivariateModelWithResponse( + "45aad126-aafd-11ea-b8fb-d89ef3400c5f", requestOptions); + Assertions.assertEquals(204, response.getStatusCode()); + } +} diff --git a/sdk/cognitiveservices/azure-cognitiveservices-multivariateanomalydetector/src/test/java/com/azure/cognitiveservices/multivariateanomalydetector/generated/DetectAnomalyWithMultivariateModelTests.java b/sdk/cognitiveservices/azure-cognitiveservices-multivariateanomalydetector/src/test/java/com/azure/cognitiveservices/multivariateanomalydetector/generated/DetectAnomalyWithMultivariateModelTests.java new file mode 100644 index 0000000000000..949245a7a86ff --- /dev/null +++ b/sdk/cognitiveservices/azure-cognitiveservices-multivariateanomalydetector/src/test/java/com/azure/cognitiveservices/multivariateanomalydetector/generated/DetectAnomalyWithMultivariateModelTests.java @@ -0,0 +1,30 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.cognitiveservices.multivariateanomalydetector.generated; + +import com.azure.core.http.rest.RequestOptions; +import com.azure.core.http.rest.Response; +import com.azure.core.util.BinaryData; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + +public final class DetectAnomalyWithMultivariateModelTests extends AnomalyDetectorClientTestBase { + @Test + @Disabled + public void testDetectAnomalyWithMultivariateModelTests() { + BinaryData body = + BinaryData.fromString( + "{\"endTime\":\"2019-04-01T00:40:00Z\",\"source\":\"https://multiadsample.blob.core.windows.net/data/sample_data_2_1000.zip?sp=rl&st=2020-12-04T06:03:47Z&se=2022-12-05T06:03:00Z&sv=2019-12-12&sr=b&sig=AZTbvZ7fcp3MdqGY%2FvGHJXJjUgjS4DneCGl7U5omq5c%3D\",\"startTime\":\"2019-04-01T00:15:00Z\"}"); + RequestOptions requestOptions = new RequestOptions(); + Response response = + anomalyDetectorClient.detectAnomalyWithResponse( + "45aad126-aafd-11ea-b8fb-d89ef3400c5f", body, requestOptions); + Assertions.assertEquals(201, response.getStatusCode()); + Assertions.assertEquals( + "{Endpoint}/anomalydetector/v1.1-preview/multivariate/results/{resultId}", + response.getHeaders().get("Location").getValue()); + } +} diff --git a/sdk/cognitiveservices/azure-cognitiveservices-multivariateanomalydetector/src/test/java/com/azure/cognitiveservices/multivariateanomalydetector/generated/ExportModelTests.java b/sdk/cognitiveservices/azure-cognitiveservices-multivariateanomalydetector/src/test/java/com/azure/cognitiveservices/multivariateanomalydetector/generated/ExportModelTests.java new file mode 100644 index 0000000000000..b7b4ce5275124 --- /dev/null +++ b/sdk/cognitiveservices/azure-cognitiveservices-multivariateanomalydetector/src/test/java/com/azure/cognitiveservices/multivariateanomalydetector/generated/ExportModelTests.java @@ -0,0 +1,23 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.cognitiveservices.multivariateanomalydetector.generated; + +import com.azure.core.http.rest.RequestOptions; +import com.azure.core.http.rest.Response; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + +public final class ExportModelTests extends AnomalyDetectorClientTestBase { + @Test + @Disabled + public void testExportModelTests() { + RequestOptions requestOptions = new RequestOptions(); + Response response = + anomalyDetectorClient.exportModelWithResponse("45aad126-aafd-11ea-b8fb-d89ef3400c5f", requestOptions); + Assertions.assertEquals(200, response.getStatusCode()); + Assertions.assertEquals("application/zip", response.getHeaders().get("content-type").getValue()); + } +} diff --git a/sdk/cognitiveservices/azure-cognitiveservices-multivariateanomalydetector/src/test/java/com/azure/cognitiveservices/multivariateanomalydetector/generated/GetDetectionResultTests.java b/sdk/cognitiveservices/azure-cognitiveservices-multivariateanomalydetector/src/test/java/com/azure/cognitiveservices/multivariateanomalydetector/generated/GetDetectionResultTests.java new file mode 100644 index 0000000000000..202e0d934d343 --- /dev/null +++ b/sdk/cognitiveservices/azure-cognitiveservices-multivariateanomalydetector/src/test/java/com/azure/cognitiveservices/multivariateanomalydetector/generated/GetDetectionResultTests.java @@ -0,0 +1,29 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.cognitiveservices.multivariateanomalydetector.generated; + +import com.azure.core.http.rest.RequestOptions; +import com.azure.core.http.rest.Response; +import com.azure.core.util.BinaryData; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + +public final class GetDetectionResultTests extends AnomalyDetectorClientTestBase { + @Test + @Disabled + public void testGetDetectionResultTests() { + RequestOptions requestOptions = new RequestOptions(); + Response response = + anomalyDetectorClient.getDetectionResultWithResponse( + "663884e6-b117-11ea-b3de-0242ac130004", requestOptions); + Assertions.assertEquals(200, response.getStatusCode()); + Assertions.assertEquals( + BinaryData.fromString( + "{\"resultId\":\"663884e6-b117-11ea-b3de-0242ac130004\",\"results\":[{\"errors\":[],\"timestamp\":\"2021-01-01T00:28:00Z\",\"value\":{\"isAnomaly\":false,\"score\":0.6928471326828003,\"severity\":0}},{\"timestamp\":\"2021-01-01T00:29:00Z\",\"value\":{\"interpretation\":[{\"contributionScore\":0.5371576215,\"correlationChanges\":{\"changedValues\":[0.1741322,0.1093203],\"changedVariables\":[\"variable_1\",\"variable_3\"]},\"variable\":\"variable_2\"},{\"contributionScore\":0.3324159383,\"correlationChanges\":{\"changedValues\":[0.1229392],\"changedVariables\":[\"variable_2\"]},\"variable\":\"variable_3\"},{\"contributionScore\":0.1304264402,\"correlationChanges\":{\"changedValues\":[],\"changedVariables\":[]},\"variable\":\"variable_1\"}],\"isAnomaly\":true,\"score\":0.9171165823936462,\"severity\":0.5337404608726501}}],\"summary\":{\"errors\":[],\"setupInfo\":{\"endTime\":\"2021-01-01T00:29:00Z\",\"source\":\"https://multiadsample.blob.core.windows.net/data/sample_data_2_1000.zip?sp=rl&st=2020-12-04T06:03:47Z&se=2022-12-05T06:03:00Z&sv=2019-12-12&sr=b&sig=AZTbvZ7fcp3MdqGY%2FvGHJXJjUgjS4DneCGl7U5omq5c%3D\",\"startTime\":\"2021-01-01T00:00:00Z\"},\"status\":\"READY\",\"variableStates\":[{\"effectiveCount\":30,\"endTime\":\"2021-01-01T00:29:00Z\",\"filledNARatio\":0,\"startTime\":\"2021-01-01T00:00:00Z\",\"variable\":\"variable_1\"},{\"effectiveCount\":30,\"endTime\":\"2021-01-01T00:29:00Z\",\"filledNARatio\":0,\"startTime\":\"2021-01-01T00:00:00Z\",\"variable\":\"variable_2\"},{\"effectiveCount\":30,\"endTime\":\"2021-01-01T00:29:00Z\",\"filledNARatio\":0,\"startTime\":\"2021-01-01T00:00:00Z\",\"variable\":\"variable_3\"}]}}") + .toObject(Object.class), + response.getValue().toObject(Object.class)); + } +} diff --git a/sdk/cognitiveservices/azure-cognitiveservices-multivariateanomalydetector/src/test/java/com/azure/cognitiveservices/multivariateanomalydetector/generated/GetMultivariateModelTests.java b/sdk/cognitiveservices/azure-cognitiveservices-multivariateanomalydetector/src/test/java/com/azure/cognitiveservices/multivariateanomalydetector/generated/GetMultivariateModelTests.java new file mode 100644 index 0000000000000..a287e6a7acf7d --- /dev/null +++ b/sdk/cognitiveservices/azure-cognitiveservices-multivariateanomalydetector/src/test/java/com/azure/cognitiveservices/multivariateanomalydetector/generated/GetMultivariateModelTests.java @@ -0,0 +1,29 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.cognitiveservices.multivariateanomalydetector.generated; + +import com.azure.core.http.rest.RequestOptions; +import com.azure.core.http.rest.Response; +import com.azure.core.util.BinaryData; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + +public final class GetMultivariateModelTests extends AnomalyDetectorClientTestBase { + @Test + @Disabled + public void testGetMultivariateModelTests() { + RequestOptions requestOptions = new RequestOptions(); + Response response = + anomalyDetectorClient.getMultivariateModelWithResponse( + "45aad126-aafd-11ea-b8fb-d89ef3400c5f", requestOptions); + Assertions.assertEquals(200, response.getStatusCode()); + Assertions.assertEquals( + BinaryData.fromString( + "{\"createdTime\":\"2020-06-30T00:00:00Z\",\"lastUpdatedTime\":\"2020-06-30T00:00:00Z\",\"modelId\":\"45aad126-aafd-11ea-b8fb-d89ef3400c5f\",\"modelInfo\":{\"alignPolicy\":{\"alignMode\":\"Outer\",\"fillNAMethod\":\"Linear\",\"paddingValue\":0},\"diagnosticsInfo\":{\"modelState\":{\"epochIds\":[10,20,30,40,50,60,70,80,90,100],\"latenciesInSeconds\":[0.3398594856262207,0.3659665584564209,0.37360644340515137,0.35134077072143555,0.33703041076660156,0.31876277923583984,0.32833099365234375,0.3503587245941162,0.3080024719238281,0.3327946662902832],\"trainLosses\":[0.6291328072547913,0.1671326905488968,0.12354248017072678,0.10259664058685303,0.09584927558898926,0.09069952368736267,0.08686016499996185,0.08603022992610931,0.08287354558706284,0.08235538005828857],\"validationLosses\":[1.9232804775238037,1.0645641088485718,0.6031560301780701,0.5302737951278687,0.46980252861976624,0.4395163357257843,0.41829314827919006,0.40579143166542053,0.405649870634079,0.38492488861083984]},\"variableStates\":[{\"effectiveCount\":1441,\"endTime\":\"2019-04-02T00:00:00Z\",\"filledNARatio\":0,\"startTime\":\"2019-04-01T00:00:00Z\",\"variable\":\"ad_input\"},{\"effectiveCount\":1441,\"endTime\":\"2019-04-02T00:00:00Z\",\"filledNARatio\":0,\"startTime\":\"2019-04-01T00:00:00Z\",\"variable\":\"ad_ontimer_output\"},{\"effectiveCount\":1441,\"endTime\":\"2019-04-02T00:00:00Z\",\"filledNARatio\":0,\"startTime\":\"2019-04-01T00:00:00Z\",\"variable\":\"ingestion\"},{\"effectiveCount\":1441,\"endTime\":\"2019-04-02T00:00:00Z\",\"filledNARatio\":0,\"startTime\":\"2019-04-01T00:00:00Z\",\"variable\":\"data_in_speed\"},{\"effectiveCount\":1441,\"endTime\":\"2019-04-02T00:00:00Z\",\"filledNARatio\":0,\"startTime\":\"2019-04-01T00:00:00Z\",\"variable\":\"cpu\"},{\"effectiveCount\":1441,\"endTime\":\"2019-04-02T00:00:00Z\",\"filledNARatio\":0,\"startTime\":\"2019-04-01T00:00:00Z\",\"variable\":\"ad_series_init\"},{\"effectiveCount\":1441,\"endTime\":\"2019-04-02T00:00:00Z\",\"filledNARatio\":0,\"startTime\":\"2019-04-01T00:00:00Z\",\"variable\":\"flink_last_ckpt_duration\"},{\"effectiveCount\":1441,\"endTime\":\"2019-04-02T00:00:00Z\",\"filledNARatio\":0,\"startTime\":\"2019-04-01T00:00:00Z\",\"variable\":\"data_out_speed\"},{\"effectiveCount\":1441,\"endTime\":\"2019-04-02T00:00:00Z\",\"filledNARatio\":0,\"startTime\":\"2019-04-01T00:00:00Z\",\"variable\":\"ad_output\"}]},\"displayName\":\"Devops-MultiAD\",\"endTime\":\"2019-04-02T00:00:00Z\",\"errors\":[],\"slidingWindow\":20,\"source\":\"https://multiadsample.blob.core.windows.net/data/sample_data_2_1000.zip?sp=rl&st=2020-12-04T06:03:47Z&se=2022-12-05T06:03:00Z&sv=2019-12-12&sr=b&sig=AZTbvZ7fcp3MdqGY%2FvGHJXJjUgjS4DneCGl7U5omq5c%3D\",\"startTime\":\"2019-04-01T00:00:00Z\",\"status\":\"READY\"}}") + .toObject(Object.class), + response.getValue().toObject(Object.class)); + } +} diff --git a/sdk/cognitiveservices/azure-cognitiveservices-multivariateanomalydetector/src/test/java/com/azure/cognitiveservices/multivariateanomalydetector/generated/ListMultivariateModelTests.java b/sdk/cognitiveservices/azure-cognitiveservices-multivariateanomalydetector/src/test/java/com/azure/cognitiveservices/multivariateanomalydetector/generated/ListMultivariateModelTests.java new file mode 100644 index 0000000000000..bef2ed90e2675 --- /dev/null +++ b/sdk/cognitiveservices/azure-cognitiveservices-multivariateanomalydetector/src/test/java/com/azure/cognitiveservices/multivariateanomalydetector/generated/ListMultivariateModelTests.java @@ -0,0 +1,27 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.cognitiveservices.multivariateanomalydetector.generated; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.RequestOptions; +import com.azure.core.util.BinaryData; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + +public final class ListMultivariateModelTests extends AnomalyDetectorClientTestBase { + @Test + @Disabled + public void testListMultivariateModelTests() { + RequestOptions requestOptions = new RequestOptions(); + PagedIterable response = anomalyDetectorClient.listMultivariateModel(requestOptions); + Assertions.assertEquals(200, response.iterableByPage().iterator().next().getStatusCode()); + Assertions.assertEquals( + BinaryData.fromString( + "{\"createdTime\":\"2020-06-30T00:00:00Z\",\"displayName\":\"DevOps-MultiAD\",\"lastUpdatedTime\":\"2020-06-30T00:00:00Z\",\"modelId\":\"45aad126-aafd-11ea-b8fb-d89ef3400c5f\",\"status\":\"READY\",\"variablesCount\":18}") + .toObject(Object.class), + response.iterator().next().toObject(Object.class)); + } +} diff --git a/sdk/cognitiveservices/azure-cognitiveservices-multivariateanomalydetector/src/test/java/com/azure/cognitiveservices/multivariateanomalydetector/generated/TrainMultivariateModelTests.java b/sdk/cognitiveservices/azure-cognitiveservices-multivariateanomalydetector/src/test/java/com/azure/cognitiveservices/multivariateanomalydetector/generated/TrainMultivariateModelTests.java new file mode 100644 index 0000000000000..c5e8dbfdfdc15 --- /dev/null +++ b/sdk/cognitiveservices/azure-cognitiveservices-multivariateanomalydetector/src/test/java/com/azure/cognitiveservices/multivariateanomalydetector/generated/TrainMultivariateModelTests.java @@ -0,0 +1,28 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.cognitiveservices.multivariateanomalydetector.generated; + +import com.azure.core.http.rest.RequestOptions; +import com.azure.core.http.rest.Response; +import com.azure.core.util.BinaryData; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + +public final class TrainMultivariateModelTests extends AnomalyDetectorClientTestBase { + @Test + @Disabled + public void testTrainMultivariateModelTests() { + BinaryData body = + BinaryData.fromString( + "{\"alignPolicy\":{\"alignMode\":\"Outer\",\"fillNAMethod\":\"Linear\",\"paddingValue\":0},\"displayName\":\"Devops-MultiAD\",\"endTime\":\"2019-04-02T00:00:00Z\",\"slidingWindow\":20,\"source\":\"https://multiadsample.blob.core.windows.net/data/sample_data_2_1000.zip?sp=rl&st=2020-12-04T06:03:47Z&se=2022-12-05T06:03:00Z&sv=2019-12-12&sr=b&sig=AZTbvZ7fcp3MdqGY%2FvGHJXJjUgjS4DneCGl7U5omq5c%3D\",\"startTime\":\"2019-04-01T00:00:00Z\"}"); + RequestOptions requestOptions = new RequestOptions(); + Response response = anomalyDetectorClient.trainMultivariateModelWithResponse(body, requestOptions); + Assertions.assertEquals(201, response.getStatusCode()); + Assertions.assertEquals( + "{Endpoint}/anomalydetector/v1.1-preview/multivariate/models/{modelId}", + response.getHeaders().get("Location").getValue()); + } +} diff --git a/sdk/cognitiveservices/azure-cognitiveservices-multivariateanomalydetector/swagger/README_SPEC.md b/sdk/cognitiveservices/azure-cognitiveservices-multivariateanomalydetector/swagger/README_SPEC.md new file mode 100644 index 0000000000000..69624d4f3e6a8 --- /dev/null +++ b/sdk/cognitiveservices/azure-cognitiveservices-multivariateanomalydetector/swagger/README_SPEC.md @@ -0,0 +1,30 @@ +## Generate autorest code + +```yaml +input-file: +- /mnt/vss/_work/1/s/azure-rest-api-specs/specification/cognitiveservices/data-plane/AnomalyDetector/preview/v1.1-preview.2/MultivariateAnomalyDetector.json +output-folder: ../ +java: true +regenerate-pom: false +partial-update: true +model-override-setter-from-superclass: true +use-default-http-status-code-to-exception-type-mapping: true +generate-sync-async-clients: true +generate-client-as-impl: true +models-subpackage: implementation.models +generate-client-interfaces: false +generate-builder-per-client: true +add-context-parameter: true +generate-tests: true +artifact-id: azure-cognitiveservices-multivariateanomalydetector +low-level-client: true +sync-methods: all +generate-samples: true +license-header: MICROSOFT_MIT_SMALL +client-logger: true +namespace: com.azure.cognitiveservices.multivariateanomalydetector +context-client-method-parameter: true +azure-arm: false +service-versions: +- 1.1-preview.2 +``` diff --git a/sdk/cognitiveservices/ci.yml b/sdk/cognitiveservices/ci.yml index ffe9c95283586..f0c92733bd46f 100644 --- a/sdk/cognitiveservices/ci.yml +++ b/sdk/cognitiveservices/ci.yml @@ -113,3 +113,12 @@ extends: - name: azure-resourcemanager-cognitiveservices groupId: com.azure.resourcemanager safeName: azureresourcemanagercognitiveservices + - name: azure-cognitiveservices-anomalydetector + groupId: com.azure + safeName: azurecognitiveservicesanomalydetector + - name: azure-cognitiveservices-multivariateanomalydetector + groupId: com.azure + safeName: azurecognitiveservicesmultivariateanomalydetector + - name: azure-cognitiveservices-rootcauseanalysis + groupId: com.azure + safeName: azurecognitiveservicesrootcauseanalysis diff --git a/sdk/cognitiveservices/pom.xml b/sdk/cognitiveservices/pom.xml index 9cde2baccaeac..9180b58fd0f9e 100644 --- a/sdk/cognitiveservices/pom.xml +++ b/sdk/cognitiveservices/pom.xml @@ -37,6 +37,9 @@ true + azure-cognitiveservices-anomalydetector + azure-cognitiveservices-multivariateanomalydetector + azure-cognitiveservices-rootcauseanalysis azure-resourcemanager-cognitiveservices ms-azure-cs-autosuggest ms-azure-cs-computervision