# Path: blazar/manager/oshosts/rpcapi.py
# CONF = cfg.CONF
#     BASE_RPC_API_VERSION = '1.0'
# class ManagerRPCAPI(service.RPCClient):
#     def __init__(self):
#     def get_computehost(self, host_id):
#     def list_computehosts(self, query=None):
#     def create_computehost(self, host_values):
#     def update_computehost(self, host_id, values):
#     def delete_computehost(self, host_id):
#     def list_allocations(self, query):
#     def get_allocations(self, host_id, query):
#     def list_resource_properties(self, query):
#     def update_resource_property(self, property_name, values):
# 
# Path: blazar/policy.py
# CONF = cfg.CONF
# LOG = logging.getLogger(__name__)
# DEFAULT_POLICY_FILE = 'policy.yaml'
# _ENFORCER = None
#     _ENFORCER = None
#         _ENFORCER = policy.Enforcer(CONF)
# def reset():
# def init():
# def set_rules(data, default_rule=None):
# def enforce(context, action, target, do_raise=True):
# def authorize(extension, action=None, api='blazar', ctx=None,
#               target=None):
#     def decorator(func):
#         def wrapped(self, *args, **kwargs):
# 
# Path: blazar/utils/trusts.py
# CONF = cfg.CONF
# def create_trust():
# def delete_trust(lease):
# def create_ctx_from_trust(trust_id):
# def use_trust_auth():
#     def decorator(func):
#         def wrapped(self, to_update):


from blazar.manager.oshosts import rpcapi as manager_rpcapi
from blazar import policy
from blazar.utils import trusts

    @policy.authorize('oshosts', 'put')
    def update_computehost(self, host_id, data):
        """Update computehost. Only name changing may be proceeded.

        :param host_id: ID of the computehost in Blazar DB.
        :type host_id: str
        :param data: New computehost characteristics.
        :type data: dict
        """
        return self.manager_rpcapi.update_computehost(host_id, data)

    @policy.authorize('oshosts', 'delete')
    def delete_computehost(self, host_id):
        """Delete specified computehost.

        :param host_id: ID of the computehost in Blazar DB.
        :type host_id: str
        """
        self.manager_rpcapi.delete_computehost(host_id)

    @policy.authorize('oshosts', 'get_allocations')
    def list_allocations(self, query):
        """List all allocations on all computehosts.

        :param query: parameters to query allocations
        :type query: dict
        """
        return self.manager_rpcapi.list_allocations(query)


# Path: blazar/manager/oshosts/rpcapi.py
# CONF = cfg.CONF
#     BASE_RPC_API_VERSION = '1.0'
# class ManagerRPCAPI(service.RPCClient):
#     def __init__(self):
#     def get_computehost(self, host_id):
#     def list_computehosts(self, query=None):
#     def create_computehost(self, host_values):
#     def update_computehost(self, host_id, values):
#     def delete_computehost(self, host_id):
#     def list_allocations(self, query):
#     def get_allocations(self, host_id, query):
#     def list_resource_properties(self, query):
#     def update_resource_property(self, property_name, values):
# 
# Path: blazar/policy.py
# CONF = cfg.CONF
# LOG = logging.getLogger(__name__)
# DEFAULT_POLICY_FILE = 'policy.yaml'
# _ENFORCER = None
#     _ENFORCER = None
#         _ENFORCER = policy.Enforcer(CONF)
# def reset():
# def init():
# def set_rules(data, default_rule=None):
# def enforce(context, action, target, do_raise=True):
# def authorize(extension, action=None, api='blazar', ctx=None,
#               target=None):
#     def decorator(func):
#         def wrapped(self, *args, **kwargs):
# 
# Path: blazar/utils/trusts.py
# CONF = cfg.CONF
# def create_trust():
# def delete_trust(lease):
# def create_ctx_from_trust(trust_id):
# def use_trust_auth():
#     def decorator(func):
#         def wrapped(self, to_update):


# Path: blazar/api/v1/oshosts/service.py
from blazar.manager.oshosts import rpcapi as manager_rpcapi
from blazar import policy
from blazar.utils import trusts


    @policy.authorize('oshosts', 'put')
    def update_computehost(self, host_id, data):
        """Update computehost. Only name changing may be proceeded.

        :param host_id: ID of the computehost in Blazar DB.
        :type host_id: str
        :param data: New computehost characteristics.
        :type data: dict
        """
        return self.manager_rpcapi.update_computehost(host_id, data)

    @policy.authorize('oshosts', 'delete')
    def delete_computehost(self, host_id):
        """Delete specified computehost.

        :param host_id: ID of the computehost in Blazar DB.
        :type host_id: str
        """
        self.manager_rpcapi.delete_computehost(host_id)

    @policy.authorize('oshosts', 'get_allocations')
    def list_allocations(self, query):
        """List all allocations on all computehosts.

        :param query: parameters to query allocations
        :type query: dict
        """
        return self.manager_rpcapi.list_allocations(query)


    @policy.authorize('oshosts', 'get_allocations')