diff --git a/sdk/metricsadvisor/ai-metrics-advisor/package.json b/sdk/metricsadvisor/ai-metrics-advisor/package.json index 683d70fcd882..b8692c3c75a9 100644 --- a/sdk/metricsadvisor/ai-metrics-advisor/package.json +++ b/sdk/metricsadvisor/ai-metrics-advisor/package.json @@ -85,6 +85,7 @@ "@azure/core-client": "^1.0.0", "@azure/core-rest-pipeline": "^1.1.0", "@azure/core-tracing": "1.0.0-preview.13", + "@azure/core-http-compat": "^1.2.0", "@azure/logger": "^1.0.0", "tslib": "^2.2.0" }, diff --git a/sdk/metricsadvisor/ai-metrics-advisor/review/ai-metrics-advisor.api.md b/sdk/metricsadvisor/ai-metrics-advisor/review/ai-metrics-advisor.api.md index e464ae166597..d50e87c9819b 100644 --- a/sdk/metricsadvisor/ai-metrics-advisor/review/ai-metrics-advisor.api.md +++ b/sdk/metricsadvisor/ai-metrics-advisor/review/ai-metrics-advisor.api.md @@ -6,7 +6,7 @@ /// -import { CommonClientOptions } from '@azure/core-client'; +import { ExtendedCommonClientOptions } from '@azure/core-http-compat'; import { FullOperationResponse } from '@azure/core-client'; import { OperationOptions } from '@azure/core-client'; import { PagedAsyncIterableIterator } from '@azure/core-paging'; @@ -885,7 +885,7 @@ export class MetricsAdvisorAdministrationClient { } // @public -export interface MetricsAdvisorAdministrationClientOptions extends CommonClientOptions { +export interface MetricsAdvisorAdministrationClientOptions extends ExtendedCommonClientOptions { } // @public @@ -910,7 +910,7 @@ export class MetricsAdvisorClient { } // @public -export interface MetricsAdvisorClientOptions extends CommonClientOptions { +export interface MetricsAdvisorClientOptions extends ExtendedCommonClientOptions { } // @public diff --git a/sdk/metricsadvisor/ai-metrics-advisor/src/generated/generatedClient.ts b/sdk/metricsadvisor/ai-metrics-advisor/src/generated/generatedClient.ts index c446a7dbb324..c5066661fea5 100644 --- a/sdk/metricsadvisor/ai-metrics-advisor/src/generated/generatedClient.ts +++ b/sdk/metricsadvisor/ai-metrics-advisor/src/generated/generatedClient.ts @@ -7,9 +7,9 @@ */ import * as coreClient from "@azure/core-client"; +import * as coreHttpCompat from "@azure/core-http-compat"; import * as Parameters from "./models/parameters"; import * as Mappers from "./models/mappers"; -import { GeneratedClientContext } from "./generatedClientContext"; import { GeneratedClientOptionalParams, GetActiveSeriesCountOptionalParams, @@ -156,7 +156,9 @@ import { } from "./models"; /** @internal */ -export class GeneratedClient extends GeneratedClientContext { +export class GeneratedClient extends coreHttpCompat.ExtendedServiceClient { + endpoint: string; + /** * Initializes a new instance of the GeneratedClient class. * @param endpoint Supported Cognitive Services endpoints (protocol and hostname, for example: @@ -164,7 +166,35 @@ export class GeneratedClient extends GeneratedClientContext { * @param options The parameter options */ constructor(endpoint: string, options?: GeneratedClientOptionalParams) { - super(endpoint, options); + if (endpoint === undefined) { + throw new Error("'endpoint' cannot be null"); + } + + // Initializing default values for options + if (!options) { + options = {}; + } + const defaults: GeneratedClientOptionalParams = { + requestContentType: "application/json; charset=utf-8" + }; + + const packageDetails = `azsdk-js-ai-metrics-advisor/1.0.1`; + const userAgentPrefix = + options.userAgentOptions && options.userAgentOptions.userAgentPrefix + ? `${options.userAgentOptions.userAgentPrefix} ${packageDetails}` + : `${packageDetails}`; + + const optionsWithDefaults = { + ...defaults, + ...options, + userAgentOptions: { + userAgentPrefix + }, + baseUri: options.endpoint || "{endpoint}/metricsadvisor/v1.0" + }; + super(optionsWithDefaults); + // Parameter assignments + this.endpoint = endpoint; } /** diff --git a/sdk/metricsadvisor/ai-metrics-advisor/src/generated/index.ts b/sdk/metricsadvisor/ai-metrics-advisor/src/generated/index.ts index 3aebf3c9a56c..657fb6d642e1 100644 --- a/sdk/metricsadvisor/ai-metrics-advisor/src/generated/index.ts +++ b/sdk/metricsadvisor/ai-metrics-advisor/src/generated/index.ts @@ -8,4 +8,3 @@ export * from "./models"; export { GeneratedClient } from "./generatedClient"; -export { GeneratedClientContext } from "./generatedClientContext"; diff --git a/sdk/metricsadvisor/ai-metrics-advisor/src/generated/models/index.ts b/sdk/metricsadvisor/ai-metrics-advisor/src/generated/models/index.ts index 54175a9bd500..c34252d3b823 100644 --- a/sdk/metricsadvisor/ai-metrics-advisor/src/generated/models/index.ts +++ b/sdk/metricsadvisor/ai-metrics-advisor/src/generated/models/index.ts @@ -7,6 +7,7 @@ */ import * as coreClient from "@azure/core-client"; +import * as coreHttpCompat from "@azure/core-http-compat"; export type DataSourceCredentialUnion = | DataSourceCredential @@ -2445,7 +2446,7 @@ export type GetAnomalyDetectionConfigurationsByMetricNextResponse = AnomalyDetec /** Optional parameters. */ export interface GeneratedClientOptionalParams - extends coreClient.ServiceClientOptions { + extends coreHttpCompat.ExtendedServiceClientOptions { /** Overrides client endpoint. */ endpoint?: string; } diff --git a/sdk/metricsadvisor/ai-metrics-advisor/src/metricsAdvisorAdministrationClient.ts b/sdk/metricsadvisor/ai-metrics-advisor/src/metricsAdvisorAdministrationClient.ts index e7179d740df8..3cd97651e473 100644 --- a/sdk/metricsadvisor/ai-metrics-advisor/src/metricsAdvisorAdministrationClient.ts +++ b/sdk/metricsadvisor/ai-metrics-advisor/src/metricsAdvisorAdministrationClient.ts @@ -7,7 +7,7 @@ import { bearerTokenAuthenticationPolicy, InternalPipelineOptions, } from "@azure/core-rest-pipeline"; -import { FullOperationResponse, OperationOptions, CommonClientOptions } from "@azure/core-client"; +import { FullOperationResponse, OperationOptions } from "@azure/core-client"; import { isTokenCredential, TokenCredential } from "@azure/core-auth"; import { PagedAsyncIterableIterator, PageSettings } from "@azure/core-paging"; import "@azure/core-paging"; @@ -68,11 +68,12 @@ import { MetricsAdvisorLoggingAllowedHeaderNames, MetricsAdvisorLoggingAllowedQueryParameters, } from "./constants"; +import { ExtendedCommonClientOptions } from "@azure/core-http-compat"; /** * Client options used to configure API requests. */ -export interface MetricsAdvisorAdministrationClientOptions extends CommonClientOptions {} +export interface MetricsAdvisorAdministrationClientOptions extends ExtendedCommonClientOptions {} /** * Options for listing data feed ingestion status diff --git a/sdk/metricsadvisor/ai-metrics-advisor/src/metricsAdvisorClient.ts b/sdk/metricsadvisor/ai-metrics-advisor/src/metricsAdvisorClient.ts index 72e51920f04f..a9d2ec81cf24 100644 --- a/sdk/metricsadvisor/ai-metrics-advisor/src/metricsAdvisorClient.ts +++ b/sdk/metricsadvisor/ai-metrics-advisor/src/metricsAdvisorClient.ts @@ -7,9 +7,10 @@ import { bearerTokenAuthenticationPolicy, InternalPipelineOptions, } from "@azure/core-rest-pipeline"; -import { OperationOptions, CommonClientOptions } from "@azure/core-client"; import { PagedAsyncIterableIterator, PageSettings } from "@azure/core-paging"; import { isTokenCredential, TokenCredential } from "@azure/core-auth"; +import { OperationOptions } from "@azure/core-client"; +import { ExtendedCommonClientOptions } from "@azure/core-http-compat"; import { GeneratedClient } from "./generated/generatedClient"; import { createSpan } from "./tracing"; import { @@ -49,7 +50,7 @@ import { logger } from "./logger"; /** * Client options used to configure Metrics Advisor API requests. */ -export interface MetricsAdvisorClientOptions extends CommonClientOptions {} +export interface MetricsAdvisorClientOptions extends ExtendedCommonClientOptions {} /** * Options for listing incidents for detection configurations diff --git a/sdk/metricsadvisor/ai-metrics-advisor/swagger/README.md b/sdk/metricsadvisor/ai-metrics-advisor/swagger/README.md index 8c44d5e10dfa..894aa610a056 100644 --- a/sdk/metricsadvisor/ai-metrics-advisor/swagger/README.md +++ b/sdk/metricsadvisor/ai-metrics-advisor/swagger/README.md @@ -18,11 +18,12 @@ input-file: https://raw.githubusercontent.com/Azure/azure-rest-api-specs/08f5e39 add-credentials: false override-client-name: GeneratedClient use-extension: - "@autorest/typescript": "6.0.0-beta.15" + "@autorest/typescript": "6.0.0-beta.16" disable-async-iterators: true hide-clients: true package-version: 1.0.1 typescript: true +core-http-compat-mode: true ``` ## Customizations for Track 2 Generator