예제 #1
0
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)
예제 #2
0
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)
예제 #3
0
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)