Docs: Enable O2 DMS by exposing k8s API endpoint
[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     # profile = api_dms_lcm_v1.model("DMSGetDtoProfile", {
23     #     'cluster_api_endpoint': fields.String(
24     #         attributes='cluster_api_endpoint'),
25     #     'cluster_ca_cert': fields.String(attributes='cluster_ca_cert'),
26     #     'admin_user': fields.String(attributes='admin_user'),
27     #     'admin_client_cert': fields.String(attributes='admin_client_cert'),
28     #     'admin_client_key': fields.String(attributes='admin_client_key'),
29     #     # 'kube_config_file': fields.String(attributes='kube_config_file')
30     # })
31
32     dms_get = api_dms_lcm_v1.model(
33         "DmsGetDto",
34         {
35             'deploymentManagerId': fields.String(
36                 required=True,
37                 description='Deployment manager ID'),
38             'name': fields.String,
39             'description': fields.String,
40             'supportedLocations': fields.String,
41             'capabilities': fields.String,
42             'capacity': fields.String,
43             # 'profileName': fields.String,
44             # 'profileData': fields.Nested(profile, False, True),
45         }
46     )
47
48
49 class DmsLcmNfDeploymentDescriptorDTO:
50     NfDeploymentDescriptor_get = api_dms_lcm_v1.model(
51         "NfDeploymentDescriptorGetDto",
52         {
53             'id': fields.String(
54                 required=True,
55                 description='NfDeploymentDescriptor ID'),
56             'name': fields.String,
57             'description': fields.String,
58             'inputParams': fields.String,
59             'outputParams': fields.String,
60             'artifactRepoUrl': fields.String,
61             'artifactName': fields.String
62         }
63     )
64
65     NfDeploymentDescriptor_create = api_dms_lcm_v1.model(
66         "NfDeploymentDescriptorCreateDto",
67         {
68             'name': fields.String,
69             'description': fields.String,
70             'artifactRepoUrl': fields.String,
71             'artifactName': fields.String,
72             'inputParams': fields.String,
73             'outputParams': fields.String
74         }
75     )
76
77     NfDeploymentDescriptor_create_post_resp = api_dms_lcm_v1.model(
78         "NfDeploymentDescriptorCreateRespDto",
79         {
80             'id': fields.String(
81                 required=True, description='NfDeploymentDescriptor ID'),
82         }
83     )
84
85     NfDeploymentDescriptor_update = api_dms_lcm_v1.model(
86         "NfDeploymentDescriptorUpdateDto",
87         {
88             'name': fields.String,
89             'description': fields.String,
90             'artifactRepoUrl': fields.String,
91             'artifactName': fields.String,
92             'inputParams': fields.String,
93             'outputParams': fields.String
94         }
95     )
96
97
98 class DmsLcmNfDeploymentDTO:
99     NfDeployment_get = api_dms_lcm_v1.model(
100         "NfDeploymentGetDto",
101         {
102             'id': fields.String(
103                 required=True,
104                 description='NfDeployment ID'),
105             'name': fields.String,
106             'description': fields.String,
107             'descriptorId': fields.String,
108             'parentDeploymentId': fields.String,
109             'status': fields.Integer
110         }
111     )
112
113     NfDeployment_create = api_dms_lcm_v1.model(
114         "NfDeploymentCreateDto",
115         {
116             'name': fields.String,
117             'description': fields.String,
118             'descriptorId': fields.String,
119             'parentDeploymentId': fields.String
120         }
121     )
122
123     NfDeployment_create_post_resp = api_dms_lcm_v1.model(
124         "NfDeploymentCreateRespDto",
125         {
126             'id': fields.String(
127                 required=True, description='NfDeployment ID'),
128         }
129     )
130
131     NfDeployment_update = api_dms_lcm_v1.model(
132         "NfDeploymentUpdateDto",
133         {
134             'name': fields.String,
135             'description': fields.String,
136             'parentDeploymentId': fields.String
137         }
138     )
139
140
141 class DmsLcmNfOCloudVResourceDTO:
142     NfOCloudVResource_get = api_dms_lcm_v1.model(
143         "NfOCloudVResourceGetDto",
144         {
145             'id': fields.String(
146                 required=True,
147                 description='NfOCloudVResource ID'),
148             'name': fields.String,
149             'description': fields.String,
150             'descriptorId': fields.String,
151             'vresourceType': fields.String,
152             'status': fields.Integer,
153             'metadata': fields.String
154         }
155     )