diff --git a/sdk/cognitiveservices/azure-cognitiveservices-MultivariateAnomalyDetector/CHANGELOG.md b/sdk/cognitiveservices/azure-cognitiveservices-MultivariateAnomalyDetector/CHANGELOG.md new file mode 100644 index 000000000000..5350cdc0924f --- /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 000000000000..5f5d6459447b --- /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 000000000000..50ff51fdcdf9 --- /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.24.1 + + + com.azure + azure-core-http-netty + 1.11.6 + + + org.junit.jupiter + junit-jupiter-engine + 5.8.2 + test + + + com.azure + azure-core-test + 1.7.7 + test + + + com.azure + azure-identity + 1.4.3 + 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 000000000000..91441fb18f82 --- /dev/null +++ b/sdk/cognitiveservices/azure-cognitiveservices-MultivariateAnomalyDetector/src/main/java/com/azure/cognitiveservices/multivariateanomalydetector/AnomalyDetectorAsyncClient.java @@ -0,0 +1,422 @@ +// 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.HttpResponseException; +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 AnomalyDetectorClient client. + * + * @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. + * @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. + * @return response of listing models. + */ + @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. + * @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. + * @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. + * @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. + * @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. + * @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. + * @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 000000000000..aee43d5f1066 --- /dev/null +++ b/sdk/cognitiveservices/azure-cognitiveservices-MultivariateAnomalyDetector/src/main/java/com/azure/cognitiveservices/multivariateanomalydetector/AnomalyDetectorClient.java @@ -0,0 +1,420 @@ +// 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.HttpResponseException; +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 AnomalyDetectorClientImpl serviceClient; + + /** + * Initializes an instance of AnomalyDetectorClient client. + * + * @param serviceClient the service client implementation. + */ + @Generated + AnomalyDetectorClient(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. + * @return the {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response trainMultivariateModelWithResponse(BinaryData body, RequestOptions requestOptions) { + return this.serviceClient.trainMultivariateModelWithResponse(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. + * @return response of listing models. + */ + @Generated + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listMultivariateModel(RequestOptions requestOptions) { + return this.serviceClient.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. + * @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.serviceClient.getMultivariateModelWithResponse(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. + * @return the {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response deleteMultivariateModelWithResponse(String modelId, RequestOptions requestOptions) { + return this.serviceClient.deleteMultivariateModelWithResponse(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. + * @return the {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response detectAnomalyWithResponse(String modelId, BinaryData body, RequestOptions requestOptions) { + return this.serviceClient.detectAnomalyWithResponse(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. + * @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.serviceClient.getDetectionResultWithResponse(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. + * @return the {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response exportModelWithResponse(String modelId, RequestOptions requestOptions) { + return this.serviceClient.exportModelWithResponse(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. + * @return the response body along with {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response lastDetectAnomalyWithResponse( + String modelId, BinaryData body, RequestOptions requestOptions) { + return this.serviceClient.lastDetectAnomalyWithResponse(modelId, body, requestOptions); + } +} 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 000000000000..bedefc1ec9c1 --- /dev/null +++ b/sdk/cognitiveservices/azure-cognitiveservices-MultivariateAnomalyDetector/src/main/java/com/azure/cognitiveservices/multivariateanomalydetector/AnomalyDetectorClientBuilder.java @@ -0,0 +1,311 @@ +// 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.credential.TokenCredential; +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.BearerTokenAuthenticationPolicy; +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 static final String[] DEFAULT_SCOPES = new String[] {"https://cognitiveservices.azure.com/.default"}; + + @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 TokenCredential used for authentication. + */ + @Generated private TokenCredential tokenCredential; + + /** + * Sets The TokenCredential used for authentication. + * + * @param tokenCredential the tokenCredential value. + * @return the AnomalyDetectorClientBuilder. + */ + @Generated + public AnomalyDetectorClientBuilder credential(TokenCredential tokenCredential) { + this.tokenCredential = tokenCredential; + 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()); + if (tokenCredential != null) { + policies.add(new BearerTokenAuthenticationPolicy(tokenCredential, DEFAULT_SCOPES)); + } + 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 async client. + * + * @return an instance of AnomalyDetectorAsyncClient. + */ + @Generated + public AnomalyDetectorAsyncClient buildAsyncClient() { + return new AnomalyDetectorAsyncClient(buildInnerClient()); + } + + /** + * Builds an instance of AnomalyDetectorClient sync client. + * + * @return an instance of AnomalyDetectorClient. + */ + @Generated + public AnomalyDetectorClient buildClient() { + return new AnomalyDetectorClient(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 000000000000..4330997e3c5f --- /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.1. */ + V1_1_PREVIEW_1("1.1-preview.1"); + + 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_1; + } +} 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 000000000000..789965ac3139 --- /dev/null +++ b/sdk/cognitiveservices/azure-cognitiveservices-MultivariateAnomalyDetector/src/main/java/com/azure/cognitiveservices/multivariateanomalydetector/implementation/AnomalyDetectorClientImpl.java @@ -0,0 +1,1684 @@ +// 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.exception.HttpResponseException; +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}) + Mono> trainMultivariateModel( + @HostParam("Endpoint") String endpoint, + @HostParam("ApiVersion") String apiVersion, + @BodyParam("application/json") BinaryData body, + RequestOptions requestOptions, + Context context); + + @Get("/multivariate/models") + @ExpectedResponses({200}) + Mono> listMultivariateModel( + @HostParam("Endpoint") String endpoint, + @HostParam("ApiVersion") String apiVersion, + RequestOptions requestOptions, + Context context); + + @Get("/multivariate/models/{modelId}") + @ExpectedResponses({200}) + Mono> getMultivariateModel( + @HostParam("Endpoint") String endpoint, + @HostParam("ApiVersion") String apiVersion, + @PathParam("modelId") String modelId, + RequestOptions requestOptions, + Context context); + + @Delete("/multivariate/models/{modelId}") + @ExpectedResponses({204}) + 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}) + 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}) + 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}) + 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}) + 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}) + 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. + * @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. + * @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. + * @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. + * @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. + * @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. + * @return response of listing models. + */ + @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. + * @return response of listing models. + */ + @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. + * @return response of listing models. + */ + @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. + * @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. + * @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. + * @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. + * @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. + * @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. + * @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. + * @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. + * @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. + * @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. + * @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. + * @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. + * @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. + * @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. + * @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. + * @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. + * @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. + * @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. + * @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. + * @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. + * @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/package-info.java b/sdk/cognitiveservices/azure-cognitiveservices-MultivariateAnomalyDetector/src/main/java/com/azure/cognitiveservices/multivariateanomalydetector/package-info.java new file mode 100644 index 000000000000..e5890231deb8 --- /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 000000000000..5f29c77adced --- /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 000000000000..ca812989b4f2 --- /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 000000000000..8a3cce23e526 --- /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/test/java/com/azure/cognitiveservices/multivariateanomalydetector/ClientTests.java b/sdk/cognitiveservices/azure-cognitiveservices-MultivariateAnomalyDetector/src/test/java/com/azure/cognitiveservices/multivariateanomalydetector/ClientTests.java new file mode 100644 index 000000000000..53e81565f030 --- /dev/null +++ b/sdk/cognitiveservices/azure-cognitiveservices-MultivariateAnomalyDetector/src/test/java/com/azure/cognitiveservices/multivariateanomalydetector/ClientTests.java @@ -0,0 +1,47 @@ +// 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.credential.AccessToken; +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.test.annotation.DoNotRecord; +import com.azure.core.util.Configuration; +import com.azure.identity.DefaultAzureCredentialBuilder; +import java.time.OffsetDateTime; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; +import reactor.core.publisher.Mono; + +public final class ClientTests extends TestBase { + private AnomalyDetectorClientBuilder builder; + + @BeforeEach + public void setup() { + builder = + new AnomalyDetectorClientBuilder() + .endpoint(Configuration.getGlobalConfiguration().get("ENDPOINT")) + .httpClient(HttpClient.createDefault()) + .httpLogOptions(new HttpLogOptions().setLogLevel(HttpLogDetailLevel.BODY_AND_HEADERS)); + if (getTestMode() == TestMode.PLAYBACK) { + builder.httpClient(interceptorManager.getPlaybackClient()) + .credential(request -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX))); + } else if (getTestMode() == TestMode.RECORD) { + builder.addPolicy(interceptorManager.getRecordPolicy()) + .credential(new DefaultAzureCredentialBuilder().build()); + } else if (getTestMode() == TestMode.LIVE) { + builder.credential(new DefaultAzureCredentialBuilder().build()); + } + } + + @Test + @DoNotRecord(skipInPlayback = true) + public void testClient() { + // use the builder to create client + } +} 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 000000000000..c77f15caeadc --- /dev/null +++ b/sdk/cognitiveservices/azure-cognitiveservices-MultivariateAnomalyDetector/swagger/README_SPEC.md @@ -0,0 +1,26 @@ +## Generate autorest code + +```yaml +input-file: + - /home/vsts/work/1/s/azure-rest-api-specs/specification/cognitiveservices/data-plane/AnomalyDetector/preview/v1.1-preview.1/MultivariateAnomalyDetector.json +java: true +output-folder: ../ +partial-update: true +regenerate-pom: false +generate-sync-async-clients: true +generate-client-as-impl: true +generate-client-interfaces: false +add-context-parameter: true +artifact-id: azure-cognitiveservices-MultivariateAnomalyDetector +low-level-client: true +sync-methods: all +generate-samples: true +license-header: MICROSOFT_MIT_SMALL +namespace: com.azure.cognitiveservices.MultivariateAnomalyDetector +context-client-method-parameter: true +azure-arm: false +credential-types: tokencredential +credential-scopes: https://cognitiveservices.azure.com/.default +service-versions: + - '1.1-preview.1' +```