diff --git a/sdk/metricsadvisor/azure-ai-metricsadvisor-perf/src/main/java/com/azure/ai/metricsadvisor/perf/AnomaliesListTest.java b/sdk/metricsadvisor/azure-ai-metricsadvisor-perf/src/main/java/com/azure/ai/metricsadvisor/perf/AnomaliesListTest.java
index 0115262eb776a..0fc2f72629e22 100644
--- a/sdk/metricsadvisor/azure-ai-metricsadvisor-perf/src/main/java/com/azure/ai/metricsadvisor/perf/AnomaliesListTest.java
+++ b/sdk/metricsadvisor/azure-ai-metricsadvisor-perf/src/main/java/com/azure/ai/metricsadvisor/perf/AnomaliesListTest.java
@@ -25,7 +25,7 @@ public AnomaliesListTest(PerfStressOptions options) {
@Override
public void run() {
super.metricsAdvisorClient
- .listAnomaliesForAlert(super.alertConfigId,
+ .listAnomalies(super.alertConfigId,
super.alertId,
new ListAnomaliesAlertedOptions(),
Context.NONE)
@@ -38,7 +38,7 @@ public void run() {
@Override
public Mono runAsync() {
return super.metricsAdvisorAsyncClient
- .listAnomaliesForAlert(super.alertConfigId,
+ .listAnomalies(super.alertConfigId,
super.alertId,
new ListAnomaliesAlertedOptions())
.take(super.maxListElements)
diff --git a/sdk/metricsadvisor/azure-ai-metricsadvisor-perf/src/main/java/com/azure/ai/metricsadvisor/perf/IncidentsListTest.java b/sdk/metricsadvisor/azure-ai-metricsadvisor-perf/src/main/java/com/azure/ai/metricsadvisor/perf/IncidentsListTest.java
index c7f0b7369b577..0c2395636c5b4 100644
--- a/sdk/metricsadvisor/azure-ai-metricsadvisor-perf/src/main/java/com/azure/ai/metricsadvisor/perf/IncidentsListTest.java
+++ b/sdk/metricsadvisor/azure-ai-metricsadvisor-perf/src/main/java/com/azure/ai/metricsadvisor/perf/IncidentsListTest.java
@@ -3,7 +3,6 @@
package com.azure.ai.metricsadvisor.perf;
-import com.azure.ai.metricsadvisor.models.ListIncidentsAlertedOptions;
import com.azure.ai.metricsadvisor.perf.core.ServiceTest;
import com.azure.perf.test.core.PerfStressOptions;
import reactor.core.publisher.Mono;
@@ -24,9 +23,8 @@ public IncidentsListTest(PerfStressOptions options) {
@Override
public void run() {
super.metricsAdvisorClient
- .listIncidentsForAlert(super.alertConfigId,
- super.alertId,
- new ListIncidentsAlertedOptions())
+ .listIncidents(super.alertConfigId,
+ super.alertId)
.stream()
.limit(super.maxListElements)
.forEach(incident -> {
@@ -36,9 +34,8 @@ public void run() {
@Override
public Mono runAsync() {
return super.metricsAdvisorAsyncClient
- .listIncidentsForAlert(super.alertConfigId,
- super.alertId,
- new ListIncidentsAlertedOptions())
+ .listIncidents(super.alertConfigId,
+ super.alertId)
.take(super.maxListElements)
.then();
}
diff --git a/sdk/metricsadvisor/azure-ai-metricsadvisor/CHANGELOG.md b/sdk/metricsadvisor/azure-ai-metricsadvisor/CHANGELOG.md
index a9e105181d07f..70a0a0e8ab0c7 100644
--- a/sdk/metricsadvisor/azure-ai-metricsadvisor/CHANGELOG.md
+++ b/sdk/metricsadvisor/azure-ai-metricsadvisor/CHANGELOG.md
@@ -3,11 +3,18 @@
## 1.0.0-beta.4 (Unreleased)
### Features added
-- Added support for Azure Log Analytics DataFeed source.
+- Added support for Azure Log Analytics DataFeed source
+- Added data source credential API support to client
+- Added authentication type support for data feed
+- Added property `splitAlertByDimensions` to AnomalyAlertConfiguration model
### Breaking changes
+- Replaced updateSubscriptionKey and updateApiKey into one method updateKey
+- Deprecated support for HttpRequestDataFeed and ElasticsearchDataFeed source type
+- Renamed `value` and `expectedValue` to `valueOfRootNode` and `expectedValueOfRootNode`
- Renamed `top` parameter to `maxPageSize`
-
+- Removed granularity type DataFeedGranularityType.PerSecond as it's not supported by the service anymore.
+
## 1.0.0-beta.3 (2021-02-09)
- Support Azure Active Directory (AAD) authentication for Metrics Advisor clients.
- Renamed method `listDimensionValuesWithAnomalies` and `ListDimensionValuesWithAnomaliesOptions`.
@@ -32,7 +39,9 @@
- Renamed Data feed ingestion granularity type to `"PerMinute"` and `"PerSecond"` instead of `"Minutely"` and `"Secondly"`.
- Renamed Feedback api's from `createMetricFeedback`, `getMetricFeedback` and `listMetricFeedbacks`
to `addFeedback`, `getFeedback` and `listFeedback` respectively.
-
+- Removed `getSubscriptionKey` and `getApiKey` from `MetricsAdvisorKeyCredential` and introduced `MetricsAdvisorKeys`.
+- Renamed model `ErrorCode` to `MetricsAdvisorError` and `ErrorCodeException`
+to `MetricsAdvisorResponseException`
## 1.0.0-beta.1 (2020-10-07)
Version 1.0.0-beta.1 is a preview of our efforts in creating a Azure Metrics Advisor client library that is developer-friendly
and idiomatic to the Java ecosystem. The principles that guide
diff --git a/sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/MetricsAdvisorAsyncClient.java b/sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/MetricsAdvisorAsyncClient.java
index 24dc394539fa2..c63acc3e317e8 100644
--- a/sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/MetricsAdvisorAsyncClient.java
+++ b/sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/MetricsAdvisorAsyncClient.java
@@ -41,7 +41,7 @@
import com.azure.ai.metricsadvisor.models.DataPointAnomaly;
import com.azure.ai.metricsadvisor.models.DimensionKey;
import com.azure.ai.metricsadvisor.models.EnrichmentStatus;
-import com.azure.ai.metricsadvisor.models.ErrorCodeException;
+import com.azure.ai.metricsadvisor.models.MetricsAdvisorResponseException;
import com.azure.ai.metricsadvisor.models.IncidentRootCause;
import com.azure.ai.metricsadvisor.models.ListAlertOptions;
import com.azure.ai.metricsadvisor.models.ListAnomaliesAlertedOptions;
@@ -61,7 +61,6 @@
import com.azure.ai.metricsadvisor.models.MetricPeriodFeedback;
import com.azure.ai.metricsadvisor.models.MetricSeriesData;
import com.azure.ai.metricsadvisor.models.MetricSeriesDefinition;
-import com.azure.ai.metricsadvisor.models.MetricsAdvisorServiceVersion;
import com.azure.core.annotation.ReturnType;
import com.azure.core.annotation.ServiceClient;
import com.azure.core.annotation.ServiceMethod;
@@ -99,7 +98,7 @@
* @see MetricsAdvisorClientBuilder
*/
@ServiceClient(builder = MetricsAdvisorClientBuilder.class, isAsync = true)
-public class MetricsAdvisorAsyncClient {
+public final class MetricsAdvisorAsyncClient {
private static final String METRICS_ADVISOR_TRACING_NAMESPACE_VALUE = "Microsoft.CognitiveServices";
final ClientLogger logger = new ClientLogger(MetricsAdvisorAsyncClient.class);
@@ -117,6 +116,28 @@ public class MetricsAdvisorAsyncClient {
this.service = service;
}
+ /**
+ * List series definition for a metric.
+ *
+ * Code sample
+ * {@codesnippet com.azure.ai.metricsadvisor.MetricsAdvisorAsyncClient.listMetricSeriesDefinitions#String-OffsetDateTime}
+ *
+ * @param metricId metric unique id.
+ * @param activeSince the start time for querying series ingested after this time.
+ *
+ * @return A {@link PagedFlux} of the {@link MetricSeriesDefinition metric series definitions}.
+ * @throws IllegalArgumentException thrown if {@code metricId} fail the UUID format validation.
+ * @throws MetricsAdvisorResponseException thrown if the request is rejected by server.
+ * @throws NullPointerException thrown if the {@code metricId} or {@code activeSince}
+ * is null.
+ */
+ @ServiceMethod(returns = ReturnType.COLLECTION)
+ public PagedFlux listMetricSeriesDefinitions(
+ String metricId,
+ OffsetDateTime activeSince) {
+ return listMetricSeriesDefinitions(metricId, activeSince, null);
+ }
+
/**
* List series definition for a metric.
*
@@ -129,7 +150,7 @@ public class MetricsAdvisorAsyncClient {
*
* @return A {@link PagedFlux} of the {@link MetricSeriesDefinition metric series definitions}.
* @throws IllegalArgumentException thrown if {@code metricId} fail the UUID format validation.
- * @throws ErrorCodeException thrown if the request is rejected by server.
+ * @throws MetricsAdvisorResponseException thrown if the request is rejected by server.
* @throws NullPointerException thrown if the {@code metricId} or {@code activeSince}
* is null.
*/
@@ -219,7 +240,7 @@ private Mono> listMetricSeriesDefinitionNe
*
* @return A {@link PagedFlux} of the {@link MetricSeriesData metric series data points}.
* @throws IllegalArgumentException thrown if {@code metricId} fail the UUID format validation.
- * @throws ErrorCodeException thrown if the request is rejected by server.
+ * @throws MetricsAdvisorResponseException thrown if the request is rejected by server.
* @throws NullPointerException thrown if the {@code metricId}, {@code startTime} or {@code endTime}
* is null.
*/
@@ -275,7 +296,7 @@ private Mono> listMetricSeriesDataInternal(Strin
*
* @return the {@link PagedFlux} of the dimension values for that metric.
* @throws IllegalArgumentException thrown if {@code metricId} fail the UUID format validation.
- * @throws ErrorCodeException thrown if the request is rejected by server.
+ * @throws MetricsAdvisorResponseException thrown if the request is rejected by server.
* @throws NullPointerException thrown if the {@code metricId} or {@code dimensionName} is null.
*/
@ServiceMethod(returns = ReturnType.COLLECTION)
@@ -297,7 +318,7 @@ public PagedFlux listMetricDimensionValues(
*
* @return the {@link PagedFlux} of the dimension values for that metric.
* @throws IllegalArgumentException thrown if {@code metricId} fail the UUID format validation.
- * @throws ErrorCodeException thrown if the request is rejected by server.
+ * @throws MetricsAdvisorResponseException thrown if the request is rejected by server.
* @throws NullPointerException thrown if the {@code metricId} or {@code dimensionName} is null.
*/
@ServiceMethod(returns = ReturnType.COLLECTION)
@@ -375,6 +396,29 @@ private Mono> listMetricDimensionValuesNextPageAsync(Strin
null));
}
+ /**
+ * List the enrichment status for a metric.
+ *
+ * Code sample
+ * {@codesnippet com.azure.ai.metricsadvisor.MetricsAdvisorAsyncClient.listMetricEnrichmentStatus#String-OffsetDateTime-OffsetDateTime}
+ *
+ * @param metricId metric unique id.
+ * @param startTime The start time for querying the time series data.
+ * @param endTime The end time for querying the time series data.
+ *
+ * @return the list of enrichment status's for the specified metric.
+ * @throws IllegalArgumentException thrown if {@code metricId} fail the UUID format validation.
+ * @throws MetricsAdvisorResponseException thrown if the request is rejected by server.
+ * @throws NullPointerException thrown if {@code metricId}, {@code startTime} and {@code endTime}
+ * is null.
+ */
+ @ServiceMethod(returns = ReturnType.COLLECTION)
+ public PagedFlux listMetricEnrichmentStatus(
+ String metricId,
+ OffsetDateTime startTime, OffsetDateTime endTime) {
+ return listMetricEnrichmentStatus(metricId, startTime, endTime, null);
+ }
+
/**
* List the enrichment status for a metric.
*
@@ -388,7 +432,7 @@ private Mono> listMetricDimensionValuesNextPageAsync(Strin
*
* @return the list of enrichment status's for the specified metric.
* @throws IllegalArgumentException thrown if {@code metricId} fail the UUID format validation.
- * @throws ErrorCodeException thrown if the request is rejected by server.
+ * @throws MetricsAdvisorResponseException thrown if the request is rejected by server.
* @throws NullPointerException thrown if {@code metricId}, {@code startTime} and {@code endTime}
* is null.
*/
@@ -481,11 +525,11 @@ private Mono> listMetricEnrichmentStatusNextPage
* a detection configuration.
*
* Code sample
- * {@codesnippet com.azure.ai.metricsadvisor.MetricsAdvisorAsyncClient.listMetricEnrichedSeriesData#List-String-OffsetDateTime-OffsetDateTime}
+ * {@codesnippet com.azure.ai.metricsadvisor.MetricsAdvisorAsyncClient.listMetricEnrichedSeriesData#String-List-OffsetDateTime-OffsetDateTime}
*
- * @param seriesKeys The time series key list, each key identifies a specific time series.
* @param detectionConfigurationId The id of the configuration used to enrich the time series
* identified by the keys in {@code seriesKeys}.
+ * @param seriesKeys The time series key list, each key identifies a specific time series.
* @param startTime The start time of the time range within which the enriched data is returned.
* @param endTime The end time of the time range within which the enriched data is returned.
* @return The enriched time series.
@@ -495,31 +539,33 @@ private Mono> listMetricEnrichmentStatusNextPage
* or {@code startTime} or {@code endTime} is null.
*/
@ServiceMethod(returns = ReturnType.COLLECTION)
- public PagedFlux listMetricEnrichedSeriesData(List seriesKeys,
- String detectionConfigurationId,
+ public PagedFlux listMetricEnrichedSeriesData(String detectionConfigurationId,
+ List seriesKeys,
OffsetDateTime startTime,
OffsetDateTime endTime) {
try {
- return new PagedFlux<>(() -> withContext(context -> listMetricEnrichedSeriesDataInternal(seriesKeys,
- detectionConfigurationId, startTime, endTime, context)), null);
+ return new PagedFlux<>(() -> withContext(context -> listMetricEnrichedSeriesDataInternal(
+ detectionConfigurationId,
+ seriesKeys,
+ startTime, endTime, context)), null);
} catch (RuntimeException e) {
return new PagedFlux<>(() -> monoError(logger, e));
}
}
- PagedFlux listMetricEnrichedSeriesData(List seriesKeys,
- String detectionConfigurationId,
+ PagedFlux listMetricEnrichedSeriesData(String detectionConfigurationId,
+ List seriesKeys,
OffsetDateTime startTime,
OffsetDateTime endTime,
Context context) {
- return new PagedFlux<>(() -> listMetricEnrichedSeriesDataInternal(seriesKeys,
- detectionConfigurationId,
+ return new PagedFlux<>(() -> listMetricEnrichedSeriesDataInternal(detectionConfigurationId,
+ seriesKeys,
startTime, endTime, context), null);
}
private Mono>
- listMetricEnrichedSeriesDataInternal(List seriesKeys,
- String detectionConfigurationId,
+ listMetricEnrichedSeriesDataInternal(String detectionConfigurationId,
+ List seriesKeys,
OffsetDateTime startTime,
OffsetDateTime endTime,
Context context) {
@@ -564,7 +610,31 @@ PagedFlux listMetricEnrichedSeriesData(ListCode sample
- * {@codesnippet com.azure.ai.metricsadvisor.MetricsAdvisorAsyncClient.listAnomaliesForDetectionConfig#String-OffsetDateTime-OffsetDateTime-ListAnomaliesDetectedOptions}
+ * {@codesnippet com.azure.ai.metricsadvisor.MetricsAdvisorAsyncClient.listAnomalies#String-OffsetDateTime-OffsetDateTime}
+ *
+ * @param detectionConfigurationId The anomaly detection configuration id.
+ * @param startTime The start time of the time range within which the anomalies were detected.
+ * @param endTime The end time of the time range within which the anomalies were detected.
+ *
+ * @return The anomalies.
+ * @throws IllegalArgumentException thrown if {@code detectionConfigurationId} does not conform
+ * to the UUID format specification
+ * or {@code options.filter} is used to set severity but either min or max severity is missing.
+ * @throws NullPointerException thrown if the {@code detectionConfigurationId} or {@code options}
+ * or {@code startTime} or {@code endTime} is null.
+ */
+ @ServiceMethod(returns = ReturnType.COLLECTION)
+ public PagedFlux listAnomalies(
+ String detectionConfigurationId,
+ OffsetDateTime startTime, OffsetDateTime endTime) {
+ return listAnomalies(detectionConfigurationId, startTime, endTime, null);
+ }
+
+ /**
+ * Fetch the anomalies identified by an anomaly detection configuration.
+ *
+ * Code sample
+ * {@codesnippet com.azure.ai.metricsadvisor.MetricsAdvisorAsyncClient.listAnomalies#String-OffsetDateTime-OffsetDateTime-ListAnomaliesDetectedOptions}
*
* @param detectionConfigurationId The anomaly detection configuration id.
* @param startTime The start time of the time range within which the anomalies were detected.
@@ -579,7 +649,7 @@ PagedFlux listMetricEnrichedSeriesData(List listAnomaliesForDetectionConfig(
+ public PagedFlux listAnomalies(
String detectionConfigurationId,
OffsetDateTime startTime, OffsetDateTime endTime, ListAnomaliesDetectedOptions options) {
try {
@@ -595,7 +665,7 @@ public PagedFlux listAnomaliesForDetectionConfig(
}
}
- PagedFlux listAnomaliesForDetectionConfig(
+ PagedFlux listAnomalies(
String detectionConfigurationId,
OffsetDateTime startTime, OffsetDateTime endTime, ListAnomaliesDetectedOptions options, Context context) {
return new PagedFlux<>(() ->
@@ -683,7 +753,29 @@ private Mono> listAnomaliesForDetectionConfigNex
* Fetch the incidents identified by an anomaly detection configuration.
*
* Code sample
- * {@codesnippet com.azure.ai.metricsadvisor.MetricsAdvisorAsyncClient.listIncidentsForDetectionConfig#String-OffsetDateTime-OffsetDateTime-ListIncidentsDetectedOptions}
+ * {@codesnippet com.azure.ai.metricsadvisor.MetricsAdvisorAsyncClient.listIncidents#String-OffsetDateTime-OffsetDateTime}
+ *
+ * @param detectionConfigurationId The anomaly detection configuration id.
+ * @param startTime The start time of the time range within which the incidents were detected.
+ * @param endTime The end time of the time range within which the incidents were detected.
+ * @return The incidents.
+ * @throws IllegalArgumentException thrown if {@code detectionConfigurationId} does not conform
+ * to the UUID format specification.
+ * @throws NullPointerException thrown if the {@code detectionConfigurationId} or {@code options}
+ * or {@code startTime} or {@code endTime} is null.
+ */
+ @ServiceMethod(returns = ReturnType.COLLECTION)
+ public PagedFlux listIncidents(
+ String detectionConfigurationId,
+ OffsetDateTime startTime, OffsetDateTime endTime) {
+ return listIncidents(detectionConfigurationId, startTime, endTime, null);
+ }
+
+ /**
+ * Fetch the incidents identified by an anomaly detection configuration.
+ *
+ * Code sample
+ * {@codesnippet com.azure.ai.metricsadvisor.MetricsAdvisorAsyncClient.listIncidents#String-OffsetDateTime-OffsetDateTime-ListIncidentsDetectedOptions}
*
* @param detectionConfigurationId The anomaly detection configuration id.
* @param startTime The start time of the time range within which the incidents were detected.
@@ -696,7 +788,7 @@ private Mono> listAnomaliesForDetectionConfigNex
* or {@code startTime} or {@code endTime} is null.
*/
@ServiceMethod(returns = ReturnType.COLLECTION)
- public PagedFlux listIncidentsForDetectionConfig(
+ public PagedFlux listIncidents(
String detectionConfigurationId,
OffsetDateTime startTime, OffsetDateTime endTime, ListIncidentsDetectedOptions options) {
try {
@@ -713,7 +805,7 @@ public PagedFlux listIncidentsForDetectionConfig(
}
}
- PagedFlux listIncidentsForDetectionConfig(
+ PagedFlux listIncidents(
String detectionConfigurationId,
OffsetDateTime startTime, OffsetDateTime endTime, ListIncidentsDetectedOptions options, Context context) {
return new PagedFlux<>(() ->
@@ -788,7 +880,7 @@ private Mono> listIncidentsForDetectionConfigNext
*
* @return the list of root causes for that incident.
* @throws IllegalArgumentException thrown if {@code detectionConfigurationId} fail the UUID format validation.
- * @throws ErrorCodeException thrown if the request is rejected by server.
+ * @throws MetricsAdvisorResponseException thrown if the request is rejected by server.
* @throws NullPointerException thrown if the {@code detectionConfigurationId} or {@code incidentId} is null.
**/
@ServiceMethod(returns = ReturnType.COLLECTION)
@@ -831,7 +923,7 @@ PagedFlux listIncidentRootCauses(
*
* @return the list of root causes for that anomalyIncident.
* @throws IllegalArgumentException thrown if {@code detectionConfigurationId} fail the UUID format validation.
- * @throws ErrorCodeException thrown if the request is rejected by server.
+ * @throws MetricsAdvisorResponseException thrown if the request is rejected by server.
* @throws NullPointerException thrown if the {@code detectionConfigurationId} or {@code incidentId} is null.
**/
@ServiceMethod(returns = ReturnType.COLLECTION)
@@ -869,6 +961,30 @@ private Mono> listIncidentRootCausesInternal(An
.map(res -> IncidentRootCauseTransforms.fromInnerResponse(res));
}
+ /**
+ * Fetch dimension values that have anomalies.
+ *
+ * Code sample
+ * {@codesnippet com.azure.ai.metricsadvisor.MetricsAdvisorAsyncClient.listAnomalyDimensionValues#String-String-OffsetDateTime-OffsetDateTime}
+ *
+ * @param detectionConfigurationId Identifies the configuration used to detect the anomalies.
+ * @param dimensionName The dimension name to retrieve the values for.
+ * @param startTime The start time of the time range within which the anomalies were identified.
+ * @param endTime The end time of the time range within which the anomalies were identified.
+ * @return The dimension values with anomalies.
+ * @throws IllegalArgumentException thrown if {@code detectionConfigurationId} does not conform
+ * to the UUID format specification.
+ * @throws NullPointerException thrown if the {@code detectionConfigurationId} or {@code dimensionName}
+ * or {@code options} or {@code startTime} or {@code endTime} is null.
+ */
+ @ServiceMethod(returns = ReturnType.COLLECTION)
+ public PagedFlux listAnomalyDimensionValues(
+ String detectionConfigurationId,
+ String dimensionName,
+ OffsetDateTime startTime, OffsetDateTime endTime) {
+ return listAnomalyDimensionValues(detectionConfigurationId, dimensionName, startTime, endTime, null);
+ }
+
/**
* Fetch dimension values that have anomalies.
*
@@ -995,6 +1111,27 @@ private Mono> listAnomalyDimensionValuesNextPageAsync(
error));
}
+ /**
+ * Fetch the alerts triggered by an anomaly alert configuration.
+ *
+ * Code sample
+ * {@codesnippet com.azure.ai.metricsadvisor.MetricsAdvisorAsyncClient.listAlerts#String-OffsetDateTime-OffsetDateTime}
+ *
+ * @param alertConfigurationId The anomaly alert configuration id.
+ * @param startTime The start time of the time range within which the alerts were triggered.
+ * @param endTime The end time of the time range within which the alerts were triggered.
+ * @return The alerts.
+ * @throws IllegalArgumentException thrown if {@code alertConfigurationId} does not conform
+ * to the UUID format specification.
+ * @throws NullPointerException thrown if the {@code alertConfigurationId}
+ * or {@code startTime} or {@code endTime} is null.
+ */
+ @ServiceMethod(returns = ReturnType.COLLECTION)
+ public PagedFlux listAlerts(
+ String alertConfigurationId, OffsetDateTime startTime, OffsetDateTime endTime) {
+ return listAlerts(alertConfigurationId, startTime, endTime, null);
+ }
+
/**
* Fetch the alerts triggered by an anomaly alert configuration.
*
@@ -1093,7 +1230,7 @@ private Mono> listAlertsNextPageAsync(
* Fetch the anomalies in an alert.
*
* Code sample
- * {@codesnippet com.azure.ai.metricsadvisor.MetricsAdvisorAsyncClient.listAnomaliesForAlert#String-String}
+ * {@codesnippet com.azure.ai.metricsadvisor.MetricsAdvisorAsyncClient.listAnomalies#String-String}
*
* @param alertConfigurationId The anomaly alert configuration id.
* @param alertId The alert id.
@@ -1104,17 +1241,17 @@ private Mono> listAlertsNextPageAsync(
* @throws NullPointerException thrown if the {@code alertConfigurationId} or {@code alertId} is null.
*/
@ServiceMethod(returns = ReturnType.COLLECTION)
- public PagedFlux listAnomaliesForAlert(
+ public PagedFlux listAnomalies(
String alertConfigurationId,
String alertId) {
- return listAnomaliesForAlert(alertConfigurationId, alertId, null);
+ return listAnomalies(alertConfigurationId, alertId, null);
}
/**
* Fetch the anomalies in an alert.
*
* Code sample
- * {@codesnippet com.azure.ai.metricsadvisor.MetricsAdvisorAsyncClient.listAnomaliesForAlert#String-String-ListAnomaliesAlertedOptions}
+ * {@codesnippet com.azure.ai.metricsadvisor.MetricsAdvisorAsyncClient.listAnomalies#String-String-ListAnomaliesAlertedOptions}
*
* @param alertConfigurationId The anomaly alert configuration id.
* @param alertId The alert id.
@@ -1126,7 +1263,7 @@ public PagedFlux listAnomaliesForAlert(
* @throws NullPointerException thrown if the {@code alertConfigurationId} or {@code alertId} is null.
*/
@ServiceMethod(returns = ReturnType.COLLECTION)
- public PagedFlux listAnomaliesForAlert(
+ public PagedFlux listAnomalies(
String alertConfigurationId,
String alertId,
ListAnomaliesAlertedOptions options) {
@@ -1142,7 +1279,7 @@ public PagedFlux listAnomaliesForAlert(
}
}
- PagedFlux listAnomaliesForAlert(
+ PagedFlux listAnomalies(
String alertConfigurationId,
String alertId,
ListAnomaliesAlertedOptions options,
@@ -1192,11 +1329,32 @@ private Mono> listAnomaliesForAlertNextPageAsync
.map(response -> AnomalyTransforms.fromInnerPagedResponse(response));
}
+
+ /**
+ * Fetch the incidents in an alert.
+ *
+ * Code sample
+ * {@codesnippet com.azure.ai.metricsadvisor.MetricsAdvisorAsyncClient.listIncidents#String-String-ListIncidentsAlertedOptions}
+ *
+ * @param alertConfigurationId The anomaly alert configuration id.
+ * @param alertId The alert id.
+ * @return The incidents.
+ * @throws IllegalArgumentException thrown if {@code alertConfigurationId} or {@code alertId} does not
+ * conform to the UUID format specification.
+ * @throws NullPointerException thrown if the {@code alertConfigurationId} or {@code alertId} is null.
+ */
+ @ServiceMethod(returns = ReturnType.COLLECTION)
+ public PagedFlux listIncidents(
+ String alertConfigurationId,
+ String alertId) {
+ return listIncidents(alertConfigurationId, alertId, null);
+ }
+
/**
* Fetch the incidents in an alert.
*
* Code sample
- * {@codesnippet com.azure.ai.metricsadvisor.MetricsAdvisorAsyncClient.listIncidentsForAlert#String-String-ListIncidentsAlertedOptions}
+ * {@codesnippet com.azure.ai.metricsadvisor.MetricsAdvisorAsyncClient.listIncidents#String-String-ListIncidentsAlertedOptions}
*
* @param alertConfigurationId The anomaly alert configuration id.
* @param alertId The alert id.
@@ -1207,7 +1365,7 @@ private Mono> listAnomaliesForAlertNextPageAsync
* @throws NullPointerException thrown if the {@code alertConfigurationId} or {@code alertId} is null.
*/
@ServiceMethod(returns = ReturnType.COLLECTION)
- public PagedFlux listIncidentsForAlert(
+ public PagedFlux listIncidents(
String alertConfigurationId,
String alertId,
ListIncidentsAlertedOptions options) {
@@ -1223,7 +1381,7 @@ public PagedFlux listIncidentsForAlert(
}
}
- PagedFlux listIncidentsForAlert(
+ PagedFlux listIncidents(
String alertConfigurationId,
String alertId,
ListIncidentsAlertedOptions options, Context context) {
@@ -1273,7 +1431,7 @@ private Mono> listIncidentsForAlertNextPageAsync(
* Create a new metric feedback.
*
* Code sample
- * {@codesnippet com.azure.ai.metricsadvisor.MetricsAdvisorAsyncClient.addFeeddback#String-MetricFeedback}
+ * {@codesnippet com.azure.ai.metricsadvisor.MetricsAdvisorAsyncClient.addFeedback#String-MetricFeedback}
*
* @param metricId the unique id for which the feedback needs to be submitted.
* @param metricFeedback the actual metric feedback.
@@ -1282,7 +1440,7 @@ private Mono> listIncidentsForAlertNextPageAsync(
* @throws NullPointerException If {@code metricId}, {@code metricFeedback.dimensionFilter} is null.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
- public Mono addFeeddback(String metricId, MetricFeedback metricFeedback) {
+ public Mono addFeedback(String metricId, MetricFeedback metricFeedback) {
return addFeedbackWithResponse(metricId, metricFeedback).flatMap(FluxUtil::toMono);
}
@@ -1448,7 +1606,7 @@ Mono> getFeedbackWithResponse(String feedbackId, Contex
* @return A {@link PagedFlux} containing information of all the {@link MetricFeedback metric feedbacks}
* in the account.
* @throws IllegalArgumentException thrown if {@code metricId} fail the UUID format validation.
- * @throws ErrorCodeException thrown if the request is rejected by server.
+ * @throws MetricsAdvisorResponseException thrown if the request is rejected by server.
* @throws NullPointerException thrown if the {@code metricId} is null.
*/
@ServiceMethod(returns = ReturnType.COLLECTION)
@@ -1469,7 +1627,7 @@ public PagedFlux listFeedback(String metricId) {
* @return A {@link PagedFlux} containing information of all the {@link MetricFeedback metric feedbacks} in
* the account.
* @throws IllegalArgumentException thrown if {@code metricId} fail the UUID format validation.
- * @throws ErrorCodeException thrown if the request is rejected by server.
+ * @throws MetricsAdvisorResponseException thrown if the request is rejected by server.
* @throws NullPointerException thrown if the {@code metricId} is null.
*/
@ServiceMethod(returns = ReturnType.COLLECTION)
diff --git a/sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/MetricsAdvisorClient.java b/sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/MetricsAdvisorClient.java
index ceab653f34b41..8dc26b07eb40d 100644
--- a/sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/MetricsAdvisorClient.java
+++ b/sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/MetricsAdvisorClient.java
@@ -9,7 +9,7 @@
import com.azure.ai.metricsadvisor.models.DataPointAnomaly;
import com.azure.ai.metricsadvisor.models.DimensionKey;
import com.azure.ai.metricsadvisor.models.EnrichmentStatus;
-import com.azure.ai.metricsadvisor.models.ErrorCodeException;
+import com.azure.ai.metricsadvisor.models.MetricsAdvisorResponseException;
import com.azure.ai.metricsadvisor.models.IncidentRootCause;
import com.azure.ai.metricsadvisor.models.ListAlertOptions;
import com.azure.ai.metricsadvisor.models.ListAnomaliesAlertedOptions;
@@ -44,7 +44,7 @@
* @see MetricsAdvisorClientBuilder
*/
@ServiceClient(builder = MetricsAdvisorClientBuilder.class)
-public class MetricsAdvisorClient {
+public final class MetricsAdvisorClient {
private final MetricsAdvisorAsyncClient client;
@@ -70,7 +70,7 @@ public class MetricsAdvisorClient {
* @param activeSince the start time for querying series ingested after this time.
* @return A {@link PagedIterable} of the {@link MetricSeriesDefinition metric series definitions}.
* @throws IllegalArgumentException thrown if {@code metricId} fail the UUID format validation.
- * @throws ErrorCodeException thrown if the request is rejected by server.
+ * @throws MetricsAdvisorResponseException thrown if the request is rejected by server.
* @throws NullPointerException thrown if the {@code metricId} or {@code activeSince}
* is null.
*/
@@ -93,7 +93,7 @@ public PagedIterable listMetricSeriesDefinitions(
*
* @return A {@link PagedIterable} of the {@link MetricSeriesDefinition metric series definitions}.
* @throws IllegalArgumentException thrown if {@code metricId} fail the UUID format validation.
- * @throws ErrorCodeException thrown if the request is rejected by server.
+ * @throws MetricsAdvisorResponseException thrown if the request is rejected by server.
* @throws NullPointerException thrown if the {@code metricId} or {@code activeSince}
* is null.
*/
@@ -169,7 +169,7 @@ public PagedIterable listMetricSeriesData(String metricId, Lis
* @param endTime The end time for querying the time series data.
* @return the list of enrichment status's for the specified metric.
* @throws IllegalArgumentException thrown if {@code metricId} fail the UUID format validation.
- * @throws ErrorCodeException thrown if the request is rejected by server.
+ * @throws MetricsAdvisorResponseException thrown if the request is rejected by server.
* @throws NullPointerException thrown if {@code metricId}, {@code startTime} and {@code endTime}
* is null.
*/
@@ -193,7 +193,7 @@ public PagedIterable listMetricEnrichmentStatus(
*
* @return the list of enrichment status's for the specified metric.
* @throws IllegalArgumentException thrown if {@code metricId} fail the UUID format validation.
- * @throws ErrorCodeException thrown if the request is rejected by server.
+ * @throws MetricsAdvisorResponseException thrown if the request is rejected by server.
* @throws NullPointerException thrown if {@code metricId}, {@code startTime} and {@code endTime}
* is null.
*/
@@ -210,11 +210,11 @@ public PagedIterable listMetricEnrichmentStatus(
* a detection configuration.
*
* Code sample
- * {@codesnippet com.azure.ai.metricsadvisor.MetricsAdvisorClient.listMetricEnrichedSeriesData#List-String-OffsetDateTime-OffsetDateTime}
+ * {@codesnippet com.azure.ai.metricsadvisor.MetricsAdvisorClient.listMetricEnrichedSeriesData#String-List-OffsetDateTime-OffsetDateTime}
*
- * @param seriesKeys The time series key list, each key identifies a specific time series.
* @param detectionConfigurationId The id of the configuration used to enrich the time series
* identified by the keys in {@code seriesKeys}.
+ * @param seriesKeys The time series key list, each key identifies a specific time series.
* @param startTime The start time.
* @param endTime The end time.
* @return The enriched time series.
@@ -224,12 +224,12 @@ public PagedIterable listMetricEnrichmentStatus(
* or {@code startTime} or {@code endTime} is null.
*/
@ServiceMethod(returns = ReturnType.COLLECTION)
- public PagedIterable listMetricEnrichedSeriesData(List seriesKeys,
- String detectionConfigurationId,
+ public PagedIterable listMetricEnrichedSeriesData(String detectionConfigurationId,
+ List seriesKeys,
OffsetDateTime startTime,
OffsetDateTime endTime) {
- return listMetricEnrichedSeriesData(seriesKeys,
- detectionConfigurationId,
+ return listMetricEnrichedSeriesData(detectionConfigurationId,
+ seriesKeys,
startTime,
endTime,
Context.NONE);
@@ -240,11 +240,11 @@ public PagedIterable listMetricEnrichedSeriesData(List
* a detection configuration.
*
* Code sample
- * {@codesnippet com.azure.ai.metricsadvisor.MetricsAdvisorClient.listMetricEnrichedSeriesData#List-String-OffsetDateTime-OffsetDateTime-Context}
+ * {@codesnippet com.azure.ai.metricsadvisor.MetricsAdvisorClient.listMetricEnrichedSeriesData#String-List-OffsetDateTime-OffsetDateTime-Context}
*
- * @param seriesKeys The time series key list, each key identifies a specific time series.
* @param detectionConfigurationId The id of the configuration used to enrich the time series
* identified by the keys in {@code seriesKeys}.
+ * @param seriesKeys The time series key list, each key identifies a specific time series.
* @param startTime The start time of the time range within which the enriched data is returned.
* @param endTime The end time of the time range within which the enriched data is returned.
* @param context Additional context that is passed through the Http pipeline during the service call.
@@ -256,13 +256,13 @@ public PagedIterable listMetricEnrichedSeriesData(List
*/
@ServiceMethod(returns = ReturnType.COLLECTION)
public PagedIterable listMetricEnrichedSeriesData(
- List seriesKeys,
String detectionConfigurationId,
+ List seriesKeys,
OffsetDateTime startTime,
OffsetDateTime endTime,
Context context) {
- return new PagedIterable<>(client.listMetricEnrichedSeriesData(seriesKeys,
- detectionConfigurationId,
+ return new PagedIterable<>(client.listMetricEnrichedSeriesData(detectionConfigurationId,
+ seriesKeys,
startTime,
endTime,
context == null ? Context.NONE : context));
@@ -272,7 +272,7 @@ public PagedIterable listMetricEnrichedSeriesData(
* Fetch the anomalies identified by an anomaly detection configuration.
*
* Code sample
- * {@codesnippet com.azure.ai.metricsadvisor.MetricsAdvisorClient.listAnomaliesForDetectionConfig#String-OffsetDateTime-OffsetDateTime}
+ * {@codesnippet com.azure.ai.metricsadvisor.MetricsAdvisorClient.listAnomalies#String-OffsetDateTime-OffsetDateTime}
*
* @param detectionConfigurationId The anomaly detection configuration id.
* @param startTime The start time of the time range within which the anomalies were detected.
@@ -285,16 +285,16 @@ public PagedIterable listMetricEnrichedSeriesData(
* {@code startTime} or {@code endTime} is null.
*/
@ServiceMethod(returns = ReturnType.COLLECTION)
- public PagedIterable listAnomaliesForDetectionConfig(
+ public PagedIterable listAnomalies(
String detectionConfigurationId, OffsetDateTime startTime, OffsetDateTime endTime) {
- return listAnomaliesForDetectionConfig(detectionConfigurationId, startTime, endTime, null, Context.NONE);
+ return listAnomalies(detectionConfigurationId, startTime, endTime, null, Context.NONE);
}
/**
* Fetch the anomalies identified by an anomaly detection configuration.
*
* Code sample
- * {@codesnippet com.azure.ai.metricsadvisor.MetricsAdvisorClient.listAnomaliesForDetectionConfig#String-OffsetDateTime-OffsetDateTime-ListAnomaliesDetectedOptions-Context}
+ * {@codesnippet com.azure.ai.metricsadvisor.MetricsAdvisorClient.listAnomalies#String-OffsetDateTime-OffsetDateTime-ListAnomaliesDetectedOptions-Context}
*
* @param detectionConfigurationId The anomaly detection configuration id.
* @param startTime The start time of the time range within which the anomalies were detected.
@@ -309,10 +309,10 @@ public PagedIterable listAnomaliesForDetectionConfig(
* {@code endTime} is null.
*/
@ServiceMethod(returns = ReturnType.COLLECTION)
- public PagedIterable listAnomaliesForDetectionConfig(
+ public PagedIterable listAnomalies(
String detectionConfigurationId,
OffsetDateTime startTime, OffsetDateTime endTime, ListAnomaliesDetectedOptions options, Context context) {
- return new PagedIterable<>(client.listAnomaliesForDetectionConfig(detectionConfigurationId,
+ return new PagedIterable<>(client.listAnomalies(detectionConfigurationId,
startTime,
endTime,
options,
@@ -323,7 +323,7 @@ public PagedIterable listAnomaliesForDetectionConfig(
* Fetch the incidents identified by an anomaly detection configuration.
*
* Code sample
- * {@codesnippet com.azure.ai.metricsadvisor.MetricsAdvisorClient.listIncidentsForDetectionConfig#String-OffsetDateTime-OffsetDateTime}
+ * {@codesnippet com.azure.ai.metricsadvisor.MetricsAdvisorClient.listIncidents#String-OffsetDateTime-OffsetDateTime}
*
* @param detectionConfigurationId The anomaly detection configuration id.
* @param startTime The start time of the time range within which the incidents were detected.
@@ -335,16 +335,16 @@ public PagedIterable listAnomaliesForDetectionConfig(
* or {@code startTime} or {@code endTime} is null.
*/
@ServiceMethod(returns = ReturnType.COLLECTION)
- public PagedIterable listIncidentsForDetectionConfig(
+ public PagedIterable listIncidents(
String detectionConfigurationId, OffsetDateTime startTime, OffsetDateTime endTime) {
- return listIncidentsForDetectionConfig(detectionConfigurationId, startTime, endTime, null, Context.NONE);
+ return listIncidents(detectionConfigurationId, startTime, endTime, null, Context.NONE);
}
/**
* Fetch the incidents identified by an anomaly detection configuration.
*
* Code sample
- * {@codesnippet com.azure.ai.metricsadvisor.MetricsAdvisorClient.listIncidentsForDetectionConfig#String-OffsetDateTime-OffsetDateTime-ListIncidentsDetectedOptions-Context}
+ * {@codesnippet com.azure.ai.metricsadvisor.MetricsAdvisorClient.listIncidents#String-OffsetDateTime-OffsetDateTime-ListIncidentsDetectedOptions-Context}
*
* @param detectionConfigurationId The anomaly detection configuration id.
* @param startTime The start time of the time range within which the incidents were detected.
@@ -358,10 +358,10 @@ public PagedIterable listIncidentsForDetectionConfig(
* {@code endTime} is null.
*/
@ServiceMethod(returns = ReturnType.COLLECTION)
- public PagedIterable listIncidentsForDetectionConfig(
+ public PagedIterable listIncidents(
String detectionConfigurationId,
OffsetDateTime startTime, OffsetDateTime endTime, ListIncidentsDetectedOptions options, Context context) {
- return new PagedIterable<>(client.listIncidentsForDetectionConfig(detectionConfigurationId,
+ return new PagedIterable<>(client.listIncidents(detectionConfigurationId,
startTime, endTime, options,
context == null ? Context.NONE : context));
}
@@ -377,7 +377,7 @@ public PagedIterable listIncidentsForDetectionConfig(
*
* @return the list of root causes for that incident.
* @throws IllegalArgumentException thrown if {@code detectionConfigurationId} fail the UUID format validation.
- * @throws ErrorCodeException thrown if the request is rejected by server.
+ * @throws MetricsAdvisorResponseException thrown if the request is rejected by server.
* @throws NullPointerException thrown if the {@code detectionConfigurationId} or {@code incidentId} is null.
**/
@ServiceMethod(returns = ReturnType.COLLECTION)
@@ -399,7 +399,7 @@ public PagedIterable listIncidentRootCauses(
*
* @return the list of root causes for that incident.
* @throws IllegalArgumentException thrown if {@code detectionConfigurationId} fail the UUID format validation.
- * @throws ErrorCodeException thrown if the request is rejected by server.
+ * @throws MetricsAdvisorResponseException thrown if the request is rejected by server.
* @throws NullPointerException thrown if the {@code detectionConfigurationId} or {@code incidentId} is null.
**/
@ServiceMethod(returns = ReturnType.COLLECTION)
@@ -419,7 +419,7 @@ public PagedIterable listIncidentRootCauses(
*
* @return the list of root causes for that anomalyIncident.
* @throws IllegalArgumentException thrown if {@code detectionConfigurationId} fail the UUID format validation.
- * @throws ErrorCodeException thrown if the request is rejected by server.
+ * @throws MetricsAdvisorResponseException thrown if the request is rejected by server.
* @throws NullPointerException thrown if the {@code detectionConfigurationId} or {@code incidentId} is null.
**/
@ServiceMethod(returns = ReturnType.COLLECTION)
@@ -531,7 +531,7 @@ public PagedIterable listAlerts(
* Fetch the anomalies in an alert.
*
* Code sample
- * {@codesnippet com.azure.ai.metricsadvisor.MetricsAdvisorClient.listAnomaliesForAlert#String-String}
+ * {@codesnippet com.azure.ai.metricsadvisor.MetricsAdvisorClient.listAnomalies#String-String}
*
* @param alertConfigurationId The anomaly alert configuration id.
* @param alertId The alert id.
@@ -541,17 +541,17 @@ public PagedIterable listAlerts(
* @throws NullPointerException thrown if the {@code alertConfigurationId} or {@code alertId} is null.
*/
@ServiceMethod(returns = ReturnType.COLLECTION)
- public PagedIterable listAnomaliesForAlert(
+ public PagedIterable listAnomalies(
String alertConfigurationId,
String alertId) {
- return listAnomaliesForAlert(alertConfigurationId, alertId, null, Context.NONE);
+ return listAnomalies(alertConfigurationId, alertId, null, Context.NONE);
}
/**
* Fetch the anomalies in an alert.
*
* Code sample
- * {@codesnippet com.azure.ai.metricsadvisor.MetricsAdvisorClient.listAnomaliesForAlert#String-String-ListAnomaliesAlertedOptions-Context}
+ * {@codesnippet com.azure.ai.metricsadvisor.MetricsAdvisorClient.listAnomalies#String-String-ListAnomaliesAlertedOptions-Context}
*
* @param alertConfigurationId The anomaly alert configuration id.
* @param alertId The alert id.
@@ -564,11 +564,11 @@ public PagedIterable listAnomaliesForAlert(
* @throws NullPointerException thrown if the {@code alertConfigurationId} or {@code alertId} is null.
*/
@ServiceMethod(returns = ReturnType.COLLECTION)
- public PagedIterable listAnomaliesForAlert(
+ public PagedIterable listAnomalies(
String alertConfigurationId,
String alertId,
ListAnomaliesAlertedOptions options, Context context) {
- return new PagedIterable<>(client.listAnomaliesForAlert(alertConfigurationId,
+ return new PagedIterable<>(client.listAnomalies(alertConfigurationId,
alertId,
options,
context == null ? Context.NONE : context));
@@ -578,11 +578,10 @@ public PagedIterable listAnomaliesForAlert(
* Fetch the incidents in an alert.
*
* Code sample
- * {@codesnippet com.azure.ai.metricsadvisor.MetricsAdvisorClient.listIncidentsForAlert#String-String-ListIncidentsAlertedOptions}
+ * {@codesnippet com.azure.ai.metricsadvisor.MetricsAdvisorClient.listIncidents#String-String-ListIncidentsAlertedOptions-Context}
*
* @param alertConfigurationId The anomaly alert configuration id.
* @param alertId The alert id.
- * @param options The additional parameters.
*
* @return The incidents.
* @throws IllegalArgumentException thrown if {@code alertConfigurationId} or {@code alertId} does not
@@ -590,18 +589,20 @@ public PagedIterable listAnomaliesForAlert(
* @throws NullPointerException thrown if the {@code alertConfigurationId} or {@code alertId} is null.
*/
@ServiceMethod(returns = ReturnType.COLLECTION)
- public PagedIterable listIncidentsForAlert(
+ public PagedIterable listIncidents(
String alertConfigurationId,
- String alertId,
- ListIncidentsAlertedOptions options) {
- return listIncidentsForAlert(alertConfigurationId, alertId, options, Context.NONE);
+ String alertId) {
+ return this.listIncidents(alertConfigurationId,
+ alertId,
+ null,
+ Context.NONE);
}
/**
* Fetch the incidents in an alert.
*
* Code sample
- * {@codesnippet com.azure.ai.metricsadvisor.MetricsAdvisorClient.listIncidentsForAlert#String-String-ListIncidentsAlertedOptions-Context}
+ * {@codesnippet com.azure.ai.metricsadvisor.MetricsAdvisorClient.listIncidents#String-String-ListIncidentsAlertedOptions-Context}
*
* @param alertConfigurationId The anomaly alert configuration id.
* @param alertId The alert id.
@@ -614,11 +615,11 @@ public PagedIterable listIncidentsForAlert(
* @throws NullPointerException thrown if the {@code alertConfigurationId} or {@code alertId} is null.
*/
@ServiceMethod(returns = ReturnType.COLLECTION)
- public PagedIterable listIncidentsForAlert(
+ public PagedIterable listIncidents(
String alertConfigurationId,
String alertId,
ListIncidentsAlertedOptions options, Context context) {
- return new PagedIterable<>(client.listIncidentsForAlert(alertConfigurationId,
+ return new PagedIterable<>(client.listIncidents(alertConfigurationId,
alertId,
options,
context == null ? Context.NONE : context));
@@ -628,7 +629,7 @@ public PagedIterable listIncidentsForAlert(
* Create a new metric feedback.
*
* Code sample
- * {@codesnippet com.azure.ai.metricsadvisor.MetricsAdvisorClient.addFeeddback#String-MetricFeedback}
+ * {@codesnippet com.azure.ai.metricsadvisor.MetricsAdvisorClient.addFeedback#String-MetricFeedback}
*
* @param metricId the unique id for which the feedback needs to be submitted.
* @param metricFeedback the actual metric feedback.
@@ -638,7 +639,7 @@ public PagedIterable listIncidentsForAlert(
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public MetricFeedback addFeedback(String metricId, MetricFeedback metricFeedback) {
- return createMetricFeedbackWithResponse(metricId, metricFeedback, Context.NONE).getValue();
+ return addFeedbackWithResponse(metricId, metricFeedback, Context.NONE).getValue();
}
/**
@@ -655,8 +656,8 @@ public MetricFeedback addFeedback(String metricId, MetricFeedback metricFeedback
* @throws NullPointerException If {@code metricId}, {@code metricFeedback.dimensionFilter} is null.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
- public Response createMetricFeedbackWithResponse(String metricId, MetricFeedback metricFeedback,
- Context context) {
+ public Response addFeedbackWithResponse(String metricId, MetricFeedback metricFeedback,
+ Context context) {
return client.addFeedbackWithResponse(metricId, metricFeedback, context).block();
}
@@ -706,7 +707,7 @@ public Response getFeedbackWithResponse(String feedbackId, Conte
* @return A {@link PagedIterable} containing information of all the {@link MetricFeedback metric feedbacks}
* in the account.
* @throws IllegalArgumentException thrown if {@code metricId} fail the UUID format validation.
- * @throws ErrorCodeException thrown if the request is rejected by server.
+ * @throws MetricsAdvisorResponseException thrown if the request is rejected by server.
* @throws NullPointerException thrown if the {@code metricId} is null.
*/
@ServiceMethod(returns = ReturnType.COLLECTION)
@@ -729,7 +730,7 @@ public PagedIterable listFeedback(
* @return A {@link PagedIterable} containing information of all the {@link MetricFeedback metric feedbacks}
* in the account.
* @throws IllegalArgumentException thrown if {@code metricId} fail the UUID format validation.
- * @throws ErrorCodeException thrown if the request is rejected by server.
+ * @throws MetricsAdvisorResponseException thrown if the request is rejected by server.
* @throws NullPointerException thrown if the {@code metricId} is null.
*/
@ServiceMethod(returns = ReturnType.COLLECTION)
@@ -751,7 +752,7 @@ public PagedIterable listFeedback(
*
* @return the {@link PagedIterable} of the dimension values for that metric.
* @throws IllegalArgumentException thrown if {@code metricId} fail the UUID format validation.
- * @throws ErrorCodeException thrown if the request is rejected by server.
+ * @throws MetricsAdvisorResponseException thrown if the request is rejected by server.
* @throws NullPointerException thrown if the {@code metricId} or {@code dimensionName} is null.
*/
@ServiceMethod(returns = ReturnType.COLLECTION)
@@ -774,7 +775,7 @@ public PagedIterable listMetricDimensionValues(
*
* @return the {@link PagedIterable} of the dimension values for that metric.
* @throws IllegalArgumentException thrown if {@code metricId} fail the UUID format validation.
- * @throws ErrorCodeException thrown if the request is rejected by server.
+ * @throws MetricsAdvisorResponseException thrown if the request is rejected by server.
* @throws NullPointerException thrown if the {@code metricId} or {@code dimensionName} is null.
*/
@ServiceMethod(returns = ReturnType.COLLECTION)
diff --git a/sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/MetricsAdvisorClientBuilder.java b/sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/MetricsAdvisorClientBuilder.java
index 1d8c038c6820d..26b0b78252bd0 100644
--- a/sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/MetricsAdvisorClientBuilder.java
+++ b/sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/MetricsAdvisorClientBuilder.java
@@ -6,7 +6,6 @@
import com.azure.ai.metricsadvisor.implementation.AzureCognitiveServiceMetricsAdvisorRestAPIOpenAPIV2Impl;
import com.azure.ai.metricsadvisor.implementation.AzureCognitiveServiceMetricsAdvisorRestAPIOpenAPIV2ImplBuilder;
import com.azure.ai.metricsadvisor.models.MetricsAdvisorKeyCredential;
-import com.azure.ai.metricsadvisor.models.MetricsAdvisorServiceVersion;
import com.azure.core.annotation.ServiceClientBuilder;
import com.azure.core.credential.TokenCredential;
import com.azure.core.http.ContentType;
@@ -19,11 +18,13 @@
import com.azure.core.http.policy.BearerTokenAuthenticationPolicy;
import com.azure.core.http.policy.HttpLogDetailLevel;
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.RequestIdPolicy;
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.logging.ClientLogger;
@@ -79,6 +80,8 @@ public final class MetricsAdvisorClientBuilder {
private static final RetryPolicy DEFAULT_RETRY_POLICY = new RetryPolicy("retry-after-ms",
ChronoUnit.MILLIS);
private static final String DEFAULT_SCOPE = "https://cognitiveservices.azure.com/.default";
+ private static final HttpLogOptions DEFAULT_LOG_OPTIONS = new HttpLogOptions();
+ private static final ClientOptions DEFAULT_CLIENT_OPTIONS = new ClientOptions();
private final ClientLogger logger = new ClientLogger(MetricsAdvisorClientBuilder.class);
private final List policies;
@@ -91,6 +94,7 @@ public final class MetricsAdvisorClientBuilder {
private TokenCredential tokenCredential;
private HttpClient httpClient;
private HttpLogOptions httpLogOptions;
+ private ClientOptions clientOptions;
private HttpPipeline httpPipeline;
private Configuration configuration;
private RetryPolicy retryPolicy;
@@ -111,8 +115,8 @@ public MetricsAdvisorClientBuilder() {
clientVersion = properties.getOrDefault(VERSION, "UnknownVersion");
headers = new HttpHeaders()
- .put(ECHO_REQUEST_ID_HEADER, "true")
- .put(ACCEPT_HEADER, CONTENT_TYPE_HEADER_VALUE);
+ .set(ECHO_REQUEST_ID_HEADER, "true")
+ .set(ACCEPT_HEADER, CONTENT_TYPE_HEADER_VALUE);
}
/**
@@ -183,17 +187,21 @@ private HttpPipeline getDefaultHttpPipeline(Configuration buildConfiguration) {
// Authentications
if (tokenCredential != null) {
policies.add(new BearerTokenAuthenticationPolicy(tokenCredential, DEFAULT_SCOPE));
- } else if (!CoreUtils.isNullOrEmpty(metricsAdvisorKeyCredential.getSubscriptionKey())
- || !CoreUtils.isNullOrEmpty(metricsAdvisorKeyCredential.getApiKey())) {
- headers.put(OCP_APIM_SUBSCRIPTION_KEY, metricsAdvisorKeyCredential.getSubscriptionKey());
- headers.put(API_KEY, metricsAdvisorKeyCredential.getApiKey());
+ } else if (!CoreUtils.isNullOrEmpty(metricsAdvisorKeyCredential.getKeys().getSubscriptionKey())
+ || !CoreUtils.isNullOrEmpty(metricsAdvisorKeyCredential.getKeys().getApiKey())) {
+ headers.set(OCP_APIM_SUBSCRIPTION_KEY, metricsAdvisorKeyCredential.getKeys().getSubscriptionKey());
+ headers.set(API_KEY, metricsAdvisorKeyCredential.getKeys().getApiKey());
} else {
// Throw exception that credential cannot be null
throw logger.logExceptionAsError(
new IllegalArgumentException("Missing credential information while building a client."));
}
- policies.add(new UserAgentPolicy(httpLogOptions.getApplicationId(), clientName, clientVersion,
+ ClientOptions buildClientOptions = this.clientOptions == null ? DEFAULT_CLIENT_OPTIONS : this.clientOptions;
+ HttpLogOptions buildLogOptions = this.httpLogOptions == null ? DEFAULT_LOG_OPTIONS : this.httpLogOptions;
+ final String applicationId = CoreUtils.getApplicationId(buildClientOptions, buildLogOptions);
+
+ policies.add(new UserAgentPolicy(applicationId, clientName, clientVersion,
buildConfiguration));
policies.add(new RequestIdPolicy());
policies.add(new AddHeadersPolicy(headers));
@@ -201,6 +209,7 @@ private HttpPipeline getDefaultHttpPipeline(Configuration buildConfiguration) {
HttpPolicyProviders.addBeforeRetryPolicies(policies);
policies.add(retryPolicy == null ? DEFAULT_RETRY_POLICY : retryPolicy);
policies.add(new AddDatePolicy());
+ policies.add(new HttpLoggingPolicy(httpLogOptions));
policies.addAll(this.policies);
HttpPolicyProviders.addAfterRetryPolicies(policies);
@@ -280,6 +289,17 @@ public MetricsAdvisorClientBuilder httpLogOptions(HttpLogOptions logOptions) {
return this;
}
+ /**
+ * Sets the client options such as application ID and custom headers to set on a request.
+ *
+ * @param clientOptions The client options.
+ * @return The updated MetricsAdvisorClientBuilder object.
+ */
+ public MetricsAdvisorClientBuilder clientOptions(ClientOptions clientOptions) {
+ this.clientOptions = clientOptions;
+ return this;
+ }
+
/**
* Adds a policy to the set of existing policies that are executed after required policies.
*
diff --git a/sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/models/MetricsAdvisorServiceVersion.java b/sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/MetricsAdvisorServiceVersion.java
similarity index 94%
rename from sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/models/MetricsAdvisorServiceVersion.java
rename to sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/MetricsAdvisorServiceVersion.java
index 4253863f068e2..b606d4d06c63f 100644
--- a/sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/models/MetricsAdvisorServiceVersion.java
+++ b/sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/MetricsAdvisorServiceVersion.java
@@ -1,7 +1,7 @@
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License.
-package com.azure.ai.metricsadvisor.models;
+package com.azure.ai.metricsadvisor;
import com.azure.core.util.ServiceVersion;
diff --git a/sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/administration/MetricsAdvisorAdministrationAsyncClient.java b/sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/administration/MetricsAdvisorAdministrationAsyncClient.java
index e6c3de02bb5b1..510b4a7dc7e40 100644
--- a/sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/administration/MetricsAdvisorAdministrationAsyncClient.java
+++ b/sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/administration/MetricsAdvisorAdministrationAsyncClient.java
@@ -4,7 +4,10 @@
package com.azure.ai.metricsadvisor.administration;
import com.azure.ai.metricsadvisor.implementation.AzureCognitiveServiceMetricsAdvisorRestAPIOpenAPIV2Impl;
+import com.azure.ai.metricsadvisor.implementation.models.DataSourceCredential;
+import com.azure.ai.metricsadvisor.implementation.models.DataSourceCredentialPatch;
import com.azure.ai.metricsadvisor.implementation.models.RollUpMethod;
+import com.azure.ai.metricsadvisor.implementation.util.DataSourceCredentialEntityTransforms;
import com.azure.ai.metricsadvisor.implementation.util.DataFeedTransforms;
import com.azure.ai.metricsadvisor.implementation.util.DetectionConfigurationTransforms;
import com.azure.ai.metricsadvisor.implementation.models.AnomalyDetectionConfigurationPatch;
@@ -21,26 +24,28 @@
import com.azure.ai.metricsadvisor.implementation.models.ViewMode;
import com.azure.ai.metricsadvisor.implementation.util.Utility;
import com.azure.ai.metricsadvisor.implementation.util.AlertConfigurationTransforms;
-import com.azure.ai.metricsadvisor.models.AnomalyAlertConfiguration;
-import com.azure.ai.metricsadvisor.models.DataFeed;
-import com.azure.ai.metricsadvisor.models.DataFeedGranularity;
-import com.azure.ai.metricsadvisor.models.DataFeedIngestionProgress;
-import com.azure.ai.metricsadvisor.models.DataFeedIngestionSettings;
-import com.azure.ai.metricsadvisor.models.DataFeedIngestionStatus;
-import com.azure.ai.metricsadvisor.models.DataFeedMissingDataPointFillSettings;
-import com.azure.ai.metricsadvisor.models.DataFeedMissingDataPointFillType;
-import com.azure.ai.metricsadvisor.models.DataFeedOptions;
-import com.azure.ai.metricsadvisor.models.DataFeedRollupSettings;
-import com.azure.ai.metricsadvisor.models.DataFeedSchema;
-import com.azure.ai.metricsadvisor.models.ListAnomalyAlertConfigsOptions;
-import com.azure.ai.metricsadvisor.models.ListMetricAnomalyDetectionConfigsOptions;
-import com.azure.ai.metricsadvisor.models.NotificationHook;
-import com.azure.ai.metricsadvisor.models.ListDataFeedFilter;
-import com.azure.ai.metricsadvisor.models.ListDataFeedIngestionOptions;
-import com.azure.ai.metricsadvisor.models.ListDataFeedOptions;
-import com.azure.ai.metricsadvisor.models.ListHookOptions;
-import com.azure.ai.metricsadvisor.models.AnomalyDetectionConfiguration;
-import com.azure.ai.metricsadvisor.models.MetricsAdvisorServiceVersion;
+import com.azure.ai.metricsadvisor.administration.models.AnomalyAlertConfiguration;
+import com.azure.ai.metricsadvisor.administration.models.DataFeed;
+import com.azure.ai.metricsadvisor.administration.models.DataFeedGranularity;
+import com.azure.ai.metricsadvisor.administration.models.DataFeedIngestionProgress;
+import com.azure.ai.metricsadvisor.administration.models.DataFeedIngestionSettings;
+import com.azure.ai.metricsadvisor.administration.models.DataFeedIngestionStatus;
+import com.azure.ai.metricsadvisor.administration.models.DataFeedMissingDataPointFillSettings;
+import com.azure.ai.metricsadvisor.administration.models.DataFeedMissingDataPointFillType;
+import com.azure.ai.metricsadvisor.administration.models.DataFeedOptions;
+import com.azure.ai.metricsadvisor.administration.models.DataFeedRollupSettings;
+import com.azure.ai.metricsadvisor.administration.models.DataFeedSchema;
+import com.azure.ai.metricsadvisor.administration.models.DatasourceCredentialEntity;
+import com.azure.ai.metricsadvisor.administration.models.ListAnomalyAlertConfigsOptions;
+import com.azure.ai.metricsadvisor.administration.models.ListCredentialEntityOptions;
+import com.azure.ai.metricsadvisor.administration.models.ListMetricAnomalyDetectionConfigsOptions;
+import com.azure.ai.metricsadvisor.administration.models.NotificationHook;
+import com.azure.ai.metricsadvisor.administration.models.ListDataFeedFilter;
+import com.azure.ai.metricsadvisor.administration.models.ListDataFeedIngestionOptions;
+import com.azure.ai.metricsadvisor.administration.models.ListDataFeedOptions;
+import com.azure.ai.metricsadvisor.administration.models.ListHookOptions;
+import com.azure.ai.metricsadvisor.administration.models.AnomalyDetectionConfiguration;
+import com.azure.ai.metricsadvisor.MetricsAdvisorServiceVersion;
import com.azure.core.annotation.ReturnType;
import com.azure.core.annotation.ServiceClient;
import com.azure.core.annotation.ServiceMethod;
@@ -63,7 +68,7 @@
import java.util.stream.Collectors;
import static com.azure.ai.metricsadvisor.implementation.util.Utility.parseOperationId;
-import static com.azure.ai.metricsadvisor.models.DataFeedGranularityType.CUSTOM;
+import static com.azure.ai.metricsadvisor.administration.models.DataFeedGranularityType.CUSTOM;
import static com.azure.core.util.FluxUtil.monoError;
import static com.azure.core.util.FluxUtil.withContext;
import static com.azure.core.util.tracing.Tracer.AZ_TRACING_NAMESPACE_KEY;
@@ -76,7 +81,7 @@
* @see MetricsAdvisorAdministrationClientBuilder
*/
@ServiceClient(builder = MetricsAdvisorAdministrationClientBuilder.class, isAsync = true)
-public class MetricsAdvisorAdministrationAsyncClient {
+public final class MetricsAdvisorAdministrationAsyncClient {
private static final String METRICS_ADVISOR_TRACING_NAMESPACE_VALUE = "Microsoft.CognitiveServices";
private final ClientLogger logger = new ClientLogger(MetricsAdvisorAdministrationAsyncClient.class);
private final AzureCognitiveServiceMetricsAdvisorRestAPIOpenAPIV2Impl service;
@@ -325,28 +330,28 @@ Mono> updateDataFeedWithResponse(DataFeed dataFeed, Context c
? null : dataFeedIngestionSettings.getIngestionRetryDelay().getSeconds())
.setNeedRollup(
dataFeedRollupSettings.getRollupType() != null
- ? NeedRollupEnum.fromString(dataFeedRollupSettings.getRollupType().toString())
- : null)
+ ? NeedRollupEnum.fromString(dataFeedRollupSettings.getRollupType().toString())
+ : null)
.setRollUpColumns(dataFeedRollupSettings.getAutoRollupGroupByColumnNames())
.setRollUpMethod(
dataFeedRollupSettings.getDataFeedAutoRollUpMethod() != null
- ? RollUpMethod.fromString(
+ ? RollUpMethod.fromString(
dataFeedRollupSettings.getDataFeedAutoRollUpMethod().toString())
: null)
.setAllUpIdentification(dataFeedRollupSettings.getRollupIdentificationValue())
.setFillMissingPointType(
dataFeedMissingDataPointFillSettings.getFillType() != null
- ? FillMissingPointType.fromString(
+ ? FillMissingPointType.fromString(
dataFeedMissingDataPointFillSettings.getFillType().toString())
: null)
.setFillMissingPointValue(
// For PATCH send 'fill-custom-value' over wire only for 'fill-custom-type'.
dataFeedMissingDataPointFillSettings.getFillType() == DataFeedMissingDataPointFillType.CUSTOM_VALUE
- ? dataFeedMissingDataPointFillSettings.getCustomFillValue()
+ ? dataFeedMissingDataPointFillSettings.getCustomFillValue()
: null)
.setViewMode(
dataFeedOptions.getAccessMode() != null
- ? ViewMode.fromString(dataFeedOptions.getAccessMode().toString())
+ ? ViewMode.fromString(dataFeedOptions.getAccessMode().toString())
: null)
.setViewers(dataFeedOptions.getViewerEmails())
.setAdmins(dataFeedOptions.getAdminEmails())
@@ -697,7 +702,7 @@ public Mono> getDataFeedIngestionProgressWit
}
Mono> getDataFeedIngestionProgressWithResponse(String dataFeedId,
- Context context) {
+ Context context) {
Objects.requireNonNull(dataFeedId, "'dataFeedId' is required.");
return service.getIngestionProgressWithResponseAsync(UUID.fromString(dataFeedId),
context.addData(AZ_TRACING_NAMESPACE_KEY, METRICS_ADVISOR_TRACING_NAMESPACE_VALUE))
@@ -970,7 +975,7 @@ public Mono> deleteMetricAnomalyDetectionConfigWithResponse(
}
Mono> deleteMetricAnomalyDetectionConfigWithResponse(String detectionConfigurationId,
- Context context) {
+ Context context) {
Objects.requireNonNull(detectionConfigurationId, "detectionConfigurationId is required.");
return service.deleteHookWithResponseAsync(UUID.fromString(detectionConfigurationId),
context.addData(AZ_TRACING_NAMESPACE_KEY, METRICS_ADVISOR_TRACING_NAMESPACE_VALUE))
@@ -979,6 +984,23 @@ Mono> deleteMetricAnomalyDetectionConfigWithResponse(String detec
.doOnError(error -> logger.warning("Failed to delete MetricAnomalyDetectionConfiguration", error));
}
+ /**
+ * Given a metric id, retrieve all anomaly detection configurations applied to it.
+ *
+ * Code sample
+ * {@codesnippet com.azure.ai.metricsadvisor.administration.MetricsAdvisorAdministrationAsyncClient.listMetricAnomalyDetectionConfigs#String}
+ *
+ * @param metricId The metric id.
+ * @return The anomaly detection configurations.
+ * @throws NullPointerException thrown if the {@code metricId} is null.
+ * @throws IllegalArgumentException If {@code metricId} does not conform to the UUID format specification.
+ */
+ @ServiceMethod(returns = ReturnType.COLLECTION)
+ public PagedFlux listMetricAnomalyDetectionConfigs(
+ String metricId) {
+ return listMetricAnomalyDetectionConfigs(metricId, null);
+ }
+
/**
* Given a metric id, retrieve all anomaly detection configurations applied to it.
*
@@ -1659,4 +1681,315 @@ private Mono> listAnomalyAlertConfigsNe
error))
.map(response -> AlertConfigurationTransforms.fromInnerPagedResponse(response));
}
+
+ /**
+ * Create a data source credential entity.
+ *
+ * Code sample
+ * {@codesnippet com.azure.ai.metricsadvisor.administration.MetricsAdvisorAdministrationAsyncClient.createDatasourceCredential#DatasourceCredentialEntity}
+ *
+ * @param datasourceCredential The credential entity.
+ * @return A {@link Mono} containing the created {@link DatasourceCredentialEntity}.
+ * @throws NullPointerException thrown if the {@code credentialEntity} is null
+ */
+ @ServiceMethod(returns = ReturnType.SINGLE)
+ public Mono createDatasourceCredential(
+ DatasourceCredentialEntity datasourceCredential) {
+ return createDatasourceCredentialWithResponse(datasourceCredential)
+ .map(Response::getValue);
+ }
+
+ /**
+ * Create a data source credential entity with REST response.
+ *
+ * Code sample
+ * {@codesnippet com.azure.ai.metricsadvisor.administration.MetricsAdvisorAdministrationAsyncClient.createDatasourceCredentialWithResponse#DatasourceCredentialEntity}
+ *
+ * @param datasourceCredential The credential entity.
+ * @return A {@link Mono} containing the created {@link DatasourceCredentialEntity}.
+ * @throws NullPointerException thrown if the {@code credentialEntity} is null
+ */
+ @ServiceMethod(returns = ReturnType.SINGLE)
+ public Mono> createDatasourceCredentialWithResponse(
+ DatasourceCredentialEntity datasourceCredential) {
+ try {
+ return withContext(context -> createDatasourceCredentialWithResponse(datasourceCredential,
+ context));
+ } catch (RuntimeException e) {
+ return FluxUtil.monoError(logger, e);
+ }
+ }
+
+ Mono> createDatasourceCredentialWithResponse(
+ DatasourceCredentialEntity datasourceCredential,
+ Context context) {
+ Objects.requireNonNull(datasourceCredential, "datasourceCredential is required");
+
+ final DataSourceCredential
+ innerDataSourceCredential = DataSourceCredentialEntityTransforms.toInnerForCreate(datasourceCredential);
+ return service.createCredentialWithResponseAsync(innerDataSourceCredential,
+ context.addData(AZ_TRACING_NAMESPACE_KEY, METRICS_ADVISOR_TRACING_NAMESPACE_VALUE))
+ .doOnSubscribe(ignoredValue -> logger.info("Creating DataSourceCredentialEntity"))
+ .doOnSuccess(response -> logger.info("Created DataSourceCredentialEntity"))
+ .doOnError(error -> logger.warning("Failed to create DataSourceCredentialEntity", error))
+ .flatMap(response -> {
+ final String credentialId
+ = Utility.parseOperationId(response.getDeserializedHeaders().getLocation());
+ return this.getDatasourceCredentialWithResponse(credentialId, context)
+ .map(configurationResponse -> new ResponseBase(
+ response.getRequest(),
+ response.getStatusCode(),
+ response.getHeaders(),
+ configurationResponse.getValue(),
+ null));
+ });
+ }
+
+ /**
+ * Update a data source credential entity.
+ *
+ * Code sample
+ * {@codesnippet com.azure.ai.metricsadvisor.administration.MetricsAdvisorAdministrationAsyncClient.updateDatasourceCredential#DatasourceCredentialEntity}
+ *
+ * @param datasourceCredential The credential entity.
+ * @return A {@link Mono} containing the updated {@link DatasourceCredentialEntity}.
+ * @throws NullPointerException thrown if the {@code credentialEntity} is null
+ */
+ @ServiceMethod(returns = ReturnType.SINGLE)
+ public Mono updateDatasourceCredential(
+ DatasourceCredentialEntity datasourceCredential) {
+ return updateDatasourceCredentialWithResponse(datasourceCredential)
+ .map(Response::getValue);
+ }
+
+ /**
+ * Update a data source credential entity with REST response.
+ *
+ * Code sample
+ * {@codesnippet com.azure.ai.metricsadvisor.administration.MetricsAdvisorAdministrationAsyncClient.updateDatasourceCredentialWithResponse#DatasourceCredentialEntity}
+ *
+ * @param datasourceCredential The credential entity.
+ * @return A {@link Mono} containing the updated {@link DatasourceCredentialEntity}.
+ * @throws NullPointerException thrown if the {@code credentialEntity} is null
+ */
+ @ServiceMethod(returns = ReturnType.SINGLE)
+ public Mono> updateDatasourceCredentialWithResponse(
+ DatasourceCredentialEntity datasourceCredential) {
+ try {
+ return withContext(context -> updateDatasourceCredentialWithResponse(datasourceCredential,
+ context));
+ } catch (RuntimeException e) {
+ return FluxUtil.monoError(logger, e);
+ }
+ }
+
+ Mono> updateDatasourceCredentialWithResponse(
+ DatasourceCredentialEntity datasourceCredential,
+ Context context) {
+ Objects.requireNonNull(datasourceCredential, "datasourceCredential is required");
+
+ final DataSourceCredentialPatch
+ innerDataSourceCredential = DataSourceCredentialEntityTransforms.toInnerForUpdate(datasourceCredential);
+ return service.updateCredentialWithResponseAsync(UUID.fromString(datasourceCredential.getId()),
+ innerDataSourceCredential,
+ context.addData(AZ_TRACING_NAMESPACE_KEY, METRICS_ADVISOR_TRACING_NAMESPACE_VALUE))
+ .doOnSubscribe(ignoredValue -> logger.info("Updating DataSourceCredentialEntity"))
+ .doOnSuccess(response -> logger.info("Updated DataSourceCredentialEntity"))
+ .doOnError(error -> logger.warning("Failed to update DataSourceCredentialEntity", error))
+ .flatMap(response -> {
+ return this.getDatasourceCredentialWithResponse(datasourceCredential.getId(), context)
+ .map(configurationResponse -> new ResponseBase(
+ response.getRequest(),
+ response.getStatusCode(),
+ response.getHeaders(),
+ configurationResponse.getValue(),
+ null));
+ });
+ }
+
+ /**
+ * Get a data source credential entity by its id.
+ *
+ * Code sample
+ * {@codesnippet com.azure.ai.metricsadvisor.administration.MetricsAdvisorAdministrationAsyncClient.getDatasourceCredential#String}
+ *
+ * @param credentialId The data source credential entity unique id.
+ *
+ * @return The data source credential entity for the provided id.
+ * @throws IllegalArgumentException If {@code credentialId} does not conform to the UUID format specification.
+ * @throws NullPointerException thrown if the {@code credentialId} is null.
+ */
+ @ServiceMethod(returns = ReturnType.SINGLE)
+ public Mono getDatasourceCredential(String credentialId) {
+ return getDatasourceCredentialWithResponse(credentialId).flatMap(FluxUtil::toMono);
+ }
+
+ /**
+ * Get a data source credential entity by its id with REST response.
+ *
+ * Code sample
+ * {@codesnippet com.azure.ai.metricsadvisor.administration.MetricsAdvisorAdministrationAsyncClient.getDatasourceCredentialWithResponse#String}
+ *
+ * @param credentialId The data source credential entity unique id.
+ *
+ * @return The data source credential entity for the provided id.
+ * @throws IllegalArgumentException If {@code credentialId} does not conform to the UUID format specification.
+ * @throws NullPointerException thrown if the {@code credentialId} is null.
+ */
+ @ServiceMethod(returns = ReturnType.SINGLE)
+ public Mono> getDatasourceCredentialWithResponse(
+ String credentialId) {
+ try {
+ return withContext(context -> getDatasourceCredentialWithResponse(credentialId, context));
+ } catch (RuntimeException ex) {
+ return monoError(logger, ex);
+ }
+ }
+
+ Mono> getDatasourceCredentialWithResponse(String credentialId,
+ Context context) {
+ Objects.requireNonNull(credentialId, "'credentialId' cannot be null.");
+
+ return service.getCredentialWithResponseAsync(UUID.fromString(credentialId), context)
+ .map(response -> new SimpleResponse<>(response,
+ DataSourceCredentialEntityTransforms.fromInner(response.getValue())));
+ }
+
+ /**
+ * Deletes the data source credential entity identified by {@code credentialId}.
+ *
+ * Code sample
+ * {@codesnippet com.azure.ai.metricsadvisor.administration.MetricsAdvisorAdministrationAsyncClient.deleteDatasourceCredential#String}
+ *
+ * @param credentialId The data source credential entity id.
+ *
+ * @return An empty Mono.
+ * @throws IllegalArgumentException If {@code credentialId} does not conform to the
+ * UUID format specification.
+ * @throws NullPointerException thrown if the {@code credentialId} is null.
+ */
+ @ServiceMethod(returns = ReturnType.SINGLE)
+ public Mono deleteDatasourceCredential(String credentialId) {
+ return deleteDatasourceCredentialWithResponse(credentialId).flatMap(FluxUtil::toMono);
+ }
+
+ /**
+ * Deletes the data source credential entity identified by {@code credentialId}.
+ *
+ * Code sample
+ * {@codesnippet com.azure.ai.metricsadvisor.administration.MetricsAdvisorAdministrationAsyncClient.deleteDatasourceCredentialWithResponse#String}
+ *
+ * @param credentialId The data source credential entity id.
+ *
+ * @return A response containing status code and headers returned after the operation.
+ * @throws IllegalArgumentException If {@code credentialId} does not conform to the
+ * UUID format specification.
+ * @throws NullPointerException thrown if the {@code credentialId} is null.
+ */
+ @ServiceMethod(returns = ReturnType.SINGLE)
+ public Mono> deleteDatasourceCredentialWithResponse(String credentialId) {
+ try {
+ return withContext(context -> deleteDatasourceCredentialWithResponse(credentialId, context));
+ } catch (RuntimeException ex) {
+ return monoError(logger, ex);
+ }
+ }
+
+ Mono> deleteDatasourceCredentialWithResponse(String credentialId, Context context) {
+ Objects.requireNonNull(credentialId, "'credentialId' is required.");
+ final Context withTracing = context.addData(AZ_TRACING_NAMESPACE_KEY, METRICS_ADVISOR_TRACING_NAMESPACE_VALUE);
+
+ return service.deleteCredentialWithResponseAsync(UUID.fromString(credentialId),
+ withTracing)
+ .doOnSubscribe(ignoredValue -> logger.info("Deleting deleteDataSourceCredentialEntity - {}",
+ credentialId))
+ .doOnSuccess(response -> logger.info("Deleted deleteDataSourceCredentialEntity - {}", response))
+ .doOnError(error -> logger.warning("Failed to delete deleteDataSourceCredentialEntity - {}",
+ credentialId, error));
+ }
+
+ /**
+ * List information of all data source credential entities on the metrics advisor account.
+ *
+ * Code sample
+ * {@codesnippet com.azure.ai.metricsadvisor.administration.MetricsAdvisorAdministrationAsyncClient.listDatasourceCredentials}
+ *
+ * @return A {@link PagedFlux} containing information of all the {@link DatasourceCredentialEntity data feeds}
+ * in the account.
+ */
+ @ServiceMethod(returns = ReturnType.COLLECTION)
+ public PagedFlux listDatasourceCredentials() {
+ return listDatasourceCredentials(new ListCredentialEntityOptions());
+ }
+
+ /**
+ * List information of all data source credential entities on the metrics advisor account.
+ *
+ * Code sample
+ * {@codesnippet com.azure.ai.metricsadvisor.administration.MetricsAdvisorAdministrationAsyncClient.listDatasourceCredentials#ListCredentialEntityOptions}
+ *
+ * @param options The configurable {@link ListCredentialEntityOptions options} to pass for filtering
+ * the output result.
+ *
+ * @return A {@link PagedFlux} containing information of all the {@link DatasourceCredentialEntity data feeds}
+ * in the account.
+ */
+ @ServiceMethod(returns = ReturnType.COLLECTION)
+ public PagedFlux listDatasourceCredentials(ListCredentialEntityOptions options) {
+ try {
+ return new PagedFlux<>(() ->
+ withContext(context ->
+ listCredentialEntitiesSinglePageAsync(options, context)),
+ continuationToken ->
+ withContext(context -> listCredentialEntitiesSNextPageAsync(continuationToken, context)));
+ } catch (RuntimeException ex) {
+ return new PagedFlux<>(() -> monoError(logger, ex));
+ }
+ }
+
+ PagedFlux listDatasourceCredentials(ListCredentialEntityOptions options,
+ Context context) {
+ return new PagedFlux<>(() ->
+ listCredentialEntitiesSinglePageAsync(options, context),
+ continuationToken ->
+ listCredentialEntitiesSNextPageAsync(continuationToken, context));
+ }
+
+ private Mono> listCredentialEntitiesSinglePageAsync(
+ ListCredentialEntityOptions options, Context context) {
+ options = options != null ? options : new ListCredentialEntityOptions();
+ final Context withTracing = context.addData(AZ_TRACING_NAMESPACE_KEY, METRICS_ADVISOR_TRACING_NAMESPACE_VALUE);
+ return service.listCredentialsSinglePageAsync(options.getSkip(), options.getMaxPageSize(), withTracing)
+ .doOnRequest(ignoredValue -> logger.info("Listing information for all data source credentials"))
+ .doOnSuccess(response -> logger.info("Listed data source credentials {}", response))
+ .doOnError(error -> logger.warning("Failed to list all data source credential information - {}", error))
+ .map(res -> new PagedResponseBase<>(
+ res.getRequest(),
+ res.getStatusCode(),
+ res.getHeaders(),
+ res.getValue().stream()
+ .map(DataSourceCredentialEntityTransforms::fromInner).collect(Collectors.toList()),
+ res.getContinuationToken(),
+ null));
+ }
+
+ private Mono> listCredentialEntitiesSNextPageAsync(
+ String nextPageLink, Context context) {
+ if (CoreUtils.isNullOrEmpty(nextPageLink)) {
+ return Mono.empty();
+ }
+ return service.listCredentialsNextSinglePageAsync(nextPageLink, context)
+ .doOnSubscribe(ignoredValue -> logger.info("Retrieving the next listing page - Page {}", nextPageLink))
+ .doOnSuccess(response -> logger.info("Retrieved the next listing page - Page {}", nextPageLink))
+ .doOnError(error -> logger.warning("Failed to retrieve the next listing page - Page {}", nextPageLink,
+ error))
+ .map(res -> new PagedResponseBase<>(
+ res.getRequest(),
+ res.getStatusCode(),
+ res.getHeaders(),
+ res.getValue().stream()
+ .map(DataSourceCredentialEntityTransforms::fromInner).collect(Collectors.toList()),
+ res.getContinuationToken(),
+ null));
+ }
}
diff --git a/sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/administration/MetricsAdvisorAdministrationClient.java b/sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/administration/MetricsAdvisorAdministrationClient.java
index 0a12dd44b6d8a..c506f6d632aeb 100644
--- a/sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/administration/MetricsAdvisorAdministrationClient.java
+++ b/sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/administration/MetricsAdvisorAdministrationClient.java
@@ -3,17 +3,19 @@
package com.azure.ai.metricsadvisor.administration;
-import com.azure.ai.metricsadvisor.models.AnomalyAlertConfiguration;
-import com.azure.ai.metricsadvisor.models.AnomalyDetectionConfiguration;
-import com.azure.ai.metricsadvisor.models.DataFeed;
-import com.azure.ai.metricsadvisor.models.DataFeedIngestionProgress;
-import com.azure.ai.metricsadvisor.models.DataFeedIngestionStatus;
-import com.azure.ai.metricsadvisor.models.ListAnomalyAlertConfigsOptions;
-import com.azure.ai.metricsadvisor.models.ListDataFeedIngestionOptions;
-import com.azure.ai.metricsadvisor.models.ListDataFeedOptions;
-import com.azure.ai.metricsadvisor.models.ListHookOptions;
-import com.azure.ai.metricsadvisor.models.ListMetricAnomalyDetectionConfigsOptions;
-import com.azure.ai.metricsadvisor.models.NotificationHook;
+import com.azure.ai.metricsadvisor.administration.models.AnomalyAlertConfiguration;
+import com.azure.ai.metricsadvisor.administration.models.AnomalyDetectionConfiguration;
+import com.azure.ai.metricsadvisor.administration.models.DataFeed;
+import com.azure.ai.metricsadvisor.administration.models.DataFeedIngestionProgress;
+import com.azure.ai.metricsadvisor.administration.models.DataFeedIngestionStatus;
+import com.azure.ai.metricsadvisor.administration.models.DatasourceCredentialEntity;
+import com.azure.ai.metricsadvisor.administration.models.ListAnomalyAlertConfigsOptions;
+import com.azure.ai.metricsadvisor.administration.models.ListCredentialEntityOptions;
+import com.azure.ai.metricsadvisor.administration.models.ListDataFeedIngestionOptions;
+import com.azure.ai.metricsadvisor.administration.models.ListDataFeedOptions;
+import com.azure.ai.metricsadvisor.administration.models.ListHookOptions;
+import com.azure.ai.metricsadvisor.administration.models.ListMetricAnomalyDetectionConfigsOptions;
+import com.azure.ai.metricsadvisor.administration.models.NotificationHook;
import com.azure.core.annotation.ReturnType;
import com.azure.core.annotation.ServiceClient;
import com.azure.core.annotation.ServiceMethod;
@@ -223,8 +225,7 @@ public PagedIterable listDataFeeds(ListDataFeedOptions options, Contex
*/
@ServiceMethod(returns = ReturnType.COLLECTION)
public PagedIterable listDataFeedIngestionStatus(
- String dataFeedId,
- ListDataFeedIngestionOptions options) {
+ String dataFeedId, ListDataFeedIngestionOptions options) {
return listDataFeedIngestionStatus(dataFeedId, options, Context.NONE);
}
@@ -517,19 +518,17 @@ public Response deleteMetricAnomalyDetectionConfigWithResponse(
* Given a metric id, retrieve all anomaly detection configurations applied to it.
*
* Code sample
- * {@codesnippet com.azure.ai.metricsadvisor.administration.MetricsAdvisorAdministrationClient.listMetricAnomalyDetectionConfigs#String-ListMetricAnomalyDetectionConfigsOptions}
+ * {@codesnippet com.azure.ai.metricsadvisor.administration.MetricsAdvisorAdministrationClient.listMetricAnomalyDetectionConfigs#String}
*
* @param metricId The metric id.
- * @param options th e additional configurable options to specify when querying the result.
* @return The anomaly detection configurations.
* @throws NullPointerException thrown if the {@code metricId} is null.
* @throws IllegalArgumentException If {@code metricId} does not conform to the UUID format specification.
*/
@ServiceMethod(returns = ReturnType.COLLECTION)
public PagedIterable listMetricAnomalyDetectionConfigs(
- String metricId,
- ListMetricAnomalyDetectionConfigsOptions options) {
- return new PagedIterable<>(client.listMetricAnomalyDetectionConfigs(metricId, options,
+ String metricId) {
+ return new PagedIterable<>(client.listMetricAnomalyDetectionConfigs(metricId, null,
Context.NONE));
}
@@ -914,4 +913,174 @@ public PagedIterable listAnomalyAlertConfigs(
return new PagedIterable<>(client.listAnomalyAlertConfigs(detectionConfigurationId, options,
context == null ? Context.NONE : context));
}
+
+ /**
+ * Create a data source credential entity.
+ *
+ * Code sample
+ * {@codesnippet com.azure.ai.metricsadvisor.administration.MetricsAdvisorAdministrationClient.createDatasourceCredential#DatasourceCredentialEntity}
+ *
+ * @param datasourceCredential The credential entity.
+ * @return The created {@link DatasourceCredentialEntity}.
+ * @throws NullPointerException thrown if the {@code credentialEntity} is null
+ */
+ @ServiceMethod(returns = ReturnType.SINGLE)
+ public DatasourceCredentialEntity createDatasourceCredential(DatasourceCredentialEntity datasourceCredential) {
+ return createDatasourceCredentialWithResponse(datasourceCredential, Context.NONE).getValue();
+ }
+
+ /**
+ * Create a data source credential entity with REST response.
+ *
+ * Code sample
+ * {@codesnippet com.azure.ai.metricsadvisor.administration.MetricsAdvisorAdministrationClient.createDatasourceCredentialWithResponse#DatasourceCredentialEntity-Context}
+ *
+ * @param datasourceCredential The credential entity.
+ * @param context Additional context that is passed through the HTTP pipeline during the service call.
+ *
+ * @return A {@link Response} containing the created {@link DatasourceCredentialEntity}.
+ * @throws NullPointerException thrown if the {@code credentialEntity} is null
+ */
+ @ServiceMethod(returns = ReturnType.SINGLE)
+ public Response createDatasourceCredentialWithResponse(
+ DatasourceCredentialEntity datasourceCredential, Context context) {
+ return client.createDatasourceCredentialWithResponse(datasourceCredential, context).block();
+ }
+
+ /**
+ * Get a data source credential entity by its id.
+ *
+ * Code sample
+ * {@codesnippet com.azure.ai.metricsadvisor.administration.MetricsAdvisorAdministrationClient.getDatasourceCredential#String}
+ *
+ * @param credentialId The data source credential entity unique id.
+ *
+ * @return The data source credential entity for the provided id.
+ * @throws IllegalArgumentException If {@code credentialId} does not conform to the UUID format specification.
+ * @throws NullPointerException thrown if the {@code credentialId} is null.
+ */
+ @ServiceMethod(returns = ReturnType.SINGLE)
+ public DatasourceCredentialEntity getDatasourceCredential(String credentialId) {
+ return getDatasourceCredentialWithResponse(credentialId, Context.NONE).getValue();
+ }
+
+ /**
+ * Get a data source credential entity by its id with REST response.
+ *
+ * Code sample
+ * {@codesnippet com.azure.ai.metricsadvisor.administration.MetricsAdvisorAdministrationClient.getDatasourceCredentialWithResponse#String-Context}
+ *
+ * @param credentialId The data source credential entity unique id.
+ * @param context Additional context that is passed through the HTTP pipeline during the service call.
+ *
+ * @return The data feed for the provided id.
+ * @throws IllegalArgumentException If {@code dataFeedId} does not conform to the UUID format specification.
+ * @throws NullPointerException thrown if the {@code dataFeedId} is null.
+ */
+ @ServiceMethod(returns = ReturnType.SINGLE)
+ public Response getDatasourceCredentialWithResponse(String credentialId,
+ Context context) {
+ return client.getDatasourceCredentialWithResponse(credentialId, context).block();
+ }
+
+ /**
+ * Update a data source credential entity.
+ *
+ * Code sample
+ * {@codesnippet com.azure.ai.metricsadvisor.administration.MetricsAdvisorAdministrationClient.updateDatasourceCredential#DatasourceCredentialEntity}
+ *
+ * @param datasourceCredential The credential entity.
+ *
+ * @return The updated {@link DatasourceCredentialEntity}.
+ * @throws NullPointerException thrown if the {@code credentialEntity} is null
+ */
+ @ServiceMethod(returns = ReturnType.SINGLE)
+ public DatasourceCredentialEntity updateDatasourceCredential(DatasourceCredentialEntity datasourceCredential) {
+ return updateDatasourceCredentialWithResponse(datasourceCredential, Context.NONE).getValue();
+ }
+
+ /**
+ * Update a data source credential entity.
+ *
+ * Code sample
+ * {@codesnippet com.azure.ai.metricsadvisor.administration.MetricsAdvisorAdministrationClient.updateDatasourceCredentialWithResponse#DatasourceCredentialEntity-Context}
+ *
+ * @param datasourceCredential The credential entity.
+ * @param context Additional context that is passed through the HTTP pipeline during the service call.
+ *
+ * @return A {@link Response} containing the updated {@link DatasourceCredentialEntity}.
+ * @throws NullPointerException thrown if the {@code credentialEntity} is null
+ */
+ @ServiceMethod(returns = ReturnType.SINGLE)
+ public Response updateDatasourceCredentialWithResponse(
+ DatasourceCredentialEntity datasourceCredential, Context context) {
+ return client.updateDatasourceCredentialWithResponse(datasourceCredential, context).block();
+ }
+
+ /**
+ * Delete a data source credential entity.
+ *
+ * Code sample
+ * {@codesnippet com.azure.ai.metricsadvisor.administration.MetricsAdvisorAdministrationClient.deleteDatasourceCredential#String}
+ *
+ * @param credentialId The data source credential entity unique id.
+ *
+ * @throws IllegalArgumentException If {@code credentialId} does not conform to the UUID format specification.
+ * @throws NullPointerException thrown if the {@code credentialId} is null.
+ */
+ @ServiceMethod(returns = ReturnType.SINGLE)
+ public void deleteDatasourceCredential(String credentialId) {
+ deleteDatasourceCredentialWithResponse(credentialId, Context.NONE);
+ }
+
+ /**
+ * Delete a data source credential entity with REST response.
+ *
+ * Code sample
+ * {@codesnippet com.azure.ai.metricsadvisor.administration.MetricsAdvisorAdministrationClient.deleteDatasourceCredentialWithResponse#String-Context}
+ *
+ * @param credentialId The data source credential entity unique id.
+ * @param context Additional context that is passed through the HTTP pipeline during the service call.
+ *
+ * @return a REST Response.
+ * @throws IllegalArgumentException If {@code dataFeedId} does not conform to the UUID format specification.
+ * @throws NullPointerException thrown if the {@code dataFeedId} is null.
+ */
+ @ServiceMethod(returns = ReturnType.SINGLE)
+ public Response deleteDatasourceCredentialWithResponse(String credentialId, Context context) {
+ return client.deleteDataFeedWithResponse(credentialId, context).block();
+ }
+
+ /**
+ * List information of all data source credential entities on the metrics advisor account.
+ *
+ * Code sample
+ * {@codesnippet com.azure.ai.metricsadvisor.administration.MetricsAdvisorAdministrationClient.listDatasourceCredentials}
+ *
+ * @return A {@link PagedIterable} containing information of all the {@link DatasourceCredentialEntity}
+ * in the account.
+ */
+ @ServiceMethod(returns = ReturnType.COLLECTION)
+ public PagedIterable listDatasourceCredentials() {
+ return listDatasourceCredentials(null, Context.NONE);
+ }
+
+ /**
+ * List information of all data source credential entities on the metrics advisor account.
+ *
+ * Code sample
+ * {@codesnippet com.azure.ai.metricsadvisor.administration.MetricsAdvisorAdministrationClient.listDatasourceCredentials#ListCredentialEntityOptions-Context}
+ *
+ * @param options The configurable {@link ListCredentialEntityOptions options} to pass for filtering the output
+ * result.
+ * @param context Additional context that is passed through the Http pipeline during the service call.
+ *
+ * @return A {@link PagedIterable} containing information of all the {@link DatasourceCredentialEntity}
+ * in the account.
+ */
+ @ServiceMethod(returns = ReturnType.COLLECTION)
+ public PagedIterable listDatasourceCredentials(
+ ListCredentialEntityOptions options, Context context) {
+ return new PagedIterable<>(client.listDatasourceCredentials(options, context));
+ }
}
diff --git a/sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/administration/MetricsAdvisorAdministrationClientBuilder.java b/sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/administration/MetricsAdvisorAdministrationClientBuilder.java
index 9a129a83e5aee..b317b9a42985b 100644
--- a/sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/administration/MetricsAdvisorAdministrationClientBuilder.java
+++ b/sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/administration/MetricsAdvisorAdministrationClientBuilder.java
@@ -6,7 +6,7 @@
import com.azure.ai.metricsadvisor.implementation.AzureCognitiveServiceMetricsAdvisorRestAPIOpenAPIV2Impl;
import com.azure.ai.metricsadvisor.implementation.AzureCognitiveServiceMetricsAdvisorRestAPIOpenAPIV2ImplBuilder;
import com.azure.ai.metricsadvisor.models.MetricsAdvisorKeyCredential;
-import com.azure.ai.metricsadvisor.models.MetricsAdvisorServiceVersion;
+import com.azure.ai.metricsadvisor.MetricsAdvisorServiceVersion;
import com.azure.core.annotation.ServiceClientBuilder;
import com.azure.core.credential.TokenCredential;
import com.azure.core.http.ContentType;
@@ -19,11 +19,13 @@
import com.azure.core.http.policy.BearerTokenAuthenticationPolicy;
import com.azure.core.http.policy.HttpLogDetailLevel;
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.RequestIdPolicy;
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.logging.ClientLogger;
@@ -82,6 +84,8 @@ public final class MetricsAdvisorAdministrationClientBuilder {
private static final RetryPolicy DEFAULT_RETRY_POLICY = new RetryPolicy("retry-after-ms",
ChronoUnit.MILLIS);
private static final String DEFAULT_SCOPE = "https://cognitiveservices.azure.com/.default";
+ private static final HttpLogOptions DEFAULT_LOG_OPTIONS = new HttpLogOptions();
+ private static final ClientOptions DEFAULT_CLIENT_OPTIONS = new ClientOptions();
private final ClientLogger logger = new ClientLogger(MetricsAdvisorAdministrationClientBuilder.class);
private final List policies;
@@ -94,6 +98,7 @@ public final class MetricsAdvisorAdministrationClientBuilder {
private MetricsAdvisorKeyCredential metricsAdvisorKeyCredential;
private HttpClient httpClient;
private HttpLogOptions httpLogOptions;
+ private ClientOptions clientOptions;
private HttpPipeline httpPipeline;
private Configuration configuration;
private RetryPolicy retryPolicy;
@@ -114,8 +119,8 @@ public MetricsAdvisorAdministrationClientBuilder() {
clientVersion = properties.getOrDefault(VERSION, "UnknownVersion");
headers = new HttpHeaders()
- .put(ECHO_REQUEST_ID_HEADER, "true")
- .put(ACCEPT_HEADER, CONTENT_TYPE_HEADER_VALUE);
+ .set(ECHO_REQUEST_ID_HEADER, "true")
+ .set(ACCEPT_HEADER, CONTENT_TYPE_HEADER_VALUE);
}
/**
@@ -183,28 +188,33 @@ private HttpPipeline getDefaultHttpPipeline(Configuration buildConfiguration) {
// Closest to API goes first, closest to wire goes last.
final List policies = new ArrayList<>();
- policies.add(new UserAgentPolicy(httpLogOptions.getApplicationId(), clientName, clientVersion,
- buildConfiguration));
- policies.add(new RequestIdPolicy());
- policies.add(new AddHeadersPolicy(headers));
-
- HttpPolicyProviders.addBeforeRetryPolicies(policies);
- policies.add(retryPolicy == null ? DEFAULT_RETRY_POLICY : retryPolicy);
- policies.add(new AddDatePolicy());
-
// Authentications
if (tokenCredential != null) {
policies.add(new BearerTokenAuthenticationPolicy(tokenCredential, DEFAULT_SCOPE));
- } else if (!CoreUtils.isNullOrEmpty(metricsAdvisorKeyCredential.getSubscriptionKey())
- || !CoreUtils.isNullOrEmpty(metricsAdvisorKeyCredential.getApiKey())) {
- headers.put(OCP_APIM_SUBSCRIPTION_KEY, metricsAdvisorKeyCredential.getSubscriptionKey());
- headers.put(API_KEY, metricsAdvisorKeyCredential.getApiKey());
+ } else if (!CoreUtils.isNullOrEmpty(metricsAdvisorKeyCredential.getKeys().getSubscriptionKey())
+ || !CoreUtils.isNullOrEmpty(metricsAdvisorKeyCredential.getKeys().getApiKey())) {
+ headers.set(OCP_APIM_SUBSCRIPTION_KEY, metricsAdvisorKeyCredential.getKeys().getSubscriptionKey());
+ headers.set(API_KEY, metricsAdvisorKeyCredential.getKeys().getApiKey());
} else {
- // Throw exception that credential and tokenCredential cannot be null
+ // Throw exception that credential cannot be null
throw logger.logExceptionAsError(
new IllegalArgumentException("Missing credential information while building a client."));
}
+ ClientOptions buildClientOptions = this.clientOptions == null ? DEFAULT_CLIENT_OPTIONS : this.clientOptions;
+ HttpLogOptions buildLogOptions = this.httpLogOptions == null ? DEFAULT_LOG_OPTIONS : this.httpLogOptions;
+ final String applicationId = CoreUtils.getApplicationId(buildClientOptions, buildLogOptions);
+
+ policies.add(new UserAgentPolicy(applicationId, clientName, clientVersion,
+ buildConfiguration));
+ policies.add(new RequestIdPolicy());
+ policies.add(new AddHeadersPolicy(headers));
+
+ HttpPolicyProviders.addBeforeRetryPolicies(policies);
+ policies.add(retryPolicy == null ? DEFAULT_RETRY_POLICY : retryPolicy);
+ policies.add(new AddDatePolicy());
+ policies.add(new HttpLoggingPolicy(httpLogOptions));
+
policies.addAll(this.policies);
HttpPolicyProviders.addAfterRetryPolicies(policies);
@@ -284,6 +294,18 @@ public MetricsAdvisorAdministrationClientBuilder httpLogOptions(HttpLogOptions l
return this;
}
+ /**
+ * Sets the client options such as application ID and custom headers to set on a request.
+ *
+ * @param clientOptions The client options.
+ * @return The updated MetricsAdvisorAdministrationClientBuilder object.
+ */
+ public MetricsAdvisorAdministrationClientBuilder clientOptions(ClientOptions clientOptions) {
+ this.clientOptions = clientOptions;
+ return this;
+ }
+
+
/**
* Adds a policy to the set of existing policies that are executed after required policies.
*
diff --git a/sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/models/AnomalyAlertConfiguration.java b/sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/administration/models/AnomalyAlertConfiguration.java
similarity index 86%
rename from sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/models/AnomalyAlertConfiguration.java
rename to sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/administration/models/AnomalyAlertConfiguration.java
index 086de32e93e4d..45dbf467d9515 100644
--- a/sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/models/AnomalyAlertConfiguration.java
+++ b/sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/administration/models/AnomalyAlertConfiguration.java
@@ -1,7 +1,7 @@
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License.
-package com.azure.ai.metricsadvisor.models;
+package com.azure.ai.metricsadvisor.administration.models;
import com.azure.ai.metricsadvisor.implementation.util.AnomalyAlertConfigurationHelper;
import com.azure.core.annotation.Fluent;
@@ -21,6 +21,7 @@ public final class AnomalyAlertConfiguration {
private MetricAnomalyAlertConfigurationsOperator crossMetricsOperator;
private List metricAnomalyAlertConfigurations;
private List hookIds;
+ private List splitAlertByDimensions;
static {
AnomalyAlertConfigurationHelper.setAccessor((configuration, id) -> {
@@ -106,6 +107,15 @@ public List getIdOfHooksToAlert() {
return Collections.unmodifiableList(this.hookIds);
}
+ /**
+ * Gets dimensions that receives alerts triggered by this configuration.
+ *
+ * @return The hook ids.
+ */
+ public List getDimensionsToAlert() {
+ return Collections.unmodifiableList(this.splitAlertByDimensions);
+ }
+
/**
* Sets the description for the configuration.
*
@@ -200,6 +210,22 @@ public AnomalyAlertConfiguration setIdOfHooksToAlert(List hookIds) {
return this;
}
+ /**
+ * Sets the dimensionsToAlert to receives alerts triggered by this configuration.
+ *
+ * @param dimensionsToAlert The hook ids.
+ *
+ * @return The AnomalyAlertConfiguration object itself.
+ */
+ public AnomalyAlertConfiguration setDimensionsToAlert(List dimensionsToAlert) {
+ if (splitAlertByDimensions == null) {
+ this.splitAlertByDimensions = new ArrayList<>();
+ } else {
+ this.splitAlertByDimensions = dimensionsToAlert;
+ }
+ return this;
+ }
+
void setId(String id) {
this.id = id;
}
diff --git a/sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/models/AnomalyDetectionConfiguration.java b/sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/administration/models/AnomalyDetectionConfiguration.java
similarity index 97%
rename from sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/models/AnomalyDetectionConfiguration.java
rename to sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/administration/models/AnomalyDetectionConfiguration.java
index c4e8ab1a95bd5..94d93d0fdbd76 100644
--- a/sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/models/AnomalyDetectionConfiguration.java
+++ b/sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/administration/models/AnomalyDetectionConfiguration.java
@@ -1,9 +1,11 @@
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License.
-package com.azure.ai.metricsadvisor.models;
+package com.azure.ai.metricsadvisor.administration.models;
import com.azure.ai.metricsadvisor.implementation.util.AnomalyDetectionConfigurationHelper;
+import com.azure.ai.metricsadvisor.models.DimensionKey;
+import com.azure.core.annotation.Fluent;
import java.util.ArrayList;
import java.util.Collections;
@@ -12,6 +14,7 @@
/**
* Configuration to detect anomalies in metric time series.
*/
+@Fluent
public final class AnomalyDetectionConfiguration {
private String id;
private String metricId;
diff --git a/sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/models/AnomalyDetectorDirection.java b/sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/administration/models/AnomalyDetectorDirection.java
similarity index 95%
rename from sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/models/AnomalyDetectorDirection.java
rename to sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/administration/models/AnomalyDetectorDirection.java
index afe39fc419135..7f8fca4c90fc2 100644
--- a/sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/models/AnomalyDetectorDirection.java
+++ b/sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/administration/models/AnomalyDetectorDirection.java
@@ -2,7 +2,7 @@
// Licensed under the MIT License.
// Code generated by Microsoft (R) AutoRest Code Generator.
-package com.azure.ai.metricsadvisor.models;
+package com.azure.ai.metricsadvisor.administration.models;
import com.azure.core.util.ExpandableStringEnum;
import com.fasterxml.jackson.annotation.JsonCreator;
diff --git a/sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/models/AnomalySeverity.java b/sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/administration/models/AnomalySeverity.java
similarity index 95%
rename from sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/models/AnomalySeverity.java
rename to sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/administration/models/AnomalySeverity.java
index 515fbae35bcc2..2b061067e0cec 100644
--- a/sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/models/AnomalySeverity.java
+++ b/sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/administration/models/AnomalySeverity.java
@@ -2,7 +2,7 @@
// Licensed under the MIT License.
// Code generated by Microsoft (R) AutoRest Code Generator.
-package com.azure.ai.metricsadvisor.models;
+package com.azure.ai.metricsadvisor.administration.models;
import com.azure.core.util.ExpandableStringEnum;
import com.fasterxml.jackson.annotation.JsonCreator;
diff --git a/sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/models/AzureAppInsightsDataFeedSource.java b/sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/administration/models/AzureAppInsightsDataFeedSource.java
similarity index 96%
rename from sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/models/AzureAppInsightsDataFeedSource.java
rename to sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/administration/models/AzureAppInsightsDataFeedSource.java
index 8f567c6a70c77..c92c8c174a39c 100644
--- a/sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/models/AzureAppInsightsDataFeedSource.java
+++ b/sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/administration/models/AzureAppInsightsDataFeedSource.java
@@ -1,7 +1,7 @@
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License.
-package com.azure.ai.metricsadvisor.models;
+package com.azure.ai.metricsadvisor.administration.models;
import com.azure.core.annotation.Immutable;
diff --git a/sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/administration/models/AzureBlobDataFeedSource.java b/sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/administration/models/AzureBlobDataFeedSource.java
new file mode 100644
index 0000000000000..c209877adda84
--- /dev/null
+++ b/sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/administration/models/AzureBlobDataFeedSource.java
@@ -0,0 +1,125 @@
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// Licensed under the MIT License.
+
+package com.azure.ai.metricsadvisor.administration.models;
+
+import com.azure.ai.metricsadvisor.implementation.util.AzureBlobDataFeedSourceAccessor;
+import com.azure.core.annotation.Immutable;
+
+/**
+ * The AzureBlobDataFeedSource model.
+ */
+@Immutable
+public final class AzureBlobDataFeedSource extends DataFeedSource {
+ /*
+ * Azure Blob connection string
+ */
+ private final String connectionString;
+
+ /*
+ * Container
+ */
+ private final String container;
+
+ /*
+ * Blob Template
+ */
+ private final String blobTemplate;
+
+ /*
+ * The authentication type to access the data source.
+ */
+ private final DatasourceAuthenticationType authType;
+
+ static {
+ AzureBlobDataFeedSourceAccessor.setAccessor(
+ new AzureBlobDataFeedSourceAccessor.Accessor() {
+ @Override
+ public String getConnectionString(AzureBlobDataFeedSource feedSource) {
+ return feedSource.getConnectionString();
+ }
+ });
+ }
+
+ /**
+ * Create a AzureBlobDataFeedSource instance.
+ *
+ * @param connectionString the Azure Blob connection string
+ * @param container the container name
+ * @param blobTemplate the blob template name
+ */
+ private AzureBlobDataFeedSource(final String connectionString,
+ final String container,
+ final String blobTemplate,
+ final DatasourceAuthenticationType authType) {
+ this.connectionString = connectionString;
+ this.container = container;
+ this.blobTemplate = blobTemplate;
+ this.authType = authType;
+ }
+
+ /**
+ * Create a AzureBlobDataFeedSource with credential included in the {@code connectionString} as plain text.
+ *
+ * @param connectionString the Azure Blob connection string
+ * @param container the container name
+ * @param blobTemplate the blob template name
+ *
+ * @return The AzureBlobDataFeedSource.
+ */
+ public static AzureBlobDataFeedSource fromBasicCredential(final String connectionString,
+ final String container,
+ final String blobTemplate) {
+ return new AzureBlobDataFeedSource(connectionString, container, blobTemplate, DatasourceAuthenticationType.BASIC);
+ }
+
+ /**
+ * Create a SQLServerDataFeedSource with the {@code connectionString} containing the resource
+ * id of the SQL server on which metrics advisor has MSI access.
+ *
+ * @param connectionString the Azure Blob connection string
+ * @param container the container name
+ * @param blobTemplate the blob template name
+ *
+ * @return The AzureBlobDataFeedSource.
+ */
+ public static AzureBlobDataFeedSource fromManagedIdentityCredential(final String connectionString,
+ final String container,
+ final String blobTemplate) {
+ return new AzureBlobDataFeedSource(connectionString,
+ container,
+ blobTemplate,
+ DatasourceAuthenticationType.MANAGED_IDENTITY);
+ }
+
+ /**
+ * Get the container name.
+ *
+ * @return the container value.
+ */
+ public String getContainer() {
+ return this.container;
+ }
+
+ /**
+ * Get the blob template name.
+ *
+ * @return the blobTemplate value.
+ */
+ public String getBlobTemplate() {
+ return this.blobTemplate;
+ }
+
+ /**
+ * Gets the authentication type to access the data source.
+ *
+ * @return The authentication type.
+ */
+ public DatasourceAuthenticationType getAuthenticationType() {
+ return this.authType;
+ }
+
+ private String getConnectionString() {
+ return this.connectionString;
+ }
+}
diff --git a/sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/models/AzureCosmosDataFeedSource.java b/sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/administration/models/AzureCosmosDbDataFeedSource.java
similarity index 60%
rename from sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/models/AzureCosmosDataFeedSource.java
rename to sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/administration/models/AzureCosmosDbDataFeedSource.java
index cd63921a7239e..b8ce7f0cff184 100644
--- a/sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/models/AzureCosmosDataFeedSource.java
+++ b/sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/administration/models/AzureCosmosDbDataFeedSource.java
@@ -1,15 +1,16 @@
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License.
-package com.azure.ai.metricsadvisor.models;
+package com.azure.ai.metricsadvisor.administration.models;
+import com.azure.ai.metricsadvisor.implementation.util.AzureCosmosDbDataFeedSourceAccessor;
import com.azure.core.annotation.Immutable;
/**
- * The AzureCosmosDataFeedSource model.
+ * The AzureCosmosDbDataFeedSource model.
*/
@Immutable
-public final class AzureCosmosDataFeedSource extends DataFeedSource {
+public final class AzureCosmosDbDataFeedSource extends DataFeedSource {
/*
* Azure CosmosDB connection string
*/
@@ -30,31 +31,34 @@ public final class AzureCosmosDataFeedSource extends DataFeedSource {
*/
private final String collectionId;
+ static {
+ AzureCosmosDbDataFeedSourceAccessor.setAccessor(
+ new AzureCosmosDbDataFeedSourceAccessor.Accessor() {
+ @Override
+ public String getConnectionString(AzureCosmosDbDataFeedSource feedSource) {
+ return feedSource.getConnectionString();
+ }
+ });
+ }
+
/**
- * Create a AzureCosmosDataFeedSource instance
+ * Create a AzureCosmosDataFeedSource.
*
* @param connectionString the Azure CosmosDB connection string.
* @param sqlQuery the query script.
* @param database the database name.
* @param collectionId the collection Id value.
*/
- public AzureCosmosDataFeedSource(final String connectionString, final String sqlQuery, final String database,
- final String collectionId) {
+ public AzureCosmosDbDataFeedSource(final String connectionString,
+ final String sqlQuery,
+ final String database,
+ final String collectionId) {
this.connectionString = connectionString;
this.sqlQuery = sqlQuery;
this.database = database;
this.collectionId = collectionId;
}
- /**
- * Get the connectionString property: Azure CosmosDB connection string.
- *
- * @return the connectionString value.
- */
- public String getConnectionString() {
- return this.connectionString;
- }
-
/**
* Get the sqlQuery property: Query script.
*
@@ -84,4 +88,7 @@ public String getCollectionId() {
return this.collectionId;
}
+ private String getConnectionString() {
+ return this.connectionString;
+ }
}
diff --git a/sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/administration/models/AzureDataExplorerDataFeedSource.java b/sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/administration/models/AzureDataExplorerDataFeedSource.java
new file mode 100644
index 0000000000000..79c4bfe9fd1da
--- /dev/null
+++ b/sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/administration/models/AzureDataExplorerDataFeedSource.java
@@ -0,0 +1,157 @@
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// Licensed under the MIT License.
+
+package com.azure.ai.metricsadvisor.administration.models;
+
+import com.azure.ai.metricsadvisor.implementation.util.AzureDataExplorerDataFeedSourceAccessor;
+import com.azure.core.annotation.Immutable;
+
+/**
+ * The AzureDataExplorerDataFeedSource model.
+ */
+@Immutable
+public final class AzureDataExplorerDataFeedSource extends DataFeedSource {
+ /*
+ * Database connection string
+ */
+ private final String connectionString;
+
+ /*
+ * Query script
+ */
+ private final String query;
+
+ /*
+ * The id of the credential resource to authenticate the data source.
+ */
+ private final String credentialId;
+
+ /*
+ * The authentication type to access the data source.
+ */
+ private final DatasourceAuthenticationType authType;
+
+ static {
+ AzureDataExplorerDataFeedSourceAccessor.setAccessor(
+ new AzureDataExplorerDataFeedSourceAccessor.Accessor() {
+ @Override
+ public String getConnectionString(AzureDataExplorerDataFeedSource feedSource) {
+ return feedSource.getConnectionString();
+ }
+ });
+ }
+
+ private AzureDataExplorerDataFeedSource(final String connectionString,
+ final String query,
+ final String credentialId,
+ final DatasourceAuthenticationType authType) {
+ this.connectionString = connectionString;
+ this.query = query;
+ this.credentialId = credentialId;
+ this.authType = authType;
+ }
+
+ /**
+ * Create a AzureDataExplorerDataFeedSource with credential included in the {@code connectionString} as plain text.
+ *
+ * @param connectionString The connection string.
+ * @param query The query that retrieves the values to be analyzed for anomalies.
+ *
+ * @return The AzureDataExplorerDataFeedSource.
+ */
+ public static AzureDataExplorerDataFeedSource fromBasicCredential(final String connectionString,
+ final String query) {
+ return new AzureDataExplorerDataFeedSource(connectionString, query, null, DatasourceAuthenticationType.BASIC);
+ }
+
+ /**
+ * Create a AzureDataExplorerDataFeedSource with the {@code connectionString} containing the resource
+ * id of the SQL server on which metrics advisor has MSI access.
+ *
+ * @param connectionString The connection string.
+ * @param query The query that retrieves the values to be analyzed for anomalies.
+ *
+ * @return The AzureDataExplorerDataFeedSource.
+ */
+ public static AzureDataExplorerDataFeedSource fromManagedIdentityCredential(final String connectionString,
+ final String query) {
+ return new AzureDataExplorerDataFeedSource(connectionString,
+ query,
+ null,
+ DatasourceAuthenticationType.MANAGED_IDENTITY);
+ }
+
+ /**
+ * Create a AzureDataExplorerDataFeedSource with the {@code credentialId} identifying a credential
+ * entity of type {@link DatasourceServicePrincipal}, the entity contains
+ * Service Principal to access the SQL Server.
+ *
+ * @param connectionString The connection string.
+ * @param query The query that retrieves the values to be analyzed for anomalies.
+ * @param credentialId The unique id of a credential entity of type
+ * {@link DatasourceServicePrincipal}.
+ *
+ * @return The SQLServerDataFeedSource.
+ */
+ public static AzureDataExplorerDataFeedSource fromServicePrincipalCredential(final String connectionString,
+ final String query,
+ final String credentialId) {
+ return new AzureDataExplorerDataFeedSource(connectionString,
+ query,
+ credentialId,
+ DatasourceAuthenticationType.SERVICE_PRINCIPAL);
+ }
+
+ /**
+ * Create a AzureDataExplorerDataFeedSource with the {@code credentialId} identifying a credential
+ * entity of type {@link DatasourceServicePrincipalInKeyVault}, the entity contains
+ * details of the KeyVault holding the Service Principal to access the SQL Server.
+ *
+ * @param connectionString The connection string.
+ * @param query The query that retrieves the values to be analyzed for anomalies.
+ * @param credentialId The unique id of a credential entity of type
+ * {@link DatasourceServicePrincipalInKeyVault}.
+ *
+ * @return The AzureDataExplorerDataFeedSource.
+ */
+ public static AzureDataExplorerDataFeedSource fromServicePrincipalInKeyVaultCredential(
+ final String connectionString,
+ final String query,
+ final String credentialId) {
+ return new AzureDataExplorerDataFeedSource(connectionString,
+ query,
+ credentialId,
+ DatasourceAuthenticationType.SERVICE_PRINCIPAL_IN_KV);
+ }
+
+ /**
+ * Get the query property: Query script.
+ *
+ * @return the query value.
+ */
+ public String getQuery() {
+ return this.query;
+ }
+
+ /**
+ * Gets the id of the {@link DatasourceCredentialEntity credential resource} to authenticate the data source.
+ *
+ * @return The credential resource id.
+ */
+ public String getCredentialId() {
+ return this.credentialId;
+ }
+
+ /**
+ * Gets the authentication type to access the data source.
+ *
+ * @return The authentication type.
+ */
+ public DatasourceAuthenticationType getAuthenticationType() {
+ return this.authType;
+ }
+
+ private String getConnectionString() {
+ return this.connectionString;
+ }
+}
diff --git a/sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/administration/models/AzureDataLakeStorageGen2DataFeedSource.java b/sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/administration/models/AzureDataLakeStorageGen2DataFeedSource.java
new file mode 100644
index 0000000000000..46935d2bbfd7f
--- /dev/null
+++ b/sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/administration/models/AzureDataLakeStorageGen2DataFeedSource.java
@@ -0,0 +1,243 @@
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// Licensed under the MIT License.
+
+package com.azure.ai.metricsadvisor.administration.models;
+
+import com.azure.ai.metricsadvisor.implementation.util.AzureDataLakeStorageGen2DataFeedSourceAccessor;
+import com.azure.core.annotation.Immutable;
+
+/**
+ * The AzureDataLakeStorageGen2DataFeedSource model.
+ */
+@Immutable
+public final class AzureDataLakeStorageGen2DataFeedSource extends DataFeedSource {
+ /*
+ * Account name
+ */
+ private final String accountName;
+
+ /*
+ * Account key
+ */
+ private final String accountKey;
+
+ /*
+ * File system name (Container)
+ */
+ private final String fileSystemName;
+
+ /*
+ * Directory template
+ */
+ private final String directoryTemplate;
+
+ /*
+ * File template
+ */
+ private final String fileTemplate;
+
+ /*
+ * The id of the credential resource to authenticate the data source.
+ */
+ private final String credentialId;
+
+ /*
+ * The authentication type to access the data source.
+ */
+ private final DatasourceAuthenticationType authType;
+
+ static {
+ AzureDataLakeStorageGen2DataFeedSourceAccessor.setAccessor(
+ new AzureDataLakeStorageGen2DataFeedSourceAccessor.Accessor() {
+ @Override
+ public String getAccountKey(AzureDataLakeStorageGen2DataFeedSource feedSource) {
+ return feedSource.getAccountKey();
+ }
+ });
+ }
+
+ private AzureDataLakeStorageGen2DataFeedSource(final String accountName,
+ final String accountKey,
+ final String fileSystemName,
+ final String directoryTemplate,
+ final String fileTemplate,
+ final String credentialId,
+ final DatasourceAuthenticationType authType) {
+ this.accountName = accountName;
+ this.accountKey = accountKey;
+ this.fileSystemName = fileSystemName;
+ this.directoryTemplate = directoryTemplate;
+ this.fileTemplate = fileTemplate;
+ this.credentialId = credentialId;
+ this.authType = authType;
+ }
+
+ /**
+ * Create a AzureDataLakeStorageGen2DataFeedSource with the given {@code accountKey} for authentication.
+ *
+ * @param accountName the name of the storage account.
+ * @param accountKey the key of the storage account.
+ * @param fileSystemName the file system name.
+ * @param directoryTemplate the directory template of the storage account.
+ * @param fileTemplate the file template.
+ *
+ * @return The AzureDataLakeStorageGen2DataFeedSource.
+ */
+ public static AzureDataLakeStorageGen2DataFeedSource fromBasicCredential(final String accountName,
+ final String accountKey,
+ final String fileSystemName,
+ final String directoryTemplate,
+ final String fileTemplate) {
+ return new AzureDataLakeStorageGen2DataFeedSource(accountName,
+ accountKey,
+ fileSystemName,
+ directoryTemplate,
+ fileTemplate,
+ null,
+ DatasourceAuthenticationType.BASIC);
+ }
+
+ /**
+ * Create a AzureDataLakeStorageGen2DataFeedSource with the {@code credentialId} identifying
+ * a credential entity of type {@link DatasourceSqlServerConnectionString} that contains
+ * the shared access key.
+ *
+ * @param accountName the name of the storage account.
+ * @param fileSystemName the file system name.
+ * @param directoryTemplate the directory template of the storage account.
+ * @param fileTemplate the file template.
+ * @param credentialId The unique id of a credential entity of type
+ * {@link DatasourceDataLakeGen2SharedKey}.
+ *
+ * @return The AzureDataLakeStorageGen2DataFeedSource.
+ */
+ public static AzureDataLakeStorageGen2DataFeedSource fromSharedKeyCredential(
+ final String accountName,
+ final String fileSystemName,
+ final String directoryTemplate,
+ final String fileTemplate,
+ final String credentialId) {
+ return new AzureDataLakeStorageGen2DataFeedSource(accountName,
+ null,
+ fileSystemName,
+ directoryTemplate,
+ fileTemplate,
+ credentialId,
+ DatasourceAuthenticationType.DATA_LAKE_GEN2_SHARED_KEY);
+ }
+
+ /**
+ * Create a AzureDataLakeStorageGen2DataFeedSource with the {@code credentialId}
+ * identifying a credential entity of type {@link DatasourceServicePrincipal},
+ * the entity contains Service Principal to access the Data Lake storage.
+ *
+ * @param accountName the name of the storage account.
+ * @param fileSystemName the file system name.
+ * @param directoryTemplate the directory template of the storage account.
+ * @param fileTemplate the file template.
+ * @param credentialId The unique id of a credential entity of type
+ * {@link DatasourceServicePrincipal}.
+ *
+ * @return The AzureDataLakeStorageGen2DataFeedSource.
+ */
+ public static AzureDataLakeStorageGen2DataFeedSource fromServicePrincipalCredential(final String accountName,
+ final String fileSystemName,
+ final String directoryTemplate,
+ final String fileTemplate,
+ final String credentialId) {
+ return new AzureDataLakeStorageGen2DataFeedSource(accountName,
+ null,
+ fileSystemName,
+ directoryTemplate,
+ fileTemplate,
+ credentialId,
+ DatasourceAuthenticationType.SERVICE_PRINCIPAL);
+ }
+
+ /**
+ * Create a AzureDataLakeStorageGen2DataFeedSource with the {@code credentialId} identifying
+ * a credential entity of type {@link DatasourceServicePrincipalInKeyVault}, the entity
+ * contains details of the KeyVault holding the Service Principal to access the Data Lake storage.
+ *
+ * @param accountName the name of the storage account.
+ * @param fileSystemName the file system name.
+ * @param directoryTemplate the directory template of the storage account.
+ * @param fileTemplate the file template.
+ * @param credentialId The unique id of a credential entity of type
+ * {@link DatasourceServicePrincipalInKeyVault}
+ *
+ * @return The AzureDataLakeStorageGen2DataFeedSource.
+ */
+ public static AzureDataLakeStorageGen2DataFeedSource fromServicePrincipalInKeyVaultCredential(
+ final String accountName,
+ final String fileSystemName,
+ final String directoryTemplate,
+ final String fileTemplate,
+ final String credentialId) {
+ return new AzureDataLakeStorageGen2DataFeedSource(accountName,
+ null,
+ fileSystemName,
+ directoryTemplate,
+ fileTemplate,
+ credentialId,
+ DatasourceAuthenticationType.SERVICE_PRINCIPAL_IN_KV);
+ }
+
+ /**
+ * Get the the account name for the AzureDataLakeStorageGen2DataFeedSource.
+ *
+ * @return the accountName value.
+ */
+ public String getAccountName() {
+ return this.accountName;
+ }
+
+ /**
+ * Get the file system name or the container name.
+ *
+ * @return the fileSystemName value.
+ */
+ public String getFileSystemName() {
+ return this.fileSystemName;
+ }
+
+ /**
+ * Get the directory template.
+ *
+ * @return the directoryTemplate value.
+ */
+ public String getDirectoryTemplate() {
+ return this.directoryTemplate;
+ }
+
+ /**
+ * Get the file template.
+ *
+ * @return the fileTemplate value.
+ */
+ public String getFileTemplate() {
+ return this.fileTemplate;
+ }
+
+ /**
+ * Gets the id of the {@link DatasourceCredentialEntity credential resource} to authenticate the data source.
+ *
+ * @return The credential resource id.
+ */
+ public String getCredentialId() {
+ return this.credentialId;
+ }
+
+ /**
+ * Gets the authentication type to access the data source.
+ *
+ * @return The authentication type.
+ */
+ public DatasourceAuthenticationType getAuthenticationType() {
+ return this.authType;
+ }
+
+ private String getAccountKey() {
+ return this.accountKey;
+ }
+}
diff --git a/sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/models/AzureEventHubsDataFeedSource.java b/sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/administration/models/AzureEventHubsDataFeedSource.java
similarity index 66%
rename from sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/models/AzureEventHubsDataFeedSource.java
rename to sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/administration/models/AzureEventHubsDataFeedSource.java
index 6db59ca5d855d..41c0822f837e1 100644
--- a/sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/models/AzureEventHubsDataFeedSource.java
+++ b/sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/administration/models/AzureEventHubsDataFeedSource.java
@@ -1,8 +1,9 @@
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License.
-package com.azure.ai.metricsadvisor.models;
+package com.azure.ai.metricsadvisor.administration.models;
+import com.azure.ai.metricsadvisor.implementation.util.AzureEventHubsDataFeedSourceAccessor;
import com.azure.core.annotation.Immutable;
/**
@@ -19,6 +20,16 @@ public final class AzureEventHubsDataFeedSource extends DataFeedSource {
*/
private final String consumerGroup;
+ static {
+ AzureEventHubsDataFeedSourceAccessor.setAccessor(
+ new AzureEventHubsDataFeedSourceAccessor.Accessor() {
+ @Override
+ public String getConnectionString(AzureEventHubsDataFeedSource feedSource) {
+ return feedSource.getConnectionString();
+ }
+ });
+ }
+
/**
* Create a AzureEventHubsDataFeedSource instance
*
@@ -30,15 +41,6 @@ public AzureEventHubsDataFeedSource(final String connectionString, final String
this.consumerGroup = consumerGroup;
}
- /**
- * Gets the Azure EventHub connection string.
- *
- * @return the connectionString value.
- */
- public String getConnectionString() {
- return this.connectionString;
- }
-
/**
* Gets the Azure EventHub consumer group.
*
@@ -47,4 +49,8 @@ public String getConnectionString() {
public String getConsumerGroup() {
return this.consumerGroup;
}
+
+ private String getConnectionString() {
+ return this.connectionString;
+ }
}
diff --git a/sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/administration/models/AzureLogAnalyticsDataFeedSource.java b/sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/administration/models/AzureLogAnalyticsDataFeedSource.java
new file mode 100644
index 0000000000000..2fafb3b63f264
--- /dev/null
+++ b/sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/administration/models/AzureLogAnalyticsDataFeedSource.java
@@ -0,0 +1,209 @@
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// Licensed under the MIT License.
+// Code generated by Microsoft (R) AutoRest Code Generator.
+
+package com.azure.ai.metricsadvisor.administration.models;
+
+import com.azure.ai.metricsadvisor.implementation.util.AzureLogAnalyticsDataFeedSourceAccessor;
+import com.azure.core.annotation.Immutable;
+
+/** The AzureLogAnalyticsDataFeedSource model. */
+@Immutable
+public final class AzureLogAnalyticsDataFeedSource extends DataFeedSource {
+ /*
+ * The tenant id of service principal that have access to this Log
+ * Analytics
+ */
+ private final String tenantId;
+
+ /*
+ * The client id of service principal that have access to this Log
+ * Analytics
+ */
+ private final String clientId;
+
+ /*
+ * The client secret of service principal that have access to this Log
+ * Analytics
+ */
+ private final String clientSecret;
+
+ /*
+ * The workspace id of this Log Analytics
+ */
+ private final String workspaceId;
+
+ /*
+ * The KQL (Kusto Query Language) query to fetch data from this Log
+ * Analytics
+ */
+ private final String query;
+
+ /*
+ * The id of the credential resource to authenticate the data source.
+ */
+ private final String credentialId;
+
+ /*
+ * The authentication type to access the data source.
+ */
+ private final DatasourceAuthenticationType authType;
+
+ static {
+ AzureLogAnalyticsDataFeedSourceAccessor.setAccessor(
+ new AzureLogAnalyticsDataFeedSourceAccessor.Accessor() {
+ @Override
+ public String getClientSecret(AzureLogAnalyticsDataFeedSource feedSource) {
+ return feedSource.getClientSecret();
+ }
+ });
+ }
+
+ private AzureLogAnalyticsDataFeedSource(final String tenantId,
+ final String clientId,
+ final String clientSecret,
+ final String workspaceId,
+ final String query,
+ final String credentialId,
+ final DatasourceAuthenticationType authType) {
+ this.tenantId = tenantId;
+ this.clientId = clientId;
+ this.clientSecret = clientSecret;
+ this.workspaceId = workspaceId;
+ this.query = query;
+ this.credentialId = credentialId;
+ this.authType = authType;
+ }
+
+ /**
+ * Create a AzureLogAnalyticsDataFeedSource with the given {@code tenantId}, {@code clientId} and
+ * {@code clientSecret} for authentication.
+ *
+ * @param tenantId The tenant id of service principal that have access to this Log Analytics.
+ * @param clientId The client id of service principal that have access to this Log Analytics.
+ * @param clientSecret The client secret of service principal that have access to this Log Analytics.
+ * @param workspaceId the query script.
+ * @param query the KQL (Kusto Query Language) query to fetch data from this Log
+ * Analytics.
+ *
+ * @return The AzureLogAnalyticsDataFeedSource.
+ */
+ public static AzureLogAnalyticsDataFeedSource fromBasicCredential(final String tenantId,
+ final String clientId,
+ final String clientSecret,
+ final String workspaceId,
+ final String query) {
+ return new AzureLogAnalyticsDataFeedSource(tenantId,
+ clientId,
+ clientSecret,
+ workspaceId,
+ query,
+ null,
+ DatasourceAuthenticationType.BASIC);
+ }
+
+ /**
+ * Create a AzureLogAnalyticsDataFeedSource with the {@code credentialId} identifying
+ * a credential entity of type {@link DatasourceServicePrincipal}, the entity
+ * contains details of the KeyVault holding the Service Principal to access the Data Lake storage.
+ *
+ * @param workspaceId the query script.
+ * @param query the KQL (Kusto Query Language) query to fetch data from this Log Analytics.
+ * @param credentialId The unique id of a credential entity of type
+ *
+ * @return The AzureLogAnalyticsDataFeedSource.
+ */
+ public static AzureLogAnalyticsDataFeedSource fromServicePrincipalCredential(final String workspaceId,
+ final String query,
+ final String credentialId) {
+ return new AzureLogAnalyticsDataFeedSource(null,
+ null,
+ null,
+ workspaceId,
+ query,
+ credentialId,
+ DatasourceAuthenticationType.SERVICE_PRINCIPAL);
+ }
+
+ /**
+ * Create a AzureLogAnalyticsDataFeedSource with the {@code credentialId} identifying
+ * a credential entity of type {@link DatasourceServicePrincipalInKeyVault}, the entity
+ * contains details of the KeyVault holding the Service Principal to access the Data Lake storage.
+ *
+ * @param workspaceId the query script.
+ * @param query the KQL (Kusto Query Language) query to fetch data from this Log Analytics.
+ * @param credentialId The unique id of a credential entity of type
+ *
+ * @return The AzureLogAnalyticsDataFeedSource.
+ */
+ public static AzureLogAnalyticsDataFeedSource fromServicePrincipalInKeyVaultCredential(
+ final String workspaceId,
+ final String query,
+ final String credentialId) {
+ return new AzureLogAnalyticsDataFeedSource(null,
+ null,
+ null,
+ workspaceId,
+ query,
+ credentialId,
+ DatasourceAuthenticationType.SERVICE_PRINCIPAL_IN_KV);
+ }
+
+ /**
+ * Get the tenantId property: The tenant id of service principal that have access to this Log Analytics.
+ *
+ * @return the tenantId value.
+ */
+ public String getTenantId() {
+ return this.tenantId;
+ }
+
+ /**
+ * Get the clientId property: The client id of service principal that have access to this Log Analytics.
+ *
+ * @return the clientId value.
+ */
+ public String getClientId() {
+ return this.clientId;
+ }
+
+ /**
+ * Get the workspaceId property: The workspace id of this Log Analytics.
+ *
+ * @return the workspaceId value.
+ */
+ public String getWorkspaceId() {
+ return this.workspaceId;
+ }
+
+ /**
+ * Get the query property: The KQL (Kusto Query Language) query to fetch data from this Log Analytics.
+ *
+ * @return the query value.
+ */
+ public String getQuery() {
+ return this.query;
+ }
+
+ /**
+ * Gets the id of the {@link DatasourceCredentialEntity credential resource} to authenticate the data source.
+ *
+ * @return The credential resource id.
+ */
+ public String getCredentialId() {
+ return this.credentialId;
+ }
+
+ /**
+ * Gets the authentication type to access the data source.
+ *
+ * @return The authentication type.
+ */
+ public DatasourceAuthenticationType getAuthenticationType() {
+ return this.authType;
+ }
+
+ private String getClientSecret() {
+ return this.clientSecret;
+ }
+}
diff --git a/sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/models/AzureTableDataFeedSource.java b/sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/administration/models/AzureTableDataFeedSource.java
similarity index 71%
rename from sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/models/AzureTableDataFeedSource.java
rename to sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/administration/models/AzureTableDataFeedSource.java
index 33a942675588f..639f76f58d0da 100644
--- a/sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/models/AzureTableDataFeedSource.java
+++ b/sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/administration/models/AzureTableDataFeedSource.java
@@ -1,8 +1,9 @@
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License.
-package com.azure.ai.metricsadvisor.models;
+package com.azure.ai.metricsadvisor.administration.models;
+import com.azure.ai.metricsadvisor.implementation.util.AzureTableDataFeedSourceAccessor;
import com.azure.core.annotation.Immutable;
/**
@@ -25,6 +26,16 @@ public final class AzureTableDataFeedSource extends DataFeedSource {
*/
private final String table;
+ static {
+ AzureTableDataFeedSourceAccessor.setAccessor(
+ new AzureTableDataFeedSourceAccessor.Accessor() {
+ @Override
+ public String getConnectionString(AzureTableDataFeedSource feedSource) {
+ return feedSource.getConnectionString();
+ }
+ });
+ }
+
/**
* Create a AzureTableDataFeedSource instance.
*
@@ -38,15 +49,6 @@ public AzureTableDataFeedSource(final String connectionString, final String scri
this.table = table;
}
- /**
- * Get the connectionString property: Azure Table connection string.
- *
- * @return the connectionString value.
- */
- public String getConnectionString() {
- return this.connectionString;
- }
-
/**
* Get the script property: Query script.
*
@@ -64,4 +66,8 @@ public String getQueryScript() {
public String getTableName() {
return this.table;
}
+
+ private String getConnectionString() {
+ return this.connectionString;
+ }
}
diff --git a/sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/administration/models/BoundaryDirection.java b/sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/administration/models/BoundaryDirection.java
new file mode 100644
index 0000000000000..cbfe1341058ba
--- /dev/null
+++ b/sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/administration/models/BoundaryDirection.java
@@ -0,0 +1,44 @@
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// Licensed under the MIT License.
+
+package com.azure.ai.metricsadvisor.administration.models;
+
+import com.azure.core.util.ExpandableStringEnum;
+
+import java.util.Collection;
+
+/**
+ * Describes the direction of boundary used in anomaly boundary conditions.
+ */
+public final class BoundaryDirection extends ExpandableStringEnum {
+ /**
+ * Defines the lower boundary in a boundary condition.
+ */
+ public static final BoundaryDirection LOWER = fromString("LOWER");
+ /**
+ * Defines the upper boundary in a boundary condition.
+ */
+ public static final BoundaryDirection UPPER = fromString("UPPER");
+ /**
+ * Defines both lower and upper boundary in a boundary condition.
+ */
+ public static final BoundaryDirection BOTH = fromString("BOTH");
+
+ /**
+ * Creates or finds a BoundaryDirection from its string representation.
+ *
+ * @param name a name to look for.
+ *
+ * @return the corresponding BoundaryDirection.
+ */
+ public static BoundaryDirection fromString(String name) {
+ return fromString(name, BoundaryDirection.class);
+ }
+
+ /**
+ * @return known BoundaryDirection values.
+ */
+ public static Collection values() {
+ return values(BoundaryDirection.class);
+ }
+}
diff --git a/sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/models/ChangeThresholdCondition.java b/sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/administration/models/ChangeThresholdCondition.java
similarity index 98%
rename from sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/models/ChangeThresholdCondition.java
rename to sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/administration/models/ChangeThresholdCondition.java
index de42c851a7a49..766adb156073b 100644
--- a/sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/models/ChangeThresholdCondition.java
+++ b/sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/administration/models/ChangeThresholdCondition.java
@@ -2,7 +2,7 @@
// Licensed under the MIT License.
// Code generated by Microsoft (R) AutoRest Code Generator.
-package com.azure.ai.metricsadvisor.models;
+package com.azure.ai.metricsadvisor.administration.models;
import com.azure.core.annotation.Fluent;
import com.fasterxml.jackson.annotation.JsonProperty;
diff --git a/sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/models/DataFeed.java b/sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/administration/models/DataFeed.java
similarity index 99%
rename from sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/models/DataFeed.java
rename to sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/administration/models/DataFeed.java
index b1366e6f7c616..dea6bac5a1a66 100644
--- a/sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/models/DataFeed.java
+++ b/sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/administration/models/DataFeed.java
@@ -1,7 +1,7 @@
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License.
-package com.azure.ai.metricsadvisor.models;
+package com.azure.ai.metricsadvisor.administration.models;
import com.azure.ai.metricsadvisor.implementation.util.DataFeedHelper;
import com.azure.core.annotation.Fluent;
diff --git a/sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/models/DataFeedAccessMode.java b/sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/administration/models/DataFeedAccessMode.java
similarity index 94%
rename from sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/models/DataFeedAccessMode.java
rename to sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/administration/models/DataFeedAccessMode.java
index d9e10b2899cb0..5385fd33c2a01 100644
--- a/sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/models/DataFeedAccessMode.java
+++ b/sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/administration/models/DataFeedAccessMode.java
@@ -1,7 +1,7 @@
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License.
-package com.azure.ai.metricsadvisor.models;
+package com.azure.ai.metricsadvisor.administration.models;
import com.azure.core.util.ExpandableStringEnum;
diff --git a/sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/models/DataFeedAutoRollUpMethod.java b/sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/administration/models/DataFeedAutoRollUpMethod.java
similarity index 96%
rename from sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/models/DataFeedAutoRollUpMethod.java
rename to sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/administration/models/DataFeedAutoRollUpMethod.java
index 30ab0ecea82e0..01d37db24d5ee 100644
--- a/sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/models/DataFeedAutoRollUpMethod.java
+++ b/sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/administration/models/DataFeedAutoRollUpMethod.java
@@ -1,7 +1,7 @@
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License.
-package com.azure.ai.metricsadvisor.models;
+package com.azure.ai.metricsadvisor.administration.models;
import com.azure.core.util.ExpandableStringEnum;
diff --git a/sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/models/DataFeedDimension.java b/sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/administration/models/DataFeedDimension.java
similarity index 96%
rename from sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/models/DataFeedDimension.java
rename to sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/administration/models/DataFeedDimension.java
index 99352e1de42c9..5888a5b7600a9 100644
--- a/sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/models/DataFeedDimension.java
+++ b/sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/administration/models/DataFeedDimension.java
@@ -2,7 +2,7 @@
// Licensed under the MIT License.
// Code generated by Microsoft (R) AutoRest Code Generator.
-package com.azure.ai.metricsadvisor.models;
+package com.azure.ai.metricsadvisor.administration.models;
import com.azure.core.annotation.Fluent;
import com.fasterxml.jackson.annotation.JsonProperty;
diff --git a/sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/models/DataFeedGranularity.java b/sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/administration/models/DataFeedGranularity.java
similarity index 96%
rename from sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/models/DataFeedGranularity.java
rename to sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/administration/models/DataFeedGranularity.java
index ac094cb255d6f..7ede4aaebff29 100644
--- a/sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/models/DataFeedGranularity.java
+++ b/sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/administration/models/DataFeedGranularity.java
@@ -1,7 +1,7 @@
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License.
-package com.azure.ai.metricsadvisor.models;
+package com.azure.ai.metricsadvisor.administration.models;
import com.azure.core.annotation.Fluent;
diff --git a/sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/models/DataFeedGranularityType.java b/sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/administration/models/DataFeedGranularityType.java
similarity index 90%
rename from sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/models/DataFeedGranularityType.java
rename to sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/administration/models/DataFeedGranularityType.java
index 8e285f3d89a27..717f8e04897d9 100644
--- a/sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/models/DataFeedGranularityType.java
+++ b/sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/administration/models/DataFeedGranularityType.java
@@ -1,7 +1,7 @@
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License.
-package com.azure.ai.metricsadvisor.models;
+package com.azure.ai.metricsadvisor.administration.models;
import com.azure.core.util.ExpandableStringEnum;
@@ -41,11 +41,6 @@ public final class DataFeedGranularityType extends ExpandableStringEnum {
+ /**
+ * Enum value NoRollup.
+ */
+ public static final DataFeedRollupType NO_ROLLUP = fromString("NoRollup");
+
+ /**
+ * Enum value NeedRollup.
+ */
+ public static final DataFeedRollupType AUTO_ROLLUP = fromString("NeedRollup");
+
+ /**
+ * Enum value AlreadyRollup.
+ */
+ public static final DataFeedRollupType ALREADY_ROLLUP = fromString("AlreadyRollup");
+
+ /**
+ * Creates or finds a DataFeedRollupType from its string representation.
+ *
+ * @param name a name to look for.
+ *
+ * @return the corresponding DataFeedRollupType.
+ */
+ public static DataFeedRollupType fromString(String name) {
+ return fromString(name, DataFeedRollupType.class);
+ }
+
+ /**
+ * @return known DataFeedRollupType values.
+ */
+ public static Collection values() {
+ return values(DataFeedRollupType.class);
+ }
+}
diff --git a/sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/models/DataFeedSchema.java b/sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/administration/models/DataFeedSchema.java
similarity index 97%
rename from sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/models/DataFeedSchema.java
rename to sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/administration/models/DataFeedSchema.java
index 107b4b132a82d..e7d1b3851cef8 100644
--- a/sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/models/DataFeedSchema.java
+++ b/sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/administration/models/DataFeedSchema.java
@@ -1,7 +1,7 @@
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License.
-package com.azure.ai.metricsadvisor.models;
+package com.azure.ai.metricsadvisor.administration.models;
import com.azure.core.annotation.Fluent;
diff --git a/sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/administration/models/DataFeedSource.java b/sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/administration/models/DataFeedSource.java
new file mode 100644
index 0000000000000..03ef40cb5b761
--- /dev/null
+++ b/sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/administration/models/DataFeedSource.java
@@ -0,0 +1,29 @@
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// Licensed under the MIT License.
+
+package com.azure.ai.metricsadvisor.administration.models;
+
+import com.azure.ai.metricsadvisor.models.InfluxDbDataFeedSource;
+
+/**
+ * The {@link DataFeedSource} represents the base type for different
+ * types of data sources that service can ingest data and perform
+ * anomaly detection.
+ *
+ * @see AzureAppInsightsDataFeedSource
+ * @see AzureBlobDataFeedSource
+ * @see AzureCosmosDbDataFeedSource
+ * @see AzureDataExplorerDataFeedSource
+ * @see AzureDataLakeStorageGen2DataFeedSource
+ * @see AzureEventHubsDataFeedSource
+ * @see AzureLogAnalyticsDataFeedSource
+ * @see AzureTableDataFeedSource
+ * @see InfluxDbDataFeedSource
+ * @see MongoDbDataFeedSource
+ * @see MySqlDataFeedSource
+ * @see PostgreSqlDataFeedSource
+ * @see SqlServerDataFeedSource
+ */
+public abstract class DataFeedSource {
+ // No common properties, used only as discriminator type.
+}
diff --git a/sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/administration/models/DataFeedSourceType.java b/sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/administration/models/DataFeedSourceType.java
new file mode 100644
index 0000000000000..45c6b7ce23a3d
--- /dev/null
+++ b/sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/administration/models/DataFeedSourceType.java
@@ -0,0 +1,97 @@
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// Licensed under the MIT License.
+
+package com.azure.ai.metricsadvisor.administration.models;
+
+import com.azure.core.util.ExpandableStringEnum;
+
+import java.util.Collection;
+
+/**
+ * Defines values for all supported data sources types.
+ */
+public final class DataFeedSourceType extends ExpandableStringEnum {
+
+ /**
+ * Static value AzureApplicationInsights for DataFeedSourceType.
+ */
+ public static final DataFeedSourceType AZURE_APP_INSIGHTS = fromString("AzureApplicationInsights");
+
+ /**
+ * Static value AzureBlob for DataFeedSourceType.
+ */
+ public static final DataFeedSourceType AZURE_BLOB = fromString("AzureBlob");
+
+ /**
+ * Static value AzureDataExplorer for DataFeedSourceType..
+ */
+ public static final DataFeedSourceType AZURE_DATA_EXPLORER = fromString("AzureDataExplorer");
+
+ /**
+ * Static value AzureEventHubs for DataFeedSourceType..
+ */
+ public static final DataFeedSourceType AZURE_EVENT_HUBS = fromString("AzureEventHubs");
+
+ /**
+ * Static value AzureTable for DataFeedSourceType..
+ */
+ public static final DataFeedSourceType AZURE_TABLE = fromString("AzureTable");
+
+ /**
+ * Static value InfluxDB for DataFeedSourceType..
+ */
+ public static final DataFeedSourceType INFLUX_DB = fromString("InfluxDB");
+
+ /**
+ * Static value MongoDB for DataFeedSourceType..
+ */
+ public static final DataFeedSourceType MONGO_DB = fromString("MongoDB");
+
+ /**
+ * Static value MySql for DataFeedSourceType..
+ */
+ public static final DataFeedSourceType MYSQL_DB = fromString("MySql");
+
+ /**
+ * Static value PostgreSql for DataFeedSourceType..
+ */
+ public static final DataFeedSourceType POSTGRE_SQL_DB = fromString("PostgreSql");
+
+ /**
+ * Static value SqlServer.
+ */
+ public static final DataFeedSourceType SQL_SERVER_DB = fromString("SqlServer");
+
+ /**
+ * Static value AzureCosmosDB for DataFeedSourceType..
+ */
+ public static final DataFeedSourceType AZURE_COSMOS_DB = fromString("AzureCosmosDB");
+
+ /**
+ * Enum value AzureDataLakeStorageGen2 for DataFeedSourceType..
+ */
+ public static final DataFeedSourceType AZURE_DATA_LAKE_STORAGE_GEN2 = fromString("AzureDataLakeStorageGen2");
+
+ /**
+ * Enum value AzureLogAnalytics for DataFeedSourceType..
+ */
+ public static final DataFeedSourceType AZURE_LOG_ANALYTICS = fromString("AzureLogAnalytics");
+
+ /**
+ * Creates or finds a DataFeedSourceType from its string representation.
+ *
+ * @param name a name to look for.
+ *
+ * @return the corresponding DataFeedSourceType.
+ */
+ public static DataFeedSourceType fromString(String name) {
+ return fromString(name, DataFeedSourceType.class);
+ }
+
+ /**
+ * @return known DataFeedSourceType values.
+ */
+ public static Collection values() {
+ return values(DataFeedSourceType.class);
+ }
+}
diff --git a/sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/models/DataFeedStatus.java b/sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/administration/models/DataFeedStatus.java
similarity index 95%
rename from sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/models/DataFeedStatus.java
rename to sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/administration/models/DataFeedStatus.java
index ba1e977b39028..61e6365770546 100644
--- a/sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/models/DataFeedStatus.java
+++ b/sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/administration/models/DataFeedStatus.java
@@ -2,7 +2,7 @@
// Licensed under the MIT License.
// Code generated by Microsoft (R) AutoRest Code Generator.
-package com.azure.ai.metricsadvisor.models;
+package com.azure.ai.metricsadvisor.administration.models;
import com.azure.core.util.ExpandableStringEnum;
import com.fasterxml.jackson.annotation.JsonCreator;
diff --git a/sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/administration/models/DatasourceAuthenticationType.java b/sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/administration/models/DatasourceAuthenticationType.java
new file mode 100644
index 0000000000000..537f8c700f607
--- /dev/null
+++ b/sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/administration/models/DatasourceAuthenticationType.java
@@ -0,0 +1,47 @@
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// Licensed under the MIT License.
+
+package com.azure.ai.metricsadvisor.administration.models;
+
+import com.azure.core.util.ExpandableStringEnum;
+import com.fasterxml.jackson.annotation.JsonCreator;
+
+import java.util.Collection;
+
+/** Defines values for DataSourceAuthenticationType. */
+public final class DatasourceAuthenticationType extends ExpandableStringEnum {
+ /** Static value Basic for DataSourceAuthenticationType. */
+ public static final DatasourceAuthenticationType BASIC = fromString("Basic");
+
+ /** Static value ManagedIdentity for DataSourceAuthenticationType. */
+ public static final DatasourceAuthenticationType MANAGED_IDENTITY = fromString("ManagedIdentity");
+
+ /** Static value AzureSQLConnectionString for DataSourceAuthenticationType. */
+ public static final DatasourceAuthenticationType AZURE_SQL_CONNECTION_STRING
+ = fromString("AzureSQLConnectionString");
+
+ /** Static value DataLakeGen2SharedKey for DataSourceAuthenticationType. */
+ public static final DatasourceAuthenticationType DATA_LAKE_GEN2_SHARED_KEY = fromString("DataLakeGen2SharedKey");
+
+ /** Static value ServicePrincipal for DataSourceAuthenticationType. */
+ public static final DatasourceAuthenticationType SERVICE_PRINCIPAL = fromString("ServicePrincipal");
+
+ /** Static value ServicePrincipalInKV for DataSourceAuthenticationType. */
+ public static final DatasourceAuthenticationType SERVICE_PRINCIPAL_IN_KV = fromString("ServicePrincipalInKV");
+
+ /**
+ * Creates or finds a AuthenticationTypeEnum from its string representation.
+ *
+ * @param name a name to look for.
+ * @return the corresponding AuthenticationTypeEnum.
+ */
+ @JsonCreator
+ public static DatasourceAuthenticationType fromString(String name) {
+ return fromString(name, DatasourceAuthenticationType.class);
+ }
+
+ /** @return known AuthenticationTypeEnum values. */
+ public static Collection values() {
+ return values(DatasourceAuthenticationType.class);
+ }
+}
diff --git a/sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/administration/models/DatasourceCredentialEntity.java b/sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/administration/models/DatasourceCredentialEntity.java
new file mode 100644
index 0000000000000..a998b7c73c5ea
--- /dev/null
+++ b/sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/administration/models/DatasourceCredentialEntity.java
@@ -0,0 +1,34 @@
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// Licensed under the MIT License.
+
+package com.azure.ai.metricsadvisor.administration.models;
+
+/**
+ * The base credential type for different types of authentication
+ * that service uses to access the data sources {@link DataFeedSource}.
+ *
+ * @see DatasourceDataLakeGen2SharedKey
+ * @see DatasourceServicePrincipal
+ * @see DatasourceServicePrincipalInKeyVault
+ * @see DatasourceSqlServerConnectionString
+ */
+public abstract class DatasourceCredentialEntity {
+ /**
+ * Gets the credential id.
+ *
+ * @return The credential id.
+ */
+ public abstract String getId();
+ /**
+ * Gets the credential name.
+ *
+ * @return The credential name.
+ */
+ public abstract String getName();
+ /**
+ * Gets the credential description.
+ *
+ * @return The credential description.
+ */
+ public abstract String getDescription();
+}
diff --git a/sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/administration/models/DatasourceDataLakeGen2SharedKey.java b/sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/administration/models/DatasourceDataLakeGen2SharedKey.java
new file mode 100644
index 0000000000000..4b8cb5e11edfc
--- /dev/null
+++ b/sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/administration/models/DatasourceDataLakeGen2SharedKey.java
@@ -0,0 +1,100 @@
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// Licensed under the MIT License.
+
+package com.azure.ai.metricsadvisor.administration.models;
+
+import com.azure.ai.metricsadvisor.implementation.util.DataSourceDataLakeGen2SharedKeyAccessor;
+import com.azure.core.annotation.Fluent;
+
+/**
+ * The shared key credential entity for DataLakeGen2.
+ */
+@Fluent
+public final class DatasourceDataLakeGen2SharedKey extends DatasourceCredentialEntity {
+ private String id;
+ private String name;
+ private String description;
+ private String sharedKey;
+
+ static {
+ DataSourceDataLakeGen2SharedKeyAccessor.setAccessor(
+ new DataSourceDataLakeGen2SharedKeyAccessor.Accessor() {
+ @Override
+ public void setId(DatasourceDataLakeGen2SharedKey entity, String id) {
+ entity.setId(id);
+ }
+
+ @Override
+ public String getSharedKey(DatasourceDataLakeGen2SharedKey entity) {
+ return entity.getSharedKey();
+ }
+ });
+ }
+
+ @Override
+ public String getId() {
+ return this.id;
+ }
+
+ @Override
+ public String getName() {
+ return this.name;
+ }
+
+ @Override
+ public String getDescription() {
+ return this.description;
+ }
+
+ /**
+ * Creates DataSourceDataLakeGen2SharedKey.
+ *
+ * @param name The name
+ * @param sharedKey The shared key
+ */
+ public DatasourceDataLakeGen2SharedKey(String name, String sharedKey) {
+ this.name = name;
+ this.sharedKey = sharedKey;
+ }
+
+ /**
+ * Sets the name.
+ *
+ * @param name The name
+ * @return an updated object with name set
+ */
+ public DatasourceDataLakeGen2SharedKey setName(String name) {
+ this.name = name;
+ return this;
+ }
+
+ /**
+ * Sets the shared key.
+ *
+ * @param sharedKey The shared key
+ * @return an updated object with shared key set
+ */
+ public DatasourceDataLakeGen2SharedKey setSharedKey(String sharedKey) {
+ this.sharedKey = sharedKey;
+ return this;
+ }
+
+ /**
+ * Sets the description.
+ *
+ * @param description The description.
+ * @return an updated object with description set
+ */
+ public DatasourceDataLakeGen2SharedKey setDescription(String description) {
+ this.description = description;
+ return this;
+ }
+
+ private void setId(String id) {
+ this.id = id;
+ }
+
+ private String getSharedKey() {
+ return this.sharedKey;
+ }
+}
diff --git a/sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/administration/models/DatasourceServicePrincipal.java b/sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/administration/models/DatasourceServicePrincipal.java
new file mode 100644
index 0000000000000..3f219a02b27ed
--- /dev/null
+++ b/sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/administration/models/DatasourceServicePrincipal.java
@@ -0,0 +1,146 @@
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// Licensed under the MIT License.
+
+package com.azure.ai.metricsadvisor.administration.models;
+
+import com.azure.ai.metricsadvisor.implementation.util.DataSourceServicePrincipalAccessor;
+import com.azure.core.annotation.Fluent;
+
+/**
+ * The service principal credential entity for data source..
+ */
+@Fluent
+public final class DatasourceServicePrincipal extends DatasourceCredentialEntity {
+ private String id;
+ private String name;
+ private String description;
+ private String clientId;
+ private String tenantId;
+ private String clientSecret;
+
+ static {
+ DataSourceServicePrincipalAccessor.setAccessor(
+ new DataSourceServicePrincipalAccessor.Accessor() {
+ @Override
+ public void setId(DatasourceServicePrincipal entity, String id) {
+ entity.setId(id);
+ }
+
+ @Override
+ public String getClientSecret(DatasourceServicePrincipal entity) {
+ return entity.getClientSecret();
+ }
+ });
+ }
+
+ @Override
+ public String getId() {
+ return this.id;
+ }
+
+ @Override
+ public String getName() {
+ return this.name;
+ }
+
+ @Override
+ public String getDescription() {
+ return this.description;
+ }
+
+ /**
+ * Gets the client id.
+ *
+ * @return The client id.
+ */
+ public String getClientId() {
+ return this.clientId;
+ }
+
+ /**
+ * Gets the tenant id.
+ *
+ * @return The tenant id.
+ */
+ public String getTenantId() {
+ return this.tenantId;
+ }
+
+ /**
+ * Creates DataSourceServicePrincipal.
+ *
+ * @param name The name.
+ * @param clientId The client id.
+ * @param clientSecret The client secret.
+ * @param tenantId The tenant id.
+ */
+ public DatasourceServicePrincipal(String name, String clientId, String tenantId, String clientSecret) {
+ this.name = name;
+ this.clientId = clientId;
+ this.tenantId = tenantId;
+ this.clientSecret = clientSecret;
+ }
+
+ /**
+ * Sets the name.
+ *
+ * @param name The name
+ * @return an updated object with name set
+ */
+ public DatasourceServicePrincipal setName(String name) {
+ this.name = name;
+ return this;
+ }
+
+ /**
+ * Sets the client id.
+ *
+ * @param clientId The client id
+ * @return an updated object with client id set
+ */
+ public DatasourceServicePrincipal setClientId(String clientId) {
+ this.clientId = clientId;
+ return this;
+ }
+
+ /**
+ * Sets the client secret.
+ *
+ * @param clientSecret The client secret
+ * @return an updated object with client secret set
+ */
+ public DatasourceServicePrincipal setClientSecret(String clientSecret) {
+ this.clientSecret = clientSecret;
+ return this;
+ }
+
+ /**
+ * Sets the tenant id.
+ *
+ * @param tenantId The tenant id
+ * @return an updated object with client teant id set
+ */
+ public DatasourceServicePrincipal setTenantId(String tenantId) {
+ this.tenantId = tenantId;
+ return this;
+ }
+
+ /**
+ * Sets the description.
+ *
+ * @param description The description
+ * @return an updated object with description set
+ */
+ public DatasourceServicePrincipal setDescription(String description) {
+ this.description = description;
+ return this;
+ }
+
+ private void setId(String id) {
+ this.id = id;
+ }
+
+ private String getClientSecret() {
+ return this.clientSecret;
+ }
+}
diff --git a/sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/administration/models/DatasourceServicePrincipalInKeyVault.java b/sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/administration/models/DatasourceServicePrincipalInKeyVault.java
new file mode 100644
index 0000000000000..339beb303d043
--- /dev/null
+++ b/sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/administration/models/DatasourceServicePrincipalInKeyVault.java
@@ -0,0 +1,178 @@
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// Licensed under the MIT License.
+
+package com.azure.ai.metricsadvisor.administration.models;
+
+import com.azure.ai.metricsadvisor.implementation.util.DataSourceServicePrincipalInKeyVaultAccessor;
+import com.azure.core.annotation.Fluent;
+
+/**
+ * The service principal stored in a key vault representing the credential entity for a data source.
+ */
+@Fluent
+public final class DatasourceServicePrincipalInKeyVault extends DatasourceCredentialEntity {
+ private String id;
+ private String name;
+ private String description;
+ private String keyVaultEndpoint;
+ private String keyVaultClientId;
+ private String keyVaultClientSecret;
+ private String clientIdSecretName;
+ private String clientSecretName;
+ private String tenantId;
+
+ static {
+ DataSourceServicePrincipalInKeyVaultAccessor.setAccessor(
+ new DataSourceServicePrincipalInKeyVaultAccessor.Accessor() {
+ @Override
+ public void setId(DatasourceServicePrincipalInKeyVault entity, String id) {
+ entity.setId(id);
+ }
+
+ @Override
+ public String getKeyVaultClientSecret(DatasourceServicePrincipalInKeyVault entity) {
+ return entity.getKeyVaultClientSecret();
+ }
+ });
+ }
+
+ @Override
+ public String getId() {
+ return this.id;
+ }
+
+ @Override
+ public String getName() {
+ return this.name;
+ }
+
+ @Override
+ public String getDescription() {
+ return this.description;
+ }
+
+ /**
+ * Gets the endpoint to the KeyVault storing service principal.
+ *
+ * @return The KeyVault endpoint.
+ */
+ public String getKeyVaultEndpoint() {
+ return this.keyVaultEndpoint;
+ }
+
+ /**
+ * Gets the client id to access the KeyVault storing service principal.
+ *
+ * @return The client id to access the KeyVault.
+ */
+ public String getKeyVaultClientId() {
+ return this.keyVaultClientId;
+ }
+
+ /**
+ * Gets the tenant id of the service principal.
+ *
+ * @return The tenant id.
+ */
+ public String getTenantId() {
+ return this.tenantId;
+ }
+
+ /**
+ * Gets the name of the KeyVault secret holding client secret.
+ *
+ * @return The name of the KeyVault secret holding client secret
+ */
+ public String getSecretNameForDatasourceClientId() {
+ return this.clientIdSecretName;
+ }
+
+ /**
+ * Gets the name of the KeyVault secret holding client secret.
+ *
+ * @return The name of the KeyVault secret holding client secret
+ */
+ public String getSecretNameForDatasourceClientSecret() {
+ return this.clientSecretName;
+ }
+
+ /**
+ * Sets the name.
+ *
+ * @param name The name
+ * @return an updated object with name set
+ */
+ public DatasourceServicePrincipalInKeyVault setName(String name) {
+ this.name = name;
+ return this;
+ }
+
+ /**
+ * Sets the keyVault containing the data source secrets.
+ *
+ * @param keyVaultEndpoint The keyVault endpoint
+ * @param keyVaultClientId The client id to access the keyVault
+ * @param keyVaultClientSecret The client secret to access the keyVault
+ * @return an updated object
+ */
+ public DatasourceServicePrincipalInKeyVault setKeyVaultForDatasourceSecrets(String keyVaultEndpoint,
+ String keyVaultClientId,
+ String keyVaultClientSecret) {
+ this.keyVaultEndpoint = keyVaultEndpoint;
+ this.keyVaultClientId = keyVaultClientId;
+ this.keyVaultClientSecret = keyVaultClientSecret;
+ return this;
+ }
+
+ /**
+ * Sets the name of the keyvault secret holding client id.
+ *
+ * @param clientIdSecretName The secret name
+ * @return an updated object with client id secret name set
+ */
+ public DatasourceServicePrincipalInKeyVault setSecretNameForDatasourceClientId(String clientIdSecretName) {
+ this.clientIdSecretName = clientIdSecretName;
+ return this;
+ }
+
+ /**
+ * Sets the name of the keyvault secret holding client secret.
+ *
+ * @param clientSecretName The secret name
+ * @return an updated object with client secret name set
+ */
+ public DatasourceServicePrincipalInKeyVault setSecretNameForDatasourceClientSecret(String clientSecretName) {
+ this.clientSecretName = clientSecretName;
+ return this;
+ }
+
+ /**
+ * Sets the tenant id.
+ *
+ * @param tenantId The tenant id
+ * @return an updated object with client tenant id set
+ */
+ public DatasourceServicePrincipalInKeyVault setTenantId(String tenantId) {
+ this.tenantId = tenantId;
+ return this;
+ }
+
+ /**
+ * Sets the description.
+ *
+ * @param description The description
+ * @return an updated object with description set
+ */
+ public DatasourceServicePrincipalInKeyVault setDescription(String description) {
+ this.description = description;
+ return this;
+ }
+
+ private void setId(String id) {
+ this.id = id;
+ }
+
+ private String getKeyVaultClientSecret() {
+ return this.keyVaultClientSecret;
+ }
+}
diff --git a/sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/administration/models/DatasourceSqlServerConnectionString.java b/sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/administration/models/DatasourceSqlServerConnectionString.java
new file mode 100644
index 0000000000000..17270b34fece3
--- /dev/null
+++ b/sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/administration/models/DatasourceSqlServerConnectionString.java
@@ -0,0 +1,100 @@
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// Licensed under the MIT License.
+
+package com.azure.ai.metricsadvisor.administration.models;
+
+import com.azure.ai.metricsadvisor.implementation.util.DataSourceSqlServerConnectionStringAccessor;
+import com.azure.core.annotation.Fluent;
+
+/**
+ * The connection credential entity for SQLServer.
+ */
+@Fluent
+public final class DatasourceSqlServerConnectionString extends DatasourceCredentialEntity {
+ private String id;
+ private String name;
+ private String description;
+ private String connectionString;
+
+ static {
+ DataSourceSqlServerConnectionStringAccessor.setAccessor(
+ new DataSourceSqlServerConnectionStringAccessor.Accessor() {
+ @Override
+ public void setId(DatasourceSqlServerConnectionString entity, String id) {
+ entity.setId(id);
+ }
+
+ @Override
+ public String getConnectionString(DatasourceSqlServerConnectionString entity) {
+ return entity.getConnectionString();
+ }
+ });
+ }
+
+ @Override
+ public String getId() {
+ return this.id;
+ }
+
+ @Override
+ public String getName() {
+ return this.name;
+ }
+
+ @Override
+ public String getDescription() {
+ return this.description;
+ }
+
+ /**
+ * Creates DataSourceSqlServerConnectionString.
+ *
+ * @param name The name
+ * @param connectionString The connection string
+ */
+ public DatasourceSqlServerConnectionString(String name, String connectionString) {
+ this.name = name;
+ this.connectionString = connectionString;
+ }
+
+ /**
+ * Sets the name.
+ *
+ * @param name The name
+ * @return an updated object with name set
+ */
+ public DatasourceSqlServerConnectionString setName(String name) {
+ this.name = name;
+ return this;
+ }
+
+ /**
+ * Sets the connection string.
+ *
+ * @param connectionString The connection string
+ * @return an updated object with connection string set
+ */
+ public DatasourceSqlServerConnectionString setConnectionString(String connectionString) {
+ this.connectionString = connectionString;
+ return this;
+ }
+
+ /**
+ * Sets the description.
+ *
+ * @param description The description.
+ * @return an updated object with description set
+ */
+ public DatasourceSqlServerConnectionString setDescription(String description) {
+ this .description = description;
+ return this;
+ }
+
+ private void setId(String id) {
+ this.id = id;
+ }
+
+ private String getConnectionString() {
+ return this.connectionString;
+ }
+}
diff --git a/sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/models/DetectionConditionsOperator.java b/sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/administration/models/DetectionConditionsOperator.java
similarity index 95%
rename from sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/models/DetectionConditionsOperator.java
rename to sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/administration/models/DetectionConditionsOperator.java
index d51aa7232ea73..0cfbe84da7906 100644
--- a/sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/models/DetectionConditionsOperator.java
+++ b/sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/administration/models/DetectionConditionsOperator.java
@@ -1,7 +1,7 @@
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License.
-package com.azure.ai.metricsadvisor.models;
+package com.azure.ai.metricsadvisor.administration.models;
import com.azure.core.util.ExpandableStringEnum;
diff --git a/sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/models/EmailNotificationHook.java b/sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/administration/models/EmailNotificationHook.java
similarity index 97%
rename from sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/models/EmailNotificationHook.java
rename to sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/administration/models/EmailNotificationHook.java
index fc54e0cf400d2..0f96ef356811b 100644
--- a/sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/models/EmailNotificationHook.java
+++ b/sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/administration/models/EmailNotificationHook.java
@@ -1,7 +1,9 @@
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License.
-package com.azure.ai.metricsadvisor.models;
+package com.azure.ai.metricsadvisor.administration.models;
+
+import com.azure.core.annotation.Fluent;
import java.util.ArrayList;
import java.util.Collections;
@@ -12,6 +14,7 @@
/**
* A hook that describes email based incident alerts notification.
*/
+@Fluent
public final class EmailNotificationHook extends NotificationHook {
private String name;
private String description;
diff --git a/sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/models/HardThresholdCondition.java b/sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/administration/models/HardThresholdCondition.java
similarity index 98%
rename from sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/models/HardThresholdCondition.java
rename to sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/administration/models/HardThresholdCondition.java
index 297ffac0fb40c..6c6070f4eb3fe 100644
--- a/sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/models/HardThresholdCondition.java
+++ b/sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/administration/models/HardThresholdCondition.java
@@ -2,7 +2,7 @@
// Licensed under the MIT License.
// Code generated by Microsoft (R) AutoRest Code Generator.
-package com.azure.ai.metricsadvisor.models;
+package com.azure.ai.metricsadvisor.administration.models;
import com.azure.core.annotation.Fluent;
import com.fasterxml.jackson.annotation.JsonProperty;
diff --git a/sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/models/IngestionStatusType.java b/sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/administration/models/IngestionStatusType.java
similarity index 97%
rename from sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/models/IngestionStatusType.java
rename to sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/administration/models/IngestionStatusType.java
index 790e648615954..ffc4fcfffefdd 100644
--- a/sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/models/IngestionStatusType.java
+++ b/sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/administration/models/IngestionStatusType.java
@@ -2,7 +2,7 @@
// Licensed under the MIT License.
// Code generated by Microsoft (R) AutoRest Code Generator.
-package com.azure.ai.metricsadvisor.models;
+package com.azure.ai.metricsadvisor.administration.models;
import com.azure.core.util.ExpandableStringEnum;
import com.fasterxml.jackson.annotation.JsonCreator;
diff --git a/sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/models/ListAnomalyAlertConfigsOptions.java b/sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/administration/models/ListAnomalyAlertConfigsOptions.java
similarity index 96%
rename from sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/models/ListAnomalyAlertConfigsOptions.java
rename to sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/administration/models/ListAnomalyAlertConfigsOptions.java
index a064d801eb41e..8845caa5e0e3f 100644
--- a/sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/models/ListAnomalyAlertConfigsOptions.java
+++ b/sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/administration/models/ListAnomalyAlertConfigsOptions.java
@@ -1,7 +1,7 @@
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License.
-package com.azure.ai.metricsadvisor.models;
+package com.azure.ai.metricsadvisor.administration.models;
import com.azure.core.annotation.Fluent;
diff --git a/sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/administration/models/ListCredentialEntityOptions.java b/sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/administration/models/ListCredentialEntityOptions.java
new file mode 100644
index 0000000000000..b795c8c12aee0
--- /dev/null
+++ b/sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/administration/models/ListCredentialEntityOptions.java
@@ -0,0 +1,59 @@
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// Licensed under the MIT License.
+
+package com.azure.ai.metricsadvisor.administration.models;
+
+import com.azure.core.annotation.Fluent;
+
+/**
+ * Additional properties for filtering results on the listCredentialEntities operation.
+ */
+@Fluent
+public final class ListCredentialEntityOptions {
+ private Integer maxPageSize;
+ private Integer skip;
+
+ /**
+ * Gets limit indicating the number of items that will be included in a service returned page.
+ *
+ * @return The maxPageSize value.
+ */
+ public Integer getMaxPageSize() {
+ return this.maxPageSize;
+ }
+
+ /**
+ * Sets limit indicating the number of items to be included in a service returned page.
+ *
+ * @param maxPageSize The maxPageSize value.
+ *
+ * @return The ListCredentialEntityOptions object itself.
+ */
+ public ListCredentialEntityOptions setMaxPageSize(final int maxPageSize) {
+ this.maxPageSize = maxPageSize;
+ return this;
+ }
+
+ /**
+ * Gets the number of items in the queried collection that will be skipped and not included
+ * in the returned result.
+ *
+ * @return The skip value.
+ */
+ public Integer getSkip() {
+ return this.skip;
+ }
+
+ /**
+ * Sets the number of items in the queried collection that are to be skipped and not included
+ * in the returned result.
+ *
+ * @param skip The skip value.
+ *
+ * @return ListCredentialEntityOptions itself.
+ */
+ public ListCredentialEntityOptions setSkip(final int skip) {
+ this.skip = skip;
+ return this;
+ }
+}
diff --git a/sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/models/ListDataFeedFilter.java b/sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/administration/models/ListDataFeedFilter.java
similarity index 98%
rename from sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/models/ListDataFeedFilter.java
rename to sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/administration/models/ListDataFeedFilter.java
index ccdb0beef75bb..3afcf9bfe3caf 100644
--- a/sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/models/ListDataFeedFilter.java
+++ b/sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/administration/models/ListDataFeedFilter.java
@@ -1,7 +1,7 @@
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License.
-package com.azure.ai.metricsadvisor.models;
+package com.azure.ai.metricsadvisor.administration.models;
import com.azure.core.annotation.Fluent;
diff --git a/sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/models/ListDataFeedIngestionOptions.java b/sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/administration/models/ListDataFeedIngestionOptions.java
similarity index 95%
rename from sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/models/ListDataFeedIngestionOptions.java
rename to sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/administration/models/ListDataFeedIngestionOptions.java
index 321be1d531297..57e8c832c55f4 100644
--- a/sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/models/ListDataFeedIngestionOptions.java
+++ b/sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/administration/models/ListDataFeedIngestionOptions.java
@@ -1,13 +1,16 @@
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License.
-package com.azure.ai.metricsadvisor.models;
+package com.azure.ai.metricsadvisor.administration.models;
+
+import com.azure.core.annotation.Fluent;
import java.time.OffsetDateTime;
/**
* Describes the additional parameters for the API to list data feed ingestion status.
*/
+@Fluent
public final class ListDataFeedIngestionOptions {
private final OffsetDateTime startTime;
private final OffsetDateTime endTime;
diff --git a/sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/models/ListDataFeedOptions.java b/sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/administration/models/ListDataFeedOptions.java
similarity index 97%
rename from sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/models/ListDataFeedOptions.java
rename to sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/administration/models/ListDataFeedOptions.java
index 7b6f50c4376ac..191c7aa744349 100644
--- a/sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/models/ListDataFeedOptions.java
+++ b/sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/administration/models/ListDataFeedOptions.java
@@ -1,7 +1,7 @@
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License.
-package com.azure.ai.metricsadvisor.models;
+package com.azure.ai.metricsadvisor.administration.models;
import com.azure.core.annotation.Fluent;
diff --git a/sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/models/ListHookOptions.java b/sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/administration/models/ListHookOptions.java
similarity index 94%
rename from sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/models/ListHookOptions.java
rename to sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/administration/models/ListHookOptions.java
index 16264221bc2d2..3f8425f6bb9d2 100644
--- a/sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/models/ListHookOptions.java
+++ b/sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/administration/models/ListHookOptions.java
@@ -1,11 +1,14 @@
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License.
-package com.azure.ai.metricsadvisor.models;
+package com.azure.ai.metricsadvisor.administration.models;
+
+import com.azure.core.annotation.Fluent;
/**
* Describes the additional parameters for the API to list hooks.
*/
+@Fluent
public final class ListHookOptions {
private String hookNameFilter;
private Integer maxPageSize;
diff --git a/sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/models/ListMetricAnomalyDetectionConfigsOptions.java b/sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/administration/models/ListMetricAnomalyDetectionConfigsOptions.java
similarity index 96%
rename from sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/models/ListMetricAnomalyDetectionConfigsOptions.java
rename to sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/administration/models/ListMetricAnomalyDetectionConfigsOptions.java
index 58a3cdf233cb5..d8bab4f9ec9ae 100644
--- a/sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/models/ListMetricAnomalyDetectionConfigsOptions.java
+++ b/sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/administration/models/ListMetricAnomalyDetectionConfigsOptions.java
@@ -1,7 +1,7 @@
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License.
-package com.azure.ai.metricsadvisor.models;
+package com.azure.ai.metricsadvisor.administration.models;
import com.azure.core.annotation.Fluent;
diff --git a/sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/models/MetricAnomalyAlertConditions.java b/sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/administration/models/MetricAnomalyAlertConditions.java
similarity index 95%
rename from sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/models/MetricAnomalyAlertConditions.java
rename to sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/administration/models/MetricAnomalyAlertConditions.java
index ee7c30ee81d87..66acbec15bc45 100644
--- a/sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/models/MetricAnomalyAlertConditions.java
+++ b/sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/administration/models/MetricAnomalyAlertConditions.java
@@ -1,12 +1,15 @@
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License.
-package com.azure.ai.metricsadvisor.models;
+package com.azure.ai.metricsadvisor.administration.models;
+
+import com.azure.core.annotation.Fluent;
/**
* Defines conditions to decide whether the detected anomalies should be
* included in an alert or not.
*/
+@Fluent
public final class MetricAnomalyAlertConditions {
private MetricBoundaryCondition boundaryCondition;
private SeverityCondition severityCondition;
diff --git a/sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/models/MetricAnomalyAlertConfiguration.java b/sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/administration/models/MetricAnomalyAlertConfiguration.java
similarity index 98%
rename from sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/models/MetricAnomalyAlertConfiguration.java
rename to sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/administration/models/MetricAnomalyAlertConfiguration.java
index 55d788a84e0e8..4b7a7f9685742 100644
--- a/sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/models/MetricAnomalyAlertConfiguration.java
+++ b/sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/administration/models/MetricAnomalyAlertConfiguration.java
@@ -1,7 +1,7 @@
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License.
-package com.azure.ai.metricsadvisor.models;
+package com.azure.ai.metricsadvisor.administration.models;
import com.azure.core.annotation.Fluent;
diff --git a/sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/models/MetricAnomalyAlertConfigurationsOperator.java b/sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/administration/models/MetricAnomalyAlertConfigurationsOperator.java
similarity index 97%
rename from sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/models/MetricAnomalyAlertConfigurationsOperator.java
rename to sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/administration/models/MetricAnomalyAlertConfigurationsOperator.java
index 0ae4fcee6e041..4d0c66eff364d 100644
--- a/sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/models/MetricAnomalyAlertConfigurationsOperator.java
+++ b/sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/administration/models/MetricAnomalyAlertConfigurationsOperator.java
@@ -1,7 +1,7 @@
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License.
-package com.azure.ai.metricsadvisor.models;
+package com.azure.ai.metricsadvisor.administration.models;
import com.azure.core.util.ExpandableStringEnum;
diff --git a/sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/models/MetricAnomalyAlertScope.java b/sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/administration/models/MetricAnomalyAlertScope.java
similarity index 96%
rename from sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/models/MetricAnomalyAlertScope.java
rename to sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/administration/models/MetricAnomalyAlertScope.java
index 071c8a96cdf69..5225731a580b9 100644
--- a/sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/models/MetricAnomalyAlertScope.java
+++ b/sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/administration/models/MetricAnomalyAlertScope.java
@@ -1,8 +1,9 @@
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License.
-package com.azure.ai.metricsadvisor.models;
+package com.azure.ai.metricsadvisor.administration.models;
+import com.azure.ai.metricsadvisor.models.DimensionKey;
import com.azure.core.annotation.Immutable;
/**
@@ -29,7 +30,7 @@ private MetricAnomalyAlertScope(DimensionKey seriesGroupId) {
}
private MetricAnomalyAlertScope(TopNGroupScope topNGroup) {
- this.scopeType = MetricAnomalyAlertScopeType.TOPN;
+ this.scopeType = MetricAnomalyAlertScopeType.TOP_N;
this.topNGroup = topNGroup;
this.seriesGroupId = null;
}
diff --git a/sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/models/MetricAnomalyAlertScopeType.java b/sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/administration/models/MetricAnomalyAlertScopeType.java
similarity index 91%
rename from sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/models/MetricAnomalyAlertScopeType.java
rename to sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/administration/models/MetricAnomalyAlertScopeType.java
index 600bde8f4e09f..d4824834b5130 100644
--- a/sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/models/MetricAnomalyAlertScopeType.java
+++ b/sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/administration/models/MetricAnomalyAlertScopeType.java
@@ -1,7 +1,7 @@
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License.
-package com.azure.ai.metricsadvisor.models;
+package com.azure.ai.metricsadvisor.administration.models;
import com.azure.core.util.ExpandableStringEnum;
@@ -22,7 +22,7 @@ public final class MetricAnomalyAlertScopeType extends ExpandableStringEnum {
+ /**
+ * Defines the lower boundary in a boundary condition.
+ */
+ public static final SingleBoundaryDirection LOWER = fromString("LOWER");
+ /**
+ * Defines the upper boundary in a boundary condition.
+ */
+ public static final SingleBoundaryDirection UPPER = fromString("UPPER");
+
+ /**
+ * Creates or finds a BoundaryDirection from its string representation.
+ *
+ * @param name a name to look for.
+ *
+ * @return the corresponding BoundaryDirection.
+ */
+ public static SingleBoundaryDirection fromString(String name) {
+ return fromString(name, SingleBoundaryDirection.class);
+ }
+
+ /**
+ * @return known BoundaryDirection values.
+ */
+ public static Collection values() {
+ return values(SingleBoundaryDirection.class);
+ }
+}
diff --git a/sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/models/SmartDetectionCondition.java b/sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/administration/models/SmartDetectionCondition.java
similarity index 97%
rename from sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/models/SmartDetectionCondition.java
rename to sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/administration/models/SmartDetectionCondition.java
index 239cee3bfee60..790b5af113d1f 100644
--- a/sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/models/SmartDetectionCondition.java
+++ b/sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/administration/models/SmartDetectionCondition.java
@@ -2,7 +2,7 @@
// Licensed under the MIT License.
// Code generated by Microsoft (R) AutoRest Code Generator.
-package com.azure.ai.metricsadvisor.models;
+package com.azure.ai.metricsadvisor.administration.models;
import com.azure.core.annotation.Fluent;
import com.fasterxml.jackson.annotation.JsonProperty;
diff --git a/sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/models/SnoozeScope.java b/sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/administration/models/SnoozeScope.java
similarity index 94%
rename from sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/models/SnoozeScope.java
rename to sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/administration/models/SnoozeScope.java
index 62a30fd96b4f2..5e225b4d0135e 100644
--- a/sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/models/SnoozeScope.java
+++ b/sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/administration/models/SnoozeScope.java
@@ -2,7 +2,7 @@
// Licensed under the MIT License.
// Code generated by Microsoft (R) AutoRest Code Generator.
-package com.azure.ai.metricsadvisor.models;
+package com.azure.ai.metricsadvisor.administration.models;
import com.azure.core.util.ExpandableStringEnum;
import com.fasterxml.jackson.annotation.JsonCreator;
diff --git a/sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/administration/models/SqlServerDataFeedSource.java b/sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/administration/models/SqlServerDataFeedSource.java
new file mode 100644
index 0000000000000..e2097b7fd617a
--- /dev/null
+++ b/sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/administration/models/SqlServerDataFeedSource.java
@@ -0,0 +1,173 @@
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// Licensed under the MIT License.
+
+package com.azure.ai.metricsadvisor.administration.models;
+
+import com.azure.ai.metricsadvisor.implementation.util.SqlServerDataFeedSourceAccessor;
+import com.azure.core.annotation.Immutable;
+
+/**
+ * The SQLServerDataFeedSource model.
+ */
+@Immutable
+public final class SqlServerDataFeedSource extends DataFeedSource {
+ /*
+ * SQL Server database connection string
+ */
+ private final String connectionString;
+
+ /*
+ * Get the query that retrieves the values to be analyzed for anomalies.
+ */
+ private final String query;
+
+ /*
+ * The id of the credential resource to authenticate the data source.
+ */
+ private final String credentialId;
+
+ /*
+ * The authentication type to access the data source.
+ */
+ private final DatasourceAuthenticationType authType;
+
+ static {
+ SqlServerDataFeedSourceAccessor.setAccessor(
+ new SqlServerDataFeedSourceAccessor.Accessor() {
+ @Override
+ public String getConnectionString(SqlServerDataFeedSource feedSource) {
+ return feedSource.getConnectionString();
+ }
+ });
+ }
+
+ private SqlServerDataFeedSource(final String connectionString,
+ final String query,
+ final String credentialId,
+ final DatasourceAuthenticationType authType) {
+ this.connectionString = connectionString;
+ this.query = query;
+ this.credentialId = credentialId;
+ this.authType = authType;
+ }
+
+ /**
+ * Create a SQLServerDataFeedSource with credential included in the {@code connectionString} as plain text.
+ *
+ * @param connectionString The SQL server connection string.
+ * @param query The query that retrieves the values to be analyzed for anomalies.
+ *
+ * @return The SQLServerDataFeedSource.
+ */
+ public static SqlServerDataFeedSource fromBasicCredential(final String connectionString,
+ final String query) {
+ return new SqlServerDataFeedSource(connectionString, query, null, DatasourceAuthenticationType.BASIC);
+ }
+
+ /**
+ * Create a SQLServerDataFeedSource with the {@code connectionString} containing the resource
+ * id of the SQL server on which metrics advisor has MSI access.
+ *
+ * @param connectionString The SQL server connection string.
+ * @param query The query that retrieves the values to be analyzed for anomalies.
+ * @return The SQLServerDataFeedSource.
+ */
+ public static SqlServerDataFeedSource fromManagedIdentityCredential(final String connectionString,
+ final String query) {
+ return new SqlServerDataFeedSource(connectionString,
+ query,
+ null,
+ DatasourceAuthenticationType.MANAGED_IDENTITY);
+ }
+
+ /**
+ * Create a SQLServerDataFeedSource with the {@code credentialId} identifying a credential
+ * entity of type {@link DatasourceSqlServerConnectionString} that contains the SQL
+ * connection string.
+ *
+ * @param query The query that retrieves the values to be analyzed for anomalies.
+ * @param credentialId The unique id of a credential entity of type
+ * {@link DatasourceSqlServerConnectionString}.
+ * @return The SQLServerDataFeedSource.
+ */
+ public static SqlServerDataFeedSource fromConnectionStringCredential(final String query,
+ final String credentialId) {
+ return new SqlServerDataFeedSource(null,
+ query,
+ credentialId,
+ DatasourceAuthenticationType.AZURE_SQL_CONNECTION_STRING);
+ }
+
+ /**
+ * Create a SQLServerDataFeedSource with the {@code credentialId} identifying a credential
+ * entity of type {@link DatasourceServicePrincipal}, the entity contains
+ * Service Principal to access the SQL Server.
+ *
+ * @param connectionString The SQL server connection string.
+ * @param query The query that retrieves the values to be analyzed for anomalies.
+ * @param credentialId The unique id of a credential entity of type
+ * {@link DatasourceServicePrincipal}.
+ *
+ * @return The SQLServerDataFeedSource.
+ */
+ public static SqlServerDataFeedSource fromServicePrincipalCredential(final String connectionString,
+ final String query,
+ final String credentialId) {
+ return new SqlServerDataFeedSource(connectionString,
+ query,
+ credentialId,
+ DatasourceAuthenticationType.SERVICE_PRINCIPAL);
+ }
+
+ /**
+ * Create a SQLServerDataFeedSource with the {@code credentialId} identifying a credential
+ * entity of type {@link DatasourceServicePrincipalInKeyVault}, the entity contains
+ * details of the KeyVault holding the Service Principal to access the SQL Server.
+ *
+ * @param connectionString The SQL server connection string.
+ * @param query The query that retrieves the values to be analyzed for anomalies.
+ * @param credentialId The unique id of a credential entity of type
+ * {@link DatasourceServicePrincipalInKeyVault}.
+ *
+ * @return The SQLServerDataFeedSource.
+ */
+ public static SqlServerDataFeedSource fromServicePrincipalInKeyVaultCredential(final String connectionString,
+ final String query,
+ final String credentialId) {
+ return new SqlServerDataFeedSource(connectionString,
+ query,
+ credentialId,
+ DatasourceAuthenticationType.SERVICE_PRINCIPAL_IN_KV);
+ }
+
+ /**
+ * Get the query that retrieves the values to be analyzed for anomalies.
+ *
+ * @return the query.
+ */
+ public String getQuery() {
+ return this.query;
+ }
+
+ /**
+ * Gets the id of the {@link DatasourceCredentialEntity credential resource} to authenticate the data source.
+ *
+ * @return The credential resource id.
+ */
+ public String getCredentialId() {
+ return this.credentialId;
+ }
+
+ /**
+ * Gets the authentication type to access the data source.
+ *
+ * @return The authentication type.
+ */
+ public DatasourceAuthenticationType getAuthenticationType() {
+ return this.authType;
+ }
+
+ private String getConnectionString() {
+ return this.connectionString;
+ }
+}
diff --git a/sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/models/SuppressCondition.java b/sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/administration/models/SuppressCondition.java
similarity index 96%
rename from sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/models/SuppressCondition.java
rename to sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/administration/models/SuppressCondition.java
index 8486eefcdbc8c..5d8ca839845de 100644
--- a/sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/models/SuppressCondition.java
+++ b/sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/administration/models/SuppressCondition.java
@@ -2,7 +2,7 @@
// Licensed under the MIT License.
// Code generated by Microsoft (R) AutoRest Code Generator.
-package com.azure.ai.metricsadvisor.models;
+package com.azure.ai.metricsadvisor.administration.models;
import com.azure.core.annotation.Fluent;
import com.fasterxml.jackson.annotation.JsonProperty;
diff --git a/sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/models/TopNGroupScope.java b/sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/administration/models/TopNGroupScope.java
similarity index 97%
rename from sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/models/TopNGroupScope.java
rename to sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/administration/models/TopNGroupScope.java
index 167397b82955a..89d7a572fd20e 100644
--- a/sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/models/TopNGroupScope.java
+++ b/sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/administration/models/TopNGroupScope.java
@@ -2,7 +2,7 @@
// Licensed under the MIT License.
// Code generated by Microsoft (R) AutoRest Code Generator.
-package com.azure.ai.metricsadvisor.models;
+package com.azure.ai.metricsadvisor.administration.models;
import com.azure.core.annotation.Fluent;
import com.fasterxml.jackson.annotation.JsonProperty;
diff --git a/sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/models/WebNotificationHook.java b/sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/administration/models/WebNotificationHook.java
similarity index 97%
rename from sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/models/WebNotificationHook.java
rename to sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/administration/models/WebNotificationHook.java
index 7c8e17eb29457..1167fa6bbc588 100644
--- a/sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/models/WebNotificationHook.java
+++ b/sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/administration/models/WebNotificationHook.java
@@ -1,13 +1,15 @@
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License.
-package com.azure.ai.metricsadvisor.models;
+package com.azure.ai.metricsadvisor.administration.models;
+import com.azure.core.annotation.Fluent;
import com.azure.core.http.HttpHeaders;
/**
* A hook that describes web-hook based incident alerts notification.
*/
+@Fluent
public final class WebNotificationHook extends NotificationHook {
private String name;
private String description;
diff --git a/sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/administration/models/package-info.java b/sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/administration/models/package-info.java
new file mode 100644
index 0000000000000..d1191adc2e58f
--- /dev/null
+++ b/sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/administration/models/package-info.java
@@ -0,0 +1,8 @@
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// Licensed under the MIT License.
+// Code generated by Microsoft (R) AutoRest Code Generator.
+
+/**
+ * Package containing model types for Metrics Advisor administration operations.
+ */
+package com.azure.ai.metricsadvisor.administration.models;
diff --git a/sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/implementation/AzureCognitiveServiceMetricsAdvisorRestAPIOpenAPIV2Impl.java b/sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/implementation/AzureCognitiveServiceMetricsAdvisorRestAPIOpenAPIV2Impl.java
index 36e12fc20dbaf..921b454a846ae 100644
--- a/sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/implementation/AzureCognitiveServiceMetricsAdvisorRestAPIOpenAPIV2Impl.java
+++ b/sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/implementation/AzureCognitiveServiceMetricsAdvisorRestAPIOpenAPIV2Impl.java
@@ -58,10 +58,10 @@
import com.azure.ai.metricsadvisor.implementation.models.SeriesResultList;
import com.azure.ai.metricsadvisor.implementation.models.UsageStats;
import com.azure.ai.metricsadvisor.models.AnomalyAlert;
-import com.azure.ai.metricsadvisor.models.DataFeedIngestionProgress;
-import com.azure.ai.metricsadvisor.models.DataFeedIngestionStatus;
+import com.azure.ai.metricsadvisor.administration.models.DataFeedIngestionProgress;
+import com.azure.ai.metricsadvisor.administration.models.DataFeedIngestionStatus;
import com.azure.ai.metricsadvisor.models.EnrichmentStatus;
-import com.azure.ai.metricsadvisor.models.ErrorCodeException;
+import com.azure.ai.metricsadvisor.models.MetricsAdvisorResponseException;
import com.azure.core.annotation.BodyParam;
import com.azure.core.annotation.Delete;
import com.azure.core.annotation.ExpectedResponses;
@@ -195,13 +195,13 @@ public SerializerAdapter getSerializerAdapter() {
private interface AzureCognitiveServiceMetricsAdvisorRestAPIOpenAPIV2Service {
@Get("/stats/latest")
@ExpectedResponses({200})
- @UnexpectedResponseExceptionType(ErrorCodeException.class)
+ @UnexpectedResponseExceptionType(MetricsAdvisorResponseException.class)
Mono> getActiveSeriesCount(
@HostParam("endpoint") String endpoint, @HeaderParam("Accept") String accept, Context context);
@Get("/alert/anomaly/configurations/{configurationId}")
@ExpectedResponses({200})
- @UnexpectedResponseExceptionType(ErrorCodeException.class)
+ @UnexpectedResponseExceptionType(MetricsAdvisorResponseException.class)
Mono> getAnomalyAlertingConfiguration(
@HostParam("endpoint") String endpoint,
@PathParam("configurationId") UUID configurationId,
@@ -210,7 +210,7 @@ Mono> getAnomalyAlertingConfiguration(
@Patch("/alert/anomaly/configurations/{configurationId}")
@ExpectedResponses({200})
- @UnexpectedResponseExceptionType(ErrorCodeException.class)
+ @UnexpectedResponseExceptionType(MetricsAdvisorResponseException.class)
Mono> updateAnomalyAlertingConfiguration(
@HostParam("endpoint") String endpoint,
@PathParam("configurationId") UUID configurationId,
@@ -220,7 +220,7 @@ Mono> updateAnomalyAlertingConfiguration(
@Delete("/alert/anomaly/configurations/{configurationId}")
@ExpectedResponses({204})
- @UnexpectedResponseExceptionType(ErrorCodeException.class)
+ @UnexpectedResponseExceptionType(MetricsAdvisorResponseException.class)
Mono> deleteAnomalyAlertingConfiguration(
@HostParam("endpoint") String endpoint,
@PathParam("configurationId") UUID configurationId,
@@ -229,7 +229,7 @@ Mono> deleteAnomalyAlertingConfiguration(
@Post("/alert/anomaly/configurations")
@ExpectedResponses({201})
- @UnexpectedResponseExceptionType(ErrorCodeException.class)
+ @UnexpectedResponseExceptionType(MetricsAdvisorResponseException.class)
Mono createAnomalyAlertingConfiguration(
@HostParam("endpoint") String endpoint,
@BodyParam("application/json") AnomalyAlertingConfiguration body,
@@ -238,7 +238,7 @@ Mono createAnomalyAlertingConfigurat
@Post("/alert/anomaly/configurations/{configurationId}/alerts/query")
@ExpectedResponses({200})
- @UnexpectedResponseExceptionType(ErrorCodeException.class)
+ @UnexpectedResponseExceptionType(MetricsAdvisorResponseException.class)
Mono> getAlertsByAnomalyAlertingConfiguration(
@HostParam("endpoint") String endpoint,
@PathParam("configurationId") UUID configurationId,
@@ -250,7 +250,7 @@ Mono> getAlertsByAnomalyAlertingConfiguration(
@Get("/alert/anomaly/configurations/{configurationId}/alerts/{alertId}/anomalies")
@ExpectedResponses({200})
- @UnexpectedResponseExceptionType(ErrorCodeException.class)
+ @UnexpectedResponseExceptionType(MetricsAdvisorResponseException.class)
Mono> getAnomaliesFromAlertByAnomalyAlertingConfiguration(
@HostParam("endpoint") String endpoint,
@PathParam("configurationId") UUID configurationId,
@@ -262,7 +262,7 @@ Mono> getAnomaliesFromAlertByAnomalyAlertingConfigur
@Get("/alert/anomaly/configurations/{configurationId}/alerts/{alertId}/incidents")
@ExpectedResponses({200})
- @UnexpectedResponseExceptionType(ErrorCodeException.class)
+ @UnexpectedResponseExceptionType(MetricsAdvisorResponseException.class)
Mono> getIncidentsFromAlertByAnomalyAlertingConfiguration(
@HostParam("endpoint") String endpoint,
@PathParam("configurationId") UUID configurationId,
@@ -274,7 +274,7 @@ Mono> getIncidentsFromAlertByAnomalyAlertingConfigu
@Get("/enrichment/anomalyDetection/configurations/{configurationId}")
@ExpectedResponses({200})
- @UnexpectedResponseExceptionType(ErrorCodeException.class)
+ @UnexpectedResponseExceptionType(MetricsAdvisorResponseException.class)
Mono> getAnomalyDetectionConfiguration(
@HostParam("endpoint") String endpoint,
@PathParam("configurationId") UUID configurationId,
@@ -283,7 +283,7 @@ Mono> getAnomalyDetectionConfiguration(
@Patch("/enrichment/anomalyDetection/configurations/{configurationId}")
@ExpectedResponses({200})
- @UnexpectedResponseExceptionType(ErrorCodeException.class)
+ @UnexpectedResponseExceptionType(MetricsAdvisorResponseException.class)
Mono> updateAnomalyDetectionConfiguration(
@HostParam("endpoint") String endpoint,
@PathParam("configurationId") UUID configurationId,
@@ -293,7 +293,7 @@ Mono> updateAnomalyDetectionConfiguratio
@Delete("/enrichment/anomalyDetection/configurations/{configurationId}")
@ExpectedResponses({204})
- @UnexpectedResponseExceptionType(ErrorCodeException.class)
+ @UnexpectedResponseExceptionType(MetricsAdvisorResponseException.class)
Mono> deleteAnomalyDetectionConfiguration(
@HostParam("endpoint") String endpoint,
@PathParam("configurationId") UUID configurationId,
@@ -302,7 +302,7 @@ Mono> deleteAnomalyDetectionConfiguration(
@Post("/enrichment/anomalyDetection/configurations")
@ExpectedResponses({201})
- @UnexpectedResponseExceptionType(ErrorCodeException.class)
+ @UnexpectedResponseExceptionType(MetricsAdvisorResponseException.class)
Mono createAnomalyDetectionConfiguration(
@HostParam("endpoint") String endpoint,
@BodyParam("application/json") AnomalyDetectionConfiguration body,
@@ -311,7 +311,7 @@ Mono createAnomalyDetectionConfigur
@Get("/enrichment/anomalyDetection/configurations/{configurationId}/alert/anomaly/configurations")
@ExpectedResponses({200})
- @UnexpectedResponseExceptionType(ErrorCodeException.class)
+ @UnexpectedResponseExceptionType(MetricsAdvisorResponseException.class)
Mono>
getAnomalyAlertingConfigurationsByAnomalyDetectionConfiguration(
@HostParam("endpoint") String endpoint,
@@ -323,7 +323,7 @@ Mono createAnomalyDetectionConfigur
@Post("/enrichment/anomalyDetection/configurations/{configurationId}/series/query")
@ExpectedResponses({200})
- @UnexpectedResponseExceptionType(ErrorCodeException.class)
+ @UnexpectedResponseExceptionType(MetricsAdvisorResponseException.class)
Mono> getSeriesByAnomalyDetectionConfiguration(
@HostParam("endpoint") String endpoint,
@PathParam("configurationId") UUID configurationId,
@@ -333,7 +333,7 @@ Mono> getSeriesByAnomalyDetectionConfiguration(
@Post("/enrichment/anomalyDetection/configurations/{configurationId}/anomalies/query")
@ExpectedResponses({200})
- @UnexpectedResponseExceptionType(ErrorCodeException.class)
+ @UnexpectedResponseExceptionType(MetricsAdvisorResponseException.class)
Mono> getAnomaliesByAnomalyDetectionConfiguration(
@HostParam("endpoint") String endpoint,
@PathParam("configurationId") UUID configurationId,
@@ -345,7 +345,7 @@ Mono> getAnomaliesByAnomalyDetectionConfiguration(
@Post("/enrichment/anomalyDetection/configurations/{configurationId}/anomalies/dimension/query")
@ExpectedResponses({200})
- @UnexpectedResponseExceptionType(ErrorCodeException.class)
+ @UnexpectedResponseExceptionType(MetricsAdvisorResponseException.class)
Mono> getDimensionOfAnomaliesByAnomalyDetectionConfiguration(
@HostParam("endpoint") String endpoint,
@PathParam("configurationId") UUID configurationId,
@@ -357,7 +357,7 @@ Mono> getDimensionOfAnomaliesByAnomalyDetectionCo
@Post("/enrichment/anomalyDetection/configurations/{configurationId}/incidents/query")
@ExpectedResponses({200})
- @UnexpectedResponseExceptionType(ErrorCodeException.class)
+ @UnexpectedResponseExceptionType(MetricsAdvisorResponseException.class)
Mono> getIncidentsByAnomalyDetectionConfiguration(
@HostParam("endpoint") String endpoint,
@PathParam("configurationId") UUID configurationId,
@@ -368,7 +368,7 @@ Mono> getIncidentsByAnomalyDetectionConfiguration(
@Get("/enrichment/anomalyDetection/configurations/{configurationId}/incidents/query")
@ExpectedResponses({200})
- @UnexpectedResponseExceptionType(ErrorCodeException.class)
+ @UnexpectedResponseExceptionType(MetricsAdvisorResponseException.class)
Mono> getIncidentsByAnomalyDetectionConfigurationNextPages(
@HostParam("endpoint") String endpoint,
@PathParam("configurationId") UUID configurationId,
@@ -379,7 +379,7 @@ Mono> getIncidentsByAnomalyDetectionConfigurationNe
@Get("/enrichment/anomalyDetection/configurations/{configurationId}/incidents/{incidentId}/rootCause")
@ExpectedResponses({200})
- @UnexpectedResponseExceptionType(ErrorCodeException.class)
+ @UnexpectedResponseExceptionType(MetricsAdvisorResponseException.class)
Mono> getRootCauseOfIncidentByAnomalyDetectionConfiguration(
@HostParam("endpoint") String endpoint,
@PathParam("configurationId") UUID configurationId,
@@ -389,7 +389,7 @@ Mono> getRootCauseOfIncidentByAnomalyDetectionConfigurat
@Post("/credentials")
@ExpectedResponses({201})
- @UnexpectedResponseExceptionType(ErrorCodeException.class)
+ @UnexpectedResponseExceptionType(MetricsAdvisorResponseException.class)
Mono createCredential(
@HostParam("endpoint") String endpoint,
@BodyParam("application/json") DataSourceCredential body,
@@ -398,7 +398,7 @@ Mono createCredential(
@Get("/credentials")
@ExpectedResponses({200})
- @UnexpectedResponseExceptionType(ErrorCodeException.class)
+ @UnexpectedResponseExceptionType(MetricsAdvisorResponseException.class)
Mono> listCredentials(
@HostParam("endpoint") String endpoint,
@QueryParam("$skip") Integer skip,
@@ -408,7 +408,7 @@ Mono> listCredentials(
@Patch("/credentials/{credentialId}")
@ExpectedResponses({200})
- @UnexpectedResponseExceptionType(ErrorCodeException.class)
+ @UnexpectedResponseExceptionType(MetricsAdvisorResponseException.class)
Mono> updateCredential(
@HostParam("endpoint") String endpoint,
@PathParam("credentialId") UUID credentialId,
@@ -418,7 +418,7 @@ Mono> updateCredential(
@Delete("/credentials/{credentialId}")
@ExpectedResponses({204})
- @UnexpectedResponseExceptionType(ErrorCodeException.class)
+ @UnexpectedResponseExceptionType(MetricsAdvisorResponseException.class)
Mono> deleteCredential(
@HostParam("endpoint") String endpoint,
@PathParam("credentialId") UUID credentialId,
@@ -427,7 +427,7 @@ Mono> deleteCredential(
@Get("/credentials/{credentialId}")
@ExpectedResponses({200})
- @UnexpectedResponseExceptionType(ErrorCodeException.class)
+ @UnexpectedResponseExceptionType(MetricsAdvisorResponseException.class)
Mono> getCredential(
@HostParam("endpoint") String endpoint,
@PathParam("credentialId") UUID credentialId,
@@ -436,7 +436,7 @@ Mono> getCredential(
@Get("/dataFeeds")
@ExpectedResponses({200})
- @UnexpectedResponseExceptionType(ErrorCodeException.class)
+ @UnexpectedResponseExceptionType(MetricsAdvisorResponseException.class)
Mono> listDataFeeds(
@HostParam("endpoint") String endpoint,
@QueryParam("dataFeedName") String dataFeedName,
@@ -451,7 +451,7 @@ Mono> listDataFeeds(
@Post("/dataFeeds")
@ExpectedResponses({201})
- @UnexpectedResponseExceptionType(ErrorCodeException.class)
+ @UnexpectedResponseExceptionType(MetricsAdvisorResponseException.class)
Mono createDataFeed(
@HostParam("endpoint") String endpoint,
@BodyParam("application/json") DataFeedDetail body,
@@ -460,7 +460,7 @@ Mono createDataFeed(
@Get("/dataFeeds/{dataFeedId}")
@ExpectedResponses({200})
- @UnexpectedResponseExceptionType(ErrorCodeException.class)
+ @UnexpectedResponseExceptionType(MetricsAdvisorResponseException.class)
Mono> getDataFeedById(
@HostParam("endpoint") String endpoint,
@PathParam("dataFeedId") UUID dataFeedId,
@@ -469,7 +469,7 @@ Mono> getDataFeedById(
@Patch("/dataFeeds/{dataFeedId}")
@ExpectedResponses({200})
- @UnexpectedResponseExceptionType(ErrorCodeException.class)
+ @UnexpectedResponseExceptionType(MetricsAdvisorResponseException.class)
Mono> updateDataFeed(
@HostParam("endpoint") String endpoint,
@PathParam("dataFeedId") UUID dataFeedId,
@@ -479,7 +479,7 @@ Mono> updateDataFeed(
@Delete("/dataFeeds/{dataFeedId}")
@ExpectedResponses({204})
- @UnexpectedResponseExceptionType(ErrorCodeException.class)
+ @UnexpectedResponseExceptionType(MetricsAdvisorResponseException.class)
Mono> deleteDataFeed(
@HostParam("endpoint") String endpoint,
@PathParam("dataFeedId") UUID dataFeedId,
@@ -488,7 +488,7 @@ Mono> deleteDataFeed(
@Get("/feedback/metric/{feedbackId}")
@ExpectedResponses({200})
- @UnexpectedResponseExceptionType(ErrorCodeException.class)
+ @UnexpectedResponseExceptionType(MetricsAdvisorResponseException.class)
Mono> getMetricFeedback(
@HostParam("endpoint") String endpoint,
@PathParam("feedbackId") UUID feedbackId,
@@ -497,7 +497,7 @@ Mono> getMetricFeedback(
@Post("/feedback/metric/query")
@ExpectedResponses({200})
- @UnexpectedResponseExceptionType(ErrorCodeException.class)
+ @UnexpectedResponseExceptionType(MetricsAdvisorResponseException.class)
Mono> listMetricFeedbacks(
@HostParam("endpoint") String endpoint,
@QueryParam("$skip") Integer skip,
@@ -508,7 +508,7 @@ Mono> listMetricFeedbacks(
@Post("/feedback/metric")
@ExpectedResponses({201})
- @UnexpectedResponseExceptionType(ErrorCodeException.class)
+ @UnexpectedResponseExceptionType(MetricsAdvisorResponseException.class)
Mono createMetricFeedback(
@HostParam("endpoint") String endpoint,
@BodyParam("application/json") MetricFeedback body,
@@ -517,7 +517,7 @@ Mono createMetricFeedback(
@Get("/hooks")
@ExpectedResponses({200})
- @UnexpectedResponseExceptionType(ErrorCodeException.class)
+ @UnexpectedResponseExceptionType(MetricsAdvisorResponseException.class)
Mono> listHooks(
@HostParam("endpoint") String endpoint,
@QueryParam("hookName") String hookName,
@@ -528,7 +528,7 @@ Mono> listHooks(
@Post("/hooks")
@ExpectedResponses({201})
- @UnexpectedResponseExceptionType(ErrorCodeException.class)
+ @UnexpectedResponseExceptionType(MetricsAdvisorResponseException.class)
Mono createHook(
@HostParam("endpoint") String endpoint,
@BodyParam("application/json") HookInfo body,
@@ -537,7 +537,7 @@ Mono createHook(
@Get("/hooks/{hookId}")
@ExpectedResponses({200})
- @UnexpectedResponseExceptionType(ErrorCodeException.class)
+ @UnexpectedResponseExceptionType(MetricsAdvisorResponseException.class)
Mono> getHook(
@HostParam("endpoint") String endpoint,
@PathParam("hookId") UUID hookId,
@@ -546,7 +546,7 @@ Mono> getHook(
@Patch("/hooks/{hookId}")
@ExpectedResponses({200})
- @UnexpectedResponseExceptionType(ErrorCodeException.class)
+ @UnexpectedResponseExceptionType(MetricsAdvisorResponseException.class)
Mono> updateHook(
@HostParam("endpoint") String endpoint,
@PathParam("hookId") UUID hookId,
@@ -556,7 +556,7 @@ Mono> updateHook(
@Delete("/hooks/{hookId}")
@ExpectedResponses({204})
- @UnexpectedResponseExceptionType(ErrorCodeException.class)
+ @UnexpectedResponseExceptionType(MetricsAdvisorResponseException.class)
Mono> deleteHook(
@HostParam("endpoint") String endpoint,
@PathParam("hookId") UUID hookId,
@@ -565,7 +565,7 @@ Mono> deleteHook(
@Post("/dataFeeds/{dataFeedId}/ingestionStatus/query")
@ExpectedResponses({200})
- @UnexpectedResponseExceptionType(ErrorCodeException.class)
+ @UnexpectedResponseExceptionType(MetricsAdvisorResponseException.class)
Mono> getDataFeedIngestionStatus(
@HostParam("endpoint") String endpoint,
@PathParam("dataFeedId") UUID dataFeedId,
@@ -577,7 +577,7 @@ Mono> getDataFeedIngestionStatus(
@Post("/dataFeeds/{dataFeedId}/ingestionProgress/reset")
@ExpectedResponses({204})
- @UnexpectedResponseExceptionType(ErrorCodeException.class)
+ @UnexpectedResponseExceptionType(MetricsAdvisorResponseException.class)
Mono> resetDataFeedIngestionStatus(
@HostParam("endpoint") String endpoint,
@PathParam("dataFeedId") UUID dataFeedId,
@@ -587,7 +587,7 @@ Mono> resetDataFeedIngestionStatus(
@Get("/dataFeeds/{dataFeedId}/ingestionProgress")
@ExpectedResponses({200})
- @UnexpectedResponseExceptionType(ErrorCodeException.class)
+ @UnexpectedResponseExceptionType(MetricsAdvisorResponseException.class)
Mono> getIngestionProgress(
@HostParam("endpoint") String endpoint,
@PathParam("dataFeedId") UUID dataFeedId,
@@ -596,7 +596,7 @@ Mono> getIngestionProgress(
@Post("/metrics/{metricId}/data/query")
@ExpectedResponses({200})
- @UnexpectedResponseExceptionType(ErrorCodeException.class)
+ @UnexpectedResponseExceptionType(MetricsAdvisorResponseException.class)
Mono> getMetricData(
@HostParam("endpoint") String endpoint,
@PathParam("metricId") UUID metricId,
@@ -606,7 +606,7 @@ Mono> getMetricData(
@Post("/metrics/{metricId}/series/query")
@ExpectedResponses({200})
- @UnexpectedResponseExceptionType(ErrorCodeException.class)
+ @UnexpectedResponseExceptionType(MetricsAdvisorResponseException.class)
Mono> getMetricSeries(
@HostParam("endpoint") String endpoint,
@PathParam("metricId") UUID metricId,
@@ -618,7 +618,7 @@ Mono> getMetricSeries(
@Post("/metrics/{metricId}/dimension/query")
@ExpectedResponses({200})
- @UnexpectedResponseExceptionType(ErrorCodeException.class)
+ @UnexpectedResponseExceptionType(MetricsAdvisorResponseException.class)
Mono> getMetricDimension(
@HostParam("endpoint") String endpoint,
@PathParam("metricId") UUID metricId,
@@ -630,7 +630,7 @@ Mono> getMetricDimension(
@Get("/metrics/{metricId}/enrichment/anomalyDetection/configurations")
@ExpectedResponses({200})
- @UnexpectedResponseExceptionType(ErrorCodeException.class)
+ @UnexpectedResponseExceptionType(MetricsAdvisorResponseException.class)
Mono> getAnomalyDetectionConfigurationsByMetric(
@HostParam("endpoint") String endpoint,
@PathParam("metricId") UUID metricId,
@@ -641,7 +641,7 @@ Mono> getAnomalyDetectionConfigurati
@Post("/metrics/{metricId}/status/enrichment/anomalyDetection/query")
@ExpectedResponses({200})
- @UnexpectedResponseExceptionType(ErrorCodeException.class)
+ @UnexpectedResponseExceptionType(MetricsAdvisorResponseException.class)
Mono> getEnrichmentStatusByMetric(
@HostParam("endpoint") String endpoint,
@PathParam("metricId") UUID metricId,
@@ -653,7 +653,7 @@ Mono> getEnrichmentStatusByMetric(
@Post("{nextLink}")
@ExpectedResponses({200})
- @UnexpectedResponseExceptionType(ErrorCodeException.class)
+ @UnexpectedResponseExceptionType(MetricsAdvisorResponseException.class)
Mono> getAlertsByAnomalyAlertingConfigurationNext(
@HostParam("endpoint") String endpoint,
@PathParam(value = "nextLink", encoded = true) String nextLink,
@@ -663,7 +663,7 @@ Mono> getAlertsByAnomalyAlertingConfigurationNext(
@Post("{nextLink}")
@ExpectedResponses({200})
- @UnexpectedResponseExceptionType(ErrorCodeException.class)
+ @UnexpectedResponseExceptionType(MetricsAdvisorResponseException.class)
Mono> getAnomaliesByAnomalyDetectionConfigurationNext(
@HostParam("endpoint") String endpoint,
@PathParam(value = "nextLink", encoded = true) String nextLink,
@@ -673,7 +673,7 @@ Mono> getAnomaliesByAnomalyDetectionConfigurationNex
@Post("{nextLink}")
@ExpectedResponses({200})
- @UnexpectedResponseExceptionType(ErrorCodeException.class)
+ @UnexpectedResponseExceptionType(MetricsAdvisorResponseException.class)
Mono> getDimensionOfAnomaliesByAnomalyDetectionConfigurationNext(
@HostParam("endpoint") String endpoint,
@PathParam(value = "nextLink", encoded = true) String nextLink,
@@ -683,7 +683,7 @@ Mono> getDimensionOfAnomaliesByAnomalyDetectionCo
@Post("{nextLink}")
@ExpectedResponses({200})
- @UnexpectedResponseExceptionType(ErrorCodeException.class)
+ @UnexpectedResponseExceptionType(MetricsAdvisorResponseException.class)
Mono> listMetricFeedbacksNext(
@HostParam("endpoint") String endpoint,
@PathParam(value = "nextLink", encoded = true) String nextLink,
@@ -693,7 +693,7 @@ Mono> listMetricFeedbacksNext(
@Post("{nextLink}")
@ExpectedResponses({200})
- @UnexpectedResponseExceptionType(ErrorCodeException.class)
+ @UnexpectedResponseExceptionType(MetricsAdvisorResponseException.class)
Mono