Fix: UpdateDms throwing error that no attribute 'events'
[pti/o2.git] / o2dms / views / dms_dto.py
index d353137..e52bc3e 100644 (file)
 #  See the License for the specific language governing permissions and
 #  limitations under the License.
 
-from flask_restx import Namespace, fields
+from flask_restx import fields
+from o2dms.views import api_dms_lcm_v1
 
 
 class DmsDTO:
-
-    api = Namespace("O2DMS",
-                    description='DMS related operations.')
-
-    dms_get = api.model(
-        "Get DMS information",
+    dms_get = api_dms_lcm_v1.model(
+        "DmsGetDto",
         {
             'deploymentManagerId': fields.String(
                 required=True,
@@ -36,12 +33,8 @@ class DmsDTO:
 
 
 class DmsLcmNfDeploymentDescriptorDTO:
-
-    api = Namespace("O2DMS_LCM_NfDeploymentDescriptor",
-                    description='DMS LCM NfDeploymentDescritpor operations.')
-
-    dmslcm_NfDeploymentDescriptor_get = api.model(
-        "Get NfDeploymentDescriptor information",
+    NfDeploymentDescriptor_get = api_dms_lcm_v1.model(
+        "NfDeploymentDescriptorGetDto",
         {
             'id': fields.String(
                 required=True,
@@ -52,3 +45,92 @@ class DmsLcmNfDeploymentDescriptorDTO:
             'outputParams': fields.String
         }
     )
+
+    NfDeploymentDescriptor_create = api_dms_lcm_v1.model(
+        "NfDeploymentDescriptorCreateDto",
+        {
+            'name': fields.String,
+            'description': fields.String,
+            'inputParams': fields.String,
+            'outputParams': fields.String
+        }
+    )
+
+    NfDeploymentDescriptor_create_post_resp = api_dms_lcm_v1.model(
+        "NfDeploymentDescriptorCreateRespDto",
+        {
+            'id': fields.String(
+                required=True, description='NfDeploymentDescriptor ID'),
+        }
+    )
+
+    NfDeploymentDescriptor_update = api_dms_lcm_v1.model(
+        "NfDeploymentDescriptorUpdateDto",
+        {
+            'name': fields.String,
+            'description': fields.String,
+            'inputParams': fields.String,
+            'outputParams': fields.String
+        }
+    )
+
+
+class DmsLcmNfDeploymentDTO:
+    NfDeployment_get = api_dms_lcm_v1.model(
+        "NfDeploymentGetDto",
+        {
+            'id': fields.String(
+                required=True,
+                description='NfDeployment ID'),
+            'name': fields.String,
+            'description': fields.String,
+            'descriptorId': fields.String,
+            'parentDeploymentId': fields.String,
+            'status': fields.Integer
+        }
+    )
+
+    NfDeployment_create = api_dms_lcm_v1.model(
+        "NfDeploymentCreateDto",
+        {
+            'name': fields.String,
+            'description': fields.String,
+            'descriptorId': fields.String,
+            'parentDeploymentId': fields.String
+        }
+    )
+
+    NfDeployment_create_post_resp = api_dms_lcm_v1.model(
+        "NfDeploymentCreateRespDto",
+        {
+            'id': fields.String(
+                required=True, description='NfDeployment ID'),
+        }
+    )
+
+    NfDeployment_update = api_dms_lcm_v1.model(
+        "NfDeploymentUpdateDto",
+        {
+            'name': fields.String,
+            'description': fields.String,
+            'descriptorId': fields.String,
+            'parentDeploymentId': fields.String
+        }
+    )
+
+
+class DmsLcmNfOCloudVResourceDTO:
+    NfOCloudVResource_get = api_dms_lcm_v1.model(
+        "NfOCloudVResourceGetDto",
+        {
+            'id': fields.String(
+                required=True,
+                description='NfOCloudVResource ID'),
+            'name': fields.String,
+            'description': fields.String,
+            'descriptorId': fields.String,
+            'vresourceType': fields.String,
+            'status': fields.Integer,
+            'metadata': fields.String
+        }
+    )