Skip to content
Merged
Show file tree
Hide file tree
Changes from 17 commits
Commits
Show all changes
35 commits
Select commit Hold shift + click to select a range
9fb6730
Add the cloud setting option for ARM modular SDK
MaryGao Jun 3, 2025
7877136
Update the idea
MaryGao Jun 3, 2025
40c8971
Merge branch 'main' into support-multi-cloud-modular
MaryGao Jun 23, 2025
2b05dec
Build the cloud setting enum in model.ts
MaryGao Jun 23, 2025
ff301ca
Update the comments
MaryGao Jun 23, 2025
e98f8d8
Fix the generation issues
MaryGao Jun 23, 2025
a38ee5d
Refactor code a little to remove duplications
MaryGao Jun 23, 2025
5bfb860
Update the integration testings
MaryGao Jun 23, 2025
3705a0c
Fix the thrown exception messages
MaryGao Jun 23, 2025
7612429
Update the formats
MaryGao Jun 23, 2025
2711920
Directly use tcgc arm option
MaryGao Jun 23, 2025
4cb037a
Fix the UTs
MaryGao Jun 23, 2025
ed48054
Merge branch 'main' into support-multi-cloud-modular
MaryGao Jun 23, 2025
045ccbc
Update packages/typespec-ts/src/modular/buildClientContext.ts
MaryGao Jun 23, 2025
94d31cb
Regen the smoke with copilot comments
MaryGao Jun 23, 2025
5a63c55
Regen with smoke testing
MaryGao Jun 23, 2025
98680a0
Merge branch 'main' into support-multi-cloud-modular
MaryGao Jun 24, 2025
0f521eb
Merge branch 'main' into support-multi-cloud-modular
MaryGao Jun 24, 2025
a212372
Merge main into pr/MaryGao/3233 - resolved conflicts in cloud setting…
MaryGao Jul 15, 2025
abc02ad
Move the helper into our static helper folder
MaryGao Jul 15, 2025
b8a37b7
Remove the baseurl
MaryGao Jul 15, 2025
21cbaee
Update the un-necessary codes
MaryGao Jul 15, 2025
ca885b7
Update the un-necessary codes
MaryGao Jul 15, 2025
4183b3a
Fix the UTs
MaryGao Jul 15, 2025
c66ce82
Fix the UTs
MaryGao Jul 15, 2025
d8258cc
Update packages/typespec-ts/src/modular/buildRootIndex.ts
MaryGao Jul 15, 2025
8df5e7d
Update the comments
MaryGao Jul 15, 2025
2824202
Merge branch 'support-multi-cloud-modular' of https://github.com/mary…
MaryGao Jul 15, 2025
d2ba539
Update the copilot suggestion
MaryGao Jul 15, 2025
5ce951b
Update the git diff
MaryGao Jul 15, 2025
99a0b4f
Regen modular integration test
MaryGao Jul 15, 2025
03ebf2c
Update packages/typespec-test/test/NetworkAnalytics.Management/genera…
MaryGao Jul 16, 2025
e24c68d
Update packages/typespec-test/test/NetworkAnalytics.Management/genera…
MaryGao Jul 16, 2025
c213829
Refresh the smoke test and integration test
MaryGao Jul 16, 2025
5d5610d
Update the index file
MaryGao Jul 16, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -343,6 +343,13 @@ export enum KnownActionType {
Internal = "Internal"
}

// @public
export enum KnownAzureClouds {
AZURE_CHINA_CLOUD = "AZURE_CHINA_CLOUD",
AZURE_PUBLIC_CLOUD = "AZURE_PUBLIC_CLOUD",
AZURE_US_GOVERNMENT = "AZURE_US_GOVERNMENT"
Comment thread
MaryGao marked this conversation as resolved.
Outdated
}

