move uncloud a layer up
Signed-off-by: Nico Schottelius <nico@nico-notebook.schottelius.org>
This commit is contained in:
parent
1d1ae6fb3e
commit
94633d6cc8
70 changed files with 99 additions and 50 deletions
|
@ -1,42 +0,0 @@
|
||||||
## How to place a order with penguin pay
|
|
||||||
|
|
||||||
### Requirements
|
|
||||||
|
|
||||||
* An ungleich account - can be registered for free on
|
|
||||||
https://account.ungleich.ch
|
|
||||||
* httpie installed (provides the http command)
|
|
||||||
|
|
||||||
## Get a membership
|
|
||||||
|
|
||||||
|
|
||||||
## Registering a payment method
|
|
||||||
|
|
||||||
To be able to pay for the membership, you will need to register a
|
|
||||||
credit card or apply for payment on bill (TO BE IMPLEMENTED).
|
|
||||||
|
|
||||||
### Register credit card
|
|
||||||
|
|
||||||
```
|
|
||||||
http POST https://api.ungleich.ch/membership \
|
|
||||||
username=nico password=yourpassword \
|
|
||||||
cc_number=.. \
|
|
||||||
cc_
|
|
||||||
|
|
||||||
```
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
### Request payment via bill
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
## Create the membership
|
|
||||||
|
|
||||||
|
|
||||||
```
|
|
||||||
http POST https://api.ungleich.ch/membership username=nico password=yourpassword
|
|
||||||
|
|
||||||
```
|
|
||||||
|
|
||||||
## List available products
|
|
|
@ -49,3 +49,52 @@ password=...
|
||||||
* Django rest framework
|
* Django rest framework
|
||||||
** viewset: .list and .create
|
** viewset: .list and .create
|
||||||
** view: .get .post
|
** 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
|
||||||
|
|
||||||
|
* An ungleich account - can be registered for free on
|
||||||
|
https://account.ungleich.ch
|
||||||
|
* httpie installed (provides the http command)
|
||||||
|
|
||||||
|
## Get a membership
|
||||||
|
|
||||||
|
|
||||||
|
## Registering a payment method
|
||||||
|
|
||||||
|
To be able to pay for the membership, you will need to register a
|
||||||
|
credit card or apply for payment on bill (TO BE IMPLEMENTED).
|
||||||
|
|
||||||
|
### Register credit card
|
||||||
|
|
||||||
|
```
|
||||||
|
http POST https://api.ungleich.ch/membership \
|
||||||
|
username=nico password=yourpassword \
|
||||||
|
cc_number=.. \
|
||||||
|
cc_
|
||||||
|
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
### Request payment via bill
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
## Create the membership
|
||||||
|
|
||||||
|
|
||||||
|
```
|
||||||
|
http POST https://api.ungleich.ch/membership username=nico password=yourpassword
|
||||||
|
|
||||||
|
```
|
||||||
|
|
||||||
|
## List available products
|
||||||
|
|
|
@ -1 +0,0 @@
|
||||||
*
|
|
6
plan.org
6
plan.org
|
@ -1,6 +0,0 @@
|
||||||
* TODO register CC
|
|
||||||
* TODO list products
|
|
||||||
* ahmed
|
|
||||||
** schemas
|
|
||||||
*** field: is_valid? - used by schemas
|
|
||||||
*** definition of a "schema"
|
|
|
@ -15,7 +15,7 @@ class VM(models.Model):
|
||||||
def cores(self):
|
def cores(self):
|
||||||
return int(self.data['TEMPLATE']['VCPU'])
|
return int(self.data['TEMPLATE']['VCPU'])
|
||||||
|
|
||||||
@property
|
@propertyx
|
||||||
def ram_in_gb(self):
|
def ram_in_gb(self):
|
||||||
return (int(self.data['TEMPLATE']['MEMORY'])/1024.)
|
return (int(self.data['TEMPLATE']['MEMORY'])/1024.)
|
||||||
|
|
|
@ -12,3 +12,5 @@ class VMDetail(generics.RetrieveAPIView):
|
||||||
lookup_field = 'vmid'
|
lookup_field = 'vmid'
|
||||||
queryset = VM.objects.all()
|
queryset = VM.objects.all()
|
||||||
serializer_class = VMSerializer
|
serializer_class = VMSerializer
|
||||||
|
|
||||||
|
class VMViewSet(
|
0
uncloud/uncloud_vm/__init__.py
Normal file
0
uncloud/uncloud_vm/__init__.py
Normal file
3
uncloud/uncloud_vm/admin.py
Normal file
3
uncloud/uncloud_vm/admin.py
Normal file
|
@ -0,0 +1,3 @@
|
||||||
|
from django.contrib import admin
|
||||||
|
|
||||||
|
# Register your models here.
|
5
uncloud/uncloud_vm/apps.py
Normal file
5
uncloud/uncloud_vm/apps.py
Normal file
|
@ -0,0 +1,5 @@
|
||||||
|
from django.apps import AppConfig
|
||||||
|
|
||||||
|
|
||||||
|
class UncloudVmConfig(AppConfig):
|
||||||
|
name = 'uncloud_vm'
|
0
uncloud/uncloud_vm/migrations/__init__.py
Normal file
0
uncloud/uncloud_vm/migrations/__init__.py
Normal file
12
uncloud/uncloud_vm/models.py
Normal file
12
uncloud/uncloud_vm/models.py
Normal file
|
@ -0,0 +1,12 @@
|
||||||
|
from django.db import models
|
||||||
|
|
||||||
|
|
||||||
|
class VM(models.Model):
|
||||||
|
uuid = models.UUIDField(primary_key=True, default=uuid.uuid4, editable=False)
|
||||||
|
owner = models.ForeignKey(get_user_model(), on_delete=models.CASCADE)
|
||||||
|
|
||||||
|
cores = models.IntegerField()
|
||||||
|
ram = models.FloatField()
|
||||||
|
|
||||||
|
|
||||||
|
class VMDisk(models.Model):
|
3
uncloud/uncloud_vm/tests.py
Normal file
3
uncloud/uncloud_vm/tests.py
Normal file
|
@ -0,0 +1,3 @@
|
||||||
|
from django.test import TestCase
|
||||||
|
|
||||||
|
# Create your tests here.
|
24
uncloud/uncloud_vm/views.py
Normal file
24
uncloud/uncloud_vm/views.py
Normal file
|
@ -0,0 +1,24 @@
|
||||||
|
from django.shortcuts import render
|
||||||
|
|
||||||
|
|
||||||
|
from django.contrib.auth.models import User
|
||||||
|
from django.shortcuts import get_object_or_404
|
||||||
|
from myapps.serializers import UserSerializer
|
||||||
|
from rest_framework import viewsets
|
||||||
|
from rest_framework.response import Response
|
||||||
|
|
||||||
|
from opennebula.models import VM as OpenNebulaVM
|
||||||
|
|
||||||
|
class VMViewSet(viewsets.ViewSet):
|
||||||
|
def list(self, request):
|
||||||
|
queryset = User.objects.all()
|
||||||
|
serializer = UserSerializer(queryset, many=True)
|
||||||
|
return Response(serializer.data)
|
||||||
|
|
||||||
|
def retrieve(self, request, pk=None):
|
||||||
|
queryset = User.objects.all()
|
||||||
|
user = get_object_or_404(queryset, pk=pk)
|
||||||
|
serializer = UserSerializer(user)
|
||||||
|
return Response(serializer.data)
|
||||||
|
|
||||||
|
permission_classes = [permissions.IsAuthenticated]
|
Loading…
Reference in a new issue