[uncloud_api] completely remove it
This commit is contained in:
parent
aa59b05a2d
commit
11d629bb51
14 changed files with 0 additions and 214 deletions
|
@ -1,6 +0,0 @@
|
|||
from django.contrib import admin
|
||||
|
||||
from .models import Product, Feature
|
||||
|
||||
#admin.site.register(Product)
|
||||
#admin.site.register(Feature)
|
|
@ -1,5 +0,0 @@
|
|||
from django.apps import AppConfig
|
||||
|
||||
|
||||
class ApiConfig(AppConfig):
|
||||
name = 'uncloud_api'
|
|
@ -1,26 +0,0 @@
|
|||
import time
|
||||
from django.conf import settings
|
||||
from django.core.management.base import BaseCommand
|
||||
|
||||
import uncloud_api.models
|
||||
|
||||
import inspect
|
||||
import sys
|
||||
import re
|
||||
|
||||
class Command(BaseCommand):
|
||||
args = '<None>'
|
||||
help = 'hacking - only use if you are Nico'
|
||||
|
||||
def add_arguments(self, parser):
|
||||
parser.add_argument('command', type=str, help='Command')
|
||||
|
||||
def handle(self, *args, **options):
|
||||
getattr(self, options['command'])(**options)
|
||||
|
||||
@classmethod
|
||||
def classtest(cls, **_):
|
||||
clsmembers = inspect.getmembers(sys.modules['uncloud_api.models'], inspect.isclass)
|
||||
for name, c in clsmembers:
|
||||
if re.match(r'.+Product$', name):
|
||||
print("{} -> {}".format(name, c))
|
|
@ -1,29 +0,0 @@
|
|||
import time
|
||||
from django.conf import settings
|
||||
from django.core.management.base import BaseCommand
|
||||
|
||||
from uncloud_api import models
|
||||
|
||||
|
||||
class Command(BaseCommand):
|
||||
args = '<None>'
|
||||
help = 'VM Snapshot support'
|
||||
|
||||
def add_arguments(self, parser):
|
||||
parser.add_argument('command', type=str, help='Command')
|
||||
|
||||
def handle(self, *args, **options):
|
||||
print("Snapshotting")
|
||||
#getattr(self, options['command'])(**options)
|
||||
|
||||
@classmethod
|
||||
def monitor(cls, **_):
|
||||
while True:
|
||||
try:
|
||||
tweets = models.Reply.get_target_tweets()
|
||||
responses = models.Reply.objects.values_list('tweet_id', flat=True)
|
||||
new_tweets = [x for x in tweets if x.id not in responses]
|
||||
models.Reply.send(new_tweets)
|
||||
except TweepError as e:
|
||||
print(e)
|
||||
time.sleep(60)
|
|
@ -1,31 +0,0 @@
|
|||
# Generated by Django 3.0.3 on 2020-02-23 17:12
|
||||
|
||||
from django.conf import settings
|
||||
from django.db import migrations, models
|
||||
import django.db.models.deletion
|
||||
import uuid
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
initial = True
|
||||
|
||||
dependencies = [
|
||||
migrations.swappable_dependency(settings.AUTH_USER_MODEL),
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.CreateModel(
|
||||
name='VMSnapshotProduct',
|
||||
fields=[
|
||||
('uuid', models.UUIDField(default=uuid.uuid4, editable=False, primary_key=True, serialize=False)),
|
||||
('status', models.CharField(choices=[('pending', 'Pending'), ('being_created', 'Being created'), ('active', 'Active'), ('deleted', 'Deleted')], default='pending', max_length=256)),
|
||||
('gb_ssd', models.FloatField()),
|
||||
('gb_hdd', models.FloatField()),
|
||||
('owner', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to=settings.AUTH_USER_MODEL)),
|
||||
],
|
||||
options={
|
||||
'abstract': False,
|
||||
},
|
||||
),
|
||||
]
|
|
@ -1,19 +0,0 @@
|
|||
# Generated by Django 3.0.3 on 2020-02-25 18:16
|
||||
|
||||
from django.db import migrations, models
|
||||
import uuid
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
('uncloud_api', '0001_initial'),
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.AddField(
|
||||
model_name='vmsnapshotproduct',
|
||||
name='vm_uuid',
|
||||
field=models.UUIDField(default=uuid.uuid4, editable=False),
|
||||
),
|
||||
]
|
|
@ -1,36 +0,0 @@
|
|||
# Generated by Django 3.0.3 on 2020-02-25 19:50
|
||||
|
||||
from django.conf import settings
|
||||
from django.db import migrations, models
|
||||
import django.db.models.deletion
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
migrations.swappable_dependency(settings.AUTH_USER_MODEL),
|
||||
('uncloud_api', '0002_vmsnapshotproduct_vm_uuid'),
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.AlterField(
|
||||
model_name='vmsnapshotproduct',
|
||||
name='gb_hdd',
|
||||
field=models.FloatField(editable=False),
|
||||
),
|
||||
migrations.AlterField(
|
||||
model_name='vmsnapshotproduct',
|
||||
name='gb_ssd',
|
||||
field=models.FloatField(editable=False),
|
||||
),
|
||||
migrations.AlterField(
|
||||
model_name='vmsnapshotproduct',
|
||||
name='owner',
|
||||
field=models.ForeignKey(editable=False, on_delete=django.db.models.deletion.CASCADE, to=settings.AUTH_USER_MODEL),
|
||||
),
|
||||
migrations.AlterField(
|
||||
model_name='vmsnapshotproduct',
|
||||
name='vm_uuid',
|
||||
field=models.UUIDField(),
|
||||
),
|
||||
]
|
|
@ -1,8 +0,0 @@
|
|||
from django.contrib.auth import get_user_model
|
||||
|
||||
from rest_framework import serializers
|
||||
|
||||
class UserSerializer(serializers.ModelSerializer):
|
||||
class Meta:
|
||||
model = get_user_model()
|
||||
fields = ['url', 'username', 'email']
|
|
@ -1,3 +0,0 @@
|
|||
from django.test import TestCase
|
||||
|
||||
# Create your tests here.
|
|
@ -1,51 +0,0 @@
|
|||
from django.shortcuts import render
|
||||
from django.contrib.auth import get_user_model
|
||||
from django.contrib.auth.models import Group
|
||||
|
||||
from rest_framework import viewsets, permissions, generics
|
||||
|
||||
from rest_framework.views import APIView
|
||||
from rest_framework.response import Response
|
||||
|
||||
from .serializers import UserSerializer
|
||||
|
||||
import inspect
|
||||
import sys
|
||||
import re
|
||||
|
||||
|
||||
|
||||
# maybe drop or not --- we need something to guide the user!
|
||||
# class ProductsViewSet(viewsets.ViewSet):
|
||||
# permission_classes = [permissions.IsAuthenticated]
|
||||
|
||||
# def list(self, request):
|
||||
|
||||
# clsmembers = []
|
||||
# for modules in [ 'uncloud_api.models', 'uncloud_vm.models' ]:
|
||||
# clsmembers.extend(inspect.getmembers(sys.modules[modules], inspect.isclass))
|
||||
|
||||
|
||||
# products = []
|
||||
# for name, c in clsmembers:
|
||||
# # Include everything that ends in Product, but not Product itself
|
||||
# m = re.match(r'(?P<pname>.+)Product$', name)
|
||||
# if m:
|
||||
# products.append({
|
||||
# 'name': m.group('pname'),
|
||||
# 'description': c.description,
|
||||
# 'recurring_period': c.recurring_period,
|
||||
# 'pricing_model': c.pricing_model()
|
||||
# }
|
||||
# )
|
||||
|
||||
|
||||
# return Response(products)
|
||||
|
||||
|
||||
class UserViewSet(viewsets.ModelViewSet):
|
||||
serializer_class = UserSerializer
|
||||
permission_classes = [permissions.IsAuthenticated]
|
||||
|
||||
def get_queryset(self):
|
||||
return self.request.user
|
Loading…
Reference in a new issue