docs: service module endpoint summaries
This commit is contained in:
parent
01c49ca34c
commit
ff4d36b4cd
1 changed files with 40 additions and 19 deletions
|
|
@ -26,7 +26,12 @@ router = APIRouter(
|
||||||
prefix="/service",
|
prefix="/service",
|
||||||
)
|
)
|
||||||
|
|
||||||
@router.get("/", status_code=status.HTTP_200_OK, response_model=ServiceGetServiceResponse, responses={
|
|
||||||
|
@router.get("/",
|
||||||
|
summary="Get all services",
|
||||||
|
status_code=status.HTTP_200_OK,
|
||||||
|
response_model=ServiceGetServiceResponse,
|
||||||
|
responses={
|
||||||
status.HTTP_200_OK: {"description": "Successful retrieval from database"},
|
status.HTTP_200_OK: {"description": "Successful retrieval from database"},
|
||||||
status.HTTP_401_UNAUTHORIZED: {"description": "Unauthorized"},
|
status.HTTP_401_UNAUTHORIZED: {"description": "Unauthorized"},
|
||||||
})
|
})
|
||||||
|
|
@ -38,7 +43,12 @@ async def get_all_services(db: db_dependency, org_model: org_model_root_claim_qu
|
||||||
|
|
||||||
return {"services": permission_models}
|
return {"services": permission_models}
|
||||||
|
|
||||||
@router.post("/", status_code=status.HTTP_200_OK, response_model=ServicePostServiceResponse, responses={
|
|
||||||
|
@router.post("/",
|
||||||
|
summary="Register a new service.",
|
||||||
|
status_code=status.HTTP_200_OK,
|
||||||
|
response_model=ServicePostServiceResponse,
|
||||||
|
responses={
|
||||||
status.HTTP_200_OK: {"description": "Successfully registered a new service"},
|
status.HTTP_200_OK: {"description": "Successfully registered a new service"},
|
||||||
status.HTTP_401_UNAUTHORIZED: {"description": "Unauthorized"},
|
status.HTTP_401_UNAUTHORIZED: {"description": "Unauthorized"},
|
||||||
status.HTTP_409_CONFLICT: {"description": "Service with this name already exists"},
|
status.HTTP_409_CONFLICT: {"description": "Service with this name already exists"},
|
||||||
|
|
@ -61,11 +71,17 @@ async def register_service(db: db_dependency, su: super_admin_dependency, reques
|
||||||
db.commit()
|
db.commit()
|
||||||
return {"service": response}
|
return {"service": response}
|
||||||
|
|
||||||
@router.patch("/key", status_code=status.HTTP_200_OK, response_model=ServicePatchKeyResponse, responses={
|
|
||||||
|
@router.patch("/key",
|
||||||
|
summary="Regenerate service API key.",
|
||||||
|
status_code=status.HTTP_200_OK,
|
||||||
|
response_model=ServicePatchKeyResponse,
|
||||||
|
responses={
|
||||||
status.HTTP_200_OK: {"description": "Successful update of API key"},
|
status.HTTP_200_OK: {"description": "Successful update of API key"},
|
||||||
status.HTTP_401_UNAUTHORIZED: {"description": "Unauthorized"},
|
status.HTTP_401_UNAUTHORIZED: {"description": "Unauthorized"},
|
||||||
})
|
})
|
||||||
async def regenerate_api_key(db: db_dependency, su: super_admin_dependency, service_model: service_model_body_dependency, request_model: ServicePatchKeyRequest):
|
async def regenerate_api_key(db: db_dependency, su: super_admin_dependency,
|
||||||
|
service_model: service_model_body_dependency, request_model: ServicePatchKeyRequest):
|
||||||
"""
|
"""
|
||||||
Generates and returns a new API key for the service to access the hub.
|
Generates and returns a new API key for the service to access the hub.
|
||||||
"""
|
"""
|
||||||
|
|
@ -77,11 +93,16 @@ async def regenerate_api_key(db: db_dependency, su: super_admin_dependency, serv
|
||||||
db.commit()
|
db.commit()
|
||||||
return {"service": response}
|
return {"service": response}
|
||||||
|
|
||||||
@router.delete("/", status_code=status.HTTP_204_NO_CONTENT, responses={
|
|
||||||
|
@router.delete("/",
|
||||||
|
summary="Remove a service.",
|
||||||
|
status_code=status.HTTP_204_NO_CONTENT,
|
||||||
|
responses={
|
||||||
status.HTTP_204_NO_CONTENT: {"description": "Successfully removed service from db"},
|
status.HTTP_204_NO_CONTENT: {"description": "Successfully removed service from db"},
|
||||||
status.HTTP_401_UNAUTHORIZED: {"description": "Unauthorized"},
|
status.HTTP_401_UNAUTHORIZED: {"description": "Unauthorized"},
|
||||||
})
|
})
|
||||||
async def remove_service(db: db_dependency, service_model: service_model_body_dependency, su: super_admin_dependency, request_model: ServiceDeleteServiceRequest):
|
async def remove_service(db: db_dependency, service_model: service_model_body_dependency, su: super_admin_dependency,
|
||||||
|
request_model: ServiceDeleteServiceRequest):
|
||||||
"""
|
"""
|
||||||
Removes a service from the hub.
|
Removes a service from the hub.
|
||||||
"""
|
"""
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue