diff --git a/README-penguinpay.md b/README-penguinpay.md deleted file mode 100644 index 3229bc5..0000000 --- a/README-penguinpay.md +++ /dev/null @@ -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 diff --git a/README.md b/meow-payv1/README.md similarity index 100% rename from README.md rename to meow-payv1/README.md diff --git a/config.py b/meow-payv1/config.py similarity index 100% rename from config.py rename to meow-payv1/config.py diff --git a/hack-a-vpn.py b/meow-payv1/hack-a-vpn.py similarity index 100% rename from hack-a-vpn.py rename to meow-payv1/hack-a-vpn.py diff --git a/helper.py b/meow-payv1/helper.py similarity index 100% rename from helper.py rename to meow-payv1/helper.py diff --git a/ldaptest.py b/meow-payv1/ldaptest.py similarity index 100% rename from ldaptest.py rename to meow-payv1/ldaptest.py diff --git a/products/ipv6-only-django.json b/meow-payv1/products/ipv6-only-django.json similarity index 100% rename from products/ipv6-only-django.json rename to meow-payv1/products/ipv6-only-django.json diff --git a/products/ipv6-only-vm.json b/meow-payv1/products/ipv6-only-vm.json similarity index 100% rename from products/ipv6-only-vm.json rename to meow-payv1/products/ipv6-only-vm.json diff --git a/products/ipv6-only-vpn.json b/meow-payv1/products/ipv6-only-vpn.json similarity index 100% rename from products/ipv6-only-vpn.json rename to meow-payv1/products/ipv6-only-vpn.json diff --git a/products/ipv6box.json b/meow-payv1/products/ipv6box.json similarity index 100% rename from products/ipv6box.json rename to meow-payv1/products/ipv6box.json diff --git a/products/membership.json b/meow-payv1/products/membership.json similarity index 100% rename from products/membership.json rename to meow-payv1/products/membership.json diff --git a/requirements.txt b/meow-payv1/requirements.txt similarity index 100% rename from requirements.txt rename to meow-payv1/requirements.txt diff --git a/sample-pay.conf b/meow-payv1/sample-pay.conf similarity index 100% rename from sample-pay.conf rename to meow-payv1/sample-pay.conf diff --git a/schemas.py b/meow-payv1/schemas.py similarity index 100% rename from schemas.py rename to meow-payv1/schemas.py diff --git a/stripe_hack.py b/meow-payv1/stripe_hack.py similarity index 100% rename from stripe_hack.py rename to meow-payv1/stripe_hack.py diff --git a/stripe_utils.py b/meow-payv1/stripe_utils.py similarity index 100% rename from stripe_utils.py rename to meow-payv1/stripe_utils.py diff --git a/ucloud_pay.py b/meow-payv1/ucloud_pay.py similarity index 100% rename from ucloud_pay.py rename to meow-payv1/ucloud_pay.py diff --git a/notes-nico.org b/notes-nico.org index 93e0c00..03c1b97 100644 --- a/notes-nico.org +++ b/notes-nico.org @@ -49,3 +49,52 @@ password=... * Django rest framework ** 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 + +* 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 diff --git a/notes.org b/notes.org deleted file mode 100644 index 72e8ffc..0000000 --- a/notes.org +++ /dev/null @@ -1 +0,0 @@ -* diff --git a/plan.org b/plan.org deleted file mode 100644 index 9f172c2..0000000 --- a/plan.org +++ /dev/null @@ -1,6 +0,0 @@ -* TODO register CC -* TODO list products -* ahmed -** schemas -*** field: is_valid? - used by schemas -*** definition of a "schema" diff --git a/nicohack202002/uncloud/.gitignore b/uncloud/.gitignore similarity index 100% rename from nicohack202002/uncloud/.gitignore rename to uncloud/.gitignore diff --git a/nicohack202002/uncloud/README.md b/uncloud/README.md similarity index 100% rename from nicohack202002/uncloud/README.md rename to uncloud/README.md diff --git a/nicohack202002/uncloud/manage.py b/uncloud/manage.py similarity index 100% rename from nicohack202002/uncloud/manage.py rename to uncloud/manage.py diff --git a/nicohack202002/uncloud/opennebula/__init__.py b/uncloud/opennebula/__init__.py similarity index 100% rename from nicohack202002/uncloud/opennebula/__init__.py rename to uncloud/opennebula/__init__.py diff --git a/nicohack202002/uncloud/opennebula/admin.py b/uncloud/opennebula/admin.py similarity index 100% rename from nicohack202002/uncloud/opennebula/admin.py rename to uncloud/opennebula/admin.py diff --git a/nicohack202002/uncloud/opennebula/apps.py b/uncloud/opennebula/apps.py similarity index 100% rename from nicohack202002/uncloud/opennebula/apps.py rename to uncloud/opennebula/apps.py diff --git a/nicohack202002/uncloud/opennebula/management/commands/syncvm.py b/uncloud/opennebula/management/commands/syncvm.py similarity index 100% rename from nicohack202002/uncloud/opennebula/management/commands/syncvm.py rename to uncloud/opennebula/management/commands/syncvm.py diff --git a/nicohack202002/uncloud/opennebula/migrations/0001_initial.py b/uncloud/opennebula/migrations/0001_initial.py similarity index 100% rename from nicohack202002/uncloud/opennebula/migrations/0001_initial.py rename to uncloud/opennebula/migrations/0001_initial.py diff --git a/nicohack202002/uncloud/opennebula/migrations/0002_vm_uuid.py b/uncloud/opennebula/migrations/0002_vm_uuid.py similarity index 100% rename from nicohack202002/uncloud/opennebula/migrations/0002_vm_uuid.py rename to uncloud/opennebula/migrations/0002_vm_uuid.py diff --git a/nicohack202002/uncloud/opennebula/migrations/0003_auto_20200223_1058.py b/uncloud/opennebula/migrations/0003_auto_20200223_1058.py similarity index 100% rename from nicohack202002/uncloud/opennebula/migrations/0003_auto_20200223_1058.py rename to uncloud/opennebula/migrations/0003_auto_20200223_1058.py diff --git a/nicohack202002/uncloud/opennebula/migrations/__init__.py b/uncloud/opennebula/migrations/__init__.py similarity index 100% rename from nicohack202002/uncloud/opennebula/migrations/__init__.py rename to uncloud/opennebula/migrations/__init__.py diff --git a/nicohack202002/uncloud/opennebula/models.py b/uncloud/opennebula/models.py similarity index 98% rename from nicohack202002/uncloud/opennebula/models.py rename to uncloud/opennebula/models.py index ff0e49c..6dbc576 100644 --- a/nicohack202002/uncloud/opennebula/models.py +++ b/uncloud/opennebula/models.py @@ -15,7 +15,7 @@ class VM(models.Model): def cores(self): return int(self.data['TEMPLATE']['VCPU']) - @property + @propertyx def ram_in_gb(self): return (int(self.data['TEMPLATE']['MEMORY'])/1024.) diff --git a/nicohack202002/uncloud/opennebula/serializers.py b/uncloud/opennebula/serializers.py similarity index 100% rename from nicohack202002/uncloud/opennebula/serializers.py rename to uncloud/opennebula/serializers.py diff --git a/nicohack202002/uncloud/opennebula/tests.py b/uncloud/opennebula/tests.py similarity index 100% rename from nicohack202002/uncloud/opennebula/tests.py rename to uncloud/opennebula/tests.py diff --git a/nicohack202002/uncloud/opennebula/views.py b/uncloud/opennebula/views.py similarity index 95% rename from nicohack202002/uncloud/opennebula/views.py rename to uncloud/opennebula/views.py index f706815..7f2b537 100644 --- a/nicohack202002/uncloud/opennebula/views.py +++ b/uncloud/opennebula/views.py @@ -12,3 +12,5 @@ class VMDetail(generics.RetrieveAPIView): lookup_field = 'vmid' queryset = VM.objects.all() serializer_class = VMSerializer + +class VMViewSet( diff --git a/nicohack202002/uncloud/requirements.txt b/uncloud/requirements.txt similarity index 100% rename from nicohack202002/uncloud/requirements.txt rename to uncloud/requirements.txt diff --git a/nicohack202002/uncloud/uncloud/.gitignore b/uncloud/uncloud/.gitignore similarity index 100% rename from nicohack202002/uncloud/uncloud/.gitignore rename to uncloud/uncloud/.gitignore diff --git a/nicohack202002/uncloud/uncloud/__init__.py b/uncloud/uncloud/__init__.py similarity index 100% rename from nicohack202002/uncloud/uncloud/__init__.py rename to uncloud/uncloud/__init__.py diff --git a/nicohack202002/uncloud/uncloud/asgi.py b/uncloud/uncloud/asgi.py similarity index 100% rename from nicohack202002/uncloud/uncloud/asgi.py rename to uncloud/uncloud/asgi.py diff --git a/nicohack202002/uncloud/uncloud/secrets_sample.py b/uncloud/uncloud/secrets_sample.py similarity index 100% rename from nicohack202002/uncloud/uncloud/secrets_sample.py rename to uncloud/uncloud/secrets_sample.py diff --git a/nicohack202002/uncloud/uncloud/settings.py b/uncloud/uncloud/settings.py similarity index 100% rename from nicohack202002/uncloud/uncloud/settings.py rename to uncloud/uncloud/settings.py diff --git a/nicohack202002/uncloud/uncloud/stripe.py b/uncloud/uncloud/stripe.py similarity index 100% rename from nicohack202002/uncloud/uncloud/stripe.py rename to uncloud/uncloud/stripe.py diff --git a/nicohack202002/uncloud/uncloud/urls.py b/uncloud/uncloud/urls.py similarity index 100% rename from nicohack202002/uncloud/uncloud/urls.py rename to uncloud/uncloud/urls.py diff --git a/nicohack202002/uncloud/uncloud/wsgi.py b/uncloud/uncloud/wsgi.py similarity index 100% rename from nicohack202002/uncloud/uncloud/wsgi.py rename to uncloud/uncloud/wsgi.py diff --git a/nicohack202002/uncloud/uncloud_api/__init__.py b/uncloud/uncloud_api/__init__.py similarity index 100% rename from nicohack202002/uncloud/uncloud_api/__init__.py rename to uncloud/uncloud_api/__init__.py diff --git a/nicohack202002/uncloud/uncloud_api/admin.py b/uncloud/uncloud_api/admin.py similarity index 100% rename from nicohack202002/uncloud/uncloud_api/admin.py rename to uncloud/uncloud_api/admin.py diff --git a/nicohack202002/uncloud/uncloud_api/apps.py b/uncloud/uncloud_api/apps.py similarity index 100% rename from nicohack202002/uncloud/uncloud_api/apps.py rename to uncloud/uncloud_api/apps.py diff --git a/nicohack202002/uncloud/uncloud_api/management/__init__.py b/uncloud/uncloud_api/management/__init__.py similarity index 100% rename from nicohack202002/uncloud/uncloud_api/management/__init__.py rename to uncloud/uncloud_api/management/__init__.py diff --git a/nicohack202002/uncloud/uncloud_api/management/commands/__init__.py b/uncloud/uncloud_api/management/commands/__init__.py similarity index 100% rename from nicohack202002/uncloud/uncloud_api/management/commands/__init__.py rename to uncloud/uncloud_api/management/commands/__init__.py diff --git a/nicohack202002/uncloud/uncloud_api/management/commands/hack.py b/uncloud/uncloud_api/management/commands/hack.py similarity index 100% rename from nicohack202002/uncloud/uncloud_api/management/commands/hack.py rename to uncloud/uncloud_api/management/commands/hack.py diff --git a/nicohack202002/uncloud/uncloud_api/management/commands/snapshot.py b/uncloud/uncloud_api/management/commands/snapshot.py similarity index 100% rename from nicohack202002/uncloud/uncloud_api/management/commands/snapshot.py rename to uncloud/uncloud_api/management/commands/snapshot.py diff --git a/nicohack202002/uncloud/uncloud_api/migrations/0001_initial.py b/uncloud/uncloud_api/migrations/0001_initial.py similarity index 100% rename from nicohack202002/uncloud/uncloud_api/migrations/0001_initial.py rename to uncloud/uncloud_api/migrations/0001_initial.py diff --git a/nicohack202002/uncloud/uncloud_api/migrations/__init__.py b/uncloud/uncloud_api/migrations/__init__.py similarity index 100% rename from nicohack202002/uncloud/uncloud_api/migrations/__init__.py rename to uncloud/uncloud_api/migrations/__init__.py diff --git a/nicohack202002/uncloud/uncloud_api/models.py b/uncloud/uncloud_api/models.py similarity index 100% rename from nicohack202002/uncloud/uncloud_api/models.py rename to uncloud/uncloud_api/models.py diff --git a/nicohack202002/uncloud/uncloud_api/serializers.py b/uncloud/uncloud_api/serializers.py similarity index 100% rename from nicohack202002/uncloud/uncloud_api/serializers.py rename to uncloud/uncloud_api/serializers.py diff --git a/nicohack202002/uncloud/uncloud_api/tests.py b/uncloud/uncloud_api/tests.py similarity index 100% rename from nicohack202002/uncloud/uncloud_api/tests.py rename to uncloud/uncloud_api/tests.py diff --git a/nicohack202002/uncloud/uncloud_api/views.py b/uncloud/uncloud_api/views.py similarity index 100% rename from nicohack202002/uncloud/uncloud_api/views.py rename to uncloud/uncloud_api/views.py diff --git a/nicohack202002/uncloud/uncloud_auth/__init__.py b/uncloud/uncloud_auth/__init__.py similarity index 100% rename from nicohack202002/uncloud/uncloud_auth/__init__.py rename to uncloud/uncloud_auth/__init__.py diff --git a/nicohack202002/uncloud/uncloud_auth/admin.py b/uncloud/uncloud_auth/admin.py similarity index 100% rename from nicohack202002/uncloud/uncloud_auth/admin.py rename to uncloud/uncloud_auth/admin.py diff --git a/nicohack202002/uncloud/uncloud_auth/apps.py b/uncloud/uncloud_auth/apps.py similarity index 100% rename from nicohack202002/uncloud/uncloud_auth/apps.py rename to uncloud/uncloud_auth/apps.py diff --git a/nicohack202002/uncloud/uncloud_auth/migrations/0001_initial.py b/uncloud/uncloud_auth/migrations/0001_initial.py similarity index 100% rename from nicohack202002/uncloud/uncloud_auth/migrations/0001_initial.py rename to uncloud/uncloud_auth/migrations/0001_initial.py diff --git a/nicohack202002/uncloud/uncloud_auth/migrations/__init__.py b/uncloud/uncloud_auth/migrations/__init__.py similarity index 100% rename from nicohack202002/uncloud/uncloud_auth/migrations/__init__.py rename to uncloud/uncloud_auth/migrations/__init__.py diff --git a/nicohack202002/uncloud/uncloud_auth/models.py b/uncloud/uncloud_auth/models.py similarity index 100% rename from nicohack202002/uncloud/uncloud_auth/models.py rename to uncloud/uncloud_auth/models.py diff --git a/uncloud/uncloud_vm/__init__.py b/uncloud/uncloud_vm/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/uncloud/uncloud_vm/admin.py b/uncloud/uncloud_vm/admin.py new file mode 100644 index 0000000..8c38f3f --- /dev/null +++ b/uncloud/uncloud_vm/admin.py @@ -0,0 +1,3 @@ +from django.contrib import admin + +# Register your models here. diff --git a/uncloud/uncloud_vm/apps.py b/uncloud/uncloud_vm/apps.py new file mode 100644 index 0000000..c5e94a5 --- /dev/null +++ b/uncloud/uncloud_vm/apps.py @@ -0,0 +1,5 @@ +from django.apps import AppConfig + + +class UncloudVmConfig(AppConfig): + name = 'uncloud_vm' diff --git a/uncloud/uncloud_vm/migrations/__init__.py b/uncloud/uncloud_vm/migrations/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/uncloud/uncloud_vm/models.py b/uncloud/uncloud_vm/models.py new file mode 100644 index 0000000..b1aab40 --- /dev/null +++ b/uncloud/uncloud_vm/models.py @@ -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): diff --git a/uncloud/uncloud_vm/tests.py b/uncloud/uncloud_vm/tests.py new file mode 100644 index 0000000..7ce503c --- /dev/null +++ b/uncloud/uncloud_vm/tests.py @@ -0,0 +1,3 @@ +from django.test import TestCase + +# Create your tests here. diff --git a/uncloud/uncloud_vm/views.py b/uncloud/uncloud_vm/views.py new file mode 100644 index 0000000..aa5855c --- /dev/null +++ b/uncloud/uncloud_vm/views.py @@ -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]