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
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
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
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
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
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
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
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
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
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
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
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