Add back secret with built-in user for o2 service
[pti/o2.git] / o2ims / views / ocloud_dto.py
index c7489ae..c8e5202 100644 (file)
@@ -62,7 +62,6 @@ class ResourcePoolDTO:
 
 
 class ResourceDTO:
-
     resource_list = api_ims_inventory_v1.model(
         "ResourceListDto",
         {
@@ -76,6 +75,46 @@ class ResourceDTO:
         }
     )
 
+    list_result = api_ims_inventory_v1.model(
+        "ResourceListPagenationDto",
+        {
+            'count': fields.Integer(),
+            'page_num': fields.Integer(),
+            'results': fields.List(fields.Nested(resource_list))
+        }
+    )
+
+    # def get_paginated_list(results, url, start, limit):
+    #     start = int(start)
+    #     limit = int(limit)
+    #     count = len(results)
+    #     if count < start or limit < 0:
+    #         api_ims_inventory_v1.abort(404)
+    #     # make response
+    #     obj = {}
+    #     obj['start'] = start
+    #     obj['limit'] = limit
+    #     obj['count'] = count
+    #     # make URLs
+    #     # make previous url
+    #     if start == 1:
+    #         obj['previous'] = ''
+    #     else:
+    #         start_copy = max(1, start - limit)
+    #         limit_copy = start - 1
+    #         obj['previous'] = url + \
+    #             '?start=%d&limit=%d' % (start_copy, limit_copy)
+    #     # make next url
+    #     if start + limit > count:
+    #         obj['next'] = ''
+    #     else:
+    #         start_copy = start + limit
+    #         obj['next'] = url + '?start=%d&limit=%d' % (start_copy, limit)
+    #     # finally extract result according to bounds
+    #     # obj['results'] = results[(start - 1):(start - 1 + limit)]
+    #     obj['result'] = fields.List(fields.Nested(ResourceDTO.resource_list))
+    #     return obj
+
     def recursive_resource_mapping(iteration_number=2):
         resource_json_mapping = {
             'resourceId': fields.String(required=True,
@@ -144,6 +183,10 @@ class DeploymentManagerDTO:
             'supportedLocations': fields.String,
             'capabilities': fields.String,
             'capacity': fields.String,
+            'profileSupportList': fields.List(
+                fields.String,
+                description='Profile support list, use default for the return \
+                     endpoint'),
         }
     )
 
@@ -154,7 +197,12 @@ class DeploymentManagerDTO:
         'admin_user': fields.String(attributes='admin_user'),
         'admin_client_cert': fields.String(attributes='admin_client_cert'),
         'admin_client_key': fields.String(attributes='admin_client_key'),
-        'kube_config_file': fields.String(attributes='kube_config_file')
+        # 'kube_config_file': fields.String(attributes='kube_config_file')
+        'helmcli_host_with_port': fields.String(
+            attributes='helmcli_host_with_port'),
+        'helmcli_username': fields.String(attributes='helmcli_username'),
+        'helmcli_password': fields.String(attributes='helmcli_password'),
+        'helmcli_kubeconfig': fields.String(attributes='helmcli_kubeconfig'),
     })
 
     deployment_manager_get = api_ims_inventory_v1.model(
@@ -169,7 +217,8 @@ class DeploymentManagerDTO:
             'supportedLocations': fields.String,
             'capabilities': fields.String,
             'capacity': fields.String,
-            'profile': fields.Nested(profile, False, True),
+            'profileName': fields.String,
+            'profileData': fields.Nested(profile, False, True),
         }
     )