├── .npmrc
├── .eslintignore
├── .gitattributes
├── resources
├── run-after.gif
├── azLogicApps.png
├── open-in-designer.gif
├── recurrence-trigger.gif
├── open-in-monitoring-view.gif
├── dark
│ ├── eye.svg
│ ├── BulletList.svg
│ ├── Run.svg
│ ├── Filter.svg
│ ├── AddBuildDefinitionToProject.svg
│ ├── Edit.svg
│ ├── Refresh.svg
│ ├── CreateProject.svg
│ └── CreateLogicApp.svg
├── light
│ ├── eye.svg
│ ├── BulletList.svg
│ ├── Filter.svg
│ ├── Run.svg
│ ├── AddBuildDefinitionToProject.svg
│ ├── Edit.svg
│ ├── Refresh.svg
│ ├── CreateProject.svg
│ └── CreateLogicApp.svg
├── azIntegrationAccount.svg
├── status
│ ├── Running.svg
│ ├── Succeeded.svg
│ ├── Failed.svg
│ ├── Skipped.svg
│ ├── Cancelled.svg
│ ├── Aborted.svg
│ └── Unknown.svg
├── azIntegrationAccountMap.svg
├── azure.svg
├── azLogicAppsWorkflowVersion.svg
├── azIntegrationAccountSchema.svg
├── azIntegrationAccountAgreement.svg
├── azIntegrationAccountPartner.svg
├── azLogicAppsWorkflow.svg
└── azLogicApps.svg
├── .vscode
├── extensions.json
├── tasks.json
├── settings.json
└── launch.json
├── .vscodeignore
├── src
├── localize.ts
├── test
│ ├── index.test.js
│ ├── runTest.js
│ └── index.js
├── extensionVariables.ts
├── utils
│ ├── dialogResponses.ts
│ ├── integration-account
│ │ ├── integrationAccountUtils.ts
│ │ ├── schemaUtils.ts
│ │ ├── partnerUtils.ts
│ │ └── mapUtils.ts
│ ├── commandUtils.ts
│ ├── authorizationUtils.ts
│ ├── stringUtils.ts
│ ├── locationUtils.ts
│ ├── nodeUtils.ts
│ ├── workspaceUtils.ts
│ ├── readOnlyUtils.ts
│ └── logic-app
│ │ └── connectionReferenceUtils.ts
├── tree
│ ├── logic-app
│ │ ├── LogicAppCurrentVersionTreeItem.ts
│ │ ├── LogicAppsProvider.ts
│ │ ├── LogicAppTriggerTreeItem.ts
│ │ ├── LogicAppRunActionTreeItem.ts
│ │ ├── LogicAppRunsTreeItem.ts
│ │ ├── LogicAppTriggersTreeItem.ts
│ │ ├── LogicAppRunActionsTreeItem.ts
│ │ ├── LogicAppVersionsTreeItem.ts
│ │ └── LogicAppVersionTreeItem.ts
│ └── integration-account
│ │ ├── IntegrationAccountsProvider.ts
│ │ ├── IntegrationAccountMapsTreeItem.ts
│ │ ├── IntegrationAccountSchemasTreeItem.ts
│ │ ├── IntegrationAccountPartnersTreeItem.ts
│ │ └── IntegrationAccountAgreementsTreeItem.ts
├── commands
│ ├── logic-app
│ │ ├── openInEditor.ts
│ │ ├── openInPortal.ts
│ │ ├── openRunInEditor.ts
│ │ ├── openTriggerInEditor.ts
│ │ ├── createLogicApp.ts
│ │ ├── openRunActionInEditor.ts
│ │ ├── deleteLogicApp.ts
│ │ ├── enableLogicApp.ts
│ │ ├── disableLogicApp.ts
│ │ ├── resubmitRun.ts
│ │ ├── runTrigger.ts
│ │ ├── openVersionInEditor.ts
│ │ ├── createProject.ts
│ │ ├── addBuildDefinitionToProject.ts
│ │ ├── promoteVersion.ts
│ │ ├── openRunInMonitoringView.ts
│ │ ├── addLogicAppToProject.ts
│ │ └── openVersionInDesigner.ts
│ └── integration-account
│ │ ├── integrationAccountMapCommands.ts
│ │ ├── integrationAccountSchemaCommands.ts
│ │ ├── integrationAccountPartnerCommands.ts
│ │ ├── IntegrationAccountAgreementCommands.ts
│ │ └── integrationAccountCommands.ts
├── wizard
│ ├── integration-account
│ │ ├── agreements
│ │ │ ├── hostPartnerStep.ts
│ │ │ ├── guestPartnerStep.ts
│ │ │ ├── hostIdentityStep.ts
│ │ │ ├── guestIdentityStep.ts
│ │ │ ├── agreementTypeStep.ts
│ │ │ ├── partnerStep.ts
│ │ │ ├── agreementCreateStep.ts
│ │ │ └── identityStep.ts
│ │ ├── maps
│ │ │ ├── mapTypeStep.ts
│ │ │ ├── mapCreateStep.ts
│ │ │ └── createMapWizard.ts
│ │ ├── partners
│ │ │ ├── partnerQualifierStep.ts
│ │ │ ├── partnerCreateStep.ts
│ │ │ ├── partnerValueStep.ts
│ │ │ └── partnerNameStep.ts
│ │ ├── integrationAccountSkuStep.ts
│ │ ├── schemas
│ │ │ ├── schemaCreateStep.ts
│ │ │ └── createSchemaWizard.ts
│ │ └── integrationAccountCreateStep.ts
│ └── logic-app
│ │ ├── LocationListStep.ts
│ │ ├── CsmFileCreateStep.ts
│ │ ├── CsmParametersFileCreateStep.ts
│ │ ├── WorkspaceFolderSelectionStep.ts
│ │ ├── BuildDefinitionCreateStep.ts
│ │ ├── CsmFilenameStep.ts
│ │ ├── BuildDefinitionFilenameStep.ts
│ │ ├── ServiceConnectionNameStep.ts
│ │ ├── CsmParametersFilenameStep.ts
│ │ ├── LogicAppCreateStep.ts
│ │ ├── ResourceGroupNameStep.ts
│ │ ├── GenerateBuildDefinitionStep.ts
│ │ └── createLogicApp.ts
└── editors
│ ├── logic-app
│ └── LogicAppEditor.ts
│ └── integration-account
│ ├── IntegrationAccountSchemaEditor.ts
│ ├── integrationAccountAgreementEditor.ts
│ ├── IntegrationAccountMapEditor.ts
│ └── integrationAccountPartnerEditor.ts
├── tsconfig.json
├── NOTES.md
├── .eslintrc.js
├── LICENSE
├── webpack.config.js
├── package.nls.json
└── SECURITY.md
/.npmrc:
--------------------------------------------------------------------------------
1 | registry=https://registry.npmjs.org/
2 |
--------------------------------------------------------------------------------
/.eslintignore:
--------------------------------------------------------------------------------
1 | .vscode-test
2 | node_modules
3 | out
4 |
--------------------------------------------------------------------------------
/.gitattributes:
--------------------------------------------------------------------------------
1 | # Set default behavior to automatically normalize line endings.
2 | * text=auto
3 |
4 |
--------------------------------------------------------------------------------
/resources/run-after.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/microsoft/vscode-azurelogicapps/HEAD/resources/run-after.gif
--------------------------------------------------------------------------------
/resources/azLogicApps.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/microsoft/vscode-azurelogicapps/HEAD/resources/azLogicApps.png
--------------------------------------------------------------------------------
/resources/open-in-designer.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/microsoft/vscode-azurelogicapps/HEAD/resources/open-in-designer.gif
--------------------------------------------------------------------------------
/resources/recurrence-trigger.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/microsoft/vscode-azurelogicapps/HEAD/resources/recurrence-trigger.gif
--------------------------------------------------------------------------------
/resources/open-in-monitoring-view.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/microsoft/vscode-azurelogicapps/HEAD/resources/open-in-monitoring-view.gif
--------------------------------------------------------------------------------
/.vscode/extensions.json:
--------------------------------------------------------------------------------
1 | {
2 | // See http://go.microsoft.com/fwlink/?LinkId=827846
3 | // for the documentation about the extensions.json format
4 | "recommendations": [
5 | "dbaeumer.vscode-eslint"
6 | ]
7 | }
--------------------------------------------------------------------------------
/.vscodeignore:
--------------------------------------------------------------------------------
1 | .vscode/**
2 | .vscode-test/**
3 | out/test/**
4 | out/**/*.map
5 | src/**
6 | .eslintignore
7 | .eslintrc.js
8 | .gitattributes
9 | .gitignore
10 | .npmrc
11 | NOTES.md
12 | tsconfig.json
13 | webpack.config.js
--------------------------------------------------------------------------------
/resources/dark/eye.svg:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/resources/light/eye.svg:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/resources/dark/BulletList.svg:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/resources/light/BulletList.svg:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/src/localize.ts:
--------------------------------------------------------------------------------
1 | /*---------------------------------------------------------------------------------------------
2 | * Copyright (c) Microsoft Corporation. All rights reserved.
3 | * Licensed under the MIT License. See LICENSE in the project root for license information.
4 | *--------------------------------------------------------------------------------------------*/
5 |
6 | import * as nls from "vscode-nls";
7 |
8 | export const localize: nls.LocalizeFunc = nls.config(process.env.VSCODE_NLS_CONFIG as nls.Options | undefined)();
9 |
--------------------------------------------------------------------------------
/tsconfig.json:
--------------------------------------------------------------------------------
1 | {
2 | "compilerOptions": {
3 | "alwaysStrict": true,
4 | "lib": [
5 | "es6"
6 | ],
7 | "module": "commonjs",
8 | "noFallthroughCasesInSwitch": true,
9 | "noImplicitReturns": true,
10 | "noUnusedLocals": true,
11 | "noUnusedParameters": true,
12 | "outDir": "out",
13 | "rootDir": "src",
14 | "sourceMap": true,
15 | "strict": true,
16 | "target": "es6"
17 | },
18 | "exclude": [
19 | "node_modules",
20 | ".vscode-test"
21 | ]
22 | }
--------------------------------------------------------------------------------
/.vscode/tasks.json:
--------------------------------------------------------------------------------
1 | // See https://go.microsoft.com/fwlink/?LinkId=733558
2 | // for the documentation about the tasks.json format
3 | {
4 | "version": "2.0.0",
5 | "tasks": [
6 | {
7 | "type": "npm",
8 | "script": "watch",
9 | "problemMatcher": "$tsc-watch",
10 | "isBackground": true,
11 | "presentation": {
12 | "reveal": "never"
13 | },
14 | "group": {
15 | "kind": "build",
16 | "isDefault": true
17 | }
18 | }
19 | ]
20 | }
--------------------------------------------------------------------------------
/resources/dark/Run.svg:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/src/test/index.test.js:
--------------------------------------------------------------------------------
1 | /*---------------------------------------------------------------------------------------------
2 | * Copyright (c) Microsoft Corporation. All rights reserved.
3 | * Licensed under the MIT License. See LICENSE in the project root for license information.
4 | *--------------------------------------------------------------------------------------------*/
5 |
6 | // const assert = require("assert");
7 | // const extension = require("../extension");
8 |
9 | suite("Extension Tests", () => {
10 | // eslint-disable-line @typescript-eslint/no-empty-function
11 | });
12 |
--------------------------------------------------------------------------------
/.vscode/settings.json:
--------------------------------------------------------------------------------
1 | // Place your settings in this file to overwrite default and user settings.
2 | {
3 | "files.exclude": {
4 | "out": false // set this to true to hide the "out" folder with the compiled JS files
5 | },
6 | "prettier.requireConfig": true,
7 | "search.exclude": {
8 | "out": true // set this to false to include "out" folder in search results
9 | },
10 | // Turn off tsc task auto detection since we have the necessary tasks as npm scripts
11 | "typescript.tsc.autoDetect": "off",
12 | "typescript.tsdk": "node_modules\\typescript\\lib",
13 | }
--------------------------------------------------------------------------------
/resources/dark/Filter.svg:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/resources/light/Filter.svg:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/resources/light/Run.svg:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/NOTES.md:
--------------------------------------------------------------------------------
1 | # Notes
2 |
3 | ## Compiling code
4 |
5 | ### Prerequisites for compiling code
6 |
7 | Install Node 16.x or later (includes npm 8.x or later).
8 |
9 | Install prerequisite Node.js package dependencies:
10 | `npm install --legacy-peer-deps`
11 |
12 | ### Commands to compile code
13 |
14 | Compile:
15 | `npm run compile`
16 |
17 | Watch:
18 | `npm run watch`
19 |
20 | ## Running tests
21 |
22 | ### Prerequisites for running tests
23 |
24 | You must not have any open instances of Visual Studio Code before running tests.
25 |
26 | ### Command to run tests
27 |
28 | `npm run test`
29 |
30 | ## Packaging code
31 |
32 | `npm run package`
33 |
--------------------------------------------------------------------------------
/resources/dark/AddBuildDefinitionToProject.svg:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/resources/light/AddBuildDefinitionToProject.svg:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/resources/azIntegrationAccount.svg:
--------------------------------------------------------------------------------
1 |
2 |
--------------------------------------------------------------------------------
/resources/status/Running.svg:
--------------------------------------------------------------------------------
1 |
2 |
15 |
--------------------------------------------------------------------------------
/resources/status/Succeeded.svg:
--------------------------------------------------------------------------------
1 |
2 |
13 |
--------------------------------------------------------------------------------
/src/extensionVariables.ts:
--------------------------------------------------------------------------------
1 | /*---------------------------------------------------------------------------------------------
2 | * Copyright (c) Microsoft Corporation. All rights reserved.
3 | * Licensed under the MIT License. See LICENSE in the project root for license information.
4 | *--------------------------------------------------------------------------------------------*/
5 |
6 | import * as vscode from "vscode";
7 | import { IAzureUserInput } from "vscode-azureextensionui";
8 | import TelemetryReporter from "vscode-extension-telemetry";
9 |
10 | export namespace ext {
11 | export let context: vscode.ExtensionContext;
12 | export let outputChannel: vscode.OutputChannel;
13 | export let reporter: TelemetryReporter | undefined;
14 | export let ui: IAzureUserInput;
15 | }
16 |
--------------------------------------------------------------------------------
/resources/status/Failed.svg:
--------------------------------------------------------------------------------
1 |
2 |
16 |
--------------------------------------------------------------------------------
/resources/status/Skipped.svg:
--------------------------------------------------------------------------------
1 |
2 |
16 |
--------------------------------------------------------------------------------
/resources/status/Cancelled.svg:
--------------------------------------------------------------------------------
1 |
2 |
16 |
--------------------------------------------------------------------------------
/src/utils/dialogResponses.ts:
--------------------------------------------------------------------------------
1 | /*---------------------------------------------------------------------------------------------
2 | * Copyright (c) Microsoft Corporation. All rights reserved.
3 | * Licensed under the MIT License. See LICENSE in the project root for license information.
4 | *--------------------------------------------------------------------------------------------*/
5 |
6 | import { MessageItem } from "vscode";
7 | import { localize } from "../localize";
8 |
9 | export namespace DialogResponses {
10 | export const no: MessageItem = {
11 | title: localize("no", "No")
12 | };
13 |
14 | export const ok: MessageItem = {
15 | title: localize("ok", "OK")
16 | };
17 |
18 | export const yes: MessageItem = {
19 | title: localize("yes", "Yes")
20 | };
21 | }
22 |
--------------------------------------------------------------------------------
/.eslintrc.js:
--------------------------------------------------------------------------------
1 | /*---------------------------------------------------------------------------------------------
2 | * Copyright (c) Microsoft Corporation. All rights reserved.
3 | * Licensed under the MIT License. See LICENSE in the project root for license information.
4 | *--------------------------------------------------------------------------------------------*/
5 |
6 | module.exports = {
7 | "root": true,
8 | "parser": "@typescript-eslint/parser",
9 | "plugins": [
10 | "@typescript-eslint"
11 | ],
12 | "extends": [
13 | "plugin:@typescript-eslint/recommended"
14 | ],
15 | "rules": {
16 | "@typescript-eslint/no-explicit-any": "off",
17 | "@typescript-eslint/no-namespace": "off",
18 | "@typescript-eslint/no-non-null-assertion": "off"
19 | }
20 | };
21 |
--------------------------------------------------------------------------------
/src/tree/logic-app/LogicAppCurrentVersionTreeItem.ts:
--------------------------------------------------------------------------------
1 | /*---------------------------------------------------------------------------------------------
2 | * Copyright (c) Microsoft Corporation. All rights reserved.
3 | * Licensed under the MIT License. See LICENSE in the project root for license information.
4 | *--------------------------------------------------------------------------------------------*/
5 |
6 | import { IAzureTreeItem } from "vscode-azureextensionui";
7 | import { LogicAppVersionTreeItem } from "./LogicAppVersionTreeItem";
8 |
9 | export class LogicAppCurrentVersionTreeItem extends LogicAppVersionTreeItem implements IAzureTreeItem {
10 | public static readonly contextValue: string = "azLogicAppsWorkflowCurrentVersion";
11 | public readonly contextValue: string = LogicAppCurrentVersionTreeItem.contextValue;
12 | }
13 |
--------------------------------------------------------------------------------
/src/commands/logic-app/openInEditor.ts:
--------------------------------------------------------------------------------
1 | /*---------------------------------------------------------------------------------------------
2 | * Copyright (c) Microsoft Corporation. All rights reserved.
3 | * Licensed under the MIT License. See LICENSE in the project root for license information.
4 | *--------------------------------------------------------------------------------------------*/
5 |
6 | import { AzureTreeDataProvider, BaseEditor, IAzureNode } from "vscode-azureextensionui";
7 | import { LogicAppTreeItem } from "../../tree/logic-app/LogicAppTreeItem";
8 |
9 | export async function openInEditor(tree: AzureTreeDataProvider, editor: BaseEditor, node?: IAzureNode): Promise {
10 | if (!node) {
11 | node = await tree.showNodePicker(LogicAppTreeItem.contextValue);
12 | }
13 |
14 | await editor.showEditor(node);
15 | }
16 |
--------------------------------------------------------------------------------
/resources/azIntegrationAccountMap.svg:
--------------------------------------------------------------------------------
1 |
2 |
10 |
--------------------------------------------------------------------------------
/resources/dark/Edit.svg:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/resources/light/Edit.svg:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/src/commands/logic-app/openInPortal.ts:
--------------------------------------------------------------------------------
1 | /*---------------------------------------------------------------------------------------------
2 | * Copyright (c) Microsoft Corporation. All rights reserved.
3 | * Licensed under the MIT License. See LICENSE in the project root for license information.
4 | *--------------------------------------------------------------------------------------------*/
5 |
6 | import { AzureTreeDataProvider, IAzureNode } from "vscode-azureextensionui";
7 | import { LogicAppTreeItem } from "../../tree/logic-app/LogicAppTreeItem";
8 |
9 | export async function openInPortal(tree: AzureTreeDataProvider, node?: IAzureNode): Promise {
10 | if (!node) {
11 | node = await tree.showNodePicker(LogicAppTreeItem.contextValue);
12 | } else if (node.treeItem.contextValue !== LogicAppTreeItem.contextValue) {
13 | node = await tree.showNodePicker(LogicAppTreeItem.contextValue, node);
14 | }
15 |
16 | node.openInPortal();
17 | }
18 |
--------------------------------------------------------------------------------
/resources/dark/Refresh.svg:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/resources/light/Refresh.svg:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/src/commands/logic-app/openRunInEditor.ts:
--------------------------------------------------------------------------------
1 | /*---------------------------------------------------------------------------------------------
2 | * Copyright (c) Microsoft Corporation. All rights reserved.
3 | * Licensed under the MIT License. See LICENSE in the project root for license information.
4 | *--------------------------------------------------------------------------------------------*/
5 |
6 | import { AzureTreeDataProvider, IAzureNode } from "vscode-azureextensionui";
7 | import { LogicAppRunTreeItem } from "../../tree/logic-app/LogicAppRunTreeItem";
8 | import { openReadOnlyJson } from "../../utils/readOnlyUtils";
9 |
10 | export async function openRunInEditor(tree: AzureTreeDataProvider, node?: IAzureNode): Promise {
11 | if (!node) {
12 | node = await tree.showNodePicker(LogicAppRunTreeItem.contextValue);
13 | }
14 |
15 | const content = await (node.treeItem as LogicAppRunTreeItem).getData();
16 | await openReadOnlyJson(node.id, content);
17 | }
18 |
--------------------------------------------------------------------------------
/src/commands/logic-app/openTriggerInEditor.ts:
--------------------------------------------------------------------------------
1 | /*---------------------------------------------------------------------------------------------
2 | * Copyright (c) Microsoft Corporation. All rights reserved.
3 | * Licensed under the MIT License. See LICENSE in the project root for license information.
4 | *--------------------------------------------------------------------------------------------*/
5 |
6 | import { AzureTreeDataProvider, IAzureNode } from "vscode-azureextensionui";
7 | import { LogicAppTriggerTreeItem } from "../../tree/logic-app/LogicAppTriggerTreeItem";
8 | import { openReadOnlyJson } from "../../utils/readOnlyUtils";
9 |
10 | export async function openTriggerInEditor(tree: AzureTreeDataProvider, node?: IAzureNode): Promise {
11 | if (!node) {
12 | node = await tree.showNodePicker(LogicAppTriggerTreeItem.contextValue);
13 | }
14 |
15 | const content = await (node.treeItem as LogicAppTriggerTreeItem).getData();
16 | await openReadOnlyJson(node.id, content);
17 | }
18 |
--------------------------------------------------------------------------------
/src/commands/logic-app/createLogicApp.ts:
--------------------------------------------------------------------------------
1 | /*---------------------------------------------------------------------------------------------
2 | * Copyright (c) Microsoft Corporation. All rights reserved.
3 | * Licensed under the MIT License. See LICENSE in the project root for license information.
4 | *--------------------------------------------------------------------------------------------*/
5 |
6 | import { AzureTreeDataProvider, BaseEditor, IAzureNode, IAzureParentNode } from "vscode-azureextensionui";
7 |
8 | export async function createLogicApp(tree: AzureTreeDataProvider, editor: BaseEditor, subscription?: IAzureParentNode, resourceGroup?: string): Promise {
9 | const node = !subscription
10 | ? await tree.showNodePicker(AzureTreeDataProvider.subscriptionContextValue) as IAzureParentNode
11 | : subscription;
12 |
13 | const logicAppNode = await node.createChild({ resourceGroup });
14 | await editor.showEditor(logicAppNode);
15 | return logicAppNode.id;
16 | }
17 |
--------------------------------------------------------------------------------
/src/commands/logic-app/openRunActionInEditor.ts:
--------------------------------------------------------------------------------
1 | /*---------------------------------------------------------------------------------------------
2 | * Copyright (c) Microsoft Corporation. All rights reserved.
3 | * Licensed under the MIT License. See LICENSE in the project root for license information.
4 | *--------------------------------------------------------------------------------------------*/
5 |
6 | import { AzureTreeDataProvider, IAzureNode } from "vscode-azureextensionui";
7 | import { LogicAppRunActionTreeItem } from "../../tree/logic-app/LogicAppRunActionTreeItem";
8 | import { openReadOnlyJson } from "../../utils/readOnlyUtils";
9 |
10 | export async function openRunActionInEditor(tree: AzureTreeDataProvider, node?: IAzureNode): Promise {
11 | if (!node) {
12 | node = await tree.showNodePicker(LogicAppRunActionTreeItem.contextValue);
13 | }
14 |
15 | const content = await (node.treeItem as LogicAppRunActionTreeItem).getData();
16 | await openReadOnlyJson(node.id, content);
17 | }
18 |
--------------------------------------------------------------------------------
/src/commands/logic-app/deleteLogicApp.ts:
--------------------------------------------------------------------------------
1 | /*---------------------------------------------------------------------------------------------
2 | * Copyright (c) Microsoft Corporation. All rights reserved.
3 | * Licensed under the MIT License. See LICENSE in the project root for license information.
4 | *--------------------------------------------------------------------------------------------*/
5 |
6 | import { AzureTreeDataProvider, IAzureNode } from "vscode-azureextensionui";
7 | import { localize } from "../../localize";
8 | import { LogicAppTreeItem } from "../../tree/logic-app/LogicAppTreeItem";
9 |
10 | export async function deleteLogicApp(tree: AzureTreeDataProvider, node?: IAzureNode): Promise {
11 | if (!node) {
12 | node = await tree.showNodePicker(LogicAppTreeItem.contextValue);
13 | }
14 |
15 | await node.runWithTemporaryDescription(
16 | localize("azLogicApp.deleting", "Deleting..."),
17 | async () => {
18 | await node!.deleteNode();
19 | }
20 | );
21 | }
22 |
--------------------------------------------------------------------------------
/src/utils/integration-account/integrationAccountUtils.ts:
--------------------------------------------------------------------------------
1 | /*---------------------------------------------------------------------------------------------
2 | * Copyright (c) Microsoft Corporation. All rights reserved.
3 | * Licensed under the MIT License. See LICENSE in the project root for license information.
4 | *--------------------------------------------------------------------------------------------*/
5 |
6 | import { IntegrationAccount } from "azure-arm-logic/lib/models";
7 |
8 | export enum IntegrationAccountSku {
9 | Free = "Free",
10 | Basic = "Basic",
11 | Standard = "Standard"
12 | }
13 |
14 | export async function createNewIntegrationAccount(integrationAccountName: string, sku: IntegrationAccountSku, location: string): Promise {
15 | const integrationAccount: IntegrationAccount = {
16 | location,
17 | name: integrationAccountName,
18 | properties: {},
19 | sku: {
20 | name: sku
21 | }
22 | };
23 |
24 | return integrationAccount;
25 | }
26 |
--------------------------------------------------------------------------------
/src/wizard/integration-account/agreements/hostPartnerStep.ts:
--------------------------------------------------------------------------------
1 | /*---------------------------------------------------------------------------------------------
2 | * Copyright (c) Microsoft Corporation. All rights reserved.
3 | * Licensed under the MIT License. See LICENSE in the project root for license information.
4 | *--------------------------------------------------------------------------------------------*/
5 |
6 | import { AzureWizardPromptStep } from "vscode-azureextensionui";
7 | import { IAgreementWizardContext } from "./createAgreementWizard";
8 | import { PartnerStep } from "./partnerStep";
9 |
10 | export class HostPartnerStep extends AzureWizardPromptStep {
11 | public async prompt(wizardContext: IAgreementWizardContext): Promise {
12 | const partnerStep = new PartnerStep();
13 | await partnerStep.prompt(wizardContext).then((result) => {
14 | wizardContext.hostPartner = result;
15 | });
16 |
17 | return wizardContext;
18 | }
19 | }
20 |
--------------------------------------------------------------------------------
/src/utils/integration-account/schemaUtils.ts:
--------------------------------------------------------------------------------
1 | /*---------------------------------------------------------------------------------------------
2 | * Copyright (c) Microsoft Corporation. All rights reserved.
3 | * Licensed under the MIT License. See LICENSE in the project root for license information.
4 | *--------------------------------------------------------------------------------------------*/
5 |
6 | import { IntegrationAccountSchema } from "azure-arm-logic/lib/models";
7 | import { Constants } from "../../constants";
8 |
9 | export enum SchemaType {
10 | Xml = "Xml"
11 | }
12 |
13 | export async function createNewSchema(schemaName: string): Promise {
14 | const schema: IntegrationAccountSchema = {
15 | content: "\n\n\t\n",
16 | contentType: Constants.XmlContentType,
17 | name: schemaName,
18 | schemaType: SchemaType.Xml
19 | };
20 |
21 | return schema;
22 | }
23 |
--------------------------------------------------------------------------------
/src/wizard/integration-account/agreements/guestPartnerStep.ts:
--------------------------------------------------------------------------------
1 | /*---------------------------------------------------------------------------------------------
2 | * Copyright (c) Microsoft Corporation. All rights reserved.
3 | * Licensed under the MIT License. See LICENSE in the project root for license information.
4 | *--------------------------------------------------------------------------------------------*/
5 |
6 | import { AzureWizardPromptStep } from "vscode-azureextensionui";
7 | import { IAgreementWizardContext } from "./createAgreementWizard";
8 | import { PartnerStep } from "./partnerStep";
9 |
10 | export class GuestPartnerStep extends AzureWizardPromptStep {
11 | public async prompt(wizardContext: IAgreementWizardContext): Promise {
12 | const partnerStep = new PartnerStep();
13 | await partnerStep.prompt(wizardContext, [wizardContext.hostPartner!]).then((result) => {
14 | wizardContext.guestPartner = result;
15 | });
16 |
17 | return wizardContext;
18 | }
19 | }
20 |
--------------------------------------------------------------------------------
/src/wizard/integration-account/agreements/hostIdentityStep.ts:
--------------------------------------------------------------------------------
1 | /*---------------------------------------------------------------------------------------------
2 | * Copyright (c) Microsoft Corporation. All rights reserved.
3 | * Licensed under the MIT License. See LICENSE in the project root for license information.
4 | *--------------------------------------------------------------------------------------------*/
5 |
6 | import { AzureWizardPromptStep } from "vscode-azureextensionui";
7 | import { IAgreementWizardContext } from "./createAgreementWizard";
8 | import { IdentityStep } from "./identityStep";
9 |
10 | export class HostIdentityStep extends AzureWizardPromptStep {
11 | public async prompt(wizardContext: IAgreementWizardContext): Promise {
12 | const identityStep = new IdentityStep();
13 | await identityStep.prompt(wizardContext, wizardContext.hostPartner!).then((result) => {
14 | wizardContext.hostIdentity = result;
15 | });
16 |
17 | return wizardContext;
18 | }
19 | }
20 |
--------------------------------------------------------------------------------
/src/wizard/integration-account/agreements/guestIdentityStep.ts:
--------------------------------------------------------------------------------
1 | /*---------------------------------------------------------------------------------------------
2 | * Copyright (c) Microsoft Corporation. All rights reserved.
3 | * Licensed under the MIT License. See LICENSE in the project root for license information.
4 | *--------------------------------------------------------------------------------------------*/
5 |
6 | import { AzureWizardPromptStep } from "vscode-azureextensionui";
7 | import { IAgreementWizardContext } from "./createAgreementWizard";
8 | import { IdentityStep } from "./identityStep";
9 |
10 | export class GuestIdentityStep extends AzureWizardPromptStep {
11 | public async prompt(wizardContext: IAgreementWizardContext): Promise {
12 | const identityStep = new IdentityStep();
13 | await identityStep.prompt(wizardContext, wizardContext.guestPartner!).then((result) => {
14 | wizardContext.guestIdentity = result;
15 | });
16 |
17 | return wizardContext;
18 | }
19 | }
20 |
--------------------------------------------------------------------------------
/resources/azure.svg:
--------------------------------------------------------------------------------
1 |
4 |
--------------------------------------------------------------------------------
/src/wizard/logic-app/LocationListStep.ts:
--------------------------------------------------------------------------------
1 | /*---------------------------------------------------------------------------------------------
2 | * Copyright (c) Microsoft Corporation. All rights reserved.
3 | * Licensed under the MIT License. See LICENSE in the project root for license information.
4 | *--------------------------------------------------------------------------------------------*/
5 |
6 | import { AzureWizardPromptStep, UserCancelledError } from "vscode-azureextensionui";
7 | import { askForLocation } from "../../utils/locationUtils";
8 | import { IBuildDefinitionWizardContext } from "./createBuildDefinition";
9 |
10 | export class LocationListStep extends AzureWizardPromptStep {
11 | public async prompt(wizardContext: IBuildDefinitionWizardContext): Promise {
12 | const location = await askForLocation();
13 | if (!location) {
14 | throw new UserCancelledError();
15 | }
16 |
17 | return {
18 | ...wizardContext,
19 | location
20 | };
21 | }
22 | }
23 |
--------------------------------------------------------------------------------
/src/commands/logic-app/enableLogicApp.ts:
--------------------------------------------------------------------------------
1 | /*---------------------------------------------------------------------------------------------
2 | * Copyright (c) Microsoft Corporation. All rights reserved.
3 | * Licensed under the MIT License. See LICENSE in the project root for license information.
4 | *--------------------------------------------------------------------------------------------*/
5 |
6 | import { AzureTreeDataProvider, IAzureNode } from "vscode-azureextensionui";
7 | import { localize } from "../../localize";
8 | import { LogicAppTreeItem } from "../../tree/logic-app/LogicAppTreeItem";
9 |
10 | export async function enableLogicApp(tree: AzureTreeDataProvider, node?: IAzureNode): Promise {
11 | if (!node) {
12 | node = await tree.showNodePicker(LogicAppTreeItem.contextValue);
13 | }
14 |
15 | await node.runWithTemporaryDescription(
16 | localize("azLogicApps.enabling", "Enabling..."),
17 | async () => {
18 | const logicAppTreeItem = node!.treeItem as LogicAppTreeItem;
19 | await logicAppTreeItem.enable();
20 | }
21 | );
22 | }
23 |
--------------------------------------------------------------------------------
/src/commands/logic-app/disableLogicApp.ts:
--------------------------------------------------------------------------------
1 | /*---------------------------------------------------------------------------------------------
2 | * Copyright (c) Microsoft Corporation. All rights reserved.
3 | * Licensed under the MIT License. See LICENSE in the project root for license information.
4 | *--------------------------------------------------------------------------------------------*/
5 |
6 | import { AzureTreeDataProvider, IAzureNode } from "vscode-azureextensionui";
7 | import { localize } from "../../localize";
8 | import { LogicAppTreeItem } from "../../tree/logic-app/LogicAppTreeItem";
9 |
10 | export async function disableLogicApp(tree: AzureTreeDataProvider, node?: IAzureNode): Promise {
11 | if (!node) {
12 | node = await tree.showNodePicker(LogicAppTreeItem.contextValue);
13 | }
14 |
15 | await node.runWithTemporaryDescription(
16 | localize("azLogicApps.disabling", "Disabling..."),
17 | async () => {
18 | const logicAppTreeItem = node!.treeItem as LogicAppTreeItem;
19 | await logicAppTreeItem.disable();
20 | }
21 | );
22 | }
23 |
--------------------------------------------------------------------------------
/src/wizard/integration-account/maps/mapTypeStep.ts:
--------------------------------------------------------------------------------
1 | /*---------------------------------------------------------------------------------------------
2 | * Copyright (c) Microsoft Corporation. All rights reserved.
3 | * Licensed under the MIT License. See LICENSE in the project root for license information.
4 | *--------------------------------------------------------------------------------------------*/
5 |
6 | import * as vscode from "vscode";
7 | import { AzureWizardPromptStep, UserCancelledError } from "vscode-azureextensionui";
8 | import { MapType } from "../../../utils/integration-account/mapUtils";
9 | import { IMapWizardContext } from "./createMapWizard";
10 |
11 | export class MapTypeStep extends AzureWizardPromptStep {
12 | public async prompt(wizardContext: IMapWizardContext): Promise {
13 | const mapTypes = Object.keys(MapType);
14 | wizardContext.mapType = await vscode.window.showQuickPick(mapTypes);
15 |
16 | if (wizardContext.mapType) {
17 | return wizardContext;
18 | }
19 |
20 | throw new UserCancelledError();
21 | }
22 | }
23 |
--------------------------------------------------------------------------------
/resources/dark/CreateProject.svg:
--------------------------------------------------------------------------------
1 |
9 |
--------------------------------------------------------------------------------
/resources/light/CreateProject.svg:
--------------------------------------------------------------------------------
1 |
9 |
--------------------------------------------------------------------------------
/src/utils/commandUtils.ts:
--------------------------------------------------------------------------------
1 | /*---------------------------------------------------------------------------------------------
2 | * Copyright (c) Microsoft Corporation. All rights reserved.
3 | * Licensed under the MIT License. See LICENSE in the project root for license information.
4 | *--------------------------------------------------------------------------------------------*/
5 |
6 | import * as vscode from "vscode";
7 | import { AzureTreeDataProvider, IAzureNode, IAzureParentNode, IAzureTreeItem } from "vscode-azureextensionui";
8 |
9 | export async function openAndShowTextDocument(content: string, language = "json"): Promise {
10 | const document = await vscode.workspace.openTextDocument({
11 | content,
12 | language
13 | });
14 |
15 | await vscode.window.showTextDocument(document);
16 | }
17 |
18 | export async function createChildNode(tree: AzureTreeDataProvider, parentContextValue: string, node?: IAzureParentNode): Promise> {
19 | if (!node) {
20 | node = await tree.showNodePicker(parentContextValue) as IAzureParentNode;
21 | }
22 |
23 | return await node.createChild();
24 | }
25 |
--------------------------------------------------------------------------------
/src/commands/logic-app/resubmitRun.ts:
--------------------------------------------------------------------------------
1 | /*---------------------------------------------------------------------------------------------
2 | * Copyright (c) Microsoft Corporation. All rights reserved.
3 | * Licensed under the MIT License. See LICENSE in the project root for license information.
4 | *--------------------------------------------------------------------------------------------*/
5 |
6 | import { AzureTreeDataProvider, IAzureNode } from "vscode-azureextensionui";
7 | import { localize } from "../../localize";
8 | import { LogicAppRunTreeItem } from "../../tree/logic-app/LogicAppRunTreeItem";
9 |
10 | export async function resubmitRun(tree: AzureTreeDataProvider, node?: IAzureNode): Promise {
11 | if (!node) {
12 | node = await tree.showNodePicker(LogicAppRunTreeItem.contextValue);
13 | }
14 |
15 | node.runWithTemporaryDescription(
16 | localize("azLogicApps.resubmitting", "Resubmitting..."),
17 | async () => {
18 | const logicAppRunTreeItem = node!.treeItem as LogicAppRunTreeItem;
19 | await logicAppRunTreeItem.resubmit();
20 | await node!.parent!.refresh();
21 | }
22 | );
23 | }
24 |
--------------------------------------------------------------------------------
/src/commands/logic-app/runTrigger.ts:
--------------------------------------------------------------------------------
1 | /*---------------------------------------------------------------------------------------------
2 | * Copyright (c) Microsoft Corporation. All rights reserved.
3 | * Licensed under the MIT License. See LICENSE in the project root for license information.
4 | *--------------------------------------------------------------------------------------------*/
5 |
6 | import { AzureTreeDataProvider, IAzureNode } from "vscode-azureextensionui";
7 | import { localize } from "../../localize";
8 | import { LogicAppTriggerTreeItem } from "../../tree/logic-app/LogicAppTriggerTreeItem";
9 |
10 | export async function runTrigger(tree: AzureTreeDataProvider, node?: IAzureNode): Promise {
11 | if (!node) {
12 | node = await tree.showNodePicker(LogicAppTriggerTreeItem.contextValue);
13 | }
14 |
15 | node.runWithTemporaryDescription(
16 | localize("azLogicApps.running", "Running..."),
17 | async () => {
18 | const logicAppTriggerTreeItem = node!.treeItem as LogicAppTriggerTreeItem;
19 | await logicAppTriggerTreeItem.run();
20 | await node!.parent!.parent!.refresh();
21 | }
22 | );
23 | }
24 |
--------------------------------------------------------------------------------
/src/commands/logic-app/openVersionInEditor.ts:
--------------------------------------------------------------------------------
1 | /*---------------------------------------------------------------------------------------------
2 | * Copyright (c) Microsoft Corporation. All rights reserved.
3 | * Licensed under the MIT License. See LICENSE in the project root for license information.
4 | *--------------------------------------------------------------------------------------------*/
5 |
6 | import { AzureTreeDataProvider, IAzureNode } from "vscode-azureextensionui";
7 | import { LogicAppCurrentVersionTreeItem } from "../../tree/logic-app/LogicAppCurrentVersionTreeItem";
8 | import { LogicAppVersionTreeItem } from "../../tree/logic-app/LogicAppVersionTreeItem";
9 | import { openReadOnlyJson } from "../../utils/readOnlyUtils";
10 |
11 | export async function openVersionInEditor(tree: AzureTreeDataProvider, node?: IAzureNode): Promise {
12 | if (!node) {
13 | node = await tree.showNodePicker([LogicAppCurrentVersionTreeItem.contextValue, LogicAppVersionTreeItem.contextValue]);
14 | }
15 |
16 | const content = await (node.treeItem as LogicAppCurrentVersionTreeItem | LogicAppVersionTreeItem).getData();
17 | await openReadOnlyJson(node.id, content);
18 | }
19 |
--------------------------------------------------------------------------------
/src/utils/authorizationUtils.ts:
--------------------------------------------------------------------------------
1 | /*---------------------------------------------------------------------------------------------
2 | * Copyright (c) Microsoft Corporation. All rights reserved.
3 | * Licensed under the MIT License. See LICENSE in the project root for license information.
4 | *--------------------------------------------------------------------------------------------*/
5 |
6 | import { ServiceClientCredentials, WebResource } from "ms-rest";
7 |
8 | export interface CredentialsMetadata {
9 | domain: string;
10 | userName: string;
11 | }
12 |
13 | export function getAuthorization(credentials: ServiceClientCredentials): Promise {
14 | return new Promise((resolve, reject) => {
15 | const webResource = new WebResource();
16 | credentials.signRequest(webResource, (err: Error | undefined): void => {
17 | if (err) {
18 | reject(err);
19 | } else {
20 | resolve(webResource.headers.authorization);
21 | }
22 | });
23 | });
24 | }
25 |
26 | export function getCredentialsMetadata(credentials: ServiceClientCredentials): CredentialsMetadata {
27 | return credentials as unknown as CredentialsMetadata;
28 | }
29 |
--------------------------------------------------------------------------------
/src/wizard/integration-account/agreements/agreementTypeStep.ts:
--------------------------------------------------------------------------------
1 | /*---------------------------------------------------------------------------------------------
2 | * Copyright (c) Microsoft Corporation. All rights reserved.
3 | * Licensed under the MIT License. See LICENSE in the project root for license information.
4 | *--------------------------------------------------------------------------------------------*/
5 |
6 | import * as vscode from "vscode";
7 | import { AzureWizardPromptStep, UserCancelledError } from "vscode-azureextensionui";
8 | import { AgreementType } from "../../../utils/integration-account/agreementUtils";
9 | import { IAgreementWizardContext } from "./createAgreementWizard";
10 |
11 | export class AgreementTypeStep extends AzureWizardPromptStep {
12 | public async prompt(wizardContext: IAgreementWizardContext): Promise {
13 | const agreementTypes = Object.keys(AgreementType);
14 | wizardContext.agreementType = await vscode.window.showQuickPick(agreementTypes);
15 |
16 | if (wizardContext.agreementType) {
17 | return wizardContext;
18 | }
19 |
20 | throw new UserCancelledError();
21 | }
22 | }
23 |
--------------------------------------------------------------------------------
/LICENSE:
--------------------------------------------------------------------------------
1 | MIT License
2 |
3 | Copyright (c) Microsoft Corporation. All rights reserved.
4 |
5 | Permission is hereby granted, free of charge, to any person obtaining a copy
6 | of this software and associated documentation files (the "Software"), to deal
7 | in the Software without restriction, including without limitation the rights
8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9 | copies of the Software, and to permit persons to whom the Software is
10 | furnished to do so, subject to the following conditions:
11 |
12 | The above copyright notice and this permission notice shall be included in all
13 | copies or substantial portions of the Software.
14 |
15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21 | SOFTWARE
22 |
--------------------------------------------------------------------------------
/src/test/runTest.js:
--------------------------------------------------------------------------------
1 | /*---------------------------------------------------------------------------------------------
2 | * Copyright (c) Microsoft Corporation. All rights reserved.
3 | * Licensed under the MIT License. See LICENSE in the project root for license information.
4 | *--------------------------------------------------------------------------------------------*/
5 |
6 | const path = require("path");
7 | const { runTests } = require("@vscode/test-electron");
8 |
9 | async function main() {
10 | try {
11 | // The folder containing the Extension Manifest package.json
12 | // Passed to `--extensionDevelopmentPath`
13 | const extensionDevelopmentPath = path.resolve(__dirname, '../../../');
14 |
15 | // The path to the extension test runner script
16 | // Passed to --extensionTestsPath
17 | const extensionTestsPath = path.resolve(__dirname, './index');
18 |
19 | // Download VS Code, unzip it and run the integration test
20 | await runTests({ extensionDevelopmentPath, extensionTestsPath });
21 | } catch (err) {
22 | console.error(err);
23 | console.error('Failed to run tests');
24 | process.exit(1);
25 | }
26 | }
27 |
28 | main();
29 |
--------------------------------------------------------------------------------
/src/wizard/logic-app/CsmFileCreateStep.ts:
--------------------------------------------------------------------------------
1 | /*---------------------------------------------------------------------------------------------
2 | * Copyright (c) Microsoft Corporation. All rights reserved.
3 | * Licensed under the MIT License. See LICENSE in the project root for license information.
4 | *--------------------------------------------------------------------------------------------*/
5 |
6 | import * as fse from "fs-extra";
7 | import { AzureWizardExecuteStep } from "vscode-azureextensionui";
8 | import { generateDeploymentTemplate } from "../../utils/logic-app/templateUtils";
9 | import { IBuildDefinitionWizardContext } from "./createBuildDefinition";
10 |
11 | export class CsmFileCreateStep extends AzureWizardExecuteStep {
12 | public async execute(wizardContext: IBuildDefinitionWizardContext): Promise {
13 | const { csmFilename, templateParameterDefinitions, templateResources } = wizardContext;
14 | const deploymentTemplate = generateDeploymentTemplate(templateParameterDefinitions!, templateResources!);
15 |
16 | await fse.writeJSON(csmFilename!, deploymentTemplate, { spaces: 4 });
17 |
18 | return wizardContext;
19 | }
20 | }
21 |
--------------------------------------------------------------------------------
/src/wizard/integration-account/partners/partnerQualifierStep.ts:
--------------------------------------------------------------------------------
1 | /*---------------------------------------------------------------------------------------------
2 | * Copyright (c) Microsoft Corporation. All rights reserved.
3 | * Licensed under the MIT License. See LICENSE in the project root for license information.
4 | *--------------------------------------------------------------------------------------------*/
5 |
6 | import * as vscode from "vscode";
7 | import { AzureWizardPromptStep, UserCancelledError } from "vscode-azureextensionui";
8 | import { Constants } from "../../../constants";
9 | import { IPartnerWizardContext } from "./createPartnerWizard";
10 |
11 | export class PartnerQualifierStep extends AzureWizardPromptStep {
12 | public async prompt(wizardContext: IPartnerWizardContext): Promise {
13 | const qualifiers = Array.from(Constants.Qualifier.keys());
14 | const qualifier = await vscode.window.showQuickPick(qualifiers);
15 |
16 | if (qualifier) {
17 | wizardContext.partnerQualifier = Constants.Qualifier.get(qualifier);
18 | return wizardContext;
19 | }
20 |
21 | throw new UserCancelledError();
22 | }
23 | }
24 |
--------------------------------------------------------------------------------
/src/commands/logic-app/createProject.ts:
--------------------------------------------------------------------------------
1 | /*---------------------------------------------------------------------------------------------
2 | * Copyright (c) Microsoft Corporation. All rights reserved.
3 | * Licensed under the MIT License. See LICENSE in the project root for license information.
4 | *--------------------------------------------------------------------------------------------*/
5 |
6 | import * as fse from "fs-extra";
7 | import * as vscode from "vscode";
8 | import { ext } from "../../extensionVariables";
9 | import { localize } from "../../localize";
10 | import { openFolder, selectWorkspaceFolder } from "../../utils/workspaceUtils";
11 |
12 | export async function createProject(): Promise {
13 | const fsPath = await selectWorkspaceFolder(ext.ui);
14 | if (!fsPath) {
15 | return;
16 | }
17 |
18 | const options: vscode.ProgressOptions = {
19 | location: vscode.ProgressLocation.Notification,
20 | title: localize("azLogicApp.creatingProject", "Creating project...")
21 | };
22 |
23 | await vscode.window.withProgress(options, async () => {
24 | await fse.ensureDir(fsPath);
25 |
26 | const uri = vscode.Uri.file(fsPath);
27 | await openFolder(uri);
28 | });
29 | }
30 |
--------------------------------------------------------------------------------
/src/wizard/integration-account/integrationAccountSkuStep.ts:
--------------------------------------------------------------------------------
1 | /*---------------------------------------------------------------------------------------------
2 | * Copyright (c) Microsoft Corporation. All rights reserved.
3 | * Licensed under the MIT License. See LICENSE in the project root for license information.
4 | *--------------------------------------------------------------------------------------------*/
5 |
6 | import * as vscode from "vscode";
7 | import { AzureWizardPromptStep, UserCancelledError } from "vscode-azureextensionui";
8 | import { IntegrationAccountSku } from "../../utils/integration-account/integrationAccountUtils";
9 | import { IIntegrationAccountWizardContext } from "./createIntegrationAccountWizard";
10 |
11 | export class IntegrationAccountSkuStep extends AzureWizardPromptStep {
12 | public async prompt(wizardContext: IIntegrationAccountWizardContext): Promise {
13 | const skus = Object.keys(IntegrationAccountSku);
14 | wizardContext.sku = await vscode.window.showQuickPick(skus);
15 |
16 | if (wizardContext.sku) {
17 | return wizardContext;
18 | }
19 |
20 | throw new UserCancelledError();
21 | }
22 | }
23 |
--------------------------------------------------------------------------------
/src/wizard/logic-app/CsmParametersFileCreateStep.ts:
--------------------------------------------------------------------------------
1 | /*---------------------------------------------------------------------------------------------
2 | * Copyright (c) Microsoft Corporation. All rights reserved.
3 | * Licensed under the MIT License. See LICENSE in the project root for license information.
4 | *--------------------------------------------------------------------------------------------*/
5 |
6 | import * as fse from "fs-extra";
7 | import { AzureWizardExecuteStep } from "vscode-azureextensionui";
8 | import { generateDeploymentTemplateParameters } from "../../utils/logic-app/templateUtils";
9 | import { IBuildDefinitionWizardContext } from "./createBuildDefinition";
10 |
11 | export class CsmParametersFileCreateStep extends AzureWizardExecuteStep {
12 | public async execute(wizardContext: IBuildDefinitionWizardContext): Promise {
13 | const { csmParametersFilename, templateParameters } = wizardContext;
14 | const deploymentTemplateParameters = generateDeploymentTemplateParameters(templateParameters);
15 |
16 | await fse.writeJSON(csmParametersFilename!, deploymentTemplateParameters, { spaces: 4 });
17 |
18 | return wizardContext;
19 | }
20 | }
21 |
--------------------------------------------------------------------------------
/src/wizard/logic-app/WorkspaceFolderSelectionStep.ts:
--------------------------------------------------------------------------------
1 | /*---------------------------------------------------------------------------------------------
2 | * Copyright (c) Microsoft Corporation. All rights reserved.
3 | * Licensed under the MIT License. See LICENSE in the project root for license information.
4 | *--------------------------------------------------------------------------------------------*/
5 |
6 | import { AzureWizardPromptStep, UserCancelledError } from "vscode-azureextensionui";
7 | import { ext } from "../../extensionVariables";
8 | import { selectWorkspaceFolder } from "../../utils/workspaceUtils";
9 | import { IBuildDefinitionWizardContext } from "./createBuildDefinition";
10 |
11 | export class WorkspaceFolderSelectionStep extends AzureWizardPromptStep {
12 | public async prompt(wizardContext: IBuildDefinitionWizardContext): Promise {
13 | const workspaceFolderPath = wizardContext.workspaceFolderPath || await selectWorkspaceFolder(ext.ui);
14 | if (!workspaceFolderPath) {
15 | throw new UserCancelledError();
16 | }
17 |
18 | return {
19 | ...wizardContext,
20 | workspaceFolderPath
21 | };
22 | }
23 | }
24 |
--------------------------------------------------------------------------------
/resources/azLogicAppsWorkflowVersion.svg:
--------------------------------------------------------------------------------
1 |
2 |
--------------------------------------------------------------------------------
/src/utils/stringUtils.ts:
--------------------------------------------------------------------------------
1 | /*---------------------------------------------------------------------------------------------
2 | * Copyright (c) Microsoft Corporation. All rights reserved.
3 | * Licensed under the MIT License. See LICENSE in the project root for license information.
4 | *--------------------------------------------------------------------------------------------*/
5 |
6 | /**
7 | * Replace characters invalid for a deployment template parameter name with a replacement character (default _).
8 | * Deployment template parameter names cannot begin with a number.
9 | * @param {string} value
10 | * @param {string} [replaceWith="_"]
11 | * @returns {string}
12 | */
13 | export function normalizeParameterName(value: string, replaceWith = "_"): string {
14 | return value.replace(/[^$\w]/g, replaceWith).replace(/^\d/, replaceWith);
15 | }
16 |
17 | /**
18 | * Replace characters invalid for an Azure resource name with a replacement character (default _).
19 | * Azure resource names cannot end with a period.
20 | * @param {string} value
21 | * @param {string} [replaceWith="_"]
22 | * @returns {string}
23 | */
24 | export function normalizeResourceName(value: string, replaceWith = "_"): string {
25 | return value.replace(/[^-\w.()]/g, replaceWith).replace(/\.$/, replaceWith);
26 | }
27 |
--------------------------------------------------------------------------------
/resources/azIntegrationAccountSchema.svg:
--------------------------------------------------------------------------------
1 |
2 |
20 |
--------------------------------------------------------------------------------
/resources/status/Aborted.svg:
--------------------------------------------------------------------------------
1 |
2 |
31 |
--------------------------------------------------------------------------------
/src/commands/logic-app/addBuildDefinitionToProject.ts:
--------------------------------------------------------------------------------
1 | /*---------------------------------------------------------------------------------------------
2 | * Copyright (c) Microsoft Corporation. All rights reserved.
3 | * Licensed under the MIT License. See LICENSE in the project root for license information.
4 | *--------------------------------------------------------------------------------------------*/
5 |
6 | import * as vscode from "vscode";
7 | import { localize } from "../../localize";
8 | import { openFolder } from "../../utils/workspaceUtils";
9 | import { createBuildDefinition } from "../../wizard/logic-app/createBuildDefinition";
10 |
11 | export async function addBuildDefinitionToProject(workspaceFolderPath?: string): Promise {
12 | const options: vscode.ProgressOptions = {
13 | location: vscode.ProgressLocation.Notification,
14 | title: localize("azLogicApps.creatingBuildDefinition", "Creating build definition...")
15 | };
16 |
17 | await vscode.window.withProgress(options, async () => {
18 | ({ workspaceFolderPath } = await createBuildDefinition(workspaceFolderPath));
19 |
20 | if (!vscode.workspace.workspaceFolders || vscode.workspace.workspaceFolders.length === 0) {
21 | await openFolder(vscode.Uri.file(workspaceFolderPath!));
22 | }
23 | });
24 | }
25 |
--------------------------------------------------------------------------------
/.vscode/launch.json:
--------------------------------------------------------------------------------
1 | // A launch configuration that compiles the extension and then opens it inside a new window
2 | // Use IntelliSense to learn about possible attributes.
3 | // Hover to view descriptions of existing attributes.
4 | // For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
5 | {
6 | "version": "0.2.0",
7 | "configurations": [
8 | {
9 | "name": "Extension",
10 | "type": "extensionHost",
11 | "request": "launch",
12 | "runtimeExecutable": "${execPath}",
13 | "args": [
14 | "--extensionDevelopmentPath=${workspaceFolder}"
15 | ],
16 | "outFiles": [
17 | "${workspaceFolder}/out/**/*.js"
18 | ],
19 | "preLaunchTask": "npm: compile"
20 | },
21 | {
22 | "name": "Extension Tests",
23 | "type": "extensionHost",
24 | "request": "launch",
25 | "runtimeExecutable": "${execPath}",
26 | "args": [
27 | "--extensionDevelopmentPath=${workspaceFolder}",
28 | "--extensionTestsPath=${workspaceFolder}/out/test"
29 | ],
30 | "outFiles": [
31 | "${workspaceFolder}/out/test/**/*.js"
32 | ],
33 | "preLaunchTask": "npm: compile"
34 | }
35 | ]
36 | }
37 |
--------------------------------------------------------------------------------
/src/utils/locationUtils.ts:
--------------------------------------------------------------------------------
1 | /*---------------------------------------------------------------------------------------------
2 | * Copyright (c) Microsoft Corporation. All rights reserved.
3 | * Licensed under the MIT License. See LICENSE in the project root for license information.
4 | *--------------------------------------------------------------------------------------------*/
5 |
6 | import { SubscriptionClient } from "azure-arm-resource";
7 | import * as vscode from "vscode";
8 |
9 | export async function askForLocation(): Promise {
10 | return vscode.window.showQuickPick(getLocations(), { canPickMany: false });
11 | }
12 |
13 | async function getLocations(): Promise {
14 | const extension = vscode.extensions.getExtension("ms-vscode.azure-account");
15 | if (!extension) {
16 | return [];
17 | }
18 |
19 | const { filters, sessions } = extension.exports;
20 | if (filters.length < 1 || sessions.length < 1) {
21 | return [];
22 | }
23 |
24 | const { subscriptionId } = filters[0].subscription;
25 | const { credentials } = sessions[0];
26 | const client = new SubscriptionClient(credentials);
27 | const locationListResult = await client.subscriptions.listLocations(subscriptionId);
28 | const locations = locationListResult.map((location) => location!.displayName!);
29 | locations.sort();
30 |
31 | return locations;
32 | }
33 |
--------------------------------------------------------------------------------
/src/utils/nodeUtils.ts:
--------------------------------------------------------------------------------
1 | /*---------------------------------------------------------------------------------------------
2 | * Copyright (c) Microsoft Corporation. All rights reserved.
3 | * Licensed under the MIT License. See LICENSE in the project root for license information.
4 | *--------------------------------------------------------------------------------------------*/
5 |
6 | import * as path from "path";
7 | import { ext } from "../extensionVariables";
8 |
9 | export interface IThemedIconPath {
10 | dark: string;
11 | light: string;
12 | }
13 |
14 | export function getIconPath(iconName: string): string {
15 | return ext.context.asAbsolutePath(path.join("resources", `${iconName}.svg`));
16 | }
17 |
18 | export function getStatusIconPath(iconName: string): string {
19 | return ext.context.asAbsolutePath(path.join("resources", "status", `${iconName}.svg`));
20 | }
21 |
22 | export function getThemedIconPath(iconName: string): IThemedIconPath {
23 | return {
24 | dark: ext.context.asAbsolutePath(path.join("resources", "dark", `${iconName}.svg`)),
25 | light: ext.context.asAbsolutePath(path.join("resources", "light", `${iconName}.svg`))
26 | };
27 | }
28 |
29 | export function arrayToMap(array: T[], key: K): Map {
30 | const mappedObjects: Map = new Map();
31 | for (const item of array) {
32 | mappedObjects.set(String(item[key]), item);
33 | }
34 |
35 | return mappedObjects;
36 | }
37 |
--------------------------------------------------------------------------------
/src/test/index.js:
--------------------------------------------------------------------------------
1 | /*---------------------------------------------------------------------------------------------
2 | * Copyright (c) Microsoft Corporation. All rights reserved.
3 | * Licensed under the MIT License. See LICENSE in the project root for license information.
4 | *--------------------------------------------------------------------------------------------*/
5 |
6 | const path = require("path");
7 | const Mocha = require("mocha");
8 | const glob = require("glob");
9 |
10 | function run() {
11 | // Create the mocha test
12 | const mocha = new Mocha({
13 | ui: 'tdd'
14 | });
15 | mocha.color(true);
16 |
17 | const testsRoot = path.resolve(__dirname, '..');
18 |
19 | return new Promise((c, e) => {
20 | glob('**/**.test.js', { cwd: testsRoot }, (err, files) => {
21 | if (err) {
22 | return e(err);
23 | }
24 |
25 | // Add files to the test suite
26 | for (const f of files) {
27 | mocha.addFile(path.resolve(testsRoot, f));
28 | }
29 |
30 | try {
31 | // Run the mocha test
32 | mocha.run(failures => {
33 | if (failures > 0) {
34 | e(new Error(`${failures} tests failed.`));
35 | } else {
36 | c();
37 | }
38 | });
39 | } catch (err) {
40 | e(err);
41 | }
42 | });
43 | });
44 | }
45 |
46 | exports.run = run;
47 |
--------------------------------------------------------------------------------
/resources/azIntegrationAccountAgreement.svg:
--------------------------------------------------------------------------------
1 |
2 |
23 |
--------------------------------------------------------------------------------
/resources/azIntegrationAccountPartner.svg:
--------------------------------------------------------------------------------
1 |
2 |
22 |
--------------------------------------------------------------------------------
/src/commands/logic-app/promoteVersion.ts:
--------------------------------------------------------------------------------
1 | /*---------------------------------------------------------------------------------------------
2 | * Copyright (c) Microsoft Corporation. All rights reserved.
3 | * Licensed under the MIT License. See LICENSE in the project root for license information.
4 | *--------------------------------------------------------------------------------------------*/
5 |
6 | import * as vscode from "vscode";
7 | import { AzureTreeDataProvider, IAzureNode } from "vscode-azureextensionui";
8 | import { localize } from "../../localize";
9 | import { LogicAppVersionTreeItem } from "../../tree/logic-app/LogicAppVersionTreeItem";
10 | import { DialogResponses } from "../../utils/dialogResponses";
11 |
12 | export async function promoteVersion(tree: AzureTreeDataProvider, node?: IAzureNode): Promise {
13 | if (!node) {
14 | node = await tree.showNodePicker(LogicAppVersionTreeItem.contextValue);
15 | }
16 |
17 | const result = await vscode.window.showWarningMessage(
18 | localize("azLogicApps.promotePrompt", "Are you sure that you want to promote this version?"),
19 | DialogResponses.yes,
20 | DialogResponses.no);
21 |
22 | if (result === DialogResponses.yes) {
23 | node.runWithTemporaryDescription(
24 | localize("azLogicApps.promoting", "Promoting..."),
25 | async () => {
26 | const logicAppRunTreeItem = node!.treeItem as LogicAppVersionTreeItem;
27 | await logicAppRunTreeItem.promote();
28 | await node!.parent!.refresh();
29 | }
30 | );
31 | }
32 | }
33 |
--------------------------------------------------------------------------------
/src/wizard/logic-app/BuildDefinitionCreateStep.ts:
--------------------------------------------------------------------------------
1 | /*---------------------------------------------------------------------------------------------
2 | * Copyright (c) Microsoft Corporation. All rights reserved.
3 | * Licensed under the MIT License. See LICENSE in the project root for license information.
4 | *--------------------------------------------------------------------------------------------*/
5 |
6 | import * as fse from "fs-extra";
7 | import * as path from "path";
8 | import { AzureWizardExecuteStep } from "vscode-azureextensionui";
9 | import { generateBuildDefinition } from "../../utils/logic-app/templateUtils";
10 | import { IBuildDefinitionWizardContext } from "./createBuildDefinition";
11 |
12 | export class BuildDefinitionCreateStep extends AzureWizardExecuteStep {
13 | public async execute(wizardContext: IBuildDefinitionWizardContext): Promise {
14 | const { azureSubscription, buildDefinitionFilename, csmFilename, csmParametersFilename, location, resourceGroupName, workspaceFolderPath } = wizardContext;
15 |
16 | const buildDefinition = generateBuildDefinition({
17 | azureSubscription: azureSubscription!,
18 | csmFile: path.relative(workspaceFolderPath!, csmFilename!),
19 | csmParametersFile: path.relative(workspaceFolderPath!, csmParametersFilename!),
20 | location: location!,
21 | resourceGroupName: resourceGroupName!
22 | });
23 |
24 | await fse.writeFile(buildDefinitionFilename!, buildDefinition);
25 |
26 | return wizardContext;
27 | }
28 | }
29 |
--------------------------------------------------------------------------------
/src/wizard/integration-account/agreements/partnerStep.ts:
--------------------------------------------------------------------------------
1 | /*---------------------------------------------------------------------------------------------
2 | * Copyright (c) Microsoft Corporation. All rights reserved.
3 | * Licensed under the MIT License. See LICENSE in the project root for license information.
4 | *--------------------------------------------------------------------------------------------*/
5 |
6 | import * as vscode from "vscode";
7 | import { UserCancelledError } from "vscode-azureextensionui";
8 | import { getAllPartners } from "../../../utils/integration-account/partnerUtils";
9 | import { arrayToMap } from "../../../utils/nodeUtils";
10 | import { IAgreementWizardContext } from "./createAgreementWizard";
11 |
12 | export class PartnerStep {
13 | public async prompt(wizardContext: IAgreementWizardContext, namesToExclude: string[] = []): Promise {
14 | let partnerNames: string[];
15 | if (!wizardContext.partners) {
16 | const partners = await getAllPartners(wizardContext.credentials, wizardContext.subscriptionId, wizardContext.resourceGroup!.name!, wizardContext.integrationAccountName);
17 | wizardContext.partners = arrayToMap(partners, "name");
18 | }
19 |
20 | partnerNames = [...wizardContext.partners.keys()];
21 | partnerNames = partnerNames.filter((partnerName) => {
22 | return namesToExclude.indexOf(partnerName) === -1;
23 | });
24 |
25 | const selectedPartner = await vscode.window.showQuickPick(partnerNames);
26 |
27 | if (selectedPartner) {
28 | return selectedPartner;
29 | }
30 |
31 | throw new UserCancelledError();
32 | }
33 | }
34 |
--------------------------------------------------------------------------------
/src/wizard/integration-account/maps/mapCreateStep.ts:
--------------------------------------------------------------------------------
1 | /*---------------------------------------------------------------------------------------------
2 | * Copyright (c) Microsoft Corporation. All rights reserved.
3 | * Licensed under the MIT License. See LICENSE in the project root for license information.
4 | *--------------------------------------------------------------------------------------------*/
5 |
6 | import LogicAppsManagementClient from "azure-arm-logic";
7 | import { IntegrationAccountMap } from "azure-arm-logic/lib/models";
8 | import { addExtensionUserAgent, AzureWizardExecuteStep } from "vscode-azureextensionui";
9 | import { IntegrationAccountMapTreeItem } from "../../../tree/integration-account/IntegrationAccountMapTreeItem";
10 | import { createNewMap, MapType } from "../../../utils/integration-account/mapUtils";
11 | import { IMapWizardContext } from "./createMapWizard";
12 |
13 | export class MapCreateStep extends AzureWizardExecuteStep {
14 | public async execute(wizardContext: IMapWizardContext): Promise {
15 | const client = new LogicAppsManagementClient(wizardContext.credentials, wizardContext.subscriptionId);
16 | addExtensionUserAgent(client);
17 |
18 | const newMap: IntegrationAccountMap = await client.integrationAccountMaps.createOrUpdate(wizardContext.resourceGroup!.name!,
19 | wizardContext.integrationAccountName,
20 | wizardContext.mapName!,
21 | await createNewMap(wizardContext.mapName!, MapType[wizardContext.mapType! as MapType]));
22 |
23 | wizardContext.map = new IntegrationAccountMapTreeItem(client, newMap);
24 |
25 | return wizardContext;
26 | }
27 | }
28 |
--------------------------------------------------------------------------------
/src/wizard/integration-account/schemas/schemaCreateStep.ts:
--------------------------------------------------------------------------------
1 | /*---------------------------------------------------------------------------------------------
2 | * Copyright (c) Microsoft Corporation. All rights reserved.
3 | * Licensed under the MIT License. See LICENSE in the project root for license information.
4 | *--------------------------------------------------------------------------------------------*/
5 |
6 | import LogicAppsManagementClient from "azure-arm-logic";
7 | import { IntegrationAccountSchema } from "azure-arm-logic/lib/models";
8 | import { addExtensionUserAgent, AzureWizardExecuteStep } from "vscode-azureextensionui";
9 | import { IntegrationAccountSchemaTreeItem } from "../../../tree/integration-account/IntegrationAccountSchemaTreeItem";
10 | import { createNewSchema } from "../../../utils/integration-account/schemaUtils";
11 | import { ISchemaWizardContext } from "./createSchemaWizard";
12 |
13 | export class SchemaCreateStep extends AzureWizardExecuteStep {
14 | public async execute(wizardContext: ISchemaWizardContext): Promise {
15 | const client = new LogicAppsManagementClient(wizardContext.credentials, wizardContext.subscriptionId);
16 | addExtensionUserAgent(client);
17 |
18 | const newSchema: IntegrationAccountSchema = await client.integrationAccountSchemas.createOrUpdate(wizardContext.resourceGroup!.name!,
19 | wizardContext.integrationAccountName,
20 | wizardContext.schemaName!,
21 | await createNewSchema(wizardContext.schemaName!));
22 |
23 | wizardContext.schema = new IntegrationAccountSchemaTreeItem(client, newSchema);
24 |
25 | return wizardContext;
26 | }
27 | }
28 |
--------------------------------------------------------------------------------
/src/wizard/integration-account/partners/partnerCreateStep.ts:
--------------------------------------------------------------------------------
1 | /*---------------------------------------------------------------------------------------------
2 | * Copyright (c) Microsoft Corporation. All rights reserved.
3 | * Licensed under the MIT License. See LICENSE in the project root for license information.
4 | *--------------------------------------------------------------------------------------------*/
5 |
6 | import LogicAppsManagementClient from "azure-arm-logic";
7 | import { IntegrationAccountPartner } from "azure-arm-logic/lib/models";
8 | import { addExtensionUserAgent, AzureWizardExecuteStep } from "vscode-azureextensionui";
9 | import { IntegrationAccountPartnerTreeItem } from "../../../tree/integration-account/IntegrationAccountPartnerTreeItem";
10 | import { createNewPartner } from "../../../utils/integration-account/partnerUtils";
11 | import { IPartnerWizardContext } from "./createPartnerWizard";
12 |
13 | export class PartnerCreateStep extends AzureWizardExecuteStep {
14 | public async execute(wizardContext: IPartnerWizardContext): Promise {
15 | const client = new LogicAppsManagementClient(wizardContext.credentials, wizardContext.subscriptionId);
16 | addExtensionUserAgent(client);
17 |
18 | const newPartner: IntegrationAccountPartner = await client.integrationAccountPartners.createOrUpdate(wizardContext.resourceGroup!.name!,
19 | wizardContext.integrationAccountName,
20 | wizardContext.partnerName!,
21 | await createNewPartner(wizardContext.partnerName!, wizardContext.partnerQualifier!, wizardContext.partnerValue!));
22 |
23 | wizardContext.partner = new IntegrationAccountPartnerTreeItem(client, newPartner);
24 |
25 | return wizardContext;
26 | }
27 | }
28 |
--------------------------------------------------------------------------------
/src/commands/logic-app/openRunInMonitoringView.ts:
--------------------------------------------------------------------------------
1 | /*---------------------------------------------------------------------------------------------
2 | * Copyright (c) Microsoft Corporation. All rights reserved.
3 | * Licensed under the MIT License. See LICENSE in the project root for license information.
4 | *--------------------------------------------------------------------------------------------*/
5 |
6 | import * as vscode from "vscode";
7 | import { AzureTreeDataProvider, IAzureNode } from "vscode-azureextensionui";
8 | import { LogicAppRunTreeItem } from "../../tree/logic-app/LogicAppRunTreeItem";
9 | import { getAuthorization } from "../../utils/authorizationUtils";
10 | import { getWebviewContent } from "../../utils/logic-app/monitoringViewUtils";
11 |
12 | export async function openRunInMonitoringView(tree: AzureTreeDataProvider, node?: IAzureNode): Promise {
13 | if (!node) {
14 | node = await tree.showNodePicker(LogicAppRunTreeItem.contextValue);
15 | }
16 |
17 | const authorization = await getAuthorization(node.credentials);
18 | const canvasMode = vscode.workspace.getConfiguration("azureLogicApps").get("canvasMode")!;
19 | const runNode = node as IAzureNode;
20 | const { id: runId, label: title, location, resourceGroupName, workflowId } = runNode.treeItem;
21 | const { subscriptionId } = runNode;
22 |
23 | const options: vscode.WebviewOptions & vscode.WebviewPanelOptions = {
24 | enableScripts: true,
25 | retainContextWhenHidden: true
26 | };
27 | const panel = vscode.window.createWebviewPanel("monitoringView", title, vscode.ViewColumn.Beside, options);
28 | panel.webview.html = getWebviewContent({ authorization, canvasMode, location, resourceGroupName, runId, subscriptionId, title, workflowId });
29 | }
30 |
--------------------------------------------------------------------------------
/src/wizard/logic-app/CsmFilenameStep.ts:
--------------------------------------------------------------------------------
1 | /*---------------------------------------------------------------------------------------------
2 | * Copyright (c) Microsoft Corporation. All rights reserved.
3 | * Licensed under the MIT License. See LICENSE in the project root for license information.
4 | *--------------------------------------------------------------------------------------------*/
5 |
6 | import * as path from "path";
7 | import * as vscode from "vscode";
8 | import { AzureWizardPromptStep, UserCancelledError } from "vscode-azureextensionui";
9 | import { localize } from "../../localize";
10 | import { IBuildDefinitionWizardContext } from "./createBuildDefinition";
11 |
12 | export class CsmFilenameStep extends AzureWizardPromptStep {
13 | public async prompt(wizardContext: IBuildDefinitionWizardContext): Promise {
14 | const { workspaceFolderPath } = wizardContext;
15 | const csmFilename = await askForDeploymentTemplateFilename(workspaceFolderPath!);
16 | if (!csmFilename) {
17 | throw new UserCancelledError();
18 | }
19 |
20 | return {
21 | ...wizardContext,
22 | csmFilename
23 | };
24 | }
25 | }
26 |
27 | async function askForDeploymentTemplateFilename(workspaceFolderPath: string): Promise {
28 | const csmFileSaveDialogOptions: vscode.SaveDialogOptions = {
29 | defaultUri: vscode.Uri.file(path.join(workspaceFolderPath, "csm-file.json")),
30 | filters: {
31 | [localize("azLogicApps.armDeploymentTemplateFiles", "ARM Deployment Template Files")]: ["json"]
32 | }
33 | };
34 | const csmUri = await vscode.window.showSaveDialog(csmFileSaveDialogOptions);
35 |
36 | return csmUri ? csmUri.fsPath : undefined;
37 | }
38 |
--------------------------------------------------------------------------------
/webpack.config.js:
--------------------------------------------------------------------------------
1 | /*---------------------------------------------------------------------------------------------
2 | * Copyright (c) Microsoft Corporation. All rights reserved.
3 | * Licensed under the MIT License. See LICENSE in the project root for license information.
4 | *--------------------------------------------------------------------------------------------*/
5 |
6 | // @ts-check
7 |
8 | "use strict";
9 |
10 | const path = require("path");
11 |
12 | /** @type {import("webpack").Configuration} */
13 | const config = {
14 | devtool: "source-map",
15 | entry: "./src/extension.ts",
16 | externals: {
17 | "azure-arm-logic": "commonjs azure-arm-logic",
18 | "azure-arm-resource": "commonjs azure-arm-resource",
19 | "fs-extra": "commonjs fs-extra",
20 | "glob": "commonjs glob",
21 | "js-yaml": "commonjs js-yaml",
22 | "ms-rest": "commonjs ms-rest",
23 | "request": "commonjs request",
24 | "request-promise-native": "commonjs request-promise-native",
25 | "vscode": "commonjs vscode",
26 | "vscode-azureextensionui": "commonjs vscode-azureextensionui",
27 | "vscode-extension-telemetry": "commonjs vscode-extension-telemetry",
28 | "vscode-nls": "commonjs vscode-nls"
29 | },
30 | module: {
31 | rules: [
32 | {
33 | test: /\.ts$/,
34 | exclude: /node_modules/,
35 | loader: "ts-loader"
36 | }
37 | ]
38 | },
39 | output: {
40 | devtoolModuleFilenameTemplate: "../[resource-path]",
41 | filename: "extension.js",
42 | libraryTarget: "commonjs2",
43 | path: path.resolve(__dirname, "out")
44 | },
45 | resolve: {
46 | extensions: [".ts", ".js"]
47 | },
48 | target: "node"
49 | };
50 |
51 | module.exports = config;
52 |
--------------------------------------------------------------------------------
/resources/azLogicAppsWorkflow.svg:
--------------------------------------------------------------------------------
1 |
2 |
16 |
--------------------------------------------------------------------------------
/src/wizard/logic-app/BuildDefinitionFilenameStep.ts:
--------------------------------------------------------------------------------
1 | /*---------------------------------------------------------------------------------------------
2 | * Copyright (c) Microsoft Corporation. All rights reserved.
3 | * Licensed under the MIT License. See LICENSE in the project root for license information.
4 | *--------------------------------------------------------------------------------------------*/
5 |
6 | import * as path from "path";
7 | import * as vscode from "vscode";
8 | import { AzureWizardPromptStep, UserCancelledError } from "vscode-azureextensionui";
9 | import { localize } from "../../localize";
10 | import { IBuildDefinitionWizardContext } from "./createBuildDefinition";
11 |
12 | export class BuildDefinitionFilenameStep extends AzureWizardPromptStep {
13 | public async prompt(wizardContext: IBuildDefinitionWizardContext): Promise {
14 | const { workspaceFolderPath } = wizardContext;
15 | const buildDefinitionFilename = await askForBuildDefinitionFilename(workspaceFolderPath!);
16 | if (!buildDefinitionFilename) {
17 | throw new UserCancelledError();
18 | }
19 |
20 | return {
21 | ...wizardContext,
22 | buildDefinitionFilename
23 | };
24 | }
25 | }
26 |
27 | async function askForBuildDefinitionFilename(workspaceFolderPath: string): Promise {
28 | const yamlSaveDialogOptions: vscode.SaveDialogOptions = {
29 | defaultUri: vscode.Uri.file(path.join(workspaceFolderPath, "azure-pipelines.yml")),
30 | filters: {
31 | [localize("azLogicApps.azurePipelinesYamlFiles", "Azure Pipelines YAML Files")]: ["yml"]
32 | }
33 | };
34 | const yamlUri = await vscode.window.showSaveDialog(yamlSaveDialogOptions);
35 |
36 | return yamlUri ? yamlUri.fsPath : undefined;
37 | }
38 |
--------------------------------------------------------------------------------
/src/editors/logic-app/LogicAppEditor.ts:
--------------------------------------------------------------------------------
1 | /*---------------------------------------------------------------------------------------------
2 | * Copyright (c) Microsoft Corporation. All rights reserved.
3 | * Licensed under the MIT License. See LICENSE in the project root for license information.
4 | *--------------------------------------------------------------------------------------------*/
5 |
6 | import * as vscode from "vscode";
7 | import { BaseEditor, IAzureNode } from "vscode-azureextensionui";
8 | import { localize } from "../../localize";
9 | import { LogicAppTreeItem } from "../../tree/logic-app/LogicAppTreeItem";
10 |
11 | export class LogicAppEditor extends BaseEditor> {
12 | constructor() {
13 | super("azureLogicApps.showSavePrompt");
14 | }
15 |
16 | public async getData(node: IAzureNode): Promise {
17 | return node.treeItem.getData(true);
18 | }
19 |
20 | public async getFilename(node: IAzureNode): Promise {
21 | return `${node.treeItem.label}.logicapp.json`;
22 | }
23 |
24 | public async getSaveConfirmationText(node: IAzureNode): Promise {
25 | const { label } = node.treeItem;
26 | return localize("azLogicApps.saveConfirmationText", "Saving '{0}' will update the Logic App definition in your subscription.", label);
27 | }
28 |
29 | public async getSize(): Promise {
30 | return 0;
31 | }
32 |
33 | public async updateData(node: IAzureNode): Promise {
34 | if (!vscode.window.activeTextEditor) {
35 | throw new Error(localize("azLogicApps.errorUpdatingFile", "Cannot update Logic App after it has been closed."));
36 | }
37 |
38 | return await node.treeItem.update(vscode.window.activeTextEditor.document.getText());
39 | }
40 | }
41 |
--------------------------------------------------------------------------------
/src/wizard/logic-app/ServiceConnectionNameStep.ts:
--------------------------------------------------------------------------------
1 | /*---------------------------------------------------------------------------------------------
2 | * Copyright (c) Microsoft Corporation. All rights reserved.
3 | * Licensed under the MIT License. See LICENSE in the project root for license information.
4 | *--------------------------------------------------------------------------------------------*/
5 |
6 | import * as vscode from "vscode";
7 | import { AzureWizardPromptStep, UserCancelledError } from "vscode-azureextensionui";
8 | import { localize } from "../../localize";
9 | import { IBuildDefinitionWizardContext } from "./createBuildDefinition";
10 |
11 | export class ServiceConnectionNameStep extends AzureWizardPromptStep {
12 | public async prompt(wizardContext: IBuildDefinitionWizardContext): Promise {
13 | const azureSubscription = await askForAzureSubscriptionName();
14 | if (!azureSubscription) {
15 | throw new UserCancelledError();
16 | }
17 |
18 | return {
19 | ...wizardContext,
20 | azureSubscription
21 | };
22 | }
23 | }
24 |
25 | async function askForAzureSubscriptionName(): Promise {
26 | function validateInput(value: string): string | null | undefined | Thenable {
27 | if (value === "") {
28 | return localize("azLogicApps.azureSubscriptionRequired", "An ARM service connection name is required.");
29 | }
30 |
31 | return undefined;
32 | }
33 |
34 | const azureSubscriptionInputBoxOptions: vscode.InputBoxOptions = {
35 | prompt: localize("azLogicApps.azureSubscriptionPrompt", "Enter Azure Resource Manager connection name."),
36 | validateInput
37 | };
38 |
39 | return vscode.window.showInputBox(azureSubscriptionInputBoxOptions);
40 | }
41 |
--------------------------------------------------------------------------------
/src/wizard/integration-account/integrationAccountCreateStep.ts:
--------------------------------------------------------------------------------
1 | /*---------------------------------------------------------------------------------------------
2 | * Copyright (c) Microsoft Corporation. All rights reserved.
3 | * Licensed under the MIT License. See LICENSE in the project root for license information.
4 | *--------------------------------------------------------------------------------------------*/
5 |
6 | import LogicAppsManagementClient from "azure-arm-logic";
7 | import { IntegrationAccount } from "azure-arm-logic/lib/models";
8 | import { addExtensionUserAgent, AzureWizardExecuteStep } from "vscode-azureextensionui";
9 | import { IntegrationAccountTreeItem } from "../../tree/integration-account/IntegrationAccountTreeItem";
10 | import { createNewIntegrationAccount, IntegrationAccountSku } from "../../utils/integration-account/integrationAccountUtils";
11 | import { IIntegrationAccountWizardContext } from "./createIntegrationAccountWizard";
12 |
13 | export class IntegrationAccountCreateStep extends AzureWizardExecuteStep {
14 | public async execute(wizardContext: IIntegrationAccountWizardContext): Promise {
15 | const client = new LogicAppsManagementClient(wizardContext.credentials, wizardContext.subscriptionId);
16 | addExtensionUserAgent(client);
17 |
18 | const newIntegrationAccount: IntegrationAccount = await client.integrationAccounts.createOrUpdate(wizardContext.resourceGroup!.name!,
19 | wizardContext.integrationAccountName!,
20 | await createNewIntegrationAccount(wizardContext.integrationAccountName!,
21 | IntegrationAccountSku[wizardContext.sku! as IntegrationAccountSku],
22 | wizardContext.location!.name!));
23 |
24 | wizardContext.integrationAccount = new IntegrationAccountTreeItem(client, newIntegrationAccount);
25 |
26 | return wizardContext;
27 | }
28 | }
29 |
--------------------------------------------------------------------------------
/package.nls.json:
--------------------------------------------------------------------------------
1 | {
2 | "azIntegrationAccounts.delete": "Delete",
3 | "azIntegrationAccounts.loadMore": "Load More...",
4 | "azIntegrationAccounts.new": "New",
5 | "azIntegrationAccounts.openInEditor": "Open in Editor",
6 | "azIntegrationAccounts.refresh": "Refresh",
7 | "azIntegrationAccounts.selectSubscriptions": "Select Subscriptions",
8 | "azIntegrationAccounts.showExplorerDescription": "Show or hide the Azure Integration Accounts Explorer",
9 | "azIntegrationAccounts.showSavePrompt": "Prompt the user before saving and updating a Logic App",
10 | "azIntegrationAccounts.viewProperties": "View properties",
11 | "azLogicApps.addBuildDefinitionToProject": "Add Build Definition to Project",
12 | "azLogicApps.addLogicAppToProject": "Add to Project",
13 | "azLogicApps.canvasMode": "Use the same canvas mode used by the Logic Apps (Standard) designer",
14 | "azLogicApps.createLogicApp": "Create Logic App",
15 | "azLogicApps.createProject": "Create Project",
16 | "azLogicApps.deleteLogicApp": "Delete",
17 | "azLogicApps.disableLogicApp": "Disable",
18 | "azLogicApps.enableLogicApp": "Enable",
19 | "azLogicApps.loadMore": "Load More...",
20 | "azLogicApps.openInDesigner": "Open in Designer",
21 | "azLogicApps.openInEditor": "Open in Editor",
22 | "azLogicApps.openInPortal": "Open in Portal",
23 | "azLogicApps.openRunInMonitoringView": "Open in Monitoring View",
24 | "azLogicApps.promoteVersion": "Promote",
25 | "azLogicApps.refresh": "Refresh",
26 | "azLogicApps.resubmitRun": "Resubmit",
27 | "azLogicApps.runTrigger": "Run",
28 | "azLogicApps.selectSubscriptions": "Select Subscriptions",
29 | "azLogicApps.showExplorerDescription": "Show or hide the Azure Logic Apps Explorer",
30 | "azLogicApps.showSavePrompt": "Prompt the user before saving and updating a Logic App.",
31 | "extension.description": "Visual Studio Code extension for Azure Logic Apps (Consumption)"
32 | }
--------------------------------------------------------------------------------
/resources/status/Unknown.svg:
--------------------------------------------------------------------------------
1 |
2 |
37 |
38 |
--------------------------------------------------------------------------------
/src/commands/logic-app/addLogicAppToProject.ts:
--------------------------------------------------------------------------------
1 | /*---------------------------------------------------------------------------------------------
2 | * Copyright (c) Microsoft Corporation. All rights reserved.
3 | * Licensed under the MIT License. See LICENSE in the project root for license information.
4 | *--------------------------------------------------------------------------------------------*/
5 |
6 | import * as vscode from "vscode";
7 | import { AzureTreeDataProvider, IAzureNode } from "vscode-azureextensionui";
8 | import { ext } from "../../extensionVariables";
9 | import { localize } from "../../localize";
10 | import { LogicAppTreeItem } from "../../tree/logic-app/LogicAppTreeItem";
11 | import { selectWorkspaceFolder } from "../../utils/workspaceUtils";
12 |
13 | export async function addLogicAppToProject(tree: AzureTreeDataProvider, node?: IAzureNode): Promise {
14 | if (!node) {
15 | node = await tree.showNodePicker(LogicAppTreeItem.contextValue);
16 | }
17 |
18 | const { workspaceFolders } = vscode.workspace;
19 | if (!workspaceFolders || workspaceFolders.length === 0) {
20 | await vscode.window.showErrorMessage(localize("azLogicApps.noWorkspaceFolders", "You must create a project first before adding Logic Apps to a project."));
21 | return;
22 | }
23 |
24 | const workspaceFolderPath = workspaceFolders.length === 1
25 | ? workspaceFolders[0].uri.fsPath
26 | : await selectWorkspaceFolder(ext.ui);
27 |
28 | if (!workspaceFolderPath) {
29 | return;
30 | }
31 |
32 | const options: vscode.ProgressOptions = {
33 | location: vscode.ProgressLocation.Notification,
34 | title: localize("azLogicApp.addingToProject", "Adding to project...")
35 | };
36 |
37 | await vscode.window.withProgress(options, async () => {
38 | const logicAppTreeItem = node!.treeItem as LogicAppTreeItem;
39 | await logicAppTreeItem.addToProject(workspaceFolderPath);
40 | });
41 | }
42 |
--------------------------------------------------------------------------------
/src/wizard/logic-app/CsmParametersFilenameStep.ts:
--------------------------------------------------------------------------------
1 | /*---------------------------------------------------------------------------------------------
2 | * Copyright (c) Microsoft Corporation. All rights reserved.
3 | * Licensed under the MIT License. See LICENSE in the project root for license information.
4 | *--------------------------------------------------------------------------------------------*/
5 |
6 | import * as path from "path";
7 | import * as vscode from "vscode";
8 | import { AzureWizardPromptStep, UserCancelledError } from "vscode-azureextensionui";
9 | import { localize } from "../../localize";
10 | import { IBuildDefinitionWizardContext } from "./createBuildDefinition";
11 |
12 | export class CsmParametersFilenameStep extends AzureWizardPromptStep {
13 | public async prompt(wizardContext: IBuildDefinitionWizardContext): Promise {
14 | const { workspaceFolderPath } = wizardContext;
15 | const csmParametersFilename = await askForDeploymentTemplateParametersFilename(workspaceFolderPath!);
16 | if (!csmParametersFilename) {
17 | throw new UserCancelledError();
18 | }
19 |
20 | return {
21 | ...wizardContext,
22 | csmParametersFilename
23 | };
24 | }
25 | }
26 |
27 | async function askForDeploymentTemplateParametersFilename(workspaceFolderPath: string): Promise {
28 | const csmParametersFileSaveDialogOptions: vscode.SaveDialogOptions = {
29 | defaultUri: vscode.Uri.file(path.join(workspaceFolderPath, "csm-parameters-file.json")),
30 | filters: {
31 | [localize("azLogicApps.armDeploymentTemplateParametersFiles", "ARM Deployment Template Parameters Files")]: ["json"]
32 | }
33 | };
34 | const csmParametersUri = await vscode.window.showSaveDialog(csmParametersFileSaveDialogOptions);
35 |
36 | return csmParametersUri ? csmParametersUri.fsPath : undefined;
37 | }
38 |
--------------------------------------------------------------------------------
/src/commands/integration-account/integrationAccountMapCommands.ts:
--------------------------------------------------------------------------------
1 | /*---------------------------------------------------------------------------------------------
2 | * Copyright (c) Microsoft Corporation. All rights reserved.
3 | * Licensed under the MIT License. See LICENSE in the project root for license information.
4 | *--------------------------------------------------------------------------------------------*/
5 |
6 | import { AzureTreeDataProvider, BaseEditor, IAzureNode } from "vscode-azureextensionui";
7 | import { localize } from "../../localize";
8 | import { IntegrationAccountMapTreeItem } from "../../tree/integration-account/IntegrationAccountMapTreeItem";
9 | import { openAndShowTextDocument } from "../../utils/commandUtils";
10 |
11 | export async function deleteIntegrationAccountMap(tree: AzureTreeDataProvider, node?: IAzureNode): Promise {
12 | if (!node) {
13 | node = await tree.showNodePicker(IntegrationAccountMapTreeItem.contextValue);
14 | }
15 |
16 | await node.runWithTemporaryDescription(
17 | localize("azIntegrationAccounts.deleting", "Deleting..."),
18 | async () => {
19 | await node!.deleteNode();
20 | }
21 | );
22 | }
23 |
24 | export async function openIntegrationAccountMapInEditor(tree: AzureTreeDataProvider, editor: BaseEditor, node?: IAzureNode): Promise {
25 | if (!node) {
26 | node = await tree.showNodePicker(IntegrationAccountMapTreeItem.contextValue);
27 | }
28 |
29 | await editor.showEditor(node);
30 | }
31 |
32 | export async function viewIntegrationAccountMapProperties(tree: AzureTreeDataProvider, node?: IAzureNode): Promise {
33 | if (!node) {
34 | node = await tree.showNodePicker(IntegrationAccountMapTreeItem.contextValue);
35 | }
36 |
37 | const map = node.treeItem as IntegrationAccountMapTreeItem;
38 | const mapProperties = await map.getProperties();
39 |
40 | await openAndShowTextDocument(mapProperties, "json");
41 | }
42 |
--------------------------------------------------------------------------------
/src/utils/integration-account/partnerUtils.ts:
--------------------------------------------------------------------------------
1 | /*---------------------------------------------------------------------------------------------
2 | * Copyright (c) Microsoft Corporation. All rights reserved.
3 | * Licensed under the MIT License. See LICENSE in the project root for license information.
4 | *--------------------------------------------------------------------------------------------*/
5 |
6 | import LogicAppsManagementClient from "azure-arm-logic";
7 | import { IntegrationAccountPartner } from "azure-arm-logic/lib/models";
8 | import { ServiceClientCredentials } from "ms-rest";
9 | import { addExtensionUserAgent } from "vscode-azureextensionui";
10 |
11 | export enum PartnerType {
12 | B2B = "B2B"
13 | }
14 |
15 | export async function createNewPartner(partnerName: string, qualifier: string, value: string): Promise {
16 | const partner: IntegrationAccountPartner = {
17 | content: {
18 | b2b: {
19 | businessIdentities: [
20 | {
21 | qualifier,
22 | value
23 | }
24 | ]
25 | }
26 | },
27 | name: partnerName,
28 | partnerType: PartnerType.B2B
29 | };
30 |
31 | return partner;
32 | }
33 |
34 | export async function getAllPartners(credentials: ServiceClientCredentials, subscriptionId: string, resourceGroup: string, integrationAccount: string): Promise {
35 | const client = new LogicAppsManagementClient(credentials, subscriptionId);
36 | addExtensionUserAgent(client);
37 |
38 | const partners = await client.integrationAccountPartners.list(resourceGroup, integrationAccount);
39 | let nextPageLink = partners.nextLink;
40 |
41 | while (nextPageLink) {
42 | partners.push(...await client.integrationAccountPartners.listNext(nextPageLink));
43 | nextPageLink = partners.nextLink;
44 | }
45 |
46 | return partners;
47 | }
48 |
--------------------------------------------------------------------------------
/src/wizard/logic-app/LogicAppCreateStep.ts:
--------------------------------------------------------------------------------
1 | /*---------------------------------------------------------------------------------------------
2 | * Copyright (c) Microsoft Corporation. All rights reserved.
3 | * Licensed under the MIT License. See LICENSE in the project root for license information.
4 | *--------------------------------------------------------------------------------------------*/
5 |
6 | import LogicAppsManagementClient from "azure-arm-logic";
7 | import { Workflow } from "azure-arm-logic/lib/models";
8 | import { addExtensionUserAgent, AzureWizardExecuteStep } from "vscode-azureextensionui";
9 | import { LogicAppTreeItem } from "../../tree/logic-app/LogicAppTreeItem";
10 | import { IAzureLogicAppWizardContext } from "./createLogicApp";
11 |
12 | export class LogicAppCreateStep extends AzureWizardExecuteStep {
13 | public async execute(wizardContext: IAzureLogicAppWizardContext): Promise {
14 | const client = new LogicAppsManagementClient(wizardContext.credentials, wizardContext.subscriptionId);
15 | addExtensionUserAgent(client);
16 |
17 | const location = wizardContext.location!.name!;
18 | const resourceGroupName = wizardContext.resourceGroup!.name!;
19 | const workflowName = wizardContext.workflowName!;
20 | const emptyWorkflow: Workflow = {
21 | definition: {
22 | $schema: "https://schema.management.azure.com/providers/Microsoft.Logic/schemas/2016-06-01/workflowdefinition.json#",
23 | actions: {},
24 | contentVersion: "1.0.0.0",
25 | outputs: {},
26 | parameters: {},
27 | triggers: {}
28 | },
29 | location
30 | };
31 | const workflow = await client.workflows.createOrUpdate(resourceGroupName, workflowName, emptyWorkflow);
32 |
33 | wizardContext.logicApp = new LogicAppTreeItem(client, workflow);
34 |
35 | return wizardContext;
36 | }
37 | }
38 |
--------------------------------------------------------------------------------
/src/tree/logic-app/LogicAppsProvider.ts:
--------------------------------------------------------------------------------
1 | /*---------------------------------------------------------------------------------------------
2 | * Copyright (c) Microsoft Corporation. All rights reserved.
3 | * Licensed under the MIT License. See LICENSE in the project root for license information.
4 | *--------------------------------------------------------------------------------------------*/
5 |
6 | import LogicAppsManagementClient from "azure-arm-logic";
7 | import { Workflow } from "azure-arm-logic/lib/models";
8 | import { addExtensionUserAgent, IAzureNode, IAzureTreeItem, IChildProvider } from "vscode-azureextensionui";
9 | import { localize } from "../../localize";
10 | import { createLogicApp } from "../../wizard/logic-app/createLogicApp";
11 | import { LogicAppTreeItem } from "./LogicAppTreeItem";
12 |
13 | export class LogicAppsProvider implements IChildProvider {
14 | public readonly childTypeLabel = localize("azLogicApps.LogicApp", "Logic App");
15 |
16 | private nextLink: string | undefined;
17 |
18 | public async createChild(node: IAzureNode, showCreatingNode: (label: string) => void): Promise {
19 | return createLogicApp(node, showCreatingNode);
20 | }
21 |
22 | public hasMoreChildren(): boolean {
23 | return this.nextLink !== undefined;
24 | }
25 |
26 | public async loadMoreChildren(node: IAzureNode, clearCache: boolean): Promise {
27 | if (clearCache) {
28 | this.nextLink = undefined;
29 | }
30 |
31 | const client = new LogicAppsManagementClient(node.credentials, node.subscriptionId);
32 | addExtensionUserAgent(client);
33 |
34 | const logicApps = this.nextLink === undefined
35 | ? await client.workflows.listBySubscription()
36 | : await client.workflows.listBySubscriptionNext(this.nextLink);
37 |
38 | this.nextLink = logicApps.nextLink;
39 |
40 | return logicApps.map((logicApp: Workflow) => new LogicAppTreeItem(client, logicApp));
41 | }
42 | }
43 |
--------------------------------------------------------------------------------
/src/commands/integration-account/integrationAccountSchemaCommands.ts:
--------------------------------------------------------------------------------
1 | /*---------------------------------------------------------------------------------------------
2 | * Copyright (c) Microsoft Corporation. All rights reserved.
3 | * Licensed under the MIT License. See LICENSE in the project root for license information.
4 | *--------------------------------------------------------------------------------------------*/
5 |
6 | import { AzureTreeDataProvider, BaseEditor, IAzureNode } from "vscode-azureextensionui";
7 | import { localize } from "../../localize";
8 | import { IntegrationAccountSchemaTreeItem } from "../../tree/integration-account/IntegrationAccountSchemaTreeItem";
9 | import { openAndShowTextDocument } from "../../utils/commandUtils";
10 |
11 | export async function deleteIntegrationAccountSchema(tree: AzureTreeDataProvider, node?: IAzureNode): Promise {
12 | if (!node) {
13 | node = await tree.showNodePicker(IntegrationAccountSchemaTreeItem.contextValue);
14 | }
15 |
16 | await node.runWithTemporaryDescription(
17 | localize("azIntegrationAccounts.deleting", "Deleting..."),
18 | async () => {
19 | await node!.deleteNode();
20 | }
21 | );
22 | }
23 |
24 | export async function openIntegrationAccountSchemaInEditor(tree: AzureTreeDataProvider, editor: BaseEditor, node?: IAzureNode): Promise {
25 | if (!node) {
26 | node = await tree.showNodePicker(IntegrationAccountSchemaTreeItem.contextValue);
27 | }
28 |
29 | await editor.showEditor(node);
30 | }
31 |
32 | export async function viewIntegrationAccountSchemaProperties(tree: AzureTreeDataProvider, node?: IAzureNode): Promise {
33 | if (!node) {
34 | node = await tree.showNodePicker(IntegrationAccountSchemaTreeItem.contextValue);
35 | }
36 |
37 | const schema = node.treeItem as IntegrationAccountSchemaTreeItem;
38 | const schemaProperties = await schema.getProperties();
39 |
40 | await openAndShowTextDocument(schemaProperties, "json");
41 | }
42 |
--------------------------------------------------------------------------------
/src/commands/integration-account/integrationAccountPartnerCommands.ts:
--------------------------------------------------------------------------------
1 | /*---------------------------------------------------------------------------------------------
2 | * Copyright (c) Microsoft Corporation. All rights reserved.
3 | * Licensed under the MIT License. See LICENSE in the project root for license information.
4 | *--------------------------------------------------------------------------------------------*/
5 |
6 | import { AzureTreeDataProvider, BaseEditor, IAzureNode } from "vscode-azureextensionui";
7 | import { localize } from "../../localize";
8 | import { IntegrationAccountPartnerTreeItem } from "../../tree/integration-account/IntegrationAccountPartnerTreeItem";
9 | import { openAndShowTextDocument } from "../../utils/commandUtils";
10 |
11 | export async function deleteIntegrationAccountPartner(tree: AzureTreeDataProvider, node?: IAzureNode): Promise {
12 | if (!node) {
13 | node = await tree.showNodePicker(IntegrationAccountPartnerTreeItem.contextValue);
14 | }
15 |
16 | await node.runWithTemporaryDescription(
17 | localize("azIntegrationAccounts.deleting", "Deleting..."),
18 | async () => {
19 | await node!.deleteNode();
20 | }
21 | );
22 | }
23 |
24 | export async function openIntegrationAccountPartnerInEditor(tree: AzureTreeDataProvider, editor: BaseEditor, node?: IAzureNode): Promise {
25 | if (!node) {
26 | node = await tree.showNodePicker(IntegrationAccountPartnerTreeItem.contextValue);
27 | }
28 |
29 | await editor.showEditor(node);
30 | }
31 |
32 | export async function viewIntegrationAccountPartnerProperties(tree: AzureTreeDataProvider, node?: IAzureNode): Promise {
33 | if (!node) {
34 | node = await tree.showNodePicker(IntegrationAccountPartnerTreeItem.contextValue);
35 | }
36 |
37 | const partner = node.treeItem as IntegrationAccountPartnerTreeItem;
38 | const partnerProperties = await partner.getProperties();
39 |
40 | await openAndShowTextDocument(partnerProperties, "json");
41 | }
42 |
--------------------------------------------------------------------------------
/resources/azLogicApps.svg:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
18 |
--------------------------------------------------------------------------------
/src/editors/integration-account/IntegrationAccountSchemaEditor.ts:
--------------------------------------------------------------------------------
1 | /*---------------------------------------------------------------------------------------------
2 | * Copyright (c) Microsoft Corporation. All rights reserved.
3 | * Licensed under the MIT License. See LICENSE in the project root for license information.
4 | *--------------------------------------------------------------------------------------------*/
5 |
6 | import * as vscode from "vscode";
7 | import { BaseEditor, IAzureNode } from "vscode-azureextensionui";
8 | import { localize } from "../../localize";
9 | import { IntegrationAccountSchemaTreeItem } from "../../tree/integration-account/IntegrationAccountSchemaTreeItem";
10 |
11 | export class IntegrationAccountSchemaEditor extends BaseEditor> {
12 | constructor() {
13 | super("azIntegrationAccounts.showSavePrompt");
14 | }
15 |
16 | public async getData(node: IAzureNode): Promise {
17 | return node.treeItem.getContent();
18 | }
19 |
20 | public async getFilename(node: IAzureNode): Promise {
21 | return `${node.treeItem.label}.xml`;
22 | }
23 |
24 | public async getSaveConfirmationText(node: IAzureNode): Promise {
25 | const { label } = node.treeItem;
26 | return localize("azIntegrationAccounts.saveConfirmationText", "Saving '{0}' will update the Schema in your integration account.", label);
27 | }
28 |
29 | public async getSize(): Promise {
30 | return 0;
31 | }
32 |
33 | public async updateData(node: IAzureNode): Promise {
34 | if (!vscode.window.activeTextEditor) {
35 | throw new Error(localize("azIntegrationAccounts.errorUpdatingFile", "Cannot update Schema after it has been closed."));
36 | }
37 |
38 | return node.treeItem.update(vscode.window.activeTextEditor.document.getText());
39 | }
40 | }
41 |
--------------------------------------------------------------------------------
/src/commands/integration-account/IntegrationAccountAgreementCommands.ts:
--------------------------------------------------------------------------------
1 | /*---------------------------------------------------------------------------------------------
2 | * Copyright (c) Microsoft Corporation. All rights reserved.
3 | * Licensed under the MIT License. See LICENSE in the project root for license information.
4 | *--------------------------------------------------------------------------------------------*/
5 |
6 | import { AzureTreeDataProvider, BaseEditor, IAzureNode } from "vscode-azureextensionui";
7 | import { localize } from "../../localize";
8 | import { IntegrationAccountAgreementTreeItem } from "../../tree/integration-account/IntegrationAccountAgreementTreeItem";
9 | import { openAndShowTextDocument } from "../../utils/commandUtils";
10 |
11 | export async function deleteIntegrationAccountAgreement(tree: AzureTreeDataProvider, node?: IAzureNode): Promise {
12 | if (!node) {
13 | node = await tree.showNodePicker(IntegrationAccountAgreementTreeItem.contextValue);
14 | }
15 |
16 | await node.runWithTemporaryDescription(
17 | localize("azIntegrationAccounts.deleting", "Deleting..."),
18 | async () => {
19 | await node!.deleteNode();
20 | }
21 | );
22 | }
23 |
24 | export async function openIntegrationAccountAgreementInEditor(tree: AzureTreeDataProvider, editor: BaseEditor, node?: IAzureNode): Promise {
25 | if (!node) {
26 | node = await tree.showNodePicker(IntegrationAccountAgreementTreeItem.contextValue);
27 | }
28 |
29 | await editor.showEditor(node);
30 | }
31 |
32 | export async function viewIntegrationAccountAgreementProperties(tree: AzureTreeDataProvider, node?: IAzureNode): Promise {
33 | if (!node) {
34 | node = await tree.showNodePicker(IntegrationAccountAgreementTreeItem.contextValue);
35 | }
36 |
37 | const agreement = node.treeItem as IntegrationAccountAgreementTreeItem;
38 | const agreementProperties = await agreement.getProperties();
39 |
40 | await openAndShowTextDocument(agreementProperties, "json");
41 | }
42 |
--------------------------------------------------------------------------------
/src/editors/integration-account/integrationAccountAgreementEditor.ts:
--------------------------------------------------------------------------------
1 | /*---------------------------------------------------------------------------------------------
2 | * Copyright (c) Microsoft Corporation. All rights reserved.
3 | * Licensed under the MIT License. See LICENSE in the project root for license information.
4 | *--------------------------------------------------------------------------------------------*/
5 |
6 | import * as vscode from "vscode";
7 | import { BaseEditor, IAzureNode } from "vscode-azureextensionui";
8 | import { localize } from "../../localize";
9 | import { IntegrationAccountAgreementTreeItem } from "../../tree/integration-account/IntegrationAccountAgreementTreeItem";
10 |
11 | export class IntegrationAccountAgreementEditor extends BaseEditor> {
12 | constructor() {
13 | super("azIntegrationAccounts.showSavePrompt");
14 | }
15 |
16 | public async getData(node: IAzureNode): Promise {
17 | return node.treeItem.getContent();
18 | }
19 |
20 | public async getFilename(node: IAzureNode): Promise {
21 | return `${node.treeItem.label}.json`;
22 | }
23 |
24 | public async getSaveConfirmationText(node: IAzureNode): Promise {
25 | const { label } = node.treeItem;
26 | return localize("azIntegrationAccounts.saveConfirmationText", "Saving '{0}' will update the Agreement in your integration account.", label);
27 | }
28 |
29 | public async getSize(): Promise {
30 | return 0;
31 | }
32 |
33 | public async updateData(node: IAzureNode): Promise {
34 | if (!vscode.window.activeTextEditor) {
35 | throw new Error(localize("azIntegrationAccounts.errorUpdatingFile", "Cannot update Agreement after it has been closed."));
36 | }
37 |
38 | return node.treeItem.update(vscode.window.activeTextEditor.document.getText());
39 | }
40 | }
41 |
--------------------------------------------------------------------------------
/src/wizard/integration-account/partners/partnerValueStep.ts:
--------------------------------------------------------------------------------
1 | /*---------------------------------------------------------------------------------------------
2 | * Copyright (c) Microsoft Corporation. All rights reserved.
3 | * Licensed under the MIT License. See LICENSE in the project root for license information.
4 | *--------------------------------------------------------------------------------------------*/
5 |
6 | import * as vscode from "vscode";
7 | import { AzureWizardPromptStep, UserCancelledError } from "vscode-azureextensionui";
8 | import { localize } from "../../../localize";
9 | import { IPartnerWizardContext } from "./createPartnerWizard";
10 |
11 | export class PartnerValueStep extends AzureWizardPromptStep {
12 | public async prompt(wizardContext: IPartnerWizardContext): Promise {
13 | const options: vscode.InputBoxOptions = {
14 | prompt: localize("azIntegrationAccounts.promptForPartnerName", "Enter a value for the qualifier."),
15 | validateInput: async (value: string) => {
16 | value = value ? value.trim() : "";
17 |
18 | if (!value) {
19 | return localize("azIntegrationAccounts.valueRequired", "A value is required.");
20 | } else if (value.length > 128) {
21 | return localize("azIntegrationAccounts.valueTooLong", "The value has a maximum length of 128 characters.");
22 | } else if (!/^\"?[a-zA-Z0-9\-_.() ]+\"?$/.test(value)) {
23 | return localize("azIntegrationAccounts.valueContainsInvalidCharacters", "The value can only contain letters, numbers, and '-', '(', ')', '_', or '.'");
24 | } else {
25 | return undefined;
26 | }
27 | }
28 | };
29 |
30 | const partnerValue = await vscode.window.showInputBox(options);
31 | if (partnerValue) {
32 | wizardContext.partnerValue = partnerValue.trim();
33 | return wizardContext;
34 | }
35 |
36 | throw new UserCancelledError();
37 | }
38 | }
39 |
--------------------------------------------------------------------------------
/src/tree/logic-app/LogicAppTriggerTreeItem.ts:
--------------------------------------------------------------------------------
1 | /*---------------------------------------------------------------------------------------------
2 | * Copyright (c) Microsoft Corporation. All rights reserved.
3 | * Licensed under the MIT License. See LICENSE in the project root for license information.
4 | *--------------------------------------------------------------------------------------------*/
5 |
6 | import LogicAppsManagementClient from "azure-arm-logic";
7 | import { WorkflowTrigger } from "azure-arm-logic/lib/models";
8 | import { IAzureTreeItem } from "vscode-azureextensionui";
9 | import { getThemedIconPath, IThemedIconPath } from "../../utils/nodeUtils";
10 |
11 | export class LogicAppTriggerTreeItem implements IAzureTreeItem {
12 | public static readonly contextValue = "azLogicAppsWorkflowTrigger";
13 | public readonly contextValue = LogicAppTriggerTreeItem.contextValue;
14 |
15 | public constructor(private readonly client: LogicAppsManagementClient, private readonly workflowTrigger: WorkflowTrigger) {
16 | }
17 |
18 | public get commandId(): string {
19 | return "azureLogicApps.openTriggerInEditor";
20 | }
21 |
22 | public get iconPath(): IThemedIconPath {
23 | return getThemedIconPath("Run");
24 | }
25 |
26 | public get id(): string {
27 | return this.workflowTrigger.id!;
28 | }
29 |
30 | public get label(): string {
31 | return this.workflowTrigger.name!;
32 | }
33 |
34 | public get resourceGroupName(): string {
35 | return this.workflowTrigger.id!.split("/").slice(-7, -6)[0];
36 | }
37 |
38 | public get triggerName(): string {
39 | return this.workflowTrigger.name!;
40 | }
41 |
42 | public get workflowName(): string {
43 | return this.workflowTrigger.id!.split("/").slice(-3, -2)[0];
44 | }
45 |
46 | public async getData(): Promise {
47 | return JSON.stringify(this.workflowTrigger, null, 4);
48 | }
49 |
50 | public async run(): Promise {
51 | await this.client.workflowTriggers.run(this.resourceGroupName, this.workflowName, this.triggerName);
52 | }
53 | }
54 |
--------------------------------------------------------------------------------
/src/commands/integration-account/integrationAccountCommands.ts:
--------------------------------------------------------------------------------
1 | /*---------------------------------------------------------------------------------------------
2 | * Copyright (c) Microsoft Corporation. All rights reserved.
3 | * Licensed under the MIT License. See LICENSE in the project root for license information.
4 | *--------------------------------------------------------------------------------------------*/
5 |
6 | import * as vscode from "vscode";
7 | import { AzureTreeDataProvider, IAzureNode } from "vscode-azureextensionui";
8 | import { localize } from "../../localize";
9 | import { IntegrationAccountTreeItem } from "../../tree/integration-account/IntegrationAccountTreeItem";
10 | import { openAndShowTextDocument } from "../../utils/commandUtils";
11 | import { DialogResponses } from "../../utils/dialogResponses";
12 |
13 | export async function deleteIntegrationAccount(tree: AzureTreeDataProvider, node?: IAzureNode): Promise {
14 | if (!node) {
15 | node = await tree.showNodePicker(IntegrationAccountTreeItem.contextValue);
16 | }
17 |
18 | const result = await vscode.window.showWarningMessage(
19 | localize("azIntegrationAccounts.deleteIntegrationAccountPrompt", "Are you sure that you want to delete the whole integration account? This can not be undone."),
20 | DialogResponses.yes,
21 | DialogResponses.no);
22 |
23 | if (result === DialogResponses.yes) {
24 | await node.runWithTemporaryDescription(
25 | localize("azIntegrationAccounts.deleting", "Deleting..."),
26 | async () => {
27 | await node!.deleteNode();
28 | }
29 | );
30 | }
31 | }
32 |
33 | export async function viewIntegrationAccountProperties(tree: AzureTreeDataProvider, node?: IAzureNode): Promise {
34 | if (!node) {
35 | node = await tree.showNodePicker(IntegrationAccountTreeItem.contextValue);
36 | }
37 |
38 | const integrationAccount = node.treeItem as IntegrationAccountTreeItem;
39 | const integrationAccountProperties = await integrationAccount.getProperties();
40 |
41 | await openAndShowTextDocument(integrationAccountProperties, "json");
42 | }
43 |
--------------------------------------------------------------------------------
/src/wizard/integration-account/agreements/agreementCreateStep.ts:
--------------------------------------------------------------------------------
1 | /*---------------------------------------------------------------------------------------------
2 | * Copyright (c) Microsoft Corporation. All rights reserved.
3 | * Licensed under the MIT License. See LICENSE in the project root for license information.
4 | *--------------------------------------------------------------------------------------------*/
5 |
6 | import LogicAppsManagementClient from "azure-arm-logic";
7 | import { IntegrationAccountAgreement } from "azure-arm-logic/lib/models";
8 | import { addExtensionUserAgent, AzureWizardExecuteStep } from "vscode-azureextensionui";
9 | import { IntegrationAccountAgreementTreeItem } from "../../../tree/integration-account/IntegrationAccountAgreementTreeItem";
10 | import { AgreementType, createNewAgreement } from "../../../utils/integration-account/agreementUtils";
11 | import { IAgreementWizardContext } from "./createAgreementWizard";
12 |
13 | export class AgreementCreateStep extends AzureWizardExecuteStep {
14 | public async execute(wizardContext: IAgreementWizardContext): Promise {
15 | const client = new LogicAppsManagementClient(wizardContext.credentials, wizardContext.subscriptionId);
16 | addExtensionUserAgent(client);
17 |
18 | const newAgreement: IntegrationAccountAgreement = await client.integrationAccountAgreements.createOrUpdate(wizardContext.resourceGroup!.name!,
19 | wizardContext.integrationAccountName,
20 | wizardContext.agreementName!,
21 | await createNewAgreement(wizardContext.agreementName!,
22 | AgreementType[wizardContext.agreementType! as AgreementType],
23 | wizardContext.hostPartner!,
24 | wizardContext.hostIdentity!,
25 | wizardContext.guestPartner!,
26 | wizardContext.guestIdentity!));
27 |
28 | wizardContext.agreement = new IntegrationAccountAgreementTreeItem(client, newAgreement);
29 |
30 | return wizardContext;
31 | }
32 | }
33 |
--------------------------------------------------------------------------------
/src/utils/integration-account/mapUtils.ts:
--------------------------------------------------------------------------------
1 | /*---------------------------------------------------------------------------------------------
2 | * Copyright (c) Microsoft Corporation. All rights reserved.
3 | * Licensed under the MIT License. See LICENSE in the project root for license information.
4 | *--------------------------------------------------------------------------------------------*/
5 |
6 | import { IntegrationAccountMap } from "azure-arm-logic/lib/models";
7 | import { Constants } from "../../constants";
8 |
9 | export enum MapType {
10 | Liquid = "Liquid",
11 | Xslt = "Xslt",
12 | Xslt20 = "Xslt20",
13 | Xslt30 = "Xslt30"
14 | }
15 |
16 | export function getContentType(mapType: MapType): string {
17 | return mapType === MapType.Liquid ? Constants.LiquidContentType : Constants.XmlContentType;
18 | }
19 |
20 | export async function createNewMap(mapName: string, mapType: MapType): Promise {
21 | let content: string;
22 | switch (mapType) {
23 | case MapType.Liquid:
24 | content = "{% if user %}\nHello {{ user.name }}\n{% endif %}";
25 | break;
26 | case MapType.Xslt30:
27 | content = "\n\n\t\n\n\t\n";
28 | break;
29 | case MapType.Xslt20:
30 | content = "\n\n\t\n\n\t\n";
31 | break;
32 | case MapType.Xslt:
33 | default:
34 | content = "\n\n\t\n\n\t\n";
35 | }
36 |
37 | const map: IntegrationAccountMap = {
38 | content,
39 | contentType: getContentType(mapType),
40 | mapType,
41 | name: mapName
42 | };
43 |
44 | return map;
45 | }
46 |
--------------------------------------------------------------------------------
/src/editors/integration-account/IntegrationAccountMapEditor.ts:
--------------------------------------------------------------------------------
1 | /*---------------------------------------------------------------------------------------------
2 | * Copyright (c) Microsoft Corporation. All rights reserved.
3 | * Licensed under the MIT License. See LICENSE in the project root for license information.
4 | *--------------------------------------------------------------------------------------------*/
5 |
6 | import * as vscode from "vscode";
7 | import { BaseEditor, IAzureNode } from "vscode-azureextensionui";
8 | import { localize } from "../../localize";
9 | import { IntegrationAccountMapTreeItem } from "../../tree/integration-account/IntegrationAccountMapTreeItem";
10 | import { MapType } from "../../utils/integration-account/mapUtils";
11 |
12 | export class IntegrationAccountMapEditor extends BaseEditor> {
13 | constructor() {
14 | super("azIntegrationAccounts.showSavePrompt");
15 | }
16 |
17 | public async getData(node: IAzureNode): Promise {
18 | return node.treeItem.getContent();
19 | }
20 |
21 | public async getFilename(node: IAzureNode): Promise {
22 | const extension = node.treeItem.mapType === MapType.Liquid ? ".liquid" : ".xslt";
23 |
24 | return `${node.treeItem.label}${extension}`;
25 | }
26 |
27 | public async getSaveConfirmationText(node: IAzureNode): Promise {
28 | const { label } = node.treeItem;
29 | return localize("azIntegrationAccounts.saveConfirmationText", "Saving '{0}' will update the Map in your integration account.", label);
30 | }
31 |
32 | public async getSize(): Promise {
33 | return 0;
34 | }
35 |
36 | public async updateData(node: IAzureNode): Promise {
37 | if (!vscode.window.activeTextEditor) {
38 | throw new Error(localize("azIntegrationAccounts.errorUpdatingFile", "Cannot update Map after it has been closed."));
39 | }
40 |
41 | return node.treeItem.update(vscode.window.activeTextEditor.document.getText());
42 | }
43 | }
44 |
--------------------------------------------------------------------------------
/src/tree/logic-app/LogicAppRunActionTreeItem.ts:
--------------------------------------------------------------------------------
1 | /*---------------------------------------------------------------------------------------------
2 | * Copyright (c) Microsoft Corporation. All rights reserved.
3 | * Licensed under the MIT License. See LICENSE in the project root for license information.
4 | *--------------------------------------------------------------------------------------------*/
5 |
6 | import { WorkflowRunAction } from "azure-arm-logic/lib/models";
7 | import { IAzureTreeItem } from "vscode-azureextensionui";
8 | import * as nodeUtils from "../../utils/nodeUtils";
9 |
10 | enum LogicAppRunStatus {
11 | Aborted = "Aborted",
12 | Cancelled = "Cancelled",
13 | Failed = "Failed",
14 | Running = "Running",
15 | Skipped = "Skipped",
16 | Succeeded = "Succeeded"
17 | }
18 |
19 | export class LogicAppRunActionTreeItem implements IAzureTreeItem {
20 | public static readonly contextValue = "azLogicAppsWorkflowRunAction";
21 | public readonly contextValue = LogicAppRunActionTreeItem.contextValue;
22 |
23 | public constructor(private readonly workflowRunAction: WorkflowRunAction) {
24 | }
25 |
26 | public get commandId(): string {
27 | return "azureLogicApps.openRunActionInEditor";
28 | }
29 |
30 | public get iconPath(): string {
31 | const status = this.workflowRunAction.status!;
32 |
33 | switch (status) {
34 | case LogicAppRunStatus.Aborted:
35 | case LogicAppRunStatus.Cancelled:
36 | case LogicAppRunStatus.Failed:
37 | case LogicAppRunStatus.Running:
38 | case LogicAppRunStatus.Skipped:
39 | case LogicAppRunStatus.Succeeded:
40 | return nodeUtils.getStatusIconPath(status);
41 |
42 | default:
43 | return nodeUtils.getStatusIconPath("Unknown");
44 | }
45 | }
46 |
47 | public get id(): string {
48 | return this.workflowRunAction.id!;
49 | }
50 |
51 | public get label(): string {
52 | return this.workflowRunAction.name!;
53 | }
54 |
55 | public async getData(): Promise {
56 | return JSON.stringify(this.workflowRunAction, null, 4);
57 | }
58 | }
59 |
--------------------------------------------------------------------------------
/src/tree/integration-account/IntegrationAccountsProvider.ts:
--------------------------------------------------------------------------------
1 | /*---------------------------------------------------------------------------------------------
2 | * Copyright (c) Microsoft Corporation. All rights reserved.
3 | * Licensed under the MIT License. See LICENSE in the project root for license information.
4 | *--------------------------------------------------------------------------------------------*/
5 |
6 | import LogicAppsManagementClient from "azure-arm-logic";
7 | import { IntegrationAccount } from "azure-arm-logic/lib/models";
8 | import { addExtensionUserAgent, IAzureNode, IAzureTreeItem, IChildProvider } from "vscode-azureextensionui";
9 | import { localize } from "../../localize";
10 | import { runNewIntegrationAccountWizard } from "../../wizard/integration-account/createIntegrationAccountWizard";
11 | import { IntegrationAccountTreeItem } from "./IntegrationAccountTreeItem";
12 |
13 | export class IntegrationAccountProvider implements IChildProvider {
14 | public readonly childTypeLabel = localize("azIntegrationAccounts.IntegrationAccount", "Integration Account");
15 |
16 | private nextLink: string | undefined;
17 |
18 | public hasMoreChildren(): boolean {
19 | return this.nextLink !== undefined;
20 | }
21 |
22 | public async loadMoreChildren(node: IAzureNode, clearCache: boolean): Promise {
23 | if (clearCache) {
24 | this.nextLink = undefined;
25 | }
26 |
27 | const client = new LogicAppsManagementClient(node.credentials, node.subscriptionId);
28 | addExtensionUserAgent(client);
29 |
30 | const integrationAccounts = this.nextLink === undefined
31 | ? await client.integrationAccounts.listBySubscription()
32 | : await client.integrationAccounts.listBySubscriptionNext(this.nextLink);
33 |
34 | this.nextLink = integrationAccounts.nextLink;
35 |
36 | return integrationAccounts.map((integrationAccount: IntegrationAccount) => new IntegrationAccountTreeItem(client, integrationAccount));
37 | }
38 |
39 | public async createChild(node: IAzureNode, showCreatingNode: (label: string) => void): Promise {
40 | return runNewIntegrationAccountWizard(node, showCreatingNode);
41 | }
42 | }
43 |
--------------------------------------------------------------------------------
/src/editors/integration-account/integrationAccountPartnerEditor.ts:
--------------------------------------------------------------------------------
1 | /*---------------------------------------------------------------------------------------------
2 | * Copyright (c) Microsoft Corporation. All rights reserved.
3 | * Licensed under the MIT License. See LICENSE in the project root for license information.
4 | *--------------------------------------------------------------------------------------------*/
5 |
6 | import { PartnerContent } from "azure-arm-logic/lib/models";
7 | import * as vscode from "vscode";
8 | import { BaseEditor, IAzureNode } from "vscode-azureextensionui";
9 | import { localize } from "../../localize";
10 | import { IntegrationAccountPartnerTreeItem } from "../../tree/integration-account/IntegrationAccountPartnerTreeItem";
11 |
12 | export class IntegrationAccountPartnerEditor extends BaseEditor> {
13 | constructor() {
14 | super("azIntegrationAccounts.showSavePrompt");
15 | }
16 |
17 | public async getData(node: IAzureNode): Promise {
18 | return node.treeItem.getContent();
19 | }
20 |
21 | public async getFilename(node: IAzureNode): Promise {
22 | return `${node.treeItem.label}.json`;
23 | }
24 |
25 | public async getSaveConfirmationText(node: IAzureNode): Promise {
26 | const { label } = node.treeItem;
27 | return localize("azIntegrationAccounts.saveConfirmationText", "Saving '{0}' will update the Partner in your integration account.", label);
28 | }
29 |
30 | public async getSize(): Promise {
31 | return 0;
32 | }
33 |
34 | public async updateData(node: IAzureNode): Promise {
35 | if (!vscode.window.activeTextEditor) {
36 | throw new Error(localize("azIntegrationAccounts.errorUpdatingFile", "Cannot update Partner after it has been closed."));
37 | }
38 |
39 | const updatedText = vscode.window.activeTextEditor.document.getText();
40 | const updatedContent: PartnerContent = JSON.parse(updatedText);
41 |
42 | return node.treeItem.update(updatedContent);
43 | }
44 | }
45 |
--------------------------------------------------------------------------------
/src/utils/workspaceUtils.ts:
--------------------------------------------------------------------------------
1 | /*---------------------------------------------------------------------------------------------
2 | * Copyright (c) Microsoft Corporation. All rights reserved.
3 | * Licensed under the MIT License. See LICENSE in the project root for license information.
4 | *--------------------------------------------------------------------------------------------*/
5 |
6 | import * as path from "path";
7 | import * as vscode from "vscode";
8 | import { IAzureUserInput } from "vscode-azureextensionui";
9 | import { localize } from "../localize";
10 |
11 | interface IWorkspaceFolder extends vscode.QuickPickItem {
12 | data?: string;
13 | }
14 |
15 | const openDialogOptions: vscode.OpenDialogOptions = {
16 | canSelectFiles: false,
17 | canSelectFolders: true,
18 | canSelectMany: false,
19 | openLabel: localize("select", "Select"),
20 | };
21 |
22 | const quickPickOptions: vscode.QuickPickOptions = {
23 | canPickMany: false
24 | };
25 |
26 | export async function openFolder(uri: vscode.Uri): Promise {
27 | const { workspaceFolders } = vscode.workspace;
28 | if (!workspaceFolders || workspaceFolders.length === 0) {
29 | await vscode.commands.executeCommand("vscode.openFolder", uri);
30 | } else {
31 | vscode.workspace.updateWorkspaceFolders(workspaceFolders.length, 0, { uri });
32 | }
33 | }
34 |
35 | export async function selectWorkspaceFolder(ui: IAzureUserInput): Promise {
36 | const { workspaceFolders } = vscode.workspace;
37 |
38 | const folderItems = !workspaceFolders
39 | ? []
40 | : workspaceFolders.map(({ uri: { fsPath } }) => ({
41 | data: fsPath,
42 | description: fsPath,
43 | label: path.basename(fsPath)
44 | }));
45 | const browseItem = {
46 | label: localize("azLogicApps.browse", "$(file-directory) Browse...")
47 | };
48 | const items: IWorkspaceFolder[] = [...folderItems, browseItem];
49 | const selectedItem = await ui.showQuickPick(items, quickPickOptions);
50 | if (selectedItem && selectedItem.data) {
51 | return selectedItem.data;
52 | }
53 |
54 | const uris = await ui.showOpenDialog({
55 | ...openDialogOptions,
56 | ...workspaceFolders && workspaceFolders.length > 0 ? { defaultUri: workspaceFolders[0].uri } : undefined
57 | });
58 | return uris.length === 0
59 | ? undefined
60 | : uris[0].fsPath;
61 | }
62 |
--------------------------------------------------------------------------------
/src/wizard/logic-app/ResourceGroupNameStep.ts:
--------------------------------------------------------------------------------
1 | /*---------------------------------------------------------------------------------------------
2 | * Copyright (c) Microsoft Corporation. All rights reserved.
3 | * Licensed under the MIT License. See LICENSE in the project root for license information.
4 | *--------------------------------------------------------------------------------------------*/
5 |
6 | import * as vscode from "vscode";
7 | import { AzureWizardPromptStep, UserCancelledError } from "vscode-azureextensionui";
8 | import { localize } from "../../localize";
9 | import { IBuildDefinitionWizardContext } from "./createBuildDefinition";
10 |
11 | export class ResourceGroupNameStep extends AzureWizardPromptStep {
12 | public async prompt(wizardContext: IBuildDefinitionWizardContext): Promise {
13 | const resourceGroupName = await askForResourceGroupName();
14 | if (!resourceGroupName) {
15 | throw new UserCancelledError();
16 | }
17 |
18 | return {
19 | ...wizardContext,
20 | resourceGroupName
21 | };
22 | }
23 | }
24 |
25 | async function askForResourceGroupName(): Promise {
26 | function validateInput(value: string): string | null | undefined | Thenable {
27 | if (value === "") {
28 | return localize("azLogicApps.resourceGroupNameRequired", "A resource group name is required.");
29 | } else if (value.length > 90) {
30 | return localize("azLogicApps.resourceGroupNameTooLong", "A resource group name can only have 90 characters or less.");
31 | } else if (/[^-\w.()]/g.test(value)) {
32 | return localize("azLogicApps.resourceGroupNameValidCharacters", "A resource group name can only have alphanumeric characters, underscores, dashes, periods, and parentheses.");
33 | } else if (/\.$/.test(value)) {
34 | return localize("azLogicApps.resourceGroupNameCannotEndInPeriod", "A resource group name cannot end with a period.");
35 | }
36 |
37 | return undefined;
38 | }
39 |
40 | const resourceGroupNameInputBoxOptions: vscode.InputBoxOptions = {
41 | prompt: localize("azLogicApps.resourceGroupNamePrompt", "Enter the name of the resource group."),
42 | validateInput
43 | };
44 |
45 | return vscode.window.showInputBox(resourceGroupNameInputBoxOptions);
46 | }
47 |
--------------------------------------------------------------------------------
/src/tree/logic-app/LogicAppRunsTreeItem.ts:
--------------------------------------------------------------------------------
1 | /*---------------------------------------------------------------------------------------------
2 | * Copyright (c) Microsoft Corporation. All rights reserved.
3 | * Licensed under the MIT License. See LICENSE in the project root for license information.
4 | *--------------------------------------------------------------------------------------------*/
5 |
6 | import LogicAppsManagementClient from "azure-arm-logic";
7 | import { Workflow, WorkflowRun } from "azure-arm-logic/lib/models";
8 | import { IAzureNode, IAzureParentTreeItem, IAzureTreeItem } from "vscode-azureextensionui";
9 | import { localize } from "../../localize";
10 | import * as nodeUtils from "../../utils/nodeUtils";
11 | import { LogicAppRunTreeItem } from "./LogicAppRunTreeItem";
12 |
13 | export class LogicAppRunsTreeItem implements IAzureParentTreeItem {
14 | public static contextValue = "azLogicAppsWorkflowRuns";
15 | public readonly childTypeLabel = localize("azLogicApps.Run", "Run");
16 | public readonly contextValue = LogicAppRunsTreeItem.contextValue;
17 | public readonly label = localize("azLogicApps.Runs", "Runs");
18 |
19 | private nextLink: string | undefined;
20 |
21 | public constructor(private readonly client: LogicAppsManagementClient, private readonly workflow: Workflow) {
22 | }
23 |
24 | public hasMoreChildren(): boolean {
25 | return this.nextLink !== undefined;
26 | }
27 |
28 | public get iconPath(): nodeUtils.IThemedIconPath {
29 | return nodeUtils.getThemedIconPath("BulletList");
30 | }
31 |
32 | public get id(): string {
33 | return `${this.workflow.id!}/runs`;
34 | }
35 |
36 | public get resourceGroupName(): string {
37 | return this.workflow.id!.split("/").slice(-5, -4)[0];
38 | }
39 |
40 | public get workflowName(): string {
41 | return this.workflow.name!;
42 | }
43 |
44 | public async loadMoreChildren(_: IAzureNode, clearCache: boolean): Promise {
45 | if (clearCache) {
46 | this.nextLink = undefined;
47 | }
48 |
49 | const workflowRuns = this.nextLink === undefined
50 | ? await this.client.workflowRuns.list(this.resourceGroupName, this.workflowName)
51 | : await this.client.workflowRuns.listNext(this.nextLink);
52 |
53 | this.nextLink = workflowRuns.nextLink;
54 |
55 | return workflowRuns.map((workflowRun: WorkflowRun) => new LogicAppRunTreeItem(this.client, this.workflow, workflowRun));
56 | }
57 | }
58 |
--------------------------------------------------------------------------------
/src/wizard/logic-app/GenerateBuildDefinitionStep.ts:
--------------------------------------------------------------------------------
1 | /*---------------------------------------------------------------------------------------------
2 | * Copyright (c) Microsoft Corporation. All rights reserved.
3 | * Licensed under the MIT License. See LICENSE in the project root for license information.
4 | *--------------------------------------------------------------------------------------------*/
5 |
6 | import { Workflow } from "azure-arm-logic/lib/models";
7 | import * as fse from "fs-extra";
8 | import { glob } from "glob";
9 | import * as path from "path";
10 | import { AzureWizardExecuteStep } from "vscode-azureextensionui";
11 | import { generateTemplateParameter, generateTemplateParameterDefinition, generateTemplateResource } from "../../utils/logic-app/templateUtils";
12 | import { IBuildDefinitionWizardContext } from "./createBuildDefinition";
13 |
14 | export class GenerateBuildDefinitionStep extends AzureWizardExecuteStep {
15 | public async execute(wizardContext: IBuildDefinitionWizardContext): Promise {
16 | const { location, templateParameterDefinitions, templateParameters, templateResources, workspaceFolderPath } = wizardContext;
17 |
18 | const definitions = await glob(path.join(workspaceFolderPath!, "**/*.definition.json"));
19 |
20 | const names = definitions.map((definition) => path.basename(definition).replace(/\.definition\.json$/i, ""));
21 |
22 | for (const name of names) {
23 | const file = path.join(workspaceFolderPath!, `${name}.definition.json`);
24 | const json = await fse.readJSON(file);
25 | const {
26 | properties: {
27 | definition,
28 | parameters
29 | }
30 | } = json.resources[0];
31 |
32 | const workflow: Workflow = {
33 | definition,
34 | location,
35 | name,
36 | parameters
37 | };
38 |
39 | const templateResource = generateTemplateResource(workflow);
40 | templateResources.push(templateResource);
41 |
42 | const templateParameterDefinition = generateTemplateParameterDefinition(workflow);
43 | Object.assign(templateParameterDefinitions, templateParameterDefinition);
44 |
45 | const templateParameter = generateTemplateParameter(workflow);
46 | Object.assign(templateParameters, templateParameter);
47 | }
48 |
49 | return wizardContext;
50 | }
51 | }
52 |
--------------------------------------------------------------------------------
/src/tree/logic-app/LogicAppTriggersTreeItem.ts:
--------------------------------------------------------------------------------
1 | /*---------------------------------------------------------------------------------------------
2 | * Copyright (c) Microsoft Corporation. All rights reserved.
3 | * Licensed under the MIT License. See LICENSE in the project root for license information.
4 | *--------------------------------------------------------------------------------------------*/
5 |
6 | import LogicAppsManagementClient from "azure-arm-logic";
7 | import { Workflow, WorkflowTrigger } from "azure-arm-logic/lib/models";
8 | import { IAzureNode, IAzureParentTreeItem, IAzureTreeItem } from "vscode-azureextensionui";
9 | import { localize } from "../../localize";
10 | import { getThemedIconPath, IThemedIconPath } from "../../utils/nodeUtils";
11 | import { LogicAppTriggerTreeItem } from "./LogicAppTriggerTreeItem";
12 |
13 | export class LogicAppTriggersTreeItem implements IAzureParentTreeItem {
14 | public static contextValue = "azLogicAppsWorkflowTriggers";
15 | public readonly childTypeLabel = localize("azLogicApps.Trigger", "Trigger");
16 | public readonly contextValue = LogicAppTriggersTreeItem.contextValue;
17 | public readonly label = localize("azLogicApps.Triggers", "Triggers");
18 |
19 | private nextLink: string | undefined;
20 |
21 | public constructor(private readonly client: LogicAppsManagementClient, private readonly workflow: Workflow) {
22 | }
23 |
24 | public hasMoreChildren(): boolean {
25 | return this.nextLink !== undefined;
26 | }
27 |
28 | public get iconPath(): IThemedIconPath {
29 | return getThemedIconPath("BulletList");
30 | }
31 |
32 | public get id(): string {
33 | return `${this.workflow.id!}/triggers`;
34 | }
35 |
36 | public get resourceGroupName(): string {
37 | return this.workflow.id!.split("/").slice(-5, -4)[0];
38 | }
39 |
40 | public get workflowName(): string {
41 | return this.workflow.name!;
42 | }
43 |
44 | public async loadMoreChildren(_: IAzureNode, clearCache: boolean): Promise {
45 | if (clearCache) {
46 | this.nextLink = undefined;
47 | }
48 |
49 | const workflowTriggers = this.nextLink === undefined
50 | ? await this.client.workflowTriggers.list(this.resourceGroupName, this.workflowName)
51 | : await this.client.workflowTriggers.listNext(this.nextLink);
52 |
53 | this.nextLink = workflowTriggers.nextLink;
54 |
55 | return workflowTriggers.map((workflowTrigger: WorkflowTrigger) => new LogicAppTriggerTreeItem(this.client, workflowTrigger));
56 | }
57 | }
58 |
--------------------------------------------------------------------------------
/src/commands/logic-app/openVersionInDesigner.ts:
--------------------------------------------------------------------------------
1 | /*---------------------------------------------------------------------------------------------
2 | * Copyright (c) Microsoft Corporation. All rights reserved.
3 | * Licensed under the MIT License. See LICENSE in the project root for license information.
4 | *--------------------------------------------------------------------------------------------*/
5 |
6 | import * as vscode from "vscode";
7 | import { AzureTreeDataProvider, IAzureNode } from "vscode-azureextensionui";
8 | import { localize } from "../../localize";
9 | import { LogicAppCurrentVersionTreeItem } from "../../tree/logic-app/LogicAppCurrentVersionTreeItem";
10 | import { LogicAppVersionTreeItem } from "../../tree/logic-app/LogicAppVersionTreeItem";
11 | import { getAuthorization, getCredentialsMetadata } from "../../utils/authorizationUtils";
12 | import { getWebviewContentForDesigner } from "../../utils/logic-app/designerUtils";
13 |
14 | export async function openVersionInDesigner(tree: AzureTreeDataProvider, node?: IAzureNode): Promise {
15 | if (!node) {
16 | node = await tree.showNodePicker([LogicAppCurrentVersionTreeItem.contextValue, LogicAppVersionTreeItem.contextValue]);
17 | }
18 |
19 | const readOnlySuffix = localize("azLogicApps.readOnlySuffix", "(read-only)");
20 | const authorization = await getAuthorization(node.credentials);
21 | const canvasMode = vscode.workspace.getConfiguration("azureLogicApps").get("canvasMode")!;
22 | const { subscriptionId, treeItem } = node as IAzureNode;
23 | const definition = await treeItem.getData();
24 | const parameters = treeItem.getParameters();
25 | const references = await treeItem.getReferences();
26 | const { id: workflowId, integrationAccountId, label: workflowVersionName, location, resourceGroupName, sku } = treeItem;
27 | const { domain: tenantId, userName: userId } = getCredentialsMetadata(node.credentials);
28 | const title = `${workflowVersionName} ${readOnlySuffix}`;
29 |
30 | const options: vscode.WebviewOptions & vscode.WebviewPanelOptions = {
31 | enableScripts: true
32 | };
33 | const panel = vscode.window.createWebviewPanel("readonlyDesigner", title, vscode.ViewColumn.Beside, options);
34 | panel.webview.html = getWebviewContentForDesigner({
35 | authorization,
36 | callbacks: {},
37 | canvasMode,
38 | definition,
39 | integrationAccountId,
40 | location,
41 | parameters,
42 | readOnly: true,
43 | references,
44 | resourceGroupName,
45 | sku,
46 | subscriptionId,
47 | tenantId,
48 | title,
49 | userId,
50 | workflowId
51 | });
52 | }
53 |
--------------------------------------------------------------------------------
/src/tree/logic-app/LogicAppRunActionsTreeItem.ts:
--------------------------------------------------------------------------------
1 | /*---------------------------------------------------------------------------------------------
2 | * Copyright (c) Microsoft Corporation. All rights reserved.
3 | * Licensed under the MIT License. See LICENSE in the project root for license information.
4 | *--------------------------------------------------------------------------------------------*/
5 |
6 | import LogicAppsManagementClient from "azure-arm-logic";
7 | import { Workflow, WorkflowRun, WorkflowRunAction } from "azure-arm-logic/lib/models";
8 | import { IAzureNode, IAzureParentTreeItem, IAzureTreeItem } from "vscode-azureextensionui";
9 | import { localize } from "../../localize";
10 | import * as nodeUtils from "../../utils/nodeUtils";
11 | import { LogicAppRunActionTreeItem } from "./LogicAppRunActionTreeItem";
12 |
13 | export class LogicAppRunActionsTreeItem implements IAzureParentTreeItem {
14 | public static contextValue = "azLogicAppsWorkflowRunActions";
15 | public readonly childTypeLabel = localize("azLogicApps.RunAction", "Action");
16 | public readonly contextValue = LogicAppRunActionsTreeItem.contextValue;
17 | public readonly label = localize("azLogicApps.RunActions", "Actions");
18 |
19 | private nextLink: string | undefined;
20 |
21 | public constructor(private readonly client: LogicAppsManagementClient, private readonly workflow: Workflow, private readonly workflowRun: WorkflowRun) {
22 | }
23 |
24 | public hasMoreChildren(): boolean {
25 | return this.nextLink !== undefined;
26 | }
27 |
28 | public get iconPath(): nodeUtils.IThemedIconPath {
29 | return nodeUtils.getThemedIconPath("BulletList");
30 | }
31 |
32 | public get id(): string {
33 | return `${this.workflowRun.id!}/actions`;
34 | }
35 |
36 | public get resourceGroupName(): string {
37 | return this.workflow.id!.split("/").slice(-5, -4)[0];
38 | }
39 |
40 | public get runName(): string {
41 | return this.workflowRun.name!;
42 | }
43 |
44 | public get workflowName(): string {
45 | return this.workflow.name!;
46 | }
47 |
48 | public async loadMoreChildren(_: IAzureNode, clearCache: boolean): Promise {
49 | if (clearCache) {
50 | this.nextLink = undefined;
51 | }
52 |
53 | const workflowRunActions = this.nextLink === undefined
54 | ? await this.client.workflowRunActions.list(this.resourceGroupName, this.workflowName, this.runName)
55 | : await this.client.workflowRunActions.listNext(this.nextLink);
56 |
57 | this.nextLink = workflowRunActions.nextLink;
58 |
59 | return workflowRunActions.map((workflowRunAction: WorkflowRunAction) => new LogicAppRunActionTreeItem(workflowRunAction));
60 | }
61 | }
62 |
--------------------------------------------------------------------------------
/src/utils/readOnlyUtils.ts:
--------------------------------------------------------------------------------
1 | /*---------------------------------------------------------------------------------------------
2 | * Copyright (c) Microsoft Corporation. All rights reserved.
3 | * Licensed under the MIT License. See LICENSE.md in the project root for license information.
4 | *--------------------------------------------------------------------------------------------*/
5 |
6 | /*
7 | This functionality is more or less "cherry-picked" from package "vscode-azureextensionui".
8 | Currently we can not use it from there due to the fact that we depend on an old version.
9 | Once we move to a more recent version we should eventually remove this file and rewire the
10 | call sites to the "genuine" implementation.
11 | */
12 |
13 | import { createHash } from "crypto";
14 | import { isNullOrUndefined } from "util";
15 | import { Event, EventEmitter, TextDocumentContentProvider, Uri, window, workspace } from "vscode";
16 | import { ext } from "../extensionVariables";
17 |
18 | let contentProvider: ReadOnlyContentProvider | undefined;
19 | const providerScheme = "azurelogicappsReadonly";
20 |
21 | export async function openReadOnlyJson(name: string, content: string): Promise {
22 | return openReadOnlyContent(name, content, ".json");
23 | }
24 |
25 | export async function openReadOnlyContent(name: string, content: string, fileExt: string): Promise {
26 | if (!contentProvider) {
27 | contentProvider = new ReadOnlyContentProvider();
28 | ext.context.subscriptions.push(
29 | workspace.registerTextDocumentContentProvider(providerScheme, contentProvider));
30 | }
31 | await contentProvider.openReadOnlyContent(name, content, fileExt);
32 | }
33 |
34 | class ReadOnlyContentProvider implements TextDocumentContentProvider {
35 | private _onDidChangeEmitter = new EventEmitter();
36 | private _contentMap = new Map();
37 |
38 | public get onDidChange(): Event {
39 | return this._onDidChangeEmitter.event;
40 | }
41 |
42 | public async openReadOnlyContent(name: string, content: string, fileExt: string): Promise {
43 | const nameHash = createHash("sha256").update(name).digest("hex");
44 | const uri = Uri.parse(`${providerScheme}:///${nameHash}/${name}${fileExt}`);
45 | this._contentMap.set(uri.toString(), content);
46 | await window.showTextDocument(uri);
47 | this._onDidChangeEmitter.fire(uri);
48 | }
49 |
50 | public async provideTextDocumentContent(uri: Uri): Promise {
51 | const content = this._contentMap.get(uri.toString());
52 | if (isNullOrUndefined(content)) {
53 | throw new Error(
54 | "Internal error: Expected content from read-only provider to be neither null nor undefined");
55 | }
56 | return content;
57 | }
58 | }
--------------------------------------------------------------------------------
/SECURITY.md:
--------------------------------------------------------------------------------
1 |
2 |
3 | ## Security
4 |
5 | Microsoft takes the security of our software products and services seriously, which includes all source code repositories managed through our GitHub organizations, which include [Microsoft](https://github.com/Microsoft), [Azure](https://github.com/Azure), [DotNet](https://github.com/dotnet), [AspNet](https://github.com/aspnet), [Xamarin](https://github.com/xamarin), and [our GitHub organizations](https://opensource.microsoft.com/).
6 |
7 | If you believe you have found a security vulnerability in any Microsoft-owned repository that meets [Microsoft's definition of a security vulnerability](https://aka.ms/opensource/security/definition), please report it to us as described below.
8 |
9 | ## Reporting Security Issues
10 |
11 | **Please do not report security vulnerabilities through public GitHub issues.**
12 |
13 | Instead, please report them to the Microsoft Security Response Center (MSRC) at [https://msrc.microsoft.com/create-report](https://aka.ms/opensource/security/create-report).
14 |
15 | If you prefer to submit without logging in, send email to [secure@microsoft.com](mailto:secure@microsoft.com). If possible, encrypt your message with our PGP key; please download it from the [Microsoft Security Response Center PGP Key page](https://aka.ms/opensource/security/pgpkey).
16 |
17 | You should receive a response within 24 hours. If for some reason you do not, please follow up via email to ensure we received your original message. Additional information can be found at [microsoft.com/msrc](https://aka.ms/opensource/security/msrc).
18 |
19 | Please include the requested information listed below (as much as you can provide) to help us better understand the nature and scope of the possible issue:
20 |
21 | * Type of issue (e.g. buffer overflow, SQL injection, cross-site scripting, etc.)
22 | * Full paths of source file(s) related to the manifestation of the issue
23 | * The location of the affected source code (tag/branch/commit or direct URL)
24 | * Any special configuration required to reproduce the issue
25 | * Step-by-step instructions to reproduce the issue
26 | * Proof-of-concept or exploit code (if possible)
27 | * Impact of the issue, including how an attacker might exploit the issue
28 |
29 | This information will help us triage your report more quickly.
30 |
31 | If you are reporting for a bug bounty, more complete reports can contribute to a higher bounty award. Please visit our [Microsoft Bug Bounty Program](https://aka.ms/opensource/security/bounty) page for more details about our active programs.
32 |
33 | ## Preferred Languages
34 |
35 | We prefer all communications to be in English.
36 |
37 | ## Policy
38 |
39 | Microsoft follows the principle of [Coordinated Vulnerability Disclosure](https://aka.ms/opensource/security/cvd).
40 |
41 |
42 |
--------------------------------------------------------------------------------
/resources/dark/CreateLogicApp.svg:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/resources/light/CreateLogicApp.svg:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/src/wizard/logic-app/createLogicApp.ts:
--------------------------------------------------------------------------------
1 | /*---------------------------------------------------------------------------------------------
2 | * Copyright (c) Microsoft Corporation. All rights reserved.
3 | * Licensed under the MIT License. See LICENSE in the project root for license information.
4 | *--------------------------------------------------------------------------------------------*/
5 |
6 | import { AzureWizard, AzureWizardExecuteStep, AzureWizardPromptStep, IActionContext, IAzureNode, IAzureTreeItem, ILocationWizardContext, IResourceGroupWizardContext, LocationListStep, ResourceGroupCreateStep, ResourceGroupListStep } from "vscode-azureextensionui";
7 | import { LogicAppTreeItem } from "../../tree/logic-app/LogicAppTreeItem";
8 | import { LogicAppCreateStep } from "./LogicAppCreateStep";
9 | import { LogicAppNameStep } from "./LogicAppNameStep";
10 |
11 | export interface IAzureLogicAppWizardContext extends ILocationWizardContext, IResourceGroupWizardContext {
12 | logicApp?: LogicAppTreeItem;
13 | workflowName?: string;
14 | }
15 |
16 | export async function createLogicApp(node: IAzureNode, showCreatingNode: (label: string) => void): Promise {
17 | // Prompt the user for a workflow name, resource group, and location.
18 | const promptSteps: Array> = [
19 | new ResourceGroupListStep(),
20 | new LocationListStep(),
21 | new LogicAppNameStep()
22 | ];
23 |
24 | // Create a new resource group (if necessary) and the new Logic App.
25 | const executeSteps: Array> = [
26 | new ResourceGroupCreateStep(),
27 | new LogicAppCreateStep()
28 | ];
29 |
30 | // Initialize the wizard context.
31 | let wizardContext: IAzureLogicAppWizardContext = {
32 | credentials: node.credentials,
33 | subscriptionDisplayName: node.subscriptionDisplayName,
34 | subscriptionId: node.subscriptionId
35 | };
36 |
37 | // Create a new instance of an Azure wizard for creating Logic Apps.
38 | const wizard = new AzureWizard(promptSteps, executeSteps, wizardContext);
39 |
40 | // Create a fake action context until https://github.com/Microsoft/vscode-azuretools/issues/120 is fixed.
41 | const actionContext = { measurements: {}, properties: {} } as IActionContext;
42 |
43 | // Prompt the user for information required to create a new Logic App.
44 | wizardContext = await wizard.prompt(actionContext);
45 |
46 | // Show a "Creating..." message in the tree view.
47 | showCreatingNode(wizardContext.workflowName!);
48 |
49 | // Execute the necessary steps to create a new Logic App.
50 | wizardContext = await wizard.execute(actionContext);
51 |
52 | // Return a new Logic App tree item to add to the tree view.
53 | return wizardContext.logicApp!;
54 | }
55 |
--------------------------------------------------------------------------------
/src/tree/logic-app/LogicAppVersionsTreeItem.ts:
--------------------------------------------------------------------------------
1 | /*---------------------------------------------------------------------------------------------
2 | * Copyright (c) Microsoft Corporation. All rights reserved.
3 | * Licensed under the MIT License. See LICENSE in the project root for license information.
4 | *--------------------------------------------------------------------------------------------*/
5 |
6 | import LogicAppsManagementClient from "azure-arm-logic";
7 | import { Workflow, WorkflowVersion } from "azure-arm-logic/lib/models";
8 | import { IAzureNode, IAzureParentTreeItem, IAzureTreeItem } from "vscode-azureextensionui";
9 | import { localize } from "../../localize";
10 | import * as nodeUtils from "../../utils/nodeUtils";
11 | import { LogicAppCurrentVersionTreeItem } from "./LogicAppCurrentVersionTreeItem";
12 | import { LogicAppVersionTreeItem } from "./LogicAppVersionTreeItem";
13 |
14 | export class LogicAppVersionsTreeItem implements IAzureParentTreeItem {
15 | public static contextValue = "azLogicAppsWorkflowVersions";
16 | public readonly childTypeLabel = localize("azLogicApps.Version", "Version");
17 | public readonly contextValue = LogicAppVersionsTreeItem.contextValue;
18 | public readonly label = localize("azLogicApps.Versions", "Versions");
19 |
20 | private nextLink: string | undefined;
21 |
22 | public constructor(private readonly client: LogicAppsManagementClient, private readonly workflow: Workflow) {
23 | }
24 |
25 | public hasMoreChildren(): boolean {
26 | return this.nextLink !== undefined;
27 | }
28 |
29 | public get iconPath(): nodeUtils.IThemedIconPath {
30 | return nodeUtils.getThemedIconPath("BulletList");
31 | }
32 |
33 | public get id(): string {
34 | return `${this.workflow.id!}/versions`;
35 | }
36 |
37 | public get resourceGroupName(): string {
38 | return this.workflow.id!.split("/").slice(-5, -4)[0];
39 | }
40 |
41 | public get workflowName(): string {
42 | return this.workflow.name!;
43 | }
44 |
45 | public async loadMoreChildren(_: IAzureNode, clearCache: boolean): Promise {
46 | if (clearCache) {
47 | this.nextLink = undefined;
48 | }
49 |
50 | const workflowVersions = this.nextLink === undefined
51 | ? await this.client.workflowVersions.list(this.resourceGroupName, this.workflowName)
52 | : await this.client.workflowVersions.listNext(this.nextLink);
53 |
54 | this.nextLink = workflowVersions.nextLink;
55 |
56 | return workflowVersions.map((workflowVersion: WorkflowVersion) => {
57 | return workflowVersion.name === this.workflow.version!
58 | ? new LogicAppCurrentVersionTreeItem(this.client, this.workflow, workflowVersion)
59 | : new LogicAppVersionTreeItem(this.client, this.workflow, workflowVersion);
60 | });
61 | }
62 | }
63 |
--------------------------------------------------------------------------------
/src/wizard/integration-account/partners/partnerNameStep.ts:
--------------------------------------------------------------------------------
1 | /*---------------------------------------------------------------------------------------------
2 | * Copyright (c) Microsoft Corporation. All rights reserved.
3 | * Licensed under the MIT License. See LICENSE in the project root for license information.
4 | *--------------------------------------------------------------------------------------------*/
5 |
6 | import { IntegrationAccountPartner } from "azure-arm-logic/lib/models";
7 | import * as vscode from "vscode";
8 | import { AzureWizardPromptStep, UserCancelledError } from "vscode-azureextensionui";
9 | import { localize } from "../../../localize";
10 | import { getAllPartners } from "../../../utils/integration-account/partnerUtils";
11 | import { IPartnerWizardContext } from "./createPartnerWizard";
12 |
13 | export class PartnerNameStep extends AzureWizardPromptStep {
14 | public async prompt(wizardContext: IPartnerWizardContext): Promise {
15 | const options: vscode.InputBoxOptions = {
16 | prompt: localize("azIntegrationAccounts.promptForPartnerName", "Enter a name for the new Partner."),
17 | validateInput: async (name: string) => {
18 | name = name ? name.trim() : "";
19 |
20 | if (!name) {
21 | return localize("azIntegrationAccounts.nameRequired", "A name is required.");
22 | } else if (name.length > 80) {
23 | return localize("azIntegrationAccounts.nameTooLong", "The name has a maximum length of 80 characters.");
24 | } else if (!/^[0-9a-zA-Z-_.()]+$/.test(name)) {
25 | return localize("azIntegrationAccounts.nameContainsInvalidCharacters", "The name can only contain letters, numbers, and '-', '(', ')', '_', or '.'");
26 | } else if (!await this.isNameAvailable(name, wizardContext)) {
27 | return localize("azIntegrationAccounts.nameAlreadyInUse", "The name is already in use.");
28 | } else {
29 | return undefined;
30 | }
31 | }
32 | };
33 |
34 | const partnerName = await vscode.window.showInputBox(options);
35 | if (partnerName) {
36 | wizardContext.partnerName = partnerName.trim();
37 | return wizardContext;
38 | }
39 |
40 | throw new UserCancelledError();
41 | }
42 |
43 | private async isNameAvailable(name: string, wizardContext: IPartnerWizardContext): Promise {
44 | const partners = await getAllPartners(wizardContext.credentials, wizardContext.subscriptionId, wizardContext.resourceGroup!.name!, wizardContext.integrationAccountName);
45 |
46 | if (partners.some((partner: IntegrationAccountPartner) => partner.name! === name)) {
47 | return false;
48 | }
49 |
50 | return true;
51 | }
52 | }
53 |
--------------------------------------------------------------------------------
/src/wizard/integration-account/agreements/identityStep.ts:
--------------------------------------------------------------------------------
1 | /*---------------------------------------------------------------------------------------------
2 | * Copyright (c) Microsoft Corporation. All rights reserved.
3 | * Licensed under the MIT License. See LICENSE in the project root for license information.
4 | *--------------------------------------------------------------------------------------------*/
5 |
6 | import { BusinessIdentity } from "azure-arm-logic/lib/models";
7 | import * as vscode from "vscode";
8 | import { UserCancelledError } from "vscode-azureextensionui";
9 | import { Constants } from "../../../constants";
10 | import { AgreementType } from "../../../utils/integration-account/agreementUtils";
11 | import { getAllPartners } from "../../../utils/integration-account/partnerUtils";
12 | import { arrayToMap } from "../../../utils/nodeUtils";
13 | import { IAgreementWizardContext } from "./createAgreementWizard";
14 |
15 | export class IdentityStep {
16 | public async prompt(wizardContext: IAgreementWizardContext, partnerName: string): Promise {
17 | if (!wizardContext.partners) {
18 | const partners = await getAllPartners(wizardContext.credentials, wizardContext.subscriptionId, wizardContext.resourceGroup!.name!, wizardContext.integrationAccountName);
19 | wizardContext.partners = arrayToMap(partners, "name");
20 | }
21 |
22 | const businessIdentities = wizardContext.partners.get(partnerName)!.content.b2b!.businessIdentities!;
23 | const filteredBusinessIdentities = this.filterBusinessIdentitiesForAgreementType(wizardContext.agreementType!, businessIdentities);
24 | const dropdownValues = filteredBusinessIdentities.map((businessIdentity) => {
25 | return `${businessIdentity.qualifier} : ${businessIdentity.value}`;
26 | });
27 |
28 | const selectedValue = await vscode.window.showQuickPick(dropdownValues);
29 |
30 | if (selectedValue) {
31 | const selectedIdentity = filteredBusinessIdentities.find((identity) => {
32 | return selectedValue.startsWith(identity.qualifier);
33 | });
34 |
35 | return selectedIdentity!;
36 | }
37 |
38 | throw new UserCancelledError();
39 | }
40 |
41 | private filterBusinessIdentitiesForAgreementType(agreementType: string, businessIdentities: BusinessIdentity[]): BusinessIdentity[] {
42 | let qualifiersToInclude: string[];
43 |
44 | if (agreementType === AgreementType.AS2) {
45 | qualifiersToInclude = Constants.AS2AllowedIdentityQualifiers;
46 | } else if (agreementType === AgreementType.X12) {
47 | qualifiersToInclude = Constants.X12AllowedIdentityQualifiers;
48 | } else {
49 | qualifiersToInclude = Constants.EdifactAllowedIdentityQualifiers;
50 | }
51 |
52 | return businessIdentities.filter((businessIdentity) => {
53 | return qualifiersToInclude.indexOf(businessIdentity.qualifier) > -1;
54 | });
55 | }
56 | }
57 |
--------------------------------------------------------------------------------
/src/tree/integration-account/IntegrationAccountMapsTreeItem.ts:
--------------------------------------------------------------------------------
1 | /*---------------------------------------------------------------------------------------------
2 | * Copyright (c) Microsoft Corporation. All rights reserved.
3 | * Licensed under the MIT License. See LICENSE in the project root for license information.
4 | *--------------------------------------------------------------------------------------------*/
5 |
6 | import LogicAppsManagementClient from "azure-arm-logic";
7 | import { IntegrationAccount, IntegrationAccountMap } from "azure-arm-logic/lib/models";
8 | import { IAzureNode, IAzureParentTreeItem, IAzureTreeItem } from "vscode-azureextensionui";
9 | import { localize } from "../../localize";
10 | import { getThemedIconPath, IThemedIconPath } from "../../utils/nodeUtils";
11 | import { runNewMapWizard } from "../../wizard/integration-account/maps/createMapWizard";
12 | import { IntegrationAccountMapTreeItem } from "./IntegrationAccountMapTreeItem";
13 |
14 | export class IntegrationAccountMapsTreeItem implements IAzureParentTreeItem {
15 | public static contextValue = "azIntegrationAccountMaps";
16 | public readonly childTypeLabel = localize("azIntegrationAccounts.Map", "Map");
17 | public readonly contextValue = IntegrationAccountMapsTreeItem.contextValue;
18 | public readonly label = localize("azIntegrationAccounts.Maps", "Maps");
19 | private nextLink: string | undefined;
20 |
21 | public constructor(private readonly client: LogicAppsManagementClient, private readonly integrationAccount: IntegrationAccount) {
22 | }
23 |
24 | public get iconPath(): IThemedIconPath {
25 | return getThemedIconPath("BulletList");
26 | }
27 |
28 | public get id(): string {
29 | return `${this.integrationAccount.id!}/maps`;
30 | }
31 |
32 | public get resourceGroupName(): string {
33 | return this.integrationAccount.id!.split("/").slice(-5, -4)[0];
34 | }
35 |
36 | public get integrationAccountName(): string {
37 | return this.integrationAccount.name!;
38 | }
39 |
40 | public hasMoreChildren(): boolean {
41 | return this.nextLink !== undefined;
42 | }
43 |
44 | public async loadMoreChildren(_: IAzureNode, clearCache: boolean): Promise {
45 | if (clearCache) {
46 | this.nextLink = undefined;
47 | }
48 |
49 | const integrationAccountMaps = this.nextLink === undefined
50 | ? await this.client.integrationAccountMaps.list(this.resourceGroupName, this.integrationAccountName)
51 | : await this.client.integrationAccountMaps.listNext(this.nextLink);
52 |
53 | this.nextLink = integrationAccountMaps.nextLink;
54 |
55 | return integrationAccountMaps.map((map: IntegrationAccountMap) => new IntegrationAccountMapTreeItem(this.client, map));
56 | }
57 |
58 | public async createChild(node: IAzureNode, showCreatingNode: (label: string) => void): Promise {
59 | return runNewMapWizard(this.integrationAccount, node, showCreatingNode);
60 | }
61 | }
62 |
--------------------------------------------------------------------------------
/src/wizard/integration-account/schemas/createSchemaWizard.ts:
--------------------------------------------------------------------------------
1 | /*---------------------------------------------------------------------------------------------
2 | * Copyright (c) Microsoft Corporation. All rights reserved.
3 | * Licensed under the MIT License. See LICENSE in the project root for license information.
4 | *--------------------------------------------------------------------------------------------*/
5 |
6 | import { IntegrationAccount } from "azure-arm-logic/lib/models";
7 | import { AzureWizard, AzureWizardExecuteStep, AzureWizardPromptStep, IActionContext, IAzureNode, IAzureTreeItem, ILocationWizardContext, IResourceGroupWizardContext } from "vscode-azureextensionui";
8 | import { IntegrationAccountSchemaTreeItem } from "../../../tree/integration-account/IntegrationAccountSchemaTreeItem";
9 | import { SchemaCreateStep } from "./schemaCreateStep";
10 | import { SchemaNameStep } from "./schemaNameStep";
11 |
12 | export interface ISchemaWizardContext extends ILocationWizardContext, IResourceGroupWizardContext {
13 | integrationAccountName: string;
14 | schema?: IntegrationAccountSchemaTreeItem;
15 | schemaName?: string;
16 | }
17 |
18 | export async function runNewSchemaWizard(integrationAccount: IntegrationAccount, node: IAzureNode, showCreatingNode: (label: string) => void): Promise {
19 | // Prompt the user for a schema type and schema name.
20 | const promptSteps: Array> = [
21 | new SchemaNameStep()
22 | ];
23 |
24 | // Create the new Schema.
25 | const executeSteps: Array> = [
26 | new SchemaCreateStep()
27 | ];
28 |
29 | // Initialize the wizard context.
30 | let wizardContext: ISchemaWizardContext = {
31 | credentials: node.credentials,
32 | integrationAccountName: integrationAccount.name!,
33 | resourceGroup: {
34 | location: integrationAccount.location!,
35 | name: integrationAccount.id!.split("/").slice(-5, -4)[0]
36 | },
37 | subscriptionDisplayName: node.subscriptionDisplayName,
38 | subscriptionId: node.subscriptionId
39 | };
40 |
41 | // Create a new instance of an Azure wizard for creating Schemas.
42 | const wizard = new AzureWizard(promptSteps, executeSteps, wizardContext);
43 |
44 | // Create a fake action context until https://github.com/Microsoft/vscode-azuretools/issues/120 is fixed.
45 | const actionContext = { measurements: {}, properties: {} } as IActionContext;
46 |
47 | // Prompt the user for information required to create a new Schemas.
48 | wizardContext = await wizard.prompt(actionContext);
49 |
50 | // Show a "Creating..." message in the tree view.
51 | showCreatingNode(wizardContext.schemaName!);
52 |
53 | // Execute the necessary steps to create a new Schema.
54 | wizardContext = await wizard.execute(actionContext);
55 |
56 | // Return a new Schema tree item to add to the tree view.
57 | return wizardContext.schema!;
58 | }
59 |
--------------------------------------------------------------------------------
/src/wizard/integration-account/maps/createMapWizard.ts:
--------------------------------------------------------------------------------
1 | /*---------------------------------------------------------------------------------------------
2 | * Copyright (c) Microsoft Corporation. All rights reserved.
3 | * Licensed under the MIT License. See LICENSE in the project root for license information.
4 | *--------------------------------------------------------------------------------------------*/
5 |
6 | import { IntegrationAccount } from "azure-arm-logic/lib/models";
7 | import { AzureWizard, AzureWizardExecuteStep, AzureWizardPromptStep, IActionContext, IAzureNode, IAzureTreeItem, ILocationWizardContext, IResourceGroupWizardContext } from "vscode-azureextensionui";
8 | import { IntegrationAccountMapTreeItem } from "../../../tree/integration-account/IntegrationAccountMapTreeItem";
9 | import { MapCreateStep } from "./mapCreateStep";
10 | import { MapNameStep } from "./mapNameStep";
11 | import { MapTypeStep } from "./mapTypeStep";
12 |
13 | export interface IMapWizardContext extends ILocationWizardContext, IResourceGroupWizardContext {
14 | integrationAccountName: string;
15 | map?: IntegrationAccountMapTreeItem;
16 | mapName?: string;
17 | mapType?: string;
18 | }
19 |
20 | export async function runNewMapWizard(integrationAccount: IntegrationAccount, node: IAzureNode, showCreatingNode: (label: string) => void): Promise {
21 | // Prompt the user for a map type and map name.
22 | const promptSteps: Array> = [
23 | new MapTypeStep(),
24 | new MapNameStep()
25 | ];
26 |
27 | // Create the new Map.
28 | const executeSteps: Array> = [
29 | new MapCreateStep()
30 | ];
31 |
32 | // Initialize the wizard context.
33 | let wizardContext: IMapWizardContext = {
34 | credentials: node.credentials,
35 | integrationAccountName: integrationAccount.name!,
36 | resourceGroup: {
37 | location: integrationAccount.location!,
38 | name: integrationAccount.id!.split("/").slice(-5, -4)[0]
39 | },
40 | subscriptionDisplayName: node.subscriptionDisplayName,
41 | subscriptionId: node.subscriptionId
42 | };
43 |
44 | // Create a new instance of an Azure wizard for creating Maps.
45 | const wizard = new AzureWizard(promptSteps, executeSteps, wizardContext);
46 |
47 | // Create a fake action context until https://github.com/Microsoft/vscode-azuretools/issues/120 is fixed.
48 | const actionContext = { measurements: {}, properties: {} } as IActionContext;
49 |
50 | // Prompt the user for information required to create a new Maps.
51 | wizardContext = await wizard.prompt(actionContext);
52 |
53 | // Show a "Creating..." message in the tree view.
54 | showCreatingNode(wizardContext.mapName!);
55 |
56 | // Execute the necessary steps to create a new Map.
57 | wizardContext = await wizard.execute(actionContext);
58 |
59 | // Return a new Map tree item to add to the tree view.
60 | return wizardContext.map!;
61 | }
62 |
--------------------------------------------------------------------------------
/src/tree/logic-app/LogicAppVersionTreeItem.ts:
--------------------------------------------------------------------------------
1 | /*---------------------------------------------------------------------------------------------
2 | * Copyright (c) Microsoft Corporation. All rights reserved.
3 | * Licensed under the MIT License. See LICENSE in the project root for license information.
4 | *--------------------------------------------------------------------------------------------*/
5 |
6 | import LogicAppsManagementClient from "azure-arm-logic";
7 | import { Sku, Workflow, WorkflowVersion } from "azure-arm-logic/lib/models";
8 | import { IAzureTreeItem } from "vscode-azureextensionui";
9 | import { ConnectionReferences, getConnectionReferencesForLogicAppVersion } from "../../utils/logic-app/connectionReferenceUtils";
10 | import * as nodeUtils from "../../utils/nodeUtils";
11 |
12 | export class LogicAppVersionTreeItem implements IAzureTreeItem {
13 | public static readonly contextValue: string = "azLogicAppsWorkflowVersion";
14 | public readonly contextValue: string = LogicAppVersionTreeItem.contextValue;
15 |
16 | public constructor(private readonly client: LogicAppsManagementClient, private readonly workflow: Workflow, private readonly workflowVersion: WorkflowVersion) {
17 | }
18 |
19 | public get commandId(): string {
20 | return "azureLogicApps.openVersionInEditor";
21 | }
22 |
23 | public get iconPath(): string {
24 | return nodeUtils.getIconPath(LogicAppVersionTreeItem.contextValue);
25 | }
26 |
27 | public get id(): string {
28 | return this.workflowVersion.id!;
29 | }
30 |
31 | public get integrationAccountId(): string | undefined {
32 | return this.workflowVersion.integrationAccount?.id;
33 | }
34 |
35 | public get label(): string {
36 | return this.workflowVersion.name!;
37 | }
38 |
39 | public get location(): string {
40 | return this.workflowVersion.location!;
41 | }
42 |
43 | public get resourceGroupName(): string {
44 | return this.workflow.id!.split("/").slice(-5, -4)[0];
45 | }
46 |
47 | public get sku(): Sku | undefined {
48 | return this.workflow.sku;
49 | }
50 |
51 | public get workflowName(): string {
52 | return this.workflow.name!;
53 | }
54 |
55 | public async getData(): Promise {
56 | return JSON.stringify(this.workflowVersion.definition, null, 4);
57 | }
58 |
59 | public getParameters(): Record | undefined {
60 | return this.workflowVersion.parameters;
61 | }
62 |
63 | public async getReferences(): Promise {
64 | return getConnectionReferencesForLogicAppVersion(this.client.credentials, this.client.subscriptionId, this.resourceGroupName, this.workflowName, this.workflowVersion.name!, this.client.apiVersion);
65 | }
66 |
67 | public async promote(): Promise {
68 | const workflow: Workflow = {
69 | ...this.workflowVersion,
70 | state: this.workflow.state!
71 | };
72 |
73 | await this.client.workflows.createOrUpdate(this.resourceGroupName, this.workflowName, workflow);
74 | }
75 | }
76 |
--------------------------------------------------------------------------------
/src/tree/integration-account/IntegrationAccountSchemasTreeItem.ts:
--------------------------------------------------------------------------------
1 | /*---------------------------------------------------------------------------------------------
2 | * Copyright (c) Microsoft Corporation. All rights reserved.
3 | * Licensed under the MIT License. See LICENSE in the project root for license information.
4 | *--------------------------------------------------------------------------------------------*/
5 |
6 | import LogicAppsManagementClient from "azure-arm-logic";
7 | import { IntegrationAccount, IntegrationAccountSchema } from "azure-arm-logic/lib/models";
8 | import { IAzureNode, IAzureParentTreeItem, IAzureTreeItem } from "vscode-azureextensionui";
9 | import { localize } from "../../localize";
10 | import { getThemedIconPath, IThemedIconPath } from "../../utils/nodeUtils";
11 | import { runNewSchemaWizard } from "../../wizard/integration-account/schemas/createSchemaWizard";
12 | import { IntegrationAccountSchemaTreeItem } from "./IntegrationAccountSchemaTreeItem";
13 |
14 | export class IntegrationAccountSchemasTreeItem implements IAzureParentTreeItem {
15 | public static contextValue = "azIntegrationAccountSchemas";
16 | public readonly childTypeLabel = localize("azIntegrationAccounts.Schema", "Schema");
17 | public readonly contextValue = IntegrationAccountSchemasTreeItem.contextValue;
18 | public readonly label = localize("azIntegrationAccounts.Schemas", "Schemas");
19 | private nextLink: string | undefined;
20 |
21 | public constructor(private readonly client: LogicAppsManagementClient, private readonly integrationAccount: IntegrationAccount) {
22 | }
23 |
24 | public get iconPath(): IThemedIconPath {
25 | return getThemedIconPath("BulletList");
26 | }
27 |
28 | public get id(): string {
29 | return `${this.integrationAccount.id!}/schemas`;
30 | }
31 |
32 | public get resourceGroupName(): string {
33 | return this.integrationAccount.id!.split("/").slice(-5, -4)[0];
34 | }
35 |
36 | public get integrationAccountName(): string {
37 | return this.integrationAccount.name!;
38 | }
39 |
40 | public hasMoreChildren(): boolean {
41 | return this.nextLink !== undefined;
42 | }
43 |
44 | public async loadMoreChildren(_: IAzureNode, clearCache: boolean): Promise {
45 | if (clearCache) {
46 | this.nextLink = undefined;
47 | }
48 |
49 | const integrationAccountSchemas = this.nextLink === undefined
50 | ? await this.client.integrationAccountSchemas.list(this.resourceGroupName, this.integrationAccountName)
51 | : await this.client.integrationAccountSchemas.listNext(this.nextLink);
52 |
53 | this.nextLink = integrationAccountSchemas.nextLink;
54 |
55 | return integrationAccountSchemas.map((schema: IntegrationAccountSchema) => new IntegrationAccountSchemaTreeItem(this.client, schema));
56 | }
57 |
58 | public async createChild(node: IAzureNode, showCreatingNode: (label: string) => void): Promise {
59 | return runNewSchemaWizard(this.integrationAccount, node, showCreatingNode);
60 | }
61 | }
62 |
--------------------------------------------------------------------------------
/src/tree/integration-account/IntegrationAccountPartnersTreeItem.ts:
--------------------------------------------------------------------------------
1 | /*---------------------------------------------------------------------------------------------
2 | * Copyright (c) Microsoft Corporation. All rights reserved.
3 | * Licensed under the MIT License. See LICENSE in the project root for license information.
4 | *--------------------------------------------------------------------------------------------*/
5 |
6 | import LogicAppsManagementClient from "azure-arm-logic";
7 | import { IntegrationAccount, IntegrationAccountPartner } from "azure-arm-logic/lib/models";
8 | import { IAzureNode, IAzureParentTreeItem, IAzureTreeItem } from "vscode-azureextensionui";
9 | import { localize } from "../../localize";
10 | import { getThemedIconPath, IThemedIconPath } from "../../utils/nodeUtils";
11 | import { runNewPartnerWizard } from "../../wizard/integration-account/partners/createPartnerWizard";
12 | import { IntegrationAccountPartnerTreeItem } from "./IntegrationAccountPartnerTreeItem";
13 |
14 | export class IntegrationAccountPartnersTreeItem implements IAzureParentTreeItem {
15 | public static contextValue = "azIntegrationAccountPartners";
16 | public readonly childTypeLabel = localize("azIntegrationAccounts.Partner", "Partner");
17 | public readonly contextValue = IntegrationAccountPartnersTreeItem.contextValue;
18 | public readonly label = localize("azIntegrationAccounts.Partners", "Partners");
19 | private nextLink: string | undefined;
20 |
21 | public constructor(private readonly client: LogicAppsManagementClient, private readonly integrationAccount: IntegrationAccount) {
22 | }
23 |
24 | public get iconPath(): IThemedIconPath {
25 | return getThemedIconPath("BulletList");
26 | }
27 |
28 | public get id(): string {
29 | return `${this.integrationAccount.id!}/partners`;
30 | }
31 |
32 | public get resourceGroupName(): string {
33 | return this.integrationAccount.id!.split("/").slice(-5, -4)[0];
34 | }
35 |
36 | public get integrationAccountName(): string {
37 | return this.integrationAccount.name!;
38 | }
39 |
40 | public hasMoreChildren(): boolean {
41 | return this.nextLink !== undefined;
42 | }
43 |
44 | public async loadMoreChildren(_: IAzureNode, clearCache: boolean): Promise {
45 | if (clearCache) {
46 | this.nextLink = undefined;
47 | }
48 |
49 | const integrationAccountPartners = this.nextLink === undefined
50 | ? await this.client.integrationAccountPartners.list(this.resourceGroupName, this.integrationAccountName)
51 | : await this.client.integrationAccountPartners.listNext(this.nextLink);
52 |
53 | this.nextLink = integrationAccountPartners.nextLink;
54 |
55 | return integrationAccountPartners.map((partner: IntegrationAccountPartner) => new IntegrationAccountPartnerTreeItem(this.client, partner));
56 | }
57 |
58 | public async createChild(node: IAzureNode, showCreatingNode: (label: string) => void): Promise {
59 | return runNewPartnerWizard(this.integrationAccount, node, showCreatingNode);
60 | }
61 | }
62 |
--------------------------------------------------------------------------------
/src/tree/integration-account/IntegrationAccountAgreementsTreeItem.ts:
--------------------------------------------------------------------------------
1 | /*---------------------------------------------------------------------------------------------
2 | * Copyright (c) Microsoft Corporation. All rights reserved.
3 | * Licensed under the MIT License. See LICENSE in the project root for license information.
4 | *--------------------------------------------------------------------------------------------*/
5 |
6 | import LogicAppsManagementClient from "azure-arm-logic";
7 | import { IntegrationAccount, IntegrationAccountAgreement } from "azure-arm-logic/lib/models";
8 | import { IAzureNode, IAzureParentTreeItem, IAzureTreeItem } from "vscode-azureextensionui";
9 | import { localize } from "../../localize";
10 | import { getThemedIconPath, IThemedIconPath } from "../../utils/nodeUtils";
11 | import { runNewAgreementWizard } from "../../wizard/integration-account/agreements/createAgreementWizard";
12 | import { IntegrationAccountAgreementTreeItem } from "./IntegrationAccountAgreementTreeItem";
13 |
14 | export class IntegrationAccountAgreementsTreeItem implements IAzureParentTreeItem {
15 | public static contextValue = "azIntegrationAccountAgreements";
16 | public readonly childTypeLabel = localize("azIntegrationAccounts.Agreement", "Agreement");
17 | public readonly contextValue = IntegrationAccountAgreementsTreeItem.contextValue;
18 | public readonly label = localize("azIntegrationAccounts.Agreements", "Agreements");
19 | private nextLink: string | undefined;
20 |
21 | public constructor(private readonly client: LogicAppsManagementClient, private readonly integrationAccount: IntegrationAccount) {
22 | }
23 |
24 | public get iconPath(): IThemedIconPath {
25 | return getThemedIconPath("BulletList");
26 | }
27 |
28 | public get id(): string {
29 | return `${this.integrationAccount.id!}/agreements`;
30 | }
31 |
32 | public get resourceGroupName(): string {
33 | return this.integrationAccount.id!.split("/").slice(-5, -4)[0];
34 | }
35 |
36 | public get integrationAccountName(): string {
37 | return this.integrationAccount.name!;
38 | }
39 |
40 | public hasMoreChildren(): boolean {
41 | return this.nextLink !== undefined;
42 | }
43 |
44 | public async loadMoreChildren(_: IAzureNode, clearCache: boolean): Promise {
45 | if (clearCache) {
46 | this.nextLink = undefined;
47 | }
48 |
49 | const integrationAccountAgreements = this.nextLink === undefined
50 | ? await this.client.integrationAccountAgreements.list(this.resourceGroupName, this.integrationAccountName)
51 | : await this.client.integrationAccountAgreements.listNext(this.nextLink);
52 |
53 | this.nextLink = integrationAccountAgreements.nextLink;
54 |
55 | return integrationAccountAgreements.map((map: IntegrationAccountAgreement) => new IntegrationAccountAgreementTreeItem(this.client, map));
56 | }
57 |
58 | public async createChild(node: IAzureNode, showCreatingNode: (label: string) => void): Promise {
59 | return runNewAgreementWizard(this.integrationAccount, node, showCreatingNode);
60 | }
61 | }
62 |
--------------------------------------------------------------------------------
/src/utils/logic-app/connectionReferenceUtils.ts:
--------------------------------------------------------------------------------
1 | /*---------------------------------------------------------------------------------------------
2 | * Copyright (c) Microsoft Corporation. All rights reserved.
3 | * Licensed under the MIT License. See LICENSE in the project root for license information.
4 | *--------------------------------------------------------------------------------------------*/
5 |
6 | import { ServiceClientCredentials } from "ms-rest";
7 | import * as request from "request-promise-native";
8 | import { getAuthorization } from "../authorizationUtils";
9 |
10 | export type ConnectionReferences = Record;
11 |
12 | export interface IConnectionReference {
13 | connectionId: string;
14 | connectionName: string;
15 | id: string;
16 | }
17 |
18 | interface IConnectionsParameter {
19 | value: ConnectionReferences;
20 | }
21 |
22 | interface IWorkflowWithConnectionReferences {
23 | properties: IWorkflowPropertiesWithConnectionReferences;
24 | }
25 |
26 | interface IWorkflowParametersWithConnectionReferences {
27 | $connections?: IConnectionsParameter;
28 | }
29 |
30 | interface IWorkflowPropertiesWithConnectionReferences {
31 | parameters?: IWorkflowParametersWithConnectionReferences;
32 | }
33 |
34 | export async function getConnectionReferencesForLogicApp(credentials: ServiceClientCredentials, subscriptionId: string, resourceGroupName: string, workflowName: string, apiVersion: string): Promise {
35 | return getConnectionReferences(credentials, `https://management.azure.com/subscriptions/${subscriptionId}/resourceGroups/${resourceGroupName}/providers/Microsoft.Logic/workflows/${workflowName}?api-version=${apiVersion}`);
36 | }
37 |
38 | export async function getConnectionReferencesForLogicAppVersion(credentials: ServiceClientCredentials, subscriptionId: string, resourceGroupName: string, workflowName: string, workflowVersionName: string, apiVersion: string): Promise {
39 | return getConnectionReferences(credentials, `https://management.azure.com/subscriptions/${subscriptionId}/resourceGroups/${resourceGroupName}/providers/Microsoft.Logic/workflows/${workflowName}/versions/${workflowVersionName}?api-version=${apiVersion}`);
40 | }
41 |
42 | async function getConnectionReferences(credentials: ServiceClientCredentials, uri: string): Promise {
43 | const authorization = await getAuthorization(credentials);
44 | const options: request.RequestPromiseOptions = {
45 | headers: {
46 | "Authorization": authorization,
47 | "Content-Type": "application/json"
48 | },
49 | method: "GET",
50 | qs: {
51 | $expand: "properties/connectionReferences"
52 | }
53 | };
54 | const response = await request(uri, options);
55 | const {
56 | properties: {
57 | parameters
58 | }
59 | }: IWorkflowWithConnectionReferences = JSON.parse(response);
60 |
61 | if (parameters === undefined) {
62 | return {};
63 | } else {
64 | const { $connections } = parameters;
65 | return $connections === undefined ? {} : $connections.value;
66 | }
67 | }
68 |
--------------------------------------------------------------------------------