Skip to content
This repository has been archived by the owner on Feb 7, 2024. It is now read-only.

Commit

Permalink
added Link to swagger
Browse files Browse the repository at this point in the history
  • Loading branch information
michaelwittig committed Oct 28, 2015
1 parent 03ad9a7 commit 3ab16a2
Show file tree
Hide file tree
Showing 3 changed files with 34 additions and 3 deletions.
18 changes: 18 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,26 @@

## create API Gateway from Swagger.json

Create cloudformation stack

```
$ aws --profile awsinaction cloudformation create-stack --stack-name apigateway --template-body file://template.json --capabilities CAPABILITY_IAM --parameters ParameterKey=S3Bucket,ParameterValue=apigateway-mwittig ParameterKey=S3Key,ParameterValue=lambda_v3.zip
$ aws --profile awsinaction cloudformation describe-stacks --stack-name apigateway --query Stacks[].Outputs
```

adjust `swagger.json` to use the correct lambda function (output of the stack created before)

deploy the API Gateway

```
$ cd aws-apigateway-importer-master/
$ ./aws-api-import.sh --create ../swagger.json --profile awsinaction
$ cd ..
```

update the CloudFormation template to set the AppId parameter

```
$ aws --profile awsinaction cloudformation update-stack --stack-name apigateway --template-body file://template.json --capabilities CAPABILITY_IAM --parameters ParameterKey=S3Bucket,UsePreviousValue=true ParameterKey=S3Key,UsePreviousValue=true ParameterKey=AppId,ParameterValue=XXX
```
16 changes: 14 additions & 2 deletions swagger.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,12 @@
"items": {
"$ref": "#/definitions/User"
}
},
"headers": {
"Link": {
"description": "Contains the link to the next page.",
"type": "string"
}
}
}
},
Expand All @@ -36,14 +42,20 @@
}],
"x-amazon-apigateway-integration": {
"type": "aws",
"uri": "arn:aws:apigateway:us-east-1:lambda:path/2015-03-31/functions/arn:aws:lambda:us-east-1:878533158213:function:apigateway-GetUsersLambda-1QX1J2L4DA75J/invocations",
"uri": "arn:aws:apigateway:us-east-1:lambda:path/2015-03-31/functions/arn:aws:lambda:us-east-1:878533158213:function:apigateway-GetUsersLambda-1VBQ7Z0M4IM7Y/invocations",
"httpMethod": "POST",
"requestTemplates": {
"application/json": "{\"body\": $input.json('$'), \"parameters\": {\"limit\": \"$input.params('limit')\", \"next\": \"$input.params('next')\"}}"
},
"responses": {
"default": {
"statusCode": "200"
"statusCode": "200",
"responseParameters": {
"method.response.header.Link": "'TODO'"
},
"responseTemplates": {
"application/json": "$input.json('$.body')"
}
}
}
}
Expand Down
3 changes: 2 additions & 1 deletion template.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,8 @@
},
"AppId": {
"Description": "API Gateway App Id. E.g. 1yc6td9zjj",
"Type": "String"
"Type": "String",
"Default": ""
}
},
"Conditions": {
Expand Down

0 comments on commit 3ab16a2

Please sign in to comment.