Skip to content
Snippets Groups Projects

Feature/update documentation

Merged Karel van Klink requested to merge feature/update-documentation into develop
2 files
+ 42
63
Compare changes
  • Side-by-side
  • Inline
Files
2
+ 19
31
from typing import Any, Dict
from typing import Any
from uuid import UUID
from fastapi import Depends, HTTPException, status
@@ -30,20 +30,16 @@ def _start_process(process_name: str, data: dict) -> UUID:
@router.post("/sites", status_code=status.HTTP_201_CREATED, response_model=ImportResponseModel)
def import_site(site: SiteImportModel) -> Dict[str, Any]:
def import_site(site: SiteImportModel) -> dict[str, Any]:
"""Import a site by running the import_site workflow.
Args:
-----
site (SiteImportModel): The site information to be imported.
:param site: The site information to be imported.
:type site: SiteImportModel
Returns:
--------
dict: A dictionary containing the process id of the started process and detail message.
:return: A dictionary containing the process id of the started process and detail message.
:rtype: dict[str, Any]
Raises:
-------
HTTPException: If the site already exists or if there's an error in the process.
:raises HTTPException: If the site already exists or if there's an error in the process.
"""
try:
subscription = subscriptions.retrieve_subscription_by_subscription_instance_value(
@@ -59,20 +55,16 @@ def import_site(site: SiteImportModel) -> Dict[str, Any]:
@router.post("/routers", status_code=status.HTTP_201_CREATED, response_model=ImportResponseModel)
def import_router(router_data: RouterImportModel) -> Dict[str, Any]:
def import_router(router_data: RouterImportModel) -> dict[str, Any]:
"""Import a router by running the import_router workflow.
Args:
-----
router_data (RouterImportModel): The router information to be imported.
:param router_data: The router information to be imported.
:type router_data: RouterImportModel
Returns:
--------
dict: A dictionary containing the process id of the started process and detail message.
:return: A dictionary containing the process id of the started process and detail message.
:rtype: dict[str, Any]
Raises:
-------
HTTPException: If there's an error in the process.
:raises HTTPException: If there's an error in the process.
"""
pid = _start_process("import_router", router_data.dict())
@@ -80,20 +72,16 @@ def import_router(router_data: RouterImportModel) -> Dict[str, Any]:
@router.post("/iptrunks", status_code=status.HTTP_201_CREATED, response_model=ImportResponseModel)
def import_iptrunk(iptrunk_data: IptrunkImportModel) -> Dict[str, Any]:
def import_iptrunk(iptrunk_data: IptrunkImportModel) -> dict[str, Any]:
"""Import an iptrunk by running the import_iptrunk workflow.
Args:
-----
iptrunk_data (IptrunkImportModel): The iptrunk information to be imported.
:param iptrunk_data: The iptrunk information to be imported.
:type iptrunk_data: IptrunkImportModel
Returns:
--------
dict: A dictionary containing the process id of the started process and detail message.
:return: A dictionary containing the process id of the started process and detail message.
:rtype: dict[str, Any]
Raises:
-------
HTTPException: If there's an error in the process.
:raises HTTPException: If there's an error in the process.
"""
pid = _start_process("import_iptrunk", iptrunk_data.dict())
Loading