bbc/aws-apigateway-importer

Name: aws-apigateway-importer

Owner: BBC

Description: Tools to work with Amazon API Gateway, Swagger, and RAML

Created: 2015-11-25 15:12:11.0

Updated: 2015-11-25 15:45:14.0

Pushed: 2015-11-25 15:23:55.0

Homepage:

Size: 95

Language: Java

GitHub Committers

UserMost Recent Commit# Commits

Other Committers

UserEmailMost Recent Commit# Commits

README

Amazon API Gateway Importer

The Amazon API Gateway Importer lets you create or update Amazon API Gateway APIs from a Swagger or RAML API representation.

To learn more about API Gateway, please see the service documentation or the API documentation.

Build Status

Usage
Prerequisites

This tool requires the AWS CLI to be installed and configured on your system.

Build with mvn assembly:assembly

Import a new API
s-api-import.sh --create path/to/swagger.json

s-api-import.sh -c path/to/api.raml
Update an existing API and deploy it to a stage
s-api-import.sh --update API_ID --deploy STAGE_NAME path/to/swagger.yaml

s-api-import.sh --update API_ID --deploy STAGE_NAME --raml-config path/to/config.json path/to/api.raml

For Windows environments replace ./aws-api-import.sh with ./aws-api-import.cmd in the examples.

API Gateway Extension Example

You can fully define an API Gateway API in Swagger using the x-amazon-apigateway-auth and x-amazon-apigateway-integration extensions, or in RAML using an external configuration file.

Defined on an Operation:

mazon-apigateway-auth" : {
"type" : "aws_iam"

mazon-apigateway-integration" : {
type" : "aws",
uri" : "arn:aws:apigateway:us-east-1:lambda:path/2015-03-31/functions/arn:aws:lambda:us-east-1:MY_ACCT_ID:function:helloWorld/invocations",
httpMethod" : "POST",
credentials" : "arn:aws:iam::MY_ACCT_ID:role/lambda_exec_role",
requestTemplates" : {
   "application/json" : "json request template 2",
   "application/xml" : "xml request template 2"
,
requestParameters" : {
   "integration.request.path.integrationPathParam" : "method.request.querystring.latitude",
   "integration.request.querystring.integrationQueryParam" : "method.request.querystring.longitude"
,
cacheNamespace" : "cache-namespace",
cacheKeyParameters" : [],
responses" : {
   "2\\d{2}" : {
       "statusCode" : "200",
       "responseParameters" : {
           "method.response.header.test-method-response-header" : "integration.response.header.integrationResponseHeaderParam1"
       },
       "responseTemplates" : {
           "application/json" : "json 200 response template",
           "application/xml" : "xml 200 response template"
       }
   },
   "default" : {
       "statusCode" : "400",
       "responseParameters" : {
           "method.response.header.test-method-response-header" : "'static value'"
       },
       "responseTemplates" : {
           "application/json" : "json 400 response template",
           "application/xml" : "xml 400 response template"
       }
   }


Testing
test

This work is supported by the National Institutes of Health's National Center for Advancing Translational Sciences, Grant Number U24TR002306. This work is solely the responsibility of the creators and does not necessarily represent the official views of the National Institutes of Health.