diff --git a/resources/backupTemplates/nodejs-4.x/templates/templates.json b/resources/backupTemplates/nodejs-4.x/templates/templates.json
index 7ab50c347..954ab94ce 100644
--- a/resources/backupTemplates/nodejs-4.x/templates/templates.json
+++ b/resources/backupTemplates/nodejs-4.x/templates/templates.json
@@ -1,4657 +1,4657 @@
[
- {
- "id": "BlobTrigger-CSharp",
- "runtime": "2",
- "files": {
- "readme.md": "# BlobTrigger - C#\r\n\r\nThe `BlobTrigger` makes it incredibly easy to react to new Blobs inside of Azure Blob Storage. This sample demonstrates a simple use case of processing data from a given Blob using C#.\r\n\r\n## How it works\r\n\r\nFor a `BlobTrigger` to work, you provide a path which dictates where the blobs are located inside your container, and can also help restrict the types of blobs you wish to return. For instance, you can set the path to `samples/{name}.png` to restrict the trigger to only the samples path and only blobs with \".png\" at the end of their name.\r\n\r\n## Learn more\r\n\r\n Documentation",
- "run.csx": "public static void Run(Stream myBlob, string name, ILogger log)\r\n{\r\n log.LogInformation($\"C# Blob trigger function Processed blob\\n Name:{name} \\n Size: {myBlob.Length} Bytes\");\r\n}\r\n",
- "sample.dat": "samples-workitems/workitem.txt"
- },
- "function": {
- "bindings": [
- {
- "name": "myBlob",
- "type": "blobTrigger",
- "direction": "in",
- "path": "samples-workitems/{name}",
- "connection": ""
- }
- ]
- },
- "metadata": {
- "defaultFunctionName": "BlobTrigger",
- "description": "$BlobTrigger_description",
- "name": "Azure Blob Storage trigger",
- "language": "C#",
- "category": [
- "$temp_category_core",
- "$temp_category_dataProcessing"
- ],
- "categoryStyle": "blob",
- "enabledInTryMode": true,
- "userPrompt": [
- "connection",
- "path"
- ]
- }
+ {
+ "id": "BlobTrigger-CSharp",
+ "runtime": "2",
+ "files": {
+ "readme.md": "# BlobTrigger - C#\r\n\r\nThe `BlobTrigger` makes it incredibly easy to react to new Blobs inside of Azure Blob Storage. This sample demonstrates a simple use case of processing data from a given Blob using C#.\r\n\r\n## How it works\r\n\r\nFor a `BlobTrigger` to work, you provide a path which dictates where the blobs are located inside your container, and can also help restrict the types of blobs you wish to return. For instance, you can set the path to `samples/{name}.png` to restrict the trigger to only the samples path and only blobs with \".png\" at the end of their name.\r\n\r\n## Learn more\r\n\r\n Documentation",
+ "run.csx": "public static void Run(Stream myBlob, string name, ILogger log)\r\n{\r\n log.LogInformation($\"C# Blob trigger function Processed blob\\n Name:{name} \\n Size: {myBlob.Length} Bytes\");\r\n}\r\n",
+ "sample.dat": "samples-workitems/workitem.txt"
},
- {
- "id": "BlobTrigger-Custom",
- "runtime": "2",
- "files": {},
- "function": {
- "bindings": [
- {
- "name": "myBlob",
- "type": "blobTrigger",
- "direction": "in",
- "path": "samples-workitems/{name}",
- "connection": ""
- }
- ]
- },
- "metadata": {
- "defaultFunctionName": "BlobTrigger",
- "description": "$BlobTrigger_description",
- "name": "Azure Blob Storage trigger",
- "language": "Custom",
- "category": [
- "$temp_category_core",
- "$temp_category_dataProcessing"
- ],
- "categoryStyle": "blob",
- "enabledInTryMode": true,
- "userPrompt": [
- "connection",
- "path"
- ]
+ "function": {
+ "bindings": [
+ {
+ "name": "myBlob",
+ "type": "blobTrigger",
+ "direction": "in",
+ "path": "samples-workitems/{name}",
+ "connection": ""
}
+ ]
},
- {
- "id": "BlobTrigger-JavaScript",
- "runtime": "2",
- "files": {
- "index.js": "module.exports = async function (context, myBlob) {\r\n context.log(\"JavaScript blob trigger function processed blob \\n Blob:\", context.bindingData.blobTrigger, \"\\n Blob Size:\", myBlob.length, \"Bytes\");\r\n};",
- "readme.md": "# BlobTrigger - JavaScript\r\n\r\nThe `BlobTrigger` makes it incredibly easy to react to new Blobs inside of Azure Blob Storage. This sample demonstrates a simple use case of processing data from a given Blob using JavaScript.\r\n\r\n## How it works\r\n\r\nFor a `BlobTrigger` to work, you provide a path which dictates where the blobs are located inside your container, and can also help restrict the types of blobs you wish to return. For instance, you can set the path to `samples/{name}.png` to restrict the trigger to only the samples path and only blobs with \".png\" at the end of their name.\r\n\r\n## Learn more\r\n\r\n Documentation",
- "sample.dat": "samples-workitems/workitem.txt"
- },
- "function": {
- "bindings": [
- {
- "name": "myBlob",
- "type": "blobTrigger",
- "direction": "in",
- "path": "samples-workitems/{name}",
- "connection": ""
- }
- ]
- },
- "metadata": {
- "defaultFunctionName": "BlobTrigger",
- "description": "$BlobTrigger_description",
- "name": "Azure Blob Storage trigger",
- "language": "JavaScript",
- "category": [
- "$temp_category_core",
- "$temp_category_dataProcessing"
- ],
- "categoryStyle": "blob",
- "enabledInTryMode": true,
- "userPrompt": [
- "connection",
- "path"
- ]
+ "metadata": {
+ "defaultFunctionName": "BlobTrigger",
+ "description": "$BlobTrigger_description",
+ "name": "Azure Blob Storage trigger",
+ "language": "C#",
+ "category": [
+ "$temp_category_core",
+ "$temp_category_dataProcessing"
+ ],
+ "categoryStyle": "blob",
+ "enabledInTryMode": true,
+ "userPrompt": [
+ "connection",
+ "path"
+ ]
+ }
+ },
+ {
+ "id": "BlobTrigger-Custom",
+ "runtime": "2",
+ "files": {},
+ "function": {
+ "bindings": [
+ {
+ "name": "myBlob",
+ "type": "blobTrigger",
+ "direction": "in",
+ "path": "samples-workitems/{name}",
+ "connection": ""
}
+ ]
},
- {
- "id": "BlobTrigger-JavaScript-4.x",
- "runtime": "2",
- "files": {
- "%functionName%.js": "const { app } = require('@azure/functions');\r\n\r\napp.storageBlob('%functionName%', {\r\n path: '%path%',\r\n connection: '%connection%',\r\n handler: (context, blob) => {\r\n context.log(`Storage blob function processed blob \"${context.triggerMetadata.name}\" with size ${blob.length} bytes`);\r\n }\r\n});\r\n"
- },
- "metadata": {
- "defaultFunctionName": "storageBlobTrigger",
- "description": "$BlobTrigger_description",
- "name": "Azure Blob Storage trigger",
- "language": "JavaScript",
- "triggerType": "blobTrigger",
- "category": [
- "$temp_category_core",
- "$temp_category_dataProcessing"
- ],
- "categoryStyle": "blob",
- "enabledInTryMode": true,
- "userPrompt": [
- "connection",
- "path"
- ]
- }
+ "metadata": {
+ "defaultFunctionName": "BlobTrigger",
+ "description": "$BlobTrigger_description",
+ "name": "Azure Blob Storage trigger",
+ "language": "Custom",
+ "category": [
+ "$temp_category_core",
+ "$temp_category_dataProcessing"
+ ],
+ "categoryStyle": "blob",
+ "enabledInTryMode": true,
+ "userPrompt": [
+ "connection",
+ "path"
+ ]
+ }
+ },
+ {
+ "id": "BlobTrigger-JavaScript",
+ "runtime": "2",
+ "files": {
+ "index.js": "module.exports = async function (context, myBlob) {\r\n context.log(\"JavaScript blob trigger function processed blob \\n Blob:\", context.bindingData.blobTrigger, \"\\n Blob Size:\", myBlob.length, \"Bytes\");\r\n};",
+ "readme.md": "# BlobTrigger - JavaScript\r\n\r\nThe `BlobTrigger` makes it incredibly easy to react to new Blobs inside of Azure Blob Storage. This sample demonstrates a simple use case of processing data from a given Blob using JavaScript.\r\n\r\n## How it works\r\n\r\nFor a `BlobTrigger` to work, you provide a path which dictates where the blobs are located inside your container, and can also help restrict the types of blobs you wish to return. For instance, you can set the path to `samples/{name}.png` to restrict the trigger to only the samples path and only blobs with \".png\" at the end of their name.\r\n\r\n## Learn more\r\n\r\n Documentation",
+ "sample.dat": "samples-workitems/workitem.txt"
},
- {
- "id": "BlobTrigger-PowerShell",
- "runtime": "2",
- "files": {
- "readme.md": "# BlobTrigger - PowerShell\r\n\r\nThe `BlobTrigger` makes it incredibly easy to react to new Blobs inside of [Azure Blob Storage](https://azure.microsoft.com/en-us/services/storage/blobs/).\r\nThis sample demonstrates a simple use case of processing data from a given Blob using PowerShell.\r\n\r\n## How it works\r\n\r\nFor a `BlobTrigger` to work, you provide a path which dictates where the blobs are located inside your container, and can also help restrict the types of blobs you wish to return. For instance, you can set the path to `samples/{name}.png` to restrict the trigger to only the samples path and only blobs with \".png\" at the end of their name.\r\n\r\n## Learn more\r\n\r\n Documentation\r\n",
- "run.ps1": "# Input bindings are passed in via param block.\r\nparam([byte[]] $InputBlob, $TriggerMetadata)\r\n\r\n# Write out the blob name and size to the information log.\r\nWrite-Host \"PowerShell Blob trigger function Processed blob! Name: $($TriggerMetadata.Name) Size: $($InputBlob.Length) bytes\"\r\n",
- "sample.dat": "samples-workitems/workitem.txt"
- },
- "function": {
- "bindings": [
- {
- "name": "InputBlob",
- "type": "blobTrigger",
- "direction": "in",
- "path": "samples-workitems/{name}",
- "connection": ""
- }
- ]
- },
- "metadata": {
- "defaultFunctionName": "BlobTrigger",
- "description": "$BlobTrigger_description",
- "name": "Azure Blob Storage trigger",
- "language": "PowerShell",
- "category": [
- "$temp_category_core",
- "$temp_category_dataProcessing"
- ],
- "categoryStyle": "blob",
- "enabledInTryMode": true,
- "userPrompt": [
- "connection",
- "path"
- ]
+ "function": {
+ "bindings": [
+ {
+ "name": "myBlob",
+ "type": "blobTrigger",
+ "direction": "in",
+ "path": "samples-workitems/{name}",
+ "connection": ""
}
+ ]
},
- {
- "id": "BlobTrigger-Python",
- "runtime": "2",
- "files": {
- "readme.md": "# BlobTrigger - Python\r\n\r\nThe `BlobTrigger` makes it incredibly easy to react to new Blobs inside of Azure Blob Storage. This sample demonstrates a simple use case of processing data from a given Blob using Python.\r\n\r\n## How it works\r\n\r\nFor a `BlobTrigger` to work, you provide a path which dictates where the blobs are located inside your container, and can also help restrict the types of blobs you wish to return. For instance, you can set the path to `samples/{name}.png` to restrict the trigger to only the samples path and only blobs with \".png\" at the end of their name.\r\n\r\n## Learn more\r\n\r\n Documentation",
- "sample.dat": "samples-workitems/workitem.txt",
- "__init__.py": "import logging\r\n\r\nimport azure.functions as func\r\n\r\n\r\ndef main(myblob: func.InputStream):\r\n logging.info(f\"Python blob trigger function processed blob \\n\"\r\n f\"Name: {myblob.name}\\n\"\r\n f\"Blob Size: {myblob.length} bytes\")\r\n"
- },
- "function": {
- "scriptFile": "__init__.py",
- "bindings": [
- {
- "name": "myblob",
- "type": "blobTrigger",
- "direction": "in",
- "path": "samples-workitems/{name}",
- "connection": ""
- }
- ]
- },
- "metadata": {
- "defaultFunctionName": "BlobTrigger",
- "description": "$BlobTrigger_description",
- "name": "Azure Blob Storage trigger",
- "language": "Python",
- "category": [
- "$temp_category_core",
- "$temp_category_dataProcessing"
- ],
- "categoryStyle": "blob",
- "enabledInTryMode": true,
- "userPrompt": [
- "connection",
- "path"
- ],
- "filters": [
- "Python3"
- ]
- }
+ "metadata": {
+ "defaultFunctionName": "BlobTrigger",
+ "description": "$BlobTrigger_description",
+ "name": "Azure Blob Storage trigger",
+ "language": "JavaScript",
+ "category": [
+ "$temp_category_core",
+ "$temp_category_dataProcessing"
+ ],
+ "categoryStyle": "blob",
+ "enabledInTryMode": true,
+ "userPrompt": [
+ "connection",
+ "path"
+ ]
+ }
+ },
+ {
+ "id": "BlobTrigger-JavaScript-4.x",
+ "runtime": "2",
+ "files": {
+ "%functionName%.js": "const { app } = require('@azure/functions');\r\n\r\napp.storageBlob('%functionName%', {\r\n path: '%path%',\r\n connection: '%connection%',\r\n handler: (blob, context) => {\r\n context.log(`Storage blob function processed blob \"${context.triggerMetadata.name}\" with size ${blob.length} bytes`);\r\n }\r\n});\r\n"
},
- {
- "id": "BlobTrigger-TypeScript",
- "runtime": "2",
- "files": {
- "index.ts": "import { AzureFunction, Context } from \"@azure/functions\"\r\n\r\nconst blobTrigger: AzureFunction = async function (context: Context, myBlob: any): Promise {\r\n context.log(\"Blob trigger function processed blob \\n Name:\", context.bindingData.name, \"\\n Blob Size:\", myBlob.length, \"Bytes\");\r\n};\r\n\r\nexport default blobTrigger;\r\n",
- "readme.md": "# BlobTrigger - TypeScript\r\n\r\nThe `BlobTrigger` makes it incredibly easy to react to new Blobs inside of Azure Blob Storage. This sample demonstrates a simple use case of processing data from a given Blob using TypeScript.\r\n\r\n## How it works\r\n\r\nFor a `BlobTrigger` to work, you provide a path which dictates where the blobs are located inside your container, and can also help restrict the types of blobs you wish to return. For instance, you can set the path to `samples/{name}.png` to restrict the trigger to only the samples path and only blobs with \".png\" at the end of their name.\r\n\r\n## Learn more\r\n\r\n Documentation",
- "sample.dat": "samples-workitems/workitem.txt"
- },
- "function": {
- "bindings": [
- {
- "name": "myBlob",
- "type": "blobTrigger",
- "direction": "in",
- "path": "samples-workitems/{name}",
- "connection": ""
- }
- ]
- },
- "metadata": {
- "defaultFunctionName": "BlobTrigger",
- "description": "$BlobTrigger_description",
- "name": "Azure Blob Storage trigger",
- "language": "TypeScript",
- "category": [
- "$temp_category_core",
- "$temp_category_dataProcessing"
- ],
- "categoryStyle": "blob",
- "enabledInTryMode": true,
- "userPrompt": [
- "connection",
- "path"
- ]
- }
+ "metadata": {
+ "defaultFunctionName": "storageBlobTrigger",
+ "description": "$BlobTrigger_description",
+ "name": "Azure Blob Storage trigger",
+ "language": "JavaScript",
+ "triggerType": "blobTrigger",
+ "category": [
+ "$temp_category_core",
+ "$temp_category_dataProcessing"
+ ],
+ "categoryStyle": "blob",
+ "enabledInTryMode": true,
+ "userPrompt": [
+ "connection",
+ "path"
+ ]
+ }
+ },
+ {
+ "id": "BlobTrigger-PowerShell",
+ "runtime": "2",
+ "files": {
+ "readme.md": "# BlobTrigger - PowerShell\r\n\r\nThe `BlobTrigger` makes it incredibly easy to react to new Blobs inside of [Azure Blob Storage](https://azure.microsoft.com/en-us/services/storage/blobs/).\r\nThis sample demonstrates a simple use case of processing data from a given Blob using PowerShell.\r\n\r\n## How it works\r\n\r\nFor a `BlobTrigger` to work, you provide a path which dictates where the blobs are located inside your container, and can also help restrict the types of blobs you wish to return. For instance, you can set the path to `samples/{name}.png` to restrict the trigger to only the samples path and only blobs with \".png\" at the end of their name.\r\n\r\n## Learn more\r\n\r\n Documentation\r\n",
+ "run.ps1": "# Input bindings are passed in via param block.\r\nparam([byte[]] $InputBlob, $TriggerMetadata)\r\n\r\n# Write out the blob name and size to the information log.\r\nWrite-Host \"PowerShell Blob trigger function Processed blob! Name: $($TriggerMetadata.Name) Size: $($InputBlob.Length) bytes\"\r\n",
+ "sample.dat": "samples-workitems/workitem.txt"
},
- {
- "id": "BlobTrigger-TypeScript-4.x",
- "runtime": "2",
- "files": {
- "%functionName%.ts": "import { app, InvocationContext } from \"@azure/functions\";\r\n\r\nexport async function %functionName%(context: InvocationContext, blob: Buffer): Promise {\r\n context.log(`Storage blob function processed blob \"${context.triggerMetadata.name}\" with size ${blob.length} bytes`);\r\n}\r\n\r\napp.storageBlob('%functionName%', {\r\n path: '%path%',\r\n connection: '%connection%',\r\n handler: %functionName%\r\n});\r\n"
- },
- "metadata": {
- "defaultFunctionName": "storageBlobTrigger",
- "description": "$BlobTrigger_description",
- "name": "Azure Blob Storage trigger",
- "language": "TypeScript",
- "triggerType": "blobTrigger",
- "category": [
- "$temp_category_core",
- "$temp_category_dataProcessing"
- ],
- "categoryStyle": "blob",
- "enabledInTryMode": true,
- "userPrompt": [
- "connection",
- "path"
- ]
+ "function": {
+ "bindings": [
+ {
+ "name": "InputBlob",
+ "type": "blobTrigger",
+ "direction": "in",
+ "path": "samples-workitems/{name}",
+ "connection": ""
}
+ ]
},
- {
- "id": "CosmosDBTrigger-CSharp",
- "runtime": "2",
- "files": {
- "run.csx": "#r \"Microsoft.Azure.DocumentDB.Core\"\r\nusing System;\r\nusing System.Collections.Generic;\r\nusing Microsoft.Azure.Documents;\r\n\r\npublic static void Run(IReadOnlyList input, ILogger log)\r\n{\r\n if (input != null && input.Count > 0)\r\n {\r\n log.LogInformation(\"Documents modified \" + input.Count);\r\n log.LogInformation(\"First document Id \" + input[0].Id);\r\n }\r\n}\r\n"
- },
- "function": {
- "bindings": [
- {
- "type": "cosmosDBTrigger",
- "name": "input",
- "direction": "in",
- "connectionStringSetting": "",
- "databaseName": "",
- "collectionName": "",
- "leaseCollectionName": "leases",
- "createLeaseCollectionIfNotExists": true
- }
- ]
- },
- "metadata": {
- "defaultFunctionName": "CosmosTrigger",
- "description": "$CosmosDBTrigger_description",
- "name": "Azure Cosmos DB trigger",
- "language": "C#",
- "category": [
- "$temp_category_core",
- "$temp_category_dataProcessing"
- ],
- "categoryStyle": "cosmosDB",
- "enabledInTryMode": false,
- "userPrompt": [
- "connectionStringSetting",
- "databaseName",
- "collectionName",
- "leaseCollectionName",
- "createLeaseCollectionIfNotExists"
- ]
- }
+ "metadata": {
+ "defaultFunctionName": "BlobTrigger",
+ "description": "$BlobTrigger_description",
+ "name": "Azure Blob Storage trigger",
+ "language": "PowerShell",
+ "category": [
+ "$temp_category_core",
+ "$temp_category_dataProcessing"
+ ],
+ "categoryStyle": "blob",
+ "enabledInTryMode": true,
+ "userPrompt": [
+ "connection",
+ "path"
+ ]
+ }
+ },
+ {
+ "id": "BlobTrigger-Python",
+ "runtime": "2",
+ "files": {
+ "readme.md": "# BlobTrigger - Python\r\n\r\nThe `BlobTrigger` makes it incredibly easy to react to new Blobs inside of Azure Blob Storage. This sample demonstrates a simple use case of processing data from a given Blob using Python.\r\n\r\n## How it works\r\n\r\nFor a `BlobTrigger` to work, you provide a path which dictates where the blobs are located inside your container, and can also help restrict the types of blobs you wish to return. For instance, you can set the path to `samples/{name}.png` to restrict the trigger to only the samples path and only blobs with \".png\" at the end of their name.\r\n\r\n## Learn more\r\n\r\n Documentation",
+ "sample.dat": "samples-workitems/workitem.txt",
+ "__init__.py": "import logging\r\n\r\nimport azure.functions as func\r\n\r\n\r\ndef main(myblob: func.InputStream):\r\n logging.info(f\"Python blob trigger function processed blob \\n\"\r\n f\"Name: {myblob.name}\\n\"\r\n f\"Blob Size: {myblob.length} bytes\")\r\n"
},
- {
- "id": "CosmosDBTrigger-Custom",
- "runtime": "2",
- "files": {},
- "function": {
- "bindings": [
- {
- "type": "cosmosDBTrigger",
- "name": "documents",
- "direction": "in",
- "leaseCollectionName": "leases",
- "connectionStringSetting": "",
- "databaseName": "",
- "collectionName": "",
- "createLeaseCollectionIfNotExists": true
- }
- ]
- },
- "metadata": {
- "defaultFunctionName": "CosmosTrigger",
- "description": "$CosmosDBTrigger_description",
- "name": "Azure Cosmos DB trigger",
- "language": "Custom",
- "category": [
- "$temp_category_core",
- "$temp_category_dataProcessing"
- ],
- "categoryStyle": "cosmosDB",
- "enabledInTryMode": false,
- "userPrompt": [
- "connectionStringSetting",
- "databaseName",
- "collectionName",
- "leaseCollectionName",
- "createLeaseCollectionIfNotExists"
- ]
+ "function": {
+ "scriptFile": "__init__.py",
+ "bindings": [
+ {
+ "name": "myblob",
+ "type": "blobTrigger",
+ "direction": "in",
+ "path": "samples-workitems/{name}",
+ "connection": ""
}
+ ]
},
- {
- "id": "CosmosDBTrigger-JavaScript",
- "runtime": "2",
- "files": {
- "index.js": "module.exports = async function (context, documents) {\r\n if (!!documents && documents.length > 0) {\r\n context.log('Document Id: ', documents[0].id);\r\n }\r\n}\r\n",
- "sample.dat": "[\r\n\t{\r\n\t\t\"id\": \"sample\"\r\n\t}\r\n]"
- },
- "function": {
- "bindings": [
- {
- "type": "cosmosDBTrigger",
- "name": "documents",
- "direction": "in",
- "leaseCollectionName": "leases",
- "connectionStringSetting": "",
- "databaseName": "",
- "collectionName": "",
- "createLeaseCollectionIfNotExists": true
- }
- ]
- },
- "metadata": {
- "defaultFunctionName": "CosmosTrigger",
- "description": "$CosmosDBTrigger_description",
- "name": "Azure Cosmos DB trigger",
- "language": "JavaScript",
- "category": [
- "$temp_category_core",
- "$temp_category_dataProcessing"
- ],
- "categoryStyle": "cosmosDB",
- "enabledInTryMode": false,
- "userPrompt": [
- "connectionStringSetting",
- "databaseName",
- "collectionName",
- "leaseCollectionName",
- "createLeaseCollectionIfNotExists"
- ]
- }
+ "metadata": {
+ "defaultFunctionName": "BlobTrigger",
+ "description": "$BlobTrigger_description",
+ "name": "Azure Blob Storage trigger",
+ "language": "Python",
+ "category": [
+ "$temp_category_core",
+ "$temp_category_dataProcessing"
+ ],
+ "categoryStyle": "blob",
+ "enabledInTryMode": true,
+ "userPrompt": [
+ "connection",
+ "path"
+ ],
+ "filters": [
+ "Python3"
+ ]
+ }
+ },
+ {
+ "id": "BlobTrigger-TypeScript",
+ "runtime": "2",
+ "files": {
+ "index.ts": "import { AzureFunction, Context } from \"@azure/functions\"\r\n\r\nconst blobTrigger: AzureFunction = async function (context: Context, myBlob: any): Promise {\r\n context.log(\"Blob trigger function processed blob \\n Name:\", context.bindingData.name, \"\\n Blob Size:\", myBlob.length, \"Bytes\");\r\n};\r\n\r\nexport default blobTrigger;\r\n",
+ "readme.md": "# BlobTrigger - TypeScript\r\n\r\nThe `BlobTrigger` makes it incredibly easy to react to new Blobs inside of Azure Blob Storage. This sample demonstrates a simple use case of processing data from a given Blob using TypeScript.\r\n\r\n## How it works\r\n\r\nFor a `BlobTrigger` to work, you provide a path which dictates where the blobs are located inside your container, and can also help restrict the types of blobs you wish to return. For instance, you can set the path to `samples/{name}.png` to restrict the trigger to only the samples path and only blobs with \".png\" at the end of their name.\r\n\r\n## Learn more\r\n\r\n Documentation",
+ "sample.dat": "samples-workitems/workitem.txt"
},
- {
- "id": "CosmosDBTrigger-JavaScript-4.x",
- "runtime": "2",
- "files": {
- "%functionName%.js": "const { app } = require('@azure/functions');\r\n\r\napp.cosmosDB('%functionName%', {\r\n connectionStringSetting: '%connectionStringSetting%',\r\n databaseName: '%databaseName%',\r\n collectionName: '%collectionName%',\r\n createLeaseCollectionIfNotExists: %createLeaseCollectionIfNotExists%,\r\n handler: (context, documents) => {\r\n context.log(`Cosmos DB function processed ${documents.length} documents`);\r\n }\r\n});\r\n"
- },
- "metadata": {
- "defaultFunctionName": "cosmosDBTrigger",
- "description": "$CosmosDBTrigger_description",
- "name": "Azure Cosmos DB trigger",
- "language": "JavaScript",
- "triggerType": "cosmosDBTrigger",
- "category": [
- "$temp_category_core",
- "$temp_category_dataProcessing"
- ],
- "categoryStyle": "cosmosDB",
- "enabledInTryMode": false,
- "userPrompt": [
- "connectionStringSetting",
- "databaseName",
- "collectionName",
- "createLeaseCollectionIfNotExists"
- ]
+ "function": {
+ "bindings": [
+ {
+ "name": "myBlob",
+ "type": "blobTrigger",
+ "direction": "in",
+ "path": "samples-workitems/{name}",
+ "connection": ""
}
+ ]
},
- {
- "id": "CosmosDBTrigger-PowerShell",
- "runtime": "2",
- "files": {
- "run.ps1": "# Input bindings are passed in via param block.\r\nparam($Documents, $TriggerMetadata)\r\n\r\nif ($Documents.Count -gt 0) {\r\n Write-Host \"Document Id: $($Documents[0].id)\"\r\n}\r\n",
- "sample.dat": "[\r\n\t{\r\n\t\t\"id\": \"sample\"\r\n\t}\r\n]\r\n"
- },
- "function": {
- "bindings": [
- {
- "type": "cosmosDBTrigger",
- "name": "Documents",
- "direction": "in",
- "leaseCollectionName": "leases",
- "connectionStringSetting": "",
- "databaseName": "",
- "collectionName": "",
- "createLeaseCollectionIfNotExists": true
- }
- ]
- },
- "metadata": {
- "defaultFunctionName": "CosmosTrigger",
- "description": "$CosmosDBTrigger_description",
- "name": "Azure Cosmos DB trigger",
- "language": "PowerShell",
- "category": [
- "$temp_category_core",
- "$temp_category_dataProcessing"
- ],
- "categoryStyle": "cosmosDB",
- "enabledInTryMode": false,
- "userPrompt": [
- "connectionStringSetting",
- "databaseName",
- "collectionName",
- "leaseCollectionName",
- "createLeaseCollectionIfNotExists"
- ]
- }
+ "metadata": {
+ "defaultFunctionName": "BlobTrigger",
+ "description": "$BlobTrigger_description",
+ "name": "Azure Blob Storage trigger",
+ "language": "TypeScript",
+ "category": [
+ "$temp_category_core",
+ "$temp_category_dataProcessing"
+ ],
+ "categoryStyle": "blob",
+ "enabledInTryMode": true,
+ "userPrompt": [
+ "connection",
+ "path"
+ ]
+ }
+ },
+ {
+ "id": "BlobTrigger-TypeScript-4.x",
+ "runtime": "2",
+ "files": {
+ "%functionName%.ts": "import { app, InvocationContext } from \"@azure/functions\";\r\n\r\nexport async function %functionName%(blob: Buffer, context: InvocationContext): Promise {\r\n context.log(`Storage blob function processed blob \"${context.triggerMetadata.name}\" with size ${blob.length} bytes`);\r\n}\r\n\r\napp.storageBlob('%functionName%', {\r\n path: '%path%',\r\n connection: '%connection%',\r\n handler: %functionName%\r\n});\r\n"
},
- {
- "id": "CosmosDBTrigger-Python",
- "runtime": "2",
- "files": {
- "sample.dat": "[\r\n\t{\r\n\t\t\"id\": \"sample\"\r\n\t}\r\n]",
- "__init__.py": "import logging\r\n\r\nimport azure.functions as func\r\n\r\n\r\ndef main(documents: func.DocumentList) -> str:\r\n if documents:\r\n logging.info('Document id: %s', documents[0]['id'])\r\n"
- },
- "function": {
- "scriptFile": "__init__.py",
- "bindings": [
- {
- "type": "cosmosDBTrigger",
- "name": "documents",
- "direction": "in",
- "leaseCollectionName": "leases",
- "connectionStringSetting": "",
- "databaseName": "",
- "collectionName": "",
- "createLeaseCollectionIfNotExists": true
- }
- ]
- },
- "metadata": {
- "defaultFunctionName": "CosmosTrigger",
- "description": "$CosmosDBTrigger_description",
- "name": "Azure Cosmos DB trigger",
- "language": "Python",
- "category": [
- "$temp_category_core",
- "$temp_category_dataProcessing"
- ],
- "categoryStyle": "cosmosDB",
- "enabledInTryMode": false,
- "userPrompt": [
- "connectionStringSetting",
- "databaseName",
- "collectionName",
- "leaseCollectionName",
- "createLeaseCollectionIfNotExists"
- ],
- "filters": [
- "Python3"
- ]
- }
+ "metadata": {
+ "defaultFunctionName": "storageBlobTrigger",
+ "description": "$BlobTrigger_description",
+ "name": "Azure Blob Storage trigger",
+ "language": "TypeScript",
+ "triggerType": "blobTrigger",
+ "category": [
+ "$temp_category_core",
+ "$temp_category_dataProcessing"
+ ],
+ "categoryStyle": "blob",
+ "enabledInTryMode": true,
+ "userPrompt": [
+ "connection",
+ "path"
+ ]
+ }
+ },
+ {
+ "id": "CosmosDBTrigger-CSharp",
+ "runtime": "2",
+ "files": {
+ "run.csx": "#r \"Microsoft.Azure.DocumentDB.Core\"\r\nusing System;\r\nusing System.Collections.Generic;\r\nusing Microsoft.Azure.Documents;\r\n\r\npublic static void Run(IReadOnlyList input, ILogger log)\r\n{\r\n if (input != null && input.Count > 0)\r\n {\r\n log.LogInformation(\"Documents modified \" + input.Count);\r\n log.LogInformation(\"First document Id \" + input[0].Id);\r\n }\r\n}\r\n"
},
- {
- "id": "CosmosDBTrigger-TypeScript",
- "runtime": "2",
- "files": {
- "index.ts": "import { AzureFunction, Context } from \"@azure/functions\"\r\n\r\nconst cosmosDBTrigger: AzureFunction = async function (context: Context, documents: any[]): Promise {\r\n if (!!documents && documents.length > 0) {\r\n context.log('Document Id: ', documents[0].id);\r\n }\r\n}\r\n\r\nexport default cosmosDBTrigger;\r\n",
- "sample.dat": "[\r\n\t{\r\n\t\t\"id\": \"sample\"\r\n\t}\r\n]"
- },
- "function": {
- "bindings": [
- {
- "type": "cosmosDBTrigger",
- "name": "documents",
- "direction": "in",
- "leaseCollectionName": "leases",
- "connectionStringSetting": "",
- "databaseName": "",
- "collectionName": "",
- "createLeaseCollectionIfNotExists": true
- }
- ]
- },
- "metadata": {
- "defaultFunctionName": "CosmosTrigger",
- "description": "$CosmosDBTrigger_description",
- "name": "Azure Cosmos DB trigger",
- "language": "TypeScript",
- "category": [
- "$temp_category_core",
- "$temp_category_dataProcessing"
- ],
- "categoryStyle": "cosmosDB",
- "enabledInTryMode": false,
- "userPrompt": [
- "connectionStringSetting",
- "databaseName",
- "collectionName",
- "leaseCollectionName",
- "createLeaseCollectionIfNotExists"
- ]
+ "function": {
+ "bindings": [
+ {
+ "type": "cosmosDBTrigger",
+ "name": "input",
+ "direction": "in",
+ "connectionStringSetting": "",
+ "databaseName": "",
+ "collectionName": "",
+ "leaseCollectionName": "leases",
+ "createLeaseCollectionIfNotExists": true
}
+ ]
},
- {
- "id": "CosmosDBTrigger-TypeScript-4.x",
- "runtime": "2",
- "files": {
- "%functionName%.ts": "import { app, InvocationContext } from \"@azure/functions\";\r\n\r\nexport async function %functionName%(context: InvocationContext, documents: unknown[]): Promise {\r\n context.log(`Cosmos DB function processed ${documents.length} documents`);\r\n}\r\n\r\napp.cosmosDB('%functionName%', {\r\n connectionStringSetting: '%connectionStringSetting%',\r\n databaseName: '%databaseName%',\r\n collectionName: '%collectionName%',\r\n createLeaseCollectionIfNotExists: %createLeaseCollectionIfNotExists%,\r\n handler: %functionName%\r\n});\r\n"
- },
- "metadata": {
- "defaultFunctionName": "cosmosDBTrigger",
- "description": "$CosmosDBTrigger_description",
- "name": "Azure Cosmos DB trigger",
- "language": "TypeScript",
- "triggerType": "cosmosDBTrigger",
- "category": [
- "$temp_category_core",
- "$temp_category_dataProcessing"
- ],
- "categoryStyle": "cosmosDB",
- "enabledInTryMode": false,
- "userPrompt": [
- "connectionStringSetting",
- "databaseName",
- "collectionName",
- "createLeaseCollectionIfNotExists"
- ]
+ "metadata": {
+ "defaultFunctionName": "CosmosTrigger",
+ "description": "$CosmosDBTrigger_description",
+ "name": "Azure Cosmos DB trigger",
+ "language": "C#",
+ "category": [
+ "$temp_category_core",
+ "$temp_category_dataProcessing"
+ ],
+ "categoryStyle": "cosmosDB",
+ "enabledInTryMode": false,
+ "userPrompt": [
+ "connectionStringSetting",
+ "databaseName",
+ "collectionName",
+ "leaseCollectionName",
+ "createLeaseCollectionIfNotExists"
+ ]
+ }
+ },
+ {
+ "id": "CosmosDBTrigger-Custom",
+ "runtime": "2",
+ "files": {},
+ "function": {
+ "bindings": [
+ {
+ "type": "cosmosDBTrigger",
+ "name": "documents",
+ "direction": "in",
+ "leaseCollectionName": "leases",
+ "connectionStringSetting": "",
+ "databaseName": "",
+ "collectionName": "",
+ "createLeaseCollectionIfNotExists": true
}
+ ]
},
- {
- "id": "DurableFunctionsActivity-CSharp",
- "runtime": "2",
- "files": {
- "run.csx": "/*\r\n * This function is not intended to be invoked directly. Instead it will be\r\n * triggered by an orchestrator function.\r\n * \r\n * Before running this sample, please:\r\n * - create a Durable orchestration function\r\n * - create a Durable HTTP starter function\r\n */\r\n\r\n#r \"Microsoft.Azure.WebJobs.Extensions.DurableTask\"\r\n\r\nusing Microsoft.Azure.WebJobs.Extensions.DurableTask;\r\n\r\npublic static string Run(string name)\r\n{\r\n return $\"Hello {name}!\";\r\n}"
- },
- "function": {
- "bindings": [
- {
- "name": "name",
- "type": "activityTrigger",
- "direction": "in"
- }
- ]
- },
- "metadata": {
- "defaultFunctionName": "Hello",
- "description": "$DurableFunctionsActivity_description",
- "name": "Durable Functions activity",
- "language": "C#",
- "category": [
- "$temp_category_core",
- "$temp_category_durableFunctions"
- ],
- "categoryStyle": "other",
- "enabledInTryMode": false,
- "userPrompt": []
- }
+ "metadata": {
+ "defaultFunctionName": "CosmosTrigger",
+ "description": "$CosmosDBTrigger_description",
+ "name": "Azure Cosmos DB trigger",
+ "language": "Custom",
+ "category": [
+ "$temp_category_core",
+ "$temp_category_dataProcessing"
+ ],
+ "categoryStyle": "cosmosDB",
+ "enabledInTryMode": false,
+ "userPrompt": [
+ "connectionStringSetting",
+ "databaseName",
+ "collectionName",
+ "leaseCollectionName",
+ "createLeaseCollectionIfNotExists"
+ ]
+ }
+ },
+ {
+ "id": "CosmosDBTrigger-JavaScript",
+ "runtime": "2",
+ "files": {
+ "index.js": "module.exports = async function (context, documents) {\r\n if (!!documents && documents.length > 0) {\r\n context.log('Document Id: ', documents[0].id);\r\n }\r\n}\r\n",
+ "sample.dat": "[\r\n\t{\r\n\t\t\"id\": \"sample\"\r\n\t}\r\n]"
},
- {
- "id": "DurableFunctionsActivity-JavaScript",
- "runtime": "2",
- "files": {
- "index.js": "/*\r\n * This function is not intended to be invoked directly. Instead it will be\r\n * triggered by an orchestrator function.\r\n * \r\n * Before running this sample, please:\r\n * - create a Durable orchestration function\r\n * - create a Durable HTTP starter function\r\n * - run 'npm install durable-functions' from the wwwroot folder of your\r\n * function app in Kudu\r\n */\r\n\r\nmodule.exports = async function (context) {\r\n return `Hello ${context.bindings.name}!`;\r\n};"
- },
- "function": {
- "bindings": [
- {
- "name": "name",
- "type": "activityTrigger",
- "direction": "in"
- }
- ]
- },
- "metadata": {
- "defaultFunctionName": "Hello",
- "description": "$DurableFunctionsActivity_description",
- "name": "Durable Functions activity",
- "language": "JavaScript",
- "category": [
- "$temp_category_core",
- "$temp_category_durableFunctions"
- ],
- "categoryStyle": "other",
- "enabledInTryMode": false,
- "userPrompt": []
+ "function": {
+ "bindings": [
+ {
+ "type": "cosmosDBTrigger",
+ "name": "documents",
+ "direction": "in",
+ "leaseCollectionName": "leases",
+ "connectionStringSetting": "",
+ "databaseName": "",
+ "collectionName": "",
+ "createLeaseCollectionIfNotExists": true
}
+ ]
},
- {
- "id": "DurableFunctionsActivity-PowerShell",
- "runtime": "2",
- "files": {
- "run.ps1": "param($name)\r\n\r\n\"Hello $name!\"\r\n"
- },
- "function": {
- "bindings": [
- {
- "name": "name",
- "type": "activityTrigger",
- "direction": "in"
- }
- ]
- },
- "metadata": {
- "defaultFunctionName": "Hello",
- "description": "$DurableFunctionsActivity_description",
- "name": "Durable Functions activity",
- "language": "PowerShell",
- "category": [
- "$temp_category_core",
- "$temp_category_durableFunctions"
- ],
- "categoryStyle": "other",
- "enabledInTryMode": false,
- "userPrompt": []
- }
+ "metadata": {
+ "defaultFunctionName": "CosmosTrigger",
+ "description": "$CosmosDBTrigger_description",
+ "name": "Azure Cosmos DB trigger",
+ "language": "JavaScript",
+ "category": [
+ "$temp_category_core",
+ "$temp_category_dataProcessing"
+ ],
+ "categoryStyle": "cosmosDB",
+ "enabledInTryMode": false,
+ "userPrompt": [
+ "connectionStringSetting",
+ "databaseName",
+ "collectionName",
+ "leaseCollectionName",
+ "createLeaseCollectionIfNotExists"
+ ]
+ }
+ },
+ {
+ "id": "CosmosDBTrigger-JavaScript-4.x",
+ "runtime": "2",
+ "files": {
+ "%functionName%.js": "const { app } = require('@azure/functions');\r\n\r\napp.cosmosDB('%functionName%', {\r\n connectionStringSetting: '%connectionStringSetting%',\r\n databaseName: '%databaseName%',\r\n collectionName: '%collectionName%',\r\n createLeaseCollectionIfNotExists: %createLeaseCollectionIfNotExists%,\r\n handler: (documents, context) => {\r\n context.log(`Cosmos DB function processed ${documents.length} documents`);\r\n }\r\n});\r\n"
},
- {
- "id": "DurableFunctionsActivity-Python",
- "runtime": "2",
- "files": {
- "__init__.py": "# This function is not intended to be invoked directly. Instead it will be\r\n# triggered by an orchestrator function.\r\n# Before running this sample, please:\r\n# - create a Durable orchestration function\r\n# - create a Durable HTTP starter function\r\n# - add azure-functions-durable to requirements.txt\r\n# - run pip install -r requirements.txt\r\n\r\nimport logging\r\n\r\n\r\ndef main(name: str) -> str:\r\n return f\"Hello {name}!\"\r\n"
- },
- "function": {
- "scriptFile": "__init__.py",
- "bindings": [
- {
- "name": "name",
- "type": "activityTrigger",
- "direction": "in"
- }
- ]
- },
- "metadata": {
- "defaultFunctionName": "Hello",
- "description": "$DurableFunctionsActivity_description",
- "name": "Durable Functions activity",
- "language": "Python",
- "category": [
- "$temp_category_core",
- "$temp_category_durableFunctions"
- ],
- "categoryStyle": "other",
- "enabledInTryMode": false,
- "userPrompt": []
- }
+ "metadata": {
+ "defaultFunctionName": "cosmosDBTrigger",
+ "description": "$CosmosDBTrigger_description",
+ "name": "Azure Cosmos DB trigger",
+ "language": "JavaScript",
+ "triggerType": "cosmosDBTrigger",
+ "category": [
+ "$temp_category_core",
+ "$temp_category_dataProcessing"
+ ],
+ "categoryStyle": "cosmosDB",
+ "enabledInTryMode": false,
+ "userPrompt": [
+ "connectionStringSetting",
+ "databaseName",
+ "collectionName",
+ "createLeaseCollectionIfNotExists"
+ ]
+ }
+ },
+ {
+ "id": "CosmosDBTrigger-PowerShell",
+ "runtime": "2",
+ "files": {
+ "run.ps1": "# Input bindings are passed in via param block.\r\nparam($Documents, $TriggerMetadata)\r\n\r\nif ($Documents.Count -gt 0) {\r\n Write-Host \"Document Id: $($Documents[0].id)\"\r\n}\r\n",
+ "sample.dat": "[\r\n\t{\r\n\t\t\"id\": \"sample\"\r\n\t}\r\n]\r\n"
},
- {
- "id": "DurableFunctionsActivity-TypeScript",
- "runtime": "2",
- "files": {
- "index.ts": "/*\r\n * This function is not intended to be invoked directly. Instead it will be\r\n * triggered by an orchestrator function.\r\n * \r\n * Before running this sample, please:\r\n * - create a Durable orchestration function\r\n * - create a Durable HTTP starter function\r\n * - run 'npm install durable-functions' from the wwwroot folder of your\r\n * function app in Kudu\r\n */\r\n\r\nimport { AzureFunction, Context } from \"@azure/functions\"\r\n\r\nconst activityFunction: AzureFunction = async function (context: Context): Promise {\r\n return `Hello ${context.bindings.name}!`;\r\n};\r\n\r\nexport default activityFunction;\r\n"
- },
- "function": {
- "bindings": [
- {
- "name": "name",
- "type": "activityTrigger",
- "direction": "in"
- }
- ]
- },
- "metadata": {
- "defaultFunctionName": "Hello",
- "description": "$DurableFunctionsActivity_description",
- "name": "Durable Functions activity",
- "language": "TypeScript",
- "category": [
- "$temp_category_core",
- "$temp_category_durableFunctions"
- ],
- "categoryStyle": "other",
- "enabledInTryMode": false,
- "userPrompt": []
+ "function": {
+ "bindings": [
+ {
+ "type": "cosmosDBTrigger",
+ "name": "Documents",
+ "direction": "in",
+ "leaseCollectionName": "leases",
+ "connectionStringSetting": "",
+ "databaseName": "",
+ "collectionName": "",
+ "createLeaseCollectionIfNotExists": true
}
+ ]
},
- {
- "id": "DurableFunctionsEntity-JavaScript",
- "runtime": "2",
- "files": {
- "index.js": "/*\r\n* This function is not intended to be invoked directly. Instead it will be\r\n* triggered by a client function.\r\n* \r\n* Before running this sample, please:\r\n* - create a Durable entity HTTP function\r\n* - run 'npm install durable-functions' from the root of your app\r\n*/\r\n\r\nconst df = require(\"durable-functions\");\r\n\r\nmodule.exports = df.entity(function (context) {\r\n const currentValue = context.df.getState(() => 0);\r\n switch (context.df.operationName) {\r\n case \"add\":\r\n const amount = context.df.getInput();\r\n context.df.setState(currentValue + amount);\r\n break;\r\n case \"reset\":\r\n context.df.setState(0);\r\n break;\r\n case \"get\":\r\n context.df.return(currentValue);\r\n break;\r\n }\r\n});"
- },
- "function": {
- "bindings": [
- {
- "name": "context",
- "type": "entityTrigger",
- "direction": "in"
- }
- ]
- },
- "metadata": {
- "defaultFunctionName": "Counter",
- "description": "$DurableFunctionsEntity_description",
- "name": "Durable Functions entity",
- "language": "JavaScript",
- "category": [
- "$temp_category_core",
- "$temp_category_durableFunctions"
- ],
- "categoryStyle": "other",
- "enabledInTryMode": false,
- "userPrompt": []
- }
+ "metadata": {
+ "defaultFunctionName": "CosmosTrigger",
+ "description": "$CosmosDBTrigger_description",
+ "name": "Azure Cosmos DB trigger",
+ "language": "PowerShell",
+ "category": [
+ "$temp_category_core",
+ "$temp_category_dataProcessing"
+ ],
+ "categoryStyle": "cosmosDB",
+ "enabledInTryMode": false,
+ "userPrompt": [
+ "connectionStringSetting",
+ "databaseName",
+ "collectionName",
+ "leaseCollectionName",
+ "createLeaseCollectionIfNotExists"
+ ]
+ }
+ },
+ {
+ "id": "CosmosDBTrigger-Python",
+ "runtime": "2",
+ "files": {
+ "sample.dat": "[\r\n\t{\r\n\t\t\"id\": \"sample\"\r\n\t}\r\n]",
+ "__init__.py": "import logging\r\n\r\nimport azure.functions as func\r\n\r\n\r\ndef main(documents: func.DocumentList) -> str:\r\n if documents:\r\n logging.info('Document id: %s', documents[0]['id'])\r\n"
},
- {
- "id": "DurableFunctionsEntity-Python",
- "runtime": "2",
- "files": {
- "__init__.py": "import logging\r\nimport json\r\n\r\nimport azure.functions as func\r\nimport azure.durable_functions as df\r\n\r\n\r\ndef entity_function(context: df.DurableOrchestrationContext):\r\n\r\n current_value = context.get_state(lambda: 0)\r\n operation = context.operation_name\r\n if operation == \"add\":\r\n amount = context.get_input()\r\n current_value += amount\r\n context.set_result(current_value)\r\n elif operation == \"reset\":\r\n current_value = 0\r\n elif operation == \"get\":\r\n context.set_result(current_value)\r\n \r\n context.set_state(current_value)\r\n\r\nmain = df.Entity.create(entity_function)"
- },
- "function": {
- "scriptFile": "__init__.py",
- "bindings": [
- {
- "name": "context",
- "type": "entityTrigger",
- "direction": "in"
- }
- ]
- },
- "metadata": {
- "defaultFunctionName": "DurableFunctionsEntityPy",
- "description": "$DurableFunctionsEntity_description",
- "name": "Durable Functions entity",
- "language": "Python",
- "category": [
- "$temp_category_core",
- "$temp_category_durableFunctions"
- ],
- "categoryStyle": "other",
- "enabledInTryMode": false,
- "userPrompt": []
+ "function": {
+ "scriptFile": "__init__.py",
+ "bindings": [
+ {
+ "type": "cosmosDBTrigger",
+ "name": "documents",
+ "direction": "in",
+ "leaseCollectionName": "leases",
+ "connectionStringSetting": "",
+ "databaseName": "",
+ "collectionName": "",
+ "createLeaseCollectionIfNotExists": true
}
+ ]
},
- {
- "id": "DurableFunctionsEntity-TypeScript",
- "runtime": "2",
- "files": {
- "index.ts": "/*\r\n* This function is not intended to be invoked directly. Instead it will be\r\n* triggered by a client function.\r\n* \r\n* Before running this sample, please:\r\n* - create a Durable entity HTTP function\r\n* - run 'npm install durable-functions' from the root of your app\r\n*/\r\n\r\nimport * as df from \"durable-functions\"\r\n\r\nconst entity = df.entity(function (context) {\r\n const currentValue = context.df.getState(() => 0) as number;\r\n switch (context.df.operationName) {\r\n case \"add\":\r\n const amount = context.df.getInput() as number;\r\n context.df.setState(currentValue + amount);\r\n break;\r\n case \"reset\":\r\n context.df.setState(0);\r\n break;\r\n }\r\n});\r\n\r\nexport default entity;"
- },
- "function": {
- "bindings": [
- {
- "name": "context",
- "type": "entityTrigger",
- "direction": "in"
- }
- ]
- },
- "metadata": {
- "defaultFunctionName": "Counter",
- "description": "$DurableFunctionsEntity_description",
- "name": "Durable Functions entity",
- "language": "TypeScript",
- "category": [
- "$temp_category_core",
- "$temp_category_durableFunctions"
- ],
- "categoryStyle": "other",
- "enabledInTryMode": false,
- "userPrompt": []
- }
+ "metadata": {
+ "defaultFunctionName": "CosmosTrigger",
+ "description": "$CosmosDBTrigger_description",
+ "name": "Azure Cosmos DB trigger",
+ "language": "Python",
+ "category": [
+ "$temp_category_core",
+ "$temp_category_dataProcessing"
+ ],
+ "categoryStyle": "cosmosDB",
+ "enabledInTryMode": false,
+ "userPrompt": [
+ "connectionStringSetting",
+ "databaseName",
+ "collectionName",
+ "leaseCollectionName",
+ "createLeaseCollectionIfNotExists"
+ ],
+ "filters": [
+ "Python3"
+ ]
+ }
+ },
+ {
+ "id": "CosmosDBTrigger-TypeScript",
+ "runtime": "2",
+ "files": {
+ "index.ts": "import { AzureFunction, Context } from \"@azure/functions\"\r\n\r\nconst cosmosDBTrigger: AzureFunction = async function (context: Context, documents: any[]): Promise {\r\n if (!!documents && documents.length > 0) {\r\n context.log('Document Id: ', documents[0].id);\r\n }\r\n}\r\n\r\nexport default cosmosDBTrigger;\r\n",
+ "sample.dat": "[\r\n\t{\r\n\t\t\"id\": \"sample\"\r\n\t}\r\n]"
},
- {
- "id": "DurableFunctionsEntityClass-CSharp",
- "runtime": "2",
- "files": {
- "run.csx": "/*\r\n* This function is not intended to be invoked directly. Instead it will be\r\n* triggered by a client function.\r\n* \r\n* Before running this sample, please:\r\n* - create a Durable entity HTTP function\r\n*/\r\n\r\n#r \"Microsoft.Azure.WebJobs.Extensions.DurableTask\"\r\n#r \"Newtonsoft.Json\"\r\n\r\nusing Newtonsoft.Json;\r\nusing Microsoft.Azure.WebJobs.Extensions.DurableTask;\r\n\r\npublic class Counter\r\n{\r\n\r\n [JsonProperty(\"value\")]\r\n public int CurrentValue { get; set; }\r\n\r\n public void Add(int amount) => this.CurrentValue += amount;\r\n\r\n public void Reset() => this.CurrentValue = 0;\r\n\r\n public int Get() => this.CurrentValue;\r\n}\r\n\r\npublic static void Run(IDurableEntityContext context)\r\n => context.DispatchAsync();"
- },
- "function": {
- "bindings": [
- {
- "name": "context",
- "type": "entityTrigger",
- "direction": "in"
- }
- ]
- },
- "metadata": {
- "defaultFunctionName": "Counter",
- "description": "$DurableFunctionsEntityClass_description",
- "name": "Durable Functions entity (class)",
- "language": "C#",
- "category": [
- "$temp_category_durableFunctions"
- ],
- "categoryStyle": "other",
- "enabledInTryMode": false,
- "userPrompt": []
+ "function": {
+ "bindings": [
+ {
+ "type": "cosmosDBTrigger",
+ "name": "documents",
+ "direction": "in",
+ "leaseCollectionName": "leases",
+ "connectionStringSetting": "",
+ "databaseName": "",
+ "collectionName": "",
+ "createLeaseCollectionIfNotExists": true
}
+ ]
},
- {
- "id": "DurableFunctionsEntityFunction-CSharp",
- "runtime": "2",
- "files": {
- "run.csx": "/*\r\n* This function is not intended to be invoked directly. Instead it will be\r\n* triggered by a client function.\r\n* \r\n* Before running this sample, please:\r\n* - create a Durable entity HTTP function\r\n*/\r\n\r\n#r \"Microsoft.Azure.WebJobs.Extensions.DurableTask\"\r\n\r\nusing Microsoft.Azure.WebJobs.Extensions.DurableTask;\r\n\r\npublic static void Run(IDurableEntityContext context)\r\n{\r\n switch (context.OperationName.ToLowerInvariant())\r\n {\r\n case \"add\":\r\n context.SetState(context.GetState() + context.GetInput());\r\n break;\r\n case \"reset\":\r\n context.SetState(0);\r\n break;\r\n case \"get\":\r\n context.Return(context.GetState());\r\n break;\r\n }\r\n}"
- },
- "function": {
- "bindings": [
- {
- "name": "context",
- "type": "entityTrigger",
- "direction": "in"
- }
- ]
- },
- "metadata": {
- "defaultFunctionName": "Counter",
- "description": "$DurableFunctionsEntityFunction_description",
- "name": "Durable Functions entity (function)",
- "language": "C#",
- "category": [
- "$temp_category_durableFunctions"
- ],
- "categoryStyle": "other",
- "enabledInTryMode": false,
- "userPrompt": []
- }
+ "metadata": {
+ "defaultFunctionName": "CosmosTrigger",
+ "description": "$CosmosDBTrigger_description",
+ "name": "Azure Cosmos DB trigger",
+ "language": "TypeScript",
+ "category": [
+ "$temp_category_core",
+ "$temp_category_dataProcessing"
+ ],
+ "categoryStyle": "cosmosDB",
+ "enabledInTryMode": false,
+ "userPrompt": [
+ "connectionStringSetting",
+ "databaseName",
+ "collectionName",
+ "leaseCollectionName",
+ "createLeaseCollectionIfNotExists"
+ ]
+ }
+ },
+ {
+ "id": "CosmosDBTrigger-TypeScript-4.x",
+ "runtime": "2",
+ "files": {
+ "%functionName%.ts": "import { app, InvocationContext } from \"@azure/functions\";\r\n\r\nexport async function %functionName%(documents: unknown[], context: InvocationContext): Promise {\r\n context.log(`Cosmos DB function processed ${documents.length} documents`);\r\n}\r\n\r\napp.cosmosDB('%functionName%', {\r\n connectionStringSetting: '%connectionStringSetting%',\r\n databaseName: '%databaseName%',\r\n collectionName: '%collectionName%',\r\n createLeaseCollectionIfNotExists: %createLeaseCollectionIfNotExists%,\r\n handler: %functionName%\r\n});\r\n"
},
- {
- "id": "DurableFunctionsEntityHttpStart-CSharp",
- "runtime": "2",
- "files": {
- "run.csx": "#r \"Microsoft.Azure.WebJobs.Extensions.DurableTask\"\r\n#r \"Newtonsoft.Json\"\r\n\r\nusing System.Net;\r\nusing Newtonsoft.Json.Linq;\r\nusing Microsoft.Azure.WebJobs.Extensions.DurableTask;\r\nusing Microsoft.AspNetCore.Mvc;\r\n\r\npublic static async Task Run(\r\n HttpRequest req,\r\n IDurableEntityClient client,\r\n string entityKey)\r\n{\r\n var entityId = new EntityId(\"Counter\", entityKey);\r\n\r\n if (req.Method.Equals(\"POST\"))\r\n {\r\n await client.SignalEntityAsync(entityId, \"add\", 1);\r\n return new OkObjectResult(\"Added to the entity\");\r\n }\r\n\r\n EntityStateResponse stateResponse = await client.ReadEntityStateAsync(entityId);\r\n return new OkObjectResult(stateResponse);\r\n}"
- },
- "function": {
- "bindings": [
- {
- "authLevel": "function",
- "name": "req",
- "type": "httpTrigger",
- "direction": "in",
- "route": "{entityKey}",
- "methods": [
- "post",
- "get"
- ]
- },
- {
- "name": "$return",
- "type": "http",
- "direction": "out"
- },
- {
- "name": "client",
- "type": "durableClient",
- "direction": "in"
- }
- ]
- },
- "metadata": {
- "defaultFunctionName": "DurableFunctionsEntityHttpStart",
- "description": "$DurableFunctionsHttpStart_description",
- "name": "Durable Functions Entity HTTP starter",
- "language": "C#",
- "category": [
- "$temp_category_core",
- "$temp_category_durableFunctions"
- ],
- "categoryStyle": "other",
- "enabledInTryMode": false,
- "userPrompt": []
- }
+ "metadata": {
+ "defaultFunctionName": "cosmosDBTrigger",
+ "description": "$CosmosDBTrigger_description",
+ "name": "Azure Cosmos DB trigger",
+ "language": "TypeScript",
+ "triggerType": "cosmosDBTrigger",
+ "category": [
+ "$temp_category_core",
+ "$temp_category_dataProcessing"
+ ],
+ "categoryStyle": "cosmosDB",
+ "enabledInTryMode": false,
+ "userPrompt": [
+ "connectionStringSetting",
+ "databaseName",
+ "collectionName",
+ "createLeaseCollectionIfNotExists"
+ ]
+ }
+ },
+ {
+ "id": "DurableFunctionsActivity-CSharp",
+ "runtime": "2",
+ "files": {
+ "run.csx": "/*\r\n * This function is not intended to be invoked directly. Instead it will be\r\n * triggered by an orchestrator function.\r\n * \r\n * Before running this sample, please:\r\n * - create a Durable orchestration function\r\n * - create a Durable HTTP starter function\r\n */\r\n\r\n#r \"Microsoft.Azure.WebJobs.Extensions.DurableTask\"\r\n\r\nusing Microsoft.Azure.WebJobs.Extensions.DurableTask;\r\n\r\npublic static string Run(string name)\r\n{\r\n return $\"Hello {name}!\";\r\n}"
},
- {
- "id": "DurableFunctionsEntityHttpStart-JavaScript",
- "runtime": "2",
- "files": {
- "index.js": "const df = require(\"durable-functions\");\r\n\r\nmodule.exports = async function (context, req) {\r\n const client = df.getClient(context);\r\n const id = context.bindingData.id;\r\n const entityId = new df.EntityId(\"Counter\", id);\r\n\r\n if (req.method === \"POST\") {\r\n // increment value\r\n await client.signalEntity(entityId, \"add\", 1);\r\n } else {\r\n // reads current state of entity\r\n const stateResponse = await client.readEntityState(entityId);\r\n return { body: stateResponse.entityState };\r\n }\r\n};"
- },
- "function": {
- "bindings": [
- {
- "authLevel": "function",
- "name": "req",
- "type": "httpTrigger",
- "direction": "in",
- "route": "counters/{id}",
- "methods": [
- "post",
- "get"
- ]
- },
- {
- "name": "$return",
- "type": "http",
- "direction": "out"
- },
- {
- "name": "starter",
- "type": "orchestrationClient",
- "direction": "in"
- }
- ]
- },
- "metadata": {
- "defaultFunctionName": "DurableFunctionsEntityHttpStart",
- "description": "$DurableFunctionsHttpStart_description",
- "name": "Durable Functions Entity HTTP starter",
- "language": "JavaScript",
- "category": [
- "$temp_category_core",
- "$temp_category_durableFunctions"
- ],
- "categoryStyle": "other",
- "enabledInTryMode": false,
- "userPrompt": []
+ "function": {
+ "bindings": [
+ {
+ "name": "name",
+ "type": "activityTrigger",
+ "direction": "in"
}
+ ]
},
- {
- "id": "DurableFunctionsEntityHttpStart-TypeScript",
- "runtime": "2",
- "files": {
- "index.ts": "import { AzureFunction, Context, HttpRequest } from \"@azure/functions\"\r\nimport * as df from \"durable-functions\"\r\n\r\nconst httpStart: AzureFunction = async function (context: Context, req: HttpRequest) {\r\n const client = df.getClient(context);\r\n const id: string = req.params.id;\r\n const entityId = new df.EntityId(\"Counter\", id);\r\n\r\n if (req.method === \"POST\") {\r\n // increment value\r\n await client.signalEntity(entityId, \"add\", 1);\r\n } else {\r\n // reads current state of entity\r\n const stateResponse = await client.readEntityState(entityId);\r\n return { body: stateResponse.entityState };\r\n }\r\n};\r\n\r\nexport default httpStart;"
- },
- "function": {
- "bindings": [
- {
- "authLevel": "anonymous",
- "name": "req",
- "type": "httpTrigger",
- "direction": "in",
- "route": "counters/{id}",
- "methods": [
- "post",
- "get"
- ]
- },
- {
- "name": "$return",
- "type": "http",
- "direction": "out"
- },
- {
- "name": "client",
- "type": "durableClient",
- "direction": "in"
- }
- ]
- },
- "metadata": {
- "defaultFunctionName": "DurableFunctionsEntityHttpStart",
- "description": "$DurableFunctionsHttpStart_description",
- "name": "Durable Functions Entity HTTP starter",
- "language": "TypeScript",
- "category": [
- "$temp_category_core",
- "$temp_category_durableFunctions"
- ],
- "categoryStyle": "other",
- "enabledInTryMode": false,
- "userPrompt": [
- "authLevel"
- ]
- }
+ "metadata": {
+ "defaultFunctionName": "Hello",
+ "description": "$DurableFunctionsActivity_description",
+ "name": "Durable Functions activity",
+ "language": "C#",
+ "category": [
+ "$temp_category_core",
+ "$temp_category_durableFunctions"
+ ],
+ "categoryStyle": "other",
+ "enabledInTryMode": false,
+ "userPrompt": []
+ }
+ },
+ {
+ "id": "DurableFunctionsActivity-JavaScript",
+ "runtime": "2",
+ "files": {
+ "index.js": "/*\r\n * This function is not intended to be invoked directly. Instead it will be\r\n * triggered by an orchestrator function.\r\n * \r\n * Before running this sample, please:\r\n * - create a Durable orchestration function\r\n * - create a Durable HTTP starter function\r\n * - run 'npm install durable-functions' from the wwwroot folder of your\r\n * function app in Kudu\r\n */\r\n\r\nmodule.exports = async function (context) {\r\n return `Hello ${context.bindings.name}!`;\r\n};"
},
- {
- "id": "DurableFunctionsHttpStart-CSharp",
- "runtime": "2",
- "files": {
- "run.csx": "#r \"Microsoft.Azure.WebJobs.Extensions.DurableTask\"\r\n#r \"Newtonsoft.Json\"\r\n\r\nusing System.Net;\r\nusing Microsoft.Azure.WebJobs.Extensions.DurableTask;\r\n\r\npublic static async Task Run(\r\n HttpRequestMessage req,\r\n IDurableOrchestrationClient starter,\r\n string functionName,\r\n ILogger log)\r\n{\r\n // Function input comes from the request content.\r\n dynamic eventData = await req.Content.ReadAsAsync