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

utils + azure: vscode.dev migration work #1401

Merged
merged 36 commits into from
Mar 22, 2023
Merged
Show file tree
Hide file tree
Changes from 28 commits
Commits
Show all changes
36 commits
Select commit Hold shift + click to select a range
a13082d
Migrate T1 packages to T2 (#1357)
nturinski Jan 25, 2023
f131585
fix build
nturinski Feb 1, 2023
0451dc1
merge
nturinski Feb 1, 2023
bf2d1c6
Fix build
nturinski Feb 1, 2023
a48fbe2
Fix code error
bwateratmsft Feb 1, 2023
edf4940
Revert some changes to azure account related code
nturinski Feb 1, 2023
3755b6e
Merge branch 'nat/vscode-dev' of https://github.com/microsoft/vscode-…
nturinski Feb 1, 2023
a02642c
Nat/webpack configuration (#1375)
nturinski Feb 7, 2023
361eccc
Merge changes from main
nturinski Feb 8, 2023
8f01a95
Working version of utils and azure
nturinski Feb 8, 2023
3f4e70f
Bump versions
nturinski Feb 9, 2023
5c995e8
Revert some weird changes
nturinski Feb 9, 2023
20c4caf
Pull main
nturinski Feb 9, 2023
8289e26
Update package to use alpha dep
nturinski Feb 9, 2023
6763462
Merge main
nturinski Feb 16, 2023
9472c61
Replace randomUUID
nturinski Feb 16, 2023
66ea555
Use default pipelines and add/remove policies as needed (#1381)
nturinski Feb 16, 2023
513dd12
Merge from main
nturinski Mar 6, 2023
4c38c09
Bump versions
nturinski Mar 13, 2023
f588e75
Implement openUrl to accept string or Uri
nturinski Mar 16, 2023
eecd680
PR feedback
nturinski Mar 17, 2023
12b924f
Bump version
nturinski Mar 17, 2023
48fb9bd
Revert some changes from the PR
nturinski Mar 17, 2023
b888529
Auto formatting will be the death of me.
nturinski Mar 17, 2023
24e9b37
Remove promise
nturinski Mar 17, 2023
2ab30dc
Re-add pipelines that automatically include parsedBody
nturinski Mar 17, 2023
6ebcaac
Remove allowInsecureConnection property needed for testing
nturinski Mar 17, 2023
0390a77
Merge from main
nturinski Mar 20, 2023
f46c813
Add error throwing policy to RestPipelines
nturinski Mar 22, 2023
ef79fd1
Add a comment
nturinski Mar 22, 2023
09f5ab1
Remove comment
nturinski Mar 22, 2023
d212e88
Fix merge conflicts
nturinski Mar 22, 2023
bc9f0bd
Fix builds
nturinski Mar 22, 2023
104a47f
Thank goodness for tests!
nturinski Mar 22, 2023
55bc5c1
package.json types
nturinski Mar 22, 2023
0666c68
Fix package-lock.json
nturinski Mar 22, 2023
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
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
52 changes: 19 additions & 33 deletions azure/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,16 @@

/* 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 { 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 { AzureSubscription } from '@microsoft/vscode-azureresources-api';
import { Disposable, Progress, Uri } 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 { AzureSubscription } from '@microsoft/vscode-azureresources-api';

export type OpenInPortalOptions = {
/**
Expand All @@ -25,7 +26,7 @@ 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;
Expand Down Expand Up @@ -232,7 +233,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 @@ -349,26 +350,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 @@ -377,18 +362,19 @@ 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>;
alexweininger marked this conversation as resolved.
Show resolved Hide resolved

export type AzExtRequestPrepareOptions = RequestPrepareOptions & { rejectUnauthorized?: boolean }
export type AzExtRequestPrepareOptions = PipelineRequestOptions & { rejectUnauthorized?: boolean }
export type AzExtPipelineResponse = PipelineResponse & { parsedBody?: any }

/**
* 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 @@ -398,23 +384,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 Down
Loading