Change to use Enum
Changes operation and operational status types to
IntEnums
Change-Id: If204c3a7d3cf0f3407792a5ae54b4c1077898e67
Signed-off-by: Mark Beierl <mark.beierl@canonical.com>
diff --git a/osm_common/dataclasses/temporal_dataclasses.py b/osm_common/dataclasses/temporal_dataclasses.py
index 3b8a857..37736c7 100644
--- a/osm_common/dataclasses/temporal_dataclasses.py
+++ b/osm_common/dataclasses/temporal_dataclasses.py
@@ -16,7 +16,9 @@
#######################################################################################
from dataclasses import dataclass
+from enum import auto, IntEnum
+#######################################################################################
# Workflow Dataclasses
@@ -42,6 +44,7 @@
op_id: str
+#######################################################################################
# Activity Dataclasses
@@ -60,6 +63,12 @@
vim_uuid: str
+class VimState(IntEnum):
+ PROCESSING = auto()
+ ENABLED = auto()
+ ERROR = auto()
+
+
@dataclass
class UpdateVimStateInput:
"""
@@ -71,7 +80,7 @@
The UUID of the VIM account as stored in the OSM vim
collection in Mongo
- operational_state : str
+ operational_state : VimState
A representation of the operational state (ENABLED or ERROR)
of the VIM.
@@ -82,10 +91,15 @@
"""
vim_uuid: str
- operational_state: str
+ operational_state: VimState
message: str
+class VimOperationState(IntEnum):
+ COMPLETED = auto()
+ FAILED = auto()
+
+
@dataclass
class UpdateVimOperationStateInput:
"""
@@ -102,7 +116,7 @@
The operation (task) id for this workflow. This is used
to update the status of the operation in Mongo vim collection.
- op_state : str
+ op_state : VimOperationState
A representation of the state of the specified operation id,
such as COMPLETED, or FAILED.
@@ -114,7 +128,7 @@
vim_uuid: str
op_id: str
- op_state: str
+ op_state: VimOperationState
message: str