This repository has been archived on 2024-05-31. You can view files and clone it, but cannot push or open issues or pull requests.
devicehub-teal/ereuse_devicehub/resources/action/__init__.py

373 lines
6.5 KiB
Python
Raw Normal View History

from typing import Callable, Iterable, Tuple
from ereuse_devicehub.resources.action import schemas
2023-03-21 11:08:13 +00:00
from ereuse_devicehub.resources.action.views.views import (
ActionView,
AllocateView,
DeallocateView,
LiveView,
)
from ereuse_devicehub.resources.device.sync import Sync
2023-03-21 11:08:13 +00:00
from ereuse_devicehub.teal.resource import Converters, Resource
2018-04-10 15:06:39 +00:00
class ActionDef(Resource):
SCHEMA = schemas.Action
VIEW = ActionView
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
class AddDef(ActionDef):
VIEW = None
SCHEMA = schemas.Add
class RemoveDef(ActionDef):
VIEW = None
SCHEMA = schemas.Remove
class EraseBasicDef(ActionDef):
VIEW = None
SCHEMA = schemas.EraseBasic
2018-06-10 16:47:49 +00:00
class EraseSectorsDef(EraseBasicDef):
VIEW = None
SCHEMA = schemas.EraseSectors
2018-06-10 16:47:49 +00:00
class ErasePhysicalDef(EraseBasicDef):
VIEW = None
SCHEMA = schemas.ErasePhysical
2018-06-10 16:47:49 +00:00
class StepDef(Resource):
VIEW = None
SCHEMA = schemas.Step
2018-06-10 16:47:49 +00:00
class StepZeroDef(StepDef):
VIEW = None
SCHEMA = schemas.StepZero
2018-06-10 16:47:49 +00:00
class StepRandomDef(StepDef):
VIEW = None
SCHEMA = schemas.StepRandom
2018-06-10 16:47:49 +00:00
class BenchmarkDef(ActionDef):
VIEW = None
2019-04-16 15:47:28 +00:00
SCHEMA = schemas.Benchmark
class BenchmarkDataStorageDef(BenchmarkDef):
VIEW = None
SCHEMA = schemas.BenchmarkDataStorage
class BenchmarkWithRateDef(BenchmarkDef):
VIEW = None
SCHEMA = schemas.BenchmarkWithRate
class BenchmarkProcessorDef(BenchmarkWithRateDef):
VIEW = None
SCHEMA = schemas.BenchmarkProcessor
2018-06-10 16:47:49 +00:00
2019-04-16 15:47:28 +00:00
class BenchmarkProcessorSysbenchDef(BenchmarkProcessorDef):
VIEW = None
2019-04-16 15:47:28 +00:00
SCHEMA = schemas.BenchmarkProcessorSysbench
2018-06-10 16:47:49 +00:00
2019-04-16 15:47:28 +00:00
class BenchmarkRamSysbenchDef(BenchmarkWithRateDef):
VIEW = None
2019-04-16 15:47:28 +00:00
SCHEMA = schemas.BenchmarkRamSysbench
class TestDef(ActionDef):
VIEW = None
SCHEMA = schemas.Test
class MeasureBattery(TestDef):
VIEW = None
SCHEMA = schemas.MeasureBattery
class TestDataStorageDef(TestDef):
VIEW = None
SCHEMA = schemas.TestDataStorage
class StressTestDef(TestDef):
VIEW = None
SCHEMA = schemas.StressTest
class TestAudioDef(TestDef):
VIEW = None
SCHEMA = schemas.TestAudio
class TestConnectivityDef(TestDef):
VIEW = None
SCHEMA = schemas.TestConnectivity
class TestCameraDef(TestDef):
VIEW = None
SCHEMA = schemas.TestCamera
class TestKeyboardDef(TestDef):
VIEW = None
SCHEMA = schemas.TestKeyboard
class TestTrackpadDef(TestDef):
VIEW = None
SCHEMA = schemas.TestTrackpad
class TestBiosDef(TestDef):
VIEW = None
SCHEMA = schemas.TestBios
2019-05-08 17:12:05 +00:00
class VisualTestDef(TestDef):
VIEW = None
2019-05-08 17:12:05 +00:00
SCHEMA = schemas.VisualTest
2019-04-16 15:47:28 +00:00
class RateDef(ActionDef):
2019-04-16 15:47:28 +00:00
VIEW = None
SCHEMA = schemas.Rate
2018-06-10 16:47:49 +00:00
2019-04-16 15:47:28 +00:00
class RateComputerDef(RateDef):
VIEW = None
2019-04-16 15:47:28 +00:00
SCHEMA = schemas.RateComputer
2018-06-20 21:18:15 +00:00
class PriceDef(ActionDef):
2018-07-14 14:41:22 +00:00
VIEW = None
SCHEMA = schemas.Price
2018-07-14 14:41:22 +00:00
class EreusePriceDef(ActionDef):
2018-07-14 14:41:22 +00:00
VIEW = None
SCHEMA = schemas.EreusePrice
2018-07-14 14:41:22 +00:00
class InstallDef(ActionDef):
VIEW = None
SCHEMA = schemas.Install
2018-06-10 16:47:49 +00:00
class SnapshotDef(ActionDef):
VIEW = None
SCHEMA = schemas.Snapshot
2023-03-21 11:08:13 +00:00
def __init__(
self,
app,
import_name=__name__.split('.')[0],
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(),
):
url_prefix = '/{}'.format(ActionDef.resource)
2023-03-21 11:08:13 +00:00
super().__init__(
app,
import_name,
static_folder,
static_url_path,
template_folder,
url_prefix,
subdomain,
url_defaults,
root_path,
cli_commands,
)
self.sync = Sync()
class ToRepairDef(ActionDef):
VIEW = None
SCHEMA = schemas.ToRepair
class RepairDef(ActionDef):
VIEW = None
SCHEMA = schemas.Repair
class ReadyDef(ActionDef):
VIEW = None
SCHEMA = schemas.Ready
class RecyclingDef(ActionDef):
VIEW = None
SCHEMA = schemas.Recycling
class UseDef(ActionDef):
VIEW = None
SCHEMA = schemas.Use
class RefurbishDef(ActionDef):
VIEW = None
SCHEMA = schemas.Refurbish
class ManagementDef(ActionDef):
VIEW = None
SCHEMA = schemas.Management
class ToPrepareDef(ActionDef):
VIEW = None
SCHEMA = schemas.ToPrepare
2021-07-29 10:45:43 +00:00
class DataWipeDef(ActionDef):
2021-07-21 06:46:09 +00:00
VIEW = None
2021-07-29 10:45:43 +00:00
SCHEMA = schemas.DataWipe
2021-07-21 06:46:09 +00:00
2023-05-26 15:11:47 +00:00
class EraseDataWipe(ActionDef):
VIEW = None
SCHEMA = schemas.EraseDataWipe
class AllocateDef(ActionDef):
VIEW = AllocateView
SCHEMA = schemas.Allocate
class DeallocateDef(ActionDef):
VIEW = DeallocateView
SCHEMA = schemas.Deallocate
class PrepareDef(ActionDef):
VIEW = None
SCHEMA = schemas.Prepare
class LiveDef(ActionDef):
2020-12-28 14:31:57 +00:00
VIEW = LiveView
SCHEMA = schemas.Live
2020-12-29 16:36:28 +00:00
AUTH = False
class ReserveDef(ActionDef):
VIEW = None
SCHEMA = schemas.Reserve
class CancelReservationDef(ActionDef):
VIEW = None
SCHEMA = schemas.CancelReservation
class SellDef(ActionDef):
VIEW = None
SCHEMA = schemas.Sell
class DonateDef(ActionDef):
VIEW = None
SCHEMA = schemas.Donate
2020-11-23 10:43:30 +00:00
class RentDef(ActionDef):
VIEW = None
SCHEMA = schemas.Rent
class MakeAvailable(ActionDef):
VIEW = None
SCHEMA = schemas.MakeAvailable
2021-04-30 15:54:03 +00:00
2021-10-05 09:56:19 +00:00
class Delete(ActionDef):
VIEW = None
SCHEMA = schemas.Delete
2021-04-22 09:10:13 +00:00
class ConfirmDef(ActionDef):
VIEW = None
SCHEMA = schemas.Confirm
2021-04-30 15:54:03 +00:00
class RevokeDef(ActionDef):
2021-04-30 10:44:32 +00:00
VIEW = None
2021-04-30 15:54:03 +00:00
SCHEMA = schemas.Revoke
2021-04-30 10:44:32 +00:00
2021-11-10 17:59:44 +00:00
class ConfirmRevokeDef(ActionDef):
2021-04-30 15:54:03 +00:00
VIEW = None
2021-11-10 17:59:44 +00:00
SCHEMA = schemas.ConfirmRevoke
2021-04-30 15:54:03 +00:00
2021-03-25 10:26:30 +00:00
class TradeDef(ActionDef):
VIEW = None
SCHEMA = schemas.Trade
class ConfirmDocumentDef(ActionDef):
VIEW = None
SCHEMA = schemas.ConfirmDocument
class RevokeDocumentDef(ActionDef):
VIEW = None
SCHEMA = schemas.RevokeDocument
class ConfirmRevokeDocumentDef(ActionDef):
VIEW = None
SCHEMA = schemas.ConfirmRevokeDocument
class CancelTradeDef(ActionDef):
VIEW = None
SCHEMA = schemas.CancelTrade
class ToDisposeProductDef(ActionDef):
VIEW = None
SCHEMA = schemas.ToDisposeProduct
class DisposeProductDef(ActionDef):
VIEW = None
SCHEMA = schemas.DisposeProduct
class MigrateToDef(ActionDef):
VIEW = None
SCHEMA = schemas.MigrateTo
class MigrateFromDef(ActionDef):
VIEW = None
SCHEMA = schemas.MigrateFrom
2021-09-06 10:45:47 +00:00
class MoveOnDocumentDef(ActionDef):
2021-09-06 10:45:47 +00:00
VIEW = None
SCHEMA = schemas.MoveOnDocument