# Path: aodh/api/controllers/v2/base.py
# class ClientSideError(wsme.exc.ClientSideError):
# class ProjectNotAuthorized(ClientSideError):
# class AdvEnum(wtypes.wsproperty):
# class Base(wtypes.DynamicBase):
# class Query(Base):
# class AlarmNotFound(ClientSideError):
# class AlarmRule(Base):
#     def __init__(self, error, status_code=400):
#     def __init__(self, id, aspect='project'):
#     def __init__(self, name, *args, **kwargs):
#     def _get(self, parent):
#     def _set(self, parent, value):
#     def from_db_model(cls, m):
#     def from_db_and_links(cls, m, links):
#     def as_dict(self, db_model):
#     def as_dict_from_keys(self, keys):
#     def to_dict(self):
#     def get_op(self):
#     def set_op(self, value):
#     def __repr__(self):
#     def sample(cls):
#     def as_dict(self):
#     def get_value(self, forced_type=None):
#     def __init__(self, alarm, auth_project):
#     def validate_alarm(alarm):
#     def create_hook(alarm):
#     def update_hook(alarm):
# 
# Path: aodh/profiler.py
# LOG = log.getLogger(__name__)
# class WsgiMiddleware(object):
#     def __init__(self, application, **kwargs):
#     def factory(cls, global_conf, **local_conf):
#         def filter_(app):
#     def __call__(self, request):
# def setup(conf):
# def trace_cls(name, **kwargs):
#     def decorator(cls):


import pecan
import wsmeext.pecan as wsme_pecan
from pecan import rest
from wsme import types as wtypes
from aodh.api.controllers.v2 import base
from aodh import profiler

def _flatten_capabilities(capabilities):
    return dict((k, v) for k, v in _recursive_keypairs(capabilities))


class Capabilities(base.Base):
    """A representation of the API and storage capabilities.

    Usually constrained by restrictions imposed by the storage driver.
    """

    api = {wtypes.text: bool}
    "A flattened dictionary of API capabilities"
    alarm_storage = {wtypes.text: bool}
    "A flattened dictionary of alarm storage capabilities"

    @classmethod
    def sample(cls):
        return cls(
            api=_flatten_capabilities({
                'alarms': {'query': {'simple': True,
                                     'complex': True},
                           'history': {'query': {'simple': True,
                                                 'complex': True}}},
            }),
            alarm_storage=_flatten_capabilities(
                {'storage': {'production_ready': True}}),
        )



# Path: aodh/api/controllers/v2/base.py
# class ClientSideError(wsme.exc.ClientSideError):
# class ProjectNotAuthorized(ClientSideError):
# class AdvEnum(wtypes.wsproperty):
# class Base(wtypes.DynamicBase):
# class Query(Base):
# class AlarmNotFound(ClientSideError):
# class AlarmRule(Base):
#     def __init__(self, error, status_code=400):
#     def __init__(self, id, aspect='project'):
#     def __init__(self, name, *args, **kwargs):
#     def _get(self, parent):
#     def _set(self, parent, value):
#     def from_db_model(cls, m):
#     def from_db_and_links(cls, m, links):
#     def as_dict(self, db_model):
#     def as_dict_from_keys(self, keys):
#     def to_dict(self):
#     def get_op(self):
#     def set_op(self, value):
#     def __repr__(self):
#     def sample(cls):
#     def as_dict(self):
#     def get_value(self, forced_type=None):
#     def __init__(self, alarm, auth_project):
#     def validate_alarm(alarm):
#     def create_hook(alarm):
#     def update_hook(alarm):
# 
# Path: aodh/profiler.py
# LOG = log.getLogger(__name__)
# class WsgiMiddleware(object):
#     def __init__(self, application, **kwargs):
#     def factory(cls, global_conf, **local_conf):
#         def filter_(app):
#     def __call__(self, request):
# def setup(conf):
# def trace_cls(name, **kwargs):
#     def decorator(cls):


# Path: aodh/api/controllers/v2/capabilities.py
import pecan
import wsmeext.pecan as wsme_pecan
from pecan import rest
from wsme import types as wtypes
from aodh.api.controllers.v2 import base
from aodh import profiler


def _flatten_capabilities(capabilities):
    return dict((k, v) for k, v in _recursive_keypairs(capabilities))


class Capabilities(base.Base):
    """A representation of the API and storage capabilities.

    Usually constrained by restrictions imposed by the storage driver.
    """

    api = {wtypes.text: bool}
    "A flattened dictionary of API capabilities"
    alarm_storage = {wtypes.text: bool}
    "A flattened dictionary of alarm storage capabilities"

    @classmethod
    def sample(cls):
        return cls(
            api=_flatten_capabilities({
                'alarms': {'query': {'simple': True,
                                     'complex': True},
                           'history': {'query': {'simple': True,
                                                 'complex': True}}},
            }),
            alarm_storage=_flatten_capabilities(
                {'storage': {'production_ready': True}}),
        )



@profiler.trace_cls('api')