def get_source(context, id): """Retrieves single source by ID.""" if id is None: msg = _("ID cannot be None") raise exception.InvalidSource(reason=msg) return db.source_get(context, id)
def get_source_by_name(context, name): """Retrieves single source by name.""" if name is None: msg = _("Source name cannot be None") raise exception.InvalidSource(reason=msg) return db.source_get_by_name(context, name)
def get_migration(ctxt, id): """Retrieves single source by ID.""" if id is None: msg = _("ID cannot be None") raise exception.InvalidSource(reason=msg) check_policy(ctxt, 'get_migration') return db.migration_get(ctxt, id)