-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
88e8265
commit dbe3810
Showing
10 changed files
with
229 additions
and
0 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
node_modules | ||
local.settings.json |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
{ | ||
"bindings": [ | ||
{ | ||
"type": "httpTrigger", | ||
"direction": "in", | ||
"name": "req", | ||
"route": "hello", | ||
"methods": [ | ||
"get", | ||
"post" | ||
], | ||
"authLevel": "anonymous" | ||
}, | ||
{ | ||
"type": "http", | ||
"direction": "out", | ||
"name": "res" | ||
}, | ||
{ | ||
"type": "blob", | ||
"name": "outputBlob", | ||
"path": "output/{filename}", | ||
"connection": "rocketleagueappfunc_STORAGE", | ||
"direction": "out" | ||
}, | ||
{ | ||
"type": "table", | ||
"name": "outputTable", | ||
"tableName": "submissions", | ||
"connection": "rocketleagueappfunc_STORAGE", | ||
"direction": "out" | ||
} | ||
], | ||
"disabled": false | ||
} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
module.exports = function (context, req) { | ||
context.log('JavaScript HTTP trigger function processed a request.', context.bindings.outputBlob); | ||
|
||
context.bindings.outputBlob = req.body; | ||
if (req.query.name || (req.body && req.body.name)) { | ||
context.res = { | ||
// status: 200, /* Defaults to 200 */ | ||
body: "Hello " + (req.query.name || req.body.name) | ||
}; | ||
} | ||
else { | ||
context.res = { | ||
status: 400, | ||
body: "Please pass a name on the query string or in the request body" | ||
}; | ||
} | ||
context.done(); | ||
}; |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
{ | ||
"bindings": [ | ||
{ | ||
"authLevel": "anonymous", | ||
"type": "httpTrigger", | ||
"direction": "in", | ||
"name": "req", | ||
"methods": [ | ||
"post", | ||
"get" | ||
] | ||
}, | ||
{ | ||
"type": "http", | ||
"direction": "out", | ||
"name": "res" | ||
} | ||
], | ||
"disabled": false | ||
} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
import os | ||
import json | ||
from azure.storage.blob import BlockBlobService | ||
|
||
response = open(os.environ['res'], 'w') | ||
|
||
try: | ||
#postreqdata = json.loads(open(os.environ['req']).read()) | ||
#os.environ['req'] | ||
name = "test" #os.environ['req_query_name'] | ||
response.write("hello world from "+name) | ||
except ValueError as err: | ||
print("Error " + err.message) | ||
|
||
response.close() | ||
|
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
{ | ||
"bindings": [ | ||
{ | ||
"authLevel": "anonymous", | ||
"type": "httpTrigger", | ||
"direction": "in", | ||
"name": "req", | ||
"route": "upload", | ||
"methods": [ | ||
"post", | ||
"get" | ||
] | ||
}, | ||
{ | ||
"type": "http", | ||
"direction": "out", | ||
"name": "res" | ||
}, | ||
{ | ||
"type": "table", | ||
"name": "outputTable", | ||
"tableName": "submissions", | ||
"connection": "rocketleagueappfunc_STORAGE", | ||
"direction": "out" | ||
}, | ||
{ | ||
"type": "blob", | ||
"name": "submissionBlob", | ||
"path": "uploaded-submissions/{filename}", | ||
"connection": "rocketleagueappfunc_STORAGE", | ||
"direction": "out" | ||
} | ||
], | ||
"disabled": false | ||
} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
const azure = require('azure-storage'); | ||
const multer = require('multer'); | ||
|
||
|
||
module.exports = function (context, req) { | ||
context.log('JavaScript HTTP trigger function processed a request.'); | ||
let storageConnection = GetEnvironmentVariable("rocketleagueappfunc_STORAGE"); | ||
context.log(storageConnection); | ||
var blobService = azure.createBlobService(storageConnection); | ||
|
||
blobService.listBlobsSegmented('uploaded-submissions', null, function(error, result, response){ | ||
context.log("blob list"); | ||
if(!error){ | ||
for(entryId in result.entries){ | ||
context.log("entry ", result.entries[entryId].name); | ||
} | ||
// result.entries contains the entries | ||
// If not all blobs were returned, result.continuationToken has the continuation token. | ||
} | ||
}); | ||
|
||
// Iterates through trigger and input binding data | ||
context.bindings.submissionBlob = req.body; | ||
context.bindings.outputTable = []; | ||
/*context.bindings.outputTable.push({ | ||
PartitionKey: "Test", | ||
RowKey: "1234", | ||
Name: "Name " + req.query.name, | ||
Email: "test email 3" | ||
}); | ||
*/ | ||
if (req.query.name || (req.body && req.body.name)) { | ||
context.res = { | ||
// status: 200, /* Defaults to 200 */ | ||
body: "Hello " + (req.query.name || req.body.name) | ||
}; | ||
} | ||
else { | ||
context.res = { | ||
status: 400, | ||
body: "Please pass a name on the query string or in the request body" | ||
}; | ||
} | ||
outputBindings = {filename: "test.txt"}; | ||
context.log('output ',outputBindings); | ||
context.log('body', req.body); | ||
context.bindings.submissionBlob = req.body; | ||
|
||
context.done(null, outputBindings ); | ||
}; | ||
|
||
function GetEnvironmentVariable(name) | ||
{ | ||
return process.env[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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
{} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
{ | ||
"name": "rocket_league_func_api", | ||
"version": "1.0.0", | ||
"description": "Rocket league funcitional app", | ||
"productName": " Rocket League", | ||
"author": "yuri.ivanov@capgemini.com", | ||
"private": true, | ||
"scripts": {}, | ||
"dependencies": { | ||
"azure-storage": "^2.10.1" | ||
}, | ||
"engines": { | ||
"node": ">= 8.9.0", | ||
"npm": ">= 5.6.0" | ||
} | ||
} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
{ | ||
"$schema": "http://json.schemastore.org/proxies", | ||
"proxies": { | ||
"home": { | ||
"matchCondition": { | ||
"route": "/", | ||
"methods": [ | ||
"GET" | ||
] | ||
}, | ||
"backendUri": "https://rocketleagueappfunc.z16.web.core.windows.net/index.html" | ||
}, | ||
"Static Assets": { | ||
"matchCondition": { | ||
"route": "/{*restOfPath}", | ||
"methods": [ | ||
"GET", | ||
"HEAD", | ||
"OPTIONS" | ||
] | ||
}, | ||
"backendUri": "https://rocketleagueappfunc.z16.web.core.windows.net/{restOfPath}" | ||
}, | ||
"api": { | ||
"matchCondition": { | ||
"route": "/api/{*url}" | ||
}, | ||
"backendUri": "https://%WEBSITE_HOSTNAME%/api/{url}" | ||
} | ||
} | ||
} |