From e56853bb52d463573442303231094c1d109027f5 Mon Sep 17 00:00:00 2001 From: gatici Date: Wed, 26 Jul 2023 15:07:09 +0300 Subject: [PATCH] OSMENG-1092 Base Class for Delete NS Record Activity Change-Id: If54a11d9c899dac57577fdbec436e0c15986e6c3 Signed-off-by: gatici --- osm_common/temporal/activities/ns.py | 43 ++++++++++++++++++++++++++++ 1 file changed, 43 insertions(+) diff --git a/osm_common/temporal/activities/ns.py b/osm_common/temporal/activities/ns.py index 4f1f4fe..265a9c1 100644 --- a/osm_common/temporal/activities/ns.py +++ b/osm_common/temporal/activities/ns.py @@ -178,3 +178,46 @@ class UpdateNsState(BaseActivity): async def __call__(self, activity_input: Input) -> None: raise NotImplementedError() + + +class DeleteNsRecord(BaseActivity): + """Delete a NS record from DB. + + Collaborators: + DB Write: nsrs + + Raises (retryable): + DbException: If DB access fails, the collection does not exist. + + Activity Lifecycle: + This activity should complete relatively quickly (less than a + second). However, it would be reasonable to wait up to 10 + seconds. + + This activity will not report a heartbeat due to its + short-running nature. + + This operation is idempotent. + + """ + + @dataclass + class Input: + """ + Input dataclass for activity that deletes a NS record. + + Attributes: + ----------- + ns_uuid : str + The UUID of the NS to be deleted from the nsrs + collection in Mongo. + """ + + ns_uuid: str + + def __init__(self, db: DbBase): + super().__init__() + self.db: DbBase = db + + async def __call__(self, activity_input: Input) -> None: + raise NotImplementedError() -- 2.25.1