Skip to content

Instantly share code, notes, and snippets.

@derek1ee
Last active April 24, 2018 17:29
Show Gist options
  • Select an option

  • Save derek1ee/65eee5655680f7ae13cae7573a24a226 to your computer and use it in GitHub Desktop.

Select an option

Save derek1ee/65eee5655680f7ae13cae7573a24a226 to your computer and use it in GitHub Desktop.
VideoIndexerTemplate
{
"$connections": {
"value": {
"azureblob_1": {
"connectionId": "",
"id": "/subscriptions/{0}/providers/Microsoft.Web/locations/{1}/managedApis/azureblob"
},
"azureeventgrid_1": {
"connectionId": "",
"id": "/subscriptions/{0}/providers/Microsoft.Web/locations/{1}/managedApis/azureeventgrid"
},
"videoindexer": {
"connectionId": "",
"id": "/subscriptions/{0}/providers/Microsoft.Web/locations/{1}/managedApis/videoindexer"
}
}
},
"definition": {
"$schema": "https://schema.management.azure.com/providers/Microsoft.Logic/schemas/2016-06-01/workflowdefinition.json#",
"actions": {
"Condition": {
"actions": {
"Compose": {
"inputs": "@{split(triggerBody()?['subject'], '/')?[4]}/@{split(triggerBody()?['subject'], '/')?[6]}",
"runAfter": {},
"type": "Compose"
},
"Create_SAS_URI_by_path": {
"inputs": {
"body": {
"Permissions": "Read"
},
"host": {
"connection": {
"name": "@parameters('$connections')['azureblob_1']['connectionId']"
}
},
"method": "post",
"path": "/datasets/default/CreateSharedLinkByPath",
"queries": {
"path": "@{outputs('Compose')}"
}
},
"runAfter": {
"Compose": [
"Succeeded"
]
},
"type": "ApiConnection"
},
"Upload_video_and_index_(using_a_URL)": {
"inputs": {
"host": {
"connection": {
"name": "@parameters('$connections')['videoindexer']['connectionId']"
}
},
"method": "post",
"path": "/Api/Partner/Breakdowns",
"queries": {
"name": "@{triggerBody()?['data']?['eTag']}",
"privacy": "Private",
"videoUrl": "@body('Create_SAS_URI_by_path')?['WebUrl']"
}
},
"runAfter": {
"Create_SAS_URI_by_path": [
"Succeeded"
]
},
"type": "ApiConnection"
}
},
"expression": {
"and": [
{
"equals": [
"@triggerBody()?['eventType']",
"Microsoft.Storage.BlobCreated"
]
}
]
},
"runAfter": {},
"type": "If"
}
},
"contentVersion": "1.0.0.0",
"outputs": {},
"parameters": {
"$connections": {
"defaultValue": {},
"type": "Object"
}
},
"triggers": {
"When_a_resource_event_occurs": {
"inputs": {
"body": {
"properties": {
"destination": {
"endpointType": "webhook",
"properties": {
"endpointUrl": "@{listCallbackUrl()}"
}
},
"filter": {
"subjectEndsWith": ".mov"
},
"topic": null
}
},
"host": {
"connection": {
"name": "@parameters('$connections')['azureeventgrid_1']['connectionId']"
}
},
"path": "/subscriptions//providers/@{encodeURIComponent('Microsoft.Storage.StorageAccounts')}/resource/eventSubscriptions",
"queries": {
"x-ms-api-version": "2017-09-15-preview"
}
},
"splitOn": "@triggerBody()",
"type": "ApiConnectionWebhook"
}
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment