From d30773a776f36e8269c7b2377e1d948fad2f5b82 Mon Sep 17 00:00:00 2001 From: Weidong Xu Date: Mon, 14 Mar 2022 12:09:38 +0800 Subject: [PATCH] support AAD authentication --- .../MetricsAdvisorAsyncClient.java | 2 +- .../metricsadvisor/MetricsAdvisorClient.java | 2 +- .../MetricsAdvisorClientBuilder.java | 27 ++++++++++++++++++- .../generated/CreateANewDataFeed.java | 6 ++++- .../CreateANewDataSourceCredential.java | 6 ++++- .../generated/CreateANewHook.java | 6 ++++- .../generated/CreateANewMetricFeedback.java | 6 ++++- .../CreateAnomalyAlertingConfiguration.java | 6 ++++- .../CreateAnomalyDetectionConfiguration.java | 6 ++++- .../generated/DeleteADataFeed.java | 6 ++++- .../DeleteADataSourceCredential.java | 6 ++++- .../metricsadvisor/generated/DeleteAHook.java | 6 ++++- .../DeleteAnomalyAlertingConfiguration.java | 6 ++++- .../DeleteAnomalyDetectionConfiguration.java | 6 ++++- .../generated/GetADataFeedByItsId.java | 6 ++++- .../generated/GetADataSourceCredential.java | 6 ++++- .../generated/GetAHookByItsId.java | 6 ++++- .../generated/GetAMetricFeedbackByItsId.java | 6 ++++- .../GetDataIngestionStatusByDataFeed.java | 6 ++++- ...uccessIngestionJobTimestampByDataFeed.java | 6 ++++- .../generated/GetLatestUsageStats.java | 6 ++++- .../GetTimeSeriesDataFromMetric.java | 6 ++++- ...SpecificAnomalyDetectionConfiguration.java | 6 ++++- ...ectionConfigurationsForSpecificMetric.java | 6 ++++- .../generated/ListAllCredentials.java | 6 ++++- .../generated/ListAllDataFeeds.java | 6 ++++- .../generated/ListAllHooks.java | 6 ++++- .../ListDimensionFromCertainMetric.java | 6 ++++- .../ListFeedbackOnTheGivenMetric.java | 6 ++++- ...SeriesDimensionCombinationsFromMetric.java | 6 ++++- ...ryASingleAnomalyAlertingConfiguration.java | 6 ++++- ...yASingleAnomalyDetectionConfiguration.java | 6 ++++- ...ertsUnderAnomalyAlertingConfiguration.java | 6 ++++- .../QueryAnomaliesUnderASpecificAlert.java | 6 ++++- ...iesUnderAnomalyDetectionConfiguration.java | 6 ++++- .../QueryAnomalyDetectionStatus.java | 6 ++++- .../QueryDimensionValuesOfAnomalies.java | 6 ++++- .../QueryIncidentsUnderASpecificAlert.java | 6 ++++- ...ntsUnderAnomalyDetectionConfiguration.java | 6 ++++- .../generated/QueryRootCauseForIncident.java | 6 ++++- ...QuerySeriesEnrichedByAnomalyDetection.java | 6 ++++- ...gestionStatusByDataFeedToBackfillData.java | 6 ++++- .../generated/UpdateADataFeed.java | 6 ++++- .../UpdateADataSourceCredential.java | 6 ++++- .../metricsadvisor/generated/UpdateAHook.java | 6 ++++- .../UpdateAnomalyAlertingConfiguration.java | 6 ++++- .../UpdateAnomalyDetectionConfiguration.java | 6 ++++- .../MetricsAdvisorClientTestBase.java | 14 ++++++++-- .../swagger/README_SPEC.md | 3 +++ 49 files changed, 263 insertions(+), 49 deletions(-) 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 d8fe6edf60d55..b7dc80dd2d272 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 @@ -1,7 +1,6 @@ // 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; import com.azure.ai.metricsadvisor.implementation.MetricsAdvisorClientImpl; @@ -22,6 +21,7 @@ /** Initializes a new instance of the asynchronous MetricsAdvisorClient type. */ @ServiceClient(builder = MetricsAdvisorClientBuilder.class, isAsync = true) public final class MetricsAdvisorAsyncClient { + @Generated private final MetricsAdvisorClientImpl serviceClient; /** 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 922da5227b061..1efc829a06b89 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 @@ -1,7 +1,6 @@ // 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; import com.azure.core.annotation.Generated; @@ -20,6 +19,7 @@ /** Initializes a new instance of the synchronous MetricsAdvisorClient type. */ @ServiceClient(builder = MetricsAdvisorClientBuilder.class) public final class MetricsAdvisorClient { + @Generated private final MetricsAdvisorAsyncClient asyncClient; /** 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 aae4c9f686665..a48c81a241eb1 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 @@ -1,18 +1,19 @@ // 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; import com.azure.ai.metricsadvisor.implementation.MetricsAdvisorClientImpl; import com.azure.core.annotation.Generated; import com.azure.core.annotation.ServiceClientBuilder; +import com.azure.core.credential.TokenCredential; import com.azure.core.http.HttpClient; import com.azure.core.http.HttpHeaders; import com.azure.core.http.HttpPipeline; import com.azure.core.http.HttpPipelineBuilder; import com.azure.core.http.HttpPipelinePosition; import com.azure.core.http.policy.AddHeadersPolicy; +import com.azure.core.http.policy.BearerTokenAuthenticationPolicy; import com.azure.core.http.policy.CookiePolicy; import com.azure.core.http.policy.HttpLogOptions; import com.azure.core.http.policy.HttpLoggingPolicy; @@ -32,6 +33,7 @@ /** A builder for creating a new instance of the MetricsAdvisorClient type. */ @ServiceClientBuilder(serviceClients = {MetricsAdvisorClient.class, MetricsAdvisorAsyncClient.class}) public final class MetricsAdvisorClientBuilder { + @Generated private static final String SDK_NAME = "name"; @Generated private static final String SDK_VERSION = "version"; @@ -228,6 +230,9 @@ private HttpPipeline createHttpPipeline() { HttpPolicyProviders.addBeforeRetryPolicies(policies); policies.add(retryPolicy == null ? new RetryPolicy() : retryPolicy); policies.add(new CookiePolicy()); + if (tokenCredential != null) { + policies.add(new BearerTokenAuthenticationPolicy(tokenCredential, DEFAULT_SCOPES)); + } policies.addAll( this.pipelinePolicies.stream() .filter(p -> p.getPipelinePosition() == HttpPipelinePosition.PER_RETRY) @@ -262,4 +267,24 @@ public MetricsAdvisorAsyncClient buildAsyncClient() { public MetricsAdvisorClient buildClient() { return new MetricsAdvisorClient(new MetricsAdvisorAsyncClient(buildInnerClient())); } + + @Generated + private static final String[] DEFAULT_SCOPES = new String[] {"https://cognitiveservices.azure.com/.default"}; + + /* + * The TokenCredential used for authentication. + */ + @Generated private TokenCredential tokenCredential; + + /** + * Sets The TokenCredential used for authentication. + * + * @param tokenCredential the tokenCredential value. + * @return the MetricsAdvisorClientBuilder. + */ + @Generated + public MetricsAdvisorClientBuilder credential(TokenCredential tokenCredential) { + this.tokenCredential = tokenCredential; + return this; + } } diff --git a/sdk/metricsadvisor/azure-ai-metricsadvisor/src/samples/java/com/azure/ai/metricsadvisor/generated/CreateANewDataFeed.java b/sdk/metricsadvisor/azure-ai-metricsadvisor/src/samples/java/com/azure/ai/metricsadvisor/generated/CreateANewDataFeed.java index 077f1d1deaad6..b60a42140887d 100644 --- a/sdk/metricsadvisor/azure-ai-metricsadvisor/src/samples/java/com/azure/ai/metricsadvisor/generated/CreateANewDataFeed.java +++ b/sdk/metricsadvisor/azure-ai-metricsadvisor/src/samples/java/com/azure/ai/metricsadvisor/generated/CreateANewDataFeed.java @@ -9,12 +9,16 @@ import com.azure.core.http.rest.RequestOptions; import com.azure.core.http.rest.Response; import com.azure.core.util.BinaryData; +import com.azure.identity.DefaultAzureCredentialBuilder; public class CreateANewDataFeed { public static void main(String[] args) { // BEGIN: com.azure.ai.metricsadvisor.generated.createdatafeed.createanewdatafeed MetricsAdvisorClient metricsAdvisorClient = - new MetricsAdvisorClientBuilder().endpoint("{endpoint}").buildClient(); + new MetricsAdvisorClientBuilder() + .credential(new DefaultAzureCredentialBuilder().build()) + .endpoint("{endpoint}") + .buildClient(); BinaryData body = BinaryData.fromString( "{\"allUpIdentification\":\"__SUM__\",\"authenticationType\":\"Basic\",\"dataFeedDescription\":\"This is a sample data feed.\",\"dataFeedName\":\"Sample - cost/revenue - city/category\",\"dataSourceParameter\":{\"connectionString\":\"Server=PlaceholderSqlServer,1433;Initial Catalog=PlaceholderDatabase;User ID=PlaceholderUserName;Password=PlaceholderPassword;\",\"query\":\"select * from your_table where timestamp = @StartTime\"},\"dataSourceType\":\"SqlServer\",\"dataStartFrom\":\"2020-01-01T00:00:00.000Z\",\"dimension\":[{\"dimensionDisplayName\":\"category\",\"dimensionName\":\"category\"},{\"dimensionDisplayName\":\"city\",\"dimensionName\":\"city\"}],\"fillMissingPointType\":\"SmartFilling\",\"granularityName\":\"Daily\",\"maxConcurrency\":5,\"metrics\":[{\"metricDisplayName\":\"cost\",\"metricName\":\"cost\"},{\"metricDisplayName\":\"revenue\",\"metricName\":\"revenue\"}],\"minRetryIntervalInSeconds\":3600,\"needRollup\":\"NeedRollup\",\"rollUpMethod\":\"Sum\",\"startOffsetInSeconds\":86400,\"stopRetryAfterInSeconds\":604800,\"timestampColumn\":\"timestamp\",\"viewMode\":\"Private\"}"); diff --git a/sdk/metricsadvisor/azure-ai-metricsadvisor/src/samples/java/com/azure/ai/metricsadvisor/generated/CreateANewDataSourceCredential.java b/sdk/metricsadvisor/azure-ai-metricsadvisor/src/samples/java/com/azure/ai/metricsadvisor/generated/CreateANewDataSourceCredential.java index 6df5bbc337d35..87eb32720b777 100644 --- a/sdk/metricsadvisor/azure-ai-metricsadvisor/src/samples/java/com/azure/ai/metricsadvisor/generated/CreateANewDataSourceCredential.java +++ b/sdk/metricsadvisor/azure-ai-metricsadvisor/src/samples/java/com/azure/ai/metricsadvisor/generated/CreateANewDataSourceCredential.java @@ -9,12 +9,16 @@ import com.azure.core.http.rest.RequestOptions; import com.azure.core.http.rest.Response; import com.azure.core.util.BinaryData; +import com.azure.identity.DefaultAzureCredentialBuilder; public class CreateANewDataSourceCredential { public static void main(String[] args) { // BEGIN: com.azure.ai.metricsadvisor.generated.createcredential.createanewdatasourcecredential MetricsAdvisorClient metricsAdvisorClient = - new MetricsAdvisorClientBuilder().endpoint("{endpoint}").buildClient(); + new MetricsAdvisorClientBuilder() + .credential(new DefaultAzureCredentialBuilder().build()) + .endpoint("{endpoint}") + .buildClient(); BinaryData body = BinaryData.fromString( "{\"dataSourceCredentialDescription\":\"This is a data source credential\",\"dataSourceCredentialName\":\"A data source credential\",\"dataSourceCredentialType\":\"ServicePrincipal\",\"parameters\":{\"clientId\":\"88888888-8888-8888-8888-888888888888\",\"clientSecret\":\"fake-client-secret\",\"tenantId\":\"12345678-1234-1234-1234-123456788888\"}}"); diff --git a/sdk/metricsadvisor/azure-ai-metricsadvisor/src/samples/java/com/azure/ai/metricsadvisor/generated/CreateANewHook.java b/sdk/metricsadvisor/azure-ai-metricsadvisor/src/samples/java/com/azure/ai/metricsadvisor/generated/CreateANewHook.java index dc1f986e56d4c..a153a56123153 100644 --- a/sdk/metricsadvisor/azure-ai-metricsadvisor/src/samples/java/com/azure/ai/metricsadvisor/generated/CreateANewHook.java +++ b/sdk/metricsadvisor/azure-ai-metricsadvisor/src/samples/java/com/azure/ai/metricsadvisor/generated/CreateANewHook.java @@ -9,12 +9,16 @@ import com.azure.core.http.rest.RequestOptions; import com.azure.core.http.rest.Response; import com.azure.core.util.BinaryData; +import com.azure.identity.DefaultAzureCredentialBuilder; public class CreateANewHook { public static void main(String[] args) { // BEGIN: com.azure.ai.metricsadvisor.generated.createhook.createanewhook MetricsAdvisorClient metricsAdvisorClient = - new MetricsAdvisorClientBuilder().endpoint("{endpoint}").buildClient(); + new MetricsAdvisorClientBuilder() + .credential(new DefaultAzureCredentialBuilder().build()) + .endpoint("{endpoint}") + .buildClient(); BinaryData body = BinaryData.fromString( "{\"description\":\"This is a webhook.\",\"externalLink\":\"\",\"hookName\":\"A webhook\",\"hookParameter\":{\"endpoint\":\"https://localhost/demo/post\"},\"hookType\":\"Webhook\"}"); diff --git a/sdk/metricsadvisor/azure-ai-metricsadvisor/src/samples/java/com/azure/ai/metricsadvisor/generated/CreateANewMetricFeedback.java b/sdk/metricsadvisor/azure-ai-metricsadvisor/src/samples/java/com/azure/ai/metricsadvisor/generated/CreateANewMetricFeedback.java index 42ca1e3c0f406..9053f5f613504 100644 --- a/sdk/metricsadvisor/azure-ai-metricsadvisor/src/samples/java/com/azure/ai/metricsadvisor/generated/CreateANewMetricFeedback.java +++ b/sdk/metricsadvisor/azure-ai-metricsadvisor/src/samples/java/com/azure/ai/metricsadvisor/generated/CreateANewMetricFeedback.java @@ -9,12 +9,16 @@ import com.azure.core.http.rest.RequestOptions; import com.azure.core.http.rest.Response; import com.azure.core.util.BinaryData; +import com.azure.identity.DefaultAzureCredentialBuilder; public class CreateANewMetricFeedback { public static void main(String[] args) { // BEGIN: com.azure.ai.metricsadvisor.generated.createmetricfeedback.createanewmetricfeedback MetricsAdvisorClient metricsAdvisorClient = - new MetricsAdvisorClientBuilder().endpoint("{endpoint}").buildClient(); + new MetricsAdvisorClientBuilder() + .credential(new DefaultAzureCredentialBuilder().build()) + .endpoint("{endpoint}") + .buildClient(); BinaryData body = BinaryData.fromString( "{\"anomalyDetectionConfigurationId\":\"33333333-3333-3333-3333-000000000001\",\"dimensionFilter\":{\"dimension\":{\"city\":\"Beijing\"}},\"endTime\":\"2020-01-01T00:00:00.000Z\",\"feedbackType\":\"Anomaly\",\"metricId\":\"22222222-2222-2222-2222-000000000001\",\"startTime\":\"2020-01-01T00:00:00.000Z\",\"value\":{\"anomalyValue\":\"NotAnomaly\"}}"); diff --git a/sdk/metricsadvisor/azure-ai-metricsadvisor/src/samples/java/com/azure/ai/metricsadvisor/generated/CreateAnomalyAlertingConfiguration.java b/sdk/metricsadvisor/azure-ai-metricsadvisor/src/samples/java/com/azure/ai/metricsadvisor/generated/CreateAnomalyAlertingConfiguration.java index 43a57da722227..04c193c196b80 100644 --- a/sdk/metricsadvisor/azure-ai-metricsadvisor/src/samples/java/com/azure/ai/metricsadvisor/generated/CreateAnomalyAlertingConfiguration.java +++ b/sdk/metricsadvisor/azure-ai-metricsadvisor/src/samples/java/com/azure/ai/metricsadvisor/generated/CreateAnomalyAlertingConfiguration.java @@ -9,13 +9,17 @@ import com.azure.core.http.rest.RequestOptions; import com.azure.core.http.rest.Response; import com.azure.core.util.BinaryData; +import com.azure.identity.DefaultAzureCredentialBuilder; public class CreateAnomalyAlertingConfiguration { public static void main(String[] args) { // BEGIN: // com.azure.ai.metricsadvisor.generated.createanomalyalertingconfiguration.createanomalyalertingconfiguration MetricsAdvisorClient metricsAdvisorClient = - new MetricsAdvisorClientBuilder().endpoint("{endpoint}").buildClient(); + new MetricsAdvisorClientBuilder() + .credential(new DefaultAzureCredentialBuilder().build()) + .endpoint("{endpoint}") + .buildClient(); BinaryData body = BinaryData.fromString( "{\"name\":\"alerting configuration name\",\"crossMetricsOperator\":\"AND\",\"hookIds\":[\"00000000-0000-0000-0000-000000000001\"],\"metricAlertingConfigurations\":[{\"anomalyDetectionConfigurationId\":\"33333333-3333-3333-3333-000000000001\",\"anomalyScopeType\":\"All\",\"negationOperation\":false,\"severityFilter\":{\"maxAlertSeverity\":\"High\",\"minAlertSeverity\":\"Medium\"},\"snoozeFilter\":{\"autoSnooze\":0,\"onlyForSuccessive\":true,\"snoozeScope\":\"Series\"}},{\"anomalyDetectionConfigurationId\":\"33333333-3333-3333-3333-000000000002\",\"anomalyScopeType\":\"Dimension\",\"dimensionAnomalyScope\":{\"dimension\":{\"city\":\"Beijing\"}},\"negationOperation\":false,\"severityFilter\":{\"maxAlertSeverity\":\"High\",\"minAlertSeverity\":\"Low\"},\"snoozeFilter\":{\"autoSnooze\":0,\"onlyForSuccessive\":true,\"snoozeScope\":\"Series\"},\"valueFilter\":{\"type\":\"Value\",\"direction\":\"Both\",\"lower\":0,\"upper\":1000}}]}"); diff --git a/sdk/metricsadvisor/azure-ai-metricsadvisor/src/samples/java/com/azure/ai/metricsadvisor/generated/CreateAnomalyDetectionConfiguration.java b/sdk/metricsadvisor/azure-ai-metricsadvisor/src/samples/java/com/azure/ai/metricsadvisor/generated/CreateAnomalyDetectionConfiguration.java index 2ec022ae02281..0d47ebbdde9bb 100644 --- a/sdk/metricsadvisor/azure-ai-metricsadvisor/src/samples/java/com/azure/ai/metricsadvisor/generated/CreateAnomalyDetectionConfiguration.java +++ b/sdk/metricsadvisor/azure-ai-metricsadvisor/src/samples/java/com/azure/ai/metricsadvisor/generated/CreateAnomalyDetectionConfiguration.java @@ -9,13 +9,17 @@ import com.azure.core.http.rest.RequestOptions; import com.azure.core.http.rest.Response; import com.azure.core.util.BinaryData; +import com.azure.identity.DefaultAzureCredentialBuilder; public class CreateAnomalyDetectionConfiguration { public static void main(String[] args) { // BEGIN: // com.azure.ai.metricsadvisor.generated.createanomalydetectionconfiguration.createanomalydetectionconfiguration MetricsAdvisorClient metricsAdvisorClient = - new MetricsAdvisorClientBuilder().endpoint("{endpoint}").buildClient(); + new MetricsAdvisorClientBuilder() + .credential(new DefaultAzureCredentialBuilder().build()) + .endpoint("{endpoint}") + .buildClient(); BinaryData body = BinaryData.fromString( "{\"name\":\"Anomaly detection configuration name\",\"description\":\"Anomaly detection configuration description\",\"dimensionGroupOverrideConfigurations\":[{\"changeThresholdCondition\":{\"anomalyDetectorDirection\":\"Both\",\"changePercentage\":5,\"shiftPoint\":1,\"suppressCondition\":{\"minNumber\":1,\"minRatio\":100},\"withinRange\":false},\"conditionOperator\":\"AND\",\"group\":{\"dimension\":{\"city\":\"Beijing\"}},\"hardThresholdCondition\":{\"anomalyDetectorDirection\":\"Both\",\"lowerBound\":1,\"suppressCondition\":{\"minNumber\":1,\"minRatio\":100},\"upperBound\":100},\"smartDetectionCondition\":{\"anomalyDetectorDirection\":\"Both\",\"sensitivity\":91,\"suppressCondition\":{\"minNumber\":1,\"minRatio\":100}}}],\"metricId\":\"22222222-2222-2222-2222-000000000001\",\"seriesOverrideConfigurations\":[{\"changeThresholdCondition\":{\"anomalyDetectorDirection\":\"Both\",\"changePercentage\":5,\"shiftPoint\":1,\"suppressCondition\":{\"minNumber\":1,\"minRatio\":100},\"withinRange\":false},\"conditionOperator\":\"AND\",\"hardThresholdCondition\":{\"anomalyDetectorDirection\":\"Both\",\"lowerBound\":1,\"suppressCondition\":{\"minNumber\":1,\"minRatio\":100},\"upperBound\":100},\"series\":{\"dimension\":{\"category\":\"Jewelry\",\"city\":\"Beijing\"}},\"smartDetectionCondition\":{\"anomalyDetectorDirection\":\"Both\",\"sensitivity\":91,\"suppressCondition\":{\"minNumber\":1,\"minRatio\":100}}}],\"wholeMetricConfiguration\":{\"changeThresholdCondition\":{\"anomalyDetectorDirection\":\"Both\",\"changePercentage\":5,\"shiftPoint\":1,\"suppressCondition\":{\"minNumber\":1,\"minRatio\":100},\"withinRange\":false},\"conditionOperator\":\"AND\",\"hardThresholdCondition\":{\"anomalyDetectorDirection\":\"Both\",\"lowerBound\":1,\"suppressCondition\":{\"minNumber\":1,\"minRatio\":100},\"upperBound\":100},\"smartDetectionCondition\":{\"anomalyDetectorDirection\":\"Both\",\"sensitivity\":91,\"suppressCondition\":{\"minNumber\":1,\"minRatio\":100}}}}"); diff --git a/sdk/metricsadvisor/azure-ai-metricsadvisor/src/samples/java/com/azure/ai/metricsadvisor/generated/DeleteADataFeed.java b/sdk/metricsadvisor/azure-ai-metricsadvisor/src/samples/java/com/azure/ai/metricsadvisor/generated/DeleteADataFeed.java index 654836386c9f6..b9aece0b19660 100644 --- a/sdk/metricsadvisor/azure-ai-metricsadvisor/src/samples/java/com/azure/ai/metricsadvisor/generated/DeleteADataFeed.java +++ b/sdk/metricsadvisor/azure-ai-metricsadvisor/src/samples/java/com/azure/ai/metricsadvisor/generated/DeleteADataFeed.java @@ -8,12 +8,16 @@ import com.azure.ai.metricsadvisor.MetricsAdvisorClientBuilder; import com.azure.core.http.rest.RequestOptions; import com.azure.core.http.rest.Response; +import com.azure.identity.DefaultAzureCredentialBuilder; public class DeleteADataFeed { public static void main(String[] args) { // BEGIN: com.azure.ai.metricsadvisor.generated.deletedatafeed.deleteadatafeed MetricsAdvisorClient metricsAdvisorClient = - new MetricsAdvisorClientBuilder().endpoint("{endpoint}").buildClient(); + new MetricsAdvisorClientBuilder() + .credential(new DefaultAzureCredentialBuilder().build()) + .endpoint("{endpoint}") + .buildClient(); RequestOptions requestOptions = new RequestOptions(); Response response = metricsAdvisorClient.deleteDataFeedWithResponse("01234567-8901-2345-6789-012345678901", requestOptions); diff --git a/sdk/metricsadvisor/azure-ai-metricsadvisor/src/samples/java/com/azure/ai/metricsadvisor/generated/DeleteADataSourceCredential.java b/sdk/metricsadvisor/azure-ai-metricsadvisor/src/samples/java/com/azure/ai/metricsadvisor/generated/DeleteADataSourceCredential.java index 867239a8cd626..aa37a943c0f6b 100644 --- a/sdk/metricsadvisor/azure-ai-metricsadvisor/src/samples/java/com/azure/ai/metricsadvisor/generated/DeleteADataSourceCredential.java +++ b/sdk/metricsadvisor/azure-ai-metricsadvisor/src/samples/java/com/azure/ai/metricsadvisor/generated/DeleteADataSourceCredential.java @@ -8,12 +8,16 @@ import com.azure.ai.metricsadvisor.MetricsAdvisorClientBuilder; import com.azure.core.http.rest.RequestOptions; import com.azure.core.http.rest.Response; +import com.azure.identity.DefaultAzureCredentialBuilder; public class DeleteADataSourceCredential { public static void main(String[] args) { // BEGIN: com.azure.ai.metricsadvisor.generated.deletecredential.deleteadatasourcecredential MetricsAdvisorClient metricsAdvisorClient = - new MetricsAdvisorClientBuilder().endpoint("{endpoint}").buildClient(); + new MetricsAdvisorClientBuilder() + .credential(new DefaultAzureCredentialBuilder().build()) + .endpoint("{endpoint}") + .buildClient(); RequestOptions requestOptions = new RequestOptions(); Response response = metricsAdvisorClient.deleteCredentialWithResponse( diff --git a/sdk/metricsadvisor/azure-ai-metricsadvisor/src/samples/java/com/azure/ai/metricsadvisor/generated/DeleteAHook.java b/sdk/metricsadvisor/azure-ai-metricsadvisor/src/samples/java/com/azure/ai/metricsadvisor/generated/DeleteAHook.java index 32fd76c6821e9..a6024ab23c15e 100644 --- a/sdk/metricsadvisor/azure-ai-metricsadvisor/src/samples/java/com/azure/ai/metricsadvisor/generated/DeleteAHook.java +++ b/sdk/metricsadvisor/azure-ai-metricsadvisor/src/samples/java/com/azure/ai/metricsadvisor/generated/DeleteAHook.java @@ -8,12 +8,16 @@ import com.azure.ai.metricsadvisor.MetricsAdvisorClientBuilder; import com.azure.core.http.rest.RequestOptions; import com.azure.core.http.rest.Response; +import com.azure.identity.DefaultAzureCredentialBuilder; public class DeleteAHook { public static void main(String[] args) { // BEGIN: com.azure.ai.metricsadvisor.generated.deletehook.deleteahook MetricsAdvisorClient metricsAdvisorClient = - new MetricsAdvisorClientBuilder().endpoint("{endpoint}").buildClient(); + new MetricsAdvisorClientBuilder() + .credential(new DefaultAzureCredentialBuilder().build()) + .endpoint("{endpoint}") + .buildClient(); RequestOptions requestOptions = new RequestOptions(); Response response = metricsAdvisorClient.deleteHookWithResponse("01234567-8901-2345-6789-012345678901", requestOptions); diff --git a/sdk/metricsadvisor/azure-ai-metricsadvisor/src/samples/java/com/azure/ai/metricsadvisor/generated/DeleteAnomalyAlertingConfiguration.java b/sdk/metricsadvisor/azure-ai-metricsadvisor/src/samples/java/com/azure/ai/metricsadvisor/generated/DeleteAnomalyAlertingConfiguration.java index a48e07fceb091..10923aa14d4e7 100644 --- a/sdk/metricsadvisor/azure-ai-metricsadvisor/src/samples/java/com/azure/ai/metricsadvisor/generated/DeleteAnomalyAlertingConfiguration.java +++ b/sdk/metricsadvisor/azure-ai-metricsadvisor/src/samples/java/com/azure/ai/metricsadvisor/generated/DeleteAnomalyAlertingConfiguration.java @@ -8,13 +8,17 @@ import com.azure.ai.metricsadvisor.MetricsAdvisorClientBuilder; import com.azure.core.http.rest.RequestOptions; import com.azure.core.http.rest.Response; +import com.azure.identity.DefaultAzureCredentialBuilder; public class DeleteAnomalyAlertingConfiguration { public static void main(String[] args) { // BEGIN: // com.azure.ai.metricsadvisor.generated.deleteanomalyalertingconfiguration.deleteanomalyalertingconfiguration MetricsAdvisorClient metricsAdvisorClient = - new MetricsAdvisorClientBuilder().endpoint("{endpoint}").buildClient(); + new MetricsAdvisorClientBuilder() + .credential(new DefaultAzureCredentialBuilder().build()) + .endpoint("{endpoint}") + .buildClient(); RequestOptions requestOptions = new RequestOptions(); Response response = metricsAdvisorClient.deleteAnomalyAlertingConfigurationWithResponse( diff --git a/sdk/metricsadvisor/azure-ai-metricsadvisor/src/samples/java/com/azure/ai/metricsadvisor/generated/DeleteAnomalyDetectionConfiguration.java b/sdk/metricsadvisor/azure-ai-metricsadvisor/src/samples/java/com/azure/ai/metricsadvisor/generated/DeleteAnomalyDetectionConfiguration.java index 3b51489c2d071..b86fa77d1ff13 100644 --- a/sdk/metricsadvisor/azure-ai-metricsadvisor/src/samples/java/com/azure/ai/metricsadvisor/generated/DeleteAnomalyDetectionConfiguration.java +++ b/sdk/metricsadvisor/azure-ai-metricsadvisor/src/samples/java/com/azure/ai/metricsadvisor/generated/DeleteAnomalyDetectionConfiguration.java @@ -8,13 +8,17 @@ import com.azure.ai.metricsadvisor.MetricsAdvisorClientBuilder; import com.azure.core.http.rest.RequestOptions; import com.azure.core.http.rest.Response; +import com.azure.identity.DefaultAzureCredentialBuilder; public class DeleteAnomalyDetectionConfiguration { public static void main(String[] args) { // BEGIN: // com.azure.ai.metricsadvisor.generated.deleteanomalydetectionconfiguration.deleteanomalydetectionconfiguration MetricsAdvisorClient metricsAdvisorClient = - new MetricsAdvisorClientBuilder().endpoint("{endpoint}").buildClient(); + new MetricsAdvisorClientBuilder() + .credential(new DefaultAzureCredentialBuilder().build()) + .endpoint("{endpoint}") + .buildClient(); RequestOptions requestOptions = new RequestOptions(); Response response = metricsAdvisorClient.deleteAnomalyDetectionConfigurationWithResponse( diff --git a/sdk/metricsadvisor/azure-ai-metricsadvisor/src/samples/java/com/azure/ai/metricsadvisor/generated/GetADataFeedByItsId.java b/sdk/metricsadvisor/azure-ai-metricsadvisor/src/samples/java/com/azure/ai/metricsadvisor/generated/GetADataFeedByItsId.java index d1ebf081891ae..43b188c8e774c 100644 --- a/sdk/metricsadvisor/azure-ai-metricsadvisor/src/samples/java/com/azure/ai/metricsadvisor/generated/GetADataFeedByItsId.java +++ b/sdk/metricsadvisor/azure-ai-metricsadvisor/src/samples/java/com/azure/ai/metricsadvisor/generated/GetADataFeedByItsId.java @@ -9,12 +9,16 @@ import com.azure.core.http.rest.RequestOptions; import com.azure.core.http.rest.Response; import com.azure.core.util.BinaryData; +import com.azure.identity.DefaultAzureCredentialBuilder; public class GetADataFeedByItsId { public static void main(String[] args) { // BEGIN: com.azure.ai.metricsadvisor.generated.getdatafeedbyid.getadatafeedbyitsid MetricsAdvisorClient metricsAdvisorClient = - new MetricsAdvisorClientBuilder().endpoint("{endpoint}").buildClient(); + new MetricsAdvisorClientBuilder() + .credential(new DefaultAzureCredentialBuilder().build()) + .endpoint("{endpoint}") + .buildClient(); RequestOptions requestOptions = new RequestOptions(); Response response = metricsAdvisorClient.getDataFeedByIdWithResponse( diff --git a/sdk/metricsadvisor/azure-ai-metricsadvisor/src/samples/java/com/azure/ai/metricsadvisor/generated/GetADataSourceCredential.java b/sdk/metricsadvisor/azure-ai-metricsadvisor/src/samples/java/com/azure/ai/metricsadvisor/generated/GetADataSourceCredential.java index 812b574efc427..1e419711adb9a 100644 --- a/sdk/metricsadvisor/azure-ai-metricsadvisor/src/samples/java/com/azure/ai/metricsadvisor/generated/GetADataSourceCredential.java +++ b/sdk/metricsadvisor/azure-ai-metricsadvisor/src/samples/java/com/azure/ai/metricsadvisor/generated/GetADataSourceCredential.java @@ -9,12 +9,16 @@ import com.azure.core.http.rest.RequestOptions; import com.azure.core.http.rest.Response; import com.azure.core.util.BinaryData; +import com.azure.identity.DefaultAzureCredentialBuilder; public class GetADataSourceCredential { public static void main(String[] args) { // BEGIN: com.azure.ai.metricsadvisor.generated.getcredential.getadatasourcecredential MetricsAdvisorClient metricsAdvisorClient = - new MetricsAdvisorClientBuilder().endpoint("{endpoint}").buildClient(); + new MetricsAdvisorClientBuilder() + .credential(new DefaultAzureCredentialBuilder().build()) + .endpoint("{endpoint}") + .buildClient(); RequestOptions requestOptions = new RequestOptions(); Response response = metricsAdvisorClient.getCredentialWithResponse("01234567-8901-2345-6789-012345678901", requestOptions); diff --git a/sdk/metricsadvisor/azure-ai-metricsadvisor/src/samples/java/com/azure/ai/metricsadvisor/generated/GetAHookByItsId.java b/sdk/metricsadvisor/azure-ai-metricsadvisor/src/samples/java/com/azure/ai/metricsadvisor/generated/GetAHookByItsId.java index 034ca7ad87317..d3e0bb27887fa 100644 --- a/sdk/metricsadvisor/azure-ai-metricsadvisor/src/samples/java/com/azure/ai/metricsadvisor/generated/GetAHookByItsId.java +++ b/sdk/metricsadvisor/azure-ai-metricsadvisor/src/samples/java/com/azure/ai/metricsadvisor/generated/GetAHookByItsId.java @@ -9,12 +9,16 @@ import com.azure.core.http.rest.RequestOptions; import com.azure.core.http.rest.Response; import com.azure.core.util.BinaryData; +import com.azure.identity.DefaultAzureCredentialBuilder; public class GetAHookByItsId { public static void main(String[] args) { // BEGIN: com.azure.ai.metricsadvisor.generated.gethook.getahookbyitsid MetricsAdvisorClient metricsAdvisorClient = - new MetricsAdvisorClientBuilder().endpoint("{endpoint}").buildClient(); + new MetricsAdvisorClientBuilder() + .credential(new DefaultAzureCredentialBuilder().build()) + .endpoint("{endpoint}") + .buildClient(); RequestOptions requestOptions = new RequestOptions(); Response response = metricsAdvisorClient.getHookWithResponse("01234567-8901-2345-6789-012345678901", requestOptions); diff --git a/sdk/metricsadvisor/azure-ai-metricsadvisor/src/samples/java/com/azure/ai/metricsadvisor/generated/GetAMetricFeedbackByItsId.java b/sdk/metricsadvisor/azure-ai-metricsadvisor/src/samples/java/com/azure/ai/metricsadvisor/generated/GetAMetricFeedbackByItsId.java index 6c4a63a57927d..000dcf6cabe4b 100644 --- a/sdk/metricsadvisor/azure-ai-metricsadvisor/src/samples/java/com/azure/ai/metricsadvisor/generated/GetAMetricFeedbackByItsId.java +++ b/sdk/metricsadvisor/azure-ai-metricsadvisor/src/samples/java/com/azure/ai/metricsadvisor/generated/GetAMetricFeedbackByItsId.java @@ -9,12 +9,16 @@ import com.azure.core.http.rest.RequestOptions; import com.azure.core.http.rest.Response; import com.azure.core.util.BinaryData; +import com.azure.identity.DefaultAzureCredentialBuilder; public class GetAMetricFeedbackByItsId { public static void main(String[] args) { // BEGIN: com.azure.ai.metricsadvisor.generated.getmetricfeedback.getametricfeedbackbyitsid MetricsAdvisorClient metricsAdvisorClient = - new MetricsAdvisorClientBuilder().endpoint("{endpoint}").buildClient(); + new MetricsAdvisorClientBuilder() + .credential(new DefaultAzureCredentialBuilder().build()) + .endpoint("{endpoint}") + .buildClient(); RequestOptions requestOptions = new RequestOptions(); Response response = metricsAdvisorClient.getMetricFeedbackWithResponse( diff --git a/sdk/metricsadvisor/azure-ai-metricsadvisor/src/samples/java/com/azure/ai/metricsadvisor/generated/GetDataIngestionStatusByDataFeed.java b/sdk/metricsadvisor/azure-ai-metricsadvisor/src/samples/java/com/azure/ai/metricsadvisor/generated/GetDataIngestionStatusByDataFeed.java index 6204f6b41c195..1b5209e310e82 100644 --- a/sdk/metricsadvisor/azure-ai-metricsadvisor/src/samples/java/com/azure/ai/metricsadvisor/generated/GetDataIngestionStatusByDataFeed.java +++ b/sdk/metricsadvisor/azure-ai-metricsadvisor/src/samples/java/com/azure/ai/metricsadvisor/generated/GetDataIngestionStatusByDataFeed.java @@ -9,12 +9,16 @@ import com.azure.core.http.rest.PagedIterable; import com.azure.core.http.rest.RequestOptions; import com.azure.core.util.BinaryData; +import com.azure.identity.DefaultAzureCredentialBuilder; public class GetDataIngestionStatusByDataFeed { public static void main(String[] args) { // BEGIN: com.azure.ai.metricsadvisor.generated.getdatafeedingestionstatus.getdataingestionstatusbydatafeed MetricsAdvisorClient metricsAdvisorClient = - new MetricsAdvisorClientBuilder().endpoint("{endpoint}").buildClient(); + new MetricsAdvisorClientBuilder() + .credential(new DefaultAzureCredentialBuilder().build()) + .endpoint("{endpoint}") + .buildClient(); BinaryData body = BinaryData.fromString( "{\"endTime\":\"2020-02-01T00:00:00.000Z\",\"startTime\":\"2020-01-01T00:00:00.000Z\"}"); diff --git a/sdk/metricsadvisor/azure-ai-metricsadvisor/src/samples/java/com/azure/ai/metricsadvisor/generated/GetDataLastSuccessIngestionJobTimestampByDataFeed.java b/sdk/metricsadvisor/azure-ai-metricsadvisor/src/samples/java/com/azure/ai/metricsadvisor/generated/GetDataLastSuccessIngestionJobTimestampByDataFeed.java index 326f43f427f8c..c62d46ea4701a 100644 --- a/sdk/metricsadvisor/azure-ai-metricsadvisor/src/samples/java/com/azure/ai/metricsadvisor/generated/GetDataLastSuccessIngestionJobTimestampByDataFeed.java +++ b/sdk/metricsadvisor/azure-ai-metricsadvisor/src/samples/java/com/azure/ai/metricsadvisor/generated/GetDataLastSuccessIngestionJobTimestampByDataFeed.java @@ -9,13 +9,17 @@ import com.azure.core.http.rest.RequestOptions; import com.azure.core.http.rest.Response; import com.azure.core.util.BinaryData; +import com.azure.identity.DefaultAzureCredentialBuilder; public class GetDataLastSuccessIngestionJobTimestampByDataFeed { public static void main(String[] args) { // BEGIN: // com.azure.ai.metricsadvisor.generated.getingestionprogress.getdatalastsuccessingestionjobtimestampbydatafeed MetricsAdvisorClient metricsAdvisorClient = - new MetricsAdvisorClientBuilder().endpoint("{endpoint}").buildClient(); + new MetricsAdvisorClientBuilder() + .credential(new DefaultAzureCredentialBuilder().build()) + .endpoint("{endpoint}") + .buildClient(); RequestOptions requestOptions = new RequestOptions(); Response response = metricsAdvisorClient.getIngestionProgressWithResponse( diff --git a/sdk/metricsadvisor/azure-ai-metricsadvisor/src/samples/java/com/azure/ai/metricsadvisor/generated/GetLatestUsageStats.java b/sdk/metricsadvisor/azure-ai-metricsadvisor/src/samples/java/com/azure/ai/metricsadvisor/generated/GetLatestUsageStats.java index 5fe3f2bca5bdd..49525904377a8 100644 --- a/sdk/metricsadvisor/azure-ai-metricsadvisor/src/samples/java/com/azure/ai/metricsadvisor/generated/GetLatestUsageStats.java +++ b/sdk/metricsadvisor/azure-ai-metricsadvisor/src/samples/java/com/azure/ai/metricsadvisor/generated/GetLatestUsageStats.java @@ -9,12 +9,16 @@ import com.azure.core.http.rest.RequestOptions; import com.azure.core.http.rest.Response; import com.azure.core.util.BinaryData; +import com.azure.identity.DefaultAzureCredentialBuilder; public class GetLatestUsageStats { public static void main(String[] args) { // BEGIN: com.azure.ai.metricsadvisor.generated.getactiveseriescount.getlatestusagestats MetricsAdvisorClient metricsAdvisorClient = - new MetricsAdvisorClientBuilder().endpoint("{endpoint}").buildClient(); + new MetricsAdvisorClientBuilder() + .credential(new DefaultAzureCredentialBuilder().build()) + .endpoint("{endpoint}") + .buildClient(); RequestOptions requestOptions = new RequestOptions(); Response response = metricsAdvisorClient.getActiveSeriesCountWithResponse(requestOptions); // END: com.azure.ai.metricsadvisor.generated.getactiveseriescount.getlatestusagestats diff --git a/sdk/metricsadvisor/azure-ai-metricsadvisor/src/samples/java/com/azure/ai/metricsadvisor/generated/GetTimeSeriesDataFromMetric.java b/sdk/metricsadvisor/azure-ai-metricsadvisor/src/samples/java/com/azure/ai/metricsadvisor/generated/GetTimeSeriesDataFromMetric.java index fea29012efb8d..eb0f4b3765ee8 100644 --- a/sdk/metricsadvisor/azure-ai-metricsadvisor/src/samples/java/com/azure/ai/metricsadvisor/generated/GetTimeSeriesDataFromMetric.java +++ b/sdk/metricsadvisor/azure-ai-metricsadvisor/src/samples/java/com/azure/ai/metricsadvisor/generated/GetTimeSeriesDataFromMetric.java @@ -9,12 +9,16 @@ import com.azure.core.http.rest.RequestOptions; import com.azure.core.http.rest.Response; import com.azure.core.util.BinaryData; +import com.azure.identity.DefaultAzureCredentialBuilder; public class GetTimeSeriesDataFromMetric { public static void main(String[] args) { // BEGIN: com.azure.ai.metricsadvisor.generated.getmetricdata.gettimeseriesdatafrommetric MetricsAdvisorClient metricsAdvisorClient = - new MetricsAdvisorClientBuilder().endpoint("{endpoint}").buildClient(); + new MetricsAdvisorClientBuilder() + .credential(new DefaultAzureCredentialBuilder().build()) + .endpoint("{endpoint}") + .buildClient(); BinaryData body = BinaryData.fromString( "{\"endTime\":\"2020-02-01T00:00:00.000Z\",\"series\":[{\"category\":\"__SUM__\",\"city\":\"Beijing\"}],\"startTime\":\"2020-01-01T00:00:00.000Z\"}"); diff --git a/sdk/metricsadvisor/azure-ai-metricsadvisor/src/samples/java/com/azure/ai/metricsadvisor/generated/ListAllAnomalyAlertingConfigurationsForSpecificAnomalyDetectionConfiguration.java b/sdk/metricsadvisor/azure-ai-metricsadvisor/src/samples/java/com/azure/ai/metricsadvisor/generated/ListAllAnomalyAlertingConfigurationsForSpecificAnomalyDetectionConfiguration.java index e0786c9cc0c29..869d0f704e6f4 100644 --- a/sdk/metricsadvisor/azure-ai-metricsadvisor/src/samples/java/com/azure/ai/metricsadvisor/generated/ListAllAnomalyAlertingConfigurationsForSpecificAnomalyDetectionConfiguration.java +++ b/sdk/metricsadvisor/azure-ai-metricsadvisor/src/samples/java/com/azure/ai/metricsadvisor/generated/ListAllAnomalyAlertingConfigurationsForSpecificAnomalyDetectionConfiguration.java @@ -9,13 +9,17 @@ import com.azure.core.http.rest.PagedIterable; import com.azure.core.http.rest.RequestOptions; import com.azure.core.util.BinaryData; +import com.azure.identity.DefaultAzureCredentialBuilder; public class ListAllAnomalyAlertingConfigurationsForSpecificAnomalyDetectionConfiguration { public static void main(String[] args) { // BEGIN: // com.azure.ai.metricsadvisor.generated.getanomalyalertingconfigurationsbyanomalydetectionconfiguration.listallanomalyalertingconfigurationsforspecificanomalydetectionconfiguration MetricsAdvisorClient metricsAdvisorClient = - new MetricsAdvisorClientBuilder().endpoint("{endpoint}").buildClient(); + new MetricsAdvisorClientBuilder() + .credential(new DefaultAzureCredentialBuilder().build()) + .endpoint("{endpoint}") + .buildClient(); RequestOptions requestOptions = new RequestOptions(); PagedIterable response = metricsAdvisorClient.getAnomalyAlertingConfigurationsByAnomalyDetectionConfiguration( diff --git a/sdk/metricsadvisor/azure-ai-metricsadvisor/src/samples/java/com/azure/ai/metricsadvisor/generated/ListAllAnomalyDetectionConfigurationsForSpecificMetric.java b/sdk/metricsadvisor/azure-ai-metricsadvisor/src/samples/java/com/azure/ai/metricsadvisor/generated/ListAllAnomalyDetectionConfigurationsForSpecificMetric.java index f8ea1eee3990d..34e464ecdb046 100644 --- a/sdk/metricsadvisor/azure-ai-metricsadvisor/src/samples/java/com/azure/ai/metricsadvisor/generated/ListAllAnomalyDetectionConfigurationsForSpecificMetric.java +++ b/sdk/metricsadvisor/azure-ai-metricsadvisor/src/samples/java/com/azure/ai/metricsadvisor/generated/ListAllAnomalyDetectionConfigurationsForSpecificMetric.java @@ -9,13 +9,17 @@ import com.azure.core.http.rest.PagedIterable; import com.azure.core.http.rest.RequestOptions; import com.azure.core.util.BinaryData; +import com.azure.identity.DefaultAzureCredentialBuilder; public class ListAllAnomalyDetectionConfigurationsForSpecificMetric { public static void main(String[] args) { // BEGIN: // com.azure.ai.metricsadvisor.generated.getanomalydetectionconfigurationsbymetric.listallanomalydetectionconfigurationsforspecificmetric MetricsAdvisorClient metricsAdvisorClient = - new MetricsAdvisorClientBuilder().endpoint("{endpoint}").buildClient(); + new MetricsAdvisorClientBuilder() + .credential(new DefaultAzureCredentialBuilder().build()) + .endpoint("{endpoint}") + .buildClient(); RequestOptions requestOptions = new RequestOptions(); PagedIterable response = metricsAdvisorClient.getAnomalyDetectionConfigurationsByMetric( diff --git a/sdk/metricsadvisor/azure-ai-metricsadvisor/src/samples/java/com/azure/ai/metricsadvisor/generated/ListAllCredentials.java b/sdk/metricsadvisor/azure-ai-metricsadvisor/src/samples/java/com/azure/ai/metricsadvisor/generated/ListAllCredentials.java index 66733a54d6363..fa405b42a091e 100644 --- a/sdk/metricsadvisor/azure-ai-metricsadvisor/src/samples/java/com/azure/ai/metricsadvisor/generated/ListAllCredentials.java +++ b/sdk/metricsadvisor/azure-ai-metricsadvisor/src/samples/java/com/azure/ai/metricsadvisor/generated/ListAllCredentials.java @@ -9,12 +9,16 @@ import com.azure.core.http.rest.PagedIterable; import com.azure.core.http.rest.RequestOptions; import com.azure.core.util.BinaryData; +import com.azure.identity.DefaultAzureCredentialBuilder; public class ListAllCredentials { public static void main(String[] args) { // BEGIN: com.azure.ai.metricsadvisor.generated.listcredentials.listallcredentials MetricsAdvisorClient metricsAdvisorClient = - new MetricsAdvisorClientBuilder().endpoint("{endpoint}").buildClient(); + new MetricsAdvisorClientBuilder() + .credential(new DefaultAzureCredentialBuilder().build()) + .endpoint("{endpoint}") + .buildClient(); RequestOptions requestOptions = new RequestOptions(); PagedIterable response = metricsAdvisorClient.listCredentials(requestOptions); // END: com.azure.ai.metricsadvisor.generated.listcredentials.listallcredentials diff --git a/sdk/metricsadvisor/azure-ai-metricsadvisor/src/samples/java/com/azure/ai/metricsadvisor/generated/ListAllDataFeeds.java b/sdk/metricsadvisor/azure-ai-metricsadvisor/src/samples/java/com/azure/ai/metricsadvisor/generated/ListAllDataFeeds.java index 0e2854f759421..ea9e718a223a1 100644 --- a/sdk/metricsadvisor/azure-ai-metricsadvisor/src/samples/java/com/azure/ai/metricsadvisor/generated/ListAllDataFeeds.java +++ b/sdk/metricsadvisor/azure-ai-metricsadvisor/src/samples/java/com/azure/ai/metricsadvisor/generated/ListAllDataFeeds.java @@ -9,12 +9,16 @@ import com.azure.core.http.rest.PagedIterable; import com.azure.core.http.rest.RequestOptions; import com.azure.core.util.BinaryData; +import com.azure.identity.DefaultAzureCredentialBuilder; public class ListAllDataFeeds { public static void main(String[] args) { // BEGIN: com.azure.ai.metricsadvisor.generated.listdatafeeds.listalldatafeeds MetricsAdvisorClient metricsAdvisorClient = - new MetricsAdvisorClientBuilder().endpoint("{endpoint}").buildClient(); + new MetricsAdvisorClientBuilder() + .credential(new DefaultAzureCredentialBuilder().build()) + .endpoint("{endpoint}") + .buildClient(); RequestOptions requestOptions = new RequestOptions(); requestOptions.addQueryParam("creator", "demo@microsoft.com"); requestOptions.addQueryParam("dataFeedName", "name_prefix"); diff --git a/sdk/metricsadvisor/azure-ai-metricsadvisor/src/samples/java/com/azure/ai/metricsadvisor/generated/ListAllHooks.java b/sdk/metricsadvisor/azure-ai-metricsadvisor/src/samples/java/com/azure/ai/metricsadvisor/generated/ListAllHooks.java index a5072a517fffd..064ce8a58153a 100644 --- a/sdk/metricsadvisor/azure-ai-metricsadvisor/src/samples/java/com/azure/ai/metricsadvisor/generated/ListAllHooks.java +++ b/sdk/metricsadvisor/azure-ai-metricsadvisor/src/samples/java/com/azure/ai/metricsadvisor/generated/ListAllHooks.java @@ -9,12 +9,16 @@ import com.azure.core.http.rest.PagedIterable; import com.azure.core.http.rest.RequestOptions; import com.azure.core.util.BinaryData; +import com.azure.identity.DefaultAzureCredentialBuilder; public class ListAllHooks { public static void main(String[] args) { // BEGIN: com.azure.ai.metricsadvisor.generated.listhooks.listallhooks MetricsAdvisorClient metricsAdvisorClient = - new MetricsAdvisorClientBuilder().endpoint("{endpoint}").buildClient(); + new MetricsAdvisorClientBuilder() + .credential(new DefaultAzureCredentialBuilder().build()) + .endpoint("{endpoint}") + .buildClient(); RequestOptions requestOptions = new RequestOptions(); requestOptions.addQueryParam("hookName", "name_prefix"); PagedIterable response = metricsAdvisorClient.listHooks(requestOptions); diff --git a/sdk/metricsadvisor/azure-ai-metricsadvisor/src/samples/java/com/azure/ai/metricsadvisor/generated/ListDimensionFromCertainMetric.java b/sdk/metricsadvisor/azure-ai-metricsadvisor/src/samples/java/com/azure/ai/metricsadvisor/generated/ListDimensionFromCertainMetric.java index 850a8affabd02..4776d3753b744 100644 --- a/sdk/metricsadvisor/azure-ai-metricsadvisor/src/samples/java/com/azure/ai/metricsadvisor/generated/ListDimensionFromCertainMetric.java +++ b/sdk/metricsadvisor/azure-ai-metricsadvisor/src/samples/java/com/azure/ai/metricsadvisor/generated/ListDimensionFromCertainMetric.java @@ -9,12 +9,16 @@ import com.azure.core.http.rest.PagedIterable; import com.azure.core.http.rest.RequestOptions; import com.azure.core.util.BinaryData; +import com.azure.identity.DefaultAzureCredentialBuilder; public class ListDimensionFromCertainMetric { public static void main(String[] args) { // BEGIN: com.azure.ai.metricsadvisor.generated.getmetricdimension.listdimensionfromcertainmetric MetricsAdvisorClient metricsAdvisorClient = - new MetricsAdvisorClientBuilder().endpoint("{endpoint}").buildClient(); + new MetricsAdvisorClientBuilder() + .credential(new DefaultAzureCredentialBuilder().build()) + .endpoint("{endpoint}") + .buildClient(); BinaryData body = BinaryData.fromString("{\"dimensionName\":\"city\"}"); RequestOptions requestOptions = new RequestOptions(); PagedIterable response = diff --git a/sdk/metricsadvisor/azure-ai-metricsadvisor/src/samples/java/com/azure/ai/metricsadvisor/generated/ListFeedbackOnTheGivenMetric.java b/sdk/metricsadvisor/azure-ai-metricsadvisor/src/samples/java/com/azure/ai/metricsadvisor/generated/ListFeedbackOnTheGivenMetric.java index efc326ec21cf7..16b3dceaa8124 100644 --- a/sdk/metricsadvisor/azure-ai-metricsadvisor/src/samples/java/com/azure/ai/metricsadvisor/generated/ListFeedbackOnTheGivenMetric.java +++ b/sdk/metricsadvisor/azure-ai-metricsadvisor/src/samples/java/com/azure/ai/metricsadvisor/generated/ListFeedbackOnTheGivenMetric.java @@ -9,12 +9,16 @@ import com.azure.core.http.rest.PagedIterable; import com.azure.core.http.rest.RequestOptions; import com.azure.core.util.BinaryData; +import com.azure.identity.DefaultAzureCredentialBuilder; public class ListFeedbackOnTheGivenMetric { public static void main(String[] args) { // BEGIN: com.azure.ai.metricsadvisor.generated.listmetricfeedbacks.listfeedbackonthegivenmetric MetricsAdvisorClient metricsAdvisorClient = - new MetricsAdvisorClientBuilder().endpoint("{endpoint}").buildClient(); + new MetricsAdvisorClientBuilder() + .credential(new DefaultAzureCredentialBuilder().build()) + .endpoint("{endpoint}") + .buildClient(); BinaryData body = BinaryData.fromString( "{\"endTime\":\"2020-01-01T00:00:00.000Z\",\"feedbackType\":\"Anomaly\",\"metricId\":\"22222222-2222-2222-2222-000000000001\",\"startTime\":\"2020-01-01T00:00:00.000Z\",\"timeMode\":\"MetricTimestamp\"}"); diff --git a/sdk/metricsadvisor/azure-ai-metricsadvisor/src/samples/java/com/azure/ai/metricsadvisor/generated/ListSeriesDimensionCombinationsFromMetric.java b/sdk/metricsadvisor/azure-ai-metricsadvisor/src/samples/java/com/azure/ai/metricsadvisor/generated/ListSeriesDimensionCombinationsFromMetric.java index 2978e9c6700f9..486a634d0eb32 100644 --- a/sdk/metricsadvisor/azure-ai-metricsadvisor/src/samples/java/com/azure/ai/metricsadvisor/generated/ListSeriesDimensionCombinationsFromMetric.java +++ b/sdk/metricsadvisor/azure-ai-metricsadvisor/src/samples/java/com/azure/ai/metricsadvisor/generated/ListSeriesDimensionCombinationsFromMetric.java @@ -9,12 +9,16 @@ import com.azure.core.http.rest.PagedIterable; import com.azure.core.http.rest.RequestOptions; import com.azure.core.util.BinaryData; +import com.azure.identity.DefaultAzureCredentialBuilder; public class ListSeriesDimensionCombinationsFromMetric { public static void main(String[] args) { // BEGIN: com.azure.ai.metricsadvisor.generated.getmetricseries.listseriesdimensioncombinationsfrommetric MetricsAdvisorClient metricsAdvisorClient = - new MetricsAdvisorClientBuilder().endpoint("{endpoint}").buildClient(); + new MetricsAdvisorClientBuilder() + .credential(new DefaultAzureCredentialBuilder().build()) + .endpoint("{endpoint}") + .buildClient(); BinaryData body = BinaryData.fromString( "{\"activeSince\":\"2020-01-01T00:00:00.000Z\",\"dimensionFilter\":{\"city\":[\"Beijing\"]}}"); diff --git a/sdk/metricsadvisor/azure-ai-metricsadvisor/src/samples/java/com/azure/ai/metricsadvisor/generated/QueryASingleAnomalyAlertingConfiguration.java b/sdk/metricsadvisor/azure-ai-metricsadvisor/src/samples/java/com/azure/ai/metricsadvisor/generated/QueryASingleAnomalyAlertingConfiguration.java index a87e26fd1ec58..73983fa4987ae 100644 --- a/sdk/metricsadvisor/azure-ai-metricsadvisor/src/samples/java/com/azure/ai/metricsadvisor/generated/QueryASingleAnomalyAlertingConfiguration.java +++ b/sdk/metricsadvisor/azure-ai-metricsadvisor/src/samples/java/com/azure/ai/metricsadvisor/generated/QueryASingleAnomalyAlertingConfiguration.java @@ -9,13 +9,17 @@ import com.azure.core.http.rest.RequestOptions; import com.azure.core.http.rest.Response; import com.azure.core.util.BinaryData; +import com.azure.identity.DefaultAzureCredentialBuilder; public class QueryASingleAnomalyAlertingConfiguration { public static void main(String[] args) { // BEGIN: // com.azure.ai.metricsadvisor.generated.getanomalyalertingconfiguration.queryasingleanomalyalertingconfiguration MetricsAdvisorClient metricsAdvisorClient = - new MetricsAdvisorClientBuilder().endpoint("{endpoint}").buildClient(); + new MetricsAdvisorClientBuilder() + .credential(new DefaultAzureCredentialBuilder().build()) + .endpoint("{endpoint}") + .buildClient(); RequestOptions requestOptions = new RequestOptions(); Response response = metricsAdvisorClient.getAnomalyAlertingConfigurationWithResponse( diff --git a/sdk/metricsadvisor/azure-ai-metricsadvisor/src/samples/java/com/azure/ai/metricsadvisor/generated/QueryASingleAnomalyDetectionConfiguration.java b/sdk/metricsadvisor/azure-ai-metricsadvisor/src/samples/java/com/azure/ai/metricsadvisor/generated/QueryASingleAnomalyDetectionConfiguration.java index 28020da4994f1..71ccd5941f8a8 100644 --- a/sdk/metricsadvisor/azure-ai-metricsadvisor/src/samples/java/com/azure/ai/metricsadvisor/generated/QueryASingleAnomalyDetectionConfiguration.java +++ b/sdk/metricsadvisor/azure-ai-metricsadvisor/src/samples/java/com/azure/ai/metricsadvisor/generated/QueryASingleAnomalyDetectionConfiguration.java @@ -9,13 +9,17 @@ import com.azure.core.http.rest.RequestOptions; import com.azure.core.http.rest.Response; import com.azure.core.util.BinaryData; +import com.azure.identity.DefaultAzureCredentialBuilder; public class QueryASingleAnomalyDetectionConfiguration { public static void main(String[] args) { // BEGIN: // com.azure.ai.metricsadvisor.generated.getanomalydetectionconfiguration.queryasingleanomalydetectionconfiguration MetricsAdvisorClient metricsAdvisorClient = - new MetricsAdvisorClientBuilder().endpoint("{endpoint}").buildClient(); + new MetricsAdvisorClientBuilder() + .credential(new DefaultAzureCredentialBuilder().build()) + .endpoint("{endpoint}") + .buildClient(); RequestOptions requestOptions = new RequestOptions(); Response response = metricsAdvisorClient.getAnomalyDetectionConfigurationWithResponse( diff --git a/sdk/metricsadvisor/azure-ai-metricsadvisor/src/samples/java/com/azure/ai/metricsadvisor/generated/QueryAlertsUnderAnomalyAlertingConfiguration.java b/sdk/metricsadvisor/azure-ai-metricsadvisor/src/samples/java/com/azure/ai/metricsadvisor/generated/QueryAlertsUnderAnomalyAlertingConfiguration.java index 77cf221c4db9b..e77f29fcb3cfc 100644 --- a/sdk/metricsadvisor/azure-ai-metricsadvisor/src/samples/java/com/azure/ai/metricsadvisor/generated/QueryAlertsUnderAnomalyAlertingConfiguration.java +++ b/sdk/metricsadvisor/azure-ai-metricsadvisor/src/samples/java/com/azure/ai/metricsadvisor/generated/QueryAlertsUnderAnomalyAlertingConfiguration.java @@ -9,13 +9,17 @@ import com.azure.core.http.rest.PagedIterable; import com.azure.core.http.rest.RequestOptions; import com.azure.core.util.BinaryData; +import com.azure.identity.DefaultAzureCredentialBuilder; public class QueryAlertsUnderAnomalyAlertingConfiguration { public static void main(String[] args) { // BEGIN: // com.azure.ai.metricsadvisor.generated.getalertsbyanomalyalertingconfiguration.queryalertsunderanomalyalertingconfiguration MetricsAdvisorClient metricsAdvisorClient = - new MetricsAdvisorClientBuilder().endpoint("{endpoint}").buildClient(); + new MetricsAdvisorClientBuilder() + .credential(new DefaultAzureCredentialBuilder().build()) + .endpoint("{endpoint}") + .buildClient(); BinaryData body = BinaryData.fromString( "{\"endTime\":\"2020-02-01T00:00:00.000Z\",\"startTime\":\"2020-01-01T00:00:00.000Z\",\"timeMode\":\"AnomalyTime\"}"); diff --git a/sdk/metricsadvisor/azure-ai-metricsadvisor/src/samples/java/com/azure/ai/metricsadvisor/generated/QueryAnomaliesUnderASpecificAlert.java b/sdk/metricsadvisor/azure-ai-metricsadvisor/src/samples/java/com/azure/ai/metricsadvisor/generated/QueryAnomaliesUnderASpecificAlert.java index 0d5152552ff20..8122975f7daf5 100644 --- a/sdk/metricsadvisor/azure-ai-metricsadvisor/src/samples/java/com/azure/ai/metricsadvisor/generated/QueryAnomaliesUnderASpecificAlert.java +++ b/sdk/metricsadvisor/azure-ai-metricsadvisor/src/samples/java/com/azure/ai/metricsadvisor/generated/QueryAnomaliesUnderASpecificAlert.java @@ -9,13 +9,17 @@ import com.azure.core.http.rest.PagedIterable; import com.azure.core.http.rest.RequestOptions; import com.azure.core.util.BinaryData; +import com.azure.identity.DefaultAzureCredentialBuilder; public class QueryAnomaliesUnderASpecificAlert { public static void main(String[] args) { // BEGIN: // com.azure.ai.metricsadvisor.generated.getanomaliesfromalertbyanomalyalertingconfiguration.queryanomaliesunderaspecificalert MetricsAdvisorClient metricsAdvisorClient = - new MetricsAdvisorClientBuilder().endpoint("{endpoint}").buildClient(); + new MetricsAdvisorClientBuilder() + .credential(new DefaultAzureCredentialBuilder().build()) + .endpoint("{endpoint}") + .buildClient(); RequestOptions requestOptions = new RequestOptions(); PagedIterable response = metricsAdvisorClient.getAnomaliesFromAlertByAnomalyAlertingConfiguration( diff --git a/sdk/metricsadvisor/azure-ai-metricsadvisor/src/samples/java/com/azure/ai/metricsadvisor/generated/QueryAnomaliesUnderAnomalyDetectionConfiguration.java b/sdk/metricsadvisor/azure-ai-metricsadvisor/src/samples/java/com/azure/ai/metricsadvisor/generated/QueryAnomaliesUnderAnomalyDetectionConfiguration.java index 31f9f9a12005f..401488f33f4e7 100644 --- a/sdk/metricsadvisor/azure-ai-metricsadvisor/src/samples/java/com/azure/ai/metricsadvisor/generated/QueryAnomaliesUnderAnomalyDetectionConfiguration.java +++ b/sdk/metricsadvisor/azure-ai-metricsadvisor/src/samples/java/com/azure/ai/metricsadvisor/generated/QueryAnomaliesUnderAnomalyDetectionConfiguration.java @@ -9,13 +9,17 @@ import com.azure.core.http.rest.PagedIterable; import com.azure.core.http.rest.RequestOptions; import com.azure.core.util.BinaryData; +import com.azure.identity.DefaultAzureCredentialBuilder; public class QueryAnomaliesUnderAnomalyDetectionConfiguration { public static void main(String[] args) { // BEGIN: // com.azure.ai.metricsadvisor.generated.getanomaliesbyanomalydetectionconfiguration.queryanomaliesunderanomalydetectionconfiguration MetricsAdvisorClient metricsAdvisorClient = - new MetricsAdvisorClientBuilder().endpoint("{endpoint}").buildClient(); + new MetricsAdvisorClientBuilder() + .credential(new DefaultAzureCredentialBuilder().build()) + .endpoint("{endpoint}") + .buildClient(); BinaryData body = BinaryData.fromString( "{\"endTime\":\"2020-02-01T00:00:00.000Z\",\"filter\":{\"dimensionFilter\":[{\"dimension\":{\"city\":\"Beijing\"}}],\"severityFilter\":{\"max\":\"High\",\"min\":\"Low\"}},\"startTime\":\"2020-01-01T00:00:00.000Z\"}"); diff --git a/sdk/metricsadvisor/azure-ai-metricsadvisor/src/samples/java/com/azure/ai/metricsadvisor/generated/QueryAnomalyDetectionStatus.java b/sdk/metricsadvisor/azure-ai-metricsadvisor/src/samples/java/com/azure/ai/metricsadvisor/generated/QueryAnomalyDetectionStatus.java index 73f34975016dc..70d4d36f34c43 100644 --- a/sdk/metricsadvisor/azure-ai-metricsadvisor/src/samples/java/com/azure/ai/metricsadvisor/generated/QueryAnomalyDetectionStatus.java +++ b/sdk/metricsadvisor/azure-ai-metricsadvisor/src/samples/java/com/azure/ai/metricsadvisor/generated/QueryAnomalyDetectionStatus.java @@ -9,12 +9,16 @@ import com.azure.core.http.rest.PagedIterable; import com.azure.core.http.rest.RequestOptions; import com.azure.core.util.BinaryData; +import com.azure.identity.DefaultAzureCredentialBuilder; public class QueryAnomalyDetectionStatus { public static void main(String[] args) { // BEGIN: com.azure.ai.metricsadvisor.generated.getenrichmentstatusbymetric.queryanomalydetectionstatus MetricsAdvisorClient metricsAdvisorClient = - new MetricsAdvisorClientBuilder().endpoint("{endpoint}").buildClient(); + new MetricsAdvisorClientBuilder() + .credential(new DefaultAzureCredentialBuilder().build()) + .endpoint("{endpoint}") + .buildClient(); BinaryData body = BinaryData.fromString( "{\"endTime\":\"2020-02-01T00:00:00.000Z\",\"startTime\":\"2020-01-01T00:00:00.000Z\"}"); diff --git a/sdk/metricsadvisor/azure-ai-metricsadvisor/src/samples/java/com/azure/ai/metricsadvisor/generated/QueryDimensionValuesOfAnomalies.java b/sdk/metricsadvisor/azure-ai-metricsadvisor/src/samples/java/com/azure/ai/metricsadvisor/generated/QueryDimensionValuesOfAnomalies.java index 95f412606ebda..e96260e28bcf5 100644 --- a/sdk/metricsadvisor/azure-ai-metricsadvisor/src/samples/java/com/azure/ai/metricsadvisor/generated/QueryDimensionValuesOfAnomalies.java +++ b/sdk/metricsadvisor/azure-ai-metricsadvisor/src/samples/java/com/azure/ai/metricsadvisor/generated/QueryDimensionValuesOfAnomalies.java @@ -9,13 +9,17 @@ import com.azure.core.http.rest.PagedIterable; import com.azure.core.http.rest.RequestOptions; import com.azure.core.util.BinaryData; +import com.azure.identity.DefaultAzureCredentialBuilder; public class QueryDimensionValuesOfAnomalies { public static void main(String[] args) { // BEGIN: // com.azure.ai.metricsadvisor.generated.getdimensionofanomaliesbyanomalydetectionconfiguration.querydimensionvaluesofanomalies MetricsAdvisorClient metricsAdvisorClient = - new MetricsAdvisorClientBuilder().endpoint("{endpoint}").buildClient(); + new MetricsAdvisorClientBuilder() + .credential(new DefaultAzureCredentialBuilder().build()) + .endpoint("{endpoint}") + .buildClient(); BinaryData body = BinaryData.fromString( "{\"dimensionFilter\":{\"dimension\":{\"city\":\"Beijing\"}},\"dimensionName\":\"category\",\"endTime\":\"2020-02-01T00:00:00.000Z\",\"startTime\":\"2020-01-01T00:00:00.000Z\"}"); diff --git a/sdk/metricsadvisor/azure-ai-metricsadvisor/src/samples/java/com/azure/ai/metricsadvisor/generated/QueryIncidentsUnderASpecificAlert.java b/sdk/metricsadvisor/azure-ai-metricsadvisor/src/samples/java/com/azure/ai/metricsadvisor/generated/QueryIncidentsUnderASpecificAlert.java index 31ae2a608a42d..c5f176d024ffa 100644 --- a/sdk/metricsadvisor/azure-ai-metricsadvisor/src/samples/java/com/azure/ai/metricsadvisor/generated/QueryIncidentsUnderASpecificAlert.java +++ b/sdk/metricsadvisor/azure-ai-metricsadvisor/src/samples/java/com/azure/ai/metricsadvisor/generated/QueryIncidentsUnderASpecificAlert.java @@ -9,13 +9,17 @@ import com.azure.core.http.rest.PagedIterable; import com.azure.core.http.rest.RequestOptions; import com.azure.core.util.BinaryData; +import com.azure.identity.DefaultAzureCredentialBuilder; public class QueryIncidentsUnderASpecificAlert { public static void main(String[] args) { // BEGIN: // com.azure.ai.metricsadvisor.generated.getincidentsfromalertbyanomalyalertingconfiguration.queryincidentsunderaspecificalert MetricsAdvisorClient metricsAdvisorClient = - new MetricsAdvisorClientBuilder().endpoint("{endpoint}").buildClient(); + new MetricsAdvisorClientBuilder() + .credential(new DefaultAzureCredentialBuilder().build()) + .endpoint("{endpoint}") + .buildClient(); RequestOptions requestOptions = new RequestOptions(); PagedIterable response = metricsAdvisorClient.getIncidentsFromAlertByAnomalyAlertingConfiguration( diff --git a/sdk/metricsadvisor/azure-ai-metricsadvisor/src/samples/java/com/azure/ai/metricsadvisor/generated/QueryIncidentsUnderAnomalyDetectionConfiguration.java b/sdk/metricsadvisor/azure-ai-metricsadvisor/src/samples/java/com/azure/ai/metricsadvisor/generated/QueryIncidentsUnderAnomalyDetectionConfiguration.java index a057358351f44..61e78b8a55e3e 100644 --- a/sdk/metricsadvisor/azure-ai-metricsadvisor/src/samples/java/com/azure/ai/metricsadvisor/generated/QueryIncidentsUnderAnomalyDetectionConfiguration.java +++ b/sdk/metricsadvisor/azure-ai-metricsadvisor/src/samples/java/com/azure/ai/metricsadvisor/generated/QueryIncidentsUnderAnomalyDetectionConfiguration.java @@ -9,13 +9,17 @@ import com.azure.core.http.rest.PagedIterable; import com.azure.core.http.rest.RequestOptions; import com.azure.core.util.BinaryData; +import com.azure.identity.DefaultAzureCredentialBuilder; public class QueryIncidentsUnderAnomalyDetectionConfiguration { public static void main(String[] args) { // BEGIN: // com.azure.ai.metricsadvisor.generated.getincidentsbyanomalydetectionconfiguration.queryincidentsunderanomalydetectionconfiguration MetricsAdvisorClient metricsAdvisorClient = - new MetricsAdvisorClientBuilder().endpoint("{endpoint}").buildClient(); + new MetricsAdvisorClientBuilder() + .credential(new DefaultAzureCredentialBuilder().build()) + .endpoint("{endpoint}") + .buildClient(); BinaryData body = BinaryData.fromString( "{\"endTime\":\"2020-02-01T00:00:00.000Z\",\"filter\":{\"dimensionFilter\":[{\"dimension\":{\"city\":\"Beijing\"}}]},\"startTime\":\"2020-01-01T00:00:00.000Z\"}"); diff --git a/sdk/metricsadvisor/azure-ai-metricsadvisor/src/samples/java/com/azure/ai/metricsadvisor/generated/QueryRootCauseForIncident.java b/sdk/metricsadvisor/azure-ai-metricsadvisor/src/samples/java/com/azure/ai/metricsadvisor/generated/QueryRootCauseForIncident.java index efec1e3cf28be..279accaa6b9fc 100644 --- a/sdk/metricsadvisor/azure-ai-metricsadvisor/src/samples/java/com/azure/ai/metricsadvisor/generated/QueryRootCauseForIncident.java +++ b/sdk/metricsadvisor/azure-ai-metricsadvisor/src/samples/java/com/azure/ai/metricsadvisor/generated/QueryRootCauseForIncident.java @@ -9,13 +9,17 @@ import com.azure.core.http.rest.RequestOptions; import com.azure.core.http.rest.Response; import com.azure.core.util.BinaryData; +import com.azure.identity.DefaultAzureCredentialBuilder; public class QueryRootCauseForIncident { public static void main(String[] args) { // BEGIN: // com.azure.ai.metricsadvisor.generated.getrootcauseofincidentbyanomalydetectionconfiguration.queryrootcauseforincident MetricsAdvisorClient metricsAdvisorClient = - new MetricsAdvisorClientBuilder().endpoint("{endpoint}").buildClient(); + new MetricsAdvisorClientBuilder() + .credential(new DefaultAzureCredentialBuilder().build()) + .endpoint("{endpoint}") + .buildClient(); RequestOptions requestOptions = new RequestOptions(); Response response = metricsAdvisorClient.getRootCauseOfIncidentByAnomalyDetectionConfigurationWithResponse( diff --git a/sdk/metricsadvisor/azure-ai-metricsadvisor/src/samples/java/com/azure/ai/metricsadvisor/generated/QuerySeriesEnrichedByAnomalyDetection.java b/sdk/metricsadvisor/azure-ai-metricsadvisor/src/samples/java/com/azure/ai/metricsadvisor/generated/QuerySeriesEnrichedByAnomalyDetection.java index dbb000e924e1f..1c9b43b85cb66 100644 --- a/sdk/metricsadvisor/azure-ai-metricsadvisor/src/samples/java/com/azure/ai/metricsadvisor/generated/QuerySeriesEnrichedByAnomalyDetection.java +++ b/sdk/metricsadvisor/azure-ai-metricsadvisor/src/samples/java/com/azure/ai/metricsadvisor/generated/QuerySeriesEnrichedByAnomalyDetection.java @@ -9,13 +9,17 @@ import com.azure.core.http.rest.RequestOptions; import com.azure.core.http.rest.Response; import com.azure.core.util.BinaryData; +import com.azure.identity.DefaultAzureCredentialBuilder; public class QuerySeriesEnrichedByAnomalyDetection { public static void main(String[] args) { // BEGIN: // com.azure.ai.metricsadvisor.generated.getseriesbyanomalydetectionconfiguration.queryseriesenrichedbyanomalydetection MetricsAdvisorClient metricsAdvisorClient = - new MetricsAdvisorClientBuilder().endpoint("{endpoint}").buildClient(); + new MetricsAdvisorClientBuilder() + .credential(new DefaultAzureCredentialBuilder().build()) + .endpoint("{endpoint}") + .buildClient(); BinaryData body = BinaryData.fromString( "{\"endTime\":\"2020-02-01T00:00:00.000Z\",\"series\":[{\"dimension\":{\"category\":\"Jewelry\",\"city\":\"Beijing\"}}],\"startTime\":\"2020-01-01T00:00:00.000Z\"}"); diff --git a/sdk/metricsadvisor/azure-ai-metricsadvisor/src/samples/java/com/azure/ai/metricsadvisor/generated/ResetDataIngestionStatusByDataFeedToBackfillData.java b/sdk/metricsadvisor/azure-ai-metricsadvisor/src/samples/java/com/azure/ai/metricsadvisor/generated/ResetDataIngestionStatusByDataFeedToBackfillData.java index 8cd85e3886c09..d7d0823af98d5 100644 --- a/sdk/metricsadvisor/azure-ai-metricsadvisor/src/samples/java/com/azure/ai/metricsadvisor/generated/ResetDataIngestionStatusByDataFeedToBackfillData.java +++ b/sdk/metricsadvisor/azure-ai-metricsadvisor/src/samples/java/com/azure/ai/metricsadvisor/generated/ResetDataIngestionStatusByDataFeedToBackfillData.java @@ -9,13 +9,17 @@ import com.azure.core.http.rest.RequestOptions; import com.azure.core.http.rest.Response; import com.azure.core.util.BinaryData; +import com.azure.identity.DefaultAzureCredentialBuilder; public class ResetDataIngestionStatusByDataFeedToBackfillData { public static void main(String[] args) { // BEGIN: // com.azure.ai.metricsadvisor.generated.resetdatafeedingestionstatus.resetdataingestionstatusbydatafeedtobackfilldata MetricsAdvisorClient metricsAdvisorClient = - new MetricsAdvisorClientBuilder().endpoint("{endpoint}").buildClient(); + new MetricsAdvisorClientBuilder() + .credential(new DefaultAzureCredentialBuilder().build()) + .endpoint("{endpoint}") + .buildClient(); BinaryData body = BinaryData.fromString( "{\"endTime\":\"2020-02-01T00:00:00.000Z\",\"startTime\":\"2020-01-01T00:00:00.000Z\"}"); diff --git a/sdk/metricsadvisor/azure-ai-metricsadvisor/src/samples/java/com/azure/ai/metricsadvisor/generated/UpdateADataFeed.java b/sdk/metricsadvisor/azure-ai-metricsadvisor/src/samples/java/com/azure/ai/metricsadvisor/generated/UpdateADataFeed.java index b0b861cc4f89a..c5bd6ab901f41 100644 --- a/sdk/metricsadvisor/azure-ai-metricsadvisor/src/samples/java/com/azure/ai/metricsadvisor/generated/UpdateADataFeed.java +++ b/sdk/metricsadvisor/azure-ai-metricsadvisor/src/samples/java/com/azure/ai/metricsadvisor/generated/UpdateADataFeed.java @@ -9,12 +9,16 @@ import com.azure.core.http.rest.RequestOptions; import com.azure.core.http.rest.Response; import com.azure.core.util.BinaryData; +import com.azure.identity.DefaultAzureCredentialBuilder; public class UpdateADataFeed { public static void main(String[] args) { // BEGIN: com.azure.ai.metricsadvisor.generated.updatedatafeed.updateadatafeed MetricsAdvisorClient metricsAdvisorClient = - new MetricsAdvisorClientBuilder().endpoint("{endpoint}").buildClient(); + new MetricsAdvisorClientBuilder() + .credential(new DefaultAzureCredentialBuilder().build()) + .endpoint("{endpoint}") + .buildClient(); BinaryData body = BinaryData.fromString("{\"dataFeedName\":\"Sample - cost/revenue - city/category\"}"); RequestOptions requestOptions = new RequestOptions(); Response response = diff --git a/sdk/metricsadvisor/azure-ai-metricsadvisor/src/samples/java/com/azure/ai/metricsadvisor/generated/UpdateADataSourceCredential.java b/sdk/metricsadvisor/azure-ai-metricsadvisor/src/samples/java/com/azure/ai/metricsadvisor/generated/UpdateADataSourceCredential.java index baa89e000736d..e1232a7174bc7 100644 --- a/sdk/metricsadvisor/azure-ai-metricsadvisor/src/samples/java/com/azure/ai/metricsadvisor/generated/UpdateADataSourceCredential.java +++ b/sdk/metricsadvisor/azure-ai-metricsadvisor/src/samples/java/com/azure/ai/metricsadvisor/generated/UpdateADataSourceCredential.java @@ -9,12 +9,16 @@ import com.azure.core.http.rest.RequestOptions; import com.azure.core.http.rest.Response; import com.azure.core.util.BinaryData; +import com.azure.identity.DefaultAzureCredentialBuilder; public class UpdateADataSourceCredential { public static void main(String[] args) { // BEGIN: com.azure.ai.metricsadvisor.generated.updatecredential.updateadatasourcecredential MetricsAdvisorClient metricsAdvisorClient = - new MetricsAdvisorClientBuilder().endpoint("{endpoint}").buildClient(); + new MetricsAdvisorClientBuilder() + .credential(new DefaultAzureCredentialBuilder().build()) + .endpoint("{endpoint}") + .buildClient(); BinaryData body = BinaryData.fromString("{\"dataSourceCredentialDescription\":\"This is a data source credential\"}"); RequestOptions requestOptions = new RequestOptions(); diff --git a/sdk/metricsadvisor/azure-ai-metricsadvisor/src/samples/java/com/azure/ai/metricsadvisor/generated/UpdateAHook.java b/sdk/metricsadvisor/azure-ai-metricsadvisor/src/samples/java/com/azure/ai/metricsadvisor/generated/UpdateAHook.java index 5288560592d2f..561d3fe7b838e 100644 --- a/sdk/metricsadvisor/azure-ai-metricsadvisor/src/samples/java/com/azure/ai/metricsadvisor/generated/UpdateAHook.java +++ b/sdk/metricsadvisor/azure-ai-metricsadvisor/src/samples/java/com/azure/ai/metricsadvisor/generated/UpdateAHook.java @@ -9,12 +9,16 @@ import com.azure.core.http.rest.RequestOptions; import com.azure.core.http.rest.Response; import com.azure.core.util.BinaryData; +import com.azure.identity.DefaultAzureCredentialBuilder; public class UpdateAHook { public static void main(String[] args) { // BEGIN: com.azure.ai.metricsadvisor.generated.updatehook.updateahook MetricsAdvisorClient metricsAdvisorClient = - new MetricsAdvisorClientBuilder().endpoint("{endpoint}").buildClient(); + new MetricsAdvisorClientBuilder() + .credential(new DefaultAzureCredentialBuilder().build()) + .endpoint("{endpoint}") + .buildClient(); BinaryData body = BinaryData.fromString("{\"description\":\"This is a webhook.\"}"); RequestOptions requestOptions = new RequestOptions(); Response response = diff --git a/sdk/metricsadvisor/azure-ai-metricsadvisor/src/samples/java/com/azure/ai/metricsadvisor/generated/UpdateAnomalyAlertingConfiguration.java b/sdk/metricsadvisor/azure-ai-metricsadvisor/src/samples/java/com/azure/ai/metricsadvisor/generated/UpdateAnomalyAlertingConfiguration.java index d65289eaf38f7..ea2f9d144dbc0 100644 --- a/sdk/metricsadvisor/azure-ai-metricsadvisor/src/samples/java/com/azure/ai/metricsadvisor/generated/UpdateAnomalyAlertingConfiguration.java +++ b/sdk/metricsadvisor/azure-ai-metricsadvisor/src/samples/java/com/azure/ai/metricsadvisor/generated/UpdateAnomalyAlertingConfiguration.java @@ -9,13 +9,17 @@ import com.azure.core.http.rest.RequestOptions; import com.azure.core.http.rest.Response; import com.azure.core.util.BinaryData; +import com.azure.identity.DefaultAzureCredentialBuilder; public class UpdateAnomalyAlertingConfiguration { public static void main(String[] args) { // BEGIN: // com.azure.ai.metricsadvisor.generated.updateanomalyalertingconfiguration.updateanomalyalertingconfiguration MetricsAdvisorClient metricsAdvisorClient = - new MetricsAdvisorClientBuilder().endpoint("{endpoint}").buildClient(); + new MetricsAdvisorClientBuilder() + .credential(new DefaultAzureCredentialBuilder().build()) + .endpoint("{endpoint}") + .buildClient(); BinaryData body = BinaryData.fromString( "{\"name\":\"alerting configuration name\",\"description\":\"this is an anomaly alerting configuration\",\"crossMetricsOperator\":\"AND\",\"hookIds\":[\"00000000-0000-0000-0000-000000000001\"],\"metricAlertingConfigurations\":[{\"anomalyDetectionConfigurationId\":\"33333333-3333-3333-3333-000000000001\",\"anomalyScopeType\":\"All\",\"negationOperation\":false,\"severityFilter\":{\"maxAlertSeverity\":\"High\",\"minAlertSeverity\":\"Medium\"},\"snoozeFilter\":{\"autoSnooze\":0,\"onlyForSuccessive\":true,\"snoozeScope\":\"Series\"}},{\"anomalyDetectionConfigurationId\":\"33333333-3333-3333-3333-000000000002\",\"anomalyScopeType\":\"Dimension\",\"dimensionAnomalyScope\":{\"dimension\":{\"city\":\"Beijing\"}},\"negationOperation\":false,\"severityFilter\":{\"maxAlertSeverity\":\"High\",\"minAlertSeverity\":\"Low\"},\"snoozeFilter\":{\"autoSnooze\":0,\"onlyForSuccessive\":true,\"snoozeScope\":\"Series\"},\"valueFilter\":{\"direction\":\"Both\",\"lower\":0,\"upper\":1000}}]}"); diff --git a/sdk/metricsadvisor/azure-ai-metricsadvisor/src/samples/java/com/azure/ai/metricsadvisor/generated/UpdateAnomalyDetectionConfiguration.java b/sdk/metricsadvisor/azure-ai-metricsadvisor/src/samples/java/com/azure/ai/metricsadvisor/generated/UpdateAnomalyDetectionConfiguration.java index c80e47f71a224..06e8ab91774f1 100644 --- a/sdk/metricsadvisor/azure-ai-metricsadvisor/src/samples/java/com/azure/ai/metricsadvisor/generated/UpdateAnomalyDetectionConfiguration.java +++ b/sdk/metricsadvisor/azure-ai-metricsadvisor/src/samples/java/com/azure/ai/metricsadvisor/generated/UpdateAnomalyDetectionConfiguration.java @@ -9,13 +9,17 @@ import com.azure.core.http.rest.RequestOptions; import com.azure.core.http.rest.Response; import com.azure.core.util.BinaryData; +import com.azure.identity.DefaultAzureCredentialBuilder; public class UpdateAnomalyDetectionConfiguration { public static void main(String[] args) { // BEGIN: // com.azure.ai.metricsadvisor.generated.updateanomalydetectionconfiguration.updateanomalydetectionconfiguration MetricsAdvisorClient metricsAdvisorClient = - new MetricsAdvisorClientBuilder().endpoint("{endpoint}").buildClient(); + new MetricsAdvisorClientBuilder() + .credential(new DefaultAzureCredentialBuilder().build()) + .endpoint("{endpoint}") + .buildClient(); BinaryData body = BinaryData.fromString( "{\"wholeMetricConfiguration\":{\"smartDetectionCondition\":{\"sensitivity\":91}}}"); diff --git a/sdk/metricsadvisor/azure-ai-metricsadvisor/src/test/java/com/azure/ai/metricsadvisor/generated/MetricsAdvisorClientTestBase.java b/sdk/metricsadvisor/azure-ai-metricsadvisor/src/test/java/com/azure/ai/metricsadvisor/generated/MetricsAdvisorClientTestBase.java index 03060d493b0ea..ed7afd2b643f6 100644 --- a/sdk/metricsadvisor/azure-ai-metricsadvisor/src/test/java/com/azure/ai/metricsadvisor/generated/MetricsAdvisorClientTestBase.java +++ b/sdk/metricsadvisor/azure-ai-metricsadvisor/src/test/java/com/azure/ai/metricsadvisor/generated/MetricsAdvisorClientTestBase.java @@ -6,12 +6,16 @@ import com.azure.ai.metricsadvisor.MetricsAdvisorClient; import com.azure.ai.metricsadvisor.MetricsAdvisorClientBuilder; +import com.azure.core.credential.AccessToken; import com.azure.core.http.HttpClient; import com.azure.core.http.policy.HttpLogDetailLevel; import com.azure.core.http.policy.HttpLogOptions; import com.azure.core.test.TestBase; import com.azure.core.test.TestMode; import com.azure.core.util.Configuration; +import com.azure.identity.DefaultAzureCredentialBuilder; +import java.time.OffsetDateTime; +import reactor.core.publisher.Mono; class MetricsAdvisorClientTestBase extends TestBase { protected MetricsAdvisorClient metricsAdvisorClient; @@ -24,9 +28,15 @@ protected void beforeTest() { .httpClient(HttpClient.createDefault()) .httpLogOptions(new HttpLogOptions().setLogLevel(HttpLogDetailLevel.BASIC)); if (getTestMode() == TestMode.PLAYBACK) { - metricsAdvisorClientbuilder.httpClient(interceptorManager.getPlaybackClient()); + metricsAdvisorClientbuilder + .httpClient(interceptorManager.getPlaybackClient()) + .credential(request -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX))); } else if (getTestMode() == TestMode.RECORD) { - metricsAdvisorClientbuilder.addPolicy(interceptorManager.getRecordPolicy()); + metricsAdvisorClientbuilder + .addPolicy(interceptorManager.getRecordPolicy()) + .credential(new DefaultAzureCredentialBuilder().build()); + } else if (getTestMode() == TestMode.LIVE) { + metricsAdvisorClientbuilder.credential(new DefaultAzureCredentialBuilder().build()); } metricsAdvisorClient = metricsAdvisorClientbuilder.buildClient(); } diff --git a/sdk/metricsadvisor/azure-ai-metricsadvisor/swagger/README_SPEC.md b/sdk/metricsadvisor/azure-ai-metricsadvisor/swagger/README_SPEC.md index 56f3d953fac48..76dfa99249b77 100644 --- a/sdk/metricsadvisor/azure-ai-metricsadvisor/swagger/README_SPEC.md +++ b/sdk/metricsadvisor/azure-ai-metricsadvisor/swagger/README_SPEC.md @@ -27,4 +27,7 @@ context-client-method-parameter: true azure-arm: false service-versions: - '1.0' + +security: AADToken +security-scopes: https://cognitiveservices.azure.com/.default ```