简体   繁体   中英

Azure Apim. Create operation in schema from openapi definition

I have to create a schema so then I can create operation in Azure APIM. the code that I know is need to be used is:

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.....

but how Im supposed to extract Get and POST operations from this openapi definition and include them in that Schema? https://github.com/RaphaelYoshiga/TerraformBasics/blob/master/conference-api.json

I haven´t find a clear example so far.

Below is the example of Azure apim operation with apim service

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
  }
}

For further information check this .

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM