pulumi python代码中如何传递连接参数
How to pass connection parameters in pulumi python code
我正在尝试将我的逻辑应用程序 ARM 模板转换为 pulumi。但它不接受我的 JSON 形式的连接参数。我需要在逻辑应用步骤
中传递我的 github 连接详细信息
你能告诉我如何在 pulumi python 中做到这一点吗?
"parameters": {
"$connections": {
"value": {
"github": {
"connectionId": "/subscriptions/b417b96c-ff1e-4d07-bc32-74bd70a2a033/resourceGroups/task/providers/Microsoft.Web/connections/github",
"connectionName": "github",
"id": "/subscriptions/b417b96c-ff1e-4d07-bc32-74bd70a2a033/providers/Microsoft.Web/locations/eastus/managedApis/github"
}
}
}
我的代码
example_action_custom = azure.logicapps.ActionCustom("exampleActionCustom",
logic_app_id=example_workflow.id,
name= "Create_a_repository_using_a_template",
body="""{
"inputs": {
"body": {
"name": "cog-chalnge-pmi-shah-@{triggerBody()?['ghusername']}",
"owner": "@triggerBody()?['ghusername']",
"private": true
},
"headers": {
"Accept": "application/vnd.github.baptiste-preview+json"
},
"host": {
"connection": {
"name": "@parameters('$connections')['github']['connectionId']"
}
},
"method": "post",
"parameters": {
"$connections": {
"value": {
"github": {
"connectionId": "/subscriptions/b417b96c-ff1e-4d07-bc32-74bd70a2a033/resourceGroups/bluecode_test_task/providers/Microsoft.Web/connections/github",
"connectionName": "github",
"id": "/subscriptions/b417b96c-ff1e-4d07-bc32-74bd70a2a033/providers/Microsoft.Web/locations/eastus/managedApis/github"
}
}
}
},
"path": "/repos/@{encodeURIComponent('')}/@{encodeURIComponent('')}/generate"
},
"runAfter": {},
"type": "ApiConnection"
}
""")
无法创建 github 连接器
我试过的有用链接 - https://www.pulumi.com/docs/reference/pkg/azure/logicapps/workflow/
https://www.pulumi.com/docs/reference/pkg/azure/logicapps/actioncustom
azure.logicapps.ActionCustom无法传递参数。我已经使用另一个 class 来传递工作流程 azure_native.logic.Workflow。
https://www.pulumi.com/docs/reference/pkg/azure-native/logic/workflow/
我正在尝试将我的逻辑应用程序 ARM 模板转换为 pulumi。但它不接受我的 JSON 形式的连接参数。我需要在逻辑应用步骤
中传递我的 github 连接详细信息你能告诉我如何在 pulumi python 中做到这一点吗?
"parameters": {
"$connections": {
"value": {
"github": {
"connectionId": "/subscriptions/b417b96c-ff1e-4d07-bc32-74bd70a2a033/resourceGroups/task/providers/Microsoft.Web/connections/github",
"connectionName": "github",
"id": "/subscriptions/b417b96c-ff1e-4d07-bc32-74bd70a2a033/providers/Microsoft.Web/locations/eastus/managedApis/github"
}
}
}
我的代码
example_action_custom = azure.logicapps.ActionCustom("exampleActionCustom",
logic_app_id=example_workflow.id,
name= "Create_a_repository_using_a_template",
body="""{
"inputs": {
"body": {
"name": "cog-chalnge-pmi-shah-@{triggerBody()?['ghusername']}",
"owner": "@triggerBody()?['ghusername']",
"private": true
},
"headers": {
"Accept": "application/vnd.github.baptiste-preview+json"
},
"host": {
"connection": {
"name": "@parameters('$connections')['github']['connectionId']"
}
},
"method": "post",
"parameters": {
"$connections": {
"value": {
"github": {
"connectionId": "/subscriptions/b417b96c-ff1e-4d07-bc32-74bd70a2a033/resourceGroups/bluecode_test_task/providers/Microsoft.Web/connections/github",
"connectionName": "github",
"id": "/subscriptions/b417b96c-ff1e-4d07-bc32-74bd70a2a033/providers/Microsoft.Web/locations/eastus/managedApis/github"
}
}
}
},
"path": "/repos/@{encodeURIComponent('')}/@{encodeURIComponent('')}/generate"
},
"runAfter": {},
"type": "ApiConnection"
}
""")
无法创建 github 连接器
我试过的有用链接 - https://www.pulumi.com/docs/reference/pkg/azure/logicapps/workflow/ https://www.pulumi.com/docs/reference/pkg/azure/logicapps/actioncustom
azure.logicapps.ActionCustom无法传递参数。我已经使用另一个 class 来传递工作流程 azure_native.logic.Workflow。
https://www.pulumi.com/docs/reference/pkg/azure-native/logic/workflow/