-
-
Save justinyoo/1b20541f6e605981d801c9f0e3e9c219 to your computer and use it in GitHub Desktop.
Testing Serverless Applications - Part 2
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
{ | |
"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