【问题标题】:Is there an example of what Workflow.Definition (Microsoft.Azure.Management.Logic.Models) should look like?是否有 Workflow.Definition (Microsoft.Azure.Management.Logic.Models) 应该是什么样子的示例?
【发布时间】:2019-08-20 01:44:05
【问题描述】:

我正在尝试使用 Microsoft.Azure.Management.Logic 命名空间中提供的 Azure REST API for Logic Apps Management 的包装器。 特别是,我正在尝试使用 IWorkflowOperations.CreateOrUpdate 方法。

CreateOrUpdate() 方法接受一个 IWorkflow 对象。 Workflow 类本身有一个定义属性,它是 object 类型的,如此处所述https://docs.microsoft.com/en-us/dotnet/api/microsoft.azure.management.logic.models.workflow.definition?view=azure-dotnet#Microsoft_Azure_Management_Logic_Models_Workflow_Definition 我很难理解定义对象应该是什么。

当我尝试执行 CreateOrUpdate 部分时出现序列化错误。

非常感谢您!

var wfLocation = "East US";
var wfDefinition = System.IO.File.ReadAllText(System.IO.Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "wfDefinition.json"));
var wkflow = new Microsoft.Azure.Management.Logic.Models.Workflow() { Definition = wfDefinition, Location = wfLocation };
logicManagementClient.Workflows.CreateOrUpdate("xxxxxx", "new-test", wkflow);

// And wdDefinition.json looks like

{
  "properties": {
    "definition": {
      "$schema": "https://schema.management.azure.com/providers/Microsoft.Logic/schemas/2016-06-01/workflowdefinition.json#",
      "actions": {
        "HTTP": {
          "inputs": {
            "body": "Test Body",
            "method": "POST",
            "uri": "http://ptsv2.com/t/5351a-1565875020/post"
          },
          "runAfter": {},
          "type": "Http"
        }
      },
      "contentVersion": "1.0.0.0",
      "outputs": {},
      "parameters": {},
      "triggers": {
        "Sliding_Window": {
          "recurrence": {
            "frequency": "Second",
            "interval": 3
          },
          "type": "SlidingWindow"
        }
      }
    }
  },
  "location": "East US"
}

【问题讨论】:

    标签: azure workflow azure-logic-apps


    【解决方案1】:

    好的,我知道定义是什么样的了。我提取了一个现有的工作流程并将其序列化为 JSON。 这就是它的样子

    {
        "$schema": "https://schema.management.azure.com/providers/Microsoft.Logic/schemas/2016-06-01/workflowdefinition.json#",
        "contentVersion": "1.0.0.0",
        "parameters": {},
        "triggers": {
            "Recurrence": {
                "recurrence": {
                    "frequency": "Minute",
                    "interval": 1
                },
                "type": "Recurrence"
            }
        },
        "actions": {
            "HTTP": {
                "runAfter": {},
                "type": "Http",
                "inputs": {
                    "body": "Test Body",
                    "method": "POST",
                    "uri": "http://ptsv2.com/t/5351a-1565875020/post"
                }
            }
        },
        "outputs": {}
    }
    

    【讨论】:

      猜你喜欢
      • 2014-04-10
      • 1970-01-01
      • 2013-10-31
      • 1970-01-01
      • 1970-01-01
      • 2014-12-12
      • 2015-12-09
      • 2017-12-14
      • 1970-01-01
      相关资源
      最近更新 更多