Skip to content

Commit

Permalink
Update deprecated Azure SDK packages (#61)
Browse files Browse the repository at this point in the history
  • Loading branch information
Tatsinnit authored Mar 15, 2021
1 parent 707d860 commit 430e893
Show file tree
Hide file tree
Showing 11 changed files with 3,731 additions and 405 deletions.
4,082 changes: 3,706 additions & 376 deletions package-lock.json

Large diffs are not rendered by default.

15 changes: 6 additions & 9 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -128,24 +128,21 @@
},
"dependencies": {
"@azure/arm-containerservice": "^7.0.1",
"@azure/arm-monitor": "^6.0.0",
"@azure/arm-resources": "^3.0.0",
"@azure/arm-storage": "^15.2.0",
"@azure/arm-subscriptions": "^3.0.0",
"@azure/storage-blob": "^12.1.2",
"axios": "^0.19.2",
"azure-arm-containerservice": "^7.0.0",
"azure-arm-monitor": "^5.4.0",
"azure-arm-resource": "^7.4.0",
"azure-arm-storage": "^8.1.0",
"azure-blob-storage": "^4.2.3",
"azure-storage": "^2.10.3",
"handlebars": "^4.7.6",
"js-yaml": "^3.14.0",
"jszip": "^3.5.0",
"ms-rest": "^2.5.4",
"ms-rest-azure": "^2.6.0",
"replace": "^1.2.0",
"tmp": "^0.2.1",
"util": "^0.12.3",
"vscode-azureextensionui": "^0.27.1",
"vscode-extension-telemetry": "^0.0.17",
"vscode-azureextensionui": "^0.39.4",
"vscode-extension-telemetry": "^0.1.6",
"vscode-kubernetes-tools-api": "^1.0.0"
},
"repository": {
Expand Down
4 changes: 2 additions & 2 deletions src/azure-api-utils.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { ISubscriptionContext } from "vscode-azureextensionui";
import { SubscriptionClient } from 'azure-arm-resource';
import { SubscriptionModels } from '@azure/arm-subscriptions';

export interface PartialList<T> extends Array<T> {
nextLink?: string;
Expand All @@ -25,7 +25,7 @@ function bitAfter(bits: string[], after: string): string | undefined {
return bits[afterIndex + 1];
}

export function toSubscription(context: ISubscriptionContext): SubscriptionClient.SubscriptionModels.Subscription {
export function toSubscription(context: ISubscriptionContext): SubscriptionModels.Subscription {
return {
id: context.subscriptionPath,
subscriptionId: context.subscriptionId,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { GenericResource } from 'azure-arm-resource/lib/resource/models';
import { GenericResource } from '@azure/arm-resources/esm/models';

export interface resourceNode{
resource: GenericResource;
Expand Down
2 changes: 1 addition & 1 deletion src/commands/detectorDiagnostics/detectorDiagnostics.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import * as path from 'path';
import * as fs from 'fs';
import * as htmlhandlers from "handlebars";
import { Errorable } from '../utils/errorable';
import ResourceManagementClient from 'azure-arm-resource/lib/resource/resourceManagementClient';
import { ResourceManagementClient } from '@azure/arm-resources';

export default async function detectorDiagnostics(
context: IActionContext,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ export interface AppLensARMResponse {
readonly id: string;
readonly name: string;
readonly location: string;
readonly resourceGroup: string;
readonly resourceGroup?: string;
readonly properties: any;
readonly type: string;
}
6 changes: 3 additions & 3 deletions src/commands/periscope/helpers/periscopehelper.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@ import * as vscode from 'vscode';
import * as k8s from 'vscode-kubernetes-tools-api';
import { getSASKey, LinkDuration } from '../../utils/azurestorage';
import { parseResource } from '../../../azure-api-utils';
import * as ast from 'azure-arm-storage';
import * as ast from '@azure/arm-storage';
import { PeriscopeStorage, PeriscopeHTMLInterface } from '../models/storage';
import * as amon from 'azure-arm-monitor';
import * as amon from '@azure/arm-monitor';
import * as htmlhandlers from "handlebars";
import * as path from 'path';
import * as fs from 'fs';
Expand All @@ -23,7 +23,7 @@ export async function getClusterDiagnosticSettings(
try {
// Get daignostic setting via diagnostic monitor
const diagnosticMonitor = new amon.MonitorManagementClient(cluster.root.credentials, cluster.root.subscriptionId);
const diagnosticSettings = await diagnosticMonitor.diagnosticSettingsOperations.list(cluster.id!);
const diagnosticSettings = await diagnosticMonitor.diagnosticSettings.list(cluster.id!);

return diagnosticSettings;
} catch (e) {
Expand Down
2 changes: 1 addition & 1 deletion src/commands/utils/clusters.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import * as vscode from 'vscode';
import AksClusterTreeItem from "../../tree/aksClusterTreeItem";
import { parseResource } from "../../azure-api-utils";
import * as azcs from 'azure-arm-containerservice'; // deprecated, but @azure/arm-containerservice doesn't play nicely with AzureAccount, so...
import * as azcs from '@azure/arm-containerservice';

export async function getKubeconfigYaml(target: AksClusterTreeItem): Promise<string | undefined> {
const { resourceGroupName, name } = parseResource(target.id!);
Expand Down
5 changes: 2 additions & 3 deletions src/extension.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import * as vscode from 'vscode';
import * as k8s from 'vscode-kubernetes-tools-api';
import AksClusterTreeItem from './tree/aksClusterTreeItem';
import AzureAccountTreeItem from './tree/azureAccountTreeItem';
import { createTelemetryReporter, registerUIExtensionVariables, AzExtTreeDataProvider, AzureUserInput, registerCommand, IActionContext } from 'vscode-azureextensionui';
import { createAzExtOutputChannel, registerUIExtensionVariables, AzExtTreeDataProvider, AzureUserInput, registerCommand, IActionContext } from 'vscode-azureextensionui';
import selectSubscriptions from './commands/selectSubscriptions';
import detectorDiagnostics from './commands/detectorDiagnostics/detectorDiagnostics';
import periscope from './commands/periscope/periscope';
Expand All @@ -22,8 +22,7 @@ export async function activate(context: vscode.ExtensionContext) {
const uiExtensionVariables = {
context,
ignoreBundle: true,
outputChannel: vscode.window.createOutputChannel('Azure Identity'),
reporter: createTelemetryReporter(context),
outputChannel: createAzExtOutputChannel('Azure Identity', ''),
ui: new AzureUserInput(context.globalState)
};

Expand Down
8 changes: 4 additions & 4 deletions src/tree/aksClusterTreeItem.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
import { AzExtParentTreeItem, AzureTreeItem, ISubscriptionContext } from "vscode-azureextensionui";
import { Resource } from "azure-arm-storage/lib/models";
import { CloudExplorerV1 } from "vscode-kubernetes-tools-api";
import { SubscriptionClient } from 'azure-arm-resource';
import { SubscriptionModels } from '@azure/arm-subscriptions';
import { toSubscription } from "../azure-api-utils";
import { getExtensionPath } from "../commands/utils/host";
import * as path from 'path';
import * as vscode from 'vscode';
import { Resource } from "@azure/arm-resources/esm/models";

// The de facto API of tree nodes that represent individual AKS clusters.
// Tree items should implement this interface to maintain backward compatibility with previous versions of the extension.
Expand All @@ -14,7 +14,7 @@ export interface AksClusterTreeNode {
readonly armId: string;
readonly name: string;
readonly session: ISubscriptionContext;
readonly subscription: SubscriptionClient.SubscriptionModels.Subscription;
readonly subscription: SubscriptionModels.Subscription;
}

export default class AksClusterTreeItem extends AzureTreeItem implements AksClusterTreeNode {
Expand Down Expand Up @@ -45,7 +45,7 @@ export default class AksClusterTreeItem extends AzureTreeItem implements AksClus
return this.root;
}

public get subscription(): SubscriptionClient.SubscriptionModels.Subscription {
public get subscription(): SubscriptionModels.Subscription {
return toSubscription(this.root);
}

Expand Down
8 changes: 4 additions & 4 deletions src/tree/subscriptionTreeItem.ts
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
import { IActionContext, SubscriptionTreeItemBase, AzExtTreeItem, AzExtParentTreeItem, ISubscriptionContext } from 'vscode-azureextensionui';
import ResourceManagementClient from 'azure-arm-resource/lib/resource/resourceManagementClient';
import { listAll, toSubscription } from '../azure-api-utils';
import AksClusterTreeItem from './aksClusterTreeItem';
import { SubscriptionClient } from 'azure-arm-resource';
import { SubscriptionModels } from '@azure/arm-subscriptions';
import { ResourceManagementClient } from '@azure/arm-resources';

// The de facto API of tree nodes that represent individual Azure subscriptions.
// Tree items should implement this interface to maintain backward compatibility with previous versions of the extension.
export interface SubscriptionTreeNode {
readonly nodeType: 'subscription';
readonly name: string;
readonly session: ISubscriptionContext;
readonly subscription: SubscriptionClient.SubscriptionModels.Subscription;
readonly subscription: SubscriptionModels.Subscription;
}

export default class SubscriptionTreeItem extends SubscriptionTreeItemBase implements SubscriptionTreeNode {
Expand Down Expand Up @@ -41,7 +41,7 @@ export default class SubscriptionTreeItem extends SubscriptionTreeItemBase imple
return this.root;
}

public get subscription(): SubscriptionClient.SubscriptionModels.Subscription {
public get subscription(): SubscriptionModels.Subscription {
return toSubscription(this.root);
}

Expand Down

0 comments on commit 430e893

Please sign in to comment.