586de3f78a1434fa0a9046d0c2b64fa13d6ed6b5
[pti/o2.git] / o2ims / views / ocloud_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 Namespace, fields
16
17
18 class OcloudDTO:
19
20     api = Namespace("Ocloud", description='Ocloud related operations.')
21
22     ocloud = api.model(
23         "OcloudList",
24         {
25             'oCloudId': fields.String(required=True),
26             'globalCloudId': fields.String,
27             'name': fields.String,
28             'description': fields.String,
29             'infrastructureManagementServiceEndpoint': fields.String,
30         }
31     )
32
33
34 class ResourceTypeDTO:
35
36     api = Namespace(
37         "ResourceType", description='Resource type related operations.')
38
39     resource_type_get = api.model(
40         "ResourceTypeGet",
41         {
42             'resourceTypeId': fields.String(required=True,
43                                             description='Resource type ID'),
44             'name': fields.String,
45             'vendor': fields.String,
46             'version': fields.String,
47             'description': fields.String,
48         }
49     )
50
51
52 class ResourcePoolDTO:
53
54     api = Namespace(
55         "ResourcePool", description='Resource pool related operations.')
56
57     resource_pool_get = api.model(
58         "ResourcePoolGet",
59         {
60             'resourcePoolId': fields.String(required=True,
61                                             description='Resource pool ID'),
62             'name': fields.String,
63             'globalLocationId': fields.String,
64             'location': fields.String,
65             'description': fields.String,
66         }
67     )
68
69
70 class ResourceDTO:
71
72     api = Namespace("Resource", description='Resource related operations.')
73
74     resource_list = api.model(
75         "ResourceList",
76         {
77             'resourceId': fields.String(required=True,
78                                         description='Resource ID'),
79             'resourceTypeId': fields.String,
80             'resourcePoolId': fields.String,
81             'parentId': fields.String,
82             'description': fields.String,
83         }
84     )
85
86     resource_get = api.model(
87         "ResourceGet",
88         {
89             'resourceId': fields.String(required=True,
90                                         description='Resource ID'),
91             'resourceTypeId': fields.String,
92             'resourcePoolId': fields.String,
93             'parentId': fields.String,
94             'description': fields.String,
95         }
96     )
97
98
99 class DeploymentManagerDTO:
100
101     api = Namespace("DeploymentManager",
102                     description='Deployment manager related operations.')
103
104     deployment_manager_get = api.model(
105         "DeploymentManagerGet",
106         {
107             'deploymentManagerId': fields.String(
108                 required=True,
109                 description='Deployment manager ID'),
110             'name': fields.String,
111             'description': fields.String,
112             'deploymentManagementServiceEndpoint': fields.String,
113             'supportedLocations': fields.String,
114             'capabilities': fields.String,
115             'capacity': fields.String,
116         }
117     )
118
119
120 class SubscriptionDTO:
121
122     api = Namespace(
123         "Subscription", description='Subscription related operations.')
124
125     subscription_get = api.model(
126         "SubscriptionGet",
127         {
128             'subscriptionId': fields.String(required=True,
129                                             description='Subscription ID'),
130             'callback': fields.String,
131             'consumerSubscriptionId': fields.String,
132             'filter': fields.String,
133         }
134     )
135
136     subscription = api.model(
137         "SubscriptionCreate",
138         {
139             'callback': fields.String(
140                 required=True, description='Subscription callback address'),
141             'consumerSubscriptionId': fields.String,
142             'filter': fields.String,
143         }
144     )
145
146     subscription_post_resp = api.model(
147         "SubscriptionCreatedResp",
148         {
149             'subscriptionId': fields.String(required=True,
150                                             description='Subscription ID'),
151         }
152     )