-
Notifications
You must be signed in to change notification settings - Fork 43
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #220 from ninoseki/status-endpoint
refactor: introduce status API endpoint
- Loading branch information
Showing
17 changed files
with
750 additions
and
610 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 |
---|---|---|
@@ -1,9 +1,10 @@ | ||
from fastapi import APIRouter | ||
|
||
from backend.api.endpoints import analyze, cache, lookup, submit | ||
from backend.api.endpoints import analyze, cache, lookup, status, submit | ||
|
||
api_router = APIRouter() | ||
api_router.include_router(analyze.router, prefix="/analyze", tags=["analyze"]) | ||
api_router.include_router(submit.router, prefix="/submit", tags=["submit"]) | ||
api_router.include_router(lookup.router, prefix="/lookup", tags=["lookup"]) | ||
api_router.include_router(cache.router, prefix="/cache", tags=["cache"]) | ||
api_router.include_router(status.router, prefix="/status", tags=["status"]) |
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,22 @@ | ||
from fastapi import APIRouter | ||
|
||
from backend import dependencies, schemas | ||
|
||
router = APIRouter() | ||
|
||
|
||
@router.get("/") | ||
async def get_status( | ||
optional_redis: dependencies.OptionalRedis, | ||
optional_email_rep: dependencies.OptionalEmailRep, | ||
optional_inquest: dependencies.OptionalInQuest, | ||
optional_vt: dependencies.OptionalVirusTotal, | ||
optional_urlscan: dependencies.OptionalUrlScan, | ||
) -> schemas.Status: | ||
return schemas.Status( | ||
cache=optional_redis is not None, | ||
vt=optional_vt is not None, | ||
inquest=optional_inquest is not None, | ||
email_rep=optional_email_rep is not None, | ||
urlscan=optional_urlscan is not None, | ||
) |
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
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,19 @@ | ||
from pydantic import Field | ||
|
||
from .api_model import APIModel | ||
|
||
|
||
class Status(APIModel): | ||
cache: bool = Field(default=False, description="Whether cache is enabled or not") | ||
vt: bool = Field( | ||
default=False, description="Whether VirusTotal integration is enabled or not" | ||
) | ||
inquest: bool = Field( | ||
default=False, description="Whether InQuest integration is enabled or not" | ||
) | ||
urlscan: bool = Field( | ||
default=False, description="Whether urlscan.io integration is enabled or not" | ||
) | ||
email_rep: bool = Field( | ||
default=False, description="Whether EmailRep integration is enabled or not" | ||
) |
Oops, something went wrong.