Initial commit
This commit is contained in:
Коммит
b7b417a752
|
@ -0,0 +1,10 @@
|
|||
{
|
||||
"bindings": {
|
||||
"input": [
|
||||
{
|
||||
"type": "blobTrigger",
|
||||
"path": "samples-workitems-csharp"
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
|
@ -0,0 +1,5 @@
|
|||
{
|
||||
"name": "BlobTrigger C# Function",
|
||||
"language": "C#",
|
||||
"trigger": "BlobTrigger"
|
||||
}
|
|
@ -0,0 +1,9 @@
|
|||
using System;
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
using Microsoft.Azure.WebJobs.Host;
|
||||
|
||||
public static void Run(string id, TraceWriter log)
|
||||
{
|
||||
log.Verbose(string.Format("CSharp Blob trigger function processed a request. Item Id={0}", id));
|
||||
}
|
|
@ -0,0 +1,10 @@
|
|||
{
|
||||
"bindings": {
|
||||
"input": [
|
||||
{
|
||||
"type": "blobTrigger",
|
||||
"path": "samples-workitems"
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
|
@ -0,0 +1,4 @@
|
|||
module.exports = function (workItem, context) {
|
||||
console.log('Node.js blob trigger function processed work item ' + workItem.id);
|
||||
context.done();
|
||||
}
|
|
@ -0,0 +1,5 @@
|
|||
{
|
||||
"name": "BlobTrigger Nodejs Function",
|
||||
"language": "JavaScript",
|
||||
"trigger": "BlobTrigger"
|
||||
}
|
|
@ -0,0 +1,14 @@
|
|||
{
|
||||
"bindings": {
|
||||
"input": [
|
||||
{
|
||||
"type": "httpTrigger"
|
||||
}
|
||||
],
|
||||
"output": [
|
||||
{
|
||||
"type": "http"
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
|
@ -0,0 +1,5 @@
|
|||
{
|
||||
"name": "HttpTrigger Batch Function",
|
||||
"language": "Batch",
|
||||
"trigger": "HttpTrigger"
|
||||
}
|
|
@ -0,0 +1,7 @@
|
|||
echo OFF
|
||||
|
||||
IF DEFINED req_query_name (
|
||||
echo Hello %req_query_name%! > %res%
|
||||
) ELSE (
|
||||
echo Please pass a name on the query string > %res%
|
||||
)
|
|
@ -0,0 +1,14 @@
|
|||
{
|
||||
"bindings": {
|
||||
"input": [
|
||||
{
|
||||
"type": "httpTrigger"
|
||||
}
|
||||
],
|
||||
"output": [
|
||||
{
|
||||
"type": "http"
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
|
@ -0,0 +1,5 @@
|
|||
{
|
||||
"name": "HttpTrigger C# Function",
|
||||
"language": "C#",
|
||||
"trigger": "HttpTrigger"
|
||||
}
|
|
@ -0,0 +1,36 @@
|
|||
#r "System.Web.Http"
|
||||
|
||||
using System;
|
||||
using System.Linq;
|
||||
using System.Net;
|
||||
using System.Net.Http;
|
||||
using System.Threading.Tasks;
|
||||
using System.Diagnostics;
|
||||
using Microsoft.Azure.WebJobs.Host;
|
||||
|
||||
public static Task<HttpResponseMessage> Run(HttpRequestMessage req, TraceWriter log)
|
||||
{
|
||||
var queryParamms = req.GetQueryNameValuePairs()
|
||||
.ToDictionary(p => p.Key, p => p.Value, StringComparer.OrdinalIgnoreCase);
|
||||
|
||||
log.Verbose(string.Format("CSharp HTTP trigger function processed a request. Name={0}", req.RequestUri));
|
||||
|
||||
HttpResponseMessage res = null;
|
||||
string name;
|
||||
if (queryParamms.TryGetValue("name", out name))
|
||||
{
|
||||
res = new HttpResponseMessage(HttpStatusCode.OK)
|
||||
{
|
||||
Content = new StringContent("Hello " + name)
|
||||
};
|
||||
}
|
||||
else
|
||||
{
|
||||
res = new HttpResponseMessage(HttpStatusCode.BadRequest)
|
||||
{
|
||||
Content = new StringContent("Please pass a name on the query string")
|
||||
};
|
||||
}
|
||||
|
||||
return Task.FromResult(res);
|
||||
}
|
|
@ -0,0 +1,14 @@
|
|||
{
|
||||
"bindings": {
|
||||
"input": [
|
||||
{
|
||||
"type": "httpTrigger"
|
||||
}
|
||||
],
|
||||
"output": [
|
||||
{
|
||||
"type": "http"
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
|
@ -0,0 +1,10 @@
|
|||
module.exports = function (req, context) {
|
||||
context.log('Node.js HTTP trigger function processed a request. Name=' + req.query.name);
|
||||
|
||||
if (typeof req.query.name == 'undefined') {
|
||||
context.done(null, "Please pass a name on the query string");
|
||||
}
|
||||
else {
|
||||
context.done(null, "Hello " + req.query.name);
|
||||
}
|
||||
}
|
|
@ -0,0 +1,5 @@
|
|||
{
|
||||
"name": "HttpTrigger Nodejs Function",
|
||||
"language": "JavaScript",
|
||||
"trigger": "HttpTrigger"
|
||||
}
|
|
@ -0,0 +1,9 @@
|
|||
{
|
||||
"bindings": {
|
||||
"input": [
|
||||
{
|
||||
"type": "manualTrigger"
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
|
@ -0,0 +1,4 @@
|
|||
module.exports = function (input, context) {
|
||||
context.log('Node.js manually triggered function called with input ' + input);
|
||||
context.done();
|
||||
}
|
|
@ -0,0 +1,5 @@
|
|||
{
|
||||
"name": "ManualTrigger Nodejs Function",
|
||||
"language": "JavaScript",
|
||||
"trigger": "ManualTrigger"
|
||||
}
|
|
@ -0,0 +1,10 @@
|
|||
{
|
||||
"bindings": {
|
||||
"input": [
|
||||
{
|
||||
"type": "queueTrigger",
|
||||
"queueName": "samples-bash"
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
|
@ -0,0 +1,5 @@
|
|||
{
|
||||
"name": "QueueTrigger Bash Function",
|
||||
"language": "Bash",
|
||||
"trigger": "QueueTrigger"
|
||||
}
|
|
@ -0,0 +1,2 @@
|
|||
read -r input
|
||||
printf "Bash script processed queue message: $input"
|
|
@ -0,0 +1,17 @@
|
|||
{
|
||||
"bindings": {
|
||||
"input": [
|
||||
{
|
||||
"type": "queueTrigger",
|
||||
"queueName": "samples-batch"
|
||||
}
|
||||
],
|
||||
"output": [
|
||||
{
|
||||
"type": "blob",
|
||||
"name": "output",
|
||||
"path": "samples-output/{id}"
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
|
@ -0,0 +1,5 @@
|
|||
{
|
||||
"name": "QueueTrigger Batch Function",
|
||||
"language": "Batch",
|
||||
"trigger": "QueueTrigger"
|
||||
}
|
|
@ -0,0 +1,4 @@
|
|||
echo OFF
|
||||
SET /p input=
|
||||
echo Windows Batch script processed queue message '%input%'
|
||||
echo %input% > %output%
|
|
@ -0,0 +1,10 @@
|
|||
{
|
||||
"bindings": {
|
||||
"input": [
|
||||
{
|
||||
"type": "queueTrigger",
|
||||
"queueName": "samples-fsharp"
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
|
@ -0,0 +1,5 @@
|
|||
{
|
||||
"name": "QueueTrigger F# Function",
|
||||
"language": "F#",
|
||||
"trigger": "QueueTrigger"
|
||||
}
|
|
@ -0,0 +1,3 @@
|
|||
let input = System.Console.In.ReadLine()
|
||||
let message = sprintf "F# script processed queue message '%s'" input
|
||||
System.Console.Out.WriteLine(message)
|
|
@ -0,0 +1,10 @@
|
|||
{
|
||||
"bindings": {
|
||||
"input": [
|
||||
{
|
||||
"type": "queueTrigger",
|
||||
"queueName": "samples-php"
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
|
@ -0,0 +1,5 @@
|
|||
{
|
||||
"name": "QueueTrigger Php Function",
|
||||
"language": "Php",
|
||||
"trigger": "QueueTrigger"
|
||||
}
|
|
@ -0,0 +1,5 @@
|
|||
<?php
|
||||
$input = fgets(STDIN);
|
||||
$input = rtrim($input, "\n\r");
|
||||
fwrite(STDOUT, "PHP script processed queue message '$input'");
|
||||
?>
|
|
@ -0,0 +1,19 @@
|
|||
{
|
||||
"bindings": {
|
||||
"input": [
|
||||
{
|
||||
"type": "queueTrigger",
|
||||
"queueName": "samples-powershell"
|
||||
}
|
||||
],
|
||||
"output": [
|
||||
{
|
||||
"type": "table",
|
||||
"name": "output",
|
||||
"tableName": "samples",
|
||||
"partitionKey": "samples",
|
||||
"rowKey": "%rand-guid%"
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
|
@ -0,0 +1,5 @@
|
|||
{
|
||||
"name": "QueueTrigger Powershell Function",
|
||||
"language": "Powershell",
|
||||
"trigger": "QueueTrigger"
|
||||
}
|
|
@ -0,0 +1,8 @@
|
|||
$in = [Console]::ReadLine()
|
||||
|
||||
[Console]::WriteLine("Powershell script processed queue message '$in'")
|
||||
|
||||
$output = $Env:output
|
||||
$json = $in | ConvertFrom-Json
|
||||
$entity = [string]::Format('{{ "timestamp": "{0}", "status": 0, "title": "Powershell Table Entity for message {1}" }}', $(get-date -f MM-dd-yyyy_HH_mm_ss), $json.id)
|
||||
$entity | Out-File -Encoding Ascii $output
|
|
@ -0,0 +1,25 @@
|
|||
{
|
||||
"bindings": {
|
||||
"input": [
|
||||
{
|
||||
"type": "queueTrigger",
|
||||
"queueName": "samples-python"
|
||||
},
|
||||
{
|
||||
"type": "table",
|
||||
"name": "input",
|
||||
"tableName": "samples",
|
||||
"partitionKey": "samples",
|
||||
"take": 5,
|
||||
"filter": "status eq '0'"
|
||||
}
|
||||
],
|
||||
"output": [
|
||||
{
|
||||
"type": "blob",
|
||||
"name": "output",
|
||||
"path": "samples-output/{id}"
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
|
@ -0,0 +1,5 @@
|
|||
{
|
||||
"name": "QueueTrigger Python Function",
|
||||
"language": "Python",
|
||||
"trigger": "QueueTrigger"
|
||||
}
|
|
@ -0,0 +1,18 @@
|
|||
import os
|
||||
import json
|
||||
|
||||
# read the queue message and write to stdout
|
||||
input = input();
|
||||
message = "Python script processed queue message '{0}'".format(input)
|
||||
print(message)
|
||||
|
||||
# read the entities from the table binding
|
||||
tableData = open(os.environ['input'])
|
||||
table = json.load(tableData)
|
||||
print("Read {0} Table entities".format(len(table)))
|
||||
for entity in table:
|
||||
print(entity)
|
||||
|
||||
# write to the output binding
|
||||
f = open(os.environ['output'], 'w')
|
||||
f.write(input)
|
|
@ -0,0 +1,17 @@
|
|||
{
|
||||
"bindings": {
|
||||
"input": [
|
||||
{
|
||||
"type": "queueTrigger",
|
||||
"queueName": "samples-workitems"
|
||||
}
|
||||
],
|
||||
"output": [
|
||||
{
|
||||
"type": "blob",
|
||||
"name": "receipt",
|
||||
"path": "samples-workitems/{id}"
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
|
@ -0,0 +1,5 @@
|
|||
module.exports = function (workItem, context) {
|
||||
context.log('Node.js queue trigger function processed work item ' + workItem.id);
|
||||
|
||||
context.done(null, workItem);
|
||||
}
|
|
@ -0,0 +1,5 @@
|
|||
{
|
||||
"name": "QueueTrigger Nodejs Function",
|
||||
"language": "JavaScript",
|
||||
"trigger": "QueueTrigger"
|
||||
}
|
|
@ -0,0 +1,17 @@
|
|||
{
|
||||
"bindings": {
|
||||
"input": [
|
||||
{
|
||||
"type": "serviceBusTrigger",
|
||||
"queueName": "samples-input"
|
||||
}
|
||||
],
|
||||
"output": [
|
||||
{
|
||||
"type": "serviceBus",
|
||||
"name": "message",
|
||||
"queueName": "samples-input"
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
|
@ -0,0 +1,16 @@
|
|||
module.exports = function (message, context) {
|
||||
context.log("Node.js ServiceBus queue trigger function processed message '" + JSON.stringify(message) + "'");
|
||||
|
||||
var output = null;
|
||||
if (message.count < 1)
|
||||
{
|
||||
// write a message back to the queue that this function is triggered on
|
||||
// ensuring that we only loop on this once
|
||||
message.count += 1;
|
||||
output = {
|
||||
message: JSON.stringify(message)
|
||||
};
|
||||
}
|
||||
|
||||
context.done(null, output);
|
||||
}
|
|
@ -0,0 +1,5 @@
|
|||
{
|
||||
"name": "ServiceBusQueueTrigger Nodejs Function",
|
||||
"language": "JavaScript",
|
||||
"trigger": "ServiceBusQueueTrigger"
|
||||
}
|
|
@ -0,0 +1,18 @@
|
|||
{
|
||||
"bindings": {
|
||||
"input": [
|
||||
{
|
||||
"type": "timerTrigger",
|
||||
"schedule": "0/10 * * * * *",
|
||||
"runOnStartup": true
|
||||
}
|
||||
],
|
||||
"output": [
|
||||
{
|
||||
"type": "queue",
|
||||
"name": "message",
|
||||
"queueName": "samples-csharp"
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
|
@ -0,0 +1,5 @@
|
|||
{
|
||||
"name": "TimerTrigger C# Function",
|
||||
"language": "C#",
|
||||
"trigger": "TimerTrigger"
|
||||
}
|
|
@ -0,0 +1,11 @@
|
|||
using System;
|
||||
using System.Diagnostics;
|
||||
using Microsoft.Azure.WebJobs;
|
||||
using Microsoft.Azure.WebJobs.Host;
|
||||
|
||||
public static void Run(TimerInfo timerInfo, out string message, TraceWriter log)
|
||||
{
|
||||
log.Verbose("CSharp Timer trigger function executed.");
|
||||
|
||||
message = $"Trigger function executed at {DateTime.Now}";
|
||||
}
|
|
@ -0,0 +1,18 @@
|
|||
{
|
||||
"bindings": {
|
||||
"input": [
|
||||
{
|
||||
"type": "timerTrigger",
|
||||
"schedule": "0 * * * * *",
|
||||
"runOnStartup": true
|
||||
}
|
||||
],
|
||||
"output": [
|
||||
{
|
||||
"type": "queue",
|
||||
"name": "message",
|
||||
"queueName": "samples-fsharp"
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
|
@ -0,0 +1,11 @@
|
|||
module.exports = function (context) {
|
||||
var timeStamp = new Date().toISOString();
|
||||
context.log('Node.js timer trigger function ran! ' + timeStamp);
|
||||
|
||||
var message = {
|
||||
id: Math.floor(Math.random() * 10000) + 1,
|
||||
notes: "Generated by Timer function"
|
||||
};
|
||||
|
||||
context.done(null, message);
|
||||
}
|
|
@ -0,0 +1,5 @@
|
|||
module.exports.log = function (text, log, callback) {
|
||||
var timeStamp = new Date().toISOString();
|
||||
log(timeStamp + ' ' + text);
|
||||
callback();
|
||||
}
|
|
@ -0,0 +1,5 @@
|
|||
{
|
||||
"name": "TimerTrigger Nodejs Function",
|
||||
"language": "JavaScript",
|
||||
"trigger": "TimerTrigger"
|
||||
}
|
|
@ -0,0 +1,15 @@
|
|||
{
|
||||
"bindings": {
|
||||
"input": [
|
||||
{
|
||||
"type": "httpTrigger",
|
||||
"webHookType": "genericJson"
|
||||
}
|
||||
],
|
||||
"output": [
|
||||
{
|
||||
"type": "http"
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
|
@ -0,0 +1,4 @@
|
|||
module.exports = function (body, context) {
|
||||
context.log('Webhook was triggered!');
|
||||
context.done(null, 'WebHook processed successfully! ' + body.a);
|
||||
}
|
|
@ -0,0 +1,5 @@
|
|||
{
|
||||
"name": "Generic Webhook Nodejs function",
|
||||
"language": "JavaScript",
|
||||
"trigger": "HttpTrigger"
|
||||
}
|
|
@ -0,0 +1,15 @@
|
|||
{
|
||||
"bindings": {
|
||||
"input": [
|
||||
{
|
||||
"type": "httpTrigger",
|
||||
"webHookType": "github"
|
||||
}
|
||||
],
|
||||
"output": [
|
||||
{
|
||||
"type": "http"
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
|
@ -0,0 +1,4 @@
|
|||
module.exports = function (body, context) {
|
||||
context.log('GitHub WebHook triggered! ' + body.comment.body);
|
||||
context.done(null, 'New GitHub comment: ' + body.comment.body);
|
||||
}
|
|
@ -0,0 +1,5 @@
|
|||
{
|
||||
"name": "Github Webhook Nodejs Function",
|
||||
"language": "JavaScript",
|
||||
"trigger": "HttpTrigger"
|
||||
}
|
Загрузка…
Ссылка в новой задаче