pulumi / pulumi-aws-apigateway

Apache License 2.0
11 stars 5 forks source link

Provide easy integration between kinesis and apigateway #33

Open CyrusNajmabadi opened 5 years ago

CyrusNajmabadi commented 5 years ago

See https://docs.aws.amazon.com/apigateway/latest/developerguide/api-as-kinesis-proxy-export-swagger-with-extensions.html for details on what we can take care of for the user.

Note: there are several ways we could do (and we might want to do may of them). These include:

  1. making it easy to create an IntegreationRoute's target from a kinesis stream.
  2. being able ot make an entire Route from a kinesis stream.

The difference between the two can be see with something like:

      "/streams/{stream-name}": {
         "get": {
            "parameters": [
               {
                  "name": "stream-name",
                  "in": "path",
                  "required": true,
                  "schema": {
                     "type": "string"
                  }
               }
            ],
            "responses": {
               "200": {
                  "description": "200 response",
                  "content": {
                     "application/json": {
                        "schema": {
                           "$ref": "#/components/schemas/Empty"
                        }
                     }
                  }
               }
            },
            "x-amazon-apigateway-integration": {
               "credentials": "arn:aws:iam::123456789012:role/apigAwsProxyRole",
               "responses": {
                  "default": {
                     "statusCode": "200"
                  }
               },
               "requestTemplates": {
                  "application/json": "{\n    \"StreamName\": \"$input.params('stream-name')\"\n}"
               },
               "uri": "arn:aws:apigateway:us-east-1:kinesis:action/DescribeStream",
               "httpMethod": "POST",
               "type": "aws"
            }
         },

Doing just the 'integration target' would set up the "x-amazon-apigateway-integration" portion, but likely would not setup the parameters/responses pieces (leaving the user to have to do that).

Indeed, it's not even likely that the "integration target" approach would work given that for this to work a common stream-name variable needs to be referenced in all places.