【问题标题】:What is the difference between LogicApp.json and LogicApp.definition.json templates?LogicApp.json 和 LogicApp.definition.json 模板有什么区别?
【发布时间】:2021-09-23 11:28:45
【问题描述】:

我在 Visual Studio Code 和 Visual Code 社区本地创建了相同的逻辑应用程序。我发现两者都创建了不同的模板文件,即 VS Community 上的 LogicApp.json 和 VS Code 上的 LogicApp.definition.json。这些模板文件有何不同?

来自 VS 社区的 Json (LogicApp.json):-

{
  "$schema": "https://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#",
  "contentVersion": "1.0.0.0",
  "parameters": {
    "logicAppName": {
      "type": "string",
      "minLength": 1,
      "maxLength": 80,
      "metadata": {
        "description": "Name of the Logic App."
      }
    },
    "logicAppLocation": {
      "type": "string",
      "defaultValue": "[resourceGroup().location]",
      "allowedValues": [
        "[resourceGroup().location]",
        "eastasia",
        "southeastasia",
        "centralus",
        "eastus",
        "eastus2",
        "westus",
        "northcentralus",
        "southcentralus",
        "northeurope",
        "westeurope",
        "japanwest",
        "japaneast",
        "brazilsouth",
        "australiaeast",
        "australiasoutheast",
        "southindia",
        "centralindia",
        "westindia",
        "canadacentral",
        "canadaeast",
        "uksouth",
        "ukwest",
        "westcentralus",
        "westus2",
        "koreacentral",
        "koreasouth",
        "francecentral",
        "francesouth",
        "uaecentral",
        "uaenorth",
        "southafricanorth",
        "southafricawest",
        "switzerlandnorth",
        "switzerlandwest",
        "germanynorth",
        "germanywestcentral",
        "norwayeast",
        "brazilsoutheast"
      ],
      "metadata": {
        "description": "Location of the Logic App."
      }
    }
  },
  "variables": {},
  "resources": [
    {
      "name": "[parameters('logicAppName')]",
      "type": "Microsoft.Logic/workflows",
      "location": "[parameters('logicAppLocation')]",
      "tags": {
        "displayName": "LogicApp"
      },
      "apiVersion": "2016-06-01",
      "properties": {
        "definition": {
          "$schema": "https://schema.management.azure.com/providers/Microsoft.Logic/schemas/2016-06-01/workflowdefinition.json#",
          "actions": {
            "Response": {
              "type": "Response",
              "kind": "http",
              "inputs": {
                "statusCode": 200,
                "body": "hello user!"
              },
              "runAfter": {}
            }
          },
          "parameters": {},
          "triggers": {
            "manual": {
              "type": "Request",
              "kind": "Http",
              "inputs": {
                "schema": {},
                "method": "GET"
              }
            }
          },
          "contentVersion": "1.0.0.0",
          "outputs": {}
        },
        "parameters": {}
      }
    }
  ],
  "outputs": {}
}

来自 VS Code 的 Json (LoginApp.definition.json):-

{
    "$schema": "https://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#",
    "contentVersion": "1.0.0.0",
    "parameters": {
        "workflows_logic_vscode_name": {
            "defaultValue": "logic-vscode",
            "type": "string"
        }
    },
    "resources": [
        {
            "apiVersion": "2017-07-01",
            "dependsOn": [],
            "location": "eastus",
            "name": "[parameters('workflows_logic_vscode_name')]",
            "properties": {
                "definition": {
                    "$schema": "https://schema.management.azure.com/providers/Microsoft.Logic/schemas/2016-06-01/workflowdefinition.json#",
                    "contentVersion": "1.0.0.0",
                    "parameters": {},
                    "triggers": {
                        "Request": {
                            "type": "Request",
                            "kind": "Http",
                            "inputs": {
                                "method": "GET",
                                "schema": {}
                            }
                        }
                    },
                    "actions": {
                        "Response": {
                            "runAfter": {},
                            "type": "Response",
                            "inputs": {
                                "body": "Hello user",
                                "statusCode": 200
                            }
                        }
                    },
                    "outputs": {}
                },
                "parameters": {},
                "state": "Enabled"
            },
            "scale": null,
            "tags": {},
            "type": "Microsoft.Logic/workflows"
        }
    ],
    "variables": {}
}

【问题讨论】:

  • 我没有这些文件,你能把 JSON 添加到问题中吗?
  • @juunas 请看一下。

标签: azure azure-logic-apps


【解决方案1】:

两者都是工作流定义,当您查看详细信息时,工作流看起来相似但格式不同。

在 VS-Code/Visual Studio/Portal/etc 中创建时格式会有所不同。

以下是我们从 Azure 门户创建它时的示例定义:

{
    "definition": {
        "$schema": "https://schema.management.azure.com/providers/Microsoft.Logic/schemas/XXXX-06-01/workflowdefinition.json#",
        "actions": {},
        "contentVersion": "X.0.0.0",
        "outputs": {},
        "triggers": {
            "manual": {
                "inputs": {},
                "kind": "Http",
                "type": "Request"
            }
        }
    },
    "kind": "Stateful"
}

从 Microsoft 文档中了解 VSCodeVisualStudio 中创建逻辑应用程序的区别及其工作流程。

【讨论】:

    猜你喜欢
    • 2022-01-03
    • 1970-01-01
    • 2011-11-02
    • 1970-01-01
    • 2010-11-10
    • 2018-06-11
    • 2011-08-26
    • 1970-01-01
    相关资源
    最近更新 更多