Skip to content

Commit

Permalink
package migration for @microsoft packages and T2 (#3046)
Browse files Browse the repository at this point in the history
* package migration for @microsoft packages and T2

* Remove stale comment

* Add registerAzureUtilsExtensionVariables(ext) call before AppService

* Alphabetize

* Comments to fix loadMore if paging gets fixed
  • Loading branch information
nturinski authored Feb 15, 2022
1 parent 6ab43e2 commit 411ece5
Show file tree
Hide file tree
Showing 204 changed files with 1,278 additions and 1,371 deletions.
4 changes: 2 additions & 2 deletions extension.bundle.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@
//
// The tests should import '../extension.bundle'. At design-time they live in tests/ and so will pick up this file (extension.bundle.ts).
// At runtime the tests live in dist/tests and will therefore pick up the main webpack bundle at dist/extension.bundle.js.
export * from 'vscode-azureappservice';
export * from 'vscode-azureextensionui';
export { createAzureClient, createGenericClient } from '@microsoft/vscode-azext-azureutils';
export { AzExtTreeDataProvider, DialogResponses, IActionContext, nonNullValue, parseError, registerOnActionStartHandler } from '@microsoft/vscode-azext-utils';
export * from './src/commands/addBinding/addBinding';
export * from './src/commands/copyFunctionUrl';
export * from './src/commands/createFunction/createFunction';
Expand Down
1,846 changes: 886 additions & 960 deletions package-lock.json

Large diffs are not rendered by default.

19 changes: 10 additions & 9 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -1104,20 +1104,23 @@
"vinyl-buffer": "^1.0.1",
"vinyl-source-stream": "^2.0.0",
"vsce": "^1.87.0",
"vscode-azureextensiondev": "^0.10.2",
"vscode-azureextensiondev": "^0.10.4",
"vscode-test": "^1.5.2",
"webpack": "^5.28.0",
"webpack-cli": "^4.6.0"
},
"dependencies": {
"@azure/arm-appinsights": "^2.1.0",
"@azure/arm-appservice": "^6.0.0",
"@azure/arm-cosmosdb": "^9.0.0",
"@azure/arm-eventhub": "^3.2.0",
"@azure/arm-servicebus": "^3.2.0",
"@azure/arm-storage": "^15.0.0",
"@azure/arm-appinsights": "^4.0.0",
"@azure/arm-appservice": "^11.0.0",
"@azure/arm-cosmosdb": "^15.0.0",
"@azure/arm-eventhub": "^5.0.0",
"@azure/arm-servicebus": "^5.0.0",
"@azure/arm-storage": "^17.0.0",
"@azure/ms-rest-js": "^2.2.1",
"@azure/storage-blob": "^12.5.0",
"@microsoft/vscode-azext-azureappservice": "^0.1.0",
"@microsoft/vscode-azext-azureutils": "^0.1.0",
"@microsoft/vscode-azext-utils": "^0.1.0",
"escape-string-regexp": "^4.0.0",
"extract-zip": "^2.0.1",
"fs-extra": "^4.0.2",
Expand All @@ -1128,8 +1131,6 @@
"portfinder": "^1.0.23",
"ps-tree": "^1.1.1",
"semver": "^5.7.1",
"vscode-azureappservice": "^0.86.3",
"vscode-azureextensionui": "^0.48.5",
"vscode-azurekudu": "^0.2.0",
"vscode-nls": "^4.1.1",
"websocket": "^1.0.29",
Expand Down
2 changes: 1 addition & 1 deletion src/FuncVersion.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/

import { IActionContext, IAzureQuickPickItem, IAzureQuickPickOptions } from 'vscode-azureextensionui';
import { IActionContext, IAzureQuickPickItem, IAzureQuickPickOptions } from '@microsoft/vscode-azext-utils';
import { localize } from './localize';
import { openUrl } from './utils/openUrl';

Expand Down
2 changes: 1 addition & 1 deletion src/commands/addBinding/BindingCreateStep.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/

import { AzureWizardExecuteStep } from "@microsoft/vscode-azext-utils";
import { Progress, Uri, window, workspace } from "vscode";
import { AzureWizardExecuteStep } from "vscode-azureextensionui";
import { IFunctionBinding, IFunctionJson } from "../../funcConfig/function";
import { IBindingTemplate } from "../../templates/IBindingTemplate";
import { confirmEditJsonFile } from '../../utils/fs';
Expand Down
2 changes: 1 addition & 1 deletion src/commands/addBinding/BindingDirectionStep.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/

import { AzureWizardPromptStep, IAzureQuickPickItem } from 'vscode-azureextensionui';
import { AzureWizardPromptStep, IAzureQuickPickItem } from '@microsoft/vscode-azext-utils';
import { localize } from '../../localize';
import { IBindingWizardContext } from './IBindingWizardContext';

Expand Down
2 changes: 1 addition & 1 deletion src/commands/addBinding/BindingListStep.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/

import { AzureWizardPromptStep, IAzureQuickPickItem, IWizardOptions } from 'vscode-azureextensionui';
import { AzureWizardPromptStep, IAzureQuickPickItem, IWizardOptions } from '@microsoft/vscode-azext-utils';
import { ProjectLanguage } from '../../constants';
import { ext } from '../../extensionVariables';
import { FuncVersion } from '../../FuncVersion';
Expand Down
2 changes: 1 addition & 1 deletion src/commands/addBinding/addBinding.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/

import { AzureWizard, IActionContext } from "@microsoft/vscode-azext-utils";
import { Uri, WorkspaceFolder } from "vscode";
import { AzureWizard, IActionContext } from "vscode-azureextensionui";
import { ProjectLanguage, projectTemplateKeySetting } from "../../constants";
import { ext } from "../../extensionVariables";
import { FuncVersion } from "../../FuncVersion";
Expand Down
2 changes: 1 addition & 1 deletion src/commands/addBinding/createBindingWizard.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/

import { AzureWizard } from "vscode-azureextensionui";
import { AzureWizard } from "@microsoft/vscode-azext-utils";
import { localize } from "../../localize";
import { BindingCreateStep } from "./BindingCreateStep";
import { BindingDirectionStep } from "./BindingDirectionStep";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/

import { AzureWizardExecuteStep } from '@microsoft/vscode-azext-utils';
import { Progress } from 'vscode';
import { AzureWizardExecuteStep } from 'vscode-azureextensionui';
import { setLocalAppSetting } from '../../../funcConfig/local.settings';
import { localize } from '../../../localize';
import { IBindingSetting } from '../../../templates/IBindingTemplate';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/

import { AzureWizardPromptStep } from "vscode-azureextensionui";
import { AzureWizardPromptStep } from "@microsoft/vscode-azext-utils";
import { BindingSettingValue } from "../../../funcConfig/function";
import { IBindingSetting } from "../../../templates/IBindingTemplate";
import { getBindingSetting, setBindingSetting } from "../../createFunction/IFunctionWizardContext";
Expand Down
2 changes: 1 addition & 1 deletion src/commands/addBinding/settingSteps/BooleanPromptStep.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/

import { IAzureQuickPickItem } from "vscode-azureextensionui";
import { IAzureQuickPickItem } from "@microsoft/vscode-azext-utils";
import { BindingSettingValue } from "../../../funcConfig/function";
import { envUtils } from "../../../utils/envUtils";
import { IBindingWizardContext } from "../IBindingWizardContext";
Expand Down
2 changes: 1 addition & 1 deletion src/commands/addBinding/settingSteps/EnumPromptStep.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/

import { IAzureQuickPickItem } from "vscode-azureextensionui";
import { IAzureQuickPickItem } from "@microsoft/vscode-azext-utils";
import { BindingSettingValue } from "../../../funcConfig/function";
import { IBindingWizardContext } from "../IBindingWizardContext";
import { BindingSettingStepBase } from "./BindingSettingStepBase";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/

import { AzureWizardExecuteStep } from '@microsoft/vscode-azext-utils';
import { Progress } from 'vscode';
import { AzureWizardExecuteStep } from 'vscode-azureextensionui';
import { localSettingsFileName } from '../../../constants';
import { setLocalAppSetting } from '../../../funcConfig/local.settings';
import { localize } from '../../../localize';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,9 @@
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/

import { StorageAccountKind, StorageAccountListStep, StorageAccountPerformance, StorageAccountReplication } from '@microsoft/vscode-azext-azureutils';
import { AzureWizardExecuteStep, AzureWizardPromptStep, IAzureQuickPickItem, ISubscriptionActionContext, IWizardOptions } from '@microsoft/vscode-azext-utils';
import * as path from 'path';
import { AzureWizardExecuteStep, AzureWizardPromptStep, IAzureQuickPickItem, ISubscriptionActionContext, IWizardOptions, StorageAccountKind, StorageAccountListStep, StorageAccountPerformance, StorageAccountReplication } from 'vscode-azureextensionui';
import { localSettingsFileName } from '../../../constants';
import { ext } from '../../../extensionVariables';
import { BindingSettingValue } from '../../../funcConfig/function';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/

import { AzureWizardPromptStep } from 'vscode-azureextensionui';
import { AzureWizardPromptStep } from '@microsoft/vscode-azext-utils';
import { localize } from '../../../localize';
import { IBindingWizardContext } from '../IBindingWizardContext';

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/

import { IStorageAccountWizardContext } from 'vscode-azureextensionui';
import { IStorageAccountWizardContext } from '@microsoft/vscode-azext-azureutils';
import { getStorageConnectionString } from '../../../utils/azure';
import { IBindingWizardContext } from '../IBindingWizardContext';
import { AzureConnectionCreateStepBase, IConnection } from './AzureConnectionCreateStepBase';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/

import { AzureWizardPromptStep } from "vscode-azureextensionui";
import { AzureWizardPromptStep } from "@microsoft/vscode-azext-utils";
import { IBindingSetting, ValueType } from "../../../templates/IBindingTemplate";
import { IBindingWizardContext } from "../IBindingWizardContext";
import { BindingNameStep } from "./BindingNameStep";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/

import { CosmosDBManagementClient, CosmosDBManagementModels } from '@azure/arm-cosmosdb';
import { CosmosDBManagementClient, DatabaseAccountGetResults, DatabaseAccountListKeysResult } from '@azure/arm-cosmosdb';
import { getResourceGroupFromId } from '../../../../utils/azure';
import { createCosmosDBClient } from '../../../../utils/azureClients';
import { nonNullProp } from '../../../../utils/nonNull';
Expand All @@ -13,14 +13,14 @@ import { ICosmosDBWizardContext } from './ICosmosDBWizardContext';

export class CosmosDBConnectionCreateStep extends AzureConnectionCreateStepBase<IBindingWizardContext & ICosmosDBWizardContext> {
public async getConnection(context: ICosmosDBWizardContext): Promise<IConnection> {
const databaseAccount: CosmosDBManagementModels.DatabaseAccountGetResults = nonNullProp(context, 'databaseAccount');
const databaseAccount: DatabaseAccountGetResults = nonNullProp(context, 'databaseAccount');
const name: string = nonNullProp(databaseAccount, 'name');

const client: CosmosDBManagementClient = await createCosmosDBClient(context);
const resourceGroup: string = getResourceGroupFromId(nonNullProp(databaseAccount, 'id'));
// NOTE: We have to generate the connection string ourselves rather than calling client.databaseAccounts.listConnectionStrings
// (The runtime currently only handles Cosmos DB connection strings _not_ mongo connection strings)
const keys: CosmosDBManagementModels.DatabaseAccountListKeysResult = await client.databaseAccounts.listKeys(resourceGroup, name);
const keys: DatabaseAccountListKeysResult = await client.databaseAccounts.listKeys(resourceGroup, name);
return {
name: name,
connectionString: `AccountEndpoint=${nonNullProp(databaseAccount, 'documentEndpoint')};AccountKey=${nonNullProp(keys, 'primaryMasterKey')};`
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@
*--------------------------------------------------------------------------------------------*/

import { CosmosDBManagementClient } from '@azure/arm-cosmosdb';
import { AzureWizardPromptStep } from 'vscode-azureextensionui';
import { uiUtils } from '@microsoft/vscode-azext-azureutils';
import { AzureWizardPromptStep } from '@microsoft/vscode-azext-utils';
import { localize } from '../../../../localize';
import { promptForResource } from '../../../../utils/azure';
import { createCosmosDBClient } from '../../../../utils/azureClients';
Expand All @@ -14,7 +15,8 @@ export class CosmosDBListStep extends AzureWizardPromptStep<ICosmosDBWizardConte
public async prompt(context: ICosmosDBWizardContext): Promise<void> {
const placeHolder: string = localize('placeHolder', 'Select a database account');
const client: CosmosDBManagementClient = await createCosmosDBClient(context);
context.databaseAccount = await promptForResource(context, placeHolder, client.databaseAccounts.list());
context.databaseAccount = await promptForResource(context, placeHolder,
uiUtils.listAllIterator(client.databaseAccounts.list()));
}

public shouldPrompt(context: ICosmosDBWizardContext): boolean {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/

import { CosmosDBManagementModels } from '@azure/arm-cosmosdb';
import { ISubscriptionActionContext } from 'vscode-azureextensionui';
import { DatabaseAccountGetResults } from '@azure/arm-cosmosdb';
import { ISubscriptionActionContext } from '@microsoft/vscode-azext-utils';

export interface ICosmosDBWizardContext extends ISubscriptionActionContext {
databaseAccount?: CosmosDBManagementModels.DatabaseAccountGetResults;
databaseAccount?: DatabaseAccountGetResults;
}
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,9 @@
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/

import { EventHubManagementClient, EventHubManagementModels } from '@azure/arm-eventhub';
import { AzureWizardPromptStep } from 'vscode-azureextensionui';
import { AuthorizationRule, EventHubManagementClient } from '@azure/arm-eventhub';
import { uiUtils } from '@microsoft/vscode-azext-azureutils';
import { AzureWizardPromptStep } from '@microsoft/vscode-azext-utils';
import { localize } from '../../../../localize';
import { IBaseResourceWithName, promptForResource } from '../../../../utils/azure';
import { createEventHubClient } from '../../../../utils/azureClients';
Expand All @@ -22,16 +23,16 @@ export class EventHubAuthRuleListStep extends AzureWizardPromptStep<IEventHubWiz
const namespaceDescription: string = localize('namespacePolicy', '(namespace policy)');
const hubDescription: string = localize('hubPolicy', '(hub policy)');
// concats hub policies with namespace policies and adds a description to each
async function getEventHubAuthRules(): Promise<EventHubManagementModels.AuthorizationRule[]> {
const namespaceRules: EventHubManagementModels.AuthorizationRule[] = await client.namespaces.listAuthorizationRules(resourceGroupName, namespaceName);
async function getEventHubAuthRules(): Promise<AuthorizationRule[]> {
const namespaceRules: AuthorizationRule[] = await uiUtils.listAllIterator(client.namespaces.listAuthorizationRules(resourceGroupName, namespaceName));
namespaceRules.forEach((r: IBaseResourceWithName) => r._description = namespaceDescription);
const hubRules: EventHubManagementModels.AuthorizationRule[] = await client.eventHubs.listAuthorizationRules(resourceGroupName, namespaceName, eventHubName);
const hubRules: AuthorizationRule[] = await uiUtils.listAllIterator(client.eventHubs.listAuthorizationRules(resourceGroupName, namespaceName, eventHubName));
hubRules.forEach((r: IBaseResourceWithName) => r._description = hubDescription);
return hubRules.concat(namespaceRules);
}

const placeHolder: string = localize('placeHolder', 'Select an event hub policy');
const result: (EventHubManagementModels.AuthorizationRule & IBaseResourceWithName) | undefined = await promptForResource(context, placeHolder, getEventHubAuthRules());
const result: (AuthorizationRule & IBaseResourceWithName) | undefined = await promptForResource(context, placeHolder, getEventHubAuthRules());
if (result) {
context.authRuleName = nonNullProp(result, 'name');
context.isNamespaceAuthRule = result._description === namespaceDescription;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/

import { EventHubManagementClient, EventHubManagementModels } from '@azure/arm-eventhub';
import { AccessKeys, EventHubManagementClient } from '@azure/arm-eventhub';
import { createEventHubClient } from '../../../../utils/azureClients';
import { nonNullProp } from '../../../../utils/nonNull';
import { IBindingWizardContext } from '../../IBindingWizardContext';
Expand All @@ -20,10 +20,10 @@ export class EventHubConnectionCreateStep extends AzureConnectionCreateStepBase<
const client: EventHubManagementClient = await createEventHubClient(context);
let connectionString: string;
if (context.isNamespaceAuthRule) {
const keys: EventHubManagementModels.AccessKeys = await client.namespaces.listKeys(resourceGroupName, namespaceName, authRuleName);
const keys: AccessKeys = await client.namespaces.listKeys(resourceGroupName, namespaceName, authRuleName);
connectionString = `${nonNullProp(keys, 'primaryConnectionString')};EntityPath=${eventHubName}`;
} else {
const keys: EventHubManagementModels.AccessKeys = await client.eventHubs.listKeys(resourceGroupName, namespaceName, eventHubName, authRuleName);
const keys: AccessKeys = await client.eventHubs.listKeys(resourceGroupName, namespaceName, eventHubName, authRuleName);
connectionString = nonNullProp(keys, 'primaryConnectionString');
}

Expand Down
Loading

0 comments on commit 411ece5

Please sign in to comment.