diff --git a/packages/typespec-test/test/NetworkAnalytics.Management/generated/typespec-ts/sdk/test/arm-test/review/arm-networkanalytics.api.md b/packages/typespec-test/test/NetworkAnalytics.Management/generated/typespec-ts/sdk/test/arm-test/review/arm-networkanalytics.api.md index 5eddb8970e..8232a1473a 100644 --- a/packages/typespec-test/test/NetworkAnalytics.Management/generated/typespec-ts/sdk/test/arm-test/review/arm-networkanalytics.api.md +++ b/packages/typespec-test/test/NetworkAnalytics.Management/generated/typespec-ts/sdk/test/arm-test/review/arm-networkanalytics.api.md @@ -28,6 +28,16 @@ export interface AccountSasToken { // @public export type ActionType = string; +// @public +export enum AzureClouds { + AZURE_CHINA_CLOUD = "AZURE_CHINA_CLOUD", + AZURE_PUBLIC_CLOUD = "AZURE_PUBLIC_CLOUD", + AZURE_US_GOVERNMENT = "AZURE_US_GOVERNMENT" +} + +// @public +export type AzureSupportedClouds = `${AzureClouds}`; + // @public export interface ConsumptionEndpointsProperties { readonly fileAccessResourceId?: string; @@ -442,6 +452,7 @@ export class NetworkAnalyticsApi { // @public export interface NetworkAnalyticsApiOptionalParams extends ClientOptions { apiVersion?: string; + cloudSetting?: AzureSupportedClouds; } // @public diff --git a/packages/typespec-test/test/NetworkAnalytics.Management/generated/typespec-ts/sdk/test/arm-test/src/api/networkAnalyticsApiContext.ts b/packages/typespec-test/test/NetworkAnalytics.Management/generated/typespec-ts/sdk/test/arm-test/src/api/networkAnalyticsApiContext.ts index 0de173ee97..7cde06a1d9 100644 --- a/packages/typespec-test/test/NetworkAnalytics.Management/generated/typespec-ts/sdk/test/arm-test/src/api/networkAnalyticsApiContext.ts +++ b/packages/typespec-test/test/NetworkAnalytics.Management/generated/typespec-ts/sdk/test/arm-test/src/api/networkAnalyticsApiContext.ts @@ -3,6 +3,10 @@ import { logger } from "../logger.js"; import { KnownVersions } from "../models/models.js"; +import { + AzureSupportedClouds, + getArmEndpoint, +} from "../static-helpers/cloudSettingHelpers.js"; import { Client, ClientOptions, getClient } from "@azure-rest/core-client"; import { TokenCredential } from "@azure/core-auth"; @@ -19,6 +23,8 @@ export interface NetworkAnalyticsApiOptionalParams extends ClientOptions { /** The API version to use for this operation. */ /** Known values of {@link KnownVersions} that the service accepts. */ apiVersion?: string; + /** Specifies the Azure cloud environment for the client. */ + cloudSetting?: AzureSupportedClouds; } export function createNetworkAnalyticsApi( @@ -26,7 +32,10 @@ export function createNetworkAnalyticsApi( subscriptionId: string, options: NetworkAnalyticsApiOptionalParams = {}, ): NetworkAnalyticsApiContext { - const endpointUrl = options.endpoint ?? "https://management.azure.com"; + const endpointUrl = + options.endpoint ?? + getArmEndpoint(options.cloudSetting) ?? + "https://management.azure.com"; const prefixFromOptions = options?.userAgentOptions?.userAgentPrefix; const userAgentInfo = `azsdk-js-arm-networkanalytics/1.0.0-beta.1`; const userAgentPrefix = prefixFromOptions diff --git a/packages/typespec-test/test/NetworkAnalytics.Management/generated/typespec-ts/sdk/test/arm-test/src/index.ts b/packages/typespec-test/test/NetworkAnalytics.Management/generated/typespec-ts/sdk/test/arm-test/src/index.ts index 686df7f842..01a8d58590 100644 --- a/packages/typespec-test/test/NetworkAnalytics.Management/generated/typespec-ts/sdk/test/arm-test/src/index.ts +++ b/packages/typespec-test/test/NetworkAnalytics.Management/generated/typespec-ts/sdk/test/arm-test/src/index.ts @@ -1,6 +1,10 @@ // Copyright (c) Microsoft Corporation. // Licensed under the MIT License. +import { + AzureClouds, + AzureSupportedClouds, +} from "./static-helpers/cloudSettingHelpers.js"; import { PageSettings, ContinuablePage, @@ -104,3 +108,4 @@ export { OperationsOperations, } from "./classic/index.js"; export { PageSettings, ContinuablePage, PagedAsyncIterableIterator }; +export { AzureClouds, AzureSupportedClouds }; diff --git a/packages/typespec-test/test/NetworkAnalytics.Management/generated/typespec-ts/sdk/test/arm-test/src/static-helpers/cloudSettingHelpers.ts b/packages/typespec-test/test/NetworkAnalytics.Management/generated/typespec-ts/sdk/test/arm-test/src/static-helpers/cloudSettingHelpers.ts new file mode 100644 index 0000000000..dff63d6324 --- /dev/null +++ b/packages/typespec-test/test/NetworkAnalytics.Management/generated/typespec-ts/sdk/test/arm-test/src/static-helpers/cloudSettingHelpers.ts @@ -0,0 +1,35 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +/** An enum to describe Azure Cloud. */ +export enum AzureClouds { + /** Azure public cloud, which is the default cloud for Azure SDKs. */ + AZURE_PUBLIC_CLOUD = "AZURE_PUBLIC_CLOUD", + /** Azure China cloud */ + AZURE_CHINA_CLOUD = "AZURE_CHINA_CLOUD", + /** Azure US government cloud */ + AZURE_US_GOVERNMENT = "AZURE_US_GOVERNMENT", +} + +/** The supported values for cloud setting as a string literal type */ +export type AzureSupportedClouds = `${AzureClouds}`; + +export function getArmEndpoint( + cloudSetting?: AzureSupportedClouds, +): string | undefined { + if (cloudSetting === undefined) { + return undefined; + } + const cloudEndpoints: Record = { + AZURE_CHINA_CLOUD: "https://management.chinacloudapi.cn/", + AZURE_US_GOVERNMENT: "https://management.usgovcloudapi.net/", + AZURE_PUBLIC_CLOUD: "https://management.azure.com/", + }; + if (cloudSetting in cloudEndpoints) { + return cloudEndpoints[cloudSetting]; + } else { + throw new Error( + `Unknown cloud setting: ${cloudSetting}. Please refer to the enum AzureClouds for possible values.`, + ); + } +} diff --git a/packages/typespec-ts/src/framework/load-static-helpers.ts b/packages/typespec-ts/src/framework/load-static-helpers.ts index d3921dfe28..08b0d69816 100644 --- a/packages/typespec-ts/src/framework/load-static-helpers.ts +++ b/packages/typespec-ts/src/framework/load-static-helpers.ts @@ -2,6 +2,7 @@ import { readdir, stat, readFile } from "fs/promises"; import * as path from "path"; import { ClassDeclaration, + EnumDeclaration, FunctionDeclaration, InterfaceDeclaration, Project, @@ -15,7 +16,7 @@ import { ModularEmitterOptions } from "../modular/interfaces.js"; export const SourceFileSymbol = Symbol("SourceFile"); export interface StaticHelperMetadata { name: string; - kind: "function" | "interface" | "typeAlias" | "class"; + kind: "function" | "interface" | "typeAlias" | "class" | "enum"; location: string; [SourceFileSymbol]?: SourceFile; } @@ -137,6 +138,7 @@ function getDeclarationByMetadata( | FunctionDeclaration | TypeAliasDeclaration | InterfaceDeclaration + | EnumDeclaration | undefined { switch (declaration.kind) { case "class": @@ -147,6 +149,8 @@ function getDeclarationByMetadata( return file.getInterface(declaration.name); case "typeAlias": return file.getTypeAlias(declaration.name); + case "enum": + return file.getEnum(declaration.name); default: throw new Error( `invalid helper kind ${declaration.kind}\nAll helpers provided to loadStaticHelpers are of kind: function, interface, typeAlias, class` diff --git a/packages/typespec-ts/src/index.ts b/packages/typespec-ts/src/index.ts index 6ab4454b9c..91e47d20c4 100644 --- a/packages/typespec-ts/src/index.ts +++ b/packages/typespec-ts/src/index.ts @@ -11,6 +11,7 @@ import { import { EmitContext, Program } from "@typespec/compiler"; import { GenerationDirDetail, SdkContext } from "./utils/interfaces.js"; import { + CloudSettingHelpers, MultipartHelpers, PagingHelpers, PollingHelpers, @@ -130,7 +131,8 @@ export async function $onEmit(context: EmitContext) { ...PagingHelpers, ...PollingHelpers, ...UrlTemplateHelpers, - ...MultipartHelpers + ...MultipartHelpers, + ...CloudSettingHelpers }, { sourcesDir: dpgContext.generationPathDetail?.modularSourcesDir, diff --git a/packages/typespec-ts/src/lib.ts b/packages/typespec-ts/src/lib.ts index c8ca7dc6ed..e2550feb7b 100644 --- a/packages/typespec-ts/src/lib.ts +++ b/packages/typespec-ts/src/lib.ts @@ -356,6 +356,12 @@ const libDef = { messages: { default: paramMessage`The property name ${"propertyName"} has conflicts with others and please use @clientName to rename it.` } + }, + "parameter-name-conflict": { + severity: "warning", + messages: { + default: paramMessage`The parameter name ${"parameterName"} has conflicts with others and please use @clientName to rename it.` + } } }, emitter: { diff --git a/packages/typespec-ts/src/modular/buildClientContext.ts b/packages/typespec-ts/src/modular/buildClientContext.ts index d3c6339d00..76b86f2d84 100644 --- a/packages/typespec-ts/src/modular/buildClientContext.ts +++ b/packages/typespec-ts/src/modular/buildClientContext.ts @@ -33,6 +33,9 @@ import { import { getModularClientOptions } from "../utils/clientUtils.js"; import { useContext } from "../contextManager.js"; import { refkey } from "../framework/refkey.js"; +import { reportDiagnostic } from "../lib.js"; +import { NoTarget } from "@typespec/compiler"; +import { CloudSettingHelpers } from "./static-helpers-metadata.js"; /** * This function gets the path of the file containing the modular client context @@ -100,25 +103,46 @@ export function buildClientContext( }) }); + const propertiesInOptions = getClientParameters(client, dpgContext, { + optionalOnly: true + }) + .filter((p) => p.name !== "endpoint") + .map((p) => { + return { + name: getClientParameterName(p), + type: + p.name.toLowerCase() === "apiversion" + ? "string" + : getTypeExpression(dpgContext, p.type), + hasQuestionToken: true, + docs: getDocsWithKnownVersion(dpgContext, p) + }; + }); + if (dpgContext.arm) { + propertiesInOptions.push({ + name: "cloudSetting", + type: `${resolveReference(CloudSettingHelpers.AzureSupportedClouds)}`, + hasQuestionToken: true, + docs: [`Specifies the Azure cloud environment for the client.`] + }); + } + // check if we have duplication options + const existingOptionNames = new Set(); + for (const property of propertiesInOptions) { + if (existingOptionNames.has(property.name)) { + reportDiagnostic(dpgContext.program, { + code: "parameter-name-conflict", + format: { parameterName: property.name }, + target: NoTarget + }); + } + existingOptionNames.add(property.name); + } clientContextFile.addInterface({ name: `${getClassicalClientName(client)}OptionalParams`, isExported: true, extends: [resolveReference(dependencies.ClientOptions)], - properties: getClientParameters(client, dpgContext, { - optionalOnly: true - }) - .filter((p) => p.name !== "endpoint") - .map((p) => { - return { - name: getClientParameterName(p), - type: - p.name.toLowerCase() === "apiversion" - ? "string" - : getTypeExpression(dpgContext, p.type), - hasQuestionToken: true, - docs: getDocsWithKnownVersion(dpgContext, p) - }; - }), + properties: propertiesInOptions, docs: ["Optional parameters for the client."] }); diff --git a/packages/typespec-ts/src/modular/buildRootIndex.ts b/packages/typespec-ts/src/modular/buildRootIndex.ts index 56f2e97197..9ea67381f7 100644 --- a/packages/typespec-ts/src/modular/buildRootIndex.ts +++ b/packages/typespec-ts/src/modular/buildRootIndex.ts @@ -3,7 +3,11 @@ import { Project, SourceFile } from "ts-morph"; import { getClassicalClientName } from "./helpers/namingHelpers.js"; import { ModularEmitterOptions } from "./interfaces.js"; import { resolveReference } from "../framework/reference.js"; -import { MultipartHelpers, PagingHelpers } from "./static-helpers-metadata.js"; +import { + CloudSettingHelpers, + MultipartHelpers, + PagingHelpers +} from "./static-helpers-metadata.js"; import { SdkClientType, SdkContext, @@ -68,6 +72,7 @@ export function buildRootIndex( exportPagingTypes(context, rootIndexFile); exportFileContentsType(context, rootIndexFile); + exportAzureCloudTypes(context, rootIndexFile); } function exportModels( @@ -91,6 +96,15 @@ function exportModels( } } +function exportAzureCloudTypes(context: SdkContext, rootIndexFile: SourceFile) { + if (context.arm) { + addExportsToRootIndexFile(rootIndexFile, [ + resolveReference(CloudSettingHelpers.AzureClouds), + resolveReference(CloudSettingHelpers.AzureSupportedClouds) + ]); + } +} + /** * This is a temporary solution for adding paging exports. Eventually we will have the binder generate the exports automatically. */ @@ -99,18 +113,11 @@ function exportPagingTypes(context: SdkContext, rootIndexFile: SourceFile) { return; } - const existingExports = getExistingExports(rootIndexFile); - const namedExports = [ + addExportsToRootIndexFile(rootIndexFile, [ resolveReference(PagingHelpers.PageSettings), resolveReference(PagingHelpers.ContinuablePage), resolveReference(PagingHelpers.PagedAsyncIterableIterator) - ]; - - const newNamedExports = getNewNamedExports(namedExports, existingExports); - - if (newNamedExports.length > 0) { - addExportsToRootIndexFile(rootIndexFile, newNamedExports); - } + ]); } function hasPaging(context: SdkContext): boolean { @@ -139,14 +146,9 @@ function exportFileContentsType( ) ) ) { - const existingExports = getExistingExports(rootIndexFile); - const namedExports = [resolveReference(MultipartHelpers.FileContents)]; - - const newNamedExports = getNewNamedExports(namedExports, existingExports); - - if (newNamedExports.length > 0) { - addExportsToRootIndexFile(rootIndexFile, newNamedExports); - } + addExportsToRootIndexFile(rootIndexFile, [ + resolveReference(MultipartHelpers.FileContents) + ]); } } @@ -171,11 +173,15 @@ function getNewNamedExports( function addExportsToRootIndexFile( rootIndexFile: SourceFile, - newNamedExports: string[] + namedExports: string[] ) { - rootIndexFile.addExportDeclaration({ - namedExports: newNamedExports - }); + const existingExports = getExistingExports(rootIndexFile); + const newNamedExports = getNewNamedExports(namedExports, existingExports); + if (newNamedExports.length > 0) { + rootIndexFile.addExportDeclaration({ + namedExports: newNamedExports + }); + } } function exportRestoreHelpers( diff --git a/packages/typespec-ts/src/modular/helpers/clientHelpers.ts b/packages/typespec-ts/src/modular/helpers/clientHelpers.ts index b5d4ad4de4..c866d4870d 100644 --- a/packages/typespec-ts/src/modular/helpers/clientHelpers.ts +++ b/packages/typespec-ts/src/modular/helpers/clientHelpers.ts @@ -20,6 +20,8 @@ import { SdkContext } from "../../utils/interfaces.js"; import { getClassicalClientName } from "./namingHelpers.js"; import { getTypeExpression } from "../type-expressions/get-type-expression.js"; import { isCredentialType } from "./typeHelpers.js"; +import { CloudSettingHelpers } from "../static-helpers-metadata.js"; +import { resolveReference } from "../../framework/reference.js"; interface ClientParameterOptions { onClientOnly?: boolean; @@ -170,8 +172,16 @@ export function buildGetClientEndpointParam( dpgContext: SdkContext, client: SdkClientType ): string { - const coreEndpointParam = `options.endpoint`; - + let coreEndpointParam = ""; + if (dpgContext.rlcOptions?.flavor === "azure") { + const cloudSettingSuffix = dpgContext.arm + ? ` ?? ${resolveReference(CloudSettingHelpers.getArmEndpoint)}(options.cloudSetting)` + : ""; + coreEndpointParam = `options.endpoint${cloudSettingSuffix}`; + } else { + // unbranded does not have the deprecated baseUrl parameter + coreEndpointParam = `options.endpoint`; + } // Special case: endpoint URL not defined const endpointParam = getClientParameters(client, dpgContext, { onClientOnly: true, diff --git a/packages/typespec-ts/src/modular/static-helpers-metadata.ts b/packages/typespec-ts/src/modular/static-helpers-metadata.ts index 9de378b894..0962e8c26a 100644 --- a/packages/typespec-ts/src/modular/static-helpers-metadata.ts +++ b/packages/typespec-ts/src/modular/static-helpers-metadata.ts @@ -96,3 +96,21 @@ export const MultipartHelpers = { location: "multipartHelpers.ts" } } as const; + +export const CloudSettingHelpers = { + AzureClouds: { + kind: "enum", + name: "AzureClouds", + location: "cloudSettingHelpers.ts" + }, + AzureSupportedClouds: { + kind: "typeAlias", + name: "AzureSupportedClouds", + location: "cloudSettingHelpers.ts" + }, + getArmEndpoint: { + kind: "function", + name: "getArmEndpoint", + location: "cloudSettingHelpers.ts" + } +} as const; diff --git a/packages/typespec-ts/static/static-helpers/cloudSettingHelpers.ts b/packages/typespec-ts/static/static-helpers/cloudSettingHelpers.ts new file mode 100644 index 0000000000..e2e9bc7f1b --- /dev/null +++ b/packages/typespec-ts/static/static-helpers/cloudSettingHelpers.ts @@ -0,0 +1,32 @@ +/** An enum to describe Azure Cloud. */ +export enum AzureClouds { + /** Azure public cloud, which is the default cloud for Azure SDKs. */ + AZURE_PUBLIC_CLOUD = "AZURE_PUBLIC_CLOUD", + /** Azure China cloud */ + AZURE_CHINA_CLOUD = "AZURE_CHINA_CLOUD", + /** Azure US government cloud */ + AZURE_US_GOVERNMENT = "AZURE_US_GOVERNMENT" +} + +/** The supported values for cloud setting as a string literal type */ +export type AzureSupportedClouds = `${AzureClouds}`; + +export function getArmEndpoint( + cloudSetting?: AzureSupportedClouds +): string | undefined { + if (cloudSetting === undefined) { + return undefined; + } + const cloudEndpoints: Record = { + AZURE_CHINA_CLOUD: "https://management.chinacloudapi.cn/", + AZURE_US_GOVERNMENT: "https://management.usgovcloudapi.net/", + AZURE_PUBLIC_CLOUD: "https://management.azure.com/" + }; + if (cloudSetting in cloudEndpoints) { + return cloudEndpoints[cloudSetting]; + } else { + throw new Error( + `Unknown cloud setting: ${cloudSetting}. Please refer to the enum AzureClouds for possible values.` + ); + } +} diff --git a/packages/typespec-ts/test/azureModularIntegration/generated/azure/resource-manager/common-properties/src/index.d.ts b/packages/typespec-ts/test/azureModularIntegration/generated/azure/resource-manager/common-properties/src/index.d.ts index 5ec0fe9a05..d67babb3fd 100644 --- a/packages/typespec-ts/test/azureModularIntegration/generated/azure/resource-manager/common-properties/src/index.d.ts +++ b/packages/typespec-ts/test/azureModularIntegration/generated/azure/resource-manager/common-properties/src/index.d.ts @@ -16,6 +16,14 @@ export declare interface ApiErrorBase { message?: string; } +export declare enum AzureClouds { + AZURE_PUBLIC_CLOUD = "AZURE_PUBLIC_CLOUD", + AZURE_CHINA_CLOUD = "AZURE_CHINA_CLOUD", + AZURE_US_GOVERNMENT = "AZURE_US_GOVERNMENT" +} + +export declare type AzureSupportedClouds = `${AzureClouds}`; + export declare interface CloudError { error?: ApiError; } @@ -33,6 +41,7 @@ export declare class CommonPropertiesClient { export declare interface CommonPropertiesClientOptionalParams extends ClientOptions { apiVersion?: string; + cloudSetting?: AzureSupportedClouds; } export declare interface ConfidentialResource extends TrackedResource { diff --git a/packages/typespec-ts/test/azureModularIntegration/generated/azure/resource-manager/large-header/src/index.d.ts b/packages/typespec-ts/test/azureModularIntegration/generated/azure/resource-manager/large-header/src/index.d.ts index 1d47ae7730..981aaaa079 100644 --- a/packages/typespec-ts/test/azureModularIntegration/generated/azure/resource-manager/large-header/src/index.d.ts +++ b/packages/typespec-ts/test/azureModularIntegration/generated/azure/resource-manager/large-header/src/index.d.ts @@ -6,6 +6,14 @@ import { PathUncheckedResponse } from '@azure-rest/core-client'; import { Pipeline } from '@azure/core-rest-pipeline'; import { PollerLike } from '@azure/core-lro'; +export declare enum AzureClouds { + AZURE_PUBLIC_CLOUD = "AZURE_PUBLIC_CLOUD", + AZURE_CHINA_CLOUD = "AZURE_CHINA_CLOUD", + AZURE_US_GOVERNMENT = "AZURE_US_GOVERNMENT" +} + +export declare type AzureSupportedClouds = `${AzureClouds}`; + export declare interface CancelResult { succeeded: boolean; } @@ -40,6 +48,7 @@ export declare class LargeHeaderClient { export declare interface LargeHeaderClientOptionalParams extends ClientOptions { apiVersion?: string; + cloudSetting?: AzureSupportedClouds; } export declare interface LargeHeadersOperations { diff --git a/packages/typespec-ts/test/azureModularIntegration/generated/azure/resource-manager/non-resource/src/index.d.ts b/packages/typespec-ts/test/azureModularIntegration/generated/azure/resource-manager/non-resource/src/index.d.ts index ab5e8f128a..bc513e62f7 100644 --- a/packages/typespec-ts/test/azureModularIntegration/generated/azure/resource-manager/non-resource/src/index.d.ts +++ b/packages/typespec-ts/test/azureModularIntegration/generated/azure/resource-manager/non-resource/src/index.d.ts @@ -2,6 +2,14 @@ import { ClientOptions } from '@azure-rest/core-client'; import { OperationOptions } from '@azure-rest/core-client'; import { Pipeline } from '@azure/core-rest-pipeline'; +export declare enum AzureClouds { + AZURE_PUBLIC_CLOUD = "AZURE_PUBLIC_CLOUD", + AZURE_CHINA_CLOUD = "AZURE_CHINA_CLOUD", + AZURE_US_GOVERNMENT = "AZURE_US_GOVERNMENT" +} + +export declare type AzureSupportedClouds = `${AzureClouds}`; + export declare interface ErrorAdditionalInfo { readonly type?: string; readonly info?: any; @@ -38,6 +46,7 @@ export declare class NonResourceClient { export declare interface NonResourceClientOptionalParams extends ClientOptions { apiVersion?: string; + cloudSetting?: AzureSupportedClouds; } export declare interface NonResourceOperationsCreateOptionalParams extends OperationOptions { diff --git a/packages/typespec-ts/test/azureModularIntegration/generated/azure/resource-manager/operation-templates/src/index.d.ts b/packages/typespec-ts/test/azureModularIntegration/generated/azure/resource-manager/operation-templates/src/index.d.ts index a33815127a..8edab12646 100644 --- a/packages/typespec-ts/test/azureModularIntegration/generated/azure/resource-manager/operation-templates/src/index.d.ts +++ b/packages/typespec-ts/test/azureModularIntegration/generated/azure/resource-manager/operation-templates/src/index.d.ts @@ -17,6 +17,14 @@ export declare interface ActionResult { export declare type ActionType = string; +export declare enum AzureClouds { + AZURE_PUBLIC_CLOUD = "AZURE_PUBLIC_CLOUD", + AZURE_CHINA_CLOUD = "AZURE_CHINA_CLOUD", + AZURE_US_GOVERNMENT = "AZURE_US_GOVERNMENT" +} + +export declare type AzureSupportedClouds = `${AzureClouds}`; + export declare interface ChangeAllowanceRequest { totalAllowed?: number; reason?: string; @@ -160,6 +168,7 @@ export declare class OperationTemplatesClient { export declare interface OperationTemplatesClientOptionalParams extends ClientOptions { apiVersion?: string; + cloudSetting?: AzureSupportedClouds; } export declare interface OptionalBodyGetOptionalParams extends OperationOptions { diff --git a/packages/typespec-ts/test/azureModularIntegration/generated/azure/resource-manager/resources/src/index.d.ts b/packages/typespec-ts/test/azureModularIntegration/generated/azure/resource-manager/resources/src/index.d.ts index 7e0592a807..8455ad8494 100644 --- a/packages/typespec-ts/test/azureModularIntegration/generated/azure/resource-manager/resources/src/index.d.ts +++ b/packages/typespec-ts/test/azureModularIntegration/generated/azure/resource-manager/resources/src/index.d.ts @@ -6,6 +6,14 @@ import { PathUncheckedResponse } from '@azure-rest/core-client'; import { Pipeline } from '@azure/core-rest-pipeline'; import { PollerLike } from '@azure/core-lro'; +export declare enum AzureClouds { + AZURE_PUBLIC_CLOUD = "AZURE_PUBLIC_CLOUD", + AZURE_CHINA_CLOUD = "AZURE_CHINA_CLOUD", + AZURE_US_GOVERNMENT = "AZURE_US_GOVERNMENT" +} + +export declare type AzureSupportedClouds = `${AzureClouds}`; + export declare type ContinuablePage = TPage & { continuationToken?: string; }; @@ -193,6 +201,7 @@ export declare class ResourcesClient { export declare interface ResourcesClientOptionalParams extends ClientOptions { apiVersion?: string; + cloudSetting?: AzureSupportedClouds; } export declare function restorePoller(client: ResourcesClient, serializedState: string, sourceOperation: (...args: any[]) => PollerLike, TResult>, options?: RestorePollerOptions): PollerLike, TResult>;