Skip to content

Instantly share code, notes, and snippets.

@justinyoo
Created July 20, 2017 12:45
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save justinyoo/1b20541f6e605981d801c9f0e3e9c219 to your computer and use it in GitHub Desktop.
Save justinyoo/1b20541f6e605981d801c9f0e3e9c219 to your computer and use it in GitHub Desktop.
Testing Serverless Applications - Part 2
{
"definition": {
"$schema": "https://schema.management.azure.com/providers/Microsoft.Logic/schemas/2016-06-01/workflowdefinition.json#",
"contentVersion": "1.0.0.0",
"parameters": {},
"triggers": {
"manual": {
"type": "Request",
"kind": "Http",
"inputs": {
"method": "POST",
"schema": {
"type": "object",
"properties": {
"functionAppEndpointUri": {
"type": "string"
},
"functionAppKey": {
"type": "string"
},
"query": {
"type": "string"
}
}
}
}
}
},
"actions": {
"HTTP": {
"type": "Http",
"runAfter": {},
"inputs": {
"method": "GET",
"uri": "@{triggerBody()?['functionAppEndpointUri']}?q=@{triggerBody()?['query']}",
"headers": {
"x-functions-key": "@{triggerBody()?['functionAppKey']}"
}
}
},
"ErrorResponse": {
"type": "Response",
"runAfter": {
"HTTP": [
"Failed"
]
},
"inputs": {
"statusCode": "@outputs('HTTP')['statusCode']",
"body": "@body('HTTP')"
}
},
"Parse_JSON": {
"type": "ParseJson",
"runAfter": {
"HTTP": [
"Succeeded"
]
},
"inputs": {
"content": "@body('HTTP')",
"schema": {
"type": "array",
"items": {
"type": "object",
"properties": {
"name": {
"type": "string"
},
"url": {
"type": "string"
}
},
"required": [
"name",
"url"
]
}
}
}
},
"Condition": {
"type": "If",
"runAfter": {
"Parse_JSON": [
"Succeeded"
]
},
"expression": "@greater(length(body('Parse_JSON')), 0)",
"actions": {
"OkResponse": {
"type": "Response",
"runAfter": {},
"inputs": {
"statusCode": 200,
"body": "@body('Parse_JSON')"
}
}
},
"else": {
"actions": {
"NotFoundResponse": {
"type": "Response",
"runAfter": {},
"inputs": {
"statusCode": 404,
"body": {
"message": "Template not found"
}
}
}
}
}
}
},
"outputs": {}
},
"parameters": {}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment