Create a gist now

Instantly share code, notes, and snippets.

@justinyoo /workflow.json Secret
Created Jul 20, 2017

What would you like to do?
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