Add nfdeployment handlers
[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             'artifactRepoUrl': fields.String,
49             'artifactName': fields.String
50         }
51     )
52
53     NfDeploymentDescriptor_create = api_dms_lcm_v1.model(
54         "NfDeploymentDescriptorCreateDto",
55         {
56             'name': fields.String,
57             'description': fields.String,
58             'artifactRepoUrl': fields.String,
59             'artifactName': fields.String,
60             'inputParams': fields.String,
61             'outputParams': fields.String
62         }
63     )
64
65     NfDeploymentDescriptor_create_post_resp = api_dms_lcm_v1.model(
66         "NfDeploymentDescriptorCreateRespDto",
67         {
68             'id': fields.String(
69                 required=True, description='NfDeploymentDescriptor ID'),
70         }
71     )
72
73     NfDeploymentDescriptor_update = api_dms_lcm_v1.model(
74         "NfDeploymentDescriptorUpdateDto",
75         {
76             'name': fields.String,
77             'description': fields.String,
78             'artifactRepoUrl': fields.String,
79             'artifactName': fields.String,
80             'inputParams': fields.String,
81             'outputParams': fields.String
82         }
83     )
84
85
86 class DmsLcmNfDeploymentDTO:
87     NfDeployment_get = api_dms_lcm_v1.model(
88         "NfDeploymentGetDto",
89         {
90             'id': fields.String(
91                 required=True,
92                 description='NfDeployment ID'),
93             'name': fields.String,
94             'description': fields.String,
95             'descriptorId': fields.String,
96             'parentDeploymentId': fields.String,
97             'status': fields.Integer
98         }
99     )
100
101     NfDeployment_create = api_dms_lcm_v1.model(
102         "NfDeploymentCreateDto",
103         {
104             'name': fields.String,
105             'description': fields.String,
106             'descriptorId': fields.String,
107             'parentDeploymentId': fields.String
108         }
109     )
110
111     NfDeployment_create_post_resp = api_dms_lcm_v1.model(
112         "NfDeploymentCreateRespDto",
113         {
114             'id': fields.String(
115                 required=True, description='NfDeployment ID'),
116         }
117     )
118
119     NfDeployment_update = api_dms_lcm_v1.model(
120         "NfDeploymentUpdateDto",
121         {
122             'name': fields.String,
123             'description': fields.String,
124             'parentDeploymentId': fields.String
125         }
126     )
127
128
129 class DmsLcmNfOCloudVResourceDTO:
130     NfOCloudVResource_get = api_dms_lcm_v1.model(
131         "NfOCloudVResourceGetDto",
132         {
133             'id': fields.String(
134                 required=True,
135                 description='NfOCloudVResource ID'),
136             'name': fields.String,
137             'description': fields.String,
138             'descriptorId': fields.String,
139             'vresourceType': fields.String,
140             'status': fields.Integer,
141             'metadata': fields.String
142         }
143     )