Skip to content

Commit

Permalink
Migrate T1 packages to T2 (#1357)
Browse files Browse the repository at this point in the history
* T2 Only

* Changes to move towards T2

Co-authored-by: Megan Mott <[email protected]>
  • Loading branch information
nturinski and motm32 authored Jan 25, 2023
1 parent 7ac8301 commit a13082d
Show file tree
Hide file tree
Showing 33 changed files with 623 additions and 1,430 deletions.
35 changes: 1 addition & 34 deletions appservice/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 1 addition & 3 deletions appservice/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -37,10 +37,8 @@
"@azure/arm-appservice": "^13.0.2",
"@azure/arm-operationalinsights": "^8.0.1",
"@azure/arm-resourcegraph": "^4.0.0",
"@azure/arm-resources": "^5.0.0",
"@azure/arm-subscriptions": "^5.0.0",
"@azure/arm-resources-subscriptions": "^2.0.1",
"@azure/ms-rest-azure-env": "^2.0.0",
"@azure/ms-rest-js": "^2.3.0",
"@azure/storage-blob": "^12.3.0",
"@microsoft/vscode-azext-azureutils": "^0.3.7",
"@microsoft/vscode-azext-utils": "^0.4.0",
Expand Down
95 changes: 20 additions & 75 deletions azure/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,15 @@

/* eslint-disable @typescript-eslint/no-explicit-any */

import type { ExtendedLocation, ResourceGroup } from '@azure/arm-resources';
import type { Location } from '@azure/arm-resources-subscriptions';
import type { Environment } from '@azure/ms-rest-azure-env';
import type { HttpOperationResponse, RequestPrepareOptions, ServiceClient } from '@azure/ms-rest-js';
import type { PagedAsyncIterableIterator } from '@azure/core-paging';
import { Disposable, Progress } from 'vscode';
import type { AzExtParentTreeItem, AzExtServiceClientCredentials, AzExtServiceClientCredentialsT1, AzExtServiceClientCredentialsT2, AzExtTreeItem, AzureNameStep, AzureWizardExecuteStep, AzureWizardPromptStep, IActionContext, IAzureNamingRules, IAzureQuickPickItem, IAzureQuickPickOptions, IRelatedNameWizardContext, ISubscriptionActionContext, ISubscriptionContext, IWizardOptions, UIExtensionVariables } from '@microsoft/vscode-azext-utils';
import { ExtendedLocation, ResourceGroup } from '@azure/arm-resources';
import type { StorageAccount } from '@azure/arm-storage';
import type { ServiceClient, ServiceClientOptions } from '@azure/core-client';
import type { PagedAsyncIterableIterator } from '@azure/core-paging';
import type { PipelineRequestOptions, PipelineResponse } from '@azure/core-rest-pipeline';
import type { Environment } from '@azure/ms-rest-azure-env';
import type { AzExtParentTreeItem, AzExtServiceClientCredentials, AzExtServiceClientCredentialsT2, AzExtTreeItem, AzureNameStep, AzureWizardExecuteStep, AzureWizardPromptStep, IActionContext, IAzureNamingRules, IAzureQuickPickItem, IAzureQuickPickOptions, IRelatedNameWizardContext, ISubscriptionActionContext, ISubscriptionContext, IWizardOptions, UIExtensionVariables } from '@microsoft/vscode-azext-utils';
import type { Progress } from 'vscode';

export type OpenInPortalOptions = {
/**
Expand All @@ -24,53 +25,13 @@ export type OpenInPortalOptions = {
/**
* Implement this class to display resources under a standard subscription tree item
*/
export abstract class SubscriptionTreeItemBase extends AzExtParentTreeItem {
export declare abstract class SubscriptionTreeItemBase extends AzExtParentTreeItem {
public static readonly contextValue: string;
public readonly contextValue: string;
public readonly label: string;
constructor(parent: AzExtParentTreeItem, subscription: ISubscriptionContext);
}

/**
* A tree item for an Azure Account, which will display subscriptions. For Azure-centered extensions, this will be at the root of the tree.
*/
export declare abstract class AzureAccountTreeItemBase extends AzExtParentTreeItem implements Disposable {
public static readonly contextValue: string;
public contextValue: string;
public label: string;
public disposables: Disposable[];
public childTypeLabel: string;
public autoSelectInTreeItemPicker: boolean;

//#region Methods implemented by base class
/**
* Implement this to create a subscription tree item under this Azure Account node
* @param root Contains basic information about the subscription - should be passed in to the constructor of `SubscriptionTreeItemBase`
*/
public abstract createSubscriptionTreeItem(root: ISubscriptionContext): SubscriptionTreeItemBase | Promise<SubscriptionTreeItemBase>;
//#endregion

/**
* Azure Account Tree Item
* @param parent The parent of this node or undefined if it's the root of the tree.
* @param testAccount Unofficial api for testing - see `TestAzureAccount` in @microsoft/vscode-azext-dev package
*/
public constructor(parent?: AzExtParentTreeItem, testAccount?: {});

public dispose(): void;

/**
* If user is logged in and only has one subscription selected, adds that to the wizardContext and returns undefined
* Else, returns a prompt step for a subscription
*/
public getSubscriptionPromptStep(wizardContext: Partial<ISubscriptionActionContext>): Promise<AzureWizardPromptStep<ISubscriptionActionContext> | undefined>;

public hasMoreChildrenImpl(): boolean;
public loadMoreChildrenImpl(clearCache: boolean, context: IActionContext): Promise<AzExtTreeItem[]>;
public pickTreeItemImpl(expectedContextValues: (string | RegExp)[]): Promise<AzExtTreeItem | undefined>;
public getIsLoggedIn(): Promise<boolean>;
}

/**
* Combines the root.environment.portalLink and id to open the resource in the portal.
*
Expand Down Expand Up @@ -231,7 +192,7 @@ export declare class ResourceGroupListStep<T extends IResourceGroupWizardContext
public shouldPrompt(wizardContext: T): boolean;
}

export class ResourceGroupNameStep<T extends IResourceGroupWizardContext> extends AzureWizardPromptStep<T> {
export declare class ResourceGroupNameStep<T extends IResourceGroupWizardContext> extends AzureWizardPromptStep<T> {
public prompt(wizardContext: T): Promise<void>;
public shouldPrompt(wizardContext: T): boolean;
}
Expand Down Expand Up @@ -348,26 +309,10 @@ export interface IAzureUtilsExtensionVariables extends UIExtensionVariables {
*/
export declare function registerAzureUtilsExtensionVariables(extVars: IAzureUtilsExtensionVariables): void;

export interface IMinimumServiceClientOptions {
acceptLanguage?: string,
baseUri?: string;
/**
* Pass in endpoint as a workaround for https://github.com/Azure/azure-sdk-for-js/issues/20651.
* Value should be the same as `baseUri`.
*/
endpoint?: string;
userAgent?: string | ((defaultUserAgent: string) => string);

/**
* NOTE: Using "any" to allow for the use of different versions of "@azure/ms-rest-js", which are largely compatible for our purposes
*/
requestPolicyFactories?: any[] | ((defaultRequestPolicyFactories: any[]) => (void | any[]));
}

/**
* Credential type to be used for creating generic http rest clients
*/
export type AzExtGenericCredentials = AzExtServiceClientCredentialsT1 | AzExtServiceClientCredentialsT2 | AzExtServiceClientCredentials;
export type AzExtGenericCredentials = AzExtServiceClientCredentialsT2 | AzExtServiceClientCredentials;
export type AzExtGenericClientInfo = AzExtGenericCredentials | { credentials: AzExtGenericCredentials; environment: Environment; } | undefined;

/**
Expand All @@ -376,18 +321,18 @@ export type AzExtGenericClientInfo = AzExtGenericCredentials | { credentials: Az
* 2. Uses resourceManagerEndpointUrl to support sovereigns (if clientInfo corresponds to an Azure environment)
* @param clientInfo The client/credentials info or `undefined` if no credentials are needed
*/
export function createGenericClient(context: IActionContext, clientInfo: AzExtGenericClientInfo): Promise<ServiceClient>;
export declare function createGenericClient(context: IActionContext, clientInfo: AzExtGenericClientInfo | undefined): Promise<ServiceClient>;

export type AzExtRequestPrepareOptions = RequestPrepareOptions & { rejectUnauthorized?: boolean }
export type AzExtRequestPrepareOptions = PipelineRequestOptions & { rejectUnauthorized?: boolean }

/**
* Send request with a timeout specified and turn off retry policy (because retrying could take a lot longer)
* @param timeout The timeout in milliseconds
* @param clientInfo The client/credentials info or `undefined` if no credentials are needed
*/
export function sendRequestWithTimeout(context: IActionContext, options: AzExtRequestPrepareOptions, timeout: number, clientInfo: AzExtGenericClientInfo): Promise<HttpOperationResponse>;
export declare function sendRequestWithTimeout(context: IActionContext, options: AzExtRequestPrepareOptions, timeout: number, clientInfo: AzExtGenericClientInfo): Promise<PipelineResponse>;

export type AzExtClientType<T> = new (credentials: AzExtServiceClientCredentials, subscriptionId: string, options?: IMinimumServiceClientOptions) => T;
export type AzExtClientType<T extends ServiceClient> = new (credentials: AzExtServiceClientCredentials, subscriptionId: string, options?: ServiceClientOptions) => T;

/**
* Convenience type to give us multiple ways to specify subscription info and action context depending on the scenario
Expand All @@ -397,23 +342,23 @@ export type AzExtClientContext = ISubscriptionActionContext | [IActionContext, I
/**
* Converts `AzExtClientContext` into a single object: `ISubscriptionActionContext`
*/
export function parseClientContext(clientContext: AzExtClientContext): ISubscriptionActionContext;
export declare function parseClientContext(clientContext: AzExtClientContext): ISubscriptionActionContext;

/**
* Creates an Azure client, ensuring best practices are followed. For example:
* 1. Adds extension-specific user agent
* 2. Uses resourceManagerEndpointUrl to support sovereigns
*/
export function createAzureClient<T>(context: AzExtClientContext, clientType: AzExtClientType<T>): T;
export declare function createAzureClient<T extends ServiceClient>(context: AzExtClientContext, clientType: AzExtClientType<T>): T;

export type AzExtSubscriptionClientType<T> = new (credentials: AzExtServiceClientCredentials, options?: IMinimumServiceClientOptions) => T;
export type AzExtSubscriptionClientType<T> = new (credentials: AzExtServiceClientCredentials, options?: ServiceClientOptions) => T;

/**
* Creates an Azure subscription client, ensuring best practices are followed. For example:
* 1. Adds extension-specific user agent
* 2. Uses resourceManagerEndpointUrl to support sovereigns
*/
export function createAzureSubscriptionClient<T>(context: AzExtClientContext, clientType: AzExtSubscriptionClientType<T>): T;
export declare function createAzureSubscriptionClient<T>(context: AzExtClientContext, clientType: AzExtSubscriptionClientType<T>): T;

export declare namespace uiUtils {
export function listAllIterator<T>(iterator: PagedAsyncIterableIterator<T>): Promise<T[]>
Expand All @@ -427,5 +372,5 @@ interface ParsedAzureResourceId {
resourceName: string;
}

export function parseAzureResourceId(id: string): ParsedAzureResourceId;
export function getResourceGroupFromId(id: string): string;
export declare function parseAzureResourceId(id: string): ParsedAzureResourceId;
export declare function getResourceGroupFromId(id: string): string;
128 changes: 65 additions & 63 deletions azure/package.json
Original file line number Diff line number Diff line change
@@ -1,65 +1,67 @@
{
"name": "@microsoft/vscode-azext-azureutils",
"author": "Microsoft Corporation",
"version": "0.3.7",
"description": "Common Azure utils for developing Azure extensions for VS Code",
"tags": [
"azure",
"vscode"
],
"keywords": [
"azure",
"vscode"
],
"main": "out/src/index.js",
"types": "index.d.ts",
"license": "MIT",
"repository": {
"type": "git",
"url": "https://github.com/Microsoft/vscode-azuretools"
},
"bugs": {
"url": "https://github.com/Microsoft/vscode-azuretools/issues"
},
"homepage": "https://github.com/Microsoft/vscode-azuretools/blob/main/azure/README.md",
"scripts": {
"build": "tsc -p ./",
"prepack": "tsc -p ./",
"compile": "tsc -watch -p ./",
"lint": "eslint --ext .ts .",
"lint-fix": "eslint --ext .ts . --fix",
"pretest": "npm run build",
"test": "node ./out/test/runTest.js"
},
"dependencies": {
"@azure/arm-resources": "^5.0.0",
"@azure/arm-resources-profile-2020-09-01-hybrid": "^2.0.0",
"@azure/arm-resources-subscriptions": "^2.0.0",
"@azure/arm-storage": "^17.0.0",
"@azure/arm-storage-profile-2020-09-01-hybrid": "^2.0.0",
"@azure/ms-rest-js": "^2.2.1",
"@microsoft/vscode-azext-utils": "^0.4.0",
"semver": "^7.3.7",
"vscode-nls": "^5.0.1"
},
"devDependencies": {
"@azure/core-paging": "^1.2.1",
"@azure/ms-rest-azure-env": "^2.0.0",
"@azure/ms-rest-nodeauth": "^3.1.1",
"@microsoft/eslint-config-azuretools": "^0.1.0",
"@microsoft/vscode-azext-dev": "^0.1.4",
"@types/mocha": "^7.0.2",
"@types/node": "^14.0.0",
"@types/semver": "^7.3.9",
"@types/vscode": "1.64.0",
"@typescript-eslint/eslint-plugin": "^4.28.3",
"@vscode/test-electron": "^2.1.5",
"eslint": "^7.19.0",
"eslint-plugin-import": "^2.22.1",
"glob": "^7.1.6",
"mocha": "^9.1.3",
"mocha-junit-reporter": "^2.0.2",
"mocha-multi-reporters": "^1.1.7",
"typescript": "^4.9.4"
}
"name": "@microsoft/vscode-azext-azureutils",
"author": "Microsoft Corporation",
"version": "0.4.0",
"description": "Common Azure utils for developing Azure extensions for VS Code",
"tags": [
"azure",
"vscode"
],
"keywords": [
"azure",
"vscode"
],
"main": "out/src/index.js",
"types": "index.d.ts",
"license": "MIT",
"repository": {
"type": "git",
"url": "https://github.com/Microsoft/vscode-azuretools"
},
"bugs": {
"url": "https://github.com/Microsoft/vscode-azuretools/issues"
},
"homepage": "https://github.com/Microsoft/vscode-azuretools/blob/main/azure/README.md",
"scripts": {
"build": "tsc -p ./",
"prepack": "tsc -p ./",
"compile": "tsc -watch -p ./",
"lint": "eslint --ext .ts .",
"lint-fix": "eslint --ext .ts . --fix",
"pretest": "npm run build",
"test": "node ./out/test/runTest.js"
},
"dependencies": {
"@azure/arm-resources": "^5.0.0",
"@azure/arm-resources-profile-2020-09-01-hybrid": "^2.0.0",
"@azure/arm-resources-subscriptions": "^2.0.0",
"@azure/arm-storage": "^18.0.0",
"@azure/arm-storage-profile-2020-09-01-hybrid": "^2.0.0",
"@azure/core-client": "^1.6.0",
"@azure/core-rest-pipeline": "^1.9.0",
"@microsoft/vscode-azext-utils": "file:../utils/microsoft-vscode-azext-utils-0.4.0.tgz",
"semver": "^7.3.7",
"uuid": "^9.0.0",
"vscode-nls": "^5.0.1"
},
"devDependencies": {
"@azure/core-auth": "^1.3.2",
"@azure/core-paging": "^1.2.1",
"@azure/ms-rest-azure-env": "^2.0.0",
"@microsoft/eslint-config-azuretools": "^0.1.0",
"@microsoft/vscode-azext-dev": "^0.1.4",
"@types/mocha": "^7.0.2",
"@types/node": "^14.0.0",
"@types/semver": "^7.3.9",
"@types/vscode": "1.64.0",
"@typescript-eslint/eslint-plugin": "^4.28.3",
"@vscode/test-electron": "^2.1.5",
"eslint": "^7.19.0",
"eslint-plugin-import": "^2.22.1",
"glob": "^7.1.6",
"mocha": "^9.1.3",
"mocha-junit-reporter": "^2.0.2",
"mocha-multi-reporters": "^1.1.7",
"typescript": "^4.9.4"
}
}
Loading

0 comments on commit a13082d

Please sign in to comment.