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 2 commits
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
3,361 changes: 1,259 additions & 2,102 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": "^0.1.3",
"@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.57.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": "^0.4.0",
"@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
13 changes: 7 additions & 6 deletions src/commands/registerCommands.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 { 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, unwrapArgs } from '@microsoft/vscode-azext-utils';
import { AzExtTreeItem, IActionContext, nonNullValue, registerCommandWithTreeNodeUnwrapping, unwrapTreeNodeCommandCallback } from '@microsoft/vscode-azext-utils';
import { ext } from '../extensionVariables';
import { DeploymentSlotsNATreeItem, ScaleUpTreeItem } from '../tree/DeploymentSlotsTreeItem';
import { addAppSetting } from './appSettings/addAppSetting';
Expand Down Expand Up @@ -86,8 +87,8 @@ 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);
registerSiteCommand('appService.Deploy', unwrapArgs(deploy));
registerSiteCommand('appService.DeploySlot', unwrapArgs(deploySlot));
registerSiteCommand('appService.Redeploy', unwrapArgs(redeployDeployment));
registerSiteCommand('appService.viewDeploymentLogs', unwrapArgs(viewDeploymentLogs));
registerSiteCommand('appService.Deploy', unwrapTreeNodeCommandCallback(deploy));
registerSiteCommand('appService.DeploySlot', unwrapTreeNodeCommandCallback(deploySlot));
registerSiteCommand('appService.Redeploy', unwrapTreeNodeCommandCallback(redeployDeployment));
registerSiteCommand('appService.viewDeploymentLogs', unwrapTreeNodeCommandCallback(viewDeploymentLogs));
}
6 changes: 3 additions & 3 deletions src/extension.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@

import { registerAppServiceExtensionVariables } from '@microsoft/vscode-azext-azureappservice';
import { registerAzureUtilsExtensionVariables } from '@microsoft/vscode-azext-azureutils';
import { AzExtResourceType, callWithTelemetryAndErrorHandling, createApiProvider, createAzExtOutputChannel, createExperimentationService, IActionContext, registerErrorHandler, registerReportIssueCommand, registerUIExtensionVariables } from '@microsoft/vscode-azext-utils';
import { AzureExtensionApi, AzureExtensionApiProvider } from '@microsoft/vscode-azext-utils/api';
import { apiUtils, AzureExtensionApi, callWithTelemetryAndErrorHandling, createApiProvider, createAzExtOutputChannel, createExperimentationService, IActionContext, registerErrorHandler, registerReportIssueCommand, registerUIExtensionVariables } from '@microsoft/vscode-azext-utils';
import { AzExtResourceType } from '@microsoft/vscode-azureresources-api';
import * as vscode from 'vscode';
import { AppServiceFileSystem } from './AppServiceFileSystem';
import { revealTreeItem } from './commands/api/revealTreeItem';
Expand All @@ -21,7 +21,7 @@ export async function activateInternal(
loadStartTime: number, loadEndTime: number
},
ignoreBundle?: boolean
): Promise<AzureExtensionApiProvider> {
): Promise<apiUtils.AzureExtensionApiProvider> {
ext.context = context;
ext.ignoreBundle = ignoreBundle;

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
8 changes: 4 additions & 4 deletions src/tree/CosmosDBTreeItem.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,10 @@
*--------------------------------------------------------------------------------------------*/

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 } from '@microsoft/vscode-azext-utils';
import { AzureExtensionApiProvider } from '@microsoft/vscode-azext-utils/api';
import { AzExtParentTreeItem, AzExtTreeItem, GenericTreeItem, IActionContext, ICreateChildImplContext, TreeItemIconPath, UserCancelledError, apiUtils } from '@microsoft/vscode-azext-utils';
import * as vscode from 'vscode';
import { localize } from '../localize';
import { nonNullProp } from '../utils/nonNull';
Expand All @@ -23,7 +23,7 @@ export class CosmosDBTreeItem extends AzExtParentTreeItem {
public readonly childTypeLabel: string = 'Connection';
public readonly parent!: SiteTreeItem;
public readonly site: ParsedSite;
public cosmosDBExtension: vscode.Extension<AzureExtensionApiProvider | undefined> | undefined;
public cosmosDBExtension: vscode.Extension<apiUtils.AzureExtensionApiProvider | undefined> | undefined;
public suppressMaskLabel = true;

private readonly _endpointSuffix: string = '_ENDPOINT';
Expand Down
Loading