Skip to content

Commit

Permalink
refactor: Update endpoint in provision.py for huntress (#329)
Browse files Browse the repository at this point in the history
  • Loading branch information
taylorwalton authored Nov 4, 2024
1 parent 380c37d commit 810ef03
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 6 deletions.
4 changes: 2 additions & 2 deletions backend/app/integrations/huntress/routes/provision.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,9 +40,9 @@ async def provision_huntress_route(
await provision_huntress(provision_huntress_request, session)
await add_scheduler_jobs(
CreateSchedulerRequest(
function_name="invoke_huntress_integration_collection",
function_name="invoke_huntress_integration_collect",
time_interval=provision_huntress_request.time_interval,
job_id="invoke_huntress_integration_collection",
job_id="invoke_huntress_integration_collect",
),
)
return ProvisionHuntressResponse(
Expand Down
2 changes: 1 addition & 1 deletion backend/app/schedulers/scheduler.py
Original file line number Diff line number Diff line change
Expand Up @@ -264,7 +264,7 @@ def get_function_by_name(function_name: str):
"invoke_sap_siem_integration_brute_force_failed_logins": invoke_sap_siem_integration_brute_force_failed_logins,
"invoke_sap_siem_integration_brute_force_failed_logins_same_ip": invoke_sap_siem_integration_brute_force_failed_logins_same_ip,
"invoke_sap_siem_integration_successful_login_after_multiple_failed_logins": invoke_sap_siem_integration_successful_login_after_multiple_failed_logins,
"invoke_huntress_integration_collection": invoke_huntress_integration_collect,
"invoke_huntress_integration_collect": invoke_huntress_integration_collect,
"invoke_duo_integration_collect": invoke_duo_integration_collect,
"invoke_darktrace_integration_collect": invoke_darktrace_integration_collect,
"invoke_carbonblack_integration_collection": invoke_carbonblack_integration_collect,
Expand Down
6 changes: 3 additions & 3 deletions backend/app/schedulers/services/invoke_huntress.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,21 +34,21 @@ async def invoke_huntress_integration_collect() -> InvokeHuntressResponse:
InvokeHuntressRequest(
customer_code=customer_code,
integration_name="Huntress",
time_range=f"{(await get_scheduled_job_metadata('invoke_huntress_integration_collection')).time_interval}m",
time_range=f"{(await get_scheduled_job_metadata('invoke_huntress_integration_collect')).time_interval}m",
),
session,
)
# Close the session
await session.close()
with get_sync_db_session() as session:
# Synchronous ORM operations
job_metadata = session.query(JobMetadata).filter_by(job_id="invoke_huntress_integration_collection").one_or_none()
job_metadata = session.query(JobMetadata).filter_by(job_id="invoke_huntress_integration_collect").one_or_none()
if job_metadata:
job_metadata.last_success = datetime.utcnow()
session.add(job_metadata)
session.commit()
else:
# Handle the case where job_metadata does not exist
print("JobMetadata for 'invoke_huntress_integration_collection' not found.")
print("JobMetadata for 'invoke_huntress_integration_collect' not found.")

return InvokeHuntressResponse(success=True, message="Huntress integration invoked.")

0 comments on commit 810ef03

Please sign in to comment.