Skip to content

Instantly share code, notes, and snippets.

View kennetham's full-sized avatar

Kenneth Ham kennetham

View GitHub Profile
@kennetham
kennetham / pom.xml
Last active March 12, 2019 03:21
Pom file for Java Serverless Function with Kubeless on Kubernetes
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<artifactId>function</artifactId>
<name>function</name>
<version>1.0-SNAPSHOT</version>
<dependencies>
<dependency>
<groupId>joda-time</groupId>
<artifactId>joda-time</artifactId>
<version>2.9.2</version>
@kennetham
kennetham / HelloWorld.java
Created March 12, 2019 03:17
Java Serverless Function with Kubeless on Kubernetes
package io.kubeless;
import io.kubeless.Event;
import io.kubeless.Context;
import org.joda.time.LocalTime;
public class HelloWorld {
public String foo(io.kubeless.Event event, io.kubeless.Context context) {
System.out.println(event.Data);
@kennetham
kennetham / httpPost
Created May 12, 2018 14:36
HTTP POST request to execute Orchestration Function
POST http://{host}/api/orchestrators/E1_HelloSequence
@kennetham
kennetham / function.json
Created May 12, 2018 14:32
Orchestration Function (JSON)
{
"bindings": [
{
"authLevel": "anonymous",
"name": "req",
"type": "httpTrigger",
"direction": "in",
"route": "orchestrators/{functionName}",
"methods": ["post"]
},
@kennetham
kennetham / run.csx
Created May 12, 2018 14:28
Orchestration Function
#r "Microsoft.Azure.WebJobs.Extensions.DurableTask"
#r "Newtonsoft.Json"
using System.Net;
using System.Net.Http.Headers;
public static async Task<HttpResponseMessage> Run(
HttpRequestMessage req,
DurableOrchestrationClient starter,
string functionName,
@kennetham
kennetham / index.js
Created May 12, 2018 14:23
Activity Function
module.exports = function(context) {
context.done(null, `Hello ${context.bindings.name}!`);
};
@kennetham
kennetham / index.js
Created May 12, 2018 14:22
Orchestrator Function
const df = require("durable-functions");
module.exports = df(function*(context){
context.log("Starting chain sample");
const output = [];
output.push(yield context.df.callActivityAsync("E1_SayHello", "Tokyo"));
output.push(yield context.df.callActivityAsync("E1_SayHello", "Seattle"));
output.push(yield context.df.callActivityAsync("E1_SayHello", "London"));
@kennetham
kennetham / durable-function
Created May 12, 2018 14:13
Azure Functions Durable Extension
func extensions install -p Microsoft.Azure.WebJobs.Extensions.DurableTask -v 1.4.0
@kennetham
kennetham / azuredeploy.parameters.json
Created May 5, 2018 07:42
Azure Deploy Parameters with Azure Key Vault
"parameters": {
"vmName": {
"value": "iisvm"
},
"vmAdminUserName": {
"value": "adminuser"
},
"vmAdminPassword": {
@kennetham
kennetham / azuredeploy.json
Created May 5, 2018 07:41
Azure Deploy VM Properties
"properties": {
"publicIPAllocationMethod": "Dynamic",
"dnsSettings": {
"domainNameLabel": "[variables('vmpipDnsName')]"
}
}