Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update utils #2512

Merged
merged 9 commits into from
Jun 28, 2023
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
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
1,132 changes: 273 additions & 859 deletions package-lock.json

Large diffs are not rendered by default.

17 changes: 9 additions & 8 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -772,13 +772,13 @@
},
"devDependencies": {
"@microsoft/eslint-config-azuretools": "^0.1.0",
"@microsoft/vscode-azext-dev": "^1.0.4",
"@microsoft/vscode-azext-dev": "^2.0.0",
"@types/dotenv": "^6.1.1",
"@types/fs-extra": "^8.0.0",
"@types/gulp": "^4.0.6",
"@types/mocha": "^8.2.2",
"@types/node": "^14.0.0",
"@types/vscode": "1.76.0",
"@types/vscode": "1.79.0",
alexweininger marked this conversation as resolved.
Show resolved Hide resolved
"@typescript-eslint/eslint-plugin": "^4.28.3",
"@vscode/test-electron": "^2.1.5",
"eslint": "^7.19.0",
Expand All @@ -796,17 +796,18 @@
"webpack-cli": "^4.6.0"
},
"dependencies": {
"@azure/arm-appservice": "^11.0.0",
"@azure/arm-appservice": "^13.0.2",
"@azure/arm-resources": "^5.0.0",
"@azure/ms-rest-js": "^2.2.1",
"@microsoft/vscode-azext-azureappservice": "^0.7.4",
"@microsoft/vscode-azext-azureutils": "^0.3.8",
"@microsoft/vscode-azext-utils": "^1.2.2",
"@azure/core-client": "^1.7.3",
"@azure/core-rest-pipeline": "^1.11.0",
"@microsoft/vscode-azext-azureappservice": "^2.0.0",
"@microsoft/vscode-azext-azureappsettings": "^0.2.0",
"@microsoft/vscode-azext-azureutils": "^2.0.0",
"@microsoft/vscode-azext-utils": "^2.0.1",
"dotenv": "^6.2.0",
"fast-xml-parser": "^4.2.4",
"fs-extra": "^8.0.0",
"open": "^8.0.4",
"vscode-azurekudu": "^0.2.2",
"vscode-nls": "^4.1.1"
},
"extensionDependencies": [
Expand Down
2 changes: 1 addition & 1 deletion src/commands/appSettings/addAppSetting.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 { AppSettingsTreeItem } from "@microsoft/vscode-azext-azureappservice";
import { AppSettingsTreeItem } from "@microsoft/vscode-azext-azureappsettings";
import { IActionContext } from "@microsoft/vscode-azext-utils";
import { webAppFilter } from "../../constants";
import { ext } from "../../extensionVariables";
Expand Down
2 changes: 1 addition & 1 deletion src/commands/appSettings/deleteAppSettings.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 { AppSettingTreeItem } from "@microsoft/vscode-azext-azureappservice";
import { AppSettingTreeItem } from "@microsoft/vscode-azext-azureappsettings";
import { IActionContext } from "@microsoft/vscode-azext-utils";
import { webAppFilter } from "../../constants";
import { ext } from "../../extensionVariables";
Expand Down
3 changes: 2 additions & 1 deletion src/commands/appSettings/downloadAppSettings.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@
*--------------------------------------------------------------------------------------------*/

import { StringDictionary } from "@azure/arm-appservice";
import { AppSettingsTreeItem, confirmOverwriteSettings, IAppSettingsClient } from "@microsoft/vscode-azext-azureappservice";
import { confirmOverwriteSettings } from "@microsoft/vscode-azext-azureappservice";
import { AppSettingsTreeItem, IAppSettingsClient } from "@microsoft/vscode-azext-azureappsettings";
import { IActionContext, UserCancelledError } from "@microsoft/vscode-azext-utils";
import { DotenvParseOutput } from "dotenv";
import * as fse from 'fs-extra';
Expand Down
2 changes: 1 addition & 1 deletion src/commands/appSettings/editAppSetting.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 { AppSettingTreeItem } from "@microsoft/vscode-azext-azureappservice";
import { AppSettingTreeItem } from "@microsoft/vscode-azext-azureappsettings";
import { IActionContext } from "@microsoft/vscode-azext-utils";
import { webAppFilter } from "../../constants";
import { ext } from "../../extensionVariables";
Expand Down
2 changes: 1 addition & 1 deletion src/commands/appSettings/renameAppSetting.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 { AppSettingTreeItem } from "@microsoft/vscode-azext-azureappservice";
import { AppSettingTreeItem } from "@microsoft/vscode-azext-azureappsettings";
import { IActionContext } from "@microsoft/vscode-azext-utils";
import { webAppFilter } from "../../constants";
import { ext } from "../../extensionVariables";
Expand Down
2 changes: 1 addition & 1 deletion src/commands/appSettings/toggleSlotSetting.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 { AppSettingTreeItem } from "@microsoft/vscode-azext-azureappservice";
import { AppSettingTreeItem } from "@microsoft/vscode-azext-azureappsettings";
import { IActionContext } from "@microsoft/vscode-azext-utils";
import { webAppFilter } from "../../constants";
import { ext } from "../../extensionVariables";
Expand Down
3 changes: 2 additions & 1 deletion src/commands/appSettings/uploadAppSettings.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@
*--------------------------------------------------------------------------------------------*/

import { StringDictionary } from "@azure/arm-appservice";
import { AppSettingsTreeItem, confirmOverwriteSettings, IAppSettingsClient } from "@microsoft/vscode-azext-azureappservice";
import { confirmOverwriteSettings } from "@microsoft/vscode-azext-azureappservice";
import { AppSettingsTreeItem, IAppSettingsClient } from "@microsoft/vscode-azext-azureappsettings";
import { IActionContext } from "@microsoft/vscode-azext-utils";
import * as dotenv from 'dotenv';
import { Uri, window } from "vscode";
Expand Down
7 changes: 4 additions & 3 deletions src/commands/createWebApp/setPostPromptDefaults.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,13 @@
*--------------------------------------------------------------------------------------------*/

import { AppServicePlan, WebSiteManagementClient } from '@azure/arm-appservice';
import { SiteNameStep, tryGetAppServicePlan, WebsiteOS } from "@microsoft/vscode-azext-azureappservice";
import { AzExtLocation, getResourceGroupFromId, LocationListStep, uiUtils } from '@microsoft/vscode-azext-azureutils';
import { SiteNameStep, WebsiteOS, tryGetAppServicePlan } from "@microsoft/vscode-azext-azureappservice";
import { AzExtLocation, LocationListStep, getResourceGroupFromId, uiUtils } from '@microsoft/vscode-azext-azureutils';
import { DialogResponses, IActionContext, parseError } from "@microsoft/vscode-azext-utils";
import { MessageItem } from "vscode";
import { localize } from "../../localize";
import { createWebSiteClient } from "../../utils/azureClients";

alexweininger marked this conversation as resolved.
Show resolved Hide resolved
import { createWebSiteClient } from '../../utils/azureClients';
import { nonNullProp } from "../../utils/nonNull";
import { getWorkspaceSetting, updateGlobalSetting } from "../../vsCodeConfig/settings";
import { IWebAppWizardContext } from './IWebAppWizardContext';
Expand Down
15 changes: 8 additions & 7 deletions src/commands/createWebApp/stacks/getStackPicks.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,12 @@
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/

import { HttpOperationResponse, ServiceClient } from '@azure/ms-rest-js';
import { createGenericClient } from '@microsoft/vscode-azext-azureutils';
import { ServiceClient } from '@azure/core-client';
import { createPipelineRequest } from '@azure/core-rest-pipeline';
import { AzExtPipelineResponse, createGenericClient } from '@microsoft/vscode-azext-azureutils';
import { IAzureQuickPickItem, parseError } from '@microsoft/vscode-azext-utils';
import { localize } from '../../../localize';
import { createRequestUrl } from '../../../utils/requestUtils';
import { getWorkspaceSetting } from '../../../vsCodeConfig/settings';
import { FullJavaStack, FullWebAppStack, IWebAppWizardContext } from '../IWebAppWizardContext';
import { backupStacks } from './backupStacks';
Expand Down Expand Up @@ -95,15 +97,14 @@ async function getStacks(context: IWebAppWizardContext & { _stacks?: WebAppStack
let stacksArmResponse: StacksArmResponse;
try {
const client: ServiceClient = await createGenericClient(context, context);
const result: HttpOperationResponse = await client.sendRequest({
const result: AzExtPipelineResponse = await client.sendRequest(createPipelineRequest({
method: 'GET',
pathTemplate: '/providers/Microsoft.Web/webappstacks',
queryParameters: {
url: createRequestUrl('/providers/Microsoft.Web/webappstacks', {
'api-version': '2020-10-01',
removeHiddenStacks: String(!getWorkspaceSetting<boolean>('showHiddenStacks')),
removeDeprecatedStacks: 'true'
}
});
})
}));
stacksArmResponse = <StacksArmResponse>result.parsedBody;
context.usingBackupStacks = false;
} catch (error) {
Expand Down
7 changes: 3 additions & 4 deletions src/commands/postDeploy/checkLinuxWebAppDownDetector.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,13 @@
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/

import { createKuduClient } from "@microsoft/vscode-azext-azureappservice";
import { DeployResult } from '@microsoft/vscode-azext-azureappservice';
import { openInPortal } from '@microsoft/vscode-azext-azureutils';
import { callWithTelemetryAndErrorHandling, IActionContext, UserCancelledError } from "@microsoft/vscode-azext-utils";
import * as dayjs from "dayjs";
// eslint-disable-next-line import/no-internal-modules
import * as utc from 'dayjs/plugin/utc';
import { CancellationTokenSource } from "vscode";
import { KuduClient, KuduModels } from "vscode-azurekudu";
import { detectorTimestampFormat } from '../../constants';
import { ext } from '../../extensionVariables';
import { localize } from "../../localize";
Expand All @@ -28,8 +27,8 @@ export async function checkLinuxWebAppDownDetector(originalContext: IActionConte
context.valuesToMask.push(...originalContext.valuesToMask);
context.telemetry.properties.correlationId = correlationId;

const kuduClient: KuduClient = await createKuduClient(context, node.site);
const deployment: KuduModels.DeployResult = await kuduClient.deployment.getResult('latest');
const kuduClient = await node.site.createClient(context);
const deployment: DeployResult = await kuduClient.getDeployResult(context, 'latest');

if (!deployment.endTime) {
// if there's no deployment detected, nothing can be done
Expand Down
25 changes: 15 additions & 10 deletions src/commands/postDeploy/getLinuxDetectorError.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,17 @@
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/

import { ServiceClient } from '@azure/ms-rest-js';
import { createGenericClient } from '@microsoft/vscode-azext-azureutils';
import { ServiceClient } from '@azure/core-client';
import { createPipelineRequest } from '@azure/core-rest-pipeline';
import { AzExtPipelineResponse, createGenericClient } from '@microsoft/vscode-azext-azureutils';
import { IActionContext } from "@microsoft/vscode-azext-utils";
import * as dayjs from 'dayjs';
// eslint-disable-next-line import/no-internal-modules
import * as utc from 'dayjs/plugin/utc';
import { detectorTimestampFormat } from "../../constants";
import { localize } from "../../localize";
import { SiteTreeItem } from "../../tree/SiteTreeItem";
import { createRequestUrl } from '../../utils/requestUtils';
import { findTableByName, getValuesByColumnName } from "./parseDetectorResponse";

dayjs.extend(utc);
Expand All @@ -34,15 +36,18 @@ export async function getLinuxDetectorError(context: IActionContext, detectorId:
const detectorUri: string = `${node.id}/detectors/${detectorId}`;
const client: ServiceClient = await createGenericClient(context, node.subscription);

const queryParameters: { [key: string]: string } = {
'api-version': "2015-08-01",
startTime,
endTime,
// query param to return plain text rather than html
logFormat: 'plain'
};
const response: AzExtPipelineResponse = <AzExtPipelineResponse>await client.sendRequest(createPipelineRequest({
method: 'GET', url: createRequestUrl(detectorUri, {
'api-version': "2015-08-01",
startTime,
endTime,
// query param to return plain text rather than html
logFormat: 'plain'
})
}));

const responseJson: detectorResponseJSON = <detectorResponseJSON>response.parsedBody;

const responseJson: detectorResponseJSON = <detectorResponseJSON>(await client.sendRequest({ method: 'GET', url: detectorUri, queryParameters })).parsedBody;
if (!responseJson.properties) {
return undefined;
}
Expand Down
9 changes: 5 additions & 4 deletions src/commands/postDeploy/validateWebSite.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,10 @@
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/

import { HttpOperationResponse, RestError, ServiceClient } from '@azure/ms-rest-js';
import { createGenericClient } from '@microsoft/vscode-azext-azureutils';
import { callWithTelemetryAndErrorHandling, IActionContext, UserCancelledError } from '@microsoft/vscode-azext-utils';
import { ServiceClient } from '@azure/core-client';
import { RestError, createPipelineRequest } from '@azure/core-rest-pipeline';
import { AzExtPipelineResponse, createGenericClient } from '@microsoft/vscode-azext-azureutils';
import { IActionContext, UserCancelledError, callWithTelemetryAndErrorHandling } from '@microsoft/vscode-azext-utils';
import { CancellationTokenSource } from 'vscode';
import { SiteTreeItem } from '../../tree/SiteTreeItem';
import { delay } from '../../utils/delay';
Expand Down Expand Up @@ -45,7 +46,7 @@ export async function validateWebSite(originalContext: IActionContext, deploymen
}

try {
const response: HttpOperationResponse = await client.sendRequest({ method: 'GET', url });
const response: AzExtPipelineResponse = await client.sendRequest(createPipelineRequest({ method: 'GET', url }));
currentStatusCode = response.status;
} catch (error) {
currentStatusCode = error instanceof RestError ? error.statusCode : 0;
Expand Down
9 changes: 2 additions & 7 deletions src/commands/registerCommands.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,8 @@
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/

import { AppSettingTreeItem, registerSiteCommand } from '@microsoft/vscode-azext-azureappservice';
import { registerSiteCommand } from '@microsoft/vscode-azext-azureappservice';
import { AppSettingTreeItem } from '@microsoft/vscode-azext-azureappsettings';
import { openInPortal as uiOpenInPortal } from '@microsoft/vscode-azext-azureutils';
import { AzExtTreeItem, IActionContext, nonNullValue, registerCommandWithTreeNodeUnwrapping, unwrapTreeNodeCommandCallback } from '@microsoft/vscode-azext-utils';
import { ext } from '../extensionVariables';
Expand Down Expand Up @@ -56,13 +57,9 @@ export function registerCommands(): void {
registerCommandWithTreeNodeUnwrapping('appService.appSettings.ToggleSlotSetting', toggleSlotSetting);
registerCommandWithTreeNodeUnwrapping('appService.appSettings.Upload', uploadAppSettings);
registerCommandWithTreeNodeUnwrapping('appService.Browse', browseWebsite);
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
//@ts-ignore
registerCommandWithTreeNodeUnwrapping('appService.ConfigureDeploymentSource', editScmType);
registerCommandWithTreeNodeUnwrapping('appService.connectToGitHub', connectToGitHub);
registerCommandWithTreeNodeUnwrapping('appService.CreateSlot', createSlot);
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
//@ts-ignore
registerCommandWithTreeNodeUnwrapping('appService.CreateWebApp', createWebApp);
registerCommandWithTreeNodeUnwrapping('appService.CreateWebAppAdvanced', createWebAppAdvanced);
registerCommandWithTreeNodeUnwrapping('appService.Delete', deleteWebApp);
Expand Down Expand Up @@ -90,8 +87,6 @@ export function registerCommands(): void {
registerCommandWithTreeNodeUnwrapping('appService.toggleAppSettingVisibility', async (actionContext: IActionContext, node?: AppSettingTreeItem) => { await nonNullValue(node).toggleValueVisibility(actionContext); }, 250);
registerCommandWithTreeNodeUnwrapping('appService.ViewCommitInGitHub', viewCommitInGitHub);
registerCommandWithTreeNodeUnwrapping('appService.ViewProperties', viewProperties);
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
//@ts-ignore
registerSiteCommand('appService.Deploy', unwrapTreeNodeCommandCallback(deploy));
registerSiteCommand('appService.DeploySlot', unwrapTreeNodeCommandCallback(deploySlot));
registerSiteCommand('appService.Redeploy', unwrapTreeNodeCommandCallback(redeployDeployment));
Expand Down
2 changes: 1 addition & 1 deletion src/tree/CosmosDBConnection.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
*--------------------------------------------------------------------------------------------*/

import { StringDictionary } from '@azure/arm-appservice';
import { IAppSettingsClient } from '@microsoft/vscode-azext-azureappservice';
import { IAppSettingsClient } from '@microsoft/vscode-azext-azureappsettings';
import { AzExtTreeItem, DialogResponses, IActionContext, TreeItemIconPath } from '@microsoft/vscode-azext-utils';
import { ThemeIcon } from 'vscode';
import { localize } from '../localize';
Expand Down
3 changes: 2 additions & 1 deletion src/tree/CosmosDBTreeItem.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@
*--------------------------------------------------------------------------------------------*/

import { StringDictionary } from '@azure/arm-appservice';
import { IAppSettingsClient, ParsedSite, validateAppSettingKey } from '@microsoft/vscode-azext-azureappservice';
import { ParsedSite } from '@microsoft/vscode-azext-azureappservice';
import { IAppSettingsClient, validateAppSettingKey } from '@microsoft/vscode-azext-azureappsettings';
import { openInPortal } from '@microsoft/vscode-azext-azureutils';
import { AzExtParentTreeItem, AzExtTreeItem, GenericTreeItem, IActionContext, ICreateChildImplContext, TreeItemIconPath, UserCancelledError, apiUtils } from '@microsoft/vscode-azext-utils';
import * as vscode from 'vscode';
Expand Down
8 changes: 5 additions & 3 deletions src/tree/ResolvedWebAppResource.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,12 @@
*--------------------------------------------------------------------------------------------*/

import { AppServicePlan, Site, SiteConfig, SiteLogsConfig, SiteSourceControl } from '@azure/arm-appservice';
import { AppSettingsTreeItem, AppSettingTreeItem, DeleteLastServicePlanStep, DeleteSiteStep, DeploymentsTreeItem, DeploymentTreeItem, FolderTreeItem, LogFilesTreeItem, ParsedSite, SiteFilesTreeItem } from '@microsoft/vscode-azext-azureappservice';
import { AzExtTreeItem, AzureWizard, DeleteConfirmationStep, IActionContext, ISubscriptionContext, nonNullProp, TreeItemIconPath } from '@microsoft/vscode-azext-utils';
import { DeleteLastServicePlanStep, DeleteSiteStep, DeploymentTreeItem, DeploymentsTreeItem, FolderTreeItem, LogFilesTreeItem, ParsedSite, SiteFilesTreeItem } from '@microsoft/vscode-azext-azureappservice';
import { AppSettingTreeItem, AppSettingsTreeItem } from '@microsoft/vscode-azext-azureappsettings';
import { AzExtTreeItem, AzureWizard, DeleteConfirmationStep, IActionContext, ISubscriptionContext, TreeItemIconPath, nonNullProp } from '@microsoft/vscode-azext-utils';
import { ResolvedAppResourceBase } from '@microsoft/vscode-azext-utils/hostapi';
import { githubCommitContextValueRegExp } from '../commands/deployments/viewCommitInGitHub';
import { ext } from '../extensionVariables';
import { localize } from '../localize';
import { createActivityContext } from '../utils/activityUtils';
import { matchContextValue } from '../utils/contextUtils';
Expand Down Expand Up @@ -122,7 +124,7 @@ export class ResolvedWebAppResource implements ResolvedAppResourceBase, ISiteTre
public async loadMoreChildrenImpl(_clearCache: boolean, context: IActionContext): Promise<AzExtTreeItem[]> {
const proxyTree: SiteTreeItem = this as unknown as SiteTreeItem;

this.appSettingsNode = new AppSettingsTreeItem(proxyTree, this.site, {
this.appSettingsNode = new AppSettingsTreeItem(proxyTree, this.site, ext.prefix, {
contextValuesToAdd: ['appService']
});
this._connectionsNode = new CosmosDBTreeItem(proxyTree, this.site);
Expand Down
Loading