06d4f3cf59b72cc77d14f3c058bf4502c68469db
[pti/o2.git] / o2dms / api / dms_dto.py
1 # Copyright (C) 2021 Wind River Systems, Inc.
2 #
3 #  Licensed under the Apache License, Version 2.0 (the "License");
4 #  you may not use this file except in compliance with the License.
5 #  You may obtain a copy of the License at
6 #
7 #      http://www.apache.org/licenses/LICENSE-2.0
8 #
9 #  Unless required by applicable law or agreed to in writing, software
10 #  distributed under the License is distributed on an "AS IS" BASIS,
11 #  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 #  See the License for the specific language governing permissions and
13 #  limitations under the License.
14
15 from flask_restx import fields
16 from o2dms.api.dms_api_ns import api_dms_lcm_v1
17 from o2common.helper import o2logging
18 logger = o2logging.get_logger(__name__)
19
20
21 class DmsDTO:
22     dms_get = api_dms_lcm_v1.model(
23         "DmsGetDto",
24         {
25             'deploymentManagerId': fields.String(
26                 required=True,
27                 description='Deployment manager ID'),
28             'name': fields.String,
29             'description': fields.String,
30             'supportedLocations': fields.String,
31             'capabilities': fields.String,
32             'capacity': fields.String,
33         }
34     )
35
36
37 class DmsLcmNfDeploymentDescriptorDTO:
38     NfDeploymentDescriptor_get = api_dms_lcm_v1.model(
39         "NfDeploymentDescriptorGetDto",
40         {
41             'id': fields.String(
42                 required=True,
43                 description='NfDeploymentDescriptor ID'),
44             'name': fields.String,
45             'description': fields.String,
46             'inputParams': fields.String,
47             'outputParams': fields.String,
48             'artifactUrl': fields.String
49         }
50     )
51
52     NfDeploymentDescriptor_create = api_dms_lcm_v1.model(
53         "NfDeploymentDescriptorCreateDto",
54         {
55             'name': fields.String,
56             'description': fields.String,
57             'artifactUrl': fields.String,
58             'inputParams': fields.String,
59             'outputParams': fields.String
60         }
61     )
62
63     NfDeploymentDescriptor_create_post_resp = api_dms_lcm_v1.model(
64         "NfDeploymentDescriptorCreateRespDto",
65         {
66             'id': fields.String(
67                 required=True, description='NfDeploymentDescriptor ID'),
68         }
69     )
70
71     NfDeploymentDescriptor_update = api_dms_lcm_v1.model(
72         "NfDeploymentDescriptorUpdateDto",
73         {
74             'name': fields.String,
75             'description': fields.String,
76             'artifactUrl': fields.String,
77             'inputParams': fields.String,
78             'outputParams': fields.String
79         }
80     )
81
82
83 class DmsLcmNfDeploymentDTO:
84     NfDeployment_get = api_dms_lcm_v1.model(
85         "NfDeploymentGetDto",
86         {
87             'id': fields.String(
88                 required=True,
89                 description='NfDeployment ID'),
90             'name': fields.String,
91             'description': fields.String,
92             'descriptorId': fields.String,
93             'parentDeploymentId': fields.String,
94             'status': fields.Integer
95         }
96     )
97
98     NfDeployment_create = api_dms_lcm_v1.model(
99         "NfDeploymentCreateDto",
100         {
101             'name': fields.String,
102             'description': fields.String,
103             'descriptorId': fields.String,
104             'parentDeploymentId': fields.String
105         }
106     )
107
108     NfDeployment_create_post_resp = api_dms_lcm_v1.model(
109         "NfDeploymentCreateRespDto",
110         {
111             'id': fields.String(
112                 required=True, description='NfDeployment ID'),
113         }
114     )
115
116     NfDeployment_update = api_dms_lcm_v1.model(
117         "NfDeploymentUpdateDto",
118         {
119             'name': fields.String,
120             'description': fields.String,
121             'parentDeploymentId': fields.String
122         }
123     )
124
125
126 class DmsLcmNfOCloudVResourceDTO:
127     NfOCloudVResource_get = api_dms_lcm_v1.model(
128         "NfOCloudVResourceGetDto",
129         {
130             'id': fields.String(
131                 required=True,
132                 description='NfOCloudVResource ID'),
133             'name': fields.String,
134             'description': fields.String,
135             'descriptorId': fields.String,
136             'vresourceType': fields.String,
137             'status': fields.Integer,
138             'metadata': fields.String
139         }
140     )