synthea_webservice/webservice/apps/api/urls.py

75 lines
3.2 KiB
Python
Raw Normal View History

2020-11-13 15:31:14 +01:00
from django.urls import path, re_path, include
from rest_framework import permissions, routers
from drf_yasg2.views import get_schema_view
from drf_yasg2 import openapi
from . import views
2020-11-16 16:30:41 +01:00
# from apps.dropoff.api.views import DatadropViewSet
# from apps.invitation.api.views import InvitationViewSet
# from apps.researcher.api.views import ResearcherViewSet
# from apps.storage.api.views import StorageEngineViewSet, StorageLocationViewSet
# from apps.study.api.views import StudyViewSet
# from apps.virtual_machine.api.views import (VirtualMachineViewSet,
# VirtualMachineOperatingSystemViewSet,
# VirtualMachineProfileViewSet,
# VirtualMachineMemoryViewSet,
# VirtualMachineNetworkViewSet,
# VirtualMachineStorageViewSet,
# VirtualMachineGPUViewSet)
2020-11-13 15:31:14 +01:00
schema_view = get_schema_view(
openapi.Info(
2020-11-16 16:30:41 +01:00
title="Synthea WebService API",
2020-11-13 15:31:14 +01:00
default_version='v1',
2020-11-16 16:30:41 +01:00
description="Info about Synthea WebServer API",
2020-11-13 15:31:14 +01:00
terms_of_service="https://www.rug.nl",
contact=openapi.Contact(email="vre_team@rug.nl"),
license=openapi.License(name="MIT License"),
),
public=True,
permission_classes=(permissions.AllowAny,),
)
2020-11-16 16:30:41 +01:00
#api_router_v1 = routers.DefaultRouter()
2020-11-13 15:31:14 +01:00
2020-11-16 16:30:41 +01:00
# api_router_v1.register(r'researchers', ResearcherViewSet)
2020-11-13 15:31:14 +01:00
2020-11-16 16:30:41 +01:00
# api_router_v1.register(r'studies', StudyViewSet)
2020-11-13 15:31:14 +01:00
2020-11-16 16:30:41 +01:00
# api_router_v1.register(r'dropoffs', DatadropViewSet)
2020-11-13 15:31:14 +01:00
2020-11-16 16:30:41 +01:00
# api_router_v1.register(r'invitations', InvitationViewSet)
2020-11-13 15:31:14 +01:00
2020-11-16 16:30:41 +01:00
# api_router_v1.register(r'storageengines', StorageEngineViewSet)
# api_router_v1.register(r'storagelocations', StorageLocationViewSet)
2020-11-13 15:31:14 +01:00
2020-11-16 16:30:41 +01:00
# # Order is important for virtual machines. Longest match first
# api_router_v1.register(r'virtualmachines/profiles', VirtualMachineProfileViewSet)
# api_router_v1.register(r'virtualmachines/storage', VirtualMachineStorageViewSet)
# api_router_v1.register(r'virtualmachines/memory', VirtualMachineMemoryViewSet)
# api_router_v1.register(r'virtualmachines/network', VirtualMachineNetworkViewSet)
# api_router_v1.register(r'virtualmachines/gpu', VirtualMachineGPUViewSet)
# api_router_v1.register(r'virtualmachines/os', VirtualMachineOperatingSystemViewSet)
# api_router_v1.register(r'virtualmachines', VirtualMachineViewSet)
2020-11-13 15:31:14 +01:00
# Main namespace for the API urls
app_name = 'api'
urlpatterns = [
re_path(r'^swagger(?P<format>\.json|\.yaml)$', schema_view.without_ui(cache_timeout=0), name='schema-json'),
path('swagger/', schema_view.with_ui('swagger', cache_timeout=0), name='schema-swagger-ui'),
path('redoc/', schema_view.with_ui('redoc', cache_timeout=0), name='schema-redoc'),
# Extra /api/info path for checking if the Hawk authentication is working.
# Also this will give the full url to the OpenAPI documentation
path('info/', views.Info.as_view(), name='info'),
2020-11-16 16:30:41 +01:00
path('states/', views.States.as_view(), name='states'),
path('modules/', views.Modules.as_view(), name='modules'),
path('generate/', views.Generate.as_view(), name='generate'),
2020-11-13 15:31:14 +01:00
# Add extra namespace for versioning the API
2020-11-16 16:30:41 +01:00
#path('v1/', include((api_router_v1.urls,'api'),namespace='v1')),
2020-11-13 15:31:14 +01:00
]