OSMENG-1092 Base Class for Delete NS Record Activity 48/13748/2
authorgatici <gulsum.atici@canonical.com>
Wed, 26 Jul 2023 12:07:09 +0000 (15:07 +0300)
committergatici <gulsum.atici@canonical.com>
Wed, 26 Jul 2023 12:20:07 +0000 (15:20 +0300)
Change-Id: If54a11d9c899dac57577fdbec436e0c15986e6c3
Signed-off-by: gatici <gulsum.atici@canonical.com>
osm_common/temporal/activities/ns.py

index 4f1f4fe..265a9c1 100644 (file)
@@ -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()