Last active
December 21, 2015 10:28
-
-
Save Nopik/2d1c52c58504fe1e7771 to your computer and use it in GitHub Desktop.
awsm.json to s-function.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# Name of your lambda | |
FN=foo | |
# Absolute path to some s-function file which will be used as template | |
TEMPLATE=/absolute/path/to/some/s-function.json | |
jq ".[0].functions.$FN.handler=(.[1].lambda.cloudFormation.Handler | sub(\"aws_\";\"\"))|.[0].functions.$FN.timeout=.[1].lambda.cloudFormation.Timeout|.[0].functions.$FN.memorySize=.[1].lambda.cloudFormation.MemorySize|.[0].functions.$FN.endpoints[0].path=.[1].apiGateway.cloudFormation.Path|.[0].functions.$FN.endpoints[0].method=.[1].apiGateway.cloudFormation.Method|.[0].functions.$FN.endpoints[0].requestParameters=.[1].apiGateway.cloudFormation.RequestParameters|.[0].functions.$FN.endpoints[0].requestTemplates=.[1].apiGateway.cloudFormation.RequestTemplates|.[0].functions.$FN.endpoints[0].responses=.[1].apiGateway.cloudFormation.Responses|.[0]" --slurp $TEMPLATE awsm.json >s-function.json | |
git add s-function.json |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
I dig it. I use
jq
every single day, I think. Well done.