'Return a list of valid resource types.'

def get_types(self, cnxt=None, support_status=None, type_name=None, version=None, with_description=False):

    if ((support_status is not None) and (not support.is_valid_status(support_status))):
        msg = (_('Invalid    support    status    and    should    be    one    of    %s') % six.text_type(support.SUPPORT_STATUSES))
        raise exception.Invalid(reason=msg)
    def is_resource(key):
        return isinstance(self._registry[key], (ClassResourceInfo, TemplateResourceInfo))
    def status_matches(cls):
        return ((support_status is None) or (cls.get_class().support_status.status == support_status))
    def is_available(cls):
        if (cnxt is None):
            return True
        try:
            return cls.get_class().is_service_available(cnxt)[0]
        except Exception:
            return False
    def not_hidden_matches(cls):
        return (cls.get_class().support_status.status != support.HIDDEN)
    def is_allowed(enforcer, name):
        if (cnxt is None):
            return True
        try:
            enforcer.enforce(cnxt, name)
        except enforcer.exc:
            return False
        else:
            return True
    enforcer = policy.ResourceEnforcer()
    def name_matches(name):
        try:
            return ((type_name is None) or re.match(type_name, name))
        except:
            return False
    def version_matches(cls):
        return ((version is None) or (cls.get_class().support_status.version == version))
    import heat.engine.resource
    def resource_description(name, info, with_description):
        if (not with_description):
            return name
        rsrc_cls = info.get_class()
        if (rsrc_cls is None):
            rsrc_cls = heat.engine.resource.Resource
        return {'resource_type': name, 'description': rsrc_cls.getdoc()}
    return [resource_description(name, cls, with_description) for (name, cls) in six.iteritems(self._registry) if (is_resource(name) and name_matches(name) and status_matches(cls) and is_available(cls) and is_allowed(enforcer, name) and not_hidden_matches(cls) and version_matches(cls))]
