def _get_by_name_or_id(self, name_or_id, exclude_fields=None, include_fields=None):
        """
        Retrieve resource object by an id of a name.
        """
        resource_db = self._get_by_id(
            resource_id=name_or_id,
            exclude_fields=exclude_fields,
            include_fields=include_fields,
        )

        if not resource_db:
            # Try name
            resource_db = self._get_by_name(
                resource_name=name_or_id, exclude_fields=exclude_fields
            )

        if not resource_db:
            msg = 'Resource with a name or id "%s" not found' % (name_or_id)
            raise StackStormDBObjectNotFoundError(msg)

        return resource_db

        Retrieve resource object by an id of a name.
        
st2api/st2api/controllers/resource.py