Coverage for ion/services/coi/exchange/resource_wrapper : 86.36%
Hot-keys on this page
r m x p toggle line displays
j k next/prev highlighted chunk
0 (zero) top of page
1 (one) first highlighted chunk
|
#!/usr/bin/env python
@file ion.services.coi.exchange.exchange_resource.py @author Brian Fox @brief Provides convenience methods to manage exchange management resources. """
# Used for manipulating the resource registry
# All the various google buffer protos are listed below. It's unnecessary # to redefine these in other modules. Instead use soemthing like: # # import ion.services.coi.exchange.exchange_resources as bp # my_type = bp.queue_type
# Defined for easier unit tests that loop through all prototypes.
"broker_type" : broker_type, "exchangespace_type" : exchangespace_type, "exchangename_type" : exchangename_type, "queue_type" : queue_type,
"amqpexchangemapping_type" : amqpexchangemapping_type, "amqpqueuemapping_type" : amqpqueuemapping_type, "amqpbrokercredentials_type" : amqpbrokercredentials_type, "brokerfederation_type" : brokerfederation_type, "hardwaremapping_type" : hardwaremapping_type, }
""" Tests if the string provided (hash) is a 40 character hexidecimal str. """ if type(hash) is not str: return False return set(hash.lower()).issubset(hexdigits)
""" An exception class for the Exchange Management system. """
""" ServiceHelper provides a wrapper to the various service oriented calls of the ExchangeManagementService. The wrapper hides the ResourceClient and MessageClient from the business logic of the EMS. This helps clarify code. """
""" Performs basic type checking. This should be invoked for any ExchangeManagementClient call that receives a specific Google Buffer Protocol object. """ if msg.MessageType != resource_request_type: raise ExchangeManagementError('wrong message type: %s' % str(msg.MessageType)) if msg.HasField('resource_reference'): raise ExchangeManagementError('resource_reference field expected to be unset, received: %s' % msg.resource_reference)
def create_object(self, msg, name, description): """ Creates a ResourceManagement object based on the the parameters provided. """
def create_object_by_id(self, type, name, description): """ Creates a ResourceManagement object based on the the parameters provided. """ object = yield self.rc.create_instance(type, name, description) yield defer.returnValue(object)
def push_object(self, object): """ Pushes a newly created ResourceManagement object to the data store. """
def get_object(self, id): """ Creates a ResourceManagement object based on the the parameters provided. """ #response.resource_reference = self.rc.reference_instance(object) #response.configuration = object.ResourceObject # The resource does not have the fields?
""" ClientHelper provides a wrapper which facilitates some of the ExchangeManagementClient code. The MessageClient is hidden within this wrapper. """
def create_object(self, type): |