Adjust API level on swagger and set API doc expansion by default
[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 fields
16
17 from o2ims.views import api
18
19
20 class OcloudDTO:
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     resource_type_get = api.model(
37         "ResourceTypeGet",
38         {
39             'resourceTypeId': fields.String(required=True,
40                                             description='Resource type ID'),
41             'name': fields.String,
42             'vendor': fields.String,
43             'version': fields.String,
44             'description': fields.String,
45         }
46     )
47
48
49 class ResourcePoolDTO:
50
51     resource_pool_get = api.model(
52         "ResourcePoolGet",
53         {
54             'resourcePoolId': fields.String(required=True,
55                                             description='Resource pool ID'),
56             'name': fields.String,
57             'globalLocationId': fields.String,
58             'location': fields.String,
59             'description': fields.String,
60         }
61     )
62
63
64 class ResourceDTO:
65
66     resource_list = api.model(
67         "ResourceList",
68         {
69             'resourceId': fields.String(required=True,
70                                         description='Resource ID'),
71             'resourceTypeId': fields.String,
72             'resourcePoolId': fields.String,
73             'parentId': fields.String,
74             'description': fields.String,
75         }
76     )
77
78     resource_get = api.model(
79         "ResourceGet",
80         {
81             'resourceId': fields.String(required=True,
82                                         description='Resource ID'),
83             'resourceTypeId': fields.String,
84             'resourcePoolId': fields.String,
85             'parentId': fields.String,
86             'description': fields.String,
87         }
88     )
89
90
91 class DeploymentManagerDTO:
92
93     deployment_manager_get = api.model(
94         "DeploymentManagerGet",
95         {
96             'deploymentManagerId': fields.String(
97                 required=True,
98                 description='Deployment manager ID'),
99             'name': fields.String,
100             'description': fields.String,
101             'deploymentManagementServiceEndpoint': fields.String,
102             'supportedLocations': fields.String,
103             'capabilities': fields.String,
104             'capacity': fields.String,
105         }
106     )
107
108
109 class SubscriptionDTO:
110
111     subscription_get = api.model(
112         "SubscriptionGet",
113         {
114             'subscriptionId': fields.String(required=True,
115                                             description='Subscription ID'),
116             'callback': fields.String,
117             'consumerSubscriptionId': fields.String,
118             'filter': fields.String,
119         }
120     )
121
122     subscription = api.model(
123         "SubscriptionCreate",
124         {
125             'callback': fields.String(
126                 required=True, description='Subscription callback address'),
127             'consumerSubscriptionId': fields.String,
128             'filter': fields.String,
129         }
130     )
131
132     subscription_post_resp = api.model(
133         "SubscriptionCreatedResp",
134         {
135             'subscriptionId': fields.String(required=True,
136                                             description='Subscription ID'),
137         }
138     )