AtlasOfLivingAustralia / api-gateway

Issues & documentation repository for managing the delivery of the API Gateway for the Atlas.
0 stars 0 forks source link

Amazon API Gateway route mapping #20

Open djtfmartin opened 2 years ago

djtfmartin commented 2 years ago

Each of the OpenAPI documents supplied by backend services will need to be imported into the Gateway and mapped through the Amazon API gateway console.

This is a largely configuration/deployment task using the Amazon API gateway UI, however it could be assisted by a script or tool that will take an Open API document and enhance it would the necessary x-amazon-apigateway-integration configuration which will map importing OpenAPI documents much quicker (and possible a task performed using CLI tools or ansible).

Example

Original

openapi: "3.0.1"
info:
  title: "Species"
  version: "2021-10-26 19:18:34UTC"
servers:
- url: "https://gateway-test.ala.org.au/species/{basePath}"
  variables:
    basePath:
      default: ""
paths:
  /ranks:
    get:
      responses:
        default:
          description: "Default response for GET /ranks"
      security:
      - MyAuth: []

Transformed

openapi: "3.0.1"
info:
  title: "Species"
  version: "2021-10-26 19:18:34UTC"
servers:
- url: "https://gateway-test.ala.org.au/species/{basePath}"
  variables:
    basePath:
      default: ""
paths:
  /ranks:
    get:
      responses:
        default:
          description: "Default response for GET /ranks"
      security:
      - MyAuth: []
      x-amazon-apigateway-integration:
        payloadFormatVersion: "1.0"
        type: "http_proxy"
        httpMethod: "GET"
        uri: "https://bie-ws-test.ala.org.au/ws/ranks"
        connectionType: "INTERNET"
djtfmartin commented 2 years ago

Script added here:

https://github.com/AtlasOfLivingAustralia/api-gateway/blob/main/OpenAPIAWS.groovy