2018-05-30 10:49:40 +00:00
|
|
|
from typing import Callable, Iterable, Tuple
|
|
|
|
|
|
|
|
from ereuse_devicehub.resources.device.sync import Sync
|
2018-06-20 21:18:15 +00:00
|
|
|
from ereuse_devicehub.resources.event.schemas import Add, AggregateRate, AppRate, Benchmark, \
|
2018-06-19 16:38:42 +00:00
|
|
|
BenchmarkDataStorage, BenchmarkProcessor, BenchmarkProcessorSysbench, BenchmarkRamSysbench, \
|
|
|
|
BenchmarkWithRate, EraseBasic, EraseSectors, Event, Install, PhotoboxSystemRate, \
|
|
|
|
PhotoboxUserRate, Rate, Remove, Snapshot, Step, StepRandom, StepZero, StressTest, Test, \
|
|
|
|
TestDataStorage, WorkbenchRate
|
2018-04-27 17:16:43 +00:00
|
|
|
from ereuse_devicehub.resources.event.views import EventView, SnapshotView
|
|
|
|
from teal.resource import Converters, Resource
|
2018-04-10 15:06:39 +00:00
|
|
|
|
|
|
|
|
|
|
|
class EventDef(Resource):
|
2018-04-27 17:16:43 +00:00
|
|
|
SCHEMA = Event
|
2018-04-10 15:06:39 +00:00
|
|
|
VIEW = EventView
|
2018-04-27 17:16:43 +00:00
|
|
|
AUTH = True
|
2018-06-15 13:31:03 +00:00
|
|
|
ID_CONVERTER = Converters.uuid
|
2018-04-27 17:16:43 +00:00
|
|
|
|
|
|
|
|
2018-05-13 13:13:12 +00:00
|
|
|
class AddDef(EventDef):
|
2018-06-24 14:57:49 +00:00
|
|
|
VIEW = None
|
2018-05-13 13:13:12 +00:00
|
|
|
SCHEMA = Add
|
|
|
|
|
|
|
|
|
|
|
|
class RemoveDef(EventDef):
|
2018-06-24 14:57:49 +00:00
|
|
|
VIEW = None
|
2018-05-13 13:13:12 +00:00
|
|
|
SCHEMA = Remove
|
|
|
|
|
|
|
|
|
2018-06-10 16:47:49 +00:00
|
|
|
class EraseBasicDef(EventDef):
|
2018-06-24 14:57:49 +00:00
|
|
|
VIEW = None
|
2018-06-10 16:47:49 +00:00
|
|
|
SCHEMA = EraseBasic
|
|
|
|
|
|
|
|
|
|
|
|
class EraseSectorsDef(EraseBasicDef):
|
2018-06-24 14:57:49 +00:00
|
|
|
VIEW = None
|
2018-06-10 16:47:49 +00:00
|
|
|
SCHEMA = EraseSectors
|
|
|
|
|
|
|
|
|
|
|
|
class StepDef(Resource):
|
2018-06-24 14:57:49 +00:00
|
|
|
VIEW = None
|
2018-06-10 16:47:49 +00:00
|
|
|
SCHEMA = Step
|
|
|
|
|
|
|
|
|
|
|
|
class StepZeroDef(StepDef):
|
2018-06-24 14:57:49 +00:00
|
|
|
VIEW = None
|
2018-06-10 16:47:49 +00:00
|
|
|
SCHEMA = StepZero
|
|
|
|
|
|
|
|
|
|
|
|
class StepRandomDef(StepDef):
|
2018-06-24 14:57:49 +00:00
|
|
|
VIEW = None
|
2018-06-10 16:47:49 +00:00
|
|
|
SCHEMA = StepRandom
|
|
|
|
|
|
|
|
|
|
|
|
class RateDef(EventDef):
|
2018-06-24 14:57:49 +00:00
|
|
|
VIEW = None
|
2018-06-10 16:47:49 +00:00
|
|
|
SCHEMA = Rate
|
|
|
|
|
|
|
|
|
|
|
|
class AggregateRateDef(RateDef):
|
2018-06-24 14:57:49 +00:00
|
|
|
VIEW = None
|
2018-06-10 16:47:49 +00:00
|
|
|
SCHEMA = AggregateRate
|
|
|
|
|
|
|
|
|
|
|
|
class WorkbenchRateDef(RateDef):
|
2018-06-24 14:57:49 +00:00
|
|
|
VIEW = None
|
2018-06-10 16:47:49 +00:00
|
|
|
SCHEMA = WorkbenchRate
|
|
|
|
|
|
|
|
|
|
|
|
class PhotoboxUserDef(RateDef):
|
2018-06-24 14:57:49 +00:00
|
|
|
VIEW = None
|
2018-06-10 16:47:49 +00:00
|
|
|
SCHEMA = PhotoboxUserRate
|
|
|
|
|
|
|
|
|
|
|
|
class PhotoboxSystemRateDef(RateDef):
|
2018-06-24 14:57:49 +00:00
|
|
|
VIEW = None
|
2018-06-10 16:47:49 +00:00
|
|
|
SCHEMA = PhotoboxSystemRate
|
|
|
|
|
|
|
|
|
2018-06-20 21:18:15 +00:00
|
|
|
class AppRateDef(RateDef):
|
2018-06-24 14:57:49 +00:00
|
|
|
VIEW = None
|
2018-06-20 21:18:15 +00:00
|
|
|
SCHEMA = AppRate
|
|
|
|
|
|
|
|
|
2018-06-10 16:47:49 +00:00
|
|
|
class InstallDef(EventDef):
|
2018-06-24 14:57:49 +00:00
|
|
|
VIEW = None
|
2018-06-10 16:47:49 +00:00
|
|
|
SCHEMA = Install
|
|
|
|
|
|
|
|
|
2018-04-27 17:16:43 +00:00
|
|
|
class SnapshotDef(EventDef):
|
2018-06-24 14:57:49 +00:00
|
|
|
VIEW = None
|
2018-04-27 17:16:43 +00:00
|
|
|
SCHEMA = Snapshot
|
|
|
|
VIEW = SnapshotView
|
2018-05-13 13:13:12 +00:00
|
|
|
|
2018-05-30 10:49:40 +00:00
|
|
|
def __init__(self, app, import_name=__package__, static_folder=None, static_url_path=None,
|
|
|
|
template_folder=None, url_prefix=None, subdomain=None, url_defaults=None,
|
|
|
|
root_path=None, cli_commands: Iterable[Tuple[Callable, str or None]] = tuple()):
|
|
|
|
super().__init__(app, import_name, static_folder, static_url_path, template_folder,
|
|
|
|
url_prefix, subdomain, url_defaults, root_path, cli_commands)
|
|
|
|
self.sync = Sync()
|
|
|
|
|
2018-05-13 13:13:12 +00:00
|
|
|
|
|
|
|
class TestDef(EventDef):
|
2018-06-24 14:57:49 +00:00
|
|
|
VIEW = None
|
2018-05-13 13:13:12 +00:00
|
|
|
SCHEMA = Test
|
|
|
|
|
|
|
|
|
2018-06-10 16:47:49 +00:00
|
|
|
class TestDataStorageDef(TestDef):
|
2018-06-24 14:57:49 +00:00
|
|
|
VIEW = None
|
2018-06-10 16:47:49 +00:00
|
|
|
SCHEMA = TestDataStorage
|
2018-06-19 16:38:42 +00:00
|
|
|
|
|
|
|
|
|
|
|
class StressTestDef(TestDef):
|
2018-06-24 14:57:49 +00:00
|
|
|
VIEW = None
|
2018-06-19 16:38:42 +00:00
|
|
|
SCHEMA = StressTest
|
|
|
|
|
|
|
|
|
|
|
|
class BenchmarkDef(EventDef):
|
2018-06-24 14:57:49 +00:00
|
|
|
VIEW = None
|
2018-06-19 16:38:42 +00:00
|
|
|
SCHEMA = Benchmark
|
|
|
|
|
|
|
|
|
|
|
|
class BenchmarkDataStorageDef(BenchmarkDef):
|
2018-06-24 14:57:49 +00:00
|
|
|
VIEW = None
|
2018-06-19 16:38:42 +00:00
|
|
|
SCHEMA = BenchmarkDataStorage
|
|
|
|
|
|
|
|
|
|
|
|
class BenchmarkWithRateDef(BenchmarkDef):
|
2018-06-24 14:57:49 +00:00
|
|
|
VIEW = None
|
2018-06-19 16:38:42 +00:00
|
|
|
SCHEMA = BenchmarkWithRate
|
|
|
|
|
|
|
|
|
|
|
|
class BenchmarkProcessorDef(BenchmarkWithRateDef):
|
2018-06-24 14:57:49 +00:00
|
|
|
VIEW = None
|
2018-06-19 16:38:42 +00:00
|
|
|
SCHEMA = BenchmarkProcessor
|
|
|
|
|
|
|
|
|
|
|
|
class BenchmarkProcessorSysbenchDef(BenchmarkProcessorDef):
|
2018-06-24 14:57:49 +00:00
|
|
|
VIEW = None
|
2018-06-19 16:38:42 +00:00
|
|
|
SCHEMA = BenchmarkProcessorSysbench
|
|
|
|
|
|
|
|
|
|
|
|
class BenchmarkRamSysbenchDef(BenchmarkWithRateDef):
|
2018-06-24 14:57:49 +00:00
|
|
|
VIEW = None
|
2018-06-19 16:38:42 +00:00
|
|
|
SCHEMA = BenchmarkRamSysbench
|