gpt4 book ai didi

azure - 是否有 Workflow.Definition (Microsoft.Azure.Management.Logic.Models) 应该是什么样子的示例?

转载 作者:行者123 更新时间:2023-12-03 02:48:14 25 4
gpt4 key购买 nike

我正在尝试使用 Azure 的 REST API 的包装器进行逻辑应用管理,该包装器在 Microsoft.Azure.Management.Logic 命名空间中提供。特别是,我尝试使用 IWorkflowOperations.CreateOrUpdate 方法。

CreateOrUpdate() 方法接受 IWorkflow 对象。 Workflow 类本身有一个 Definition 属性,其类型为 object,如此处所述 https://learn.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"
}

最佳答案

好的,我明白了定义是什么样的。我提取了现有的工作流程并将其序列化为 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": {}
}

关于azure - 是否有 Workflow.Definition (Microsoft.Azure.Management.Logic.Models) 应该是什么样子的示例?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/57559312/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com