mirror of
https://github.com/microsoft/onefuzz.git
synced 2025-06-11 09:41:37 +00:00
always set SignalR events at the end of handlers (#445)
Addresses an issue where events meant for SignalR do not get sent to the service when an App Service instance spins down before a timer event fires.
This commit is contained in:
parent
f3d81566e3
commit
b499b9b17d
@ -10,6 +10,7 @@ from onefuzztypes.requests import CanScheduleRequest
|
||||
from onefuzztypes.responses import CanSchedule
|
||||
|
||||
from ..onefuzzlib.endpoint_authorization import call_if_agent
|
||||
from ..onefuzzlib.events import get_events
|
||||
from ..onefuzzlib.pools import Node
|
||||
from ..onefuzzlib.request import not_ok, ok, parse_request
|
||||
from ..onefuzzlib.tasks.main import Task
|
||||
@ -42,7 +43,13 @@ def post(req: func.HttpRequest) -> func.HttpResponse:
|
||||
return ok(CanSchedule(allowed=allowed, work_stopped=work_stopped))
|
||||
|
||||
|
||||
def main(req: func.HttpRequest) -> func.HttpResponse:
|
||||
def main(req: func.HttpRequest, dashboard: func.Out[str]) -> func.HttpResponse:
|
||||
methods = {"POST": post}
|
||||
method = methods[req.method]
|
||||
return call_if_agent(req, method)
|
||||
result = call_if_agent(req, method)
|
||||
|
||||
events = get_events()
|
||||
if events:
|
||||
dashboard.set(events)
|
||||
|
||||
return result
|
||||
|
@ -1,20 +1,26 @@
|
||||
{
|
||||
"scriptFile": "__init__.py",
|
||||
"bindings": [
|
||||
{
|
||||
"authLevel": "anonymous",
|
||||
"type": "httpTrigger",
|
||||
"direction": "in",
|
||||
"name": "req",
|
||||
"methods": [
|
||||
"post"
|
||||
],
|
||||
"route": "agents/can_schedule"
|
||||
},
|
||||
{
|
||||
"type": "http",
|
||||
"direction": "out",
|
||||
"name": "$return"
|
||||
}
|
||||
]
|
||||
"scriptFile": "__init__.py",
|
||||
"bindings": [
|
||||
{
|
||||
"authLevel": "anonymous",
|
||||
"type": "httpTrigger",
|
||||
"direction": "in",
|
||||
"name": "req",
|
||||
"methods": [
|
||||
"post"
|
||||
],
|
||||
"route": "agents/can_schedule"
|
||||
},
|
||||
{
|
||||
"type": "http",
|
||||
"direction": "out",
|
||||
"name": "$return"
|
||||
},
|
||||
{
|
||||
"type": "signalR",
|
||||
"direction": "out",
|
||||
"name": "dashboard",
|
||||
"hubName": "dashboard"
|
||||
}
|
||||
]
|
||||
}
|
||||
|
@ -9,6 +9,7 @@ from onefuzztypes.requests import NodeCommandDelete, NodeCommandGet
|
||||
from onefuzztypes.responses import BoolResult, PendingNodeCommand
|
||||
|
||||
from ..onefuzzlib.endpoint_authorization import call_if_agent
|
||||
from ..onefuzzlib.events import get_events
|
||||
from ..onefuzzlib.pools import NodeMessage
|
||||
from ..onefuzzlib.request import not_ok, ok, parse_request
|
||||
|
||||
@ -42,7 +43,13 @@ def delete(req: func.HttpRequest) -> func.HttpResponse:
|
||||
return ok(BoolResult(result=True))
|
||||
|
||||
|
||||
def main(req: func.HttpRequest) -> func.HttpResponse:
|
||||
def main(req: func.HttpRequest, dashboard: func.Out[str]) -> func.HttpResponse:
|
||||
methods = {"DELETE": delete, "GET": get}
|
||||
method = methods[req.method]
|
||||
return call_if_agent(req, method)
|
||||
result = call_if_agent(req, method)
|
||||
|
||||
events = get_events()
|
||||
if events:
|
||||
dashboard.set(events)
|
||||
|
||||
return result
|
||||
|
@ -1,22 +1,28 @@
|
||||
{
|
||||
"scriptFile": "__init__.py",
|
||||
"bindings": [
|
||||
{
|
||||
"authLevel": "anonymous",
|
||||
"type": "httpTrigger",
|
||||
"direction": "in",
|
||||
"name": "req",
|
||||
"methods": [
|
||||
"get",
|
||||
"post",
|
||||
"delete"
|
||||
],
|
||||
"route": "agents/commands"
|
||||
},
|
||||
{
|
||||
"type": "http",
|
||||
"direction": "out",
|
||||
"name": "$return"
|
||||
}
|
||||
]
|
||||
"scriptFile": "__init__.py",
|
||||
"bindings": [
|
||||
{
|
||||
"authLevel": "anonymous",
|
||||
"type": "httpTrigger",
|
||||
"direction": "in",
|
||||
"name": "req",
|
||||
"methods": [
|
||||
"get",
|
||||
"post",
|
||||
"delete"
|
||||
],
|
||||
"route": "agents/commands"
|
||||
},
|
||||
{
|
||||
"type": "http",
|
||||
"direction": "out",
|
||||
"name": "$return"
|
||||
},
|
||||
{
|
||||
"type": "signalR",
|
||||
"direction": "out",
|
||||
"name": "dashboard",
|
||||
"hubName": "dashboard"
|
||||
}
|
||||
]
|
||||
}
|
||||
|
@ -18,6 +18,7 @@ from onefuzztypes.responses import BoolResult
|
||||
|
||||
from ..onefuzzlib.agent_events import on_state_update, on_worker_event
|
||||
from ..onefuzzlib.endpoint_authorization import call_if_agent
|
||||
from ..onefuzzlib.events import get_events
|
||||
from ..onefuzzlib.request import not_ok, ok, parse_request
|
||||
|
||||
|
||||
@ -71,7 +72,13 @@ def post(req: func.HttpRequest) -> func.HttpResponse:
|
||||
return ok(BoolResult(result=True))
|
||||
|
||||
|
||||
def main(req: func.HttpRequest) -> func.HttpResponse:
|
||||
def main(req: func.HttpRequest, dashboard: func.Out[str]) -> func.HttpResponse:
|
||||
methods = {"POST": post}
|
||||
method = methods[req.method]
|
||||
return call_if_agent(req, method)
|
||||
result = call_if_agent(req, method)
|
||||
|
||||
events = get_events()
|
||||
if events:
|
||||
dashboard.set(events)
|
||||
|
||||
return result
|
||||
|
@ -1,20 +1,26 @@
|
||||
{
|
||||
"scriptFile": "__init__.py",
|
||||
"bindings": [
|
||||
{
|
||||
"authLevel": "anonymous",
|
||||
"type": "httpTrigger",
|
||||
"direction": "in",
|
||||
"name": "req",
|
||||
"methods": [
|
||||
"post"
|
||||
],
|
||||
"route": "agents/events"
|
||||
},
|
||||
{
|
||||
"type": "http",
|
||||
"direction": "out",
|
||||
"name": "$return"
|
||||
}
|
||||
]
|
||||
}
|
||||
"scriptFile": "__init__.py",
|
||||
"bindings": [
|
||||
{
|
||||
"authLevel": "anonymous",
|
||||
"type": "httpTrigger",
|
||||
"direction": "in",
|
||||
"name": "req",
|
||||
"methods": [
|
||||
"post"
|
||||
],
|
||||
"route": "agents/events"
|
||||
},
|
||||
{
|
||||
"type": "http",
|
||||
"direction": "out",
|
||||
"name": "$return"
|
||||
},
|
||||
{
|
||||
"type": "signalR",
|
||||
"direction": "out",
|
||||
"name": "dashboard",
|
||||
"hubName": "dashboard"
|
||||
}
|
||||
]
|
||||
}
|
||||
|
@ -17,6 +17,7 @@ from ..onefuzzlib.azure.creds import get_instance_url
|
||||
from ..onefuzzlib.azure.queue import get_queue_sas
|
||||
from ..onefuzzlib.azure.storage import StorageType
|
||||
from ..onefuzzlib.endpoint_authorization import call_if_agent
|
||||
from ..onefuzzlib.events import get_events
|
||||
from ..onefuzzlib.pools import Node, NodeMessage, NodeTasks, Pool
|
||||
from ..onefuzzlib.request import not_ok, ok, parse_uri
|
||||
|
||||
@ -116,7 +117,13 @@ def post(req: func.HttpRequest) -> func.HttpResponse:
|
||||
return create_registration_response(node.machine_id, pool)
|
||||
|
||||
|
||||
def main(req: func.HttpRequest) -> func.HttpResponse:
|
||||
def main(req: func.HttpRequest, dashboard: func.Out[str]) -> func.HttpResponse:
|
||||
methods = {"POST": post, "GET": get}
|
||||
method = methods[req.method]
|
||||
return call_if_agent(req, method)
|
||||
result = call_if_agent(req, method)
|
||||
|
||||
events = get_events()
|
||||
if events:
|
||||
dashboard.set(events)
|
||||
|
||||
return result
|
||||
|
@ -1,22 +1,28 @@
|
||||
{
|
||||
"scriptFile": "__init__.py",
|
||||
"bindings": [
|
||||
{
|
||||
"authLevel": "anonymous",
|
||||
"type": "httpTrigger",
|
||||
"direction": "in",
|
||||
"name": "req",
|
||||
"methods": [
|
||||
"get",
|
||||
"post",
|
||||
"delete"
|
||||
],
|
||||
"route": "agents/registration"
|
||||
},
|
||||
{
|
||||
"type": "http",
|
||||
"direction": "out",
|
||||
"name": "$return"
|
||||
}
|
||||
]
|
||||
"scriptFile": "__init__.py",
|
||||
"bindings": [
|
||||
{
|
||||
"authLevel": "anonymous",
|
||||
"type": "httpTrigger",
|
||||
"direction": "in",
|
||||
"name": "req",
|
||||
"methods": [
|
||||
"get",
|
||||
"post",
|
||||
"delete"
|
||||
],
|
||||
"route": "agents/registration"
|
||||
},
|
||||
{
|
||||
"type": "http",
|
||||
"direction": "out",
|
||||
"name": "$return"
|
||||
},
|
||||
{
|
||||
"type": "signalR",
|
||||
"direction": "out",
|
||||
"name": "dashboard",
|
||||
"hubName": "dashboard"
|
||||
}
|
||||
]
|
||||
}
|
||||
|
@ -21,6 +21,7 @@ from ..onefuzzlib.azure.containers import (
|
||||
)
|
||||
from ..onefuzzlib.azure.storage import StorageType
|
||||
from ..onefuzzlib.endpoint_authorization import call_if_user
|
||||
from ..onefuzzlib.events import get_events
|
||||
from ..onefuzzlib.request import not_ok, ok, parse_request
|
||||
|
||||
|
||||
@ -89,7 +90,13 @@ def delete(req: func.HttpRequest) -> func.HttpResponse:
|
||||
return ok(BoolResult(result=delete_container(request.name, StorageType.corpus)))
|
||||
|
||||
|
||||
def main(req: func.HttpRequest) -> func.HttpResponse:
|
||||
def main(req: func.HttpRequest, dashboard: func.Out[str]) -> func.HttpResponse:
|
||||
methods = {"GET": get, "POST": post, "DELETE": delete}
|
||||
method = methods[req.method]
|
||||
return call_if_user(req, method)
|
||||
result = call_if_user(req, method)
|
||||
|
||||
events = get_events()
|
||||
if events:
|
||||
dashboard.set(events)
|
||||
|
||||
return result
|
||||
|
@ -16,6 +16,12 @@
|
||||
"type": "http",
|
||||
"direction": "out",
|
||||
"name": "$return"
|
||||
},
|
||||
{
|
||||
"type": "signalR",
|
||||
"direction": "out",
|
||||
"name": "dashboard",
|
||||
"hubName": "dashboard"
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
|
@ -14,6 +14,7 @@ from ..onefuzzlib.azure.containers import (
|
||||
)
|
||||
from ..onefuzzlib.azure.storage import StorageType
|
||||
from ..onefuzzlib.endpoint_authorization import call_if_user
|
||||
from ..onefuzzlib.events import get_events
|
||||
from ..onefuzzlib.request import not_ok, parse_uri, redirect
|
||||
|
||||
|
||||
@ -46,7 +47,13 @@ def get(req: func.HttpRequest) -> func.HttpResponse:
|
||||
)
|
||||
|
||||
|
||||
def main(req: func.HttpRequest) -> func.HttpResponse:
|
||||
def main(req: func.HttpRequest, dashboard: func.Out[str]) -> func.HttpResponse:
|
||||
methods = {"GET": get}
|
||||
method = methods[req.method]
|
||||
return call_if_user(req, method)
|
||||
result = call_if_user(req, method)
|
||||
|
||||
events = get_events()
|
||||
if events:
|
||||
dashboard.set(events)
|
||||
|
||||
return result
|
||||
|
@ -1,19 +1,25 @@
|
||||
{
|
||||
"scriptFile": "__init__.py",
|
||||
"bindings": [
|
||||
{
|
||||
"authLevel": "anonymous",
|
||||
"type": "httpTrigger",
|
||||
"direction": "in",
|
||||
"name": "req",
|
||||
"methods": [
|
||||
"get"
|
||||
]
|
||||
},
|
||||
{
|
||||
"type": "http",
|
||||
"direction": "out",
|
||||
"name": "$return"
|
||||
}
|
||||
]
|
||||
}
|
||||
"scriptFile": "__init__.py",
|
||||
"bindings": [
|
||||
{
|
||||
"authLevel": "anonymous",
|
||||
"type": "httpTrigger",
|
||||
"direction": "in",
|
||||
"name": "req",
|
||||
"methods": [
|
||||
"get"
|
||||
]
|
||||
},
|
||||
{
|
||||
"type": "http",
|
||||
"direction": "out",
|
||||
"name": "$return"
|
||||
},
|
||||
{
|
||||
"type": "signalR",
|
||||
"direction": "out",
|
||||
"name": "dashboard",
|
||||
"hubName": "dashboard"
|
||||
}
|
||||
]
|
||||
}
|
||||
|
@ -14,12 +14,13 @@ from ..onefuzzlib.azure.creds import (
|
||||
get_instance_id,
|
||||
get_subscription,
|
||||
)
|
||||
from ..onefuzzlib.events import get_events
|
||||
from ..onefuzzlib.request import ok
|
||||
from ..onefuzzlib.versions import versions
|
||||
|
||||
|
||||
def main(req: func.HttpRequest) -> func.HttpResponse:
|
||||
return ok(
|
||||
def main(req: func.HttpRequest, dashboard: func.Out[str]) -> func.HttpResponse:
|
||||
response = ok(
|
||||
Info(
|
||||
resource_group=get_base_resource_group(),
|
||||
region=get_base_region(),
|
||||
@ -30,3 +31,9 @@ def main(req: func.HttpRequest) -> func.HttpResponse:
|
||||
insights_instrumentation_key=get_insights_instrumentation_key(),
|
||||
)
|
||||
)
|
||||
|
||||
events = get_events()
|
||||
if events:
|
||||
dashboard.set(events)
|
||||
|
||||
return response
|
||||
|
@ -1,19 +1,25 @@
|
||||
{
|
||||
"scriptFile": "__init__.py",
|
||||
"bindings": [
|
||||
{
|
||||
"authLevel": "anonymous",
|
||||
"type": "httpTrigger",
|
||||
"direction": "in",
|
||||
"name": "req",
|
||||
"methods": [
|
||||
"get"
|
||||
]
|
||||
},
|
||||
{
|
||||
"type": "http",
|
||||
"direction": "out",
|
||||
"name": "$return"
|
||||
}
|
||||
]
|
||||
}
|
||||
"scriptFile": "__init__.py",
|
||||
"bindings": [
|
||||
{
|
||||
"authLevel": "anonymous",
|
||||
"type": "httpTrigger",
|
||||
"direction": "in",
|
||||
"name": "req",
|
||||
"methods": [
|
||||
"get"
|
||||
]
|
||||
},
|
||||
{
|
||||
"type": "http",
|
||||
"direction": "out",
|
||||
"name": "$return"
|
||||
},
|
||||
{
|
||||
"type": "signalR",
|
||||
"direction": "out",
|
||||
"name": "dashboard",
|
||||
"hubName": "dashboard"
|
||||
}
|
||||
]
|
||||
}
|
||||
|
@ -8,6 +8,7 @@ from onefuzztypes.job_templates import JobTemplateRequest
|
||||
from onefuzztypes.models import Error
|
||||
|
||||
from ..onefuzzlib.endpoint_authorization import call_if_user
|
||||
from ..onefuzzlib.events import get_events
|
||||
from ..onefuzzlib.job_templates.templates import JobTemplateIndex
|
||||
from ..onefuzzlib.request import not_ok, ok, parse_request
|
||||
from ..onefuzzlib.user_credentials import parse_jwt_token
|
||||
@ -34,7 +35,13 @@ def post(req: func.HttpRequest) -> func.HttpResponse:
|
||||
return ok(job)
|
||||
|
||||
|
||||
def main(req: func.HttpRequest) -> func.HttpResponse:
|
||||
def main(req: func.HttpRequest, dashboard: func.Out[str]) -> func.HttpResponse:
|
||||
methods = {"GET": get, "POST": post}
|
||||
method = methods[req.method]
|
||||
return call_if_user(req, method)
|
||||
result = call_if_user(req, method)
|
||||
|
||||
events = get_events()
|
||||
if events:
|
||||
dashboard.set(events)
|
||||
|
||||
return result
|
||||
|
@ -15,6 +15,12 @@
|
||||
"type": "http",
|
||||
"direction": "out",
|
||||
"name": "$return"
|
||||
},
|
||||
{
|
||||
"type": "signalR",
|
||||
"direction": "out",
|
||||
"name": "dashboard",
|
||||
"hubName": "dashboard"
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
|
@ -14,6 +14,7 @@ from onefuzztypes.models import Error
|
||||
from onefuzztypes.responses import BoolResult
|
||||
|
||||
from ..onefuzzlib.endpoint_authorization import call_if_user
|
||||
from ..onefuzzlib.events import get_events
|
||||
from ..onefuzzlib.job_templates.templates import JobTemplateIndex
|
||||
from ..onefuzzlib.request import not_ok, ok, parse_request
|
||||
|
||||
@ -61,7 +62,13 @@ def delete(req: func.HttpRequest) -> func.HttpResponse:
|
||||
return ok(BoolResult(result=entry is not None))
|
||||
|
||||
|
||||
def main(req: func.HttpRequest) -> func.HttpResponse:
|
||||
def main(req: func.HttpRequest, dashboard: func.Out[str]) -> func.HttpResponse:
|
||||
methods = {"GET": get, "POST": post, "DELETE": delete}
|
||||
method = methods[req.method]
|
||||
return call_if_user(req, method)
|
||||
result = call_if_user(req, method)
|
||||
|
||||
events = get_events()
|
||||
if events:
|
||||
dashboard.set(events)
|
||||
|
||||
return result
|
||||
|
@ -17,6 +17,12 @@
|
||||
"type": "http",
|
||||
"direction": "out",
|
||||
"name": "$return"
|
||||
},
|
||||
{
|
||||
"type": "signalR",
|
||||
"direction": "out",
|
||||
"name": "dashboard",
|
||||
"hubName": "dashboard"
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
|
@ -9,6 +9,7 @@ from onefuzztypes.models import Error, JobConfig, JobTaskInfo
|
||||
from onefuzztypes.requests import JobGet, JobSearch
|
||||
|
||||
from ..onefuzzlib.endpoint_authorization import call_if_user
|
||||
from ..onefuzzlib.events import get_events
|
||||
from ..onefuzzlib.jobs import Job
|
||||
from ..onefuzzlib.request import not_ok, ok, parse_request
|
||||
from ..onefuzzlib.tasks.main import Task
|
||||
@ -74,7 +75,13 @@ def delete(req: func.HttpRequest) -> func.HttpResponse:
|
||||
return ok(job)
|
||||
|
||||
|
||||
def main(req: func.HttpRequest) -> func.HttpResponse:
|
||||
def main(req: func.HttpRequest, dashboard: func.Out[str]) -> func.HttpResponse:
|
||||
methods = {"GET": get, "POST": post, "DELETE": delete}
|
||||
method = methods[req.method]
|
||||
return call_if_user(req, method)
|
||||
result = call_if_user(req, method)
|
||||
|
||||
events = get_events()
|
||||
if events:
|
||||
dashboard.set(events)
|
||||
|
||||
return result
|
||||
|
@ -16,6 +16,12 @@
|
||||
"type": "http",
|
||||
"direction": "out",
|
||||
"name": "$return"
|
||||
},
|
||||
{
|
||||
"type": "signalR",
|
||||
"direction": "out",
|
||||
"name": "dashboard",
|
||||
"hubName": "dashboard"
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
|
@ -22,4 +22,4 @@
|
||||
"hubName": "dashboard"
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
|
@ -10,6 +10,7 @@ from onefuzztypes.requests import NodeGet, NodeSearch, NodeUpdate
|
||||
from onefuzztypes.responses import BoolResult
|
||||
|
||||
from ..onefuzzlib.endpoint_authorization import call_if_user
|
||||
from ..onefuzzlib.events import get_events
|
||||
from ..onefuzzlib.pools import Node, NodeTasks
|
||||
from ..onefuzzlib.request import not_ok, ok, parse_request
|
||||
|
||||
@ -100,7 +101,13 @@ def patch(req: func.HttpRequest) -> func.HttpResponse:
|
||||
return ok(BoolResult(result=True))
|
||||
|
||||
|
||||
def main(req: func.HttpRequest) -> func.HttpResponse:
|
||||
def main(req: func.HttpRequest, dashboard: func.Out[str]) -> func.HttpResponse:
|
||||
methods = {"GET": get, "PATCH": patch, "DELETE": delete, "POST": post}
|
||||
method = methods[req.method]
|
||||
return call_if_user(req, method)
|
||||
result = call_if_user(req, method)
|
||||
|
||||
events = get_events()
|
||||
if events:
|
||||
dashboard.set(events)
|
||||
|
||||
return result
|
||||
|
@ -1,22 +1,28 @@
|
||||
{
|
||||
"scriptFile": "__init__.py",
|
||||
"bindings": [
|
||||
{
|
||||
"authLevel": "anonymous",
|
||||
"type": "httpTrigger",
|
||||
"direction": "in",
|
||||
"name": "req",
|
||||
"methods": [
|
||||
"get",
|
||||
"patch",
|
||||
"delete",
|
||||
"post"
|
||||
]
|
||||
},
|
||||
{
|
||||
"type": "http",
|
||||
"direction": "out",
|
||||
"name": "$return"
|
||||
}
|
||||
]
|
||||
}
|
||||
"scriptFile": "__init__.py",
|
||||
"bindings": [
|
||||
{
|
||||
"authLevel": "anonymous",
|
||||
"type": "httpTrigger",
|
||||
"direction": "in",
|
||||
"name": "req",
|
||||
"methods": [
|
||||
"get",
|
||||
"patch",
|
||||
"delete",
|
||||
"post"
|
||||
]
|
||||
},
|
||||
{
|
||||
"type": "http",
|
||||
"direction": "out",
|
||||
"name": "$return"
|
||||
},
|
||||
{
|
||||
"type": "signalR",
|
||||
"direction": "out",
|
||||
"name": "dashboard",
|
||||
"hubName": "dashboard"
|
||||
}
|
||||
]
|
||||
}
|
||||
|
@ -9,6 +9,8 @@ from onefuzztypes.models import Error
|
||||
from onefuzztypes.requests import NodeAddSshKey
|
||||
from onefuzztypes.responses import BoolResult
|
||||
|
||||
from ..onefuzzlib.endpoint_authorization import call_if_user
|
||||
from ..onefuzzlib.events import get_events
|
||||
from ..onefuzzlib.pools import Node
|
||||
from ..onefuzzlib.request import not_ok, ok, parse_request
|
||||
|
||||
@ -31,8 +33,13 @@ def post(req: func.HttpRequest) -> func.HttpResponse:
|
||||
return ok(BoolResult(result=True))
|
||||
|
||||
|
||||
def main(req: func.HttpRequest) -> func.HttpResponse:
|
||||
if req.method == "POST":
|
||||
return post(req)
|
||||
else:
|
||||
raise Exception("invalid method")
|
||||
def main(req: func.HttpRequest, dashboard: func.Out[str]) -> func.HttpResponse:
|
||||
methods = {"POST": post}
|
||||
method = methods[req.method]
|
||||
result = call_if_user(req, method)
|
||||
|
||||
events = get_events()
|
||||
if events:
|
||||
dashboard.set(events)
|
||||
|
||||
return result
|
||||
|
@ -1,20 +1,26 @@
|
||||
{
|
||||
"scriptFile": "__init__.py",
|
||||
"bindings": [
|
||||
{
|
||||
"authLevel": "anonymous",
|
||||
"type": "httpTrigger",
|
||||
"direction": "in",
|
||||
"name": "req",
|
||||
"methods": [
|
||||
"post"
|
||||
],
|
||||
"route": "node/add_ssh_key"
|
||||
},
|
||||
{
|
||||
"type": "http",
|
||||
"direction": "out",
|
||||
"name": "$return"
|
||||
}
|
||||
]
|
||||
}
|
||||
"scriptFile": "__init__.py",
|
||||
"bindings": [
|
||||
{
|
||||
"authLevel": "anonymous",
|
||||
"type": "httpTrigger",
|
||||
"direction": "in",
|
||||
"name": "req",
|
||||
"methods": [
|
||||
"post"
|
||||
],
|
||||
"route": "node/add_ssh_key"
|
||||
},
|
||||
{
|
||||
"type": "http",
|
||||
"direction": "out",
|
||||
"name": "$return"
|
||||
},
|
||||
{
|
||||
"type": "signalR",
|
||||
"direction": "out",
|
||||
"name": "dashboard",
|
||||
"hubName": "dashboard"
|
||||
}
|
||||
]
|
||||
}
|
||||
|
@ -10,6 +10,7 @@ from onefuzztypes.models import Error
|
||||
from onefuzztypes.requests import NotificationCreate, NotificationGet
|
||||
|
||||
from ..onefuzzlib.endpoint_authorization import call_if_user
|
||||
from ..onefuzzlib.events import get_events
|
||||
from ..onefuzzlib.notifications.main import Notification
|
||||
from ..onefuzzlib.request import not_ok, ok, parse_request
|
||||
|
||||
@ -49,7 +50,13 @@ def delete(req: func.HttpRequest) -> func.HttpResponse:
|
||||
return ok(entry)
|
||||
|
||||
|
||||
def main(req: func.HttpRequest) -> func.HttpResponse:
|
||||
def main(req: func.HttpRequest, dashboard: func.Out[str]) -> func.HttpResponse:
|
||||
methods = {"GET": get, "POST": post, "DELETE": delete}
|
||||
method = methods[req.method]
|
||||
return call_if_user(req, method)
|
||||
result = call_if_user(req, method)
|
||||
|
||||
events = get_events()
|
||||
if events:
|
||||
dashboard.set(events)
|
||||
|
||||
return result
|
||||
|
@ -16,6 +16,12 @@
|
||||
"type": "http",
|
||||
"direction": "out",
|
||||
"name": "$return"
|
||||
},
|
||||
{
|
||||
"type": "signalR",
|
||||
"direction": "out",
|
||||
"name": "dashboard",
|
||||
"hubName": "dashboard"
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
|
@ -22,6 +22,7 @@ from ..onefuzzlib.azure.queue import get_queue_sas
|
||||
from ..onefuzzlib.azure.storage import StorageType
|
||||
from ..onefuzzlib.azure.vmss import list_available_skus
|
||||
from ..onefuzzlib.endpoint_authorization import call_if_user
|
||||
from ..onefuzzlib.events import get_events
|
||||
from ..onefuzzlib.pools import Pool
|
||||
from ..onefuzzlib.request import not_ok, ok, parse_request
|
||||
|
||||
@ -131,7 +132,13 @@ def delete(req: func.HttpRequest) -> func.HttpResponse:
|
||||
return ok(BoolResult(result=True))
|
||||
|
||||
|
||||
def main(req: func.HttpRequest) -> func.HttpResponse:
|
||||
def main(req: func.HttpRequest, dashboard: func.Out[str]) -> func.HttpResponse:
|
||||
methods = {"GET": get, "POST": post, "DELETE": delete}
|
||||
method = methods[req.method]
|
||||
return call_if_user(req, method)
|
||||
result = call_if_user(req, method)
|
||||
|
||||
events = get_events()
|
||||
if events:
|
||||
dashboard.set(events)
|
||||
|
||||
return result
|
||||
|
@ -1,22 +1,28 @@
|
||||
{
|
||||
"scriptFile": "__init__.py",
|
||||
"bindings": [
|
||||
{
|
||||
"authLevel": "anonymous",
|
||||
"type": "httpTrigger",
|
||||
"direction": "in",
|
||||
"name": "req",
|
||||
"methods": [
|
||||
"get",
|
||||
"post",
|
||||
"delete",
|
||||
"patch"
|
||||
]
|
||||
},
|
||||
{
|
||||
"type": "http",
|
||||
"direction": "out",
|
||||
"name": "$return"
|
||||
}
|
||||
]
|
||||
}
|
||||
"scriptFile": "__init__.py",
|
||||
"bindings": [
|
||||
{
|
||||
"authLevel": "anonymous",
|
||||
"type": "httpTrigger",
|
||||
"direction": "in",
|
||||
"name": "req",
|
||||
"methods": [
|
||||
"get",
|
||||
"post",
|
||||
"delete",
|
||||
"patch"
|
||||
]
|
||||
},
|
||||
{
|
||||
"type": "http",
|
||||
"direction": "out",
|
||||
"name": "$return"
|
||||
},
|
||||
{
|
||||
"type": "signalR",
|
||||
"direction": "out",
|
||||
"name": "dashboard",
|
||||
"hubName": "dashboard"
|
||||
}
|
||||
]
|
||||
}
|
||||
|
@ -12,6 +12,7 @@ from onefuzztypes.requests import ProxyCreate, ProxyDelete, ProxyGet, ProxyReset
|
||||
from onefuzztypes.responses import BoolResult, ProxyGetResult
|
||||
|
||||
from ..onefuzzlib.endpoint_authorization import call_if_user
|
||||
from ..onefuzzlib.events import get_events
|
||||
from ..onefuzzlib.pools import Scaleset
|
||||
from ..onefuzzlib.proxy import Proxy
|
||||
from ..onefuzzlib.proxy_forward import ProxyForward
|
||||
@ -114,7 +115,13 @@ def delete(req: func.HttpRequest) -> func.HttpResponse:
|
||||
return ok(BoolResult(result=True))
|
||||
|
||||
|
||||
def main(req: func.HttpRequest) -> func.HttpResponse:
|
||||
def main(req: func.HttpRequest, dashboard: func.Out[str]) -> func.HttpResponse:
|
||||
methods = {"GET": get, "POST": post, "DELETE": delete, "PATCH": patch}
|
||||
method = methods[req.method]
|
||||
return call_if_user(req, method)
|
||||
result = call_if_user(req, method)
|
||||
|
||||
events = get_events()
|
||||
if events:
|
||||
dashboard.set(events)
|
||||
|
||||
return result
|
||||
|
@ -1,22 +1,28 @@
|
||||
{
|
||||
"scriptFile": "__init__.py",
|
||||
"bindings": [
|
||||
{
|
||||
"authLevel": "anonymous",
|
||||
"type": "httpTrigger",
|
||||
"direction": "in",
|
||||
"name": "req",
|
||||
"methods": [
|
||||
"get",
|
||||
"post",
|
||||
"delete",
|
||||
"patch"
|
||||
]
|
||||
},
|
||||
{
|
||||
"type": "http",
|
||||
"direction": "out",
|
||||
"name": "$return"
|
||||
}
|
||||
]
|
||||
}
|
||||
"scriptFile": "__init__.py",
|
||||
"bindings": [
|
||||
{
|
||||
"authLevel": "anonymous",
|
||||
"type": "httpTrigger",
|
||||
"direction": "in",
|
||||
"name": "req",
|
||||
"methods": [
|
||||
"get",
|
||||
"post",
|
||||
"delete",
|
||||
"patch"
|
||||
]
|
||||
},
|
||||
{
|
||||
"type": "http",
|
||||
"direction": "out",
|
||||
"name": "$return"
|
||||
},
|
||||
{
|
||||
"type": "signalR",
|
||||
"direction": "out",
|
||||
"name": "dashboard",
|
||||
"hubName": "dashboard"
|
||||
}
|
||||
]
|
||||
}
|
||||
|
@ -1,18 +1,18 @@
|
||||
{
|
||||
"scriptFile": "__init__.py",
|
||||
"bindings": [
|
||||
{
|
||||
"name": "msg",
|
||||
"type": "queueTrigger",
|
||||
"direction": "in",
|
||||
"queueName": "proxy",
|
||||
"connection": "AzureWebJobsStorage"
|
||||
},
|
||||
{
|
||||
"type": "signalR",
|
||||
"direction": "out",
|
||||
"name": "dashboard",
|
||||
"hubName": "dashboard"
|
||||
}
|
||||
]
|
||||
}
|
||||
"scriptFile": "__init__.py",
|
||||
"bindings": [
|
||||
{
|
||||
"name": "msg",
|
||||
"type": "queueTrigger",
|
||||
"direction": "in",
|
||||
"queueName": "proxy",
|
||||
"connection": "AzureWebJobsStorage"
|
||||
},
|
||||
{
|
||||
"type": "signalR",
|
||||
"direction": "out",
|
||||
"name": "dashboard",
|
||||
"hubName": "dashboard"
|
||||
}
|
||||
]
|
||||
}
|
||||
|
@ -1,18 +1,18 @@
|
||||
{
|
||||
"scriptFile": "__init__.py",
|
||||
"bindings": [
|
||||
{
|
||||
"name": "msg",
|
||||
"type": "queueTrigger",
|
||||
"direction": "in",
|
||||
"queueName": "file-changes",
|
||||
"connection": "AzureWebJobsStorage"
|
||||
},
|
||||
{
|
||||
"type": "signalR",
|
||||
"direction": "out",
|
||||
"name": "dashboard",
|
||||
"hubName": "dashboard"
|
||||
}
|
||||
]
|
||||
}
|
||||
"scriptFile": "__init__.py",
|
||||
"bindings": [
|
||||
{
|
||||
"name": "msg",
|
||||
"type": "queueTrigger",
|
||||
"direction": "in",
|
||||
"queueName": "file-changes",
|
||||
"connection": "AzureWebJobsStorage"
|
||||
},
|
||||
{
|
||||
"type": "signalR",
|
||||
"direction": "out",
|
||||
"name": "dashboard",
|
||||
"hubName": "dashboard"
|
||||
}
|
||||
]
|
||||
}
|
||||
|
@ -1,18 +1,18 @@
|
||||
{
|
||||
"scriptFile": "__init__.py",
|
||||
"bindings": [
|
||||
{
|
||||
"name": "msg",
|
||||
"type": "queueTrigger",
|
||||
"direction": "in",
|
||||
"queueName": "node-heartbeat",
|
||||
"connection": "AzureWebJobsStorage"
|
||||
},
|
||||
{
|
||||
"type": "signalR",
|
||||
"direction": "out",
|
||||
"name": "dashboard",
|
||||
"hubName": "dashboard"
|
||||
}
|
||||
]
|
||||
}
|
||||
"scriptFile": "__init__.py",
|
||||
"bindings": [
|
||||
{
|
||||
"name": "msg",
|
||||
"type": "queueTrigger",
|
||||
"direction": "in",
|
||||
"queueName": "node-heartbeat",
|
||||
"connection": "AzureWebJobsStorage"
|
||||
},
|
||||
{
|
||||
"type": "signalR",
|
||||
"direction": "out",
|
||||
"name": "dashboard",
|
||||
"hubName": "dashboard"
|
||||
}
|
||||
]
|
||||
}
|
||||
|
@ -1,18 +1,18 @@
|
||||
{
|
||||
"scriptFile": "__init__.py",
|
||||
"bindings": [
|
||||
{
|
||||
"name": "msg",
|
||||
"type": "queueTrigger",
|
||||
"direction": "in",
|
||||
"queueName": "task-heartbeat",
|
||||
"connection": "AzureWebJobsStorage"
|
||||
},
|
||||
{
|
||||
"type": "signalR",
|
||||
"direction": "out",
|
||||
"name": "dashboard",
|
||||
"hubName": "dashboard"
|
||||
}
|
||||
]
|
||||
}
|
||||
"scriptFile": "__init__.py",
|
||||
"bindings": [
|
||||
{
|
||||
"name": "msg",
|
||||
"type": "queueTrigger",
|
||||
"direction": "in",
|
||||
"queueName": "task-heartbeat",
|
||||
"connection": "AzureWebJobsStorage"
|
||||
},
|
||||
{
|
||||
"type": "signalR",
|
||||
"direction": "out",
|
||||
"name": "dashboard",
|
||||
"hubName": "dashboard"
|
||||
}
|
||||
]
|
||||
}
|
||||
|
@ -1,18 +1,18 @@
|
||||
{
|
||||
"scriptFile": "__init__.py",
|
||||
"bindings": [
|
||||
{
|
||||
"name": "msg",
|
||||
"type": "queueTrigger",
|
||||
"direction": "in",
|
||||
"queueName": "update-queue",
|
||||
"connection": "AzureWebJobsStorage"
|
||||
},
|
||||
{
|
||||
"type": "signalR",
|
||||
"direction": "out",
|
||||
"name": "dashboard",
|
||||
"hubName": "dashboard"
|
||||
}
|
||||
]
|
||||
}
|
||||
"scriptFile": "__init__.py",
|
||||
"bindings": [
|
||||
{
|
||||
"name": "msg",
|
||||
"type": "queueTrigger",
|
||||
"direction": "in",
|
||||
"queueName": "update-queue",
|
||||
"connection": "AzureWebJobsStorage"
|
||||
},
|
||||
{
|
||||
"type": "signalR",
|
||||
"direction": "out",
|
||||
"name": "dashboard",
|
||||
"hubName": "dashboard"
|
||||
}
|
||||
]
|
||||
}
|
||||
|
@ -7,10 +7,15 @@ import json
|
||||
|
||||
import azure.functions as func
|
||||
|
||||
from ..onefuzzlib.events import get_events
|
||||
from ..onefuzzlib.webhooks import WebhookMessageLog, WebhookMessageQueueObj
|
||||
|
||||
|
||||
def main(msg: func.QueueMessage) -> None:
|
||||
def main(msg: func.QueueMessage, dashboard: func.Out[str]) -> None:
|
||||
body = msg.get_body()
|
||||
obj = WebhookMessageQueueObj.parse_obj(json.loads(body))
|
||||
WebhookMessageLog.process_from_queue(obj)
|
||||
|
||||
events = get_events()
|
||||
if events:
|
||||
dashboard.set(events)
|
||||
|
@ -1,12 +1,18 @@
|
||||
{
|
||||
"scriptFile": "__init__.py",
|
||||
"bindings": [
|
||||
{
|
||||
"name": "msg",
|
||||
"type": "queueTrigger",
|
||||
"direction": "in",
|
||||
"queueName": "webhooks",
|
||||
"connection": "AzureWebJobsStorage"
|
||||
}
|
||||
]
|
||||
}
|
||||
"scriptFile": "__init__.py",
|
||||
"bindings": [
|
||||
{
|
||||
"name": "msg",
|
||||
"type": "queueTrigger",
|
||||
"direction": "in",
|
||||
"queueName": "webhooks",
|
||||
"connection": "AzureWebJobsStorage"
|
||||
},
|
||||
{
|
||||
"type": "signalR",
|
||||
"direction": "out",
|
||||
"name": "dashboard",
|
||||
"hubName": "dashboard"
|
||||
}
|
||||
]
|
||||
}
|
||||
|
@ -9,6 +9,7 @@ from onefuzztypes.models import Error, ReproConfig
|
||||
from onefuzztypes.requests import ReproGet
|
||||
|
||||
from ..onefuzzlib.endpoint_authorization import call_if_user
|
||||
from ..onefuzzlib.events import get_events
|
||||
from ..onefuzzlib.repro import Repro
|
||||
from ..onefuzzlib.request import not_ok, ok, parse_request
|
||||
from ..onefuzzlib.user_credentials import parse_jwt_token
|
||||
@ -73,7 +74,13 @@ def delete(req: func.HttpRequest) -> func.HttpResponse:
|
||||
return ok(vm)
|
||||
|
||||
|
||||
def main(req: func.HttpRequest) -> func.HttpResponse:
|
||||
def main(req: func.HttpRequest, dashboard: func.Out[str]) -> func.HttpResponse:
|
||||
methods = {"GET": get, "POST": post, "DELETE": delete}
|
||||
method = methods[req.method]
|
||||
return call_if_user(req, method)
|
||||
result = call_if_user(req, method)
|
||||
|
||||
events = get_events()
|
||||
if events:
|
||||
dashboard.set(events)
|
||||
|
||||
return result
|
||||
|
@ -16,6 +16,12 @@
|
||||
"type": "http",
|
||||
"direction": "out",
|
||||
"name": "$return"
|
||||
},
|
||||
{
|
||||
"type": "signalR",
|
||||
"direction": "out",
|
||||
"name": "dashboard",
|
||||
"hubName": "dashboard"
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
|
@ -17,6 +17,7 @@ from onefuzztypes.responses import BoolResult
|
||||
from ..onefuzzlib.azure.creds import get_base_region, get_regions
|
||||
from ..onefuzzlib.azure.vmss import list_available_skus
|
||||
from ..onefuzzlib.endpoint_authorization import call_if_user
|
||||
from ..onefuzzlib.events import get_events
|
||||
from ..onefuzzlib.pools import Pool, Scaleset
|
||||
from ..onefuzzlib.request import not_ok, ok, parse_request
|
||||
|
||||
@ -143,7 +144,13 @@ def patch(req: func.HttpRequest) -> func.HttpResponse:
|
||||
return ok(scaleset)
|
||||
|
||||
|
||||
def main(req: func.HttpRequest) -> func.HttpResponse:
|
||||
def main(req: func.HttpRequest, dashboard: func.Out[str]) -> func.HttpResponse:
|
||||
methods = {"GET": get, "POST": post, "DELETE": delete, "PATCH": patch}
|
||||
method = methods[req.method]
|
||||
return call_if_user(req, method)
|
||||
result = call_if_user(req, method)
|
||||
|
||||
events = get_events()
|
||||
if events:
|
||||
dashboard.set(events)
|
||||
|
||||
return result
|
||||
|
@ -1,22 +1,28 @@
|
||||
{
|
||||
"scriptFile": "__init__.py",
|
||||
"bindings": [
|
||||
{
|
||||
"authLevel": "anonymous",
|
||||
"type": "httpTrigger",
|
||||
"direction": "in",
|
||||
"name": "req",
|
||||
"methods": [
|
||||
"get",
|
||||
"post",
|
||||
"delete",
|
||||
"patch"
|
||||
]
|
||||
},
|
||||
{
|
||||
"type": "http",
|
||||
"direction": "out",
|
||||
"name": "$return"
|
||||
}
|
||||
]
|
||||
}
|
||||
"scriptFile": "__init__.py",
|
||||
"bindings": [
|
||||
{
|
||||
"authLevel": "anonymous",
|
||||
"type": "httpTrigger",
|
||||
"direction": "in",
|
||||
"name": "req",
|
||||
"methods": [
|
||||
"get",
|
||||
"post",
|
||||
"delete",
|
||||
"patch"
|
||||
]
|
||||
},
|
||||
{
|
||||
"type": "http",
|
||||
"direction": "out",
|
||||
"name": "$return"
|
||||
},
|
||||
{
|
||||
"type": "signalR",
|
||||
"direction": "out",
|
||||
"name": "dashboard",
|
||||
"hubName": "dashboard"
|
||||
}
|
||||
]
|
||||
}
|
||||
|
@ -3,7 +3,6 @@
|
||||
# Copyright (c) Microsoft Corporation.
|
||||
# Licensed under the MIT License.
|
||||
|
||||
# import logging
|
||||
import azure.functions as func
|
||||
from onefuzztypes.enums import ErrorCode, JobState
|
||||
from onefuzztypes.models import Error, TaskConfig
|
||||
@ -11,6 +10,7 @@ from onefuzztypes.requests import TaskGet, TaskSearch
|
||||
from onefuzztypes.responses import BoolResult
|
||||
|
||||
from ..onefuzzlib.endpoint_authorization import call_if_user
|
||||
from ..onefuzzlib.events import get_events
|
||||
from ..onefuzzlib.jobs import Job
|
||||
from ..onefuzzlib.pools import NodeTasks
|
||||
from ..onefuzzlib.request import not_ok, ok, parse_request
|
||||
@ -99,7 +99,13 @@ def delete(req: func.HttpRequest) -> func.HttpResponse:
|
||||
return ok(task)
|
||||
|
||||
|
||||
def main(req: func.HttpRequest) -> func.HttpResponse:
|
||||
def main(req: func.HttpRequest, dashboard: func.Out[str]) -> func.HttpResponse:
|
||||
methods = {"GET": get, "POST": post, "DELETE": delete}
|
||||
method = methods[req.method]
|
||||
return call_if_user(req, method)
|
||||
result = call_if_user(req, method)
|
||||
|
||||
events = get_events()
|
||||
if events:
|
||||
dashboard.set(events)
|
||||
|
||||
return result
|
||||
|
@ -17,6 +17,12 @@
|
||||
"type": "http",
|
||||
"direction": "out",
|
||||
"name": "$return"
|
||||
},
|
||||
{
|
||||
"type": "signalR",
|
||||
"direction": "out",
|
||||
"name": "dashboard",
|
||||
"hubName": "dashboard"
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
|
@ -8,12 +8,13 @@ import logging
|
||||
import azure.functions as func
|
||||
from onefuzztypes.enums import VmState
|
||||
|
||||
from ..onefuzzlib.events import get_events
|
||||
from ..onefuzzlib.pools import Scaleset
|
||||
from ..onefuzzlib.proxy import Proxy
|
||||
from ..onefuzzlib.webhooks import WebhookMessageLog
|
||||
|
||||
|
||||
def main(mytimer: func.TimerRequest) -> None: # noqa: F841
|
||||
def main(mytimer: func.TimerRequest, dashboard: func.Out[str]) -> None: # noqa: F841
|
||||
for proxy in Proxy.search():
|
||||
if not proxy.is_used():
|
||||
logging.info("stopping proxy")
|
||||
@ -33,3 +34,7 @@ def main(mytimer: func.TimerRequest) -> None: # noqa: F841
|
||||
log_entry.event_id,
|
||||
)
|
||||
log_entry.delete()
|
||||
|
||||
events = get_events()
|
||||
if events:
|
||||
dashboard.set(events)
|
||||
|
@ -1,11 +1,17 @@
|
||||
{
|
||||
"bindings": [
|
||||
{
|
||||
"direction": "in",
|
||||
"name": "mytimer",
|
||||
"schedule": "1.00:00:00",
|
||||
"type": "timerTrigger"
|
||||
}
|
||||
],
|
||||
"scriptFile": "__init__.py"
|
||||
}
|
||||
"bindings": [
|
||||
{
|
||||
"direction": "in",
|
||||
"name": "mytimer",
|
||||
"schedule": "1.00:00:00",
|
||||
"type": "timerTrigger"
|
||||
},
|
||||
{
|
||||
"type": "signalR",
|
||||
"direction": "out",
|
||||
"name": "dashboard",
|
||||
"hubName": "dashboard"
|
||||
}
|
||||
],
|
||||
"scriptFile": "__init__.py"
|
||||
}
|
||||
|
@ -1,17 +1,17 @@
|
||||
{
|
||||
"bindings": [
|
||||
{
|
||||
"direction": "in",
|
||||
"name": "mytimer",
|
||||
"schedule": "00:00:30",
|
||||
"type": "timerTrigger"
|
||||
},
|
||||
{
|
||||
"type": "signalR",
|
||||
"direction": "out",
|
||||
"name": "dashboard",
|
||||
"hubName": "dashboard"
|
||||
}
|
||||
],
|
||||
"scriptFile": "__init__.py"
|
||||
}
|
||||
"bindings": [
|
||||
{
|
||||
"direction": "in",
|
||||
"name": "mytimer",
|
||||
"schedule": "00:00:30",
|
||||
"type": "timerTrigger"
|
||||
},
|
||||
{
|
||||
"type": "signalR",
|
||||
"direction": "out",
|
||||
"name": "dashboard",
|
||||
"hubName": "dashboard"
|
||||
}
|
||||
],
|
||||
"scriptFile": "__init__.py"
|
||||
}
|
||||
|
@ -14,4 +14,4 @@
|
||||
}
|
||||
],
|
||||
"scriptFile": "__init__.py"
|
||||
}
|
||||
}
|
||||
|
@ -1,17 +1,17 @@
|
||||
{
|
||||
"bindings": [
|
||||
{
|
||||
"direction": "in",
|
||||
"name": "mytimer",
|
||||
"schedule": "00:00:15",
|
||||
"type": "timerTrigger"
|
||||
},
|
||||
{
|
||||
"type": "signalR",
|
||||
"direction": "out",
|
||||
"name": "dashboard",
|
||||
"hubName": "dashboard"
|
||||
}
|
||||
],
|
||||
"scriptFile": "__init__.py"
|
||||
}
|
||||
"bindings": [
|
||||
{
|
||||
"direction": "in",
|
||||
"name": "mytimer",
|
||||
"schedule": "00:00:15",
|
||||
"type": "timerTrigger"
|
||||
},
|
||||
{
|
||||
"type": "signalR",
|
||||
"direction": "out",
|
||||
"name": "dashboard",
|
||||
"hubName": "dashboard"
|
||||
}
|
||||
],
|
||||
"scriptFile": "__init__.py"
|
||||
}
|
||||
|
@ -16,6 +16,7 @@ from onefuzztypes.requests import (
|
||||
from onefuzztypes.responses import BoolResult
|
||||
|
||||
from ..onefuzzlib.endpoint_authorization import call_if_user
|
||||
from ..onefuzzlib.events import get_events
|
||||
from ..onefuzzlib.request import not_ok, ok, parse_request
|
||||
from ..onefuzzlib.webhooks import Webhook
|
||||
|
||||
@ -105,7 +106,13 @@ def delete(req: func.HttpRequest) -> func.HttpResponse:
|
||||
return ok(BoolResult(result=True))
|
||||
|
||||
|
||||
def main(req: func.HttpRequest) -> func.HttpResponse:
|
||||
def main(req: func.HttpRequest, dashboard: func.Out[str]) -> func.HttpResponse:
|
||||
methods = {"GET": get, "POST": post, "DELETE": delete, "PATCH": patch}
|
||||
method = methods[req.method]
|
||||
return call_if_user(req, method)
|
||||
result = call_if_user(req, method)
|
||||
|
||||
events = get_events()
|
||||
if events:
|
||||
dashboard.set(events)
|
||||
|
||||
return result
|
||||
|
@ -17,6 +17,12 @@
|
||||
"type": "http",
|
||||
"direction": "out",
|
||||
"name": "$return"
|
||||
},
|
||||
{
|
||||
"type": "signalR",
|
||||
"direction": "out",
|
||||
"name": "dashboard",
|
||||
"hubName": "dashboard"
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
|
@ -10,6 +10,7 @@ from onefuzztypes.models import Error
|
||||
from onefuzztypes.requests import WebhookGet
|
||||
|
||||
from ..onefuzzlib.endpoint_authorization import call_if_user
|
||||
from ..onefuzzlib.events import get_events
|
||||
from ..onefuzzlib.request import not_ok, ok, parse_request
|
||||
from ..onefuzzlib.webhooks import Webhook, WebhookMessageLog
|
||||
|
||||
@ -28,7 +29,13 @@ def post(req: func.HttpRequest) -> func.HttpResponse:
|
||||
return ok(logs)
|
||||
|
||||
|
||||
def main(req: func.HttpRequest) -> func.HttpResponse:
|
||||
def main(req: func.HttpRequest, dashboard: func.Out[str]) -> func.HttpResponse:
|
||||
methods = {"POST": post}
|
||||
method = methods[req.method]
|
||||
return call_if_user(req, method)
|
||||
result = call_if_user(req, method)
|
||||
|
||||
events = get_events()
|
||||
if events:
|
||||
dashboard.set(events)
|
||||
|
||||
return result
|
||||
|
@ -15,6 +15,12 @@
|
||||
"type": "http",
|
||||
"direction": "out",
|
||||
"name": "$return"
|
||||
},
|
||||
{
|
||||
"type": "signalR",
|
||||
"direction": "out",
|
||||
"name": "dashboard",
|
||||
"hubName": "dashboard"
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
|
@ -10,6 +10,7 @@ from onefuzztypes.models import Error
|
||||
from onefuzztypes.requests import WebhookGet
|
||||
|
||||
from ..onefuzzlib.endpoint_authorization import call_if_user
|
||||
from ..onefuzzlib.events import get_events
|
||||
from ..onefuzzlib.request import not_ok, ok, parse_request
|
||||
from ..onefuzzlib.webhooks import Webhook
|
||||
|
||||
@ -29,7 +30,13 @@ def post(req: func.HttpRequest) -> func.HttpResponse:
|
||||
return ok(ping)
|
||||
|
||||
|
||||
def main(req: func.HttpRequest) -> func.HttpResponse:
|
||||
def main(req: func.HttpRequest, dashboard: func.Out[str]) -> func.HttpResponse:
|
||||
methods = {"POST": post}
|
||||
method = methods[req.method]
|
||||
return call_if_user(req, method)
|
||||
result = call_if_user(req, method)
|
||||
|
||||
events = get_events()
|
||||
if events:
|
||||
dashboard.set(events)
|
||||
|
||||
return result
|
||||
|
@ -15,6 +15,12 @@
|
||||
"type": "http",
|
||||
"direction": "out",
|
||||
"name": "$return"
|
||||
},
|
||||
{
|
||||
"type": "signalR",
|
||||
"direction": "out",
|
||||
"name": "dashboard",
|
||||
"hubName": "dashboard"
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user