def list_schedules( self, project: str, name: str = None, kind: schemas.ScheduleKinds = None, include_last_run: bool = False, ) -> schemas.SchedulesOutput: project = project or default_project params = {"kind": kind, "name": name, "include_last_run": include_last_run} path = f"projects/{project}/schedules" error_message = f"Failed listing schedules for {project} ? {kind} {name}" resp = self.api_call("GET", path, error_message, params=params) return schemas.SchedulesOutput(**resp.json())
def list_schedules( self, db_session: Session, project: str = None, name: str = None, kind: str = None, labels: str = None, include_last_run: bool = False, ) -> schemas.SchedulesOutput: logger.debug( "Getting schedules", project=project, name=name, labels=labels, kind=kind ) db_schedules = get_db().list_schedules(db_session, project, name, labels, kind) schedules = [] for db_schedule in db_schedules: schedule = self._transform_and_enrich_db_schedule( db_session, db_schedule, include_last_run ) schedules.append(schedule) return schemas.SchedulesOutput(schedules=schedules)