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
{ | |
"properties": { | |
"request": { | |
"properties": { | |
"inDialog": { | |
"type": "boolean" | |
}, | |
"intent": { | |
"properties": { | |
"name": { |
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
#r "Microsoft.WindowsAzure.Storage" | |
using Microsoft.WindowsAzure.Storage.Table; | |
using System.Net; | |
public static HttpResponseMessage Run(HttpRequestMessage req, IQueryable<Person> oncallTable, TraceWriter log) | |
{ | |
log.Info("C# HTTP trigger function processed a request."); | |
var startOfWeek = DateTimeExtension.StartOfWeek(DateTime.Now, DayOfWeek.Monday); |
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
using System.Linq; | |
using System.Net; | |
using System.Net.Http; | |
using System.Threading.Tasks; | |
using Microsoft.Azure.WebJobs; | |
using Microsoft.Azure.WebJobs.Extensions.Http; | |
using Microsoft.Azure.WebJobs.Host; | |
using Newtonsoft.Json.Linq; | |
using Microsoft.Azure.Services.AppAuthentication; | |
using Microsoft.Azure.KeyVault; |
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
{ | |
"runtimeStatus": "Completed", | |
"input": { | |
"$type": "HttpToDurable.ProcessRequest, HttpToDurable", | |
"data": "some data" | |
}, | |
"output": [ | |
"some response data" | |
], | |
"createdTime": "2017-11-25T23:02:35Z", |
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
using System; | |
using Microsoft.Azure.WebJobs; | |
using Microsoft.Azure.WebJobs.Host; | |
namespace FunctionApp5 | |
{ | |
public static class Function1 | |
{ | |
[FunctionName("Function1")] | |
public static void Run1([QueueTrigger("queue1-poison")]dynamic message, TraceWriter log) |
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
function EmitEvent(ringEvent, context, callback) { | |
context.log('Sending event to event grid.'); | |
var eventGridPayload = [{ | |
id: utils.generateUUID(), | |
eventType: ringEvent['kind'], | |
subject: 'ring/frontDoor', | |
eventTime: new Date().toISOString(), | |
data: ringEvent | |
}]; | |
var response = ''; |
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
const utils = require('../function-utils'); | |
module.exports = function (context, req) { | |
context.log('JavaScript HTTP trigger function processed a request.'); | |
var ringData = req.body[0]; | |
ringData['id'] = ringData['id'] || utils.generateUUID(); | |
context.log(ringData); | |
context.bindings.ringDocument = JSON.stringify(ringData); |
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
[FunctionName("watcher")] | |
public static async Task RunOrchestrator( | |
[OrchestrationTrigger] DurableOrchestrationContext context, TraceWriter log) | |
{ | |
log.Info("Starting watcher - getting initial ticker"); | |
WatcherRequest input = context.GetInput<WatcherRequest>(); | |
double current = await context.CallActivityAsync<double>("watcher_getticker", input.market); | |
DateTime maxTime = context.CurrentUtcDateTime.Add(input.maxDuration); | |
while (current < input.threshold && context.CurrentUtcDateTime < maxTime) { | |
await context.CreateTimer(context.CurrentUtcDateTime.AddMinutes(double.Parse(Constants.DelayInterval)), CancellationToken.None); |
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
[FunctionName("watcher_getticker")] | |
public static async Task<double> GetTicker([ActivityTrigger] string name, TraceWriter log) | |
{ | |
var result = await (await Bittrex.httpClient.GetAsync(Constants.TickerUrl + "?market=" + name)).Content.ReadAsAsync<JObject>(); | |
return (double)result["result"]["Bid"]; | |
} | |
[FunctionName("send_event")] | |
public static async Task SendMessage([ActivityTrigger] Message message, TraceWriter log) | |
{ |
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
using System.Net; | |
using System.Net.Http; | |
using System.Threading.Tasks; | |
using Microsoft.Azure.WebJobs; | |
using Microsoft.Azure.WebJobs.Extensions.Http; | |
using Microsoft.Azure.WebJobs.Host; | |
using Newtonsoft.Json.Linq; | |
namespace EventGridDocs | |
{ |