-
Notifications
You must be signed in to change notification settings - Fork 4
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
2556ffb
commit 773bf4f
Showing
18 changed files
with
937 additions
and
338 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 |
---|---|---|
|
@@ -102,6 +102,7 @@ typings/ | |
__pycache__/ | ||
*.py[cod] | ||
*$py.class | ||
.pytest_cache | ||
|
||
# C extensions | ||
*.so | ||
|
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,36 @@ | ||
from fastapi import FastAPI, Request, status, Request | ||
from fastapi.exceptions import RequestValidationError | ||
from fastapi.encoders import jsonable_encoder | ||
from fastapi.responses import JSONResponse | ||
from fastapi.exceptions import HTTPException | ||
from starlette.responses import HTMLResponse | ||
from routers.routes import router | ||
|
||
def create_app(): | ||
|
||
app = FastAPI(title="GWA Kubernetes API", | ||
description="Description: API to create resources in Openshift using Kubectl", | ||
version="1.0.0") | ||
|
||
app.include_router(router) | ||
|
||
@app.exception_handler(RequestValidationError) | ||
async def validation_exception_handler(request: Request, exc: RequestValidationError): | ||
return JSONResponse( | ||
status_code=status.HTTP_422_UNPROCESSABLE_ENTITY, | ||
content=jsonable_encoder({"detail": exc.errors(), "body": exc.body}), | ||
) | ||
|
||
@app.get("/health") | ||
async def get_health(): | ||
return {"status": "up"} | ||
|
||
@app.get("/") | ||
def main(): | ||
title = """ | ||
<h1> | ||
GWA KUBE API | ||
</h1> """ | ||
return HTMLResponse(title) | ||
|
||
return app |
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
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
Oops, something went wrong.