New updates
This commit is contained in:
@@ -9,58 +9,29 @@ class ApiConfig(AppConfig):
|
||||
verbose_name = _('API')
|
||||
verbose_name_plural = _('APIs')
|
||||
|
||||
# try:
|
||||
# assert settings.SWAGGER_SETTINGS
|
||||
# except AttributeError:
|
||||
# # We only load this setting, if it is not available in the overall settings.py file
|
||||
# settings.SWAGGER_SETTINGS = {
|
||||
# 'SECURITY_DEFINITIONS': {
|
||||
# 'Hawk': {
|
||||
# 'type': 'apiKey',
|
||||
# 'description': 'HTTP Holder-Of-Key Authentication Scheme, https://github.com/hapijs/hawk, https://hawkrest.readthedocs.io/en/latest/<br /><strong>Ex header:</strong><br />\'Authorization\': \'Hawk mac="F4+S9cu7yZiZEgdtqzMpOOdudvqcV2V2Yzk2WcphECc=", hash="+7fKUX+djeQolvnLTxr0X47e//UHKbkRlajwMw3tx3w=", id="7FI5JET4", ts="1592905433", nonce="DlV-fL"\'',
|
||||
# 'name': 'Authorization',
|
||||
# 'in': 'header'
|
||||
# }
|
||||
# }
|
||||
# }
|
||||
try:
|
||||
assert settings.SWAGGER_SETTINGS
|
||||
except AttributeError:
|
||||
# We only load this setting, if it is not available in the overall settings.py file
|
||||
settings.SWAGGER_SETTINGS = {
|
||||
}
|
||||
|
||||
# try:
|
||||
# assert settings.REST_FRAMEWORK
|
||||
# except AttributeError:
|
||||
# # We only load this setting, if it is not available in the overall settings.py file
|
||||
# # To protect all API views with Hawk by default, put this in your settings:
|
||||
# # https://hawkrest.readthedocs.io/en/latest/usage.html#protecting-api-views-with-hawk
|
||||
# settings.REST_FRAMEWORK = {
|
||||
try:
|
||||
assert settings.REST_FRAMEWORK
|
||||
except AttributeError:
|
||||
# We only load this setting, if it is not available in the overall settings.py file
|
||||
# To protect all API views with Hawk by default, put this in your settings:
|
||||
# https://hawkrest.readthedocs.io/en/latest/usage.html#protecting-api-views-with-hawk
|
||||
settings.REST_FRAMEWORK = {
|
||||
|
||||
# 'DEFAULT_AUTHENTICATION_CLASSES': (
|
||||
# 'apps.api.authentication.APIHawk',
|
||||
# ),
|
||||
|
||||
# 'DEFAULT_PERMISSION_CLASSES': (
|
||||
# 'rest_framework.permissions.IsAuthenticated',
|
||||
# ),
|
||||
|
||||
# # 'DEFAULT_AUTHENTICATION_CLASSES': (
|
||||
# # 'rest_framework.authentication.TokenAuthentication',
|
||||
# # ),
|
||||
|
||||
# # 'DEFAULT_PERMISSION_CLASSES': (
|
||||
# # 'rest_framework.permissions.IsAuthenticated', ),
|
||||
|
||||
# # Use Django's standard `django.contrib.auth` permissions,
|
||||
# # or allow read-only access for unauthenticated users.
|
||||
# #'DEFAULT_PERMISSION_CLASSES': [
|
||||
# # 'rest_framework.permissions.DjangoModelPermissionsOrAnonReadOnly'
|
||||
# #],
|
||||
# 'DEFAULT_PAGINATION_CLASS': 'rest_framework.pagination.PageNumberPagination',
|
||||
# 'PAGE_SIZE': 10
|
||||
# }
|
||||
|
||||
# try:
|
||||
# assert settings.HAWK_MESSAGE_EXPIRATION
|
||||
# except AttributeError:
|
||||
# # We only load this setting, if it is not available in the overall settings.py file
|
||||
# settings.HAWK_MESSAGE_EXPIRATION = 60
|
||||
# Use Django's standard `django.contrib.auth` permissions,
|
||||
# or allow read-only access for unauthenticated users.
|
||||
# 'DEFAULT_PERMISSION_CLASSES': [
|
||||
# 'rest_framework.permissions.DjangoModelPermissionsOrAnonReadOnly'
|
||||
# ],
|
||||
'DEFAULT_PAGINATION_CLASS': 'rest_framework.pagination.PageNumberPagination',
|
||||
'PAGE_SIZE': 10
|
||||
}
|
||||
|
||||
def ready(self):
|
||||
from . import signals
|
@@ -7,53 +7,27 @@ from drf_yasg2 import openapi
|
||||
|
||||
from . import views
|
||||
|
||||
# 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)
|
||||
from apps.synthea.api.views import SyntheaViewSet
|
||||
from apps.synthea.api.serializers import SyntheaSerializer ,SyntheaModelsSerializer
|
||||
|
||||
|
||||
schema_view = get_schema_view(
|
||||
openapi.Info(
|
||||
title="Synthea WebService API",
|
||||
default_version='v1',
|
||||
default_version='',
|
||||
description="Info about Synthea WebServer API",
|
||||
terms_of_service="https://www.rug.nl",
|
||||
contact=openapi.Contact(email="vre_team@rug.nl"),
|
||||
contact=openapi.Contact(email="cit@rug.nl"),
|
||||
license=openapi.License(name="MIT License"),
|
||||
),
|
||||
public=True,
|
||||
permission_classes=(permissions.AllowAny,),
|
||||
)
|
||||
|
||||
#api_router_v1 = routers.DefaultRouter()
|
||||
generate_post = SyntheaViewSet.as_view({
|
||||
'post': 'create'
|
||||
})
|
||||
|
||||
# api_router_v1.register(r'researchers', ResearcherViewSet)
|
||||
|
||||
# api_router_v1.register(r'studies', StudyViewSet)
|
||||
|
||||
# api_router_v1.register(r'dropoffs', DatadropViewSet)
|
||||
|
||||
# api_router_v1.register(r'invitations', InvitationViewSet)
|
||||
|
||||
# api_router_v1.register(r'storageengines', StorageEngineViewSet)
|
||||
# api_router_v1.register(r'storagelocations', StorageLocationViewSet)
|
||||
|
||||
# # 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)
|
||||
|
||||
# Main namespace for the API urls
|
||||
app_name = 'api'
|
||||
@@ -68,8 +42,5 @@ urlpatterns = [
|
||||
|
||||
path('states/', views.States.as_view(), name='states'),
|
||||
path('modules/', views.Modules.as_view(), name='modules'),
|
||||
path('generate/', views.Generate.as_view(), name='generate'),
|
||||
|
||||
# Add extra namespace for versioning the API
|
||||
#path('v1/', include((api_router_v1.urls,'api'),namespace='v1')),
|
||||
path('generate/', generate_post, name='generate'),
|
||||
]
|
Reference in New Issue
Block a user