Initial open source commit

This commit is contained in:
frikky
2020-05-11 19:17:35 +02:00
commit f3587ac821
205 changed files with 63293 additions and 0 deletions
+2
View File
@@ -0,0 +1,2 @@
curl http://localhost:5001/api/v1/execution_cleanup -H "Authorization: Bearer e08c6f22-9a55-4557-b008-04388cc51fb0"
+5
View File
@@ -0,0 +1,5 @@
#!/bin/sh
curl -XPOST http://localhost:5001/api/v1/workflows/1d9d8ce2-566e-4c3f-8a37-5d6c7d2000b5/execute -d '{"execution_argument":""}' -H "Authorization: Bearer 144308d0-6aab-4d4f-8bb2-75189281ee26"
curl -XPOST http://localhost:5001/api/v1/workflows/1d9d8ce2-566e-4c3f-8a37-5d6c7d2000b5/execute -d '{"execution_argument":""}' -H "Authorization: Bearer eyJhbGciOiJSUzI1NiIsImtpZCI6IjYwZjQwNjBlNThkNzVmZDNmNzBiZWZmODhjNzk0YTc3NTMyN2FhMzEiLCJ0eXAiOiJKV1QifQ.eyJhdWQiOiJodHRwczovL3NodWZmbGVyLmlvL2FwaS92MS93b3JrZmxvd3MvMWQ5ZDhjZTItNTY2ZS00YzNmLThhMzctNWQ2YzdkMjAwMGI1L2V4ZWN1dGUiLCJhenAiOiIxMDMwNzY3ODIwNjE0MjQ2MTg0MjIiLCJlbWFpbCI6InNjaGVkdWxlckBzaHVmZmxlLTI0MTUxNy5pYW0uZ3NlcnZpY2VhY2NvdW50LmNvbSIsImVtYWlsX3ZlcmlmaWVkIjp0cnVlLCJleHAiOjE1NjU1Mjc1NTEsImlhdCI6MTU2NTUyMzk1MSwiaXNzIjoiaHR0cHM6Ly9hY2NvdW50cy5nb29nbGUuY29tIiwic3ViIjoiMTAzMDc2NzgyMDYxNDI0NjE4NDIyIn0.r0EDq9fjhf_5CPTiltyfk_L3uYJp577Uy0yYPcCAl2nv50_z_oUtbWGBpQLL8gcj-NGd3g4E52Qur8k6hCMIQweLS6WAb1279vGffEoCNDfkWb3Oy-yJGP1kzwLvqFJqnHLkSWYXNWvSyWnEimW8Rryx_m1BXS5wcA8l4NIr83kS7fPZrTwjnwFSeGSThwk91DVARzapQb8r0GEgOUyHZ1aBXnV98mikzSUt-5xFKe9eMdD22YJAj0Ru-DxAxs5nOqghX4PMRysWjshjOMrlR1piPWxqAmewp8YKZDCQ5gXskpeAFBDoULT971Wsx_NCohnJsFqx1JfPS9ZYMTW2oQ"
+24
View File
@@ -0,0 +1,24 @@
#curl localhost:5000/api/v1/hooks
# Starts a webhook
# curl localhost:5000/api/v1/hooks/d6ef8912e8bd37776e654cbc14c2629c/start
# Runs a request towards the webhook created
#curl -XPOST localhost:5002/webhook -d '{"helo": "hi"}'
# Gets the ID of a new hook
#curl -X PUT localhost:5001/api/v1/hooks/e6f77059e6d469a6c4c314cc06d5a4c0 -d '{"name": "asd", "description": "hola", "type": "webhook", "id": "e6f77059e6d469a6c4c314cc06d5a4c0", "status": "stopped", "info": {"name": "lul", "url": "http://test"}}'
#curl -X POST localhost:5000/api/v1/hooks/new -d '{"name": "asd", "description": "hola", "type": "webhook"}'
#curl -X POST "https://europe-west1-shuffle-241517.cloudfunctions.net/webhook_982995716e67c3a549092d3a3a7921cd" -H "Content-Type:application/json" -H "Authorization: Bearer 144308d0-6aab-4d4f-8bb2-75189281ee26" --data '{"name":"Keyboard Cat"}' -v
#jcurl http://localhost:5001/api/v1/hooks/b4ba07c9-45d4-41f2-b260-83c8e99eba0c -H "Authorization: Bearer 144308d0-6aab-4d4f-8bb2-75189281ee26"
#curl https://shuffler.io/api/v1/hooks/b4ba07c9-45d4-41f2-b260-83c8e99eba0c -H "Authorization: Bearer 144308d0-6aab-4d4f-8bb2-75189281ee26"
#curl -X POST "http://localhost:8080" -H "Content-Type:application/json" -H "Authorization: Bearer 144308d0-6aab-4d4f-8bb2-75189281ee26" --data '{"test": {"hello": "HEYOOOO"}}' -v
#curl -X POST "https://europe-west1-shuffle-241517.cloudfunctions.net/webhook_3ceff795-ce9a-43a2-a2f5-d4401a6e772d" -H "Authorization: Bearer 144308d0-6aab-4d4f-8bb2-75189281ee26" --data 'wut'
curl POST "https://europe-west1-shuffler.cloudfunctions.net/outlooktrigger_be4dbb0a-d396-4544-bc36-e57d1bdb2e40" -H "Authorization: Bearer 144308d0-6aab-4d4f-8bb2-75189281ee26" --data 'wut' -vvv
+69
View File
@@ -0,0 +1,69 @@
# This is a script to test a function by itself
import requests
import json
def invoke(url, headers, message):
# Used for testing
try:
ret = requests.post(url, headers=headers, json=message, timeout=5)
print(ret.text)
print(ret.status_code)
except requests.exceptions.ConnectionError as e:
print(f"Requesterror: {e}")
def invoke_multi(url, headers, message):
cnt = 0
maxcnt = 100
print("Running %d requests towards %s." % (maxcnt, url))
while(1):
try:
ret = requests.post(url, headers=headers, json=message, timeout=1)
print(ret.status_code)
except requests.exceptions.ConnectionError as e:
print(f"Connectionerror: {e}")
except requests.exceptions.ReadTimeout as e:
print(f"Readtimeout: {e}")
cnt += 1
if cnt == maxcnt:
break
print("Done :)")
if __name__ == "__main__":
# Specific thingies for hello_world
message = {
"parameters": [{
"id_": "asd",
"name": "call",
"value": "REPEAT THIS DATA PLEASE THANKS",
"variant": "STATIC_VALUE",
}],
"name": "repeat_back_to_me",
"execution_id": "asd",
"label": "",
"position": "",
"app_name": "hello_world",
"app_version": "1.0.0",
"label": "lul",
"priority": "1",
"id_": "test",
"id": "test",
"authorization": "hey",
}
apikey = "eyJhbGciOiJSUzI1NiIsImtpZCI6IjYwZjQwNjBlNThkNzVmZDNmNzBiZWZmODhjNzk0YTc3NTMyN2FhMzEiLCJ0eXAiOiJKV1QifQ.eyJhdWQiOiJodHRwczovL3NodWZmbGVyLmlvL2FwaS92MS93b3JrZmxvd3MvMWQ5ZDhjZTItNTY2ZS00YzNmLThhMzctNWQ2YzdkMjAwMGI1L2V4ZWN1dGUiLCJhenAiOiIxMDMwNzY3ODIwNjE0MjQ2MTg0MjIiLCJlbWFpbCI6InNjaGVkdWxlckBzaHVmZmxlLTI0MTUxNy5pYW0uZ3NlcnZpY2VhY2NvdW50LmNvbSIsImVtYWlsX3ZlcmlmaWVkIjp0cnVlLCJleHAiOjE1NjU1Mjc1NTEsImlhdCI6MTU2NTUyMzk1MSwiaXNzIjoiaHR0cHM6Ly9hY2NvdW50cy5nb29nbGUuY29tIiwic3ViIjoiMTAzMDc2NzgyMDYxNDI0NjE4NDIyIn0.r0EDq9fjhf_5CPTiltyfk_L3uYJp577Uy0yYPcCAl2nv50_z_oUtbWGBpQLL8gcj-NGd3g4E52Qur8k6hCMIQweLS6WAb1279vGffEoCNDfkWb3Oy-yJGP1kzwLvqFJqnHLkSWYXNWvSyWnEimW8Rryx_m1BXS5wcA8l4NIr83kS7fPZrTwjnwFSeGSThwk91DVARzapQb8r0GEgOUyHZ1aBXnV98mikzSUt-5xFKe9eMdD22YJAj0Ru-DxAxs5nOqghX4PMRysWjshjOMrlR1piPWxqAmewp8YKZDCQ5gXskpeAFBDoULT971Wsx_NCohnJsFqx1JfPS9ZYMTW2oQ"
headers = {
"Content-Type": "application/json",
"Authorization": f"Bearer {apikey}"
}
location = "europe-west2"
functionname = "hello-world-1-0-6"
project = "shuffler"
url = f"https://{location}-{project}.cloudfunctions.net/{functionname}"
print(url)
invoke(url, headers, message)
#invoke_multi(url, headers, message)
+2
View File
@@ -0,0 +1,2 @@
curl localhost:5000/api/v1/schedules/apps
+2
View File
@@ -0,0 +1,2 @@
# Fails cus of unmarshal
curl -XPOST http://localhost:5001/api/v1/workflows/1d9d8ce2-566e-4c3f-8a37-5d6c7d2000b5/schedule -d '{"name": "hey", "frequency": "*/1 * * * *", "execution_argument": "{\"test\": \"hey\"}"}' -H "Authorization: Bearer eyJhbGciOiJSUzI1NiIsImtpZCI6IjYwZjQwNjBlNThkNzVmZDNmNzBiZWZmODhjNzk0YTc3NTMyN2FhMzEiLCJ0eXAiOiJKV1QifQ.eyJhdWQiOiJodHRwczovL3NodWZmbGVyLmlvL2FwaS92MS93b3JrZmxvd3MvMWQ5ZDhjZTItNTY2ZS00YzNmLThhMzctNWQ2YzdkMjAwMGI1L2V4ZWN1dGUiLCJhenAiOiIxMDMwNzY3ODIwNjE0MjQ2MTg0MjIiLCJlbWFpbCI6InNjaGVkdWxlckBzaHVmZmxlLTI0MTUxNy5pYW0uZ3NlcnZpY2VhY2NvdW50LmNvbSIsImVtYWlsX3ZlcmlmaWVkIjp0cnVlLCJleHAiOjE1NjU1Mjc1NTEsImlhdCI6MTU2NTUyMzk1MSwiaXNzIjoiaHR0cHM6Ly9hY2NvdW50cy5nb29nbGUuY29tIiwic3ViIjoiMTAzMDc2NzgyMDYxNDI0NjE4NDIyIn0.r0EDq9fjhf_5CPTiltyfk_L3uYJp577Uy0yYPcCAl2nv50_z_oUtbWGBpQLL8gcj-NGd3g4E52Qur8k6hCMIQweLS6WAb1279vGffEoCNDfkWb3Oy-yJGP1kzwLvqFJqnHLkSWYXNWvSyWnEimW8Rryx_m1BXS5wcA8l4NIr83kS7fPZrTwjnwFSeGSThwk91DVARzapQb8r0GEgOUyHZ1aBXnV98mikzSUt-5xFKe9eMdD22YJAj0Ru-DxAxs5nOqghX4PMRysWjshjOMrlR1piPWxqAmewp8YKZDCQ5gXskpeAFBDoULT971Wsx_NCohnJsFqx1JfPS9ZYMTW2oQ"
+3
View File
@@ -0,0 +1,3 @@
#curl -X POST -H "Content-Type: application/json" shuffler.io/functions/sendmail -H "Authorization: Bearer " -d '{"target": "frikky@shuffler.io", "body": "Hey, this is a body for something to look at", "subject": "SOS check me", "type": "alert", "sender_company": "shuffler"}'
curl -X POST -H "Content-Type: application/json" localhost:5001/functions/sendmail -H "Authorization: Bearer " -d '{"targets": ["frikky@shuffler.io", "rheyix.yt@gmail.com"], "body": "Hey, this is a body for something to look at", "subject": "SOS check me", "type": "alert", "sender_company": "shuffler"}'
+7
View File
@@ -0,0 +1,7 @@
#!/bin/bash
# Should give 401
curl localhost:5000/api/v1/uploadResult/asdasd -d {}
echo
# Should give 200 if it exists
curl localhost:5000/api/v1/uploadResult/e07910a06a086c83ba41827aa00b26ed -d '{"title": "helo","description": "wut", "type": "hi", "source": "wutface", "sourceRef": "halvor hei"}'
+1
View File
@@ -0,0 +1 @@
curl -H "Content-Type: application/json" localhost:5001/api/v1/triggers/9e845679-5843-4959-a76c-a6d664e9df35 -H "Authorization: Bearer 377469e8-dd5d-4521-8d9e-416d8d2f6fd4"
+4
View File
@@ -0,0 +1,4 @@
#!/bin/bash
curl http://localhost:5001/ws -H "Connections: Upgrade"
#curl -X POST "https://europe-west1-shuffle-241517.cloudfunctions.net/webhook_982995716e67c3a549092d3a3a7921cd" -H "Content-Type:application/json" -H "Authorization: Bearer 144308d0-6aab-4d4f-8bb2-75189281ee26" --data '{"name":"Keyboard Cat"}' -v
+202
View File
@@ -0,0 +1,202 @@
[
{
"actions": [
{
"app_name": "hello_world",
"app_version": "1.0.0",
"errors": [],
"id_": "2686a5d4-531d-158f-6b1a-0c1d23481304",
"is_valid": true,
"label": "check_bool",
"name": "check_bool",
"environment": "cloud",
"parameters": [],
"position": {
"x": 329.98133726556375,
"y": 160.01013778166904
},
"priority": 3
}
],
"branches": [
{
"destination_id": "6478ecae-b10e-88e9-e34d-9bbe6aff393d",
"id_": "5fd6a357-ae33-b1af-5dc2-0306efa28887",
"source_id": "2686a5d4-531d-158f-6b1a-0c1d23481304"
},
{
"destination_id": "2686a5d4-531d-158f-6b1a-0c1d23481304",
"id_": "d46d0b05-5757-5084-c339-70ac63985781",
"source_id": "6478ecae-b10e-88e9-e34d-9bbe6aff393d"
}
],
"conditions": [
{
"app_name": "Builtin",
"app_version": "1.0.0",
"conditional": "",
"errors": [],
"id_": "6478ecae-b10e-88e9-e34d-9bbe6aff393d",
"is_valid": true,
"label": "Condition",
"name": "Condition",
"position": {
"x": 320.97142988802364,
"y": 394.9753467582139
}
}
],
"description": "",
"errors": [],
"id_": "a5f82cfd-0f38-3474-20e2-f757f3718707",
"is_valid": true,
"name": "asd2",
"start": "2686a5d4-531d-158f-6b1a-0c1d23481304",
"tags": [],
"transforms": [],
"triggers": [],
"workflow_variables": []
},
{
"actions": [
{
"app_name": "hello_world",
"app_version": "1.0.0",
"errors": [],
"id_": "51df7c4f-b856-1aca-402b-9fec660b6505",
"is_valid": true,
"label": "wut",
"name": "hello_world",
"parameters": [],
"position": {
"x": 250,
"y": 150
},
"priority": 3
},
{
"app_name": "hello_world",
"app_version": "1.0.0",
"errors": [],
"id_": "36975212-3b9a-2e4c-4ad7-0ee5a6325842",
"is_valid": true,
"label": "check_bool",
"name": "check_bool",
"parameters": [],
"position": {
"x": 241.00207363715955,
"y": 294.9896318142021
},
"priority": 3
}
],
"branches": [
{
"destination_id": "36975212-3b9a-2e4c-4ad7-0ee5a6325842",
"id_": "44231b8f-4331-764e-0c1d-ccbc901d1309",
"source_id": "51df7c4f-b856-1aca-402b-9fec660b6505"
},
{
"destination_id": "51df7c4f-b856-1aca-402b-9fec660b6505",
"id_": "9b3dc561-e879-4877-c32e-ab7149d83b39",
"source_id": "36975212-3b9a-2e4c-4ad7-0ee5a6325842"
}
],
"conditions": [],
"description": "",
"errors": [],
"id_": "4e437698-fc18-29d3-e875-969b57354685",
"is_valid": true,
"name": "hi",
"start": "51df7c4f-b856-1aca-402b-9fec660b6505",
"tags": [],
"transforms": [],
"triggers": [],
"workflow_variables": []
},
{
"actions": [
{
"app_name": "hello_world",
"app_version": "1.0.0",
"errors": [],
"id_": "d0dbd1c4-dd61-6d4a-70e1-ac05dad0fe1f",
"is_valid": true,
"label": "i am bool",
"name": "check_bool",
"parameters": [],
"position": {
"x": 377.9998262128892,
"y": 330.01190441708906
},
"priority": 3
},
{
"app_name": "hello_world",
"app_version": "1.0.0",
"errors": [],
"id_": "39353c1c-b179-152c-f977-615a15a5de37",
"is_valid": true,
"label": "hello_world",
"name": "hello_world",
"parameters": [],
"position": {
"x": 375.2590614780782,
"y": 160.6226941577116
},
"priority": 3
}
],
"branches": [
{
"destination_id": "d0dbd1c4-dd61-6d4a-70e1-ac05dad0fe1f",
"id_": "7c81993f-5fd6-fc83-2f41-8074d6c8dc25",
"source_id": "39353c1c-b179-152c-f977-615a15a5de37"
}
],
"conditions": [],
"description": "",
"errors": [],
"id_": "af8467be-43ca-d38b-3f7e-9aeb922fb21a",
"is_valid": true,
"name": "new!",
"start": "39353c1c-b179-152c-f977-615a15a5de37",
"tags": [],
"transforms": [],
"triggers": [],
"workflow_variables": []
},
{
"actions": [
{
"app_name": "Builtin",
"app_version": "1.0.0",
"errors": [],
"id_": "7dddec9a-b493-8b58-9234-1b74dd9b420a",
"is_valid": true,
"label": "Boolean",
"name": "Boolean",
"parameters": [],
"position": {
"x": 350,
"y": 250
},
"priority": 3
}
],
"branches": [],
"conditions": [],
"description": "",
"errors": [
"Action Builtin.Boolean does not exist"
],
"id_": "07bae551-21e6-c0f5-4db3-81e8a1e8a805",
"is_valid": false,
"name": "wutface",
"start": "7dddec9a-b493-8b58-9234-1b74dd9b420a",
"tags": [],
"transforms": [],
"triggers": [],
"workflow_variables": []
}
]
+23
View File
@@ -0,0 +1,23 @@
#curl -X POST -H "Content-Type: application/json" localhost:5001/api/v1/workflows/3d14ca4a-67bd-8dfb-2673-2864f1ccf59c/execute -d '{"workflow_id": "3d14ca4a-67bd-8dfb-2673-2864f1ccf59c", "execution_id": "eaaa8d19-a761-12b8-cac2-f34eb50c3711"}'
curl -X POST -H "Content-Type: application/json" https://shuffle-241517.appspot.com/api/v1/workflows/3d14ca4a-67bd-8dfb-2673-2864f1ccf59c/execute -d '{"workflow_id": "3d14ca4a-67bd-8dfb-2673-2864f1ccf59c", "execution_id": "eaaa8d19-a761-12b8-cac2-f34eb50c3711"}'
#curl -X POST http://localhost:5001/api/v1/workflows/streams -H "Content-Type: application/json" \
# -d '{"execution_id": "eaaa8d19-a761-12b8-cac2-f34eb50c3711",
# "result": "hello_result",
# "started_at": 1562309342,
# "authorization": "afcc298d-c6c2-4b0d-8221-1603b44d072d",
# "status": "ABORTED",
# "action": {
# "app_name": "hi",
# "app_version": "ho",
# "id_": "this_is_an_id",
# "label": "wut",
# "name": "stream_testing",
# "parameters": [],
# "position": {
# "x": 100,
# "y": 100
# },
# "priority": 1
# }}'
+15
View File
@@ -0,0 +1,15 @@
# Get all workflows
curl localhost:5001/api/v1/workflows
# Get A workflow
#curl localhost:5001/api/v1/workflows/a5f82cfd-0f38-3474-20e2-f757f3718707
# NEW workflow
# curl -XPOST localhost:5001/api/v1/workflows -d '{"tags":[],"actions":[],"branches":[],"conditions":[{"label":"Condition","app_name":"Builtin","name":"Condition","conditional":"","id_":"18165f42-aab9-6c9a-0ef4-4e5a37a3b2ad","app_version":"1.0.0","position":{"x":224,"y":168}}],"workflow_variables":[],"name":"asd","start":"18165f42-aab9-6c9a-0ef4-4e5a37a3b2ad","id_":"3d14ca4a-67bd-8dfb-2673-2864f1ccf59c"}'
# Add a workflow
#curl localhost:5001/api/v1/workflows/a5f82cfd-0f38-3474-20e2-f757f3718707 -d '{"actions":[{"app_name":"hello_world","app_version":"1.0.0","errors":[],"id_":"2686a5d4-531d-158f-6b1a-0c1d23481304","is_valid":true,"label":"check_bool","name":"check_bool","parameters":[],"position":{"x":329.98133726556375,"y":160.01013778166904},"priority":3}],"branches":[{"destination_id":"6478ecae-b10e-88e9-e34d-9bbe6aff393d","id_":"5fd6a357-ae33-b1af-5dc2-0306efa28887","source_id":"2686a5d4-531d-158f-6b1a-0c1d23481304"},{"destination_id":"2686a5d4-531d-158f-6b1a-0c1d23481304","id_":"d46d0b05-5757-5084-c339-70ac63985781","source_id":"6478ecae-b10e-88e9-e34d-9bbe6aff393d"}],"conditions":[{"app_name":"Builtin","app_version":"1.0.0","conditional":"","errors":[],"id_":"6478ecae-b10e-88e9-e34d-9bbe6aff393d","is_valid":true,"label":"Condition","name":"Condition","position":{"x":320.97142988802364,"y":394.9753467582139}}],"description":"","errors":[],"id_":"a5f82cfd-0f38-3474-20e2-f757f3718707","is_valid":true,"name":"asd2","start":"2686a5d4-531d-158f-6b1a-0c1d23481304","tags":[],"transforms":[],"triggers":[],"workflow_variables":[]}'
# Execute a workflow
# curl -H "Content-Type: application/json" localhost:5001/api/v1/workflows/3d14ca4a-67bd-8dfb-2673-2864f1ccf59c/execute
#curl -X POST -H "Content-Type: application/json" localhost:5001/api/v1/workflows/3d14ca4a-67bd-8dfb-2673-2864f1ccf59c/execute -d '{"workflow_id": "3d14ca4a-67bd-8dfb-2673-2864f1ccf59c", "execution_id": "eaaa8d19-a761-12b8-cac2-f34eb50c3711"}'