// @public
export enum KnownControlState {
Disabled = "Disabled",
Expand Down Expand Up @@ -442,6 +449,7 @@ export class NetworkAnalyticsApi {
// @public
export interface NetworkAnalyticsApiOptionalParams extends ClientOptions {
apiVersion?: string;
cloudSetting?: string;
Comment thread
MaryGao marked this conversation as resolved.
Outdated
}

// @public
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,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;
/** Azure cloud setting, known values of {@link KnownAzureClouds} */
cloudSetting?: string;
}

export function createNetworkAnalyticsApi(
Expand All @@ -27,7 +29,10 @@ export function createNetworkAnalyticsApi(
options: NetworkAnalyticsApiOptionalParams = {},
): NetworkAnalyticsApiContext {
const endpointUrl =
options.endpoint ?? options.baseUrl ?? "https://management.azure.com";
options.endpoint ??
options.baseUrl ??
getArmEndpoint(options.cloudSetting) ??
"https://management.azure.com";
Comment thread
MaryGao marked this conversation as resolved.
const prefixFromOptions = options?.userAgentOptions?.userAgentPrefix;
const userAgentInfo = `azsdk-js-arm-networkanalytics/1.0.0-beta.1`;
const userAgentPrefix = prefixFromOptions
Expand Down Expand Up @@ -65,3 +70,22 @@ export function createNetworkAnalyticsApi(
subscriptionId,
} as NetworkAnalyticsApiContext;
}

/** Get the ARM endpoint for the client. */
function getArmEndpoint(cloudSetting?: string): string | undefined {
if (cloudSetting === undefined) {
return undefined;
}
const cloudEndpoints: Record<string, string> = {
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 the enum KnownAzureClouds for possible values.`,
);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,6 @@ import {
PagedAsyncIterableIterator,
} from "./static-helpers/pagingHelpers.js";

export { NetworkAnalyticsApi } from "./networkAnalyticsApi.js";
export { restorePoller, RestorePollerOptions } from "./restorePollerHelpers.js";
export {
Operation,
OperationDisplay,
Expand Down Expand Up @@ -67,7 +65,10 @@ export {
RoleAssignmentDetail,
ListRoleAssignments,
KnownVersions,
KnownAzureClouds,
} from "./models/index.js";
export { NetworkAnalyticsApi } from "./networkAnalyticsApi.js";
export { restorePoller, RestorePollerOptions } from "./restorePollerHelpers.js";
export { NetworkAnalyticsApiOptionalParams } from "./api/index.js";
export {
DataProductsListBySubscriptionOptionalParams,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,4 +59,5 @@ export {
RoleAssignmentDetail,
ListRoleAssignments,
KnownVersions,
KnownAzureClouds,
} from "./models.js";
Original file line number Diff line number Diff line change
Expand Up @@ -1448,3 +1448,13 @@ export enum KnownVersions {
/** The 2023-11-15 stable version. */
V20231115 = "2023-11-15",
}

/** An enum to describe Azure Cloud. */
export enum KnownAzureClouds {
/** 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",
}
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ import {
PagedAsyncIterableIterator,
} from "./static-helpers/pagingHelpers.js";

export { AIProjectClient } from "./aiProjectClient.js";
export {
GetWorkspaceResponse,
WorkspaceProperties,
Expand Down Expand Up @@ -245,6 +244,7 @@ export {
RunAdditionalFieldList,
VectorStoreFileStatusFilter,
} from "./models/agents/index.js";
export { AIProjectClient } from "./aiProjectClient.js";
Comment thread
MaryGao marked this conversation as resolved.
Outdated
Comment thread
MaryGao marked this conversation as resolved.
Outdated
export { AIProjectClientOptionalParams } from "./api/index.js";
export {
AgentsListVectorStoreFileBatchFilesOptionalParams,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ import {
PagedAsyncIterableIterator,
} from "./static-helpers/pagingHelpers.js";

export { AnomalyDetectorClient } from "./anomalyDetectorClient.js";
export { APIVersion } from "./models/index.js";
export {
MultivariateMultivariateDetectionResult,
Expand Down Expand Up @@ -46,6 +45,7 @@ export {
UnivariateUnivariateChangePointDetectionOptions,
UnivariateUnivariateChangePointDetectionResult,
} from "./models/univariate/index.js";
export { AnomalyDetectorClient } from "./anomalyDetectorClient.js";
export { AnomalyDetectorClientOptionalParams } from "./api/index.js";
export {
MultivariateDetectMultivariateLastAnomalyOptionalParams,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ import {
PagedAsyncIterableIterator,
} from "./static-helpers/pagingHelpers.js";

export { BatchClient } from "./batchClient.js";
export {
BatchApplication,
BatchError,
Expand Down Expand Up @@ -202,6 +201,7 @@ export {
StatusLevelTypes,
KnownVersions,
} from "./models/index.js";
export { BatchClient } from "./batchClient.js";
export {
BatchClientOptionalParams,
ListNodeFilesOptionalParams,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT License.

export { ChatProtocolClient } from "./chatProtocolClient.js";
export {
StreamingChatCompletionOptionsRecord,
ChatMessage,
Expand All @@ -15,6 +14,7 @@ export {
ChatChoiceRecord,
KnownAPIVersion,
} from "./models/index.js";
export { ChatProtocolClient } from "./chatProtocolClient.js";
export {
ChatProtocolClientOptionalParams,
CreateOptionalParams,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ import {
PagedAsyncIterableIterator,
} from "./static-helpers/pagingHelpers.js";

export { ContentSafetyClient } from "./contentSafetyClient.js";
export {
AnalyzeTextOptions,
TextCategory,
Expand Down Expand Up @@ -35,6 +34,7 @@ export {
RemoveTextBlocklistItemsOptions,
KnownVersions,
} from "./models/index.js";
export { ContentSafetyClient } from "./contentSafetyClient.js";
export {
ContentSafetyClientOptionalParams,
ListTextBlocklistItemsOptionalParams,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT License.

export { EventGridClient } from "./eventGridClient.js";
export {
CloudEvent,
PublishResult,
Expand All @@ -16,6 +15,7 @@ export {
ReleaseDelay,
KnownServiceApiVersions,
} from "./models/index.js";
export { EventGridClient } from "./eventGridClient.js";
export {
EventGridClientOptionalParams,
RenewCloudEventLocksOptionalParams,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT License.

export { RadiologyInsightsClient } from "./radiologyInsightsClient.js";
export { restorePoller, RestorePollerOptions } from "./restorePollerHelpers.js";
export {
PatientRecord,
PatientInfo,
Expand Down Expand Up @@ -76,6 +74,8 @@ export {
DomainResourceUnion,
Narrative,
} from "./models/fhir/r4/index.js";
export { RadiologyInsightsClient } from "./radiologyInsightsClient.js";
export { restorePoller, RestorePollerOptions } from "./restorePollerHelpers.js";
export {
InferRadiologyInsightsOptionalParams,
RadiologyInsightsClientOptionalParams,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT License.

export { FooClient } from "./fooClient.js";
export { A } from "./models/index.js";
export { BA } from "./models/b/index.js";
export { BEA } from "./models/b/e/index.js";
export { FooClient } from "./fooClient.js";
export { FooClientOptionalParams, Op1OptionalParams } from "./api/index.js";
export { BOp1OptionalParams } from "./api/b/index.js";
export { DOp1OptionalParams } from "./api/d/index.js";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ import {
PagedAsyncIterableIterator,
} from "./static-helpers/pagingHelpers.js";

export { LoadTestAdministrationClient } from "./loadTestAdministration/loadTestAdministrationClient.js";
export {
Test,
PassFailCriteria,
Expand Down Expand Up @@ -92,6 +91,7 @@ export {
RecommendationCategory,
KnownAPIVersions,
} from "./models/index.js";
export { LoadTestAdministrationClient } from "./loadTestAdministration/loadTestAdministrationClient.js";
export {
LoadTestAdministrationClientOptionalParams,
DeleteTestOptionalParams,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@

import { FileContents } from "./static-helpers/multipartHelpers.js";

export { OpenAIClient } from "./openAIClient.js";
export {
CreateCompletionRequest,
Prompt,
Expand Down Expand Up @@ -53,6 +52,7 @@ export {
ListFineTuningJobEventsResponse,
FineTuningJobEvent,
} from "./models/index.js";
export { OpenAIClient } from "./openAIClient.js";
export { OpenAIClientOptionalParams } from "./api/index.js";
export { CompletionsCreateOptionalParams } from "./api/completions/index.js";
export { EditsCreateOptionalParams } from "./api/edits/index.js";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@

import { FileContents } from "./static-helpers/multipartHelpers.js";

export { OpenAIClient } from "./openAIClient.js";
export {
AudioTranscriptionOptions,
AudioTranscriptionFormat,
Expand Down Expand Up @@ -147,6 +146,7 @@ export {
EmbeddingsUsage,
KnownServiceApiVersions,
} from "./models/index.js";
export { OpenAIClient } from "./openAIClient.js";
export {
OpenAIClientOptionalParams,
GetEmbeddingsOptionalParams,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@

import { FileContents } from "./static-helpers/multipartHelpers.js";

export { OpenAIClient } from "./openAIClient.js";
export {
CreateCompletionRequest,
Prompt,
Expand Down Expand Up @@ -52,6 +51,7 @@ export {
ListFineTuningJobEventsResponse,
FineTuningJobEvent,
} from "./models/index.js";
export { OpenAIClient } from "./openAIClient.js";
export { OpenAIClientOptionalParams } from "./api/index.js";
export { CompletionsCreateOptionalParams } from "./api/completions/index.js";
export { EditsCreateOptionalParams } from "./api/edits/index.js";
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT License.

export { WidgetManagerClient } from "./widgetManagerClient.js";
export { KnownVersions } from "./models/index.js";
export { WidgetManagerClient } from "./widgetManagerClient.js";
export { WidgetManagerClientOptionalParams } from "./api/index.js";
export {
FooOperationsGetAvatarAsJpegOptionalParams,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT License.

export { ParametrizedHostClient } from "./parametrizedHostClient.js";
export { Collection } from "./models/index.js";
export { ParametrizedHostClient } from "./parametrizedHostClient.js";
export { ParametrizedHostClientOptionalParams } from "./api/index.js";
export { ConfidentialLedgerListCollectionsOptionalParams } from "./api/confidentialLedger/index.js";
export { ConfidentialLedgerOperations } from "./classic/index.js";
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ import {
PagedAsyncIterableIterator,
} from "./static-helpers/pagingHelpers.js";

export { SchemaRegistryClient } from "./schemaRegistryClient.js";
export {
SchemaGroup,
SchemaVersion,
Expand All @@ -18,6 +17,7 @@ export {
KnownServiceApiVersions,
ContentTypeEnum,
} from "./models/index.js";
export { SchemaRegistryClient } from "./schemaRegistryClient.js";
export { SchemaRegistryClientOptionalParams } from "./api/index.js";
export {
SchemaOperationsRegisterSchemaOptionalParams,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ import {
PagedAsyncIterableIterator,
} from "./static-helpers/pagingHelpers.js";

export { TodoClient } from "./todoClient.js";
export {
User,
ApiError,
Expand All @@ -30,6 +29,7 @@ export {
UserExistsResponse,
InvalidUserResponse,
} from "./models/users/index.js";
export { TodoClient } from "./todoClient.js";
export { TodoClientOptionalParams } from "./api/index.js";
export {
TodoItemsDeleteOptionalParams,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,6 @@ import {
PagedAsyncIterableIterator,
} from "./static-helpers/pagingHelpers.js";

export { SAPWidgetServiceClient } from "./sapWidgetServiceClient.js";
export { restorePoller, RestorePollerOptions } from "./restorePollerHelpers.js";
export {
Widget,
WidgetError,
Expand All @@ -17,6 +15,8 @@ export {
NonReferencedModel,
KnownVersions,
} from "./models/index.js";
export { SAPWidgetServiceClient } from "./sapWidgetServiceClient.js";
export { restorePoller, RestorePollerOptions } from "./restorePollerHelpers.js";
export { SAPWidgetServiceClientOptionalParams } from "./api/index.js";
export {
BudgetsContinueOptionalParams,
Expand Down
10 changes: 7 additions & 3 deletions packages/typespec-ts/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -287,15 +287,19 @@ export async function $onEmit(context: EmitContext) {
);

const isMultiClients = dpgContext.sdkPackage.clients.length > 1;
const clientMap = getClientHierarchyMap(dpgContext);
const hasModularClients = clientMap.length > 0;
console.time("onEmit: emit models");
emitTypes(dpgContext, { sourceRoot: modularSourcesRoot });
emitTypes(dpgContext, {
sourceRoot: modularSourcesRoot,
hasModularClients
});
console.timeEnd("onEmit: emit models");
buildSubpathIndexFile(modularEmitterOptions, "models", undefined, {
recursive: true
});
console.time("onEmit: emit source files");
const clientMap = getClientHierarchyMap(dpgContext);
if (clientMap.length === 0) {
if (hasModularClients) {
// If no clients, we still need to build the root index file
buildRootIndex(dpgContext, modularEmitterOptions, rootIndexFile);
}
Expand Down
Loading
Loading