Renamed folder from example -> aggregate
This commit is contained in:
@@ -16,6 +16,6 @@ router = APIRouter(tags=["aggregates"])
|
|||||||
|
|
||||||
@router.get("/aggregates", response_model=List[AggregateSchema])
|
@router.get("/aggregates", response_model=List[AggregateSchema])
|
||||||
async def aggregates_endpoint(
|
async def aggregates_endpoint(
|
||||||
metric: MetricEnum = Query(MetricEnum.relative, description="Metric type")
|
metric: MetricEnum = Query(MetricEnum.relative, description="Metric type"),
|
||||||
):
|
):
|
||||||
return await get_aggregates(metric)
|
return await get_aggregates(metric)
|
||||||
@@ -10,9 +10,15 @@ async def get_aggregates(metric: str = "relative") -> List[AggregateSchema]:
|
|||||||
print(f"Metric used: {metric}")
|
print(f"Metric used: {metric}")
|
||||||
|
|
||||||
aggregates: list = [
|
aggregates: list = [
|
||||||
AggregateSchema(aggregate="Aggregate A", node="cluster01-01", available="100.0TB"),
|
AggregateSchema(
|
||||||
AggregateSchema(aggregate="Aggregate B", node="cluster01-01", available="200.5GB"),
|
aggregate="Aggregate A", node="cluster01-01", available="100.0TB"
|
||||||
AggregateSchema(aggregate="Aggregate C", node="cluster01-02", available="300.75MB"),
|
),
|
||||||
|
AggregateSchema(
|
||||||
|
aggregate="Aggregate B", node="cluster01-01", available="200.5GB"
|
||||||
|
),
|
||||||
|
AggregateSchema(
|
||||||
|
aggregate="Aggregate C", node="cluster01-02", available="300.75MB"
|
||||||
|
),
|
||||||
]
|
]
|
||||||
|
|
||||||
return aggregates
|
return aggregates
|
||||||
@@ -1,8 +1,8 @@
|
|||||||
# contains the router for the example endpoint
|
# contains the router for the aggregate endpoint
|
||||||
from fastapi import APIRouter
|
from fastapi import APIRouter
|
||||||
from .schema import ExampleSchema
|
from .schema import ExampleSchema
|
||||||
|
|
||||||
router = APIRouter(tags=["example"])
|
router = APIRouter(tags=["aggregate"])
|
||||||
|
|
||||||
|
|
||||||
@router.get("/example")
|
@router.get("/example")
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
# contains the schema definitions for the example service
|
# contains the schema definitions for the aggregate service
|
||||||
from pydantic import BaseModel
|
from pydantic import BaseModel
|
||||||
|
|
||||||
|
|
||||||
3
src/aggregate/service.py
Normal file
3
src/aggregate/service.py
Normal file
@@ -0,0 +1,3 @@
|
|||||||
|
# contains the business logic for the aggregate service
|
||||||
|
async def example_service() -> str:
|
||||||
|
return "This is an aggregate service"
|
||||||
@@ -1,3 +0,0 @@
|
|||||||
# contains the business logic for the example service
|
|
||||||
async def example_service() -> str:
|
|
||||||
return "This is an example service"
|
|
||||||
@@ -1,7 +1,7 @@
|
|||||||
from src.service import load_config
|
from src.service import load_config
|
||||||
from fastapi import FastAPI
|
from fastapi import FastAPI
|
||||||
import logging
|
import logging
|
||||||
from src.example import aggregate_router
|
from src.aggregate import aggregate_router
|
||||||
|
|
||||||
logger = logging.getLogger("uvicorn")
|
logger = logging.getLogger("uvicorn")
|
||||||
|
|
||||||
@@ -11,6 +11,7 @@ config = load_config()
|
|||||||
app = FastAPI()
|
app = FastAPI()
|
||||||
app.include_router(aggregate_router)
|
app.include_router(aggregate_router)
|
||||||
|
|
||||||
|
|
||||||
@app.get("/")
|
@app.get("/")
|
||||||
async def main():
|
async def main():
|
||||||
return {"Hello": "World"}
|
return {"Hello": "World"}
|
||||||
|
|||||||
Reference in New Issue
Block a user