def get_last_operation(instance_id: str = None) -> List[ServiceInstance]: if instance_id: if ServiceInstanceAdapter.exists_in_db(instance_id): model_sql = ServiceInstanceAdapter.find_by_id_name(instance_id) model = ServiceInstanceAdapter.model_sql_to_model(model_sql) return [model.state] else: return [] else: LOG.warning('No instance ID was provided') return []
def get_service_instance(instance_id: str = None) -> List[ServiceInstance]: if instance_id: if ServiceInstanceAdapter.exists_in_db(instance_id): model_sql = ServiceInstanceAdapter.find_by_id_name(instance_id) model = ServiceInstanceAdapter.model_sql_to_model(model_sql) return [model] else: return [] else: models = ServiceInstanceAdapter.get_all() return models