azure - 蔚蓝阿皮姆。根据 openapi 定义在模式中创建操作
问题描述
我必须创建一个架构,然后才能在 Azure APIM 中创建操作。我知道需要使用的代码是:
resource "azurerm_api_management_api_schema" "example" {
api_name = azurerm_api_management_api.sample-api.name
api_management_name = azurerm_api_management_api.sample-api.api_management_name
resource_group_name = azurerm_api_management_api.sample-api.resource_group_name
schema_id = "example-schema"
content_type = "application/vnd.oai.openapi.components+json"
value = <<JSON
{
"properties": {
"contentType": "application/vnd.oai.openapi.components+json",
"document": {
"components": {
"schemas": {
operation Get 1
operation Get 2
operation post 1.....
但是我应该如何从这个 openapi 定义中提取 Get 和 POST 操作并将它们包含在该架构中? https://github.com/RaphaelYoshiga/TerraformBasics/blob/master/conference-api.json
到目前为止,我还没有找到一个明确的例子。
解决方案
下面是使用 apim 服务的 Azure apim 操作示例
data "azurerm_api_management_api" "example" {
name = "search-api"
api_management_name = "search-api-management"
resource_group_name = "search-service"
revision = "2"
}
resource "azurerm_api_management_api_operation" "example" {
operation_id = "user-delete"
api_name = data.azurerm_api_management_api.example.name
api_management_name = data.azurerm_api_management_api.example.api_management_name
resource_group_name = data.azurerm_api_management_api.example.resource_group_name
display_name = "Delete User Operation"
method = "DELETE"
url_template = "/users/{id}/delete"
description = "This can only be done by the logged in user."
response {
status_code = 200
}
}
欲了解更多信息,请查看此。
推荐阅读
- javascript - 为什么带有“位置:绝对”的“div”会溢出屏幕
- asp.net-mvc - Razor 页面 SelectList 不会填充
- php - 前端设置时找不到 codeigniter MVC 的 404 页面
- javascript - 如何使用 Razorpay Route 将美元金额转入关联账户
- javascript - CMD 和 VS Code 在同时检查时显示不同版本的角度,在安装过程中我可能会遗漏什么吗?
- anylogic - 如何在不强制转换代理类型的情况下在资源单元上使用 .getServicedEntity() 方法?
- emacs - 组织时钟表报告的时间格式
- javascript - 如何在 JS 中将此奇数字符串(h:m dd/m/yyyy)转换为日期时间对象
- ios - Swift UI Animate 改变宽度不起作用
- python - 使用交互式 ipython 笔记本运行 Tkinter