def robots_get(capability=[]): """ method to get all robots """ resultlist = [] items=[] if capability: items = Robot.scan(capabilities__contains=capability) else: items = Robot.scan() for item in items: resultlist.append(item.attribute_values) return resultlist
def buildings_building_id_robots_get(buildingId, capability = None): resultList = [] try: building = Building.get(buildingId) except Exception as e: return 'Building with id=%s does not exist.' % (buildingId) if capability is not None and capability != '': for item in Robot.scan(buildingId__eq=buildingId, capabilities__contains=capability, conditional_operator='AND'): resultList.append(item.attribute_values) else: for item in Robot.scan(buildingId__eq=buildingId): resultList.append(item.attribute_values) return resultList
def buildings_building_id_robots_get(buildingId, capability=None): resultList = [] try: building = Building.get(buildingId) except Exception as e: return 'Building with id=%s does not exist.' % (buildingId) if capability is not None and capability != '': for item in Robot.scan(buildingId__eq=buildingId, capabilities__contains=capability, conditional_operator='AND'): resultList.append(item.attribute_values) else: for item in Robot.scan(buildingId__eq=buildingId): resultList.append(item.attribute_values) return resultList
def robots_delete() -> str: temp = [] for item in Robot.scan(): temp.append(item.delete()) return "%s items deleted." % len(temp)
def buildings_building_id_robots_get(buildingId) -> str: resultList = [] for item in Robot.scan(buildingId__eq=buildingId): resultList.append(item.attribute_values) return ( resultList )
def buildings_building_id_robots_delete(buildingId): """ method to delete all robots inside a building """ resultlist = [] for item in Robot.scan(buildingId__eq=buildingId): resultlist.append(item.delete()) return "%s items deleted." % len(resultlist)
def robots_delete(): """ method to delete all robots """ temp = [] for item in Robot.scan(): temp.append(item.delete()) return "%s items deleted." % len(temp)
def robots_get(): """ method to get all robots """ resultlist = [] for item in Robot.scan(): resultlist.append(item.attribute_values) return resultlist
def buildings_building_id_robots_delete(buildingId) -> str: resultList = [] for item in Robot.scan(buildingId__eq=buildingId): resultList.append(item.delete()) return "%s items deleted." % len(resultList)
def robots_get() -> str: resultList = [] for item in Robot.scan(): resultList.append(item.attribute_values) return resultList
def buildings_building_id_robots_get(buildingId) -> str: resultList = [] for item in Robot.scan(buildingId__eq=buildingId): resultList.append(item.attribute_values) return (resultList)