Added in additional support for core objects (ServiceClass,ServiceResource,Tags,Projects and Reservations)
diff --git a/planetstack/core/api_root.py b/planetstack/core/api_root.py
index 87e8924..4ac267a 100644
--- a/planetstack/core/api_root.py
+++ b/planetstack/core/api_root.py
@@ -6,11 +6,16 @@
def api_root(request, format=None):
return Response({
'deployments': reverse('deployment-list', request=request, format=format),
- 'sites': reverse('site-list', request=request, format=format),
- 'users': reverse('user-list', request=request, format=format),
- 'slices': reverse('slice-list', request=request, format=format),
- 'roles': reverse('role-list', request=request, format=format),
- 'nodes': reverse('node-list', request=request, format=format),
- 'slivers': reverse('sliver-list', request=request, format=format),
'images': reverse('image-list', request=request, format=format),
+ 'nodes': reverse('node-list', request=request, format=format),
+ 'projects': reverse('project-list', request=request, format=format),
+ 'reservations': reverse('reservation-list', request=request, format=format),
+ 'roles': reverse('role-list', request=request, format=format),
+ 'serviceclasses': reverse('serviceclass-list', request=request, format=format),
+ 'serviceresources': reverse('serviceresource-list', request=request, format=format),
+ 'sites': reverse('site-list', request=request, format=format),
+ 'slices': reverse('slice-list', request=request, format=format),
+ 'slivers': reverse('sliver-list', request=request, format=format),
+ 'tags': reverse('tag-list', request=request, format=format),
+ 'users': reverse('user-list', request=request, format=format),
})
diff --git a/planetstack/core/views/deployment_networks.py b/planetstack/core/views/deployment.py
similarity index 100%
rename from planetstack/core/views/deployment_networks.py
rename to planetstack/core/views/deployment.py
diff --git a/planetstack/core/views/projects.py b/planetstack/core/views/projects.py
new file mode 100644
index 0000000..c5311d5
--- /dev/null
+++ b/planetstack/core/views/projects.py
@@ -0,0 +1,13 @@
+from core.serializers import ProjectSerializer
+from rest_framework import generics
+from core.models import Project
+
+class ProjectList(generics.ListCreateAPIView):
+ queryset = Project.objects.all()
+ serializer_class = ProjectSerializer
+
+class ProjectDetail(generics.RetrieveUpdateDestroyAPIView):
+ queryset = Project.objects.all()
+ serializer_class = ProjectSerializer
+
+
diff --git a/planetstack/core/views/reservations.py b/planetstack/core/views/reservations.py
new file mode 100644
index 0000000..03f79eb
--- /dev/null
+++ b/planetstack/core/views/reservations.py
@@ -0,0 +1,13 @@
+from core.serializers import ReservationSerializer
+from rest_framework import generics
+from core.models import Reservation
+
+class ReservationList(generics.ListCreateAPIView):
+ queryset = Reservation.objects.all()
+ serializer_class = ReservationSerializer
+
+class ReservationDetail(generics.RetrieveUpdateDestroyAPIView):
+ queryset = Reservation.objects.all()
+ serializer_class = ReservationSerializer
+
+
diff --git a/planetstack/core/views/serviceclasses.py b/planetstack/core/views/serviceclasses.py
new file mode 100644
index 0000000..b8b1b70
--- /dev/null
+++ b/planetstack/core/views/serviceclasses.py
@@ -0,0 +1,13 @@
+from core.serializers import ServiceClassSerializer
+from rest_framework import generics
+from core.models import ServiceClass
+
+class ServiceClassList(generics.ListCreateAPIView):
+ queryset = ServiceClass.objects.all()
+ serializer_class = ServiceClassSerializer
+
+class ServiceClassDetail(generics.RetrieveUpdateDestroyAPIView):
+ queryset = ServiceClass.objects.all()
+ serializer_class = ServiceClassSerializer
+
+
diff --git a/planetstack/core/views/serviceresources.py b/planetstack/core/views/serviceresources.py
new file mode 100644
index 0000000..e394c18
--- /dev/null
+++ b/planetstack/core/views/serviceresources.py
@@ -0,0 +1,13 @@
+from core.serializers import ServiceResourceSerializer
+from rest_framework import generics
+from core.models import ServiceResource
+
+class ServiceResourceList(generics.ListCreateAPIView):
+ queryset = ServiceResource.objects.all()
+ serializer_class = ServiceResourceSerializer
+
+class ServiceResourceDetail(generics.RetrieveUpdateDestroyAPIView):
+ queryset = ServiceResource.objects.all()
+ serializer_class = ServiceResourceSerializer
+
+
diff --git a/planetstack/core/views/sites.py b/planetstack/core/views/sites.py
index b4af8ac..4ec9cb2 100644
--- a/planetstack/core/views/sites.py
+++ b/planetstack/core/views/sites.py
@@ -9,62 +9,3 @@
class SiteDetail(generics.RetrieveUpdateDestroyAPIView):
queryset = Site.objects.all()
serializer_class = SiteSerializer
-
-
-
-#class SiteListCreate(APIView):
-###### """
-## List all sites or create a new site.
-# """
-#
-# def post(self, request, format = None):
-# data = parse_request(request.DATA)
-# if 'auth' not in data:
-# return Response(status=status.HTTP_400_BAD_REQUEST)
-# elif 'site' in data:
-# site = add_site(data['auth'], data['site'])
-# serializer = SiteSerializer(site)
-# return Response(serializer.data, status=status.HTTP_201_CREATED)
-# else:
-# sites = get_sites(data['auth'])
-# serializer = SiteSerializer(sites, many=True)
-# return Response(serializer.data)
-
-
-#class SiteRetrieveUpdateDestroy(APIView):
-# """
-# Retrieve, update or delete a site
-# """
-#
-# def post(self, request, pk, format=None):
-# """Retrieve a site"""
-# data = parse_request(request.DATA)
-# if 'auth' not in data:
-# return Response(status=status.HTTP_400_BAD_REQUEST)
-# sites = get_sites(data['auth'], {'id': pk})
-# if not sites:
-# return Response(status=status.HTTP_404_NOT_FOUND)
-# serializer = SiteSerializer(sites[0])
-# return Response(serializer.data)
-#
-# def put(self, request, pk, format=None):
-# """update a site"""
-# data = parse_request(request.DATA)
-# if 'auth' not in data:
-# return Response(status=status.HTTP_400_BAD_REQUEST)
-# elif 'site' not in data:
-# return Response(status=status.HTTP_400_BAD_REQUEST)
-#
-# site = update_site(pk, data['site'])
-# serializer = SiteSerializer(site)
-# return Response(serializer.data)
-#
-# def delete(self, request, pk, format=None):
-# data = parse_request(request.DATA)
-# if 'auth' not in data:
-# return Response(status=status.HTTP_400_BAD_REQUEST)
-# delete_site(data['auth'], {'id': pk})
-# return Response(status=status.HTTP_204_NO_CONTENT)
-#
-#
-##
diff --git a/planetstack/core/views/tags.py b/planetstack/core/views/tags.py
new file mode 100644
index 0000000..ba8a035
--- /dev/null
+++ b/planetstack/core/views/tags.py
@@ -0,0 +1,13 @@
+from core.serializers import TagSerializer
+from rest_framework import generics
+from core.models import Tag
+
+class TagList(generics.ListCreateAPIView):
+ queryset = Tag.objects.all()
+ serializer_class = TagSerializer
+
+class TagDetail(generics.RetrieveUpdateDestroyAPIView):
+ queryset = Tag.objects.all()
+ serializer_class = TagSerializer
+
+