From: gatici Date: Wed, 26 Jul 2023 12:07:09 +0000 (+0300) Subject: OSMENG-1092 Base Class for Delete NS Record Activity X-Git-Url: https://osm.etsi.org/gitweb/?a=commitdiff_plain;h=refs%2Fchanges%2F48%2F13748%2F2;p=osm%2Fcommon.git OSMENG-1092 Base Class for Delete NS Record Activity Change-Id: If54a11d9c899dac57577fdbec436e0c15986e6c3 Signed-off-by: gatici --- 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()