@classmethod
def _from_object(cls, context, obj):
    """Construct a cluster from database object.

        :param context: the context used for DB operations;
        :param obj: a DB cluster object that will receive all fields;
        """
    kwargs = {'id': obj.id, 'user': obj.user, 'project': obj.project,
        'domain': obj.domain, 'init_at': obj.init_at, 'created_at': obj.
        created_at, 'updated_at': obj.updated_at, 'min_size': obj.min_size,
        'max_size': obj.max_size, 'next_index': obj.next_index, 'timeout':
        obj.timeout, 'status': obj.status, 'status_reason': obj.
        status_reason, 'data': obj.data, 'metadata': obj.metadata,
        'dependents': obj.dependents, 'config': obj.config}
    return cls(obj.name, obj.desired_capacity, obj.profile_id, context=
        context, **kwargs)
