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> getDataFeedIngestionStatusNext( @HostParam("endpoint") String endpoint, @PathParam(value = "nextLink", encoded = true) String nextLink, @@ -703,7 +703,7 @@ Mono> getDataFeedIngestionStatusNext( @Post("{nextLink}") @ExpectedResponses({200}) - @UnexpectedResponseExceptionType(ErrorCodeException.class) + @UnexpectedResponseExceptionType(MetricsAdvisorResponseException.class) Mono> getMetricSeriesNext( @HostParam("endpoint") String endpoint, @PathParam(value = "nextLink", encoded = true) String nextLink, @@ -713,7 +713,7 @@ Mono> getMetricSeriesNext( @Post("{nextLink}") @ExpectedResponses({200}) - @UnexpectedResponseExceptionType(ErrorCodeException.class) + @UnexpectedResponseExceptionType(MetricsAdvisorResponseException.class) Mono> getMetricDimensionNext( @HostParam("endpoint") String endpoint, @PathParam(value = "nextLink", encoded = true) String nextLink, @@ -723,7 +723,7 @@ Mono> getMetricDimensionNext( @Post("{nextLink}") @ExpectedResponses({200}) - @UnexpectedResponseExceptionType(ErrorCodeException.class) + @UnexpectedResponseExceptionType(MetricsAdvisorResponseException.class) Mono> getEnrichmentStatusByMetricNext( @HostParam("endpoint") String endpoint, @PathParam(value = "nextLink", encoded = true) String nextLink, @@ -733,7 +733,7 @@ Mono> getEnrichmentStatusByMetricNext( @Get("{nextLink}") @ExpectedResponses({200}) - @UnexpectedResponseExceptionType(ErrorCodeException.class) + @UnexpectedResponseExceptionType(MetricsAdvisorResponseException.class) Mono> getAnomaliesFromAlertByAnomalyAlertingConfigurationNext( @PathParam(value = "nextLink", encoded = true) String nextLink, @HostParam("endpoint") String endpoint, @@ -742,7 +742,7 @@ Mono> getAnomaliesFromAlertByAnomalyAlertingConfigur @Get("{nextLink}") @ExpectedResponses({200}) - @UnexpectedResponseExceptionType(ErrorCodeException.class) + @UnexpectedResponseExceptionType(MetricsAdvisorResponseException.class) Mono> getIncidentsFromAlertByAnomalyAlertingConfigurationNext( @PathParam(value = "nextLink", encoded = true) String nextLink, @HostParam("endpoint") String endpoint, @@ -751,7 +751,7 @@ Mono> getIncidentsFromAlertByAnomalyAlertingConfigu @Get("{nextLink}") @ExpectedResponses({200}) - @UnexpectedResponseExceptionType(ErrorCodeException.class) + @UnexpectedResponseExceptionType(MetricsAdvisorResponseException.class) Mono> getAnomalyAlertingConfigurationsByAnomalyDetectionConfigurationNext( @PathParam(value = "nextLink", encoded = true) String nextLink, @@ -761,7 +761,7 @@ Mono> getIncidentsFromAlertByAnomalyAlertingConfigu @Get("{nextLink}") @ExpectedResponses({200}) - @UnexpectedResponseExceptionType(ErrorCodeException.class) + @UnexpectedResponseExceptionType(MetricsAdvisorResponseException.class) Mono> getIncidentsByAnomalyDetectionConfigurationNext( @PathParam(value = "nextLink", encoded = true) String nextLink, @HostParam("endpoint") String endpoint, @@ -770,7 +770,7 @@ Mono> getIncidentsByAnomalyDetectionConfigurationNe @Get("{nextLink}") @ExpectedResponses({200}) - @UnexpectedResponseExceptionType(ErrorCodeException.class) + @UnexpectedResponseExceptionType(MetricsAdvisorResponseException.class) Mono> getIncidentsByAnomalyDetectionConfigurationNextPagesNext( @PathParam(value = "nextLink", encoded = true) String nextLink, @HostParam("endpoint") String endpoint, @@ -779,7 +779,7 @@ Mono> getIncidentsByAnomalyDetectionConfigurationNe @Get("{nextLink}") @ExpectedResponses({200}) - @UnexpectedResponseExceptionType(ErrorCodeException.class) + @UnexpectedResponseExceptionType(MetricsAdvisorResponseException.class) Mono> listCredentialsNext( @PathParam(value = "nextLink", encoded = true) String nextLink, @HostParam("endpoint") String endpoint, @@ -788,7 +788,7 @@ Mono> listCredentialsNext( @Get("{nextLink}") @ExpectedResponses({200}) - @UnexpectedResponseExceptionType(ErrorCodeException.class) + @UnexpectedResponseExceptionType(MetricsAdvisorResponseException.class) Mono> listDataFeedsNext( @PathParam(value = "nextLink", encoded = true) String nextLink, @HostParam("endpoint") String endpoint, @@ -797,7 +797,7 @@ Mono> listDataFeedsNext( @Get("{nextLink}") @ExpectedResponses({200}) - @UnexpectedResponseExceptionType(ErrorCodeException.class) + @UnexpectedResponseExceptionType(MetricsAdvisorResponseException.class) Mono> listHooksNext( @PathParam(value = "nextLink", encoded = true) String nextLink, @HostParam("endpoint") String endpoint, @@ -806,7 +806,7 @@ Mono> listHooksNext( @Get("{nextLink}") @ExpectedResponses({200}) - @UnexpectedResponseExceptionType(ErrorCodeException.class) + @UnexpectedResponseExceptionType(MetricsAdvisorResponseException.class) Mono> getAnomalyDetectionConfigurationsByMetricNext( @PathParam(value = "nextLink", encoded = true) String nextLink, @HostParam("endpoint") String endpoint, @@ -817,7 +817,7 @@ Mono> getAnomalyDetectionConfigurati /** * Get latest usage stats. * - * @throws ErrorCodeException thrown if the request is rejected by server. + * @throws MetricsAdvisorResponseException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. * @return latest usage stats. */ @@ -832,7 +832,7 @@ public Mono> getActiveSeriesCountWithResponseAsync() { * * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ErrorCodeException thrown if the request is rejected by server. + * @throws MetricsAdvisorResponseException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. * @return latest usage stats. */ @@ -845,7 +845,7 @@ public Mono> getActiveSeriesCountWithResponseAsync(Context /** * Get latest usage stats. * - * @throws ErrorCodeException thrown if the request is rejected by server. + * @throws MetricsAdvisorResponseException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. * @return latest usage stats. */ @@ -867,7 +867,7 @@ public Mono getActiveSeriesCountAsync() { * * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ErrorCodeException thrown if the request is rejected by server. + * @throws MetricsAdvisorResponseException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. * @return latest usage stats. */ @@ -887,7 +887,7 @@ public Mono getActiveSeriesCountAsync(Context context) { /** * Get latest usage stats. * - * @throws ErrorCodeException thrown if the request is rejected by server. + * @throws MetricsAdvisorResponseException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. * @return latest usage stats. */ @@ -901,7 +901,7 @@ public UsageStats getActiveSeriesCount() { * * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ErrorCodeException thrown if the request is rejected by server. + * @throws MetricsAdvisorResponseException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. * @return latest usage stats. */ @@ -915,7 +915,7 @@ public Response getActiveSeriesCountWithResponse(Context context) { * * @param configurationId anomaly alerting configuration unique id. * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ErrorCodeException thrown if the request is rejected by server. + * @throws MetricsAdvisorResponseException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. * @return the response. */ @@ -934,7 +934,7 @@ public Mono> getAnomalyAlertingConfigurat * @param configurationId anomaly alerting configuration unique id. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ErrorCodeException thrown if the request is rejected by server. + * @throws MetricsAdvisorResponseException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. * @return the response. */ @@ -950,7 +950,7 @@ public Mono> getAnomalyAlertingConfigurat * * @param configurationId anomaly alerting configuration unique id. * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ErrorCodeException thrown if the request is rejected by server. + * @throws MetricsAdvisorResponseException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. * @return the response. */ @@ -973,7 +973,7 @@ public Mono getAnomalyAlertingConfigurationAsync(U * @param configurationId anomaly alerting configuration unique id. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ErrorCodeException thrown if the request is rejected by server. + * @throws MetricsAdvisorResponseException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. * @return the response. */ @@ -996,7 +996,7 @@ public Mono getAnomalyAlertingConfigurationAsync( * * @param configurationId anomaly alerting configuration unique id. * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ErrorCodeException thrown if the request is rejected by server. + * @throws MetricsAdvisorResponseException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. * @return the response. */ @@ -1011,7 +1011,7 @@ public AnomalyAlertingConfiguration getAnomalyAlertingConfiguration(UUID configu * @param configurationId anomaly alerting configuration unique id. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ErrorCodeException thrown if the request is rejected by server. + * @throws MetricsAdvisorResponseException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. * @return the response. */ @@ -1027,7 +1027,7 @@ public Response getAnomalyAlertingConfigurationWit * @param configurationId anomaly alerting configuration unique id. * @param body anomaly alerting configuration. * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ErrorCodeException thrown if the request is rejected by server. + * @throws MetricsAdvisorResponseException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. * @return the response. */ @@ -1048,7 +1048,7 @@ public Mono> updateAnomalyAlertingConfigu * @param body anomaly alerting configuration. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ErrorCodeException thrown if the request is rejected by server. + * @throws MetricsAdvisorResponseException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. * @return the response. */ @@ -1065,7 +1065,7 @@ public Mono> updateAnomalyAlertingConfigu * @param configurationId anomaly alerting configuration unique id. * @param body anomaly alerting configuration. * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ErrorCodeException thrown if the request is rejected by server. + * @throws MetricsAdvisorResponseException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. * @return the response. */ @@ -1090,7 +1090,7 @@ public Mono updateAnomalyAlertingConfigurationAsyn * @param body anomaly alerting configuration. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ErrorCodeException thrown if the request is rejected by server. + * @throws MetricsAdvisorResponseException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. * @return the response. */ @@ -1114,7 +1114,7 @@ public Mono updateAnomalyAlertingConfigurationAsyn * @param configurationId anomaly alerting configuration unique id. * @param body anomaly alerting configuration. * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ErrorCodeException thrown if the request is rejected by server. + * @throws MetricsAdvisorResponseException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. * @return the response. */ @@ -1131,7 +1131,7 @@ public AnomalyAlertingConfiguration updateAnomalyAlertingConfiguration( * @param body anomaly alerting configuration. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ErrorCodeException thrown if the request is rejected by server. + * @throws MetricsAdvisorResponseException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. * @return the response. */ @@ -1146,7 +1146,7 @@ public Response updateAnomalyAlertingConfiguration * * @param configurationId anomaly alerting configuration unique id. * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ErrorCodeException thrown if the request is rejected by server. + * @throws MetricsAdvisorResponseException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. * @return the completion. */ @@ -1165,7 +1165,7 @@ public Mono> deleteAnomalyAlertingConfigurationWithResponseAsync( * @param configurationId anomaly alerting configuration unique id. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ErrorCodeException thrown if the request is rejected by server. + * @throws MetricsAdvisorResponseException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. * @return the completion. */ @@ -1181,7 +1181,7 @@ public Mono> deleteAnomalyAlertingConfigurationWithResponseAsync( * * @param configurationId anomaly alerting configuration unique id. * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ErrorCodeException thrown if the request is rejected by server. + * @throws MetricsAdvisorResponseException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. * @return the completion. */ @@ -1197,7 +1197,7 @@ public Mono deleteAnomalyAlertingConfigurationAsync(UUID configurationId) * @param configurationId anomaly alerting configuration unique id. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ErrorCodeException thrown if the request is rejected by server. + * @throws MetricsAdvisorResponseException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. * @return the completion. */ @@ -1212,7 +1212,7 @@ public Mono deleteAnomalyAlertingConfigurationAsync(UUID configurationId, * * @param configurationId anomaly alerting configuration unique id. * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ErrorCodeException thrown if the request is rejected by server. + * @throws MetricsAdvisorResponseException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. */ @ServiceMethod(returns = ReturnType.SINGLE) @@ -1226,7 +1226,7 @@ public void deleteAnomalyAlertingConfiguration(UUID configurationId) { * @param configurationId anomaly alerting configuration unique id. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ErrorCodeException thrown if the request is rejected by server. + * @throws MetricsAdvisorResponseException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. * @return the response. */ @@ -1240,7 +1240,7 @@ public Response deleteAnomalyAlertingConfigurationWithResponse(UUID config * * @param body anomaly alerting configuration. * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ErrorCodeException thrown if the request is rejected by server. + * @throws MetricsAdvisorResponseException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. * @return the completion. */ @@ -1258,7 +1258,7 @@ public Mono createAnomalyAlertingCon * @param body anomaly alerting configuration. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ErrorCodeException thrown if the request is rejected by server. + * @throws MetricsAdvisorResponseException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. * @return the completion. */ @@ -1274,7 +1274,7 @@ public Mono createAnomalyAlertingCon * * @param body anomaly alerting configuration. * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ErrorCodeException thrown if the request is rejected by server. + * @throws MetricsAdvisorResponseException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. * @return the completion. */ @@ -1290,7 +1290,7 @@ public Mono createAnomalyAlertingConfigurationAsync(AnomalyAlertingConfigu * @param body anomaly alerting configuration. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ErrorCodeException thrown if the request is rejected by server. + * @throws MetricsAdvisorResponseException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. * @return the completion. */ @@ -1305,7 +1305,7 @@ public Mono createAnomalyAlertingConfigurationAsync(AnomalyAlertingConfigu * * @param body anomaly alerting configuration. * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ErrorCodeException thrown if the request is rejected by server. + * @throws MetricsAdvisorResponseException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. */ @ServiceMethod(returns = ReturnType.SINGLE) @@ -1319,7 +1319,7 @@ public void createAnomalyAlertingConfiguration(AnomalyAlertingConfiguration body * @param body anomaly alerting configuration. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ErrorCodeException thrown if the request is rejected by server. + * @throws MetricsAdvisorResponseException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. * @return the response. */ @@ -1337,7 +1337,7 @@ public Response createAnomalyAlertingConfigurationWithResponse( * @param skip for paging, skipped number. * @param maxpagesize the maximum number of items in one page. * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ErrorCodeException thrown if the request is rejected by server. + * @throws MetricsAdvisorResponseException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. * @return the response. */ @@ -1369,7 +1369,7 @@ public Mono> getAlertsByAnomalyAlertingConfiguration * @param maxpagesize the maximum number of items in one page. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ErrorCodeException thrown if the request is rejected by server. + * @throws MetricsAdvisorResponseException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. * @return the response. */ @@ -1398,7 +1398,7 @@ public Mono> getAlertsByAnomalyAlertingConfiguration * @param skip for paging, skipped number. * @param maxpagesize the maximum number of items in one page. * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ErrorCodeException thrown if the request is rejected by server. + * @throws MetricsAdvisorResponseException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. * @return the response. */ @@ -1419,7 +1419,7 @@ public PagedFlux getAlertsByAnomalyAlertingConfigurationAsync( * @param maxpagesize the maximum number of items in one page. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ErrorCodeException thrown if the request is rejected by server. + * @throws MetricsAdvisorResponseException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. * @return the response. */ @@ -1441,7 +1441,7 @@ public PagedFlux getAlertsByAnomalyAlertingConfigurationAsync( * @param skip for paging, skipped number. * @param maxpagesize the maximum number of items in one page. * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ErrorCodeException thrown if the request is rejected by server. + * @throws MetricsAdvisorResponseException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. * @return the response. */ @@ -1461,7 +1461,7 @@ public PagedIterable getAlertsByAnomalyAlertingConfiguration( * @param maxpagesize the maximum number of items in one page. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ErrorCodeException thrown if the request is rejected by server. + * @throws MetricsAdvisorResponseException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. * @return the response. */ @@ -1480,7 +1480,7 @@ public PagedIterable getAlertsByAnomalyAlertingConfiguration( * @param skip for paging, skipped number. * @param maxpagesize the maximum number of items in one page. * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ErrorCodeException thrown if the request is rejected by server. + * @throws MetricsAdvisorResponseException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. * @return the response. */ @@ -1518,7 +1518,7 @@ public Mono> getAnomaliesFromAlertByAnomalyAlerting * @param maxpagesize the maximum number of items in one page. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ErrorCodeException thrown if the request is rejected by server. + * @throws MetricsAdvisorResponseException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. * @return the response. */ @@ -1547,7 +1547,7 @@ public Mono> getAnomaliesFromAlertByAnomalyAlerting * @param skip for paging, skipped number. * @param maxpagesize the maximum number of items in one page. * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ErrorCodeException thrown if the request is rejected by server. + * @throws MetricsAdvisorResponseException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. * @return the response. */ @@ -1570,7 +1570,7 @@ public PagedFlux getAnomaliesFromAlertByAnomalyAlertingConfigurat * @param maxpagesize the maximum number of items in one page. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ErrorCodeException thrown if the request is rejected by server. + * @throws MetricsAdvisorResponseException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. * @return the response. */ @@ -1592,7 +1592,7 @@ public PagedFlux getAnomaliesFromAlertByAnomalyAlertingConfigurat * @param skip for paging, skipped number. * @param maxpagesize the maximum number of items in one page. * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ErrorCodeException thrown if the request is rejected by server. + * @throws MetricsAdvisorResponseException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. * @return the response. */ @@ -1612,7 +1612,7 @@ public PagedIterable getAnomaliesFromAlertByAnomalyAlertingConfig * @param maxpagesize the maximum number of items in one page. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ErrorCodeException thrown if the request is rejected by server. + * @throws MetricsAdvisorResponseException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. * @return the response. */ @@ -1632,7 +1632,7 @@ public PagedIterable getAnomaliesFromAlertByAnomalyAlertingConfig * @param skip for paging, skipped number. * @param maxpagesize the maximum number of items in one page. * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ErrorCodeException thrown if the request is rejected by server. + * @throws MetricsAdvisorResponseException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. * @return the response. */ @@ -1670,7 +1670,7 @@ public Mono> getIncidentsFromAlertByAnomalyAlertin * @param maxpagesize the maximum number of items in one page. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ErrorCodeException thrown if the request is rejected by server. + * @throws MetricsAdvisorResponseException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. * @return the response. */ @@ -1699,7 +1699,7 @@ public Mono> getIncidentsFromAlertByAnomalyAlertin * @param skip for paging, skipped number. * @param maxpagesize the maximum number of items in one page. * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ErrorCodeException thrown if the request is rejected by server. + * @throws MetricsAdvisorResponseException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. * @return the response. */ @@ -1722,7 +1722,7 @@ public PagedFlux getIncidentsFromAlertByAnomalyAlertingConfigura * @param maxpagesize the maximum number of items in one page. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ErrorCodeException thrown if the request is rejected by server. + * @throws MetricsAdvisorResponseException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. * @return the response. */ @@ -1744,7 +1744,7 @@ public PagedFlux getIncidentsFromAlertByAnomalyAlertingConfigura * @param skip for paging, skipped number. * @param maxpagesize the maximum number of items in one page. * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ErrorCodeException thrown if the request is rejected by server. + * @throws MetricsAdvisorResponseException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. * @return the response. */ @@ -1764,7 +1764,7 @@ public PagedIterable getIncidentsFromAlertByAnomalyAlertingConfi * @param maxpagesize the maximum number of items in one page. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ErrorCodeException thrown if the request is rejected by server. + * @throws MetricsAdvisorResponseException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. * @return the response. */ @@ -1781,7 +1781,7 @@ public PagedIterable getIncidentsFromAlertByAnomalyAlertingConfi * * @param configurationId anomaly detection configuration unique id. * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ErrorCodeException thrown if the request is rejected by server. + * @throws MetricsAdvisorResponseException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. * @return the response. */ @@ -1800,7 +1800,7 @@ public Mono> getAnomalyDetectionConfigur * @param configurationId anomaly detection configuration unique id. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ErrorCodeException thrown if the request is rejected by server. + * @throws MetricsAdvisorResponseException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. * @return the response. */ @@ -1816,7 +1816,7 @@ public Mono> getAnomalyDetectionConfigur * * @param configurationId anomaly detection configuration unique id. * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ErrorCodeException thrown if the request is rejected by server. + * @throws MetricsAdvisorResponseException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. * @return the response. */ @@ -1839,7 +1839,7 @@ public Mono getAnomalyDetectionConfigurationAsync * @param configurationId anomaly detection configuration unique id. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ErrorCodeException thrown if the request is rejected by server. + * @throws MetricsAdvisorResponseException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. * @return the response. */ @@ -1862,7 +1862,7 @@ public Mono getAnomalyDetectionConfigurationAsync * * @param configurationId anomaly detection configuration unique id. * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ErrorCodeException thrown if the request is rejected by server. + * @throws MetricsAdvisorResponseException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. * @return the response. */ @@ -1877,7 +1877,7 @@ public AnomalyDetectionConfiguration getAnomalyDetectionConfiguration(UUID confi * @param configurationId anomaly detection configuration unique id. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ErrorCodeException thrown if the request is rejected by server. + * @throws MetricsAdvisorResponseException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. * @return the response. */ @@ -1893,7 +1893,7 @@ public Response getAnomalyDetectionConfigurationW * @param configurationId anomaly detection configuration unique id. * @param body anomaly detection configuration. * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ErrorCodeException thrown if the request is rejected by server. + * @throws MetricsAdvisorResponseException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. * @return the response. */ @@ -1914,7 +1914,7 @@ public Mono> updateAnomalyDetectionConfi * @param body anomaly detection configuration. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ErrorCodeException thrown if the request is rejected by server. + * @throws MetricsAdvisorResponseException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. * @return the response. */ @@ -1931,7 +1931,7 @@ public Mono> updateAnomalyDetectionConfi * @param configurationId anomaly detection configuration unique id. * @param body anomaly detection configuration. * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ErrorCodeException thrown if the request is rejected by server. + * @throws MetricsAdvisorResponseException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. * @return the response. */ @@ -1956,7 +1956,7 @@ public Mono updateAnomalyDetectionConfigurationAs * @param body anomaly detection configuration. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ErrorCodeException thrown if the request is rejected by server. + * @throws MetricsAdvisorResponseException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. * @return the response. */ @@ -1980,7 +1980,7 @@ public Mono updateAnomalyDetectionConfigurationAs * @param configurationId anomaly detection configuration unique id. * @param body anomaly detection configuration. * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ErrorCodeException thrown if the request is rejected by server. + * @throws MetricsAdvisorResponseException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. * @return the response. */ @@ -1997,7 +1997,7 @@ public AnomalyDetectionConfiguration updateAnomalyDetectionConfiguration( * @param body anomaly detection configuration. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ErrorCodeException thrown if the request is rejected by server. + * @throws MetricsAdvisorResponseException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. * @return the response. */ @@ -2012,7 +2012,7 @@ public Response updateAnomalyDetectionConfigurati * * @param configurationId anomaly detection configuration unique id. * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ErrorCodeException thrown if the request is rejected by server. + * @throws MetricsAdvisorResponseException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. * @return the completion. */ @@ -2031,7 +2031,7 @@ public Mono> deleteAnomalyDetectionConfigurationWithResponseAsync * @param configurationId anomaly detection configuration unique id. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ErrorCodeException thrown if the request is rejected by server. + * @throws MetricsAdvisorResponseException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. * @return the completion. */ @@ -2047,7 +2047,7 @@ public Mono> deleteAnomalyDetectionConfigurationWithResponseAsync * * @param configurationId anomaly detection configuration unique id. * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ErrorCodeException thrown if the request is rejected by server. + * @throws MetricsAdvisorResponseException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. * @return the completion. */ @@ -2063,7 +2063,7 @@ public Mono deleteAnomalyDetectionConfigurationAsync(UUID configurationId) * @param configurationId anomaly detection configuration unique id. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ErrorCodeException thrown if the request is rejected by server. + * @throws MetricsAdvisorResponseException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. * @return the completion. */ @@ -2078,7 +2078,7 @@ public Mono deleteAnomalyDetectionConfigurationAsync(UUID configurationId, * * @param configurationId anomaly detection configuration unique id. * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ErrorCodeException thrown if the request is rejected by server. + * @throws MetricsAdvisorResponseException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. */ @ServiceMethod(returns = ReturnType.SINGLE) @@ -2092,7 +2092,7 @@ public void deleteAnomalyDetectionConfiguration(UUID configurationId) { * @param configurationId anomaly detection configuration unique id. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ErrorCodeException thrown if the request is rejected by server. + * @throws MetricsAdvisorResponseException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. * @return the response. */ @@ -2106,7 +2106,7 @@ public Response deleteAnomalyDetectionConfigurationWithResponse(UUID confi * * @param body anomaly detection configuration. * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ErrorCodeException thrown if the request is rejected by server. + * @throws MetricsAdvisorResponseException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. * @return the completion. */ @@ -2124,7 +2124,7 @@ public Mono createAnomalyDetectionC * @param body anomaly detection configuration. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ErrorCodeException thrown if the request is rejected by server. + * @throws MetricsAdvisorResponseException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. * @return the completion. */ @@ -2140,7 +2140,7 @@ public Mono createAnomalyDetectionC * * @param body anomaly detection configuration. * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ErrorCodeException thrown if the request is rejected by server. + * @throws MetricsAdvisorResponseException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. * @return the completion. */ @@ -2156,7 +2156,7 @@ public Mono createAnomalyDetectionConfigurationAsync(AnomalyDetectionConfi * @param body anomaly detection configuration. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ErrorCodeException thrown if the request is rejected by server. + * @throws MetricsAdvisorResponseException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. * @return the completion. */ @@ -2171,7 +2171,7 @@ public Mono createAnomalyDetectionConfigurationAsync(AnomalyDetectionConfi * * @param body anomaly detection configuration. * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ErrorCodeException thrown if the request is rejected by server. + * @throws MetricsAdvisorResponseException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. */ @ServiceMethod(returns = ReturnType.SINGLE) @@ -2185,7 +2185,7 @@ public void createAnomalyDetectionConfiguration(AnomalyDetectionConfiguration bo * @param body anomaly detection configuration. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ErrorCodeException thrown if the request is rejected by server. + * @throws MetricsAdvisorResponseException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. * @return the response. */ @@ -2202,7 +2202,7 @@ public Response createAnomalyDetectionConfigurationWithResponse( * @param skip for paging, skipped number. * @param maxpagesize the maximum number of items in one page. * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ErrorCodeException thrown if the request is rejected by server. + * @throws MetricsAdvisorResponseException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. * @return the response. */ @@ -2234,7 +2234,7 @@ public Response createAnomalyDetectionConfigurationWithResponse( * @param maxpagesize the maximum number of items in one page. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ErrorCodeException thrown if the request is rejected by server. + * @throws MetricsAdvisorResponseException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. * @return the response. */ @@ -2263,7 +2263,7 @@ public Response createAnomalyDetectionConfigurationWithResponse( * @param skip for paging, skipped number. * @param maxpagesize the maximum number of items in one page. * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ErrorCodeException thrown if the request is rejected by server. + * @throws MetricsAdvisorResponseException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. * @return the response. */ @@ -2286,7 +2286,7 @@ public PagedFlux getAnomalyAlertingConfigurationsB * @param maxpagesize the maximum number of items in one page. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ErrorCodeException thrown if the request is rejected by server. + * @throws MetricsAdvisorResponseException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. * @return the response. */ @@ -2309,7 +2309,7 @@ public PagedFlux getAnomalyAlertingConfigurationsB * @param skip for paging, skipped number. * @param maxpagesize the maximum number of items in one page. * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ErrorCodeException thrown if the request is rejected by server. + * @throws MetricsAdvisorResponseException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. * @return the response. */ @@ -2329,7 +2329,7 @@ public PagedIterable getAnomalyAlertingConfigurati * @param maxpagesize the maximum number of items in one page. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ErrorCodeException thrown if the request is rejected by server. + * @throws MetricsAdvisorResponseException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. * @return the response. */ @@ -2347,7 +2347,7 @@ public PagedIterable getAnomalyAlertingConfigurati * @param configurationId anomaly detection configuration unique id. * @param body query series detection result request. * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ErrorCodeException thrown if the request is rejected by server. + * @throws MetricsAdvisorResponseException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. * @return the response. */ @@ -2368,7 +2368,7 @@ public Mono> getSeriesByAnomalyDetectionConfiguration * @param body query series detection result request. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ErrorCodeException thrown if the request is rejected by server. + * @throws MetricsAdvisorResponseException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. * @return the response. */ @@ -2386,7 +2386,7 @@ public Mono> getSeriesByAnomalyDetectionConfiguration * @param configurationId anomaly detection configuration unique id. * @param body query series detection result request. * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ErrorCodeException thrown if the request is rejected by server. + * @throws MetricsAdvisorResponseException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. * @return the response. */ @@ -2411,7 +2411,7 @@ public Mono getSeriesByAnomalyDetectionConfigurationAsync( * @param body query series detection result request. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ErrorCodeException thrown if the request is rejected by server. + * @throws MetricsAdvisorResponseException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. * @return the response. */ @@ -2435,7 +2435,7 @@ public Mono getSeriesByAnomalyDetectionConfigurationAsync( * @param configurationId anomaly detection configuration unique id. * @param body query series detection result request. * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ErrorCodeException thrown if the request is rejected by server. + * @throws MetricsAdvisorResponseException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. * @return the response. */ @@ -2451,7 +2451,7 @@ public SeriesResultList getSeriesByAnomalyDetectionConfiguration(UUID configurat * @param body query series detection result request. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ErrorCodeException thrown if the request is rejected by server. + * @throws MetricsAdvisorResponseException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. * @return the response. */ @@ -2469,7 +2469,7 @@ public Response getSeriesByAnomalyDetectionConfigurationWithRe * @param skip for paging, skipped number. * @param maxpagesize the maximum number of items in one page. * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ErrorCodeException thrown if the request is rejected by server. + * @throws MetricsAdvisorResponseException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. * @return the response. */ @@ -2501,7 +2501,7 @@ public Mono> getAnomaliesByAnomalyDetectionConfigur * @param maxpagesize the maximum number of items in one page. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ErrorCodeException thrown if the request is rejected by server. + * @throws MetricsAdvisorResponseException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. * @return the response. */ @@ -2534,7 +2534,7 @@ public Mono> getAnomaliesByAnomalyDetectionConfigur * @param skip for paging, skipped number. * @param maxpagesize the maximum number of items in one page. * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ErrorCodeException thrown if the request is rejected by server. + * @throws MetricsAdvisorResponseException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. * @return the response. */ @@ -2557,7 +2557,7 @@ public PagedFlux getAnomaliesByAnomalyDetectionConfigurationAsync * @param maxpagesize the maximum number of items in one page. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ErrorCodeException thrown if the request is rejected by server. + * @throws MetricsAdvisorResponseException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. * @return the response. */ @@ -2583,7 +2583,7 @@ public PagedFlux getAnomaliesByAnomalyDetectionConfigurationAsync * @param skip for paging, skipped number. * @param maxpagesize the maximum number of items in one page. * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ErrorCodeException thrown if the request is rejected by server. + * @throws MetricsAdvisorResponseException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. * @return the response. */ @@ -2603,7 +2603,7 @@ public PagedIterable getAnomaliesByAnomalyDetectionConfiguration( * @param maxpagesize the maximum number of items in one page. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ErrorCodeException thrown if the request is rejected by server. + * @throws MetricsAdvisorResponseException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. * @return the response. */ @@ -2626,7 +2626,7 @@ public PagedIterable getAnomaliesByAnomalyDetectionConfiguration( * @param skip for paging, skipped number. * @param maxpagesize the maximum number of items in one page. * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ErrorCodeException thrown if the request is rejected by server. + * @throws MetricsAdvisorResponseException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. * @return the response. */ @@ -2658,7 +2658,7 @@ public Mono> getDimensionOfAnomaliesByAnomalyDetectionConf * @param maxpagesize the maximum number of items in one page. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ErrorCodeException thrown if the request is rejected by server. + * @throws MetricsAdvisorResponseException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. * @return the response. */ @@ -2687,7 +2687,7 @@ public Mono> getDimensionOfAnomaliesByAnomalyDetectionConf * @param skip for paging, skipped number. * @param maxpagesize the maximum number of items in one page. * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ErrorCodeException thrown if the request is rejected by server. + * @throws MetricsAdvisorResponseException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. * @return the response. */ @@ -2710,7 +2710,7 @@ public PagedFlux getDimensionOfAnomaliesByAnomalyDetectionConfigurationA * @param maxpagesize the maximum number of items in one page. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ErrorCodeException thrown if the request is rejected by server. + * @throws MetricsAdvisorResponseException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. * @return the response. */ @@ -2734,7 +2734,7 @@ public PagedFlux getDimensionOfAnomaliesByAnomalyDetectionConfigurationA * @param skip for paging, skipped number. * @param maxpagesize the maximum number of items in one page. * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ErrorCodeException thrown if the request is rejected by server. + * @throws MetricsAdvisorResponseException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. * @return the response. */ @@ -2754,7 +2754,7 @@ public PagedIterable getDimensionOfAnomaliesByAnomalyDetectionConfigurat * @param maxpagesize the maximum number of items in one page. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ErrorCodeException thrown if the request is rejected by server. + * @throws MetricsAdvisorResponseException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. * @return the response. */ @@ -2773,7 +2773,7 @@ public PagedIterable getDimensionOfAnomaliesByAnomalyDetectionConfigurat * @param body query detection incident result request. * @param maxpagesize the maximum number of items in one page. * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ErrorCodeException thrown if the request is rejected by server. + * @throws MetricsAdvisorResponseException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. * @return the response. */ @@ -2804,7 +2804,7 @@ public Mono> getIncidentsByAnomalyDetectionConfigu * @param maxpagesize the maximum number of items in one page. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ErrorCodeException thrown if the request is rejected by server. + * @throws MetricsAdvisorResponseException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. * @return the response. */ @@ -2832,7 +2832,7 @@ public Mono> getIncidentsByAnomalyDetectionConfigu * @param body query detection incident result request. * @param maxpagesize the maximum number of items in one page. * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ErrorCodeException thrown if the request is rejected by server. + * @throws MetricsAdvisorResponseException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. * @return the response. */ @@ -2852,7 +2852,7 @@ public PagedFlux getIncidentsByAnomalyDetectionConfigurationAsyn * @param maxpagesize the maximum number of items in one page. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ErrorCodeException thrown if the request is rejected by server. + * @throws MetricsAdvisorResponseException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. * @return the response. */ @@ -2873,7 +2873,7 @@ public PagedFlux getIncidentsByAnomalyDetectionConfigurationAsyn * @param body query detection incident result request. * @param maxpagesize the maximum number of items in one page. * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ErrorCodeException thrown if the request is rejected by server. + * @throws MetricsAdvisorResponseException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. * @return the response. */ @@ -2892,7 +2892,7 @@ public PagedIterable getIncidentsByAnomalyDetectionConfiguration * @param maxpagesize the maximum number of items in one page. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ErrorCodeException thrown if the request is rejected by server. + * @throws MetricsAdvisorResponseException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. * @return the response. */ @@ -2910,7 +2910,7 @@ public PagedIterable getIncidentsByAnomalyDetectionConfiguration * @param maxpagesize the maximum number of items in one page. * @param token the token for getting the next page. * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ErrorCodeException thrown if the request is rejected by server. + * @throws MetricsAdvisorResponseException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. * @return the response. */ @@ -2941,7 +2941,7 @@ public Mono> getIncidentsByAnomalyDetectionConfigu * @param token the token for getting the next page. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ErrorCodeException thrown if the request is rejected by server. + * @throws MetricsAdvisorResponseException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. * @return the response. */ @@ -2969,7 +2969,7 @@ public Mono> getIncidentsByAnomalyDetectionConfigu * @param maxpagesize the maximum number of items in one page. * @param token the token for getting the next page. * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ErrorCodeException thrown if the request is rejected by server. + * @throws MetricsAdvisorResponseException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. * @return the response. */ @@ -2991,7 +2991,7 @@ public PagedFlux getIncidentsByAnomalyDetectionConfigurationNext * @param token the token for getting the next page. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ErrorCodeException thrown if the request is rejected by server. + * @throws MetricsAdvisorResponseException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. * @return the response. */ @@ -3012,7 +3012,7 @@ public PagedFlux getIncidentsByAnomalyDetectionConfigurationNext * @param maxpagesize the maximum number of items in one page. * @param token the token for getting the next page. * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ErrorCodeException thrown if the request is rejected by server. + * @throws MetricsAdvisorResponseException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. * @return the response. */ @@ -3031,7 +3031,7 @@ public PagedIterable getIncidentsByAnomalyDetectionConfiguration * @param token the token for getting the next page. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ErrorCodeException thrown if the request is rejected by server. + * @throws MetricsAdvisorResponseException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. * @return the response. */ @@ -3049,7 +3049,7 @@ public PagedIterable getIncidentsByAnomalyDetectionConfiguration * @param configurationId anomaly detection configuration unique id. * @param incidentId incident id. * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ErrorCodeException thrown if the request is rejected by server. + * @throws MetricsAdvisorResponseException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. * @return the response. */ @@ -3070,7 +3070,7 @@ public Mono> getRootCauseOfIncidentByAnomalyDetectionCon * @param incidentId incident id. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ErrorCodeException thrown if the request is rejected by server. + * @throws MetricsAdvisorResponseException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. * @return the response. */ @@ -3088,7 +3088,7 @@ public Mono> getRootCauseOfIncidentByAnomalyDetectionCon * @param configurationId anomaly detection configuration unique id. * @param incidentId incident id. * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ErrorCodeException thrown if the request is rejected by server. + * @throws MetricsAdvisorResponseException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. * @return the response. */ @@ -3113,7 +3113,7 @@ public Mono getRootCauseOfIncidentByAnomalyDetectionConfiguration * @param incidentId incident id. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ErrorCodeException thrown if the request is rejected by server. + * @throws MetricsAdvisorResponseException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. * @return the response. */ @@ -3138,7 +3138,7 @@ public Mono getRootCauseOfIncidentByAnomalyDetectionConfiguration * @param configurationId anomaly detection configuration unique id. * @param incidentId incident id. * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ErrorCodeException thrown if the request is rejected by server. + * @throws MetricsAdvisorResponseException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. * @return the response. */ @@ -3155,7 +3155,7 @@ public RootCauseList getRootCauseOfIncidentByAnomalyDetectionConfiguration( * @param incidentId incident id. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ErrorCodeException thrown if the request is rejected by server. + * @throws MetricsAdvisorResponseException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. * @return the response. */ @@ -3172,7 +3172,7 @@ public Response getRootCauseOfIncidentByAnomalyDetectionConfigura * * @param body Create data source credential request. * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ErrorCodeException thrown if the request is rejected by server. + * @throws MetricsAdvisorResponseException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. * @return the completion. */ @@ -3188,7 +3188,7 @@ public Mono createCredentialWithResponseAsync(DataSour * @param body Create data source credential request. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ErrorCodeException thrown if the request is rejected by server. + * @throws MetricsAdvisorResponseException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. * @return the completion. */ @@ -3204,7 +3204,7 @@ public Mono createCredentialWithResponseAsync( * * @param body Create data source credential request. * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ErrorCodeException thrown if the request is rejected by server. + * @throws MetricsAdvisorResponseException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. * @return the completion. */ @@ -3219,7 +3219,7 @@ public Mono createCredentialAsync(DataSourceCredential body) { * @param body Create data source credential request. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ErrorCodeException thrown if the request is rejected by server. + * @throws MetricsAdvisorResponseException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. * @return the completion. */ @@ -3233,7 +3233,7 @@ public Mono createCredentialAsync(DataSourceCredential body, Context conte * * @param body Create data source credential request. * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ErrorCodeException thrown if the request is rejected by server. + * @throws MetricsAdvisorResponseException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. */ @ServiceMethod(returns = ReturnType.SINGLE) @@ -3247,7 +3247,7 @@ public void createCredential(DataSourceCredential body) { * @param body Create data source credential request. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ErrorCodeException thrown if the request is rejected by server. + * @throws MetricsAdvisorResponseException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. * @return the response. */ @@ -3262,7 +3262,7 @@ public Response createCredentialWithResponse(DataSourceCredential body, Co * @param skip for paging, skipped number. * @param maxpagesize the maximum number of items in one page. * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ErrorCodeException thrown if the request is rejected by server. + * @throws MetricsAdvisorResponseException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. * @return the response. */ @@ -3289,7 +3289,7 @@ public Mono> listCredentialsSinglePageAsync( * @param maxpagesize the maximum number of items in one page. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ErrorCodeException thrown if the request is rejected by server. + * @throws MetricsAdvisorResponseException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. * @return the response. */ @@ -3315,7 +3315,7 @@ public Mono> listCredentialsSinglePageAsync( * @param skip for paging, skipped number. * @param maxpagesize the maximum number of items in one page. * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ErrorCodeException thrown if the request is rejected by server. + * @throws MetricsAdvisorResponseException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. * @return the response. */ @@ -3333,7 +3333,7 @@ public PagedFlux listCredentialsAsync(Integer skip, Intege * @param maxpagesize the maximum number of items in one page. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ErrorCodeException thrown if the request is rejected by server. + * @throws MetricsAdvisorResponseException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. * @return the response. */ @@ -3350,7 +3350,7 @@ public PagedFlux listCredentialsAsync(Integer skip, Intege * @param skip for paging, skipped number. * @param maxpagesize the maximum number of items in one page. * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ErrorCodeException thrown if the request is rejected by server. + * @throws MetricsAdvisorResponseException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. * @return the response. */ @@ -3366,7 +3366,7 @@ public PagedIterable listCredentials(Integer skip, Integer * @param maxpagesize the maximum number of items in one page. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ErrorCodeException thrown if the request is rejected by server. + * @throws MetricsAdvisorResponseException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. * @return the response. */ @@ -3381,7 +3381,7 @@ public PagedIterable listCredentials(Integer skip, Integer * @param credentialId Data source credential unique ID. * @param body Update data source credential request. * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ErrorCodeException thrown if the request is rejected by server. + * @throws MetricsAdvisorResponseException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. * @return the response. */ @@ -3400,7 +3400,7 @@ public Mono> updateCredentialWithResponseAsync( * @param body Update data source credential request. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ErrorCodeException thrown if the request is rejected by server. + * @throws MetricsAdvisorResponseException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. * @return the response. */ @@ -3417,7 +3417,7 @@ public Mono> updateCredentialWithResponseAsync( * @param credentialId Data source credential unique ID. * @param body Update data source credential request. * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ErrorCodeException thrown if the request is rejected by server. + * @throws MetricsAdvisorResponseException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. * @return the response. */ @@ -3441,7 +3441,7 @@ public Mono updateCredentialAsync(UUID credentialId, DataS * @param body Update data source credential request. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ErrorCodeException thrown if the request is rejected by server. + * @throws MetricsAdvisorResponseException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. * @return the response. */ @@ -3465,7 +3465,7 @@ public Mono updateCredentialAsync( * @param credentialId Data source credential unique ID. * @param body Update data source credential request. * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ErrorCodeException thrown if the request is rejected by server. + * @throws MetricsAdvisorResponseException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. * @return the response. */ @@ -3481,7 +3481,7 @@ public DataSourceCredential updateCredential(UUID credentialId, DataSourceCreden * @param body Update data source credential request. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ErrorCodeException thrown if the request is rejected by server. + * @throws MetricsAdvisorResponseException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. * @return the response. */ @@ -3496,7 +3496,7 @@ public Response updateCredentialWithResponse( * * @param credentialId Data source credential unique ID. * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ErrorCodeException thrown if the request is rejected by server. + * @throws MetricsAdvisorResponseException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. * @return the completion. */ @@ -3513,7 +3513,7 @@ public Mono> deleteCredentialWithResponseAsync(UUID credentialId) * @param credentialId Data source credential unique ID. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ErrorCodeException thrown if the request is rejected by server. + * @throws MetricsAdvisorResponseException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. * @return the completion. */ @@ -3528,7 +3528,7 @@ public Mono> deleteCredentialWithResponseAsync(UUID credentialId, * * @param credentialId Data source credential unique ID. * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ErrorCodeException thrown if the request is rejected by server. + * @throws MetricsAdvisorResponseException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. * @return the completion. */ @@ -3543,7 +3543,7 @@ public Mono deleteCredentialAsync(UUID credentialId) { * @param credentialId Data source credential unique ID. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ErrorCodeException thrown if the request is rejected by server. + * @throws MetricsAdvisorResponseException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. * @return the completion. */ @@ -3557,7 +3557,7 @@ public Mono deleteCredentialAsync(UUID credentialId, Context context) { * * @param credentialId Data source credential unique ID. * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ErrorCodeException thrown if the request is rejected by server. + * @throws MetricsAdvisorResponseException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. */ @ServiceMethod(returns = ReturnType.SINGLE) @@ -3571,7 +3571,7 @@ public void deleteCredential(UUID credentialId) { * @param credentialId Data source credential unique ID. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ErrorCodeException thrown if the request is rejected by server. + * @throws MetricsAdvisorResponseException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. * @return the response. */ @@ -3585,7 +3585,7 @@ public Response deleteCredentialWithResponse(UUID credentialId, Context co * * @param credentialId Data source credential unique ID. * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ErrorCodeException thrown if the request is rejected by server. + * @throws MetricsAdvisorResponseException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. * @return a data source credential. */ @@ -3602,7 +3602,7 @@ public Mono> getCredentialWithResponseAsync(UUID * @param credentialId Data source credential unique ID. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ErrorCodeException thrown if the request is rejected by server. + * @throws MetricsAdvisorResponseException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. * @return a data source credential. */ @@ -3617,7 +3617,7 @@ public Mono> getCredentialWithResponseAsync(UUID * * @param credentialId Data source credential unique ID. * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ErrorCodeException thrown if the request is rejected by server. + * @throws MetricsAdvisorResponseException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. * @return a data source credential. */ @@ -3640,7 +3640,7 @@ public Mono getCredentialAsync(UUID credentialId) { * @param credentialId Data source credential unique ID. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ErrorCodeException thrown if the request is rejected by server. + * @throws MetricsAdvisorResponseException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. * @return a data source credential. */ @@ -3662,7 +3662,7 @@ public Mono getCredentialAsync(UUID credentialId, Context * * @param credentialId Data source credential unique ID. * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ErrorCodeException thrown if the request is rejected by server. + * @throws MetricsAdvisorResponseException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. * @return a data source credential. */ @@ -3677,7 +3677,7 @@ public DataSourceCredential getCredential(UUID credentialId) { * @param credentialId Data source credential unique ID. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ErrorCodeException thrown if the request is rejected by server. + * @throws MetricsAdvisorResponseException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. * @return a data source credential. */ @@ -3697,7 +3697,7 @@ public Response getCredentialWithResponse(UUID credentialI * @param skip for paging, skipped number. * @param maxpagesize the maximum number of items in one page. * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ErrorCodeException thrown if the request is rejected by server. + * @throws MetricsAdvisorResponseException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. * @return the response. */ @@ -3747,7 +3747,7 @@ public Mono> listDataFeedsSinglePageAsync( * @param maxpagesize the maximum number of items in one page. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ErrorCodeException thrown if the request is rejected by server. + * @throws MetricsAdvisorResponseException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. * @return the response. */ @@ -3795,7 +3795,7 @@ public Mono> listDataFeedsSinglePageAsync( * @param skip for paging, skipped number. * @param maxpagesize the maximum number of items in one page. * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ErrorCodeException thrown if the request is rejected by server. + * @throws MetricsAdvisorResponseException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. * @return the response. */ @@ -3827,7 +3827,7 @@ public PagedFlux listDataFeedsAsync( * @param maxpagesize the maximum number of items in one page. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ErrorCodeException thrown if the request is rejected by server. + * @throws MetricsAdvisorResponseException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. * @return the response. */ @@ -3866,7 +3866,7 @@ public PagedFlux listDataFeedsAsync( * @param skip for paging, skipped number. * @param maxpagesize the maximum number of items in one page. * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ErrorCodeException thrown if the request is rejected by server. + * @throws MetricsAdvisorResponseException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. * @return the response. */ @@ -3895,7 +3895,7 @@ public PagedIterable listDataFeeds( * @param maxpagesize the maximum number of items in one page. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ErrorCodeException thrown if the request is rejected by server. + * @throws MetricsAdvisorResponseException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. * @return the response. */ @@ -3919,7 +3919,7 @@ public PagedIterable listDataFeeds( * * @param body parameters to create a data feed. * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ErrorCodeException thrown if the request is rejected by server. + * @throws MetricsAdvisorResponseException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. * @return the completion. */ @@ -3935,7 +3935,7 @@ public Mono createDataFeedWithResponseAsync(DataFeedDeta * @param body parameters to create a data feed. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ErrorCodeException thrown if the request is rejected by server. + * @throws MetricsAdvisorResponseException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. * @return the completion. */ @@ -3950,7 +3950,7 @@ public Mono createDataFeedWithResponseAsync(DataFeedDeta * * @param body parameters to create a data feed. * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ErrorCodeException thrown if the request is rejected by server. + * @throws MetricsAdvisorResponseException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. * @return the completion. */ @@ -3965,7 +3965,7 @@ public Mono createDataFeedAsync(DataFeedDetail body) { * @param body parameters to create a data feed. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ErrorCodeException thrown if the request is rejected by server. + * @throws MetricsAdvisorResponseException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. * @return the completion. */ @@ -3979,7 +3979,7 @@ public Mono createDataFeedAsync(DataFeedDetail body, Context context) { * * @param body parameters to create a data feed. * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ErrorCodeException thrown if the request is rejected by server. + * @throws MetricsAdvisorResponseException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. */ @ServiceMethod(returns = ReturnType.SINGLE) @@ -3993,7 +3993,7 @@ public void createDataFeed(DataFeedDetail body) { * @param body parameters to create a data feed. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ErrorCodeException thrown if the request is rejected by server. + * @throws MetricsAdvisorResponseException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. * @return the response. */ @@ -4007,7 +4007,7 @@ public Response createDataFeedWithResponse(DataFeedDetail body, Context co * * @param dataFeedId The data feed unique id. * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ErrorCodeException thrown if the request is rejected by server. + * @throws MetricsAdvisorResponseException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. * @return a data feed by its id. */ @@ -4024,7 +4024,7 @@ public Mono> getDataFeedByIdWithResponseAsync(UUID data * @param dataFeedId The data feed unique id. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ErrorCodeException thrown if the request is rejected by server. + * @throws MetricsAdvisorResponseException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. * @return a data feed by its id. */ @@ -4039,7 +4039,7 @@ public Mono> getDataFeedByIdWithResponseAsync(UUID data * * @param dataFeedId The data feed unique id. * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ErrorCodeException thrown if the request is rejected by server. + * @throws MetricsAdvisorResponseException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. * @return a data feed by its id. */ @@ -4062,7 +4062,7 @@ public Mono getDataFeedByIdAsync(UUID dataFeedId) { * @param dataFeedId The data feed unique id. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ErrorCodeException thrown if the request is rejected by server. + * @throws MetricsAdvisorResponseException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. * @return a data feed by its id. */ @@ -4084,7 +4084,7 @@ public Mono getDataFeedByIdAsync(UUID dataFeedId, Context contex * * @param dataFeedId The data feed unique id. * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ErrorCodeException thrown if the request is rejected by server. + * @throws MetricsAdvisorResponseException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. * @return a data feed by its id. */ @@ -4099,7 +4099,7 @@ public DataFeedDetail getDataFeedById(UUID dataFeedId) { * @param dataFeedId The data feed unique id. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ErrorCodeException thrown if the request is rejected by server. + * @throws MetricsAdvisorResponseException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. * @return a data feed by its id. */ @@ -4114,7 +4114,7 @@ public Response getDataFeedByIdWithResponse(UUID dataFeedId, Con * @param dataFeedId The data feed unique id. * @param body parameters to update a data feed. * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ErrorCodeException thrown if the request is rejected by server. + * @throws MetricsAdvisorResponseException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. * @return the response. */ @@ -4132,7 +4132,7 @@ public Mono> updateDataFeedWithResponseAsync(UUID dataF * @param body parameters to update a data feed. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ErrorCodeException thrown if the request is rejected by server. + * @throws MetricsAdvisorResponseException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. * @return the response. */ @@ -4149,7 +4149,7 @@ public Mono> updateDataFeedWithResponseAsync( * @param dataFeedId The data feed unique id. * @param body parameters to update a data feed. * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ErrorCodeException thrown if the request is rejected by server. + * @throws MetricsAdvisorResponseException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. * @return the response. */ @@ -4173,7 +4173,7 @@ public Mono updateDataFeedAsync(UUID dataFeedId, DataFeedDetailP * @param body parameters to update a data feed. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ErrorCodeException thrown if the request is rejected by server. + * @throws MetricsAdvisorResponseException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. * @return the response. */ @@ -4196,7 +4196,7 @@ public Mono updateDataFeedAsync(UUID dataFeedId, DataFeedDetailP * @param dataFeedId The data feed unique id. * @param body parameters to update a data feed. * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ErrorCodeException thrown if the request is rejected by server. + * @throws MetricsAdvisorResponseException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. * @return the response. */ @@ -4212,7 +4212,7 @@ public DataFeedDetail updateDataFeed(UUID dataFeedId, DataFeedDetailPatch body) * @param body parameters to update a data feed. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ErrorCodeException thrown if the request is rejected by server. + * @throws MetricsAdvisorResponseException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. * @return the response. */ @@ -4227,7 +4227,7 @@ public Response updateDataFeedWithResponse( * * @param dataFeedId The data feed unique id. * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ErrorCodeException thrown if the request is rejected by server. + * @throws MetricsAdvisorResponseException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. * @return the completion. */ @@ -4243,7 +4243,7 @@ public Mono> deleteDataFeedWithResponseAsync(UUID dataFeedId) { * @param dataFeedId The data feed unique id. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ErrorCodeException thrown if the request is rejected by server. + * @throws MetricsAdvisorResponseException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. * @return the completion. */ @@ -4258,7 +4258,7 @@ public Mono> deleteDataFeedWithResponseAsync(UUID dataFeedId, Con * * @param dataFeedId The data feed unique id. * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ErrorCodeException thrown if the request is rejected by server. + * @throws MetricsAdvisorResponseException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. * @return the completion. */ @@ -4273,7 +4273,7 @@ public Mono deleteDataFeedAsync(UUID dataFeedId) { * @param dataFeedId The data feed unique id. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ErrorCodeException thrown if the request is rejected by server. + * @throws MetricsAdvisorResponseException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. * @return the completion. */ @@ -4287,7 +4287,7 @@ public Mono deleteDataFeedAsync(UUID dataFeedId, Context context) { * * @param dataFeedId The data feed unique id. * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ErrorCodeException thrown if the request is rejected by server. + * @throws MetricsAdvisorResponseException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. */ @ServiceMethod(returns = ReturnType.SINGLE) @@ -4301,7 +4301,7 @@ public void deleteDataFeed(UUID dataFeedId) { * @param dataFeedId The data feed unique id. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ErrorCodeException thrown if the request is rejected by server. + * @throws MetricsAdvisorResponseException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. * @return the response. */ @@ -4315,7 +4315,7 @@ public Response deleteDataFeedWithResponse(UUID dataFeedId, Context contex * * @param feedbackId the unique feedback ID. * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ErrorCodeException thrown if the request is rejected by server. + * @throws MetricsAdvisorResponseException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. * @return a metric feedback by its id. */ @@ -4332,7 +4332,7 @@ public Mono> getMetricFeedbackWithResponseAsync(UUID fe * @param feedbackId the unique feedback ID. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ErrorCodeException thrown if the request is rejected by server. + * @throws MetricsAdvisorResponseException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. * @return a metric feedback by its id. */ @@ -4347,7 +4347,7 @@ public Mono> getMetricFeedbackWithResponseAsync(UUID fe * * @param feedbackId the unique feedback ID. * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ErrorCodeException thrown if the request is rejected by server. + * @throws MetricsAdvisorResponseException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. * @return a metric feedback by its id. */ @@ -4370,7 +4370,7 @@ public Mono getMetricFeedbackAsync(UUID feedbackId) { * @param feedbackId the unique feedback ID. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ErrorCodeException thrown if the request is rejected by server. + * @throws MetricsAdvisorResponseException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. * @return a metric feedback by its id. */ @@ -4392,7 +4392,7 @@ public Mono getMetricFeedbackAsync(UUID feedbackId, Context cont * * @param feedbackId the unique feedback ID. * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ErrorCodeException thrown if the request is rejected by server. + * @throws MetricsAdvisorResponseException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. * @return a metric feedback by its id. */ @@ -4407,7 +4407,7 @@ public MetricFeedback getMetricFeedback(UUID feedbackId) { * @param feedbackId the unique feedback ID. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ErrorCodeException thrown if the request is rejected by server. + * @throws MetricsAdvisorResponseException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. * @return a metric feedback by its id. */ @@ -4423,7 +4423,7 @@ public Response getMetricFeedbackWithResponse(UUID feedbackId, C * @param skip for paging, skipped number. * @param maxpagesize the maximum number of items in one page. * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ErrorCodeException thrown if the request is rejected by server. + * @throws MetricsAdvisorResponseException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. * @return the response. */ @@ -4454,7 +4454,7 @@ public Mono> listMetricFeedbacksSinglePageAsync( * @param maxpagesize the maximum number of items in one page. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ErrorCodeException thrown if the request is rejected by server. + * @throws MetricsAdvisorResponseException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. * @return the response. */ @@ -4481,7 +4481,7 @@ public Mono> listMetricFeedbacksSinglePageAsync( * @param skip for paging, skipped number. * @param maxpagesize the maximum number of items in one page. * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ErrorCodeException thrown if the request is rejected by server. + * @throws MetricsAdvisorResponseException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. * @return the response. */ @@ -4501,7 +4501,7 @@ public PagedFlux listMetricFeedbacksAsync( * @param maxpagesize the maximum number of items in one page. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ErrorCodeException thrown if the request is rejected by server. + * @throws MetricsAdvisorResponseException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. * @return the response. */ @@ -4520,7 +4520,7 @@ public PagedFlux listMetricFeedbacksAsync( * @param skip for paging, skipped number. * @param maxpagesize the maximum number of items in one page. * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ErrorCodeException thrown if the request is rejected by server. + * @throws MetricsAdvisorResponseException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. * @return the response. */ @@ -4538,7 +4538,7 @@ public PagedIterable listMetricFeedbacks( * @param maxpagesize the maximum number of items in one page. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ErrorCodeException thrown if the request is rejected by server. + * @throws MetricsAdvisorResponseException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. * @return the response. */ @@ -4553,7 +4553,7 @@ public PagedIterable listMetricFeedbacks( * * @param body metric feedback. * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ErrorCodeException thrown if the request is rejected by server. + * @throws MetricsAdvisorResponseException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. * @return the completion. */ @@ -4569,7 +4569,7 @@ public Mono createMetricFeedbackWithResponseAsync( * @param body metric feedback. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ErrorCodeException thrown if the request is rejected by server. + * @throws MetricsAdvisorResponseException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. * @return the completion. */ @@ -4585,7 +4585,7 @@ public Mono createMetricFeedbackWithResponseAsync( * * @param body metric feedback. * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ErrorCodeException thrown if the request is rejected by server. + * @throws MetricsAdvisorResponseException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. * @return the completion. */ @@ -4600,7 +4600,7 @@ public Mono createMetricFeedbackAsync(MetricFeedback body) { * @param body metric feedback. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ErrorCodeException thrown if the request is rejected by server. + * @throws MetricsAdvisorResponseException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. * @return the completion. */ @@ -4615,7 +4615,7 @@ public Mono createMetricFeedbackAsync(MetricFeedback body, Context context * * @param body metric feedback. * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ErrorCodeException thrown if the request is rejected by server. + * @throws MetricsAdvisorResponseException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. */ @ServiceMethod(returns = ReturnType.SINGLE) @@ -4629,7 +4629,7 @@ public void createMetricFeedback(MetricFeedback body) { * @param body metric feedback. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ErrorCodeException thrown if the request is rejected by server. + * @throws MetricsAdvisorResponseException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. * @return the response. */ @@ -4645,7 +4645,7 @@ public Response createMetricFeedbackWithResponse(MetricFeedback body, Cont * @param skip for paging, skipped number. * @param maxpagesize the maximum number of items in one page. * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ErrorCodeException thrown if the request is rejected by server. + * @throws MetricsAdvisorResponseException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. * @return the response. */ @@ -4673,7 +4673,7 @@ public Mono> listHooksSinglePageAsync(String hookName, I * @param maxpagesize the maximum number of items in one page. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ErrorCodeException thrown if the request is rejected by server. + * @throws MetricsAdvisorResponseException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. * @return the response. */ @@ -4700,7 +4700,7 @@ public Mono> listHooksSinglePageAsync( * @param skip for paging, skipped number. * @param maxpagesize the maximum number of items in one page. * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ErrorCodeException thrown if the request is rejected by server. + * @throws MetricsAdvisorResponseException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. * @return the response. */ @@ -4719,7 +4719,7 @@ public PagedFlux listHooksAsync(String hookName, Integer skip, Integer * @param maxpagesize the maximum number of items in one page. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ErrorCodeException thrown if the request is rejected by server. + * @throws MetricsAdvisorResponseException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. * @return the response. */ @@ -4737,7 +4737,7 @@ public PagedFlux listHooksAsync(String hookName, Integer skip, Integer * @param skip for paging, skipped number. * @param maxpagesize the maximum number of items in one page. * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ErrorCodeException thrown if the request is rejected by server. + * @throws MetricsAdvisorResponseException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. * @return the response. */ @@ -4754,7 +4754,7 @@ public PagedIterable listHooks(String hookName, Integer skip, Integer * @param maxpagesize the maximum number of items in one page. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ErrorCodeException thrown if the request is rejected by server. + * @throws MetricsAdvisorResponseException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. * @return the response. */ @@ -4768,7 +4768,7 @@ public PagedIterable listHooks(String hookName, Integer skip, Integer * * @param body Create hook request. * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ErrorCodeException thrown if the request is rejected by server. + * @throws MetricsAdvisorResponseException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. * @return the completion. */ @@ -4784,7 +4784,7 @@ public Mono createHookWithResponseAsync(HookInfo body) { * @param body Create hook request. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ErrorCodeException thrown if the request is rejected by server. + * @throws MetricsAdvisorResponseException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. * @return the completion. */ @@ -4799,7 +4799,7 @@ public Mono createHookWithResponseAsync(HookInfo body, Conte * * @param body Create hook request. * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ErrorCodeException thrown if the request is rejected by server. + * @throws MetricsAdvisorResponseException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. * @return the completion. */ @@ -4814,7 +4814,7 @@ public Mono createHookAsync(HookInfo body) { * @param body Create hook request. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ErrorCodeException thrown if the request is rejected by server. + * @throws MetricsAdvisorResponseException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. * @return the completion. */ @@ -4828,7 +4828,7 @@ public Mono createHookAsync(HookInfo body, Context context) { * * @param body Create hook request. * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ErrorCodeException thrown if the request is rejected by server. + * @throws MetricsAdvisorResponseException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. */ @ServiceMethod(returns = ReturnType.SINGLE) @@ -4842,7 +4842,7 @@ public void createHook(HookInfo body) { * @param body Create hook request. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ErrorCodeException thrown if the request is rejected by server. + * @throws MetricsAdvisorResponseException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. * @return the response. */ @@ -4856,7 +4856,7 @@ public Response createHookWithResponse(HookInfo body, Context context) { * * @param hookId Hook unique ID. * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ErrorCodeException thrown if the request is rejected by server. + * @throws MetricsAdvisorResponseException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. * @return a hook by its id. */ @@ -4872,7 +4872,7 @@ public Mono> getHookWithResponseAsync(UUID hookId) { * @param hookId Hook unique ID. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ErrorCodeException thrown if the request is rejected by server. + * @throws MetricsAdvisorResponseException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. * @return a hook by its id. */ @@ -4887,7 +4887,7 @@ public Mono> getHookWithResponseAsync(UUID hookId, Context co * * @param hookId Hook unique ID. * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ErrorCodeException thrown if the request is rejected by server. + * @throws MetricsAdvisorResponseException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. * @return a hook by its id. */ @@ -4910,7 +4910,7 @@ public Mono getHookAsync(UUID hookId) { * @param hookId Hook unique ID. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ErrorCodeException thrown if the request is rejected by server. + * @throws MetricsAdvisorResponseException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. * @return a hook by its id. */ @@ -4932,7 +4932,7 @@ public Mono getHookAsync(UUID hookId, Context context) { * * @param hookId Hook unique ID. * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ErrorCodeException thrown if the request is rejected by server. + * @throws MetricsAdvisorResponseException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. * @return a hook by its id. */ @@ -4947,7 +4947,7 @@ public HookInfo getHook(UUID hookId) { * @param hookId Hook unique ID. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ErrorCodeException thrown if the request is rejected by server. + * @throws MetricsAdvisorResponseException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. * @return a hook by its id. */ @@ -4962,7 +4962,7 @@ public Response getHookWithResponse(UUID hookId, Context context) { * @param hookId Hook unique ID. * @param body Update hook request. * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ErrorCodeException thrown if the request is rejected by server. + * @throws MetricsAdvisorResponseException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. * @return the response. */ @@ -4979,7 +4979,7 @@ public Mono> updateHookWithResponseAsync(UUID hookId, HookInf * @param body Update hook request. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ErrorCodeException thrown if the request is rejected by server. + * @throws MetricsAdvisorResponseException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. * @return the response. */ @@ -4995,7 +4995,7 @@ public Mono> updateHookWithResponseAsync(UUID hookId, HookInf * @param hookId Hook unique ID. * @param body Update hook request. * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ErrorCodeException thrown if the request is rejected by server. + * @throws MetricsAdvisorResponseException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. * @return the response. */ @@ -5019,7 +5019,7 @@ public Mono updateHookAsync(UUID hookId, HookInfoPatch body) { * @param body Update hook request. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ErrorCodeException thrown if the request is rejected by server. + * @throws MetricsAdvisorResponseException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. * @return the response. */ @@ -5042,7 +5042,7 @@ public Mono updateHookAsync(UUID hookId, HookInfoPatch body, Context c * @param hookId Hook unique ID. * @param body Update hook request. * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ErrorCodeException thrown if the request is rejected by server. + * @throws MetricsAdvisorResponseException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. * @return the response. */ @@ -5058,7 +5058,7 @@ public HookInfo updateHook(UUID hookId, HookInfoPatch body) { * @param body Update hook request. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ErrorCodeException thrown if the request is rejected by server. + * @throws MetricsAdvisorResponseException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. * @return the response. */ @@ -5072,7 +5072,7 @@ public Response updateHookWithResponse(UUID hookId, HookInfoPatch body * * @param hookId Hook unique ID. * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ErrorCodeException thrown if the request is rejected by server. + * @throws MetricsAdvisorResponseException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. * @return the completion. */ @@ -5088,7 +5088,7 @@ public Mono> deleteHookWithResponseAsync(UUID hookId) { * @param hookId Hook unique ID. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ErrorCodeException thrown if the request is rejected by server. + * @throws MetricsAdvisorResponseException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. * @return the completion. */ @@ -5103,7 +5103,7 @@ public Mono> deleteHookWithResponseAsync(UUID hookId, Context con * * @param hookId Hook unique ID. * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ErrorCodeException thrown if the request is rejected by server. + * @throws MetricsAdvisorResponseException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. * @return the completion. */ @@ -5118,7 +5118,7 @@ public Mono deleteHookAsync(UUID hookId) { * @param hookId Hook unique ID. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ErrorCodeException thrown if the request is rejected by server. + * @throws MetricsAdvisorResponseException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. * @return the completion. */ @@ -5132,7 +5132,7 @@ public Mono deleteHookAsync(UUID hookId, Context context) { * * @param hookId Hook unique ID. * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ErrorCodeException thrown if the request is rejected by server. + * @throws MetricsAdvisorResponseException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. */ @ServiceMethod(returns = ReturnType.SINGLE) @@ -5146,7 +5146,7 @@ public void deleteHook(UUID hookId) { * @param hookId Hook unique ID. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ErrorCodeException thrown if the request is rejected by server. + * @throws MetricsAdvisorResponseException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. * @return the response. */ @@ -5163,7 +5163,7 @@ public Response deleteHookWithResponse(UUID hookId, Context context) { * @param skip for paging, skipped number. * @param maxpagesize the maximum number of items in one page. * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ErrorCodeException thrown if the request is rejected by server. + * @throws MetricsAdvisorResponseException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. * @return data ingestion status by data feed. */ @@ -5195,7 +5195,7 @@ public Mono> getDataFeedIngestionStatusSi * @param maxpagesize the maximum number of items in one page. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ErrorCodeException thrown if the request is rejected by server. + * @throws MetricsAdvisorResponseException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. * @return data ingestion status by data feed. */ @@ -5224,7 +5224,7 @@ public Mono> getDataFeedIngestionStatusSi * @param skip for paging, skipped number. * @param maxpagesize the maximum number of items in one page. * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ErrorCodeException thrown if the request is rejected by server. + * @throws MetricsAdvisorResponseException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. * @return data ingestion status by data feed. */ @@ -5245,7 +5245,7 @@ public PagedFlux getDataFeedIngestionStatusAsync( * @param maxpagesize the maximum number of items in one page. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ErrorCodeException thrown if the request is rejected by server. + * @throws MetricsAdvisorResponseException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. * @return data ingestion status by data feed. */ @@ -5265,7 +5265,7 @@ public PagedFlux getDataFeedIngestionStatusAsync( * @param skip for paging, skipped number. * @param maxpagesize the maximum number of items in one page. * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ErrorCodeException thrown if the request is rejected by server. + * @throws MetricsAdvisorResponseException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. * @return data ingestion status by data feed. */ @@ -5284,7 +5284,7 @@ public PagedIterable getDataFeedIngestionStatus( * @param maxpagesize the maximum number of items in one page. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ErrorCodeException thrown if the request is rejected by server. + * @throws MetricsAdvisorResponseException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. * @return data ingestion status by data feed. */ @@ -5300,7 +5300,7 @@ public PagedIterable getDataFeedIngestionStatus( * @param dataFeedId The data feed unique id. * @param body The backfill time range. * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ErrorCodeException thrown if the request is rejected by server. + * @throws MetricsAdvisorResponseException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. * @return the completion. */ @@ -5319,7 +5319,7 @@ public Mono> resetDataFeedIngestionStatusWithResponseAsync( * @param body The backfill time range. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ErrorCodeException thrown if the request is rejected by server. + * @throws MetricsAdvisorResponseException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. * @return the completion. */ @@ -5336,7 +5336,7 @@ public Mono> resetDataFeedIngestionStatusWithResponseAsync( * @param dataFeedId The data feed unique id. * @param body The backfill time range. * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ErrorCodeException thrown if the request is rejected by server. + * @throws MetricsAdvisorResponseException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. * @return the completion. */ @@ -5353,7 +5353,7 @@ public Mono resetDataFeedIngestionStatusAsync(UUID dataFeedId, IngestionPr * @param body The backfill time range. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ErrorCodeException thrown if the request is rejected by server. + * @throws MetricsAdvisorResponseException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. * @return the completion. */ @@ -5370,7 +5370,7 @@ public Mono resetDataFeedIngestionStatusAsync( * @param dataFeedId The data feed unique id. * @param body The backfill time range. * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ErrorCodeException thrown if the request is rejected by server. + * @throws MetricsAdvisorResponseException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. */ @ServiceMethod(returns = ReturnType.SINGLE) @@ -5385,7 +5385,7 @@ public void resetDataFeedIngestionStatus(UUID dataFeedId, IngestionProgressReset * @param body The backfill time range. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ErrorCodeException thrown if the request is rejected by server. + * @throws MetricsAdvisorResponseException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. * @return the response. */ @@ -5400,7 +5400,7 @@ public Response resetDataFeedIngestionStatusWithResponse( * * @param dataFeedId The data feed unique id. * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ErrorCodeException thrown if the request is rejected by server. + * @throws MetricsAdvisorResponseException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. * @return data last success ingestion job timestamp by data feed. */ @@ -5417,7 +5417,7 @@ public Mono> getIngestionProgressWithRespons * @param dataFeedId The data feed unique id. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ErrorCodeException thrown if the request is rejected by server. + * @throws MetricsAdvisorResponseException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. * @return data last success ingestion job timestamp by data feed. */ @@ -5433,7 +5433,7 @@ public Mono> getIngestionProgressWithRespons * * @param dataFeedId The data feed unique id. * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ErrorCodeException thrown if the request is rejected by server. + * @throws MetricsAdvisorResponseException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. * @return data last success ingestion job timestamp by data feed. */ @@ -5456,7 +5456,7 @@ public Mono getIngestionProgressAsync(UUID dataFeedId * @param dataFeedId The data feed unique id. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ErrorCodeException thrown if the request is rejected by server. + * @throws MetricsAdvisorResponseException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. * @return data last success ingestion job timestamp by data feed. */ @@ -5478,7 +5478,7 @@ public Mono getIngestionProgressAsync(UUID dataFeedId * * @param dataFeedId The data feed unique id. * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ErrorCodeException thrown if the request is rejected by server. + * @throws MetricsAdvisorResponseException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. * @return data last success ingestion job timestamp by data feed. */ @@ -5493,7 +5493,7 @@ public DataFeedIngestionProgress getIngestionProgress(UUID dataFeedId) { * @param dataFeedId The data feed unique id. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ErrorCodeException thrown if the request is rejected by server. + * @throws MetricsAdvisorResponseException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. * @return data last success ingestion job timestamp by data feed. */ @@ -5508,7 +5508,7 @@ public Response getIngestionProgressWithResponse(UUID * @param metricId metric unique id. * @param body query time series data condition. * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ErrorCodeException thrown if the request is rejected by server. + * @throws MetricsAdvisorResponseException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. * @return time series data from metric. */ @@ -5526,7 +5526,7 @@ public Mono> getMetricDataWithResponseAsync(UUID metric * @param body query time series data condition. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ErrorCodeException thrown if the request is rejected by server. + * @throws MetricsAdvisorResponseException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. * @return time series data from metric. */ @@ -5543,7 +5543,7 @@ public Mono> getMetricDataWithResponseAsync( * @param metricId metric unique id. * @param body query time series data condition. * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ErrorCodeException thrown if the request is rejected by server. + * @throws MetricsAdvisorResponseException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. * @return time series data from metric. */ @@ -5567,7 +5567,7 @@ public Mono getMetricDataAsync(UUID metricId, MetricDataQueryOpt * @param body query time series data condition. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ErrorCodeException thrown if the request is rejected by server. + * @throws MetricsAdvisorResponseException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. * @return time series data from metric. */ @@ -5590,7 +5590,7 @@ public Mono getMetricDataAsync(UUID metricId, MetricDataQueryOpt * @param metricId metric unique id. * @param body query time series data condition. * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ErrorCodeException thrown if the request is rejected by server. + * @throws MetricsAdvisorResponseException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. * @return time series data from metric. */ @@ -5606,7 +5606,7 @@ public MetricDataList getMetricData(UUID metricId, MetricDataQueryOptions body) * @param body query time series data condition. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ErrorCodeException thrown if the request is rejected by server. + * @throws MetricsAdvisorResponseException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. * @return time series data from metric. */ @@ -5624,7 +5624,7 @@ public Response getMetricDataWithResponse( * @param skip for paging, skipped number. * @param maxpagesize the maximum number of items in one page. * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ErrorCodeException thrown if the request is rejected by server. + * @throws MetricsAdvisorResponseException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. * @return the response. */ @@ -5656,7 +5656,7 @@ public Mono> getMetricSeriesSinglePageAsync( * @param maxpagesize the maximum number of items in one page. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ErrorCodeException thrown if the request is rejected by server. + * @throws MetricsAdvisorResponseException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. * @return the response. */ @@ -5684,7 +5684,7 @@ public Mono> getMetricSeriesSinglePageAsync( * @param skip for paging, skipped number. * @param maxpagesize the maximum number of items in one page. * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ErrorCodeException thrown if the request is rejected by server. + * @throws MetricsAdvisorResponseException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. * @return the response. */ @@ -5705,7 +5705,7 @@ public PagedFlux getMetricSeriesAsync( * @param maxpagesize the maximum number of items in one page. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ErrorCodeException thrown if the request is rejected by server. + * @throws MetricsAdvisorResponseException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. * @return the response. */ @@ -5725,7 +5725,7 @@ public PagedFlux getMetricSeriesAsync( * @param skip for paging, skipped number. * @param maxpagesize the maximum number of items in one page. * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ErrorCodeException thrown if the request is rejected by server. + * @throws MetricsAdvisorResponseException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. * @return the response. */ @@ -5744,7 +5744,7 @@ public PagedIterable getMetricSeries( * @param maxpagesize the maximum number of items in one page. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ErrorCodeException thrown if the request is rejected by server. + * @throws MetricsAdvisorResponseException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. * @return the response. */ @@ -5762,7 +5762,7 @@ public PagedIterable getMetricSeries( * @param skip for paging, skipped number. * @param maxpagesize the maximum number of items in one page. * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ErrorCodeException thrown if the request is rejected by server. + * @throws MetricsAdvisorResponseException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. * @return the response. */ @@ -5794,7 +5794,7 @@ public Mono> getMetricDimensionSinglePageAsync( * @param maxpagesize the maximum number of items in one page. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ErrorCodeException thrown if the request is rejected by server. + * @throws MetricsAdvisorResponseException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. * @return the response. */ @@ -5822,7 +5822,7 @@ public Mono> getMetricDimensionSinglePageAsync( * @param skip for paging, skipped number. * @param maxpagesize the maximum number of items in one page. * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ErrorCodeException thrown if the request is rejected by server. + * @throws MetricsAdvisorResponseException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. * @return the response. */ @@ -5843,7 +5843,7 @@ public PagedFlux getMetricDimensionAsync( * @param maxpagesize the maximum number of items in one page. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ErrorCodeException thrown if the request is rejected by server. + * @throws MetricsAdvisorResponseException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. * @return the response. */ @@ -5863,7 +5863,7 @@ public PagedFlux getMetricDimensionAsync( * @param skip for paging, skipped number. * @param maxpagesize the maximum number of items in one page. * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ErrorCodeException thrown if the request is rejected by server. + * @throws MetricsAdvisorResponseException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. * @return the response. */ @@ -5882,7 +5882,7 @@ public PagedIterable getMetricDimension( * @param maxpagesize the maximum number of items in one page. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ErrorCodeException thrown if the request is rejected by server. + * @throws MetricsAdvisorResponseException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. * @return the response. */ @@ -5899,7 +5899,7 @@ public PagedIterable getMetricDimension( * @param skip for paging, skipped number. * @param maxpagesize the maximum number of items in one page. * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ErrorCodeException thrown if the request is rejected by server. + * @throws MetricsAdvisorResponseException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. * @return the response. */ @@ -5930,7 +5930,7 @@ public Mono> getAnomalyDetectionCon * @param maxpagesize the maximum number of items in one page. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ErrorCodeException thrown if the request is rejected by server. + * @throws MetricsAdvisorResponseException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. * @return the response. */ @@ -5958,7 +5958,7 @@ public Mono> getAnomalyDetectionCon * @param skip for paging, skipped number. * @param maxpagesize the maximum number of items in one page. * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ErrorCodeException thrown if the request is rejected by server. + * @throws MetricsAdvisorResponseException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. * @return the response. */ @@ -5978,7 +5978,7 @@ public PagedFlux getAnomalyDetectionConfiguration * @param maxpagesize the maximum number of items in one page. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ErrorCodeException thrown if the request is rejected by server. + * @throws MetricsAdvisorResponseException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. * @return the response. */ @@ -5997,7 +5997,7 @@ public PagedFlux getAnomalyDetectionConfiguration * @param skip for paging, skipped number. * @param maxpagesize the maximum number of items in one page. * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ErrorCodeException thrown if the request is rejected by server. + * @throws MetricsAdvisorResponseException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. * @return the response. */ @@ -6015,7 +6015,7 @@ public PagedIterable getAnomalyDetectionConfigura * @param maxpagesize the maximum number of items in one page. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ErrorCodeException thrown if the request is rejected by server. + * @throws MetricsAdvisorResponseException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. * @return the response. */ @@ -6034,7 +6034,7 @@ public PagedIterable getAnomalyDetectionConfigura * @param skip for paging, skipped number. * @param maxpagesize the maximum number of items in one page. * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ErrorCodeException thrown if the request is rejected by server. + * @throws MetricsAdvisorResponseException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. * @return the response. */ @@ -6066,7 +6066,7 @@ public Mono> getEnrichmentStatusByMetricSinglePa * @param maxpagesize the maximum number of items in one page. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ErrorCodeException thrown if the request is rejected by server. + * @throws MetricsAdvisorResponseException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. * @return the response. */ @@ -6095,7 +6095,7 @@ public Mono> getEnrichmentStatusByMetricSinglePa * @param skip for paging, skipped number. * @param maxpagesize the maximum number of items in one page. * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ErrorCodeException thrown if the request is rejected by server. + * @throws MetricsAdvisorResponseException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. * @return the response. */ @@ -6116,7 +6116,7 @@ public PagedFlux getEnrichmentStatusByMetricAsync( * @param maxpagesize the maximum number of items in one page. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ErrorCodeException thrown if the request is rejected by server. + * @throws MetricsAdvisorResponseException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. * @return the response. */ @@ -6136,7 +6136,7 @@ public PagedFlux getEnrichmentStatusByMetricAsync( * @param skip for paging, skipped number. * @param maxpagesize the maximum number of items in one page. * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ErrorCodeException thrown if the request is rejected by server. + * @throws MetricsAdvisorResponseException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. * @return the response. */ @@ -6155,7 +6155,7 @@ public PagedIterable getEnrichmentStatusByMetric( * @param maxpagesize the maximum number of items in one page. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ErrorCodeException thrown if the request is rejected by server. + * @throws MetricsAdvisorResponseException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. * @return the response. */ @@ -6171,7 +6171,7 @@ public PagedIterable getEnrichmentStatusByMetric( * @param nextLink the next link. * @param body query alerting result request. * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ErrorCodeException thrown if the request is rejected by server. + * @throws MetricsAdvisorResponseException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. * @return the response. */ @@ -6201,7 +6201,7 @@ public Mono> getAlertsByAnomalyAlertingConfiguration * @param body query alerting result request. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ErrorCodeException thrown if the request is rejected by server. + * @throws MetricsAdvisorResponseException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. * @return the response. */ @@ -6227,7 +6227,7 @@ public Mono> getAlertsByAnomalyAlertingConfiguration * @param nextLink the next link. * @param body query detection anomaly result request. * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ErrorCodeException thrown if the request is rejected by server. + * @throws MetricsAdvisorResponseException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. * @return the response. */ @@ -6257,7 +6257,7 @@ public Mono> getAnomaliesByAnomalyDetectionConfigur * @param body query detection anomaly result request. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ErrorCodeException thrown if the request is rejected by server. + * @throws MetricsAdvisorResponseException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. * @return the response. */ @@ -6284,7 +6284,7 @@ public Mono> getAnomaliesByAnomalyDetectionConfigur * @param nextLink the next link. * @param body query dimension values request. * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ErrorCodeException thrown if the request is rejected by server. + * @throws MetricsAdvisorResponseException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. * @return the response. */ @@ -6314,7 +6314,7 @@ public Mono> getDimensionOfAnomaliesByAnomalyDetectionConf * @param body query dimension values request. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ErrorCodeException thrown if the request is rejected by server. + * @throws MetricsAdvisorResponseException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. * @return the response. */ @@ -6341,7 +6341,7 @@ public Mono> getDimensionOfAnomaliesByAnomalyDetectionConf * @param nextLink the next link. * @param body metric feedback filter. * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ErrorCodeException thrown if the request is rejected by server. + * @throws MetricsAdvisorResponseException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. * @return the response. */ @@ -6369,7 +6369,7 @@ public Mono> listMetricFeedbacksNextSinglePageAsyn * @param body metric feedback filter. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ErrorCodeException thrown if the request is rejected by server. + * @throws MetricsAdvisorResponseException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. * @return the response. */ @@ -6395,7 +6395,7 @@ public Mono> listMetricFeedbacksNextSinglePageAsyn * @param nextLink the next link. * @param body The query time range. * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ErrorCodeException thrown if the request is rejected by server. + * @throws MetricsAdvisorResponseException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. * @return data ingestion status by data feed. */ @@ -6425,7 +6425,7 @@ public Mono> getDataFeedIngestionStatusNe * @param body The query time range. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ErrorCodeException thrown if the request is rejected by server. + * @throws MetricsAdvisorResponseException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. * @return data ingestion status by data feed. */ @@ -6451,7 +6451,7 @@ public Mono> getDataFeedIngestionStatusNe * @param nextLink the next link. * @param body filter to query series. * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ErrorCodeException thrown if the request is rejected by server. + * @throws MetricsAdvisorResponseException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. * @return the response. */ @@ -6479,7 +6479,7 @@ public Mono> getMetricSeriesNextSinglePageAsync( * @param body filter to query series. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ErrorCodeException thrown if the request is rejected by server. + * @throws MetricsAdvisorResponseException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. * @return the response. */ @@ -6505,7 +6505,7 @@ public Mono> getMetricSeriesNextSinglePageAsync( * @param nextLink the next link. * @param body query dimension option. * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ErrorCodeException thrown if the request is rejected by server. + * @throws MetricsAdvisorResponseException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. * @return the response. */ @@ -6533,7 +6533,7 @@ public Mono> getMetricDimensionNextSinglePageAsync( * @param body query dimension option. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ErrorCodeException thrown if the request is rejected by server. + * @throws MetricsAdvisorResponseException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. * @return the response. */ @@ -6559,7 +6559,7 @@ public Mono> getMetricDimensionNextSinglePageAsync( * @param nextLink the next link. * @param body query options. * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ErrorCodeException thrown if the request is rejected by server. + * @throws MetricsAdvisorResponseException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. * @return the response. */ @@ -6589,7 +6589,7 @@ public Mono> getEnrichmentStatusByMetricNextSing * @param body query options. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ErrorCodeException thrown if the request is rejected by server. + * @throws MetricsAdvisorResponseException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. * @return the response. */ @@ -6614,7 +6614,7 @@ public Mono> getEnrichmentStatusByMetricNextSing * * @param nextLink The nextLink parameter. * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ErrorCodeException thrown if the request is rejected by server. + * @throws MetricsAdvisorResponseException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. * @return the response. */ @@ -6643,7 +6643,7 @@ public Mono> getAnomaliesFromAlertByAnomalyAlerting * @param nextLink The nextLink parameter. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ErrorCodeException thrown if the request is rejected by server. + * @throws MetricsAdvisorResponseException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. * @return the response. */ @@ -6669,7 +6669,7 @@ public Mono> getAnomaliesFromAlertByAnomalyAlerting * * @param nextLink The nextLink parameter. * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ErrorCodeException thrown if the request is rejected by server. + * @throws MetricsAdvisorResponseException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. * @return the response. */ @@ -6698,7 +6698,7 @@ public Mono> getIncidentsFromAlertByAnomalyAlertin * @param nextLink The nextLink parameter. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ErrorCodeException thrown if the request is rejected by server. + * @throws MetricsAdvisorResponseException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. * @return the response. */ @@ -6724,7 +6724,7 @@ public Mono> getIncidentsFromAlertByAnomalyAlertin * * @param nextLink The nextLink parameter. * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ErrorCodeException thrown if the request is rejected by server. + * @throws MetricsAdvisorResponseException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. * @return the response. */ @@ -6753,7 +6753,7 @@ public Mono> getIncidentsFromAlertByAnomalyAlertin * @param nextLink The nextLink parameter. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ErrorCodeException thrown if the request is rejected by server. + * @throws MetricsAdvisorResponseException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. * @return the response. */ @@ -6780,7 +6780,7 @@ public Mono> getIncidentsFromAlertByAnomalyAlertin * * @param nextLink The nextLink parameter. * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ErrorCodeException thrown if the request is rejected by server. + * @throws MetricsAdvisorResponseException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. * @return the response. */ @@ -6809,7 +6809,7 @@ public Mono> getIncidentsByAnomalyDetectionConfigu * @param nextLink The nextLink parameter. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ErrorCodeException thrown if the request is rejected by server. + * @throws MetricsAdvisorResponseException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. * @return the response. */ @@ -6834,7 +6834,7 @@ public Mono> getIncidentsByAnomalyDetectionConfigu * * @param nextLink The nextLink parameter. * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ErrorCodeException thrown if the request is rejected by server. + * @throws MetricsAdvisorResponseException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. * @return the response. */ @@ -6863,7 +6863,7 @@ public Mono> getIncidentsByAnomalyDetectionConfigu * @param nextLink The nextLink parameter. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ErrorCodeException thrown if the request is rejected by server. + * @throws MetricsAdvisorResponseException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. * @return the response. */ @@ -6889,7 +6889,7 @@ public Mono> getIncidentsByAnomalyDetectionConfigu * * @param nextLink The nextLink parameter. * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ErrorCodeException thrown if the request is rejected by server. + * @throws MetricsAdvisorResponseException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. * @return the response. */ @@ -6915,7 +6915,7 @@ public Mono> listCredentialsNextSinglePageAs * @param nextLink The nextLink parameter. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ErrorCodeException thrown if the request is rejected by server. + * @throws MetricsAdvisorResponseException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. * @return the response. */ @@ -6940,7 +6940,7 @@ public Mono> listCredentialsNextSinglePageAs * * @param nextLink The nextLink parameter. * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ErrorCodeException thrown if the request is rejected by server. + * @throws MetricsAdvisorResponseException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. * @return the response. */ @@ -6965,7 +6965,7 @@ public Mono> listDataFeedsNextSinglePageAsync(Stri * @param nextLink The nextLink parameter. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ErrorCodeException thrown if the request is rejected by server. + * @throws MetricsAdvisorResponseException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. * @return the response. */ @@ -6989,7 +6989,7 @@ public Mono> listDataFeedsNextSinglePageAsync(Stri * * @param nextLink The nextLink parameter. * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ErrorCodeException thrown if the request is rejected by server. + * @throws MetricsAdvisorResponseException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. * @return the response. */ @@ -7014,7 +7014,7 @@ public Mono> listHooksNextSinglePageAsync(String nextLin * @param nextLink The nextLink parameter. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ErrorCodeException thrown if the request is rejected by server. + * @throws MetricsAdvisorResponseException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. * @return the response. */ @@ -7038,7 +7038,7 @@ public Mono> listHooksNextSinglePageAsync(String nextLin * * @param nextLink The nextLink parameter. * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ErrorCodeException thrown if the request is rejected by server. + * @throws MetricsAdvisorResponseException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. * @return the response. */ @@ -7067,7 +7067,7 @@ public Mono> listHooksNextSinglePageAsync(String nextLin * @param nextLink The nextLink parameter. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ErrorCodeException thrown if the request is rejected by server. + * @throws MetricsAdvisorResponseException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. * @return the response. */ diff --git a/sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/implementation/models/AnomalyProperty.java b/sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/implementation/models/AnomalyProperty.java index 0b504df8cfa5d..0e65b3bd46731 100644 --- a/sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/implementation/models/AnomalyProperty.java +++ b/sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/implementation/models/AnomalyProperty.java @@ -4,7 +4,7 @@ package com.azure.ai.metricsadvisor.implementation.models; -import com.azure.ai.metricsadvisor.models.AnomalySeverity; +import com.azure.ai.metricsadvisor.administration.models.AnomalySeverity; import com.azure.ai.metricsadvisor.models.AnomalyStatus; 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/implementation/models/ChangeThresholdConditionPatch.java b/sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/implementation/models/ChangeThresholdConditionPatch.java index 6f938c093733d..8b60ad04497bf 100644 --- a/sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/implementation/models/ChangeThresholdConditionPatch.java +++ b/sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/implementation/models/ChangeThresholdConditionPatch.java @@ -4,7 +4,7 @@ package com.azure.ai.metricsadvisor.implementation.models; -import com.azure.ai.metricsadvisor.models.AnomalyDetectorDirection; +import com.azure.ai.metricsadvisor.administration.models.AnomalyDetectorDirection; 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/implementation/models/DataFeedDetail.java b/sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/implementation/models/DataFeedDetail.java index 87a91cd085147..fc700c8dd6add 100644 --- a/sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/implementation/models/DataFeedDetail.java +++ b/sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/implementation/models/DataFeedDetail.java @@ -4,8 +4,8 @@ package com.azure.ai.metricsadvisor.implementation.models; -import com.azure.ai.metricsadvisor.models.DataFeedDimension; -import com.azure.ai.metricsadvisor.models.DataFeedMetric; +import com.azure.ai.metricsadvisor.administration.models.DataFeedDimension; +import com.azure.ai.metricsadvisor.administration.models.DataFeedMetric; import com.azure.core.annotation.Fluent; import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.annotation.JsonSubTypes; diff --git a/sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/implementation/models/DimensionGroupConfiguration.java b/sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/implementation/models/DimensionGroupConfiguration.java index 4dca9793dad01..ccf7579d5e729 100644 --- a/sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/implementation/models/DimensionGroupConfiguration.java +++ b/sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/implementation/models/DimensionGroupConfiguration.java @@ -4,9 +4,9 @@ package com.azure.ai.metricsadvisor.implementation.models; -import com.azure.ai.metricsadvisor.models.ChangeThresholdCondition; -import com.azure.ai.metricsadvisor.models.HardThresholdCondition; -import com.azure.ai.metricsadvisor.models.SmartDetectionCondition; +import com.azure.ai.metricsadvisor.administration.models.ChangeThresholdCondition; +import com.azure.ai.metricsadvisor.administration.models.HardThresholdCondition; +import com.azure.ai.metricsadvisor.administration.models.SmartDetectionCondition; 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/implementation/models/Granularity.java b/sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/implementation/models/Granularity.java index 6ab44ae840069..82e53d0dfa9dc 100644 --- a/sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/implementation/models/Granularity.java +++ b/sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/implementation/models/Granularity.java @@ -28,9 +28,6 @@ public final class Granularity extends ExpandableStringEnum { /** Static value Minutely for Granularity. */ public static final Granularity MINUTELY = fromString("Minutely"); - /** Static value Secondly for Granularity. */ - public static final Granularity SECONDLY = fromString("Secondly"); - /** Static value Custom for Granularity. */ public static final Granularity CUSTOM = fromString("Custom"); diff --git a/sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/implementation/models/HardThresholdConditionPatch.java b/sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/implementation/models/HardThresholdConditionPatch.java index 00e3c4a425e6c..411b33611b31b 100644 --- a/sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/implementation/models/HardThresholdConditionPatch.java +++ b/sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/implementation/models/HardThresholdConditionPatch.java @@ -4,7 +4,7 @@ package com.azure.ai.metricsadvisor.implementation.models; -import com.azure.ai.metricsadvisor.models.AnomalyDetectorDirection; +import com.azure.ai.metricsadvisor.administration.models.AnomalyDetectorDirection; 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/implementation/models/IncidentProperty.java b/sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/implementation/models/IncidentProperty.java index aca955e5008f8..775b0325321ab 100644 --- a/sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/implementation/models/IncidentProperty.java +++ b/sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/implementation/models/IncidentProperty.java @@ -5,7 +5,7 @@ package com.azure.ai.metricsadvisor.implementation.models; import com.azure.ai.metricsadvisor.models.AnomalyIncidentStatus; -import com.azure.ai.metricsadvisor.models.AnomalySeverity; +import com.azure.ai.metricsadvisor.administration.models.AnomalySeverity; 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/implementation/models/IngestionStatusList.java b/sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/implementation/models/IngestionStatusList.java index d42c387b195c5..e5e5f75c72808 100644 --- a/sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/implementation/models/IngestionStatusList.java +++ b/sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/implementation/models/IngestionStatusList.java @@ -4,7 +4,7 @@ package com.azure.ai.metricsadvisor.implementation.models; -import com.azure.ai.metricsadvisor.models.DataFeedIngestionStatus; +import com.azure.ai.metricsadvisor.administration.models.DataFeedIngestionStatus; import com.azure.core.annotation.Immutable; import com.fasterxml.jackson.annotation.JsonProperty; import java.util.List; diff --git a/sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/implementation/models/MetricAlertingConfiguration.java b/sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/implementation/models/MetricAlertingConfiguration.java index 7850f7a9a0478..ba228e0e9016e 100644 --- a/sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/implementation/models/MetricAlertingConfiguration.java +++ b/sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/implementation/models/MetricAlertingConfiguration.java @@ -4,9 +4,9 @@ package com.azure.ai.metricsadvisor.implementation.models; -import com.azure.ai.metricsadvisor.models.MetricAnomalyAlertSnoozeCondition; -import com.azure.ai.metricsadvisor.models.SeverityCondition; -import com.azure.ai.metricsadvisor.models.TopNGroupScope; +import com.azure.ai.metricsadvisor.administration.models.MetricAnomalyAlertSnoozeCondition; +import com.azure.ai.metricsadvisor.administration.models.SeverityCondition; +import com.azure.ai.metricsadvisor.administration.models.TopNGroupScope; import com.azure.core.annotation.Fluent; import com.fasterxml.jackson.annotation.JsonProperty; import java.util.UUID; diff --git a/sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/implementation/models/SeriesConfiguration.java b/sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/implementation/models/SeriesConfiguration.java index 2af0e12af0939..b3157117b87e6 100644 --- a/sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/implementation/models/SeriesConfiguration.java +++ b/sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/implementation/models/SeriesConfiguration.java @@ -4,9 +4,9 @@ package com.azure.ai.metricsadvisor.implementation.models; -import com.azure.ai.metricsadvisor.models.ChangeThresholdCondition; -import com.azure.ai.metricsadvisor.models.HardThresholdCondition; -import com.azure.ai.metricsadvisor.models.SmartDetectionCondition; +import com.azure.ai.metricsadvisor.administration.models.ChangeThresholdCondition; +import com.azure.ai.metricsadvisor.administration.models.HardThresholdCondition; +import com.azure.ai.metricsadvisor.administration.models.SmartDetectionCondition; 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/implementation/models/SeverityFilterCondition.java b/sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/implementation/models/SeverityFilterCondition.java index e3ab15f7a838f..17df8d565107a 100644 --- a/sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/implementation/models/SeverityFilterCondition.java +++ b/sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/implementation/models/SeverityFilterCondition.java @@ -4,7 +4,7 @@ package com.azure.ai.metricsadvisor.implementation.models; -import com.azure.ai.metricsadvisor.models.AnomalySeverity; +import com.azure.ai.metricsadvisor.administration.models.AnomalySeverity; 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/implementation/models/SmartDetectionConditionPatch.java b/sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/implementation/models/SmartDetectionConditionPatch.java index 50d66249620ce..3e9c985cc870c 100644 --- a/sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/implementation/models/SmartDetectionConditionPatch.java +++ b/sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/implementation/models/SmartDetectionConditionPatch.java @@ -4,7 +4,7 @@ package com.azure.ai.metricsadvisor.implementation.models; -import com.azure.ai.metricsadvisor.models.AnomalyDetectorDirection; +import com.azure.ai.metricsadvisor.administration.models.AnomalyDetectorDirection; 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/implementation/models/WholeMetricConfiguration.java b/sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/implementation/models/WholeMetricConfiguration.java index 717d6412569d9..1d731997ce766 100644 --- a/sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/implementation/models/WholeMetricConfiguration.java +++ b/sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/implementation/models/WholeMetricConfiguration.java @@ -4,9 +4,9 @@ package com.azure.ai.metricsadvisor.implementation.models; -import com.azure.ai.metricsadvisor.models.ChangeThresholdCondition; -import com.azure.ai.metricsadvisor.models.HardThresholdCondition; -import com.azure.ai.metricsadvisor.models.SmartDetectionCondition; +import com.azure.ai.metricsadvisor.administration.models.ChangeThresholdCondition; +import com.azure.ai.metricsadvisor.administration.models.HardThresholdCondition; +import com.azure.ai.metricsadvisor.administration.models.SmartDetectionCondition; 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/implementation/util/AlertConfigurationTransforms.java b/sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/implementation/util/AlertConfigurationTransforms.java index 7dcdb01dab8e3..41d96440c4292 100644 --- a/sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/implementation/util/AlertConfigurationTransforms.java +++ b/sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/implementation/util/AlertConfigurationTransforms.java @@ -11,15 +11,15 @@ import com.azure.ai.metricsadvisor.implementation.models.Direction; import com.azure.ai.metricsadvisor.implementation.models.MetricAlertingConfiguration; import com.azure.ai.metricsadvisor.implementation.models.ValueCondition; -import com.azure.ai.metricsadvisor.models.AnomalyAlertConfiguration; -import com.azure.ai.metricsadvisor.models.BoundaryDirection; +import com.azure.ai.metricsadvisor.administration.models.AnomalyAlertConfiguration; +import com.azure.ai.metricsadvisor.administration.models.BoundaryDirection; import com.azure.ai.metricsadvisor.models.DimensionKey; -import com.azure.ai.metricsadvisor.models.MetricAnomalyAlertConditions; -import com.azure.ai.metricsadvisor.models.MetricAnomalyAlertConfiguration; -import com.azure.ai.metricsadvisor.models.MetricAnomalyAlertConfigurationsOperator; -import com.azure.ai.metricsadvisor.models.MetricAnomalyAlertScope; -import com.azure.ai.metricsadvisor.models.MetricAnomalyAlertScopeType; -import com.azure.ai.metricsadvisor.models.MetricBoundaryCondition; +import com.azure.ai.metricsadvisor.administration.models.MetricAnomalyAlertConditions; +import com.azure.ai.metricsadvisor.administration.models.MetricAnomalyAlertConfiguration; +import com.azure.ai.metricsadvisor.administration.models.MetricAnomalyAlertConfigurationsOperator; +import com.azure.ai.metricsadvisor.administration.models.MetricAnomalyAlertScope; +import com.azure.ai.metricsadvisor.administration.models.MetricAnomalyAlertScopeType; +import com.azure.ai.metricsadvisor.administration.models.MetricBoundaryCondition; import com.azure.core.http.rest.PagedResponse; import com.azure.core.http.rest.PagedResponseBase; import com.azure.core.util.logging.ClientLogger; @@ -123,7 +123,7 @@ private static List getMetricAlertConfigList( .getSeriesGroupInScope() .asMap()); innerMetricAlertConfiguration.setDimensionAnomalyScope(innerId); - } else if (alertScope.getScopeType() == MetricAnomalyAlertScopeType.TOPN) { + } else if (alertScope.getScopeType() == MetricAnomalyAlertScopeType.TOP_N) { innerMetricAlertConfiguration.setAnomalyScopeType(AnomalyScope.TOPN); innerMetricAlertConfiguration.setTopNAnomalyScope(alertScope.getTopNGroupInScope()); } @@ -136,19 +136,15 @@ private static List getMetricAlertConfigList( ValueCondition innerValueCondition = new ValueCondition(); if (boundaryConditions != null) { BoundaryDirection direction = boundaryConditions.getDirection(); - switch (direction) { - case LOWER: - innerValueCondition.setDirection(Direction.DOWN); - break; - case UPPER: - innerValueCondition.setDirection(Direction.UP); - break; - case BOTH: - innerValueCondition.setDirection(Direction.BOTH); - break; - default: - throw LOGGER.logExceptionAsError(new IllegalStateException("Unexpected value: " - + direction)); + if (direction == BoundaryDirection.LOWER) { + innerValueCondition.setDirection(Direction.DOWN); + } else if (direction == BoundaryDirection.UPPER) { + innerValueCondition.setDirection(Direction.UP); + } else if (direction == BoundaryDirection.BOTH) { + innerValueCondition.setDirection(Direction.BOTH); + } else { + throw LOGGER.logExceptionAsError(new IllegalStateException("Unexpected value: " + + direction)); } innerValueCondition.setLower(boundaryConditions.getLowerBoundary()); innerValueCondition.setUpper(boundaryConditions.getUpperBoundary()); diff --git a/sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/implementation/util/AnomalyAlertConfigurationHelper.java b/sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/implementation/util/AnomalyAlertConfigurationHelper.java index f3aaac1b9bddb..1a75ff9a13512 100644 --- a/sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/implementation/util/AnomalyAlertConfigurationHelper.java +++ b/sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/implementation/util/AnomalyAlertConfigurationHelper.java @@ -4,7 +4,7 @@ package com.azure.ai.metricsadvisor.implementation.util; -import com.azure.ai.metricsadvisor.models.AnomalyAlertConfiguration; +import com.azure.ai.metricsadvisor.administration.models.AnomalyAlertConfiguration; /** * The helper class to set the non-public properties of an {@link AnomalyAlertConfiguration} instance. diff --git a/sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/implementation/util/AnomalyDetectionConfigurationHelper.java b/sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/implementation/util/AnomalyDetectionConfigurationHelper.java index a3e9344282967..e79ec18b0dad2 100644 --- a/sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/implementation/util/AnomalyDetectionConfigurationHelper.java +++ b/sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/implementation/util/AnomalyDetectionConfigurationHelper.java @@ -3,7 +3,7 @@ package com.azure.ai.metricsadvisor.implementation.util; -import com.azure.ai.metricsadvisor.models.AnomalyDetectionConfiguration; +import com.azure.ai.metricsadvisor.administration.models.AnomalyDetectionConfiguration; /** * The helper class to set the non-public properties of an {@link AnomalyDetectionConfiguration} instance. diff --git a/sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/implementation/util/AnomalyHelper.java b/sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/implementation/util/AnomalyHelper.java index d25907388c648..2e352355bbc3a 100644 --- a/sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/implementation/util/AnomalyHelper.java +++ b/sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/implementation/util/AnomalyHelper.java @@ -3,7 +3,7 @@ package com.azure.ai.metricsadvisor.implementation.util; -import com.azure.ai.metricsadvisor.models.AnomalySeverity; +import com.azure.ai.metricsadvisor.administration.models.AnomalySeverity; import com.azure.ai.metricsadvisor.models.DataPointAnomaly; import com.azure.ai.metricsadvisor.models.AnomalyStatus; import com.azure.ai.metricsadvisor.models.DimensionKey; diff --git a/sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/implementation/util/AnomalyTransforms.java b/sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/implementation/util/AnomalyTransforms.java index 3503911fe1fed..0b7dbbeafe06d 100644 --- a/sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/implementation/util/AnomalyTransforms.java +++ b/sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/implementation/util/AnomalyTransforms.java @@ -7,7 +7,7 @@ import com.azure.ai.metricsadvisor.implementation.models.DetectionAnomalyFilterCondition; import com.azure.ai.metricsadvisor.implementation.models.DimensionGroupIdentity; import com.azure.ai.metricsadvisor.implementation.models.SeverityFilterCondition; -import com.azure.ai.metricsadvisor.models.AnomalySeverity; +import com.azure.ai.metricsadvisor.administration.models.AnomalySeverity; import com.azure.ai.metricsadvisor.models.DataPointAnomaly; import com.azure.ai.metricsadvisor.models.DimensionKey; import com.azure.ai.metricsadvisor.models.ListAnomaliesDetectedFilter; diff --git a/sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/implementation/util/AzureBlobDataFeedSourceAccessor.java b/sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/implementation/util/AzureBlobDataFeedSourceAccessor.java new file mode 100644 index 0000000000000..4923a710ce936 --- /dev/null +++ b/sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/implementation/util/AzureBlobDataFeedSourceAccessor.java @@ -0,0 +1,35 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +package com.azure.ai.metricsadvisor.implementation.util; + +import com.azure.ai.metricsadvisor.administration.models.AzureBlobDataFeedSource; +import com.azure.ai.metricsadvisor.administration.models.SqlServerDataFeedSource; + +public final class AzureBlobDataFeedSourceAccessor { + private static Accessor accessor; + + private AzureBlobDataFeedSourceAccessor() { + } + + /** + * Type defining the methods to set the non-public properties of + * an {@link SqlServerDataFeedSource} instance. + */ + public interface Accessor { + String getConnectionString(AzureBlobDataFeedSource feedSource); + } + + /** + * The method called from {@link AzureBlobDataFeedSource} to set it's accessor. + * + * @param accessor The accessor. + */ + public static void setAccessor(final Accessor accessor) { + AzureBlobDataFeedSourceAccessor.accessor = accessor; + } + + public static String getConnectionString(AzureBlobDataFeedSource feedSource) { + return accessor.getConnectionString(feedSource); + } +} diff --git a/sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/implementation/util/AzureCosmosDbDataFeedSourceAccessor.java b/sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/implementation/util/AzureCosmosDbDataFeedSourceAccessor.java new file mode 100644 index 0000000000000..b6012ad84ab95 --- /dev/null +++ b/sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/implementation/util/AzureCosmosDbDataFeedSourceAccessor.java @@ -0,0 +1,34 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +package com.azure.ai.metricsadvisor.implementation.util; + +import com.azure.ai.metricsadvisor.administration.models.AzureCosmosDbDataFeedSource; + +public final class AzureCosmosDbDataFeedSourceAccessor { + private static Accessor accessor; + + private AzureCosmosDbDataFeedSourceAccessor() { + } + + /** + * Type defining the methods to set the non-public properties of + * an {@link AzureCosmosDbDataFeedSource} instance. + */ + public interface Accessor { + String getConnectionString(AzureCosmosDbDataFeedSource feedSource); + } + + /** + * The method called from {@link AzureCosmosDbDataFeedSource} to set it's accessor. + * + * @param accessor The accessor. + */ + public static void setAccessor(final Accessor accessor) { + AzureCosmosDbDataFeedSourceAccessor.accessor = accessor; + } + + public static String getConnectionString(AzureCosmosDbDataFeedSource feedSource) { + return accessor.getConnectionString(feedSource); + } +} diff --git a/sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/implementation/util/AzureDataExplorerDataFeedSourceAccessor.java b/sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/implementation/util/AzureDataExplorerDataFeedSourceAccessor.java new file mode 100644 index 0000000000000..1e77ffec316f1 --- /dev/null +++ b/sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/implementation/util/AzureDataExplorerDataFeedSourceAccessor.java @@ -0,0 +1,34 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +package com.azure.ai.metricsadvisor.implementation.util; + +import com.azure.ai.metricsadvisor.administration.models.AzureDataExplorerDataFeedSource; + +public final class AzureDataExplorerDataFeedSourceAccessor { + private static Accessor accessor; + + private AzureDataExplorerDataFeedSourceAccessor() { + } + + /** + * Type defining the methods to set the non-public properties of + * an {@link AzureDataExplorerDataFeedSource} instance. + */ + public interface Accessor { + String getConnectionString(AzureDataExplorerDataFeedSource feedSource); + } + + /** + * The method called from {@link AzureDataExplorerDataFeedSource} to set it's accessor. + * + * @param accessor The accessor. + */ + public static void setAccessor(final Accessor accessor) { + AzureDataExplorerDataFeedSourceAccessor.accessor = accessor; + } + + public static String getConnectionString(AzureDataExplorerDataFeedSource feedSource) { + return accessor.getConnectionString(feedSource); + } +} diff --git a/sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/implementation/util/AzureDataLakeStorageGen2DataFeedSourceAccessor.java b/sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/implementation/util/AzureDataLakeStorageGen2DataFeedSourceAccessor.java new file mode 100644 index 0000000000000..182ff57e61e65 --- /dev/null +++ b/sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/implementation/util/AzureDataLakeStorageGen2DataFeedSourceAccessor.java @@ -0,0 +1,35 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +package com.azure.ai.metricsadvisor.implementation.util; + +import com.azure.ai.metricsadvisor.administration.models.AzureDataLakeStorageGen2DataFeedSource; +import com.azure.ai.metricsadvisor.administration.models.SqlServerDataFeedSource; + +public final class AzureDataLakeStorageGen2DataFeedSourceAccessor { + private static Accessor accessor; + + private AzureDataLakeStorageGen2DataFeedSourceAccessor() { + } + + /** + * Type defining the methods to set the non-public properties of + * an {@link AzureDataLakeStorageGen2DataFeedSource} instance. + */ + public interface Accessor { + String getAccountKey(AzureDataLakeStorageGen2DataFeedSource feedSource); + } + + /** + * The method called from {@link SqlServerDataFeedSource} to set it's accessor. + * + * @param accessor The accessor. + */ + public static void setAccessor(final Accessor accessor) { + AzureDataLakeStorageGen2DataFeedSourceAccessor.accessor = accessor; + } + + public static String getAccountKey(AzureDataLakeStorageGen2DataFeedSource feedSource) { + return accessor.getAccountKey(feedSource); + } +} diff --git a/sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/implementation/util/AzureEventHubsDataFeedSourceAccessor.java b/sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/implementation/util/AzureEventHubsDataFeedSourceAccessor.java new file mode 100644 index 0000000000000..2cb6790bcfb20 --- /dev/null +++ b/sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/implementation/util/AzureEventHubsDataFeedSourceAccessor.java @@ -0,0 +1,35 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +package com.azure.ai.metricsadvisor.implementation.util; + +import com.azure.ai.metricsadvisor.administration.models.AzureEventHubsDataFeedSource; +import com.azure.ai.metricsadvisor.administration.models.SqlServerDataFeedSource; + +public final class AzureEventHubsDataFeedSourceAccessor { + private static Accessor accessor; + + private AzureEventHubsDataFeedSourceAccessor() { + } + + /** + * Type defining the methods to set the non-public properties of + * an {@link SqlServerDataFeedSource} instance. + */ + public interface Accessor { + String getConnectionString(AzureEventHubsDataFeedSource feedSource); + } + + /** + * The method called from {@link SqlServerDataFeedSource} to set it's accessor. + * + * @param accessor The accessor. + */ + public static void setAccessor(final Accessor accessor) { + AzureEventHubsDataFeedSourceAccessor.accessor = accessor; + } + + public static String getConnectionString(AzureEventHubsDataFeedSource feedSource) { + return accessor.getConnectionString(feedSource); + } +} diff --git a/sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/implementation/util/AzureLogAnalyticsDataFeedSourceAccessor.java b/sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/implementation/util/AzureLogAnalyticsDataFeedSourceAccessor.java new file mode 100644 index 0000000000000..8ccd45adce52c --- /dev/null +++ b/sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/implementation/util/AzureLogAnalyticsDataFeedSourceAccessor.java @@ -0,0 +1,35 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +package com.azure.ai.metricsadvisor.implementation.util; + +import com.azure.ai.metricsadvisor.administration.models.AzureLogAnalyticsDataFeedSource; +import com.azure.ai.metricsadvisor.administration.models.SqlServerDataFeedSource; + +public final class AzureLogAnalyticsDataFeedSourceAccessor { + private static Accessor accessor; + + private AzureLogAnalyticsDataFeedSourceAccessor() { + } + + /** + * Type defining the methods to set the non-public properties of + * an {@link SqlServerDataFeedSource} instance. + */ + public interface Accessor { + String getClientSecret(AzureLogAnalyticsDataFeedSource feedSource); + } + + /** + * The method called from {@link AzureLogAnalyticsDataFeedSource} to set it's accessor. + * + * @param accessor The accessor. + */ + public static void setAccessor(final Accessor accessor) { + AzureLogAnalyticsDataFeedSourceAccessor.accessor = accessor; + } + + public static String getClientSecret(AzureLogAnalyticsDataFeedSource feedSource) { + return accessor.getClientSecret(feedSource); + } +} diff --git a/sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/implementation/util/AzureTableDataFeedSourceAccessor.java b/sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/implementation/util/AzureTableDataFeedSourceAccessor.java new file mode 100644 index 0000000000000..e50ed6bad771c --- /dev/null +++ b/sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/implementation/util/AzureTableDataFeedSourceAccessor.java @@ -0,0 +1,35 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +package com.azure.ai.metricsadvisor.implementation.util; + +import com.azure.ai.metricsadvisor.administration.models.AzureTableDataFeedSource; +import com.azure.ai.metricsadvisor.administration.models.SqlServerDataFeedSource; + +public final class AzureTableDataFeedSourceAccessor { + private static Accessor accessor; + + private AzureTableDataFeedSourceAccessor() { + } + + /** + * Type defining the methods to set the non-public properties of + * an {@link AzureTableDataFeedSource} instance. + */ + public interface Accessor { + String getConnectionString(AzureTableDataFeedSource feedSource); + } + + /** + * The method called from {@link SqlServerDataFeedSource} to set it's accessor. + * + * @param accessor The accessor. + */ + public static void setAccessor(final Accessor accessor) { + AzureTableDataFeedSourceAccessor.accessor = accessor; + } + + public static String getConnectionString(AzureTableDataFeedSource feedSource) { + return accessor.getConnectionString(feedSource); + } +} diff --git a/sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/implementation/util/DataFeedHelper.java b/sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/implementation/util/DataFeedHelper.java index 9f8be9954b60c..3f190bc000985 100644 --- a/sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/implementation/util/DataFeedHelper.java +++ b/sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/implementation/util/DataFeedHelper.java @@ -3,9 +3,9 @@ package com.azure.ai.metricsadvisor.implementation.util; -import com.azure.ai.metricsadvisor.models.DataFeed; -import com.azure.ai.metricsadvisor.models.DataFeedSourceType; -import com.azure.ai.metricsadvisor.models.DataFeedStatus; +import com.azure.ai.metricsadvisor.administration.models.DataFeed; +import com.azure.ai.metricsadvisor.administration.models.DataFeedSourceType; +import com.azure.ai.metricsadvisor.administration.models.DataFeedStatus; import java.time.OffsetDateTime; import java.util.Map; diff --git a/sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/implementation/util/DataFeedTransforms.java b/sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/implementation/util/DataFeedTransforms.java index 4b3e767d0552d..6d4f50fe95f20 100644 --- a/sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/implementation/util/DataFeedTransforms.java +++ b/sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/implementation/util/DataFeedTransforms.java @@ -3,6 +3,7 @@ package com.azure.ai.metricsadvisor.implementation.util; +import com.azure.ai.metricsadvisor.implementation.models.AuthenticationTypeEnum; import com.azure.ai.metricsadvisor.implementation.models.AzureApplicationInsightsDataFeed; import com.azure.ai.metricsadvisor.implementation.models.AzureApplicationInsightsDataFeedPatch; import com.azure.ai.metricsadvisor.implementation.models.AzureApplicationInsightsParameter; @@ -51,35 +52,35 @@ import com.azure.ai.metricsadvisor.implementation.models.SQLServerDataFeedPatch; import com.azure.ai.metricsadvisor.implementation.models.SQLSourceParameterPatch; import com.azure.ai.metricsadvisor.implementation.models.SqlSourceParameter; -import com.azure.ai.metricsadvisor.models.AzureAppInsightsDataFeedSource; -import com.azure.ai.metricsadvisor.models.AzureBlobDataFeedSource; -import com.azure.ai.metricsadvisor.models.AzureCosmosDataFeedSource; -import com.azure.ai.metricsadvisor.models.AzureDataExplorerDataFeedSource; -import com.azure.ai.metricsadvisor.models.AzureDataLakeStorageGen2DataFeedSource; -import com.azure.ai.metricsadvisor.models.AzureEventHubsDataFeedSource; -import com.azure.ai.metricsadvisor.models.AzureLogAnalyticsDataFeedSource; -import com.azure.ai.metricsadvisor.models.AzureTableDataFeedSource; -import com.azure.ai.metricsadvisor.models.DataFeed; -import com.azure.ai.metricsadvisor.models.DataFeedAccessMode; -import com.azure.ai.metricsadvisor.models.DataFeedAutoRollUpMethod; -import com.azure.ai.metricsadvisor.models.DataFeedGranularity; -import com.azure.ai.metricsadvisor.models.DataFeedGranularityType; -import com.azure.ai.metricsadvisor.models.DataFeedIngestionSettings; -import com.azure.ai.metricsadvisor.models.DataFeedMetric; -import com.azure.ai.metricsadvisor.models.DataFeedMissingDataPointFillSettings; -import com.azure.ai.metricsadvisor.models.DataFeedOptions; -import com.azure.ai.metricsadvisor.models.DataFeedRollupSettings; -import com.azure.ai.metricsadvisor.models.DataFeedRollupType; -import com.azure.ai.metricsadvisor.models.DataFeedSchema; -import com.azure.ai.metricsadvisor.models.DataFeedSource; -import com.azure.ai.metricsadvisor.models.DataFeedSourceType; -import com.azure.ai.metricsadvisor.models.DataFeedStatus; -import com.azure.ai.metricsadvisor.models.DataFeedMissingDataPointFillType; -import com.azure.ai.metricsadvisor.models.InfluxDBDataFeedSource; -import com.azure.ai.metricsadvisor.models.MongoDBDataFeedSource; -import com.azure.ai.metricsadvisor.models.MySqlDataFeedSource; -import com.azure.ai.metricsadvisor.models.PostgreSqlDataFeedSource; -import com.azure.ai.metricsadvisor.models.SQLServerDataFeedSource; +import com.azure.ai.metricsadvisor.administration.models.AzureAppInsightsDataFeedSource; +import com.azure.ai.metricsadvisor.administration.models.AzureBlobDataFeedSource; +import com.azure.ai.metricsadvisor.administration.models.AzureCosmosDbDataFeedSource; +import com.azure.ai.metricsadvisor.administration.models.AzureDataExplorerDataFeedSource; +import com.azure.ai.metricsadvisor.administration.models.AzureDataLakeStorageGen2DataFeedSource; +import com.azure.ai.metricsadvisor.administration.models.AzureEventHubsDataFeedSource; +import com.azure.ai.metricsadvisor.administration.models.AzureLogAnalyticsDataFeedSource; +import com.azure.ai.metricsadvisor.administration.models.AzureTableDataFeedSource; +import com.azure.ai.metricsadvisor.administration.models.DataFeed; +import com.azure.ai.metricsadvisor.administration.models.DataFeedAccessMode; +import com.azure.ai.metricsadvisor.administration.models.DataFeedAutoRollUpMethod; +import com.azure.ai.metricsadvisor.administration.models.DataFeedGranularity; +import com.azure.ai.metricsadvisor.administration.models.DataFeedGranularityType; +import com.azure.ai.metricsadvisor.administration.models.DataFeedIngestionSettings; +import com.azure.ai.metricsadvisor.administration.models.DataFeedMetric; +import com.azure.ai.metricsadvisor.administration.models.DataFeedMissingDataPointFillSettings; +import com.azure.ai.metricsadvisor.administration.models.DataFeedOptions; +import com.azure.ai.metricsadvisor.administration.models.DataFeedRollupSettings; +import com.azure.ai.metricsadvisor.administration.models.DataFeedRollupType; +import com.azure.ai.metricsadvisor.administration.models.DataFeedSchema; +import com.azure.ai.metricsadvisor.administration.models.DataFeedSource; +import com.azure.ai.metricsadvisor.administration.models.DataFeedSourceType; +import com.azure.ai.metricsadvisor.administration.models.DataFeedStatus; +import com.azure.ai.metricsadvisor.administration.models.DataFeedMissingDataPointFillType; +import com.azure.ai.metricsadvisor.models.InfluxDbDataFeedSource; +import com.azure.ai.metricsadvisor.administration.models.MongoDbDataFeedSource; +import com.azure.ai.metricsadvisor.administration.models.MySqlDataFeedSource; +import com.azure.ai.metricsadvisor.administration.models.PostgreSqlDataFeedSource; +import com.azure.ai.metricsadvisor.administration.models.SqlServerDataFeedSource; import com.azure.core.util.logging.ClientLogger; import java.time.Duration; @@ -165,13 +166,25 @@ private static DataFeed setDataFeedSourceType(final DataFeedDetail dataFeedDetai } else if (dataFeedDetail instanceof AzureBlobDataFeed) { final AzureBlobParameter dataSourceParameter = ((AzureBlobDataFeed) dataFeedDetail) .getDataSourceParameter(); - dataFeed.setSource(new AzureBlobDataFeedSource(dataSourceParameter.getConnectionString(), - dataSourceParameter.getContainer(), dataSourceParameter.getBlobTemplate())); + if (dataFeedDetail.getAuthenticationType() == AuthenticationTypeEnum.BASIC) { + dataFeed.setSource(AzureBlobDataFeedSource.fromBasicCredential( + dataSourceParameter.getConnectionString(), + dataSourceParameter.getContainer(), + dataSourceParameter.getBlobTemplate())); + } else if (dataFeedDetail.getAuthenticationType() == AuthenticationTypeEnum.MANAGED_IDENTITY) { + dataFeed.setSource(AzureBlobDataFeedSource.fromManagedIdentityCredential( + dataSourceParameter.getConnectionString(), + dataSourceParameter.getContainer(), + dataSourceParameter.getBlobTemplate())); + } else { + throw LOGGER.logExceptionAsError(new RuntimeException( + String.format("AuthType %s not supported for Blob", dataFeedDetail.getAuthenticationType()))); + } dataFeedSourceType = DataFeedSourceType.AZURE_BLOB; } else if (dataFeedDetail instanceof AzureCosmosDBDataFeed) { final AzureCosmosDBParameter dataSourceParameter = ((AzureCosmosDBDataFeed) dataFeedDetail).getDataSourceParameter(); - dataFeed.setSource(new AzureCosmosDataFeedSource( + dataFeed.setSource(new AzureCosmosDbDataFeedSource( dataSourceParameter.getConnectionString(), dataSourceParameter.getSqlQuery(), dataSourceParameter.getDatabase(), @@ -181,10 +194,33 @@ private static DataFeed setDataFeedSourceType(final DataFeedDetail dataFeedDetai } else if (dataFeedDetail instanceof AzureDataExplorerDataFeed) { final SqlSourceParameter dataSourceParameter = ((AzureDataExplorerDataFeed) dataFeedDetail).getDataSourceParameter(); - dataFeed.setSource(new AzureDataExplorerDataFeedSource( - dataSourceParameter.getConnectionString(), - dataSourceParameter.getQuery() - )); + if (dataFeedDetail.getAuthenticationType() == AuthenticationTypeEnum.BASIC) { + dataFeed.setSource(AzureDataExplorerDataFeedSource.fromBasicCredential( + dataSourceParameter.getConnectionString(), + dataSourceParameter.getQuery() + )); + } else if (dataFeedDetail.getAuthenticationType() == AuthenticationTypeEnum.MANAGED_IDENTITY) { + dataFeed.setSource(AzureDataExplorerDataFeedSource.fromManagedIdentityCredential( + dataSourceParameter.getConnectionString(), + dataSourceParameter.getQuery() + )); + } else if (dataFeedDetail.getAuthenticationType() == AuthenticationTypeEnum.SERVICE_PRINCIPAL) { + dataFeed.setSource(AzureDataExplorerDataFeedSource.fromServicePrincipalCredential( + dataSourceParameter.getConnectionString(), + dataSourceParameter.getQuery(), + dataFeedDetail.getCredentialId() + )); + } else if (dataFeedDetail.getAuthenticationType() == AuthenticationTypeEnum.SERVICE_PRINCIPAL_IN_KV) { + dataFeed.setSource(AzureDataExplorerDataFeedSource.fromServicePrincipalInKeyVaultCredential( + dataSourceParameter.getConnectionString(), + dataSourceParameter.getQuery(), + dataFeedDetail.getCredentialId() + )); + } else { + throw LOGGER.logExceptionAsError(new RuntimeException( + String.format("AuthType %s not supported for AzureDataExplorer", + dataFeedDetail.getAuthenticationType()))); + } dataFeedSourceType = DataFeedSourceType.AZURE_DATA_EXPLORER; } else if (dataFeedDetail instanceof AzureEventHubsDataFeed) { final AzureEventHubsParameter azureEventHubsParameter = @@ -201,7 +237,7 @@ private static DataFeed setDataFeedSourceType(final DataFeedDetail dataFeedDetai dataFeedSourceType = DataFeedSourceType.AZURE_TABLE; } else if (dataFeedDetail instanceof InfluxDBDataFeed) { final InfluxDBParameter dataSourceParameter = ((InfluxDBDataFeed) dataFeedDetail).getDataSourceParameter(); - dataFeed.setSource(new InfluxDBDataFeedSource( + dataFeed.setSource(new InfluxDbDataFeedSource( dataSourceParameter.getConnectionString(), dataSourceParameter.getDatabase(), dataSourceParameter.getUserName(), @@ -227,12 +263,37 @@ private static DataFeed setDataFeedSourceType(final DataFeedDetail dataFeedDetai } else if (dataFeedDetail instanceof SQLServerDataFeed) { final SqlSourceParameter dataSourceParameter = ((SQLServerDataFeed) dataFeedDetail) .getDataSourceParameter(); - dataFeed.setSource(new SQLServerDataFeedSource(dataSourceParameter.getConnectionString(), - dataSourceParameter.getQuery())); + if (dataFeedDetail.getAuthenticationType() == AuthenticationTypeEnum.BASIC) { + dataFeed.setSource(SqlServerDataFeedSource.fromBasicCredential( + dataSourceParameter.getConnectionString(), + dataSourceParameter.getQuery())); + } else if (dataFeedDetail.getAuthenticationType() == AuthenticationTypeEnum.MANAGED_IDENTITY) { + dataFeed.setSource(SqlServerDataFeedSource.fromManagedIdentityCredential( + dataSourceParameter.getConnectionString(), + dataSourceParameter.getQuery())); + } else if (dataFeedDetail.getAuthenticationType() == AuthenticationTypeEnum.AZURE_SQLCONNECTION_STRING) { + dataFeed.setSource(SqlServerDataFeedSource.fromConnectionStringCredential( + dataSourceParameter.getQuery(), + dataFeedDetail.getCredentialId())); + } else if (dataFeedDetail.getAuthenticationType() == AuthenticationTypeEnum.SERVICE_PRINCIPAL) { + dataFeed.setSource(SqlServerDataFeedSource.fromServicePrincipalCredential( + dataSourceParameter.getConnectionString(), + dataSourceParameter.getQuery(), + dataFeedDetail.getCredentialId())); + } else if (dataFeedDetail.getAuthenticationType() == AuthenticationTypeEnum.SERVICE_PRINCIPAL_IN_KV) { + dataFeed.setSource(SqlServerDataFeedSource.fromServicePrincipalInKeyVaultCredential( + dataSourceParameter.getConnectionString(), + dataSourceParameter.getQuery(), + dataFeedDetail.getCredentialId())); + } else { + throw LOGGER.logExceptionAsError(new RuntimeException( + String.format("AuthType %s not supported for AzureSqlServer", + dataFeedDetail.getAuthenticationType()))); + } dataFeedSourceType = DataFeedSourceType.SQL_SERVER_DB; } else if (dataFeedDetail instanceof MongoDBDataFeed) { final MongoDBParameter dataSourceParameter = ((MongoDBDataFeed) dataFeedDetail).getDataSourceParameter(); - dataFeed.setSource(new MongoDBDataFeedSource( + dataFeed.setSource(new MongoDbDataFeedSource( dataSourceParameter.getConnectionString(), dataSourceParameter.getDatabase(), dataSourceParameter.getCommand() @@ -241,22 +302,69 @@ private static DataFeed setDataFeedSourceType(final DataFeedDetail dataFeedDetai } else if (dataFeedDetail instanceof AzureDataLakeStorageGen2DataFeed) { final AzureDataLakeStorageGen2Parameter azureDataLakeStorageGen2Parameter = ((AzureDataLakeStorageGen2DataFeed) dataFeedDetail).getDataSourceParameter(); - dataFeed.setSource(new AzureDataLakeStorageGen2DataFeedSource( - azureDataLakeStorageGen2Parameter.getAccountName(), - azureDataLakeStorageGen2Parameter.getAccountKey(), - azureDataLakeStorageGen2Parameter.getFileSystemName(), - azureDataLakeStorageGen2Parameter.getDirectoryTemplate(), - azureDataLakeStorageGen2Parameter.getFileTemplate() - )); + if (dataFeedDetail.getAuthenticationType() == AuthenticationTypeEnum.BASIC) { + dataFeed.setSource(AzureDataLakeStorageGen2DataFeedSource.fromBasicCredential( + azureDataLakeStorageGen2Parameter.getAccountName(), + azureDataLakeStorageGen2Parameter.getAccountKey(), + azureDataLakeStorageGen2Parameter.getFileSystemName(), + azureDataLakeStorageGen2Parameter.getDirectoryTemplate(), + azureDataLakeStorageGen2Parameter.getFileTemplate() + )); + } else if (dataFeedDetail.getAuthenticationType() == AuthenticationTypeEnum.DATA_LAKE_GEN2SHARED_KEY) { + dataFeed.setSource(AzureDataLakeStorageGen2DataFeedSource.fromSharedKeyCredential( + azureDataLakeStorageGen2Parameter.getAccountName(), + azureDataLakeStorageGen2Parameter.getFileSystemName(), + azureDataLakeStorageGen2Parameter.getDirectoryTemplate(), + azureDataLakeStorageGen2Parameter.getFileTemplate(), + dataFeedDetail.getCredentialId() + )); + } else if (dataFeedDetail.getAuthenticationType() == AuthenticationTypeEnum.SERVICE_PRINCIPAL) { + dataFeed.setSource(AzureDataLakeStorageGen2DataFeedSource.fromServicePrincipalCredential( + azureDataLakeStorageGen2Parameter.getAccountName(), + azureDataLakeStorageGen2Parameter.getFileSystemName(), + azureDataLakeStorageGen2Parameter.getDirectoryTemplate(), + azureDataLakeStorageGen2Parameter.getFileTemplate(), + dataFeedDetail.getCredentialId() + )); + } else if (dataFeedDetail.getAuthenticationType() == AuthenticationTypeEnum.SERVICE_PRINCIPAL_IN_KV) { + dataFeed.setSource(AzureDataLakeStorageGen2DataFeedSource.fromServicePrincipalInKeyVaultCredential( + azureDataLakeStorageGen2Parameter.getAccountName(), + azureDataLakeStorageGen2Parameter.getFileSystemName(), + azureDataLakeStorageGen2Parameter.getDirectoryTemplate(), + azureDataLakeStorageGen2Parameter.getFileTemplate(), + dataFeedDetail.getCredentialId() + )); + } else { + throw LOGGER.logExceptionAsError(new RuntimeException( + String.format("AuthType %s not supported for AzureDataLakeStorageGen2", + dataFeedDetail.getAuthenticationType()))); + } dataFeedSourceType = DataFeedSourceType.AZURE_DATA_LAKE_STORAGE_GEN2; } else if (dataFeedDetail instanceof AzureLogAnalyticsDataFeed) { final AzureLogAnalyticsParameter azureLogAnalyticsDataFeed = ((AzureLogAnalyticsDataFeed) dataFeedDetail).getDataSourceParameter(); - dataFeed.setSource(new AzureLogAnalyticsDataFeedSource(azureLogAnalyticsDataFeed.getTenantId(), - azureLogAnalyticsDataFeed.getClientId(), - azureLogAnalyticsDataFeed.getClientSecret(), - azureLogAnalyticsDataFeed.getWorkspaceId(), - azureLogAnalyticsDataFeed.getQuery())); + if (dataFeedDetail.getAuthenticationType() == AuthenticationTypeEnum.BASIC) { + dataFeed.setSource(AzureLogAnalyticsDataFeedSource.fromBasicCredential( + azureLogAnalyticsDataFeed.getTenantId(), + azureLogAnalyticsDataFeed.getClientId(), + azureLogAnalyticsDataFeed.getClientSecret(), + azureLogAnalyticsDataFeed.getWorkspaceId(), + azureLogAnalyticsDataFeed.getQuery())); + } else if (dataFeedDetail.getAuthenticationType() == AuthenticationTypeEnum.SERVICE_PRINCIPAL) { + dataFeed.setSource(AzureLogAnalyticsDataFeedSource.fromServicePrincipalCredential( + azureLogAnalyticsDataFeed.getWorkspaceId(), + azureLogAnalyticsDataFeed.getQuery(), + dataFeedDetail.getCredentialId())); + } else if (dataFeedDetail.getAuthenticationType() == AuthenticationTypeEnum.SERVICE_PRINCIPAL_IN_KV) { + dataFeed.setSource(AzureLogAnalyticsDataFeedSource.fromServicePrincipalInKeyVaultCredential( + azureLogAnalyticsDataFeed.getWorkspaceId(), + azureLogAnalyticsDataFeed.getQuery(), + dataFeedDetail.getCredentialId())); + } else { + throw LOGGER.logExceptionAsError(new RuntimeException( + String.format("AuthType %s not supported for AzureLogAnalytics", + dataFeedDetail.getAuthenticationType()))); + } dataFeedSourceType = DataFeedSourceType.AZURE_LOG_ANALYTICS; } else { throw LOGGER.logExceptionAsError(new RuntimeException( @@ -288,82 +396,98 @@ public static DataFeedDetail toDataFeedDetailSource(final DataFeedSource dataFee final AzureBlobDataFeedSource azureBlobDataFeedSource = ((AzureBlobDataFeedSource) dataFeedSource); dataFeedDetail = new AzureBlobDataFeed() .setDataSourceParameter(new AzureBlobParameter() - .setConnectionString(azureBlobDataFeedSource.getConnectionString()) + .setConnectionString(AzureBlobDataFeedSourceAccessor.getConnectionString(azureBlobDataFeedSource)) .setContainer(azureBlobDataFeedSource.getContainer()) - .setBlobTemplate(azureBlobDataFeedSource.getBlobTemplate())); - } else if (dataFeedSource instanceof AzureCosmosDataFeedSource) { - final AzureCosmosDataFeedSource azureCosmosDataFeedSource = ((AzureCosmosDataFeedSource) dataFeedSource); + .setBlobTemplate(azureBlobDataFeedSource.getBlobTemplate())) + .setAuthenticationType(AuthenticationTypeEnum + .fromString(azureBlobDataFeedSource.getAuthenticationType().toString())); + } else if (dataFeedSource instanceof AzureCosmosDbDataFeedSource) { + final AzureCosmosDbDataFeedSource azureCosmosDbDataFeedSource = ((AzureCosmosDbDataFeedSource) dataFeedSource); dataFeedDetail = new AzureCosmosDBDataFeed() .setDataSourceParameter(new AzureCosmosDBParameter() - .setConnectionString(azureCosmosDataFeedSource.getConnectionString()) - .setCollectionId(azureCosmosDataFeedSource.getCollectionId()) - .setDatabase(azureCosmosDataFeedSource.getDatabase()) - .setSqlQuery(azureCosmosDataFeedSource.getSqlQuery())); + .setConnectionString(AzureCosmosDbDataFeedSourceAccessor + .getConnectionString(azureCosmosDbDataFeedSource)) + .setCollectionId(azureCosmosDbDataFeedSource.getCollectionId()) + .setDatabase(azureCosmosDbDataFeedSource.getDatabase()) + .setSqlQuery(azureCosmosDbDataFeedSource.getSqlQuery())); } else if (dataFeedSource instanceof AzureDataExplorerDataFeedSource) { final AzureDataExplorerDataFeedSource azureDataExplorerDataFeedSource = ((AzureDataExplorerDataFeedSource) dataFeedSource); dataFeedDetail = new AzureDataExplorerDataFeed() .setDataSourceParameter(new SqlSourceParameter() - .setConnectionString(azureDataExplorerDataFeedSource.getConnectionString()) - .setQuery(azureDataExplorerDataFeedSource.getQuery())); + .setConnectionString( + AzureDataExplorerDataFeedSourceAccessor.getConnectionString(azureDataExplorerDataFeedSource)) + .setQuery(azureDataExplorerDataFeedSource.getQuery())) + .setAuthenticationType(AuthenticationTypeEnum + .fromString(azureDataExplorerDataFeedSource.getAuthenticationType().toString())) + .setCredentialId(azureDataExplorerDataFeedSource.getCredentialId()); } else if (dataFeedSource instanceof AzureEventHubsDataFeedSource) { final AzureEventHubsDataFeedSource azureEventHubsDataFeedSource = ((AzureEventHubsDataFeedSource) dataFeedSource); dataFeedDetail = new AzureEventHubsDataFeed() .setDataSourceParameter(new AzureEventHubsParameter() - .setConnectionString(azureEventHubsDataFeedSource.getConnectionString()) + .setConnectionString(AzureEventHubsDataFeedSourceAccessor. + getConnectionString(azureEventHubsDataFeedSource)) .setConsumerGroup(azureEventHubsDataFeedSource.getConsumerGroup())); } else if (dataFeedSource instanceof AzureTableDataFeedSource) { final AzureTableDataFeedSource azureTableDataFeedSource = ((AzureTableDataFeedSource) dataFeedSource); dataFeedDetail = new AzureTableDataFeed() .setDataSourceParameter(new AzureTableParameter() - .setConnectionString(azureTableDataFeedSource.getConnectionString()) + .setConnectionString(AzureTableDataFeedSourceAccessor + .getConnectionString(azureTableDataFeedSource)) .setTable(azureTableDataFeedSource.getTableName()) .setQuery(azureTableDataFeedSource.getQueryScript())); - } else if (dataFeedSource instanceof InfluxDBDataFeedSource) { - final InfluxDBDataFeedSource influxDBDataFeedSource = ((InfluxDBDataFeedSource) dataFeedSource); + } else if (dataFeedSource instanceof InfluxDbDataFeedSource) { + final InfluxDbDataFeedSource influxDBDataFeedSource = ((InfluxDbDataFeedSource) dataFeedSource); dataFeedDetail = new InfluxDBDataFeed() .setDataSourceParameter(new InfluxDBParameter() .setConnectionString(influxDBDataFeedSource.getConnectionString()) .setDatabase(influxDBDataFeedSource.getDatabase()) .setQuery(influxDBDataFeedSource.getQuery()) - .setPassword(influxDBDataFeedSource.getPassword()) + .setPassword(InfluxDbDataFeedSourceAccessor.getPassword(influxDBDataFeedSource)) .setUserName(influxDBDataFeedSource.getUserName())); } else if (dataFeedSource instanceof MySqlDataFeedSource) { final MySqlDataFeedSource mySqlDataFeedSource = ((MySqlDataFeedSource) dataFeedSource); dataFeedDetail = new MySqlDataFeed() .setDataSourceParameter(new SqlSourceParameter() - .setConnectionString(mySqlDataFeedSource.getConnectionString()) + .setConnectionString(MySqlDataFeedSourceAccessor.getConnectionString(mySqlDataFeedSource)) .setQuery(mySqlDataFeedSource.getQuery())); } else if (dataFeedSource instanceof PostgreSqlDataFeedSource) { final PostgreSqlDataFeedSource postgreSqlDataFeedSource = ((PostgreSqlDataFeedSource) dataFeedSource); dataFeedDetail = new PostgreSqlDataFeed() .setDataSourceParameter(new SqlSourceParameter() - .setConnectionString(postgreSqlDataFeedSource.getConnectionString()) + .setConnectionString(PostgreSqlDataFeedSourceAccessor.getConnectionString(postgreSqlDataFeedSource)) .setQuery(postgreSqlDataFeedSource.getQuery())); - } else if (dataFeedSource instanceof SQLServerDataFeedSource) { - final SQLServerDataFeedSource sqlServerDataFeedSource = ((SQLServerDataFeedSource) dataFeedSource); + } else if (dataFeedSource instanceof SqlServerDataFeedSource) { + final SqlServerDataFeedSource sqlServerDataFeedSource = ((SqlServerDataFeedSource) dataFeedSource); dataFeedDetail = new SQLServerDataFeed() .setDataSourceParameter(new SqlSourceParameter() - .setConnectionString(sqlServerDataFeedSource.getConnectionString()) - .setQuery(sqlServerDataFeedSource.getQuery())); - } else if (dataFeedSource instanceof MongoDBDataFeedSource) { - final MongoDBDataFeedSource azureCosmosDataFeedSource = ((MongoDBDataFeedSource) dataFeedSource); + .setConnectionString(SqlServerDataFeedSourceAccessor.getConnectionString(sqlServerDataFeedSource)) + .setQuery(sqlServerDataFeedSource.getQuery())) + .setAuthenticationType(AuthenticationTypeEnum + .fromString(sqlServerDataFeedSource.getAuthenticationType().toString())) + .setCredentialId(sqlServerDataFeedSource.getCredentialId()); + } else if (dataFeedSource instanceof MongoDbDataFeedSource) { + final MongoDbDataFeedSource mongoDbDataFeedSource = ((MongoDbDataFeedSource) dataFeedSource); dataFeedDetail = new MongoDBDataFeed() .setDataSourceParameter(new MongoDBParameter() - .setConnectionString(azureCosmosDataFeedSource.getConnectionString()) - .setCommand(azureCosmosDataFeedSource.getCommand()) - .setDatabase(azureCosmosDataFeedSource.getDatabase())); + .setConnectionString(MongoDbDataFeedSourceAccessor.getConnectionString(mongoDbDataFeedSource)) + .setCommand(mongoDbDataFeedSource.getCommand()) + .setDatabase(mongoDbDataFeedSource.getDatabase())); } else if (dataFeedSource instanceof AzureDataLakeStorageGen2DataFeedSource) { final AzureDataLakeStorageGen2DataFeedSource azureDataLakeStorageGen2DataFeedSource = ((AzureDataLakeStorageGen2DataFeedSource) dataFeedSource); dataFeedDetail = new AzureDataLakeStorageGen2DataFeed() .setDataSourceParameter(new AzureDataLakeStorageGen2Parameter() - .setAccountKey(azureDataLakeStorageGen2DataFeedSource.getAccountKey()) + .setAccountKey(AzureDataLakeStorageGen2DataFeedSourceAccessor + .getAccountKey(azureDataLakeStorageGen2DataFeedSource)) .setAccountName(azureDataLakeStorageGen2DataFeedSource.getAccountName()) .setDirectoryTemplate(azureDataLakeStorageGen2DataFeedSource.getDirectoryTemplate()) .setFileSystemName(azureDataLakeStorageGen2DataFeedSource.getFileSystemName()) - .setFileTemplate(azureDataLakeStorageGen2DataFeedSource.getFileTemplate())); + .setFileTemplate(azureDataLakeStorageGen2DataFeedSource.getFileTemplate())) + .setAuthenticationType(AuthenticationTypeEnum + .fromString(azureDataLakeStorageGen2DataFeedSource.getAuthenticationType().toString())) + .setCredentialId(azureDataLakeStorageGen2DataFeedSource.getCredentialId()); } else if (dataFeedSource instanceof AzureLogAnalyticsDataFeedSource) { final AzureLogAnalyticsDataFeedSource azureLogAnalyticsDataFeedSource = ((AzureLogAnalyticsDataFeedSource) dataFeedSource); @@ -371,9 +495,13 @@ public static DataFeedDetail toDataFeedDetailSource(final DataFeedSource dataFee .setDataSourceParameter(new AzureLogAnalyticsParameter() .setTenantId(azureLogAnalyticsDataFeedSource.getTenantId()) .setClientId(azureLogAnalyticsDataFeedSource.getClientId()) - .setClientSecret(azureLogAnalyticsDataFeedSource.getClientSecret()) + .setClientSecret(AzureLogAnalyticsDataFeedSourceAccessor + .getClientSecret(azureLogAnalyticsDataFeedSource)) .setWorkspaceId(azureLogAnalyticsDataFeedSource.getWorkspaceId()) - .setQuery(azureLogAnalyticsDataFeedSource.getQuery())); + .setQuery(azureLogAnalyticsDataFeedSource.getQuery())) + .setAuthenticationType(AuthenticationTypeEnum + .fromString(azureLogAnalyticsDataFeedSource.getAuthenticationType().toString())) + .setCredentialId(azureLogAnalyticsDataFeedSource.getCredentialId()); } else { throw LOGGER.logExceptionAsError(new RuntimeException( String.format("Data feed source type %s not supported", dataFeedSource.getClass().getCanonicalName()))); @@ -403,97 +531,117 @@ public static DataFeedDetailPatch toInnerForUpdate(final DataFeedSource dataFeed final AzureBlobDataFeedSource azureBlobDataFeedSource = ((AzureBlobDataFeedSource) dataFeedSource); dataFeedDetailPatch = new AzureBlobDataFeedPatch() .setDataSourceParameter(new AzureBlobParameterPatch() - .setConnectionString(azureBlobDataFeedSource.getConnectionString()) + .setConnectionString(AzureBlobDataFeedSourceAccessor.getConnectionString(azureBlobDataFeedSource)) .setContainer(azureBlobDataFeedSource.getContainer()) - .setBlobTemplate(azureBlobDataFeedSource.getBlobTemplate())); - } else if (dataFeedSource instanceof AzureCosmosDataFeedSource) { - final AzureCosmosDataFeedSource azureCosmosDataFeedSource = ((AzureCosmosDataFeedSource) dataFeedSource); + .setBlobTemplate(azureBlobDataFeedSource.getBlobTemplate())) + .setAuthenticationType(AuthenticationTypeEnum + .fromString(azureBlobDataFeedSource.getAuthenticationType().toString())); + } else if (dataFeedSource instanceof AzureCosmosDbDataFeedSource) { + final AzureCosmosDbDataFeedSource azureCosmosDbDataFeedSource = ((AzureCosmosDbDataFeedSource) dataFeedSource); dataFeedDetailPatch = new AzureCosmosDBDataFeedPatch() .setDataSourceParameter(new AzureCosmosDBParameterPatch() - .setConnectionString(azureCosmosDataFeedSource.getConnectionString()) - .setCollectionId(azureCosmosDataFeedSource.getCollectionId()) - .setDatabase(azureCosmosDataFeedSource.getDatabase()) - .setSqlQuery(azureCosmosDataFeedSource.getSqlQuery())); + .setConnectionString(AzureCosmosDbDataFeedSourceAccessor + .getConnectionString(azureCosmosDbDataFeedSource)) + .setCollectionId(azureCosmosDbDataFeedSource.getCollectionId()) + .setDatabase(azureCosmosDbDataFeedSource.getDatabase()) + .setSqlQuery(azureCosmosDbDataFeedSource.getSqlQuery())); } else if (dataFeedSource instanceof AzureDataExplorerDataFeedSource) { final AzureDataExplorerDataFeedSource azureDataExplorerDataFeedSource = ((AzureDataExplorerDataFeedSource) dataFeedSource); dataFeedDetailPatch = new AzureDataExplorerDataFeedPatch() .setDataSourceParameter(new SQLSourceParameterPatch() - .setConnectionString(azureDataExplorerDataFeedSource.getConnectionString()) - .setQuery(azureDataExplorerDataFeedSource.getQuery())); + .setConnectionString( + AzureDataExplorerDataFeedSourceAccessor.getConnectionString(azureDataExplorerDataFeedSource)) + .setQuery(azureDataExplorerDataFeedSource.getQuery())) + .setAuthenticationType(AuthenticationTypeEnum + .fromString(azureDataExplorerDataFeedSource.getAuthenticationType().toString())) + .setCredentialId(azureDataExplorerDataFeedSource.getCredentialId()); } else if (dataFeedSource instanceof AzureEventHubsDataFeedSource) { final AzureEventHubsDataFeedSource azureEventHubsDataFeedSource = ((AzureEventHubsDataFeedSource) dataFeedSource); dataFeedDetailPatch = new AzureEventHubsDataFeedPatch() .setDataSourceParameter(new AzureEventHubsParameterPatch() - .setConnectionString(azureEventHubsDataFeedSource.getConnectionString()) + .setConnectionString(AzureEventHubsDataFeedSourceAccessor + .getConnectionString(azureEventHubsDataFeedSource)) .setConsumerGroup(azureEventHubsDataFeedSource.getConsumerGroup())); } else if (dataFeedSource instanceof AzureTableDataFeedSource) { final AzureTableDataFeedSource azureTableDataFeedSource = ((AzureTableDataFeedSource) dataFeedSource); dataFeedDetailPatch = new AzureTableDataFeedPatch() .setDataSourceParameter(new AzureTableParameterPatch() - .setConnectionString(azureTableDataFeedSource.getConnectionString()) + .setConnectionString(AzureTableDataFeedSourceAccessor.getConnectionString(azureTableDataFeedSource)) .setTable(azureTableDataFeedSource.getTableName()) .setQuery(azureTableDataFeedSource.getQueryScript())); - } else if (dataFeedSource instanceof InfluxDBDataFeedSource) { - final InfluxDBDataFeedSource influxDBDataFeedSource = ((InfluxDBDataFeedSource) dataFeedSource); + } else if (dataFeedSource instanceof InfluxDbDataFeedSource) { + final InfluxDbDataFeedSource influxDBDataFeedSource = ((InfluxDbDataFeedSource) dataFeedSource); dataFeedDetailPatch = new InfluxDBDataFeedPatch() .setDataSourceParameter(new InfluxDBParameterPatch() .setConnectionString(influxDBDataFeedSource.getConnectionString()) .setDatabase(influxDBDataFeedSource.getDatabase()) .setQuery(influxDBDataFeedSource.getQuery()) - .setPassword(influxDBDataFeedSource.getPassword()) + .setPassword(InfluxDbDataFeedSourceAccessor.getPassword(influxDBDataFeedSource)) .setUserName(influxDBDataFeedSource.getUserName())); } else if (dataFeedSource instanceof MySqlDataFeedSource) { final MySqlDataFeedSource mySqlDataFeedSource = ((MySqlDataFeedSource) dataFeedSource); dataFeedDetailPatch = new MySqlDataFeedPatch() .setDataSourceParameter(new SQLSourceParameterPatch() - .setConnectionString(mySqlDataFeedSource.getConnectionString()) + .setConnectionString(MySqlDataFeedSourceAccessor.getConnectionString(mySqlDataFeedSource)) .setQuery(mySqlDataFeedSource.getQuery())); } else if (dataFeedSource instanceof PostgreSqlDataFeedSource) { final PostgreSqlDataFeedSource postgreSqlDataFeedSource = ((PostgreSqlDataFeedSource) dataFeedSource); dataFeedDetailPatch = new PostgreSqlDataFeedPatch() .setDataSourceParameter(new SQLSourceParameterPatch() - .setConnectionString(postgreSqlDataFeedSource.getConnectionString()) + .setConnectionString(PostgreSqlDataFeedSourceAccessor.getConnectionString(postgreSqlDataFeedSource)) .setQuery(postgreSqlDataFeedSource.getQuery())); - } else if (dataFeedSource instanceof SQLServerDataFeedSource) { - final SQLServerDataFeedSource sqlServerDataFeedSource = ((SQLServerDataFeedSource) dataFeedSource); + } else if (dataFeedSource instanceof SqlServerDataFeedSource) { + final SqlServerDataFeedSource sqlServerDataFeedSource = ((SqlServerDataFeedSource) dataFeedSource); dataFeedDetailPatch = new SQLServerDataFeedPatch() .setDataSourceParameter(new SQLSourceParameterPatch() - .setConnectionString(sqlServerDataFeedSource.getConnectionString()) - .setQuery(sqlServerDataFeedSource.getQuery())); - } else if (dataFeedSource instanceof MongoDBDataFeedSource) { - final MongoDBDataFeedSource azureCosmosDataFeedSource = ((MongoDBDataFeedSource) dataFeedSource); + .setConnectionString(SqlServerDataFeedSourceAccessor.getConnectionString(sqlServerDataFeedSource)) + .setQuery(sqlServerDataFeedSource.getQuery())) + .setAuthenticationType(AuthenticationTypeEnum + .fromString(sqlServerDataFeedSource.getAuthenticationType().toString())) + .setCredentialId(sqlServerDataFeedSource.getCredentialId()); + } else if (dataFeedSource instanceof MongoDbDataFeedSource) { + final MongoDbDataFeedSource mongoDbDataFeedSource = ((MongoDbDataFeedSource) dataFeedSource); dataFeedDetailPatch = new MongoDBDataFeedPatch() .setDataSourceParameter(new MongoDBParameterPatch() - .setConnectionString(azureCosmosDataFeedSource.getConnectionString()) - .setCommand(azureCosmosDataFeedSource.getCommand()) - .setDatabase(azureCosmosDataFeedSource.getDatabase())); + .setConnectionString(MongoDbDataFeedSourceAccessor.getConnectionString(mongoDbDataFeedSource)) + .setCommand(mongoDbDataFeedSource.getCommand()) + .setDatabase(mongoDbDataFeedSource.getDatabase())); } else if (dataFeedSource instanceof AzureDataLakeStorageGen2DataFeedSource) { final AzureDataLakeStorageGen2DataFeedSource azureDataLakeStorageGen2DataFeedSource = ((AzureDataLakeStorageGen2DataFeedSource) dataFeedSource); dataFeedDetailPatch = new AzureDataLakeStorageGen2DataFeedPatch() .setDataSourceParameter(new AzureDataLakeStorageGen2ParameterPatch() - .setAccountKey(azureDataLakeStorageGen2DataFeedSource.getAccountKey()) + .setAccountKey(AzureDataLakeStorageGen2DataFeedSourceAccessor + .getAccountKey(azureDataLakeStorageGen2DataFeedSource)) .setAccountName(azureDataLakeStorageGen2DataFeedSource.getAccountName()) .setDirectoryTemplate(azureDataLakeStorageGen2DataFeedSource.getDirectoryTemplate()) .setFileSystemName(azureDataLakeStorageGen2DataFeedSource.getFileSystemName()) - .setFileTemplate(azureDataLakeStorageGen2DataFeedSource.getFileTemplate())); + .setFileTemplate(azureDataLakeStorageGen2DataFeedSource.getFileTemplate())) + .setAuthenticationType(AuthenticationTypeEnum + .fromString(azureDataLakeStorageGen2DataFeedSource.getAuthenticationType().toString())) + .setCredentialId(azureDataLakeStorageGen2DataFeedSource.getCredentialId()); } else if (dataFeedSource instanceof AzureLogAnalyticsDataFeedSource) { - final AzureLogAnalyticsDataFeedSource azureDataLakeStorageGen2DataFeedSource = + final AzureLogAnalyticsDataFeedSource azureLogAnalyticsDataFeedSource = ((AzureLogAnalyticsDataFeedSource) dataFeedSource); dataFeedDetailPatch = new AzureLogAnalyticsDataFeedPatch() .setDataSourceParameter(new AzureLogAnalyticsParameterPatch() - .setTenantId(azureDataLakeStorageGen2DataFeedSource.getTenantId()) - .setClientId(azureDataLakeStorageGen2DataFeedSource.getClientId()) - .setClientSecret(azureDataLakeStorageGen2DataFeedSource.getClientSecret()) - .setWorkspaceId(azureDataLakeStorageGen2DataFeedSource.getWorkspaceId()) - .setQuery(azureDataLakeStorageGen2DataFeedSource.getQuery())); + .setTenantId(azureLogAnalyticsDataFeedSource.getTenantId()) + .setClientId(azureLogAnalyticsDataFeedSource.getClientId()) + .setClientSecret(AzureLogAnalyticsDataFeedSourceAccessor + .getClientSecret(azureLogAnalyticsDataFeedSource)) + .setWorkspaceId(azureLogAnalyticsDataFeedSource.getWorkspaceId()) + .setQuery(azureLogAnalyticsDataFeedSource.getQuery())) + .setAuthenticationType(AuthenticationTypeEnum + .fromString(azureLogAnalyticsDataFeedSource.getAuthenticationType().toString())) + .setCredentialId(azureLogAnalyticsDataFeedSource.getCredentialId()); } else { throw LOGGER.logExceptionAsError(new RuntimeException( String.format("Data feed source type %s not supported.", dataFeedSource.getClass().getCanonicalName()))); } + return dataFeedDetailPatch; } } diff --git a/sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/implementation/util/DataSourceCredentialEntityTransforms.java b/sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/implementation/util/DataSourceCredentialEntityTransforms.java new file mode 100644 index 0000000000000..afce1874acd88 --- /dev/null +++ b/sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/implementation/util/DataSourceCredentialEntityTransforms.java @@ -0,0 +1,215 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +package com.azure.ai.metricsadvisor.implementation.util; + +import com.azure.ai.metricsadvisor.implementation.models.AzureSQLConnectionStringCredential; +import com.azure.ai.metricsadvisor.implementation.models.AzureSQLConnectionStringCredentialPatch; +import com.azure.ai.metricsadvisor.implementation.models.AzureSQLConnectionStringParam; +import com.azure.ai.metricsadvisor.implementation.models.AzureSQLConnectionStringParamPatch; +import com.azure.ai.metricsadvisor.implementation.models.DataLakeGen2SharedKeyCredential; +import com.azure.ai.metricsadvisor.implementation.models.DataLakeGen2SharedKeyCredentialPatch; +import com.azure.ai.metricsadvisor.implementation.models.DataLakeGen2SharedKeyParam; +import com.azure.ai.metricsadvisor.implementation.models.DataLakeGen2SharedKeyParamPatch; +import com.azure.ai.metricsadvisor.implementation.models.DataSourceCredential; +import com.azure.ai.metricsadvisor.implementation.models.DataSourceCredentialPatch; +import com.azure.ai.metricsadvisor.implementation.models.ServicePrincipalCredential; +import com.azure.ai.metricsadvisor.implementation.models.ServicePrincipalCredentialPatch; +import com.azure.ai.metricsadvisor.implementation.models.ServicePrincipalInKVCredential; +import com.azure.ai.metricsadvisor.implementation.models.ServicePrincipalInKVCredentialPatch; +import com.azure.ai.metricsadvisor.implementation.models.ServicePrincipalInKVParam; +import com.azure.ai.metricsadvisor.implementation.models.ServicePrincipalInKVParamPatch; +import com.azure.ai.metricsadvisor.implementation.models.ServicePrincipalParam; +import com.azure.ai.metricsadvisor.implementation.models.ServicePrincipalParamPatch; +import com.azure.ai.metricsadvisor.administration.models.DatasourceDataLakeGen2SharedKey; +import com.azure.ai.metricsadvisor.administration.models.DatasourceCredentialEntity; +import com.azure.ai.metricsadvisor.administration.models.DatasourceSqlServerConnectionString; +import com.azure.ai.metricsadvisor.administration.models.DatasourceServicePrincipal; +import com.azure.ai.metricsadvisor.administration.models.DatasourceServicePrincipalInKeyVault; +import com.azure.core.util.logging.ClientLogger; + +/** + * Helper class to convert between service level credential model to SDK exposed model. + */ +public final class DataSourceCredentialEntityTransforms { + private static final ClientLogger LOGGER = new ClientLogger(DataSourceCredentialEntityTransforms.class); + + private DataSourceCredentialEntityTransforms() { + } + + /** + * Transform configuration wire model to {@link DatasourceCredentialEntity}. + * + * @param innerCredential The wire model instance. + * + * @return The custom model instance. + */ + public static DatasourceCredentialEntity fromInner(DataSourceCredential innerCredential) { + if (innerCredential instanceof AzureSQLConnectionStringCredential) { + final AzureSQLConnectionStringCredential sqlConnectionStringCredential + = (AzureSQLConnectionStringCredential) innerCredential; + final DatasourceSqlServerConnectionString credentialEntity + = new DatasourceSqlServerConnectionString( + sqlConnectionStringCredential.getDataSourceCredentialName(), + null); + DataSourceSqlServerConnectionStringAccessor.setId(credentialEntity, + sqlConnectionStringCredential.getDataSourceCredentialId().toString()); + credentialEntity.setDescription(sqlConnectionStringCredential.getDataSourceCredentialDescription()); + return credentialEntity; + } else if (innerCredential instanceof DataLakeGen2SharedKeyCredential) { + final DataLakeGen2SharedKeyCredential dataLakeGen2SharedKeyCredential + = (DataLakeGen2SharedKeyCredential) innerCredential; + final DatasourceDataLakeGen2SharedKey credentialEntity = new DatasourceDataLakeGen2SharedKey( + dataLakeGen2SharedKeyCredential.getDataSourceCredentialName(), + null); + DataSourceDataLakeGen2SharedKeyAccessor.setId(credentialEntity, + dataLakeGen2SharedKeyCredential.getDataSourceCredentialId().toString()); + credentialEntity.setDescription(dataLakeGen2SharedKeyCredential.getDataSourceCredentialDescription()); + return credentialEntity; + } else if (innerCredential instanceof ServicePrincipalCredential) { + final ServicePrincipalCredential servicePrincipalCredential = (ServicePrincipalCredential) innerCredential; + final DatasourceServicePrincipal credentialEntity = + new DatasourceServicePrincipal(servicePrincipalCredential.getDataSourceCredentialName(), + servicePrincipalCredential.getParameters().getClientId(), + servicePrincipalCredential.getParameters().getTenantId(), + null); + DataSourceServicePrincipalAccessor.setId(credentialEntity, + servicePrincipalCredential.getDataSourceCredentialId().toString()); + credentialEntity.setDescription(servicePrincipalCredential.getDataSourceCredentialDescription()); + return credentialEntity; + } else if (innerCredential instanceof ServicePrincipalInKVCredential) { + final ServicePrincipalInKVCredential servicePrincipalInKVCredential + = (ServicePrincipalInKVCredential) innerCredential; + final DatasourceServicePrincipalInKeyVault credentialEntity = + new DatasourceServicePrincipalInKeyVault(); + credentialEntity + .setName(servicePrincipalInKVCredential.getDataSourceCredentialName()) + .setDescription(servicePrincipalInKVCredential.getDataSourceCredentialDescription()) + .setKeyVaultForDatasourceSecrets(servicePrincipalInKVCredential.getParameters().getKeyVaultEndpoint(), + servicePrincipalInKVCredential.getParameters().getKeyVaultClientId(), + null) + .setTenantId(servicePrincipalInKVCredential.getParameters().getTenantId()) + .setSecretNameForDatasourceClientId( + servicePrincipalInKVCredential.getParameters().getServicePrincipalIdNameInKV()) + .setSecretNameForDatasourceClientSecret( + servicePrincipalInKVCredential.getParameters().getServicePrincipalSecretNameInKV()); + + DataSourceServicePrincipalInKeyVaultAccessor.setId(credentialEntity, + servicePrincipalInKVCredential.getDataSourceCredentialId().toString()); + + return credentialEntity; + } else { + throw LOGGER.logExceptionAsError(new IllegalArgumentException("Unknown inner credential type.")); + } + } + + public static DataSourceCredential toInnerForCreate(DatasourceCredentialEntity credentialEntity) { + if (credentialEntity instanceof DatasourceSqlServerConnectionString) { + final DatasourceSqlServerConnectionString credential + = (DatasourceSqlServerConnectionString) credentialEntity; + final AzureSQLConnectionStringCredential innerCredential = new AzureSQLConnectionStringCredential(); + innerCredential.setDataSourceCredentialName(credentialEntity.getName()); + innerCredential.setDataSourceCredentialDescription(credentialEntity.getDescription()); + innerCredential.setParameters(new AzureSQLConnectionStringParam() + .setConnectionString(DataSourceSqlServerConnectionStringAccessor + .getConnectionString(credential))); + + return innerCredential; + } else if (credentialEntity instanceof DatasourceDataLakeGen2SharedKey) { + final DatasourceDataLakeGen2SharedKey credential + = (DatasourceDataLakeGen2SharedKey) credentialEntity; + final DataLakeGen2SharedKeyCredential innerCredential = new DataLakeGen2SharedKeyCredential(); + innerCredential.setDataSourceCredentialName(credentialEntity.getName()); + innerCredential.setDataSourceCredentialDescription(credentialEntity.getDescription()); + innerCredential + .setParameters(new DataLakeGen2SharedKeyParam() + .setAccountKey(DataSourceDataLakeGen2SharedKeyAccessor.getSharedKey(credential))); + + return innerCredential; + } else if (credentialEntity instanceof DatasourceServicePrincipal) { + final DatasourceServicePrincipal credential + = (DatasourceServicePrincipal) credentialEntity; + final ServicePrincipalCredential innerCredential = new ServicePrincipalCredential(); + innerCredential.setDataSourceCredentialName(credentialEntity.getName()); + innerCredential.setDataSourceCredentialDescription(credentialEntity.getDescription()); + innerCredential.setParameters(new ServicePrincipalParam() + .setClientId(credential.getClientId()) + .setTenantId(credential.getTenantId()) + .setClientSecret(DataSourceServicePrincipalAccessor.getClientSecret(credential))); + + return innerCredential; + } else if (credentialEntity instanceof DatasourceServicePrincipalInKeyVault) { + final DatasourceServicePrincipalInKeyVault credential + = (DatasourceServicePrincipalInKeyVault) credentialEntity; + final ServicePrincipalInKVCredential innerCredential = new ServicePrincipalInKVCredential(); + innerCredential.setDataSourceCredentialName(credentialEntity.getName()); + innerCredential.setDataSourceCredentialDescription(credentialEntity.getDescription()); + innerCredential.setParameters(new ServicePrincipalInKVParam() + .setKeyVaultEndpoint(credential.getKeyVaultEndpoint()) + .setKeyVaultClientId(credential.getKeyVaultClientId()) + .setKeyVaultClientSecret(DataSourceServicePrincipalInKeyVaultAccessor + .getKeyVaultClientSecret(credential)) + .setServicePrincipalIdNameInKV(credential.getSecretNameForDatasourceClientId()) + .setServicePrincipalSecretNameInKV(credential.getSecretNameForDatasourceClientSecret()) + .setTenantId(credential.getTenantId())); + return innerCredential; + } else { + throw LOGGER.logExceptionAsError(new IllegalArgumentException("Unknown credential entity type.")); + } + } + + public static DataSourceCredentialPatch toInnerForUpdate(DatasourceCredentialEntity credentialEntity) { + if (credentialEntity instanceof DatasourceSqlServerConnectionString) { + final DatasourceSqlServerConnectionString credential + = (DatasourceSqlServerConnectionString) credentialEntity; + final AzureSQLConnectionStringCredentialPatch innerCredential = new AzureSQLConnectionStringCredentialPatch(); + innerCredential.setDataSourceCredentialName(credentialEntity.getName()); + innerCredential.setDataSourceCredentialDescription(credentialEntity.getDescription()); + innerCredential.setParameters(new AzureSQLConnectionStringParamPatch() + .setConnectionString(DataSourceSqlServerConnectionStringAccessor + .getConnectionString(credential))); + + return innerCredential; + } else if (credentialEntity instanceof DatasourceDataLakeGen2SharedKey) { + final DatasourceDataLakeGen2SharedKey credential + = (DatasourceDataLakeGen2SharedKey) credentialEntity; + final DataLakeGen2SharedKeyCredentialPatch innerCredential = new DataLakeGen2SharedKeyCredentialPatch(); + innerCredential.setDataSourceCredentialName(credentialEntity.getName()); + innerCredential.setDataSourceCredentialDescription(credentialEntity.getDescription()); + innerCredential + .setParameters(new DataLakeGen2SharedKeyParamPatch() + .setAccountKey(DataSourceDataLakeGen2SharedKeyAccessor.getSharedKey(credential))); + + return innerCredential; + } else if (credentialEntity instanceof DatasourceServicePrincipal) { + final DatasourceServicePrincipal credential + = (DatasourceServicePrincipal) credentialEntity; + final ServicePrincipalCredentialPatch innerCredential = new ServicePrincipalCredentialPatch(); + innerCredential.setDataSourceCredentialName(credentialEntity.getName()); + innerCredential.setDataSourceCredentialDescription(credentialEntity.getDescription()); + innerCredential.setParameters(new ServicePrincipalParamPatch() + .setClientId(credential.getClientId()) + .setTenantId(credential.getTenantId()) + .setClientSecret(DataSourceServicePrincipalAccessor.getClientSecret(credential))); + + return innerCredential; + } else if (credentialEntity instanceof DatasourceServicePrincipalInKeyVault) { + final DatasourceServicePrincipalInKeyVault credential + = (DatasourceServicePrincipalInKeyVault) credentialEntity; + final ServicePrincipalInKVCredentialPatch innerCredential = new ServicePrincipalInKVCredentialPatch(); + innerCredential.setDataSourceCredentialName(credentialEntity.getName()); + innerCredential.setDataSourceCredentialDescription(credentialEntity.getDescription()); + innerCredential.setParameters(new ServicePrincipalInKVParamPatch() + .setKeyVaultEndpoint(credential.getKeyVaultEndpoint()) + .setKeyVaultClientId(credential.getKeyVaultClientId()) + .setKeyVaultClientSecret(DataSourceServicePrincipalInKeyVaultAccessor + .getKeyVaultClientSecret(credential)) + .setServicePrincipalIdNameInKV(credential.getSecretNameForDatasourceClientId()) + .setServicePrincipalSecretNameInKV(credential.getSecretNameForDatasourceClientSecret()) + .setTenantId(credential.getTenantId())); + return innerCredential; + } else { + throw LOGGER.logExceptionAsError(new IllegalArgumentException("Unknown credential entity type.")); + } + } +} diff --git a/sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/implementation/util/DataSourceDataLakeGen2SharedKeyAccessor.java b/sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/implementation/util/DataSourceDataLakeGen2SharedKeyAccessor.java new file mode 100644 index 0000000000000..5688230e83a3e --- /dev/null +++ b/sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/implementation/util/DataSourceDataLakeGen2SharedKeyAccessor.java @@ -0,0 +1,39 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +package com.azure.ai.metricsadvisor.implementation.util; + +import com.azure.ai.metricsadvisor.administration.models.DatasourceDataLakeGen2SharedKey; + +public final class DataSourceDataLakeGen2SharedKeyAccessor { + private static Accessor accessor; + + private DataSourceDataLakeGen2SharedKeyAccessor() { + } + + /** + * Type defining the methods to set the non-public properties of + * an {@link DatasourceDataLakeGen2SharedKey} instance. + */ + public interface Accessor { + void setId(DatasourceDataLakeGen2SharedKey entity, String id); + String getSharedKey(DatasourceDataLakeGen2SharedKey entity); + } + + /** + * The method called from {@link DatasourceDataLakeGen2SharedKey} to set it's accessor. + * + * @param accessor The accessor. + */ + public static void setAccessor(final Accessor accessor) { + DataSourceDataLakeGen2SharedKeyAccessor.accessor = accessor; + } + + public static void setId(DatasourceDataLakeGen2SharedKey entity, String id) { + accessor.setId(entity, id); + } + + public static String getSharedKey(DatasourceDataLakeGen2SharedKey entity) { + return accessor.getSharedKey(entity); + } +} diff --git a/sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/implementation/util/DataSourceServicePrincipalAccessor.java b/sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/implementation/util/DataSourceServicePrincipalAccessor.java new file mode 100644 index 0000000000000..30e2aafb359b0 --- /dev/null +++ b/sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/implementation/util/DataSourceServicePrincipalAccessor.java @@ -0,0 +1,39 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +package com.azure.ai.metricsadvisor.implementation.util; + +import com.azure.ai.metricsadvisor.administration.models.DatasourceServicePrincipal; + +public final class DataSourceServicePrincipalAccessor { + private static Accessor accessor; + + private DataSourceServicePrincipalAccessor() { + } + + /** + * Type defining the methods to set the non-public properties of + * an {@link DatasourceServicePrincipal} instance. + */ + public interface Accessor { + void setId(DatasourceServicePrincipal entity, String id); + String getClientSecret(DatasourceServicePrincipal entity); + } + + /** + * The method called from {@link DatasourceServicePrincipal} to set it's accessor. + * + * @param accessor The accessor. + */ + public static void setAccessor(final Accessor accessor) { + DataSourceServicePrincipalAccessor.accessor = accessor; + } + + public static void setId(DatasourceServicePrincipal entity, String id) { + accessor.setId(entity, id); + } + + public static String getClientSecret(DatasourceServicePrincipal entity) { + return accessor.getClientSecret(entity); + } +} diff --git a/sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/implementation/util/DataSourceServicePrincipalInKeyVaultAccessor.java b/sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/implementation/util/DataSourceServicePrincipalInKeyVaultAccessor.java new file mode 100644 index 0000000000000..96e7bc648ce7c --- /dev/null +++ b/sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/implementation/util/DataSourceServicePrincipalInKeyVaultAccessor.java @@ -0,0 +1,39 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +package com.azure.ai.metricsadvisor.implementation.util; + +import com.azure.ai.metricsadvisor.administration.models.DatasourceServicePrincipalInKeyVault; + +public final class DataSourceServicePrincipalInKeyVaultAccessor { + private static Accessor accessor; + + private DataSourceServicePrincipalInKeyVaultAccessor() { + } + + /** + * Type defining the methods to set the non-public properties of + * an {@link DatasourceServicePrincipalInKeyVault} instance. + */ + public interface Accessor { + void setId(DatasourceServicePrincipalInKeyVault entity, String id); + String getKeyVaultClientSecret(DatasourceServicePrincipalInKeyVault entity); + } + + /** + * The method called from {@link DatasourceServicePrincipalInKeyVault} to set it's accessor. + * + * @param accessor The accessor. + */ + public static void setAccessor(final Accessor accessor) { + DataSourceServicePrincipalInKeyVaultAccessor.accessor = accessor; + } + + public static void setId(DatasourceServicePrincipalInKeyVault entity, String id) { + accessor.setId(entity, id); + } + + public static String getKeyVaultClientSecret(DatasourceServicePrincipalInKeyVault entity) { + return accessor.getKeyVaultClientSecret(entity); + } +} diff --git a/sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/implementation/util/DataSourceSqlServerConnectionStringAccessor.java b/sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/implementation/util/DataSourceSqlServerConnectionStringAccessor.java new file mode 100644 index 0000000000000..75bec7dbf91e2 --- /dev/null +++ b/sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/implementation/util/DataSourceSqlServerConnectionStringAccessor.java @@ -0,0 +1,39 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +package com.azure.ai.metricsadvisor.implementation.util; + +import com.azure.ai.metricsadvisor.administration.models.DatasourceSqlServerConnectionString; + +public final class DataSourceSqlServerConnectionStringAccessor { + private static Accessor accessor; + + private DataSourceSqlServerConnectionStringAccessor() { + } + + /** + * Type defining the methods to set the non-public properties of + * an {@link DatasourceSqlServerConnectionString} instance. + */ + public interface Accessor { + void setId(DatasourceSqlServerConnectionString entity, String id); + String getConnectionString(DatasourceSqlServerConnectionString entity); + } + + /** + * The method called from {@link DatasourceSqlServerConnectionString} to set it's accessor. + * + * @param accessor The accessor. + */ + public static void setAccessor(final Accessor accessor) { + DataSourceSqlServerConnectionStringAccessor.accessor = accessor; + } + + public static void setId(DatasourceSqlServerConnectionString entity, String id) { + accessor.setId(entity, id); + } + + public static String getConnectionString(DatasourceSqlServerConnectionString entity) { + return accessor.getConnectionString(entity); + } +} diff --git a/sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/implementation/util/DetectionConfigurationTransforms.java b/sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/implementation/util/DetectionConfigurationTransforms.java index d3edc0e64424e..14a46cf57d38e 100644 --- a/sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/implementation/util/DetectionConfigurationTransforms.java +++ b/sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/implementation/util/DetectionConfigurationTransforms.java @@ -15,15 +15,15 @@ import com.azure.ai.metricsadvisor.implementation.models.SuppressConditionPatch; import com.azure.ai.metricsadvisor.implementation.models.WholeMetricConfiguration; import com.azure.ai.metricsadvisor.implementation.models.WholeMetricConfigurationPatch; -import com.azure.ai.metricsadvisor.models.ChangeThresholdCondition; -import com.azure.ai.metricsadvisor.models.DetectionConditionsOperator; +import com.azure.ai.metricsadvisor.administration.models.ChangeThresholdCondition; +import com.azure.ai.metricsadvisor.administration.models.DetectionConditionsOperator; import com.azure.ai.metricsadvisor.models.DimensionKey; -import com.azure.ai.metricsadvisor.models.HardThresholdCondition; -import com.azure.ai.metricsadvisor.models.MetricWholeSeriesDetectionCondition; -import com.azure.ai.metricsadvisor.models.AnomalyDetectionConfiguration; -import com.azure.ai.metricsadvisor.models.MetricSeriesGroupDetectionCondition; -import com.azure.ai.metricsadvisor.models.MetricSingleSeriesDetectionCondition; -import com.azure.ai.metricsadvisor.models.SmartDetectionCondition; +import com.azure.ai.metricsadvisor.administration.models.HardThresholdCondition; +import com.azure.ai.metricsadvisor.administration.models.MetricWholeSeriesDetectionCondition; +import com.azure.ai.metricsadvisor.administration.models.AnomalyDetectionConfiguration; +import com.azure.ai.metricsadvisor.administration.models.MetricSeriesGroupDetectionCondition; +import com.azure.ai.metricsadvisor.administration.models.MetricSingleSeriesDetectionCondition; +import com.azure.ai.metricsadvisor.administration.models.SmartDetectionCondition; import com.azure.core.http.rest.PagedResponse; import com.azure.core.http.rest.PagedResponseBase; import com.azure.core.util.CoreUtils; @@ -37,7 +37,7 @@ import java.util.stream.Stream; /** - * Expose transformation methods to transform {@link com.azure.ai.metricsadvisor.models.AnomalyDetectionConfiguration} + * Expose transformation methods to transform {@link AnomalyDetectionConfiguration} * model to REST API wire model and vice-versa. */ public final class DetectionConfigurationTransforms { @@ -175,7 +175,7 @@ public static PagedResponse fromInnerPagedRespons } /** - * Transform {@link com.azure.ai.metricsadvisor.models.AnomalyDetectionConfiguration} to create API wire model. + * Transform {@link AnomalyDetectionConfiguration} to create API wire model. * * @param metricId The metric id. * @param detectionConfiguration The custom model instance. @@ -222,7 +222,7 @@ public static com.azure.ai.metricsadvisor.implementation.models.AnomalyDetection } /** - * Transform {@link com.azure.ai.metricsadvisor.models.AnomalyDetectionConfiguration} to update API wire model. + * Transform {@link AnomalyDetectionConfiguration} to update API wire model. * * @param detectionConfiguration The custom model instance. * @return The wire model instance. diff --git a/sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/implementation/util/HookHelper.java b/sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/implementation/util/HookHelper.java index 26550fdfb7ec5..d276921fe2f70 100644 --- a/sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/implementation/util/HookHelper.java +++ b/sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/implementation/util/HookHelper.java @@ -3,7 +3,7 @@ package com.azure.ai.metricsadvisor.implementation.util; -import com.azure.ai.metricsadvisor.models.NotificationHook; +import com.azure.ai.metricsadvisor.administration.models.NotificationHook; import java.util.List; diff --git a/sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/implementation/util/HookTransforms.java b/sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/implementation/util/HookTransforms.java index 92d0249715d70..f39d20bdf1136 100644 --- a/sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/implementation/util/HookTransforms.java +++ b/sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/implementation/util/HookTransforms.java @@ -13,9 +13,9 @@ import com.azure.ai.metricsadvisor.implementation.models.WebhookHookInfoPatch; import com.azure.ai.metricsadvisor.implementation.models.WebhookHookParameter; import com.azure.ai.metricsadvisor.implementation.models.WebhookHookParameterPatch; -import com.azure.ai.metricsadvisor.models.EmailNotificationHook; -import com.azure.ai.metricsadvisor.models.NotificationHook; -import com.azure.ai.metricsadvisor.models.WebNotificationHook; +import com.azure.ai.metricsadvisor.administration.models.EmailNotificationHook; +import com.azure.ai.metricsadvisor.administration.models.NotificationHook; +import com.azure.ai.metricsadvisor.administration.models.WebNotificationHook; import com.azure.core.http.HttpHeaders; import com.azure.core.http.rest.Page; import com.azure.core.http.rest.PagedResponse; diff --git a/sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/implementation/util/IncidentHelper.java b/sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/implementation/util/IncidentHelper.java index b8f63ef864239..62d9220cabc0e 100644 --- a/sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/implementation/util/IncidentHelper.java +++ b/sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/implementation/util/IncidentHelper.java @@ -4,7 +4,7 @@ package com.azure.ai.metricsadvisor.implementation.util; import com.azure.ai.metricsadvisor.models.AnomalyIncidentStatus; -import com.azure.ai.metricsadvisor.models.AnomalySeverity; +import com.azure.ai.metricsadvisor.administration.models.AnomalySeverity; import com.azure.ai.metricsadvisor.models.DimensionKey; import com.azure.ai.metricsadvisor.models.AnomalyIncident; diff --git a/sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/implementation/util/InfluxDbDataFeedSourceAccessor.java b/sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/implementation/util/InfluxDbDataFeedSourceAccessor.java new file mode 100644 index 0000000000000..a05fb172312fc --- /dev/null +++ b/sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/implementation/util/InfluxDbDataFeedSourceAccessor.java @@ -0,0 +1,35 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +package com.azure.ai.metricsadvisor.implementation.util; + +import com.azure.ai.metricsadvisor.models.InfluxDbDataFeedSource; +import com.azure.ai.metricsadvisor.administration.models.SqlServerDataFeedSource; + +public final class InfluxDbDataFeedSourceAccessor { + private static Accessor accessor; + + private InfluxDbDataFeedSourceAccessor() { + } + + /** + * Type defining the methods to set the non-public properties of + * an {@link SqlServerDataFeedSource} instance. + */ + public interface Accessor { + String getPassword(InfluxDbDataFeedSource feedSource); + } + + /** + * The method called from {@link InfluxDbDataFeedSource} to set it's accessor. + * + * @param accessor The accessor. + */ + public static void setAccessor(final Accessor accessor) { + InfluxDbDataFeedSourceAccessor.accessor = accessor; + } + + public static String getPassword(InfluxDbDataFeedSource feedSource) { + return accessor.getPassword(feedSource); + } +} diff --git a/sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/implementation/util/MetricAnomalyFeedbackHelper.java b/sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/implementation/util/MetricAnomalyFeedbackHelper.java index b9dd1ff646a29..27d9c4773d84b 100644 --- a/sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/implementation/util/MetricAnomalyFeedbackHelper.java +++ b/sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/implementation/util/MetricAnomalyFeedbackHelper.java @@ -3,7 +3,7 @@ package com.azure.ai.metricsadvisor.implementation.util; -import com.azure.ai.metricsadvisor.models.AnomalyDetectionConfiguration; +import com.azure.ai.metricsadvisor.administration.models.AnomalyDetectionConfiguration; import com.azure.ai.metricsadvisor.models.MetricAnomalyFeedback; /** diff --git a/sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/implementation/util/MetricBoundaryConditionHelper.java b/sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/implementation/util/MetricBoundaryConditionHelper.java index dc6612dd0dc9a..3430764f664fe 100644 --- a/sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/implementation/util/MetricBoundaryConditionHelper.java +++ b/sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/implementation/util/MetricBoundaryConditionHelper.java @@ -4,8 +4,8 @@ package com.azure.ai.metricsadvisor.implementation.util; -import com.azure.ai.metricsadvisor.models.BoundaryDirection; -import com.azure.ai.metricsadvisor.models.MetricBoundaryCondition; +import com.azure.ai.metricsadvisor.administration.models.BoundaryDirection; +import com.azure.ai.metricsadvisor.administration.models.MetricBoundaryCondition; /** * The helper class to set the non-public properties of an {@link MetricBoundaryCondition} instance. diff --git a/sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/implementation/util/MongoDbDataFeedSourceAccessor.java b/sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/implementation/util/MongoDbDataFeedSourceAccessor.java new file mode 100644 index 0000000000000..ad592e60df1b9 --- /dev/null +++ b/sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/implementation/util/MongoDbDataFeedSourceAccessor.java @@ -0,0 +1,34 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +package com.azure.ai.metricsadvisor.implementation.util; + +import com.azure.ai.metricsadvisor.administration.models.MongoDbDataFeedSource; + +public final class MongoDbDataFeedSourceAccessor { + private static Accessor accessor; + + private MongoDbDataFeedSourceAccessor() { + } + + /** + * Type defining the methods to set the non-public properties of + * an {@link MongoDbDataFeedSource} instance. + */ + public interface Accessor { + String getConnectionString(MongoDbDataFeedSource feedSource); + } + + /** + * The method called from {@link MongoDbDataFeedSource} to set it's accessor. + * + * @param accessor The accessor. + */ + public static void setAccessor(final Accessor accessor) { + MongoDbDataFeedSourceAccessor.accessor = accessor; + } + + public static String getConnectionString(MongoDbDataFeedSource feedSource) { + return accessor.getConnectionString(feedSource); + } +} diff --git a/sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/implementation/util/MySqlDataFeedSourceAccessor.java b/sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/implementation/util/MySqlDataFeedSourceAccessor.java new file mode 100644 index 0000000000000..88f98b5edc156 --- /dev/null +++ b/sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/implementation/util/MySqlDataFeedSourceAccessor.java @@ -0,0 +1,35 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +package com.azure.ai.metricsadvisor.implementation.util; + +import com.azure.ai.metricsadvisor.administration.models.MySqlDataFeedSource; +import com.azure.ai.metricsadvisor.administration.models.SqlServerDataFeedSource; + +public final class MySqlDataFeedSourceAccessor { + private static Accessor accessor; + + private MySqlDataFeedSourceAccessor() { + } + + /** + * Type defining the methods to set the non-public properties of + * an {@link SqlServerDataFeedSource} instance. + */ + public interface Accessor { + String getConnectionString(MySqlDataFeedSource feedSource); + } + + /** + * The method called from {@link MySqlDataFeedSource} to set it's accessor. + * + * @param accessor The accessor. + */ + public static void setAccessor(final Accessor accessor) { + MySqlDataFeedSourceAccessor.accessor = accessor; + } + + public static String getConnectionString(MySqlDataFeedSource feedSource) { + return accessor.getConnectionString(feedSource); + } +} diff --git a/sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/implementation/util/PostgreSqlDataFeedSourceAccessor.java b/sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/implementation/util/PostgreSqlDataFeedSourceAccessor.java new file mode 100644 index 0000000000000..461d8de16c211 --- /dev/null +++ b/sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/implementation/util/PostgreSqlDataFeedSourceAccessor.java @@ -0,0 +1,34 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +package com.azure.ai.metricsadvisor.implementation.util; + +import com.azure.ai.metricsadvisor.administration.models.PostgreSqlDataFeedSource; + +public final class PostgreSqlDataFeedSourceAccessor { + private static Accessor accessor; + + private PostgreSqlDataFeedSourceAccessor() { + } + + /** + * Type defining the methods to set the non-public properties of + * an {@link PostgreSqlDataFeedSource} instance. + */ + public interface Accessor { + String getConnectionString(PostgreSqlDataFeedSource feedSource); + } + + /** + * The method called from {@link PostgreSqlDataFeedSource} to set it's accessor. + * + * @param accessor The accessor. + */ + public static void setAccessor(final Accessor accessor) { + PostgreSqlDataFeedSourceAccessor.accessor = accessor; + } + + public static String getConnectionString(PostgreSqlDataFeedSource feedSource) { + return accessor.getConnectionString(feedSource); + } +} diff --git a/sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/implementation/util/SqlServerDataFeedSourceAccessor.java b/sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/implementation/util/SqlServerDataFeedSourceAccessor.java new file mode 100644 index 0000000000000..73ec2f6c85d8d --- /dev/null +++ b/sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/implementation/util/SqlServerDataFeedSourceAccessor.java @@ -0,0 +1,34 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +package com.azure.ai.metricsadvisor.implementation.util; + +import com.azure.ai.metricsadvisor.administration.models.SqlServerDataFeedSource; + +public final class SqlServerDataFeedSourceAccessor { + private static Accessor accessor; + + private SqlServerDataFeedSourceAccessor() { + } + + /** + * Type defining the methods to set the non-public properties of + * an {@link SqlServerDataFeedSource} instance. + */ + public interface Accessor { + String getConnectionString(SqlServerDataFeedSource feedSource); + } + + /** + * The method called from {@link SqlServerDataFeedSource} to set it's accessor. + * + * @param accessor The accessor. + */ + public static void setAccessor(final Accessor accessor) { + SqlServerDataFeedSourceAccessor.accessor = accessor; + } + + public static String getConnectionString(SqlServerDataFeedSource feedSource) { + return accessor.getConnectionString(feedSource); + } +} diff --git a/sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/models/AnomalyIncident.java b/sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/models/AnomalyIncident.java index 5eaf76e86218d..62da6421c2181 100644 --- a/sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/models/AnomalyIncident.java +++ b/sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/models/AnomalyIncident.java @@ -3,6 +3,7 @@ package com.azure.ai.metricsadvisor.models; +import com.azure.ai.metricsadvisor.administration.models.AnomalySeverity; import com.azure.ai.metricsadvisor.implementation.util.IncidentHelper; import java.time.OffsetDateTime; @@ -20,8 +21,8 @@ public final class AnomalyIncident { private AnomalyIncidentStatus status; private OffsetDateTime startTime; private OffsetDateTime lastTime; - private Double value; - private Double expectedValue; + private Double valueOfRootNode; + private Double expectedValueOfRootNode; static { IncidentHelper.setAccessor(new IncidentHelper.IncidentAccessor() { @@ -52,12 +53,12 @@ public void setRootDimensionKey(AnomalyIncident incident, DimensionKey rootDimen @Override public void setValue(AnomalyIncident incident, Double value) { - incident.setValue(value); + incident.setValueOfRootNode(value); } @Override public void setExpectedValue(AnomalyIncident incident, Double value) { - incident.setExpectedValue(value); + incident.setExpectedValueOfRootNode(value); } @Override @@ -135,8 +136,8 @@ public DimensionKey getRootDimensionKey() { * * @return The value. */ - public Double getValue() { - return this.value; + public Double getValueOfRootNode() { + return this.valueOfRootNode; } /** @@ -144,8 +145,8 @@ public Double getValue() { * * @return The expected value. */ - public Double getExpectedValue() { - return this.expectedValue; + public Double getExpectedValueOfRootNode() { + return this.expectedValueOfRootNode; } /** @@ -204,12 +205,12 @@ void setRootDimensionKey(DimensionKey rootDimensionKey) { this.rootDimensionKey = rootDimensionKey; } - void setValue(Double value) { - this.value = value; + void setValueOfRootNode(Double valueOfRootNode) { + this.valueOfRootNode = valueOfRootNode; } - void setExpectedValue(Double value) { - this.expectedValue = value; + void setExpectedValueOfRootNode(Double value) { + this.expectedValueOfRootNode = value; } void setSeverity(AnomalySeverity severity) { diff --git a/sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/models/AzureBlobDataFeedSource.java b/sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/models/AzureBlobDataFeedSource.java deleted file mode 100644 index 76c472d6f8dcd..0000000000000 --- a/sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/models/AzureBlobDataFeedSource.java +++ /dev/null @@ -1,71 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -package com.azure.ai.metricsadvisor.models; - -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; - - /** - * Create a AzureBlobDataFeedSource instance. - * - * @param connectionString the Azure Blob connection string - * @param container the container name - * @param blobTemplate the blob template name - */ - public AzureBlobDataFeedSource(final String connectionString, final String container, final String blobTemplate) { - this.connectionString = connectionString; - this.container = container; - this.blobTemplate = blobTemplate; - } - - /** - * Get the Azure Blob connection string. - * - * @return the connectionString value. - */ - public String getConnectionString() { - return this.connectionString; - } - - - /** - * 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; - } - - -} diff --git a/sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/models/AzureDataExplorerDataFeedSource.java b/sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/models/AzureDataExplorerDataFeedSource.java deleted file mode 100644 index e2f5336b0116a..0000000000000 --- a/sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/models/AzureDataExplorerDataFeedSource.java +++ /dev/null @@ -1,53 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -package com.azure.ai.metricsadvisor.models; - -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; - - /** - * Create a AzureDataExplorerDataFeedSource instance. - * - * @param connectionString the database connection string. - * @param query the query script. - */ - public AzureDataExplorerDataFeedSource(final String connectionString, final String query) { - this.connectionString = connectionString; - this.query = query; - } - - /** - * Get the connectionString property: Database connection string. - * - * @return the connectionString value. - */ - public String getConnectionString() { - return this.connectionString; - } - - - /** - * Get the query property: Query script. - * - * @return the query value. - */ - public String getQuery() { - return this.query; - } - -} diff --git a/sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/models/AzureDataLakeStorageGen2DataFeedSource.java b/sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/models/AzureDataLakeStorageGen2DataFeedSource.java deleted file mode 100644 index abcc378b11ff5..0000000000000 --- a/sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/models/AzureDataLakeStorageGen2DataFeedSource.java +++ /dev/null @@ -1,100 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -package com.azure.ai.metricsadvisor.models; - -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; - - /** - * Constructs a AzureDataLakeStorageGen2DataFeedSource object. - * - * @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 directoty template of the storage account. - * @param fileTemplate the file template. - */ - public AzureDataLakeStorageGen2DataFeedSource(final String accountName, final String accountKey, - final String fileSystemName, final String directoryTemplate, final String fileTemplate) { - this.accountName = accountName; - this.accountKey = accountKey; - this.fileSystemName = fileSystemName; - this.directoryTemplate = directoryTemplate; - this.fileTemplate = fileTemplate; - } - - /** - * Get the the account name for the AzureDataLakeStorageGen2DataFeedSource. - * - * @return the accountName value. - */ - public String getAccountName() { - return this.accountName; - } - - /** - * Get the account key value for the AzureDataLakeStorageGen2DataFeedSource. - * - * @return the accountKey value. - */ - public String getAccountKey() { - return this.accountKey; - } - - /** - * 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; - } -} diff --git a/sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/models/AzureLogAnalyticsDataFeedSource.java b/sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/models/AzureLogAnalyticsDataFeedSource.java deleted file mode 100644 index db23a800fd099..0000000000000 --- a/sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/models/AzureLogAnalyticsDataFeedSource.java +++ /dev/null @@ -1,104 +0,0 @@ -// 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.models; - -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; - - /** - * Create a AzureLogAnalyticsDataFeedSource instance. - * - * @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. - */ - public AzureLogAnalyticsDataFeedSource(String tenantId, String clientId, String clientSecret, - String workspaceId, String query) { - this.tenantId = tenantId; - this.clientId = clientId; - this.clientSecret = clientSecret; - this.workspaceId = workspaceId; - this.query = query; - } - - /** - * 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 clientSecret property: The client secret of service principal that have access to this Log Analytics. - * - * @return the clientSecret value. - */ - public String getClientSecret() { - return this.clientSecret; - } - - /** - * 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; - } -} diff --git a/sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/models/BoundaryDirection.java b/sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/models/BoundaryDirection.java deleted file mode 100644 index 4618aecd3662c..0000000000000 --- a/sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/models/BoundaryDirection.java +++ /dev/null @@ -1,22 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -package com.azure.ai.metricsadvisor.models; - -/** - * Describes the direction of boundary used in anomaly boundary conditions. - */ -public enum BoundaryDirection { - /** - * Defines the lower boundary in a boundary condition. - */ - LOWER, - /** - * Defines the upper boundary in a boundary condition. - */ - UPPER, - /** - * Defines both lower and upper boundary in a boundary condition. - */ - BOTH -} diff --git a/sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/models/DataFeedRollupType.java b/sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/models/DataFeedRollupType.java deleted file mode 100644 index 0dc56b2ecedcb..0000000000000 --- a/sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/models/DataFeedRollupType.java +++ /dev/null @@ -1,56 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -package com.azure.ai.metricsadvisor.models; - -/** - * Defines values for LeaseStateType. - */ -public enum DataFeedRollupType { - - /** - * Enum value NoRollup. - */ - NO_ROLLUP("NoRollup"), - - /** - * Enum value NeedRollup. - */ - AUTO_ROLLUP("NeedRollup"), - - /** - * Enum value AlreadyRollup. - */ - ALREADY_ROLLUP("AlreadyRollup"); - - /** - /** - * The actual serialized value for a DataFeedRollupType instance. - */ - private final String value; - - DataFeedRollupType(String value) { - this.value = value; - } - - /** - * Parses a serialized value to a DataFeedRollupType instance. - * - * @param value the serialized value to parse. - * @return the parsed DataFeedRollupType object, or null if unable to parse. - */ - public static DataFeedRollupType fromString(String value) { - DataFeedRollupType[] items = DataFeedRollupType.values(); - for (DataFeedRollupType item : items) { - if (item.toString().equalsIgnoreCase(value)) { - return item; - } - } - return null; - } - - @Override - public String toString() { - return this.value; - } -} diff --git a/sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/models/DataFeedSource.java b/sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/models/DataFeedSource.java deleted file mode 100644 index f8a542a5ad9e4..0000000000000 --- a/sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/models/DataFeedSource.java +++ /dev/null @@ -1,9 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -package com.azure.ai.metricsadvisor.models; - -/** The DataFeedSource model. */ -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/models/DataFeedSourceType.java b/sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/models/DataFeedSourceType.java deleted file mode 100644 index c26e0981ee99a..0000000000000 --- a/sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/models/DataFeedSourceType.java +++ /dev/null @@ -1,116 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -package com.azure.ai.metricsadvisor.models; - -/** - * Defines values for DataFeedSourceType. - */ -public enum DataFeedSourceType { - - /** - * Enum value AzureApplicationInsights. - */ - AZURE_APP_INSIGHTS("AzureApplicationInsights"), - - /** - * Enum value AzureBlob. - */ - AZURE_BLOB("AzureBlob"), - - /** - * Enum value AzureDataExplorer. - */ - AZURE_DATA_EXPLORER("AzureDataExplorer"), - - /** - * Enum value AzureEventHubs. - */ - AZURE_EVENT_HUBS("AzureEventHubs"), - - /** - * Enum value AzureTable. - */ - AZURE_TABLE("AzureTable"), - - /** - * Enum value HttpRequest. - */ - HTTP_REQUEST("HttpRequest"), - - /** - * Enum value InfluxDB. - */ - INFLUX_DB("InfluxDB"), - - /** - * Enum value MongoDB. - */ - MONGO_DB("MongoDB"), - - /** - * Enum value MySql. - */ - MYSQL_DB("MySql"), - - /** - * Enum value PostgreSql. - */ - POSTGRE_SQL_DB("PostgreSql"), - - /** - * Enum value SqlServer. - */ - SQL_SERVER_DB("SqlServer"), - - /** - * Enum value AzureCosmosDB. - */ - AZURE_COSMOS_DB("AzureCosmosDB"), - - /** - * Enum value SqlServer. - */ - ELASTIC_SEARCH("Elasticsearch"), - - /** - * Enum value AzureDataLakeStorageGen2. - */ - AZURE_DATA_LAKE_STORAGE_GEN2("AzureDataLakeStorageGen2"), - - /** - * Enum value AzureLogAnalytics. - */ - AZURE_LOG_ANALYTICS("AzureLogAnalytics"); - - /** - /** - * The actual serialized value for a DataFeedSourceType instance. - */ - private final String value; - - DataFeedSourceType(final String value) { - this.value = value; - } - - /** - * Parses a serialized value to a DataFeedSourceType instance. - * - * @param value the serialized value to parse. - * @return the parsed DataFeedSourceType object, or null if unable to parse. - */ - public static DataFeedSourceType fromString(final String value) { - final DataFeedSourceType[] items = DataFeedSourceType.values(); - for (final DataFeedSourceType item : items) { - if (item.toString().equalsIgnoreCase(value)) { - return item; - } - } - return null; - } - - @Override - public String toString() { - return this.value; - } -} diff --git a/sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/models/DataPointAnomaly.java b/sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/models/DataPointAnomaly.java index 59d061aa8f28b..a45bebf213642 100644 --- a/sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/models/DataPointAnomaly.java +++ b/sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/models/DataPointAnomaly.java @@ -3,6 +3,7 @@ package com.azure.ai.metricsadvisor.models; +import com.azure.ai.metricsadvisor.administration.models.AnomalySeverity; import com.azure.ai.metricsadvisor.implementation.util.AnomalyHelper; import java.time.OffsetDateTime; diff --git a/sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/models/DimensionKey.java b/sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/models/DimensionKey.java index 2d3626e173652..29ede8fc8fee3 100644 --- a/sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/models/DimensionKey.java +++ b/sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/models/DimensionKey.java @@ -3,6 +3,8 @@ package com.azure.ai.metricsadvisor.models; +import com.azure.ai.metricsadvisor.administration.models.DataFeedSchema; + import java.util.HashMap; import java.util.Iterator; import java.util.Map; @@ -67,6 +69,16 @@ public DimensionKey put(String dimensionName, String dimensionValue) { return this; } + /** + * Gets dimension value for the given {@code dimensionName}. + * + * @param dimensionName The dimension name. + * @return The dimension value if exists, {@code null} otherwise. + */ + public String get(String dimensionName) { + return this.dimensions.get(dimensionName); + } + /** * Removes a dimension name-value from the key. * diff --git a/sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/models/ElasticsearchDataFeedSource.java b/sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/models/ElasticsearchDataFeedSource.java deleted file mode 100644 index 5dc57cda515a2..0000000000000 --- a/sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/models/ElasticsearchDataFeedSource.java +++ /dev/null @@ -1,84 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -package com.azure.ai.metricsadvisor.models; - -import com.azure.core.annotation.Immutable; - -/** - * The ElasticsearchDataFeedSource model. - */ -@Immutable -public final class ElasticsearchDataFeedSource extends DataFeedSource { - /* - * Host - */ - private final String host; - - /* - * Port - */ - private final String port; - - /* - * Authorization header - */ - private final String authHeader; - - /* - * Query - */ - private final String query; - - /** - * Construct a ElasticsearchDataFeedSource instance. - * - * @param host the host for data source. - * @param port the port data source. - * @param authHeader the auth header for data source. - * @param query the query. - */ - public ElasticsearchDataFeedSource(final String host, final String port, final String authHeader, - final String query) { - this.host = host; - this.port = port; - this.authHeader = authHeader; - this.query = query; - } - - /** - * Get the host value for the Elasticsearch. - * - * @return the host value. - */ - public String getHost() { - return this.host; - } - - /** - * Get the port for the Elasticsearch. - * - * @return the port value. - */ - public String getPort() { - return this.port; - } - - /** - * Get the authorization header. - * - * @return the authHeader value. - */ - public String getAuthHeader() { - return this.authHeader; - } - - /** - * Get the query value. - * - * @return the query value. - */ - public String getQuery() { - return this.query; - } -} diff --git a/sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/models/HttpRequestDataFeedSource.java b/sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/models/HttpRequestDataFeedSource.java deleted file mode 100644 index 5a39d412497ba..0000000000000 --- a/sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/models/HttpRequestDataFeedSource.java +++ /dev/null @@ -1,101 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -package com.azure.ai.metricsadvisor.models; - -import com.azure.core.annotation.Fluent; - -/** - * The HttpRequestDataFeedSource model. - */ -@Fluent -public final class HttpRequestDataFeedSource extends DataFeedSource { - - /* - * HTTP URL - */ - private final String url; - - /* - * HTTP header - */ - private String httpHeader; - - /* - * HTTP method - */ - private final String httpMethod; - - /* - * HTTP request body - */ - private String payload; - - /** - * Create a HttpRequestDataFeedSource instance. - * @param url the HTTP url. - * @param httpMethod the HTTP method. - */ - public HttpRequestDataFeedSource(final String url, final String httpMethod) { - this.url = url; - this.httpMethod = httpMethod; - } - - /** - * Get the url property: HTTP URL. - * - * @return the url value. - */ - public String getUrl() { - return this.url; - } - - /** - * Get the httpHeader property: HTTP header. - * - * @return the httpHeader value. - */ - public String getHttpHeader() { - return this.httpHeader; - } - - /** - * Get the httpMethod property: HTTP method. - * - * @return the httpMethod value. - */ - public String getHttpMethod() { - return this.httpMethod; - } - - /** - * Get the payload property: HTTP request body. - * - * @return the payload value. - */ - public String getPayload() { - return this.payload; - } - - /** - * Set the httpHeader property: HTTP header. - * - * @param httpHeader the httpHeader value to set. - * @return the HttpRequestDataFeedSource object itself. - */ - public HttpRequestDataFeedSource setHttpHeader(String httpHeader) { - this.httpHeader = httpHeader; - return this; - } - - /** - * Set the payload property: HTTP reuqest body. - * - * @param payload the payload value to set. - * @return the HttpRequestDataFeedSource object itself. - */ - public HttpRequestDataFeedSource setPayload(String payload) { - this.payload = payload; - return this; - } -} diff --git a/sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/models/InfluxDBDataFeedSource.java b/sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/models/InfluxDbDataFeedSource.java similarity index 69% rename from sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/models/InfluxDBDataFeedSource.java rename to sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/models/InfluxDbDataFeedSource.java index 6692eca9ff5a8..d2416ce6af5f2 100644 --- a/sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/models/InfluxDBDataFeedSource.java +++ b/sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/models/InfluxDbDataFeedSource.java @@ -3,13 +3,15 @@ package com.azure.ai.metricsadvisor.models; +import com.azure.ai.metricsadvisor.administration.models.DataFeedSource; +import com.azure.ai.metricsadvisor.implementation.util.InfluxDbDataFeedSourceAccessor; import com.azure.core.annotation.Immutable; /** - * The InfluxDBDataFeedSource model. + * The InfluxDbDataFeedSource model. */ @Immutable -public final class InfluxDBDataFeedSource extends DataFeedSource { +public final class InfluxDbDataFeedSource extends DataFeedSource { /* * InfluxDB connection string */ @@ -35,8 +37,18 @@ public final class InfluxDBDataFeedSource extends DataFeedSource { */ private final String query; + static { + InfluxDbDataFeedSourceAccessor.setAccessor( + new InfluxDbDataFeedSourceAccessor.Accessor() { + @Override + public String getPassword(InfluxDbDataFeedSource feedSource) { + return feedSource.getPassword(); + } + }); + } + /** - * Create a InfluxDBDataFeedSource instance. + * Create a InfluxDbDataFeedSource instance. * * @param connectionString InfluxDB connection string * @param database the database name. @@ -44,9 +56,9 @@ public final class InfluxDBDataFeedSource extends DataFeedSource { * @param password the database access password. * @param query the query value. */ - public InfluxDBDataFeedSource(final String connectionString, final String database, final String userName, - final String password, - final String query) { + public InfluxDbDataFeedSource(final String connectionString, final String database, final String userName, + final String password, + final String query) { this.connectionString = connectionString; this.database = database; this.userName = userName; @@ -82,17 +94,6 @@ public String getUserName() { return this.userName; } - - /** - * Get the password property: Database access password. - * - * @return the password value. - */ - public String getPassword() { - return this.password; - } - - /** * Get the query property: Query script. * @@ -102,5 +103,7 @@ public String getQuery() { return this.query; } - + private String getPassword() { + return this.password; + } } diff --git a/sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/models/ListAlertOptions.java b/sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/models/ListAlertOptions.java index 048e2cf31aff9..388adbd4147a7 100644 --- a/sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/models/ListAlertOptions.java +++ b/sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/models/ListAlertOptions.java @@ -3,9 +3,12 @@ package com.azure.ai.metricsadvisor.models; +import com.azure.core.annotation.Fluent; + /** * Describes the additional parameters for the API to list the alerts triggered. */ +@Fluent public final class ListAlertOptions { private Integer maxPageSize; private Integer skip; diff --git a/sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/models/ListAnomaliesAlertedOptions.java b/sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/models/ListAnomaliesAlertedOptions.java index 801b62d27d2bb..0d10486e2c31c 100644 --- a/sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/models/ListAnomaliesAlertedOptions.java +++ b/sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/models/ListAnomaliesAlertedOptions.java @@ -3,9 +3,12 @@ package com.azure.ai.metricsadvisor.models; +import com.azure.core.annotation.Fluent; + /** * Describes the additional parameters for the API to list anomalies in an alert. */ +@Fluent public final class ListAnomaliesAlertedOptions { private Integer maxPageSize; private Integer skip; diff --git a/sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/models/ListAnomaliesDetectedFilter.java b/sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/models/ListAnomaliesDetectedFilter.java index 0222ea5c723e7..f8365a306b59e 100644 --- a/sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/models/ListAnomaliesDetectedFilter.java +++ b/sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/models/ListAnomaliesDetectedFilter.java @@ -3,11 +3,15 @@ package com.azure.ai.metricsadvisor.models; +import com.azure.ai.metricsadvisor.administration.models.AnomalySeverity; +import com.azure.core.annotation.Fluent; + import java.util.List; /** * Describes additional conditions to filter the anomalies while listing. */ +@Fluent public final class ListAnomaliesDetectedFilter { private AnomalySeverity minSeverity; private AnomalySeverity maxSeverity; diff --git a/sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/models/ListAnomaliesDetectedOptions.java b/sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/models/ListAnomaliesDetectedOptions.java index a5d7ae2339fff..d5d59223a64df 100644 --- a/sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/models/ListAnomaliesDetectedOptions.java +++ b/sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/models/ListAnomaliesDetectedOptions.java @@ -3,9 +3,12 @@ package com.azure.ai.metricsadvisor.models; +import com.azure.core.annotation.Fluent; + /** * Describes the additional parameters for the API to list anomalies detected. */ +@Fluent public final class ListAnomaliesDetectedOptions { private Integer maxPageSize; private Integer skip; diff --git a/sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/models/ListAnomalyDimensionValuesOptions.java b/sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/models/ListAnomalyDimensionValuesOptions.java index b6ad61d7b9071..e2c73b5bcd84f 100644 --- a/sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/models/ListAnomalyDimensionValuesOptions.java +++ b/sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/models/ListAnomalyDimensionValuesOptions.java @@ -3,9 +3,12 @@ package com.azure.ai.metricsadvisor.models; +import com.azure.core.annotation.Fluent; + /** * Describes the additional parameters for the API to list values of a dimension that have anomalies. */ +@Fluent public final class ListAnomalyDimensionValuesOptions { private Integer maxPageSize; private Integer skip; diff --git a/sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/models/ListIncidentsAlertedOptions.java b/sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/models/ListIncidentsAlertedOptions.java index f41940700838a..c6b43559b3c92 100644 --- a/sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/models/ListIncidentsAlertedOptions.java +++ b/sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/models/ListIncidentsAlertedOptions.java @@ -3,9 +3,12 @@ package com.azure.ai.metricsadvisor.models; +import com.azure.core.annotation.Fluent; + /** * Describes the additional parameters for the API to list incidents in an alert. */ +@Fluent public final class ListIncidentsAlertedOptions { private Integer maxPageSize; private Integer skip; diff --git a/sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/models/ListIncidentsDetectedOptions.java b/sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/models/ListIncidentsDetectedOptions.java index 122f74b98cb29..affa1d65aa6d4 100644 --- a/sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/models/ListIncidentsDetectedOptions.java +++ b/sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/models/ListIncidentsDetectedOptions.java @@ -3,11 +3,14 @@ package com.azure.ai.metricsadvisor.models; +import com.azure.core.annotation.Fluent; + import java.util.List; /** * Describes the additional parameters for the API to list incidents detected. */ +@Fluent public final class ListIncidentsDetectedOptions { private Integer maxPageSize; private List dimensionsToFilter; diff --git a/sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/models/MetricAnomalyFeedback.java b/sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/models/MetricAnomalyFeedback.java index 46162f1e7adb6..d6d9deebc4f20 100644 --- a/sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/models/MetricAnomalyFeedback.java +++ b/sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/models/MetricAnomalyFeedback.java @@ -3,13 +3,14 @@ package com.azure.ai.metricsadvisor.models; +import com.azure.ai.metricsadvisor.administration.models.AnomalyDetectionConfiguration; import com.azure.ai.metricsadvisor.implementation.util.MetricAnomalyFeedbackHelper; import com.azure.core.annotation.Fluent; import java.time.OffsetDateTime; /** - * The MetricAnomalyFeedback class. + * A feedback to indicate a set of data points as Anomaly or NotAnomaly. */ @Fluent public final class MetricAnomalyFeedback extends MetricFeedback { @@ -94,6 +95,19 @@ public MetricAnomalyFeedback setDetectionConfigurationId( return this; } + /** + * Set the series keys value for the feedback. + * + * @param dimensionFilter the dimensionFilter value to set. + * + * @return the MetricAnomalyFeedback object itself. + */ + @Override + public MetricAnomalyFeedback setDimensionFilter(final DimensionKey dimensionFilter) { + super.setDimensionFilter(dimensionFilter); + return this; + } + /** * Get the corresponding anomaly detection configuration Id of this * feedback. diff --git a/sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/models/MetricChangePointFeedback.java b/sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/models/MetricChangePointFeedback.java index b5faf24abf2c4..1bac75b32a03f 100644 --- a/sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/models/MetricChangePointFeedback.java +++ b/sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/models/MetricChangePointFeedback.java @@ -3,14 +3,15 @@ package com.azure.ai.metricsadvisor.models; -import com.azure.core.annotation.Immutable; +import com.azure.core.annotation.Fluent; import java.time.OffsetDateTime; /** - * The MetricChangePointFeedback class. + * The Feedback that allows the user to mark the exact change point when the time series has + * a trend change. This helps the anomaly detector in future analysis. */ -@Immutable +@Fluent public final class MetricChangePointFeedback extends MetricFeedback { private final OffsetDateTime startTime; private final OffsetDateTime endTime; @@ -32,6 +33,19 @@ public MetricChangePointFeedback(OffsetDateTime startTime, this.changePointValue = changePointValue; } + /** + * Set the series keys value for the feedback. + * + * @param dimensionFilter the dimensionFilter value to set. + * + * @return the MetricChangePointFeedback object itself. + */ + @Override + public MetricChangePointFeedback setDimensionFilter(final DimensionKey dimensionFilter) { + super.setDimensionFilter(dimensionFilter); + return this; + } + /** * Get the change point feedback value. * diff --git a/sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/models/MetricCommentFeedback.java b/sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/models/MetricCommentFeedback.java index bc361dba6c2a6..cddb9d398f36d 100644 --- a/sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/models/MetricCommentFeedback.java +++ b/sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/models/MetricCommentFeedback.java @@ -3,14 +3,15 @@ package com.azure.ai.metricsadvisor.models; -import com.azure.core.annotation.Immutable; +import com.azure.core.annotation.Fluent; import java.time.OffsetDateTime; /** - * The MetricCommentFeedback class. + * The feedback that allows adding comments in plain text providing more + * context about the data. */ -@Immutable +@Fluent public final class MetricCommentFeedback extends MetricFeedback { private final OffsetDateTime startTime; private final OffsetDateTime endTime; @@ -32,6 +33,19 @@ public MetricCommentFeedback(OffsetDateTime startTime, this.comment = comment; } + /** + * Set the series keys value for the feedback. + * + * @param dimensionFilter the dimensionFilter value to set. + * + * @return the MetricCommentFeedback object itself. + */ + @Override + public MetricCommentFeedback setDimensionFilter(final DimensionKey dimensionFilter) { + super.setDimensionFilter(dimensionFilter); + return this; + } + /** * Get the comment value. * diff --git a/sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/models/MetricFeedback.java b/sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/models/MetricFeedback.java index 7e2a8dee292f0..653fa51ba12bb 100644 --- a/sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/models/MetricFeedback.java +++ b/sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/models/MetricFeedback.java @@ -4,12 +4,22 @@ package com.azure.ai.metricsadvisor.models; import com.azure.ai.metricsadvisor.implementation.util.MetricFeedbackHelper; +import com.azure.core.annotation.Fluent; import java.time.OffsetDateTime; /** - * The abstract MetricFeedback class. + * Users can submit various feedback for the anomaly detection that the service + * performed. The {@link MetricFeedback} represents the base type for different + * feedback. The feedback will be applied for the future anomaly detection + * processing of the same time series. + * + * @see MetricAnomalyFeedback + * @see MetricChangePointFeedback + * @see MetricCommentFeedback + * @see MetricPeriodFeedback */ +@Fluent public abstract class MetricFeedback { private String id; private String metricId; diff --git a/sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/models/MetricPeriodFeedback.java b/sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/models/MetricPeriodFeedback.java index 866d10bea00eb..9eb6572880dcb 100644 --- a/sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/models/MetricPeriodFeedback.java +++ b/sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/models/MetricPeriodFeedback.java @@ -3,12 +3,13 @@ package com.azure.ai.metricsadvisor.models; -import com.azure.core.annotation.Immutable; +import com.azure.core.annotation.Fluent; /** - * The MetricPeriodFeedback model. + * The Feedback that helps the service in estimating period(seasonality) + * of the time series. */ -@Immutable +@Fluent public final class MetricPeriodFeedback extends MetricFeedback { private final PeriodType periodType; private final int periodValue; @@ -25,6 +26,19 @@ public MetricPeriodFeedback(PeriodType periodType, this.periodValue = periodValue; } + /** + * Set the series keys value for the feedback. + * + * @param dimensionFilter the dimensionFilter value to set. + * + * @return the MetricPeriodFeedback object itself. + */ + @Override + public MetricPeriodFeedback setDimensionFilter(final DimensionKey dimensionFilter) { + super.setDimensionFilter(dimensionFilter); + return this; + } + /** * Get the type of setting period. * diff --git a/sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/models/ErrorCode.java b/sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/models/MetricsAdvisorError.java similarity index 80% rename from sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/models/ErrorCode.java rename to sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/models/MetricsAdvisorError.java index e91792d487e58..1c3c134a9610e 100644 --- a/sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/models/ErrorCode.java +++ b/sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/models/MetricsAdvisorError.java @@ -7,9 +7,9 @@ import com.azure.core.annotation.Fluent; import com.fasterxml.jackson.annotation.JsonProperty; -/** The ErrorCode model. */ +/** The MetricsAdvisorError model. */ @Fluent -public final class ErrorCode { +public final class MetricsAdvisorError { /* * The message property. */ @@ -35,9 +35,9 @@ public String getMessage() { * Set the message property: The message property. * * @param message the message value to set. - * @return the ErrorCode object itself. + * @return the MetricsAdvisorError object itself. */ - public ErrorCode setMessage(String message) { + public MetricsAdvisorError setMessage(String message) { this.message = message; return this; } @@ -55,9 +55,9 @@ public String getCode() { * Set the code property: The code property. * * @param code the code value to set. - * @return the ErrorCode object itself. + * @return the MetricsAdvisorError object itself. */ - public ErrorCode setCode(String code) { + public MetricsAdvisorError setCode(String code) { this.code = code; return this; } diff --git a/sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/models/MetricsAdvisorKeyCredential.java b/sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/models/MetricsAdvisorKeyCredential.java index 11560091de54a..37a5e3c2f4a65 100644 --- a/sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/models/MetricsAdvisorKeyCredential.java +++ b/sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/models/MetricsAdvisorKeyCredential.java @@ -3,12 +3,15 @@ package com.azure.ai.metricsadvisor.models; +import com.azure.core.annotation.Fluent; + /** * The MetricsAdvisorKeyCredential class. */ +@Fluent public final class MetricsAdvisorKeyCredential { - private volatile String subscriptionKey; - private volatile String apiKey; + private volatile MetricsAdvisorKeys keys; + private final Object updateLock = new Object(); /** * Creates a MetricsAdvisorKeyCredential credential that authorizes request with the given keys. @@ -17,54 +20,33 @@ public final class MetricsAdvisorKeyCredential { * @param apiKey the api key used to authorize requests */ public MetricsAdvisorKeyCredential(String subscriptionKey, String apiKey) { - this.subscriptionKey = subscriptionKey; - this.apiKey = apiKey; - } - - /** - * Retrieves the subscription key associated to this credential. - * - * @return The subscription key being used to authorize requests. - */ - public String getSubscriptionKey() { - return this.subscriptionKey; + this.keys = new MetricsAdvisorKeys(subscriptionKey, apiKey); } /** - * Retrieves the api key associated to this credential. + * Retrieves the {@link MetricsAdvisorKeys} containing the subscription key and api key + * associated with this credential. * - * @return The api key being used to authorize requests. + * @return The {@link MetricsAdvisorKeys} containing the subscription key and api key. */ - public String getApiKey() { - return this.apiKey; + public MetricsAdvisorKeys getKeys() { + return this.keys; } /** - * Rotates the subscription key associated to this credential. + * Update the subscription and api key associated to this credential. *

- * This is intended to be used when you've regenerated your subscription key and want to - * update long lived clients. + * This is intended to be used when you've regenerated your subscription key and + * api key want to update long lived clients. *

* @param subscriptionKey The new subscription key to associated with this credential. - * @return The updated {@code MetricsAdvisorKeyCredential} object. - */ - public MetricsAdvisorKeyCredential updateSubscriptionKey(String subscriptionKey) { - this.subscriptionKey = subscriptionKey; - return this; - } - - /** - * Rotates the api key associated to this credential. - *

- * This is intended to be used when you've regenerated your api key and want to - * update long lived clients. - *

- * * @param apiKey The new api key to associated with this credential. * @return The updated {@code MetricsAdvisorKeyCredential} object. */ - public MetricsAdvisorKeyCredential updateApiKey(String apiKey) { - this.apiKey = apiKey; + public MetricsAdvisorKeyCredential updateKey(String subscriptionKey, String apiKey) { + synchronized (this.updateLock) { + this.keys = new MetricsAdvisorKeys(subscriptionKey, apiKey); + } return this; } } diff --git a/sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/models/MetricsAdvisorKeys.java b/sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/models/MetricsAdvisorKeys.java new file mode 100644 index 0000000000000..933456534681b --- /dev/null +++ b/sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/models/MetricsAdvisorKeys.java @@ -0,0 +1,40 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +package com.azure.ai.metricsadvisor.models; + +import com.azure.core.annotation.Immutable; + +/** + * Represents a credential bag containing the subscription key and api key. + * + * @see MetricsAdvisorKeyCredential + */ +@Immutable +public final class MetricsAdvisorKeys { + private final String subscriptionKey; + private final String apiKey; + + MetricsAdvisorKeys(String subscriptionKey, String apiKey) { + this.subscriptionKey = subscriptionKey; + this.apiKey = apiKey; + } + + /** + * Retrieves the subscription key. + * + * @return The subscription key. + */ + public String getSubscriptionKey() { + return this.subscriptionKey; + } + + /** + * Retrieves the api key. + * + * @return The api key. + */ + public String getApiKey() { + return this.apiKey; + } +} diff --git a/sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/models/ErrorCodeException.java b/sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/models/MetricsAdvisorResponseException.java similarity index 61% rename from sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/models/ErrorCodeException.java rename to sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/models/MetricsAdvisorResponseException.java index e8aed79f5cc81..d778fb2f395d1 100644 --- a/sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/models/ErrorCodeException.java +++ b/sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/models/MetricsAdvisorResponseException.java @@ -8,30 +8,30 @@ import com.azure.core.http.HttpResponse; /** Exception thrown for an invalid response with ErrorCode information. */ -public final class ErrorCodeException extends HttpResponseException { +public final class MetricsAdvisorResponseException extends HttpResponseException { /** - * Initializes a new instance of the ErrorCodeException class. + * Initializes a new instance of the MetricsAdvisorResponseException class. * * @param message the exception message or the response content if a message is not available. * @param response the HTTP response. */ - public ErrorCodeException(String message, HttpResponse response) { + public MetricsAdvisorResponseException(String message, HttpResponse response) { super(message, response); } /** - * Initializes a new instance of the ErrorCodeException class. + * Initializes a new instance of the MetricsAdvisorResponseException class. * * @param message the exception message or the response content if a message is not available. * @param response the HTTP response. * @param value the deserialized response value. */ - public ErrorCodeException(String message, HttpResponse response, ErrorCode value) { + public MetricsAdvisorResponseException(String message, HttpResponse response, MetricsAdvisorError value) { super(message, response, value); } @Override - public ErrorCode getValue() { - return (ErrorCode) super.getValue(); + public MetricsAdvisorError getValue() { + return (MetricsAdvisorError) super.getValue(); } } diff --git a/sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/models/SQLServerDataFeedSource.java b/sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/models/SQLServerDataFeedSource.java deleted file mode 100644 index cd08acb7f8411..0000000000000 --- a/sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/models/SQLServerDataFeedSource.java +++ /dev/null @@ -1,54 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -package com.azure.ai.metricsadvisor.models; - -import com.azure.core.annotation.Immutable; - -/** - * The SQLServerDataFeedSource model. - */ -@Immutable -public final class SQLServerDataFeedSource extends DataFeedSource { - /* - * Database connection string - */ - private final String connectionString; - - /* - * Query script - */ - private final String query; - - /** - * Create a SQLServerDataFeedSource instance - * - * @param connectionString the database connection string. - * @param query the query value. - */ - public SQLServerDataFeedSource(final String connectionString, final String query) { - this.connectionString = connectionString; - this.query = query; - } - - /** - * Get the connectionString property: Database connection string. - * - * @return the connectionString value. - */ - public String getConnectionString() { - return this.connectionString; - } - - - /** - * Get the query property: Query script. - * - * @return the query value. - */ - public String getQuery() { - return this.query; - } - - -} diff --git a/sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/models/SingleBoundaryDirection.java b/sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/models/SingleBoundaryDirection.java deleted file mode 100644 index f82503553f8a6..0000000000000 --- a/sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/models/SingleBoundaryDirection.java +++ /dev/null @@ -1,18 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -package com.azure.ai.metricsadvisor.models; - -/** - * Defines values for SingleBoundaryDirection. - */ -public enum SingleBoundaryDirection { - /** - * Enum value lower boundary. - */ - LOWER, - /** - * Enum value upper boundary. - */ - UPPER -} diff --git a/sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/module-info.java b/sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/module-info.java index 1257368814eb4..1c53ff113d938 100644 --- a/sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/module-info.java +++ b/sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/module-info.java @@ -7,8 +7,10 @@ exports com.azure.ai.metricsadvisor; exports com.azure.ai.metricsadvisor.models; exports com.azure.ai.metricsadvisor.administration; + exports com.azure.ai.metricsadvisor.administration.models; opens com.azure.ai.metricsadvisor.implementation to com.fasterxml.jackson.databind; + opens com.azure.ai.metricsadvisor.administration.models to com.fasterxml.jackson.databind; opens com.azure.ai.metricsadvisor.models to com.fasterxml.jackson.databind; opens com.azure.ai.metricsadvisor.implementation.models to com.fasterxml.jackson.databind, com.azure.core; } diff --git a/sdk/metricsadvisor/azure-ai-metricsadvisor/src/samples/java/com/azure/ai/metricsadvisor/ListEnrichedSeriesAsyncSample.java b/sdk/metricsadvisor/azure-ai-metricsadvisor/src/samples/java/com/azure/ai/metricsadvisor/ListEnrichedSeriesAsyncSample.java index c7643650b84b0..142d08a3ff779 100644 --- a/sdk/metricsadvisor/azure-ai-metricsadvisor/src/samples/java/com/azure/ai/metricsadvisor/ListEnrichedSeriesAsyncSample.java +++ b/sdk/metricsadvisor/azure-ai-metricsadvisor/src/samples/java/com/azure/ai/metricsadvisor/ListEnrichedSeriesAsyncSample.java @@ -30,8 +30,8 @@ public static void main(String[] args) { final OffsetDateTime endTime = OffsetDateTime.parse("2020-09-12T00:00:00Z"); PagedFlux enrichedDataFlux - = advisorAsyncClient.listMetricEnrichedSeriesData(Arrays.asList(seriesKey), - detectionConfigurationId, + = advisorAsyncClient.listMetricEnrichedSeriesData(detectionConfigurationId, + Arrays.asList(seriesKey), startTime, endTime); diff --git a/sdk/metricsadvisor/azure-ai-metricsadvisor/src/samples/java/com/azure/ai/metricsadvisor/ListEnrichedSeriesSample.java b/sdk/metricsadvisor/azure-ai-metricsadvisor/src/samples/java/com/azure/ai/metricsadvisor/ListEnrichedSeriesSample.java index b13a51554f189..aef0f8859f730 100644 --- a/sdk/metricsadvisor/azure-ai-metricsadvisor/src/samples/java/com/azure/ai/metricsadvisor/ListEnrichedSeriesSample.java +++ b/sdk/metricsadvisor/azure-ai-metricsadvisor/src/samples/java/com/azure/ai/metricsadvisor/ListEnrichedSeriesSample.java @@ -30,8 +30,8 @@ public static void main(String[] args) { final OffsetDateTime endTime = OffsetDateTime.parse("2020-09-12T00:00:00Z"); PagedIterable enrichedDataIterable - = advisorClient.listMetricEnrichedSeriesData(Arrays.asList(seriesKey), - detectionConfigurationId, + = advisorClient.listMetricEnrichedSeriesData(detectionConfigurationId, + Arrays.asList(seriesKey), startTime, endTime); diff --git a/sdk/metricsadvisor/azure-ai-metricsadvisor/src/samples/java/com/azure/ai/metricsadvisor/ListIncidentsAlertedAsyncSample.java b/sdk/metricsadvisor/azure-ai-metricsadvisor/src/samples/java/com/azure/ai/metricsadvisor/ListIncidentsAlertedAsyncSample.java index 90fa4d81dde05..2e12585da3d91 100644 --- a/sdk/metricsadvisor/azure-ai-metricsadvisor/src/samples/java/com/azure/ai/metricsadvisor/ListIncidentsAlertedAsyncSample.java +++ b/sdk/metricsadvisor/azure-ai-metricsadvisor/src/samples/java/com/azure/ai/metricsadvisor/ListIncidentsAlertedAsyncSample.java @@ -24,7 +24,7 @@ public static void main(String[] args) { final ListIncidentsAlertedOptions options = new ListIncidentsAlertedOptions() .setMaxPageSize(10); - PagedFlux incidentsPagedFlux = advisorAsyncClient.listIncidentsForAlert( + PagedFlux incidentsPagedFlux = advisorAsyncClient.listIncidents( alertConfigurationId, alertId, options); diff --git a/sdk/metricsadvisor/azure-ai-metricsadvisor/src/samples/java/com/azure/ai/metricsadvisor/ListIncidentsAlertedSample.java b/sdk/metricsadvisor/azure-ai-metricsadvisor/src/samples/java/com/azure/ai/metricsadvisor/ListIncidentsAlertedSample.java index 250e37caf1c99..99b348db60180 100644 --- a/sdk/metricsadvisor/azure-ai-metricsadvisor/src/samples/java/com/azure/ai/metricsadvisor/ListIncidentsAlertedSample.java +++ b/sdk/metricsadvisor/azure-ai-metricsadvisor/src/samples/java/com/azure/ai/metricsadvisor/ListIncidentsAlertedSample.java @@ -7,6 +7,7 @@ import com.azure.ai.metricsadvisor.models.ListIncidentsAlertedOptions; import com.azure.ai.metricsadvisor.models.MetricsAdvisorKeyCredential; import com.azure.core.http.rest.PagedIterable; +import com.azure.core.util.Context; /** * Sample demonstrates how to list incidents in an alert. @@ -24,10 +25,11 @@ public static void main(String[] args) { final ListIncidentsAlertedOptions options = new ListIncidentsAlertedOptions() .setMaxPageSize(10); - PagedIterable incidentsIterable = advisorClient.listIncidentsForAlert( + PagedIterable incidentsIterable = advisorClient.listIncidents( alertConfigurationId, alertId, - options); + options, + Context.NONE); for (AnomalyIncident anomalyIncident : incidentsIterable) { System.out.printf("DataFeedMetric Id: %s%n", anomalyIncident.getMetricId()); diff --git a/sdk/metricsadvisor/azure-ai-metricsadvisor/src/samples/java/com/azure/ai/metricsadvisor/ListIncidentsDetectedAsyncSample.java b/sdk/metricsadvisor/azure-ai-metricsadvisor/src/samples/java/com/azure/ai/metricsadvisor/ListIncidentsDetectedAsyncSample.java index f8f2a86bb776c..3c78bb3b5fc62 100644 --- a/sdk/metricsadvisor/azure-ai-metricsadvisor/src/samples/java/com/azure/ai/metricsadvisor/ListIncidentsDetectedAsyncSample.java +++ b/sdk/metricsadvisor/azure-ai-metricsadvisor/src/samples/java/com/azure/ai/metricsadvisor/ListIncidentsDetectedAsyncSample.java @@ -28,7 +28,7 @@ public static void main(String[] args) { .setMaxPageSize(1000); PagedFlux incidentsFlux - = advisorAsyncClient.listIncidentsForDetectionConfig(detectionConfigurationId, startTime, endTime, options); + = advisorAsyncClient.listIncidents(detectionConfigurationId, startTime, endTime, options); incidentsFlux.doOnNext(incident -> { System.out.printf("Data Feed Metric Id: %s%n", incident.getMetricId()); diff --git a/sdk/metricsadvisor/azure-ai-metricsadvisor/src/samples/java/com/azure/ai/metricsadvisor/ListIncidentsDetectedSample.java b/sdk/metricsadvisor/azure-ai-metricsadvisor/src/samples/java/com/azure/ai/metricsadvisor/ListIncidentsDetectedSample.java index 6a2f001e81b04..7103f8469bacc 100644 --- a/sdk/metricsadvisor/azure-ai-metricsadvisor/src/samples/java/com/azure/ai/metricsadvisor/ListIncidentsDetectedSample.java +++ b/sdk/metricsadvisor/azure-ai-metricsadvisor/src/samples/java/com/azure/ai/metricsadvisor/ListIncidentsDetectedSample.java @@ -29,7 +29,7 @@ public static void main(String[] args) { .setMaxPageSize(1000); PagedIterable incidentsIterable - = advisorClient.listIncidentsForDetectionConfig(detectionConfigurationId, startTime, endTime, options, + = advisorClient.listIncidents(detectionConfigurationId, startTime, endTime, options, Context.NONE); for (AnomalyIncident anomalyIncident : incidentsIterable) { diff --git a/sdk/metricsadvisor/azure-ai-metricsadvisor/src/samples/java/com/azure/ai/metricsadvisor/ListsAnomaliesForAlertsAsyncSample.java b/sdk/metricsadvisor/azure-ai-metricsadvisor/src/samples/java/com/azure/ai/metricsadvisor/ListsAnomaliesForAlertsAsyncSample.java index 51a808caad092..534e09c52cedd 100644 --- a/sdk/metricsadvisor/azure-ai-metricsadvisor/src/samples/java/com/azure/ai/metricsadvisor/ListsAnomaliesForAlertsAsyncSample.java +++ b/sdk/metricsadvisor/azure-ai-metricsadvisor/src/samples/java/com/azure/ai/metricsadvisor/ListsAnomaliesForAlertsAsyncSample.java @@ -21,7 +21,7 @@ public static void main(String[] args) { final String alertId = "1746b031c00"; final ListAnomaliesAlertedOptions options = new ListAnomaliesAlertedOptions() .setMaxPageSize(10); - advisorAsyncClient.listAnomaliesForAlert( + advisorAsyncClient.listAnomalies( alertConfigurationId, alertId, options) diff --git a/sdk/metricsadvisor/azure-ai-metricsadvisor/src/samples/java/com/azure/ai/metricsadvisor/ListsAnomaliesForAlertsSample.java b/sdk/metricsadvisor/azure-ai-metricsadvisor/src/samples/java/com/azure/ai/metricsadvisor/ListsAnomaliesForAlertsSample.java index 257a5ed2a5cd5..d581b3755cd98 100644 --- a/sdk/metricsadvisor/azure-ai-metricsadvisor/src/samples/java/com/azure/ai/metricsadvisor/ListsAnomaliesForAlertsSample.java +++ b/sdk/metricsadvisor/azure-ai-metricsadvisor/src/samples/java/com/azure/ai/metricsadvisor/ListsAnomaliesForAlertsSample.java @@ -25,7 +25,7 @@ public static void main(String[] args) { final ListAnomaliesAlertedOptions options = new ListAnomaliesAlertedOptions() .setMaxPageSize(10); - PagedIterable anomaliesIterable = advisorClient.listAnomaliesForAlert( + PagedIterable anomaliesIterable = advisorClient.listAnomalies( alertConfigurationId, alertId, options, diff --git a/sdk/metricsadvisor/azure-ai-metricsadvisor/src/samples/java/com/azure/ai/metricsadvisor/ListsAnomaliesForDetectionConfigAsyncSample.java b/sdk/metricsadvisor/azure-ai-metricsadvisor/src/samples/java/com/azure/ai/metricsadvisor/ListsAnomaliesForDetectionConfigAsyncSample.java index fb8e5678af54e..a54d66f3c5029 100644 --- a/sdk/metricsadvisor/azure-ai-metricsadvisor/src/samples/java/com/azure/ai/metricsadvisor/ListsAnomaliesForDetectionConfigAsyncSample.java +++ b/sdk/metricsadvisor/azure-ai-metricsadvisor/src/samples/java/com/azure/ai/metricsadvisor/ListsAnomaliesForDetectionConfigAsyncSample.java @@ -3,7 +3,7 @@ package com.azure.ai.metricsadvisor; -import com.azure.ai.metricsadvisor.models.AnomalySeverity; +import com.azure.ai.metricsadvisor.administration.models.AnomalySeverity; import com.azure.ai.metricsadvisor.models.ListAnomaliesDetectedFilter; import com.azure.ai.metricsadvisor.models.ListAnomaliesDetectedOptions; import com.azure.ai.metricsadvisor.models.MetricsAdvisorKeyCredential; @@ -29,7 +29,7 @@ public static void main(String[] args) { final ListAnomaliesDetectedOptions options = new ListAnomaliesDetectedOptions() .setMaxPageSize(10) .setFilter(filter); - advisorAsyncClient.listAnomaliesForDetectionConfig(detectionConfigurationId, + advisorAsyncClient.listAnomalies(detectionConfigurationId, startTime, endTime, options) .doOnNext(anomaly -> { System.out.printf("DataPoint Anomaly Severity: %s%n", anomaly.getSeverity()); diff --git a/sdk/metricsadvisor/azure-ai-metricsadvisor/src/samples/java/com/azure/ai/metricsadvisor/ListsAnomaliesForDetectionConfigSample.java b/sdk/metricsadvisor/azure-ai-metricsadvisor/src/samples/java/com/azure/ai/metricsadvisor/ListsAnomaliesForDetectionConfigSample.java index 09a73a9fa2f68..d7a3cdf48d1f1 100644 --- a/sdk/metricsadvisor/azure-ai-metricsadvisor/src/samples/java/com/azure/ai/metricsadvisor/ListsAnomaliesForDetectionConfigSample.java +++ b/sdk/metricsadvisor/azure-ai-metricsadvisor/src/samples/java/com/azure/ai/metricsadvisor/ListsAnomaliesForDetectionConfigSample.java @@ -7,7 +7,7 @@ import com.azure.ai.metricsadvisor.models.ListAnomaliesDetectedFilter; import com.azure.ai.metricsadvisor.models.ListAnomaliesDetectedOptions; import com.azure.ai.metricsadvisor.models.MetricsAdvisorKeyCredential; -import com.azure.ai.metricsadvisor.models.AnomalySeverity; +import com.azure.ai.metricsadvisor.administration.models.AnomalySeverity; import com.azure.core.http.rest.PagedIterable; import java.time.OffsetDateTime; @@ -32,7 +32,7 @@ public static void main(String[] args) { .setMaxPageSize(10) .setFilter(filter); PagedIterable anomaliesIterable - = advisorClient.listAnomaliesForDetectionConfig(detectionConfigurationId, + = advisorClient.listAnomalies(detectionConfigurationId, startTime, endTime); for (DataPointAnomaly dataPointAnomaly : anomaliesIterable) { diff --git a/sdk/metricsadvisor/azure-ai-metricsadvisor/src/samples/java/com/azure/ai/metricsadvisor/MetricFeedbackAsyncSample.java b/sdk/metricsadvisor/azure-ai-metricsadvisor/src/samples/java/com/azure/ai/metricsadvisor/MetricFeedbackAsyncSample.java index b931dc58d3317..be85df753317b 100644 --- a/sdk/metricsadvisor/azure-ai-metricsadvisor/src/samples/java/com/azure/ai/metricsadvisor/MetricFeedbackAsyncSample.java +++ b/sdk/metricsadvisor/azure-ai-metricsadvisor/src/samples/java/com/azure/ai/metricsadvisor/MetricFeedbackAsyncSample.java @@ -39,7 +39,7 @@ public static void main(String[] args) { System.out.printf("Creating Metric Feedback%n"); final Mono createdFeedbackMono - = advisorAsyncClient.addFeeddback(metricId, metricChangePointFeedback); + = advisorAsyncClient.addFeedback(metricId, metricChangePointFeedback); createdFeedbackMono .doOnSubscribe(__ -> diff --git a/sdk/metricsadvisor/azure-ai-metricsadvisor/src/samples/java/com/azure/ai/metricsadvisor/MetricsAdvisorAsyncClientJavaDocCodeSnippets.java b/sdk/metricsadvisor/azure-ai-metricsadvisor/src/samples/java/com/azure/ai/metricsadvisor/MetricsAdvisorAsyncClientJavaDocCodeSnippets.java index 04a65ab24e845..4dfd96bf9e7bb 100644 --- a/sdk/metricsadvisor/azure-ai-metricsadvisor/src/samples/java/com/azure/ai/metricsadvisor/MetricsAdvisorAsyncClientJavaDocCodeSnippets.java +++ b/sdk/metricsadvisor/azure-ai-metricsadvisor/src/samples/java/com/azure/ai/metricsadvisor/MetricsAdvisorAsyncClientJavaDocCodeSnippets.java @@ -27,7 +27,7 @@ import com.azure.ai.metricsadvisor.models.MetricFeedback; import com.azure.ai.metricsadvisor.models.MetricPeriodFeedback; import com.azure.ai.metricsadvisor.models.MetricsAdvisorKeyCredential; -import com.azure.ai.metricsadvisor.models.AnomalySeverity; +import com.azure.ai.metricsadvisor.administration.models.AnomalySeverity; import com.azure.core.http.HttpPipeline; import com.azure.core.http.HttpPipelineBuilder; import com.azure.core.http.rest.PagedFlux; @@ -85,7 +85,23 @@ public void createMetricAdvisorAsyncClientWithPipeline() { * Code snippet for * {@link MetricsAdvisorAsyncClient#listMetricSeriesDefinitions(String, OffsetDateTime, ListMetricSeriesDefinitionOptions)} */ + public void listMetricSeriesDefinitions() { + // BEGIN: com.azure.ai.metricsadvisor.MetricsAdvisorAsyncClient.listMetricSeriesDefinitions#String-OffsetDateTime + String metricId = "b460abfc-7a58-47d7-9d99-21ee21fdfc6e"; + final OffsetDateTime activeSince = OffsetDateTime.parse("2020-07-10T00:00:00Z"); + + metricsAdvisorAsyncClient.listMetricSeriesDefinitions(metricId, activeSince) + .subscribe(metricSeriesDefinition -> { + System.out.printf("Data Feed Metric id for the retrieved series definition : %s%n", + metricSeriesDefinition.getMetricId()); + System.out.printf("Series Key:"); + System.out.println(metricSeriesDefinition.getSeriesKey().asMap()); + }); + // END: com.azure.ai.metricsadvisor.MetricsAdvisorAsyncClient.listMetricSeriesDefinitions#String-OffsetDateTime + } + + public void listMetricSeriesDefinitionsWithOptions() { // BEGIN: com.azure.ai.metricsadvisor.MetricsAdvisorAsyncClient.listMetricSeriesDefinitions#String-OffsetDateTime-ListMetricSeriesDefinitionOptions String metricId = "b460abfc-7a58-47d7-9d99-21ee21fdfc6e"; final OffsetDateTime activeSince = OffsetDateTime.parse("2020-07-10T00:00:00Z"); @@ -154,17 +170,42 @@ public void listMetricDimensionValuesWithOptions() { // END: com.azure.ai.metricsadvisor.MetricsAdvisorAsyncClient.listMetricDimensionValues#String-String-ListMetricDimensionValuesOptions } + public void listIncidentsForAlert() { + // BEGIN: com.azure.ai.metricsadvisor.MetricsAdvisorAsyncClient.listIncidents#String-String + final String alertConfigurationId = "ff3014a0-bbbb-41ec-a637-677e77b81299"; + final String alertId = "1746b031c00"; + + metricsAdvisorAsyncClient.listIncidents( + alertConfigurationId, + alertId) + .subscribe(incident -> { + System.out.printf("Data Feed Metric Id: %s%n", incident.getMetricId()); + System.out.printf("Detection Configuration Id: %s%n", incident.getDetectionConfigurationId()); + System.out.printf("Anomaly Incident Id: %s%n", incident.getId()); + System.out.printf("Anomaly Incident Start Time: %s%n", incident.getStartTime()); + System.out.printf("Anomaly Incident AnomalySeverity: %s%n", incident.getSeverity()); + System.out.printf("Anomaly Incident Status: %s%n", incident.getStatus()); + System.out.printf("Root DataFeedDimension Key:"); + DimensionKey rootDimension = incident.getRootDimensionKey(); + for (Map.Entry dimension : rootDimension.asMap().entrySet()) { + System.out.printf("DimensionName: %s DimensionValue:%s%n", + dimension.getKey(), dimension.getValue()); + } + }); + // END: com.azure.ai.metricsadvisor.MetricsAdvisorAsyncClient.listIncidents#String-String + } + /** - * Code snippet for {@link MetricsAdvisorAsyncClient#listIncidentsForAlert(String, String, ListIncidentsAlertedOptions)}. + * Code snippet for {@link MetricsAdvisorAsyncClient#listIncidents(String, String, ListIncidentsAlertedOptions)}. */ - public void listIncidentsForAlert() { - // BEGIN: com.azure.ai.metricsadvisor.MetricsAdvisorAsyncClient.listIncidentsForAlert#String-String-ListIncidentsAlertedOptions + public void listIncidentsForAlertWithOptions() { + // BEGIN: com.azure.ai.metricsadvisor.MetricsAdvisorAsyncClient.listIncidents#String-String-ListIncidentsAlertedOptions final String alertConfigurationId = "ff3014a0-bbbb-41ec-a637-677e77b81299"; final String alertId = "1746b031c00"; final ListIncidentsAlertedOptions options = new ListIncidentsAlertedOptions() .setMaxPageSize(10); - metricsAdvisorAsyncClient.listIncidentsForAlert( + metricsAdvisorAsyncClient.listIncidents( alertConfigurationId, alertId, options) @@ -182,18 +223,18 @@ public void listIncidentsForAlert() { dimension.getKey(), dimension.getValue()); } }); - // END: com.azure.ai.metricsadvisor.MetricsAdvisorAsyncClient.listIncidentsForAlert#String-String-ListIncidentsAlertedOptions + // END: com.azure.ai.metricsadvisor.MetricsAdvisorAsyncClient.listIncidents#String-String-ListIncidentsAlertedOptions } /** - * Code snippet for {@link MetricsAdvisorAsyncClient#listAnomaliesForAlert(String, String)}. + * Code snippet for {@link MetricsAdvisorAsyncClient#listAnomalies(String, String)}. */ public void listAnomaliesForAlert() { - // BEGIN: com.azure.ai.metricsadvisor.MetricsAdvisorAsyncClient.listAnomaliesForAlert#String-String + // BEGIN: com.azure.ai.metricsadvisor.MetricsAdvisorAsyncClient.listAnomalies#String-String final String alertConfigurationId = "ff3014a0-bbbb-41ec-a637-677e77b81299"; final String alertId = "1746b031c00"; - metricsAdvisorAsyncClient.listAnomaliesForAlert( + metricsAdvisorAsyncClient.listAnomalies( alertConfigurationId, alertId) .subscribe(anomaly -> { @@ -210,19 +251,19 @@ public void listAnomaliesForAlert() { dimension.getKey(), dimension.getValue()); } }); - // END: com.azure.ai.metricsadvisor.MetricsAdvisorAsyncClient.listAnomaliesForAlert#String-String + // END: com.azure.ai.metricsadvisor.MetricsAdvisorAsyncClient.listAnomalies#String-String } /** - * Code snippet for {@link MetricsAdvisorAsyncClient#listAnomaliesForAlert(String, String, ListAnomaliesAlertedOptions)}. + * Code snippet for {@link MetricsAdvisorAsyncClient#listAnomalies(String, String, ListAnomaliesAlertedOptions)}. */ public void listAnomaliesForAlertWithOptions() { - // BEGIN: com.azure.ai.metricsadvisor.MetricsAdvisorAsyncClient.listAnomaliesForAlert#String-String-ListAnomaliesAlertedOptions + // BEGIN: com.azure.ai.metricsadvisor.MetricsAdvisorAsyncClient.listAnomalies#String-String-ListAnomaliesAlertedOptions final String alertConfigurationId = "ff3014a0-bbbb-41ec-a637-677e77b81299"; final String alertId = "1746b031c00"; final ListAnomaliesAlertedOptions options = new ListAnomaliesAlertedOptions() .setMaxPageSize(10); - metricsAdvisorAsyncClient.listAnomaliesForAlert( + metricsAdvisorAsyncClient.listAnomalies( alertConfigurationId, alertId, options) @@ -236,13 +277,29 @@ public void listAnomaliesForAlertWithOptions() { System.out.printf("Series Key:"); System.out.println(anomaly.getSeriesKey().asMap()); }); - // END: com.azure.ai.metricsadvisor.MetricsAdvisorAsyncClient.listAnomaliesForAlert#String-String-ListAnomaliesAlertedOptions + // END: com.azure.ai.metricsadvisor.MetricsAdvisorAsyncClient.listAnomalies#String-String-ListAnomaliesAlertedOptions + } + + public void listAlertForAlertConfiguration() { + // BEGIN: com.azure.ai.metricsadvisor.MetricsAdvisorAsyncClient.listAlerts#String-OffsetDateTime-OffsetDateTime + final String alertConfigurationId = "ff3014a0-bbbb-41ec-a637-677e77b81299"; + final OffsetDateTime startTime = OffsetDateTime.parse("2020-01-01T00:00:00Z"); + final OffsetDateTime endTime = OffsetDateTime.parse("2020-09-09T00:00:00Z"); + final AlertQueryTimeMode timeMode = AlertQueryTimeMode.ANOMALY_TIME; + + metricsAdvisorAsyncClient.listAlerts(alertConfigurationId, startTime, endTime) + .subscribe(alert -> { + System.out.printf("Anomaly Alert Id: %s%n", alert.getId()); + System.out.printf("Created Time: %s%n", alert.getCreatedTime()); + System.out.printf("Modified Time: %s%n", alert.getModifiedTime()); + }); + // END: com.azure.ai.metricsadvisor.MetricsAdvisorAsyncClient.listAlerts#String-OffsetDateTime-OffsetDateTime } /** * Code snippet for {@link MetricsAdvisorAsyncClient#listAlerts(String, OffsetDateTime, OffsetDateTime, ListAlertOptions)}. */ - public void listAlertForAlertConfiguration() { + public void listAlertForAlertConfigurationWithOptions() { // BEGIN: com.azure.ai.metricsadvisor.MetricsAdvisorAsyncClient.listAlerts#String-OffsetDateTime-OffsetDateTime-ListAlertOptions final String alertConfigurationId = "ff3014a0-bbbb-41ec-a637-677e77b81299"; final OffsetDateTime startTime = OffsetDateTime.parse("2020-01-01T00:00:00Z"); @@ -261,10 +318,22 @@ public void listAlertForAlertConfiguration() { // END: com.azure.ai.metricsadvisor.MetricsAdvisorAsyncClient.listAlerts#String-OffsetDateTime-OffsetDateTime-ListAlertOptions } - /** - * Code snippet for {@link MetricsAdvisorAsyncClient#listAnomalyDimensionValues(String, String, OffsetDateTime, OffsetDateTime, ListAnomalyDimensionValuesOptions)}. - */ public void listAnomalyDimensionValues() { + // BEGIN: com.azure.ai.metricsadvisor.MetricsAdvisorAsyncClient.listAnomalyDimensionValues#String-String-OffsetDateTime-OffsetDateTime + final String detectionConfigurationId = "c0f2539f-b804-4ab9-a70f-0da0c89c76d8"; + final String dimensionName = "Dim1"; + final OffsetDateTime startTime = OffsetDateTime.parse("2020-01-01T00:00:00Z"); + final OffsetDateTime endTime = OffsetDateTime.parse("2020-09-09T00:00:00Z"); + + metricsAdvisorAsyncClient.listAnomalyDimensionValues(detectionConfigurationId, + dimensionName, + startTime, endTime) + .subscribe(dimensionValue -> { + System.out.printf("DataFeedDimension Value: %s%n", dimensionValue); + }); + // END: com.azure.ai.metricsadvisor.MetricsAdvisorAsyncClient.listAnomalyDimensionValues#String-String-OffsetDateTime-OffsetDateTime + } + public void listAnomalyDimensionValuesWithOptions() { // BEGIN: com.azure.ai.metricsadvisor.MetricsAdvisorAsyncClient.listAnomalyDimensionValues#String-String-OffsetDateTime-OffsetDateTime-ListAnomalyDimensionValuesOptions final String detectionConfigurationId = "c0f2539f-b804-4ab9-a70f-0da0c89c76d8"; final String dimensionName = "Dim1"; @@ -283,11 +352,32 @@ public void listAnomalyDimensionValues() { // END: com.azure.ai.metricsadvisor.MetricsAdvisorAsyncClient.listAnomalyDimensionValues#String-String-OffsetDateTime-OffsetDateTime-ListAnomalyDimensionValuesOptions } + public void listIncidentsForDetectionConfig() { + // BEGIN: com.azure.ai.metricsadvisor.MetricsAdvisorAsyncClient.listIncidents#String-OffsetDateTime-OffsetDateTime + final String detectionConfigurationId = "c0f2539f-b804-4ab9-a70f-0da0c89c76d8"; + final OffsetDateTime startTime = OffsetDateTime.parse("2020-09-09T00:00:00Z"); + final OffsetDateTime endTime = OffsetDateTime.parse("2020-09-09T12:00:00Z"); + + PagedFlux incidentsFlux + = metricsAdvisorAsyncClient.listIncidents(detectionConfigurationId, startTime, endTime); + + incidentsFlux.subscribe(incident -> { + System.out.printf("Data Feed Metric Id: %s%n", incident.getMetricId()); + System.out.printf("Detection Configuration Id: %s%n", incident.getDetectionConfigurationId()); + System.out.printf("Anomaly Incident Id: %s%n", incident.getId()); + System.out.printf("Anomaly Incident Start Time: %s%n", incident.getStartTime()); + System.out.printf("Anomaly Incident AnomalySeverity: %s%n", incident.getSeverity()); + System.out.printf("Anomaly Incident Status: %s%n", incident.getStatus()); + System.out.printf("Root DataFeedDimension Key: %s%n", incident.getRootDimensionKey().asMap()); + }); + // END: com.azure.ai.metricsadvisor.MetricsAdvisorAsyncClient.listIncidents#String-OffsetDateTime-OffsetDateTime + } + /** - * Code snippet for {@link MetricsAdvisorAsyncClient#listIncidentsForDetectionConfig(String, OffsetDateTime, OffsetDateTime, ListIncidentsDetectedOptions)}. + * Code snippet for {@link MetricsAdvisorAsyncClient#listIncidents(String, OffsetDateTime, OffsetDateTime, ListIncidentsDetectedOptions)}. */ - public void listIncidentsForDetectionConfig() { - // BEGIN: com.azure.ai.metricsadvisor.MetricsAdvisorAsyncClient.listIncidentsForDetectionConfig#String-OffsetDateTime-OffsetDateTime-ListIncidentsDetectedOptions + public void listIncidentsForDetectionConfigWithOptions() { + // BEGIN: com.azure.ai.metricsadvisor.MetricsAdvisorAsyncClient.listIncidents#String-OffsetDateTime-OffsetDateTime-ListIncidentsDetectedOptions final String detectionConfigurationId = "c0f2539f-b804-4ab9-a70f-0da0c89c76d8"; final OffsetDateTime startTime = OffsetDateTime.parse("2020-09-09T00:00:00Z"); final OffsetDateTime endTime = OffsetDateTime.parse("2020-09-09T12:00:00Z"); @@ -295,7 +385,7 @@ public void listIncidentsForDetectionConfig() { .setMaxPageSize(1000); PagedFlux incidentsFlux - = metricsAdvisorAsyncClient.listIncidentsForDetectionConfig(detectionConfigurationId, startTime, endTime, options); + = metricsAdvisorAsyncClient.listIncidents(detectionConfigurationId, startTime, endTime, options); incidentsFlux.subscribe(incident -> { System.out.printf("Data Feed Metric Id: %s%n", incident.getMetricId()); @@ -306,14 +396,34 @@ public void listIncidentsForDetectionConfig() { System.out.printf("Anomaly Incident Status: %s%n", incident.getStatus()); System.out.printf("Root DataFeedDimension Key: %s%n", incident.getRootDimensionKey().asMap()); }); - // END: com.azure.ai.metricsadvisor.MetricsAdvisorAsyncClient.listIncidentsForDetectionConfig#String-OffsetDateTime-OffsetDateTime-ListIncidentsDetectedOptions + // END: com.azure.ai.metricsadvisor.MetricsAdvisorAsyncClient.listIncidents#String-OffsetDateTime-OffsetDateTime-ListIncidentsDetectedOptions + } + + public void listAnomaliesForDetectionConfiguration() { + // BEGIN: com.azure.ai.metricsadvisor.MetricsAdvisorAsyncClient.listAnomalies#String-OffsetDateTime-OffsetDateTime + final String detectionConfigurationId = "c0f2539f-b804-4ab9-a70f-0da0c89c76d8"; + final OffsetDateTime startTime = OffsetDateTime.parse("2020-09-09T00:00:00Z"); + final OffsetDateTime endTime = OffsetDateTime.parse("2020-09-09T12:00:00Z"); + + metricsAdvisorAsyncClient.listAnomalies(detectionConfigurationId, + startTime, endTime) + .subscribe(anomaly -> { + System.out.printf("DataPoint Anomaly AnomalySeverity: %s%n", anomaly.getSeverity()); + System.out.printf("Series Key:"); + DimensionKey seriesKey = anomaly.getSeriesKey(); + for (Map.Entry dimension : seriesKey.asMap().entrySet()) { + System.out.printf("DimensionName: %s DimensionValue:%s%n", + dimension.getKey(), dimension.getValue()); + } + }); + // END: com.azure.ai.metricsadvisor.MetricsAdvisorAsyncClient.listAnomalies#String-OffsetDateTime-OffsetDateTime } /** - * Code snippet for {@link MetricsAdvisorAsyncClient#listAnomaliesForDetectionConfig(String, OffsetDateTime, OffsetDateTime, ListAnomaliesDetectedOptions)}. + * Code snippet for {@link MetricsAdvisorAsyncClient#listAnomalies(String, OffsetDateTime, OffsetDateTime, ListAnomaliesDetectedOptions)}. */ - public void listAnomaliesForDetectionConfiguration() { - // BEGIN: com.azure.ai.metricsadvisor.MetricsAdvisorAsyncClient.listAnomaliesForDetectionConfig#String-OffsetDateTime-OffsetDateTime-ListAnomaliesDetectedOptions + public void listAnomaliesForDetectionConfigurationWithOptions() { + // BEGIN: com.azure.ai.metricsadvisor.MetricsAdvisorAsyncClient.listAnomalies#String-OffsetDateTime-OffsetDateTime-ListAnomaliesDetectedOptions final String detectionConfigurationId = "c0f2539f-b804-4ab9-a70f-0da0c89c76d8"; final OffsetDateTime startTime = OffsetDateTime.parse("2020-09-09T00:00:00Z"); final OffsetDateTime endTime = OffsetDateTime.parse("2020-09-09T12:00:00Z"); @@ -322,7 +432,7 @@ public void listAnomaliesForDetectionConfiguration() { final ListAnomaliesDetectedOptions options = new ListAnomaliesDetectedOptions() .setMaxPageSize(10) .setFilter(filter); - metricsAdvisorAsyncClient.listAnomaliesForDetectionConfig(detectionConfigurationId, + metricsAdvisorAsyncClient.listAnomalies(detectionConfigurationId, startTime, endTime, options) .subscribe(anomaly -> { System.out.printf("DataPoint Anomaly AnomalySeverity: %s%n", anomaly.getSeverity()); @@ -333,21 +443,21 @@ public void listAnomaliesForDetectionConfiguration() { dimension.getKey(), dimension.getValue()); } }); - // END: com.azure.ai.metricsadvisor.MetricsAdvisorAsyncClient.listAnomaliesForDetectionConfig#String-OffsetDateTime-OffsetDateTime-ListAnomaliesDetectedOptions + // END: com.azure.ai.metricsadvisor.MetricsAdvisorAsyncClient.listAnomalies#String-OffsetDateTime-OffsetDateTime-ListAnomaliesDetectedOptions } /* - * Code snippet for {@link MetricsAdvisorAsyncClient#addFeeddback(String, MetricFeedback)}. + * Code snippet for {@link MetricsAdvisorAsyncClient#addFeedback(String, MetricFeedback)}. */ public void createMetricFeedback() { - // BEGIN: com.azure.ai.metricsadvisor.MetricsAdvisorAsyncClient.addFeeddback#String-MetricFeedback + // BEGIN: com.azure.ai.metricsadvisor.MetricsAdvisorAsyncClient.addFeedback#String-MetricFeedback final String metricId = "d3gh4i4-b804-4ab9-a70f-0da0c89cft3l"; final OffsetDateTime startTime = OffsetDateTime.parse("2020-01-01T00:00:00Z"); final OffsetDateTime endTime = OffsetDateTime.parse("2020-09-09T00:00:00Z"); final MetricChangePointFeedback metricChangePointFeedback = new MetricChangePointFeedback(startTime, endTime, ChangePointValue.AUTO_DETECT); - metricsAdvisorAsyncClient.addFeeddback(metricId, metricChangePointFeedback) + metricsAdvisorAsyncClient.addFeedback(metricId, metricChangePointFeedback) .subscribe(metricFeedback -> { MetricChangePointFeedback createdMetricChangePointFeedback = (MetricChangePointFeedback) metricFeedback; System.out.printf("Data Feed Metric feedback Id: %s%n", createdMetricChangePointFeedback.getId()); @@ -358,7 +468,7 @@ public void createMetricFeedback() { System.out.printf("Data Feed Metric feedback end time: %s%n", createdMetricChangePointFeedback.getEndTime()); }); - // END: com.azure.ai.metricsadvisor.MetricsAdvisorAsyncClient.addFeeddback#String-MetricFeedback + // END: com.azure.ai.metricsadvisor.MetricsAdvisorAsyncClient.addFeedback#String-MetricFeedback } /** @@ -555,7 +665,7 @@ public void listIncidentRootCausesWithIncident() { = new ListIncidentsDetectedOptions() .setMaxPageSize(10); - metricsAdvisorAsyncClient.listIncidentsForDetectionConfig(detectionConfigurationId, startTime, endTime, options) + metricsAdvisorAsyncClient.listIncidents(detectionConfigurationId, startTime, endTime, options) .flatMap(incident -> { return metricsAdvisorAsyncClient.listIncidentRootCauses(incident); }) @@ -568,10 +678,26 @@ public void listIncidentRootCausesWithIncident() { // END: com.azure.ai.metricsadvisor.MetricsAdvisorAsyncClient.listIncidentRootCauses#AnomalyIncident } + public void listMetricEnrichmentStatus() { + // BEGIN: com.azure.ai.metricsadvisor.MetricsAdvisorAsyncClient.listMetricEnrichmentStatus#String-OffsetDateTime-OffsetDateTime + final OffsetDateTime startTime = OffsetDateTime.parse("2020-01-01T00:00:00Z"); + final OffsetDateTime endTime = OffsetDateTime.parse("2020-09-09T00:00:00Z"); + final String metricId = "d3gh4i4-b804-4ab9-a70f-0da0c89cft3l"; + + metricsAdvisorAsyncClient.listMetricEnrichmentStatus(metricId, startTime, endTime) + .subscribe(enrichmentStatus -> { + System.out.printf("Data Feed Metric enrichment status : %s%n", enrichmentStatus.getStatus()); + System.out.printf("Data Feed Metric enrichment status message: %s%n", enrichmentStatus.getMessage()); + System.out.printf("Data Feed Metric enrichment status data slice timestamp : %s%n", + enrichmentStatus.getTimestamp()); + }); + // END: com.azure.ai.metricsadvisor.MetricsAdvisorAsyncClient.listMetricEnrichmentStatus#String-OffsetDateTime-OffsetDateTime + } + /** * Code snippet for {@link MetricsAdvisorAsyncClient#listMetricEnrichmentStatus(String, OffsetDateTime, OffsetDateTime, ListMetricEnrichmentStatusOptions)}. */ - public void listMetricEnrichmentStatus() { + public void listMetricEnrichmentStatusWithOptions() { // BEGIN: com.azure.ai.metricsadvisor.MetricsAdvisorAsyncClient.listMetricEnrichmentStatus#String-OffsetDateTime-OffsetDateTime-ListMetricEnrichmentStatusOptions final OffsetDateTime startTime = OffsetDateTime.parse("2020-01-01T00:00:00Z"); final OffsetDateTime endTime = OffsetDateTime.parse("2020-09-09T00:00:00Z"); @@ -589,10 +715,10 @@ public void listMetricEnrichmentStatus() { } /** - * Code snippet for {@link MetricsAdvisorAsyncClient#listMetricEnrichedSeriesData(List, String, OffsetDateTime, OffsetDateTime)}. + * Code snippet for {@link MetricsAdvisorAsyncClient#listMetricEnrichedSeriesData(String, List, OffsetDateTime, OffsetDateTime)}. */ public void listEnrichedSeries() { - // BEGIN: com.azure.ai.metricsadvisor.MetricsAdvisorAsyncClient.listMetricEnrichedSeriesData#List-String-OffsetDateTime-OffsetDateTime + // BEGIN: com.azure.ai.metricsadvisor.MetricsAdvisorAsyncClient.listMetricEnrichedSeriesData#String-List-OffsetDateTime-OffsetDateTime final String detectionConfigurationId = "e87d899d-a5a0-4259-b752-11aea34d5e34"; final DimensionKey seriesKey = new DimensionKey() .put("Dim1", "Common Lime") @@ -601,8 +727,8 @@ public void listEnrichedSeries() { final OffsetDateTime endTime = OffsetDateTime.parse("2020-09-12T00:00:00Z"); PagedFlux enrichedDataFlux - = metricsAdvisorAsyncClient.listMetricEnrichedSeriesData(Arrays.asList(seriesKey), - detectionConfigurationId, + = metricsAdvisorAsyncClient.listMetricEnrichedSeriesData(detectionConfigurationId, + Arrays.asList(seriesKey), startTime, endTime); @@ -619,6 +745,6 @@ public void listEnrichedSeries() { System.out.println("the periods calculated for the data points in the time series:"); System.out.println(enrichedData.getPeriods()); }); - // END: com.azure.ai.metricsadvisor.MetricsAdvisorAsyncClient.listMetricEnrichedSeriesData#List-String-OffsetDateTime-OffsetDateTime + // END: com.azure.ai.metricsadvisor.MetricsAdvisorAsyncClient.listMetricEnrichedSeriesData#String-List-OffsetDateTime-OffsetDateTime } } diff --git a/sdk/metricsadvisor/azure-ai-metricsadvisor/src/samples/java/com/azure/ai/metricsadvisor/MetricsAdvisorClientJavaDocCodeSnippets.java b/sdk/metricsadvisor/azure-ai-metricsadvisor/src/samples/java/com/azure/ai/metricsadvisor/MetricsAdvisorClientJavaDocCodeSnippets.java index 4ae874c049f68..d55095b80f05e 100644 --- a/sdk/metricsadvisor/azure-ai-metricsadvisor/src/samples/java/com/azure/ai/metricsadvisor/MetricsAdvisorClientJavaDocCodeSnippets.java +++ b/sdk/metricsadvisor/azure-ai-metricsadvisor/src/samples/java/com/azure/ai/metricsadvisor/MetricsAdvisorClientJavaDocCodeSnippets.java @@ -29,7 +29,7 @@ import com.azure.ai.metricsadvisor.models.MetricFeedback; import com.azure.ai.metricsadvisor.models.MetricPeriodFeedback; import com.azure.ai.metricsadvisor.models.MetricsAdvisorKeyCredential; -import com.azure.ai.metricsadvisor.models.AnomalySeverity; +import com.azure.ai.metricsadvisor.administration.models.AnomalySeverity; import com.azure.ai.metricsadvisor.models.AlertQueryTimeMode; import com.azure.core.http.HttpPipeline; import com.azure.core.http.HttpPipelineBuilder; @@ -203,48 +203,16 @@ public void listMetricDimensionValuesWithOptions() { } /** - * Code snippet for {@link MetricsAdvisorClient#listIncidentsForAlert(String, String, ListIncidentsAlertedOptions)}. - */ - public void listIncidentsForAlert() { - // BEGIN: com.azure.ai.metricsadvisor.MetricsAdvisorClient.listIncidentsForAlert#String-String-ListIncidentsAlertedOptions - final String alertConfigurationId = "ff3014a0-bbbb-41ec-a637-677e77b81299"; - final String alertId = "1746b031c00"; - final ListIncidentsAlertedOptions options = new ListIncidentsAlertedOptions() - .setMaxPageSize(10); - - PagedIterable incidentsIterable = metricsAdvisorClient.listIncidentsForAlert( - alertConfigurationId, - alertId, - options); - - for (AnomalyIncident anomalyIncident : incidentsIterable) { - System.out.printf("Data Feed Metric Id: %s%n", anomalyIncident.getMetricId()); - System.out.printf("Detection Configuration Id: %s%n", anomalyIncident.getDetectionConfigurationId()); - System.out.printf("Anomaly Incident Id: %s%n", anomalyIncident.getId()); - System.out.printf("Anomaly Incident Start Time: %s%n", anomalyIncident.getStartTime()); - System.out.printf("Anomaly Incident AnomalySeverity: %s%n", anomalyIncident.getSeverity()); - System.out.printf("Anomaly Incident Status: %s%n", anomalyIncident.getStatus()); - System.out.printf("Root DataFeedDimension Key:"); - DimensionKey rootDimension = anomalyIncident.getRootDimensionKey(); - for (Map.Entry dimension : rootDimension.asMap().entrySet()) { - System.out.printf("DimensionName: %s DimensionValue:%s%n", - dimension.getKey(), dimension.getValue()); - } - } - // END: com.azure.ai.metricsadvisor.MetricsAdvisorClient.listIncidentsForAlert#String-String-ListIncidentsAlertedOptions - } - - /** - * Code snippet for {@link MetricsAdvisorClient#listIncidentsForAlert(String, String, ListIncidentsAlertedOptions, Context)}. + * Code snippet for {@link MetricsAdvisorClient#listIncidents(String, String, ListIncidentsAlertedOptions, Context)}. */ public void listIncidentsForAlertWithContext() { - // BEGIN: com.azure.ai.metricsadvisor.MetricsAdvisorClient.listIncidentsForAlert#String-String-ListIncidentsAlertedOptions-Context + // BEGIN: com.azure.ai.metricsadvisor.MetricsAdvisorClient.listIncidents#String-String-ListIncidentsAlertedOptions-Context final String alertConfigurationId = "ff3014a0-bbbb-41ec-a637-677e77b81299"; final String alertId = "1746b031c00"; final ListIncidentsAlertedOptions options = new ListIncidentsAlertedOptions() .setMaxPageSize(10); - PagedIterable incidentsIterable = metricsAdvisorClient.listIncidentsForAlert( + PagedIterable incidentsIterable = metricsAdvisorClient.listIncidents( alertConfigurationId, alertId, options, @@ -270,17 +238,17 @@ public void listIncidentsForAlertWithContext() { } } }); - // END: com.azure.ai.metricsadvisor.MetricsAdvisorClient.listIncidentsForAlert#String-String-ListIncidentsAlertedOptions-Context + // END: com.azure.ai.metricsadvisor.MetricsAdvisorClient.listIncidents#String-String-ListIncidentsAlertedOptions-Context } /** - * Code snippet for {@link MetricsAdvisorClient#listAnomaliesForAlert(String, String)} + * Code snippet for {@link MetricsAdvisorClient#listAnomalies(String, String)} */ public void listAnomaliesForAlert() { - // BEGIN: com.azure.ai.metricsadvisor.MetricsAdvisorClient.listAnomaliesForAlert#String-String + // BEGIN: com.azure.ai.metricsadvisor.MetricsAdvisorClient.listAnomalies#String-String final String alertConfigurationId = "ff3014a0-bbbb-41ec-a637-677e77b81299"; final String alertId = "1746b031c00"; - PagedIterable anomaliesIterable = metricsAdvisorClient.listAnomaliesForAlert( + PagedIterable anomaliesIterable = metricsAdvisorClient.listAnomalies( alertConfigurationId, alertId ); @@ -295,19 +263,19 @@ public void listAnomaliesForAlert() { System.out.printf("Series Key:"); System.out.println(dataPointAnomaly.getSeriesKey().asMap()); } - // END: com.azure.ai.metricsadvisor.MetricsAdvisorClient.listAnomaliesForAlert#String-String + // END: com.azure.ai.metricsadvisor.MetricsAdvisorClient.listAnomalies#String-String } /** - * Code snippet for {@link MetricsAdvisorClient#listAnomaliesForAlert(String, String, ListAnomaliesAlertedOptions, Context)}. + * Code snippet for {@link MetricsAdvisorClient#listAnomalies(String, String, ListAnomaliesAlertedOptions, Context)}. */ public void listAnomaliesForAlertWithContext() { - // BEGIN: com.azure.ai.metricsadvisor.MetricsAdvisorClient.listAnomaliesForAlert#String-String-ListAnomaliesAlertedOptions-Context + // BEGIN: com.azure.ai.metricsadvisor.MetricsAdvisorClient.listAnomalies#String-String-ListAnomaliesAlertedOptions-Context final String alertConfigurationId = "ff3014a0-bbbb-41ec-a637-677e77b81299"; final String alertId = "1746b031c00"; final ListAnomaliesAlertedOptions options = new ListAnomaliesAlertedOptions() .setMaxPageSize(10); - PagedIterable anomaliesIterable = metricsAdvisorClient.listAnomaliesForAlert( + PagedIterable anomaliesIterable = metricsAdvisorClient.listAnomalies( alertConfigurationId, alertId, options, @@ -329,7 +297,7 @@ public void listAnomaliesForAlertWithContext() { System.out.println(dataPointAnomaly.getSeriesKey().asMap()); } }); - // END: com.azure.ai.metricsadvisor.MetricsAdvisorClient.listAnomaliesForAlert#String-String-ListAnomaliesAlertedOptions-Context + // END: com.azure.ai.metricsadvisor.MetricsAdvisorClient.listAnomalies#String-String-ListAnomaliesAlertedOptions-Context } /** @@ -435,16 +403,16 @@ public void listAnomalyDimensionValuesWithContext() { } /** - * Code snippet for {@link MetricsAdvisorClient#listIncidentsForDetectionConfig(String, OffsetDateTime, OffsetDateTime)}. + * Code snippet for {@link MetricsAdvisorClient#listIncidents(String, OffsetDateTime, OffsetDateTime)}. */ public void listIncidentsForDetectionConfig() { - // BEGIN: com.azure.ai.metricsadvisor.MetricsAdvisorClient.listIncidentsForDetectionConfig#String-OffsetDateTime-OffsetDateTime + // BEGIN: com.azure.ai.metricsadvisor.MetricsAdvisorClient.listIncidents#String-OffsetDateTime-OffsetDateTime final String detectionConfigurationId = "c0f2539f-b804-4ab9-a70f-0da0c89c76d8"; final OffsetDateTime startTime = OffsetDateTime.parse("2020-09-09T00:00:00Z"); final OffsetDateTime endTime = OffsetDateTime.parse("2020-09-09T12:00:00Z"); PagedIterable incidentsIterable - = metricsAdvisorClient.listIncidentsForDetectionConfig(detectionConfigurationId, startTime, endTime); + = metricsAdvisorClient.listIncidents(detectionConfigurationId, startTime, endTime); for (AnomalyIncident anomalyIncident : incidentsIterable) { System.out.printf("Data Feed Metric Id: %s%n", anomalyIncident.getMetricId()); @@ -455,14 +423,14 @@ public void listIncidentsForDetectionConfig() { System.out.printf("Anomaly Incident Status: %s%n", anomalyIncident.getStatus()); System.out.printf("Root DataFeedDimension Key: %s%n", anomalyIncident.getRootDimensionKey().asMap()); } - // END: com.azure.ai.metricsadvisor.MetricsAdvisorClient.listIncidentsForDetectionConfig#String-OffsetDateTime-OffsetDateTime + // END: com.azure.ai.metricsadvisor.MetricsAdvisorClient.listIncidents#String-OffsetDateTime-OffsetDateTime } /** - * Code snippet for {@link MetricsAdvisorClient#listIncidentsForDetectionConfig(String, OffsetDateTime, OffsetDateTime, ListIncidentsDetectedOptions, Context)}. + * Code snippet for {@link MetricsAdvisorClient#listIncidents(String, OffsetDateTime, OffsetDateTime, ListIncidentsDetectedOptions, Context)}. */ public void listIncidentsForDetectionConfigWithContext() { - // BEGIN: com.azure.ai.metricsadvisor.MetricsAdvisorClient.listIncidentsForDetectionConfig#String-OffsetDateTime-OffsetDateTime-ListIncidentsDetectedOptions-Context + // BEGIN: com.azure.ai.metricsadvisor.MetricsAdvisorClient.listIncidents#String-OffsetDateTime-OffsetDateTime-ListIncidentsDetectedOptions-Context final String detectionConfigurationId = "c0f2539f-b804-4ab9-a70f-0da0c89c76d8"; final OffsetDateTime startTime = OffsetDateTime.parse("2020-09-09T00:00:00Z"); final OffsetDateTime endTime = OffsetDateTime.parse("2020-09-09T12:00:00Z"); @@ -470,7 +438,7 @@ public void listIncidentsForDetectionConfigWithContext() { .setMaxPageSize(1000); PagedIterable incidentsIterable - = metricsAdvisorClient.listIncidentsForDetectionConfig(detectionConfigurationId, + = metricsAdvisorClient.listIncidents(detectionConfigurationId, startTime, endTime, options, Context.NONE); @@ -491,14 +459,14 @@ public void listIncidentsForDetectionConfigWithContext() { System.out.printf("Root DataFeedDimension Key: %s%n", anomalyIncident.getRootDimensionKey().asMap()); } }); - // END: com.azure.ai.metricsadvisor.MetricsAdvisorClient.listIncidentsForDetectionConfig#String-OffsetDateTime-OffsetDateTime-ListIncidentsDetectedOptions-Context + // END: com.azure.ai.metricsadvisor.MetricsAdvisorClient.listIncidents#String-OffsetDateTime-OffsetDateTime-ListIncidentsDetectedOptions-Context } /* - * Code snippet for {@link MetricsAdvisorClient#listAnomaliesForDetectionConfig(String, ListAnomaliesDetectedOptions)}. + * Code snippet for {@link MetricsAdvisorClient#listAnomalies(String, ListAnomaliesDetectedOptions)}. */ public void listAnomaliesForDetectionConfiguration() { - // BEGIN: com.azure.ai.metricsadvisor.MetricsAdvisorClient.listAnomaliesForDetectionConfig#String-OffsetDateTime-OffsetDateTime + // BEGIN: com.azure.ai.metricsadvisor.MetricsAdvisorClient.listAnomalies#String-OffsetDateTime-OffsetDateTime final String detectionConfigurationId = "c0f2539f-b804-4ab9-a70f-0da0c89c76d8"; final OffsetDateTime startTime = OffsetDateTime.parse("2020-09-09T00:00:00Z"); final OffsetDateTime endTime = OffsetDateTime.parse("2020-09-09T12:00:00Z"); @@ -508,7 +476,7 @@ public void listAnomaliesForDetectionConfiguration() { .setMaxPageSize(10) .setFilter(filter); PagedIterable anomaliesIterable - = metricsAdvisorClient.listAnomaliesForDetectionConfig(detectionConfigurationId, startTime, endTime, + = metricsAdvisorClient.listAnomalies(detectionConfigurationId, startTime, endTime, options, Context.NONE); for (DataPointAnomaly dataPointAnomaly : anomaliesIterable) { @@ -520,14 +488,14 @@ public void listAnomaliesForDetectionConfiguration() { dimension.getKey(), dimension.getValue()); } } - // END: com.azure.ai.metricsadvisor.MetricsAdvisorClient.listAnomaliesForDetectionConfig#String-OffsetDateTime-OffsetDateTime + // END: com.azure.ai.metricsadvisor.MetricsAdvisorClient.listAnomalies#String-OffsetDateTime-OffsetDateTime } /** - * Code snippet for {@link MetricsAdvisorClient#listAnomaliesForDetectionConfig(String, OffsetDateTime, OffsetDateTime, ListAnomaliesDetectedOptions, Context)}. + * Code snippet for {@link MetricsAdvisorClient#listAnomalies(String, OffsetDateTime, OffsetDateTime, ListAnomaliesDetectedOptions, Context)}. */ public void listAnomaliesForDetectionConfigurationWithContext() { - // BEGIN: com.azure.ai.metricsadvisor.MetricsAdvisorClient.listAnomaliesForDetectionConfig#String-OffsetDateTime-OffsetDateTime-ListAnomaliesDetectedOptions-Context + // BEGIN: com.azure.ai.metricsadvisor.MetricsAdvisorClient.listAnomalies#String-OffsetDateTime-OffsetDateTime-ListAnomaliesDetectedOptions-Context final String detectionConfigurationId = "c0f2539f-b804-4ab9-a70f-0da0c89c76d8"; final OffsetDateTime startTime = OffsetDateTime.parse("2020-09-09T00:00:00Z"); final OffsetDateTime endTime = OffsetDateTime.parse("2020-09-09T12:00:00Z"); @@ -537,7 +505,7 @@ public void listAnomaliesForDetectionConfigurationWithContext() { .setMaxPageSize(10) .setFilter(filter); PagedIterable anomaliesIterable - = metricsAdvisorClient.listAnomaliesForDetectionConfig(detectionConfigurationId, + = metricsAdvisorClient.listAnomalies(detectionConfigurationId, startTime, endTime, options, Context.NONE); @@ -556,14 +524,14 @@ public void listAnomaliesForDetectionConfigurationWithContext() { } } }); - // END: com.azure.ai.metricsadvisor.MetricsAdvisorClient.listAnomaliesForDetectionConfig#String-OffsetDateTime-OffsetDateTime-ListAnomaliesDetectedOptions-Context + // END: com.azure.ai.metricsadvisor.MetricsAdvisorClient.listAnomalies#String-OffsetDateTime-OffsetDateTime-ListAnomaliesDetectedOptions-Context } /* - * Code snippet for {@link MetricsAdvisorClient#addFeeddback(String, MetricFeedback)}. + * Code snippet for {@link MetricsAdvisorClient#addFeedback(String, MetricFeedback)}. */ public void createMetricFeedback() { - // BEGIN: com.azure.ai.metricsadvisor.MetricsAdvisorClient.addFeeddback#String-MetricFeedback + // BEGIN: com.azure.ai.metricsadvisor.MetricsAdvisorClient.addFeedback#String-MetricFeedback final String metricId = "d3gh4i4-b804-4ab9-a70f-0da0c89cft3l"; final OffsetDateTime startTime = OffsetDateTime.parse("2020-01-01T00:00:00Z"); final OffsetDateTime endTime = OffsetDateTime.parse("2020-09-09T00:00:00Z"); @@ -581,11 +549,11 @@ public void createMetricFeedback() { createdMetricChangePointFeedback.getStartTime()); System.out.printf("Data Feed Metric feedback end time: %s%n", createdMetricChangePointFeedback.getEndTime()); - // END: com.azure.ai.metricsadvisor.MetricsAdvisorClient.addFeeddback#String-MetricFeedback + // END: com.azure.ai.metricsadvisor.MetricsAdvisorClient.addFeedback#String-MetricFeedback } /** - * Code snippet for {@link MetricsAdvisorClient#createMetricFeedbackWithResponse(String, MetricFeedback, Context)}. + * Code snippet for {@link MetricsAdvisorClient#addFeedbackWithResponse(String, MetricFeedback, Context)}. */ public void createMetricFeedbackWithResponse() { // BEGIN: com.azure.ai.metricsadvisor.MetricsAdvisorClient.addFeedbackWithResponse#String-MetricFeedback-Context @@ -596,7 +564,7 @@ public void createMetricFeedbackWithResponse() { = new MetricChangePointFeedback(startTime, endTime, ChangePointValue.AUTO_DETECT); final Response metricFeedbackResponse - = metricsAdvisorClient.createMetricFeedbackWithResponse(metricId, metricChangePointFeedback, Context.NONE); + = metricsAdvisorClient.addFeedbackWithResponse(metricId, metricChangePointFeedback, Context.NONE); System.out.printf("Data Feed Metric feedback creation operation status %s%n", metricFeedbackResponse.getStatusCode()); @@ -798,7 +766,7 @@ public void listIncidentRootCausesWithIncident() { final OffsetDateTime startTime = OffsetDateTime.parse("2020-01-01T00:00:00Z"); final OffsetDateTime endTime = OffsetDateTime.parse("2020-09-09T00:00:00Z"); - metricsAdvisorClient.listIncidentsForDetectionConfig(detectionConfigurationId, startTime, endTime) + metricsAdvisorClient.listIncidents(detectionConfigurationId, startTime, endTime) .forEach(incident -> { metricsAdvisorClient.listIncidentRootCauses(incident) .forEach(incidentRootCause -> { @@ -852,10 +820,10 @@ public void listMetricEnrichmentStatusWithContext() { } /** - * Code snippet for {@link MetricsAdvisorClient#listMetricEnrichedSeriesData(List, String, OffsetDateTime, OffsetDateTime)}. + * Code snippet for {@link MetricsAdvisorClient#listMetricEnrichedSeriesData(String, List, OffsetDateTime, OffsetDateTime)}. */ public void listEnrichedSeries() { - // BEGIN: com.azure.ai.metricsadvisor.MetricsAdvisorClient.listMetricEnrichedSeriesData#List-String-OffsetDateTime-OffsetDateTime + // BEGIN: com.azure.ai.metricsadvisor.MetricsAdvisorClient.listMetricEnrichedSeriesData#String-List-OffsetDateTime-OffsetDateTime final String detectionConfigurationId = "e87d899d-a5a0-4259-b752-11aea34d5e34"; final DimensionKey seriesKey = new DimensionKey() .put("Dim1", "Common Lime") @@ -864,8 +832,8 @@ public void listEnrichedSeries() { final OffsetDateTime endTime = OffsetDateTime.parse("2020-09-12T00:00:00Z"); PagedIterable enrichedDataIterable - = metricsAdvisorClient.listMetricEnrichedSeriesData(Arrays.asList(seriesKey), - detectionConfigurationId, + = metricsAdvisorClient.listMetricEnrichedSeriesData(detectionConfigurationId, + Arrays.asList(seriesKey), startTime, endTime); @@ -882,14 +850,14 @@ public void listEnrichedSeries() { System.out.println("the periods calculated for the data points in the time series:"); System.out.println(enrichedData.getPeriods()); } - // END: com.azure.ai.metricsadvisor.MetricsAdvisorClient.listMetricEnrichedSeriesData#List-String-OffsetDateTime-OffsetDateTime + // END: com.azure.ai.metricsadvisor.MetricsAdvisorClient.listMetricEnrichedSeriesData#String-List-OffsetDateTime-OffsetDateTime } /** - * Code snippet for {@link MetricsAdvisorClient#listMetricEnrichedSeriesData(List, String, OffsetDateTime, OffsetDateTime, Context)}. + * Code snippet for {@link MetricsAdvisorClient#listMetricEnrichedSeriesData(String, List, OffsetDateTime, OffsetDateTime, Context)}. */ public void listEnrichedSeriesWithContext() { - // BEGIN: com.azure.ai.metricsadvisor.MetricsAdvisorClient.listMetricEnrichedSeriesData#List-String-OffsetDateTime-OffsetDateTime-Context + // BEGIN: com.azure.ai.metricsadvisor.MetricsAdvisorClient.listMetricEnrichedSeriesData#String-List-OffsetDateTime-OffsetDateTime-Context final String detectionConfigurationId = "e87d899d-a5a0-4259-b752-11aea34d5e34"; final DimensionKey seriesKey = new DimensionKey() .put("Dim1", "Common Lime") @@ -898,8 +866,8 @@ public void listEnrichedSeriesWithContext() { final OffsetDateTime endTime = OffsetDateTime.parse("2020-09-12T00:00:00Z"); PagedIterable enrichedDataIterable - = metricsAdvisorClient.listMetricEnrichedSeriesData(Arrays.asList(seriesKey), - detectionConfigurationId, + = metricsAdvisorClient.listMetricEnrichedSeriesData(detectionConfigurationId, + Arrays.asList(seriesKey), startTime, endTime); @@ -923,6 +891,6 @@ public void listEnrichedSeriesWithContext() { System.out.println(enrichedData.getPeriods()); } }); - // END: com.azure.ai.metricsadvisor.MetricsAdvisorClient.listMetricEnrichedSeriesData#List-String-OffsetDateTime-OffsetDateTime-Context + // END: com.azure.ai.metricsadvisor.MetricsAdvisorClient.listMetricEnrichedSeriesData#String-List-OffsetDateTime-OffsetDateTime-Context } } diff --git a/sdk/metricsadvisor/azure-ai-metricsadvisor/src/samples/java/com/azure/ai/metricsadvisor/ReadmeSamples.java b/sdk/metricsadvisor/azure-ai-metricsadvisor/src/samples/java/com/azure/ai/metricsadvisor/ReadmeSamples.java index b0c3c631f1c14..df6ade93241ca 100644 --- a/sdk/metricsadvisor/azure-ai-metricsadvisor/src/samples/java/com/azure/ai/metricsadvisor/ReadmeSamples.java +++ b/sdk/metricsadvisor/azure-ai-metricsadvisor/src/samples/java/com/azure/ai/metricsadvisor/ReadmeSamples.java @@ -5,37 +5,37 @@ import com.azure.ai.metricsadvisor.administration.MetricsAdvisorAdministrationClient; import com.azure.ai.metricsadvisor.administration.MetricsAdvisorAdministrationClientBuilder; -import com.azure.ai.metricsadvisor.models.AnomalyAlertConfiguration; -import com.azure.ai.metricsadvisor.models.AnomalyDetectionConfiguration; -import com.azure.ai.metricsadvisor.models.AnomalyDetectorDirection; -import com.azure.ai.metricsadvisor.models.AnomalySeverity; -import com.azure.ai.metricsadvisor.models.ChangeThresholdCondition; -import com.azure.ai.metricsadvisor.models.DataFeed; -import com.azure.ai.metricsadvisor.models.DataFeedDimension; -import com.azure.ai.metricsadvisor.models.DataFeedGranularity; -import com.azure.ai.metricsadvisor.models.DataFeedGranularityType; -import com.azure.ai.metricsadvisor.models.DataFeedIngestionSettings; -import com.azure.ai.metricsadvisor.models.DataFeedMetric; -import com.azure.ai.metricsadvisor.models.DataFeedOptions; -import com.azure.ai.metricsadvisor.models.DataFeedRollupSettings; -import com.azure.ai.metricsadvisor.models.DataFeedRollupType; -import com.azure.ai.metricsadvisor.models.DataFeedSchema; -import com.azure.ai.metricsadvisor.models.DetectionConditionsOperator; -import com.azure.ai.metricsadvisor.models.EmailNotificationHook; -import com.azure.ai.metricsadvisor.models.HardThresholdCondition; -import com.azure.ai.metricsadvisor.models.ListDataFeedIngestionOptions; -import com.azure.ai.metricsadvisor.models.MetricAnomalyAlertConditions; -import com.azure.ai.metricsadvisor.models.MetricAnomalyAlertConfiguration; -import com.azure.ai.metricsadvisor.models.MetricAnomalyAlertConfigurationsOperator; -import com.azure.ai.metricsadvisor.models.MetricAnomalyAlertScope; -import com.azure.ai.metricsadvisor.models.MetricWholeSeriesDetectionCondition; +import com.azure.ai.metricsadvisor.administration.models.AnomalyAlertConfiguration; +import com.azure.ai.metricsadvisor.administration.models.AnomalyDetectionConfiguration; +import com.azure.ai.metricsadvisor.administration.models.AnomalyDetectorDirection; +import com.azure.ai.metricsadvisor.administration.models.AnomalySeverity; +import com.azure.ai.metricsadvisor.administration.models.ChangeThresholdCondition; +import com.azure.ai.metricsadvisor.administration.models.DataFeed; +import com.azure.ai.metricsadvisor.administration.models.DataFeedDimension; +import com.azure.ai.metricsadvisor.administration.models.DataFeedGranularity; +import com.azure.ai.metricsadvisor.administration.models.DataFeedGranularityType; +import com.azure.ai.metricsadvisor.administration.models.DataFeedIngestionSettings; +import com.azure.ai.metricsadvisor.administration.models.DataFeedMetric; +import com.azure.ai.metricsadvisor.administration.models.DataFeedOptions; +import com.azure.ai.metricsadvisor.administration.models.DataFeedRollupSettings; +import com.azure.ai.metricsadvisor.administration.models.DataFeedRollupType; +import com.azure.ai.metricsadvisor.administration.models.DataFeedSchema; +import com.azure.ai.metricsadvisor.administration.models.DetectionConditionsOperator; +import com.azure.ai.metricsadvisor.administration.models.EmailNotificationHook; +import com.azure.ai.metricsadvisor.administration.models.HardThresholdCondition; +import com.azure.ai.metricsadvisor.administration.models.ListDataFeedIngestionOptions; +import com.azure.ai.metricsadvisor.administration.models.MetricAnomalyAlertConditions; +import com.azure.ai.metricsadvisor.administration.models.MetricAnomalyAlertConfiguration; +import com.azure.ai.metricsadvisor.administration.models.MetricAnomalyAlertConfigurationsOperator; +import com.azure.ai.metricsadvisor.administration.models.MetricAnomalyAlertScope; +import com.azure.ai.metricsadvisor.administration.models.MetricWholeSeriesDetectionCondition; import com.azure.ai.metricsadvisor.models.MetricsAdvisorKeyCredential; -import com.azure.ai.metricsadvisor.models.MySqlDataFeedSource; -import com.azure.ai.metricsadvisor.models.NotificationHook; -import com.azure.ai.metricsadvisor.models.SQLServerDataFeedSource; -import com.azure.ai.metricsadvisor.models.SeverityCondition; -import com.azure.ai.metricsadvisor.models.SmartDetectionCondition; -import com.azure.ai.metricsadvisor.models.SuppressCondition; +import com.azure.ai.metricsadvisor.administration.models.MySqlDataFeedSource; +import com.azure.ai.metricsadvisor.administration.models.NotificationHook; +import com.azure.ai.metricsadvisor.administration.models.SeverityCondition; +import com.azure.ai.metricsadvisor.administration.models.SmartDetectionCondition; +import com.azure.ai.metricsadvisor.administration.models.SqlServerDataFeedSource; +import com.azure.ai.metricsadvisor.administration.models.SuppressCondition; import com.azure.core.credential.TokenCredential; import com.azure.core.exception.HttpResponseException; import com.azure.identity.DefaultAzureCredentialBuilder; @@ -43,7 +43,7 @@ import java.time.OffsetDateTime; import java.util.Arrays; -import static com.azure.ai.metricsadvisor.models.DataFeedSourceType.SQL_SERVER_DB; +import static com.azure.ai.metricsadvisor.administration.models.DataFeedSourceType.SQL_SERVER_DB; /** * WARNING: MODIFYING THIS FILE WILL REQUIRE CORRESPONDING UPDATES TO README.md FILE. LINE NUMBERS ARE USED TO EXTRACT @@ -143,7 +143,7 @@ public void createDataFeed() { if (SQL_SERVER_DB == createdSqlDataFeed.getSourceType()) { System.out.printf("Data feed sql server query: %s%n", - ((SQLServerDataFeedSource) createdSqlDataFeed.getSource()).getQuery()); + ((SqlServerDataFeedSource) createdSqlDataFeed.getSource()).getQuery()); } } @@ -263,7 +263,7 @@ public void queryAlertsForDetection() { System.out.printf("AnomalyAlert created on: %s%n", alert.getCreatedTime()); // List anomalies for returned alerts - metricsAdvisorClient.listAnomaliesForAlert( + metricsAdvisorClient.listAnomalies( alertConfigurationId, alert.getId()) .forEach(anomaly -> { diff --git a/sdk/metricsadvisor/azure-ai-metricsadvisor/src/samples/java/com/azure/ai/metricsadvisor/administration/AnomalyDetectionConfigurationAsyncSample.java b/sdk/metricsadvisor/azure-ai-metricsadvisor/src/samples/java/com/azure/ai/metricsadvisor/administration/AnomalyDetectionConfigurationAsyncSample.java index 97fc054b1e118..bc404d105e6ef 100644 --- a/sdk/metricsadvisor/azure-ai-metricsadvisor/src/samples/java/com/azure/ai/metricsadvisor/administration/AnomalyDetectionConfigurationAsyncSample.java +++ b/sdk/metricsadvisor/azure-ai-metricsadvisor/src/samples/java/com/azure/ai/metricsadvisor/administration/AnomalyDetectionConfigurationAsyncSample.java @@ -3,19 +3,19 @@ package com.azure.ai.metricsadvisor.administration; -import com.azure.ai.metricsadvisor.models.AnomalyDetectionConfiguration; -import com.azure.ai.metricsadvisor.models.AnomalyDetectorDirection; -import com.azure.ai.metricsadvisor.models.ChangeThresholdCondition; -import com.azure.ai.metricsadvisor.models.DetectionConditionsOperator; +import com.azure.ai.metricsadvisor.administration.models.AnomalyDetectionConfiguration; +import com.azure.ai.metricsadvisor.administration.models.AnomalyDetectorDirection; +import com.azure.ai.metricsadvisor.administration.models.ChangeThresholdCondition; +import com.azure.ai.metricsadvisor.administration.models.DetectionConditionsOperator; import com.azure.ai.metricsadvisor.models.DimensionKey; -import com.azure.ai.metricsadvisor.models.HardThresholdCondition; -import com.azure.ai.metricsadvisor.models.ListMetricAnomalyDetectionConfigsOptions; -import com.azure.ai.metricsadvisor.models.MetricSeriesGroupDetectionCondition; -import com.azure.ai.metricsadvisor.models.MetricSingleSeriesDetectionCondition; -import com.azure.ai.metricsadvisor.models.MetricWholeSeriesDetectionCondition; +import com.azure.ai.metricsadvisor.administration.models.HardThresholdCondition; +import com.azure.ai.metricsadvisor.administration.models.ListMetricAnomalyDetectionConfigsOptions; +import com.azure.ai.metricsadvisor.administration.models.MetricSeriesGroupDetectionCondition; +import com.azure.ai.metricsadvisor.administration.models.MetricSingleSeriesDetectionCondition; +import com.azure.ai.metricsadvisor.administration.models.MetricWholeSeriesDetectionCondition; import com.azure.ai.metricsadvisor.models.MetricsAdvisorKeyCredential; -import com.azure.ai.metricsadvisor.models.SmartDetectionCondition; -import com.azure.ai.metricsadvisor.models.SuppressCondition; +import com.azure.ai.metricsadvisor.administration.models.SmartDetectionCondition; +import com.azure.ai.metricsadvisor.administration.models.SuppressCondition; import com.azure.core.http.rest.PagedFlux; import reactor.core.publisher.Mono; diff --git a/sdk/metricsadvisor/azure-ai-metricsadvisor/src/samples/java/com/azure/ai/metricsadvisor/administration/AnomalyDetectionConfigurationSample.java b/sdk/metricsadvisor/azure-ai-metricsadvisor/src/samples/java/com/azure/ai/metricsadvisor/administration/AnomalyDetectionConfigurationSample.java index 4f7124abd75a3..bac9636608b28 100644 --- a/sdk/metricsadvisor/azure-ai-metricsadvisor/src/samples/java/com/azure/ai/metricsadvisor/administration/AnomalyDetectionConfigurationSample.java +++ b/sdk/metricsadvisor/azure-ai-metricsadvisor/src/samples/java/com/azure/ai/metricsadvisor/administration/AnomalyDetectionConfigurationSample.java @@ -3,19 +3,18 @@ package com.azure.ai.metricsadvisor.administration; -import com.azure.ai.metricsadvisor.models.AnomalyDetectionConfiguration; -import com.azure.ai.metricsadvisor.models.AnomalyDetectorDirection; -import com.azure.ai.metricsadvisor.models.ChangeThresholdCondition; -import com.azure.ai.metricsadvisor.models.DetectionConditionsOperator; +import com.azure.ai.metricsadvisor.administration.models.AnomalyDetectionConfiguration; +import com.azure.ai.metricsadvisor.administration.models.AnomalyDetectorDirection; +import com.azure.ai.metricsadvisor.administration.models.ChangeThresholdCondition; +import com.azure.ai.metricsadvisor.administration.models.DetectionConditionsOperator; import com.azure.ai.metricsadvisor.models.DimensionKey; -import com.azure.ai.metricsadvisor.models.HardThresholdCondition; -import com.azure.ai.metricsadvisor.models.ListMetricAnomalyDetectionConfigsOptions; -import com.azure.ai.metricsadvisor.models.MetricSeriesGroupDetectionCondition; -import com.azure.ai.metricsadvisor.models.MetricSingleSeriesDetectionCondition; -import com.azure.ai.metricsadvisor.models.MetricWholeSeriesDetectionCondition; +import com.azure.ai.metricsadvisor.administration.models.HardThresholdCondition; +import com.azure.ai.metricsadvisor.administration.models.MetricSeriesGroupDetectionCondition; +import com.azure.ai.metricsadvisor.administration.models.MetricSingleSeriesDetectionCondition; +import com.azure.ai.metricsadvisor.administration.models.MetricWholeSeriesDetectionCondition; import com.azure.ai.metricsadvisor.models.MetricsAdvisorKeyCredential; -import com.azure.ai.metricsadvisor.models.SmartDetectionCondition; -import com.azure.ai.metricsadvisor.models.SuppressCondition; +import com.azure.ai.metricsadvisor.administration.models.SmartDetectionCondition; +import com.azure.ai.metricsadvisor.administration.models.SuppressCondition; import com.azure.core.http.rest.PagedIterable; import java.util.Arrays; @@ -56,8 +55,7 @@ public static void main(String[] args) { // List configurations System.out.printf("Listing detection configurations%n"); PagedIterable detectionConfigsIterable - = advisorAdministrationClient.listMetricAnomalyDetectionConfigs(metricId, - new ListMetricAnomalyDetectionConfigsOptions()); + = advisorAdministrationClient.listMetricAnomalyDetectionConfigs(metricId); for (AnomalyDetectionConfiguration detectionConfig : detectionConfigsIterable) { printDetectionConfiguration(detectionConfig); diff --git a/sdk/metricsadvisor/azure-ai-metricsadvisor/src/samples/java/com/azure/ai/metricsadvisor/administration/DataFeedIngestionAsyncSample.java b/sdk/metricsadvisor/azure-ai-metricsadvisor/src/samples/java/com/azure/ai/metricsadvisor/administration/DataFeedIngestionAsyncSample.java index 0c1cba4c142e0..e33e8702eb513 100644 --- a/sdk/metricsadvisor/azure-ai-metricsadvisor/src/samples/java/com/azure/ai/metricsadvisor/administration/DataFeedIngestionAsyncSample.java +++ b/sdk/metricsadvisor/azure-ai-metricsadvisor/src/samples/java/com/azure/ai/metricsadvisor/administration/DataFeedIngestionAsyncSample.java @@ -3,7 +3,7 @@ package com.azure.ai.metricsadvisor.administration; -import com.azure.ai.metricsadvisor.models.ListDataFeedIngestionOptions; +import com.azure.ai.metricsadvisor.administration.models.ListDataFeedIngestionOptions; import com.azure.ai.metricsadvisor.models.MetricsAdvisorKeyCredential; import java.time.OffsetDateTime; diff --git a/sdk/metricsadvisor/azure-ai-metricsadvisor/src/samples/java/com/azure/ai/metricsadvisor/administration/DataFeedIngestionSample.java b/sdk/metricsadvisor/azure-ai-metricsadvisor/src/samples/java/com/azure/ai/metricsadvisor/administration/DataFeedIngestionSample.java index 4c9bed81fd0d4..409b25df167a1 100644 --- a/sdk/metricsadvisor/azure-ai-metricsadvisor/src/samples/java/com/azure/ai/metricsadvisor/administration/DataFeedIngestionSample.java +++ b/sdk/metricsadvisor/azure-ai-metricsadvisor/src/samples/java/com/azure/ai/metricsadvisor/administration/DataFeedIngestionSample.java @@ -3,9 +3,9 @@ package com.azure.ai.metricsadvisor.administration; -import com.azure.ai.metricsadvisor.models.DataFeedIngestionProgress; -import com.azure.ai.metricsadvisor.models.DataFeedIngestionStatus; -import com.azure.ai.metricsadvisor.models.ListDataFeedIngestionOptions; +import com.azure.ai.metricsadvisor.administration.models.DataFeedIngestionProgress; +import com.azure.ai.metricsadvisor.administration.models.DataFeedIngestionStatus; +import com.azure.ai.metricsadvisor.administration.models.ListDataFeedIngestionOptions; import com.azure.ai.metricsadvisor.models.MetricsAdvisorKeyCredential; import com.azure.core.http.rest.PagedIterable; diff --git a/sdk/metricsadvisor/azure-ai-metricsadvisor/src/samples/java/com/azure/ai/metricsadvisor/administration/DatafeedAsyncSample.java b/sdk/metricsadvisor/azure-ai-metricsadvisor/src/samples/java/com/azure/ai/metricsadvisor/administration/DatafeedAsyncSample.java index bf56085da4769..e33629591ac02 100644 --- a/sdk/metricsadvisor/azure-ai-metricsadvisor/src/samples/java/com/azure/ai/metricsadvisor/administration/DatafeedAsyncSample.java +++ b/sdk/metricsadvisor/azure-ai-metricsadvisor/src/samples/java/com/azure/ai/metricsadvisor/administration/DatafeedAsyncSample.java @@ -3,16 +3,16 @@ package com.azure.ai.metricsadvisor.administration; -import com.azure.ai.metricsadvisor.models.AzureAppInsightsDataFeedSource; -import com.azure.ai.metricsadvisor.models.DataFeed; -import com.azure.ai.metricsadvisor.models.DataFeedDimension; -import com.azure.ai.metricsadvisor.models.DataFeedGranularity; -import com.azure.ai.metricsadvisor.models.DataFeedGranularityType; -import com.azure.ai.metricsadvisor.models.DataFeedIngestionSettings; -import com.azure.ai.metricsadvisor.models.DataFeedMetric; -import com.azure.ai.metricsadvisor.models.DataFeedOptions; -import com.azure.ai.metricsadvisor.models.DataFeedSchema; -import com.azure.ai.metricsadvisor.models.DataFeedSourceType; +import com.azure.ai.metricsadvisor.administration.models.AzureAppInsightsDataFeedSource; +import com.azure.ai.metricsadvisor.administration.models.DataFeed; +import com.azure.ai.metricsadvisor.administration.models.DataFeedDimension; +import com.azure.ai.metricsadvisor.administration.models.DataFeedGranularity; +import com.azure.ai.metricsadvisor.administration.models.DataFeedGranularityType; +import com.azure.ai.metricsadvisor.administration.models.DataFeedIngestionSettings; +import com.azure.ai.metricsadvisor.administration.models.DataFeedMetric; +import com.azure.ai.metricsadvisor.administration.models.DataFeedOptions; +import com.azure.ai.metricsadvisor.administration.models.DataFeedSchema; +import com.azure.ai.metricsadvisor.administration.models.DataFeedSourceType; import com.azure.ai.metricsadvisor.models.MetricsAdvisorKeyCredential; import reactor.core.publisher.Mono; diff --git a/sdk/metricsadvisor/azure-ai-metricsadvisor/src/samples/java/com/azure/ai/metricsadvisor/administration/DatafeedSample.java b/sdk/metricsadvisor/azure-ai-metricsadvisor/src/samples/java/com/azure/ai/metricsadvisor/administration/DatafeedSample.java index 408af9b8b42cd..94a165b4bfd55 100644 --- a/sdk/metricsadvisor/azure-ai-metricsadvisor/src/samples/java/com/azure/ai/metricsadvisor/administration/DatafeedSample.java +++ b/sdk/metricsadvisor/azure-ai-metricsadvisor/src/samples/java/com/azure/ai/metricsadvisor/administration/DatafeedSample.java @@ -3,16 +3,16 @@ package com.azure.ai.metricsadvisor.administration; -import com.azure.ai.metricsadvisor.models.AzureAppInsightsDataFeedSource; -import com.azure.ai.metricsadvisor.models.DataFeed; -import com.azure.ai.metricsadvisor.models.DataFeedDimension; -import com.azure.ai.metricsadvisor.models.DataFeedGranularity; -import com.azure.ai.metricsadvisor.models.DataFeedGranularityType; -import com.azure.ai.metricsadvisor.models.DataFeedIngestionSettings; -import com.azure.ai.metricsadvisor.models.DataFeedMetric; -import com.azure.ai.metricsadvisor.models.DataFeedOptions; -import com.azure.ai.metricsadvisor.models.DataFeedSchema; -import com.azure.ai.metricsadvisor.models.DataFeedSourceType; +import com.azure.ai.metricsadvisor.administration.models.AzureAppInsightsDataFeedSource; +import com.azure.ai.metricsadvisor.administration.models.DataFeed; +import com.azure.ai.metricsadvisor.administration.models.DataFeedDimension; +import com.azure.ai.metricsadvisor.administration.models.DataFeedGranularity; +import com.azure.ai.metricsadvisor.administration.models.DataFeedGranularityType; +import com.azure.ai.metricsadvisor.administration.models.DataFeedIngestionSettings; +import com.azure.ai.metricsadvisor.administration.models.DataFeedMetric; +import com.azure.ai.metricsadvisor.administration.models.DataFeedOptions; +import com.azure.ai.metricsadvisor.administration.models.DataFeedSchema; +import com.azure.ai.metricsadvisor.administration.models.DataFeedSourceType; import com.azure.ai.metricsadvisor.models.MetricsAdvisorKeyCredential; import java.time.OffsetDateTime; diff --git a/sdk/metricsadvisor/azure-ai-metricsadvisor/src/samples/java/com/azure/ai/metricsadvisor/administration/DatasourceCredentialAsyncSample.java b/sdk/metricsadvisor/azure-ai-metricsadvisor/src/samples/java/com/azure/ai/metricsadvisor/administration/DatasourceCredentialAsyncSample.java new file mode 100644 index 0000000000000..b4f39c07f0315 --- /dev/null +++ b/sdk/metricsadvisor/azure-ai-metricsadvisor/src/samples/java/com/azure/ai/metricsadvisor/administration/DatasourceCredentialAsyncSample.java @@ -0,0 +1,136 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +package com.azure.ai.metricsadvisor.administration; + +import com.azure.ai.metricsadvisor.administration.models.DatasourceCredentialEntity; +import com.azure.ai.metricsadvisor.administration.models.DatasourceServicePrincipalInKeyVault; +import com.azure.ai.metricsadvisor.models.MetricsAdvisorKeyCredential; +import reactor.core.publisher.Mono; + +import java.util.UUID; + +/** + * Async sample demonstrates how to create, get, update, delete and list datasource credential entity. + */ +public class DatasourceCredentialAsyncSample { + public static void main(String[] args) { + final MetricsAdvisorAdministrationAsyncClient advisorAdministrationAsyncClient = + new MetricsAdvisorAdministrationClientBuilder() + .endpoint("https://{endpoint}.cognitiveservices.azure.com/") + .credential(new MetricsAdvisorKeyCredential("subscription_key", "api_key")) + .buildAsyncClient(); + + // Create Datasource credential entity + System.out.printf("Creating Datasource Credential entity%n"); + + final String name = "sample_name" + UUID.randomUUID(); + final String cId = "f45668b2-bffa-11eb-8529-0246ac130003"; + final String tId = "67890ded-5e07-4e52-b225-4ae8f905afb5"; + final String mockSecr = "890hy69-5e07-4e52-b225-4ae8f905afb5"; + + DatasourceCredentialEntity datasourceCredential = new DatasourceServicePrincipalInKeyVault() + .setName(name) + .setKeyVaultForDatasourceSecrets("kv", cId, mockSecr) + .setTenantId(tId) + .setSecretNameForDatasourceClientId("DSClientID_1") + .setSecretNameForDatasourceClientSecret("DSClientSer_1"); + + final Mono createdDatasourceCredentialEntityMono = advisorAdministrationAsyncClient + .createDatasourceCredential(datasourceCredential); + + createdDatasourceCredentialEntityMono + .doOnSubscribe(__ -> + System.out.printf("Creating Datasource credential entity%n")) + .doOnSuccess(datasourceCredentialEntity -> + System.out.printf("Created Datasource credential entity: %s%n", datasourceCredentialEntity.getId())); + + // Retrieve the datasource credential entity that just created. + Mono fetchDataFeedMono = + createdDatasourceCredentialEntityMono.flatMap(createdDatasourceCredEntity -> { + return advisorAdministrationAsyncClient.getDatasourceCredential(createdDatasourceCredEntity.getId()) + .doOnSubscribe(__ -> + System.out + .printf("Fetching Datasource credential entity: %s%n", createdDatasourceCredEntity.getId())) + .doOnSuccess(config -> + System.out.printf("Fetched Datasource credential entity%n")) + .doOnNext(credentialEntity -> { + System.out.printf("Datasource credential entity Id : %s%n", credentialEntity.getId()); + System.out.printf("Datasource credential entity name : %s%n", credentialEntity.getName()); + if (credentialEntity instanceof DatasourceServicePrincipalInKeyVault) { + DatasourceServicePrincipalInKeyVault actualCredentialSPInKV + = (DatasourceServicePrincipalInKeyVault) credentialEntity; + System.out + .printf("Actual credential entity key vault endpoint: %s%n", + actualCredentialSPInKV.getKeyVaultEndpoint()); + System.out.printf("Actual credential entity key vault client Id: %s%n", + actualCredentialSPInKV.getKeyVaultClientId()); + System.out.printf("Actual credential entity key vault secret name for data source: %s%n", + actualCredentialSPInKV.getSecretNameForDatasourceClientId()); + System.out.printf("Actual credential entity key vault secret for data source: %s%n", + actualCredentialSPInKV.getSecretNameForDatasourceClientSecret()); + } + }); + }); + + // Update the datasource credential entity. + Mono updateDatasourcCredMono = fetchDataFeedMono + .flatMap(datasourceCredEntity -> { + DatasourceServicePrincipalInKeyVault actualCredentialSPInKV = null; + if (datasourceCredEntity instanceof DatasourceServicePrincipalInKeyVault) { + actualCredentialSPInKV = (DatasourceServicePrincipalInKeyVault) datasourceCredEntity; + } + + return advisorAdministrationAsyncClient.updateDatasourceCredential( + actualCredentialSPInKV.setSecretNameForDatasourceClientId("clientIdSecretName")) + .doOnSubscribe(__ -> + System.out.printf("Updating datasource credential entity: %s%n", datasourceCredEntity.getId())) + .doOnSuccess(config -> { + + System.out.printf("Updated datasource credential entity%n"); + System.out.printf("Updated datasource credential entity client Id: %s%n", + ((DatasourceServicePrincipalInKeyVault) datasourceCredEntity) + .getSecretNameForDatasourceClientId()); + }); + }); + + // Delete the datasource credential entity. + Mono deleteDatasourceCredMono = updateDatasourcCredMono.flatMap(datasourceCredEntity -> { + return advisorAdministrationAsyncClient.deleteDatasourceCredential(datasourceCredEntity.getId()) + .doOnSubscribe(__ -> + System.out.printf("Deleting datasource credential entity: %s%n", datasourceCredEntity.getId())) + .doOnSuccess(config -> + System.out.printf("Deleted datasource credential entity%n")); + }); + + /* + This will block until all the above CRUD on operation on email hook is completed. + This is strongly discouraged for use in production as it eliminates the benefits + of asynchronous IO. It is used here to ensure the sample runs to completion. + */ + deleteDatasourceCredMono.block(); + + // List datasource credential entity. + System.out.printf("Listing datasource credential entity%n"); + advisorAdministrationAsyncClient.listDatasourceCredentials() + .doOnNext(datasourceCredentialEntity -> { + System.out.printf("Datasource credential entity Id: %s%n", datasourceCredentialEntity.getId()); + System.out.printf("Datasource credential entity name: %s%n", datasourceCredentialEntity.getName()); + System.out.printf("Datasource credential entity description: %s%n", + datasourceCredentialEntity.getDescription()); + if (datasourceCredentialEntity instanceof DatasourceServicePrincipalInKeyVault) { + DatasourceServicePrincipalInKeyVault actualCredentialSPInKV + = (DatasourceServicePrincipalInKeyVault) datasourceCredentialEntity; + System.out + .printf("Actual credential entity key vault endpoint: %s%n", + actualCredentialSPInKV.getKeyVaultEndpoint()); + System.out.printf("Actual credential entity key vault client Id: %s%n", + actualCredentialSPInKV.getKeyVaultClientId()); + System.out.printf("Actual credential entity key vault secret name for data source: %s%n", + actualCredentialSPInKV.getSecretNameForDatasourceClientId()); + System.out.printf("Actual credential entity key vault secret for data source: %s%n", + actualCredentialSPInKV.getSecretNameForDatasourceClientSecret()); + } + }); + } +} diff --git a/sdk/metricsadvisor/azure-ai-metricsadvisor/src/samples/java/com/azure/ai/metricsadvisor/administration/DatasourceCredentialSample.java b/sdk/metricsadvisor/azure-ai-metricsadvisor/src/samples/java/com/azure/ai/metricsadvisor/administration/DatasourceCredentialSample.java new file mode 100644 index 0000000000000..6b47ce7566d08 --- /dev/null +++ b/sdk/metricsadvisor/azure-ai-metricsadvisor/src/samples/java/com/azure/ai/metricsadvisor/administration/DatasourceCredentialSample.java @@ -0,0 +1,109 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +package com.azure.ai.metricsadvisor.administration; + +import com.azure.ai.metricsadvisor.administration.models.DatasourceCredentialEntity; +import com.azure.ai.metricsadvisor.administration.models.DatasourceServicePrincipalInKeyVault; +import com.azure.ai.metricsadvisor.models.MetricsAdvisorKeyCredential; + +import java.util.UUID; + +/** + * Async sample demonstrates how to create, get, update, delete and list datasource credential entity. + */ +public class DatasourceCredentialSample { + public static void main(String[] args) { + final MetricsAdvisorAdministrationClient advisorAdministrationClient = + new MetricsAdvisorAdministrationClientBuilder() + .endpoint("https://{endpoint}.cognitiveservices.azure.com/") + .credential(new MetricsAdvisorKeyCredential("subscription_key", "api_key")) + .buildClient(); + + // Create Datasource credential entity + System.out.printf("Creating Datasource Credential entity%n"); + + final String name = "sample_name" + UUID.randomUUID(); + final String cId = "f45668b2-bffa-11eb-8529-0246ac130003"; + final String tId = "67890ded-5e07-4e52-b225-4ae8f905afb5"; + final String mockSecr = "890hy69-5e07-4e52-b225-4ae8f905afb5"; + + DatasourceCredentialEntity datasourceCredential = new DatasourceServicePrincipalInKeyVault() + .setName(name) + .setKeyVaultForDatasourceSecrets("kv", cId, mockSecr) + .setTenantId(tId) + .setSecretNameForDatasourceClientId("DSClientID_1") + .setSecretNameForDatasourceClientSecret("DSClientSer_1"); + + DatasourceCredentialEntity createdDatasourceCredentialEntity = advisorAdministrationClient + .createDatasourceCredential(datasourceCredential); + + + System.out.printf("Created Datasource credential entity: %s"); + + // Retrieve the datasource credential entity that just created. + DatasourceCredentialEntity fetchDatasourceCredEntity + = advisorAdministrationClient.getDatasourceCredential(createdDatasourceCredentialEntity.getId()); + System.out.printf("Fetched Datasource credential entity%n"); + + System.out.printf("Datasource credential entity Id : %s%n", fetchDatasourceCredEntity.getId()); + System.out.printf("Datasource credential entity name : %s%n", fetchDatasourceCredEntity.getName()); + if (fetchDatasourceCredEntity instanceof DatasourceServicePrincipalInKeyVault) { + DatasourceServicePrincipalInKeyVault actualCredentialSPInKV + = (DatasourceServicePrincipalInKeyVault) fetchDatasourceCredEntity; + System.out + .printf("Actual credential entity key vault endpoint: %s%n", + actualCredentialSPInKV.getKeyVaultEndpoint()); + System.out.printf("Actual credential entity key vault client Id: %s%n", + actualCredentialSPInKV.getKeyVaultClientId()); + System.out.printf("Actual credential entity key vault secret name for data source: %s%n", + actualCredentialSPInKV.getSecretNameForDatasourceClientId()); + System.out.printf("Actual credential entity key vault secret for data source: %s%n", + actualCredentialSPInKV.getSecretNameForDatasourceClientSecret()); + } + + // Update the datasource credential entity. + DatasourceServicePrincipalInKeyVault actualCredentialSPInKV = null; + if (fetchDatasourceCredEntity instanceof DatasourceServicePrincipalInKeyVault) { + actualCredentialSPInKV = (DatasourceServicePrincipalInKeyVault) fetchDatasourceCredEntity; + } + + DatasourceCredentialEntity updatedDatasourceCred = + advisorAdministrationClient.updateDatasourceCredential( + actualCredentialSPInKV.setSecretNameForDatasourceClientId("clientIdSecretName")); + + System.out.printf("Updated datasource credential entity%n"); + System.out.printf("Updated datasource credential entity client Id: %s%n", + ((DatasourceServicePrincipalInKeyVault) updatedDatasourceCred) + .getSecretNameForDatasourceClientId()); + + + // Delete the datasource credential entity. + advisorAdministrationClient.deleteDatasourceCredential(fetchDatasourceCredEntity.getId()); + + System.out.printf("Deleted datasource credential entity%n"); + + // List datasource credential entity. + System.out.printf("Listing datasource credential entity%n"); + advisorAdministrationClient.listDatasourceCredentials() + .forEach(datasourceCredentialEntity -> { + System.out.printf("Datasource credential entity Id: %s%n", datasourceCredentialEntity.getId()); + System.out.printf("Datasource credential entity name: %s%n", datasourceCredentialEntity.getName()); + System.out.printf("Datasource credential entity description: %s%n", + datasourceCredentialEntity.getDescription()); + if (datasourceCredentialEntity instanceof DatasourceServicePrincipalInKeyVault) { + DatasourceServicePrincipalInKeyVault actualCredentialSPInKVItem + = (DatasourceServicePrincipalInKeyVault) datasourceCredentialEntity; + System.out + .printf("Actual credential entity key vault endpoint: %s%n", + actualCredentialSPInKVItem.getKeyVaultEndpoint()); + System.out.printf("Actual credential entity key vault client Id: %s%n", + actualCredentialSPInKVItem.getKeyVaultClientId()); + System.out.printf("Actual credential entity key vault secret name for data source: %s%n", + actualCredentialSPInKVItem.getSecretNameForDatasourceClientId()); + System.out.printf("Actual credential entity key vault secret for data source: %s%n", + actualCredentialSPInKVItem.getSecretNameForDatasourceClientSecret()); + } + }); + } +} diff --git a/sdk/metricsadvisor/azure-ai-metricsadvisor/src/samples/java/com/azure/ai/metricsadvisor/administration/HookAsyncSample.java b/sdk/metricsadvisor/azure-ai-metricsadvisor/src/samples/java/com/azure/ai/metricsadvisor/administration/HookAsyncSample.java index f991e60921e8c..715bcd20b17e1 100644 --- a/sdk/metricsadvisor/azure-ai-metricsadvisor/src/samples/java/com/azure/ai/metricsadvisor/administration/HookAsyncSample.java +++ b/sdk/metricsadvisor/azure-ai-metricsadvisor/src/samples/java/com/azure/ai/metricsadvisor/administration/HookAsyncSample.java @@ -3,10 +3,10 @@ package com.azure.ai.metricsadvisor.administration; -import com.azure.ai.metricsadvisor.models.EmailNotificationHook; -import com.azure.ai.metricsadvisor.models.NotificationHook; +import com.azure.ai.metricsadvisor.administration.models.EmailNotificationHook; +import com.azure.ai.metricsadvisor.administration.models.NotificationHook; import com.azure.ai.metricsadvisor.models.MetricsAdvisorKeyCredential; -import com.azure.ai.metricsadvisor.models.WebNotificationHook; +import com.azure.ai.metricsadvisor.administration.models.WebNotificationHook; import com.azure.core.http.rest.PagedFlux; import reactor.core.publisher.Mono; diff --git a/sdk/metricsadvisor/azure-ai-metricsadvisor/src/samples/java/com/azure/ai/metricsadvisor/administration/HookSample.java b/sdk/metricsadvisor/azure-ai-metricsadvisor/src/samples/java/com/azure/ai/metricsadvisor/administration/HookSample.java index f410ca2e29524..5e82588637246 100644 --- a/sdk/metricsadvisor/azure-ai-metricsadvisor/src/samples/java/com/azure/ai/metricsadvisor/administration/HookSample.java +++ b/sdk/metricsadvisor/azure-ai-metricsadvisor/src/samples/java/com/azure/ai/metricsadvisor/administration/HookSample.java @@ -3,10 +3,10 @@ package com.azure.ai.metricsadvisor.administration; -import com.azure.ai.metricsadvisor.models.EmailNotificationHook; -import com.azure.ai.metricsadvisor.models.NotificationHook; +import com.azure.ai.metricsadvisor.administration.models.EmailNotificationHook; +import com.azure.ai.metricsadvisor.administration.models.NotificationHook; import com.azure.ai.metricsadvisor.models.MetricsAdvisorKeyCredential; -import com.azure.ai.metricsadvisor.models.WebNotificationHook; +import com.azure.ai.metricsadvisor.administration.models.WebNotificationHook; import com.azure.core.http.rest.PagedIterable; /** diff --git a/sdk/metricsadvisor/azure-ai-metricsadvisor/src/samples/java/com/azure/ai/metricsadvisor/administration/MetricsAdvisorAdministrationAsyncClientJavaDocCodeSnippets.java b/sdk/metricsadvisor/azure-ai-metricsadvisor/src/samples/java/com/azure/ai/metricsadvisor/administration/MetricsAdvisorAdministrationAsyncClientJavaDocCodeSnippets.java index cdb740e16fdcf..fd6cf16bb6ab8 100644 --- a/sdk/metricsadvisor/azure-ai-metricsadvisor/src/samples/java/com/azure/ai/metricsadvisor/administration/MetricsAdvisorAdministrationAsyncClientJavaDocCodeSnippets.java +++ b/sdk/metricsadvisor/azure-ai-metricsadvisor/src/samples/java/com/azure/ai/metricsadvisor/administration/MetricsAdvisorAdministrationAsyncClientJavaDocCodeSnippets.java @@ -3,47 +3,50 @@ 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.AnomalyDetectorDirection; -import com.azure.ai.metricsadvisor.models.ChangeThresholdCondition; -import com.azure.ai.metricsadvisor.models.DataFeed; -import com.azure.ai.metricsadvisor.models.DataFeedDimension; -import com.azure.ai.metricsadvisor.models.DataFeedGranularity; -import com.azure.ai.metricsadvisor.models.DataFeedGranularityType; -import com.azure.ai.metricsadvisor.models.DataFeedIngestionProgress; -import com.azure.ai.metricsadvisor.models.DataFeedIngestionSettings; -import com.azure.ai.metricsadvisor.models.DataFeedOptions; -import com.azure.ai.metricsadvisor.models.DataFeedRollupSettings; -import com.azure.ai.metricsadvisor.models.DataFeedRollupType; -import com.azure.ai.metricsadvisor.models.DataFeedSchema; -import com.azure.ai.metricsadvisor.models.DataFeedStatus; -import com.azure.ai.metricsadvisor.models.DetectionConditionsOperator; +import com.azure.ai.metricsadvisor.administration.models.AnomalyAlertConfiguration; +import com.azure.ai.metricsadvisor.administration.models.AnomalyDetectionConfiguration; +import com.azure.ai.metricsadvisor.administration.models.AnomalyDetectorDirection; +import com.azure.ai.metricsadvisor.administration.models.AnomalySeverity; +import com.azure.ai.metricsadvisor.administration.models.ChangeThresholdCondition; +import com.azure.ai.metricsadvisor.administration.models.DataFeed; +import com.azure.ai.metricsadvisor.administration.models.DataFeedDimension; +import com.azure.ai.metricsadvisor.administration.models.DataFeedGranularity; +import com.azure.ai.metricsadvisor.administration.models.DataFeedGranularityType; +import com.azure.ai.metricsadvisor.administration.models.DataFeedIngestionProgress; +import com.azure.ai.metricsadvisor.administration.models.DataFeedIngestionSettings; +import com.azure.ai.metricsadvisor.administration.models.DataFeedMetric; +import com.azure.ai.metricsadvisor.administration.models.DataFeedOptions; +import com.azure.ai.metricsadvisor.administration.models.DataFeedRollupSettings; +import com.azure.ai.metricsadvisor.administration.models.DataFeedRollupType; +import com.azure.ai.metricsadvisor.administration.models.DataFeedSchema; +import com.azure.ai.metricsadvisor.administration.models.DataFeedStatus; +import com.azure.ai.metricsadvisor.administration.models.DatasourceCredentialEntity; +import com.azure.ai.metricsadvisor.administration.models.DatasourceServicePrincipalInKeyVault; +import com.azure.ai.metricsadvisor.administration.models.DetectionConditionsOperator; import com.azure.ai.metricsadvisor.models.DimensionKey; -import com.azure.ai.metricsadvisor.models.EmailNotificationHook; -import com.azure.ai.metricsadvisor.models.HardThresholdCondition; -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.DataFeedMetric; -import com.azure.ai.metricsadvisor.models.MetricAnomalyAlertConditions; -import com.azure.ai.metricsadvisor.models.MetricAnomalyAlertConfiguration; -import com.azure.ai.metricsadvisor.models.MetricAnomalyAlertConfigurationsOperator; -import com.azure.ai.metricsadvisor.models.MetricAnomalyAlertScope; -import com.azure.ai.metricsadvisor.models.MetricSeriesGroupDetectionCondition; -import com.azure.ai.metricsadvisor.models.MetricSingleSeriesDetectionCondition; -import com.azure.ai.metricsadvisor.models.MetricWholeSeriesDetectionCondition; +import com.azure.ai.metricsadvisor.administration.models.EmailNotificationHook; +import com.azure.ai.metricsadvisor.administration.models.HardThresholdCondition; +import com.azure.ai.metricsadvisor.administration.models.ListAnomalyAlertConfigsOptions; +import com.azure.ai.metricsadvisor.administration.models.ListCredentialEntityOptions; +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.ListMetricAnomalyDetectionConfigsOptions; +import com.azure.ai.metricsadvisor.administration.models.MetricAnomalyAlertConditions; +import com.azure.ai.metricsadvisor.administration.models.MetricAnomalyAlertConfiguration; +import com.azure.ai.metricsadvisor.administration.models.MetricAnomalyAlertConfigurationsOperator; +import com.azure.ai.metricsadvisor.administration.models.MetricAnomalyAlertScope; +import com.azure.ai.metricsadvisor.administration.models.MetricSeriesGroupDetectionCondition; +import com.azure.ai.metricsadvisor.administration.models.MetricSingleSeriesDetectionCondition; +import com.azure.ai.metricsadvisor.administration.models.MetricWholeSeriesDetectionCondition; import com.azure.ai.metricsadvisor.models.MetricsAdvisorKeyCredential; -import com.azure.ai.metricsadvisor.models.MySqlDataFeedSource; -import com.azure.ai.metricsadvisor.models.AnomalySeverity; -import com.azure.ai.metricsadvisor.models.SeverityCondition; -import com.azure.ai.metricsadvisor.models.SmartDetectionCondition; -import com.azure.ai.metricsadvisor.models.SuppressCondition; -import com.azure.ai.metricsadvisor.models.WebNotificationHook; +import com.azure.ai.metricsadvisor.administration.models.MySqlDataFeedSource; +import com.azure.ai.metricsadvisor.administration.models.NotificationHook; +import com.azure.ai.metricsadvisor.administration.models.SeverityCondition; +import com.azure.ai.metricsadvisor.administration.models.SmartDetectionCondition; +import com.azure.ai.metricsadvisor.administration.models.SuppressCondition; +import com.azure.ai.metricsadvisor.administration.models.WebNotificationHook; import com.azure.core.http.HttpPipeline; import com.azure.core.http.HttpPipelineBuilder; import com.azure.core.util.Context; @@ -51,6 +54,7 @@ import java.time.OffsetDateTime; import java.util.Arrays; import java.util.List; +import java.util.UUID; /** * Code snippet for {@link MetricsAdvisorAdministrationAsyncClient} @@ -546,7 +550,7 @@ public void listHooksWithOptions() { /** * Code snippet for {@link MetricsAdvisorAdministrationAsyncClient#listDataFeedIngestionStatus(String, ListDataFeedIngestionOptions)}. */ - public void listDataFeedIngestionStatus() { + public void listDataFeedIngestionStatusWithOptions() { // BEGIN: com.azure.ai.metricsadvisor.administration.MetricsAdvisorAdministrationAsyncClient.listDataFeedIngestionStatus#String-ListDataFeedIngestionOptions final String dataFeedId = "4957a2f7-a0f4-4fc0-b8d7-d866c1df0f4c"; final OffsetDateTime startTime = OffsetDateTime.parse("2020-01-01T00:00:00Z"); @@ -1065,10 +1069,23 @@ public void getDetectionConfigurationWithResponse() { // END: com.azure.ai.metricsadvisor.administration.MetricsAdvisorAdministrationAsyncClient.getMetricAnomalyDetectionConfigWithResponse#String } + public void listDetectionConfigurations() { + // BEGIN: com.azure.ai.metricsadvisor.administration.MetricsAdvisorAdministrationAsyncClient.listMetricAnomalyDetectionConfigs#String + final String metricId = "0b836da8-10e6-46cd-8f4f-28262e113a62"; + metricsAdvisorAdminAsyncClient.listMetricAnomalyDetectionConfigs(metricId) + .subscribe(detectionConfig -> { + System.out.printf("Detection config Id: %s%n", detectionConfig.getId()); + System.out.printf("Name: %s%n", detectionConfig.getName()); + System.out.printf("Description: %s%n", detectionConfig.getDescription()); + System.out.printf("MetricId: %s%n", detectionConfig.getMetricId()); + }); + // END: com.azure.ai.metricsadvisor.administration.MetricsAdvisorAdministrationAsyncClient.listMetricAnomalyDetectionConfigs#String + } + /** * Code snippet for {@link MetricsAdvisorAdministrationAsyncClient#listMetricAnomalyDetectionConfigs(String, ListMetricAnomalyDetectionConfigsOptions)}. */ - public void listDetectionConfigurations() { + public void listDetectionConfigurationsWithOptions() { // BEGIN: com.azure.ai.metricsadvisor.administration.MetricsAdvisorAdministrationAsyncClient.listMetricAnomalyDetectionConfigs#String-ListMetricAnomalyDetectionConfigsOptions final String metricId = "0b836da8-10e6-46cd-8f4f-28262e113a62"; metricsAdvisorAdminAsyncClient.listMetricAnomalyDetectionConfigs(metricId, @@ -1385,4 +1402,264 @@ public void listAnomalyAlertConfigurations() { }); // END: com.azure.ai.metricsadvisor.administration.MetricsAdvisorAdministrationAsyncClient.listAnomalyAlertConfigs#String-ListAnomalyAlertConfigsOptions } + + /** + * Code snippet for {@link MetricsAdvisorAdministrationAsyncClient#createDatasourceCredential(DatasourceCredentialEntity)}. + */ + public void createDatasourceCredential() { + // BEGIN: com.azure.ai.metricsadvisor.administration.MetricsAdvisorAdministrationAsyncClient.createDatasourceCredential#DatasourceCredentialEntity + DatasourceCredentialEntity datasourceCredential; + final String name = "sample_name" + UUID.randomUUID(); + final String cId = "f45668b2-bffa-11eb-8529-0246ac130003"; + final String tId = "67890ded-5e07-4e52-b225-4ae8f905afb5"; + final String mockSecr = "890hy69-5e07-4e52-b225-4ae8f905afb5"; + + datasourceCredential = new DatasourceServicePrincipalInKeyVault() + .setName(name) + .setKeyVaultForDatasourceSecrets("kv", cId, mockSecr) + .setTenantId(tId) + .setSecretNameForDatasourceClientId("DSClientID_1") + .setSecretNameForDatasourceClientSecret("DSClientSer_1"); + + metricsAdvisorAdminAsyncClient.createDatasourceCredential(datasourceCredential) + .subscribe(credentialEntity -> { + if (credentialEntity instanceof DatasourceServicePrincipalInKeyVault) { + DatasourceServicePrincipalInKeyVault actualCredentialSPInKV + = (DatasourceServicePrincipalInKeyVault) credentialEntity; + System.out + .printf("Actual credential entity key vault endpoint: %s%n", + actualCredentialSPInKV.getKeyVaultEndpoint()); + System.out.printf("Actual credential entity key vault client Id: %s%n", + actualCredentialSPInKV.getKeyVaultClientId()); + System.out.printf("Actual credential entity key vault secret name for data source: %s%n", + actualCredentialSPInKV.getSecretNameForDatasourceClientId()); + System.out.printf("Actual credential entity key vault secret for data source: %s%n", + actualCredentialSPInKV.getSecretNameForDatasourceClientSecret()); + } + }); + // END: com.azure.ai.metricsadvisor.administration.MetricsAdvisorAdministrationAsyncClient.createDatasourceCredential#DatasourceCredentialEntity + } + + /** + * Code snippet for {@link MetricsAdvisorAdministrationAsyncClient#createDatasourceCredentialWithResponse(DatasourceCredentialEntity)}. + */ + public void createDatasourceCredentialWithResponse() { + // BEGIN: com.azure.ai.metricsadvisor.administration.MetricsAdvisorAdministrationAsyncClient.createDatasourceCredentialWithResponse#DatasourceCredentialEntity + DatasourceCredentialEntity datasourceCredential; + final String name = "sample_name" + UUID.randomUUID(); + final String cId = "f45668b2-bffa-11eb-8529-0246ac130003"; + final String tId = "67890ded-5e07-4e52-b225-4ae8f905afb5"; + final String mockSecr = "890hy69-5e07-4e52-b225-4ae8f905afb5"; + + datasourceCredential = new DatasourceServicePrincipalInKeyVault() + .setName(name) + .setKeyVaultForDatasourceSecrets("kv", cId, mockSecr) + .setTenantId(tId) + .setSecretNameForDatasourceClientId("DSClientID_1") + .setSecretNameForDatasourceClientSecret("DSClientSer_1"); + + metricsAdvisorAdminAsyncClient.createDatasourceCredentialWithResponse(datasourceCredential) + .subscribe(credentialEntityWithResponse -> { + System.out.printf("Credential Entity creation operation status: %s%n", + credentialEntityWithResponse.getStatusCode()); + if (credentialEntityWithResponse.getValue() instanceof DatasourceServicePrincipalInKeyVault) { + DatasourceServicePrincipalInKeyVault actualCredentialSPInKV + = (DatasourceServicePrincipalInKeyVault) credentialEntityWithResponse.getValue(); + System.out + .printf("Actual credential entity key vault endpoint: %s%n", + actualCredentialSPInKV.getKeyVaultEndpoint()); + System.out.printf("Actual credential entity key vault client Id: %s%n", + actualCredentialSPInKV.getKeyVaultClientId()); + System.out.printf("Actual credential entity key vault secret name for data source: %s%n", + actualCredentialSPInKV.getSecretNameForDatasourceClientId()); + System.out.printf("Actual credential entity key vault secret for data source: %s%n", + actualCredentialSPInKV.getSecretNameForDatasourceClientSecret()); + } + }); + // END: com.azure.ai.metricsadvisor.administration.MetricsAdvisorAdministrationAsyncClient.createDatasourceCredentialWithResponse#DatasourceCredentialEntity + } + + /** + * Code snippet for {@link MetricsAdvisorAdministrationAsyncClient#updateDatasourceCredential(DatasourceCredentialEntity)}. + */ + public void updateDatasourceCredential() { + // BEGIN: com.azure.ai.metricsadvisor.administration.MetricsAdvisorAdministrationAsyncClient.updateDatasourceCredential#DatasourceCredentialEntity + String credentialId = ""; + metricsAdvisorAdminAsyncClient.getDatasourceCredential(credentialId) + .flatMap(existingDatasourceCredential -> { + DatasourceServicePrincipalInKeyVault actualCredentialSPInKV = null; + if (existingDatasourceCredential instanceof DatasourceServicePrincipalInKeyVault) { + actualCredentialSPInKV = (DatasourceServicePrincipalInKeyVault) existingDatasourceCredential; + } + return metricsAdvisorAdminAsyncClient.updateDatasourceCredential( + actualCredentialSPInKV.setDescription("set updated description")); + }) + .subscribe(credentialEntity -> { + if (credentialEntity instanceof DatasourceServicePrincipalInKeyVault) { + DatasourceServicePrincipalInKeyVault actualCredentialSPInKV + = (DatasourceServicePrincipalInKeyVault) credentialEntity; + System.out.printf("Actual credential entity key vault endpoint: %s%n", + actualCredentialSPInKV.getKeyVaultEndpoint()); + System.out.printf("Actual credential entity key vault updated description: %s%n", + actualCredentialSPInKV.getDescription()); + } + }); + // END: com.azure.ai.metricsadvisor.administration.MetricsAdvisorAdministrationAsyncClient.updateDatasourceCredential#DatasourceCredentialEntity + } + + /** + * Code snippet for {@link MetricsAdvisorAdministrationAsyncClient#updateDatasourceCredentialWithResponse(DatasourceCredentialEntity)}. + */ + public void updateDatasourceCredentialWithResponse() { + // BEGIN: com.azure.ai.metricsadvisor.administration.MetricsAdvisorAdministrationAsyncClient.updateDatasourceCredentialWithResponse#DatasourceCredentialEntity + String credentialId = ""; + metricsAdvisorAdminAsyncClient.getDatasourceCredential(credentialId) + .flatMap(existingDatasourceCredential -> { + DatasourceServicePrincipalInKeyVault actualCredentialSPInKV = null; + if (existingDatasourceCredential instanceof DatasourceServicePrincipalInKeyVault) { + actualCredentialSPInKV = (DatasourceServicePrincipalInKeyVault) existingDatasourceCredential; + } + return metricsAdvisorAdminAsyncClient.updateDatasourceCredentialWithResponse( + actualCredentialSPInKV.setDescription("set updated description")); + }) + .subscribe(credentialEntityWithResponse -> { + System.out.printf("Credential Entity creation operation status: %s%n", + credentialEntityWithResponse.getStatusCode()); + if (credentialEntityWithResponse.getValue() instanceof DatasourceServicePrincipalInKeyVault) { + DatasourceServicePrincipalInKeyVault actualCredentialSPInKV + = (DatasourceServicePrincipalInKeyVault) credentialEntityWithResponse.getValue(); + System.out.printf("Actual credential entity key vault endpoint: %s%n", + actualCredentialSPInKV.getKeyVaultEndpoint()); + System.out.printf("Actual credential entity key vault updated description: %s%n", + actualCredentialSPInKV.getDescription()); + } + }); + // END: com.azure.ai.metricsadvisor.administration.MetricsAdvisorAdministrationAsyncClient.updateDatasourceCredentialWithResponse#DatasourceCredentialEntity + } + + /** + * Code snippet for {@link MetricsAdvisorAdministrationAsyncClient#getDatasourceCredential(String)}. + */ + public void getDatasourceCredential() { + // BEGIN: com.azure.ai.metricsadvisor.administration.MetricsAdvisorAdministrationAsyncClient.getDatasourceCredential#String + final String datasourceCredentialId = "f45668b2-bffa-11eb-8529-0246ac130003"; + + metricsAdvisorAdminAsyncClient.getDatasourceCredential(datasourceCredentialId) + .subscribe(credentialEntity -> { + if (credentialEntity instanceof DatasourceServicePrincipalInKeyVault) { + DatasourceServicePrincipalInKeyVault actualCredentialSPInKV + = (DatasourceServicePrincipalInKeyVault) credentialEntity; + System.out + .printf("Actual credential entity key vault endpoint: %s%n", + actualCredentialSPInKV.getKeyVaultEndpoint()); + System.out.printf("Actual credential entity key vault client Id: %s%n", + actualCredentialSPInKV.getKeyVaultClientId()); + System.out.printf("Actual credential entity key vault secret name for data source: %s%n", + actualCredentialSPInKV.getSecretNameForDatasourceClientId()); + System.out.printf("Actual credential entity key vault secret for data source: %s%n", + actualCredentialSPInKV.getSecretNameForDatasourceClientSecret()); + } + }); + // END: com.azure.ai.metricsadvisor.administration.MetricsAdvisorAdministrationAsyncClient.getDatasourceCredential#String + } + + /** + * Code snippet for {@link MetricsAdvisorAdministrationAsyncClient#getDatasourceCredentialWithResponse(String)}. + */ + public void getDatasourceCredentialWithResponse() { + // BEGIN: com.azure.ai.metricsadvisor.administration.MetricsAdvisorAdministrationAsyncClient.getDatasourceCredentialWithResponse#String + final String datasourceCredentialId = "f45668b2-bffa-11eb-8529-0246ac130003"; + + metricsAdvisorAdminAsyncClient.getDatasourceCredentialWithResponse(datasourceCredentialId) + .subscribe(credentialEntityWithResponse -> { + System.out.printf("Credential Entity creation operation status: %s%n", + credentialEntityWithResponse.getStatusCode()); + if (credentialEntityWithResponse.getValue() instanceof DatasourceServicePrincipalInKeyVault) { + DatasourceServicePrincipalInKeyVault actualCredentialSPInKV + = (DatasourceServicePrincipalInKeyVault) credentialEntityWithResponse.getValue(); + System.out + .printf("Actual credential entity key vault endpoint: %s%n", + actualCredentialSPInKV.getKeyVaultEndpoint()); + System.out.printf("Actual credential entity key vault client Id: %s%n", + actualCredentialSPInKV.getKeyVaultClientId()); + System.out.printf("Actual credential entity key vault secret name for data source: %s%n", + actualCredentialSPInKV.getSecretNameForDatasourceClientId()); + System.out.printf("Actual credential entity key vault secret for data source: %s%n", + actualCredentialSPInKV.getSecretNameForDatasourceClientSecret()); + } + }); + // END: com.azure.ai.metricsadvisor.administration.MetricsAdvisorAdministrationAsyncClient.getDatasourceCredentialWithResponse#String + } + + /** + * Code snippet for {@link MetricsAdvisorAdministrationAsyncClient#deleteDatasourceCredential(String)}. + */ + public void deleteDatasourceCredential() { + // BEGIN: com.azure.ai.metricsadvisor.administration.MetricsAdvisorAdministrationAsyncClient.deleteDatasourceCredential#String + final String datasourceCredentialId = "t00853f1-9080-447f-bacf-8dccf2e86f"; + metricsAdvisorAdminAsyncClient.deleteDataFeed(datasourceCredentialId); + // END: com.azure.ai.metricsadvisor.administration.MetricsAdvisorAdministrationAsyncClient.deleteDatasourceCredential#String + } + + /** + * Code snippet for {@link MetricsAdvisorAdministrationAsyncClient#deleteDatasourceCredentialWithResponse(String)} + */ + public void deleteDatasourceCredentialWithResponse() { + // BEGIN: com.azure.ai.metricsadvisor.administration.MetricsAdvisorAdministrationAsyncClient.deleteDatasourceCredentialWithResponse#String + final String datasourceCredentialId = "eh0854f1-8927-447f-bacf-8dccf2e86fwe"; + metricsAdvisorAdminAsyncClient.deleteDatasourceCredentialWithResponse(datasourceCredentialId) + .subscribe(response -> + System.out.printf("Datasource credential delete operation status : %s%n", response.getStatusCode())); + // END: com.azure.ai.metricsadvisor.administration.MetricsAdvisorAdministrationAsyncClient.deleteDatasourceCredentialWithResponse#String + } + + /** + * Code snippet for {@link MetricsAdvisorAdministrationAsyncClient#listDatasourceCredentials()} + */ + public void listDatasourceCredentials() { + // BEGIN: com.azure.ai.metricsadvisor.administration.MetricsAdvisorAdministrationAsyncClient.listDatasourceCredentials + metricsAdvisorAdminAsyncClient.listDatasourceCredentials() + .subscribe(datasourceCredentialEntity -> { + if (datasourceCredentialEntity instanceof DatasourceServicePrincipalInKeyVault) { + DatasourceServicePrincipalInKeyVault actualCredentialSPInKV + = (DatasourceServicePrincipalInKeyVault) datasourceCredentialEntity; + System.out + .printf("Actual credential entity key vault endpoint: %s%n", + actualCredentialSPInKV.getKeyVaultEndpoint()); + System.out.printf("Actual credential entity key vault client Id: %s%n", + actualCredentialSPInKV.getKeyVaultClientId()); + System.out.printf("Actual credential entity key vault secret name for data source: %s%n", + actualCredentialSPInKV.getSecretNameForDatasourceClientId()); + System.out.printf("Actual credential entity key vault secret for data source: %s%n", + actualCredentialSPInKV.getSecretNameForDatasourceClientSecret()); + } + }); + // END: com.azure.ai.metricsadvisor.administration.MetricsAdvisorAdministrationAsyncClient.listDatasourceCredentials + } + + /** + * Code snippet for {@link MetricsAdvisorAdministrationAsyncClient#listDatasourceCredentials(ListCredentialEntityOptions)} with options. + */ + public void listDatasourceCredentialsWithOptions() { + // BEGIN: com.azure.ai.metricsadvisor.administration.MetricsAdvisorAdministrationAsyncClient.listDatasourceCredentials#ListCredentialEntityOptions + metricsAdvisorAdminAsyncClient.listDatasourceCredentials( + new ListCredentialEntityOptions() + .setMaxPageSize(3)) + .subscribe(datasourceCredentialEntity -> { + if (datasourceCredentialEntity instanceof DatasourceServicePrincipalInKeyVault) { + DatasourceServicePrincipalInKeyVault actualCredentialSPInKV + = (DatasourceServicePrincipalInKeyVault) datasourceCredentialEntity; + System.out + .printf("Actual credential entity key vault endpoint: %s%n", + actualCredentialSPInKV.getKeyVaultEndpoint()); + System.out.printf("Actual credential entity key vault client Id: %s%n", + actualCredentialSPInKV.getKeyVaultClientId()); + System.out.printf("Actual credential entity key vault secret name for data source: %s%n", + actualCredentialSPInKV.getSecretNameForDatasourceClientId()); + System.out.printf("Actual credential entity key vault secret for data source: %s%n", + actualCredentialSPInKV.getSecretNameForDatasourceClientSecret()); + } + }); + // END: com.azure.ai.metricsadvisor.administration.MetricsAdvisorAdministrationAsyncClient.listDatasourceCredentials#ListCredentialEntityOptions + } } diff --git a/sdk/metricsadvisor/azure-ai-metricsadvisor/src/samples/java/com/azure/ai/metricsadvisor/administration/MetricsAdvisorAdministrationClientJavaDocCodeSnippets.java b/sdk/metricsadvisor/azure-ai-metricsadvisor/src/samples/java/com/azure/ai/metricsadvisor/administration/MetricsAdvisorAdministrationClientJavaDocCodeSnippets.java index 421c288fa0c61..b94a76f0d8d19 100644 --- a/sdk/metricsadvisor/azure-ai-metricsadvisor/src/samples/java/com/azure/ai/metricsadvisor/administration/MetricsAdvisorAdministrationClientJavaDocCodeSnippets.java +++ b/sdk/metricsadvisor/azure-ai-metricsadvisor/src/samples/java/com/azure/ai/metricsadvisor/administration/MetricsAdvisorAdministrationClientJavaDocCodeSnippets.java @@ -3,48 +3,51 @@ package com.azure.ai.metricsadvisor.administration; -import com.azure.ai.metricsadvisor.models.AnomalyDetectionConfiguration; -import com.azure.ai.metricsadvisor.models.AnomalyDetectorDirection; -import com.azure.ai.metricsadvisor.models.AnomalySeverity; -import com.azure.ai.metricsadvisor.models.ChangeThresholdCondition; -import com.azure.ai.metricsadvisor.models.AnomalyAlertConfiguration; -import com.azure.ai.metricsadvisor.models.DataFeed; -import com.azure.ai.metricsadvisor.models.DataFeedDimension; -import com.azure.ai.metricsadvisor.models.DataFeedGranularity; -import com.azure.ai.metricsadvisor.models.DataFeedGranularityType; -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.DataFeedOptions; -import com.azure.ai.metricsadvisor.models.DataFeedRollupSettings; -import com.azure.ai.metricsadvisor.models.DataFeedRollupType; -import com.azure.ai.metricsadvisor.models.DataFeedSchema; -import com.azure.ai.metricsadvisor.models.DataFeedStatus; -import com.azure.ai.metricsadvisor.models.DetectionConditionsOperator; +import com.azure.ai.metricsadvisor.administration.models.AnomalyAlertConfiguration; +import com.azure.ai.metricsadvisor.administration.models.AnomalyDetectionConfiguration; +import com.azure.ai.metricsadvisor.administration.models.AnomalyDetectorDirection; +import com.azure.ai.metricsadvisor.administration.models.AnomalySeverity; +import com.azure.ai.metricsadvisor.administration.models.ChangeThresholdCondition; +import com.azure.ai.metricsadvisor.administration.models.DataFeed; +import com.azure.ai.metricsadvisor.administration.models.DataFeedDimension; +import com.azure.ai.metricsadvisor.administration.models.DataFeedGranularity; +import com.azure.ai.metricsadvisor.administration.models.DataFeedGranularityType; +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.DataFeedMetric; +import com.azure.ai.metricsadvisor.administration.models.DataFeedOptions; +import com.azure.ai.metricsadvisor.administration.models.DataFeedRollupSettings; +import com.azure.ai.metricsadvisor.administration.models.DataFeedRollupType; +import com.azure.ai.metricsadvisor.administration.models.DataFeedSchema; +import com.azure.ai.metricsadvisor.administration.models.DataFeedStatus; +import com.azure.ai.metricsadvisor.administration.models.DatasourceCredentialEntity; +import com.azure.ai.metricsadvisor.administration.models.DatasourceServicePrincipalInKeyVault; +import com.azure.ai.metricsadvisor.administration.models.DetectionConditionsOperator; import com.azure.ai.metricsadvisor.models.DimensionKey; -import com.azure.ai.metricsadvisor.models.EmailNotificationHook; -import com.azure.ai.metricsadvisor.models.HardThresholdCondition; -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.DataFeedMetric; -import com.azure.ai.metricsadvisor.models.MetricAnomalyAlertConditions; -import com.azure.ai.metricsadvisor.models.MetricSeriesGroupDetectionCondition; -import com.azure.ai.metricsadvisor.models.MetricSingleSeriesDetectionCondition; -import com.azure.ai.metricsadvisor.models.MetricWholeSeriesDetectionCondition; -import com.azure.ai.metricsadvisor.models.MetricAnomalyAlertConfiguration; -import com.azure.ai.metricsadvisor.models.MetricAnomalyAlertConfigurationsOperator; -import com.azure.ai.metricsadvisor.models.MetricAnomalyAlertScope; +import com.azure.ai.metricsadvisor.administration.models.EmailNotificationHook; +import com.azure.ai.metricsadvisor.administration.models.HardThresholdCondition; +import com.azure.ai.metricsadvisor.administration.models.ListAnomalyAlertConfigsOptions; +import com.azure.ai.metricsadvisor.administration.models.ListCredentialEntityOptions; +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.ListMetricAnomalyDetectionConfigsOptions; +import com.azure.ai.metricsadvisor.administration.models.MetricAnomalyAlertConditions; +import com.azure.ai.metricsadvisor.administration.models.MetricAnomalyAlertConfiguration; +import com.azure.ai.metricsadvisor.administration.models.MetricAnomalyAlertConfigurationsOperator; +import com.azure.ai.metricsadvisor.administration.models.MetricAnomalyAlertScope; +import com.azure.ai.metricsadvisor.administration.models.MetricSeriesGroupDetectionCondition; +import com.azure.ai.metricsadvisor.administration.models.MetricSingleSeriesDetectionCondition; +import com.azure.ai.metricsadvisor.administration.models.MetricWholeSeriesDetectionCondition; import com.azure.ai.metricsadvisor.models.MetricsAdvisorKeyCredential; -import com.azure.ai.metricsadvisor.models.MySqlDataFeedSource; -import com.azure.ai.metricsadvisor.models.SeverityCondition; -import com.azure.ai.metricsadvisor.models.SmartDetectionCondition; -import com.azure.ai.metricsadvisor.models.SuppressCondition; -import com.azure.ai.metricsadvisor.models.WebNotificationHook; +import com.azure.ai.metricsadvisor.administration.models.MySqlDataFeedSource; +import com.azure.ai.metricsadvisor.administration.models.NotificationHook; +import com.azure.ai.metricsadvisor.administration.models.SeverityCondition; +import com.azure.ai.metricsadvisor.administration.models.SmartDetectionCondition; +import com.azure.ai.metricsadvisor.administration.models.SuppressCondition; +import com.azure.ai.metricsadvisor.administration.models.WebNotificationHook; import com.azure.core.http.HttpPipeline; import com.azure.core.http.HttpPipelineBuilder; import com.azure.core.http.rest.PagedIterable; @@ -56,6 +59,7 @@ import java.time.OffsetDateTime; import java.util.Arrays; import java.util.List; +import java.util.UUID; import java.util.stream.Stream; /** @@ -296,7 +300,7 @@ public void listDataFeedWithOptions() { } /** - * Code snippet for {@link MetricsAdvisorAdministrationAsyncClient#createHook(NotificationHook)}. + * Code snippet for {@link MetricsAdvisorAdministrationClient#createHook(NotificationHook)}. */ public void createHook() { // BEGIN: com.azure.ai.metricsadvisor.administration.MetricsAdvisorAdministrationClient.createHook#NotificationHook @@ -317,7 +321,7 @@ public void createHook() { } /** - * Code snippet for {@link MetricsAdvisorAdministrationAsyncClient#createHookWithResponse(NotificationHook)}. + * Code snippet for {@link MetricsAdvisorAdministrationClient#createHookWithResponse(NotificationHook, Context)}. */ public void createHookWithResponse() { // BEGIN: com.azure.ai.metricsadvisor.administration.MetricsAdvisorAdministrationClient.createHookWithResponse#NotificationHook-Context @@ -340,7 +344,7 @@ public void createHookWithResponse() { } /** - * Code snippet for {@link MetricsAdvisorAdministrationAsyncClient#getHook(String)}. + * Code snippet for {@link MetricsAdvisorAdministrationClient#getHook(String)}. */ public void getHook() { // BEGIN: com.azure.ai.metricsadvisor.administration.MetricsAdvisorAdministrationClient.getHook#String @@ -366,7 +370,7 @@ public void getHook() { } /** - * Code snippet for {@link MetricsAdvisorAdministrationAsyncClient#getHookWithResponse(String)}. + * Code snippet for {@link MetricsAdvisorAdministrationClient#getHookWithResponse(String, Context)}. */ public void getHookWithResponse() { // BEGIN: com.azure.ai.metricsadvisor.administration.MetricsAdvisorAdministrationClient.getHookWithResponse#String-Context @@ -394,7 +398,7 @@ public void getHookWithResponse() { } /** - * Code snippet for {@link MetricsAdvisorAdministrationAsyncClient#updateHook(NotificationHook)}. + * Code snippet for {@link MetricsAdvisorAdministrationClient#updateHook(NotificationHook)}. */ public void updateHook() { // BEGIN: com.azure.ai.metricsadvisor.administration.MetricsAdvisorAdministrationClient.updateHook#NotificationHook @@ -417,7 +421,7 @@ public void updateHook() { } /** - * Code snippet for {@link MetricsAdvisorAdministrationAsyncClient#updateHookWithResponse(NotificationHook)}. + * Code snippet for {@link MetricsAdvisorAdministrationClient#updateHookWithResponse(NotificationHook, Context)}. */ public void updateHookWithResponse() { // BEGIN: com.azure.ai.metricsadvisor.administration.MetricsAdvisorAdministrationClient.updateHookWithResponse#NotificationHook-Context @@ -442,7 +446,7 @@ public void updateHookWithResponse() { } /** - * Code snippet for {@link MetricsAdvisorAdministrationAsyncClient#deleteHook(String)}. + * Code snippet for {@link MetricsAdvisorAdministrationClient#deleteHook(String)}. */ public void deleteHook() { // BEGIN: com.azure.ai.metricsadvisor.administration.MetricsAdvisorAdministrationClient.deleteHook#String @@ -452,7 +456,7 @@ public void deleteHook() { } /** - * Code snippet for {@link MetricsAdvisorAdministrationAsyncClient#deleteHookWithResponse(String)}. + * Code snippet for {@link MetricsAdvisorAdministrationClient#deleteHookWithResponse(String, Context)}. */ public void deleteHookWithResponse() { // BEGIN: com.azure.ai.metricsadvisor.administration.MetricsAdvisorAdministrationClient.deleteHookWithResponse#String-Context @@ -464,7 +468,7 @@ public void deleteHookWithResponse() { } /** - * Code snippet for {@link MetricsAdvisorAdministrationAsyncClient#listHooks()}. + * Code snippet for {@link MetricsAdvisorAdministrationClient#listHooks()}. */ public void listHooks() { // BEGIN: com.azure.ai.metricsadvisor.administration.MetricsAdvisorAdministrationClient.listHooks @@ -491,7 +495,7 @@ public void listHooks() { } /** - * Code snippet for {@link MetricsAdvisorAdministrationAsyncClient#listHooks(ListHookOptions)}. + * Code snippet for {@link MetricsAdvisorAdministrationClient#listHooks(ListHookOptions, Context)}. */ public void listHooksWithOptions() { // BEGIN: com.azure.ai.metricsadvisor.administration.MetricsAdvisorAdministrationClient.listHooks#ListHookOptions-Context @@ -1066,14 +1070,13 @@ public void getDetectionConfigurationWithResponse() { } /** - * Code snippet for {@link MetricsAdvisorAdministrationClient#listMetricAnomalyDetectionConfigs(String, ListMetricAnomalyDetectionConfigsOptions)}. + * Code snippet for {@link MetricsAdvisorAdministrationClient#listMetricAnomalyDetectionConfigs(String)}. */ public void listDetectionConfigurations() { - // BEGIN: com.azure.ai.metricsadvisor.administration.MetricsAdvisorAdministrationClient.listMetricAnomalyDetectionConfigs#String-ListMetricAnomalyDetectionConfigsOptions + // BEGIN: com.azure.ai.metricsadvisor.administration.MetricsAdvisorAdministrationClient.listMetricAnomalyDetectionConfigs#String final String metricId = "0b836da8-10e6-46cd-8f4f-28262e113a62"; PagedIterable configsIterable - = metricsAdvisorAdminClient.listMetricAnomalyDetectionConfigs(metricId, - new ListMetricAnomalyDetectionConfigsOptions()); + = metricsAdvisorAdminClient.listMetricAnomalyDetectionConfigs(metricId); for (AnomalyDetectionConfiguration detectionConfig : configsIterable) { System.out.printf("Detection config Id: %s%n", detectionConfig.getId()); @@ -1081,7 +1084,7 @@ public void listDetectionConfigurations() { System.out.printf("Description: %s%n", detectionConfig.getDescription()); System.out.printf("MetricId: %s%n", detectionConfig.getMetricId()); } - // END: com.azure.ai.metricsadvisor.administration.MetricsAdvisorAdministrationClient.listMetricAnomalyDetectionConfigs#String-ListMetricAnomalyDetectionConfigsOptions + // END: com.azure.ai.metricsadvisor.administration.MetricsAdvisorAdministrationClient.listMetricAnomalyDetectionConfigs#String } /** @@ -1426,4 +1429,262 @@ public void listAnomalyAlertConfigurationsWithContext() { }); // END: com.azure.ai.metricsadvisor.administration.MetricsAdvisorAdministrationClient.listAnomalyAlertConfigs#String-ListAnomalyAlertConfigsOptions-Context } + + /** + * Code snippet for {@link MetricsAdvisorAdministrationClient#createDatasourceCredential(DatasourceCredentialEntity)}. + */ + public void createDatasourceCredential() { + // BEGIN: com.azure.ai.metricsadvisor.administration.MetricsAdvisorAdministrationClient.createDatasourceCredential#DatasourceCredentialEntity + DatasourceCredentialEntity datasourceCredential; + final String name = "sample_name" + UUID.randomUUID(); + final String cId = "f45668b2-bffa-11eb-8529-0246ac130003"; + final String tId = "67890ded-5e07-4e52-b225-4ae8f905afb5"; + final String mockSecr = "890hy69-5e07-4e52-b225-4ae8f905afb5"; + + datasourceCredential = new DatasourceServicePrincipalInKeyVault() + .setName(name) + .setKeyVaultForDatasourceSecrets("kv", cId, mockSecr) + .setTenantId(tId) + .setSecretNameForDatasourceClientId("DSClientID_1") + .setSecretNameForDatasourceClientSecret("DSClientSer_1"); + + DatasourceCredentialEntity credentialEntity = + metricsAdvisorAdminClient.createDatasourceCredential(datasourceCredential); + if (credentialEntity instanceof DatasourceServicePrincipalInKeyVault) { + DatasourceServicePrincipalInKeyVault actualCredentialSPInKV + = (DatasourceServicePrincipalInKeyVault) credentialEntity; + System.out + .printf("Actual credential entity key vault endpoint: %s%n", + actualCredentialSPInKV.getKeyVaultEndpoint()); + System.out.printf("Actual credential entity key vault client Id: %s%n", + actualCredentialSPInKV.getKeyVaultClientId()); + System.out.printf("Actual credential entity key vault secret name for data source: %s%n", + actualCredentialSPInKV.getSecretNameForDatasourceClientId()); + System.out.printf("Actual credential entity key vault secret for data source: %s%n", + actualCredentialSPInKV.getSecretNameForDatasourceClientSecret()); + } + // END: com.azure.ai.metricsadvisor.administration.MetricsAdvisorAdministrationClient.createDatasourceCredential#DatasourceCredentialEntity + } + + /** + * Code snippet for {@link MetricsAdvisorAdministrationClient#createDatasourceCredentialWithResponse(DatasourceCredentialEntity, Context)}. + */ + public void createDatasourceCredentialWithResponse() { + // BEGIN: com.azure.ai.metricsadvisor.administration.MetricsAdvisorAdministrationClient.createDatasourceCredentialWithResponse#DatasourceCredentialEntity-Context + DatasourceCredentialEntity datasourceCredential; + final String name = "sample_name" + UUID.randomUUID(); + final String cId = "f45668b2-bffa-11eb-8529-0246ac130003"; + final String tId = "67890ded-5e07-4e52-b225-4ae8f905afb5"; + final String mockSecr = "890hy69-5e07-4e52-b225-4ae8f905afb5"; + + datasourceCredential = new DatasourceServicePrincipalInKeyVault() + .setName(name) + .setKeyVaultForDatasourceSecrets("kv", cId, mockSecr) + .setTenantId(tId) + .setSecretNameForDatasourceClientId("DSClientID_1") + .setSecretNameForDatasourceClientSecret("DSClientSer_1"); + + Response credentialEntityWithResponse = + metricsAdvisorAdminClient.createDatasourceCredentialWithResponse(datasourceCredential, Context.NONE); + + System.out.printf("Credential Entity creation operation status: %s%n", + credentialEntityWithResponse.getStatusCode()); + if (credentialEntityWithResponse.getValue() instanceof DatasourceServicePrincipalInKeyVault) { + DatasourceServicePrincipalInKeyVault actualCredentialSPInKV + = (DatasourceServicePrincipalInKeyVault) credentialEntityWithResponse.getValue(); + System.out + .printf("Actual credential entity key vault endpoint: %s%n", + actualCredentialSPInKV.getKeyVaultEndpoint()); + System.out.printf("Actual credential entity key vault client Id: %s%n", + actualCredentialSPInKV.getKeyVaultClientId()); + System.out.printf("Actual credential entity key vault secret name for data source: %s%n", + actualCredentialSPInKV.getSecretNameForDatasourceClientId()); + System.out.printf("Actual credential entity key vault secret for data source: %s%n", + actualCredentialSPInKV.getSecretNameForDatasourceClientSecret()); + } + // END: com.azure.ai.metricsadvisor.administration.MetricsAdvisorAdministrationClient.createDatasourceCredentialWithResponse#DatasourceCredentialEntity-Context + } + + /** + * Code snippet for {@link MetricsAdvisorAdministrationClient#updateDatasourceCredential(DatasourceCredentialEntity)}. + */ + public void updateDatasourceCredential() { + // BEGIN: com.azure.ai.metricsadvisor.administration.MetricsAdvisorAdministrationClient.updateDatasourceCredential#DatasourceCredentialEntity + final String datasourceCredentialId = "f45668b2-bffa-11eb-8529-0246ac130003"; + DatasourceCredentialEntity existingDatasourceCredential = + metricsAdvisorAdminClient.getDatasourceCredential(datasourceCredentialId); + DatasourceServicePrincipalInKeyVault actualCredentialSPInKV = null; + if (existingDatasourceCredential instanceof DatasourceServicePrincipalInKeyVault) { + actualCredentialSPInKV = (DatasourceServicePrincipalInKeyVault) existingDatasourceCredential; + } + + DatasourceCredentialEntity credentialEntity = + metricsAdvisorAdminClient.updateDatasourceCredential( + actualCredentialSPInKV.setDescription("set updated description")); + + if (credentialEntity instanceof DatasourceServicePrincipalInKeyVault) { + DatasourceServicePrincipalInKeyVault updatedCredentialSPInKV + = (DatasourceServicePrincipalInKeyVault) credentialEntity; + System.out.printf("Actual credential entity key vault endpoint: %s%n", + updatedCredentialSPInKV.getKeyVaultEndpoint()); + System.out.printf("Actual credential entity key vault updated description: %s%n", + updatedCredentialSPInKV.getDescription()); + } + // END: com.azure.ai.metricsadvisor.administration.MetricsAdvisorAdministrationClient.updateDatasourceCredential#DatasourceCredentialEntity + } + + /** + * Code snippet for {@link MetricsAdvisorAdministrationClient#updateDatasourceCredentialWithResponse(DatasourceCredentialEntity, Context)}. + */ + public void updateDatasourceCredentialWithResponse() { + // BEGIN: com.azure.ai.metricsadvisor.administration.MetricsAdvisorAdministrationClient.updateDatasourceCredentialWithResponse#DatasourceCredentialEntity-Context + final String datasourceCredentialId = "f45668b2-bffa-11eb-8529-0246ac130003"; + DatasourceCredentialEntity existingDatasourceCredential = + metricsAdvisorAdminClient.getDatasourceCredential(datasourceCredentialId); + DatasourceServicePrincipalInKeyVault actualCredentialSPInKV = null; + if (existingDatasourceCredential instanceof DatasourceServicePrincipalInKeyVault) { + actualCredentialSPInKV = (DatasourceServicePrincipalInKeyVault) existingDatasourceCredential; + } + Response credentialEntityWithResponse = + metricsAdvisorAdminClient.updateDatasourceCredentialWithResponse( + actualCredentialSPInKV.setDescription("set updated description"), Context.NONE); + + System.out.printf("Credential Entity creation operation status: %s%n", + credentialEntityWithResponse.getStatusCode()); + if (credentialEntityWithResponse.getValue() instanceof DatasourceServicePrincipalInKeyVault) { + DatasourceServicePrincipalInKeyVault updatedCredentialSPInKV + = (DatasourceServicePrincipalInKeyVault) credentialEntityWithResponse.getValue(); + System.out.printf("Actual credential entity key vault endpoint: %s%n", + updatedCredentialSPInKV.getKeyVaultEndpoint()); + System.out.printf("Actual credential entity key vault updated description: %s%n", + updatedCredentialSPInKV.getDescription()); + } + // END: com.azure.ai.metricsadvisor.administration.MetricsAdvisorAdministrationClient.updateDatasourceCredentialWithResponse#DatasourceCredentialEntity-Context + } + + /** + * Code snippet for {@link MetricsAdvisorAdministrationClient#getDatasourceCredential(String)}. + */ + public void getDatasourceCredential() { + // BEGIN: com.azure.ai.metricsadvisor.administration.MetricsAdvisorAdministrationClient.getDatasourceCredential#String + final String datasourceCredentialId = "f45668b2-bffa-11eb-8529-0246ac130003"; + + DatasourceCredentialEntity credentialEntity = + metricsAdvisorAdminClient.getDatasourceCredential(datasourceCredentialId); + if (credentialEntity instanceof DatasourceServicePrincipalInKeyVault) { + DatasourceServicePrincipalInKeyVault actualCredentialSPInKV + = (DatasourceServicePrincipalInKeyVault) credentialEntity; + System.out + .printf("Actual credential entity key vault endpoint: %s%n", + actualCredentialSPInKV.getKeyVaultEndpoint()); + System.out.printf("Actual credential entity key vault client Id: %s%n", + actualCredentialSPInKV.getKeyVaultClientId()); + System.out.printf("Actual credential entity key vault secret name for data source: %s%n", + actualCredentialSPInKV.getSecretNameForDatasourceClientId()); + System.out.printf("Actual credential entity key vault secret for data source: %s%n", + actualCredentialSPInKV.getSecretNameForDatasourceClientSecret()); + } + // END: com.azure.ai.metricsadvisor.administration.MetricsAdvisorAdministrationClient.getDatasourceCredential#String + } + + /** + * Code snippet for {@link MetricsAdvisorAdministrationClient#getDatasourceCredentialWithResponse(String, Context)}. + */ + public void getDatasourceCredentialWithResponse() { + // BEGIN: com.azure.ai.metricsadvisor.administration.MetricsAdvisorAdministrationClient.getDatasourceCredentialWithResponse#String-Context + final String datasourceCredentialId = "f45668b2-bffa-11eb-8529-0246ac130003"; + + Response credentialEntityWithResponse = + metricsAdvisorAdminClient.getDatasourceCredentialWithResponse(datasourceCredentialId, Context.NONE); + System.out.printf("Credential Entity creation operation status: %s%n", + credentialEntityWithResponse.getStatusCode()); + if (credentialEntityWithResponse.getValue() instanceof DatasourceServicePrincipalInKeyVault) { + DatasourceServicePrincipalInKeyVault actualCredentialSPInKV + = (DatasourceServicePrincipalInKeyVault) credentialEntityWithResponse.getValue(); + System.out + .printf("Actual credential entity key vault endpoint: %s%n", + actualCredentialSPInKV.getKeyVaultEndpoint()); + System.out.printf("Actual credential entity key vault client Id: %s%n", + actualCredentialSPInKV.getKeyVaultClientId()); + System.out.printf("Actual credential entity key vault secret name for data source: %s%n", + actualCredentialSPInKV.getSecretNameForDatasourceClientId()); + System.out.printf("Actual credential entity key vault secret for data source: %s%n", + actualCredentialSPInKV.getSecretNameForDatasourceClientSecret()); + } + // END: com.azure.ai.metricsadvisor.administration.MetricsAdvisorAdministrationClient.getDatasourceCredentialWithResponse#String-Context + } + + /** + * Code snippet for {@link MetricsAdvisorAdministrationClient#deleteDatasourceCredential(String)}. + */ + public void deleteDatasourceCredential() { + // BEGIN: com.azure.ai.metricsadvisor.administration.MetricsAdvisorAdministrationClient.deleteDatasourceCredential#String + final String datasourceCredentialId = "t00853f1-9080-447f-bacf-8dccf2e86f"; + metricsAdvisorAdminClient.deleteDataFeed(datasourceCredentialId); + // END: com.azure.ai.metricsadvisor.administration.MetricsAdvisorAdministrationClient.deleteDatasourceCredential#String + } + + /** + * Code snippet for {@link MetricsAdvisorAdministrationClient#deleteDataFeedWithResponse(String, Context)} + */ + public void deleteDatasourceCredentialWithResponse() { + // BEGIN: com.azure.ai.metricsadvisor.administration.MetricsAdvisorAdministrationClient.deleteDatasourceCredentialWithResponse#String-Context + final String datasourceCredentialId = "eh0854f1-8927-447f-bacf-8dccf2e86fwe"; + Response response = + metricsAdvisorAdminClient.deleteDatasourceCredentialWithResponse(datasourceCredentialId, Context.NONE); + System.out.printf("Datasource credential delete operation status : %s%n", response.getStatusCode()); + // END: com.azure.ai.metricsadvisor.administration.MetricsAdvisorAdministrationClient.deleteDatasourceCredentialWithResponse#String-Context + } + + /** + * Code snippet for {@link MetricsAdvisorAdministrationClient#listDatasourceCredentials()} + */ + public void listDatasourceCredentials() { + // BEGIN: com.azure.ai.metricsadvisor.administration.MetricsAdvisorAdministrationClient.listDatasourceCredentials + metricsAdvisorAdminClient.listDatasourceCredentials() + .forEach(datasourceCredentialEntity -> { + if (datasourceCredentialEntity instanceof DatasourceServicePrincipalInKeyVault) { + DatasourceServicePrincipalInKeyVault actualCredentialSPInKV + = (DatasourceServicePrincipalInKeyVault) datasourceCredentialEntity; + System.out + .printf("Actual credential entity key vault endpoint: %s%n", + actualCredentialSPInKV.getKeyVaultEndpoint()); + System.out.printf("Actual credential entity key vault client Id: %s%n", + actualCredentialSPInKV.getKeyVaultClientId()); + System.out.printf("Actual credential entity key vault secret name for data source: %s%n", + actualCredentialSPInKV.getSecretNameForDatasourceClientId()); + System.out.printf("Actual credential entity key vault secret for data source: %s%n", + actualCredentialSPInKV.getSecretNameForDatasourceClientSecret()); + } + }); + // END: com.azure.ai.metricsadvisor.administration.MetricsAdvisorAdministrationClient.listDatasourceCredentials + } + + /** + * Code snippet for {@link MetricsAdvisorAdministrationClient#listDatasourceCredentials(ListCredentialEntityOptions, Context)} with options. + */ + public void listDatasourceCredentialsWithOptions() { + // BEGIN: com.azure.ai.metricsadvisor.administration.MetricsAdvisorAdministrationClient.listDatasourceCredentials#ListCredentialEntityOptions-Context + metricsAdvisorAdminClient.listDatasourceCredentials( + new ListCredentialEntityOptions() + .setMaxPageSize(3), + Context.NONE) + .forEach(datasourceCredentialEntity -> { + if (datasourceCredentialEntity instanceof DatasourceServicePrincipalInKeyVault) { + DatasourceServicePrincipalInKeyVault actualCredentialSPInKV + = (DatasourceServicePrincipalInKeyVault) datasourceCredentialEntity; + System.out + .printf("Actual credential entity key vault endpoint: %s%n", + actualCredentialSPInKV.getKeyVaultEndpoint()); + System.out.printf("Actual credential entity key vault client Id: %s%n", + actualCredentialSPInKV.getKeyVaultClientId()); + System.out.printf("Actual credential entity key vault secret name for data source: %s%n", + actualCredentialSPInKV.getSecretNameForDatasourceClientId()); + System.out.printf("Actual credential entity key vault secret for data source: %s%n", + actualCredentialSPInKV.getSecretNameForDatasourceClientSecret()); + } + }); + // END: com.azure.ai.metricsadvisor.administration.MetricsAdvisorAdministrationClient.listDatasourceCredentials#ListCredentialEntityOptions-Context + } + } diff --git a/sdk/metricsadvisor/azure-ai-metricsadvisor/src/samples/java/com/azure/ai/metricsadvisor/administration/MetricsAnomalyAlertConfigOperationsAsyncSample.java b/sdk/metricsadvisor/azure-ai-metricsadvisor/src/samples/java/com/azure/ai/metricsadvisor/administration/MetricsAnomalyAlertConfigOperationsAsyncSample.java index a567643235ac8..fa5577806a063 100644 --- a/sdk/metricsadvisor/azure-ai-metricsadvisor/src/samples/java/com/azure/ai/metricsadvisor/administration/MetricsAnomalyAlertConfigOperationsAsyncSample.java +++ b/sdk/metricsadvisor/azure-ai-metricsadvisor/src/samples/java/com/azure/ai/metricsadvisor/administration/MetricsAnomalyAlertConfigOperationsAsyncSample.java @@ -3,15 +3,15 @@ package com.azure.ai.metricsadvisor.administration; -import com.azure.ai.metricsadvisor.models.AnomalyAlertConfiguration; -import com.azure.ai.metricsadvisor.models.AnomalySeverity; -import com.azure.ai.metricsadvisor.models.ListAnomalyAlertConfigsOptions; -import com.azure.ai.metricsadvisor.models.MetricAnomalyAlertConditions; -import com.azure.ai.metricsadvisor.models.MetricAnomalyAlertConfiguration; -import com.azure.ai.metricsadvisor.models.MetricAnomalyAlertConfigurationsOperator; -import com.azure.ai.metricsadvisor.models.MetricAnomalyAlertScope; +import com.azure.ai.metricsadvisor.administration.models.AnomalyAlertConfiguration; +import com.azure.ai.metricsadvisor.administration.models.AnomalySeverity; +import com.azure.ai.metricsadvisor.administration.models.ListAnomalyAlertConfigsOptions; +import com.azure.ai.metricsadvisor.administration.models.MetricAnomalyAlertConditions; +import com.azure.ai.metricsadvisor.administration.models.MetricAnomalyAlertConfiguration; +import com.azure.ai.metricsadvisor.administration.models.MetricAnomalyAlertConfigurationsOperator; +import com.azure.ai.metricsadvisor.administration.models.MetricAnomalyAlertScope; import com.azure.ai.metricsadvisor.models.MetricsAdvisorKeyCredential; -import com.azure.ai.metricsadvisor.models.SeverityCondition; +import com.azure.ai.metricsadvisor.administration.models.SeverityCondition; import reactor.core.publisher.Mono; import java.util.Arrays; diff --git a/sdk/metricsadvisor/azure-ai-metricsadvisor/src/samples/java/com/azure/ai/metricsadvisor/administration/MetricsAnomalyAlertConfigOperationsSample.java b/sdk/metricsadvisor/azure-ai-metricsadvisor/src/samples/java/com/azure/ai/metricsadvisor/administration/MetricsAnomalyAlertConfigOperationsSample.java index 174c8bb06f085..ff3b59e65d6bc 100644 --- a/sdk/metricsadvisor/azure-ai-metricsadvisor/src/samples/java/com/azure/ai/metricsadvisor/administration/MetricsAnomalyAlertConfigOperationsSample.java +++ b/sdk/metricsadvisor/azure-ai-metricsadvisor/src/samples/java/com/azure/ai/metricsadvisor/administration/MetricsAnomalyAlertConfigOperationsSample.java @@ -3,15 +3,15 @@ package com.azure.ai.metricsadvisor.administration; -import com.azure.ai.metricsadvisor.models.AnomalyAlertConfiguration; -import com.azure.ai.metricsadvisor.models.AnomalySeverity; -import com.azure.ai.metricsadvisor.models.ListAnomalyAlertConfigsOptions; -import com.azure.ai.metricsadvisor.models.MetricAnomalyAlertConditions; -import com.azure.ai.metricsadvisor.models.MetricAnomalyAlertConfiguration; -import com.azure.ai.metricsadvisor.models.MetricAnomalyAlertConfigurationsOperator; -import com.azure.ai.metricsadvisor.models.MetricAnomalyAlertScope; +import com.azure.ai.metricsadvisor.administration.models.AnomalyAlertConfiguration; +import com.azure.ai.metricsadvisor.administration.models.AnomalySeverity; +import com.azure.ai.metricsadvisor.administration.models.ListAnomalyAlertConfigsOptions; +import com.azure.ai.metricsadvisor.administration.models.MetricAnomalyAlertConditions; +import com.azure.ai.metricsadvisor.administration.models.MetricAnomalyAlertConfiguration; +import com.azure.ai.metricsadvisor.administration.models.MetricAnomalyAlertConfigurationsOperator; +import com.azure.ai.metricsadvisor.administration.models.MetricAnomalyAlertScope; import com.azure.ai.metricsadvisor.models.MetricsAdvisorKeyCredential; -import com.azure.ai.metricsadvisor.models.SeverityCondition; +import com.azure.ai.metricsadvisor.administration.models.SeverityCondition; import java.util.Arrays; diff --git a/sdk/metricsadvisor/azure-ai-metricsadvisor/src/test/java/com/azure/ai/metricsadvisor/AlertAsyncTest.java b/sdk/metricsadvisor/azure-ai-metricsadvisor/src/test/java/com/azure/ai/metricsadvisor/AlertAsyncTest.java index 4af1de26708a0..2d89e63afabec 100644 --- a/sdk/metricsadvisor/azure-ai-metricsadvisor/src/test/java/com/azure/ai/metricsadvisor/AlertAsyncTest.java +++ b/sdk/metricsadvisor/azure-ai-metricsadvisor/src/test/java/com/azure/ai/metricsadvisor/AlertAsyncTest.java @@ -4,7 +4,6 @@ package com.azure.ai.metricsadvisor; import com.azure.ai.metricsadvisor.models.AnomalyAlert; -import com.azure.ai.metricsadvisor.models.MetricsAdvisorServiceVersion; import com.azure.core.http.HttpClient; import com.azure.core.http.rest.PagedFlux; import com.azure.core.test.TestBase; diff --git a/sdk/metricsadvisor/azure-ai-metricsadvisor/src/test/java/com/azure/ai/metricsadvisor/AlertTest.java b/sdk/metricsadvisor/azure-ai-metricsadvisor/src/test/java/com/azure/ai/metricsadvisor/AlertTest.java index a38f55dab0c72..5474020224623 100644 --- a/sdk/metricsadvisor/azure-ai-metricsadvisor/src/test/java/com/azure/ai/metricsadvisor/AlertTest.java +++ b/sdk/metricsadvisor/azure-ai-metricsadvisor/src/test/java/com/azure/ai/metricsadvisor/AlertTest.java @@ -4,7 +4,6 @@ package com.azure.ai.metricsadvisor; import com.azure.ai.metricsadvisor.models.AnomalyAlert; -import com.azure.ai.metricsadvisor.models.MetricsAdvisorServiceVersion; import com.azure.core.http.HttpClient; import com.azure.core.http.rest.PagedIterable; import com.azure.core.test.TestBase; diff --git a/sdk/metricsadvisor/azure-ai-metricsadvisor/src/test/java/com/azure/ai/metricsadvisor/AlertTestBase.java b/sdk/metricsadvisor/azure-ai-metricsadvisor/src/test/java/com/azure/ai/metricsadvisor/AlertTestBase.java index d9451ef9b907d..94db40374d816 100644 --- a/sdk/metricsadvisor/azure-ai-metricsadvisor/src/test/java/com/azure/ai/metricsadvisor/AlertTestBase.java +++ b/sdk/metricsadvisor/azure-ai-metricsadvisor/src/test/java/com/azure/ai/metricsadvisor/AlertTestBase.java @@ -6,7 +6,6 @@ import com.azure.ai.metricsadvisor.models.AlertQueryTimeMode; import com.azure.ai.metricsadvisor.models.AnomalyAlert; import com.azure.ai.metricsadvisor.models.ListAlertOptions; -import com.azure.ai.metricsadvisor.models.MetricsAdvisorServiceVersion; import com.azure.core.http.HttpClient; import org.junit.jupiter.api.Assertions; import org.junit.jupiter.api.Test; diff --git a/sdk/metricsadvisor/azure-ai-metricsadvisor/src/test/java/com/azure/ai/metricsadvisor/AnomalyAlertAsyncTest.java b/sdk/metricsadvisor/azure-ai-metricsadvisor/src/test/java/com/azure/ai/metricsadvisor/AnomalyAlertAsyncTest.java index 933c2455e4287..2a4924f017bf9 100644 --- a/sdk/metricsadvisor/azure-ai-metricsadvisor/src/test/java/com/azure/ai/metricsadvisor/AnomalyAlertAsyncTest.java +++ b/sdk/metricsadvisor/azure-ai-metricsadvisor/src/test/java/com/azure/ai/metricsadvisor/AnomalyAlertAsyncTest.java @@ -4,13 +4,12 @@ package com.azure.ai.metricsadvisor; import com.azure.ai.metricsadvisor.administration.MetricsAdvisorAdministrationAsyncClient; -import com.azure.ai.metricsadvisor.models.AnomalyAlertConfiguration; -import com.azure.ai.metricsadvisor.models.ErrorCodeException; -import com.azure.ai.metricsadvisor.models.ListAnomalyAlertConfigsOptions; -import com.azure.ai.metricsadvisor.models.MetricAnomalyAlertConfiguration; -import com.azure.ai.metricsadvisor.models.MetricAnomalyAlertConfigurationsOperator; -import com.azure.ai.metricsadvisor.models.MetricAnomalyAlertScope; -import com.azure.ai.metricsadvisor.models.MetricsAdvisorServiceVersion; +import com.azure.ai.metricsadvisor.administration.models.AnomalyAlertConfiguration; +import com.azure.ai.metricsadvisor.models.MetricsAdvisorResponseException; +import com.azure.ai.metricsadvisor.administration.models.ListAnomalyAlertConfigsOptions; +import com.azure.ai.metricsadvisor.administration.models.MetricAnomalyAlertConfiguration; +import com.azure.ai.metricsadvisor.administration.models.MetricAnomalyAlertConfigurationsOperator; +import com.azure.ai.metricsadvisor.administration.models.MetricAnomalyAlertScope; import com.azure.core.http.HttpClient; import com.azure.core.test.TestBase; import com.azure.core.util.CoreUtils; @@ -221,8 +220,8 @@ public void deleteAnomalyAlertWithResponse(HttpClient httpClient, MetricsAdvisor // Act & Assert StepVerifier.create(client.getAnomalyAlertConfigWithResponse(createdAnomalyAlert.getId())) .verifyErrorSatisfies(throwable -> { - assertEquals(ErrorCodeException.class, throwable.getClass()); - final ErrorCodeException errorCodeException = (ErrorCodeException) throwable; + assertEquals(MetricsAdvisorResponseException.class, throwable.getClass()); + final MetricsAdvisorResponseException errorCodeException = (MetricsAdvisorResponseException) throwable; assertEquals(HttpResponseStatus.NOT_FOUND.code(), errorCodeException.getResponse().getStatusCode()); }); }); diff --git a/sdk/metricsadvisor/azure-ai-metricsadvisor/src/test/java/com/azure/ai/metricsadvisor/AnomalyAlertTest.java b/sdk/metricsadvisor/azure-ai-metricsadvisor/src/test/java/com/azure/ai/metricsadvisor/AnomalyAlertTest.java index 4a6b98a5d3ad4..9c053c0b86147 100644 --- a/sdk/metricsadvisor/azure-ai-metricsadvisor/src/test/java/com/azure/ai/metricsadvisor/AnomalyAlertTest.java +++ b/sdk/metricsadvisor/azure-ai-metricsadvisor/src/test/java/com/azure/ai/metricsadvisor/AnomalyAlertTest.java @@ -4,13 +4,12 @@ package com.azure.ai.metricsadvisor; import com.azure.ai.metricsadvisor.administration.MetricsAdvisorAdministrationClient; -import com.azure.ai.metricsadvisor.models.AnomalyAlertConfiguration; -import com.azure.ai.metricsadvisor.models.ErrorCodeException; -import com.azure.ai.metricsadvisor.models.ListAnomalyAlertConfigsOptions; -import com.azure.ai.metricsadvisor.models.MetricAnomalyAlertConfiguration; -import com.azure.ai.metricsadvisor.models.MetricAnomalyAlertConfigurationsOperator; -import com.azure.ai.metricsadvisor.models.MetricAnomalyAlertScope; -import com.azure.ai.metricsadvisor.models.MetricsAdvisorServiceVersion; +import com.azure.ai.metricsadvisor.administration.models.AnomalyAlertConfiguration; +import com.azure.ai.metricsadvisor.models.MetricsAdvisorResponseException; +import com.azure.ai.metricsadvisor.administration.models.ListAnomalyAlertConfigsOptions; +import com.azure.ai.metricsadvisor.administration.models.MetricAnomalyAlertConfiguration; +import com.azure.ai.metricsadvisor.administration.models.MetricAnomalyAlertConfigurationsOperator; +import com.azure.ai.metricsadvisor.administration.models.MetricAnomalyAlertScope; import com.azure.core.http.HttpClient; import com.azure.core.http.rest.Response; import com.azure.core.test.TestBase; @@ -209,10 +208,10 @@ public void deleteAnomalyAlertWithResponse(HttpClient httpClient, MetricsAdvisor assertEquals(response.getStatusCode(), HttpResponseStatus.NO_CONTENT.code()); // Act & Assert - Exception exception = assertThrows(ErrorCodeException.class, () -> + Exception exception = assertThrows(MetricsAdvisorResponseException.class, () -> client.getAnomalyAlertConfig(createdAnomalyAlert.getId())); - assertEquals(ErrorCodeException.class, exception.getClass()); - final ErrorCodeException errorCodeException = ((ErrorCodeException) exception); + assertEquals(MetricsAdvisorResponseException.class, exception.getClass()); + final MetricsAdvisorResponseException errorCodeException = ((MetricsAdvisorResponseException) exception); assertEquals(HttpResponseStatus.NOT_FOUND.code(), errorCodeException.getResponse().getStatusCode()); }); } diff --git a/sdk/metricsadvisor/azure-ai-metricsadvisor/src/test/java/com/azure/ai/metricsadvisor/AnomalyAlertTestBase.java b/sdk/metricsadvisor/azure-ai-metricsadvisor/src/test/java/com/azure/ai/metricsadvisor/AnomalyAlertTestBase.java index fe6a5714601bc..2c0a1f6858d02 100644 --- a/sdk/metricsadvisor/azure-ai-metricsadvisor/src/test/java/com/azure/ai/metricsadvisor/AnomalyAlertTestBase.java +++ b/sdk/metricsadvisor/azure-ai-metricsadvisor/src/test/java/com/azure/ai/metricsadvisor/AnomalyAlertTestBase.java @@ -3,12 +3,12 @@ package com.azure.ai.metricsadvisor; -import com.azure.ai.metricsadvisor.models.AnomalyAlertConfiguration; -import com.azure.ai.metricsadvisor.models.MetricAnomalyAlertConditions; -import com.azure.ai.metricsadvisor.models.MetricAnomalyAlertConfiguration; -import com.azure.ai.metricsadvisor.models.MetricAnomalyAlertScope; -import com.azure.ai.metricsadvisor.models.MetricAnomalyAlertSnoozeCondition; -import com.azure.ai.metricsadvisor.models.MetricBoundaryCondition; +import com.azure.ai.metricsadvisor.administration.models.AnomalyAlertConfiguration; +import com.azure.ai.metricsadvisor.administration.models.MetricAnomalyAlertConditions; +import com.azure.ai.metricsadvisor.administration.models.MetricAnomalyAlertConfiguration; +import com.azure.ai.metricsadvisor.administration.models.MetricAnomalyAlertScope; +import com.azure.ai.metricsadvisor.administration.models.MetricAnomalyAlertSnoozeCondition; +import com.azure.ai.metricsadvisor.administration.models.MetricBoundaryCondition; import com.azure.core.util.Configuration; import java.util.Collections; diff --git a/sdk/metricsadvisor/azure-ai-metricsadvisor/src/test/java/com/azure/ai/metricsadvisor/AnomalyDimensionValuesAsyncTest.java b/sdk/metricsadvisor/azure-ai-metricsadvisor/src/test/java/com/azure/ai/metricsadvisor/AnomalyDimensionValuesAsyncTest.java index a36bffe9f5a92..fc357227f1b28 100644 --- a/sdk/metricsadvisor/azure-ai-metricsadvisor/src/test/java/com/azure/ai/metricsadvisor/AnomalyDimensionValuesAsyncTest.java +++ b/sdk/metricsadvisor/azure-ai-metricsadvisor/src/test/java/com/azure/ai/metricsadvisor/AnomalyDimensionValuesAsyncTest.java @@ -3,7 +3,6 @@ package com.azure.ai.metricsadvisor; -import com.azure.ai.metricsadvisor.models.MetricsAdvisorServiceVersion; import com.azure.core.http.HttpClient; import com.azure.core.http.rest.PagedFlux; import com.azure.core.test.TestBase; diff --git a/sdk/metricsadvisor/azure-ai-metricsadvisor/src/test/java/com/azure/ai/metricsadvisor/AnomalyDimensionValuesTest.java b/sdk/metricsadvisor/azure-ai-metricsadvisor/src/test/java/com/azure/ai/metricsadvisor/AnomalyDimensionValuesTest.java index 1c68dee3a30fa..6cc8738fcbc6e 100644 --- a/sdk/metricsadvisor/azure-ai-metricsadvisor/src/test/java/com/azure/ai/metricsadvisor/AnomalyDimensionValuesTest.java +++ b/sdk/metricsadvisor/azure-ai-metricsadvisor/src/test/java/com/azure/ai/metricsadvisor/AnomalyDimensionValuesTest.java @@ -3,7 +3,6 @@ package com.azure.ai.metricsadvisor; -import com.azure.ai.metricsadvisor.models.MetricsAdvisorServiceVersion; import com.azure.core.http.HttpClient; import com.azure.core.http.rest.PagedIterable; import com.azure.core.util.Context; diff --git a/sdk/metricsadvisor/azure-ai-metricsadvisor/src/test/java/com/azure/ai/metricsadvisor/AnomalyDimensionValuesTestBase.java b/sdk/metricsadvisor/azure-ai-metricsadvisor/src/test/java/com/azure/ai/metricsadvisor/AnomalyDimensionValuesTestBase.java index 689156f17cc91..2f32ca5f6b92f 100644 --- a/sdk/metricsadvisor/azure-ai-metricsadvisor/src/test/java/com/azure/ai/metricsadvisor/AnomalyDimensionValuesTestBase.java +++ b/sdk/metricsadvisor/azure-ai-metricsadvisor/src/test/java/com/azure/ai/metricsadvisor/AnomalyDimensionValuesTestBase.java @@ -4,7 +4,6 @@ package com.azure.ai.metricsadvisor; import com.azure.ai.metricsadvisor.models.ListAnomalyDimensionValuesOptions; -import com.azure.ai.metricsadvisor.models.MetricsAdvisorServiceVersion; import com.azure.core.http.HttpClient; import org.junit.jupiter.api.Assertions; import org.junit.jupiter.api.Test; diff --git a/sdk/metricsadvisor/azure-ai-metricsadvisor/src/test/java/com/azure/ai/metricsadvisor/AnomalyForAlertTestBase.java b/sdk/metricsadvisor/azure-ai-metricsadvisor/src/test/java/com/azure/ai/metricsadvisor/AnomalyForAlertTestBase.java index 4e9d37b095857..cfb3f8bcff6d3 100644 --- a/sdk/metricsadvisor/azure-ai-metricsadvisor/src/test/java/com/azure/ai/metricsadvisor/AnomalyForAlertTestBase.java +++ b/sdk/metricsadvisor/azure-ai-metricsadvisor/src/test/java/com/azure/ai/metricsadvisor/AnomalyForAlertTestBase.java @@ -5,7 +5,6 @@ import com.azure.ai.metricsadvisor.models.DataPointAnomaly; import com.azure.ai.metricsadvisor.models.ListAnomaliesAlertedOptions; -import com.azure.ai.metricsadvisor.models.MetricsAdvisorServiceVersion; import com.azure.core.http.HttpClient; import org.junit.jupiter.api.Assertions; diff --git a/sdk/metricsadvisor/azure-ai-metricsadvisor/src/test/java/com/azure/ai/metricsadvisor/AnomalyForDetectionConfigTestBase.java b/sdk/metricsadvisor/azure-ai-metricsadvisor/src/test/java/com/azure/ai/metricsadvisor/AnomalyForDetectionConfigTestBase.java index 5089993636f0c..67776fd98a41d 100644 --- a/sdk/metricsadvisor/azure-ai-metricsadvisor/src/test/java/com/azure/ai/metricsadvisor/AnomalyForDetectionConfigTestBase.java +++ b/sdk/metricsadvisor/azure-ai-metricsadvisor/src/test/java/com/azure/ai/metricsadvisor/AnomalyForDetectionConfigTestBase.java @@ -3,11 +3,10 @@ package com.azure.ai.metricsadvisor; -import com.azure.ai.metricsadvisor.models.AnomalySeverity; +import com.azure.ai.metricsadvisor.administration.models.AnomalySeverity; import com.azure.ai.metricsadvisor.models.DataPointAnomaly; import com.azure.ai.metricsadvisor.models.ListAnomaliesDetectedFilter; import com.azure.ai.metricsadvisor.models.ListAnomaliesDetectedOptions; -import com.azure.ai.metricsadvisor.models.MetricsAdvisorServiceVersion; import com.azure.core.http.HttpClient; import org.junit.jupiter.api.Assertions; diff --git a/sdk/metricsadvisor/azure-ai-metricsadvisor/src/test/java/com/azure/ai/metricsadvisor/AnomalyIncidentDetectedAsyncTest.java b/sdk/metricsadvisor/azure-ai-metricsadvisor/src/test/java/com/azure/ai/metricsadvisor/AnomalyIncidentDetectedAsyncTest.java index f39b0a4e40900..ebf5d82f549e4 100644 --- a/sdk/metricsadvisor/azure-ai-metricsadvisor/src/test/java/com/azure/ai/metricsadvisor/AnomalyIncidentDetectedAsyncTest.java +++ b/sdk/metricsadvisor/azure-ai-metricsadvisor/src/test/java/com/azure/ai/metricsadvisor/AnomalyIncidentDetectedAsyncTest.java @@ -4,7 +4,6 @@ package com.azure.ai.metricsadvisor; import com.azure.ai.metricsadvisor.models.AnomalyIncident; -import com.azure.ai.metricsadvisor.models.MetricsAdvisorServiceVersion; import com.azure.core.http.HttpClient; import com.azure.core.http.rest.PagedFlux; import com.azure.core.test.TestBase; @@ -41,7 +40,7 @@ public void listIncidentsDetected(HttpClient httpClient, MetricsAdvisorServiceVe MetricsAdvisorAsyncClient client = getMetricsAdvisorBuilder(httpClient, serviceVersion).buildAsyncClient(); PagedFlux incidentsFlux - = client.listIncidentsForDetectionConfig( + = client.listIncidents( ListIncidentsDetectedInput.INSTANCE.detectionConfigurationId, ListIncidentsDetectedInput.INSTANCE.startTime, ListIncidentsDetectedInput.INSTANCE.endTime, ListIncidentsDetectedInput.INSTANCE.options); diff --git a/sdk/metricsadvisor/azure-ai-metricsadvisor/src/test/java/com/azure/ai/metricsadvisor/AnomalyIncidentDetectedTest.java b/sdk/metricsadvisor/azure-ai-metricsadvisor/src/test/java/com/azure/ai/metricsadvisor/AnomalyIncidentDetectedTest.java index 95b5be7a937f4..213c79c25792f 100644 --- a/sdk/metricsadvisor/azure-ai-metricsadvisor/src/test/java/com/azure/ai/metricsadvisor/AnomalyIncidentDetectedTest.java +++ b/sdk/metricsadvisor/azure-ai-metricsadvisor/src/test/java/com/azure/ai/metricsadvisor/AnomalyIncidentDetectedTest.java @@ -4,7 +4,6 @@ package com.azure.ai.metricsadvisor; import com.azure.ai.metricsadvisor.models.AnomalyIncident; -import com.azure.ai.metricsadvisor.models.MetricsAdvisorServiceVersion; import com.azure.core.http.HttpClient; import com.azure.core.http.rest.PagedIterable; import com.azure.core.test.TestBase; @@ -39,7 +38,7 @@ public void listIncidentsDetected(HttpClient httpClient, MetricsAdvisorServiceVe MetricsAdvisorClient client = getMetricsAdvisorBuilder(httpClient, serviceVersion).buildClient(); PagedIterable incidentsIterable - = client.listIncidentsForDetectionConfig( + = client.listIncidents( ListIncidentsDetectedInput.INSTANCE.detectionConfigurationId, ListIncidentsDetectedInput.INSTANCE.startTime, ListIncidentsDetectedInput.INSTANCE.endTime, ListIncidentsDetectedInput.INSTANCE.options, Context.NONE); diff --git a/sdk/metricsadvisor/azure-ai-metricsadvisor/src/test/java/com/azure/ai/metricsadvisor/AnomalyIncidentForAlertAsyncTest.java b/sdk/metricsadvisor/azure-ai-metricsadvisor/src/test/java/com/azure/ai/metricsadvisor/AnomalyIncidentForAlertAsyncTest.java index dd37b2ae96e16..94dd2de4e17e4 100644 --- a/sdk/metricsadvisor/azure-ai-metricsadvisor/src/test/java/com/azure/ai/metricsadvisor/AnomalyIncidentForAlertAsyncTest.java +++ b/sdk/metricsadvisor/azure-ai-metricsadvisor/src/test/java/com/azure/ai/metricsadvisor/AnomalyIncidentForAlertAsyncTest.java @@ -4,7 +4,6 @@ package com.azure.ai.metricsadvisor; import com.azure.ai.metricsadvisor.models.AnomalyIncident; -import com.azure.ai.metricsadvisor.models.MetricsAdvisorServiceVersion; import com.azure.core.http.HttpClient; import com.azure.core.http.rest.PagedFlux; import com.azure.core.test.TestBase; @@ -39,7 +38,7 @@ public void listIncidentsForAlert(HttpClient httpClient, MetricsAdvisorServiceVe MetricsAdvisorAsyncClient client = getMetricsAdvisorBuilder(httpClient, serviceVersion).buildAsyncClient(); PagedFlux incidentsFlux - = client.listIncidentsForAlert( + = client.listIncidents( ListIncidentsForAlertInput.INSTANCE.alertConfigurationId, ListIncidentsForAlertInput.INSTANCE.alertId, ListIncidentsForAlertInput.INSTANCE.options); diff --git a/sdk/metricsadvisor/azure-ai-metricsadvisor/src/test/java/com/azure/ai/metricsadvisor/AnomalyIncidentForAlertTest.java b/sdk/metricsadvisor/azure-ai-metricsadvisor/src/test/java/com/azure/ai/metricsadvisor/AnomalyIncidentForAlertTest.java index 393ee04a22aca..a87d5f0577ace 100644 --- a/sdk/metricsadvisor/azure-ai-metricsadvisor/src/test/java/com/azure/ai/metricsadvisor/AnomalyIncidentForAlertTest.java +++ b/sdk/metricsadvisor/azure-ai-metricsadvisor/src/test/java/com/azure/ai/metricsadvisor/AnomalyIncidentForAlertTest.java @@ -6,10 +6,10 @@ package com.azure.ai.metricsadvisor; import com.azure.ai.metricsadvisor.models.AnomalyIncident; -import com.azure.ai.metricsadvisor.models.MetricsAdvisorServiceVersion; import com.azure.core.http.HttpClient; import com.azure.core.http.rest.PagedIterable; import com.azure.core.test.TestBase; +import com.azure.core.util.Context; import org.junit.jupiter.api.AfterAll; import org.junit.jupiter.api.Assertions; import org.junit.jupiter.api.BeforeAll; @@ -42,10 +42,11 @@ public void listIncidentsForAlert(HttpClient httpClient, MetricsAdvisorServiceVe MetricsAdvisorClient client = getMetricsAdvisorBuilder(httpClient, serviceVersion).buildClient(); PagedIterable incidentsIterable - = client.listIncidentsForAlert( + = client.listIncidents( ListIncidentsForAlertInput.INSTANCE.alertConfigurationId, ListIncidentsForAlertInput.INSTANCE.alertId, - ListIncidentsForAlertInput.INSTANCE.options); + ListIncidentsForAlertInput.INSTANCE.options, + Context.NONE); int[] cnt = new int[1]; for (AnomalyIncident anomalyIncident : incidentsIterable) { diff --git a/sdk/metricsadvisor/azure-ai-metricsadvisor/src/test/java/com/azure/ai/metricsadvisor/AnomalyIncidentRootCauseAsyncTest.java b/sdk/metricsadvisor/azure-ai-metricsadvisor/src/test/java/com/azure/ai/metricsadvisor/AnomalyIncidentRootCauseAsyncTest.java index 4a43a6d04878b..62a8ba7b511be 100644 --- a/sdk/metricsadvisor/azure-ai-metricsadvisor/src/test/java/com/azure/ai/metricsadvisor/AnomalyIncidentRootCauseAsyncTest.java +++ b/sdk/metricsadvisor/azure-ai-metricsadvisor/src/test/java/com/azure/ai/metricsadvisor/AnomalyIncidentRootCauseAsyncTest.java @@ -4,7 +4,6 @@ package com.azure.ai.metricsadvisor; import com.azure.ai.metricsadvisor.models.IncidentRootCause; -import com.azure.ai.metricsadvisor.models.MetricsAdvisorServiceVersion; import com.azure.core.http.HttpClient; import org.junit.jupiter.api.AfterAll; import org.junit.jupiter.api.BeforeAll; diff --git a/sdk/metricsadvisor/azure-ai-metricsadvisor/src/test/java/com/azure/ai/metricsadvisor/AnomalyIncidentRootCauseTest.java b/sdk/metricsadvisor/azure-ai-metricsadvisor/src/test/java/com/azure/ai/metricsadvisor/AnomalyIncidentRootCauseTest.java index 6ef538aa139af..2ad8f4e17a95f 100644 --- a/sdk/metricsadvisor/azure-ai-metricsadvisor/src/test/java/com/azure/ai/metricsadvisor/AnomalyIncidentRootCauseTest.java +++ b/sdk/metricsadvisor/azure-ai-metricsadvisor/src/test/java/com/azure/ai/metricsadvisor/AnomalyIncidentRootCauseTest.java @@ -4,7 +4,6 @@ package com.azure.ai.metricsadvisor; import com.azure.ai.metricsadvisor.models.IncidentRootCause; -import com.azure.ai.metricsadvisor.models.MetricsAdvisorServiceVersion; import com.azure.core.http.HttpClient; import org.junit.jupiter.api.AfterAll; import org.junit.jupiter.api.BeforeAll; diff --git a/sdk/metricsadvisor/azure-ai-metricsadvisor/src/test/java/com/azure/ai/metricsadvisor/CredentialsTests.java b/sdk/metricsadvisor/azure-ai-metricsadvisor/src/test/java/com/azure/ai/metricsadvisor/CredentialsTests.java index b6fcbaf612b0a..f0be59e341bf6 100644 --- a/sdk/metricsadvisor/azure-ai-metricsadvisor/src/test/java/com/azure/ai/metricsadvisor/CredentialsTests.java +++ b/sdk/metricsadvisor/azure-ai-metricsadvisor/src/test/java/com/azure/ai/metricsadvisor/CredentialsTests.java @@ -13,19 +13,15 @@ public void testKeyUpdate() { final MetricsAdvisorKeyCredential credential = new MetricsAdvisorKeyCredential("sub-id-1", "key-1"); - Assertions.assertTrue(credential.getSubscriptionKey().equals("sub-id-1")); - Assertions.assertTrue(credential.getApiKey().equals("key-1")); + Assertions.assertTrue(credential.getKeys().getSubscriptionKey().equals("sub-id-1")); + Assertions.assertTrue(credential.getKeys().getApiKey().equals("key-1")); - credential.updateSubscriptionKey(null); - Assertions.assertNull(credential.getSubscriptionKey()); + credential.updateKey(null, null); + Assertions.assertNull(credential.getKeys().getSubscriptionKey()); + Assertions.assertNull(credential.getKeys().getApiKey()); - credential.updateApiKey(null); - Assertions.assertNull(credential.getApiKey()); - - credential.updateSubscriptionKey("sub-id-2"); - Assertions.assertTrue(credential.getSubscriptionKey().equals("sub-id-2")); - - credential.updateApiKey("key-2"); - Assertions.assertTrue(credential.getApiKey().equals("key-2")); + credential.updateKey("sub-id-2", "key-2"); + Assertions.assertTrue(credential.getKeys().getSubscriptionKey().equals("sub-id-2")); + Assertions.assertTrue(credential.getKeys().getApiKey().equals("key-2")); } } diff --git a/sdk/metricsadvisor/azure-ai-metricsadvisor/src/test/java/com/azure/ai/metricsadvisor/DataFeedAsyncClientTest.java b/sdk/metricsadvisor/azure-ai-metricsadvisor/src/test/java/com/azure/ai/metricsadvisor/DataFeedAsyncClientTest.java index d6a7e29a176b9..7e55312e57233 100644 --- a/sdk/metricsadvisor/azure-ai-metricsadvisor/src/test/java/com/azure/ai/metricsadvisor/DataFeedAsyncClientTest.java +++ b/sdk/metricsadvisor/azure-ai-metricsadvisor/src/test/java/com/azure/ai/metricsadvisor/DataFeedAsyncClientTest.java @@ -4,15 +4,14 @@ package com.azure.ai.metricsadvisor; import com.azure.ai.metricsadvisor.administration.MetricsAdvisorAdministrationAsyncClient; -import com.azure.ai.metricsadvisor.models.DataFeed; -import com.azure.ai.metricsadvisor.models.DataFeedGranularityType; -import com.azure.ai.metricsadvisor.models.DataFeedSourceType; -import com.azure.ai.metricsadvisor.models.DataFeedStatus; -import com.azure.ai.metricsadvisor.models.ErrorCode; -import com.azure.ai.metricsadvisor.models.ErrorCodeException; -import com.azure.ai.metricsadvisor.models.ListDataFeedFilter; -import com.azure.ai.metricsadvisor.models.ListDataFeedOptions; -import com.azure.ai.metricsadvisor.models.MetricsAdvisorServiceVersion; +import com.azure.ai.metricsadvisor.administration.models.DataFeed; +import com.azure.ai.metricsadvisor.administration.models.DataFeedGranularityType; +import com.azure.ai.metricsadvisor.administration.models.DataFeedSourceType; +import com.azure.ai.metricsadvisor.administration.models.DataFeedStatus; +import com.azure.ai.metricsadvisor.models.MetricsAdvisorError; +import com.azure.ai.metricsadvisor.models.MetricsAdvisorResponseException; +import com.azure.ai.metricsadvisor.administration.models.ListDataFeedFilter; +import com.azure.ai.metricsadvisor.administration.models.ListDataFeedOptions; import com.azure.core.http.HttpClient; import com.azure.core.test.TestBase; import com.azure.core.util.CoreUtils; @@ -38,20 +37,20 @@ import static com.azure.ai.metricsadvisor.TestUtils.DISPLAY_NAME_WITH_ARGUMENTS; import static com.azure.ai.metricsadvisor.TestUtils.INCORRECT_UUID; import static com.azure.ai.metricsadvisor.TestUtils.INCORRECT_UUID_ERROR; -import static com.azure.ai.metricsadvisor.models.DataFeedGranularityType.DAILY; -import static com.azure.ai.metricsadvisor.models.DataFeedSourceType.AZURE_APP_INSIGHTS; -import static com.azure.ai.metricsadvisor.models.DataFeedSourceType.AZURE_BLOB; -import static com.azure.ai.metricsadvisor.models.DataFeedSourceType.AZURE_COSMOS_DB; -import static com.azure.ai.metricsadvisor.models.DataFeedSourceType.AZURE_DATA_EXPLORER; -import static com.azure.ai.metricsadvisor.models.DataFeedSourceType.AZURE_DATA_LAKE_STORAGE_GEN2; -import static com.azure.ai.metricsadvisor.models.DataFeedSourceType.AZURE_LOG_ANALYTICS; -import static com.azure.ai.metricsadvisor.models.DataFeedSourceType.AZURE_TABLE; -import static com.azure.ai.metricsadvisor.models.DataFeedSourceType.INFLUX_DB; -import static com.azure.ai.metricsadvisor.models.DataFeedSourceType.MONGO_DB; -import static com.azure.ai.metricsadvisor.models.DataFeedSourceType.MYSQL_DB; -import static com.azure.ai.metricsadvisor.models.DataFeedSourceType.POSTGRE_SQL_DB; -import static com.azure.ai.metricsadvisor.models.DataFeedSourceType.SQL_SERVER_DB; -import static com.azure.ai.metricsadvisor.models.DataFeedStatus.ACTIVE; +import static com.azure.ai.metricsadvisor.administration.models.DataFeedGranularityType.DAILY; +import static com.azure.ai.metricsadvisor.administration.models.DataFeedSourceType.AZURE_APP_INSIGHTS; +import static com.azure.ai.metricsadvisor.administration.models.DataFeedSourceType.AZURE_BLOB; +import static com.azure.ai.metricsadvisor.administration.models.DataFeedSourceType.AZURE_COSMOS_DB; +import static com.azure.ai.metricsadvisor.administration.models.DataFeedSourceType.AZURE_DATA_EXPLORER; +import static com.azure.ai.metricsadvisor.administration.models.DataFeedSourceType.AZURE_DATA_LAKE_STORAGE_GEN2; +import static com.azure.ai.metricsadvisor.administration.models.DataFeedSourceType.AZURE_LOG_ANALYTICS; +import static com.azure.ai.metricsadvisor.administration.models.DataFeedSourceType.AZURE_TABLE; +import static com.azure.ai.metricsadvisor.administration.models.DataFeedSourceType.INFLUX_DB; +import static com.azure.ai.metricsadvisor.administration.models.DataFeedSourceType.MONGO_DB; +import static com.azure.ai.metricsadvisor.administration.models.DataFeedSourceType.MYSQL_DB; +import static com.azure.ai.metricsadvisor.administration.models.DataFeedSourceType.POSTGRE_SQL_DB; +import static com.azure.ai.metricsadvisor.administration.models.DataFeedSourceType.SQL_SERVER_DB; +import static com.azure.ai.metricsadvisor.administration.models.DataFeedStatus.ACTIVE; import static org.junit.jupiter.api.Assertions.assertEquals; import static org.junit.jupiter.api.Assertions.assertNotNull; @@ -99,8 +98,8 @@ void testListDataFeed(HttpClient httpClient, MetricsAdvisorServiceVersion servic // Assert assertEquals(inputDataFeedList.size(), actualList.size()); - expectedDataFeedList.sort(Comparator.comparing(DataFeed::getSourceType)); - actualList.sort(Comparator.comparing(DataFeed::getSourceType)); + expectedDataFeedList.sort(Comparator.comparing(dataFeed -> dataFeed.getSourceType().toString())); + actualList.sort(Comparator.comparing(dataFeed -> dataFeed.getSourceType().toString())); final AtomicInteger i = new AtomicInteger(-1); final List dataFeedSourceTypes = Arrays.asList(AZURE_BLOB, SQL_SERVER_DB); expectedDataFeedList.forEach(expectedDataFeed -> validateDataFeedResult(expectedDataFeed, @@ -735,8 +734,8 @@ public void deleteDataFeedIdWithResponse(HttpClient httpClient, MetricsAdvisorSe // Act & Assert StepVerifier.create(client.getDataFeedWithResponse(createdDataFeed.getId())) .verifyErrorSatisfies(throwable -> { - assertEquals(ErrorCodeException.class, throwable.getClass()); - final ErrorCode errorCode = ((ErrorCodeException) throwable).getValue(); + assertEquals(MetricsAdvisorResponseException.class, throwable.getClass()); + final MetricsAdvisorError errorCode = ((MetricsAdvisorResponseException) throwable).getValue(); assertEquals(errorCode.getCode(), "ERROR_INVALID_PARAMETER"); assertEquals(errorCode.getMessage(), "datafeedId is invalid."); }); diff --git a/sdk/metricsadvisor/azure-ai-metricsadvisor/src/test/java/com/azure/ai/metricsadvisor/DataFeedClientTest.java b/sdk/metricsadvisor/azure-ai-metricsadvisor/src/test/java/com/azure/ai/metricsadvisor/DataFeedClientTest.java index 1b6a6ffd40ac2..10ae607db7711 100644 --- a/sdk/metricsadvisor/azure-ai-metricsadvisor/src/test/java/com/azure/ai/metricsadvisor/DataFeedClientTest.java +++ b/sdk/metricsadvisor/azure-ai-metricsadvisor/src/test/java/com/azure/ai/metricsadvisor/DataFeedClientTest.java @@ -4,19 +4,18 @@ package com.azure.ai.metricsadvisor; import com.azure.ai.metricsadvisor.administration.MetricsAdvisorAdministrationClient; -import com.azure.ai.metricsadvisor.models.DataFeed; -import com.azure.ai.metricsadvisor.models.DataFeedGranularity; -import com.azure.ai.metricsadvisor.models.DataFeedGranularityType; -import com.azure.ai.metricsadvisor.models.DataFeedMetric; -import com.azure.ai.metricsadvisor.models.DataFeedSchema; -import com.azure.ai.metricsadvisor.models.DataFeedSourceType; -import com.azure.ai.metricsadvisor.models.DataFeedStatus; -import com.azure.ai.metricsadvisor.models.ErrorCode; -import com.azure.ai.metricsadvisor.models.ErrorCodeException; -import com.azure.ai.metricsadvisor.models.ListDataFeedFilter; -import com.azure.ai.metricsadvisor.models.ListDataFeedOptions; -import com.azure.ai.metricsadvisor.models.MetricsAdvisorServiceVersion; -import com.azure.ai.metricsadvisor.models.PostgreSqlDataFeedSource; +import com.azure.ai.metricsadvisor.administration.models.DataFeed; +import com.azure.ai.metricsadvisor.administration.models.DataFeedGranularity; +import com.azure.ai.metricsadvisor.administration.models.DataFeedGranularityType; +import com.azure.ai.metricsadvisor.administration.models.DataFeedMetric; +import com.azure.ai.metricsadvisor.administration.models.DataFeedSchema; +import com.azure.ai.metricsadvisor.administration.models.DataFeedSourceType; +import com.azure.ai.metricsadvisor.administration.models.DataFeedStatus; +import com.azure.ai.metricsadvisor.models.MetricsAdvisorError; +import com.azure.ai.metricsadvisor.models.MetricsAdvisorResponseException; +import com.azure.ai.metricsadvisor.administration.models.ListDataFeedFilter; +import com.azure.ai.metricsadvisor.administration.models.ListDataFeedOptions; +import com.azure.ai.metricsadvisor.administration.models.PostgreSqlDataFeedSource; import com.azure.core.http.HttpClient; import com.azure.core.http.rest.PagedResponse; import com.azure.core.http.rest.Response; @@ -45,20 +44,20 @@ import static com.azure.ai.metricsadvisor.TestUtils.DISPLAY_NAME_WITH_ARGUMENTS; import static com.azure.ai.metricsadvisor.TestUtils.INCORRECT_UUID; import static com.azure.ai.metricsadvisor.TestUtils.INCORRECT_UUID_ERROR; -import static com.azure.ai.metricsadvisor.models.DataFeedGranularityType.DAILY; -import static com.azure.ai.metricsadvisor.models.DataFeedSourceType.AZURE_APP_INSIGHTS; -import static com.azure.ai.metricsadvisor.models.DataFeedSourceType.AZURE_BLOB; -import static com.azure.ai.metricsadvisor.models.DataFeedSourceType.AZURE_COSMOS_DB; -import static com.azure.ai.metricsadvisor.models.DataFeedSourceType.AZURE_DATA_EXPLORER; -import static com.azure.ai.metricsadvisor.models.DataFeedSourceType.AZURE_DATA_LAKE_STORAGE_GEN2; -import static com.azure.ai.metricsadvisor.models.DataFeedSourceType.AZURE_LOG_ANALYTICS; -import static com.azure.ai.metricsadvisor.models.DataFeedSourceType.AZURE_TABLE; -import static com.azure.ai.metricsadvisor.models.DataFeedSourceType.INFLUX_DB; -import static com.azure.ai.metricsadvisor.models.DataFeedSourceType.MONGO_DB; -import static com.azure.ai.metricsadvisor.models.DataFeedSourceType.MYSQL_DB; -import static com.azure.ai.metricsadvisor.models.DataFeedSourceType.POSTGRE_SQL_DB; -import static com.azure.ai.metricsadvisor.models.DataFeedSourceType.SQL_SERVER_DB; -import static com.azure.ai.metricsadvisor.models.DataFeedStatus.ACTIVE; +import static com.azure.ai.metricsadvisor.administration.models.DataFeedGranularityType.DAILY; +import static com.azure.ai.metricsadvisor.administration.models.DataFeedSourceType.AZURE_APP_INSIGHTS; +import static com.azure.ai.metricsadvisor.administration.models.DataFeedSourceType.AZURE_BLOB; +import static com.azure.ai.metricsadvisor.administration.models.DataFeedSourceType.AZURE_COSMOS_DB; +import static com.azure.ai.metricsadvisor.administration.models.DataFeedSourceType.AZURE_DATA_EXPLORER; +import static com.azure.ai.metricsadvisor.administration.models.DataFeedSourceType.AZURE_DATA_LAKE_STORAGE_GEN2; +import static com.azure.ai.metricsadvisor.administration.models.DataFeedSourceType.AZURE_LOG_ANALYTICS; +import static com.azure.ai.metricsadvisor.administration.models.DataFeedSourceType.AZURE_TABLE; +import static com.azure.ai.metricsadvisor.administration.models.DataFeedSourceType.INFLUX_DB; +import static com.azure.ai.metricsadvisor.administration.models.DataFeedSourceType.MONGO_DB; +import static com.azure.ai.metricsadvisor.administration.models.DataFeedSourceType.MYSQL_DB; +import static com.azure.ai.metricsadvisor.administration.models.DataFeedSourceType.POSTGRE_SQL_DB; +import static com.azure.ai.metricsadvisor.administration.models.DataFeedSourceType.SQL_SERVER_DB; +import static com.azure.ai.metricsadvisor.administration.models.DataFeedStatus.ACTIVE; import static org.junit.jupiter.api.Assertions.assertEquals; import static org.junit.jupiter.api.Assertions.assertNotNull; import static org.junit.jupiter.api.Assertions.assertThrows; @@ -106,8 +105,8 @@ void testListDataFeed(HttpClient httpClient, MetricsAdvisorServiceVersion servic .collect(Collectors.toList()); assertEquals(inputDataFeedList.size(), actualList.size()); - expectedDataFeedList.sort(Comparator.comparing(DataFeed::getSourceType)); - actualList.sort(Comparator.comparing(DataFeed::getSourceType)); + expectedDataFeedList.sort(Comparator.comparing(dataFeed -> dataFeed.getSourceType().toString())); + actualList.sort(Comparator.comparing(dataFeed -> dataFeed.getSourceType().toString())); final AtomicInteger i = new AtomicInteger(-1); final List dataFeedSourceTypes = Arrays.asList(AZURE_BLOB, SQL_SERVER_DB); expectedDataFeedList.forEach(expectedDataFeed -> @@ -726,9 +725,9 @@ public void deleteDataFeedIdWithResponse(HttpClient httpClient, MetricsAdvisorSe client.deleteDataFeedWithResponse(createdDataFeed.getId(), Context.NONE).getStatusCode()); // Act & Assert - ErrorCodeException exception = assertThrows(ErrorCodeException.class, () -> + MetricsAdvisorResponseException exception = assertThrows(MetricsAdvisorResponseException.class, () -> client.getDataFeedWithResponse(createdDataFeed.getId(), Context.NONE)); - final ErrorCode errorCode = exception.getValue(); + final MetricsAdvisorError errorCode = exception.getValue(); assertEquals(errorCode.getCode(), "ERROR_INVALID_PARAMETER"); assertEquals(errorCode.getMessage(), "datafeedId is invalid."); }, SQL_SERVER_DB); @@ -781,8 +780,8 @@ public void createDataFeedDuplicateMetricName(HttpClient httpClient, MetricsAdvi creatDataFeedRunner(expectedDataFeed -> { expectedDataFeed.setSchema(new DataFeedSchema(Arrays.asList(dataFeedMetric, dataFeedMetric2))); // Act & Assert - final ErrorCodeException errorCodeException - = assertThrows(ErrorCodeException.class, () -> client.createDataFeed(expectedDataFeed)); + final MetricsAdvisorResponseException errorCodeException + = assertThrows(MetricsAdvisorResponseException.class, () -> client.createDataFeed(expectedDataFeed)); assertEquals("The metric name 'cost' is duplicate,please remove one.", errorCodeException.getValue().getMessage()); diff --git a/sdk/metricsadvisor/azure-ai-metricsadvisor/src/test/java/com/azure/ai/metricsadvisor/DataFeedIngestionOperationAsyncTest.java b/sdk/metricsadvisor/azure-ai-metricsadvisor/src/test/java/com/azure/ai/metricsadvisor/DataFeedIngestionOperationAsyncTest.java index cdd4510f0331d..0b9aadeb762b6 100644 --- a/sdk/metricsadvisor/azure-ai-metricsadvisor/src/test/java/com/azure/ai/metricsadvisor/DataFeedIngestionOperationAsyncTest.java +++ b/sdk/metricsadvisor/azure-ai-metricsadvisor/src/test/java/com/azure/ai/metricsadvisor/DataFeedIngestionOperationAsyncTest.java @@ -4,9 +4,8 @@ package com.azure.ai.metricsadvisor; import com.azure.ai.metricsadvisor.administration.MetricsAdvisorAdministrationAsyncClient; -import com.azure.ai.metricsadvisor.models.DataFeedIngestionProgress; -import com.azure.ai.metricsadvisor.models.DataFeedIngestionStatus; -import com.azure.ai.metricsadvisor.models.MetricsAdvisorServiceVersion; +import com.azure.ai.metricsadvisor.administration.models.DataFeedIngestionProgress; +import com.azure.ai.metricsadvisor.administration.models.DataFeedIngestionStatus; import com.azure.core.http.HttpClient; import com.azure.core.http.rest.PagedFlux; import com.azure.core.http.rest.Response; diff --git a/sdk/metricsadvisor/azure-ai-metricsadvisor/src/test/java/com/azure/ai/metricsadvisor/DataFeedIngestionOperationTest.java b/sdk/metricsadvisor/azure-ai-metricsadvisor/src/test/java/com/azure/ai/metricsadvisor/DataFeedIngestionOperationTest.java index da81403b8d625..d80716f282420 100644 --- a/sdk/metricsadvisor/azure-ai-metricsadvisor/src/test/java/com/azure/ai/metricsadvisor/DataFeedIngestionOperationTest.java +++ b/sdk/metricsadvisor/azure-ai-metricsadvisor/src/test/java/com/azure/ai/metricsadvisor/DataFeedIngestionOperationTest.java @@ -4,9 +4,8 @@ package com.azure.ai.metricsadvisor; import com.azure.ai.metricsadvisor.administration.MetricsAdvisorAdministrationClient; -import com.azure.ai.metricsadvisor.models.DataFeedIngestionProgress; -import com.azure.ai.metricsadvisor.models.DataFeedIngestionStatus; -import com.azure.ai.metricsadvisor.models.MetricsAdvisorServiceVersion; +import com.azure.ai.metricsadvisor.administration.models.DataFeedIngestionProgress; +import com.azure.ai.metricsadvisor.administration.models.DataFeedIngestionStatus; import com.azure.core.http.HttpClient; import com.azure.core.http.rest.PagedIterable; import com.azure.core.http.rest.Response; diff --git a/sdk/metricsadvisor/azure-ai-metricsadvisor/src/test/java/com/azure/ai/metricsadvisor/DataFeedIngestionOperationTestBase.java b/sdk/metricsadvisor/azure-ai-metricsadvisor/src/test/java/com/azure/ai/metricsadvisor/DataFeedIngestionOperationTestBase.java index 9a3bfa79cdc90..e1a1504af8be0 100644 --- a/sdk/metricsadvisor/azure-ai-metricsadvisor/src/test/java/com/azure/ai/metricsadvisor/DataFeedIngestionOperationTestBase.java +++ b/sdk/metricsadvisor/azure-ai-metricsadvisor/src/test/java/com/azure/ai/metricsadvisor/DataFeedIngestionOperationTestBase.java @@ -3,10 +3,9 @@ package com.azure.ai.metricsadvisor; -import com.azure.ai.metricsadvisor.models.DataFeedIngestionProgress; -import com.azure.ai.metricsadvisor.models.DataFeedIngestionStatus; -import com.azure.ai.metricsadvisor.models.ListDataFeedIngestionOptions; -import com.azure.ai.metricsadvisor.models.MetricsAdvisorServiceVersion; +import com.azure.ai.metricsadvisor.administration.models.DataFeedIngestionProgress; +import com.azure.ai.metricsadvisor.administration.models.DataFeedIngestionStatus; +import com.azure.ai.metricsadvisor.administration.models.ListDataFeedIngestionOptions; import com.azure.core.http.HttpClient; import com.azure.core.http.rest.Response; import org.junit.jupiter.api.Assertions; diff --git a/sdk/metricsadvisor/azure-ai-metricsadvisor/src/test/java/com/azure/ai/metricsadvisor/DataFeedTestBase.java b/sdk/metricsadvisor/azure-ai-metricsadvisor/src/test/java/com/azure/ai/metricsadvisor/DataFeedTestBase.java index 0c6731f98450a..181547040b376 100644 --- a/sdk/metricsadvisor/azure-ai-metricsadvisor/src/test/java/com/azure/ai/metricsadvisor/DataFeedTestBase.java +++ b/sdk/metricsadvisor/azure-ai-metricsadvisor/src/test/java/com/azure/ai/metricsadvisor/DataFeedTestBase.java @@ -3,33 +3,32 @@ package com.azure.ai.metricsadvisor; -import com.azure.ai.metricsadvisor.models.AzureAppInsightsDataFeedSource; -import com.azure.ai.metricsadvisor.models.AzureBlobDataFeedSource; -import com.azure.ai.metricsadvisor.models.AzureCosmosDataFeedSource; -import com.azure.ai.metricsadvisor.models.AzureDataExplorerDataFeedSource; -import com.azure.ai.metricsadvisor.models.AzureDataLakeStorageGen2DataFeedSource; -import com.azure.ai.metricsadvisor.models.AzureLogAnalyticsDataFeedSource; -import com.azure.ai.metricsadvisor.models.AzureTableDataFeedSource; -import com.azure.ai.metricsadvisor.models.DataFeed; -import com.azure.ai.metricsadvisor.models.DataFeedAutoRollUpMethod; -import com.azure.ai.metricsadvisor.models.DataFeedGranularity; -import com.azure.ai.metricsadvisor.models.DataFeedGranularityType; -import com.azure.ai.metricsadvisor.models.DataFeedIngestionSettings; -import com.azure.ai.metricsadvisor.models.DataFeedMetric; -import com.azure.ai.metricsadvisor.models.DataFeedMissingDataPointFillSettings; -import com.azure.ai.metricsadvisor.models.DataFeedOptions; -import com.azure.ai.metricsadvisor.models.DataFeedRollupSettings; -import com.azure.ai.metricsadvisor.models.DataFeedRollupType; -import com.azure.ai.metricsadvisor.models.DataFeedSchema; -import com.azure.ai.metricsadvisor.models.DataFeedSourceType; -import com.azure.ai.metricsadvisor.models.DataFeedMissingDataPointFillType; -import com.azure.ai.metricsadvisor.models.DataFeedDimension; -import com.azure.ai.metricsadvisor.models.InfluxDBDataFeedSource; -import com.azure.ai.metricsadvisor.models.MetricsAdvisorServiceVersion; -import com.azure.ai.metricsadvisor.models.MongoDBDataFeedSource; -import com.azure.ai.metricsadvisor.models.MySqlDataFeedSource; -import com.azure.ai.metricsadvisor.models.PostgreSqlDataFeedSource; -import com.azure.ai.metricsadvisor.models.SQLServerDataFeedSource; +import com.azure.ai.metricsadvisor.administration.models.AzureAppInsightsDataFeedSource; +import com.azure.ai.metricsadvisor.administration.models.AzureBlobDataFeedSource; +import com.azure.ai.metricsadvisor.administration.models.AzureCosmosDbDataFeedSource; +import com.azure.ai.metricsadvisor.administration.models.AzureDataExplorerDataFeedSource; +import com.azure.ai.metricsadvisor.administration.models.AzureDataLakeStorageGen2DataFeedSource; +import com.azure.ai.metricsadvisor.administration.models.AzureLogAnalyticsDataFeedSource; +import com.azure.ai.metricsadvisor.administration.models.AzureTableDataFeedSource; +import com.azure.ai.metricsadvisor.administration.models.DataFeed; +import com.azure.ai.metricsadvisor.administration.models.DataFeedAutoRollUpMethod; +import com.azure.ai.metricsadvisor.administration.models.DataFeedGranularity; +import com.azure.ai.metricsadvisor.administration.models.DataFeedGranularityType; +import com.azure.ai.metricsadvisor.administration.models.DataFeedIngestionSettings; +import com.azure.ai.metricsadvisor.administration.models.DataFeedMetric; +import com.azure.ai.metricsadvisor.administration.models.DataFeedMissingDataPointFillSettings; +import com.azure.ai.metricsadvisor.administration.models.DataFeedOptions; +import com.azure.ai.metricsadvisor.administration.models.DataFeedRollupSettings; +import com.azure.ai.metricsadvisor.administration.models.DataFeedRollupType; +import com.azure.ai.metricsadvisor.administration.models.DataFeedSchema; +import com.azure.ai.metricsadvisor.administration.models.DataFeedSourceType; +import com.azure.ai.metricsadvisor.administration.models.DataFeedMissingDataPointFillType; +import com.azure.ai.metricsadvisor.administration.models.DataFeedDimension; +import com.azure.ai.metricsadvisor.models.InfluxDbDataFeedSource; +import com.azure.ai.metricsadvisor.administration.models.MongoDbDataFeedSource; +import com.azure.ai.metricsadvisor.administration.models.MySqlDataFeedSource; +import com.azure.ai.metricsadvisor.administration.models.PostgreSqlDataFeedSource; +import com.azure.ai.metricsadvisor.administration.models.SqlServerDataFeedSource; import com.azure.core.http.HttpClient; import com.azure.core.util.Configuration; import org.junit.jupiter.api.Test; @@ -45,7 +44,11 @@ import static com.azure.ai.metricsadvisor.TestUtils.APP_INSIGHTS_APPLICATION_ID; import static com.azure.ai.metricsadvisor.TestUtils.APP_INSIGHTS_QUERY; import static com.azure.ai.metricsadvisor.TestUtils.AZURE_DATALAKEGEN2_ACCOUNT_KEY; +import static com.azure.ai.metricsadvisor.TestUtils.AZURE_METRICS_ADVISOR_LOG_ANALYTICS_CLIENT_ID; +import static com.azure.ai.metricsadvisor.TestUtils.AZURE_METRICS_ADVISOR_LOG_ANALYTICS_CLIENT_SECRET; import static com.azure.ai.metricsadvisor.TestUtils.AZURE_METRICS_ADVISOR_ENDPOINT; +import static com.azure.ai.metricsadvisor.TestUtils.AZURE_METRICS_ADVISOR_TENANT_ID; +import static com.azure.ai.metricsadvisor.TestUtils.AZURE_METRICS_ADVISOR_LOG_ANALYTICS_WORKSPACE_ID; import static com.azure.ai.metricsadvisor.TestUtils.BLOB_CONNECTION_STRING; import static com.azure.ai.metricsadvisor.TestUtils.BLOB_TEMPLATE; import static com.azure.ai.metricsadvisor.TestUtils.COSMOS_DB_CONNECTION_STRING; @@ -56,6 +59,7 @@ import static com.azure.ai.metricsadvisor.TestUtils.INFLUX_DB_CONNECTION_STRING; import static com.azure.ai.metricsadvisor.TestUtils.INFLUX_DB_PASSWORD; import static com.azure.ai.metricsadvisor.TestUtils.INGESTION_START_TIME; +import static com.azure.ai.metricsadvisor.TestUtils.LOG_ANALYTICS_QUERY; import static com.azure.ai.metricsadvisor.TestUtils.MONGO_COMMAND; import static com.azure.ai.metricsadvisor.TestUtils.MONGO_DB_CONNECTION_STRING; import static com.azure.ai.metricsadvisor.TestUtils.MYSQL_DB_CONNECTION_STRING; @@ -108,65 +112,56 @@ void listDataFeedRunner(Consumer> testRunner) { void creatDataFeedRunner(Consumer testRunner, DataFeedSourceType dataFeedSourceType) { // create data feeds DataFeed dataFeed; - switch (dataFeedSourceType) { - case AZURE_APP_INSIGHTS: - dataFeed = new DataFeed().setSource(new AzureAppInsightsDataFeedSource( - APP_INSIGHTS_APPLICATION_ID, APP_INSIGHTS_API_KEY, TestUtils.AZURE_CLOUD, APP_INSIGHTS_QUERY)); - break; - case AZURE_BLOB: - dataFeed = new DataFeed().setSource(new AzureBlobDataFeedSource(BLOB_CONNECTION_STRING, - TEST_DB_NAME, BLOB_TEMPLATE)); - break; - case AZURE_DATA_EXPLORER: - dataFeed = - new DataFeed().setSource(new AzureDataExplorerDataFeedSource(DATA_EXPLORER_CONNECTION_STRING, - DATA_EXPLORER_QUERY)); - break; - case AZURE_TABLE: - dataFeed = new DataFeed().setSource(new AzureTableDataFeedSource(TABLE_CONNECTION_STRING, - TABLE_QUERY, TEST_DB_NAME)); - break; - case INFLUX_DB: - dataFeed = new DataFeed().setSource(new InfluxDBDataFeedSource(INFLUX_DB_CONNECTION_STRING, - TEST_DB_NAME, "adreadonly", INFLUX_DB_PASSWORD, TEMPLATE_QUERY)); - break; - case MONGO_DB: - dataFeed = new DataFeed().setSource(new MongoDBDataFeedSource(MONGO_DB_CONNECTION_STRING, - TEST_DB_NAME, MONGO_COMMAND)); - break; - case MYSQL_DB: - dataFeed = new DataFeed().setSource(new MySqlDataFeedSource(MYSQL_DB_CONNECTION_STRING, - TEMPLATE_QUERY)); - break; - case POSTGRE_SQL_DB: - dataFeed = new DataFeed().setSource(new PostgreSqlDataFeedSource(POSTGRE_SQL_DB_CONNECTION_STRING, - TEMPLATE_QUERY)); - break; - case SQL_SERVER_DB: - dataFeed = new DataFeed().setSource(new SQLServerDataFeedSource(SQL_SERVER_CONNECTION_STRING, - TEMPLATE_QUERY)); - break; - case AZURE_COSMOS_DB: - dataFeed = new DataFeed().setSource(new AzureCosmosDataFeedSource(COSMOS_DB_CONNECTION_STRING, - TEMPLATE_QUERY, TEST_DB_NAME, TEST_DB_NAME)); - break; - case AZURE_DATA_LAKE_STORAGE_GEN2: - dataFeed = new DataFeed().setSource(new AzureDataLakeStorageGen2DataFeedSource( - "adsampledatalakegen2", - AZURE_DATALAKEGEN2_ACCOUNT_KEY, - TEST_DB_NAME, DIRECTORY_TEMPLATE, FILE_TEMPLATE)); - break; - case AZURE_LOG_ANALYTICS: - dataFeed = new DataFeed().setSource(new AzureLogAnalyticsDataFeedSource( - "tenant_id", - "client_id", - "client_secret", - "workspace_id", - TEMPLATE_QUERY)); - break; - default: - throw new IllegalStateException("Unexpected value: " + dataFeedSourceType); + if (dataFeedSourceType == DataFeedSourceType.AZURE_APP_INSIGHTS) { + dataFeed = new DataFeed().setSource(new AzureAppInsightsDataFeedSource( + APP_INSIGHTS_APPLICATION_ID, APP_INSIGHTS_API_KEY, TestUtils.AZURE_CLOUD, APP_INSIGHTS_QUERY)); + } else if (dataFeedSourceType == DataFeedSourceType.AZURE_BLOB) { + dataFeed = new DataFeed().setSource(AzureBlobDataFeedSource.fromBasicCredential( + BLOB_CONNECTION_STRING, + TEST_DB_NAME, BLOB_TEMPLATE)); + } else if (dataFeedSourceType == DataFeedSourceType.AZURE_DATA_EXPLORER) { + dataFeed = + new DataFeed().setSource(AzureDataExplorerDataFeedSource.fromBasicCredential( + DATA_EXPLORER_CONNECTION_STRING, + DATA_EXPLORER_QUERY)); + } else if (dataFeedSourceType == DataFeedSourceType.AZURE_TABLE) { + dataFeed = new DataFeed().setSource(new AzureTableDataFeedSource(TABLE_CONNECTION_STRING, + TABLE_QUERY, TEST_DB_NAME)); + } else if (dataFeedSourceType == DataFeedSourceType.INFLUX_DB) { + dataFeed = new DataFeed().setSource(new InfluxDbDataFeedSource(INFLUX_DB_CONNECTION_STRING, + TEST_DB_NAME, "adreadonly", INFLUX_DB_PASSWORD, TEMPLATE_QUERY)); + } else if (dataFeedSourceType == DataFeedSourceType.MONGO_DB) { + dataFeed = new DataFeed().setSource(new MongoDbDataFeedSource(MONGO_DB_CONNECTION_STRING, + TEST_DB_NAME, MONGO_COMMAND)); + } else if (dataFeedSourceType == DataFeedSourceType.MYSQL_DB) { + dataFeed = new DataFeed().setSource(new MySqlDataFeedSource(MYSQL_DB_CONNECTION_STRING, + TEMPLATE_QUERY)); + } else if (dataFeedSourceType == DataFeedSourceType.POSTGRE_SQL_DB) { + dataFeed = new DataFeed().setSource(new PostgreSqlDataFeedSource(POSTGRE_SQL_DB_CONNECTION_STRING, + TEMPLATE_QUERY)); + } else if (dataFeedSourceType == DataFeedSourceType.SQL_SERVER_DB) { + dataFeed = new DataFeed().setSource(SqlServerDataFeedSource.fromBasicCredential( + SQL_SERVER_CONNECTION_STRING, + TEMPLATE_QUERY)); + } else if (dataFeedSourceType == DataFeedSourceType.AZURE_COSMOS_DB) { + dataFeed = new DataFeed().setSource(new AzureCosmosDbDataFeedSource(COSMOS_DB_CONNECTION_STRING, + TEMPLATE_QUERY, TEST_DB_NAME, TEST_DB_NAME)); + } else if (dataFeedSourceType == DataFeedSourceType.AZURE_DATA_LAKE_STORAGE_GEN2) { + dataFeed = new DataFeed().setSource(AzureDataLakeStorageGen2DataFeedSource.fromBasicCredential( + "adsampledatalakegen2", + AZURE_DATALAKEGEN2_ACCOUNT_KEY, + TEST_DB_NAME, DIRECTORY_TEMPLATE, FILE_TEMPLATE)); + } else if (dataFeedSourceType == DataFeedSourceType.AZURE_LOG_ANALYTICS) { + dataFeed = new DataFeed().setSource(AzureLogAnalyticsDataFeedSource.fromBasicCredential( + AZURE_METRICS_ADVISOR_TENANT_ID, + AZURE_METRICS_ADVISOR_LOG_ANALYTICS_CLIENT_ID, + AZURE_METRICS_ADVISOR_LOG_ANALYTICS_CLIENT_SECRET, + AZURE_METRICS_ADVISOR_LOG_ANALYTICS_WORKSPACE_ID, + LOG_ANALYTICS_QUERY)); + } else { + throw new IllegalStateException("Unexpected value: " + dataFeedSourceType); } + testRunner.accept(dataFeed.setSchema(new DataFeedSchema(Arrays.asList( new DataFeedMetric().setName("cost").setDisplayName("cost"), new DataFeedMetric().setName("revenue").setDisplayName("revenue"))) @@ -198,124 +193,116 @@ void validateDataFeedResult(DataFeed expectedDataFeed, DataFeed actualDataFeed, private void validateDataFeedSource(DataFeed expectedDataFeed, DataFeed actualDataFeed, DataFeedSourceType dataFeedSourceType) { - switch (dataFeedSourceType) { - case AZURE_APP_INSIGHTS: - final AzureAppInsightsDataFeedSource expAzureAppInsightsDataFeedSource = - (AzureAppInsightsDataFeedSource) expectedDataFeed.getSource(); - final AzureAppInsightsDataFeedSource actualAzureAppInsightsDataFeedSource = - (AzureAppInsightsDataFeedSource) actualDataFeed.getSource(); - // ApiKey and applicationId are no longer returned from the service. - // assertNotNull(actualAzureAppInsightsDataFeedSource.getApiKey()); - // assertNotNull(actualAzureAppInsightsDataFeedSource.getApplicationId()); - assertEquals(expAzureAppInsightsDataFeedSource.getQuery(), - actualAzureAppInsightsDataFeedSource.getQuery()); - assertEquals(expAzureAppInsightsDataFeedSource.getAzureCloud(), - actualAzureAppInsightsDataFeedSource.getAzureCloud()); - break; - case AZURE_BLOB: - final AzureBlobDataFeedSource expBlobDataFeedSource = - (AzureBlobDataFeedSource) expectedDataFeed.getSource(); - final AzureBlobDataFeedSource actualBlobDataFeedSource = - (AzureBlobDataFeedSource) actualDataFeed.getSource(); - assertEquals(expBlobDataFeedSource.getBlobTemplate(), actualBlobDataFeedSource.getBlobTemplate()); - // connection string is no longer returned from the service. - // assertNotNull(actualBlobDataFeedSource.getConnectionString()); - assertEquals(expBlobDataFeedSource.getContainer(), actualBlobDataFeedSource.getContainer()); - break; - case AZURE_DATA_EXPLORER: - final AzureDataExplorerDataFeedSource expExplorerDataFeedSource = - (AzureDataExplorerDataFeedSource) expectedDataFeed.getSource(); - final AzureDataExplorerDataFeedSource actualExplorerDataFeedSource = - (AzureDataExplorerDataFeedSource) actualDataFeed.getSource(); - // assertNotNull(actualExplorerDataFeedSource.getConnectionString()); - assertEquals(expExplorerDataFeedSource.getQuery(), actualExplorerDataFeedSource.getQuery()); - break; - case AZURE_TABLE: - final AzureTableDataFeedSource expTableDataFeedSource = - (AzureTableDataFeedSource) expectedDataFeed.getSource(); - final AzureTableDataFeedSource actualTableDataFeedSource = - (AzureTableDataFeedSource) actualDataFeed.getSource(); - // assertNotNull(actualTableDataFeedSource.getConnectionString()); - assertEquals(expTableDataFeedSource.getTableName(), actualTableDataFeedSource.getTableName()); - assertEquals(expTableDataFeedSource.getQueryScript(), actualTableDataFeedSource.getQueryScript()); - break; - case INFLUX_DB: - final InfluxDBDataFeedSource expInfluxDataFeedSource = - (InfluxDBDataFeedSource) expectedDataFeed.getSource(); - final InfluxDBDataFeedSource actualInfluxDataFeedSource = - (InfluxDBDataFeedSource) actualDataFeed.getSource(); - assertNotNull(actualInfluxDataFeedSource.getConnectionString()); - assertEquals(expInfluxDataFeedSource.getDatabase(), actualInfluxDataFeedSource.getDatabase()); - // assertNotNull(actualInfluxDataFeedSource.getPassword()); - assertNotNull(actualInfluxDataFeedSource.getUserName()); - break; - case MONGO_DB: - final MongoDBDataFeedSource expMongoDataFeedSource = - (MongoDBDataFeedSource) expectedDataFeed.getSource(); - final MongoDBDataFeedSource actualMongoDataFeedSource = - (MongoDBDataFeedSource) actualDataFeed.getSource(); - // assertNotNull(actualMongoDataFeedSource.getConnectionString()); - assertEquals(expMongoDataFeedSource.getDatabase(), actualMongoDataFeedSource.getDatabase()); - assertEquals(expMongoDataFeedSource.getCommand(), actualMongoDataFeedSource.getCommand()); - break; - case MYSQL_DB: - final MySqlDataFeedSource expMySqlDataFeedSource = (MySqlDataFeedSource) expectedDataFeed.getSource(); - final MySqlDataFeedSource actualMySqlDataFeedSource = (MySqlDataFeedSource) actualDataFeed.getSource(); - // assertNotNull(actualMySqlDataFeedSource.getConnectionString()); - assertEquals(expMySqlDataFeedSource.getQuery(), actualMySqlDataFeedSource.getQuery()); - break; - case POSTGRE_SQL_DB: - final PostgreSqlDataFeedSource expPostGreDataFeedSource = - (PostgreSqlDataFeedSource) expectedDataFeed.getSource(); - final PostgreSqlDataFeedSource actualPostGreDataFeedSource = - (PostgreSqlDataFeedSource) actualDataFeed.getSource(); - // assertNotNull(actualPostGreDataFeedSource.getConnectionString()); - assertEquals(expPostGreDataFeedSource.getQuery(), actualPostGreDataFeedSource.getQuery()); - break; - case SQL_SERVER_DB: - final SQLServerDataFeedSource expSqlServerDataFeedSource = - (SQLServerDataFeedSource) expectedDataFeed.getSource(); - final SQLServerDataFeedSource actualSqlServerDataFeedSource = - (SQLServerDataFeedSource) actualDataFeed.getSource(); - // connection string is no longer returned from the service. - // assertNotNull(actualSqlServerDataFeedSource.getConnectionString()); - assertEquals(expSqlServerDataFeedSource.getQuery(), actualSqlServerDataFeedSource.getQuery()); - break; - case AZURE_COSMOS_DB: - final AzureCosmosDataFeedSource expCosmosDataFeedSource = - (AzureCosmosDataFeedSource) expectedDataFeed.getSource(); - final AzureCosmosDataFeedSource actualCosmosDataFeedSource = - (AzureCosmosDataFeedSource) actualDataFeed.getSource(); - assertEquals(expCosmosDataFeedSource.getCollectionId(), actualCosmosDataFeedSource.getCollectionId()); - // assertNotNull(actualCosmosDataFeedSource.getConnectionString()); - assertEquals(expCosmosDataFeedSource.getDatabase(), actualCosmosDataFeedSource.getDatabase()); - assertEquals(expCosmosDataFeedSource.getSqlQuery(), actualCosmosDataFeedSource.getSqlQuery()); - break; - case AZURE_DATA_LAKE_STORAGE_GEN2: - final AzureDataLakeStorageGen2DataFeedSource expDataLakeStorageGen2DataFeedSource = - (AzureDataLakeStorageGen2DataFeedSource) expectedDataFeed.getSource(); - final AzureDataLakeStorageGen2DataFeedSource actualDataLakeFeedSource = - (AzureDataLakeStorageGen2DataFeedSource) actualDataFeed.getSource(); - // assertNotNull(actualDataLakeFeedSource.getAccountKey()); - assertNotNull(actualDataLakeFeedSource.getAccountName()); - assertEquals(expDataLakeStorageGen2DataFeedSource.getDirectoryTemplate(), - actualDataLakeFeedSource.getDirectoryTemplate()); - assertEquals(expDataLakeStorageGen2DataFeedSource.getFileSystemName(), - actualDataLakeFeedSource.getFileSystemName()); - assertEquals(expDataLakeStorageGen2DataFeedSource.getFileTemplate(), - actualDataLakeFeedSource.getFileTemplate()); - break; - case AZURE_LOG_ANALYTICS: - final AzureLogAnalyticsDataFeedSource expLogAnalyticsDataFeedSource = - (AzureLogAnalyticsDataFeedSource) expectedDataFeed.getSource(); - final AzureLogAnalyticsDataFeedSource logAnalyticsDataFeedSource = - (AzureLogAnalyticsDataFeedSource) actualDataFeed.getSource(); - assertNotNull(logAnalyticsDataFeedSource.getQuery()); - assertEquals(expLogAnalyticsDataFeedSource.getClientId(), - logAnalyticsDataFeedSource.getClientId()); - break; - default: - throw new IllegalStateException("Unexpected value: " + dataFeedSourceType); + if (dataFeedSourceType == DataFeedSourceType.AZURE_APP_INSIGHTS) { + final AzureAppInsightsDataFeedSource expAzureAppInsightsDataFeedSource = + (AzureAppInsightsDataFeedSource) expectedDataFeed.getSource(); + final AzureAppInsightsDataFeedSource actualAzureAppInsightsDataFeedSource = + (AzureAppInsightsDataFeedSource) actualDataFeed.getSource(); + // ApiKey and applicationId are no longer returned from the service. + // assertNotNull(actualAzureAppInsightsDataFeedSource.getApiKey()); + // assertNotNull(actualAzureAppInsightsDataFeedSource.getApplicationId()); + assertEquals(expAzureAppInsightsDataFeedSource.getQuery(), + actualAzureAppInsightsDataFeedSource.getQuery()); + assertEquals(expAzureAppInsightsDataFeedSource.getAzureCloud(), + actualAzureAppInsightsDataFeedSource.getAzureCloud()); + } else if (dataFeedSourceType == DataFeedSourceType.AZURE_BLOB) { + final AzureBlobDataFeedSource expBlobDataFeedSource = + (AzureBlobDataFeedSource) expectedDataFeed.getSource(); + final AzureBlobDataFeedSource actualBlobDataFeedSource = + (AzureBlobDataFeedSource) actualDataFeed.getSource(); + assertEquals(expBlobDataFeedSource.getBlobTemplate(), actualBlobDataFeedSource.getBlobTemplate()); + // connection string is no longer returned from the service. + // assertNotNull(actualBlobDataFeedSource.getConnectionString()); + assertEquals(expBlobDataFeedSource.getContainer(), actualBlobDataFeedSource.getContainer()); + } else if (dataFeedSourceType == DataFeedSourceType.AZURE_DATA_EXPLORER) { + final AzureDataExplorerDataFeedSource expExplorerDataFeedSource = + (AzureDataExplorerDataFeedSource) expectedDataFeed.getSource(); + final AzureDataExplorerDataFeedSource actualExplorerDataFeedSource = + (AzureDataExplorerDataFeedSource) actualDataFeed.getSource(); + // assertNotNull(actualExplorerDataFeedSource.getConnectionString()); + assertEquals(expExplorerDataFeedSource.getQuery(), actualExplorerDataFeedSource.getQuery()); + } else if (dataFeedSourceType == DataFeedSourceType.AZURE_TABLE) { + final AzureTableDataFeedSource expTableDataFeedSource = + (AzureTableDataFeedSource) expectedDataFeed.getSource(); + final AzureTableDataFeedSource actualTableDataFeedSource = + (AzureTableDataFeedSource) actualDataFeed.getSource(); + // assertNotNull(actualTableDataFeedSource.getConnectionString()); + assertEquals(expTableDataFeedSource.getTableName(), actualTableDataFeedSource.getTableName()); + assertEquals(expTableDataFeedSource.getQueryScript(), actualTableDataFeedSource.getQueryScript()); + } else if (dataFeedSourceType == DataFeedSourceType.INFLUX_DB) { + final InfluxDbDataFeedSource expInfluxDataFeedSource = + (InfluxDbDataFeedSource) expectedDataFeed.getSource(); + final InfluxDbDataFeedSource actualInfluxDataFeedSource = + (InfluxDbDataFeedSource) actualDataFeed.getSource(); + assertNotNull(actualInfluxDataFeedSource.getConnectionString()); + assertEquals(expInfluxDataFeedSource.getDatabase(), actualInfluxDataFeedSource.getDatabase()); + // assertNotNull(actualInfluxDataFeedSource.getPassword()); + assertNotNull(actualInfluxDataFeedSource.getUserName()); + } else if (dataFeedSourceType == DataFeedSourceType.MONGO_DB) { + final MongoDbDataFeedSource expMongoDataFeedSource = + (MongoDbDataFeedSource) expectedDataFeed.getSource(); + final MongoDbDataFeedSource actualMongoDataFeedSource = + (MongoDbDataFeedSource) actualDataFeed.getSource(); + // assertNotNull(actualMongoDataFeedSource.getConnectionString()); + assertEquals(expMongoDataFeedSource.getDatabase(), actualMongoDataFeedSource.getDatabase()); + assertEquals(expMongoDataFeedSource.getCommand(), actualMongoDataFeedSource.getCommand()); + } else if (dataFeedSourceType == DataFeedSourceType.MYSQL_DB) { + final MySqlDataFeedSource expMySqlDataFeedSource = (MySqlDataFeedSource) expectedDataFeed.getSource(); + final MySqlDataFeedSource actualMySqlDataFeedSource = (MySqlDataFeedSource) actualDataFeed.getSource(); + // assertNotNull(actualMySqlDataFeedSource.getConnectionString()); + assertEquals(expMySqlDataFeedSource.getQuery(), actualMySqlDataFeedSource.getQuery()); + } else if (dataFeedSourceType == DataFeedSourceType.POSTGRE_SQL_DB) { + final PostgreSqlDataFeedSource expPostGreDataFeedSource = + (PostgreSqlDataFeedSource) expectedDataFeed.getSource(); + final PostgreSqlDataFeedSource actualPostGreDataFeedSource = + (PostgreSqlDataFeedSource) actualDataFeed.getSource(); + // assertNotNull(actualPostGreDataFeedSource.getConnectionString()); + assertEquals(expPostGreDataFeedSource.getQuery(), actualPostGreDataFeedSource.getQuery()); + } else if (dataFeedSourceType == DataFeedSourceType.SQL_SERVER_DB) { + final SqlServerDataFeedSource expSqlServerDataFeedSource = + (SqlServerDataFeedSource) expectedDataFeed.getSource(); + final SqlServerDataFeedSource actualSqlServerDataFeedSource = + (SqlServerDataFeedSource) actualDataFeed.getSource(); + // connection string is no longer returned from the service. + // assertNotNull(actualSqlServerDataFeedSource.getConnectionString()); + assertEquals(expSqlServerDataFeedSource.getQuery(), actualSqlServerDataFeedSource.getQuery()); + } else if (dataFeedSourceType == DataFeedSourceType.AZURE_COSMOS_DB) { + final AzureCosmosDbDataFeedSource expCosmosDataFeedSource = + (AzureCosmosDbDataFeedSource) expectedDataFeed.getSource(); + final AzureCosmosDbDataFeedSource actualCosmosDataFeedSource = + (AzureCosmosDbDataFeedSource) actualDataFeed.getSource(); + assertEquals(expCosmosDataFeedSource.getCollectionId(), actualCosmosDataFeedSource.getCollectionId()); + // assertNotNull(actualCosmosDataFeedSource.getConnectionString()); + assertEquals(expCosmosDataFeedSource.getDatabase(), actualCosmosDataFeedSource.getDatabase()); + assertEquals(expCosmosDataFeedSource.getSqlQuery(), actualCosmosDataFeedSource.getSqlQuery()); + } else if (dataFeedSourceType == DataFeedSourceType.AZURE_DATA_LAKE_STORAGE_GEN2) { + final AzureDataLakeStorageGen2DataFeedSource expDataLakeStorageGen2DataFeedSource = + (AzureDataLakeStorageGen2DataFeedSource) expectedDataFeed.getSource(); + final AzureDataLakeStorageGen2DataFeedSource actualDataLakeFeedSource = + (AzureDataLakeStorageGen2DataFeedSource) actualDataFeed.getSource(); + // assertNotNull(actualDataLakeFeedSource.getAccountKey()); + assertNotNull(actualDataLakeFeedSource.getAccountName()); + assertEquals(expDataLakeStorageGen2DataFeedSource.getDirectoryTemplate(), + actualDataLakeFeedSource.getDirectoryTemplate()); + assertEquals(expDataLakeStorageGen2DataFeedSource.getFileSystemName(), + actualDataLakeFeedSource.getFileSystemName()); + assertEquals(expDataLakeStorageGen2DataFeedSource.getFileTemplate(), + actualDataLakeFeedSource.getFileTemplate()); + } else if (dataFeedSourceType == DataFeedSourceType.AZURE_LOG_ANALYTICS) { + final AzureLogAnalyticsDataFeedSource expLogAnalyticsDataFeedSource = + (AzureLogAnalyticsDataFeedSource) expectedDataFeed.getSource(); + final AzureLogAnalyticsDataFeedSource logAnalyticsDataFeedSource = + (AzureLogAnalyticsDataFeedSource) actualDataFeed.getSource(); + assertNotNull(logAnalyticsDataFeedSource.getQuery()); + assertNotNull(logAnalyticsDataFeedSource.getClientId()); + assertNotNull(logAnalyticsDataFeedSource.getTenantId()); +// assertEquals(expLogAnalyticsDataFeedSource.getClientId(), +// logAnalyticsDataFeedSource.getClientId()); +// assertEquals(expLogAnalyticsDataFeedSource.getTenantId(), +// logAnalyticsDataFeedSource.getTenantId()); + assertEquals(expLogAnalyticsDataFeedSource.getQuery(), LOG_ANALYTICS_QUERY); + } else { + throw new IllegalStateException("Unexpected value: " + dataFeedSourceType); } } diff --git a/sdk/metricsadvisor/azure-ai-metricsadvisor/src/test/java/com/azure/ai/metricsadvisor/DataFeedWithCredentialsAsyncTest.java b/sdk/metricsadvisor/azure-ai-metricsadvisor/src/test/java/com/azure/ai/metricsadvisor/DataFeedWithCredentialsAsyncTest.java new file mode 100644 index 0000000000000..b4f2f90267c05 --- /dev/null +++ b/sdk/metricsadvisor/azure-ai-metricsadvisor/src/test/java/com/azure/ai/metricsadvisor/DataFeedWithCredentialsAsyncTest.java @@ -0,0 +1,493 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +package com.azure.ai.metricsadvisor; + +import com.azure.ai.metricsadvisor.administration.MetricsAdvisorAdministrationAsyncClient; +import com.azure.ai.metricsadvisor.administration.models.AzureBlobDataFeedSource; +import com.azure.ai.metricsadvisor.administration.models.AzureDataExplorerDataFeedSource; +import com.azure.ai.metricsadvisor.administration.models.AzureDataLakeStorageGen2DataFeedSource; +import com.azure.ai.metricsadvisor.administration.models.DataFeed; +import com.azure.ai.metricsadvisor.administration.models.DatasourceDataLakeGen2SharedKey; +import com.azure.ai.metricsadvisor.administration.models.DatasourceAuthenticationType; +import com.azure.ai.metricsadvisor.administration.models.DatasourceServicePrincipal; +import com.azure.ai.metricsadvisor.administration.models.DatasourceServicePrincipalInKeyVault; +import com.azure.ai.metricsadvisor.administration.models.DatasourceSqlServerConnectionString; +import com.azure.ai.metricsadvisor.administration.models.SqlServerDataFeedSource; +import com.azure.core.http.HttpClient; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.params.ParameterizedTest; +import org.junit.jupiter.params.provider.MethodSource; +import reactor.test.StepVerifier; + +import java.util.ArrayList; +import java.util.List; +import java.util.concurrent.atomic.AtomicReference; + +import static com.azure.ai.metricsadvisor.TestUtils.AZURE_DATALAKEGEN2_ACCOUNT_KEY; +import static com.azure.ai.metricsadvisor.TestUtils.BLOB_CONNECTION_STRING; +import static com.azure.ai.metricsadvisor.TestUtils.BLOB_TEMPLATE; +import static com.azure.ai.metricsadvisor.TestUtils.DATA_EXPLORER_CONNECTION_STRING; +import static com.azure.ai.metricsadvisor.TestUtils.DATA_EXPLORER_QUERY; +import static com.azure.ai.metricsadvisor.TestUtils.DIRECTORY_TEMPLATE; +import static com.azure.ai.metricsadvisor.TestUtils.DISPLAY_NAME_WITH_ARGUMENTS; +import static com.azure.ai.metricsadvisor.TestUtils.FILE_TEMPLATE; +import static com.azure.ai.metricsadvisor.TestUtils.SQL_SERVER_CONNECTION_STRING; +import static com.azure.ai.metricsadvisor.TestUtils.TEMPLATE_QUERY; +import static com.azure.ai.metricsadvisor.TestUtils.TEST_DB_NAME; + +public class DataFeedWithCredentialsAsyncTest extends DataFeedWithCredentialsTestBase { + @ParameterizedTest(name = DISPLAY_NAME_WITH_ARGUMENTS) + @MethodSource("com.azure.ai.metricsadvisor.TestUtils#getTestParameters") + @Override + public void testSqlServer(HttpClient httpClient, MetricsAdvisorServiceVersion serviceVersion) { + final MetricsAdvisorAdministrationAsyncClient client + = getMetricsAdvisorAdministrationBuilder(httpClient, serviceVersion, true).buildAsyncClient(); + List credIds = new ArrayList<>(); + + final AtomicReference dataFeed = new AtomicReference<>(initDataFeed()); + try { + // Create SqlFeed with basic credentials in connection string. + dataFeed.get().setSource(SqlServerDataFeedSource.fromBasicCredential( + SQL_SERVER_CONNECTION_STRING, + TEMPLATE_QUERY)); + + StepVerifier.create(client.createDataFeed(dataFeed.get())) + .assertNext(createdDataFeed -> { + dataFeed.set(createdDataFeed); + Assertions.assertTrue(createdDataFeed.getSource() instanceof SqlServerDataFeedSource); + Assertions.assertNull(((SqlServerDataFeedSource) createdDataFeed.getSource()).getCredentialId()); + Assertions.assertEquals(DatasourceAuthenticationType.BASIC, + ((SqlServerDataFeedSource) createdDataFeed.getSource()).getAuthenticationType()); + }) + .verifyComplete(); + + // Update SqlFeed to use MSI. + dataFeed.get() + .setSource(SqlServerDataFeedSource.fromManagedIdentityCredential(SQL_SERVER_CONNECTION_STRING, + TEMPLATE_QUERY)); + + StepVerifier.create(client.updateDataFeed(dataFeed.get())) + .assertNext(updatedDataFeed -> { + dataFeed.set(updatedDataFeed); + Assertions.assertTrue(updatedDataFeed.getSource() instanceof SqlServerDataFeedSource); + Assertions.assertNull(((SqlServerDataFeedSource) updatedDataFeed.getSource()).getCredentialId()); + Assertions.assertEquals(DatasourceAuthenticationType.MANAGED_IDENTITY, + ((SqlServerDataFeedSource) updatedDataFeed.getSource()).getAuthenticationType()); + }) + .verifyComplete(); + + + // Create SqlConnStr cred and update DataFeed to use it. + DataFeed d1 = sqlServerWithConnStringCred(client, dataFeed.get(), credIds); + dataFeed.set(d1); + + // Create SP credential and Update SqlFeed to use it. + DataFeed d2 = sqlServerWithServicePrincipalCred(client, dataFeed.get(), credIds); + dataFeed.set(d2); + + // Create SPInKV credential and Update SqlFeed to use it. + DataFeed d3 = sqlServerWithServicePrincipalInKVCred(client, dataFeed.get(), credIds); + dataFeed.set(d3); + } finally { + try { + StepVerifier.create(client.deleteDataFeed(dataFeed.get().getId())).verifyComplete(); + } finally { + credIds.forEach(credentialId -> + StepVerifier.create(client.deleteDatasourceCredential(credentialId)).verifyComplete()); + } + } + } + + private DataFeed sqlServerWithConnStringCred(MetricsAdvisorAdministrationAsyncClient client, + DataFeed dataFeed, + List credIds) { + final AtomicReference sqlConStrCred + = new AtomicReference<>(initDatasourceSqlServerConnectionString()); + + StepVerifier.create(client.createDatasourceCredential(sqlConStrCred.get())) + .assertNext(createdCredential -> { + Assertions.assertTrue(createdCredential instanceof DatasourceSqlServerConnectionString); + credIds.add(createdCredential.getId()); + sqlConStrCred.set((DatasourceSqlServerConnectionString) createdCredential); + }) + .verifyComplete(); + + dataFeed.setSource(SqlServerDataFeedSource.fromConnectionStringCredential( + TEMPLATE_QUERY, + sqlConStrCred.get().getId())); + + + final AtomicReference resultDataFeed = new AtomicReference<>(); + StepVerifier.create(client.updateDataFeed(dataFeed)) + .assertNext(updatedDataFeed -> { + resultDataFeed.set(updatedDataFeed); + super.validateSqlServerFeedWithCredential(updatedDataFeed, sqlConStrCred.get()); + + }) + .verifyComplete(); + return resultDataFeed.get(); + } + + private DataFeed sqlServerWithServicePrincipalCred(MetricsAdvisorAdministrationAsyncClient client, + DataFeed dataFeed, + List credIds) { + final AtomicReference servicePrincipalCred + = new AtomicReference<>(initDatasourceServicePrincipal()); + + StepVerifier.create(client.createDatasourceCredential(servicePrincipalCred.get())) + .assertNext(createdCredential -> { + Assertions.assertTrue(createdCredential instanceof DatasourceServicePrincipal); + credIds.add(createdCredential.getId()); + servicePrincipalCred.set((DatasourceServicePrincipal) createdCredential); + }) + .verifyComplete(); + + dataFeed.setSource(SqlServerDataFeedSource.fromServicePrincipalCredential( + SQL_SERVER_CONNECTION_STRING, + TEMPLATE_QUERY, + servicePrincipalCred.get().getId())); + + final AtomicReference resultDataFeed = new AtomicReference<>(); + StepVerifier.create(client.updateDataFeed(dataFeed)) + .assertNext(updatedDataFeed -> { + resultDataFeed.set(updatedDataFeed); + super.validateSqlServerFeedWithCredential(updatedDataFeed, servicePrincipalCred.get()); + }) + .verifyComplete(); + return resultDataFeed.get(); + } + + private DataFeed sqlServerWithServicePrincipalInKVCred(MetricsAdvisorAdministrationAsyncClient client, + DataFeed dataFeed, + List credIds) { + final AtomicReference servicePrincipalInKVCred + = new AtomicReference<>(initDatasourceServicePrincipalInKeyVault()); + + StepVerifier.create(client.createDatasourceCredential(servicePrincipalInKVCred.get())) + .assertNext(createdCredential -> { + Assertions.assertTrue(createdCredential instanceof DatasourceServicePrincipalInKeyVault); + credIds.add(createdCredential.getId()); + servicePrincipalInKVCred.set((DatasourceServicePrincipalInKeyVault) createdCredential); + }) + .verifyComplete(); + + dataFeed.setSource(SqlServerDataFeedSource.fromServicePrincipalInKeyVaultCredential( + SQL_SERVER_CONNECTION_STRING, + TEMPLATE_QUERY, + servicePrincipalInKVCred.get().getId())); + + final AtomicReference resultDataFeed = new AtomicReference<>(); + StepVerifier.create(client.updateDataFeed(dataFeed)) + .assertNext(updatedDataFeed -> { + resultDataFeed.set(updatedDataFeed); + super.validateSqlServerFeedWithCredential(updatedDataFeed, servicePrincipalInKVCred.get()); + }) + .verifyComplete(); + return resultDataFeed.get(); + } + + + @ParameterizedTest(name = DISPLAY_NAME_WITH_ARGUMENTS) + @MethodSource("com.azure.ai.metricsadvisor.TestUtils#getTestParameters") + @Override + public void testDataLakeGen2(HttpClient httpClient, MetricsAdvisorServiceVersion serviceVersion) { + final MetricsAdvisorAdministrationAsyncClient client + = getMetricsAdvisorAdministrationBuilder(httpClient, serviceVersion, true).buildAsyncClient(); + List credIds = new ArrayList<>(); + + final AtomicReference dataFeed = new AtomicReference<>(initDataFeed()); + try { + // Create DataLakeFeed with basic credentials in key. + dataFeed.get().setSource(AzureDataLakeStorageGen2DataFeedSource.fromBasicCredential( + "adsampledatalakegen2", + AZURE_DATALAKEGEN2_ACCOUNT_KEY, + TEST_DB_NAME, + DIRECTORY_TEMPLATE, + FILE_TEMPLATE)); + + StepVerifier.create(client.createDataFeed(dataFeed.get())) + .assertNext(createdDataFeed -> { + dataFeed.set(createdDataFeed); + Assertions.assertTrue(createdDataFeed.getSource() instanceof AzureDataLakeStorageGen2DataFeedSource); + Assertions.assertNull( + ((AzureDataLakeStorageGen2DataFeedSource) createdDataFeed.getSource()).getCredentialId()); + Assertions.assertEquals(DatasourceAuthenticationType.BASIC, + ((AzureDataLakeStorageGen2DataFeedSource) createdDataFeed.getSource()).getAuthenticationType()); + }) + .verifyComplete(); + + // Create SharedKey credential and Update DataLakeFeed to use it. + DataFeed d1 = dataLakeWithSharedKeyCred(client, dataFeed.get(), credIds); + dataFeed.set(d1); + + // Create SP credential and Update SqlFeed to use it. + DataFeed d2 = dataLakeWithServicePrincipalCred(client, dataFeed.get(), credIds); + dataFeed.set(d2); + + // Create SPInKV credential and Update SqlFeed to use it. + DataFeed d3 = dataLakeWithServicePrincipalInKVCred(client, dataFeed.get(), credIds); + dataFeed.set(d3); + } finally { + try { + StepVerifier.create(client.deleteDataFeed(dataFeed.get().getId())).verifyComplete(); + } finally { + credIds.forEach(credentialId -> + StepVerifier.create(client.deleteDatasourceCredential(credentialId)).verifyComplete()); + } + } + } + + private DataFeed dataLakeWithSharedKeyCred(MetricsAdvisorAdministrationAsyncClient client, + DataFeed dataFeed, + List credIds) { + final AtomicReference sharedKeyCred + = new AtomicReference<>(initDataSourceDataLakeGen2SharedKey()); + + StepVerifier.create(client.createDatasourceCredential(sharedKeyCred.get())) + .assertNext(createdCredential -> { + Assertions.assertTrue(createdCredential instanceof DatasourceDataLakeGen2SharedKey); + credIds.add(createdCredential.getId()); + sharedKeyCred.set((DatasourceDataLakeGen2SharedKey) createdCredential); + }) + .verifyComplete(); + + dataFeed.setSource(AzureDataLakeStorageGen2DataFeedSource.fromSharedKeyCredential("adsampledatalakegen2", + TEST_DB_NAME, + DIRECTORY_TEMPLATE, + FILE_TEMPLATE, + sharedKeyCred.get().getId())); + + final AtomicReference resultDataFeed = new AtomicReference<>(); + StepVerifier.create(client.updateDataFeed(dataFeed)) + .assertNext(updatedDataFeed -> { + resultDataFeed.set(updatedDataFeed); + super.validateDataLakeFeedWithCredential(updatedDataFeed, sharedKeyCred.get()); + }) + .verifyComplete(); + + return resultDataFeed.get(); + } + + private DataFeed dataLakeWithServicePrincipalCred(MetricsAdvisorAdministrationAsyncClient client, + DataFeed dataFeed, + List credIds) { + final AtomicReference servicePrincipalCred + = new AtomicReference<>(initDatasourceServicePrincipal()); + + StepVerifier.create(client.createDatasourceCredential(servicePrincipalCred.get())) + .assertNext(createdCredential -> { + Assertions.assertTrue(createdCredential instanceof DatasourceServicePrincipal); + credIds.add(createdCredential.getId()); + servicePrincipalCred.set((DatasourceServicePrincipal) createdCredential); + }) + .verifyComplete(); + + dataFeed.setSource(AzureDataLakeStorageGen2DataFeedSource.fromServicePrincipalCredential( + "adsampledatalakegen2", + TEST_DB_NAME, + DIRECTORY_TEMPLATE, + FILE_TEMPLATE, + servicePrincipalCred.get().getId())); + + final AtomicReference resultDataFeed = new AtomicReference<>(); + StepVerifier.create(client.updateDataFeed(dataFeed)) + .assertNext(updatedDataFeed -> { + resultDataFeed.set(updatedDataFeed); + super.validateDataLakeFeedWithCredential(updatedDataFeed, servicePrincipalCred.get()); + }) + .verifyComplete(); + return resultDataFeed.get(); + } + + private DataFeed dataLakeWithServicePrincipalInKVCred(MetricsAdvisorAdministrationAsyncClient client, + DataFeed dataFeed, + List credIds) { + final AtomicReference servicePrincipalInKVCred + = new AtomicReference<>(initDatasourceServicePrincipalInKeyVault()); + + StepVerifier.create(client.createDatasourceCredential(servicePrincipalInKVCred.get())) + .assertNext(createdCredential -> { + Assertions.assertTrue(createdCredential instanceof DatasourceServicePrincipalInKeyVault); + credIds.add(createdCredential.getId()); + servicePrincipalInKVCred.set((DatasourceServicePrincipalInKeyVault) createdCredential); + }) + .verifyComplete(); + + dataFeed.setSource(AzureDataLakeStorageGen2DataFeedSource.fromServicePrincipalInKeyVaultCredential( + "adsampledatalakegen2", + TEST_DB_NAME, + DIRECTORY_TEMPLATE, + FILE_TEMPLATE, + servicePrincipalInKVCred.get().getId())); + + final AtomicReference resultDataFeed = new AtomicReference<>(); + StepVerifier.create(client.updateDataFeed(dataFeed)) + .assertNext(updatedDataFeed -> { + resultDataFeed.set(updatedDataFeed); + super.validateDataLakeFeedWithCredential(updatedDataFeed, servicePrincipalInKVCred.get()); + }) + .verifyComplete(); + return resultDataFeed.get(); + } + + @ParameterizedTest(name = DISPLAY_NAME_WITH_ARGUMENTS) + @MethodSource("com.azure.ai.metricsadvisor.TestUtils#getTestParameters") + @Override + public void testDataExplorer(HttpClient httpClient, MetricsAdvisorServiceVersion serviceVersion) { + final MetricsAdvisorAdministrationAsyncClient client + = getMetricsAdvisorAdministrationBuilder(httpClient, serviceVersion, true).buildAsyncClient(); + List credIds = new ArrayList<>(); + + final AtomicReference dataFeed = new AtomicReference<>(initDataFeed()); + try { + // Create SqlFeed with basic credentials in connection string. + dataFeed.get().setSource(AzureDataExplorerDataFeedSource.fromBasicCredential( + DATA_EXPLORER_CONNECTION_STRING, + DATA_EXPLORER_QUERY)); + + StepVerifier.create(client.createDataFeed(dataFeed.get())) + .assertNext(createdDataFeed -> { + dataFeed.set(createdDataFeed); + Assertions.assertTrue(createdDataFeed.getSource() instanceof AzureDataExplorerDataFeedSource); + Assertions.assertNull(((AzureDataExplorerDataFeedSource) createdDataFeed.getSource()) + .getCredentialId()); + Assertions.assertEquals(DatasourceAuthenticationType.BASIC, + ((AzureDataExplorerDataFeedSource) createdDataFeed.getSource()) + .getAuthenticationType()); + }) + .verifyComplete(); + + // Update DataExplorerFeed to use MSI. + dataFeed.get() + .setSource(AzureDataExplorerDataFeedSource.fromManagedIdentityCredential( + DATA_EXPLORER_CONNECTION_STRING, + DATA_EXPLORER_QUERY)); + + StepVerifier.create(client.updateDataFeed(dataFeed.get())) + .assertNext(updatedDataFeed -> { + dataFeed.set(updatedDataFeed); + Assertions.assertTrue(updatedDataFeed.getSource() instanceof AzureDataExplorerDataFeedSource); + Assertions.assertNull(((AzureDataExplorerDataFeedSource) updatedDataFeed.getSource()) + .getCredentialId()); + Assertions.assertEquals(DatasourceAuthenticationType.MANAGED_IDENTITY, + ((AzureDataExplorerDataFeedSource) updatedDataFeed.getSource()) + .getAuthenticationType()); + }) + .verifyComplete(); + + // Create SP credential and Update DataExplorerFeed to use it. + DataFeed d2 = dataExplorerWithServicePrincipalCred(client, dataFeed.get(), credIds); + dataFeed.set(d2); + + // Create SPInKV credential and Update DataExplorerFeed to use it. + DataFeed d3 = dataExplorerWithServicePrincipalInKVCred(client, dataFeed.get(), credIds); + dataFeed.set(d3); + } finally { + try { + StepVerifier.create(client.deleteDataFeed(dataFeed.get().getId())).verifyComplete(); + } finally { + credIds.forEach(credentialId -> + StepVerifier.create(client.deleteDatasourceCredential(credentialId)).verifyComplete()); + } + } + } + + private DataFeed dataExplorerWithServicePrincipalCred(MetricsAdvisorAdministrationAsyncClient client, + DataFeed dataFeed, + List credIds) { + final AtomicReference servicePrincipalCred + = new AtomicReference<>(initDatasourceServicePrincipal()); + + StepVerifier.create(client.createDatasourceCredential(servicePrincipalCred.get())) + .assertNext(createdCredential -> { + Assertions.assertTrue(createdCredential instanceof DatasourceServicePrincipal); + credIds.add(createdCredential.getId()); + servicePrincipalCred.set((DatasourceServicePrincipal) createdCredential); + }) + .verifyComplete(); + + dataFeed.setSource(AzureDataExplorerDataFeedSource.fromServicePrincipalCredential( + DATA_EXPLORER_CONNECTION_STRING, + DATA_EXPLORER_QUERY, + servicePrincipalCred.get().getId())); + + final AtomicReference resultDataFeed = new AtomicReference<>(); + StepVerifier.create(client.updateDataFeed(dataFeed)) + .assertNext(updatedDataFeed -> { + resultDataFeed.set(updatedDataFeed); + super.validateDataExplorerFeedWithCredential(updatedDataFeed, servicePrincipalCred.get()); + }) + .verifyComplete(); + return resultDataFeed.get(); + } + + private DataFeed dataExplorerWithServicePrincipalInKVCred(MetricsAdvisorAdministrationAsyncClient client, + DataFeed dataFeed, + List credIds) { + final AtomicReference servicePrincipalInKVCred + = new AtomicReference<>(initDatasourceServicePrincipalInKeyVault()); + + StepVerifier.create(client.createDatasourceCredential(servicePrincipalInKVCred.get())) + .assertNext(createdCredential -> { + Assertions.assertTrue(createdCredential instanceof DatasourceServicePrincipalInKeyVault); + credIds.add(createdCredential.getId()); + servicePrincipalInKVCred.set((DatasourceServicePrincipalInKeyVault) createdCredential); + }) + .verifyComplete(); + + dataFeed.setSource(AzureDataExplorerDataFeedSource.fromServicePrincipalInKeyVaultCredential( + DATA_EXPLORER_CONNECTION_STRING, + DATA_EXPLORER_QUERY, + servicePrincipalInKVCred.get().getId())); + + final AtomicReference resultDataFeed = new AtomicReference<>(); + StepVerifier.create(client.updateDataFeed(dataFeed)) + .assertNext(updatedDataFeed -> { + resultDataFeed.set(updatedDataFeed); + super.validateDataExplorerFeedWithCredential(updatedDataFeed, servicePrincipalInKVCred.get()); + }) + .verifyComplete(); + return resultDataFeed.get(); + } + + @ParameterizedTest(name = DISPLAY_NAME_WITH_ARGUMENTS) + @MethodSource("com.azure.ai.metricsadvisor.TestUtils#getTestParameters") + @Override + public void testBlobStorage(HttpClient httpClient, MetricsAdvisorServiceVersion serviceVersion) { + final MetricsAdvisorAdministrationAsyncClient client + = getMetricsAdvisorAdministrationBuilder(httpClient, serviceVersion, true).buildAsyncClient(); + final AtomicReference dataFeed = new AtomicReference<>(initDataFeed()); + try { + // Create BlobFeed with basic credentials in connection string. + dataFeed.get().setSource(AzureBlobDataFeedSource.fromBasicCredential( + BLOB_CONNECTION_STRING, + TEST_DB_NAME, BLOB_TEMPLATE)); + + StepVerifier.create(client.createDataFeed(dataFeed.get())) + .assertNext(createdDataFeed -> { + dataFeed.set(createdDataFeed); + Assertions.assertTrue(createdDataFeed.getSource() instanceof AzureBlobDataFeedSource); + Assertions.assertEquals(DatasourceAuthenticationType.BASIC, + ((AzureBlobDataFeedSource) createdDataFeed.getSource()).getAuthenticationType()); + }) + .verifyComplete(); + + // Update BlobFeed to use MSI. + dataFeed.get() + .setSource(AzureBlobDataFeedSource.fromManagedIdentityCredential(BLOB_CONNECTION_STRING, + TEST_DB_NAME, BLOB_TEMPLATE)); + + StepVerifier.create(client.updateDataFeed(dataFeed.get())) + .assertNext(updatedDataFeed -> { + dataFeed.set(updatedDataFeed); + Assertions.assertTrue(updatedDataFeed.getSource() instanceof AzureBlobDataFeedSource); + Assertions.assertEquals(DatasourceAuthenticationType.MANAGED_IDENTITY, + ((AzureBlobDataFeedSource) updatedDataFeed.getSource()).getAuthenticationType()); + }) + .verifyComplete(); + } finally { + StepVerifier.create(client.deleteDataFeed(dataFeed.get().getId())).verifyComplete(); + } + } +} diff --git a/sdk/metricsadvisor/azure-ai-metricsadvisor/src/test/java/com/azure/ai/metricsadvisor/DataFeedWithCredentialsTest.java b/sdk/metricsadvisor/azure-ai-metricsadvisor/src/test/java/com/azure/ai/metricsadvisor/DataFeedWithCredentialsTest.java new file mode 100644 index 0000000000000..55545d3a70d80 --- /dev/null +++ b/sdk/metricsadvisor/azure-ai-metricsadvisor/src/test/java/com/azure/ai/metricsadvisor/DataFeedWithCredentialsTest.java @@ -0,0 +1,382 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +package com.azure.ai.metricsadvisor; + +import com.azure.ai.metricsadvisor.administration.MetricsAdvisorAdministrationClient; +import com.azure.ai.metricsadvisor.administration.models.AzureBlobDataFeedSource; +import com.azure.ai.metricsadvisor.administration.models.AzureDataExplorerDataFeedSource; +import com.azure.ai.metricsadvisor.administration.models.AzureDataLakeStorageGen2DataFeedSource; +import com.azure.ai.metricsadvisor.administration.models.DataFeed; +import com.azure.ai.metricsadvisor.administration.models.DatasourceDataLakeGen2SharedKey; +import com.azure.ai.metricsadvisor.administration.models.DatasourceAuthenticationType; +import com.azure.ai.metricsadvisor.administration.models.DatasourceCredentialEntity; +import com.azure.ai.metricsadvisor.administration.models.DatasourceServicePrincipal; +import com.azure.ai.metricsadvisor.administration.models.DatasourceServicePrincipalInKeyVault; +import com.azure.ai.metricsadvisor.administration.models.DatasourceSqlServerConnectionString; +import com.azure.ai.metricsadvisor.administration.models.SqlServerDataFeedSource; +import com.azure.core.http.HttpClient; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.params.ParameterizedTest; +import org.junit.jupiter.params.provider.MethodSource; + +import java.util.ArrayList; +import java.util.List; + +import static com.azure.ai.metricsadvisor.TestUtils.AZURE_DATALAKEGEN2_ACCOUNT_KEY; +import static com.azure.ai.metricsadvisor.TestUtils.BLOB_CONNECTION_STRING; +import static com.azure.ai.metricsadvisor.TestUtils.BLOB_TEMPLATE; +import static com.azure.ai.metricsadvisor.TestUtils.DATA_EXPLORER_CONNECTION_STRING; +import static com.azure.ai.metricsadvisor.TestUtils.DATA_EXPLORER_QUERY; +import static com.azure.ai.metricsadvisor.TestUtils.DIRECTORY_TEMPLATE; +import static com.azure.ai.metricsadvisor.TestUtils.DISPLAY_NAME_WITH_ARGUMENTS; +import static com.azure.ai.metricsadvisor.TestUtils.FILE_TEMPLATE; +import static com.azure.ai.metricsadvisor.TestUtils.SQL_SERVER_CONNECTION_STRING; +import static com.azure.ai.metricsadvisor.TestUtils.TEMPLATE_QUERY; +import static com.azure.ai.metricsadvisor.TestUtils.TEST_DB_NAME; + +public class DataFeedWithCredentialsTest extends DataFeedWithCredentialsTestBase { + @ParameterizedTest(name = DISPLAY_NAME_WITH_ARGUMENTS) + @MethodSource("com.azure.ai.metricsadvisor.TestUtils#getTestParameters") + @Override + public void testSqlServer(HttpClient httpClient, MetricsAdvisorServiceVersion serviceVersion) { + final MetricsAdvisorAdministrationClient client + = getMetricsAdvisorAdministrationBuilder(httpClient, serviceVersion, true).buildClient(); + List credIds = new ArrayList<>(); + + DataFeed dataFeed = super.initDataFeed(); + try { + // Create SqlFeed with basic credentials in connection string. + dataFeed.setSource(SqlServerDataFeedSource.fromBasicCredential( + SQL_SERVER_CONNECTION_STRING, + TEMPLATE_QUERY)); + + DataFeed createdDataFeed = client.createDataFeed(dataFeed); + Assertions.assertTrue(createdDataFeed.getSource() instanceof SqlServerDataFeedSource); + Assertions.assertNull(((SqlServerDataFeedSource) createdDataFeed.getSource()).getCredentialId()); + Assertions.assertEquals(DatasourceAuthenticationType.BASIC, + ((SqlServerDataFeedSource) createdDataFeed.getSource()).getAuthenticationType()); + dataFeed = createdDataFeed; + + // Update SqlFeed to use MSI. + dataFeed + .setSource(SqlServerDataFeedSource.fromManagedIdentityCredential(SQL_SERVER_CONNECTION_STRING, + TEMPLATE_QUERY)); + + DataFeed updatedDataFeed = client.updateDataFeed(dataFeed); + Assertions.assertTrue(updatedDataFeed.getSource() instanceof SqlServerDataFeedSource); + Assertions.assertNull(((SqlServerDataFeedSource) updatedDataFeed.getSource()).getCredentialId()); + Assertions.assertEquals(DatasourceAuthenticationType.MANAGED_IDENTITY, + ((SqlServerDataFeedSource) updatedDataFeed.getSource()).getAuthenticationType()); + dataFeed = updatedDataFeed; + + // Create SqlConnStr cred and update DataFeed to use it. + dataFeed = sqlServerWithConnStringCred(client, dataFeed, credIds); + + // Create SP credential and Update SqlFeed to use it. + dataFeed = sqlServerWithServicePrincipalCred(client, dataFeed, credIds); + + // Create SPInKV credential and Update SqlFeed to use it. + dataFeed = sqlServerWithServicePrincipalInKVCred(client, dataFeed, credIds); + } finally { + try { + client.deleteDataFeed(dataFeed.getId()); + } finally { + credIds.forEach(credentialId -> client.deleteDatasourceCredential(credentialId)); + } + } + } + + private DataFeed sqlServerWithConnStringCred(MetricsAdvisorAdministrationClient client, + DataFeed dataFeed, + List credIds) { + DatasourceSqlServerConnectionString sqlConStrCred = initDatasourceSqlServerConnectionString(); + final DatasourceCredentialEntity createdCredential = client.createDatasourceCredential(sqlConStrCred); + Assertions.assertTrue(createdCredential instanceof DatasourceSqlServerConnectionString); + credIds.add(createdCredential.getId()); + sqlConStrCred = (DatasourceSqlServerConnectionString) createdCredential; + + dataFeed.setSource(SqlServerDataFeedSource.fromConnectionStringCredential( + TEMPLATE_QUERY, + sqlConStrCred.getId())); + + final DataFeed updatedDataFeed = client.updateDataFeed(dataFeed); + super.validateSqlServerFeedWithCredential(updatedDataFeed, sqlConStrCred); + return updatedDataFeed; + } + + private DataFeed sqlServerWithServicePrincipalCred(MetricsAdvisorAdministrationClient client, + DataFeed dataFeed, + List credIds) { + DatasourceServicePrincipal servicePrincipalCred = initDatasourceServicePrincipal(); + DatasourceCredentialEntity createdCredential = client.createDatasourceCredential(servicePrincipalCred); + Assertions.assertTrue(createdCredential instanceof DatasourceServicePrincipal); + credIds.add(createdCredential.getId()); + servicePrincipalCred = ((DatasourceServicePrincipal) createdCredential); + + dataFeed.setSource(SqlServerDataFeedSource.fromServicePrincipalCredential( + SQL_SERVER_CONNECTION_STRING, + TEMPLATE_QUERY, + servicePrincipalCred.getId())); + + DataFeed updatedDataFeed = client.updateDataFeed(dataFeed); + super.validateSqlServerFeedWithCredential(updatedDataFeed, servicePrincipalCred); + return updatedDataFeed; + } + + private DataFeed sqlServerWithServicePrincipalInKVCred(MetricsAdvisorAdministrationClient client, + DataFeed dataFeed, + List credIds) { + DatasourceServicePrincipalInKeyVault servicePrincipalInKVCred = initDatasourceServicePrincipalInKeyVault(); + DatasourceCredentialEntity createdCredential = client.createDatasourceCredential(servicePrincipalInKVCred); + Assertions.assertTrue(createdCredential instanceof DatasourceServicePrincipalInKeyVault); + credIds.add(createdCredential.getId()); + servicePrincipalInKVCred = (DatasourceServicePrincipalInKeyVault) createdCredential; + + dataFeed.setSource(SqlServerDataFeedSource.fromServicePrincipalInKeyVaultCredential( + SQL_SERVER_CONNECTION_STRING, + TEMPLATE_QUERY, + servicePrincipalInKVCred.getId())); + + DataFeed updatedDataFeed = client.updateDataFeed(dataFeed); + super.validateSqlServerFeedWithCredential(updatedDataFeed, servicePrincipalInKVCred); + return updatedDataFeed; + } + + + @ParameterizedTest(name = DISPLAY_NAME_WITH_ARGUMENTS) + @MethodSource("com.azure.ai.metricsadvisor.TestUtils#getTestParameters") + @Override + public void testDataLakeGen2(HttpClient httpClient, MetricsAdvisorServiceVersion serviceVersion) { + final MetricsAdvisorAdministrationClient client + = getMetricsAdvisorAdministrationBuilder(httpClient, serviceVersion, true).buildClient(); + List credIds = new ArrayList<>(); + + DataFeed dataFeed = initDataFeed(); + try { + // Create DataLakeFeed with basic credentials in key. + dataFeed.setSource(AzureDataLakeStorageGen2DataFeedSource.fromBasicCredential( + "adsampledatalakegen2", + AZURE_DATALAKEGEN2_ACCOUNT_KEY, + TEST_DB_NAME, + DIRECTORY_TEMPLATE, + FILE_TEMPLATE)); + + DataFeed createdDataFeed = client.createDataFeed(dataFeed); + Assertions.assertTrue(createdDataFeed.getSource() instanceof AzureDataLakeStorageGen2DataFeedSource); + Assertions.assertNull( + ((AzureDataLakeStorageGen2DataFeedSource) createdDataFeed.getSource()).getCredentialId()); + Assertions.assertEquals(DatasourceAuthenticationType.BASIC, + ((AzureDataLakeStorageGen2DataFeedSource) createdDataFeed.getSource()).getAuthenticationType()); + dataFeed = createdDataFeed; + + // Create SharedKey credential and Update DataLakeFeed to use it. + dataFeed = dataLakeWithSharedKeyCred(client, dataFeed, credIds); + + // Create SP credential and Update SqlFeed to use it. + dataFeed = dataLakeWithServicePrincipalCred(client, dataFeed, credIds); + + // Create SPInKV credential and Update SqlFeed to use it. + dataFeed = dataLakeWithServicePrincipalInKVCred(client, dataFeed, credIds); + } finally { + try { + client.deleteDataFeed(dataFeed.getId()); + } finally { + credIds.forEach(credentialId -> + client.deleteDatasourceCredential(credentialId)); + } + } + } + + private DataFeed dataLakeWithSharedKeyCred(MetricsAdvisorAdministrationClient client, + DataFeed dataFeed, + List credIds) { + DatasourceDataLakeGen2SharedKey sharedKeyCred = initDataSourceDataLakeGen2SharedKey(); + DatasourceCredentialEntity createdCredential = client.createDatasourceCredential(sharedKeyCred); + Assertions.assertTrue(createdCredential instanceof DatasourceDataLakeGen2SharedKey); + credIds.add(createdCredential.getId()); + sharedKeyCred = (DatasourceDataLakeGen2SharedKey) createdCredential; + + dataFeed.setSource(AzureDataLakeStorageGen2DataFeedSource.fromSharedKeyCredential("adsampledatalakegen2", + TEST_DB_NAME, + DIRECTORY_TEMPLATE, + FILE_TEMPLATE, + sharedKeyCred.getId())); + + DataFeed updatedDataFeed = client.updateDataFeed(dataFeed); + super.validateDataLakeFeedWithCredential(updatedDataFeed, sharedKeyCred); + return updatedDataFeed; + } + + private DataFeed dataLakeWithServicePrincipalCred(MetricsAdvisorAdministrationClient client, + DataFeed dataFeed, + List credIds) { + DatasourceServicePrincipal servicePrincipalCred = initDatasourceServicePrincipal(); + DatasourceCredentialEntity createdCredential = client.createDatasourceCredential(servicePrincipalCred); + Assertions.assertTrue(createdCredential instanceof DatasourceServicePrincipal); + credIds.add(createdCredential.getId()); + servicePrincipalCred = (DatasourceServicePrincipal) createdCredential; + + dataFeed.setSource(AzureDataLakeStorageGen2DataFeedSource.fromServicePrincipalCredential( + "adsampledatalakegen2", + TEST_DB_NAME, + DIRECTORY_TEMPLATE, + FILE_TEMPLATE, + servicePrincipalCred.getId())); + + DataFeed updatedDataFeed = client.updateDataFeed(dataFeed); + super.validateDataLakeFeedWithCredential(updatedDataFeed, servicePrincipalCred); + return updatedDataFeed; + } + + private DataFeed dataLakeWithServicePrincipalInKVCred(MetricsAdvisorAdministrationClient client, + DataFeed dataFeed, + List credIds) { + DatasourceServicePrincipalInKeyVault servicePrincipalInKVCred = initDatasourceServicePrincipalInKeyVault(); + DatasourceCredentialEntity createdCredential = client.createDatasourceCredential(servicePrincipalInKVCred); + Assertions.assertTrue(createdCredential instanceof DatasourceServicePrincipalInKeyVault); + credIds.add(createdCredential.getId()); + servicePrincipalInKVCred = (DatasourceServicePrincipalInKeyVault) createdCredential; + + dataFeed.setSource(AzureDataLakeStorageGen2DataFeedSource.fromServicePrincipalInKeyVaultCredential( + "adsampledatalakegen2", + TEST_DB_NAME, + DIRECTORY_TEMPLATE, + FILE_TEMPLATE, + servicePrincipalInKVCred.getId())); + + DataFeed updatedDataFeed = client.updateDataFeed(dataFeed); + super.validateDataLakeFeedWithCredential(updatedDataFeed, servicePrincipalInKVCred); + return updatedDataFeed; + } + + @ParameterizedTest(name = DISPLAY_NAME_WITH_ARGUMENTS) + @MethodSource("com.azure.ai.metricsadvisor.TestUtils#getTestParameters") + @Override + public void testDataExplorer(HttpClient httpClient, MetricsAdvisorServiceVersion serviceVersion) { + final MetricsAdvisorAdministrationClient client + = getMetricsAdvisorAdministrationBuilder(httpClient, serviceVersion, true).buildClient(); + List credIds = new ArrayList<>(); + + DataFeed dataFeed = initDataFeed(); + try { + // Create SqlFeed with basic credentials in connection string. + dataFeed.setSource(AzureDataExplorerDataFeedSource.fromBasicCredential( + DATA_EXPLORER_CONNECTION_STRING, + DATA_EXPLORER_QUERY)); + + DataFeed createdDataFeed = client.createDataFeed(dataFeed); + Assertions.assertTrue(createdDataFeed.getSource() instanceof AzureDataExplorerDataFeedSource); + Assertions.assertNull(((AzureDataExplorerDataFeedSource) createdDataFeed.getSource()) + .getCredentialId()); + Assertions.assertEquals(DatasourceAuthenticationType.BASIC, + ((AzureDataExplorerDataFeedSource) createdDataFeed.getSource()) + .getAuthenticationType()); + dataFeed = createdDataFeed; + + + // Update DataExplorerFeed to use MSI. + dataFeed + .setSource(AzureDataExplorerDataFeedSource.fromManagedIdentityCredential( + DATA_EXPLORER_CONNECTION_STRING, + DATA_EXPLORER_QUERY)); + + DataFeed updatedDataFeed = client.updateDataFeed(dataFeed); + Assertions.assertTrue(updatedDataFeed.getSource() instanceof AzureDataExplorerDataFeedSource); + Assertions.assertNull(((AzureDataExplorerDataFeedSource) updatedDataFeed.getSource()) + .getCredentialId()); + Assertions.assertEquals(DatasourceAuthenticationType.MANAGED_IDENTITY, + ((AzureDataExplorerDataFeedSource) updatedDataFeed.getSource()) + .getAuthenticationType()); + dataFeed = updatedDataFeed; + + + // Create SP credential and Update DataExplorerFeed to use it. + dataFeed = dataExplorerWithServicePrincipalCred(client, dataFeed, credIds); + + // Create SPInKV credential and Update DataExplorerFeed to use it. + dataFeed = dataExplorerWithServicePrincipalInKVCred(client, dataFeed, credIds); + } finally { + try { + client.deleteDataFeed(dataFeed.getId()); + } finally { + credIds.forEach(credentialId -> client.deleteDatasourceCredential(credentialId)); + } + } + } + + private DataFeed dataExplorerWithServicePrincipalCred(MetricsAdvisorAdministrationClient client, + DataFeed dataFeed, + List credIds) { + DatasourceServicePrincipal servicePrincipalCred = initDatasourceServicePrincipal(); + + DatasourceCredentialEntity createdCredential = client.createDatasourceCredential(servicePrincipalCred); + + Assertions.assertTrue(createdCredential instanceof DatasourceServicePrincipal); + credIds.add(createdCredential.getId()); + servicePrincipalCred = (DatasourceServicePrincipal) createdCredential; + + dataFeed.setSource(AzureDataExplorerDataFeedSource.fromServicePrincipalCredential( + DATA_EXPLORER_CONNECTION_STRING, + DATA_EXPLORER_QUERY, + servicePrincipalCred.getId())); + + DataFeed updatedDataFeed = client.updateDataFeed(dataFeed); + super.validateDataExplorerFeedWithCredential(updatedDataFeed, servicePrincipalCred); + return updatedDataFeed; + } + + private DataFeed dataExplorerWithServicePrincipalInKVCred(MetricsAdvisorAdministrationClient client, + DataFeed dataFeed, + List credIds) { + DatasourceServicePrincipalInKeyVault servicePrincipalInKVCred = initDatasourceServicePrincipalInKeyVault(); + DatasourceCredentialEntity createdCredential = client.createDatasourceCredential(servicePrincipalInKVCred); + Assertions.assertTrue(createdCredential instanceof DatasourceServicePrincipalInKeyVault); + credIds.add(createdCredential.getId()); + servicePrincipalInKVCred = (DatasourceServicePrincipalInKeyVault) createdCredential; + + + dataFeed.setSource(AzureDataExplorerDataFeedSource.fromServicePrincipalInKeyVaultCredential( + DATA_EXPLORER_CONNECTION_STRING, + DATA_EXPLORER_QUERY, + servicePrincipalInKVCred.getId())); + + DataFeed updatedDataFeed = client.updateDataFeed(dataFeed); + super.validateDataExplorerFeedWithCredential(updatedDataFeed, servicePrincipalInKVCred); + return updatedDataFeed; + } + + @ParameterizedTest(name = DISPLAY_NAME_WITH_ARGUMENTS) + @MethodSource("com.azure.ai.metricsadvisor.TestUtils#getTestParameters") + @Override + public void testBlobStorage(HttpClient httpClient, MetricsAdvisorServiceVersion serviceVersion) { + final MetricsAdvisorAdministrationClient client + = getMetricsAdvisorAdministrationBuilder(httpClient, serviceVersion, true).buildClient(); + DataFeed dataFeed = initDataFeed(); + try { + // Create BlobFeed with basic credentials in connection string. + dataFeed.setSource(AzureBlobDataFeedSource.fromBasicCredential( + BLOB_CONNECTION_STRING, + TEST_DB_NAME, BLOB_TEMPLATE)); + + DataFeed createdDataFeed = client.createDataFeed(dataFeed); + Assertions.assertTrue(createdDataFeed.getSource() instanceof AzureBlobDataFeedSource); + Assertions.assertEquals(DatasourceAuthenticationType.BASIC, + ((AzureBlobDataFeedSource) createdDataFeed.getSource()).getAuthenticationType()); + dataFeed = createdDataFeed; + + // Update BlobFeed to use MSI. + dataFeed + .setSource(AzureBlobDataFeedSource.fromManagedIdentityCredential(BLOB_CONNECTION_STRING, + TEST_DB_NAME, BLOB_TEMPLATE)); + + DataFeed updatedDataFeed = client.updateDataFeed(dataFeed); + Assertions.assertTrue(updatedDataFeed.getSource() instanceof AzureBlobDataFeedSource); + Assertions.assertEquals(DatasourceAuthenticationType.MANAGED_IDENTITY, + ((AzureBlobDataFeedSource) updatedDataFeed.getSource()).getAuthenticationType()); + dataFeed = updatedDataFeed; + } finally { + client.deleteDataFeed(dataFeed.getId()); + } + } +} diff --git a/sdk/metricsadvisor/azure-ai-metricsadvisor/src/test/java/com/azure/ai/metricsadvisor/DataFeedWithCredentialsTestBase.java b/sdk/metricsadvisor/azure-ai-metricsadvisor/src/test/java/com/azure/ai/metricsadvisor/DataFeedWithCredentialsTestBase.java new file mode 100644 index 0000000000000..1cc8c68cb3684 --- /dev/null +++ b/sdk/metricsadvisor/azure-ai-metricsadvisor/src/test/java/com/azure/ai/metricsadvisor/DataFeedWithCredentialsTestBase.java @@ -0,0 +1,162 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +package com.azure.ai.metricsadvisor; + +import com.azure.ai.metricsadvisor.administration.models.AzureDataExplorerDataFeedSource; +import com.azure.ai.metricsadvisor.administration.models.AzureDataLakeStorageGen2DataFeedSource; +import com.azure.ai.metricsadvisor.administration.models.DataFeed; +import com.azure.ai.metricsadvisor.administration.models.DataFeedDimension; +import com.azure.ai.metricsadvisor.administration.models.DataFeedGranularity; +import com.azure.ai.metricsadvisor.administration.models.DataFeedGranularityType; +import com.azure.ai.metricsadvisor.administration.models.DataFeedIngestionSettings; +import com.azure.ai.metricsadvisor.administration.models.DataFeedMetric; +import com.azure.ai.metricsadvisor.administration.models.DataFeedSchema; +import com.azure.ai.metricsadvisor.administration.models.DatasourceDataLakeGen2SharedKey; +import com.azure.ai.metricsadvisor.administration.models.DatasourceAuthenticationType; +import com.azure.ai.metricsadvisor.administration.models.DatasourceCredentialEntity; +import com.azure.ai.metricsadvisor.administration.models.DatasourceServicePrincipal; +import com.azure.ai.metricsadvisor.administration.models.DatasourceServicePrincipalInKeyVault; +import com.azure.ai.metricsadvisor.administration.models.DatasourceSqlServerConnectionString; +import com.azure.ai.metricsadvisor.administration.models.SqlServerDataFeedSource; +import com.azure.core.http.HttpClient; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Test; +import java.util.Arrays; +import java.util.UUID; + +import static com.azure.ai.metricsadvisor.TestUtils.AZURE_DATALAKEGEN2_ACCOUNT_KEY; +import static com.azure.ai.metricsadvisor.TestUtils.INGESTION_START_TIME; +import static com.azure.ai.metricsadvisor.TestUtils.SQL_SERVER_CONNECTION_STRING; + +public abstract class DataFeedWithCredentialsTestBase extends MetricsAdvisorAdministrationClientTestBase { + static final String SQL_CONNECTION_DATASOURCE_CRED_NAME_PREFIX = "java_create_data_source_cred_sql_con"; + static final String DATA_LAKE_GEN2_SHARED_KEY_DATASOURCE_CRED_NAME_PREFIX + = "java_create_data_source_cred_dlake_gen"; + static final String SP_DATASOURCE_CRED_NAME_PREFIX = "java_create_data_source_cred_sp"; + static final String SP_IN_KV_DATASOURCE_CRED_NAME_PREFIX = "java_create_data_source_cred_spkv"; + + @Test + abstract void testSqlServer(HttpClient httpClient, MetricsAdvisorServiceVersion serviceVersion); + + @Test + abstract void testDataLakeGen2(HttpClient httpClient, MetricsAdvisorServiceVersion serviceVersion); + + abstract void testDataExplorer(HttpClient httpClient, MetricsAdvisorServiceVersion serviceVersion); + + abstract void testBlobStorage(HttpClient httpClient, MetricsAdvisorServiceVersion serviceVersion); + + protected void validateSqlServerFeedWithCredential(DataFeed dataFeed, + DatasourceCredentialEntity credential) { + Assertions.assertTrue(dataFeed.getSource() instanceof SqlServerDataFeedSource); + if (credential instanceof DatasourceSqlServerConnectionString) { + Assertions.assertTrue(dataFeed.getSource() instanceof SqlServerDataFeedSource); + Assertions.assertEquals(credential.getId(), + ((SqlServerDataFeedSource) dataFeed.getSource()).getCredentialId()); + Assertions.assertEquals(DatasourceAuthenticationType.AZURE_SQL_CONNECTION_STRING, + ((SqlServerDataFeedSource) dataFeed.getSource()).getAuthenticationType()); + } else if (credential instanceof DatasourceServicePrincipal) { + Assertions.assertEquals(credential.getId(), + ((SqlServerDataFeedSource) dataFeed.getSource()).getCredentialId()); + Assertions.assertEquals(DatasourceAuthenticationType.SERVICE_PRINCIPAL, + ((SqlServerDataFeedSource) dataFeed.getSource()).getAuthenticationType()); + } else if (credential instanceof DatasourceServicePrincipalInKeyVault) { + Assertions.assertEquals(credential.getId(), + ((SqlServerDataFeedSource) dataFeed.getSource()).getCredentialId()); + Assertions.assertEquals(DatasourceAuthenticationType.SERVICE_PRINCIPAL_IN_KV, + ((SqlServerDataFeedSource) dataFeed.getSource()).getAuthenticationType()); + } else { + throw new IllegalStateException("Unexpected cred type for SqlFeed credential: " + credential); + } + } + + protected void validateDataLakeFeedWithCredential(DataFeed dataFeed, + DatasourceCredentialEntity credential) { + Assertions.assertTrue(dataFeed.getSource() instanceof AzureDataLakeStorageGen2DataFeedSource); + if (credential instanceof DatasourceDataLakeGen2SharedKey) { + Assertions.assertEquals(credential.getId(), + ((AzureDataLakeStorageGen2DataFeedSource) dataFeed.getSource()).getCredentialId()); + Assertions.assertEquals(DatasourceAuthenticationType.DATA_LAKE_GEN2_SHARED_KEY, + ((AzureDataLakeStorageGen2DataFeedSource) dataFeed.getSource()).getAuthenticationType()); + } else if (credential instanceof DatasourceServicePrincipal) { + Assertions.assertEquals(credential.getId(), + ((AzureDataLakeStorageGen2DataFeedSource) dataFeed.getSource()).getCredentialId()); + Assertions.assertEquals(DatasourceAuthenticationType.SERVICE_PRINCIPAL, + ((AzureDataLakeStorageGen2DataFeedSource) dataFeed.getSource()).getAuthenticationType()); + } else if (credential instanceof DatasourceServicePrincipalInKeyVault) { + Assertions.assertEquals(credential.getId(), + ((AzureDataLakeStorageGen2DataFeedSource) dataFeed.getSource()).getCredentialId()); + Assertions.assertEquals(DatasourceAuthenticationType.SERVICE_PRINCIPAL_IN_KV, + ((AzureDataLakeStorageGen2DataFeedSource) dataFeed.getSource()).getAuthenticationType()); + } else { + throw new IllegalStateException("Unexpected cred type for DataLake credential: " + credential); + } + } + + protected void validateDataExplorerFeedWithCredential(DataFeed dataFeed, + DatasourceCredentialEntity credential) { + Assertions.assertTrue(dataFeed.getSource() instanceof AzureDataExplorerDataFeedSource); + if (credential instanceof DatasourceServicePrincipal) { + Assertions.assertEquals(credential.getId(), + ((AzureDataExplorerDataFeedSource) dataFeed.getSource()).getCredentialId()); + Assertions.assertEquals(DatasourceAuthenticationType.SERVICE_PRINCIPAL, + ((AzureDataExplorerDataFeedSource) dataFeed.getSource()).getAuthenticationType()); + } else if (credential instanceof DatasourceServicePrincipalInKeyVault) { + Assertions.assertEquals(credential.getId(), + ((AzureDataExplorerDataFeedSource) dataFeed.getSource()).getCredentialId()); + Assertions.assertEquals(DatasourceAuthenticationType.SERVICE_PRINCIPAL_IN_KV, + ((AzureDataExplorerDataFeedSource) dataFeed.getSource()).getAuthenticationType()); + } else { + throw new IllegalStateException("Unexpected cred type for DataExplorer credential: " + credential); + } + } + + protected DataFeed initDataFeed() { + return new DataFeed().setSchema(new DataFeedSchema(Arrays.asList( + new DataFeedMetric().setName("cost").setDisplayName("cost"), + new DataFeedMetric().setName("revenue").setDisplayName("revenue"))) + .setDimensions(Arrays.asList( + new DataFeedDimension().setName("city").setDisplayName("city"), + new DataFeedDimension().setName("category").setDisplayName("category")))) + .setName("java_create_data_feed_test_sample" + UUID.randomUUID()) + .setGranularity(new DataFeedGranularity().setGranularityType(DataFeedGranularityType.DAILY)) + .setIngestionSettings(new DataFeedIngestionSettings(INGESTION_START_TIME)); + } + + protected DatasourceSqlServerConnectionString initDatasourceSqlServerConnectionString() { + final String name = SQL_CONNECTION_DATASOURCE_CRED_NAME_PREFIX + UUID.randomUUID(); + return new DatasourceSqlServerConnectionString(name, SQL_SERVER_CONNECTION_STRING); + } + + protected DatasourceDataLakeGen2SharedKey initDataSourceDataLakeGen2SharedKey() { + final String name = DATA_LAKE_GEN2_SHARED_KEY_DATASOURCE_CRED_NAME_PREFIX + UUID.randomUUID(); + return new DatasourceDataLakeGen2SharedKey(name, AZURE_DATALAKEGEN2_ACCOUNT_KEY); + } + + protected DatasourceServicePrincipal initDatasourceServicePrincipal() { + final String name = SP_DATASOURCE_CRED_NAME_PREFIX + UUID.randomUUID(); + final String cId = "e70248b2-bffa-11eb-8529-0242ac130003"; + final String tId = "45389ded-5e07-4e52-b225-4ae8f905afb5"; + final String mockSecr = "45389ded-5e07-4e52-b225-4ae8f905afb5"; + return new DatasourceServicePrincipal(name, cId, tId, mockSecr); + } + + protected DatasourceServicePrincipalInKeyVault initDatasourceServicePrincipalInKeyVault() { + final StringBuilder kvEndpoint = new StringBuilder() + .append("https://") + .append(UUID.randomUUID()) + .append(".vault") + .append(".azure.net"); + final String name = SP_IN_KV_DATASOURCE_CRED_NAME_PREFIX + UUID.randomUUID(); + final String cId = "e70248b2-bffa-11eb-8529-0242ac130003"; + final String tId = "45389ded-5e07-4e52-b225-4ae8f905afb5"; + final String mockSecr = "45389ded-5e07-4e52-b225-4ae8f905afb5"; + + return new DatasourceServicePrincipalInKeyVault() + .setName(name) + .setKeyVaultForDatasourceSecrets(kvEndpoint.toString(), cId, mockSecr) + .setTenantId(tId) + .setSecretNameForDatasourceClientId("DSClientID_1") + .setSecretNameForDatasourceClientSecret("DSClientSer_1"); + } +} diff --git a/sdk/metricsadvisor/azure-ai-metricsadvisor/src/test/java/com/azure/ai/metricsadvisor/DatasourceCredentialAsyncTest.java b/sdk/metricsadvisor/azure-ai-metricsadvisor/src/test/java/com/azure/ai/metricsadvisor/DatasourceCredentialAsyncTest.java new file mode 100644 index 0000000000000..99cc89b3559b1 --- /dev/null +++ b/sdk/metricsadvisor/azure-ai-metricsadvisor/src/test/java/com/azure/ai/metricsadvisor/DatasourceCredentialAsyncTest.java @@ -0,0 +1,187 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +package com.azure.ai.metricsadvisor; + +import com.azure.ai.metricsadvisor.administration.MetricsAdvisorAdministrationAsyncClient; +import com.azure.ai.metricsadvisor.administration.models.DatasourceAuthenticationType; +import com.azure.ai.metricsadvisor.administration.models.DatasourceCredentialEntity; +import com.azure.core.http.HttpClient; +import com.azure.core.test.TestBase; +import com.azure.core.util.CoreUtils; +import org.junit.jupiter.api.AfterAll; +import org.junit.jupiter.api.BeforeAll; +import org.junit.jupiter.params.ParameterizedTest; +import org.junit.jupiter.params.provider.MethodSource; +import reactor.core.publisher.Mono; +import reactor.test.StepVerifier; + +import java.time.Duration; +import java.util.ArrayList; +import java.util.List; +import java.util.concurrent.atomic.AtomicReference; +import java.util.stream.Collectors; + +import static com.azure.ai.metricsadvisor.TestUtils.DEFAULT_SUBSCRIBER_TIMEOUT_SECONDS; +import static com.azure.ai.metricsadvisor.TestUtils.DISPLAY_NAME_WITH_ARGUMENTS; +import static org.junit.jupiter.api.Assertions.assertEquals; + +public class DatasourceCredentialAsyncTest extends DatasourceCredentialTestBase { + private MetricsAdvisorAdministrationAsyncClient client; + + @BeforeAll + static void beforeAll() { + TestBase.setupClass(); + StepVerifier.setDefaultTimeout(Duration.ofSeconds(DEFAULT_SUBSCRIBER_TIMEOUT_SECONDS)); + } + + @AfterAll + static void afterAll() { + StepVerifier.resetDefaultTimeout(); + } + + @ParameterizedTest(name = DISPLAY_NAME_WITH_ARGUMENTS) + @MethodSource("com.azure.ai.metricsadvisor.TestUtils#getTestParameters") + @Override + void createSqlConnectionString(HttpClient httpClient, MetricsAdvisorServiceVersion serviceVersion) { + final AtomicReference credentialId = new AtomicReference<>(); + try { + // Arrange + client = getMetricsAdvisorAdministrationBuilder(httpClient, serviceVersion, true).buildAsyncClient(); + super.creatDatasourceCredentialRunner(expectedCredential -> + // Act & Assert + StepVerifier.create(client.createDatasourceCredential(expectedCredential)) + .assertNext(createdCredential -> { + credentialId.set(createdCredential.getId()); + super.validateCredentialResult(expectedCredential, + createdCredential, + DatasourceAuthenticationType.AZURE_SQL_CONNECTION_STRING); + }) + .verifyComplete(), DatasourceAuthenticationType.AZURE_SQL_CONNECTION_STRING); + + } finally { + if (!CoreUtils.isNullOrEmpty(credentialId.get())) { + Mono deleteCredential = client.deleteDatasourceCredential(credentialId.get()); + StepVerifier.create(deleteCredential) + .verifyComplete(); + } + } + } + + @ParameterizedTest(name = DISPLAY_NAME_WITH_ARGUMENTS) + @MethodSource("com.azure.ai.metricsadvisor.TestUtils#getTestParameters") + @Override + void createDataLakeGen2SharedKey(HttpClient httpClient, MetricsAdvisorServiceVersion serviceVersion) { + final AtomicReference credentialId = new AtomicReference<>(); + try { + // Arrange + client = getMetricsAdvisorAdministrationBuilder(httpClient, serviceVersion, true).buildAsyncClient(); + super.creatDatasourceCredentialRunner(expectedCredential -> + // Act & Assert + StepVerifier.create(client.createDatasourceCredential(expectedCredential)) + .assertNext(createdCredential -> { + credentialId.set(createdCredential.getId()); + super.validateCredentialResult(expectedCredential, + createdCredential, + DatasourceAuthenticationType.DATA_LAKE_GEN2_SHARED_KEY); + }) + .verifyComplete(), DatasourceAuthenticationType.DATA_LAKE_GEN2_SHARED_KEY); + + } finally { + if (!CoreUtils.isNullOrEmpty(credentialId.get())) { + Mono deleteCredential = client.deleteDatasourceCredential(credentialId.get()); + StepVerifier.create(deleteCredential) + .verifyComplete(); + } + } + } + + @ParameterizedTest(name = DISPLAY_NAME_WITH_ARGUMENTS) + @MethodSource("com.azure.ai.metricsadvisor.TestUtils#getTestParameters") + @Override + void createServicePrincipal(HttpClient httpClient, MetricsAdvisorServiceVersion serviceVersion) { + final AtomicReference credentialId = new AtomicReference<>(); + try { + // Arrange + client = getMetricsAdvisorAdministrationBuilder(httpClient, serviceVersion, true).buildAsyncClient(); + super.creatDatasourceCredentialRunner(expectedCredential -> + // Act & Assert + StepVerifier.create(client.createDatasourceCredential(expectedCredential)) + .assertNext(createdCredential -> { + credentialId.set(createdCredential.getId()); + super.validateCredentialResult(expectedCredential, + createdCredential, + DatasourceAuthenticationType.SERVICE_PRINCIPAL); + }) + .verifyComplete(), DatasourceAuthenticationType.SERVICE_PRINCIPAL); + + } finally { + if (!CoreUtils.isNullOrEmpty(credentialId.get())) { + Mono deleteCredential = client.deleteDatasourceCredential(credentialId.get()); + StepVerifier.create(deleteCredential) + .verifyComplete(); + } + } + } + + @ParameterizedTest(name = DISPLAY_NAME_WITH_ARGUMENTS) + @MethodSource("com.azure.ai.metricsadvisor.TestUtils#getTestParameters") + @Override + void createServicePrincipalInKV(HttpClient httpClient, MetricsAdvisorServiceVersion serviceVersion) { + final AtomicReference credentialId = new AtomicReference<>(); + try { + // Arrange + client = getMetricsAdvisorAdministrationBuilder(httpClient, serviceVersion, true).buildAsyncClient(); + super.creatDatasourceCredentialRunner(expectedCredential -> + // Act & Assert + StepVerifier.create(client.createDatasourceCredential(expectedCredential)) + .assertNext(createdCredential -> { + credentialId.set(createdCredential.getId()); + super.validateCredentialResult(expectedCredential, + createdCredential, + DatasourceAuthenticationType.SERVICE_PRINCIPAL_IN_KV); + }) + .verifyComplete(), DatasourceAuthenticationType.SERVICE_PRINCIPAL_IN_KV); + + } finally { + if (!CoreUtils.isNullOrEmpty(credentialId.get())) { + Mono deleteCredential = client.deleteDatasourceCredential(credentialId.get()); + StepVerifier.create(deleteCredential) + .verifyComplete(); + } + } + } + + @ParameterizedTest(name = DISPLAY_NAME_WITH_ARGUMENTS) + @MethodSource("com.azure.ai.metricsadvisor.TestUtils#getTestParameters") + void testListDataSourceCredentials(HttpClient httpClient, MetricsAdvisorServiceVersion serviceVersion) { + AtomicReference> createdCredentialIdList = new AtomicReference<>(); + try { + client = getMetricsAdvisorAdministrationBuilder(httpClient, serviceVersion, true).buildAsyncClient(); + + super.listDatasourceCredentialRunner(inputCredentialList -> { + final List ids = + inputCredentialList.stream() + .map(credential -> client.createDatasourceCredential(credential).block()) + .map(credential -> credential.getId()) + .collect(Collectors.toList()); + createdCredentialIdList.set(ids); + + List retrievedCredentialList = new ArrayList<>(); + StepVerifier.create(client.listDatasourceCredentials()) + .thenConsumeWhile(e -> { + retrievedCredentialList.add(e); + return retrievedCredentialList.size() < inputCredentialList.size(); + }) + .thenCancel().verify(); + + assertEquals(inputCredentialList.size(), retrievedCredentialList.size()); + }); + } finally { + if (!CoreUtils.isNullOrEmpty(createdCredentialIdList.get())) { + createdCredentialIdList.get().forEach(credentialId -> + StepVerifier.create(client.deleteDatasourceCredential(credentialId)).verifyComplete()); + } + } + } +} diff --git a/sdk/metricsadvisor/azure-ai-metricsadvisor/src/test/java/com/azure/ai/metricsadvisor/DatasourceCredentialTest.java b/sdk/metricsadvisor/azure-ai-metricsadvisor/src/test/java/com/azure/ai/metricsadvisor/DatasourceCredentialTest.java new file mode 100644 index 0000000000000..e88fcf93a924f --- /dev/null +++ b/sdk/metricsadvisor/azure-ai-metricsadvisor/src/test/java/com/azure/ai/metricsadvisor/DatasourceCredentialTest.java @@ -0,0 +1,156 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +package com.azure.ai.metricsadvisor; + +import com.azure.ai.metricsadvisor.administration.MetricsAdvisorAdministrationClient; +import com.azure.ai.metricsadvisor.administration.models.DatasourceAuthenticationType; +import com.azure.ai.metricsadvisor.administration.models.DatasourceCredentialEntity; +import com.azure.core.http.HttpClient; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.util.CoreUtils; +import org.junit.jupiter.params.ParameterizedTest; +import org.junit.jupiter.params.provider.MethodSource; + +import java.util.ArrayList; +import java.util.List; +import java.util.concurrent.atomic.AtomicReference; +import java.util.stream.Collectors; + +import static com.azure.ai.metricsadvisor.TestUtils.DISPLAY_NAME_WITH_ARGUMENTS; +import static org.junit.jupiter.api.Assertions.assertEquals; + +public class DatasourceCredentialTest extends DatasourceCredentialTestBase { + private MetricsAdvisorAdministrationClient client; + + @ParameterizedTest(name = DISPLAY_NAME_WITH_ARGUMENTS) + @MethodSource("com.azure.ai.metricsadvisor.TestUtils#getTestParameters") + @Override + void createSqlConnectionString(HttpClient httpClient, MetricsAdvisorServiceVersion serviceVersion) { + final AtomicReference credentialId = new AtomicReference<>(); + try { + // Arrange + client = getMetricsAdvisorAdministrationBuilder(httpClient, serviceVersion, true).buildClient(); + super.creatDatasourceCredentialRunner(expectedCredential -> { + // Act & Assert + DatasourceCredentialEntity createdCredential + = client.createDatasourceCredential(expectedCredential); + credentialId.set(createdCredential.getId()); + super.validateCredentialResult(expectedCredential, + createdCredential, + DatasourceAuthenticationType.AZURE_SQL_CONNECTION_STRING); + }, DatasourceAuthenticationType.AZURE_SQL_CONNECTION_STRING); + + } finally { + if (!CoreUtils.isNullOrEmpty(credentialId.get())) { + client.deleteDatasourceCredential(credentialId.get()); + } + } + } + + @ParameterizedTest(name = DISPLAY_NAME_WITH_ARGUMENTS) + @MethodSource("com.azure.ai.metricsadvisor.TestUtils#getTestParameters") + @Override + void createDataLakeGen2SharedKey(HttpClient httpClient, MetricsAdvisorServiceVersion serviceVersion) { + final AtomicReference credentialId = new AtomicReference<>(); + try { + // Arrange + client = getMetricsAdvisorAdministrationBuilder(httpClient, serviceVersion, true).buildClient(); + super.creatDatasourceCredentialRunner(expectedCredential -> { + // Act & Assert + DatasourceCredentialEntity createdCredential + = client.createDatasourceCredential(expectedCredential); + credentialId.set(createdCredential.getId()); + super.validateCredentialResult(expectedCredential, + createdCredential, + DatasourceAuthenticationType.DATA_LAKE_GEN2_SHARED_KEY); + }, DatasourceAuthenticationType.DATA_LAKE_GEN2_SHARED_KEY); + + } finally { + if (!CoreUtils.isNullOrEmpty(credentialId.get())) { + client.deleteDatasourceCredential(credentialId.get()); + } + } + } + + @ParameterizedTest(name = DISPLAY_NAME_WITH_ARGUMENTS) + @MethodSource("com.azure.ai.metricsadvisor.TestUtils#getTestParameters") + @Override + void createServicePrincipal(HttpClient httpClient, MetricsAdvisorServiceVersion serviceVersion) { + final AtomicReference credentialId = new AtomicReference<>(); + try { + // Arrange + client = getMetricsAdvisorAdministrationBuilder(httpClient, serviceVersion, true).buildClient(); + super.creatDatasourceCredentialRunner(expectedCredential -> { + // Act & Assert + DatasourceCredentialEntity createdCredential + = client.createDatasourceCredential(expectedCredential); + credentialId.set(createdCredential.getId()); + super.validateCredentialResult(expectedCredential, + createdCredential, + DatasourceAuthenticationType.SERVICE_PRINCIPAL); + }, DatasourceAuthenticationType.SERVICE_PRINCIPAL); + + } finally { + if (!CoreUtils.isNullOrEmpty(credentialId.get())) { + client.deleteDatasourceCredential(credentialId.get()); + } + } + } + + @Override + void createServicePrincipalInKV(HttpClient httpClient, MetricsAdvisorServiceVersion serviceVersion) { + final AtomicReference credentialId = new AtomicReference<>(); + try { + // Arrange + client = getMetricsAdvisorAdministrationBuilder(httpClient, serviceVersion, true).buildClient(); + super.creatDatasourceCredentialRunner(expectedCredential -> { + // Act & Assert + DatasourceCredentialEntity createdCredential + = client.createDatasourceCredential(expectedCredential); + credentialId.set(createdCredential.getId()); + super.validateCredentialResult(expectedCredential, + createdCredential, + DatasourceAuthenticationType.SERVICE_PRINCIPAL_IN_KV); + }, DatasourceAuthenticationType.SERVICE_PRINCIPAL_IN_KV); + + } finally { + if (!CoreUtils.isNullOrEmpty(credentialId.get())) { + client.deleteDatasourceCredential(credentialId.get()); + } + } + } + + @ParameterizedTest(name = DISPLAY_NAME_WITH_ARGUMENTS) + @MethodSource("com.azure.ai.metricsadvisor.TestUtils#getTestParameters") + @Override + void testListDataSourceCredentials(HttpClient httpClient, MetricsAdvisorServiceVersion serviceVersion) { + AtomicReference> createdCredentialIdList = new AtomicReference<>(); + try { + client = getMetricsAdvisorAdministrationBuilder(httpClient, serviceVersion, true).buildClient(); + + super.listDatasourceCredentialRunner(inputCredentialList -> { + final List ids = + inputCredentialList.stream() + .map(credential -> client.createDatasourceCredential(credential)) + .map(credential -> credential.getId()) + .collect(Collectors.toList()); + createdCredentialIdList.set(ids); + + List retrievedCredentialList = new ArrayList<>(); + PagedIterable credentialsIterable = client.listDatasourceCredentials(); + for (DatasourceCredentialEntity credential: credentialsIterable) { + retrievedCredentialList.add(credential); + if (retrievedCredentialList.size() >= inputCredentialList.size()) { + break; + } + } + assertEquals(inputCredentialList.size(), retrievedCredentialList.size()); + }); + } finally { + if (!CoreUtils.isNullOrEmpty(createdCredentialIdList.get())) { + createdCredentialIdList.get().forEach(credentialId -> client.deleteDatasourceCredential(credentialId)); + } + } + } +} diff --git a/sdk/metricsadvisor/azure-ai-metricsadvisor/src/test/java/com/azure/ai/metricsadvisor/DatasourceCredentialTestBase.java b/sdk/metricsadvisor/azure-ai-metricsadvisor/src/test/java/com/azure/ai/metricsadvisor/DatasourceCredentialTestBase.java new file mode 100644 index 0000000000000..96425ef1d8f44 --- /dev/null +++ b/sdk/metricsadvisor/azure-ai-metricsadvisor/src/test/java/com/azure/ai/metricsadvisor/DatasourceCredentialTestBase.java @@ -0,0 +1,142 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +package com.azure.ai.metricsadvisor; + +import com.azure.ai.metricsadvisor.administration.models.DatasourceDataLakeGen2SharedKey; +import com.azure.ai.metricsadvisor.administration.models.DatasourceAuthenticationType; +import com.azure.ai.metricsadvisor.administration.models.DatasourceCredentialEntity; +import com.azure.ai.metricsadvisor.administration.models.DatasourceServicePrincipal; +import com.azure.ai.metricsadvisor.administration.models.DatasourceServicePrincipalInKeyVault; +import com.azure.ai.metricsadvisor.administration.models.DatasourceSqlServerConnectionString; +import com.azure.core.http.HttpClient; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Test; + +import java.util.ArrayList; +import java.util.List; +import java.util.UUID; +import java.util.function.Consumer; + +import static com.azure.ai.metricsadvisor.TestUtils.AZURE_DATALAKEGEN2_ACCOUNT_KEY; +import static com.azure.ai.metricsadvisor.TestUtils.SQL_SERVER_CONNECTION_STRING; +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertNotNull; +import static org.junit.jupiter.api.Assertions.assertTrue; + +public abstract class DatasourceCredentialTestBase extends MetricsAdvisorAdministrationClientTestBase { + static final String SQL_CONNECTION_DATASOURCE_CRED_NAME_PREFIX = "java_create_data_source_cred_sql_con"; + static final String DATA_LAKE_GEN2_SHARED_KEY_DATASOURCE_CRED_NAME_PREFIX + = "java_create_data_source_cred_dlake_gen"; + static final String SP_DATASOURCE_CRED_NAME_PREFIX = "java_create_data_source_cred_sp"; + static final String SP_IN_KV_DATASOURCE_CRED_NAME_PREFIX = "java_create_data_source_cred_spkv"; + + @Test + abstract void createSqlConnectionString(HttpClient httpClient, MetricsAdvisorServiceVersion serviceVersion); + + @Test + abstract void createDataLakeGen2SharedKey(HttpClient httpClient, MetricsAdvisorServiceVersion serviceVersion); + + @Test + abstract void createServicePrincipal(HttpClient httpClient, MetricsAdvisorServiceVersion serviceVersion); + + @Test + abstract void createServicePrincipalInKV(HttpClient httpClient, MetricsAdvisorServiceVersion serviceVersion); + + @Test + abstract void testListDataSourceCredentials(HttpClient httpClient, MetricsAdvisorServiceVersion serviceVersion); + + void listDatasourceCredentialRunner(Consumer> testRunner) { + List list = new ArrayList<>(); + creatDatasourceCredentialRunner(datasource -> list.add(datasource), + DatasourceAuthenticationType.AZURE_SQL_CONNECTION_STRING); + creatDatasourceCredentialRunner(datasource -> list.add(datasource), + DatasourceAuthenticationType.DATA_LAKE_GEN2_SHARED_KEY); + testRunner.accept(list); + } + + void creatDatasourceCredentialRunner(Consumer testRunner, + DatasourceAuthenticationType credentialType) { + DatasourceCredentialEntity datasourceCredential; + if (credentialType == DatasourceAuthenticationType.AZURE_SQL_CONNECTION_STRING) { + final String name = SQL_CONNECTION_DATASOURCE_CRED_NAME_PREFIX + UUID.randomUUID(); + datasourceCredential = new DatasourceSqlServerConnectionString(name, SQL_SERVER_CONNECTION_STRING); + } else if (credentialType == DatasourceAuthenticationType.DATA_LAKE_GEN2_SHARED_KEY) { + final String name = DATA_LAKE_GEN2_SHARED_KEY_DATASOURCE_CRED_NAME_PREFIX + UUID.randomUUID(); + datasourceCredential = new DatasourceDataLakeGen2SharedKey(name, AZURE_DATALAKEGEN2_ACCOUNT_KEY); + } else if (credentialType == DatasourceAuthenticationType.SERVICE_PRINCIPAL) { + final String name = SP_DATASOURCE_CRED_NAME_PREFIX + UUID.randomUUID(); + final String cId = "e70248b2-bffa-11eb-8529-0242ac130003"; + final String tId = "45389ded-5e07-4e52-b225-4ae8f905afb5"; + final String mockSecr = "45389ded-5e07-4e52-b225-4ae8f905afb5"; + datasourceCredential = new DatasourceServicePrincipal(name, cId, tId, mockSecr); + } else if (credentialType == DatasourceAuthenticationType.SERVICE_PRINCIPAL_IN_KV) { + final StringBuilder kvEndpoint = new StringBuilder() + .append("https://") + .append(UUID.randomUUID()) + .append(".vault") + .append(".azure.net"); + final String name = SP_IN_KV_DATASOURCE_CRED_NAME_PREFIX + UUID.randomUUID(); + final String cId = "e70248b2-bffa-11eb-8529-0242ac130003"; + final String tId = "45389ded-5e07-4e52-b225-4ae8f905afb5"; + final String mockSecr = "45389ded-5e07-4e52-b225-4ae8f905afb5"; + + datasourceCredential = new DatasourceServicePrincipalInKeyVault() + .setName(name) + .setKeyVaultForDatasourceSecrets(kvEndpoint.toString(), cId, mockSecr) + .setTenantId(tId) + .setSecretNameForDatasourceClientId("DSClientID_1") + .setSecretNameForDatasourceClientSecret("DSClientSer_1"); + } else { + throw new IllegalStateException("Unexpected value for DataSourceCredentialType: " + credentialType); + } + testRunner.accept(datasourceCredential); + } + + void validateCredentialResult(DatasourceCredentialEntity expectedCredential, + DatasourceCredentialEntity actualCredential, + DatasourceAuthenticationType credentialType) { + assertNotNull(actualCredential.getId()); + assertNotNull(actualCredential.getName()); + + if (credentialType == DatasourceAuthenticationType.AZURE_SQL_CONNECTION_STRING) { + Assertions.assertTrue(actualCredential instanceof DatasourceSqlServerConnectionString); + assertTrue(actualCredential.getName().startsWith(SQL_CONNECTION_DATASOURCE_CRED_NAME_PREFIX)); + } else if (credentialType == DatasourceAuthenticationType.DATA_LAKE_GEN2_SHARED_KEY) { + Assertions.assertTrue(actualCredential instanceof DatasourceDataLakeGen2SharedKey); + assertTrue(actualCredential.getName().startsWith(DATA_LAKE_GEN2_SHARED_KEY_DATASOURCE_CRED_NAME_PREFIX)); + } else if (credentialType == DatasourceAuthenticationType.SERVICE_PRINCIPAL) { + Assertions.assertTrue(actualCredential instanceof DatasourceServicePrincipal); + assertTrue(actualCredential.getName().startsWith(SP_DATASOURCE_CRED_NAME_PREFIX)); + DatasourceServicePrincipal actualCredentialSP = (DatasourceServicePrincipal) actualCredential; + assertNotNull(actualCredentialSP.getClientId()); + assertNotNull(actualCredentialSP.getTenantId()); + assertEquals(((DatasourceServicePrincipal) expectedCredential).getClientId(), + actualCredentialSP.getClientId()); + assertEquals(((DatasourceServicePrincipal) expectedCredential).getTenantId(), + actualCredentialSP.getTenantId()); + } else if (credentialType == DatasourceAuthenticationType.SERVICE_PRINCIPAL_IN_KV) { + Assertions.assertTrue(actualCredential instanceof DatasourceServicePrincipalInKeyVault); + assertTrue(actualCredential.getName().startsWith(SP_IN_KV_DATASOURCE_CRED_NAME_PREFIX)); + DatasourceServicePrincipalInKeyVault actualCredentialSPInKV + = (DatasourceServicePrincipalInKeyVault) actualCredential; + assertNotNull(actualCredentialSPInKV.getKeyVaultEndpoint()); + assertNotNull(actualCredentialSPInKV.getKeyVaultClientId()); + assertNotNull(actualCredentialSPInKV.getTenantId()); + assertNotNull(actualCredentialSPInKV.getSecretNameForDatasourceClientId()); + assertNotNull(actualCredentialSPInKV.getSecretNameForDatasourceClientSecret()); + assertEquals(((DatasourceServicePrincipalInKeyVault) expectedCredential).getKeyVaultClientId(), + actualCredentialSPInKV.getKeyVaultClientId()); + assertEquals(((DatasourceServicePrincipalInKeyVault) expectedCredential).getTenantId(), + actualCredentialSPInKV.getTenantId()); + assertEquals(((DatasourceServicePrincipalInKeyVault) expectedCredential) + .getSecretNameForDatasourceClientId(), + actualCredentialSPInKV.getSecretNameForDatasourceClientId()); + assertEquals(((DatasourceServicePrincipalInKeyVault) expectedCredential) + .getSecretNameForDatasourceClientSecret(), + actualCredentialSPInKV.getSecretNameForDatasourceClientSecret()); + } else { + throw new IllegalStateException("Unexpected value for DataSourceCredentialType: " + credentialType); + } + } +} diff --git a/sdk/metricsadvisor/azure-ai-metricsadvisor/src/test/java/com/azure/ai/metricsadvisor/DetectionConfigurationAsyncTest.java b/sdk/metricsadvisor/azure-ai-metricsadvisor/src/test/java/com/azure/ai/metricsadvisor/DetectionConfigurationAsyncTest.java index 3d8b35b24f817..28a7d8e73fbf9 100644 --- a/sdk/metricsadvisor/azure-ai-metricsadvisor/src/test/java/com/azure/ai/metricsadvisor/DetectionConfigurationAsyncTest.java +++ b/sdk/metricsadvisor/azure-ai-metricsadvisor/src/test/java/com/azure/ai/metricsadvisor/DetectionConfigurationAsyncTest.java @@ -4,11 +4,10 @@ package com.azure.ai.metricsadvisor; import com.azure.ai.metricsadvisor.administration.MetricsAdvisorAdministrationAsyncClient; -import com.azure.ai.metricsadvisor.models.AnomalyDetectionConfiguration; -import com.azure.ai.metricsadvisor.models.DataFeed; -import com.azure.ai.metricsadvisor.models.DataFeedMetric; -import com.azure.ai.metricsadvisor.models.ListMetricAnomalyDetectionConfigsOptions; -import com.azure.ai.metricsadvisor.models.MetricsAdvisorServiceVersion; +import com.azure.ai.metricsadvisor.administration.models.AnomalyDetectionConfiguration; +import com.azure.ai.metricsadvisor.administration.models.DataFeed; +import com.azure.ai.metricsadvisor.administration.models.DataFeedMetric; +import com.azure.ai.metricsadvisor.administration.models.ListMetricAnomalyDetectionConfigsOptions; import com.azure.core.http.HttpClient; import com.azure.core.test.TestBase; import com.azure.core.util.CoreUtils; diff --git a/sdk/metricsadvisor/azure-ai-metricsadvisor/src/test/java/com/azure/ai/metricsadvisor/DetectionConfigurationTest.java b/sdk/metricsadvisor/azure-ai-metricsadvisor/src/test/java/com/azure/ai/metricsadvisor/DetectionConfigurationTest.java index 51847d8051748..0b47f27766ad2 100644 --- a/sdk/metricsadvisor/azure-ai-metricsadvisor/src/test/java/com/azure/ai/metricsadvisor/DetectionConfigurationTest.java +++ b/sdk/metricsadvisor/azure-ai-metricsadvisor/src/test/java/com/azure/ai/metricsadvisor/DetectionConfigurationTest.java @@ -4,11 +4,9 @@ package com.azure.ai.metricsadvisor; import com.azure.ai.metricsadvisor.administration.MetricsAdvisorAdministrationClient; -import com.azure.ai.metricsadvisor.models.AnomalyDetectionConfiguration; -import com.azure.ai.metricsadvisor.models.DataFeed; -import com.azure.ai.metricsadvisor.models.DataFeedMetric; -import com.azure.ai.metricsadvisor.models.ListMetricAnomalyDetectionConfigsOptions; -import com.azure.ai.metricsadvisor.models.MetricsAdvisorServiceVersion; +import com.azure.ai.metricsadvisor.administration.models.AnomalyDetectionConfiguration; +import com.azure.ai.metricsadvisor.administration.models.DataFeed; +import com.azure.ai.metricsadvisor.administration.models.DataFeedMetric; import com.azure.core.http.HttpClient; import com.azure.core.test.TestBase; import com.azure.core.util.CoreUtils; @@ -143,7 +141,7 @@ public void createDetectionConfigurationForMultipleSeriesAndGroup(HttpClient htt assertNotNull(configuration); id.set(configuration.getId()); - client.listMetricAnomalyDetectionConfigs(costMetricId, new ListMetricAnomalyDetectionConfigsOptions()) + client.listMetricAnomalyDetectionConfigs(costMetricId) .forEach(config -> Assertions.assertNotNull(config)); } finally { if (!CoreUtils.isNullOrEmpty(id.get())) { diff --git a/sdk/metricsadvisor/azure-ai-metricsadvisor/src/test/java/com/azure/ai/metricsadvisor/DetectionConfigurationTestBase.java b/sdk/metricsadvisor/azure-ai-metricsadvisor/src/test/java/com/azure/ai/metricsadvisor/DetectionConfigurationTestBase.java index 99c02102f7757..d55b1630877ed 100644 --- a/sdk/metricsadvisor/azure-ai-metricsadvisor/src/test/java/com/azure/ai/metricsadvisor/DetectionConfigurationTestBase.java +++ b/sdk/metricsadvisor/azure-ai-metricsadvisor/src/test/java/com/azure/ai/metricsadvisor/DetectionConfigurationTestBase.java @@ -4,26 +4,25 @@ package com.azure.ai.metricsadvisor; import com.azure.ai.metricsadvisor.administration.MetricsAdvisorAdministrationClient; -import com.azure.ai.metricsadvisor.models.AnomalyDetectionConfiguration; -import com.azure.ai.metricsadvisor.models.AnomalyDetectorDirection; -import com.azure.ai.metricsadvisor.models.ChangeThresholdCondition; -import com.azure.ai.metricsadvisor.models.DataFeed; -import com.azure.ai.metricsadvisor.models.DataFeedDimension; -import com.azure.ai.metricsadvisor.models.DataFeedGranularity; -import com.azure.ai.metricsadvisor.models.DataFeedGranularityType; -import com.azure.ai.metricsadvisor.models.DataFeedIngestionSettings; -import com.azure.ai.metricsadvisor.models.DataFeedSchema; -import com.azure.ai.metricsadvisor.models.DetectionConditionsOperator; +import com.azure.ai.metricsadvisor.administration.models.AnomalyDetectionConfiguration; +import com.azure.ai.metricsadvisor.administration.models.AnomalyDetectorDirection; +import com.azure.ai.metricsadvisor.administration.models.ChangeThresholdCondition; +import com.azure.ai.metricsadvisor.administration.models.DataFeed; +import com.azure.ai.metricsadvisor.administration.models.DataFeedDimension; +import com.azure.ai.metricsadvisor.administration.models.DataFeedGranularity; +import com.azure.ai.metricsadvisor.administration.models.DataFeedGranularityType; +import com.azure.ai.metricsadvisor.administration.models.DataFeedIngestionSettings; +import com.azure.ai.metricsadvisor.administration.models.DataFeedSchema; +import com.azure.ai.metricsadvisor.administration.models.DetectionConditionsOperator; import com.azure.ai.metricsadvisor.models.DimensionKey; -import com.azure.ai.metricsadvisor.models.HardThresholdCondition; -import com.azure.ai.metricsadvisor.models.DataFeedMetric; -import com.azure.ai.metricsadvisor.models.MetricSeriesGroupDetectionCondition; -import com.azure.ai.metricsadvisor.models.MetricWholeSeriesDetectionCondition; -import com.azure.ai.metricsadvisor.models.MetricSingleSeriesDetectionCondition; -import com.azure.ai.metricsadvisor.models.MetricsAdvisorServiceVersion; -import com.azure.ai.metricsadvisor.models.SQLServerDataFeedSource; -import com.azure.ai.metricsadvisor.models.SmartDetectionCondition; -import com.azure.ai.metricsadvisor.models.SuppressCondition; +import com.azure.ai.metricsadvisor.administration.models.HardThresholdCondition; +import com.azure.ai.metricsadvisor.administration.models.DataFeedMetric; +import com.azure.ai.metricsadvisor.administration.models.MetricSeriesGroupDetectionCondition; +import com.azure.ai.metricsadvisor.administration.models.MetricWholeSeriesDetectionCondition; +import com.azure.ai.metricsadvisor.administration.models.MetricSingleSeriesDetectionCondition; +import com.azure.ai.metricsadvisor.administration.models.SqlServerDataFeedSource; +import com.azure.ai.metricsadvisor.administration.models.SmartDetectionCondition; +import com.azure.ai.metricsadvisor.administration.models.SuppressCondition; import com.azure.core.http.HttpClient; import org.junit.jupiter.api.Assertions; @@ -789,7 +788,8 @@ protected DataFeed createDataFeed(HttpClient httpClient, MetricsAdvisorAdministrationClient client = getMetricsAdvisorAdministrationBuilder(httpClient, serviceVersion).buildClient(); - DataFeed dataFeed = new DataFeed().setSource(new SQLServerDataFeedSource(SQL_SERVER_CONNECTION_STRING, + DataFeed dataFeed = new DataFeed().setSource(SqlServerDataFeedSource.fromBasicCredential( + SQL_SERVER_CONNECTION_STRING, TEMPLATE_QUERY)); dataFeed.setSchema(new DataFeedSchema(Arrays.asList( new DataFeedMetric().setName("cost").setDisplayName("cost"), diff --git a/sdk/metricsadvisor/azure-ai-metricsadvisor/src/test/java/com/azure/ai/metricsadvisor/FeedbackAsyncTest.java b/sdk/metricsadvisor/azure-ai-metricsadvisor/src/test/java/com/azure/ai/metricsadvisor/FeedbackAsyncTest.java index 673671569a14a..f4e7e2121fb65 100644 --- a/sdk/metricsadvisor/azure-ai-metricsadvisor/src/test/java/com/azure/ai/metricsadvisor/FeedbackAsyncTest.java +++ b/sdk/metricsadvisor/azure-ai-metricsadvisor/src/test/java/com/azure/ai/metricsadvisor/FeedbackAsyncTest.java @@ -9,7 +9,6 @@ import com.azure.ai.metricsadvisor.models.ListMetricFeedbackFilter; import com.azure.ai.metricsadvisor.models.ListMetricFeedbackOptions; import com.azure.ai.metricsadvisor.models.MetricFeedback; -import com.azure.ai.metricsadvisor.models.MetricsAdvisorServiceVersion; import com.azure.core.http.HttpClient; import com.azure.core.test.TestBase; import com.azure.core.util.Context; @@ -69,7 +68,7 @@ void testListMetricFeedback(HttpClient httpClient, MetricsAdvisorServiceVersion List actualMetricFeedbackList = new ArrayList<>(); List expectedMetricFeedbackList = inputMetricFeedbackList.stream().map(metricFeedback -> - client.addFeeddback(METRIC_ID, metricFeedback) + client.addFeedback(METRIC_ID, metricFeedback) .block()) .collect(Collectors.toList()); @@ -161,7 +160,7 @@ void testListMetricFeedbackFilterByDimensionFilter(HttpClient httpClient, Metric // Arrange client = getMetricsAdvisorBuilder(httpClient, serviceVersion).buildAsyncClient(); creatMetricFeedbackRunner(inputMetricFeedback -> { - final MetricFeedback feedbackAdded = client.addFeeddback(METRIC_ID, inputMetricFeedback).block(); + final MetricFeedback feedbackAdded = client.addFeedback(METRIC_ID, inputMetricFeedback).block(); final OffsetDateTime firstFeedbackCreatedTime = feedbackAdded.getCreatedTime(); // Act & Assert @@ -216,7 +215,7 @@ void testListMetricFeedbackFilterStartTime(HttpClient httpClient, MetricsAdvisor // Arrange client = getMetricsAdvisorBuilder(httpClient, serviceVersion).buildAsyncClient(); creatMetricFeedbackRunner(inputMetricFeedback -> { - final MetricFeedback createdMetricFeedback = client.addFeeddback(METRIC_ID, inputMetricFeedback).block(); + final MetricFeedback createdMetricFeedback = client.addFeedback(METRIC_ID, inputMetricFeedback).block(); // Act & Assert StepVerifier.create(client.listFeedback(METRIC_ID, @@ -276,7 +275,7 @@ public void getMetricFeedbackValidId(HttpClient httpClient, MetricsAdvisorServic creatMetricFeedbackRunner(expectedMetricFeedback -> { // Act & Assert MetricFeedback createdMetricFeedback - = client.addFeeddback(METRIC_ID, expectedMetricFeedback).block(); + = client.addFeedback(METRIC_ID, expectedMetricFeedback).block(); // Act & Assert StepVerifier.create(client.getFeedbackWithResponse(createdMetricFeedback.getId())) .assertNext(metricFeedbackResponse -> { @@ -300,7 +299,7 @@ public void createCommentMetricFeedback(HttpClient httpClient, MetricsAdvisorSer creatMetricFeedbackRunner(expectedMetricFeedback -> // Act & Assert - StepVerifier.create(client.addFeeddback(METRIC_ID, expectedMetricFeedback)) + StepVerifier.create(client.addFeedback(METRIC_ID, expectedMetricFeedback)) .assertNext(createdMetricFeedback -> validateMetricFeedbackResult(expectedMetricFeedback, createdMetricFeedback, COMMENT)) .verifyComplete(), COMMENT); @@ -317,7 +316,7 @@ public void createAnomalyFeedback(HttpClient httpClient, MetricsAdvisorServiceVe creatMetricFeedbackRunner(expectedMetricFeedback -> // Act & Assert - StepVerifier.create(client.addFeeddback(METRIC_ID, expectedMetricFeedback)) + StepVerifier.create(client.addFeedback(METRIC_ID, expectedMetricFeedback)) .assertNext(createdMetricFeedback -> validateMetricFeedbackResult(expectedMetricFeedback, createdMetricFeedback, ANOMALY)) .verifyComplete(), ANOMALY); @@ -334,7 +333,7 @@ public void createPeriodMetricFeedback(HttpClient httpClient, MetricsAdvisorServ creatMetricFeedbackRunner(expectedMetricFeedback -> // Act & Assert - StepVerifier.create(client.addFeeddback(METRIC_ID, expectedMetricFeedback)) + StepVerifier.create(client.addFeedback(METRIC_ID, expectedMetricFeedback)) .assertNext(createdMetricFeedback -> validateMetricFeedbackResult(expectedMetricFeedback, createdMetricFeedback, PERIOD)) .verifyComplete(), PERIOD); @@ -350,7 +349,7 @@ public void createChangePointMetricFeedback(HttpClient httpClient, MetricsAdviso client = getMetricsAdvisorBuilder(httpClient, serviceVersion).buildAsyncClient(); creatMetricFeedbackRunner(expectedMetricFeedback -> // Act & Assert - StepVerifier.create(client.addFeeddback(METRIC_ID, expectedMetricFeedback)) + StepVerifier.create(client.addFeedback(METRIC_ID, expectedMetricFeedback)) .assertNext(createdMetricFeedback -> validateMetricFeedbackResult(expectedMetricFeedback, createdMetricFeedback, CHANGE_POINT)) .verifyComplete(), CHANGE_POINT); } diff --git a/sdk/metricsadvisor/azure-ai-metricsadvisor/src/test/java/com/azure/ai/metricsadvisor/FeedbackTest.java b/sdk/metricsadvisor/azure-ai-metricsadvisor/src/test/java/com/azure/ai/metricsadvisor/FeedbackTest.java index 3b43f04cf857e..c451a4adb6d78 100644 --- a/sdk/metricsadvisor/azure-ai-metricsadvisor/src/test/java/com/azure/ai/metricsadvisor/FeedbackTest.java +++ b/sdk/metricsadvisor/azure-ai-metricsadvisor/src/test/java/com/azure/ai/metricsadvisor/FeedbackTest.java @@ -9,7 +9,6 @@ import com.azure.ai.metricsadvisor.models.ListMetricFeedbackFilter; import com.azure.ai.metricsadvisor.models.ListMetricFeedbackOptions; import com.azure.ai.metricsadvisor.models.MetricFeedback; -import com.azure.ai.metricsadvisor.models.MetricsAdvisorServiceVersion; import com.azure.core.http.HttpClient; import com.azure.core.http.rest.PagedResponse; import com.azure.core.http.rest.Response; diff --git a/sdk/metricsadvisor/azure-ai-metricsadvisor/src/test/java/com/azure/ai/metricsadvisor/FeedbackTestBase.java b/sdk/metricsadvisor/azure-ai-metricsadvisor/src/test/java/com/azure/ai/metricsadvisor/FeedbackTestBase.java index a43b65d2376f7..797f341496708 100644 --- a/sdk/metricsadvisor/azure-ai-metricsadvisor/src/test/java/com/azure/ai/metricsadvisor/FeedbackTestBase.java +++ b/sdk/metricsadvisor/azure-ai-metricsadvisor/src/test/java/com/azure/ai/metricsadvisor/FeedbackTestBase.java @@ -12,7 +12,6 @@ import com.azure.ai.metricsadvisor.models.MetricCommentFeedback; import com.azure.ai.metricsadvisor.models.MetricFeedback; import com.azure.ai.metricsadvisor.models.MetricPeriodFeedback; -import com.azure.ai.metricsadvisor.models.MetricsAdvisorServiceVersion; import com.azure.ai.metricsadvisor.models.PeriodType; import com.azure.core.http.HttpClient; import com.azure.core.util.Configuration; diff --git a/sdk/metricsadvisor/azure-ai-metricsadvisor/src/test/java/com/azure/ai/metricsadvisor/IncidentDetectedTestBase.java b/sdk/metricsadvisor/azure-ai-metricsadvisor/src/test/java/com/azure/ai/metricsadvisor/IncidentDetectedTestBase.java index 6f0debd65512b..81cc245a4a522 100644 --- a/sdk/metricsadvisor/azure-ai-metricsadvisor/src/test/java/com/azure/ai/metricsadvisor/IncidentDetectedTestBase.java +++ b/sdk/metricsadvisor/azure-ai-metricsadvisor/src/test/java/com/azure/ai/metricsadvisor/IncidentDetectedTestBase.java @@ -5,7 +5,6 @@ import com.azure.ai.metricsadvisor.models.AnomalyIncident; import com.azure.ai.metricsadvisor.models.ListIncidentsDetectedOptions; -import com.azure.ai.metricsadvisor.models.MetricsAdvisorServiceVersion; import com.azure.core.http.HttpClient; import org.junit.jupiter.api.Assertions; import org.junit.jupiter.api.Test; diff --git a/sdk/metricsadvisor/azure-ai-metricsadvisor/src/test/java/com/azure/ai/metricsadvisor/IncidentForAlertTestBase.java b/sdk/metricsadvisor/azure-ai-metricsadvisor/src/test/java/com/azure/ai/metricsadvisor/IncidentForAlertTestBase.java index 7e081c958b46f..570e65fd487b8 100644 --- a/sdk/metricsadvisor/azure-ai-metricsadvisor/src/test/java/com/azure/ai/metricsadvisor/IncidentForAlertTestBase.java +++ b/sdk/metricsadvisor/azure-ai-metricsadvisor/src/test/java/com/azure/ai/metricsadvisor/IncidentForAlertTestBase.java @@ -5,7 +5,6 @@ import com.azure.ai.metricsadvisor.models.AnomalyIncident; import com.azure.ai.metricsadvisor.models.ListIncidentsAlertedOptions; -import com.azure.ai.metricsadvisor.models.MetricsAdvisorServiceVersion; import com.azure.core.http.HttpClient; import org.junit.jupiter.api.Assertions; diff --git a/sdk/metricsadvisor/azure-ai-metricsadvisor/src/test/java/com/azure/ai/metricsadvisor/MetricEnrichedSeriesDataAsyncTest.java b/sdk/metricsadvisor/azure-ai-metricsadvisor/src/test/java/com/azure/ai/metricsadvisor/MetricEnrichedSeriesDataAsyncTest.java index 18f34981fba3f..0776693b1a455 100644 --- a/sdk/metricsadvisor/azure-ai-metricsadvisor/src/test/java/com/azure/ai/metricsadvisor/MetricEnrichedSeriesDataAsyncTest.java +++ b/sdk/metricsadvisor/azure-ai-metricsadvisor/src/test/java/com/azure/ai/metricsadvisor/MetricEnrichedSeriesDataAsyncTest.java @@ -4,7 +4,6 @@ package com.azure.ai.metricsadvisor; import com.azure.ai.metricsadvisor.models.MetricEnrichedSeriesData; -import com.azure.ai.metricsadvisor.models.MetricsAdvisorServiceVersion; import com.azure.core.http.HttpClient; import com.azure.core.http.rest.PagedFlux; import com.azure.core.test.TestBase; @@ -40,8 +39,9 @@ public void getEnrichedSeriesData(HttpClient httpClient, MetricsAdvisorServiceVe MetricsAdvisorAsyncClient client = getMetricsAdvisorBuilder(httpClient, serviceVersion).buildAsyncClient(); PagedFlux enrichedDataFlux - = client.listMetricEnrichedSeriesData(GetEnrichedSeriesDataInput.INSTANCE.getSeriesKeys(), + = client.listMetricEnrichedSeriesData( GetEnrichedSeriesDataInput.INSTANCE.detectionConfigurationId, + GetEnrichedSeriesDataInput.INSTANCE.getSeriesKeys(), GetEnrichedSeriesDataInput.INSTANCE.startTime, GetEnrichedSeriesDataInput.INSTANCE.endTime); diff --git a/sdk/metricsadvisor/azure-ai-metricsadvisor/src/test/java/com/azure/ai/metricsadvisor/MetricEnrichedSeriesDataTest.java b/sdk/metricsadvisor/azure-ai-metricsadvisor/src/test/java/com/azure/ai/metricsadvisor/MetricEnrichedSeriesDataTest.java index ff2817d7164b3..bdb875d8c8188 100644 --- a/sdk/metricsadvisor/azure-ai-metricsadvisor/src/test/java/com/azure/ai/metricsadvisor/MetricEnrichedSeriesDataTest.java +++ b/sdk/metricsadvisor/azure-ai-metricsadvisor/src/test/java/com/azure/ai/metricsadvisor/MetricEnrichedSeriesDataTest.java @@ -4,7 +4,6 @@ package com.azure.ai.metricsadvisor; import com.azure.ai.metricsadvisor.models.MetricEnrichedSeriesData; -import com.azure.ai.metricsadvisor.models.MetricsAdvisorServiceVersion; import com.azure.core.http.HttpClient; import com.azure.core.http.rest.PagedIterable; import com.azure.core.test.TestBase; @@ -42,8 +41,9 @@ public void getEnrichedSeriesData(HttpClient httpClient, MetricsAdvisorServiceVe MetricsAdvisorClient client = getMetricsAdvisorBuilder(httpClient, serviceVersion).buildClient(); PagedIterable enrichedDataIterable - = client.listMetricEnrichedSeriesData(GetEnrichedSeriesDataInput.INSTANCE.getSeriesKeys(), + = client.listMetricEnrichedSeriesData( GetEnrichedSeriesDataInput.INSTANCE.detectionConfigurationId, + GetEnrichedSeriesDataInput.INSTANCE.getSeriesKeys(), GetEnrichedSeriesDataInput.INSTANCE.startTime, GetEnrichedSeriesDataInput.INSTANCE.endTime); diff --git a/sdk/metricsadvisor/azure-ai-metricsadvisor/src/test/java/com/azure/ai/metricsadvisor/MetricEnrichedSeriesDataTestBase.java b/sdk/metricsadvisor/azure-ai-metricsadvisor/src/test/java/com/azure/ai/metricsadvisor/MetricEnrichedSeriesDataTestBase.java index c1471723accff..e2d033356ba91 100644 --- a/sdk/metricsadvisor/azure-ai-metricsadvisor/src/test/java/com/azure/ai/metricsadvisor/MetricEnrichedSeriesDataTestBase.java +++ b/sdk/metricsadvisor/azure-ai-metricsadvisor/src/test/java/com/azure/ai/metricsadvisor/MetricEnrichedSeriesDataTestBase.java @@ -5,7 +5,6 @@ import com.azure.ai.metricsadvisor.models.DimensionKey; import com.azure.ai.metricsadvisor.models.MetricEnrichedSeriesData; -import com.azure.ai.metricsadvisor.models.MetricsAdvisorServiceVersion; import com.azure.core.http.HttpClient; import org.junit.jupiter.api.Assertions; diff --git a/sdk/metricsadvisor/azure-ai-metricsadvisor/src/test/java/com/azure/ai/metricsadvisor/MetricsAdvisorAdminClientBuilderTest.java b/sdk/metricsadvisor/azure-ai-metricsadvisor/src/test/java/com/azure/ai/metricsadvisor/MetricsAdvisorAdminClientBuilderTest.java index 29fc0c5dc06bd..522ea50475f72 100644 --- a/sdk/metricsadvisor/azure-ai-metricsadvisor/src/test/java/com/azure/ai/metricsadvisor/MetricsAdvisorAdminClientBuilderTest.java +++ b/sdk/metricsadvisor/azure-ai-metricsadvisor/src/test/java/com/azure/ai/metricsadvisor/MetricsAdvisorAdminClientBuilderTest.java @@ -5,7 +5,6 @@ import com.azure.ai.metricsadvisor.administration.MetricsAdvisorAdministrationClientBuilder; import com.azure.ai.metricsadvisor.models.MetricsAdvisorKeyCredential; -import com.azure.ai.metricsadvisor.models.MetricsAdvisorServiceVersion; import com.azure.core.http.HttpClient; import com.azure.core.http.policy.FixedDelay; import com.azure.core.http.policy.HttpLogDetailLevel; diff --git a/sdk/metricsadvisor/azure-ai-metricsadvisor/src/test/java/com/azure/ai/metricsadvisor/MetricsAdvisorAdministrationClientTestBase.java b/sdk/metricsadvisor/azure-ai-metricsadvisor/src/test/java/com/azure/ai/metricsadvisor/MetricsAdvisorAdministrationClientTestBase.java index 737ffb7c227a7..423f977924e1c 100644 --- a/sdk/metricsadvisor/azure-ai-metricsadvisor/src/test/java/com/azure/ai/metricsadvisor/MetricsAdvisorAdministrationClientTestBase.java +++ b/sdk/metricsadvisor/azure-ai-metricsadvisor/src/test/java/com/azure/ai/metricsadvisor/MetricsAdvisorAdministrationClientTestBase.java @@ -5,7 +5,6 @@ import com.azure.ai.metricsadvisor.administration.MetricsAdvisorAdministrationClientBuilder; import com.azure.ai.metricsadvisor.models.MetricsAdvisorKeyCredential; -import com.azure.ai.metricsadvisor.models.MetricsAdvisorServiceVersion; import com.azure.core.http.HttpClient; import com.azure.core.http.policy.HttpLogDetailLevel; import com.azure.core.http.policy.HttpLogOptions; @@ -24,6 +23,12 @@ protected void beforeTest() { MetricsAdvisorAdministrationClientBuilder getMetricsAdvisorAdministrationBuilder(HttpClient httpClient, MetricsAdvisorServiceVersion serviceVersion) { + return getMetricsAdvisorAdministrationBuilder(httpClient, serviceVersion, false); + } + + MetricsAdvisorAdministrationClientBuilder getMetricsAdvisorAdministrationBuilder(HttpClient httpClient, + MetricsAdvisorServiceVersion serviceVersion, + boolean useKeyCredential) { MetricsAdvisorAdministrationClientBuilder builder = new MetricsAdvisorAdministrationClientBuilder() .endpoint(getEndpoint()) .httpClient(httpClient == null ? interceptorManager.getPlaybackClient() : httpClient) @@ -34,7 +39,13 @@ MetricsAdvisorAdministrationClientBuilder getMetricsAdvisorAdministrationBuilder if (getTestMode() == TestMode.PLAYBACK) { builder.credential(new MetricsAdvisorKeyCredential("subscription_key", "api_key")); } else { - builder.credential(new DefaultAzureCredentialBuilder().build()); + if (useKeyCredential) { + builder.credential(new MetricsAdvisorKeyCredential( + Configuration.getGlobalConfiguration().get("AZURE_METRICS_ADVISOR_SUBSCRIPTION_KEY"), + Configuration.getGlobalConfiguration().get("AZURE_METRICS_ADVISOR_API_KEY"))); + } else { + builder.credential(new DefaultAzureCredentialBuilder().build()); + } } return builder; } diff --git a/sdk/metricsadvisor/azure-ai-metricsadvisor/src/test/java/com/azure/ai/metricsadvisor/MetricsAdvisorClientBuilderTest.java b/sdk/metricsadvisor/azure-ai-metricsadvisor/src/test/java/com/azure/ai/metricsadvisor/MetricsAdvisorClientBuilderTest.java index ba4422553e5e6..5701fda0c0993 100644 --- a/sdk/metricsadvisor/azure-ai-metricsadvisor/src/test/java/com/azure/ai/metricsadvisor/MetricsAdvisorClientBuilderTest.java +++ b/sdk/metricsadvisor/azure-ai-metricsadvisor/src/test/java/com/azure/ai/metricsadvisor/MetricsAdvisorClientBuilderTest.java @@ -5,7 +5,6 @@ import com.azure.ai.metricsadvisor.models.ListMetricFeedbackOptions; import com.azure.ai.metricsadvisor.models.MetricsAdvisorKeyCredential; -import com.azure.ai.metricsadvisor.models.MetricsAdvisorServiceVersion; import com.azure.core.http.HttpClient; import com.azure.core.http.policy.FixedDelay; import com.azure.core.http.policy.HttpLogDetailLevel; diff --git a/sdk/metricsadvisor/azure-ai-metricsadvisor/src/test/java/com/azure/ai/metricsadvisor/MetricsAdvisorClientTestBase.java b/sdk/metricsadvisor/azure-ai-metricsadvisor/src/test/java/com/azure/ai/metricsadvisor/MetricsAdvisorClientTestBase.java index 87927f0d9124c..20e6ecce67231 100644 --- a/sdk/metricsadvisor/azure-ai-metricsadvisor/src/test/java/com/azure/ai/metricsadvisor/MetricsAdvisorClientTestBase.java +++ b/sdk/metricsadvisor/azure-ai-metricsadvisor/src/test/java/com/azure/ai/metricsadvisor/MetricsAdvisorClientTestBase.java @@ -4,7 +4,6 @@ package com.azure.ai.metricsadvisor; import com.azure.ai.metricsadvisor.models.MetricsAdvisorKeyCredential; -import com.azure.ai.metricsadvisor.models.MetricsAdvisorServiceVersion; import com.azure.core.http.HttpClient; import com.azure.core.http.policy.HttpLogDetailLevel; import com.azure.core.http.policy.HttpLogOptions; diff --git a/sdk/metricsadvisor/azure-ai-metricsadvisor/src/test/java/com/azure/ai/metricsadvisor/MetricsSeriesAsyncTest.java b/sdk/metricsadvisor/azure-ai-metricsadvisor/src/test/java/com/azure/ai/metricsadvisor/MetricsSeriesAsyncTest.java index 9b2d8e62fd760..8c29273badaec 100644 --- a/sdk/metricsadvisor/azure-ai-metricsadvisor/src/test/java/com/azure/ai/metricsadvisor/MetricsSeriesAsyncTest.java +++ b/sdk/metricsadvisor/azure-ai-metricsadvisor/src/test/java/com/azure/ai/metricsadvisor/MetricsSeriesAsyncTest.java @@ -8,7 +8,6 @@ import com.azure.ai.metricsadvisor.models.ListMetricDimensionValuesOptions; import com.azure.ai.metricsadvisor.models.ListMetricSeriesDefinitionOptions; import com.azure.ai.metricsadvisor.models.MetricSeriesDefinition; -import com.azure.ai.metricsadvisor.models.MetricsAdvisorServiceVersion; import com.azure.core.http.HttpClient; import org.junit.jupiter.api.AfterAll; import org.junit.jupiter.api.Assertions; diff --git a/sdk/metricsadvisor/azure-ai-metricsadvisor/src/test/java/com/azure/ai/metricsadvisor/MetricsSeriesTest.java b/sdk/metricsadvisor/azure-ai-metricsadvisor/src/test/java/com/azure/ai/metricsadvisor/MetricsSeriesTest.java index b2dc2c0011528..f90fc4cbf9a62 100644 --- a/sdk/metricsadvisor/azure-ai-metricsadvisor/src/test/java/com/azure/ai/metricsadvisor/MetricsSeriesTest.java +++ b/sdk/metricsadvisor/azure-ai-metricsadvisor/src/test/java/com/azure/ai/metricsadvisor/MetricsSeriesTest.java @@ -8,7 +8,6 @@ import com.azure.ai.metricsadvisor.models.ListMetricDimensionValuesOptions; import com.azure.ai.metricsadvisor.models.ListMetricSeriesDefinitionOptions; import com.azure.ai.metricsadvisor.models.MetricSeriesDefinition; -import com.azure.ai.metricsadvisor.models.MetricsAdvisorServiceVersion; import com.azure.core.http.HttpClient; import com.azure.core.util.Context; import org.junit.jupiter.api.AfterAll; diff --git a/sdk/metricsadvisor/azure-ai-metricsadvisor/src/test/java/com/azure/ai/metricsadvisor/NotificationHookAsyncTest.java b/sdk/metricsadvisor/azure-ai-metricsadvisor/src/test/java/com/azure/ai/metricsadvisor/NotificationHookAsyncTest.java index 964702a1fee50..5d37ad9e2c85d 100644 --- a/sdk/metricsadvisor/azure-ai-metricsadvisor/src/test/java/com/azure/ai/metricsadvisor/NotificationHookAsyncTest.java +++ b/sdk/metricsadvisor/azure-ai-metricsadvisor/src/test/java/com/azure/ai/metricsadvisor/NotificationHookAsyncTest.java @@ -4,9 +4,8 @@ package com.azure.ai.metricsadvisor; import com.azure.ai.metricsadvisor.administration.MetricsAdvisorAdministrationAsyncClient; -import com.azure.ai.metricsadvisor.models.NotificationHook; -import com.azure.ai.metricsadvisor.models.ListHookOptions; -import com.azure.ai.metricsadvisor.models.MetricsAdvisorServiceVersion; +import com.azure.ai.metricsadvisor.administration.models.NotificationHook; +import com.azure.ai.metricsadvisor.administration.models.ListHookOptions; import com.azure.core.http.HttpClient; import com.azure.core.http.rest.PagedResponse; import com.azure.core.test.TestBase; diff --git a/sdk/metricsadvisor/azure-ai-metricsadvisor/src/test/java/com/azure/ai/metricsadvisor/NotificationHookTest.java b/sdk/metricsadvisor/azure-ai-metricsadvisor/src/test/java/com/azure/ai/metricsadvisor/NotificationHookTest.java index f50ef0f9fe296..78add9251e18a 100644 --- a/sdk/metricsadvisor/azure-ai-metricsadvisor/src/test/java/com/azure/ai/metricsadvisor/NotificationHookTest.java +++ b/sdk/metricsadvisor/azure-ai-metricsadvisor/src/test/java/com/azure/ai/metricsadvisor/NotificationHookTest.java @@ -4,9 +4,8 @@ package com.azure.ai.metricsadvisor; import com.azure.ai.metricsadvisor.administration.MetricsAdvisorAdministrationClient; -import com.azure.ai.metricsadvisor.models.NotificationHook; -import com.azure.ai.metricsadvisor.models.ListHookOptions; -import com.azure.ai.metricsadvisor.models.MetricsAdvisorServiceVersion; +import com.azure.ai.metricsadvisor.administration.models.NotificationHook; +import com.azure.ai.metricsadvisor.administration.models.ListHookOptions; import com.azure.core.http.HttpClient; import com.azure.core.http.rest.PagedResponse; import com.azure.core.util.Context; diff --git a/sdk/metricsadvisor/azure-ai-metricsadvisor/src/test/java/com/azure/ai/metricsadvisor/NotificationHookTestBase.java b/sdk/metricsadvisor/azure-ai-metricsadvisor/src/test/java/com/azure/ai/metricsadvisor/NotificationHookTestBase.java index 51cfb693b37e8..ad2a19f7407fa 100644 --- a/sdk/metricsadvisor/azure-ai-metricsadvisor/src/test/java/com/azure/ai/metricsadvisor/NotificationHookTestBase.java +++ b/sdk/metricsadvisor/azure-ai-metricsadvisor/src/test/java/com/azure/ai/metricsadvisor/NotificationHookTestBase.java @@ -3,10 +3,9 @@ package com.azure.ai.metricsadvisor; -import com.azure.ai.metricsadvisor.models.EmailNotificationHook; -import com.azure.ai.metricsadvisor.models.NotificationHook; -import com.azure.ai.metricsadvisor.models.MetricsAdvisorServiceVersion; -import com.azure.ai.metricsadvisor.models.WebNotificationHook; +import com.azure.ai.metricsadvisor.administration.models.EmailNotificationHook; +import com.azure.ai.metricsadvisor.administration.models.NotificationHook; +import com.azure.ai.metricsadvisor.administration.models.WebNotificationHook; import com.azure.core.http.HttpClient; import com.azure.core.http.HttpHeaders; import com.azure.core.http.rest.PagedResponse; diff --git a/sdk/metricsadvisor/azure-ai-metricsadvisor/src/test/java/com/azure/ai/metricsadvisor/TestUtils.java b/sdk/metricsadvisor/azure-ai-metricsadvisor/src/test/java/com/azure/ai/metricsadvisor/TestUtils.java index 0b6d510868b06..8ac83099adf8b 100644 --- a/sdk/metricsadvisor/azure-ai-metricsadvisor/src/test/java/com/azure/ai/metricsadvisor/TestUtils.java +++ b/sdk/metricsadvisor/azure-ai-metricsadvisor/src/test/java/com/azure/ai/metricsadvisor/TestUtils.java @@ -3,16 +3,15 @@ package com.azure.ai.metricsadvisor; -import com.azure.ai.metricsadvisor.models.AzureBlobDataFeedSource; -import com.azure.ai.metricsadvisor.models.DataFeed; -import com.azure.ai.metricsadvisor.models.DataFeedDimension; -import com.azure.ai.metricsadvisor.models.DataFeedGranularity; -import com.azure.ai.metricsadvisor.models.DataFeedGranularityType; -import com.azure.ai.metricsadvisor.models.DataFeedIngestionSettings; -import com.azure.ai.metricsadvisor.models.DataFeedMetric; -import com.azure.ai.metricsadvisor.models.DataFeedSchema; -import com.azure.ai.metricsadvisor.models.MetricsAdvisorServiceVersion; -import com.azure.ai.metricsadvisor.models.SQLServerDataFeedSource; +import com.azure.ai.metricsadvisor.administration.models.AzureBlobDataFeedSource; +import com.azure.ai.metricsadvisor.administration.models.DataFeed; +import com.azure.ai.metricsadvisor.administration.models.DataFeedDimension; +import com.azure.ai.metricsadvisor.administration.models.DataFeedGranularity; +import com.azure.ai.metricsadvisor.administration.models.DataFeedGranularityType; +import com.azure.ai.metricsadvisor.administration.models.DataFeedIngestionSettings; +import com.azure.ai.metricsadvisor.administration.models.DataFeedMetric; +import com.azure.ai.metricsadvisor.administration.models.DataFeedSchema; +import com.azure.ai.metricsadvisor.administration.models.SqlServerDataFeedSource; import com.azure.core.http.HttpClient; import com.azure.core.util.Configuration; import com.azure.core.util.CoreUtils; @@ -53,6 +52,8 @@ public final class TestUtils { + "let endtime=starttime + gran; requests | where timestamp >= starttime and timestamp < endtime " + "| summarize request_count = count(), duration_avg_ms = avg(duration), duration_95th_ms = percentile" + "(duration, 95), duration_max_ms = max(duration) by resultCode"; + static final String LOG_ANALYTICS_QUERY = "where StartTime >=datetime(@StartTime) and EndTime =datetime(@StartTime) and EndTime =datetime(@StartTime) and EndTime = StartDateTime and Timestamp < EndDateTime\"},\"authenticationType\":\"Basic\"}", + "Date" : "Wed, 02 Jun 2021 00:26:06 GMT", + "Content-Type" : "application/json; charset=utf-8" + }, + "Exception" : null + }, { + "Method" : "PATCH", + "Uri" : "https://REDACTED.cognitiveservices.azure.com/metricsadvisor/v1.0/dataFeeds/cd8a939e-95e9-4c09-8c54-f7cf0057b7ea", + "Headers" : { + "User-Agent" : "azsdk-java-azure-ai-metricsadvisor/1.0.0-beta.4 (1.8.0_221; Mac OS X; 10.16)", + "x-ms-client-request-id" : "9efbfdee-c6ac-48d8-8736-0b027436891d", + "Content-Type" : "application/merge-patch+json" + }, + "Response" : { + "x-request-id" : "be63dad3-34bb-486c-bd80-36179f6be4f2", + "content-length" : "1343", + "x-envoy-upstream-service-time" : "6028", + "Strict-Transport-Security" : "max-age=31536000; includeSubDomains; preload", + "x-content-type-options" : "nosniff", + "apim-request-id" : "be63dad3-34bb-486c-bd80-36179f6be4f2", + "retry-after" : "0", + "StatusCode" : "200", + "Body" : "{\"dataFeedId\":\"cd8a939e-95e9-4c09-8c54-f7cf0057b7ea\",\"dataFeedName\":\"java_create_data_feed_test_sample58e92a8c-313b-46b3-8a17-87026ff74d0d\",\"metrics\":[{\"metricId\":\"377ddcf3-d780-4873-8eda-f232f877070c\",\"metricName\":\"cost\",\"metricDisplayName\":\"cost\",\"metricDescription\":\"\"},{\"metricId\":\"3b089a71-8427-4bb5-ad0c-a84872834026\",\"metricName\":\"revenue\",\"metricDisplayName\":\"revenue\",\"metricDescription\":\"\"}],\"dimension\":[{\"dimensionName\":\"category\",\"dimensionDisplayName\":\"category\"},{\"dimensionName\":\"city\",\"dimensionDisplayName\":\"city\"}],\"dataStartFrom\":\"2019-10-01T00:00:00Z\",\"dataSourceType\":\"AzureDataExplorer\",\"timestampColumn\":\"\",\"startOffsetInSeconds\":0,\"maxQueryPerMinute\":30.0,\"granularityName\":\"Daily\",\"needRollup\":\"NoRollup\",\"fillMissingPointType\":\"PreviousValue\",\"fillMissingPointValue\":0.0,\"rollUpMethod\":\"None\",\"dataFeedDescription\":\"\",\"stopRetryAfterInSeconds\":-1,\"minRetryIntervalInSeconds\":-1,\"maxConcurrency\":0,\"viewMode\":\"Private\",\"admins\":[\"kaghiya@microsoft.com\"],\"viewers\":[],\"creator\":\"kaghiya@microsoft.com\",\"status\":\"Active\",\"createdTime\":\"2021-06-02T00:26:05Z\",\"isAdmin\":true,\"actionLinkTemplate\":\"\",\"dataSourceParameter\":{\"query\":\"let StartDateTime = datetime(@StartTime);let EndDateTime = StartDateTime + 1d;adsample| where Timestamp >= StartDateTime and Timestamp < EndDateTime\"},\"authenticationType\":\"ManagedIdentity\"}", + "Date" : "Wed, 02 Jun 2021 00:26:12 GMT", + "Content-Type" : "application/json; charset=utf-8" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://REDACTED.cognitiveservices.azure.com/metricsadvisor/v1.0/dataFeeds/cd8a939e-95e9-4c09-8c54-f7cf0057b7ea", + "Headers" : { + "User-Agent" : "azsdk-java-azure-ai-metricsadvisor/1.0.0-beta.4 (1.8.0_221; Mac OS X; 10.16)", + "x-ms-client-request-id" : "e2494194-91bc-45f2-b7a2-493fcb7dd6cd" + }, + "Response" : { + "x-request-id" : "44897a47-805c-42be-9c52-443ca323e0d0", + "content-length" : "1343", + "x-envoy-upstream-service-time" : "305", + "Strict-Transport-Security" : "max-age=31536000; includeSubDomains; preload", + "x-content-type-options" : "nosniff", + "apim-request-id" : "44897a47-805c-42be-9c52-443ca323e0d0", + "retry-after" : "0", + "StatusCode" : "200", + "Body" : "{\"dataFeedId\":\"cd8a939e-95e9-4c09-8c54-f7cf0057b7ea\",\"dataFeedName\":\"java_create_data_feed_test_sample58e92a8c-313b-46b3-8a17-87026ff74d0d\",\"metrics\":[{\"metricId\":\"377ddcf3-d780-4873-8eda-f232f877070c\",\"metricName\":\"cost\",\"metricDisplayName\":\"cost\",\"metricDescription\":\"\"},{\"metricId\":\"3b089a71-8427-4bb5-ad0c-a84872834026\",\"metricName\":\"revenue\",\"metricDisplayName\":\"revenue\",\"metricDescription\":\"\"}],\"dimension\":[{\"dimensionName\":\"category\",\"dimensionDisplayName\":\"category\"},{\"dimensionName\":\"city\",\"dimensionDisplayName\":\"city\"}],\"dataStartFrom\":\"2019-10-01T00:00:00Z\",\"dataSourceType\":\"AzureDataExplorer\",\"timestampColumn\":\"\",\"startOffsetInSeconds\":0,\"maxQueryPerMinute\":30.0,\"granularityName\":\"Daily\",\"needRollup\":\"NoRollup\",\"fillMissingPointType\":\"PreviousValue\",\"fillMissingPointValue\":0.0,\"rollUpMethod\":\"None\",\"dataFeedDescription\":\"\",\"stopRetryAfterInSeconds\":-1,\"minRetryIntervalInSeconds\":-1,\"maxConcurrency\":0,\"viewMode\":\"Private\",\"admins\":[\"kaghiya@microsoft.com\"],\"viewers\":[],\"creator\":\"kaghiya@microsoft.com\",\"status\":\"Active\",\"createdTime\":\"2021-06-02T00:26:05Z\",\"isAdmin\":true,\"actionLinkTemplate\":\"\",\"dataSourceParameter\":{\"query\":\"let StartDateTime = datetime(@StartTime);let EndDateTime = StartDateTime + 1d;adsample| where Timestamp >= StartDateTime and Timestamp < EndDateTime\"},\"authenticationType\":\"ManagedIdentity\"}", + "Date" : "Wed, 02 Jun 2021 00:26:12 GMT", + "Content-Type" : "application/json; charset=utf-8" + }, + "Exception" : null + }, { + "Method" : "POST", + "Uri" : "https://REDACTED.cognitiveservices.azure.com/metricsadvisor/v1.0/credentials", + "Headers" : { + "User-Agent" : "azsdk-java-azure-ai-metricsadvisor/1.0.0-beta.4 (1.8.0_221; Mac OS X; 10.16)", + "x-ms-client-request-id" : "62a6d8e1-c029-4eb6-bb70-f8e80a359d8e", + "Content-Type" : "application/json" + }, + "Response" : { + "x-request-id" : "7878489d-7966-46fc-b612-07a460458d19", + "content-length" : "0", + "x-envoy-upstream-service-time" : "481", + "Strict-Transport-Security" : "max-age=31536000; includeSubDomains; preload", + "x-content-type-options" : "nosniff", + "apim-request-id" : "7878489d-7966-46fc-b612-07a460458d19", + "retry-after" : "0", + "StatusCode" : "201", + "Date" : "Wed, 02 Jun 2021 00:26:13 GMT", + "Location" : "https://js-metrics-advisor.cognitiveservices.azure.com/metricsadvisor/v1.0/credentials/eca55e2d-7a27-45aa-946e-811242d1e389" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://REDACTED.cognitiveservices.azure.com/metricsadvisor/v1.0/credentials/eca55e2d-7a27-45aa-946e-811242d1e389", + "Headers" : { + "User-Agent" : "azsdk-java-azure-ai-metricsadvisor/1.0.0-beta.4 (1.8.0_221; Mac OS X; 10.16)", + "x-ms-client-request-id" : "3a768649-51e4-4000-a688-37d89eb5b170" + }, + "Response" : { + "x-request-id" : "bb547261-6a5c-4217-98c4-2eeb7023741e", + "content-length" : "360", + "x-envoy-upstream-service-time" : "109", + "Strict-Transport-Security" : "max-age=31536000; includeSubDomains; preload", + "x-content-type-options" : "nosniff", + "apim-request-id" : "bb547261-6a5c-4217-98c4-2eeb7023741e", + "retry-after" : "0", + "StatusCode" : "200", + "Body" : "{\"dataSourceCredentialId\":\"eca55e2d-7a27-45aa-946e-811242d1e389\",\"dataSourceCredentialName\":\"java_create_data_source_cred_sp48fd712e-3a7e-498f-9e58-480d4c582cbb\",\"dataSourceCredentialDescription\":\"\",\"dataSourceCredentialType\":\"ServicePrincipal\",\"parameters\":{\"clientId\":\"e70248b2-bffa-11eb-8529-0242ac130003\",\"tenantId\":\"45389ded-5e07-4e52-b225-4ae8f905afb5\"}}", + "Date" : "Wed, 02 Jun 2021 00:26:13 GMT", + "Content-Type" : "application/json; charset=utf-8" + }, + "Exception" : null + }, { + "Method" : "PATCH", + "Uri" : "https://REDACTED.cognitiveservices.azure.com/metricsadvisor/v1.0/dataFeeds/cd8a939e-95e9-4c09-8c54-f7cf0057b7ea", + "Headers" : { + "User-Agent" : "azsdk-java-azure-ai-metricsadvisor/1.0.0-beta.4 (1.8.0_221; Mac OS X; 10.16)", + "x-ms-client-request-id" : "11d8932a-db25-4938-9324-18e299b7a901", + "Content-Type" : "application/merge-patch+json" + }, + "Response" : { + "x-request-id" : "a92597a0-a702-4ba9-b1b7-ba0112ddf029", + "content-length" : "1398", + "x-envoy-upstream-service-time" : "997", + "Strict-Transport-Security" : "max-age=31536000; includeSubDomains; preload", + "x-content-type-options" : "nosniff", + "apim-request-id" : "a92597a0-a702-4ba9-b1b7-ba0112ddf029", + "retry-after" : "0", + "StatusCode" : "200", + "Body" : "{\"dataFeedId\":\"cd8a939e-95e9-4c09-8c54-f7cf0057b7ea\",\"dataFeedName\":\"java_create_data_feed_test_sample58e92a8c-313b-46b3-8a17-87026ff74d0d\",\"metrics\":[{\"metricId\":\"377ddcf3-d780-4873-8eda-f232f877070c\",\"metricName\":\"cost\",\"metricDisplayName\":\"cost\",\"metricDescription\":\"\"},{\"metricId\":\"3b089a71-8427-4bb5-ad0c-a84872834026\",\"metricName\":\"revenue\",\"metricDisplayName\":\"revenue\",\"metricDescription\":\"\"}],\"dimension\":[{\"dimensionName\":\"category\",\"dimensionDisplayName\":\"category\"},{\"dimensionName\":\"city\",\"dimensionDisplayName\":\"city\"}],\"dataStartFrom\":\"2019-10-01T00:00:00Z\",\"dataSourceType\":\"AzureDataExplorer\",\"timestampColumn\":\"\",\"startOffsetInSeconds\":0,\"maxQueryPerMinute\":30.0,\"granularityName\":\"Daily\",\"needRollup\":\"NoRollup\",\"fillMissingPointType\":\"PreviousValue\",\"fillMissingPointValue\":0.0,\"rollUpMethod\":\"None\",\"dataFeedDescription\":\"\",\"stopRetryAfterInSeconds\":-1,\"minRetryIntervalInSeconds\":-1,\"maxConcurrency\":0,\"viewMode\":\"Private\",\"admins\":[\"kaghiya@microsoft.com\"],\"viewers\":[],\"creator\":\"kaghiya@microsoft.com\",\"status\":\"Active\",\"createdTime\":\"2021-06-02T00:26:05Z\",\"isAdmin\":true,\"actionLinkTemplate\":\"\",\"dataSourceParameter\":{\"query\":\"let StartDateTime = datetime(@StartTime);let EndDateTime = StartDateTime + 1d;adsample| where Timestamp >= StartDateTime and Timestamp < EndDateTime\"},\"authenticationType\":\"ServicePrincipal\",\"credentialId\":\"eca55e2d-7a27-45aa-946e-811242d1e389\"}", + "Date" : "Wed, 02 Jun 2021 00:26:14 GMT", + "Content-Type" : "application/json; charset=utf-8" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://REDACTED.cognitiveservices.azure.com/metricsadvisor/v1.0/dataFeeds/cd8a939e-95e9-4c09-8c54-f7cf0057b7ea", + "Headers" : { + "User-Agent" : "azsdk-java-azure-ai-metricsadvisor/1.0.0-beta.4 (1.8.0_221; Mac OS X; 10.16)", + "x-ms-client-request-id" : "4eaa4eb8-bbf0-4066-b75e-fce24147f17e" + }, + "Response" : { + "x-request-id" : "362bbdfe-ea9b-4fc3-93a6-269eefb22173", + "content-length" : "1398", + "x-envoy-upstream-service-time" : "279", + "Strict-Transport-Security" : "max-age=31536000; includeSubDomains; preload", + "x-content-type-options" : "nosniff", + "apim-request-id" : "362bbdfe-ea9b-4fc3-93a6-269eefb22173", + "retry-after" : "0", + "StatusCode" : "200", + "Body" : "{\"dataFeedId\":\"cd8a939e-95e9-4c09-8c54-f7cf0057b7ea\",\"dataFeedName\":\"java_create_data_feed_test_sample58e92a8c-313b-46b3-8a17-87026ff74d0d\",\"metrics\":[{\"metricId\":\"377ddcf3-d780-4873-8eda-f232f877070c\",\"metricName\":\"cost\",\"metricDisplayName\":\"cost\",\"metricDescription\":\"\"},{\"metricId\":\"3b089a71-8427-4bb5-ad0c-a84872834026\",\"metricName\":\"revenue\",\"metricDisplayName\":\"revenue\",\"metricDescription\":\"\"}],\"dimension\":[{\"dimensionName\":\"category\",\"dimensionDisplayName\":\"category\"},{\"dimensionName\":\"city\",\"dimensionDisplayName\":\"city\"}],\"dataStartFrom\":\"2019-10-01T00:00:00Z\",\"dataSourceType\":\"AzureDataExplorer\",\"timestampColumn\":\"\",\"startOffsetInSeconds\":0,\"maxQueryPerMinute\":30.0,\"granularityName\":\"Daily\",\"needRollup\":\"NoRollup\",\"fillMissingPointType\":\"PreviousValue\",\"fillMissingPointValue\":0.0,\"rollUpMethod\":\"None\",\"dataFeedDescription\":\"\",\"stopRetryAfterInSeconds\":-1,\"minRetryIntervalInSeconds\":-1,\"maxConcurrency\":0,\"viewMode\":\"Private\",\"admins\":[\"kaghiya@microsoft.com\"],\"viewers\":[],\"creator\":\"kaghiya@microsoft.com\",\"status\":\"Active\",\"createdTime\":\"2021-06-02T00:26:05Z\",\"isAdmin\":true,\"actionLinkTemplate\":\"\",\"dataSourceParameter\":{\"query\":\"let StartDateTime = datetime(@StartTime);let EndDateTime = StartDateTime + 1d;adsample| where Timestamp >= StartDateTime and Timestamp < EndDateTime\"},\"authenticationType\":\"ServicePrincipal\",\"credentialId\":\"eca55e2d-7a27-45aa-946e-811242d1e389\"}", + "Date" : "Wed, 02 Jun 2021 00:26:14 GMT", + "Content-Type" : "application/json; charset=utf-8" + }, + "Exception" : null + }, { + "Method" : "POST", + "Uri" : "https://REDACTED.cognitiveservices.azure.com/metricsadvisor/v1.0/credentials", + "Headers" : { + "User-Agent" : "azsdk-java-azure-ai-metricsadvisor/1.0.0-beta.4 (1.8.0_221; Mac OS X; 10.16)", + "x-ms-client-request-id" : "d7bec7bf-a23f-46d6-bb66-7e6390332c4f", + "Content-Type" : "application/json" + }, + "Response" : { + "x-request-id" : "603bbdce-94be-4a17-bd74-314d31c9d0d1", + "content-length" : "0", + "x-envoy-upstream-service-time" : "520", + "Strict-Transport-Security" : "max-age=31536000; includeSubDomains; preload", + "x-content-type-options" : "nosniff", + "apim-request-id" : "603bbdce-94be-4a17-bd74-314d31c9d0d1", + "retry-after" : "0", + "StatusCode" : "201", + "Date" : "Wed, 02 Jun 2021 00:26:15 GMT", + "Location" : "https://js-metrics-advisor.cognitiveservices.azure.com/metricsadvisor/v1.0/credentials/aab1c72f-bac0-4bb6-8070-94523697a53d" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://REDACTED.cognitiveservices.azure.com/metricsadvisor/v1.0/credentials/aab1c72f-bac0-4bb6-8070-94523697a53d", + "Headers" : { + "User-Agent" : "azsdk-java-azure-ai-metricsadvisor/1.0.0-beta.4 (1.8.0_221; Mac OS X; 10.16)", + "x-ms-client-request-id" : "f433351c-c69c-42fe-9e31-38ee1f626fa0" + }, + "Response" : { + "x-request-id" : "302bbb74-9e1a-4922-a880-9f771913e481", + "content-length" : "549", + "x-envoy-upstream-service-time" : "160", + "Strict-Transport-Security" : "max-age=31536000; includeSubDomains; preload", + "x-content-type-options" : "nosniff", + "apim-request-id" : "302bbb74-9e1a-4922-a880-9f771913e481", + "retry-after" : "0", + "StatusCode" : "200", + "Body" : "{\"dataSourceCredentialId\":\"aab1c72f-bac0-4bb6-8070-94523697a53d\",\"dataSourceCredentialName\":\"java_create_data_source_cred_spkvc5272a80-ceb6-48f4-bf4f-aed7fa9f4243\",\"dataSourceCredentialDescription\":\"\",\"dataSourceCredentialType\":\"ServicePrincipalInKV\",\"parameters\":{\"servicePrincipalSecretNameInKV\":\"DSClientSer_1\",\"servicePrincipalIdNameInKV\":\"DSClientID_1\",\"tenantId\":\"45389ded-5e07-4e52-b225-4ae8f905afb5\",\"keyVaultClientId\":\"e70248b2-bffa-11eb-8529-0242ac130003\",\"keyVaultEndpoint\":\"https://8a4545f4-9116-472d-ada8-8378174a8b04.vault.azure.net\"}}", + "Date" : "Wed, 02 Jun 2021 00:26:15 GMT", + "Content-Type" : "application/json; charset=utf-8" + }, + "Exception" : null + }, { + "Method" : "PATCH", + "Uri" : "https://REDACTED.cognitiveservices.azure.com/metricsadvisor/v1.0/dataFeeds/cd8a939e-95e9-4c09-8c54-f7cf0057b7ea", + "Headers" : { + "User-Agent" : "azsdk-java-azure-ai-metricsadvisor/1.0.0-beta.4 (1.8.0_221; Mac OS X; 10.16)", + "x-ms-client-request-id" : "3e2bfbcb-a336-4f46-a163-0523ebfb13c1", + "Content-Type" : "application/merge-patch+json" + }, + "Response" : { + "x-request-id" : "5c813f64-89e0-495d-92ea-cdf2adf50abd", + "content-length" : "1402", + "x-envoy-upstream-service-time" : "6083", + "Strict-Transport-Security" : "max-age=31536000; includeSubDomains; preload", + "x-content-type-options" : "nosniff", + "apim-request-id" : "5c813f64-89e0-495d-92ea-cdf2adf50abd", + "retry-after" : "0", + "StatusCode" : "200", + "Body" : "{\"dataFeedId\":\"cd8a939e-95e9-4c09-8c54-f7cf0057b7ea\",\"dataFeedName\":\"java_create_data_feed_test_sample58e92a8c-313b-46b3-8a17-87026ff74d0d\",\"metrics\":[{\"metricId\":\"377ddcf3-d780-4873-8eda-f232f877070c\",\"metricName\":\"cost\",\"metricDisplayName\":\"cost\",\"metricDescription\":\"\"},{\"metricId\":\"3b089a71-8427-4bb5-ad0c-a84872834026\",\"metricName\":\"revenue\",\"metricDisplayName\":\"revenue\",\"metricDescription\":\"\"}],\"dimension\":[{\"dimensionName\":\"category\",\"dimensionDisplayName\":\"category\"},{\"dimensionName\":\"city\",\"dimensionDisplayName\":\"city\"}],\"dataStartFrom\":\"2019-10-01T00:00:00Z\",\"dataSourceType\":\"AzureDataExplorer\",\"timestampColumn\":\"\",\"startOffsetInSeconds\":0,\"maxQueryPerMinute\":30.0,\"granularityName\":\"Daily\",\"needRollup\":\"NoRollup\",\"fillMissingPointType\":\"PreviousValue\",\"fillMissingPointValue\":0.0,\"rollUpMethod\":\"None\",\"dataFeedDescription\":\"\",\"stopRetryAfterInSeconds\":-1,\"minRetryIntervalInSeconds\":-1,\"maxConcurrency\":0,\"viewMode\":\"Private\",\"admins\":[\"kaghiya@microsoft.com\"],\"viewers\":[],\"creator\":\"kaghiya@microsoft.com\",\"status\":\"Active\",\"createdTime\":\"2021-06-02T00:26:05Z\",\"isAdmin\":true,\"actionLinkTemplate\":\"\",\"dataSourceParameter\":{\"query\":\"let StartDateTime = datetime(@StartTime);let EndDateTime = StartDateTime + 1d;adsample| where Timestamp >= StartDateTime and Timestamp < EndDateTime\"},\"authenticationType\":\"ServicePrincipalInKV\",\"credentialId\":\"aab1c72f-bac0-4bb6-8070-94523697a53d\"}", + "Date" : "Wed, 02 Jun 2021 00:26:21 GMT", + "Content-Type" : "application/json; charset=utf-8" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://REDACTED.cognitiveservices.azure.com/metricsadvisor/v1.0/dataFeeds/cd8a939e-95e9-4c09-8c54-f7cf0057b7ea", + "Headers" : { + "User-Agent" : "azsdk-java-azure-ai-metricsadvisor/1.0.0-beta.4 (1.8.0_221; Mac OS X; 10.16)", + "x-ms-client-request-id" : "ebd857ff-3885-445c-957e-5bfc75433806" + }, + "Response" : { + "x-request-id" : "3a2607c5-9094-4e1d-92a4-561e2dfcb525", + "content-length" : "1402", + "x-envoy-upstream-service-time" : "210", + "Strict-Transport-Security" : "max-age=31536000; includeSubDomains; preload", + "x-content-type-options" : "nosniff", + "apim-request-id" : "3a2607c5-9094-4e1d-92a4-561e2dfcb525", + "retry-after" : "0", + "StatusCode" : "200", + "Body" : "{\"dataFeedId\":\"cd8a939e-95e9-4c09-8c54-f7cf0057b7ea\",\"dataFeedName\":\"java_create_data_feed_test_sample58e92a8c-313b-46b3-8a17-87026ff74d0d\",\"metrics\":[{\"metricId\":\"377ddcf3-d780-4873-8eda-f232f877070c\",\"metricName\":\"cost\",\"metricDisplayName\":\"cost\",\"metricDescription\":\"\"},{\"metricId\":\"3b089a71-8427-4bb5-ad0c-a84872834026\",\"metricName\":\"revenue\",\"metricDisplayName\":\"revenue\",\"metricDescription\":\"\"}],\"dimension\":[{\"dimensionName\":\"category\",\"dimensionDisplayName\":\"category\"},{\"dimensionName\":\"city\",\"dimensionDisplayName\":\"city\"}],\"dataStartFrom\":\"2019-10-01T00:00:00Z\",\"dataSourceType\":\"AzureDataExplorer\",\"timestampColumn\":\"\",\"startOffsetInSeconds\":0,\"maxQueryPerMinute\":30.0,\"granularityName\":\"Daily\",\"needRollup\":\"NoRollup\",\"fillMissingPointType\":\"PreviousValue\",\"fillMissingPointValue\":0.0,\"rollUpMethod\":\"None\",\"dataFeedDescription\":\"\",\"stopRetryAfterInSeconds\":-1,\"minRetryIntervalInSeconds\":-1,\"maxConcurrency\":0,\"viewMode\":\"Private\",\"admins\":[\"kaghiya@microsoft.com\"],\"viewers\":[],\"creator\":\"kaghiya@microsoft.com\",\"status\":\"Active\",\"createdTime\":\"2021-06-02T00:26:05Z\",\"isAdmin\":true,\"actionLinkTemplate\":\"\",\"dataSourceParameter\":{\"query\":\"let StartDateTime = datetime(@StartTime);let EndDateTime = StartDateTime + 1d;adsample| where Timestamp >= StartDateTime and Timestamp < EndDateTime\"},\"authenticationType\":\"ServicePrincipalInKV\",\"credentialId\":\"aab1c72f-bac0-4bb6-8070-94523697a53d\"}", + "Date" : "Wed, 02 Jun 2021 00:26:22 GMT", + "Content-Type" : "application/json; charset=utf-8" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://REDACTED.cognitiveservices.azure.com/metricsadvisor/v1.0/dataFeeds/cd8a939e-95e9-4c09-8c54-f7cf0057b7ea", + "Headers" : { + "User-Agent" : "azsdk-java-azure-ai-metricsadvisor/1.0.0-beta.4 (1.8.0_221; Mac OS X; 10.16)", + "x-ms-client-request-id" : "280afee4-46e4-409b-bbc8-21e08489a5d2" + }, + "Response" : { + "x-request-id" : "9daaba1a-e604-442b-ab6f-7870b212bf10", + "content-length" : "0", + "x-envoy-upstream-service-time" : "596", + "Strict-Transport-Security" : "max-age=31536000; includeSubDomains; preload", + "x-content-type-options" : "nosniff", + "apim-request-id" : "9daaba1a-e604-442b-ab6f-7870b212bf10", + "retry-after" : "0", + "StatusCode" : "204", + "Date" : "Wed, 02 Jun 2021 00:26:22 GMT" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://REDACTED.cognitiveservices.azure.com/metricsadvisor/v1.0/credentials/eca55e2d-7a27-45aa-946e-811242d1e389", + "Headers" : { + "User-Agent" : "azsdk-java-azure-ai-metricsadvisor/1.0.0-beta.4 (1.8.0_221; Mac OS X; 10.16)", + "x-ms-client-request-id" : "b878d541-2d0f-49e0-881c-cc628d7fda2b" + }, + "Response" : { + "x-request-id" : "14618c0b-7684-4dca-bb45-9af34182a1dd", + "content-length" : "0", + "x-envoy-upstream-service-time" : "5251", + "Strict-Transport-Security" : "max-age=31536000; includeSubDomains; preload", + "x-content-type-options" : "nosniff", + "apim-request-id" : "14618c0b-7684-4dca-bb45-9af34182a1dd", + "retry-after" : "0", + "StatusCode" : "204", + "Date" : "Wed, 02 Jun 2021 00:26:28 GMT" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://REDACTED.cognitiveservices.azure.com/metricsadvisor/v1.0/credentials/aab1c72f-bac0-4bb6-8070-94523697a53d", + "Headers" : { + "User-Agent" : "azsdk-java-azure-ai-metricsadvisor/1.0.0-beta.4 (1.8.0_221; Mac OS X; 10.16)", + "x-ms-client-request-id" : "30478a7f-ccaf-47c9-a33c-833506770ddd" + }, + "Response" : { + "x-request-id" : "bc6cc3cd-93c2-4e65-96fa-edb90b46f630", + "content-length" : "0", + "x-envoy-upstream-service-time" : "221", + "Strict-Transport-Security" : "max-age=31536000; includeSubDomains; preload", + "x-content-type-options" : "nosniff", + "apim-request-id" : "bc6cc3cd-93c2-4e65-96fa-edb90b46f630", + "retry-after" : "0", + "StatusCode" : "204", + "Date" : "Wed, 02 Jun 2021 00:26:28 GMT" + }, + "Exception" : null + } ], + "variables" : [ ] +} \ No newline at end of file diff --git a/sdk/metricsadvisor/azure-ai-metricsadvisor/src/test/resources/session-records/DataFeedWithCredentialsAsyncTest.testDataLakeGen2[1].json b/sdk/metricsadvisor/azure-ai-metricsadvisor/src/test/resources/session-records/DataFeedWithCredentialsAsyncTest.testDataLakeGen2[1].json new file mode 100644 index 0000000000000..aba2659b64dbb --- /dev/null +++ b/sdk/metricsadvisor/azure-ai-metricsadvisor/src/test/resources/session-records/DataFeedWithCredentialsAsyncTest.testDataLakeGen2[1].json @@ -0,0 +1,377 @@ +{ + "networkCallRecords" : [ { + "Method" : "POST", + "Uri" : "https://REDACTED.cognitiveservices.azure.com/metricsadvisor/v1.0/dataFeeds", + "Headers" : { + "User-Agent" : "azsdk-java-azure-ai-metricsadvisor/1.0.0-beta.4 (1.8.0_221; Mac OS X; 10.16)", + "x-ms-client-request-id" : "44e29844-5869-4512-892c-982d6f884956", + "Content-Type" : "application/json" + }, + "Response" : { + "x-request-id" : "f23a07ed-cfbc-4ea9-b82f-2ca592aac035", + "content-length" : "0", + "x-envoy-upstream-service-time" : "6103", + "Strict-Transport-Security" : "max-age=31536000; includeSubDomains; preload", + "x-content-type-options" : "nosniff", + "apim-request-id" : "f23a07ed-cfbc-4ea9-b82f-2ca592aac035", + "retry-after" : "0", + "StatusCode" : "201", + "Date" : "Tue, 01 Jun 2021 23:49:14 GMT", + "Location" : "https://js-metrics-advisor.cognitiveservices.azure.com/metricsadvisor/v1.0/dataFeeds/28761019-b879-48f3-9384-a979c12e7548" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://REDACTED.cognitiveservices.azure.com/metricsadvisor/v1.0/dataFeeds/28761019-b879-48f3-9384-a979c12e7548", + "Headers" : { + "User-Agent" : "azsdk-java-azure-ai-metricsadvisor/1.0.0-beta.4 (1.8.0_221; Mac OS X; 10.16)", + "x-ms-client-request-id" : "8ad780f6-64b6-4a70-868f-e87bc75870fc" + }, + "Response" : { + "x-request-id" : "e70c56bf-3cef-47f5-aa82-7bc50573f3df", + "content-length" : "1308", + "x-envoy-upstream-service-time" : "197", + "Strict-Transport-Security" : "max-age=31536000; includeSubDomains; preload", + "x-content-type-options" : "nosniff", + "apim-request-id" : "e70c56bf-3cef-47f5-aa82-7bc50573f3df", + "retry-after" : "0", + "StatusCode" : "200", + "Body" : "{\"dataFeedId\":\"28761019-b879-48f3-9384-a979c12e7548\",\"dataFeedName\":\"java_create_data_feed_test_samplea6fa6e7a-5a57-447b-b9c6-b092711b8b00\",\"metrics\":[{\"metricId\":\"0fe9382a-0349-4a8e-97f5-c3f8d7820c4e\",\"metricName\":\"cost\",\"metricDisplayName\":\"cost\",\"metricDescription\":\"\"},{\"metricId\":\"1afc9aee-39a5-47e8-96a4-aca99bc903df\",\"metricName\":\"revenue\",\"metricDisplayName\":\"revenue\",\"metricDescription\":\"\"}],\"dimension\":[{\"dimensionName\":\"category\",\"dimensionDisplayName\":\"category\"},{\"dimensionName\":\"city\",\"dimensionDisplayName\":\"city\"}],\"dataStartFrom\":\"2019-10-01T00:00:00Z\",\"dataSourceType\":\"AzureDataLakeStorageGen2\",\"timestampColumn\":\"\",\"startOffsetInSeconds\":0,\"maxQueryPerMinute\":30.0,\"granularityName\":\"Daily\",\"needRollup\":\"NoRollup\",\"fillMissingPointType\":\"PreviousValue\",\"fillMissingPointValue\":0.0,\"rollUpMethod\":\"None\",\"dataFeedDescription\":\"\",\"stopRetryAfterInSeconds\":-1,\"minRetryIntervalInSeconds\":-1,\"maxConcurrency\":0,\"viewMode\":\"Private\",\"admins\":[\"kaghiya@microsoft.com\"],\"viewers\":[],\"creator\":\"kaghiya@microsoft.com\",\"status\":\"Active\",\"createdTime\":\"2021-06-01T23:49:14Z\",\"isAdmin\":true,\"actionLinkTemplate\":\"\",\"dataSourceParameter\":{\"fileTemplate\":\"adsample.json\",\"accountName\":\"REDACTED\",\"directoryTemplate\":\"%Y/%m/%d\",\"fileSystemName\":\"adsample\"},\"authenticationType\":\"Basic\"}", + "Date" : "Tue, 01 Jun 2021 23:49:15 GMT", + "Content-Type" : "application/json; charset=utf-8" + }, + "Exception" : null + }, { + "Method" : "POST", + "Uri" : "https://REDACTED.cognitiveservices.azure.com/metricsadvisor/v1.0/credentials", + "Headers" : { + "User-Agent" : "azsdk-java-azure-ai-metricsadvisor/1.0.0-beta.4 (1.8.0_221; Mac OS X; 10.16)", + "x-ms-client-request-id" : "ede5bfb3-6922-49bf-9b01-42d0ed4f9c9a", + "Content-Type" : "application/json" + }, + "Response" : { + "x-request-id" : "d5c83269-629b-4372-a17d-56aa0157a3b2", + "content-length" : "0", + "x-envoy-upstream-service-time" : "5553", + "Strict-Transport-Security" : "max-age=31536000; includeSubDomains; preload", + "x-content-type-options" : "nosniff", + "apim-request-id" : "d5c83269-629b-4372-a17d-56aa0157a3b2", + "retry-after" : "0", + "StatusCode" : "201", + "Date" : "Tue, 01 Jun 2021 23:49:20 GMT", + "Location" : "https://js-metrics-advisor.cognitiveservices.azure.com/metricsadvisor/v1.0/credentials/21293813-1e8b-465d-902a-22cad62fb666" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://REDACTED.cognitiveservices.azure.com/metricsadvisor/v1.0/credentials/21293813-1e8b-465d-902a-22cad62fb666", + "Headers" : { + "User-Agent" : "azsdk-java-azure-ai-metricsadvisor/1.0.0-beta.4 (1.8.0_221; Mac OS X; 10.16)", + "x-ms-client-request-id" : "4a781f13-fb1e-416a-973c-6610373d77c1" + }, + "Response" : { + "x-request-id" : "86291a63-e7f5-40f4-b554-09af57c19aba", + "content-length" : "273", + "x-envoy-upstream-service-time" : "231", + "Strict-Transport-Security" : "max-age=31536000; includeSubDomains; preload", + "x-content-type-options" : "nosniff", + "apim-request-id" : "86291a63-e7f5-40f4-b554-09af57c19aba", + "retry-after" : "0", + "StatusCode" : "200", + "Body" : "{\"dataSourceCredentialId\":\"21293813-1e8b-465d-902a-22cad62fb666\",\"dataSourceCredentialName\":\"java_create_data_source_cred_dlake_gen3247933c-f37e-402f-a744-9a6e9e9448e5\",\"dataSourceCredentialDescription\":\"\",\"dataSourceCredentialType\":\"DataLakeGen2SharedKey\",\"parameters\":{}}", + "Date" : "Tue, 01 Jun 2021 23:49:21 GMT", + "Content-Type" : "application/json; charset=utf-8" + }, + "Exception" : null + }, { + "Method" : "PATCH", + "Uri" : "https://REDACTED.cognitiveservices.azure.com/metricsadvisor/v1.0/dataFeeds/28761019-b879-48f3-9384-a979c12e7548", + "Headers" : { + "User-Agent" : "azsdk-java-azure-ai-metricsadvisor/1.0.0-beta.4 (1.8.0_221; Mac OS X; 10.16)", + "x-ms-client-request-id" : "3547a02b-6399-4dcd-9dea-1ac65e6e33ec", + "Content-Type" : "application/merge-patch+json" + }, + "Response" : { + "x-request-id" : "69a26805-b928-4b66-81e5-20f695998164", + "content-length" : "1378", + "x-envoy-upstream-service-time" : "6101", + "Strict-Transport-Security" : "max-age=31536000; includeSubDomains; preload", + "x-content-type-options" : "nosniff", + "apim-request-id" : "69a26805-b928-4b66-81e5-20f695998164", + "retry-after" : "0", + "StatusCode" : "200", + "Body" : "{\"dataFeedId\":\"28761019-b879-48f3-9384-a979c12e7548\",\"dataFeedName\":\"java_create_data_feed_test_samplea6fa6e7a-5a57-447b-b9c6-b092711b8b00\",\"metrics\":[{\"metricId\":\"0fe9382a-0349-4a8e-97f5-c3f8d7820c4e\",\"metricName\":\"cost\",\"metricDisplayName\":\"cost\",\"metricDescription\":\"\"},{\"metricId\":\"1afc9aee-39a5-47e8-96a4-aca99bc903df\",\"metricName\":\"revenue\",\"metricDisplayName\":\"revenue\",\"metricDescription\":\"\"}],\"dimension\":[{\"dimensionName\":\"category\",\"dimensionDisplayName\":\"category\"},{\"dimensionName\":\"city\",\"dimensionDisplayName\":\"city\"}],\"dataStartFrom\":\"2019-10-01T00:00:00Z\",\"dataSourceType\":\"AzureDataLakeStorageGen2\",\"timestampColumn\":\"\",\"startOffsetInSeconds\":0,\"maxQueryPerMinute\":30.0,\"granularityName\":\"Daily\",\"needRollup\":\"NoRollup\",\"fillMissingPointType\":\"PreviousValue\",\"fillMissingPointValue\":0.0,\"rollUpMethod\":\"None\",\"dataFeedDescription\":\"\",\"stopRetryAfterInSeconds\":-1,\"minRetryIntervalInSeconds\":-1,\"maxConcurrency\":0,\"viewMode\":\"Private\",\"admins\":[\"kaghiya@microsoft.com\"],\"viewers\":[],\"creator\":\"kaghiya@microsoft.com\",\"status\":\"Active\",\"createdTime\":\"2021-06-01T23:49:14Z\",\"isAdmin\":true,\"actionLinkTemplate\":\"\",\"dataSourceParameter\":{\"fileTemplate\":\"adsample.json\",\"accountName\":\"REDACTED\",\"directoryTemplate\":\"%Y/%m/%d\",\"fileSystemName\":\"adsample\"},\"authenticationType\":\"DataLakeGen2SharedKey\",\"credentialId\":\"21293813-1e8b-465d-902a-22cad62fb666\"}", + "Date" : "Tue, 01 Jun 2021 23:49:26 GMT", + "Content-Type" : "application/json; charset=utf-8" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://REDACTED.cognitiveservices.azure.com/metricsadvisor/v1.0/dataFeeds/28761019-b879-48f3-9384-a979c12e7548", + "Headers" : { + "User-Agent" : "azsdk-java-azure-ai-metricsadvisor/1.0.0-beta.4 (1.8.0_221; Mac OS X; 10.16)", + "x-ms-client-request-id" : "803196b2-2d46-4ab1-9bad-166c8f8b08bc" + }, + "Response" : { + "x-request-id" : "efb06d36-e0b7-4392-b4e3-b95c51f2efec", + "content-length" : "1378", + "x-envoy-upstream-service-time" : "5221", + "Strict-Transport-Security" : "max-age=31536000; includeSubDomains; preload", + "x-content-type-options" : "nosniff", + "apim-request-id" : "efb06d36-e0b7-4392-b4e3-b95c51f2efec", + "retry-after" : "0", + "StatusCode" : "200", + "Body" : "{\"dataFeedId\":\"28761019-b879-48f3-9384-a979c12e7548\",\"dataFeedName\":\"java_create_data_feed_test_samplea6fa6e7a-5a57-447b-b9c6-b092711b8b00\",\"metrics\":[{\"metricId\":\"0fe9382a-0349-4a8e-97f5-c3f8d7820c4e\",\"metricName\":\"cost\",\"metricDisplayName\":\"cost\",\"metricDescription\":\"\"},{\"metricId\":\"1afc9aee-39a5-47e8-96a4-aca99bc903df\",\"metricName\":\"revenue\",\"metricDisplayName\":\"revenue\",\"metricDescription\":\"\"}],\"dimension\":[{\"dimensionName\":\"category\",\"dimensionDisplayName\":\"category\"},{\"dimensionName\":\"city\",\"dimensionDisplayName\":\"city\"}],\"dataStartFrom\":\"2019-10-01T00:00:00Z\",\"dataSourceType\":\"AzureDataLakeStorageGen2\",\"timestampColumn\":\"\",\"startOffsetInSeconds\":0,\"maxQueryPerMinute\":30.0,\"granularityName\":\"Daily\",\"needRollup\":\"NoRollup\",\"fillMissingPointType\":\"PreviousValue\",\"fillMissingPointValue\":0.0,\"rollUpMethod\":\"None\",\"dataFeedDescription\":\"\",\"stopRetryAfterInSeconds\":-1,\"minRetryIntervalInSeconds\":-1,\"maxConcurrency\":0,\"viewMode\":\"Private\",\"admins\":[\"kaghiya@microsoft.com\"],\"viewers\":[],\"creator\":\"kaghiya@microsoft.com\",\"status\":\"Active\",\"createdTime\":\"2021-06-01T23:49:14Z\",\"isAdmin\":true,\"actionLinkTemplate\":\"\",\"dataSourceParameter\":{\"fileTemplate\":\"adsample.json\",\"accountName\":\"REDACTED\",\"directoryTemplate\":\"%Y/%m/%d\",\"fileSystemName\":\"adsample\"},\"authenticationType\":\"DataLakeGen2SharedKey\",\"credentialId\":\"21293813-1e8b-465d-902a-22cad62fb666\"}", + "Date" : "Tue, 01 Jun 2021 23:49:32 GMT", + "Content-Type" : "application/json; charset=utf-8" + }, + "Exception" : null + }, { + "Method" : "POST", + "Uri" : "https://REDACTED.cognitiveservices.azure.com/metricsadvisor/v1.0/credentials", + "Headers" : { + "User-Agent" : "azsdk-java-azure-ai-metricsadvisor/1.0.0-beta.4 (1.8.0_221; Mac OS X; 10.16)", + "x-ms-client-request-id" : "afe976c1-d6f5-4645-b21c-e1c9e1c9e15a", + "Content-Type" : "application/json" + }, + "Response" : { + "x-request-id" : "71f3039a-5ec6-4ec2-af5c-88eecb8f9fec", + "content-length" : "0", + "x-envoy-upstream-service-time" : "626", + "Strict-Transport-Security" : "max-age=31536000; includeSubDomains; preload", + "x-content-type-options" : "nosniff", + "apim-request-id" : "71f3039a-5ec6-4ec2-af5c-88eecb8f9fec", + "retry-after" : "0", + "StatusCode" : "201", + "Date" : "Tue, 01 Jun 2021 23:49:34 GMT", + "Location" : "https://js-metrics-advisor.cognitiveservices.azure.com/metricsadvisor/v1.0/credentials/75b9a2e1-ce8e-48c8-9f60-630eb3d24526" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://REDACTED.cognitiveservices.azure.com/metricsadvisor/v1.0/credentials/75b9a2e1-ce8e-48c8-9f60-630eb3d24526", + "Headers" : { + "User-Agent" : "azsdk-java-azure-ai-metricsadvisor/1.0.0-beta.4 (1.8.0_221; Mac OS X; 10.16)", + "x-ms-client-request-id" : "93a2e10e-a39e-4ac2-9226-6e1dc489897f" + }, + "Response" : { + "x-request-id" : "4930cf9e-44f4-4eab-bb20-573b786975d4", + "content-length" : "360", + "x-envoy-upstream-service-time" : "140", + "Strict-Transport-Security" : "max-age=31536000; includeSubDomains; preload", + "x-content-type-options" : "nosniff", + "apim-request-id" : "4930cf9e-44f4-4eab-bb20-573b786975d4", + "retry-after" : "0", + "StatusCode" : "200", + "Body" : "{\"dataSourceCredentialId\":\"75b9a2e1-ce8e-48c8-9f60-630eb3d24526\",\"dataSourceCredentialName\":\"java_create_data_source_cred_sp14fb519b-bf6b-4217-b7f8-33d44b805732\",\"dataSourceCredentialDescription\":\"\",\"dataSourceCredentialType\":\"ServicePrincipal\",\"parameters\":{\"clientId\":\"e70248b2-bffa-11eb-8529-0242ac130003\",\"tenantId\":\"45389ded-5e07-4e52-b225-4ae8f905afb5\"}}", + "Date" : "Tue, 01 Jun 2021 23:49:34 GMT", + "Content-Type" : "application/json; charset=utf-8" + }, + "Exception" : null + }, { + "Method" : "PATCH", + "Uri" : "https://REDACTED.cognitiveservices.azure.com/metricsadvisor/v1.0/dataFeeds/28761019-b879-48f3-9384-a979c12e7548", + "Headers" : { + "User-Agent" : "azsdk-java-azure-ai-metricsadvisor/1.0.0-beta.4 (1.8.0_221; Mac OS X; 10.16)", + "x-ms-client-request-id" : "206defde-35f9-49bf-af73-7d3652331de6", + "Content-Type" : "application/merge-patch+json" + }, + "Response" : { + "x-request-id" : "22f93323-e442-43b4-b89b-4aeaa0dbe95b", + "content-length" : "1373", + "x-envoy-upstream-service-time" : "1051", + "Strict-Transport-Security" : "max-age=31536000; includeSubDomains; preload", + "x-content-type-options" : "nosniff", + "apim-request-id" : "22f93323-e442-43b4-b89b-4aeaa0dbe95b", + "retry-after" : "0", + "StatusCode" : "200", + "Body" : "{\"dataFeedId\":\"28761019-b879-48f3-9384-a979c12e7548\",\"dataFeedName\":\"java_create_data_feed_test_samplea6fa6e7a-5a57-447b-b9c6-b092711b8b00\",\"metrics\":[{\"metricId\":\"0fe9382a-0349-4a8e-97f5-c3f8d7820c4e\",\"metricName\":\"cost\",\"metricDisplayName\":\"cost\",\"metricDescription\":\"\"},{\"metricId\":\"1afc9aee-39a5-47e8-96a4-aca99bc903df\",\"metricName\":\"revenue\",\"metricDisplayName\":\"revenue\",\"metricDescription\":\"\"}],\"dimension\":[{\"dimensionName\":\"category\",\"dimensionDisplayName\":\"category\"},{\"dimensionName\":\"city\",\"dimensionDisplayName\":\"city\"}],\"dataStartFrom\":\"2019-10-01T00:00:00Z\",\"dataSourceType\":\"AzureDataLakeStorageGen2\",\"timestampColumn\":\"\",\"startOffsetInSeconds\":0,\"maxQueryPerMinute\":30.0,\"granularityName\":\"Daily\",\"needRollup\":\"NoRollup\",\"fillMissingPointType\":\"PreviousValue\",\"fillMissingPointValue\":0.0,\"rollUpMethod\":\"None\",\"dataFeedDescription\":\"\",\"stopRetryAfterInSeconds\":-1,\"minRetryIntervalInSeconds\":-1,\"maxConcurrency\":0,\"viewMode\":\"Private\",\"admins\":[\"kaghiya@microsoft.com\"],\"viewers\":[],\"creator\":\"kaghiya@microsoft.com\",\"status\":\"Active\",\"createdTime\":\"2021-06-01T23:49:14Z\",\"isAdmin\":true,\"actionLinkTemplate\":\"\",\"dataSourceParameter\":{\"fileTemplate\":\"adsample.json\",\"accountName\":\"REDACTED\",\"directoryTemplate\":\"%Y/%m/%d\",\"fileSystemName\":\"adsample\"},\"authenticationType\":\"ServicePrincipal\",\"credentialId\":\"75b9a2e1-ce8e-48c8-9f60-630eb3d24526\"}", + "Date" : "Tue, 01 Jun 2021 23:49:35 GMT", + "Content-Type" : "application/json; charset=utf-8" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://REDACTED.cognitiveservices.azure.com/metricsadvisor/v1.0/dataFeeds/28761019-b879-48f3-9384-a979c12e7548", + "Headers" : { + "User-Agent" : "azsdk-java-azure-ai-metricsadvisor/1.0.0-beta.4 (1.8.0_221; Mac OS X; 10.16)", + "x-ms-client-request-id" : "dfe6e9b0-c584-4c57-a3ec-badf9d0fb27b" + }, + "Response" : { + "x-request-id" : "b2ca16bb-99ce-4c5d-9c1d-954980de509b", + "content-length" : "1373", + "x-envoy-upstream-service-time" : "5187", + "Strict-Transport-Security" : "max-age=31536000; includeSubDomains; preload", + "x-content-type-options" : "nosniff", + "apim-request-id" : "b2ca16bb-99ce-4c5d-9c1d-954980de509b", + "retry-after" : "0", + "StatusCode" : "200", + "Body" : "{\"dataFeedId\":\"28761019-b879-48f3-9384-a979c12e7548\",\"dataFeedName\":\"java_create_data_feed_test_samplea6fa6e7a-5a57-447b-b9c6-b092711b8b00\",\"metrics\":[{\"metricId\":\"0fe9382a-0349-4a8e-97f5-c3f8d7820c4e\",\"metricName\":\"cost\",\"metricDisplayName\":\"cost\",\"metricDescription\":\"\"},{\"metricId\":\"1afc9aee-39a5-47e8-96a4-aca99bc903df\",\"metricName\":\"revenue\",\"metricDisplayName\":\"revenue\",\"metricDescription\":\"\"}],\"dimension\":[{\"dimensionName\":\"category\",\"dimensionDisplayName\":\"category\"},{\"dimensionName\":\"city\",\"dimensionDisplayName\":\"city\"}],\"dataStartFrom\":\"2019-10-01T00:00:00Z\",\"dataSourceType\":\"AzureDataLakeStorageGen2\",\"timestampColumn\":\"\",\"startOffsetInSeconds\":0,\"maxQueryPerMinute\":30.0,\"granularityName\":\"Daily\",\"needRollup\":\"NoRollup\",\"fillMissingPointType\":\"PreviousValue\",\"fillMissingPointValue\":0.0,\"rollUpMethod\":\"None\",\"dataFeedDescription\":\"\",\"stopRetryAfterInSeconds\":-1,\"minRetryIntervalInSeconds\":-1,\"maxConcurrency\":0,\"viewMode\":\"Private\",\"admins\":[\"kaghiya@microsoft.com\"],\"viewers\":[],\"creator\":\"kaghiya@microsoft.com\",\"status\":\"Active\",\"createdTime\":\"2021-06-01T23:49:14Z\",\"isAdmin\":true,\"actionLinkTemplate\":\"\",\"dataSourceParameter\":{\"fileTemplate\":\"adsample.json\",\"accountName\":\"REDACTED\",\"directoryTemplate\":\"%Y/%m/%d\",\"fileSystemName\":\"adsample\"},\"authenticationType\":\"ServicePrincipal\",\"credentialId\":\"75b9a2e1-ce8e-48c8-9f60-630eb3d24526\"}", + "Date" : "Tue, 01 Jun 2021 23:49:40 GMT", + "Content-Type" : "application/json; charset=utf-8" + }, + "Exception" : null + }, { + "Method" : "POST", + "Uri" : "https://REDACTED.cognitiveservices.azure.com/metricsadvisor/v1.0/credentials", + "Headers" : { + "User-Agent" : "azsdk-java-azure-ai-metricsadvisor/1.0.0-beta.4 (1.8.0_221; Mac OS X; 10.16)", + "x-ms-client-request-id" : "6305d126-26c7-4f7c-93ef-eba8fb461dab", + "Content-Type" : "application/json" + }, + "Response" : { + "x-request-id" : "3e043d3d-3149-437a-b257-befd98a5da77", + "content-length" : "0", + "x-envoy-upstream-service-time" : "508", + "Strict-Transport-Security" : "max-age=31536000; includeSubDomains; preload", + "x-content-type-options" : "nosniff", + "apim-request-id" : "3e043d3d-3149-437a-b257-befd98a5da77", + "retry-after" : "0", + "StatusCode" : "201", + "Date" : "Tue, 01 Jun 2021 23:49:40 GMT", + "Location" : "https://js-metrics-advisor.cognitiveservices.azure.com/metricsadvisor/v1.0/credentials/d2ecd9a7-a9ad-462b-9127-fff7b5091f7c" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://REDACTED.cognitiveservices.azure.com/metricsadvisor/v1.0/credentials/d2ecd9a7-a9ad-462b-9127-fff7b5091f7c", + "Headers" : { + "User-Agent" : "azsdk-java-azure-ai-metricsadvisor/1.0.0-beta.4 (1.8.0_221; Mac OS X; 10.16)", + "x-ms-client-request-id" : "4b0615b9-f4c0-4f8e-a25b-9d69f7bf9a70" + }, + "Response" : { + "x-request-id" : "e8caf50b-29ac-4fc9-8ecb-57a2e8a6a9dd", + "content-length" : "549", + "x-envoy-upstream-service-time" : "5104", + "Strict-Transport-Security" : "max-age=31536000; includeSubDomains; preload", + "x-content-type-options" : "nosniff", + "apim-request-id" : "e8caf50b-29ac-4fc9-8ecb-57a2e8a6a9dd", + "retry-after" : "0", + "StatusCode" : "200", + "Body" : "{\"dataSourceCredentialId\":\"d2ecd9a7-a9ad-462b-9127-fff7b5091f7c\",\"dataSourceCredentialName\":\"java_create_data_source_cred_spkve895021d-25e4-494f-a407-380002e86039\",\"dataSourceCredentialDescription\":\"\",\"dataSourceCredentialType\":\"ServicePrincipalInKV\",\"parameters\":{\"servicePrincipalSecretNameInKV\":\"DSClientSer_1\",\"servicePrincipalIdNameInKV\":\"DSClientID_1\",\"tenantId\":\"45389ded-5e07-4e52-b225-4ae8f905afb5\",\"keyVaultClientId\":\"e70248b2-bffa-11eb-8529-0242ac130003\",\"keyVaultEndpoint\":\"https://75f7dcec-8b91-480d-96f3-de77dc5f7e18.vault.azure.net\"}}", + "Date" : "Tue, 01 Jun 2021 23:49:46 GMT", + "Content-Type" : "application/json; charset=utf-8" + }, + "Exception" : null + }, { + "Method" : "PATCH", + "Uri" : "https://REDACTED.cognitiveservices.azure.com/metricsadvisor/v1.0/dataFeeds/28761019-b879-48f3-9384-a979c12e7548", + "Headers" : { + "User-Agent" : "azsdk-java-azure-ai-metricsadvisor/1.0.0-beta.4 (1.8.0_221; Mac OS X; 10.16)", + "x-ms-client-request-id" : "21f4b55d-7122-400a-88ed-4e2a1ed70673", + "Content-Type" : "application/merge-patch+json" + }, + "Response" : { + "x-request-id" : "de4701c9-1b55-4340-b34a-1ee043550146", + "content-length" : "1377", + "x-envoy-upstream-service-time" : "1153", + "Strict-Transport-Security" : "max-age=31536000; includeSubDomains; preload", + "x-content-type-options" : "nosniff", + "apim-request-id" : "de4701c9-1b55-4340-b34a-1ee043550146", + "retry-after" : "0", + "StatusCode" : "200", + "Body" : "{\"dataFeedId\":\"28761019-b879-48f3-9384-a979c12e7548\",\"dataFeedName\":\"java_create_data_feed_test_samplea6fa6e7a-5a57-447b-b9c6-b092711b8b00\",\"metrics\":[{\"metricId\":\"0fe9382a-0349-4a8e-97f5-c3f8d7820c4e\",\"metricName\":\"cost\",\"metricDisplayName\":\"cost\",\"metricDescription\":\"\"},{\"metricId\":\"1afc9aee-39a5-47e8-96a4-aca99bc903df\",\"metricName\":\"revenue\",\"metricDisplayName\":\"revenue\",\"metricDescription\":\"\"}],\"dimension\":[{\"dimensionName\":\"category\",\"dimensionDisplayName\":\"category\"},{\"dimensionName\":\"city\",\"dimensionDisplayName\":\"city\"}],\"dataStartFrom\":\"2019-10-01T00:00:00Z\",\"dataSourceType\":\"AzureDataLakeStorageGen2\",\"timestampColumn\":\"\",\"startOffsetInSeconds\":0,\"maxQueryPerMinute\":30.0,\"granularityName\":\"Daily\",\"needRollup\":\"NoRollup\",\"fillMissingPointType\":\"PreviousValue\",\"fillMissingPointValue\":0.0,\"rollUpMethod\":\"None\",\"dataFeedDescription\":\"\",\"stopRetryAfterInSeconds\":-1,\"minRetryIntervalInSeconds\":-1,\"maxConcurrency\":0,\"viewMode\":\"Private\",\"admins\":[\"kaghiya@microsoft.com\"],\"viewers\":[],\"creator\":\"kaghiya@microsoft.com\",\"status\":\"Active\",\"createdTime\":\"2021-06-01T23:49:14Z\",\"isAdmin\":true,\"actionLinkTemplate\":\"\",\"dataSourceParameter\":{\"fileTemplate\":\"adsample.json\",\"accountName\":\"REDACTED\",\"directoryTemplate\":\"%Y/%m/%d\",\"fileSystemName\":\"adsample\"},\"authenticationType\":\"ServicePrincipalInKV\",\"credentialId\":\"d2ecd9a7-a9ad-462b-9127-fff7b5091f7c\"}", + "Date" : "Tue, 01 Jun 2021 23:49:47 GMT", + "Content-Type" : "application/json; charset=utf-8" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://REDACTED.cognitiveservices.azure.com/metricsadvisor/v1.0/dataFeeds/28761019-b879-48f3-9384-a979c12e7548", + "Headers" : { + "User-Agent" : "azsdk-java-azure-ai-metricsadvisor/1.0.0-beta.4 (1.8.0_221; Mac OS X; 10.16)", + "x-ms-client-request-id" : "8eaeabe9-762e-474a-8016-bfcaf83b287f" + }, + "Response" : { + "x-request-id" : "644e764e-95ae-434f-ba31-1c2ed55a16b0", + "content-length" : "1377", + "x-envoy-upstream-service-time" : "5239", + "Strict-Transport-Security" : "max-age=31536000; includeSubDomains; preload", + "x-content-type-options" : "nosniff", + "apim-request-id" : "644e764e-95ae-434f-ba31-1c2ed55a16b0", + "retry-after" : "0", + "StatusCode" : "200", + "Body" : "{\"dataFeedId\":\"28761019-b879-48f3-9384-a979c12e7548\",\"dataFeedName\":\"java_create_data_feed_test_samplea6fa6e7a-5a57-447b-b9c6-b092711b8b00\",\"metrics\":[{\"metricId\":\"0fe9382a-0349-4a8e-97f5-c3f8d7820c4e\",\"metricName\":\"cost\",\"metricDisplayName\":\"cost\",\"metricDescription\":\"\"},{\"metricId\":\"1afc9aee-39a5-47e8-96a4-aca99bc903df\",\"metricName\":\"revenue\",\"metricDisplayName\":\"revenue\",\"metricDescription\":\"\"}],\"dimension\":[{\"dimensionName\":\"category\",\"dimensionDisplayName\":\"category\"},{\"dimensionName\":\"city\",\"dimensionDisplayName\":\"city\"}],\"dataStartFrom\":\"2019-10-01T00:00:00Z\",\"dataSourceType\":\"AzureDataLakeStorageGen2\",\"timestampColumn\":\"\",\"startOffsetInSeconds\":0,\"maxQueryPerMinute\":30.0,\"granularityName\":\"Daily\",\"needRollup\":\"NoRollup\",\"fillMissingPointType\":\"PreviousValue\",\"fillMissingPointValue\":0.0,\"rollUpMethod\":\"None\",\"dataFeedDescription\":\"\",\"stopRetryAfterInSeconds\":-1,\"minRetryIntervalInSeconds\":-1,\"maxConcurrency\":0,\"viewMode\":\"Private\",\"admins\":[\"kaghiya@microsoft.com\"],\"viewers\":[],\"creator\":\"kaghiya@microsoft.com\",\"status\":\"Active\",\"createdTime\":\"2021-06-01T23:49:14Z\",\"isAdmin\":true,\"actionLinkTemplate\":\"\",\"dataSourceParameter\":{\"fileTemplate\":\"adsample.json\",\"accountName\":\"REDACTED\",\"directoryTemplate\":\"%Y/%m/%d\",\"fileSystemName\":\"adsample\"},\"authenticationType\":\"ServicePrincipalInKV\",\"credentialId\":\"d2ecd9a7-a9ad-462b-9127-fff7b5091f7c\"}", + "Date" : "Tue, 01 Jun 2021 23:49:52 GMT", + "Content-Type" : "application/json; charset=utf-8" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://REDACTED.cognitiveservices.azure.com/metricsadvisor/v1.0/dataFeeds/28761019-b879-48f3-9384-a979c12e7548", + "Headers" : { + "User-Agent" : "azsdk-java-azure-ai-metricsadvisor/1.0.0-beta.4 (1.8.0_221; Mac OS X; 10.16)", + "x-ms-client-request-id" : "507b1092-53a6-462c-a583-9def1f4439f5" + }, + "Response" : { + "x-request-id" : "561d07a2-db4a-4e1b-ba70-401267394ceb", + "content-length" : "0", + "x-envoy-upstream-service-time" : "398", + "Strict-Transport-Security" : "max-age=31536000; includeSubDomains; preload", + "x-content-type-options" : "nosniff", + "apim-request-id" : "561d07a2-db4a-4e1b-ba70-401267394ceb", + "retry-after" : "0", + "StatusCode" : "204", + "Date" : "Tue, 01 Jun 2021 23:49:53 GMT" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://REDACTED.cognitiveservices.azure.com/metricsadvisor/v1.0/credentials/21293813-1e8b-465d-902a-22cad62fb666", + "Headers" : { + "User-Agent" : "azsdk-java-azure-ai-metricsadvisor/1.0.0-beta.4 (1.8.0_221; Mac OS X; 10.16)", + "x-ms-client-request-id" : "056245e0-d817-46ff-a19c-aec71680f76c" + }, + "Response" : { + "x-request-id" : "50cc2465-3305-4b05-bcf3-8cccc6ccd341", + "content-length" : "0", + "x-envoy-upstream-service-time" : "194", + "Strict-Transport-Security" : "max-age=31536000; includeSubDomains; preload", + "x-content-type-options" : "nosniff", + "apim-request-id" : "50cc2465-3305-4b05-bcf3-8cccc6ccd341", + "retry-after" : "0", + "StatusCode" : "204", + "Date" : "Tue, 01 Jun 2021 23:49:53 GMT" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://REDACTED.cognitiveservices.azure.com/metricsadvisor/v1.0/credentials/75b9a2e1-ce8e-48c8-9f60-630eb3d24526", + "Headers" : { + "User-Agent" : "azsdk-java-azure-ai-metricsadvisor/1.0.0-beta.4 (1.8.0_221; Mac OS X; 10.16)", + "x-ms-client-request-id" : "63e8c848-4a87-463e-8d8e-ff4d0998dd19" + }, + "Response" : { + "x-request-id" : "2edb1fe8-b04d-4886-9071-bd11610dc7d3", + "content-length" : "0", + "x-envoy-upstream-service-time" : "200", + "Strict-Transport-Security" : "max-age=31536000; includeSubDomains; preload", + "x-content-type-options" : "nosniff", + "apim-request-id" : "2edb1fe8-b04d-4886-9071-bd11610dc7d3", + "retry-after" : "0", + "StatusCode" : "204", + "Date" : "Tue, 01 Jun 2021 23:49:53 GMT" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://REDACTED.cognitiveservices.azure.com/metricsadvisor/v1.0/credentials/d2ecd9a7-a9ad-462b-9127-fff7b5091f7c", + "Headers" : { + "User-Agent" : "azsdk-java-azure-ai-metricsadvisor/1.0.0-beta.4 (1.8.0_221; Mac OS X; 10.16)", + "x-ms-client-request-id" : "226013c3-9009-4dd0-9997-19d64ec48e09" + }, + "Response" : { + "x-request-id" : "9ab88bcf-746b-427e-b4fb-c64d6e338082", + "content-length" : "0", + "x-envoy-upstream-service-time" : "255", + "Strict-Transport-Security" : "max-age=31536000; includeSubDomains; preload", + "x-content-type-options" : "nosniff", + "apim-request-id" : "9ab88bcf-746b-427e-b4fb-c64d6e338082", + "retry-after" : "0", + "StatusCode" : "204", + "Date" : "Tue, 01 Jun 2021 23:49:53 GMT" + }, + "Exception" : null + } ], + "variables" : [ ] +} \ No newline at end of file diff --git a/sdk/metricsadvisor/azure-ai-metricsadvisor/src/test/resources/session-records/DataFeedWithCredentialsAsyncTest.testSqlServer[1].json b/sdk/metricsadvisor/azure-ai-metricsadvisor/src/test/resources/session-records/DataFeedWithCredentialsAsyncTest.testSqlServer[1].json new file mode 100644 index 0000000000000..3bf3b4d825b95 --- /dev/null +++ b/sdk/metricsadvisor/azure-ai-metricsadvisor/src/test/resources/session-records/DataFeedWithCredentialsAsyncTest.testSqlServer[1].json @@ -0,0 +1,420 @@ +{ + "networkCallRecords" : [ { + "Method" : "POST", + "Uri" : "https://REDACTED.cognitiveservices.azure.com/metricsadvisor/v1.0/dataFeeds", + "Headers" : { + "User-Agent" : "azsdk-java-azure-ai-metricsadvisor/1.0.0-beta.4 (1.8.0_221; Mac OS X; 10.16)", + "x-ms-client-request-id" : "51a364ea-f3e6-4c58-b979-46c1cfda8991", + "Content-Type" : "application/json" + }, + "Response" : { + "x-request-id" : "0feb8833-81a2-49ba-aa91-d87597aeec49", + "content-length" : "0", + "x-envoy-upstream-service-time" : "6154", + "Strict-Transport-Security" : "max-age=31536000; includeSubDomains; preload", + "x-content-type-options" : "nosniff", + "apim-request-id" : "0feb8833-81a2-49ba-aa91-d87597aeec49", + "retry-after" : "0", + "StatusCode" : "201", + "Date" : "Tue, 01 Jun 2021 23:42:28 GMT", + "Location" : "https://js-metrics-advisor.cognitiveservices.azure.com/metricsadvisor/v1.0/dataFeeds/f0361e6e-8234-4eb7-8a7e-366cc625d4b9" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://REDACTED.cognitiveservices.azure.com/metricsadvisor/v1.0/dataFeeds/f0361e6e-8234-4eb7-8a7e-366cc625d4b9", + "Headers" : { + "User-Agent" : "azsdk-java-azure-ai-metricsadvisor/1.0.0-beta.4 (1.8.0_221; Mac OS X; 10.16)", + "x-ms-client-request-id" : "63141deb-95fc-47b3-bdbc-4bc3459b38f3" + }, + "Response" : { + "x-request-id" : "a2118327-a2ad-4ba1-8e0f-8601cb2cc7a9", + "content-length" : "1229", + "x-envoy-upstream-service-time" : "206", + "Strict-Transport-Security" : "max-age=31536000; includeSubDomains; preload", + "x-content-type-options" : "nosniff", + "apim-request-id" : "a2118327-a2ad-4ba1-8e0f-8601cb2cc7a9", + "retry-after" : "0", + "StatusCode" : "200", + "Body" : "{\"dataFeedId\":\"f0361e6e-8234-4eb7-8a7e-366cc625d4b9\",\"dataFeedName\":\"java_create_data_feed_test_sample549648d1-7ba6-4151-8a8f-b4d06c351ebf\",\"metrics\":[{\"metricId\":\"315ba333-a229-49ef-8f8f-e7359428c1f0\",\"metricName\":\"cost\",\"metricDisplayName\":\"cost\",\"metricDescription\":\"\"},{\"metricId\":\"90824c6d-2f54-4728-86c3-b4c8588bce61\",\"metricName\":\"revenue\",\"metricDisplayName\":\"revenue\",\"metricDescription\":\"\"}],\"dimension\":[{\"dimensionName\":\"category\",\"dimensionDisplayName\":\"category\"},{\"dimensionName\":\"city\",\"dimensionDisplayName\":\"city\"}],\"dataStartFrom\":\"2019-10-01T00:00:00Z\",\"dataSourceType\":\"SqlServer\",\"timestampColumn\":\"\",\"startOffsetInSeconds\":0,\"maxQueryPerMinute\":30.0,\"granularityName\":\"Daily\",\"needRollup\":\"NoRollup\",\"fillMissingPointType\":\"PreviousValue\",\"fillMissingPointValue\":0.0,\"rollUpMethod\":\"None\",\"dataFeedDescription\":\"\",\"stopRetryAfterInSeconds\":-1,\"minRetryIntervalInSeconds\":-1,\"maxConcurrency\":0,\"viewMode\":\"Private\",\"admins\":[\"kaghiya@microsoft.com\"],\"viewers\":[],\"creator\":\"kaghiya@microsoft.com\",\"status\":\"Active\",\"createdTime\":\"2021-06-01T23:42:28Z\",\"isAdmin\":true,\"actionLinkTemplate\":\"\",\"dataSourceParameter\":{\"query\":\"select * from adsample2 where Timestamp = @StartTime\"},\"authenticationType\":\"Basic\"}", + "Date" : "Tue, 01 Jun 2021 23:42:28 GMT", + "Content-Type" : "application/json; charset=utf-8" + }, + "Exception" : null + }, { + "Method" : "PATCH", + "Uri" : "https://REDACTED.cognitiveservices.azure.com/metricsadvisor/v1.0/dataFeeds/f0361e6e-8234-4eb7-8a7e-366cc625d4b9", + "Headers" : { + "User-Agent" : "azsdk-java-azure-ai-metricsadvisor/1.0.0-beta.4 (1.8.0_221; Mac OS X; 10.16)", + "x-ms-client-request-id" : "8e0dded2-e5d9-446e-913c-c705f3267bfc", + "Content-Type" : "application/merge-patch+json" + }, + "Response" : { + "x-request-id" : "884853f3-a49d-4f4a-b047-3ec36a7fe930", + "content-length" : "1239", + "x-envoy-upstream-service-time" : "6237", + "Strict-Transport-Security" : "max-age=31536000; includeSubDomains; preload", + "x-content-type-options" : "nosniff", + "apim-request-id" : "884853f3-a49d-4f4a-b047-3ec36a7fe930", + "retry-after" : "0", + "StatusCode" : "200", + "Body" : "{\"dataFeedId\":\"f0361e6e-8234-4eb7-8a7e-366cc625d4b9\",\"dataFeedName\":\"java_create_data_feed_test_sample549648d1-7ba6-4151-8a8f-b4d06c351ebf\",\"metrics\":[{\"metricId\":\"315ba333-a229-49ef-8f8f-e7359428c1f0\",\"metricName\":\"cost\",\"metricDisplayName\":\"cost\",\"metricDescription\":\"\"},{\"metricId\":\"90824c6d-2f54-4728-86c3-b4c8588bce61\",\"metricName\":\"revenue\",\"metricDisplayName\":\"revenue\",\"metricDescription\":\"\"}],\"dimension\":[{\"dimensionName\":\"category\",\"dimensionDisplayName\":\"category\"},{\"dimensionName\":\"city\",\"dimensionDisplayName\":\"city\"}],\"dataStartFrom\":\"2019-10-01T00:00:00Z\",\"dataSourceType\":\"SqlServer\",\"timestampColumn\":\"\",\"startOffsetInSeconds\":0,\"maxQueryPerMinute\":30.0,\"granularityName\":\"Daily\",\"needRollup\":\"NoRollup\",\"fillMissingPointType\":\"PreviousValue\",\"fillMissingPointValue\":0.0,\"rollUpMethod\":\"None\",\"dataFeedDescription\":\"\",\"stopRetryAfterInSeconds\":-1,\"minRetryIntervalInSeconds\":-1,\"maxConcurrency\":0,\"viewMode\":\"Private\",\"admins\":[\"kaghiya@microsoft.com\"],\"viewers\":[],\"creator\":\"kaghiya@microsoft.com\",\"status\":\"Active\",\"createdTime\":\"2021-06-01T23:42:28Z\",\"isAdmin\":true,\"actionLinkTemplate\":\"\",\"dataSourceParameter\":{\"query\":\"select * from adsample2 where Timestamp = @StartTime\"},\"authenticationType\":\"ManagedIdentity\"}", + "Date" : "Tue, 01 Jun 2021 23:42:35 GMT", + "Content-Type" : "application/json; charset=utf-8" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://REDACTED.cognitiveservices.azure.com/metricsadvisor/v1.0/dataFeeds/f0361e6e-8234-4eb7-8a7e-366cc625d4b9", + "Headers" : { + "User-Agent" : "azsdk-java-azure-ai-metricsadvisor/1.0.0-beta.4 (1.8.0_221; Mac OS X; 10.16)", + "x-ms-client-request-id" : "bacff21a-3c69-4e2c-a89b-cb71ab51caa1" + }, + "Response" : { + "x-request-id" : "5ee836c6-cc03-4ce4-8aa2-f170e3d2b5c3", + "content-length" : "1239", + "x-envoy-upstream-service-time" : "5234", + "Strict-Transport-Security" : "max-age=31536000; includeSubDomains; preload", + "x-content-type-options" : "nosniff", + "apim-request-id" : "5ee836c6-cc03-4ce4-8aa2-f170e3d2b5c3", + "retry-after" : "0", + "StatusCode" : "200", + "Body" : "{\"dataFeedId\":\"f0361e6e-8234-4eb7-8a7e-366cc625d4b9\",\"dataFeedName\":\"java_create_data_feed_test_sample549648d1-7ba6-4151-8a8f-b4d06c351ebf\",\"metrics\":[{\"metricId\":\"315ba333-a229-49ef-8f8f-e7359428c1f0\",\"metricName\":\"cost\",\"metricDisplayName\":\"cost\",\"metricDescription\":\"\"},{\"metricId\":\"90824c6d-2f54-4728-86c3-b4c8588bce61\",\"metricName\":\"revenue\",\"metricDisplayName\":\"revenue\",\"metricDescription\":\"\"}],\"dimension\":[{\"dimensionName\":\"category\",\"dimensionDisplayName\":\"category\"},{\"dimensionName\":\"city\",\"dimensionDisplayName\":\"city\"}],\"dataStartFrom\":\"2019-10-01T00:00:00Z\",\"dataSourceType\":\"SqlServer\",\"timestampColumn\":\"\",\"startOffsetInSeconds\":0,\"maxQueryPerMinute\":30.0,\"granularityName\":\"Daily\",\"needRollup\":\"NoRollup\",\"fillMissingPointType\":\"PreviousValue\",\"fillMissingPointValue\":0.0,\"rollUpMethod\":\"None\",\"dataFeedDescription\":\"\",\"stopRetryAfterInSeconds\":-1,\"minRetryIntervalInSeconds\":-1,\"maxConcurrency\":0,\"viewMode\":\"Private\",\"admins\":[\"kaghiya@microsoft.com\"],\"viewers\":[],\"creator\":\"kaghiya@microsoft.com\",\"status\":\"Active\",\"createdTime\":\"2021-06-01T23:42:28Z\",\"isAdmin\":true,\"actionLinkTemplate\":\"\",\"dataSourceParameter\":{\"query\":\"select * from adsample2 where Timestamp = @StartTime\"},\"authenticationType\":\"ManagedIdentity\"}", + "Date" : "Tue, 01 Jun 2021 23:42:40 GMT", + "Content-Type" : "application/json; charset=utf-8" + }, + "Exception" : null + }, { + "Method" : "POST", + "Uri" : "https://REDACTED.cognitiveservices.azure.com/metricsadvisor/v1.0/credentials", + "Headers" : { + "User-Agent" : "azsdk-java-azure-ai-metricsadvisor/1.0.0-beta.4 (1.8.0_221; Mac OS X; 10.16)", + "x-ms-client-request-id" : "00688a87-ceda-41f0-b5ab-8f15264bf818", + "Content-Type" : "application/json" + }, + "Response" : { + "x-request-id" : "5075c3aa-38f7-4407-85b2-4d1815ffb184", + "content-length" : "0", + "x-envoy-upstream-service-time" : "617", + "Strict-Transport-Security" : "max-age=31536000; includeSubDomains; preload", + "x-content-type-options" : "nosniff", + "apim-request-id" : "5075c3aa-38f7-4407-85b2-4d1815ffb184", + "retry-after" : "0", + "StatusCode" : "201", + "Date" : "Tue, 01 Jun 2021 23:42:41 GMT", + "Location" : "https://js-metrics-advisor.cognitiveservices.azure.com/metricsadvisor/v1.0/credentials/8d5b1fe4-35da-47f0-90c3-70d54d4b4562" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://REDACTED.cognitiveservices.azure.com/metricsadvisor/v1.0/credentials/8d5b1fe4-35da-47f0-90c3-70d54d4b4562", + "Headers" : { + "User-Agent" : "azsdk-java-azure-ai-metricsadvisor/1.0.0-beta.4 (1.8.0_221; Mac OS X; 10.16)", + "x-ms-client-request-id" : "e1973bf8-e23b-4735-b55c-66f0e7a1cdba" + }, + "Response" : { + "x-request-id" : "ed781100-2591-45b9-ab7c-cfc034e99aae", + "content-length" : "274", + "x-envoy-upstream-service-time" : "94", + "Strict-Transport-Security" : "max-age=31536000; includeSubDomains; preload", + "x-content-type-options" : "nosniff", + "apim-request-id" : "ed781100-2591-45b9-ab7c-cfc034e99aae", + "retry-after" : "0", + "StatusCode" : "200", + "Body" : "{\"dataSourceCredentialId\":\"8d5b1fe4-35da-47f0-90c3-70d54d4b4562\",\"dataSourceCredentialName\":\"java_create_data_source_cred_sql_conb9a54556-f179-4f89-9f84-a8d0d682aae8\",\"dataSourceCredentialDescription\":\"\",\"dataSourceCredentialType\":\"AzureSQLConnectionString\",\"parameters\":{}}", + "Date" : "Tue, 01 Jun 2021 23:42:41 GMT", + "Content-Type" : "application/json; charset=utf-8" + }, + "Exception" : null + }, { + "Method" : "PATCH", + "Uri" : "https://REDACTED.cognitiveservices.azure.com/metricsadvisor/v1.0/dataFeeds/f0361e6e-8234-4eb7-8a7e-366cc625d4b9", + "Headers" : { + "User-Agent" : "azsdk-java-azure-ai-metricsadvisor/1.0.0-beta.4 (1.8.0_221; Mac OS X; 10.16)", + "x-ms-client-request-id" : "beef156e-ecab-4c77-af28-1bd1e6af34e6", + "Content-Type" : "application/merge-patch+json" + }, + "Response" : { + "x-request-id" : "150e82a0-07ae-4027-a5ce-702fe95bfab5", + "content-length" : "1302", + "x-envoy-upstream-service-time" : "6059", + "Strict-Transport-Security" : "max-age=31536000; includeSubDomains; preload", + "x-content-type-options" : "nosniff", + "apim-request-id" : "150e82a0-07ae-4027-a5ce-702fe95bfab5", + "retry-after" : "0", + "StatusCode" : "200", + "Body" : "{\"dataFeedId\":\"f0361e6e-8234-4eb7-8a7e-366cc625d4b9\",\"dataFeedName\":\"java_create_data_feed_test_sample549648d1-7ba6-4151-8a8f-b4d06c351ebf\",\"metrics\":[{\"metricId\":\"315ba333-a229-49ef-8f8f-e7359428c1f0\",\"metricName\":\"cost\",\"metricDisplayName\":\"cost\",\"metricDescription\":\"\"},{\"metricId\":\"90824c6d-2f54-4728-86c3-b4c8588bce61\",\"metricName\":\"revenue\",\"metricDisplayName\":\"revenue\",\"metricDescription\":\"\"}],\"dimension\":[{\"dimensionName\":\"category\",\"dimensionDisplayName\":\"category\"},{\"dimensionName\":\"city\",\"dimensionDisplayName\":\"city\"}],\"dataStartFrom\":\"2019-10-01T00:00:00Z\",\"dataSourceType\":\"SqlServer\",\"timestampColumn\":\"\",\"startOffsetInSeconds\":0,\"maxQueryPerMinute\":30.0,\"granularityName\":\"Daily\",\"needRollup\":\"NoRollup\",\"fillMissingPointType\":\"PreviousValue\",\"fillMissingPointValue\":0.0,\"rollUpMethod\":\"None\",\"dataFeedDescription\":\"\",\"stopRetryAfterInSeconds\":-1,\"minRetryIntervalInSeconds\":-1,\"maxConcurrency\":0,\"viewMode\":\"Private\",\"admins\":[\"kaghiya@microsoft.com\"],\"viewers\":[],\"creator\":\"kaghiya@microsoft.com\",\"status\":\"Active\",\"createdTime\":\"2021-06-01T23:42:28Z\",\"isAdmin\":true,\"actionLinkTemplate\":\"\",\"dataSourceParameter\":{\"query\":\"select * from adsample2 where Timestamp = @StartTime\"},\"authenticationType\":\"AzureSQLConnectionString\",\"credentialId\":\"8d5b1fe4-35da-47f0-90c3-70d54d4b4562\"}", + "Date" : "Tue, 01 Jun 2021 23:42:48 GMT", + "Content-Type" : "application/json; charset=utf-8" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://REDACTED.cognitiveservices.azure.com/metricsadvisor/v1.0/dataFeeds/f0361e6e-8234-4eb7-8a7e-366cc625d4b9", + "Headers" : { + "User-Agent" : "azsdk-java-azure-ai-metricsadvisor/1.0.0-beta.4 (1.8.0_221; Mac OS X; 10.16)", + "x-ms-client-request-id" : "6623deb4-1c77-49bb-b4bd-6e12bdfc7937" + }, + "Response" : { + "x-request-id" : "e658f35c-aabf-4303-ae0c-ec4c99995b0c", + "content-length" : "1302", + "x-envoy-upstream-service-time" : "229", + "Strict-Transport-Security" : "max-age=31536000; includeSubDomains; preload", + "x-content-type-options" : "nosniff", + "apim-request-id" : "e658f35c-aabf-4303-ae0c-ec4c99995b0c", + "retry-after" : "0", + "StatusCode" : "200", + "Body" : "{\"dataFeedId\":\"f0361e6e-8234-4eb7-8a7e-366cc625d4b9\",\"dataFeedName\":\"java_create_data_feed_test_sample549648d1-7ba6-4151-8a8f-b4d06c351ebf\",\"metrics\":[{\"metricId\":\"315ba333-a229-49ef-8f8f-e7359428c1f0\",\"metricName\":\"cost\",\"metricDisplayName\":\"cost\",\"metricDescription\":\"\"},{\"metricId\":\"90824c6d-2f54-4728-86c3-b4c8588bce61\",\"metricName\":\"revenue\",\"metricDisplayName\":\"revenue\",\"metricDescription\":\"\"}],\"dimension\":[{\"dimensionName\":\"category\",\"dimensionDisplayName\":\"category\"},{\"dimensionName\":\"city\",\"dimensionDisplayName\":\"city\"}],\"dataStartFrom\":\"2019-10-01T00:00:00Z\",\"dataSourceType\":\"SqlServer\",\"timestampColumn\":\"\",\"startOffsetInSeconds\":0,\"maxQueryPerMinute\":30.0,\"granularityName\":\"Daily\",\"needRollup\":\"NoRollup\",\"fillMissingPointType\":\"PreviousValue\",\"fillMissingPointValue\":0.0,\"rollUpMethod\":\"None\",\"dataFeedDescription\":\"\",\"stopRetryAfterInSeconds\":-1,\"minRetryIntervalInSeconds\":-1,\"maxConcurrency\":0,\"viewMode\":\"Private\",\"admins\":[\"kaghiya@microsoft.com\"],\"viewers\":[],\"creator\":\"kaghiya@microsoft.com\",\"status\":\"Active\",\"createdTime\":\"2021-06-01T23:42:28Z\",\"isAdmin\":true,\"actionLinkTemplate\":\"\",\"dataSourceParameter\":{\"query\":\"select * from adsample2 where Timestamp = @StartTime\"},\"authenticationType\":\"AzureSQLConnectionString\",\"credentialId\":\"8d5b1fe4-35da-47f0-90c3-70d54d4b4562\"}", + "Date" : "Tue, 01 Jun 2021 23:42:48 GMT", + "Content-Type" : "application/json; charset=utf-8" + }, + "Exception" : null + }, { + "Method" : "POST", + "Uri" : "https://REDACTED.cognitiveservices.azure.com/metricsadvisor/v1.0/credentials", + "Headers" : { + "User-Agent" : "azsdk-java-azure-ai-metricsadvisor/1.0.0-beta.4 (1.8.0_221; Mac OS X; 10.16)", + "x-ms-client-request-id" : "3a0e9a89-17d3-47ce-9f83-e13ada5dbece", + "Content-Type" : "application/json" + }, + "Response" : { + "x-request-id" : "b20f121d-4870-4f5e-a1b3-168b9cbd95df", + "content-length" : "0", + "x-envoy-upstream-service-time" : "612", + "Strict-Transport-Security" : "max-age=31536000; includeSubDomains; preload", + "x-content-type-options" : "nosniff", + "apim-request-id" : "b20f121d-4870-4f5e-a1b3-168b9cbd95df", + "retry-after" : "0", + "StatusCode" : "201", + "Date" : "Tue, 01 Jun 2021 23:42:48 GMT", + "Location" : "https://js-metrics-advisor.cognitiveservices.azure.com/metricsadvisor/v1.0/credentials/22d9dd0c-d948-428b-9811-0ba9ddfcd817" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://REDACTED.cognitiveservices.azure.com/metricsadvisor/v1.0/credentials/22d9dd0c-d948-428b-9811-0ba9ddfcd817", + "Headers" : { + "User-Agent" : "azsdk-java-azure-ai-metricsadvisor/1.0.0-beta.4 (1.8.0_221; Mac OS X; 10.16)", + "x-ms-client-request-id" : "8f88ade2-ab13-421b-ace0-7deddc11a899" + }, + "Response" : { + "x-request-id" : "5c2d1384-b478-427a-a0f4-e723a53becd2", + "content-length" : "360", + "x-envoy-upstream-service-time" : "106", + "Strict-Transport-Security" : "max-age=31536000; includeSubDomains; preload", + "x-content-type-options" : "nosniff", + "apim-request-id" : "5c2d1384-b478-427a-a0f4-e723a53becd2", + "retry-after" : "0", + "StatusCode" : "200", + "Body" : "{\"dataSourceCredentialId\":\"22d9dd0c-d948-428b-9811-0ba9ddfcd817\",\"dataSourceCredentialName\":\"java_create_data_source_cred_sp5f242df3-7853-42f6-b26a-169c32189927\",\"dataSourceCredentialDescription\":\"\",\"dataSourceCredentialType\":\"ServicePrincipal\",\"parameters\":{\"clientId\":\"e70248b2-bffa-11eb-8529-0242ac130003\",\"tenantId\":\"45389ded-5e07-4e52-b225-4ae8f905afb5\"}}", + "Date" : "Tue, 01 Jun 2021 23:42:48 GMT", + "Content-Type" : "application/json; charset=utf-8" + }, + "Exception" : null + }, { + "Method" : "PATCH", + "Uri" : "https://REDACTED.cognitiveservices.azure.com/metricsadvisor/v1.0/dataFeeds/f0361e6e-8234-4eb7-8a7e-366cc625d4b9", + "Headers" : { + "User-Agent" : "azsdk-java-azure-ai-metricsadvisor/1.0.0-beta.4 (1.8.0_221; Mac OS X; 10.16)", + "x-ms-client-request-id" : "218d834e-db37-49a1-9ef4-165b94fb69a2", + "Content-Type" : "application/merge-patch+json" + }, + "Response" : { + "x-request-id" : "5b9cc807-db7f-420d-b309-4ed20580e70a", + "content-length" : "1294", + "x-envoy-upstream-service-time" : "1133", + "Strict-Transport-Security" : "max-age=31536000; includeSubDomains; preload", + "x-content-type-options" : "nosniff", + "apim-request-id" : "5b9cc807-db7f-420d-b309-4ed20580e70a", + "retry-after" : "0", + "StatusCode" : "200", + "Body" : "{\"dataFeedId\":\"f0361e6e-8234-4eb7-8a7e-366cc625d4b9\",\"dataFeedName\":\"java_create_data_feed_test_sample549648d1-7ba6-4151-8a8f-b4d06c351ebf\",\"metrics\":[{\"metricId\":\"315ba333-a229-49ef-8f8f-e7359428c1f0\",\"metricName\":\"cost\",\"metricDisplayName\":\"cost\",\"metricDescription\":\"\"},{\"metricId\":\"90824c6d-2f54-4728-86c3-b4c8588bce61\",\"metricName\":\"revenue\",\"metricDisplayName\":\"revenue\",\"metricDescription\":\"\"}],\"dimension\":[{\"dimensionName\":\"category\",\"dimensionDisplayName\":\"category\"},{\"dimensionName\":\"city\",\"dimensionDisplayName\":\"city\"}],\"dataStartFrom\":\"2019-10-01T00:00:00Z\",\"dataSourceType\":\"SqlServer\",\"timestampColumn\":\"\",\"startOffsetInSeconds\":0,\"maxQueryPerMinute\":30.0,\"granularityName\":\"Daily\",\"needRollup\":\"NoRollup\",\"fillMissingPointType\":\"PreviousValue\",\"fillMissingPointValue\":0.0,\"rollUpMethod\":\"None\",\"dataFeedDescription\":\"\",\"stopRetryAfterInSeconds\":-1,\"minRetryIntervalInSeconds\":-1,\"maxConcurrency\":0,\"viewMode\":\"Private\",\"admins\":[\"kaghiya@microsoft.com\"],\"viewers\":[],\"creator\":\"kaghiya@microsoft.com\",\"status\":\"Active\",\"createdTime\":\"2021-06-01T23:42:28Z\",\"isAdmin\":true,\"actionLinkTemplate\":\"\",\"dataSourceParameter\":{\"query\":\"select * from adsample2 where Timestamp = @StartTime\"},\"authenticationType\":\"ServicePrincipal\",\"credentialId\":\"22d9dd0c-d948-428b-9811-0ba9ddfcd817\"}", + "Date" : "Tue, 01 Jun 2021 23:42:50 GMT", + "Content-Type" : "application/json; charset=utf-8" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://REDACTED.cognitiveservices.azure.com/metricsadvisor/v1.0/dataFeeds/f0361e6e-8234-4eb7-8a7e-366cc625d4b9", + "Headers" : { + "User-Agent" : "azsdk-java-azure-ai-metricsadvisor/1.0.0-beta.4 (1.8.0_221; Mac OS X; 10.16)", + "x-ms-client-request-id" : "0debb8bb-12c5-4b53-87cb-0c17f5f8bc3b" + }, + "Response" : { + "x-request-id" : "bb410b63-8e52-41df-98ef-3774f190d32d", + "content-length" : "1294", + "x-envoy-upstream-service-time" : "294", + "Strict-Transport-Security" : "max-age=31536000; includeSubDomains; preload", + "x-content-type-options" : "nosniff", + "apim-request-id" : "bb410b63-8e52-41df-98ef-3774f190d32d", + "retry-after" : "0", + "StatusCode" : "200", + "Body" : "{\"dataFeedId\":\"f0361e6e-8234-4eb7-8a7e-366cc625d4b9\",\"dataFeedName\":\"java_create_data_feed_test_sample549648d1-7ba6-4151-8a8f-b4d06c351ebf\",\"metrics\":[{\"metricId\":\"315ba333-a229-49ef-8f8f-e7359428c1f0\",\"metricName\":\"cost\",\"metricDisplayName\":\"cost\",\"metricDescription\":\"\"},{\"metricId\":\"90824c6d-2f54-4728-86c3-b4c8588bce61\",\"metricName\":\"revenue\",\"metricDisplayName\":\"revenue\",\"metricDescription\":\"\"}],\"dimension\":[{\"dimensionName\":\"category\",\"dimensionDisplayName\":\"category\"},{\"dimensionName\":\"city\",\"dimensionDisplayName\":\"city\"}],\"dataStartFrom\":\"2019-10-01T00:00:00Z\",\"dataSourceType\":\"SqlServer\",\"timestampColumn\":\"\",\"startOffsetInSeconds\":0,\"maxQueryPerMinute\":30.0,\"granularityName\":\"Daily\",\"needRollup\":\"NoRollup\",\"fillMissingPointType\":\"PreviousValue\",\"fillMissingPointValue\":0.0,\"rollUpMethod\":\"None\",\"dataFeedDescription\":\"\",\"stopRetryAfterInSeconds\":-1,\"minRetryIntervalInSeconds\":-1,\"maxConcurrency\":0,\"viewMode\":\"Private\",\"admins\":[\"kaghiya@microsoft.com\"],\"viewers\":[],\"creator\":\"kaghiya@microsoft.com\",\"status\":\"Active\",\"createdTime\":\"2021-06-01T23:42:28Z\",\"isAdmin\":true,\"actionLinkTemplate\":\"\",\"dataSourceParameter\":{\"query\":\"select * from adsample2 where Timestamp = @StartTime\"},\"authenticationType\":\"ServicePrincipal\",\"credentialId\":\"22d9dd0c-d948-428b-9811-0ba9ddfcd817\"}", + "Date" : "Tue, 01 Jun 2021 23:42:50 GMT", + "Content-Type" : "application/json; charset=utf-8" + }, + "Exception" : null + }, { + "Method" : "POST", + "Uri" : "https://REDACTED.cognitiveservices.azure.com/metricsadvisor/v1.0/credentials", + "Headers" : { + "User-Agent" : "azsdk-java-azure-ai-metricsadvisor/1.0.0-beta.4 (1.8.0_221; Mac OS X; 10.16)", + "x-ms-client-request-id" : "bacb4cf1-2133-4df2-98b1-b1dda976ad84", + "Content-Type" : "application/json" + }, + "Response" : { + "x-request-id" : "7f8b4e48-acc3-4484-8f4d-e77fd8ad2e9e", + "content-length" : "0", + "x-envoy-upstream-service-time" : "549", + "Strict-Transport-Security" : "max-age=31536000; includeSubDomains; preload", + "x-content-type-options" : "nosniff", + "apim-request-id" : "7f8b4e48-acc3-4484-8f4d-e77fd8ad2e9e", + "retry-after" : "0", + "StatusCode" : "201", + "Date" : "Tue, 01 Jun 2021 23:42:51 GMT", + "Location" : "https://js-metrics-advisor.cognitiveservices.azure.com/metricsadvisor/v1.0/credentials/2184faf5-4684-47d6-ab08-a9bf84960330" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://REDACTED.cognitiveservices.azure.com/metricsadvisor/v1.0/credentials/2184faf5-4684-47d6-ab08-a9bf84960330", + "Headers" : { + "User-Agent" : "azsdk-java-azure-ai-metricsadvisor/1.0.0-beta.4 (1.8.0_221; Mac OS X; 10.16)", + "x-ms-client-request-id" : "8b336fc4-e7ee-4e5b-9821-05689769f4f1" + }, + "Response" : { + "x-request-id" : "ec932643-c95a-4948-93c0-66b1401f0e6a", + "content-length" : "549", + "x-envoy-upstream-service-time" : "5162", + "Strict-Transport-Security" : "max-age=31536000; includeSubDomains; preload", + "x-content-type-options" : "nosniff", + "apim-request-id" : "ec932643-c95a-4948-93c0-66b1401f0e6a", + "retry-after" : "0", + "StatusCode" : "200", + "Body" : "{\"dataSourceCredentialId\":\"2184faf5-4684-47d6-ab08-a9bf84960330\",\"dataSourceCredentialName\":\"java_create_data_source_cred_spkv409b06bf-e25b-4a75-9162-c68bc39d2e48\",\"dataSourceCredentialDescription\":\"\",\"dataSourceCredentialType\":\"ServicePrincipalInKV\",\"parameters\":{\"servicePrincipalSecretNameInKV\":\"DSClientSer_1\",\"servicePrincipalIdNameInKV\":\"DSClientID_1\",\"tenantId\":\"45389ded-5e07-4e52-b225-4ae8f905afb5\",\"keyVaultClientId\":\"e70248b2-bffa-11eb-8529-0242ac130003\",\"keyVaultEndpoint\":\"https://3c3fb196-4817-4a3e-b1ae-fb66aec2315d.vault.azure.net\"}}", + "Date" : "Tue, 01 Jun 2021 23:42:56 GMT", + "Content-Type" : "application/json; charset=utf-8" + }, + "Exception" : null + }, { + "Method" : "PATCH", + "Uri" : "https://REDACTED.cognitiveservices.azure.com/metricsadvisor/v1.0/dataFeeds/f0361e6e-8234-4eb7-8a7e-366cc625d4b9", + "Headers" : { + "User-Agent" : "azsdk-java-azure-ai-metricsadvisor/1.0.0-beta.4 (1.8.0_221; Mac OS X; 10.16)", + "x-ms-client-request-id" : "deb9c901-8de6-44c4-a361-ac661852d755", + "Content-Type" : "application/merge-patch+json" + }, + "Response" : { + "x-request-id" : "d4f56b28-708d-4a9f-9d27-12fc6128bde0", + "content-length" : "1298", + "x-envoy-upstream-service-time" : "974", + "Strict-Transport-Security" : "max-age=31536000; includeSubDomains; preload", + "x-content-type-options" : "nosniff", + "apim-request-id" : "d4f56b28-708d-4a9f-9d27-12fc6128bde0", + "retry-after" : "0", + "StatusCode" : "200", + "Body" : "{\"dataFeedId\":\"f0361e6e-8234-4eb7-8a7e-366cc625d4b9\",\"dataFeedName\":\"java_create_data_feed_test_sample549648d1-7ba6-4151-8a8f-b4d06c351ebf\",\"metrics\":[{\"metricId\":\"315ba333-a229-49ef-8f8f-e7359428c1f0\",\"metricName\":\"cost\",\"metricDisplayName\":\"cost\",\"metricDescription\":\"\"},{\"metricId\":\"90824c6d-2f54-4728-86c3-b4c8588bce61\",\"metricName\":\"revenue\",\"metricDisplayName\":\"revenue\",\"metricDescription\":\"\"}],\"dimension\":[{\"dimensionName\":\"category\",\"dimensionDisplayName\":\"category\"},{\"dimensionName\":\"city\",\"dimensionDisplayName\":\"city\"}],\"dataStartFrom\":\"2019-10-01T00:00:00Z\",\"dataSourceType\":\"SqlServer\",\"timestampColumn\":\"\",\"startOffsetInSeconds\":0,\"maxQueryPerMinute\":30.0,\"granularityName\":\"Daily\",\"needRollup\":\"NoRollup\",\"fillMissingPointType\":\"PreviousValue\",\"fillMissingPointValue\":0.0,\"rollUpMethod\":\"None\",\"dataFeedDescription\":\"\",\"stopRetryAfterInSeconds\":-1,\"minRetryIntervalInSeconds\":-1,\"maxConcurrency\":0,\"viewMode\":\"Private\",\"admins\":[\"kaghiya@microsoft.com\"],\"viewers\":[],\"creator\":\"kaghiya@microsoft.com\",\"status\":\"Active\",\"createdTime\":\"2021-06-01T23:42:28Z\",\"isAdmin\":true,\"actionLinkTemplate\":\"\",\"dataSourceParameter\":{\"query\":\"select * from adsample2 where Timestamp = @StartTime\"},\"authenticationType\":\"ServicePrincipalInKV\",\"credentialId\":\"2184faf5-4684-47d6-ab08-a9bf84960330\"}", + "Date" : "Tue, 01 Jun 2021 23:42:57 GMT", + "Content-Type" : "application/json; charset=utf-8" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://REDACTED.cognitiveservices.azure.com/metricsadvisor/v1.0/dataFeeds/f0361e6e-8234-4eb7-8a7e-366cc625d4b9", + "Headers" : { + "User-Agent" : "azsdk-java-azure-ai-metricsadvisor/1.0.0-beta.4 (1.8.0_221; Mac OS X; 10.16)", + "x-ms-client-request-id" : "9178bb18-9f89-47e0-85e4-a1182f88e1b5" + }, + "Response" : { + "x-request-id" : "fb37162b-f2f7-4f68-8fcd-c5ef8951273e", + "content-length" : "1298", + "x-envoy-upstream-service-time" : "283", + "Strict-Transport-Security" : "max-age=31536000; includeSubDomains; preload", + "x-content-type-options" : "nosniff", + "apim-request-id" : "fb37162b-f2f7-4f68-8fcd-c5ef8951273e", + "retry-after" : "0", + "StatusCode" : "200", + "Body" : "{\"dataFeedId\":\"f0361e6e-8234-4eb7-8a7e-366cc625d4b9\",\"dataFeedName\":\"java_create_data_feed_test_sample549648d1-7ba6-4151-8a8f-b4d06c351ebf\",\"metrics\":[{\"metricId\":\"315ba333-a229-49ef-8f8f-e7359428c1f0\",\"metricName\":\"cost\",\"metricDisplayName\":\"cost\",\"metricDescription\":\"\"},{\"metricId\":\"90824c6d-2f54-4728-86c3-b4c8588bce61\",\"metricName\":\"revenue\",\"metricDisplayName\":\"revenue\",\"metricDescription\":\"\"}],\"dimension\":[{\"dimensionName\":\"category\",\"dimensionDisplayName\":\"category\"},{\"dimensionName\":\"city\",\"dimensionDisplayName\":\"city\"}],\"dataStartFrom\":\"2019-10-01T00:00:00Z\",\"dataSourceType\":\"SqlServer\",\"timestampColumn\":\"\",\"startOffsetInSeconds\":0,\"maxQueryPerMinute\":30.0,\"granularityName\":\"Daily\",\"needRollup\":\"NoRollup\",\"fillMissingPointType\":\"PreviousValue\",\"fillMissingPointValue\":0.0,\"rollUpMethod\":\"None\",\"dataFeedDescription\":\"\",\"stopRetryAfterInSeconds\":-1,\"minRetryIntervalInSeconds\":-1,\"maxConcurrency\":0,\"viewMode\":\"Private\",\"admins\":[\"kaghiya@microsoft.com\"],\"viewers\":[],\"creator\":\"kaghiya@microsoft.com\",\"status\":\"Active\",\"createdTime\":\"2021-06-01T23:42:28Z\",\"isAdmin\":true,\"actionLinkTemplate\":\"\",\"dataSourceParameter\":{\"query\":\"select * from adsample2 where Timestamp = @StartTime\"},\"authenticationType\":\"ServicePrincipalInKV\",\"credentialId\":\"2184faf5-4684-47d6-ab08-a9bf84960330\"}", + "Date" : "Tue, 01 Jun 2021 23:42:57 GMT", + "Content-Type" : "application/json; charset=utf-8" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://REDACTED.cognitiveservices.azure.com/metricsadvisor/v1.0/dataFeeds/f0361e6e-8234-4eb7-8a7e-366cc625d4b9", + "Headers" : { + "User-Agent" : "azsdk-java-azure-ai-metricsadvisor/1.0.0-beta.4 (1.8.0_221; Mac OS X; 10.16)", + "x-ms-client-request-id" : "18c9d6f9-c5ba-4b5c-8bda-19a5885ba0fd" + }, + "Response" : { + "x-request-id" : "86f818f7-609b-4c38-9596-5f3218970846", + "content-length" : "0", + "x-envoy-upstream-service-time" : "544", + "Strict-Transport-Security" : "max-age=31536000; includeSubDomains; preload", + "x-content-type-options" : "nosniff", + "apim-request-id" : "86f818f7-609b-4c38-9596-5f3218970846", + "retry-after" : "0", + "StatusCode" : "204", + "Date" : "Tue, 01 Jun 2021 23:42:58 GMT" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://REDACTED.cognitiveservices.azure.com/metricsadvisor/v1.0/credentials/8d5b1fe4-35da-47f0-90c3-70d54d4b4562", + "Headers" : { + "User-Agent" : "azsdk-java-azure-ai-metricsadvisor/1.0.0-beta.4 (1.8.0_221; Mac OS X; 10.16)", + "x-ms-client-request-id" : "23d9ee10-b6af-4a8c-8fe0-5ea91d9e830e" + }, + "Response" : { + "x-request-id" : "23092eac-5e19-4085-82bc-4b8413d4dbc6", + "content-length" : "0", + "x-envoy-upstream-service-time" : "5226", + "Strict-Transport-Security" : "max-age=31536000; includeSubDomains; preload", + "x-content-type-options" : "nosniff", + "apim-request-id" : "23092eac-5e19-4085-82bc-4b8413d4dbc6", + "retry-after" : "0", + "StatusCode" : "204", + "Date" : "Tue, 01 Jun 2021 23:43:03 GMT" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://REDACTED.cognitiveservices.azure.com/metricsadvisor/v1.0/credentials/22d9dd0c-d948-428b-9811-0ba9ddfcd817", + "Headers" : { + "User-Agent" : "azsdk-java-azure-ai-metricsadvisor/1.0.0-beta.4 (1.8.0_221; Mac OS X; 10.16)", + "x-ms-client-request-id" : "b52058a7-9e9e-4640-a890-1abfb7e4ff4c" + }, + "Response" : { + "x-request-id" : "799f83d9-61b1-4e0c-87ba-d39206a4abd8", + "content-length" : "0", + "x-envoy-upstream-service-time" : "225", + "Strict-Transport-Security" : "max-age=31536000; includeSubDomains; preload", + "x-content-type-options" : "nosniff", + "apim-request-id" : "799f83d9-61b1-4e0c-87ba-d39206a4abd8", + "retry-after" : "0", + "StatusCode" : "204", + "Date" : "Tue, 01 Jun 2021 23:43:03 GMT" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://REDACTED.cognitiveservices.azure.com/metricsadvisor/v1.0/credentials/2184faf5-4684-47d6-ab08-a9bf84960330", + "Headers" : { + "User-Agent" : "azsdk-java-azure-ai-metricsadvisor/1.0.0-beta.4 (1.8.0_221; Mac OS X; 10.16)", + "x-ms-client-request-id" : "b509f752-fb2e-432f-8a1a-ec6ba3a8b6ae" + }, + "Response" : { + "x-request-id" : "4a88d164-f4cd-41f2-9bfc-998bf346dfac", + "content-length" : "0", + "x-envoy-upstream-service-time" : "193", + "Strict-Transport-Security" : "max-age=31536000; includeSubDomains; preload", + "x-content-type-options" : "nosniff", + "apim-request-id" : "4a88d164-f4cd-41f2-9bfc-998bf346dfac", + "retry-after" : "0", + "StatusCode" : "204", + "Date" : "Tue, 01 Jun 2021 23:43:03 GMT" + }, + "Exception" : null + } ], + "variables" : [ ] +} \ No newline at end of file diff --git a/sdk/metricsadvisor/azure-ai-metricsadvisor/src/test/resources/session-records/DataFeedWithCredentialsTest.testBlobStorage[1].json b/sdk/metricsadvisor/azure-ai-metricsadvisor/src/test/resources/session-records/DataFeedWithCredentialsTest.testBlobStorage[1].json new file mode 100644 index 0000000000000..2bd4d6c3605a0 --- /dev/null +++ b/sdk/metricsadvisor/azure-ai-metricsadvisor/src/test/resources/session-records/DataFeedWithCredentialsTest.testBlobStorage[1].json @@ -0,0 +1,108 @@ +{ + "networkCallRecords" : [ { + "Method" : "POST", + "Uri" : "https://REDACTED.cognitiveservices.azure.com/metricsadvisor/v1.0/dataFeeds", + "Headers" : { + "User-Agent" : "azsdk-java-azure-ai-metricsadvisor/1.0.0-beta.4 (1.8.0_221; Mac OS X; 10.16)", + "x-ms-client-request-id" : "c3c104d4-14fb-45cd-9b93-f6f85a477122", + "Content-Type" : "application/json" + }, + "Response" : { + "x-request-id" : "acbb9593-8167-4ea7-afbd-386d458ef1ba", + "content-length" : "0", + "x-envoy-upstream-service-time" : "5940", + "Strict-Transport-Security" : "max-age=31536000; includeSubDomains; preload", + "x-content-type-options" : "nosniff", + "apim-request-id" : "acbb9593-8167-4ea7-afbd-386d458ef1ba", + "retry-after" : "0", + "StatusCode" : "201", + "Date" : "Wed, 02 Jun 2021 00:30:44 GMT", + "Location" : "https://js-metrics-advisor.cognitiveservices.azure.com/metricsadvisor/v1.0/dataFeeds/dc2aceec-17ea-4f4c-9c09-3de176de8f4e" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://REDACTED.cognitiveservices.azure.com/metricsadvisor/v1.0/dataFeeds/dc2aceec-17ea-4f4c-9c09-3de176de8f4e", + "Headers" : { + "User-Agent" : "azsdk-java-azure-ai-metricsadvisor/1.0.0-beta.4 (1.8.0_221; Mac OS X; 10.16)", + "x-ms-client-request-id" : "008df2ca-6100-467e-bd16-27d30d9abe6a" + }, + "Response" : { + "x-request-id" : "f2207eb7-f2a6-4aa7-9be9-c9c9a5215567", + "content-length" : "1236", + "x-envoy-upstream-service-time" : "5199", + "Strict-Transport-Security" : "max-age=31536000; includeSubDomains; preload", + "x-content-type-options" : "nosniff", + "apim-request-id" : "f2207eb7-f2a6-4aa7-9be9-c9c9a5215567", + "retry-after" : "0", + "StatusCode" : "200", + "Body" : "{\"dataFeedId\":\"dc2aceec-17ea-4f4c-9c09-3de176de8f4e\",\"dataFeedName\":\"java_create_data_feed_test_sample6694b9ae-e08d-4c5d-97e6-377ea2f2118d\",\"metrics\":[{\"metricId\":\"0ce97fb3-38d4-4df5-b479-b91d116222e7\",\"metricName\":\"cost\",\"metricDisplayName\":\"cost\",\"metricDescription\":\"\"},{\"metricId\":\"dd3d183e-a763-445c-a8f2-496540789e5e\",\"metricName\":\"revenue\",\"metricDisplayName\":\"revenue\",\"metricDescription\":\"\"}],\"dimension\":[{\"dimensionName\":\"category\",\"dimensionDisplayName\":\"category\"},{\"dimensionName\":\"city\",\"dimensionDisplayName\":\"city\"}],\"dataStartFrom\":\"2019-10-01T00:00:00Z\",\"dataSourceType\":\"AzureBlob\",\"timestampColumn\":\"\",\"startOffsetInSeconds\":0,\"maxQueryPerMinute\":30.0,\"granularityName\":\"Daily\",\"needRollup\":\"NoRollup\",\"fillMissingPointType\":\"PreviousValue\",\"fillMissingPointValue\":0.0,\"rollUpMethod\":\"None\",\"dataFeedDescription\":\"\",\"stopRetryAfterInSeconds\":-1,\"minRetryIntervalInSeconds\":-1,\"maxConcurrency\":0,\"viewMode\":\"Private\",\"admins\":[\"kaghiya@microsoft.com\"],\"viewers\":[],\"creator\":\"kaghiya@microsoft.com\",\"status\":\"Active\",\"createdTime\":\"2021-06-02T00:30:44Z\",\"isAdmin\":true,\"actionLinkTemplate\":\"\",\"dataSourceParameter\":{\"container\":\"adsample\",\"blobTemplate\":\"%Y/%m/%d/%h/JsonFormatV2.json\"},\"authenticationType\":\"Basic\"}", + "Date" : "Wed, 02 Jun 2021 00:30:50 GMT", + "Content-Type" : "application/json; charset=utf-8" + }, + "Exception" : null + }, { + "Method" : "PATCH", + "Uri" : "https://REDACTED.cognitiveservices.azure.com/metricsadvisor/v1.0/dataFeeds/dc2aceec-17ea-4f4c-9c09-3de176de8f4e", + "Headers" : { + "User-Agent" : "azsdk-java-azure-ai-metricsadvisor/1.0.0-beta.4 (1.8.0_221; Mac OS X; 10.16)", + "x-ms-client-request-id" : "3c2552ef-807e-4d89-8b44-ea31f53462a2", + "Content-Type" : "application/merge-patch+json" + }, + "Response" : { + "x-request-id" : "69a408f1-fcb3-4ece-b826-7eee42367f26", + "content-length" : "1246", + "x-envoy-upstream-service-time" : "1128", + "Strict-Transport-Security" : "max-age=31536000; includeSubDomains; preload", + "x-content-type-options" : "nosniff", + "apim-request-id" : "69a408f1-fcb3-4ece-b826-7eee42367f26", + "retry-after" : "0", + "StatusCode" : "200", + "Body" : "{\"dataFeedId\":\"dc2aceec-17ea-4f4c-9c09-3de176de8f4e\",\"dataFeedName\":\"java_create_data_feed_test_sample6694b9ae-e08d-4c5d-97e6-377ea2f2118d\",\"metrics\":[{\"metricId\":\"0ce97fb3-38d4-4df5-b479-b91d116222e7\",\"metricName\":\"cost\",\"metricDisplayName\":\"cost\",\"metricDescription\":\"\"},{\"metricId\":\"dd3d183e-a763-445c-a8f2-496540789e5e\",\"metricName\":\"revenue\",\"metricDisplayName\":\"revenue\",\"metricDescription\":\"\"}],\"dimension\":[{\"dimensionName\":\"category\",\"dimensionDisplayName\":\"category\"},{\"dimensionName\":\"city\",\"dimensionDisplayName\":\"city\"}],\"dataStartFrom\":\"2019-10-01T00:00:00Z\",\"dataSourceType\":\"AzureBlob\",\"timestampColumn\":\"\",\"startOffsetInSeconds\":0,\"maxQueryPerMinute\":30.0,\"granularityName\":\"Daily\",\"needRollup\":\"NoRollup\",\"fillMissingPointType\":\"PreviousValue\",\"fillMissingPointValue\":0.0,\"rollUpMethod\":\"None\",\"dataFeedDescription\":\"\",\"stopRetryAfterInSeconds\":-1,\"minRetryIntervalInSeconds\":-1,\"maxConcurrency\":0,\"viewMode\":\"Private\",\"admins\":[\"kaghiya@microsoft.com\"],\"viewers\":[],\"creator\":\"kaghiya@microsoft.com\",\"status\":\"Active\",\"createdTime\":\"2021-06-02T00:30:44Z\",\"isAdmin\":true,\"actionLinkTemplate\":\"\",\"dataSourceParameter\":{\"container\":\"adsample\",\"blobTemplate\":\"%Y/%m/%d/%h/JsonFormatV2.json\"},\"authenticationType\":\"ManagedIdentity\"}", + "Date" : "Wed, 02 Jun 2021 00:30:50 GMT", + "Content-Type" : "application/json; charset=utf-8" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://REDACTED.cognitiveservices.azure.com/metricsadvisor/v1.0/dataFeeds/dc2aceec-17ea-4f4c-9c09-3de176de8f4e", + "Headers" : { + "User-Agent" : "azsdk-java-azure-ai-metricsadvisor/1.0.0-beta.4 (1.8.0_221; Mac OS X; 10.16)", + "x-ms-client-request-id" : "d210fb34-1a3c-4d07-b25d-74444927b4d6" + }, + "Response" : { + "x-request-id" : "a1597da5-3eaa-4bf4-9d26-acb4fd856583", + "content-length" : "1246", + "x-envoy-upstream-service-time" : "175", + "Strict-Transport-Security" : "max-age=31536000; includeSubDomains; preload", + "x-content-type-options" : "nosniff", + "apim-request-id" : "a1597da5-3eaa-4bf4-9d26-acb4fd856583", + "retry-after" : "0", + "StatusCode" : "200", + "Body" : "{\"dataFeedId\":\"dc2aceec-17ea-4f4c-9c09-3de176de8f4e\",\"dataFeedName\":\"java_create_data_feed_test_sample6694b9ae-e08d-4c5d-97e6-377ea2f2118d\",\"metrics\":[{\"metricId\":\"0ce97fb3-38d4-4df5-b479-b91d116222e7\",\"metricName\":\"cost\",\"metricDisplayName\":\"cost\",\"metricDescription\":\"\"},{\"metricId\":\"dd3d183e-a763-445c-a8f2-496540789e5e\",\"metricName\":\"revenue\",\"metricDisplayName\":\"revenue\",\"metricDescription\":\"\"}],\"dimension\":[{\"dimensionName\":\"category\",\"dimensionDisplayName\":\"category\"},{\"dimensionName\":\"city\",\"dimensionDisplayName\":\"city\"}],\"dataStartFrom\":\"2019-10-01T00:00:00Z\",\"dataSourceType\":\"AzureBlob\",\"timestampColumn\":\"\",\"startOffsetInSeconds\":0,\"maxQueryPerMinute\":30.0,\"granularityName\":\"Daily\",\"needRollup\":\"NoRollup\",\"fillMissingPointType\":\"PreviousValue\",\"fillMissingPointValue\":0.0,\"rollUpMethod\":\"None\",\"dataFeedDescription\":\"\",\"stopRetryAfterInSeconds\":-1,\"minRetryIntervalInSeconds\":-1,\"maxConcurrency\":0,\"viewMode\":\"Private\",\"admins\":[\"kaghiya@microsoft.com\"],\"viewers\":[],\"creator\":\"kaghiya@microsoft.com\",\"status\":\"Active\",\"createdTime\":\"2021-06-02T00:30:44Z\",\"isAdmin\":true,\"actionLinkTemplate\":\"\",\"dataSourceParameter\":{\"container\":\"adsample\",\"blobTemplate\":\"%Y/%m/%d/%h/JsonFormatV2.json\"},\"authenticationType\":\"ManagedIdentity\"}", + "Date" : "Wed, 02 Jun 2021 00:30:51 GMT", + "Content-Type" : "application/json; charset=utf-8" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://REDACTED.cognitiveservices.azure.com/metricsadvisor/v1.0/dataFeeds/dc2aceec-17ea-4f4c-9c09-3de176de8f4e", + "Headers" : { + "User-Agent" : "azsdk-java-azure-ai-metricsadvisor/1.0.0-beta.4 (1.8.0_221; Mac OS X; 10.16)", + "x-ms-client-request-id" : "058b9709-06eb-47e6-b144-abdb6931cad8" + }, + "Response" : { + "x-request-id" : "6aa20aff-829d-4632-a809-1f8fa074527d", + "content-length" : "0", + "x-envoy-upstream-service-time" : "501", + "Strict-Transport-Security" : "max-age=31536000; includeSubDomains; preload", + "x-content-type-options" : "nosniff", + "apim-request-id" : "6aa20aff-829d-4632-a809-1f8fa074527d", + "retry-after" : "0", + "StatusCode" : "204", + "Date" : "Wed, 02 Jun 2021 00:30:51 GMT" + }, + "Exception" : null + } ], + "variables" : [ ] +} \ No newline at end of file diff --git a/sdk/metricsadvisor/azure-ai-metricsadvisor/src/test/resources/session-records/DataFeedWithCredentialsTest.testDataExplorer[1].json b/sdk/metricsadvisor/azure-ai-metricsadvisor/src/test/resources/session-records/DataFeedWithCredentialsTest.testDataExplorer[1].json new file mode 100644 index 0000000000000..091f74a092349 --- /dev/null +++ b/sdk/metricsadvisor/azure-ai-metricsadvisor/src/test/resources/session-records/DataFeedWithCredentialsTest.testDataExplorer[1].json @@ -0,0 +1,316 @@ +{ + "networkCallRecords" : [ { + "Method" : "POST", + "Uri" : "https://REDACTED.cognitiveservices.azure.com/metricsadvisor/v1.0/dataFeeds", + "Headers" : { + "User-Agent" : "azsdk-java-azure-ai-metricsadvisor/1.0.0-beta.4 (1.8.0_221; Mac OS X; 10.16)", + "x-ms-client-request-id" : "42e1baea-3ef1-43e3-85ad-77c10ae09d9b", + "Content-Type" : "application/json" + }, + "Response" : { + "x-request-id" : "8cb86b30-7214-4505-b83d-56c283749e32", + "content-length" : "0", + "x-envoy-upstream-service-time" : "854", + "Strict-Transport-Security" : "max-age=31536000; includeSubDomains; preload", + "x-content-type-options" : "nosniff", + "apim-request-id" : "8cb86b30-7214-4505-b83d-56c283749e32", + "retry-after" : "0", + "StatusCode" : "201", + "Date" : "Wed, 02 Jun 2021 00:30:39 GMT", + "Location" : "https://js-metrics-advisor.cognitiveservices.azure.com/metricsadvisor/v1.0/dataFeeds/986abb54-0ff2-4382-993a-c439c36aedda" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://REDACTED.cognitiveservices.azure.com/metricsadvisor/v1.0/dataFeeds/986abb54-0ff2-4382-993a-c439c36aedda", + "Headers" : { + "User-Agent" : "azsdk-java-azure-ai-metricsadvisor/1.0.0-beta.4 (1.8.0_221; Mac OS X; 10.16)", + "x-ms-client-request-id" : "2439ca35-ceb7-4e5d-9261-7b30f0f40f9a" + }, + "Response" : { + "x-request-id" : "ae523518-82d1-40c9-affc-99f62e6c5500", + "content-length" : "1333", + "x-envoy-upstream-service-time" : "5212", + "Strict-Transport-Security" : "max-age=31536000; includeSubDomains; preload", + "x-content-type-options" : "nosniff", + "apim-request-id" : "ae523518-82d1-40c9-affc-99f62e6c5500", + "retry-after" : "0", + "StatusCode" : "200", + "Body" : "{\"dataFeedId\":\"986abb54-0ff2-4382-993a-c439c36aedda\",\"dataFeedName\":\"java_create_data_feed_test_sample99b2d1f8-0708-45ab-8ad3-5a2f9b3a782d\",\"metrics\":[{\"metricId\":\"19572902-49ff-4d75-b121-bbeb6a5d669f\",\"metricName\":\"cost\",\"metricDisplayName\":\"cost\",\"metricDescription\":\"\"},{\"metricId\":\"0c7fa807-44ee-4827-adee-4681d5daa730\",\"metricName\":\"revenue\",\"metricDisplayName\":\"revenue\",\"metricDescription\":\"\"}],\"dimension\":[{\"dimensionName\":\"category\",\"dimensionDisplayName\":\"category\"},{\"dimensionName\":\"city\",\"dimensionDisplayName\":\"city\"}],\"dataStartFrom\":\"2019-10-01T00:00:00Z\",\"dataSourceType\":\"AzureDataExplorer\",\"timestampColumn\":\"\",\"startOffsetInSeconds\":0,\"maxQueryPerMinute\":30.0,\"granularityName\":\"Daily\",\"needRollup\":\"NoRollup\",\"fillMissingPointType\":\"PreviousValue\",\"fillMissingPointValue\":0.0,\"rollUpMethod\":\"None\",\"dataFeedDescription\":\"\",\"stopRetryAfterInSeconds\":-1,\"minRetryIntervalInSeconds\":-1,\"maxConcurrency\":0,\"viewMode\":\"Private\",\"admins\":[\"kaghiya@microsoft.com\"],\"viewers\":[],\"creator\":\"kaghiya@microsoft.com\",\"status\":\"Active\",\"createdTime\":\"2021-06-02T00:30:39Z\",\"isAdmin\":true,\"actionLinkTemplate\":\"\",\"dataSourceParameter\":{\"query\":\"let StartDateTime = datetime(@StartTime);let EndDateTime = StartDateTime + 1d;adsample| where Timestamp >= StartDateTime and Timestamp < EndDateTime\"},\"authenticationType\":\"Basic\"}", + "Date" : "Wed, 02 Jun 2021 00:30:45 GMT", + "Content-Type" : "application/json; charset=utf-8" + }, + "Exception" : null + }, { + "Method" : "PATCH", + "Uri" : "https://REDACTED.cognitiveservices.azure.com/metricsadvisor/v1.0/dataFeeds/986abb54-0ff2-4382-993a-c439c36aedda", + "Headers" : { + "User-Agent" : "azsdk-java-azure-ai-metricsadvisor/1.0.0-beta.4 (1.8.0_221; Mac OS X; 10.16)", + "x-ms-client-request-id" : "7f5e0f39-4718-4ebf-b5f2-0fa7617ca662", + "Content-Type" : "application/merge-patch+json" + }, + "Response" : { + "x-request-id" : "c4a2ee9b-f64e-4e86-9592-a898a94adf36", + "content-length" : "1343", + "x-envoy-upstream-service-time" : "932", + "Strict-Transport-Security" : "max-age=31536000; includeSubDomains; preload", + "x-content-type-options" : "nosniff", + "apim-request-id" : "c4a2ee9b-f64e-4e86-9592-a898a94adf36", + "retry-after" : "0", + "StatusCode" : "200", + "Body" : "{\"dataFeedId\":\"986abb54-0ff2-4382-993a-c439c36aedda\",\"dataFeedName\":\"java_create_data_feed_test_sample99b2d1f8-0708-45ab-8ad3-5a2f9b3a782d\",\"metrics\":[{\"metricId\":\"19572902-49ff-4d75-b121-bbeb6a5d669f\",\"metricName\":\"cost\",\"metricDisplayName\":\"cost\",\"metricDescription\":\"\"},{\"metricId\":\"0c7fa807-44ee-4827-adee-4681d5daa730\",\"metricName\":\"revenue\",\"metricDisplayName\":\"revenue\",\"metricDescription\":\"\"}],\"dimension\":[{\"dimensionName\":\"category\",\"dimensionDisplayName\":\"category\"},{\"dimensionName\":\"city\",\"dimensionDisplayName\":\"city\"}],\"dataStartFrom\":\"2019-10-01T00:00:00Z\",\"dataSourceType\":\"AzureDataExplorer\",\"timestampColumn\":\"\",\"startOffsetInSeconds\":0,\"maxQueryPerMinute\":30.0,\"granularityName\":\"Daily\",\"needRollup\":\"NoRollup\",\"fillMissingPointType\":\"PreviousValue\",\"fillMissingPointValue\":0.0,\"rollUpMethod\":\"None\",\"dataFeedDescription\":\"\",\"stopRetryAfterInSeconds\":-1,\"minRetryIntervalInSeconds\":-1,\"maxConcurrency\":0,\"viewMode\":\"Private\",\"admins\":[\"kaghiya@microsoft.com\"],\"viewers\":[],\"creator\":\"kaghiya@microsoft.com\",\"status\":\"Active\",\"createdTime\":\"2021-06-02T00:30:39Z\",\"isAdmin\":true,\"actionLinkTemplate\":\"\",\"dataSourceParameter\":{\"query\":\"let StartDateTime = datetime(@StartTime);let EndDateTime = StartDateTime + 1d;adsample| where Timestamp >= StartDateTime and Timestamp < EndDateTime\"},\"authenticationType\":\"ManagedIdentity\"}", + "Date" : "Wed, 02 Jun 2021 00:30:46 GMT", + "Content-Type" : "application/json; charset=utf-8" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://REDACTED.cognitiveservices.azure.com/metricsadvisor/v1.0/dataFeeds/986abb54-0ff2-4382-993a-c439c36aedda", + "Headers" : { + "User-Agent" : "azsdk-java-azure-ai-metricsadvisor/1.0.0-beta.4 (1.8.0_221; Mac OS X; 10.16)", + "x-ms-client-request-id" : "8fe5a4f2-0f20-4d7c-8255-b5c6a2f94f83" + }, + "Response" : { + "x-request-id" : "e64f4781-931f-4f9f-bcd9-4707840cfd47", + "content-length" : "1343", + "x-envoy-upstream-service-time" : "5208", + "Strict-Transport-Security" : "max-age=31536000; includeSubDomains; preload", + "x-content-type-options" : "nosniff", + "apim-request-id" : "e64f4781-931f-4f9f-bcd9-4707840cfd47", + "retry-after" : "0", + "StatusCode" : "200", + "Body" : "{\"dataFeedId\":\"986abb54-0ff2-4382-993a-c439c36aedda\",\"dataFeedName\":\"java_create_data_feed_test_sample99b2d1f8-0708-45ab-8ad3-5a2f9b3a782d\",\"metrics\":[{\"metricId\":\"19572902-49ff-4d75-b121-bbeb6a5d669f\",\"metricName\":\"cost\",\"metricDisplayName\":\"cost\",\"metricDescription\":\"\"},{\"metricId\":\"0c7fa807-44ee-4827-adee-4681d5daa730\",\"metricName\":\"revenue\",\"metricDisplayName\":\"revenue\",\"metricDescription\":\"\"}],\"dimension\":[{\"dimensionName\":\"category\",\"dimensionDisplayName\":\"category\"},{\"dimensionName\":\"city\",\"dimensionDisplayName\":\"city\"}],\"dataStartFrom\":\"2019-10-01T00:00:00Z\",\"dataSourceType\":\"AzureDataExplorer\",\"timestampColumn\":\"\",\"startOffsetInSeconds\":0,\"maxQueryPerMinute\":30.0,\"granularityName\":\"Daily\",\"needRollup\":\"NoRollup\",\"fillMissingPointType\":\"PreviousValue\",\"fillMissingPointValue\":0.0,\"rollUpMethod\":\"None\",\"dataFeedDescription\":\"\",\"stopRetryAfterInSeconds\":-1,\"minRetryIntervalInSeconds\":-1,\"maxConcurrency\":0,\"viewMode\":\"Private\",\"admins\":[\"kaghiya@microsoft.com\"],\"viewers\":[],\"creator\":\"kaghiya@microsoft.com\",\"status\":\"Active\",\"createdTime\":\"2021-06-02T00:30:39Z\",\"isAdmin\":true,\"actionLinkTemplate\":\"\",\"dataSourceParameter\":{\"query\":\"let StartDateTime = datetime(@StartTime);let EndDateTime = StartDateTime + 1d;adsample| where Timestamp >= StartDateTime and Timestamp < EndDateTime\"},\"authenticationType\":\"ManagedIdentity\"}", + "Date" : "Wed, 02 Jun 2021 00:30:51 GMT", + "Content-Type" : "application/json; charset=utf-8" + }, + "Exception" : null + }, { + "Method" : "POST", + "Uri" : "https://REDACTED.cognitiveservices.azure.com/metricsadvisor/v1.0/credentials", + "Headers" : { + "User-Agent" : "azsdk-java-azure-ai-metricsadvisor/1.0.0-beta.4 (1.8.0_221; Mac OS X; 10.16)", + "x-ms-client-request-id" : "49e71574-1a44-4644-bfda-13b356c8996b", + "Content-Type" : "application/json" + }, + "Response" : { + "x-request-id" : "a5980737-0ee9-46dc-abbb-6262bfa2580d", + "content-length" : "0", + "x-envoy-upstream-service-time" : "351", + "Strict-Transport-Security" : "max-age=31536000; includeSubDomains; preload", + "x-content-type-options" : "nosniff", + "apim-request-id" : "a5980737-0ee9-46dc-abbb-6262bfa2580d", + "retry-after" : "0", + "StatusCode" : "201", + "Date" : "Wed, 02 Jun 2021 00:30:51 GMT", + "Location" : "https://js-metrics-advisor.cognitiveservices.azure.com/metricsadvisor/v1.0/credentials/fbe58c18-af15-4ccb-b7a7-eddb43d1c8b3" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://REDACTED.cognitiveservices.azure.com/metricsadvisor/v1.0/credentials/fbe58c18-af15-4ccb-b7a7-eddb43d1c8b3", + "Headers" : { + "User-Agent" : "azsdk-java-azure-ai-metricsadvisor/1.0.0-beta.4 (1.8.0_221; Mac OS X; 10.16)", + "x-ms-client-request-id" : "b773e1a6-24a8-4652-98a3-54412c869801" + }, + "Response" : { + "x-request-id" : "c2d87564-3b1e-4543-8bf0-4cd82f0e108d", + "content-length" : "360", + "x-envoy-upstream-service-time" : "143", + "Strict-Transport-Security" : "max-age=31536000; includeSubDomains; preload", + "x-content-type-options" : "nosniff", + "apim-request-id" : "c2d87564-3b1e-4543-8bf0-4cd82f0e108d", + "retry-after" : "0", + "StatusCode" : "200", + "Body" : "{\"dataSourceCredentialId\":\"fbe58c18-af15-4ccb-b7a7-eddb43d1c8b3\",\"dataSourceCredentialName\":\"java_create_data_source_cred_spcf14e3fb-4f4b-4d55-847a-bcb62c501316\",\"dataSourceCredentialDescription\":\"\",\"dataSourceCredentialType\":\"ServicePrincipal\",\"parameters\":{\"clientId\":\"e70248b2-bffa-11eb-8529-0242ac130003\",\"tenantId\":\"45389ded-5e07-4e52-b225-4ae8f905afb5\"}}", + "Date" : "Wed, 02 Jun 2021 00:30:52 GMT", + "Content-Type" : "application/json; charset=utf-8" + }, + "Exception" : null + }, { + "Method" : "PATCH", + "Uri" : "https://REDACTED.cognitiveservices.azure.com/metricsadvisor/v1.0/dataFeeds/986abb54-0ff2-4382-993a-c439c36aedda", + "Headers" : { + "User-Agent" : "azsdk-java-azure-ai-metricsadvisor/1.0.0-beta.4 (1.8.0_221; Mac OS X; 10.16)", + "x-ms-client-request-id" : "a0e1915e-6b81-44ea-ba0c-90a18d099ea1", + "Content-Type" : "application/merge-patch+json" + }, + "Response" : { + "x-request-id" : "9a52c6bd-967a-4948-983a-f79d6c1f2870", + "content-length" : "1398", + "x-envoy-upstream-service-time" : "1026", + "Strict-Transport-Security" : "max-age=31536000; includeSubDomains; preload", + "x-content-type-options" : "nosniff", + "apim-request-id" : "9a52c6bd-967a-4948-983a-f79d6c1f2870", + "retry-after" : "0", + "StatusCode" : "200", + "Body" : "{\"dataFeedId\":\"986abb54-0ff2-4382-993a-c439c36aedda\",\"dataFeedName\":\"java_create_data_feed_test_sample99b2d1f8-0708-45ab-8ad3-5a2f9b3a782d\",\"metrics\":[{\"metricId\":\"19572902-49ff-4d75-b121-bbeb6a5d669f\",\"metricName\":\"cost\",\"metricDisplayName\":\"cost\",\"metricDescription\":\"\"},{\"metricId\":\"0c7fa807-44ee-4827-adee-4681d5daa730\",\"metricName\":\"revenue\",\"metricDisplayName\":\"revenue\",\"metricDescription\":\"\"}],\"dimension\":[{\"dimensionName\":\"category\",\"dimensionDisplayName\":\"category\"},{\"dimensionName\":\"city\",\"dimensionDisplayName\":\"city\"}],\"dataStartFrom\":\"2019-10-01T00:00:00Z\",\"dataSourceType\":\"AzureDataExplorer\",\"timestampColumn\":\"\",\"startOffsetInSeconds\":0,\"maxQueryPerMinute\":30.0,\"granularityName\":\"Daily\",\"needRollup\":\"NoRollup\",\"fillMissingPointType\":\"PreviousValue\",\"fillMissingPointValue\":0.0,\"rollUpMethod\":\"None\",\"dataFeedDescription\":\"\",\"stopRetryAfterInSeconds\":-1,\"minRetryIntervalInSeconds\":-1,\"maxConcurrency\":0,\"viewMode\":\"Private\",\"admins\":[\"kaghiya@microsoft.com\"],\"viewers\":[],\"creator\":\"kaghiya@microsoft.com\",\"status\":\"Active\",\"createdTime\":\"2021-06-02T00:30:39Z\",\"isAdmin\":true,\"actionLinkTemplate\":\"\",\"dataSourceParameter\":{\"query\":\"let StartDateTime = datetime(@StartTime);let EndDateTime = StartDateTime + 1d;adsample| where Timestamp >= StartDateTime and Timestamp < EndDateTime\"},\"authenticationType\":\"ServicePrincipal\",\"credentialId\":\"fbe58c18-af15-4ccb-b7a7-eddb43d1c8b3\"}", + "Date" : "Wed, 02 Jun 2021 00:30:52 GMT", + "Content-Type" : "application/json; charset=utf-8" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://REDACTED.cognitiveservices.azure.com/metricsadvisor/v1.0/dataFeeds/986abb54-0ff2-4382-993a-c439c36aedda", + "Headers" : { + "User-Agent" : "azsdk-java-azure-ai-metricsadvisor/1.0.0-beta.4 (1.8.0_221; Mac OS X; 10.16)", + "x-ms-client-request-id" : "90fbf847-63ce-4fea-badc-c175062195ca" + }, + "Response" : { + "x-request-id" : "f7c912e3-b846-405c-981e-8eed8bb0ac2b", + "content-length" : "1398", + "x-envoy-upstream-service-time" : "5220", + "Strict-Transport-Security" : "max-age=31536000; includeSubDomains; preload", + "x-content-type-options" : "nosniff", + "apim-request-id" : "f7c912e3-b846-405c-981e-8eed8bb0ac2b", + "retry-after" : "0", + "StatusCode" : "200", + "Body" : "{\"dataFeedId\":\"986abb54-0ff2-4382-993a-c439c36aedda\",\"dataFeedName\":\"java_create_data_feed_test_sample99b2d1f8-0708-45ab-8ad3-5a2f9b3a782d\",\"metrics\":[{\"metricId\":\"19572902-49ff-4d75-b121-bbeb6a5d669f\",\"metricName\":\"cost\",\"metricDisplayName\":\"cost\",\"metricDescription\":\"\"},{\"metricId\":\"0c7fa807-44ee-4827-adee-4681d5daa730\",\"metricName\":\"revenue\",\"metricDisplayName\":\"revenue\",\"metricDescription\":\"\"}],\"dimension\":[{\"dimensionName\":\"category\",\"dimensionDisplayName\":\"category\"},{\"dimensionName\":\"city\",\"dimensionDisplayName\":\"city\"}],\"dataStartFrom\":\"2019-10-01T00:00:00Z\",\"dataSourceType\":\"AzureDataExplorer\",\"timestampColumn\":\"\",\"startOffsetInSeconds\":0,\"maxQueryPerMinute\":30.0,\"granularityName\":\"Daily\",\"needRollup\":\"NoRollup\",\"fillMissingPointType\":\"PreviousValue\",\"fillMissingPointValue\":0.0,\"rollUpMethod\":\"None\",\"dataFeedDescription\":\"\",\"stopRetryAfterInSeconds\":-1,\"minRetryIntervalInSeconds\":-1,\"maxConcurrency\":0,\"viewMode\":\"Private\",\"admins\":[\"kaghiya@microsoft.com\"],\"viewers\":[],\"creator\":\"kaghiya@microsoft.com\",\"status\":\"Active\",\"createdTime\":\"2021-06-02T00:30:39Z\",\"isAdmin\":true,\"actionLinkTemplate\":\"\",\"dataSourceParameter\":{\"query\":\"let StartDateTime = datetime(@StartTime);let EndDateTime = StartDateTime + 1d;adsample| where Timestamp >= StartDateTime and Timestamp < EndDateTime\"},\"authenticationType\":\"ServicePrincipal\",\"credentialId\":\"fbe58c18-af15-4ccb-b7a7-eddb43d1c8b3\"}", + "Date" : "Wed, 02 Jun 2021 00:30:58 GMT", + "Content-Type" : "application/json; charset=utf-8" + }, + "Exception" : null + }, { + "Method" : "POST", + "Uri" : "https://REDACTED.cognitiveservices.azure.com/metricsadvisor/v1.0/credentials", + "Headers" : { + "User-Agent" : "azsdk-java-azure-ai-metricsadvisor/1.0.0-beta.4 (1.8.0_221; Mac OS X; 10.16)", + "x-ms-client-request-id" : "21659838-d2d2-437e-800a-380533f6d51c", + "Content-Type" : "application/json" + }, + "Response" : { + "x-request-id" : "9712f494-5332-48fb-b644-bb3822d8ba55", + "content-length" : "0", + "x-envoy-upstream-service-time" : "324", + "Strict-Transport-Security" : "max-age=31536000; includeSubDomains; preload", + "x-content-type-options" : "nosniff", + "apim-request-id" : "9712f494-5332-48fb-b644-bb3822d8ba55", + "retry-after" : "0", + "StatusCode" : "201", + "Date" : "Wed, 02 Jun 2021 00:30:59 GMT", + "Location" : "https://js-metrics-advisor.cognitiveservices.azure.com/metricsadvisor/v1.0/credentials/d2ec3254-6e15-4862-a228-b22502ab2bc1" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://REDACTED.cognitiveservices.azure.com/metricsadvisor/v1.0/credentials/d2ec3254-6e15-4862-a228-b22502ab2bc1", + "Headers" : { + "User-Agent" : "azsdk-java-azure-ai-metricsadvisor/1.0.0-beta.4 (1.8.0_221; Mac OS X; 10.16)", + "x-ms-client-request-id" : "cf18c03a-dda5-4415-a079-378157e93112" + }, + "Response" : { + "x-request-id" : "8ae339d3-f4ac-4422-a5f9-762a276ad352", + "content-length" : "549", + "x-envoy-upstream-service-time" : "79", + "Strict-Transport-Security" : "max-age=31536000; includeSubDomains; preload", + "x-content-type-options" : "nosniff", + "apim-request-id" : "8ae339d3-f4ac-4422-a5f9-762a276ad352", + "retry-after" : "0", + "StatusCode" : "200", + "Body" : "{\"dataSourceCredentialId\":\"d2ec3254-6e15-4862-a228-b22502ab2bc1\",\"dataSourceCredentialName\":\"java_create_data_source_cred_spkv7731d8ac-bc24-4e63-acae-f5873daaa994\",\"dataSourceCredentialDescription\":\"\",\"dataSourceCredentialType\":\"ServicePrincipalInKV\",\"parameters\":{\"servicePrincipalSecretNameInKV\":\"DSClientSer_1\",\"servicePrincipalIdNameInKV\":\"DSClientID_1\",\"tenantId\":\"45389ded-5e07-4e52-b225-4ae8f905afb5\",\"keyVaultClientId\":\"e70248b2-bffa-11eb-8529-0242ac130003\",\"keyVaultEndpoint\":\"https://0c999727-775b-4eac-9dad-543217d615ca.vault.azure.net\"}}", + "Date" : "Wed, 02 Jun 2021 00:30:58 GMT", + "Content-Type" : "application/json; charset=utf-8" + }, + "Exception" : null + }, { + "Method" : "PATCH", + "Uri" : "https://REDACTED.cognitiveservices.azure.com/metricsadvisor/v1.0/dataFeeds/986abb54-0ff2-4382-993a-c439c36aedda", + "Headers" : { + "User-Agent" : "azsdk-java-azure-ai-metricsadvisor/1.0.0-beta.4 (1.8.0_221; Mac OS X; 10.16)", + "x-ms-client-request-id" : "83e8b7d6-d176-4581-aa23-f6f9393ee406", + "Content-Type" : "application/merge-patch+json" + }, + "Response" : { + "x-request-id" : "b96e7ac6-ba25-4edf-bce8-7a0ea496d01f", + "content-length" : "1402", + "x-envoy-upstream-service-time" : "950", + "Strict-Transport-Security" : "max-age=31536000; includeSubDomains; preload", + "x-content-type-options" : "nosniff", + "apim-request-id" : "b96e7ac6-ba25-4edf-bce8-7a0ea496d01f", + "retry-after" : "0", + "StatusCode" : "200", + "Body" : "{\"dataFeedId\":\"986abb54-0ff2-4382-993a-c439c36aedda\",\"dataFeedName\":\"java_create_data_feed_test_sample99b2d1f8-0708-45ab-8ad3-5a2f9b3a782d\",\"metrics\":[{\"metricId\":\"19572902-49ff-4d75-b121-bbeb6a5d669f\",\"metricName\":\"cost\",\"metricDisplayName\":\"cost\",\"metricDescription\":\"\"},{\"metricId\":\"0c7fa807-44ee-4827-adee-4681d5daa730\",\"metricName\":\"revenue\",\"metricDisplayName\":\"revenue\",\"metricDescription\":\"\"}],\"dimension\":[{\"dimensionName\":\"category\",\"dimensionDisplayName\":\"category\"},{\"dimensionName\":\"city\",\"dimensionDisplayName\":\"city\"}],\"dataStartFrom\":\"2019-10-01T00:00:00Z\",\"dataSourceType\":\"AzureDataExplorer\",\"timestampColumn\":\"\",\"startOffsetInSeconds\":0,\"maxQueryPerMinute\":30.0,\"granularityName\":\"Daily\",\"needRollup\":\"NoRollup\",\"fillMissingPointType\":\"PreviousValue\",\"fillMissingPointValue\":0.0,\"rollUpMethod\":\"None\",\"dataFeedDescription\":\"\",\"stopRetryAfterInSeconds\":-1,\"minRetryIntervalInSeconds\":-1,\"maxConcurrency\":0,\"viewMode\":\"Private\",\"admins\":[\"kaghiya@microsoft.com\"],\"viewers\":[],\"creator\":\"kaghiya@microsoft.com\",\"status\":\"Active\",\"createdTime\":\"2021-06-02T00:30:39Z\",\"isAdmin\":true,\"actionLinkTemplate\":\"\",\"dataSourceParameter\":{\"query\":\"let StartDateTime = datetime(@StartTime);let EndDateTime = StartDateTime + 1d;adsample| where Timestamp >= StartDateTime and Timestamp < EndDateTime\"},\"authenticationType\":\"ServicePrincipalInKV\",\"credentialId\":\"d2ec3254-6e15-4862-a228-b22502ab2bc1\"}", + "Date" : "Wed, 02 Jun 2021 00:30:59 GMT", + "Content-Type" : "application/json; charset=utf-8" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://REDACTED.cognitiveservices.azure.com/metricsadvisor/v1.0/dataFeeds/986abb54-0ff2-4382-993a-c439c36aedda", + "Headers" : { + "User-Agent" : "azsdk-java-azure-ai-metricsadvisor/1.0.0-beta.4 (1.8.0_221; Mac OS X; 10.16)", + "x-ms-client-request-id" : "473b9f6e-757a-45e3-b8a4-5d84dfb9a70e" + }, + "Response" : { + "x-request-id" : "cc86aceb-b746-4cab-a5b3-699afe1d5b3e", + "content-length" : "1402", + "x-envoy-upstream-service-time" : "175", + "Strict-Transport-Security" : "max-age=31536000; includeSubDomains; preload", + "x-content-type-options" : "nosniff", + "apim-request-id" : "cc86aceb-b746-4cab-a5b3-699afe1d5b3e", + "retry-after" : "0", + "StatusCode" : "200", + "Body" : "{\"dataFeedId\":\"986abb54-0ff2-4382-993a-c439c36aedda\",\"dataFeedName\":\"java_create_data_feed_test_sample99b2d1f8-0708-45ab-8ad3-5a2f9b3a782d\",\"metrics\":[{\"metricId\":\"19572902-49ff-4d75-b121-bbeb6a5d669f\",\"metricName\":\"cost\",\"metricDisplayName\":\"cost\",\"metricDescription\":\"\"},{\"metricId\":\"0c7fa807-44ee-4827-adee-4681d5daa730\",\"metricName\":\"revenue\",\"metricDisplayName\":\"revenue\",\"metricDescription\":\"\"}],\"dimension\":[{\"dimensionName\":\"category\",\"dimensionDisplayName\":\"category\"},{\"dimensionName\":\"city\",\"dimensionDisplayName\":\"city\"}],\"dataStartFrom\":\"2019-10-01T00:00:00Z\",\"dataSourceType\":\"AzureDataExplorer\",\"timestampColumn\":\"\",\"startOffsetInSeconds\":0,\"maxQueryPerMinute\":30.0,\"granularityName\":\"Daily\",\"needRollup\":\"NoRollup\",\"fillMissingPointType\":\"PreviousValue\",\"fillMissingPointValue\":0.0,\"rollUpMethod\":\"None\",\"dataFeedDescription\":\"\",\"stopRetryAfterInSeconds\":-1,\"minRetryIntervalInSeconds\":-1,\"maxConcurrency\":0,\"viewMode\":\"Private\",\"admins\":[\"kaghiya@microsoft.com\"],\"viewers\":[],\"creator\":\"kaghiya@microsoft.com\",\"status\":\"Active\",\"createdTime\":\"2021-06-02T00:30:39Z\",\"isAdmin\":true,\"actionLinkTemplate\":\"\",\"dataSourceParameter\":{\"query\":\"let StartDateTime = datetime(@StartTime);let EndDateTime = StartDateTime + 1d;adsample| where Timestamp >= StartDateTime and Timestamp < EndDateTime\"},\"authenticationType\":\"ServicePrincipalInKV\",\"credentialId\":\"d2ec3254-6e15-4862-a228-b22502ab2bc1\"}", + "Date" : "Wed, 02 Jun 2021 00:31:00 GMT", + "Content-Type" : "application/json; charset=utf-8" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://REDACTED.cognitiveservices.azure.com/metricsadvisor/v1.0/dataFeeds/986abb54-0ff2-4382-993a-c439c36aedda", + "Headers" : { + "User-Agent" : "azsdk-java-azure-ai-metricsadvisor/1.0.0-beta.4 (1.8.0_221; Mac OS X; 10.16)", + "x-ms-client-request-id" : "f20f750f-0e67-477c-969a-272e4ac266ee" + }, + "Response" : { + "x-request-id" : "4020ac57-28eb-4325-9b14-4813b9e77d6f", + "content-length" : "0", + "x-envoy-upstream-service-time" : "430", + "Strict-Transport-Security" : "max-age=31536000; includeSubDomains; preload", + "x-content-type-options" : "nosniff", + "apim-request-id" : "4020ac57-28eb-4325-9b14-4813b9e77d6f", + "retry-after" : "0", + "StatusCode" : "204", + "Date" : "Wed, 02 Jun 2021 00:31:00 GMT" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://REDACTED.cognitiveservices.azure.com/metricsadvisor/v1.0/dataFeeds/fbe58c18-af15-4ccb-b7a7-eddb43d1c8b3", + "Headers" : { + "User-Agent" : "azsdk-java-azure-ai-metricsadvisor/1.0.0-beta.4 (1.8.0_221; Mac OS X; 10.16)", + "x-ms-client-request-id" : "16a3b181-08f2-4595-9d0f-178c17a5b6b9" + }, + "Response" : { + "x-request-id" : "fd8a3b22-763b-4ca2-9a9f-9177febe1dd6", + "content-length" : "0", + "x-envoy-upstream-service-time" : "70", + "Strict-Transport-Security" : "max-age=31536000; includeSubDomains; preload", + "x-content-type-options" : "nosniff", + "apim-request-id" : "fd8a3b22-763b-4ca2-9a9f-9177febe1dd6", + "retry-after" : "0", + "StatusCode" : "204", + "Date" : "Wed, 02 Jun 2021 00:31:00 GMT" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://REDACTED.cognitiveservices.azure.com/metricsadvisor/v1.0/dataFeeds/d2ec3254-6e15-4862-a228-b22502ab2bc1", + "Headers" : { + "User-Agent" : "azsdk-java-azure-ai-metricsadvisor/1.0.0-beta.4 (1.8.0_221; Mac OS X; 10.16)", + "x-ms-client-request-id" : "f1073a58-cc01-45ae-af80-ea7a2ef704d9" + }, + "Response" : { + "x-request-id" : "cfb9bf8c-16a2-4ca8-958c-90ec70e199a3", + "content-length" : "0", + "x-envoy-upstream-service-time" : "71", + "Strict-Transport-Security" : "max-age=31536000; includeSubDomains; preload", + "x-content-type-options" : "nosniff", + "apim-request-id" : "cfb9bf8c-16a2-4ca8-958c-90ec70e199a3", + "retry-after" : "0", + "StatusCode" : "204", + "Date" : "Wed, 02 Jun 2021 00:31:00 GMT" + }, + "Exception" : null + } ], + "variables" : [ ] +} \ No newline at end of file diff --git a/sdk/metricsadvisor/azure-ai-metricsadvisor/src/test/resources/session-records/DataFeedWithCredentialsTest.testDataLakeGen2[1].json b/sdk/metricsadvisor/azure-ai-metricsadvisor/src/test/resources/session-records/DataFeedWithCredentialsTest.testDataLakeGen2[1].json new file mode 100644 index 0000000000000..42bb16610f87b --- /dev/null +++ b/sdk/metricsadvisor/azure-ai-metricsadvisor/src/test/resources/session-records/DataFeedWithCredentialsTest.testDataLakeGen2[1].json @@ -0,0 +1,377 @@ +{ + "networkCallRecords" : [ { + "Method" : "POST", + "Uri" : "https://REDACTED.cognitiveservices.azure.com/metricsadvisor/v1.0/dataFeeds", + "Headers" : { + "User-Agent" : "azsdk-java-azure-ai-metricsadvisor/1.0.0-beta.4 (1.8.0_221; Mac OS X; 10.16)", + "x-ms-client-request-id" : "198ec31c-c9cc-4ceb-bdeb-bcf60be6e205", + "Content-Type" : "application/json" + }, + "Response" : { + "x-request-id" : "1302a066-6646-4466-8a51-c11ee8fc313d", + "content-length" : "0", + "x-envoy-upstream-service-time" : "960", + "Strict-Transport-Security" : "max-age=31536000; includeSubDomains; preload", + "x-content-type-options" : "nosniff", + "apim-request-id" : "1302a066-6646-4466-8a51-c11ee8fc313d", + "retry-after" : "0", + "StatusCode" : "201", + "Date" : "Wed, 02 Jun 2021 00:33:37 GMT", + "Location" : "https://js-metrics-advisor.cognitiveservices.azure.com/metricsadvisor/v1.0/dataFeeds/2f6deb68-bcb4-43f9-b32a-12cd1006e46a" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://REDACTED.cognitiveservices.azure.com/metricsadvisor/v1.0/dataFeeds/2f6deb68-bcb4-43f9-b32a-12cd1006e46a", + "Headers" : { + "User-Agent" : "azsdk-java-azure-ai-metricsadvisor/1.0.0-beta.4 (1.8.0_221; Mac OS X; 10.16)", + "x-ms-client-request-id" : "fcd7f6e9-8e89-4e80-a14b-3e7914391760" + }, + "Response" : { + "x-request-id" : "55bc615a-3f96-4aea-9be8-ecc850e380a5", + "content-length" : "1308", + "x-envoy-upstream-service-time" : "262", + "Strict-Transport-Security" : "max-age=31536000; includeSubDomains; preload", + "x-content-type-options" : "nosniff", + "apim-request-id" : "55bc615a-3f96-4aea-9be8-ecc850e380a5", + "retry-after" : "0", + "StatusCode" : "200", + "Body" : "{\"dataFeedId\":\"2f6deb68-bcb4-43f9-b32a-12cd1006e46a\",\"dataFeedName\":\"java_create_data_feed_test_samplec3a902be-9b05-4ce1-ad38-30b566097a18\",\"metrics\":[{\"metricId\":\"e8b324fc-f5b2-402b-833e-3d44de806963\",\"metricName\":\"cost\",\"metricDisplayName\":\"cost\",\"metricDescription\":\"\"},{\"metricId\":\"3c9bd24c-4aae-420c-8b74-96614bb1541f\",\"metricName\":\"revenue\",\"metricDisplayName\":\"revenue\",\"metricDescription\":\"\"}],\"dimension\":[{\"dimensionName\":\"category\",\"dimensionDisplayName\":\"category\"},{\"dimensionName\":\"city\",\"dimensionDisplayName\":\"city\"}],\"dataStartFrom\":\"2019-10-01T00:00:00Z\",\"dataSourceType\":\"AzureDataLakeStorageGen2\",\"timestampColumn\":\"\",\"startOffsetInSeconds\":0,\"maxQueryPerMinute\":30.0,\"granularityName\":\"Daily\",\"needRollup\":\"NoRollup\",\"fillMissingPointType\":\"PreviousValue\",\"fillMissingPointValue\":0.0,\"rollUpMethod\":\"None\",\"dataFeedDescription\":\"\",\"stopRetryAfterInSeconds\":-1,\"minRetryIntervalInSeconds\":-1,\"maxConcurrency\":0,\"viewMode\":\"Private\",\"admins\":[\"kaghiya@microsoft.com\"],\"viewers\":[],\"creator\":\"kaghiya@microsoft.com\",\"status\":\"Active\",\"createdTime\":\"2021-06-02T00:33:37Z\",\"isAdmin\":true,\"actionLinkTemplate\":\"\",\"dataSourceParameter\":{\"fileTemplate\":\"adsample.json\",\"accountName\":\"REDACTED\",\"directoryTemplate\":\"%Y/%m/%d\",\"fileSystemName\":\"adsample\"},\"authenticationType\":\"Basic\"}", + "Date" : "Wed, 02 Jun 2021 00:33:38 GMT", + "Content-Type" : "application/json; charset=utf-8" + }, + "Exception" : null + }, { + "Method" : "POST", + "Uri" : "https://REDACTED.cognitiveservices.azure.com/metricsadvisor/v1.0/credentials", + "Headers" : { + "User-Agent" : "azsdk-java-azure-ai-metricsadvisor/1.0.0-beta.4 (1.8.0_221; Mac OS X; 10.16)", + "x-ms-client-request-id" : "fc471b73-2965-456b-b7a6-e45ac8e42100", + "Content-Type" : "application/json" + }, + "Response" : { + "x-request-id" : "90536e4d-bbab-49be-8854-7537c4ee578b", + "content-length" : "0", + "x-envoy-upstream-service-time" : "390", + "Strict-Transport-Security" : "max-age=31536000; includeSubDomains; preload", + "x-content-type-options" : "nosniff", + "apim-request-id" : "90536e4d-bbab-49be-8854-7537c4ee578b", + "retry-after" : "0", + "StatusCode" : "201", + "Date" : "Wed, 02 Jun 2021 00:33:38 GMT", + "Location" : "https://js-metrics-advisor.cognitiveservices.azure.com/metricsadvisor/v1.0/credentials/11cfc127-e774-40cf-b1f3-ec406842322d" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://REDACTED.cognitiveservices.azure.com/metricsadvisor/v1.0/credentials/11cfc127-e774-40cf-b1f3-ec406842322d", + "Headers" : { + "User-Agent" : "azsdk-java-azure-ai-metricsadvisor/1.0.0-beta.4 (1.8.0_221; Mac OS X; 10.16)", + "x-ms-client-request-id" : "06d13a20-c25f-40a0-aa15-6fc1b354c89d" + }, + "Response" : { + "x-request-id" : "3fd78424-5a70-49ea-b9f8-c19bffe5b9b8", + "content-length" : "273", + "x-envoy-upstream-service-time" : "5110", + "Strict-Transport-Security" : "max-age=31536000; includeSubDomains; preload", + "x-content-type-options" : "nosniff", + "apim-request-id" : "3fd78424-5a70-49ea-b9f8-c19bffe5b9b8", + "retry-after" : "0", + "StatusCode" : "200", + "Body" : "{\"dataSourceCredentialId\":\"11cfc127-e774-40cf-b1f3-ec406842322d\",\"dataSourceCredentialName\":\"java_create_data_source_cred_dlake_gene2e5abe1-a005-419a-a3b7-50387f74bf58\",\"dataSourceCredentialDescription\":\"\",\"dataSourceCredentialType\":\"DataLakeGen2SharedKey\",\"parameters\":{}}", + "Date" : "Wed, 02 Jun 2021 00:33:43 GMT", + "Content-Type" : "application/json; charset=utf-8" + }, + "Exception" : null + }, { + "Method" : "PATCH", + "Uri" : "https://REDACTED.cognitiveservices.azure.com/metricsadvisor/v1.0/dataFeeds/2f6deb68-bcb4-43f9-b32a-12cd1006e46a", + "Headers" : { + "User-Agent" : "azsdk-java-azure-ai-metricsadvisor/1.0.0-beta.4 (1.8.0_221; Mac OS X; 10.16)", + "x-ms-client-request-id" : "800e6af1-c124-42f7-bb6f-f9b79b9dd3c4", + "Content-Type" : "application/merge-patch+json" + }, + "Response" : { + "x-request-id" : "35acc402-c3f8-439d-8ff5-9db89e76ffca", + "content-length" : "1378", + "x-envoy-upstream-service-time" : "5854", + "Strict-Transport-Security" : "max-age=31536000; includeSubDomains; preload", + "x-content-type-options" : "nosniff", + "apim-request-id" : "35acc402-c3f8-439d-8ff5-9db89e76ffca", + "retry-after" : "0", + "StatusCode" : "200", + "Body" : "{\"dataFeedId\":\"2f6deb68-bcb4-43f9-b32a-12cd1006e46a\",\"dataFeedName\":\"java_create_data_feed_test_samplec3a902be-9b05-4ce1-ad38-30b566097a18\",\"metrics\":[{\"metricId\":\"e8b324fc-f5b2-402b-833e-3d44de806963\",\"metricName\":\"cost\",\"metricDisplayName\":\"cost\",\"metricDescription\":\"\"},{\"metricId\":\"3c9bd24c-4aae-420c-8b74-96614bb1541f\",\"metricName\":\"revenue\",\"metricDisplayName\":\"revenue\",\"metricDescription\":\"\"}],\"dimension\":[{\"dimensionName\":\"category\",\"dimensionDisplayName\":\"category\"},{\"dimensionName\":\"city\",\"dimensionDisplayName\":\"city\"}],\"dataStartFrom\":\"2019-10-01T00:00:00Z\",\"dataSourceType\":\"AzureDataLakeStorageGen2\",\"timestampColumn\":\"\",\"startOffsetInSeconds\":0,\"maxQueryPerMinute\":30.0,\"granularityName\":\"Daily\",\"needRollup\":\"NoRollup\",\"fillMissingPointType\":\"PreviousValue\",\"fillMissingPointValue\":0.0,\"rollUpMethod\":\"None\",\"dataFeedDescription\":\"\",\"stopRetryAfterInSeconds\":-1,\"minRetryIntervalInSeconds\":-1,\"maxConcurrency\":0,\"viewMode\":\"Private\",\"admins\":[\"kaghiya@microsoft.com\"],\"viewers\":[],\"creator\":\"kaghiya@microsoft.com\",\"status\":\"Active\",\"createdTime\":\"2021-06-02T00:33:37Z\",\"isAdmin\":true,\"actionLinkTemplate\":\"\",\"dataSourceParameter\":{\"fileTemplate\":\"adsample.json\",\"accountName\":\"REDACTED\",\"directoryTemplate\":\"%Y/%m/%d\",\"fileSystemName\":\"adsample\"},\"authenticationType\":\"DataLakeGen2SharedKey\",\"credentialId\":\"11cfc127-e774-40cf-b1f3-ec406842322d\"}", + "Date" : "Wed, 02 Jun 2021 00:33:48 GMT", + "Content-Type" : "application/json; charset=utf-8" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://REDACTED.cognitiveservices.azure.com/metricsadvisor/v1.0/dataFeeds/2f6deb68-bcb4-43f9-b32a-12cd1006e46a", + "Headers" : { + "User-Agent" : "azsdk-java-azure-ai-metricsadvisor/1.0.0-beta.4 (1.8.0_221; Mac OS X; 10.16)", + "x-ms-client-request-id" : "a1ab479b-7e86-4a53-b089-9e90986a4d8e" + }, + "Response" : { + "x-request-id" : "ba34bb1d-6cdb-4991-95c5-ec4dcbb4cd15", + "content-length" : "1378", + "x-envoy-upstream-service-time" : "297", + "Strict-Transport-Security" : "max-age=31536000; includeSubDomains; preload", + "x-content-type-options" : "nosniff", + "apim-request-id" : "ba34bb1d-6cdb-4991-95c5-ec4dcbb4cd15", + "retry-after" : "0", + "StatusCode" : "200", + "Body" : "{\"dataFeedId\":\"2f6deb68-bcb4-43f9-b32a-12cd1006e46a\",\"dataFeedName\":\"java_create_data_feed_test_samplec3a902be-9b05-4ce1-ad38-30b566097a18\",\"metrics\":[{\"metricId\":\"e8b324fc-f5b2-402b-833e-3d44de806963\",\"metricName\":\"cost\",\"metricDisplayName\":\"cost\",\"metricDescription\":\"\"},{\"metricId\":\"3c9bd24c-4aae-420c-8b74-96614bb1541f\",\"metricName\":\"revenue\",\"metricDisplayName\":\"revenue\",\"metricDescription\":\"\"}],\"dimension\":[{\"dimensionName\":\"category\",\"dimensionDisplayName\":\"category\"},{\"dimensionName\":\"city\",\"dimensionDisplayName\":\"city\"}],\"dataStartFrom\":\"2019-10-01T00:00:00Z\",\"dataSourceType\":\"AzureDataLakeStorageGen2\",\"timestampColumn\":\"\",\"startOffsetInSeconds\":0,\"maxQueryPerMinute\":30.0,\"granularityName\":\"Daily\",\"needRollup\":\"NoRollup\",\"fillMissingPointType\":\"PreviousValue\",\"fillMissingPointValue\":0.0,\"rollUpMethod\":\"None\",\"dataFeedDescription\":\"\",\"stopRetryAfterInSeconds\":-1,\"minRetryIntervalInSeconds\":-1,\"maxConcurrency\":0,\"viewMode\":\"Private\",\"admins\":[\"kaghiya@microsoft.com\"],\"viewers\":[],\"creator\":\"kaghiya@microsoft.com\",\"status\":\"Active\",\"createdTime\":\"2021-06-02T00:33:37Z\",\"isAdmin\":true,\"actionLinkTemplate\":\"\",\"dataSourceParameter\":{\"fileTemplate\":\"adsample.json\",\"accountName\":\"REDACTED\",\"directoryTemplate\":\"%Y/%m/%d\",\"fileSystemName\":\"adsample\"},\"authenticationType\":\"DataLakeGen2SharedKey\",\"credentialId\":\"11cfc127-e774-40cf-b1f3-ec406842322d\"}", + "Date" : "Wed, 02 Jun 2021 00:33:50 GMT", + "Content-Type" : "application/json; charset=utf-8" + }, + "Exception" : null + }, { + "Method" : "POST", + "Uri" : "https://REDACTED.cognitiveservices.azure.com/metricsadvisor/v1.0/credentials", + "Headers" : { + "User-Agent" : "azsdk-java-azure-ai-metricsadvisor/1.0.0-beta.4 (1.8.0_221; Mac OS X; 10.16)", + "x-ms-client-request-id" : "e76f3071-a7c3-4bbe-ba9d-edd4d378cea2", + "Content-Type" : "application/json" + }, + "Response" : { + "x-request-id" : "04ef4f2f-eca5-4f08-8db1-867444203007", + "content-length" : "0", + "x-envoy-upstream-service-time" : "587", + "Strict-Transport-Security" : "max-age=31536000; includeSubDomains; preload", + "x-content-type-options" : "nosniff", + "apim-request-id" : "04ef4f2f-eca5-4f08-8db1-867444203007", + "retry-after" : "0", + "StatusCode" : "201", + "Date" : "Wed, 02 Jun 2021 00:33:51 GMT", + "Location" : "https://js-metrics-advisor.cognitiveservices.azure.com/metricsadvisor/v1.0/credentials/f0b4f08b-c901-4c03-bc29-5d4b57e370f7" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://REDACTED.cognitiveservices.azure.com/metricsadvisor/v1.0/credentials/f0b4f08b-c901-4c03-bc29-5d4b57e370f7", + "Headers" : { + "User-Agent" : "azsdk-java-azure-ai-metricsadvisor/1.0.0-beta.4 (1.8.0_221; Mac OS X; 10.16)", + "x-ms-client-request-id" : "94acd6fd-28fe-4dc9-8a6a-a6f0a934f296" + }, + "Response" : { + "x-request-id" : "72710e32-1352-489a-89d9-c45812ec7929", + "content-length" : "360", + "x-envoy-upstream-service-time" : "5130", + "Strict-Transport-Security" : "max-age=31536000; includeSubDomains; preload", + "x-content-type-options" : "nosniff", + "apim-request-id" : "72710e32-1352-489a-89d9-c45812ec7929", + "retry-after" : "0", + "StatusCode" : "200", + "Body" : "{\"dataSourceCredentialId\":\"f0b4f08b-c901-4c03-bc29-5d4b57e370f7\",\"dataSourceCredentialName\":\"java_create_data_source_cred_spb3930369-ec12-481d-83f7-d292311a143c\",\"dataSourceCredentialDescription\":\"\",\"dataSourceCredentialType\":\"ServicePrincipal\",\"parameters\":{\"clientId\":\"e70248b2-bffa-11eb-8529-0242ac130003\",\"tenantId\":\"45389ded-5e07-4e52-b225-4ae8f905afb5\"}}", + "Date" : "Wed, 02 Jun 2021 00:33:56 GMT", + "Content-Type" : "application/json; charset=utf-8" + }, + "Exception" : null + }, { + "Method" : "PATCH", + "Uri" : "https://REDACTED.cognitiveservices.azure.com/metricsadvisor/v1.0/dataFeeds/2f6deb68-bcb4-43f9-b32a-12cd1006e46a", + "Headers" : { + "User-Agent" : "azsdk-java-azure-ai-metricsadvisor/1.0.0-beta.4 (1.8.0_221; Mac OS X; 10.16)", + "x-ms-client-request-id" : "f884c3b7-d277-405a-b2d4-0cd50899f21e", + "Content-Type" : "application/merge-patch+json" + }, + "Response" : { + "x-request-id" : "15ea513d-7cf9-4ce9-ae34-9c8d0bb2fb17", + "content-length" : "1373", + "x-envoy-upstream-service-time" : "5903", + "Strict-Transport-Security" : "max-age=31536000; includeSubDomains; preload", + "x-content-type-options" : "nosniff", + "apim-request-id" : "15ea513d-7cf9-4ce9-ae34-9c8d0bb2fb17", + "retry-after" : "0", + "StatusCode" : "200", + "Body" : "{\"dataFeedId\":\"2f6deb68-bcb4-43f9-b32a-12cd1006e46a\",\"dataFeedName\":\"java_create_data_feed_test_samplec3a902be-9b05-4ce1-ad38-30b566097a18\",\"metrics\":[{\"metricId\":\"e8b324fc-f5b2-402b-833e-3d44de806963\",\"metricName\":\"cost\",\"metricDisplayName\":\"cost\",\"metricDescription\":\"\"},{\"metricId\":\"3c9bd24c-4aae-420c-8b74-96614bb1541f\",\"metricName\":\"revenue\",\"metricDisplayName\":\"revenue\",\"metricDescription\":\"\"}],\"dimension\":[{\"dimensionName\":\"category\",\"dimensionDisplayName\":\"category\"},{\"dimensionName\":\"city\",\"dimensionDisplayName\":\"city\"}],\"dataStartFrom\":\"2019-10-01T00:00:00Z\",\"dataSourceType\":\"AzureDataLakeStorageGen2\",\"timestampColumn\":\"\",\"startOffsetInSeconds\":0,\"maxQueryPerMinute\":30.0,\"granularityName\":\"Daily\",\"needRollup\":\"NoRollup\",\"fillMissingPointType\":\"PreviousValue\",\"fillMissingPointValue\":0.0,\"rollUpMethod\":\"None\",\"dataFeedDescription\":\"\",\"stopRetryAfterInSeconds\":-1,\"minRetryIntervalInSeconds\":-1,\"maxConcurrency\":0,\"viewMode\":\"Private\",\"admins\":[\"kaghiya@microsoft.com\"],\"viewers\":[],\"creator\":\"kaghiya@microsoft.com\",\"status\":\"Active\",\"createdTime\":\"2021-06-02T00:33:37Z\",\"isAdmin\":true,\"actionLinkTemplate\":\"\",\"dataSourceParameter\":{\"fileTemplate\":\"adsample.json\",\"accountName\":\"REDACTED\",\"directoryTemplate\":\"%Y/%m/%d\",\"fileSystemName\":\"adsample\"},\"authenticationType\":\"ServicePrincipal\",\"credentialId\":\"f0b4f08b-c901-4c03-bc29-5d4b57e370f7\"}", + "Date" : "Wed, 02 Jun 2021 00:34:01 GMT", + "Content-Type" : "application/json; charset=utf-8" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://REDACTED.cognitiveservices.azure.com/metricsadvisor/v1.0/dataFeeds/2f6deb68-bcb4-43f9-b32a-12cd1006e46a", + "Headers" : { + "User-Agent" : "azsdk-java-azure-ai-metricsadvisor/1.0.0-beta.4 (1.8.0_221; Mac OS X; 10.16)", + "x-ms-client-request-id" : "044e121c-4ee9-4eb8-901c-03a976674987" + }, + "Response" : { + "x-request-id" : "cc1d8dc3-1eda-43d5-a5ac-0c8c9ca7831e", + "content-length" : "1373", + "x-envoy-upstream-service-time" : "5198", + "Strict-Transport-Security" : "max-age=31536000; includeSubDomains; preload", + "x-content-type-options" : "nosniff", + "apim-request-id" : "cc1d8dc3-1eda-43d5-a5ac-0c8c9ca7831e", + "retry-after" : "0", + "StatusCode" : "200", + "Body" : "{\"dataFeedId\":\"2f6deb68-bcb4-43f9-b32a-12cd1006e46a\",\"dataFeedName\":\"java_create_data_feed_test_samplec3a902be-9b05-4ce1-ad38-30b566097a18\",\"metrics\":[{\"metricId\":\"e8b324fc-f5b2-402b-833e-3d44de806963\",\"metricName\":\"cost\",\"metricDisplayName\":\"cost\",\"metricDescription\":\"\"},{\"metricId\":\"3c9bd24c-4aae-420c-8b74-96614bb1541f\",\"metricName\":\"revenue\",\"metricDisplayName\":\"revenue\",\"metricDescription\":\"\"}],\"dimension\":[{\"dimensionName\":\"category\",\"dimensionDisplayName\":\"category\"},{\"dimensionName\":\"city\",\"dimensionDisplayName\":\"city\"}],\"dataStartFrom\":\"2019-10-01T00:00:00Z\",\"dataSourceType\":\"AzureDataLakeStorageGen2\",\"timestampColumn\":\"\",\"startOffsetInSeconds\":0,\"maxQueryPerMinute\":30.0,\"granularityName\":\"Daily\",\"needRollup\":\"NoRollup\",\"fillMissingPointType\":\"PreviousValue\",\"fillMissingPointValue\":0.0,\"rollUpMethod\":\"None\",\"dataFeedDescription\":\"\",\"stopRetryAfterInSeconds\":-1,\"minRetryIntervalInSeconds\":-1,\"maxConcurrency\":0,\"viewMode\":\"Private\",\"admins\":[\"kaghiya@microsoft.com\"],\"viewers\":[],\"creator\":\"kaghiya@microsoft.com\",\"status\":\"Active\",\"createdTime\":\"2021-06-02T00:33:37Z\",\"isAdmin\":true,\"actionLinkTemplate\":\"\",\"dataSourceParameter\":{\"fileTemplate\":\"adsample.json\",\"accountName\":\"REDACTED\",\"directoryTemplate\":\"%Y/%m/%d\",\"fileSystemName\":\"adsample\"},\"authenticationType\":\"ServicePrincipal\",\"credentialId\":\"f0b4f08b-c901-4c03-bc29-5d4b57e370f7\"}", + "Date" : "Wed, 02 Jun 2021 00:34:06 GMT", + "Content-Type" : "application/json; charset=utf-8" + }, + "Exception" : null + }, { + "Method" : "POST", + "Uri" : "https://REDACTED.cognitiveservices.azure.com/metricsadvisor/v1.0/credentials", + "Headers" : { + "User-Agent" : "azsdk-java-azure-ai-metricsadvisor/1.0.0-beta.4 (1.8.0_221; Mac OS X; 10.16)", + "x-ms-client-request-id" : "5446c008-a5be-4cdf-973b-20dc9c63e3a9", + "Content-Type" : "application/json" + }, + "Response" : { + "x-request-id" : "69fd977e-520a-49bb-95d6-fad5deee32e1", + "content-length" : "0", + "x-envoy-upstream-service-time" : "369", + "Strict-Transport-Security" : "max-age=31536000; includeSubDomains; preload", + "x-content-type-options" : "nosniff", + "apim-request-id" : "69fd977e-520a-49bb-95d6-fad5deee32e1", + "retry-after" : "0", + "StatusCode" : "201", + "Date" : "Wed, 02 Jun 2021 00:34:07 GMT", + "Location" : "https://js-metrics-advisor.cognitiveservices.azure.com/metricsadvisor/v1.0/credentials/e3483a80-9556-4f94-a681-632cdf6c39c2" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://REDACTED.cognitiveservices.azure.com/metricsadvisor/v1.0/credentials/e3483a80-9556-4f94-a681-632cdf6c39c2", + "Headers" : { + "User-Agent" : "azsdk-java-azure-ai-metricsadvisor/1.0.0-beta.4 (1.8.0_221; Mac OS X; 10.16)", + "x-ms-client-request-id" : "ea187b90-7071-4e23-8644-50ec2abede67" + }, + "Response" : { + "x-request-id" : "2df50655-2528-4a3f-8569-e4c875e3acff", + "content-length" : "549", + "x-envoy-upstream-service-time" : "164", + "Strict-Transport-Security" : "max-age=31536000; includeSubDomains; preload", + "x-content-type-options" : "nosniff", + "apim-request-id" : "2df50655-2528-4a3f-8569-e4c875e3acff", + "retry-after" : "0", + "StatusCode" : "200", + "Body" : "{\"dataSourceCredentialId\":\"e3483a80-9556-4f94-a681-632cdf6c39c2\",\"dataSourceCredentialName\":\"java_create_data_source_cred_spkvc0906c9d-a47f-476e-abe7-3f1ca2f23cfb\",\"dataSourceCredentialDescription\":\"\",\"dataSourceCredentialType\":\"ServicePrincipalInKV\",\"parameters\":{\"servicePrincipalSecretNameInKV\":\"DSClientSer_1\",\"servicePrincipalIdNameInKV\":\"DSClientID_1\",\"tenantId\":\"45389ded-5e07-4e52-b225-4ae8f905afb5\",\"keyVaultClientId\":\"e70248b2-bffa-11eb-8529-0242ac130003\",\"keyVaultEndpoint\":\"https://d980b6c7-9bb8-4486-89ab-5dab5a24e62d.vault.azure.net\"}}", + "Date" : "Wed, 02 Jun 2021 00:34:07 GMT", + "Content-Type" : "application/json; charset=utf-8" + }, + "Exception" : null + }, { + "Method" : "PATCH", + "Uri" : "https://REDACTED.cognitiveservices.azure.com/metricsadvisor/v1.0/dataFeeds/2f6deb68-bcb4-43f9-b32a-12cd1006e46a", + "Headers" : { + "User-Agent" : "azsdk-java-azure-ai-metricsadvisor/1.0.0-beta.4 (1.8.0_221; Mac OS X; 10.16)", + "x-ms-client-request-id" : "8e27d810-7698-472a-9b97-83a6bcb7b3b7", + "Content-Type" : "application/merge-patch+json" + }, + "Response" : { + "x-request-id" : "991a9816-77d3-4c76-8f60-ea5fb1d8a711", + "content-length" : "1377", + "x-envoy-upstream-service-time" : "6079", + "Strict-Transport-Security" : "max-age=31536000; includeSubDomains; preload", + "x-content-type-options" : "nosniff", + "apim-request-id" : "991a9816-77d3-4c76-8f60-ea5fb1d8a711", + "retry-after" : "0", + "StatusCode" : "200", + "Body" : "{\"dataFeedId\":\"2f6deb68-bcb4-43f9-b32a-12cd1006e46a\",\"dataFeedName\":\"java_create_data_feed_test_samplec3a902be-9b05-4ce1-ad38-30b566097a18\",\"metrics\":[{\"metricId\":\"e8b324fc-f5b2-402b-833e-3d44de806963\",\"metricName\":\"cost\",\"metricDisplayName\":\"cost\",\"metricDescription\":\"\"},{\"metricId\":\"3c9bd24c-4aae-420c-8b74-96614bb1541f\",\"metricName\":\"revenue\",\"metricDisplayName\":\"revenue\",\"metricDescription\":\"\"}],\"dimension\":[{\"dimensionName\":\"category\",\"dimensionDisplayName\":\"category\"},{\"dimensionName\":\"city\",\"dimensionDisplayName\":\"city\"}],\"dataStartFrom\":\"2019-10-01T00:00:00Z\",\"dataSourceType\":\"AzureDataLakeStorageGen2\",\"timestampColumn\":\"\",\"startOffsetInSeconds\":0,\"maxQueryPerMinute\":30.0,\"granularityName\":\"Daily\",\"needRollup\":\"NoRollup\",\"fillMissingPointType\":\"PreviousValue\",\"fillMissingPointValue\":0.0,\"rollUpMethod\":\"None\",\"dataFeedDescription\":\"\",\"stopRetryAfterInSeconds\":-1,\"minRetryIntervalInSeconds\":-1,\"maxConcurrency\":0,\"viewMode\":\"Private\",\"admins\":[\"kaghiya@microsoft.com\"],\"viewers\":[],\"creator\":\"kaghiya@microsoft.com\",\"status\":\"Active\",\"createdTime\":\"2021-06-02T00:33:37Z\",\"isAdmin\":true,\"actionLinkTemplate\":\"\",\"dataSourceParameter\":{\"fileTemplate\":\"adsample.json\",\"accountName\":\"REDACTED\",\"directoryTemplate\":\"%Y/%m/%d\",\"fileSystemName\":\"adsample\"},\"authenticationType\":\"ServicePrincipalInKV\",\"credentialId\":\"e3483a80-9556-4f94-a681-632cdf6c39c2\"}", + "Date" : "Wed, 02 Jun 2021 00:34:14 GMT", + "Content-Type" : "application/json; charset=utf-8" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://REDACTED.cognitiveservices.azure.com/metricsadvisor/v1.0/dataFeeds/2f6deb68-bcb4-43f9-b32a-12cd1006e46a", + "Headers" : { + "User-Agent" : "azsdk-java-azure-ai-metricsadvisor/1.0.0-beta.4 (1.8.0_221; Mac OS X; 10.16)", + "x-ms-client-request-id" : "4be2143f-21c9-4f52-91d9-958e6393b088" + }, + "Response" : { + "x-request-id" : "bad9b36a-539f-4eaa-9807-55cf049bcde5", + "content-length" : "1377", + "x-envoy-upstream-service-time" : "5225", + "Strict-Transport-Security" : "max-age=31536000; includeSubDomains; preload", + "x-content-type-options" : "nosniff", + "apim-request-id" : "bad9b36a-539f-4eaa-9807-55cf049bcde5", + "retry-after" : "0", + "StatusCode" : "200", + "Body" : "{\"dataFeedId\":\"2f6deb68-bcb4-43f9-b32a-12cd1006e46a\",\"dataFeedName\":\"java_create_data_feed_test_samplec3a902be-9b05-4ce1-ad38-30b566097a18\",\"metrics\":[{\"metricId\":\"e8b324fc-f5b2-402b-833e-3d44de806963\",\"metricName\":\"cost\",\"metricDisplayName\":\"cost\",\"metricDescription\":\"\"},{\"metricId\":\"3c9bd24c-4aae-420c-8b74-96614bb1541f\",\"metricName\":\"revenue\",\"metricDisplayName\":\"revenue\",\"metricDescription\":\"\"}],\"dimension\":[{\"dimensionName\":\"category\",\"dimensionDisplayName\":\"category\"},{\"dimensionName\":\"city\",\"dimensionDisplayName\":\"city\"}],\"dataStartFrom\":\"2019-10-01T00:00:00Z\",\"dataSourceType\":\"AzureDataLakeStorageGen2\",\"timestampColumn\":\"\",\"startOffsetInSeconds\":0,\"maxQueryPerMinute\":30.0,\"granularityName\":\"Daily\",\"needRollup\":\"NoRollup\",\"fillMissingPointType\":\"PreviousValue\",\"fillMissingPointValue\":0.0,\"rollUpMethod\":\"None\",\"dataFeedDescription\":\"\",\"stopRetryAfterInSeconds\":-1,\"minRetryIntervalInSeconds\":-1,\"maxConcurrency\":0,\"viewMode\":\"Private\",\"admins\":[\"kaghiya@microsoft.com\"],\"viewers\":[],\"creator\":\"kaghiya@microsoft.com\",\"status\":\"Active\",\"createdTime\":\"2021-06-02T00:33:37Z\",\"isAdmin\":true,\"actionLinkTemplate\":\"\",\"dataSourceParameter\":{\"fileTemplate\":\"adsample.json\",\"accountName\":\"REDACTED\",\"directoryTemplate\":\"%Y/%m/%d\",\"fileSystemName\":\"adsample\"},\"authenticationType\":\"ServicePrincipalInKV\",\"credentialId\":\"e3483a80-9556-4f94-a681-632cdf6c39c2\"}", + "Date" : "Wed, 02 Jun 2021 00:34:19 GMT", + "Content-Type" : "application/json; charset=utf-8" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://REDACTED.cognitiveservices.azure.com/metricsadvisor/v1.0/dataFeeds/2f6deb68-bcb4-43f9-b32a-12cd1006e46a", + "Headers" : { + "User-Agent" : "azsdk-java-azure-ai-metricsadvisor/1.0.0-beta.4 (1.8.0_221; Mac OS X; 10.16)", + "x-ms-client-request-id" : "1423ce4a-ab2c-40c5-8ce0-7a7767a1bc81" + }, + "Response" : { + "x-request-id" : "0fc9c00b-9f87-4f08-83c5-014f10c4cf3b", + "content-length" : "0", + "x-envoy-upstream-service-time" : "417", + "Strict-Transport-Security" : "max-age=31536000; includeSubDomains; preload", + "x-content-type-options" : "nosniff", + "apim-request-id" : "0fc9c00b-9f87-4f08-83c5-014f10c4cf3b", + "retry-after" : "0", + "StatusCode" : "204", + "Date" : "Wed, 02 Jun 2021 00:34:19 GMT" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://REDACTED.cognitiveservices.azure.com/metricsadvisor/v1.0/dataFeeds/11cfc127-e774-40cf-b1f3-ec406842322d", + "Headers" : { + "User-Agent" : "azsdk-java-azure-ai-metricsadvisor/1.0.0-beta.4 (1.8.0_221; Mac OS X; 10.16)", + "x-ms-client-request-id" : "abafe521-fc65-44e0-81cb-6d4397b75be2" + }, + "Response" : { + "x-request-id" : "1d2dc9cd-6baf-4062-9dfd-d97e9dc6be3c", + "content-length" : "0", + "x-envoy-upstream-service-time" : "224", + "Strict-Transport-Security" : "max-age=31536000; includeSubDomains; preload", + "x-content-type-options" : "nosniff", + "apim-request-id" : "1d2dc9cd-6baf-4062-9dfd-d97e9dc6be3c", + "retry-after" : "0", + "StatusCode" : "204", + "Date" : "Wed, 02 Jun 2021 00:34:20 GMT" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://REDACTED.cognitiveservices.azure.com/metricsadvisor/v1.0/dataFeeds/f0b4f08b-c901-4c03-bc29-5d4b57e370f7", + "Headers" : { + "User-Agent" : "azsdk-java-azure-ai-metricsadvisor/1.0.0-beta.4 (1.8.0_221; Mac OS X; 10.16)", + "x-ms-client-request-id" : "efbcf655-3260-4dc3-8ff0-9ff66e1fc62f" + }, + "Response" : { + "x-request-id" : "db4ae64a-8e1c-45a1-b377-cb4b4f590eab", + "content-length" : "0", + "x-envoy-upstream-service-time" : "109", + "Strict-Transport-Security" : "max-age=31536000; includeSubDomains; preload", + "x-content-type-options" : "nosniff", + "apim-request-id" : "db4ae64a-8e1c-45a1-b377-cb4b4f590eab", + "retry-after" : "0", + "StatusCode" : "204", + "Date" : "Wed, 02 Jun 2021 00:34:20 GMT" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://REDACTED.cognitiveservices.azure.com/metricsadvisor/v1.0/dataFeeds/e3483a80-9556-4f94-a681-632cdf6c39c2", + "Headers" : { + "User-Agent" : "azsdk-java-azure-ai-metricsadvisor/1.0.0-beta.4 (1.8.0_221; Mac OS X; 10.16)", + "x-ms-client-request-id" : "e38e8910-6a86-4a90-9f5c-067196c7fec7" + }, + "Response" : { + "x-request-id" : "15269c17-f1e5-42eb-a5f7-23ce5130e4da", + "content-length" : "0", + "x-envoy-upstream-service-time" : "198", + "Strict-Transport-Security" : "max-age=31536000; includeSubDomains; preload", + "x-content-type-options" : "nosniff", + "apim-request-id" : "15269c17-f1e5-42eb-a5f7-23ce5130e4da", + "retry-after" : "0", + "StatusCode" : "204", + "Date" : "Wed, 02 Jun 2021 00:34:20 GMT" + }, + "Exception" : null + } ], + "variables" : [ ] +} \ No newline at end of file diff --git a/sdk/metricsadvisor/azure-ai-metricsadvisor/src/test/resources/session-records/DataFeedWithCredentialsTest.testSqlServer[1].json b/sdk/metricsadvisor/azure-ai-metricsadvisor/src/test/resources/session-records/DataFeedWithCredentialsTest.testSqlServer[1].json new file mode 100644 index 0000000000000..d7c4dcdda9665 --- /dev/null +++ b/sdk/metricsadvisor/azure-ai-metricsadvisor/src/test/resources/session-records/DataFeedWithCredentialsTest.testSqlServer[1].json @@ -0,0 +1,420 @@ +{ + "networkCallRecords" : [ { + "Method" : "POST", + "Uri" : "https://REDACTED.cognitiveservices.azure.com/metricsadvisor/v1.0/dataFeeds", + "Headers" : { + "User-Agent" : "azsdk-java-azure-ai-metricsadvisor/1.0.0-beta.4 (1.8.0_221; Mac OS X; 10.16)", + "x-ms-client-request-id" : "1ee5eae2-5610-4747-88a9-8bd17c814842", + "Content-Type" : "application/json" + }, + "Response" : { + "x-request-id" : "0d8f4dba-5283-4fd2-b2a1-6e4c2e08b4a6", + "content-length" : "0", + "x-envoy-upstream-service-time" : "5717", + "Strict-Transport-Security" : "max-age=31536000; includeSubDomains; preload", + "x-content-type-options" : "nosniff", + "apim-request-id" : "0d8f4dba-5283-4fd2-b2a1-6e4c2e08b4a6", + "retry-after" : "0", + "StatusCode" : "201", + "Date" : "Wed, 02 Jun 2021 00:30:45 GMT", + "Location" : "https://js-metrics-advisor.cognitiveservices.azure.com/metricsadvisor/v1.0/dataFeeds/dfd579a0-1626-45d7-8f52-e0f7fa05ebe7" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://REDACTED.cognitiveservices.azure.com/metricsadvisor/v1.0/dataFeeds/dfd579a0-1626-45d7-8f52-e0f7fa05ebe7", + "Headers" : { + "User-Agent" : "azsdk-java-azure-ai-metricsadvisor/1.0.0-beta.4 (1.8.0_221; Mac OS X; 10.16)", + "x-ms-client-request-id" : "711984ef-95c3-4e97-a992-6168bfed40dc" + }, + "Response" : { + "x-request-id" : "e0e483ae-8aeb-46ef-acdb-8f3b9449b8d6", + "content-length" : "1229", + "x-envoy-upstream-service-time" : "215", + "Strict-Transport-Security" : "max-age=31536000; includeSubDomains; preload", + "x-content-type-options" : "nosniff", + "apim-request-id" : "e0e483ae-8aeb-46ef-acdb-8f3b9449b8d6", + "retry-after" : "0", + "StatusCode" : "200", + "Body" : "{\"dataFeedId\":\"dfd579a0-1626-45d7-8f52-e0f7fa05ebe7\",\"dataFeedName\":\"java_create_data_feed_test_sample4dfd6bd4-960e-444f-914a-b800c44548ad\",\"metrics\":[{\"metricId\":\"ca2619cd-3b84-432b-970e-db088dcae2dd\",\"metricName\":\"cost\",\"metricDisplayName\":\"cost\",\"metricDescription\":\"\"},{\"metricId\":\"b550e735-3b0f-4baa-9790-d1be357f8dae\",\"metricName\":\"revenue\",\"metricDisplayName\":\"revenue\",\"metricDescription\":\"\"}],\"dimension\":[{\"dimensionName\":\"category\",\"dimensionDisplayName\":\"category\"},{\"dimensionName\":\"city\",\"dimensionDisplayName\":\"city\"}],\"dataStartFrom\":\"2019-10-01T00:00:00Z\",\"dataSourceType\":\"SqlServer\",\"timestampColumn\":\"\",\"startOffsetInSeconds\":0,\"maxQueryPerMinute\":30.0,\"granularityName\":\"Daily\",\"needRollup\":\"NoRollup\",\"fillMissingPointType\":\"PreviousValue\",\"fillMissingPointValue\":0.0,\"rollUpMethod\":\"None\",\"dataFeedDescription\":\"\",\"stopRetryAfterInSeconds\":-1,\"minRetryIntervalInSeconds\":-1,\"maxConcurrency\":0,\"viewMode\":\"Private\",\"admins\":[\"kaghiya@microsoft.com\"],\"viewers\":[],\"creator\":\"kaghiya@microsoft.com\",\"status\":\"Active\",\"createdTime\":\"2021-06-02T00:30:44Z\",\"isAdmin\":true,\"actionLinkTemplate\":\"\",\"dataSourceParameter\":{\"query\":\"select * from adsample2 where Timestamp = @StartTime\"},\"authenticationType\":\"Basic\"}", + "Date" : "Wed, 02 Jun 2021 00:30:44 GMT", + "Content-Type" : "application/json; charset=utf-8" + }, + "Exception" : null + }, { + "Method" : "PATCH", + "Uri" : "https://REDACTED.cognitiveservices.azure.com/metricsadvisor/v1.0/dataFeeds/dfd579a0-1626-45d7-8f52-e0f7fa05ebe7", + "Headers" : { + "User-Agent" : "azsdk-java-azure-ai-metricsadvisor/1.0.0-beta.4 (1.8.0_221; Mac OS X; 10.16)", + "x-ms-client-request-id" : "3ea0ef01-9721-455a-a6ed-21728c4273a2", + "Content-Type" : "application/merge-patch+json" + }, + "Response" : { + "x-request-id" : "ac77a968-5750-4eae-99ec-d962f284613d", + "content-length" : "1239", + "x-envoy-upstream-service-time" : "962", + "Strict-Transport-Security" : "max-age=31536000; includeSubDomains; preload", + "x-content-type-options" : "nosniff", + "apim-request-id" : "ac77a968-5750-4eae-99ec-d962f284613d", + "retry-after" : "0", + "StatusCode" : "200", + "Body" : "{\"dataFeedId\":\"dfd579a0-1626-45d7-8f52-e0f7fa05ebe7\",\"dataFeedName\":\"java_create_data_feed_test_sample4dfd6bd4-960e-444f-914a-b800c44548ad\",\"metrics\":[{\"metricId\":\"ca2619cd-3b84-432b-970e-db088dcae2dd\",\"metricName\":\"cost\",\"metricDisplayName\":\"cost\",\"metricDescription\":\"\"},{\"metricId\":\"b550e735-3b0f-4baa-9790-d1be357f8dae\",\"metricName\":\"revenue\",\"metricDisplayName\":\"revenue\",\"metricDescription\":\"\"}],\"dimension\":[{\"dimensionName\":\"category\",\"dimensionDisplayName\":\"category\"},{\"dimensionName\":\"city\",\"dimensionDisplayName\":\"city\"}],\"dataStartFrom\":\"2019-10-01T00:00:00Z\",\"dataSourceType\":\"SqlServer\",\"timestampColumn\":\"\",\"startOffsetInSeconds\":0,\"maxQueryPerMinute\":30.0,\"granularityName\":\"Daily\",\"needRollup\":\"NoRollup\",\"fillMissingPointType\":\"PreviousValue\",\"fillMissingPointValue\":0.0,\"rollUpMethod\":\"None\",\"dataFeedDescription\":\"\",\"stopRetryAfterInSeconds\":-1,\"minRetryIntervalInSeconds\":-1,\"maxConcurrency\":0,\"viewMode\":\"Private\",\"admins\":[\"kaghiya@microsoft.com\"],\"viewers\":[],\"creator\":\"kaghiya@microsoft.com\",\"status\":\"Active\",\"createdTime\":\"2021-06-02T00:30:44Z\",\"isAdmin\":true,\"actionLinkTemplate\":\"\",\"dataSourceParameter\":{\"query\":\"select * from adsample2 where Timestamp = @StartTime\"},\"authenticationType\":\"ManagedIdentity\"}", + "Date" : "Wed, 02 Jun 2021 00:30:45 GMT", + "Content-Type" : "application/json; charset=utf-8" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://REDACTED.cognitiveservices.azure.com/metricsadvisor/v1.0/dataFeeds/dfd579a0-1626-45d7-8f52-e0f7fa05ebe7", + "Headers" : { + "User-Agent" : "azsdk-java-azure-ai-metricsadvisor/1.0.0-beta.4 (1.8.0_221; Mac OS X; 10.16)", + "x-ms-client-request-id" : "89979aa2-3cd2-4fdc-ad80-e2cb0d5c1ba0" + }, + "Response" : { + "x-request-id" : "6c27db77-faaa-46e0-9492-aee38c1862a4", + "content-length" : "1239", + "x-envoy-upstream-service-time" : "281", + "Strict-Transport-Security" : "max-age=31536000; includeSubDomains; preload", + "x-content-type-options" : "nosniff", + "apim-request-id" : "6c27db77-faaa-46e0-9492-aee38c1862a4", + "retry-after" : "0", + "StatusCode" : "200", + "Body" : "{\"dataFeedId\":\"dfd579a0-1626-45d7-8f52-e0f7fa05ebe7\",\"dataFeedName\":\"java_create_data_feed_test_sample4dfd6bd4-960e-444f-914a-b800c44548ad\",\"metrics\":[{\"metricId\":\"ca2619cd-3b84-432b-970e-db088dcae2dd\",\"metricName\":\"cost\",\"metricDisplayName\":\"cost\",\"metricDescription\":\"\"},{\"metricId\":\"b550e735-3b0f-4baa-9790-d1be357f8dae\",\"metricName\":\"revenue\",\"metricDisplayName\":\"revenue\",\"metricDescription\":\"\"}],\"dimension\":[{\"dimensionName\":\"category\",\"dimensionDisplayName\":\"category\"},{\"dimensionName\":\"city\",\"dimensionDisplayName\":\"city\"}],\"dataStartFrom\":\"2019-10-01T00:00:00Z\",\"dataSourceType\":\"SqlServer\",\"timestampColumn\":\"\",\"startOffsetInSeconds\":0,\"maxQueryPerMinute\":30.0,\"granularityName\":\"Daily\",\"needRollup\":\"NoRollup\",\"fillMissingPointType\":\"PreviousValue\",\"fillMissingPointValue\":0.0,\"rollUpMethod\":\"None\",\"dataFeedDescription\":\"\",\"stopRetryAfterInSeconds\":-1,\"minRetryIntervalInSeconds\":-1,\"maxConcurrency\":0,\"viewMode\":\"Private\",\"admins\":[\"kaghiya@microsoft.com\"],\"viewers\":[],\"creator\":\"kaghiya@microsoft.com\",\"status\":\"Active\",\"createdTime\":\"2021-06-02T00:30:44Z\",\"isAdmin\":true,\"actionLinkTemplate\":\"\",\"dataSourceParameter\":{\"query\":\"select * from adsample2 where Timestamp = @StartTime\"},\"authenticationType\":\"ManagedIdentity\"}", + "Date" : "Wed, 02 Jun 2021 00:30:46 GMT", + "Content-Type" : "application/json; charset=utf-8" + }, + "Exception" : null + }, { + "Method" : "POST", + "Uri" : "https://REDACTED.cognitiveservices.azure.com/metricsadvisor/v1.0/credentials", + "Headers" : { + "User-Agent" : "azsdk-java-azure-ai-metricsadvisor/1.0.0-beta.4 (1.8.0_221; Mac OS X; 10.16)", + "x-ms-client-request-id" : "32c5ccc8-c3a3-462d-844c-47d05de369af", + "Content-Type" : "application/json" + }, + "Response" : { + "x-request-id" : "fe00ec94-66f6-4eb4-b149-f7afac03b81c", + "content-length" : "0", + "x-envoy-upstream-service-time" : "483", + "Strict-Transport-Security" : "max-age=31536000; includeSubDomains; preload", + "x-content-type-options" : "nosniff", + "apim-request-id" : "fe00ec94-66f6-4eb4-b149-f7afac03b81c", + "retry-after" : "0", + "StatusCode" : "201", + "Date" : "Wed, 02 Jun 2021 00:30:46 GMT", + "Location" : "https://js-metrics-advisor.cognitiveservices.azure.com/metricsadvisor/v1.0/credentials/f2ed2284-b04c-4d2d-abf0-37833ac17138" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://REDACTED.cognitiveservices.azure.com/metricsadvisor/v1.0/credentials/f2ed2284-b04c-4d2d-abf0-37833ac17138", + "Headers" : { + "User-Agent" : "azsdk-java-azure-ai-metricsadvisor/1.0.0-beta.4 (1.8.0_221; Mac OS X; 10.16)", + "x-ms-client-request-id" : "557052a0-1a7d-4c2a-b14b-1c240c542ff6" + }, + "Response" : { + "x-request-id" : "9c900a16-d0b0-440b-95e8-50b7494d4c17", + "content-length" : "274", + "x-envoy-upstream-service-time" : "5185", + "Strict-Transport-Security" : "max-age=31536000; includeSubDomains; preload", + "x-content-type-options" : "nosniff", + "apim-request-id" : "9c900a16-d0b0-440b-95e8-50b7494d4c17", + "retry-after" : "0", + "StatusCode" : "200", + "Body" : "{\"dataSourceCredentialId\":\"f2ed2284-b04c-4d2d-abf0-37833ac17138\",\"dataSourceCredentialName\":\"java_create_data_source_cred_sql_conac257eb3-b21c-484a-ad64-4c015dafe882\",\"dataSourceCredentialDescription\":\"\",\"dataSourceCredentialType\":\"AzureSQLConnectionString\",\"parameters\":{}}", + "Date" : "Wed, 02 Jun 2021 00:30:52 GMT", + "Content-Type" : "application/json; charset=utf-8" + }, + "Exception" : null + }, { + "Method" : "PATCH", + "Uri" : "https://REDACTED.cognitiveservices.azure.com/metricsadvisor/v1.0/dataFeeds/dfd579a0-1626-45d7-8f52-e0f7fa05ebe7", + "Headers" : { + "User-Agent" : "azsdk-java-azure-ai-metricsadvisor/1.0.0-beta.4 (1.8.0_221; Mac OS X; 10.16)", + "x-ms-client-request-id" : "3c12dba2-a3bc-4e91-8dd0-98e560b957c7", + "Content-Type" : "application/merge-patch+json" + }, + "Response" : { + "x-request-id" : "cef223da-7558-4f57-863a-fbfa965bf76f", + "content-length" : "1302", + "x-envoy-upstream-service-time" : "828", + "Strict-Transport-Security" : "max-age=31536000; includeSubDomains; preload", + "x-content-type-options" : "nosniff", + "apim-request-id" : "cef223da-7558-4f57-863a-fbfa965bf76f", + "retry-after" : "0", + "StatusCode" : "200", + "Body" : "{\"dataFeedId\":\"dfd579a0-1626-45d7-8f52-e0f7fa05ebe7\",\"dataFeedName\":\"java_create_data_feed_test_sample4dfd6bd4-960e-444f-914a-b800c44548ad\",\"metrics\":[{\"metricId\":\"ca2619cd-3b84-432b-970e-db088dcae2dd\",\"metricName\":\"cost\",\"metricDisplayName\":\"cost\",\"metricDescription\":\"\"},{\"metricId\":\"b550e735-3b0f-4baa-9790-d1be357f8dae\",\"metricName\":\"revenue\",\"metricDisplayName\":\"revenue\",\"metricDescription\":\"\"}],\"dimension\":[{\"dimensionName\":\"category\",\"dimensionDisplayName\":\"category\"},{\"dimensionName\":\"city\",\"dimensionDisplayName\":\"city\"}],\"dataStartFrom\":\"2019-10-01T00:00:00Z\",\"dataSourceType\":\"SqlServer\",\"timestampColumn\":\"\",\"startOffsetInSeconds\":0,\"maxQueryPerMinute\":30.0,\"granularityName\":\"Daily\",\"needRollup\":\"NoRollup\",\"fillMissingPointType\":\"PreviousValue\",\"fillMissingPointValue\":0.0,\"rollUpMethod\":\"None\",\"dataFeedDescription\":\"\",\"stopRetryAfterInSeconds\":-1,\"minRetryIntervalInSeconds\":-1,\"maxConcurrency\":0,\"viewMode\":\"Private\",\"admins\":[\"kaghiya@microsoft.com\"],\"viewers\":[],\"creator\":\"kaghiya@microsoft.com\",\"status\":\"Active\",\"createdTime\":\"2021-06-02T00:30:44Z\",\"isAdmin\":true,\"actionLinkTemplate\":\"\",\"dataSourceParameter\":{\"query\":\"select * from adsample2 where Timestamp = @StartTime\"},\"authenticationType\":\"AzureSQLConnectionString\",\"credentialId\":\"f2ed2284-b04c-4d2d-abf0-37833ac17138\"}", + "Date" : "Wed, 02 Jun 2021 00:30:52 GMT", + "Content-Type" : "application/json; charset=utf-8" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://REDACTED.cognitiveservices.azure.com/metricsadvisor/v1.0/dataFeeds/dfd579a0-1626-45d7-8f52-e0f7fa05ebe7", + "Headers" : { + "User-Agent" : "azsdk-java-azure-ai-metricsadvisor/1.0.0-beta.4 (1.8.0_221; Mac OS X; 10.16)", + "x-ms-client-request-id" : "a1cad5f6-4303-486d-b9ce-3493cbc72e37" + }, + "Response" : { + "x-request-id" : "25816479-5d69-48c9-8265-e17c06e18069", + "content-length" : "1302", + "x-envoy-upstream-service-time" : "206", + "Strict-Transport-Security" : "max-age=31536000; includeSubDomains; preload", + "x-content-type-options" : "nosniff", + "apim-request-id" : "25816479-5d69-48c9-8265-e17c06e18069", + "retry-after" : "0", + "StatusCode" : "200", + "Body" : "{\"dataFeedId\":\"dfd579a0-1626-45d7-8f52-e0f7fa05ebe7\",\"dataFeedName\":\"java_create_data_feed_test_sample4dfd6bd4-960e-444f-914a-b800c44548ad\",\"metrics\":[{\"metricId\":\"ca2619cd-3b84-432b-970e-db088dcae2dd\",\"metricName\":\"cost\",\"metricDisplayName\":\"cost\",\"metricDescription\":\"\"},{\"metricId\":\"b550e735-3b0f-4baa-9790-d1be357f8dae\",\"metricName\":\"revenue\",\"metricDisplayName\":\"revenue\",\"metricDescription\":\"\"}],\"dimension\":[{\"dimensionName\":\"category\",\"dimensionDisplayName\":\"category\"},{\"dimensionName\":\"city\",\"dimensionDisplayName\":\"city\"}],\"dataStartFrom\":\"2019-10-01T00:00:00Z\",\"dataSourceType\":\"SqlServer\",\"timestampColumn\":\"\",\"startOffsetInSeconds\":0,\"maxQueryPerMinute\":30.0,\"granularityName\":\"Daily\",\"needRollup\":\"NoRollup\",\"fillMissingPointType\":\"PreviousValue\",\"fillMissingPointValue\":0.0,\"rollUpMethod\":\"None\",\"dataFeedDescription\":\"\",\"stopRetryAfterInSeconds\":-1,\"minRetryIntervalInSeconds\":-1,\"maxConcurrency\":0,\"viewMode\":\"Private\",\"admins\":[\"kaghiya@microsoft.com\"],\"viewers\":[],\"creator\":\"kaghiya@microsoft.com\",\"status\":\"Active\",\"createdTime\":\"2021-06-02T00:30:44Z\",\"isAdmin\":true,\"actionLinkTemplate\":\"\",\"dataSourceParameter\":{\"query\":\"select * from adsample2 where Timestamp = @StartTime\"},\"authenticationType\":\"AzureSQLConnectionString\",\"credentialId\":\"f2ed2284-b04c-4d2d-abf0-37833ac17138\"}", + "Date" : "Wed, 02 Jun 2021 00:30:52 GMT", + "Content-Type" : "application/json; charset=utf-8" + }, + "Exception" : null + }, { + "Method" : "POST", + "Uri" : "https://REDACTED.cognitiveservices.azure.com/metricsadvisor/v1.0/credentials", + "Headers" : { + "User-Agent" : "azsdk-java-azure-ai-metricsadvisor/1.0.0-beta.4 (1.8.0_221; Mac OS X; 10.16)", + "x-ms-client-request-id" : "54b6bd84-2806-4d4e-87aa-5f92b903cfed", + "Content-Type" : "application/json" + }, + "Response" : { + "x-request-id" : "908468ae-3f40-4542-903b-bae9d539de09", + "content-length" : "0", + "x-envoy-upstream-service-time" : "487", + "Strict-Transport-Security" : "max-age=31536000; includeSubDomains; preload", + "x-content-type-options" : "nosniff", + "apim-request-id" : "908468ae-3f40-4542-903b-bae9d539de09", + "retry-after" : "0", + "StatusCode" : "201", + "Date" : "Wed, 02 Jun 2021 00:30:53 GMT", + "Location" : "https://js-metrics-advisor.cognitiveservices.azure.com/metricsadvisor/v1.0/credentials/25dc9420-4545-4b27-ae9c-2a301d2a0d27" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://REDACTED.cognitiveservices.azure.com/metricsadvisor/v1.0/credentials/25dc9420-4545-4b27-ae9c-2a301d2a0d27", + "Headers" : { + "User-Agent" : "azsdk-java-azure-ai-metricsadvisor/1.0.0-beta.4 (1.8.0_221; Mac OS X; 10.16)", + "x-ms-client-request-id" : "f51f8561-b0ab-4069-a902-2dbb848458a2" + }, + "Response" : { + "x-request-id" : "1976cbe9-d974-4b62-922d-5fd008bd8e2b", + "content-length" : "360", + "x-envoy-upstream-service-time" : "77", + "Strict-Transport-Security" : "max-age=31536000; includeSubDomains; preload", + "x-content-type-options" : "nosniff", + "apim-request-id" : "1976cbe9-d974-4b62-922d-5fd008bd8e2b", + "retry-after" : "0", + "StatusCode" : "200", + "Body" : "{\"dataSourceCredentialId\":\"25dc9420-4545-4b27-ae9c-2a301d2a0d27\",\"dataSourceCredentialName\":\"java_create_data_source_cred_spb6eadb7b-8051-4dc6-9807-eed293a8b283\",\"dataSourceCredentialDescription\":\"\",\"dataSourceCredentialType\":\"ServicePrincipal\",\"parameters\":{\"clientId\":\"e70248b2-bffa-11eb-8529-0242ac130003\",\"tenantId\":\"45389ded-5e07-4e52-b225-4ae8f905afb5\"}}", + "Date" : "Wed, 02 Jun 2021 00:30:53 GMT", + "Content-Type" : "application/json; charset=utf-8" + }, + "Exception" : null + }, { + "Method" : "PATCH", + "Uri" : "https://REDACTED.cognitiveservices.azure.com/metricsadvisor/v1.0/dataFeeds/dfd579a0-1626-45d7-8f52-e0f7fa05ebe7", + "Headers" : { + "User-Agent" : "azsdk-java-azure-ai-metricsadvisor/1.0.0-beta.4 (1.8.0_221; Mac OS X; 10.16)", + "x-ms-client-request-id" : "30d76315-cfe5-4d9a-a038-5cbc7cec1b2f", + "Content-Type" : "application/merge-patch+json" + }, + "Response" : { + "x-request-id" : "6a606fcf-0b7d-4541-9c31-dbb327cd20ae", + "content-length" : "1294", + "x-envoy-upstream-service-time" : "6301", + "Strict-Transport-Security" : "max-age=31536000; includeSubDomains; preload", + "x-content-type-options" : "nosniff", + "apim-request-id" : "6a606fcf-0b7d-4541-9c31-dbb327cd20ae", + "retry-after" : "0", + "StatusCode" : "200", + "Body" : "{\"dataFeedId\":\"dfd579a0-1626-45d7-8f52-e0f7fa05ebe7\",\"dataFeedName\":\"java_create_data_feed_test_sample4dfd6bd4-960e-444f-914a-b800c44548ad\",\"metrics\":[{\"metricId\":\"ca2619cd-3b84-432b-970e-db088dcae2dd\",\"metricName\":\"cost\",\"metricDisplayName\":\"cost\",\"metricDescription\":\"\"},{\"metricId\":\"b550e735-3b0f-4baa-9790-d1be357f8dae\",\"metricName\":\"revenue\",\"metricDisplayName\":\"revenue\",\"metricDescription\":\"\"}],\"dimension\":[{\"dimensionName\":\"category\",\"dimensionDisplayName\":\"category\"},{\"dimensionName\":\"city\",\"dimensionDisplayName\":\"city\"}],\"dataStartFrom\":\"2019-10-01T00:00:00Z\",\"dataSourceType\":\"SqlServer\",\"timestampColumn\":\"\",\"startOffsetInSeconds\":0,\"maxQueryPerMinute\":30.0,\"granularityName\":\"Daily\",\"needRollup\":\"NoRollup\",\"fillMissingPointType\":\"PreviousValue\",\"fillMissingPointValue\":0.0,\"rollUpMethod\":\"None\",\"dataFeedDescription\":\"\",\"stopRetryAfterInSeconds\":-1,\"minRetryIntervalInSeconds\":-1,\"maxConcurrency\":0,\"viewMode\":\"Private\",\"admins\":[\"kaghiya@microsoft.com\"],\"viewers\":[],\"creator\":\"kaghiya@microsoft.com\",\"status\":\"Active\",\"createdTime\":\"2021-06-02T00:30:44Z\",\"isAdmin\":true,\"actionLinkTemplate\":\"\",\"dataSourceParameter\":{\"query\":\"select * from adsample2 where Timestamp = @StartTime\"},\"authenticationType\":\"ServicePrincipal\",\"credentialId\":\"25dc9420-4545-4b27-ae9c-2a301d2a0d27\"}", + "Date" : "Wed, 02 Jun 2021 00:30:59 GMT", + "Content-Type" : "application/json; charset=utf-8" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://REDACTED.cognitiveservices.azure.com/metricsadvisor/v1.0/dataFeeds/dfd579a0-1626-45d7-8f52-e0f7fa05ebe7", + "Headers" : { + "User-Agent" : "azsdk-java-azure-ai-metricsadvisor/1.0.0-beta.4 (1.8.0_221; Mac OS X; 10.16)", + "x-ms-client-request-id" : "9594f0f3-99bd-4d9f-b39d-82a8dc825ae3" + }, + "Response" : { + "x-request-id" : "1b5af22b-92dc-4385-972c-3054d4d9c8ed", + "content-length" : "1294", + "x-envoy-upstream-service-time" : "175", + "Strict-Transport-Security" : "max-age=31536000; includeSubDomains; preload", + "x-content-type-options" : "nosniff", + "apim-request-id" : "1b5af22b-92dc-4385-972c-3054d4d9c8ed", + "retry-after" : "0", + "StatusCode" : "200", + "Body" : "{\"dataFeedId\":\"dfd579a0-1626-45d7-8f52-e0f7fa05ebe7\",\"dataFeedName\":\"java_create_data_feed_test_sample4dfd6bd4-960e-444f-914a-b800c44548ad\",\"metrics\":[{\"metricId\":\"ca2619cd-3b84-432b-970e-db088dcae2dd\",\"metricName\":\"cost\",\"metricDisplayName\":\"cost\",\"metricDescription\":\"\"},{\"metricId\":\"b550e735-3b0f-4baa-9790-d1be357f8dae\",\"metricName\":\"revenue\",\"metricDisplayName\":\"revenue\",\"metricDescription\":\"\"}],\"dimension\":[{\"dimensionName\":\"category\",\"dimensionDisplayName\":\"category\"},{\"dimensionName\":\"city\",\"dimensionDisplayName\":\"city\"}],\"dataStartFrom\":\"2019-10-01T00:00:00Z\",\"dataSourceType\":\"SqlServer\",\"timestampColumn\":\"\",\"startOffsetInSeconds\":0,\"maxQueryPerMinute\":30.0,\"granularityName\":\"Daily\",\"needRollup\":\"NoRollup\",\"fillMissingPointType\":\"PreviousValue\",\"fillMissingPointValue\":0.0,\"rollUpMethod\":\"None\",\"dataFeedDescription\":\"\",\"stopRetryAfterInSeconds\":-1,\"minRetryIntervalInSeconds\":-1,\"maxConcurrency\":0,\"viewMode\":\"Private\",\"admins\":[\"kaghiya@microsoft.com\"],\"viewers\":[],\"creator\":\"kaghiya@microsoft.com\",\"status\":\"Active\",\"createdTime\":\"2021-06-02T00:30:44Z\",\"isAdmin\":true,\"actionLinkTemplate\":\"\",\"dataSourceParameter\":{\"query\":\"select * from adsample2 where Timestamp = @StartTime\"},\"authenticationType\":\"ServicePrincipal\",\"credentialId\":\"25dc9420-4545-4b27-ae9c-2a301d2a0d27\"}", + "Date" : "Wed, 02 Jun 2021 00:31:00 GMT", + "Content-Type" : "application/json; charset=utf-8" + }, + "Exception" : null + }, { + "Method" : "POST", + "Uri" : "https://REDACTED.cognitiveservices.azure.com/metricsadvisor/v1.0/credentials", + "Headers" : { + "User-Agent" : "azsdk-java-azure-ai-metricsadvisor/1.0.0-beta.4 (1.8.0_221; Mac OS X; 10.16)", + "x-ms-client-request-id" : "0ceb3fd5-3636-4a59-a7f8-c0aa36fabd01", + "Content-Type" : "application/json" + }, + "Response" : { + "x-request-id" : "7bb42a13-7501-4511-bb2a-024e7be1de2c", + "content-length" : "0", + "x-envoy-upstream-service-time" : "249", + "Strict-Transport-Security" : "max-age=31536000; includeSubDomains; preload", + "x-content-type-options" : "nosniff", + "apim-request-id" : "7bb42a13-7501-4511-bb2a-024e7be1de2c", + "retry-after" : "0", + "StatusCode" : "201", + "Date" : "Wed, 02 Jun 2021 00:31:00 GMT", + "Location" : "https://js-metrics-advisor.cognitiveservices.azure.com/metricsadvisor/v1.0/credentials/ef787c41-2d6e-4a27-8180-1c1d0c63e032" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://REDACTED.cognitiveservices.azure.com/metricsadvisor/v1.0/credentials/ef787c41-2d6e-4a27-8180-1c1d0c63e032", + "Headers" : { + "User-Agent" : "azsdk-java-azure-ai-metricsadvisor/1.0.0-beta.4 (1.8.0_221; Mac OS X; 10.16)", + "x-ms-client-request-id" : "be341636-e7f4-4be4-98cb-b6f34c0bf3be" + }, + "Response" : { + "x-request-id" : "f00a2acc-c093-43de-834d-027fcc99a3ea", + "content-length" : "549", + "x-envoy-upstream-service-time" : "5125", + "Strict-Transport-Security" : "max-age=31536000; includeSubDomains; preload", + "x-content-type-options" : "nosniff", + "apim-request-id" : "f00a2acc-c093-43de-834d-027fcc99a3ea", + "retry-after" : "0", + "StatusCode" : "200", + "Body" : "{\"dataSourceCredentialId\":\"ef787c41-2d6e-4a27-8180-1c1d0c63e032\",\"dataSourceCredentialName\":\"java_create_data_source_cred_spkva00b3ff8-a48b-4370-80c2-9d2b222dd023\",\"dataSourceCredentialDescription\":\"\",\"dataSourceCredentialType\":\"ServicePrincipalInKV\",\"parameters\":{\"servicePrincipalSecretNameInKV\":\"DSClientSer_1\",\"servicePrincipalIdNameInKV\":\"DSClientID_1\",\"tenantId\":\"45389ded-5e07-4e52-b225-4ae8f905afb5\",\"keyVaultClientId\":\"e70248b2-bffa-11eb-8529-0242ac130003\",\"keyVaultEndpoint\":\"https://dbd4c453-c7fc-4602-b083-6ed0401cc01d.vault.azure.net\"}}", + "Date" : "Wed, 02 Jun 2021 00:31:06 GMT", + "Content-Type" : "application/json; charset=utf-8" + }, + "Exception" : null + }, { + "Method" : "PATCH", + "Uri" : "https://REDACTED.cognitiveservices.azure.com/metricsadvisor/v1.0/dataFeeds/dfd579a0-1626-45d7-8f52-e0f7fa05ebe7", + "Headers" : { + "User-Agent" : "azsdk-java-azure-ai-metricsadvisor/1.0.0-beta.4 (1.8.0_221; Mac OS X; 10.16)", + "x-ms-client-request-id" : "68930554-1085-4200-b858-9abc280b70c2", + "Content-Type" : "application/merge-patch+json" + }, + "Response" : { + "x-request-id" : "10d467a7-b8ab-4ef1-8ecd-879617ed7f36", + "content-length" : "1298", + "x-envoy-upstream-service-time" : "1228", + "Strict-Transport-Security" : "max-age=31536000; includeSubDomains; preload", + "x-content-type-options" : "nosniff", + "apim-request-id" : "10d467a7-b8ab-4ef1-8ecd-879617ed7f36", + "retry-after" : "0", + "StatusCode" : "200", + "Body" : "{\"dataFeedId\":\"dfd579a0-1626-45d7-8f52-e0f7fa05ebe7\",\"dataFeedName\":\"java_create_data_feed_test_sample4dfd6bd4-960e-444f-914a-b800c44548ad\",\"metrics\":[{\"metricId\":\"ca2619cd-3b84-432b-970e-db088dcae2dd\",\"metricName\":\"cost\",\"metricDisplayName\":\"cost\",\"metricDescription\":\"\"},{\"metricId\":\"b550e735-3b0f-4baa-9790-d1be357f8dae\",\"metricName\":\"revenue\",\"metricDisplayName\":\"revenue\",\"metricDescription\":\"\"}],\"dimension\":[{\"dimensionName\":\"category\",\"dimensionDisplayName\":\"category\"},{\"dimensionName\":\"city\",\"dimensionDisplayName\":\"city\"}],\"dataStartFrom\":\"2019-10-01T00:00:00Z\",\"dataSourceType\":\"SqlServer\",\"timestampColumn\":\"\",\"startOffsetInSeconds\":0,\"maxQueryPerMinute\":30.0,\"granularityName\":\"Daily\",\"needRollup\":\"NoRollup\",\"fillMissingPointType\":\"PreviousValue\",\"fillMissingPointValue\":0.0,\"rollUpMethod\":\"None\",\"dataFeedDescription\":\"\",\"stopRetryAfterInSeconds\":-1,\"minRetryIntervalInSeconds\":-1,\"maxConcurrency\":0,\"viewMode\":\"Private\",\"admins\":[\"kaghiya@microsoft.com\"],\"viewers\":[],\"creator\":\"kaghiya@microsoft.com\",\"status\":\"Active\",\"createdTime\":\"2021-06-02T00:30:44Z\",\"isAdmin\":true,\"actionLinkTemplate\":\"\",\"dataSourceParameter\":{\"query\":\"select * from adsample2 where Timestamp = @StartTime\"},\"authenticationType\":\"ServicePrincipalInKV\",\"credentialId\":\"ef787c41-2d6e-4a27-8180-1c1d0c63e032\"}", + "Date" : "Wed, 02 Jun 2021 00:31:07 GMT", + "Content-Type" : "application/json; charset=utf-8" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://REDACTED.cognitiveservices.azure.com/metricsadvisor/v1.0/dataFeeds/dfd579a0-1626-45d7-8f52-e0f7fa05ebe7", + "Headers" : { + "User-Agent" : "azsdk-java-azure-ai-metricsadvisor/1.0.0-beta.4 (1.8.0_221; Mac OS X; 10.16)", + "x-ms-client-request-id" : "f0113a6f-b10d-41fd-b8d6-9aee0d0045dd" + }, + "Response" : { + "x-request-id" : "0a6dc923-cfce-4e58-ba30-e7ac805451e5", + "content-length" : "1298", + "x-envoy-upstream-service-time" : "182", + "Strict-Transport-Security" : "max-age=31536000; includeSubDomains; preload", + "x-content-type-options" : "nosniff", + "apim-request-id" : "0a6dc923-cfce-4e58-ba30-e7ac805451e5", + "retry-after" : "0", + "StatusCode" : "200", + "Body" : "{\"dataFeedId\":\"dfd579a0-1626-45d7-8f52-e0f7fa05ebe7\",\"dataFeedName\":\"java_create_data_feed_test_sample4dfd6bd4-960e-444f-914a-b800c44548ad\",\"metrics\":[{\"metricId\":\"ca2619cd-3b84-432b-970e-db088dcae2dd\",\"metricName\":\"cost\",\"metricDisplayName\":\"cost\",\"metricDescription\":\"\"},{\"metricId\":\"b550e735-3b0f-4baa-9790-d1be357f8dae\",\"metricName\":\"revenue\",\"metricDisplayName\":\"revenue\",\"metricDescription\":\"\"}],\"dimension\":[{\"dimensionName\":\"category\",\"dimensionDisplayName\":\"category\"},{\"dimensionName\":\"city\",\"dimensionDisplayName\":\"city\"}],\"dataStartFrom\":\"2019-10-01T00:00:00Z\",\"dataSourceType\":\"SqlServer\",\"timestampColumn\":\"\",\"startOffsetInSeconds\":0,\"maxQueryPerMinute\":30.0,\"granularityName\":\"Daily\",\"needRollup\":\"NoRollup\",\"fillMissingPointType\":\"PreviousValue\",\"fillMissingPointValue\":0.0,\"rollUpMethod\":\"None\",\"dataFeedDescription\":\"\",\"stopRetryAfterInSeconds\":-1,\"minRetryIntervalInSeconds\":-1,\"maxConcurrency\":0,\"viewMode\":\"Private\",\"admins\":[\"kaghiya@microsoft.com\"],\"viewers\":[],\"creator\":\"kaghiya@microsoft.com\",\"status\":\"Active\",\"createdTime\":\"2021-06-02T00:30:44Z\",\"isAdmin\":true,\"actionLinkTemplate\":\"\",\"dataSourceParameter\":{\"query\":\"select * from adsample2 where Timestamp = @StartTime\"},\"authenticationType\":\"ServicePrincipalInKV\",\"credentialId\":\"ef787c41-2d6e-4a27-8180-1c1d0c63e032\"}", + "Date" : "Wed, 02 Jun 2021 00:31:06 GMT", + "Content-Type" : "application/json; charset=utf-8" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://REDACTED.cognitiveservices.azure.com/metricsadvisor/v1.0/dataFeeds/dfd579a0-1626-45d7-8f52-e0f7fa05ebe7", + "Headers" : { + "User-Agent" : "azsdk-java-azure-ai-metricsadvisor/1.0.0-beta.4 (1.8.0_221; Mac OS X; 10.16)", + "x-ms-client-request-id" : "032b64ba-bbfa-4468-9fc2-93109c9b1c80" + }, + "Response" : { + "x-request-id" : "aaafb06d-90a1-4323-bb98-eda153d8b6b9", + "content-length" : "0", + "x-envoy-upstream-service-time" : "393", + "Strict-Transport-Security" : "max-age=31536000; includeSubDomains; preload", + "x-content-type-options" : "nosniff", + "apim-request-id" : "aaafb06d-90a1-4323-bb98-eda153d8b6b9", + "retry-after" : "0", + "StatusCode" : "204", + "Date" : "Wed, 02 Jun 2021 00:31:07 GMT" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://REDACTED.cognitiveservices.azure.com/metricsadvisor/v1.0/dataFeeds/f2ed2284-b04c-4d2d-abf0-37833ac17138", + "Headers" : { + "User-Agent" : "azsdk-java-azure-ai-metricsadvisor/1.0.0-beta.4 (1.8.0_221; Mac OS X; 10.16)", + "x-ms-client-request-id" : "dc8421c9-8783-4adf-9f7b-3a0158e3fc7b" + }, + "Response" : { + "x-request-id" : "7ba42a55-d376-4428-ac43-7a94f2647581", + "content-length" : "0", + "x-envoy-upstream-service-time" : "73", + "Strict-Transport-Security" : "max-age=31536000; includeSubDomains; preload", + "x-content-type-options" : "nosniff", + "apim-request-id" : "7ba42a55-d376-4428-ac43-7a94f2647581", + "retry-after" : "0", + "StatusCode" : "204", + "Date" : "Wed, 02 Jun 2021 00:31:07 GMT" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://REDACTED.cognitiveservices.azure.com/metricsadvisor/v1.0/dataFeeds/25dc9420-4545-4b27-ae9c-2a301d2a0d27", + "Headers" : { + "User-Agent" : "azsdk-java-azure-ai-metricsadvisor/1.0.0-beta.4 (1.8.0_221; Mac OS X; 10.16)", + "x-ms-client-request-id" : "c00e5654-86c5-468a-8f95-8df032cc4fb9" + }, + "Response" : { + "x-request-id" : "b6f6e0d2-ed10-44e5-92cf-b4647deb3167", + "content-length" : "0", + "x-envoy-upstream-service-time" : "5123", + "Strict-Transport-Security" : "max-age=31536000; includeSubDomains; preload", + "x-content-type-options" : "nosniff", + "apim-request-id" : "b6f6e0d2-ed10-44e5-92cf-b4647deb3167", + "retry-after" : "0", + "StatusCode" : "204", + "Date" : "Wed, 02 Jun 2021 00:31:12 GMT" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://REDACTED.cognitiveservices.azure.com/metricsadvisor/v1.0/dataFeeds/ef787c41-2d6e-4a27-8180-1c1d0c63e032", + "Headers" : { + "User-Agent" : "azsdk-java-azure-ai-metricsadvisor/1.0.0-beta.4 (1.8.0_221; Mac OS X; 10.16)", + "x-ms-client-request-id" : "0b627063-d07e-42af-8e3f-4de9225d42bb" + }, + "Response" : { + "x-request-id" : "dc115ce2-84ab-4080-9719-41a1f56a0203", + "content-length" : "0", + "x-envoy-upstream-service-time" : "104", + "Strict-Transport-Security" : "max-age=31536000; includeSubDomains; preload", + "x-content-type-options" : "nosniff", + "apim-request-id" : "dc115ce2-84ab-4080-9719-41a1f56a0203", + "retry-after" : "0", + "StatusCode" : "204", + "Date" : "Wed, 02 Jun 2021 00:31:12 GMT" + }, + "Exception" : null + } ], + "variables" : [ ] +} \ No newline at end of file diff --git a/sdk/metricsadvisor/azure-ai-metricsadvisor/src/test/resources/session-records/DatasourceCredentialAsyncTest.createDataLakeGen2SharedKey[1].json b/sdk/metricsadvisor/azure-ai-metricsadvisor/src/test/resources/session-records/DatasourceCredentialAsyncTest.createDataLakeGen2SharedKey[1].json new file mode 100644 index 0000000000000..f546c0c8b962c --- /dev/null +++ b/sdk/metricsadvisor/azure-ai-metricsadvisor/src/test/resources/session-records/DatasourceCredentialAsyncTest.createDataLakeGen2SharedKey[1].json @@ -0,0 +1,65 @@ +{ + "networkCallRecords" : [ { + "Method" : "POST", + "Uri" : "https://REDACTED.cognitiveservices.azure.com/metricsadvisor/v1.0/credentials", + "Headers" : { + "User-Agent" : "azsdk-java-azure-ai-metricsadvisor/1.0.0-beta.4 (1.8.0_221; Mac OS X; 10.16)", + "x-ms-client-request-id" : "c858ce81-83a9-48dc-ab7f-732e6f4535b0", + "Content-Type" : "application/json" + }, + "Response" : { + "x-request-id" : "33435dfb-c7bc-43b6-83f0-51150896de25", + "content-length" : "0", + "x-envoy-upstream-service-time" : "630", + "Strict-Transport-Security" : "max-age=31536000; includeSubDomains; preload", + "x-content-type-options" : "nosniff", + "apim-request-id" : "33435dfb-c7bc-43b6-83f0-51150896de25", + "retry-after" : "0", + "StatusCode" : "201", + "Date" : "Fri, 28 May 2021 23:21:27 GMT", + "Location" : "https://js-metrics-advisor.cognitiveservices.azure.com/metricsadvisor/v1.0/credentials/6926fdfc-e681-45e8-84d0-2655e99b9287" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://REDACTED.cognitiveservices.azure.com/metricsadvisor/v1.0/credentials/6926fdfc-e681-45e8-84d0-2655e99b9287", + "Headers" : { + "User-Agent" : "azsdk-java-azure-ai-metricsadvisor/1.0.0-beta.4 (1.8.0_221; Mac OS X; 10.16)", + "x-ms-client-request-id" : "cf6f925d-06c9-4b24-8875-18f778c28fc9" + }, + "Response" : { + "x-request-id" : "e634ea7f-821b-40a6-9c09-1380048cec27", + "content-length" : "273", + "x-envoy-upstream-service-time" : "73", + "Strict-Transport-Security" : "max-age=31536000; includeSubDomains; preload", + "x-content-type-options" : "nosniff", + "apim-request-id" : "e634ea7f-821b-40a6-9c09-1380048cec27", + "retry-after" : "0", + "StatusCode" : "200", + "Body" : "{\"dataSourceCredentialId\":\"6926fdfc-e681-45e8-84d0-2655e99b9287\",\"dataSourceCredentialName\":\"java_create_data_source_cred_dlake_gencaa6de72-0a11-4adb-b5f2-7e7e237629f9\",\"dataSourceCredentialDescription\":\"\",\"dataSourceCredentialType\":\"DataLakeGen2SharedKey\",\"parameters\":{}}", + "Date" : "Fri, 28 May 2021 23:21:27 GMT", + "Content-Type" : "application/json; charset=utf-8" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://REDACTED.cognitiveservices.azure.com/metricsadvisor/v1.0/credentials/6926fdfc-e681-45e8-84d0-2655e99b9287", + "Headers" : { + "User-Agent" : "azsdk-java-azure-ai-metricsadvisor/1.0.0-beta.4 (1.8.0_221; Mac OS X; 10.16)", + "x-ms-client-request-id" : "f4005c65-9631-4e64-b961-29629001b3aa" + }, + "Response" : { + "x-request-id" : "83a58de8-5b0d-4169-8cdc-d192cf27a567", + "content-length" : "0", + "x-envoy-upstream-service-time" : "221", + "Strict-Transport-Security" : "max-age=31536000; includeSubDomains; preload", + "x-content-type-options" : "nosniff", + "apim-request-id" : "83a58de8-5b0d-4169-8cdc-d192cf27a567", + "retry-after" : "0", + "StatusCode" : "204", + "Date" : "Fri, 28 May 2021 23:21:27 GMT" + }, + "Exception" : null + } ], + "variables" : [ ] +} \ No newline at end of file diff --git a/sdk/metricsadvisor/azure-ai-metricsadvisor/src/test/resources/session-records/DatasourceCredentialAsyncTest.createServicePrincipalInKV[1].json b/sdk/metricsadvisor/azure-ai-metricsadvisor/src/test/resources/session-records/DatasourceCredentialAsyncTest.createServicePrincipalInKV[1].json new file mode 100644 index 0000000000000..9b14b90283f3d --- /dev/null +++ b/sdk/metricsadvisor/azure-ai-metricsadvisor/src/test/resources/session-records/DatasourceCredentialAsyncTest.createServicePrincipalInKV[1].json @@ -0,0 +1,65 @@ +{ + "networkCallRecords" : [ { + "Method" : "POST", + "Uri" : "https://REDACTED.cognitiveservices.azure.com/metricsadvisor/v1.0/credentials", + "Headers" : { + "User-Agent" : "azsdk-java-azure-ai-metricsadvisor/1.0.0-beta.4 (1.8.0_221; Mac OS X; 10.16)", + "x-ms-client-request-id" : "30077b8b-dabe-4250-8232-4ac13e804d71", + "Content-Type" : "application/json" + }, + "Response" : { + "x-request-id" : "5c1d9b33-ef34-4c7b-b98c-fb4f0a6857a1", + "content-length" : "0", + "x-envoy-upstream-service-time" : "790", + "Strict-Transport-Security" : "max-age=31536000; includeSubDomains; preload", + "x-content-type-options" : "nosniff", + "apim-request-id" : "5c1d9b33-ef34-4c7b-b98c-fb4f0a6857a1", + "retry-after" : "0", + "StatusCode" : "201", + "Date" : "Fri, 28 May 2021 23:21:27 GMT", + "Location" : "https://js-metrics-advisor.cognitiveservices.azure.com/metricsadvisor/v1.0/credentials/ab346b60-e5d1-4325-9e06-24d00779a1aa" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://REDACTED.cognitiveservices.azure.com/metricsadvisor/v1.0/credentials/ab346b60-e5d1-4325-9e06-24d00779a1aa", + "Headers" : { + "User-Agent" : "azsdk-java-azure-ai-metricsadvisor/1.0.0-beta.4 (1.8.0_221; Mac OS X; 10.16)", + "x-ms-client-request-id" : "a90d2513-6d1a-4db4-9906-479cdb652886" + }, + "Response" : { + "x-request-id" : "d8f091f4-06eb-45fc-8fee-44053d470f01", + "content-length" : "549", + "x-envoy-upstream-service-time" : "95", + "Strict-Transport-Security" : "max-age=31536000; includeSubDomains; preload", + "x-content-type-options" : "nosniff", + "apim-request-id" : "d8f091f4-06eb-45fc-8fee-44053d470f01", + "retry-after" : "0", + "StatusCode" : "200", + "Body" : "{\"dataSourceCredentialId\":\"ab346b60-e5d1-4325-9e06-24d00779a1aa\",\"dataSourceCredentialName\":\"java_create_data_source_cred_spkv5ec975c9-310d-4dd9-9e37-d9ccc869038f\",\"dataSourceCredentialDescription\":\"\",\"dataSourceCredentialType\":\"ServicePrincipalInKV\",\"parameters\":{\"servicePrincipalSecretNameInKV\":\"DSClientSer_1\",\"servicePrincipalIdNameInKV\":\"DSClientID_1\",\"tenantId\":\"45389ded-5e07-4e52-b225-4ae8f905afb5\",\"keyVaultClientId\":\"e70248b2-bffa-11eb-8529-0242ac130003\",\"keyVaultEndpoint\":\"https://ee8844ad-6346-44b8-850e-645fea3b671c.vault.azure.net\"}}", + "Date" : "Fri, 28 May 2021 23:21:27 GMT", + "Content-Type" : "application/json; charset=utf-8" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://REDACTED.cognitiveservices.azure.com/metricsadvisor/v1.0/credentials/ab346b60-e5d1-4325-9e06-24d00779a1aa", + "Headers" : { + "User-Agent" : "azsdk-java-azure-ai-metricsadvisor/1.0.0-beta.4 (1.8.0_221; Mac OS X; 10.16)", + "x-ms-client-request-id" : "1ff0b0c7-c7c6-4e77-bcd6-2d861d2d0ec4" + }, + "Response" : { + "x-request-id" : "a0d959d1-f3cd-49ca-9d9c-129bb9b9eaa0", + "content-length" : "0", + "x-envoy-upstream-service-time" : "287", + "Strict-Transport-Security" : "max-age=31536000; includeSubDomains; preload", + "x-content-type-options" : "nosniff", + "apim-request-id" : "a0d959d1-f3cd-49ca-9d9c-129bb9b9eaa0", + "retry-after" : "0", + "StatusCode" : "204", + "Date" : "Fri, 28 May 2021 23:21:27 GMT" + }, + "Exception" : null + } ], + "variables" : [ ] +} \ No newline at end of file diff --git a/sdk/metricsadvisor/azure-ai-metricsadvisor/src/test/resources/session-records/DatasourceCredentialAsyncTest.createServicePrincipal[1].json b/sdk/metricsadvisor/azure-ai-metricsadvisor/src/test/resources/session-records/DatasourceCredentialAsyncTest.createServicePrincipal[1].json new file mode 100644 index 0000000000000..fe5ac8a32e62d --- /dev/null +++ b/sdk/metricsadvisor/azure-ai-metricsadvisor/src/test/resources/session-records/DatasourceCredentialAsyncTest.createServicePrincipal[1].json @@ -0,0 +1,65 @@ +{ + "networkCallRecords" : [ { + "Method" : "POST", + "Uri" : "https://REDACTED.cognitiveservices.azure.com/metricsadvisor/v1.0/credentials", + "Headers" : { + "User-Agent" : "azsdk-java-azure-ai-metricsadvisor/1.0.0-beta.4 (1.8.0_221; Mac OS X; 10.16)", + "x-ms-client-request-id" : "8f67574e-2c11-4582-9ebc-4938962a412b", + "Content-Type" : "application/json" + }, + "Response" : { + "x-request-id" : "34877a06-7c95-470f-b55d-a0e77744584d", + "content-length" : "0", + "x-envoy-upstream-service-time" : "609", + "Strict-Transport-Security" : "max-age=31536000; includeSubDomains; preload", + "x-content-type-options" : "nosniff", + "apim-request-id" : "34877a06-7c95-470f-b55d-a0e77744584d", + "retry-after" : "0", + "StatusCode" : "201", + "Date" : "Fri, 28 May 2021 23:21:27 GMT", + "Location" : "https://js-metrics-advisor.cognitiveservices.azure.com/metricsadvisor/v1.0/credentials/22f859a9-d4cb-4da7-a1a3-fa5525b5f087" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://REDACTED.cognitiveservices.azure.com/metricsadvisor/v1.0/credentials/22f859a9-d4cb-4da7-a1a3-fa5525b5f087", + "Headers" : { + "User-Agent" : "azsdk-java-azure-ai-metricsadvisor/1.0.0-beta.4 (1.8.0_221; Mac OS X; 10.16)", + "x-ms-client-request-id" : "183ca635-9874-40a7-86c6-845aba015bf3" + }, + "Response" : { + "x-request-id" : "965ba100-24fa-47f4-ba95-304d32a1b382", + "content-length" : "360", + "x-envoy-upstream-service-time" : "94", + "Strict-Transport-Security" : "max-age=31536000; includeSubDomains; preload", + "x-content-type-options" : "nosniff", + "apim-request-id" : "965ba100-24fa-47f4-ba95-304d32a1b382", + "retry-after" : "0", + "StatusCode" : "200", + "Body" : "{\"dataSourceCredentialId\":\"22f859a9-d4cb-4da7-a1a3-fa5525b5f087\",\"dataSourceCredentialName\":\"java_create_data_source_cred_sp4f5badfe-d146-452a-8ad2-eb3404990824\",\"dataSourceCredentialDescription\":\"\",\"dataSourceCredentialType\":\"ServicePrincipal\",\"parameters\":{\"clientId\":\"e70248b2-bffa-11eb-8529-0242ac130003\",\"tenantId\":\"45389ded-5e07-4e52-b225-4ae8f905afb5\"}}", + "Date" : "Fri, 28 May 2021 23:21:27 GMT", + "Content-Type" : "application/json; charset=utf-8" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://REDACTED.cognitiveservices.azure.com/metricsadvisor/v1.0/credentials/22f859a9-d4cb-4da7-a1a3-fa5525b5f087", + "Headers" : { + "User-Agent" : "azsdk-java-azure-ai-metricsadvisor/1.0.0-beta.4 (1.8.0_221; Mac OS X; 10.16)", + "x-ms-client-request-id" : "55870836-22bf-4910-bba3-1620fa5545f8" + }, + "Response" : { + "x-request-id" : "92f4dc62-5ed2-48f8-ab7e-bd26c1171ada", + "content-length" : "0", + "x-envoy-upstream-service-time" : "233", + "Strict-Transport-Security" : "max-age=31536000; includeSubDomains; preload", + "x-content-type-options" : "nosniff", + "apim-request-id" : "92f4dc62-5ed2-48f8-ab7e-bd26c1171ada", + "retry-after" : "0", + "StatusCode" : "204", + "Date" : "Fri, 28 May 2021 23:21:28 GMT" + }, + "Exception" : null + } ], + "variables" : [ ] +} \ No newline at end of file diff --git a/sdk/metricsadvisor/azure-ai-metricsadvisor/src/test/resources/session-records/DatasourceCredentialAsyncTest.createSqlConnectionString[1].json b/sdk/metricsadvisor/azure-ai-metricsadvisor/src/test/resources/session-records/DatasourceCredentialAsyncTest.createSqlConnectionString[1].json new file mode 100644 index 0000000000000..1dc11fa840cf0 --- /dev/null +++ b/sdk/metricsadvisor/azure-ai-metricsadvisor/src/test/resources/session-records/DatasourceCredentialAsyncTest.createSqlConnectionString[1].json @@ -0,0 +1,65 @@ +{ + "networkCallRecords" : [ { + "Method" : "POST", + "Uri" : "https://REDACTED.cognitiveservices.azure.com/metricsadvisor/v1.0/credentials", + "Headers" : { + "User-Agent" : "azsdk-java-azure-ai-metricsadvisor/1.0.0-beta.4 (1.8.0_221; Mac OS X; 10.16)", + "x-ms-client-request-id" : "979f81f2-e478-4d11-89fd-5dcc26aca14f", + "Content-Type" : "application/json" + }, + "Response" : { + "x-request-id" : "284444b2-ec82-424d-9192-b5808ffdf793", + "content-length" : "0", + "x-envoy-upstream-service-time" : "615", + "Strict-Transport-Security" : "max-age=31536000; includeSubDomains; preload", + "x-content-type-options" : "nosniff", + "apim-request-id" : "284444b2-ec82-424d-9192-b5808ffdf793", + "retry-after" : "0", + "StatusCode" : "201", + "Date" : "Fri, 28 May 2021 23:21:26 GMT", + "Location" : "https://js-metrics-advisor.cognitiveservices.azure.com/metricsadvisor/v1.0/credentials/94199c4b-6e3d-42b9-88c3-db5940a00ae1" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://REDACTED.cognitiveservices.azure.com/metricsadvisor/v1.0/credentials/94199c4b-6e3d-42b9-88c3-db5940a00ae1", + "Headers" : { + "User-Agent" : "azsdk-java-azure-ai-metricsadvisor/1.0.0-beta.4 (1.8.0_221; Mac OS X; 10.16)", + "x-ms-client-request-id" : "8a89b77c-e6c1-4b8a-8691-3f540c7e41c5" + }, + "Response" : { + "x-request-id" : "65a3355f-ed34-415c-aa8a-305edcf928e7", + "content-length" : "274", + "x-envoy-upstream-service-time" : "85", + "Strict-Transport-Security" : "max-age=31536000; includeSubDomains; preload", + "x-content-type-options" : "nosniff", + "apim-request-id" : "65a3355f-ed34-415c-aa8a-305edcf928e7", + "retry-after" : "0", + "StatusCode" : "200", + "Body" : "{\"dataSourceCredentialId\":\"94199c4b-6e3d-42b9-88c3-db5940a00ae1\",\"dataSourceCredentialName\":\"java_create_data_source_cred_sql_conf6fc9443-5e5f-4c3e-b6dd-0273d4656e7f\",\"dataSourceCredentialDescription\":\"\",\"dataSourceCredentialType\":\"AzureSQLConnectionString\",\"parameters\":{}}", + "Date" : "Fri, 28 May 2021 23:21:27 GMT", + "Content-Type" : "application/json; charset=utf-8" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://REDACTED.cognitiveservices.azure.com/metricsadvisor/v1.0/credentials/94199c4b-6e3d-42b9-88c3-db5940a00ae1", + "Headers" : { + "User-Agent" : "azsdk-java-azure-ai-metricsadvisor/1.0.0-beta.4 (1.8.0_221; Mac OS X; 10.16)", + "x-ms-client-request-id" : "b5c53dd6-2dd5-4feb-99ef-84d29cd81442" + }, + "Response" : { + "x-request-id" : "a6c3bc02-4af2-40cc-971c-5e8802c6a84a", + "content-length" : "0", + "x-envoy-upstream-service-time" : "220", + "Strict-Transport-Security" : "max-age=31536000; includeSubDomains; preload", + "x-content-type-options" : "nosniff", + "apim-request-id" : "a6c3bc02-4af2-40cc-971c-5e8802c6a84a", + "retry-after" : "0", + "StatusCode" : "204", + "Date" : "Fri, 28 May 2021 23:21:28 GMT" + }, + "Exception" : null + } ], + "variables" : [ ] +} \ No newline at end of file diff --git a/sdk/metricsadvisor/azure-ai-metricsadvisor/src/test/resources/session-records/DatasourceCredentialAsyncTest.testListDataSourceCredentials[1].json b/sdk/metricsadvisor/azure-ai-metricsadvisor/src/test/resources/session-records/DatasourceCredentialAsyncTest.testListDataSourceCredentials[1].json new file mode 100644 index 0000000000000..727608b93caba --- /dev/null +++ b/sdk/metricsadvisor/azure-ai-metricsadvisor/src/test/resources/session-records/DatasourceCredentialAsyncTest.testListDataSourceCredentials[1].json @@ -0,0 +1,147 @@ +{ + "networkCallRecords" : [ { + "Method" : "POST", + "Uri" : "https://REDACTED.cognitiveservices.azure.com/metricsadvisor/v1.0/credentials", + "Headers" : { + "User-Agent" : "azsdk-java-azure-ai-metricsadvisor/1.0.0-beta.4 (1.8.0_221; Mac OS X; 10.16)", + "x-ms-client-request-id" : "29cc73d5-363f-4bb5-85d3-44ef43eb8fdf", + "Content-Type" : "application/json" + }, + "Response" : { + "x-request-id" : "659c4338-901f-4efa-881e-77da75cd6ba2", + "content-length" : "0", + "x-envoy-upstream-service-time" : "703", + "Strict-Transport-Security" : "max-age=31536000; includeSubDomains; preload", + "x-content-type-options" : "nosniff", + "apim-request-id" : "659c4338-901f-4efa-881e-77da75cd6ba2", + "retry-after" : "0", + "StatusCode" : "201", + "Date" : "Fri, 28 May 2021 23:21:27 GMT", + "Location" : "https://js-metrics-advisor.cognitiveservices.azure.com/metricsadvisor/v1.0/credentials/0f42af0f-9097-4521-a34c-c48e0d36b160" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://REDACTED.cognitiveservices.azure.com/metricsadvisor/v1.0/credentials/0f42af0f-9097-4521-a34c-c48e0d36b160", + "Headers" : { + "User-Agent" : "azsdk-java-azure-ai-metricsadvisor/1.0.0-beta.4 (1.8.0_221; Mac OS X; 10.16)", + "x-ms-client-request-id" : "fc60527a-43d6-482c-a58e-fc2f0163e76d" + }, + "Response" : { + "x-request-id" : "48a7902a-f9d2-4b0d-9faf-9ce0b90fddd4", + "content-length" : "274", + "x-envoy-upstream-service-time" : "92", + "Strict-Transport-Security" : "max-age=31536000; includeSubDomains; preload", + "x-content-type-options" : "nosniff", + "apim-request-id" : "48a7902a-f9d2-4b0d-9faf-9ce0b90fddd4", + "retry-after" : "0", + "StatusCode" : "200", + "Body" : "{\"dataSourceCredentialId\":\"0f42af0f-9097-4521-a34c-c48e0d36b160\",\"dataSourceCredentialName\":\"java_create_data_source_cred_sql_concd37bfa3-b36f-4edc-b236-d0a6379dc798\",\"dataSourceCredentialDescription\":\"\",\"dataSourceCredentialType\":\"AzureSQLConnectionString\",\"parameters\":{}}", + "Date" : "Fri, 28 May 2021 23:21:27 GMT", + "Content-Type" : "application/json; charset=utf-8" + }, + "Exception" : null + }, { + "Method" : "POST", + "Uri" : "https://REDACTED.cognitiveservices.azure.com/metricsadvisor/v1.0/credentials", + "Headers" : { + "User-Agent" : "azsdk-java-azure-ai-metricsadvisor/1.0.0-beta.4 (1.8.0_221; Mac OS X; 10.16)", + "x-ms-client-request-id" : "f8da5b4a-21e4-4c35-88ff-ec98fd9f0dd0", + "Content-Type" : "application/json" + }, + "Response" : { + "x-request-id" : "178114e8-9c23-42c1-a27a-2e3588e62b07", + "content-length" : "0", + "x-envoy-upstream-service-time" : "425", + "Strict-Transport-Security" : "max-age=31536000; includeSubDomains; preload", + "x-content-type-options" : "nosniff", + "apim-request-id" : "178114e8-9c23-42c1-a27a-2e3588e62b07", + "retry-after" : "0", + "StatusCode" : "201", + "Date" : "Fri, 28 May 2021 23:21:28 GMT", + "Location" : "https://js-metrics-advisor.cognitiveservices.azure.com/metricsadvisor/v1.0/credentials/3622237d-0a48-4b98-84a0-88f72f5dc9d0" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://REDACTED.cognitiveservices.azure.com/metricsadvisor/v1.0/credentials/3622237d-0a48-4b98-84a0-88f72f5dc9d0", + "Headers" : { + "User-Agent" : "azsdk-java-azure-ai-metricsadvisor/1.0.0-beta.4 (1.8.0_221; Mac OS X; 10.16)", + "x-ms-client-request-id" : "713ecc30-7218-466e-8ed7-3ce7b1d2ee14" + }, + "Response" : { + "x-request-id" : "a92ba042-8c5a-4ea2-b756-444c5e3990f8", + "content-length" : "273", + "x-envoy-upstream-service-time" : "77", + "Strict-Transport-Security" : "max-age=31536000; includeSubDomains; preload", + "x-content-type-options" : "nosniff", + "apim-request-id" : "a92ba042-8c5a-4ea2-b756-444c5e3990f8", + "retry-after" : "0", + "StatusCode" : "200", + "Body" : "{\"dataSourceCredentialId\":\"3622237d-0a48-4b98-84a0-88f72f5dc9d0\",\"dataSourceCredentialName\":\"java_create_data_source_cred_dlake_gen22c8ee50-bbcd-4d1f-ae74-092a868558bc\",\"dataSourceCredentialDescription\":\"\",\"dataSourceCredentialType\":\"DataLakeGen2SharedKey\",\"parameters\":{}}", + "Date" : "Fri, 28 May 2021 23:21:27 GMT", + "Content-Type" : "application/json; charset=utf-8" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://REDACTED.cognitiveservices.azure.com/metricsadvisor/v1.0/credentials", + "Headers" : { + "User-Agent" : "azsdk-java-azure-ai-metricsadvisor/1.0.0-beta.4 (1.8.0_221; Mac OS X; 10.16)", + "x-ms-client-request-id" : "d92087cc-c800-4294-982e-45e5b9f1da90" + }, + "Response" : { + "x-request-id" : "2bb5e18f-609d-4911-a19d-72a90d4390ba", + "content-length" : "577", + "x-envoy-upstream-service-time" : "115", + "Strict-Transport-Security" : "max-age=31536000; includeSubDomains; preload", + "x-content-type-options" : "nosniff", + "apim-request-id" : "2bb5e18f-609d-4911-a19d-72a90d4390ba", + "retry-after" : "0", + "StatusCode" : "200", + "Body" : "{\"value\":[{\"dataSourceCredentialId\":\"3622237d-0a48-4b98-84a0-88f72f5dc9d0\",\"dataSourceCredentialName\":\"java_create_data_source_cred_dlake_gen22c8ee50-bbcd-4d1f-ae74-092a868558bc\",\"dataSourceCredentialDescription\":\"\",\"dataSourceCredentialType\":\"DataLakeGen2SharedKey\",\"parameters\":{}},{\"dataSourceCredentialId\":\"0f42af0f-9097-4521-a34c-c48e0d36b160\",\"dataSourceCredentialName\":\"java_create_data_source_cred_sql_concd37bfa3-b36f-4edc-b236-d0a6379dc798\",\"dataSourceCredentialDescription\":\"\",\"dataSourceCredentialType\":\"AzureSQLConnectionString\",\"parameters\":{}}],\"@nextLink\":null}", + "Date" : "Fri, 28 May 2021 23:21:28 GMT", + "Content-Type" : "application/json; charset=utf-8" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://REDACTED.cognitiveservices.azure.com/metricsadvisor/v1.0/credentials/0f42af0f-9097-4521-a34c-c48e0d36b160", + "Headers" : { + "User-Agent" : "azsdk-java-azure-ai-metricsadvisor/1.0.0-beta.4 (1.8.0_221; Mac OS X; 10.16)", + "x-ms-client-request-id" : "069be3f7-b347-44de-8ad7-cb80c452b080" + }, + "Response" : { + "x-request-id" : "d0fc2bcc-abf0-421a-abfd-ce5ce82e8d13", + "content-length" : "0", + "x-envoy-upstream-service-time" : "5224", + "Strict-Transport-Security" : "max-age=31536000; includeSubDomains; preload", + "x-content-type-options" : "nosniff", + "apim-request-id" : "d0fc2bcc-abf0-421a-abfd-ce5ce82e8d13", + "retry-after" : "0", + "StatusCode" : "204", + "Date" : "Fri, 28 May 2021 23:21:33 GMT" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://REDACTED.cognitiveservices.azure.com/metricsadvisor/v1.0/credentials/3622237d-0a48-4b98-84a0-88f72f5dc9d0", + "Headers" : { + "User-Agent" : "azsdk-java-azure-ai-metricsadvisor/1.0.0-beta.4 (1.8.0_221; Mac OS X; 10.16)", + "x-ms-client-request-id" : "a79c3ef8-4307-4aa6-adc8-bccc9ee2245a" + }, + "Response" : { + "x-request-id" : "e1b9441d-3956-485f-ae2f-5f32e6622e05", + "content-length" : "0", + "x-envoy-upstream-service-time" : "212", + "Strict-Transport-Security" : "max-age=31536000; includeSubDomains; preload", + "x-content-type-options" : "nosniff", + "apim-request-id" : "e1b9441d-3956-485f-ae2f-5f32e6622e05", + "retry-after" : "0", + "StatusCode" : "204", + "Date" : "Fri, 28 May 2021 23:21:34 GMT" + }, + "Exception" : null + } ], + "variables" : [ ] +} \ No newline at end of file diff --git a/sdk/metricsadvisor/azure-ai-metricsadvisor/src/test/resources/session-records/DatasourceCredentialTest.createDataLakeGen2SharedKey[1].json b/sdk/metricsadvisor/azure-ai-metricsadvisor/src/test/resources/session-records/DatasourceCredentialTest.createDataLakeGen2SharedKey[1].json new file mode 100644 index 0000000000000..0a4ab963e4b73 --- /dev/null +++ b/sdk/metricsadvisor/azure-ai-metricsadvisor/src/test/resources/session-records/DatasourceCredentialTest.createDataLakeGen2SharedKey[1].json @@ -0,0 +1,65 @@ +{ + "networkCallRecords" : [ { + "Method" : "POST", + "Uri" : "https://REDACTED.cognitiveservices.azure.com/metricsadvisor/v1.0/credentials", + "Headers" : { + "User-Agent" : "azsdk-java-azure-ai-metricsadvisor/1.0.0-beta.4 (1.8.0_221; Mac OS X; 10.16)", + "x-ms-client-request-id" : "6e7e549e-cd2f-40de-be8d-ecfa4337726e", + "Content-Type" : "application/json" + }, + "Response" : { + "x-request-id" : "e8570861-877f-4ef2-8aaa-6d54f4a80296", + "content-length" : "0", + "x-envoy-upstream-service-time" : "1729", + "Strict-Transport-Security" : "max-age=31536000; includeSubDomains; preload", + "x-content-type-options" : "nosniff", + "apim-request-id" : "e8570861-877f-4ef2-8aaa-6d54f4a80296", + "retry-after" : "0", + "StatusCode" : "201", + "Date" : "Sun, 30 May 2021 20:54:03 GMT", + "Location" : "https://js-metrics-advisor.cognitiveservices.azure.com/metricsadvisor/v1.0/credentials/5d0183f6-83dc-4b92-8ac6-f1233cb41de4" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://REDACTED.cognitiveservices.azure.com/metricsadvisor/v1.0/credentials/5d0183f6-83dc-4b92-8ac6-f1233cb41de4", + "Headers" : { + "User-Agent" : "azsdk-java-azure-ai-metricsadvisor/1.0.0-beta.4 (1.8.0_221; Mac OS X; 10.16)", + "x-ms-client-request-id" : "c6e71453-ec55-498e-a50a-678d86e13113" + }, + "Response" : { + "x-request-id" : "060fecb8-0a3a-4fdd-85a6-1f4a8fd4be6d", + "content-length" : "273", + "x-envoy-upstream-service-time" : "5099", + "Strict-Transport-Security" : "max-age=31536000; includeSubDomains; preload", + "x-content-type-options" : "nosniff", + "apim-request-id" : "060fecb8-0a3a-4fdd-85a6-1f4a8fd4be6d", + "retry-after" : "0", + "StatusCode" : "200", + "Body" : "{\"dataSourceCredentialId\":\"5d0183f6-83dc-4b92-8ac6-f1233cb41de4\",\"dataSourceCredentialName\":\"java_create_data_source_cred_dlake_gen39c3071d-eb62-4308-ad4a-5d8ea0fdb956\",\"dataSourceCredentialDescription\":\"\",\"dataSourceCredentialType\":\"DataLakeGen2SharedKey\",\"parameters\":{}}", + "Date" : "Sun, 30 May 2021 20:54:08 GMT", + "Content-Type" : "application/json; charset=utf-8" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://REDACTED.cognitiveservices.azure.com/metricsadvisor/v1.0/dataFeeds/5d0183f6-83dc-4b92-8ac6-f1233cb41de4", + "Headers" : { + "User-Agent" : "azsdk-java-azure-ai-metricsadvisor/1.0.0-beta.4 (1.8.0_221; Mac OS X; 10.16)", + "x-ms-client-request-id" : "48705b38-58f9-4201-835c-a9dff302e28b" + }, + "Response" : { + "x-request-id" : "bda1e65e-276e-4820-9089-5c2c2682925d", + "content-length" : "0", + "x-envoy-upstream-service-time" : "102", + "Strict-Transport-Security" : "max-age=31536000; includeSubDomains; preload", + "x-content-type-options" : "nosniff", + "apim-request-id" : "bda1e65e-276e-4820-9089-5c2c2682925d", + "retry-after" : "0", + "StatusCode" : "204", + "Date" : "Sun, 30 May 2021 20:54:09 GMT" + }, + "Exception" : null + } ], + "variables" : [ ] +} \ No newline at end of file diff --git a/sdk/metricsadvisor/azure-ai-metricsadvisor/src/test/resources/session-records/DatasourceCredentialTest.createServicePrincipal[1].json b/sdk/metricsadvisor/azure-ai-metricsadvisor/src/test/resources/session-records/DatasourceCredentialTest.createServicePrincipal[1].json new file mode 100644 index 0000000000000..2de6b2e04352d --- /dev/null +++ b/sdk/metricsadvisor/azure-ai-metricsadvisor/src/test/resources/session-records/DatasourceCredentialTest.createServicePrincipal[1].json @@ -0,0 +1,65 @@ +{ + "networkCallRecords" : [ { + "Method" : "POST", + "Uri" : "https://REDACTED.cognitiveservices.azure.com/metricsadvisor/v1.0/credentials", + "Headers" : { + "User-Agent" : "azsdk-java-azure-ai-metricsadvisor/1.0.0-beta.4 (1.8.0_221; Mac OS X; 10.16)", + "x-ms-client-request-id" : "6a36cc72-387c-4426-8c1a-9806c9609d16", + "Content-Type" : "application/json" + }, + "Response" : { + "x-request-id" : "73e3782e-602c-4dd6-968b-0113be809412", + "content-length" : "0", + "x-envoy-upstream-service-time" : "937", + "Strict-Transport-Security" : "max-age=31536000; includeSubDomains; preload", + "x-content-type-options" : "nosniff", + "apim-request-id" : "73e3782e-602c-4dd6-968b-0113be809412", + "retry-after" : "0", + "StatusCode" : "201", + "Date" : "Sun, 30 May 2021 20:54:03 GMT", + "Location" : "https://js-metrics-advisor.cognitiveservices.azure.com/metricsadvisor/v1.0/credentials/5990ec59-17ed-4074-bb3d-27dec31cdedf" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://REDACTED.cognitiveservices.azure.com/metricsadvisor/v1.0/credentials/5990ec59-17ed-4074-bb3d-27dec31cdedf", + "Headers" : { + "User-Agent" : "azsdk-java-azure-ai-metricsadvisor/1.0.0-beta.4 (1.8.0_221; Mac OS X; 10.16)", + "x-ms-client-request-id" : "12a6e9e1-fc3d-4c02-bb2d-ae2f2c26a2d0" + }, + "Response" : { + "x-request-id" : "22e902d0-7584-489a-9843-43db17909549", + "content-length" : "360", + "x-envoy-upstream-service-time" : "121", + "Strict-Transport-Security" : "max-age=31536000; includeSubDomains; preload", + "x-content-type-options" : "nosniff", + "apim-request-id" : "22e902d0-7584-489a-9843-43db17909549", + "retry-after" : "0", + "StatusCode" : "200", + "Body" : "{\"dataSourceCredentialId\":\"5990ec59-17ed-4074-bb3d-27dec31cdedf\",\"dataSourceCredentialName\":\"java_create_data_source_cred_sp2ee27523-fd2b-4926-8b60-00e7be4409dd\",\"dataSourceCredentialDescription\":\"\",\"dataSourceCredentialType\":\"ServicePrincipal\",\"parameters\":{\"clientId\":\"e70248b2-bffa-11eb-8529-0242ac130003\",\"tenantId\":\"45389ded-5e07-4e52-b225-4ae8f905afb5\"}}", + "Date" : "Sun, 30 May 2021 20:54:03 GMT", + "Content-Type" : "application/json; charset=utf-8" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://REDACTED.cognitiveservices.azure.com/metricsadvisor/v1.0/dataFeeds/5990ec59-17ed-4074-bb3d-27dec31cdedf", + "Headers" : { + "User-Agent" : "azsdk-java-azure-ai-metricsadvisor/1.0.0-beta.4 (1.8.0_221; Mac OS X; 10.16)", + "x-ms-client-request-id" : "f1a060ef-0149-4444-be99-85397c5e6e68" + }, + "Response" : { + "x-request-id" : "0e3454ed-18e1-40b2-9dc9-a8ff591cdc5d", + "content-length" : "0", + "x-envoy-upstream-service-time" : "6472", + "Strict-Transport-Security" : "max-age=31536000; includeSubDomains; preload", + "x-content-type-options" : "nosniff", + "apim-request-id" : "0e3454ed-18e1-40b2-9dc9-a8ff591cdc5d", + "retry-after" : "0", + "StatusCode" : "204", + "Date" : "Sun, 30 May 2021 20:54:10 GMT" + }, + "Exception" : null + } ], + "variables" : [ ] +} \ No newline at end of file diff --git a/sdk/metricsadvisor/azure-ai-metricsadvisor/src/test/resources/session-records/DatasourceCredentialTest.createSqlConnectionString[1].json b/sdk/metricsadvisor/azure-ai-metricsadvisor/src/test/resources/session-records/DatasourceCredentialTest.createSqlConnectionString[1].json new file mode 100644 index 0000000000000..2d6f9e87f8884 --- /dev/null +++ b/sdk/metricsadvisor/azure-ai-metricsadvisor/src/test/resources/session-records/DatasourceCredentialTest.createSqlConnectionString[1].json @@ -0,0 +1,65 @@ +{ + "networkCallRecords" : [ { + "Method" : "POST", + "Uri" : "https://REDACTED.cognitiveservices.azure.com/metricsadvisor/v1.0/credentials", + "Headers" : { + "User-Agent" : "azsdk-java-azure-ai-metricsadvisor/1.0.0-beta.4 (1.8.0_221; Mac OS X; 10.16)", + "x-ms-client-request-id" : "63c2b691-9ba4-4df3-9910-c1fc9ba1ae53", + "Content-Type" : "application/json" + }, + "Response" : { + "x-request-id" : "d722bb87-4d54-4c77-80fa-376c2ba53297", + "content-length" : "0", + "x-envoy-upstream-service-time" : "869", + "Strict-Transport-Security" : "max-age=31536000; includeSubDomains; preload", + "x-content-type-options" : "nosniff", + "apim-request-id" : "d722bb87-4d54-4c77-80fa-376c2ba53297", + "retry-after" : "0", + "StatusCode" : "201", + "Date" : "Sun, 30 May 2021 20:54:02 GMT", + "Location" : "https://js-metrics-advisor.cognitiveservices.azure.com/metricsadvisor/v1.0/credentials/ec082162-976a-4a5e-b551-1c06c9cc00f2" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://REDACTED.cognitiveservices.azure.com/metricsadvisor/v1.0/credentials/ec082162-976a-4a5e-b551-1c06c9cc00f2", + "Headers" : { + "User-Agent" : "azsdk-java-azure-ai-metricsadvisor/1.0.0-beta.4 (1.8.0_221; Mac OS X; 10.16)", + "x-ms-client-request-id" : "3b2786da-3284-48f6-ae0e-967ec9d81a1e" + }, + "Response" : { + "x-request-id" : "189630ce-20e9-4ab8-98d0-cfbdba2a511e", + "content-length" : "274", + "x-envoy-upstream-service-time" : "5204", + "Strict-Transport-Security" : "max-age=31536000; includeSubDomains; preload", + "x-content-type-options" : "nosniff", + "apim-request-id" : "189630ce-20e9-4ab8-98d0-cfbdba2a511e", + "retry-after" : "0", + "StatusCode" : "200", + "Body" : "{\"dataSourceCredentialId\":\"ec082162-976a-4a5e-b551-1c06c9cc00f2\",\"dataSourceCredentialName\":\"java_create_data_source_cred_sql_con035a726d-e30e-4605-8a6d-c7ca5171ff5e\",\"dataSourceCredentialDescription\":\"\",\"dataSourceCredentialType\":\"AzureSQLConnectionString\",\"parameters\":{}}", + "Date" : "Sun, 30 May 2021 20:54:08 GMT", + "Content-Type" : "application/json; charset=utf-8" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://REDACTED.cognitiveservices.azure.com/metricsadvisor/v1.0/dataFeeds/ec082162-976a-4a5e-b551-1c06c9cc00f2", + "Headers" : { + "User-Agent" : "azsdk-java-azure-ai-metricsadvisor/1.0.0-beta.4 (1.8.0_221; Mac OS X; 10.16)", + "x-ms-client-request-id" : "7e9ba395-1e3e-4b0e-9b84-5c3010e7a867" + }, + "Response" : { + "x-request-id" : "9855ee79-b023-47d4-b5de-98053da35f8d", + "content-length" : "0", + "x-envoy-upstream-service-time" : "134", + "Strict-Transport-Security" : "max-age=31536000; includeSubDomains; preload", + "x-content-type-options" : "nosniff", + "apim-request-id" : "9855ee79-b023-47d4-b5de-98053da35f8d", + "retry-after" : "0", + "StatusCode" : "204", + "Date" : "Sun, 30 May 2021 20:54:08 GMT" + }, + "Exception" : null + } ], + "variables" : [ ] +} \ No newline at end of file diff --git a/sdk/metricsadvisor/azure-ai-metricsadvisor/src/test/resources/session-records/DatasourceCredentialTest.testListDataSourceCredentials[1].json b/sdk/metricsadvisor/azure-ai-metricsadvisor/src/test/resources/session-records/DatasourceCredentialTest.testListDataSourceCredentials[1].json new file mode 100644 index 0000000000000..3f40cdabd9af7 --- /dev/null +++ b/sdk/metricsadvisor/azure-ai-metricsadvisor/src/test/resources/session-records/DatasourceCredentialTest.testListDataSourceCredentials[1].json @@ -0,0 +1,147 @@ +{ + "networkCallRecords" : [ { + "Method" : "POST", + "Uri" : "https://REDACTED.cognitiveservices.azure.com/metricsadvisor/v1.0/credentials", + "Headers" : { + "User-Agent" : "azsdk-java-azure-ai-metricsadvisor/1.0.0-beta.4 (1.8.0_221; Mac OS X; 10.16)", + "x-ms-client-request-id" : "08bc45ed-94e1-47dd-93e1-119ff8d49248", + "Content-Type" : "application/json" + }, + "Response" : { + "x-request-id" : "3b3decd2-703a-4e41-bc81-2b8f0dd12d86", + "content-length" : "0", + "x-envoy-upstream-service-time" : "5614", + "Strict-Transport-Security" : "max-age=31536000; includeSubDomains; preload", + "x-content-type-options" : "nosniff", + "apim-request-id" : "3b3decd2-703a-4e41-bc81-2b8f0dd12d86", + "retry-after" : "0", + "StatusCode" : "201", + "Date" : "Sun, 30 May 2021 20:54:07 GMT", + "Location" : "https://js-metrics-advisor.cognitiveservices.azure.com/metricsadvisor/v1.0/credentials/9cb17d61-1df3-487c-bc27-9873d91a075c" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://REDACTED.cognitiveservices.azure.com/metricsadvisor/v1.0/credentials/9cb17d61-1df3-487c-bc27-9873d91a075c", + "Headers" : { + "User-Agent" : "azsdk-java-azure-ai-metricsadvisor/1.0.0-beta.4 (1.8.0_221; Mac OS X; 10.16)", + "x-ms-client-request-id" : "00c60870-a127-4072-867f-5589e12929c2" + }, + "Response" : { + "x-request-id" : "abeb14f7-6ca2-408b-828a-db7c920b9360", + "content-length" : "274", + "x-envoy-upstream-service-time" : "1602", + "Strict-Transport-Security" : "max-age=31536000; includeSubDomains; preload", + "x-content-type-options" : "nosniff", + "apim-request-id" : "abeb14f7-6ca2-408b-828a-db7c920b9360", + "retry-after" : "0", + "StatusCode" : "200", + "Body" : "{\"dataSourceCredentialId\":\"9cb17d61-1df3-487c-bc27-9873d91a075c\",\"dataSourceCredentialName\":\"java_create_data_source_cred_sql_conc5002d76-5960-41e4-88ab-042018e21e1b\",\"dataSourceCredentialDescription\":\"\",\"dataSourceCredentialType\":\"AzureSQLConnectionString\",\"parameters\":{}}", + "Date" : "Sun, 30 May 2021 20:54:09 GMT", + "Content-Type" : "application/json; charset=utf-8" + }, + "Exception" : null + }, { + "Method" : "POST", + "Uri" : "https://REDACTED.cognitiveservices.azure.com/metricsadvisor/v1.0/credentials", + "Headers" : { + "User-Agent" : "azsdk-java-azure-ai-metricsadvisor/1.0.0-beta.4 (1.8.0_221; Mac OS X; 10.16)", + "x-ms-client-request-id" : "38cfcbd8-8287-4b76-8444-1e531ab7d728", + "Content-Type" : "application/json" + }, + "Response" : { + "x-request-id" : "1daefb05-16dc-421c-b455-ab202798b0be", + "content-length" : "0", + "x-envoy-upstream-service-time" : "5821", + "Strict-Transport-Security" : "max-age=31536000; includeSubDomains; preload", + "x-content-type-options" : "nosniff", + "apim-request-id" : "1daefb05-16dc-421c-b455-ab202798b0be", + "retry-after" : "0", + "StatusCode" : "201", + "Date" : "Sun, 30 May 2021 20:54:15 GMT", + "Location" : "https://js-metrics-advisor.cognitiveservices.azure.com/metricsadvisor/v1.0/credentials/d945027f-a656-4dae-b4aa-ab158ebe2b0b" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://REDACTED.cognitiveservices.azure.com/metricsadvisor/v1.0/credentials/d945027f-a656-4dae-b4aa-ab158ebe2b0b", + "Headers" : { + "User-Agent" : "azsdk-java-azure-ai-metricsadvisor/1.0.0-beta.4 (1.8.0_221; Mac OS X; 10.16)", + "x-ms-client-request-id" : "fe7818da-09c0-45f2-922d-62dada2e5995" + }, + "Response" : { + "x-request-id" : "ca979713-56df-4763-9b5c-5f8a71247835", + "content-length" : "273", + "x-envoy-upstream-service-time" : "83", + "Strict-Transport-Security" : "max-age=31536000; includeSubDomains; preload", + "x-content-type-options" : "nosniff", + "apim-request-id" : "ca979713-56df-4763-9b5c-5f8a71247835", + "retry-after" : "0", + "StatusCode" : "200", + "Body" : "{\"dataSourceCredentialId\":\"d945027f-a656-4dae-b4aa-ab158ebe2b0b\",\"dataSourceCredentialName\":\"java_create_data_source_cred_dlake_gen07680095-1cbd-451d-a71a-8fa1d39ac498\",\"dataSourceCredentialDescription\":\"\",\"dataSourceCredentialType\":\"DataLakeGen2SharedKey\",\"parameters\":{}}", + "Date" : "Sun, 30 May 2021 20:54:15 GMT", + "Content-Type" : "application/json; charset=utf-8" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://REDACTED.cognitiveservices.azure.com/metricsadvisor/v1.0/credentials", + "Headers" : { + "User-Agent" : "azsdk-java-azure-ai-metricsadvisor/1.0.0-beta.4 (1.8.0_221; Mac OS X; 10.16)", + "x-ms-client-request-id" : "1f9e4a51-23d2-48f9-9d94-5001a7d5d161" + }, + "Response" : { + "x-request-id" : "88440ea7-0314-47cf-8aca-8ba7f26f3ed2", + "content-length" : "1762", + "x-envoy-upstream-service-time" : "151", + "Strict-Transport-Security" : "max-age=31536000; includeSubDomains; preload", + "x-content-type-options" : "nosniff", + "apim-request-id" : "88440ea7-0314-47cf-8aca-8ba7f26f3ed2", + "retry-after" : "0", + "StatusCode" : "200", + "Body" : "{\"value\":[{\"dataSourceCredentialId\":\"d945027f-a656-4dae-b4aa-ab158ebe2b0b\",\"dataSourceCredentialName\":\"java_create_data_source_cred_dlake_gen07680095-1cbd-451d-a71a-8fa1d39ac498\",\"dataSourceCredentialDescription\":\"\",\"dataSourceCredentialType\":\"DataLakeGen2SharedKey\",\"parameters\":{}},{\"dataSourceCredentialId\":\"9cb17d61-1df3-487c-bc27-9873d91a075c\",\"dataSourceCredentialName\":\"java_create_data_source_cred_sql_conc5002d76-5960-41e4-88ab-042018e21e1b\",\"dataSourceCredentialDescription\":\"\",\"dataSourceCredentialType\":\"AzureSQLConnectionString\",\"parameters\":{}},{\"dataSourceCredentialId\":\"5d0183f6-83dc-4b92-8ac6-f1233cb41de4\",\"dataSourceCredentialName\":\"java_create_data_source_cred_dlake_gen39c3071d-eb62-4308-ad4a-5d8ea0fdb956\",\"dataSourceCredentialDescription\":\"\",\"dataSourceCredentialType\":\"DataLakeGen2SharedKey\",\"parameters\":{}},{\"dataSourceCredentialId\":\"5990ec59-17ed-4074-bb3d-27dec31cdedf\",\"dataSourceCredentialName\":\"java_create_data_source_cred_sp2ee27523-fd2b-4926-8b60-00e7be4409dd\",\"dataSourceCredentialDescription\":\"\",\"dataSourceCredentialType\":\"ServicePrincipal\",\"parameters\":{\"clientId\":\"e70248b2-bffa-11eb-8529-0242ac130003\",\"tenantId\":\"45389ded-5e07-4e52-b225-4ae8f905afb5\"}},{\"dataSourceCredentialId\":\"ec082162-976a-4a5e-b551-1c06c9cc00f2\",\"dataSourceCredentialName\":\"java_create_data_source_cred_sql_con035a726d-e30e-4605-8a6d-c7ca5171ff5e\",\"dataSourceCredentialDescription\":\"\",\"dataSourceCredentialType\":\"AzureSQLConnectionString\",\"parameters\":{}},{\"dataSourceCredentialId\":\"4b6d4711-2987-4eb3-ac29-979e6153c44a\",\"dataSourceCredentialName\":\"java_create_data_source_cred_sql_con9269bbe9-cc7a-4b74-9cd1-cbd79ef6ff56\",\"dataSourceCredentialDescription\":\"\",\"dataSourceCredentialType\":\"AzureSQLConnectionString\",\"parameters\":{}}],\"@nextLink\":null}", + "Date" : "Sun, 30 May 2021 20:54:15 GMT", + "Content-Type" : "application/json; charset=utf-8" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://REDACTED.cognitiveservices.azure.com/metricsadvisor/v1.0/dataFeeds/9cb17d61-1df3-487c-bc27-9873d91a075c", + "Headers" : { + "User-Agent" : "azsdk-java-azure-ai-metricsadvisor/1.0.0-beta.4 (1.8.0_221; Mac OS X; 10.16)", + "x-ms-client-request-id" : "67368a54-b230-4b02-a28b-9d437b37af90" + }, + "Response" : { + "x-request-id" : "5ff2f1da-2557-4d34-a222-091862beffe2", + "content-length" : "0", + "x-envoy-upstream-service-time" : "6440", + "Strict-Transport-Security" : "max-age=31536000; includeSubDomains; preload", + "x-content-type-options" : "nosniff", + "apim-request-id" : "5ff2f1da-2557-4d34-a222-091862beffe2", + "retry-after" : "0", + "StatusCode" : "204", + "Date" : "Sun, 30 May 2021 20:54:22 GMT" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://REDACTED.cognitiveservices.azure.com/metricsadvisor/v1.0/dataFeeds/d945027f-a656-4dae-b4aa-ab158ebe2b0b", + "Headers" : { + "User-Agent" : "azsdk-java-azure-ai-metricsadvisor/1.0.0-beta.4 (1.8.0_221; Mac OS X; 10.16)", + "x-ms-client-request-id" : "1c58d893-d9ee-4ce7-859a-b66749dabc3b" + }, + "Response" : { + "x-request-id" : "09864fa6-324c-4e7d-8018-4c576051c9c0", + "content-length" : "0", + "x-envoy-upstream-service-time" : "78", + "Strict-Transport-Security" : "max-age=31536000; includeSubDomains; preload", + "x-content-type-options" : "nosniff", + "apim-request-id" : "09864fa6-324c-4e7d-8018-4c576051c9c0", + "retry-after" : "0", + "StatusCode" : "204", + "Date" : "Sun, 30 May 2021 20:54:22 GMT" + }, + "Exception" : null + } ], + "variables" : [ ] +} \ No newline at end of file diff --git a/sdk/metricsadvisor/azure-ai-metricsadvisor/swagger/README.md b/sdk/metricsadvisor/azure-ai-metricsadvisor/swagger/README.md index f59e1ae939050..a8129c354408e 100644 --- a/sdk/metricsadvisor/azure-ai-metricsadvisor/swagger/README.md +++ b/sdk/metricsadvisor/azure-ai-metricsadvisor/swagger/README.md @@ -32,11 +32,19 @@ add-context-parameter: true models-subpackage: implementation.models context-client-method-parameter: true custom-types-subpackage: models -custom-types: AnomalyDetectorDirection,AnomalyStatus,AnomalyValue,ChangePointValue,ChangeThresholdCondition,DataFeedIngestionProgress,DataFeedDimension,EnrichmentStatus,FeedbackType,HardThresholdCondition,AnomalyIncidentStatus,IngestionStatusType,DataFeedMetric,PeriodType,AnomalySeverity,SeverityCondition,SmartDetectionCondition,SnoozeScope,SuppressCondition,AlertQueryTimeMode,TopNGroupScope,DataFeedIngestionStatus,MetricAnomalyAlertSnoozeCondition,MetricSeriesDefinition,FeedbackQueryTimeMode,AnomalyAlert,DataFeedGranularityType,DataFeedRollupType,DataFeedAutoRollUpMethod,DataFeedStatus,ErrorCodeException,ErrorCode +custom-types: AnomalyDetectorDirection,AnomalyStatus,AnomalyValue,ChangePointValue,ChangeThresholdCondition,DataFeedIngestionProgress,DataFeedDimension,EnrichmentStatus,FeedbackType,HardThresholdCondition,AnomalyIncidentStatus,IngestionStatusType,DataFeedMetric,PeriodType,AnomalySeverity,SeverityCondition,SmartDetectionCondition,SnoozeScope,SuppressCondition,AlertQueryTimeMode,TopNGroupScope,DataFeedIngestionStatus,MetricAnomalyAlertSnoozeCondition,MetricSeriesDefinition,FeedbackQueryTimeMode,AnomalyAlert,DataFeedGranularityType,DataFeedRollupType,DataFeedAutoRollUpMethod,DataFeedStatus,MetricsAdvisorErrorCodeException,MetricsAdvisorErrorCode ``` ### Generated types renamed and moved to model +#### ErrorCode -> MetricsAdvisorErrorCode +```yaml +directive: + - rename-model: + from: ErrorCode + to: MetricsAdvisorErrorCode +``` + #### TimeMode -> AlertQueryTimeMode ```yaml directive: @@ -291,7 +299,7 @@ directive: "default": { "description": "Client error or server error (4xx or 5xx)", "schema": { - "$ref": "#/definitions/ErrorCode" + "$ref": "#/definitions/MetricsAdvisorErrorCode" } } }, @@ -363,7 +371,7 @@ directive: "default": { "description": "Client error or server error (4xx or 5xx)", "schema": { - "$ref": "#/definitions/ErrorCode" + "$ref": "#/definitions/MetricsAdvisorErrorCode" } } }, @@ -435,7 +443,7 @@ directive: "default": { "description": "Client error or server error (4xx or 5xx)", "schema": { - "$ref": "#/definitions/ErrorCode" + "$ref": "#/definitions/MetricsAdvisorErrorCode" } } }, @@ -507,7 +515,7 @@ directive: "default": { "description": "Client error or server error (4xx or 5xx)", "schema": { - "$ref": "#/definitions/ErrorCode" + "$ref": "#/definitions/MetricsAdvisorErrorCode" } } }, @@ -579,7 +587,7 @@ directive: "default": { "description": "Client error or server error (4xx or 5xx)", "schema": { - "$ref": "#/definitions/ErrorCode" + "$ref": "#/definitions/MetricsAdvisorErrorCode" } } }, @@ -651,7 +659,7 @@ directive: "default": { "description": "Client error or server error (4xx or 5xx)", "schema": { - "$ref": "#/definitions/ErrorCode" + "$ref": "#/definitions/MetricsAdvisorErrorCode" } } }, @@ -723,7 +731,7 @@ directive: "default": { "description": "Client error or server error (4xx or 5xx)", "schema": { - "$ref": "#/definitions/ErrorCode" + "$ref": "#/definitions/MetricsAdvisorErrorCode" } } }, @@ -795,7 +803,7 @@ directive: "default": { "description": "Client error or server error (4xx or 5xx)", "schema": { - "$ref": "#/definitions/ErrorCode" + "$ref": "#/definitions/MetricsAdvisorErrorCode" } } }, diff --git a/sdk/metricsadvisor/tests.yml b/sdk/metricsadvisor/tests.yml index ace116080b6d7..d27e25df4f9a0 100644 --- a/sdk/metricsadvisor/tests.yml +++ b/sdk/metricsadvisor/tests.yml @@ -30,5 +30,6 @@ stages: AZURE_METRICS_ADVISOR_AZURE_MONGODB_CONNECTION_STRING: $(metricsadvisor-test-azure-mongodb-connection-string) AZURE_METRICS_ADVISOR_MYSQL_CONNECTION_STRING: $(metricsadvisor-test-mysql-connection-string) AZURE_METRICS_ADVISOR_POSTGRESQL_CONNECTION_STRING: $(metricsadvisor-test-postgresql-connection-string) - AZURE_METRICS_ADVISOR_ELASTICSEARCH_AUTH_HEADER: $(metricsadvisor-test-elasticsearch-auth-header) - AZURE_METRICS_ADVISOR_ELASTICSEARCH_HOST: $(metricsadvisor-test-elasticsearch-host) + AZURE_METRICS_ADVISOR_LOG_ANALYTICS_WORKSPACE_ID: $(metricsadvisor-test-loganalytics-workspace-id) + AZURE_METRICS_ADVISOR_LOG_ANALYTICS_CLIENT_ID: $(metricsadvisor-test-loganalytics-client-id) + AZURE_METRICS_ADVISOR_LOG_ANALYTICS_CLIENT_SECRET: $(metricsadvisor-test-loganalytics-client-secret)