Commit ac664c40 by Karsa Zoltán István

get instance pk

parent 28bda55b
......@@ -56,7 +56,7 @@ from .views import (
NodeActivityView,
UserList, TemplateREST, LeaseREST, DiskRest, InstanceREST,
InterfaceREST, InstanceFromTemplateREST, InstanceFTforUsersREST,
DownloadDiskREST,
DownloadDiskREST, GetInstanceREST,
StorageDetail, DiskDetail,
MessageList, MessageDetail, MessageCreate, MessageDelete,
EnableTwoFactorView, DisableTwoFactorView,
......@@ -68,6 +68,7 @@ from .views.vm import vm_ops, vm_mass_ops
urlpatterns = [
path('acpi/vm/', InstanceREST.as_view()),
path('acpi/vm/<int:pk>/', GetInstanceREST.as_view()),
path('acpi/template/', TemplateREST.as_view()),
path('acpi/ft/', InstanceFromTemplateREST.as_view()),
path('acpi/lease/', LeaseREST.as_view()),
......
......@@ -107,6 +107,16 @@ class InterfaceREST(APIView):
return JsonResponse({ 'interfaces': serializer.data}, safe=False)
class GetInstanceREST(APIView):
authentication_classes = [TokenAuthentication,BasicAuthentication]
permission_classes = [IsAdminUser]
def get(self, request, pk, format=None):
template = Instance.objects.get(pk=pk)
serializer = InstanceSerializer(template, many=False)
return JsonResponse(serializer.data, safe=False)
class InstanceREST(APIView):
authentication_classes = [TokenAuthentication,BasicAuthentication]
permission_classes = [IsAdminUser]
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment