Skip to content

Commit

Permalink
Merge main
Browse files Browse the repository at this point in the history
  • Loading branch information
motm32 committed Sep 13, 2023
2 parents b542657 + a731826 commit c01f652
Show file tree
Hide file tree
Showing 5 changed files with 9 additions and 7 deletions.
2 changes: 1 addition & 1 deletion serviceconnector/src/createLinker/LinkerCreateStep.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ export class LinkerCreateStep extends AzureWizardExecuteStep<ICreateLinkerContex
public priority: number = 10;

public async execute(context: ICreateLinkerContext): Promise<void> {
const client = await createLinkerClient(context.credentials);
const client = await createLinkerClient(context);

context.linker = {
authInfo: context.authType,
Expand Down
2 changes: 1 addition & 1 deletion serviceconnector/src/deleteLinker/DeleteLinkerStep.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ export class DeleteLinkerStep extends AzureWizardExecuteStep<IPickLinkerContext>
public priority: number = 10;

public async execute(context: IPickLinkerContext): Promise<void> {
const client = await createLinkerClient(context.credentials);
const client = await createLinkerClient(context);
const config = await client.linker.listConfigurations(nonNullProp(context, 'sourceResourceUri'), nonNullProp(context, 'linkerName'));

context.activityChildren = [];
Expand Down
2 changes: 1 addition & 1 deletion serviceconnector/src/deleteLinker/LinkerListStep.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ export class LinkerListStep extends AzureWizardPromptStep<IPickLinkerContext>{
}

private async getPicks(context: IPickLinkerContext): Promise<IAzureQuickPickItem<string>[]> {
const client = await createLinkerClient(context.credentials);
const client = await createLinkerClient(context);
const linkers = (await uiUtils.listAllIterator(client.linker.list(nonNullProp(context, 'sourceResourceUri'))));
return linkers.map(l => {
return { label: nonNullProp(l, 'name'), data: nonNullProp(l, 'name') }
Expand Down
8 changes: 5 additions & 3 deletions serviceconnector/src/linkerClient.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,10 @@
* Licensed under the MIT License. See License.md in the project root for license information.
*--------------------------------------------------------------------------------------------*/

import { AzExtServiceClientCredentials } from "@microsoft/vscode-azext-utils";
import { ServiceLinkerManagementClient } from "@azure/arm-servicelinker";
import { createAzureSubscriptionClient } from "@microsoft/vscode-azext-azureutils";
import { ICreateLinkerContext } from "./createLinker/ICreateLinkerContext";

export async function createLinkerClient(credentials: AzExtServiceClientCredentials) {
return new (await import('@azure/arm-servicelinker')).ServiceLinkerManagementClient(credentials);
export async function createLinkerClient(context: ICreateLinkerContext): Promise<ServiceLinkerManagementClient> {
return createAzureSubscriptionClient(context, (await import('@azure/arm-servicelinker')).ServiceLinkerManagementClient)
}
2 changes: 1 addition & 1 deletion serviceconnector/src/validateLinker/ValidateLinkerStep.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ export class ValidateLinkerStep extends AzureWizardExecuteStep<IPickLinkerContex
public priority: number = 10;

public async execute(context: IPickLinkerContext): Promise<void> {
const client = await createLinkerClient(context.credentials);
const client = await createLinkerClient(context);
const response = await client.linker.beginValidateAndWait(nonNullProp(context, 'sourceResourceUri'), nonNullProp(context, 'linkerName'));

context.activityChildren = [];
Expand Down

0 comments on commit c01f652

Please sign in to comment.