Skip to content
This repository has been archived by the owner on Nov 16, 2023. It is now read-only.

Fix #133 - Azure Environment Selector (Resubmitted) #151

Open
wants to merge 5 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all 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
6 changes: 3 additions & 3 deletions package-lock.json

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

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -769,7 +769,7 @@
"lodash": "^4.17.15",
"request": "^2.88.2",
"request-promise-native": "^1.0.8",
"vscode-azureextensionui": "^0.16.5",
"vscode-azureextensionui": "0.17.1",
"vscode-extension-telemetry": "0.0.18",
"vscode-nls": "^3.2.5"
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ export class IntegrationAccountProvider implements IChildProvider {
this.nextLink = undefined;
}

const client = new LogicAppsManagementClient(node.credentials, node.subscriptionId);
const client = new LogicAppsManagementClient(node.credentials, node.subscriptionId, node.environment.resourceManagerEndpointUrl);
addExtensionUserAgent(client);

const integrationAccounts = this.nextLink === undefined
Expand Down
2 changes: 1 addition & 1 deletion src/tree/logic-app/LogicAppsProvider.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ export class LogicAppsProvider implements IChildProvider {
this.nextLink = undefined;
}

const client = new LogicAppsManagementClient(node.credentials, node.subscriptionId);
const client = new LogicAppsManagementClient(node.credentials, node.subscriptionId, node.environment.resourceManagerEndpointUrl);
addExtensionUserAgent(client);

const logicApps = this.nextLink === undefined
Expand Down
9 changes: 7 additions & 2 deletions src/utils/integration-account/partnerUtils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
* Licensed under the MIT License. See LICENSE in the project root for license information.
*--------------------------------------------------------------------------------------------*/

import { AzureEnvironment } from "ms-rest-azure";
import LogicAppsManagementClient from "azure-arm-logic";
import { IntegrationAccountPartner } from "azure-arm-logic/lib/models";
import { ServiceClientCredentials } from "ms-rest";
Expand Down Expand Up @@ -31,8 +32,8 @@ export async function createNewPartner(partnerName: string, qualifier: string, v
return partner;
}

