forked from uncloud/uncloud
update
Signed-off-by: Nico Schottelius <nico@nico-notebook.schottelius.org>
This commit is contained in:
parent
15b0fe3dc9
commit
cc9e5905eb
5 changed files with 52 additions and 68 deletions
|
|
@ -51,6 +51,7 @@ class Product(models.Model):
|
|||
default='pending'
|
||||
)
|
||||
|
||||
# This is calculated by each product and saved in the DB
|
||||
recurring_price = models.FloatField()
|
||||
one_time_price = models.FloatField()
|
||||
|
||||
|
|
@ -67,6 +68,15 @@ class VMSnapshotProduct(Product):
|
|||
price_per_gb_ssd = 0.35
|
||||
price_per_gb_hdd = 1.5/100
|
||||
|
||||
# This we need to get from the VM
|
||||
gb_ssd = models.FloatField()
|
||||
gb_hdd = models.FloatField()
|
||||
|
||||
vm_uuid = models.UUIDField()
|
||||
|
||||
# Need to setup recurring_price and one_time_price and recurring period
|
||||
|
||||
|
||||
sample_ssd = 10
|
||||
sample_hdd = 100
|
||||
|
||||
|
|
@ -97,8 +107,10 @@ Sample price for a VM with {} GB SSD and {} GB HDD VM is: {}.
|
|||
""".format(cls.price_per_gb_ssd, cls.price_per_gb_hdd,
|
||||
cls.sample_ssd, cls.sample_hdd, cls.sample_price())
|
||||
|
||||
gb_ssd = models.FloatField()
|
||||
gb_hdd = models.FloatField()
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -7,17 +7,9 @@ from .serializers import UserSerializer, GroupSerializer
|
|||
from rest_framework.views import APIView
|
||||
from rest_framework.response import Response
|
||||
|
||||
|
||||
class CreditCardViewSet(viewsets.ModelViewSet):
|
||||
|
||||
"""
|
||||
API endpoint that allows credit cards to be listed
|
||||
"""
|
||||
queryset = get_user_model().objects.all().order_by('-date_joined')
|
||||
serializer_class = UserSerializer
|
||||
|
||||
permission_classes = [permissions.IsAuthenticated]
|
||||
|
||||
import inspect
|
||||
import sys
|
||||
import re
|
||||
|
||||
class UserViewSet(viewsets.ModelViewSet):
|
||||
|
||||
|
|
@ -29,24 +21,6 @@ class UserViewSet(viewsets.ModelViewSet):
|
|||
|
||||
permission_classes = [permissions.IsAuthenticated]
|
||||
|
||||
class GroupViewSet(viewsets.ModelViewSet):
|
||||
"""
|
||||
API endpoint that allows groups to be viewed or edited.
|
||||
"""
|
||||
queryset = Group.objects.all()
|
||||
serializer_class = GroupSerializer
|
||||
|
||||
permission_classes = [permissions.IsAuthenticated]
|
||||
|
||||
class GroupViewSet(viewsets.ModelViewSet):
|
||||
"""
|
||||
API endpoint that allows groups to be viewed or edited.
|
||||
"""
|
||||
queryset = Group.objects.all()
|
||||
serializer_class = GroupSerializer
|
||||
|
||||
permission_classes = [permissions.IsAuthenticated]
|
||||
|
||||
|
||||
# POST /vm/snapshot/ vmuuid=... => create snapshot, returns snapshot uuid
|
||||
# GET /vm/snapshot => list
|
||||
|
|
@ -57,9 +31,6 @@ class VMSnapshotView(generics.ListCreateAPIView):
|
|||
#lookup_field = 'uuid'
|
||||
permission_classes = [permissions.IsAuthenticated]
|
||||
|
||||
import inspect
|
||||
import sys
|
||||
import re
|
||||
|
||||
# Next: create /order/<productname> urls
|
||||
# Next: strip off "Product" at the end
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue