コード例 #1
0
 def convert_with_links(zones, limit, url=None,
                        expand=False, **kwargs):
     collection = AvailabilityZoneCollection()
     collection.availability_zones = [
         view.format_a_zone(url, p) for p in zones]
     collection.next = collection.get_next(limit, url=url, **kwargs)
     return collection
コード例 #2
0
ファイル: containers.py プロジェクト: zwphit/zun
 def convert_with_links(rpc_containers, limit, url=None,
                        expand=False, **kwargs):
     collection = ContainerCollection()
     collection.containers = \
         [view.format_container(url, p) for p in rpc_containers]
     collection.next = collection.get_next(limit, url=url, **kwargs)
     return collection
コード例 #3
0
 def convert_with_links(rpc_registries, limit, url=None, **kwargs):
     context = pecan.request.context
     collection = RegistryCollection()
     collection.registries = \
         [view.format_registry(context, url, r.as_dict())
          for r in rpc_registries]
     collection.next = collection.get_next(limit, url=url, **kwargs)
     return collection
コード例 #4
0
ファイル: networks.py プロジェクト: wanghuiict/zun
 def convert_with_links(rpc_network,
                        limit,
                        url=None,
                        expand=False,
                        **kwargs):
     collection = NetworkCollection()
     collection.network = [view.format_network(url, p) for p in rpc_network]
     collection.next = collection.get_next(limit, url=url, **kwargs)
     return collection
コード例 #5
0
ファイル: registries.py プロジェクト: openstack/higgins
 def convert_with_links(rpc_registries, limit, url=None,
                        **kwargs):
     context = pecan.request.context
     collection = RegistryCollection()
     collection.registries = \
         [view.format_registry(context, url, r.as_dict())
          for r in rpc_registries]
     collection.next = collection.get_next(limit, url=url, **kwargs)
     return collection
コード例 #6
0
ファイル: images.py プロジェクト: zwphit/zun
 def convert_with_links(rpc_images,
                        limit,
                        url=None,
                        expand=False,
                        **kwargs):
     collection = ImageCollection()
     collection.images = [view.format_image(url, p) for p in rpc_images]
     collection.next = collection.get_next(limit, url=url, **kwargs)
     return collection
コード例 #7
0
 def convert_with_links(rpc_capsules,
                        limit,
                        url=None,
                        expand=False,
                        **kwargs):
     collection = CapsuleCollection()
     collection.capsules = \
         [view.format_capsule(url, p) for p in rpc_capsules]
     collection.next = collection.get_next(limit, url=url, **kwargs)
     return collection
コード例 #8
0
 def convert_with_links(rpc_capsules, limit, url=None,
                        expand=False, legacy_api_version=False, **kwargs):
     context = pecan.request.context
     collection = CapsuleCollection()
     collection.capsules = \
         [view.format_capsule(url, p, context,
                              legacy_api_version=legacy_api_version)
          for p in rpc_capsules]
     collection.next = collection.get_next(limit, url=url, **kwargs)
     return collection
コード例 #9
0
ファイル: capsules.py プロジェクト: openstack/higgins
 def convert_with_links(rpc_capsules, limit, url=None,
                        expand=False, legacy_api_version=False, **kwargs):
     context = pecan.request.context
     collection = CapsuleCollection()
     collection.capsules = \
         [view.format_capsule(url, p, context,
                              legacy_api_version=legacy_api_version)
          for p in rpc_capsules]
     collection.next = collection.get_next(limit, url=url, **kwargs)
     return collection
コード例 #10
0
ファイル: zun_services.py プロジェクト: prameswar/zun
 def convert_db_rec_list_to_collection(servicegroup_api, rpc_hsvcs,
                                       **kwargs):
     collection = ZunServiceCollection()
     collection.services = []
     for p in rpc_hsvcs:
         alive = servicegroup_api.service_is_up(p)
         state = 'up' if alive else 'down'
         hsvc = ZunService(state, **p.as_dict())
         collection.services.append(hsvc)
     next = collection.get_next(limit=None, url=None, **kwargs)
     if next is not None:
         collection.next = next
     return collection
コード例 #11
0
 def convert_with_links(rpc_images,
                        limit,
                        url=None,
                        expand=False,
                        **kwargs):
     collection = ImageCollection()
     # TODO(sbiswas7): This is the ugly part of the deal.
     # We need to convert this p thing below as dict for now
     # Removal of dict-compat lead to this change.
     collection.images = [
         Image.convert_with_links(p.as_dict(), expand) for p in rpc_images
     ]
     collection.next = collection.get_next(limit, url=url, **kwargs)
     return collection
コード例 #12
0
 def convert_db_rec_list_to_collection(servicegroup_api, rpc_hsvcs,
                                       **kwargs):
     collection = ZunServiceCollection()
     collection.services = []
     for p in rpc_hsvcs:
         service = p.as_dict()
         alive = servicegroup_api.service_is_up(p)
         state = 'up' if alive else 'down'
         service['state'] = state
         collection.services.append(service)
         if not service['availability_zone']:
             service['availability_zone'] = CONF.default_availability_zone
     next = collection.get_next(limit=None, url=None, **kwargs)
     if next is not None:
         collection.next = next
     return collection
コード例 #13
0
ファイル: zun_services.py プロジェクト: openstack/higgins
 def convert_db_rec_list_to_collection(servicegroup_api,
                                       rpc_hsvcs, **kwargs):
     collection = ZunServiceCollection()
     collection.services = []
     for p in rpc_hsvcs:
         service = p.as_dict()
         alive = servicegroup_api.service_is_up(p)
         state = 'up' if alive else 'down'
         service['state'] = state
         service = view.format_service(service)
         collection.services.append(service)
         if not service['availability_zone']:
             service['availability_zone'] = CONF.default_availability_zone
     next = collection.get_next(limit=None, url=None, **kwargs)
     if next is not None:
         collection.next = next
     return collection
コード例 #14
0
 def convert_with_links(nodes, limit, url=None,
                        expand=False, **kwargs):
     collection = HostCollection()
     collection.hosts = [view.format_host(url, p) for p in nodes]
     collection.next = collection.get_next(limit, url=url, **kwargs)
     return collection
コード例 #15
0
ファイル: networks.py プロジェクト: openstack/higgins
 def convert_with_links(rpc_network, limit, url=None,
                        expand=False, **kwargs):
     collection = NetworkCollection()
     collection.network = [view.format_network(url, p) for p in rpc_network]
     collection.next = collection.get_next(limit, url=url, **kwargs)
     return collection
コード例 #16
0
ファイル: hosts.py プロジェクト: openstack/higgins
 def convert_with_links(nodes, limit, url=None,
                        expand=False, **kwargs):
     collection = HostCollection()
     collection.hosts = [view.format_host(url, p) for p in nodes]
     collection.next = collection.get_next(limit, url=url, **kwargs)
     return collection
コード例 #17
0
ファイル: images.py プロジェクト: openstack/higgins
 def convert_with_links(rpc_images, limit, url=None,
                        expand=False, **kwargs):
     collection = ImageCollection()
     collection.images = [view.format_image(url, p) for p in rpc_images]
     collection.next = collection.get_next(limit, url=url, **kwargs)
     return collection