Base class for Delete VNF record activity 64/13664/3
authorPatricia Reinoso <patricia.reinoso@canonical.com>
Tue, 11 Jul 2023 15:19:57 +0000 (15:19 +0000)
committerbeierlm <mark.beierl@canonical.com>
Thu, 13 Jul 2023 17:24:23 +0000 (19:24 +0200)
Change-Id: I123d6d3df87aed21953ab0f56be174c3b99d65b4
Signed-off-by: Patricia Reinoso <patricia.reinoso@canonical.com>
osm_common/temporal/activities/vnf.py

index 9aca0e3..2666f2b 100644 (file)
@@ -465,3 +465,46 @@ class GetModelNames(BaseActivity):
 
     async def __call__(self, activity_input: Input) -> Output:
         raise NotImplementedError()
+
+
+class DeleteVnfRecord(BaseActivity):
+    """Delete a VNF record from DB.
+
+    Collaborators:
+        DB Write:           vnfrs
+
+    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 VNF record.
+
+        Attributes:
+        -----------
+        vnfr_uuid : str
+            The UUID of the VNF to be deleted from the vnfrs
+            collection in Mongo.
+        """
+
+        vnfr_uuid: str
+
+    def __init__(self, db: DbBase):
+        super().__init__()
+        self.db: DbBase = db
+
+    async def __call__(self, activity_input: Input) -> None:
+        raise NotImplementedError()