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
|
@ -9,6 +9,16 @@ vmuuid=$(http nicocustomer
|
|||
http -a nicocustomer:xxx http://uncloud.ch/vm/create_snapshot uuid=
|
||||
password=...
|
||||
```
|
||||
** backend realisation
|
||||
*** list snapshots
|
||||
- have them in the DB
|
||||
- create an entry on create
|
||||
*** creating snapshots
|
||||
- vm sync / fsync?
|
||||
- rbd snapshot
|
||||
- host/cluster mapping?
|
||||
- need image(s)
|
||||
|
||||
* steps
|
||||
** DONE authenticate via ldap
|
||||
CLOSED: [2020-02-20 Thu 19:05]
|
||||
|
@ -50,16 +60,8 @@ password=...
|
|||
** viewset: .list and .create
|
||||
** view: .get .post
|
||||
* TODO register CC
|
||||
* TODO list products
|
||||
* ahmed
|
||||
** schemas
|
||||
*** field: is_valid? - used by schemas
|
||||
*** definition of a "schema"
|
||||
* penguin pay
|
||||
## How to place a order with penguin pay
|
||||
|
||||
### Requirements
|
||||
|
||||
* DONE list products
|
||||
CLOSED: [2020-02-24 Mon 20:15]
|
||||
* An ungleich account - can be registered for free on
|
||||
https://account.ungleich.ch
|
||||
* httpie installed (provides the http command)
|
||||
|
|
|
@ -170,29 +170,29 @@ STATIC_URL = '/static/'
|
|||
stripe.api_key = secrets.STRIPE_KEY
|
||||
|
||||
# FIXME: not sure if we really need this
|
||||
LOGGING = {
|
||||
'version': 1,
|
||||
'disable_existing_loggers': False,
|
||||
'handlers': {
|
||||
'file': {
|
||||
'level': 'DEBUG',
|
||||
'class': 'logging.FileHandler',
|
||||
'filename': 'debug.log',
|
||||
},
|
||||
},
|
||||
'loggers': {
|
||||
'django': {
|
||||
'handlers': ['file'],
|
||||
'level': 'DEBUG',
|
||||
'propagate': True,
|
||||
},
|
||||
'django_auth_ldap': {
|
||||
'handlers': ['file'],
|
||||
'level': 'DEBUG',
|
||||
'propagate': True
|
||||
}
|
||||
},
|
||||
}
|
||||
# LOGGING = {
|
||||
# 'version': 1,
|
||||
# 'disable_existing_loggers': False,
|
||||
# 'handlers': {
|
||||
# 'file': {
|
||||
# 'level': 'DEBUG',
|
||||
# 'class': 'logging.FileHandler',
|
||||
# 'filename': 'debug.log',
|
||||
# },
|
||||
# },
|
||||
# 'loggers': {
|
||||
# 'django': {
|
||||
# 'handlers': ['file'],
|
||||
# 'level': 'DEBUG',
|
||||
# 'propagate': True,
|
||||
# },
|
||||
# 'django_auth_ldap': {
|
||||
# 'handlers': ['file'],
|
||||
# 'level': 'DEBUG',
|
||||
# 'propagate': True
|
||||
# }
|
||||
# },
|
||||
# }
|
||||
|
||||
# https://docs.djangoproject.com/en/3.0/ref/settings/#databases
|
||||
DATABASES = {
|
||||
|
|
|
@ -23,7 +23,6 @@ from opennebula import views as oneviews
|
|||
|
||||
router = routers.DefaultRouter()
|
||||
router.register(r'users', views.UserViewSet)
|
||||
router.register(r'groups', views.GroupViewSet)
|
||||
router.register(r'opennebula', oneviews.VMViewSet, basename='opennebula')
|
||||
router.register(r'opennebula_raw', oneviews.RawVMViewSet)
|
||||
|
||||
|
|
|
@ -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…
Reference in a new issue