From 23a806e325818f4228f57f7e0806602529c6d6c1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B6rn-Michael=20Miehe?= <40151420+ldericher@users.noreply.github.com> Date: Wed, 30 Mar 2022 21:19:06 +0000 Subject: [PATCH] create /service router --- api/kiwi_vpn_api/routers/__init__.py | 3 ++- api/kiwi_vpn_api/routers/service.py | 24 ++++++++++++++++++++++++ 2 files changed, 26 insertions(+), 1 deletion(-) create mode 100644 api/kiwi_vpn_api/routers/service.py diff --git a/api/kiwi_vpn_api/routers/__init__.py b/api/kiwi_vpn_api/routers/__init__.py index 283056a..25a4dbf 100644 --- a/api/kiwi_vpn_api/routers/__init__.py +++ b/api/kiwi_vpn_api/routers/__init__.py @@ -7,11 +7,12 @@ This file: Main API router definition. from fastapi import APIRouter from ..config import Settings -from . import admin, device, user +from . import admin, device, service, user main_router = APIRouter(prefix=f"/{Settings._.api_v1_prefix}") main_router.include_router(admin.router) +main_router.include_router(service.router) main_router.include_router(device.router) main_router.include_router(user.router) diff --git a/api/kiwi_vpn_api/routers/service.py b/api/kiwi_vpn_api/routers/service.py new file mode 100644 index 0000000..2922829 --- /dev/null +++ b/api/kiwi_vpn_api/routers/service.py @@ -0,0 +1,24 @@ +""" +/service endpoints. +""" + +from fastapi import APIRouter, Depends, HTTPException, status + +from ..config import Config +from ._common import Responses, get_current_config + +router = APIRouter(prefix="/service", tags=["service"]) + + +@router.put( + "/pki/init", + responses={ + status.HTTP_200_OK: Responses.OK, + status.HTTP_400_BAD_REQUEST: Responses.NOT_INSTALLED, + status.HTTP_403_FORBIDDEN: Responses.NEEDS_PERMISSION, + }, +) +async def init_pki( + _: Config = Depends(get_current_config), +) -> None: + pass