export async function getAllPartners(credentials: ServiceClientCredentials, subscriptionId: string, resourceGroup: string, integrationAccount: string): Promise<IntegrationAccountPartner[]> {
const client = new LogicAppsManagementClient(credentials, subscriptionId);
export async function getAllPartners(credentials: IPartnerCredentials, subscriptionId: string, resourceGroup: string, integrationAccount: string): Promise<IntegrationAccountPartner[]> {
const client = new LogicAppsManagementClient(credentials, subscriptionId, credentials.environment?.resourceManagerEndpointUrl);
addExtensionUserAgent(client);

const partners = await client.integrationAccountPartners.list(resourceGroup, integrationAccount);
Expand All @@ -45,3 +46,7 @@ export async function getAllPartners(credentials: ServiceClientCredentials, subs

return partners;
}

export interface IPartnerCredentials extends ServiceClientCredentials {
environment?: AzureEnvironment;
}
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import { IAgreementWizardContext } from "./createAgreementWizard";

export class AgreementCreateStep extends AzureWizardExecuteStep<IAgreementWizardContext> {
public async execute(wizardContext: IAgreementWizardContext): Promise<IAgreementWizardContext> {
const client = new LogicAppsManagementClient(wizardContext.credentials, wizardContext.subscriptionId);
const client = new LogicAppsManagementClient(wizardContext.credentials, wizardContext.subscriptionId, wizardContext.environment.resourceManagerEndpointUrl);
addExtensionUserAgent(client);

const newAgreement: IntegrationAccountAgreement = await client.integrationAccountAgreements.createOrUpdate(wizardContext.resourceGroup!.name!,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ export class AgreementNameStep extends AzureWizardPromptStep<IAgreementWizardCon
}

private async isNameAvailable(name: string, wizardContext: IAgreementWizardContext): Promise<boolean> {
const client = new LogicAppsManagementClient(wizardContext.credentials, wizardContext.subscriptionId);
const client = new LogicAppsManagementClient(wizardContext.credentials, wizardContext.subscriptionId, wizardContext.environment.resourceManagerEndpointUrl);
addExtensionUserAgent(client);

let agreements = await client.integrationAccountAgreements.list(wizardContext.resourceGroup!.name!, wizardContext.integrationAccountName);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
* Licensed under the MIT License. See LICENSE in the project root for license information.
*--------------------------------------------------------------------------------------------*/

import { AzureEnvironment } from "ms-rest-azure";
import { BusinessIdentity, IntegrationAccount, IntegrationAccountPartner } from "azure-arm-logic/lib/models";
import { AzureWizard, AzureWizardExecuteStep, AzureWizardPromptStep, IActionContext, IAzureNode, IAzureTreeItem, ILocationWizardContext, IResourceGroupWizardContext } from "vscode-azureextensionui";
import { IntegrationAccountAgreementTreeItem } from "../../../tree/integration-account/IntegrationAccountAgreementTreeItem";
Expand All @@ -23,6 +24,7 @@ export interface IAgreementWizardContext extends ILocationWizardContext, IResour
hostIdentity?: BusinessIdentity;
guestPartner?: string;
guestIdentity?: BusinessIdentity;
environment: AzureEnvironment;

// Passing Data Around
partners?: Map<string, IntegrationAccountPartner>;
Expand Down Expand Up @@ -53,7 +55,8 @@ export async function runNewAgreementWizard(integrationAccount: IntegrationAccou
name: integrationAccount.id!.split("/").slice(-5, -4)[0]
},
subscriptionDisplayName: node.subscriptionDisplayName,
subscriptionId: node.subscriptionId
subscriptionId: node.subscriptionId,
environment: node.environment
};

// Create a new instance of an Azure wizard for creating Agreements.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See LICENSE in the project root for license information.
*--------------------------------------------------------------------------------------------*/

import { AzureEnvironment } from "ms-rest-azure";
import { AzureWizard, AzureWizardExecuteStep, AzureWizardPromptStep, IActionContext, IAzureNode, IAzureTreeItem, ILocationWizardContext, IResourceGroupWizardContext, LocationListStep, ResourceGroupCreateStep, ResourceGroupListStep } from "vscode-azureextensionui";
import { IntegrationAccountTreeItem } from "../../tree/integration-account/IntegrationAccountTreeItem";
import { IntegrationAccountCreateStep } from "./integrationAccountCreateStep";
Expand All @@ -13,6 +13,7 @@ export interface IIntegrationAccountWizardContext extends ILocationWizardContext
integrationAccount?: IntegrationAccountTreeItem;
integrationAccountName?: string;
sku?: string;
environment: AzureEnvironment;
}

export async function runNewIntegrationAccountWizard(node: IAzureNode, showCreatingNode: (label: string) => void): Promise<IAzureTreeItem> {
Expand All @@ -34,7 +35,8 @@ export async function runNewIntegrationAccountWizard(node: IAzureNode, showCreat
let wizardContext: IIntegrationAccountWizardContext = {
credentials: node.credentials,
subscriptionDisplayName: node.subscriptionDisplayName,
subscriptionId: node.subscriptionId
subscriptionId: node.subscriptionId,
environment: node.environment
};

// Create a new instance of an Azure wizard for creating Integration Accounts.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import { IIntegrationAccountWizardContext } from "./createIntegrationAccountWiza

export class IntegrationAccountCreateStep extends AzureWizardExecuteStep<IIntegrationAccountWizardContext> {
public async execute(wizardContext: IIntegrationAccountWizardContext): Promise<IIntegrationAccountWizardContext> {
const client = new LogicAppsManagementClient(wizardContext.credentials, wizardContext.subscriptionId);
const client = new LogicAppsManagementClient(wizardContext.credentials, wizardContext.subscriptionId, wizardContext.environment.resourceManagerEndpointUrl);
addExtensionUserAgent(client);

const newIntegrationAccount: IntegrationAccount = await client.integrationAccounts.createOrUpdate(wizardContext.resourceGroup!.name!,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ export class IntegrationAccountNameStep extends AzureWizardPromptStep<IIntegrati
resourceGroupName = wizardContext.resourceGroup!.name!;
}

const client = new LogicAppsManagementClient(wizardContext.credentials, wizardContext.subscriptionId);
const client = new LogicAppsManagementClient(wizardContext.credentials, wizardContext.subscriptionId, wizardContext.environment.resourceManagerEndpointUrl);
addExtensionUserAgent(client);

let integrationAccounts = await client.integrationAccounts.listByResourceGroup(resourceGroupName);
Expand Down
5 changes: 4 additions & 1 deletion src/wizard/integration-account/maps/createMapWizard.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
* Licensed under the MIT License. See LICENSE in the project root for license information.
*--------------------------------------------------------------------------------------------*/

import { AzureEnvironment } from "ms-rest-azure";
import { IntegrationAccount } from "azure-arm-logic/lib/models";
import { AzureWizard, AzureWizardExecuteStep, AzureWizardPromptStep, IActionContext, IAzureNode, IAzureTreeItem, ILocationWizardContext, IResourceGroupWizardContext } from "vscode-azureextensionui";
import { IntegrationAccountMapTreeItem } from "../../../tree/integration-account/IntegrationAccountMapTreeItem";
Expand All @@ -15,6 +16,7 @@ export interface IMapWizardContext extends ILocationWizardContext, IResourceGrou
map?: IntegrationAccountMapTreeItem;
mapName?: string;
mapType?: string;
environment: AzureEnvironment;
}

export async function runNewMapWizard(integrationAccount: IntegrationAccount, node: IAzureNode, showCreatingNode: (label: string) => void): Promise<IAzureTreeItem> {
Expand All @@ -38,7 +40,8 @@ export async function runNewMapWizard(integrationAccount: IntegrationAccount, no
name: integrationAccount.id!.split("/").slice(-5, -4)[0]
},
subscriptionDisplayName: node.subscriptionDisplayName,
subscriptionId: node.subscriptionId
subscriptionId: node.subscriptionId,
environment: node.environment
};

// Create a new instance of an Azure wizard for creating Maps.
Expand Down
2 changes: 1 addition & 1 deletion src/wizard/integration-account/maps/mapCreateStep.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import { IMapWizardContext } from "./createMapWizard";

export class MapCreateStep extends AzureWizardExecuteStep<IMapWizardContext> {
public async execute(wizardContext: IMapWizardContext): Promise<IMapWizardContext> {
const client = new LogicAppsManagementClient(wizardContext.credentials, wizardContext.subscriptionId);
const client = new LogicAppsManagementClient(wizardContext.credentials, wizardContext.subscriptionId, wizardContext.environment.resourceManagerEndpointUrl);
addExtensionUserAgent(client);

const newMap: IntegrationAccountMap = await client.integrationAccountMaps.createOrUpdate(wizardContext.resourceGroup!.name!,
Expand Down
2 changes: 1 addition & 1 deletion src/wizard/integration-account/maps/mapNameStep.ts
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ export class MapNameStep extends AzureWizardPromptStep<IMapWizardContext> {
}

private async isNameAvailable(name: string, wizardContext: IMapWizardContext): Promise<boolean> {
const client = new LogicAppsManagementClient(wizardContext.credentials, wizardContext.subscriptionId);
const client = new LogicAppsManagementClient(wizardContext.credentials, wizardContext.subscriptionId, wizardContext.environment.resourceManagerEndpointUrl);
addExtensionUserAgent(client);

let maps = await client.integrationAccountMaps.list(wizardContext.resourceGroup!.name!, wizardContext.integrationAccountName);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
* Licensed under the MIT License. See LICENSE in the project root for license information.
*--------------------------------------------------------------------------------------------*/

import { AzureEnvironment } from "ms-rest-azure";
import { IntegrationAccount } from "azure-arm-logic/lib/models";
import { AzureWizard, AzureWizardExecuteStep, AzureWizardPromptStep, IActionContext, IAzureNode, IAzureTreeItem, ILocationWizardContext, IResourceGroupWizardContext } from "vscode-azureextensionui";
import { IntegrationAccountPartnerTreeItem } from "../../../tree/integration-account/IntegrationAccountPartnerTreeItem";
Expand All @@ -17,6 +18,7 @@ export interface IPartnerWizardContext extends ILocationWizardContext, IResource
partnerName?: string;
partnerQualifier?: string;
partnerValue?: string;
environment: AzureEnvironment;
}

export async function runNewPartnerWizard(integrationAccount: IntegrationAccount, node: IAzureNode, showCreatingNode: (label: string) => void): Promise<IAzureTreeItem> {
Expand All @@ -41,7 +43,8 @@ export async function runNewPartnerWizard(integrationAccount: IntegrationAccount
name: integrationAccount.id!.split("/").slice(-5, -4)[0]
},
subscriptionDisplayName: node.subscriptionDisplayName,
subscriptionId: node.subscriptionId
subscriptionId: node.subscriptionId,
environment: node.environment
};

// Create a new instance of an Azure wizard for creating Partners.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import { IPartnerWizardContext } from "./createPartnerWizard";

export class PartnerCreateStep extends AzureWizardExecuteStep<IPartnerWizardContext> {
public async execute(wizardContext: IPartnerWizardContext): Promise<IPartnerWizardContext> {
const client = new LogicAppsManagementClient(wizardContext.credentials, wizardContext.subscriptionId);
const client = new LogicAppsManagementClient(wizardContext.credentials, wizardContext.subscriptionId, wizardContext.environment.resourceManagerEndpointUrl);
addExtensionUserAgent(client);

const newPartner: IntegrationAccountPartner = await client.integrationAccountPartners.createOrUpdate(wizardContext.resourceGroup!.name!,
Expand Down
5 changes: 4 additions & 1 deletion src/wizard/integration-account/schemas/createSchemaWizard.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
* Licensed under the MIT License. See LICENSE in the project root for license information.
*--------------------------------------------------------------------------------------------*/

import { AzureEnvironment } from "ms-rest-azure";
import { IntegrationAccount } from "azure-arm-logic/lib/models";
import { AzureWizard, AzureWizardExecuteStep, AzureWizardPromptStep, IActionContext, IAzureNode, IAzureTreeItem, ILocationWizardContext, IResourceGroupWizardContext } from "vscode-azureextensionui";
import { IntegrationAccountSchemaTreeItem } from "../../../tree/integration-account/IntegrationAccountSchemaTreeItem";
Expand All @@ -13,6 +14,7 @@ export interface ISchemaWizardContext extends ILocationWizardContext, IResourceG
integrationAccountName: string;
schema?: IntegrationAccountSchemaTreeItem;
schemaName?: string;
environment: AzureEnvironment;
}

export async function runNewSchemaWizard(integrationAccount: IntegrationAccount, node: IAzureNode, showCreatingNode: (label: string) => void): Promise<IAzureTreeItem> {
Expand All @@ -35,7 +37,8 @@ export async function runNewSchemaWizard(integrationAccount: IntegrationAccount,
name: integrationAccount.id!.split("/").slice(-5, -4)[0]
},
subscriptionDisplayName: node.subscriptionDisplayName,
subscriptionId: node.subscriptionId
subscriptionId: node.subscriptionId,
environment: node.environment
};

// Create a new instance of an Azure wizard for creating Schemas.
Expand Down
2 changes: 1 addition & 1 deletion src/wizard/integration-account/schemas/schemaCreateStep.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import { ISchemaWizardContext } from "./createSchemaWizard";

export class SchemaCreateStep extends AzureWizardExecuteStep<ISchemaWizardContext> {
public async execute(wizardContext: ISchemaWizardContext): Promise<ISchemaWizardContext> {
const client = new LogicAppsManagementClient(wizardContext.credentials, wizardContext.subscriptionId);
const client = new LogicAppsManagementClient(wizardContext.credentials, wizardContext.subscriptionId, wizardContext.environment.resourceManagerEndpointUrl);
addExtensionUserAgent(client);

const newSchema: IntegrationAccountSchema = await client.integrationAccountSchemas.createOrUpdate(wizardContext.resourceGroup!.name!,
Expand Down
2 changes: 1 addition & 1 deletion src/wizard/integration-account/schemas/schemaNameStep.ts
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ export class SchemaNameStep extends AzureWizardPromptStep<ISchemaWizardContext>
}

private async isNameAvailable(name: string, wizardContext: ISchemaWizardContext): Promise<boolean> {
const client = new LogicAppsManagementClient(wizardContext.credentials, wizardContext.subscriptionId);
const client = new LogicAppsManagementClient(wizardContext.credentials, wizardContext.subscriptionId, wizardContext.environment.resourceManagerEndpointUrl);
addExtensionUserAgent(client);

let schemas = await client.integrationAccountSchemas.list(wizardContext.resourceGroup!.name!, wizardContext.integrationAccountName);
Expand Down
2 changes: 1 addition & 1 deletion src/wizard/logic-app/LogicAppCreateStep.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import { IAzureLogicAppWizardContext } from "./createLogicApp";

export class LogicAppCreateStep extends AzureWizardExecuteStep<IAzureLogicAppWizardContext> {
public async execute(wizardContext: IAzureLogicAppWizardContext): Promise<IAzureLogicAppWizardContext> {
const client = new LogicAppsManagementClient(wizardContext.credentials, wizardContext.subscriptionId);
const client = new LogicAppsManagementClient(wizardContext.credentials, wizardContext.subscriptionId, wizardContext.environment.resourceManagerEndpointUrl);
addExtensionUserAgent(client);

const location = wizardContext.location!.name!;
Expand Down
2 changes: 1 addition & 1 deletion src/wizard/logic-app/LogicAppNameStep.ts
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ export class LogicAppNameStep extends AzureWizardPromptStep<IAzureLogicAppWizard
resourceGroupName = wizardContext.resourceGroup!.name!;
}

const client = new LogicAppsManagementClient(wizardContext.credentials, wizardContext.subscriptionId);
const client = new LogicAppsManagementClient(wizardContext.credentials, wizardContext.subscriptionId, wizardContext.environment.resourceManagerEndpointUrl);
addExtensionUserAgent(client);

let workflows = await client.workflows.listByResourceGroup(resourceGroupName);
Expand Down
5 changes: 4 additions & 1 deletion src/wizard/logic-app/createLogicApp.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
* Licensed under the MIT License. See LICENSE in the project root for license information.
*--------------------------------------------------------------------------------------------*/

import { AzureEnvironment } from "ms-rest-azure";
import { AzureWizard, AzureWizardExecuteStep, AzureWizardPromptStep, IActionContext, IAzureNode, IAzureTreeItem, ILocationWizardContext, IResourceGroupWizardContext, LocationListStep, ResourceGroupCreateStep, ResourceGroupListStep } from "vscode-azureextensionui";
import { LogicAppTreeItem } from "../../tree/logic-app/LogicAppTreeItem";
import { LogicAppCreateStep } from "./LogicAppCreateStep";
Expand All @@ -11,6 +12,7 @@ import { LogicAppNameStep } from "./LogicAppNameStep";
export interface IAzureLogicAppWizardContext extends ILocationWizardContext, IResourceGroupWizardContext {
logicApp?: LogicAppTreeItem;
workflowName?: string;
environment: AzureEnvironment;
}

export async function createLogicApp(node: IAzureNode, showCreatingNode: (label: string) => void): Promise<IAzureTreeItem> {
Expand All @@ -31,7 +33,8 @@ export async function createLogicApp(node: IAzureNode, showCreatingNode: (label:
let wizardContext: IAzureLogicAppWizardContext = {
credentials: node.credentials,
subscriptionDisplayName: node.subscriptionDisplayName,
subscriptionId: node.subscriptionId
subscriptionId: node.subscriptionId,
environment: node.environment
};

// Create a new instance of an Azure wizard for creating Logic Apps.
Expand Down