ucscsdk/ucsceventhandler.py
def add(self,
            class_id=None,
            managed_object=None,
            prop=None,
            success_value=[],
            poll_sec=None,
            timeout_sec=None,
            call_back=None,
            context=None):
        """
        Adds an event handler.

        An event handler can be added using this method where an user can
        subscribe for the event channel from UcsCentral and can monitor those
        events for any specific success value for a managed object.

        Args:
            class_id (str): managed object class id
            managed_object (ManagedObject)
            prop (str) - property of the managed object to monitor
            success_value (list) - success values of a prop
            poll_sec - specifies the time in seconds for polling event.
            timeout_sec - time after which method should stop monitoring.
            call_back - call back method
        """

        if class_id is not None and managed_object is not None:
            raise UcscValidationException(
                "Specify either class_id or managedObject, not both")

        if class_id is not None:
            filter_callback = self._add_class_id_watch(class_id)
        elif managed_object is not None:
            filter_callback = self._add_mo_watch(managed_object, prop,
                                                 success_value, poll_sec)
        else:
            def watch_all_filter(mce):
                """
                Callback method to work on all events.
                """
                return True
            filter_callback = watch_all_filter

        param_dict = {'class_id': class_id,
                      'managed_object': managed_object,
                      'prop': prop,
                      'success_value': success_value,
                      'poll_sec': poll_sec,
                      'timeout_sec': timeout_sec,
                      'call_back': call_back,
                      'start_time': datetime.datetime.now(),
                      'context': context}

        if filter_callback is None:
            raise UcscValidationException("Error adding WatchBlock...")

        watch_block = self.watch_block_add(params=param_dict,
                                           filter_callback=filter_callback,
                                           callback=call_back)

        if watch_block is not None and len(self._wbs) == 1:
            if poll_sec is None:
                self._thread_enqueue_start()
            self._thread_dequeue_start()

        return watch_block

        Adds an event handler.

        An event handler can be added using this method where an user can
        subscribe for the event channel from UcsCentral and can monitor those
        events for any specific success value for a managed object.

        Args:
            class_id (str): managed object class id
            managed_object (ManagedObject)
            prop (str) - property of the managed object to monitor
            success_value (list) - success values of a prop
            poll_sec - specifies the time in seconds for polling event.
            timeout_sec - time after which method should stop monitoring.
            call_back - call back method
        
Adds an event handler.
An event handler can be added using this method where an user can
subscribe for the event channel from UcsCentral and can monitor those
events for any specific success value for a managed object.

class_id (str): managed object class id
managed_object (ManagedObject)
prop (str) - property of the managed object to monitor
success_value (list) - success values of a prop
poll_sec - specifies the time in seconds for polling event.
timeout_sec - time after which method should stop monitoring.
call_back - call back method
Adds an event handler . An event handler can be added using this method where an user can subscribe for the event channel from UcsCentral and can monitor those events for any specific success value for a managed object . class_id ( str ) : managed object class id managed_object ( ManagedObject ) prop ( str ) - property of the managed object to monitor success_value ( list ) - success values of a prop poll_sec - specifies the time in seconds for polling event . timeout_sec - time after which method should stop monitoring . call_back - call back method
def add(self,
            class_id=None,
            managed_object=None,
            prop=None,
            success_value=[],
            poll_sec=None,
            timeout_sec=None,
            call_back=None,
            context=None):
        if class_id is not None and managed_object is not None:
            raise UcscValidationException(
                "Specify either class_id or managedObject, not both")
        if class_id is not None:
            filter_callback = self._add_class_id_watch(class_id)
        elif managed_object is not None:
            filter_callback = self._add_mo_watch(managed_object, prop,
                                                 success_value, poll_sec)
        else:
            def watch_all_filter(mce):
                return True
            filter_callback = watch_all_filter
        param_dict = {'class_id': class_id,
                      'managed_object': managed_object,
                      'prop': prop,
                      'success_value': success_value,
                      'poll_sec': poll_sec,
                      'timeout_sec': timeout_sec,
                      'call_back': call_back,
                      'start_time': datetime.datetime.now(),
                      'context': context}
        if filter_callback is None:
            raise UcscValidationException("Error adding WatchBlock...")
        watch_block = self.watch_block_add(params=param_dict,
                                           filter_callback=filter_callback,
                                           callback=call_back)
        if watch_block is not None and len(self._wbs) == 1:
            if poll_sec is None:
                self._thread_enqueue_start()
            self._thread_dequeue_start()
        return watch_block
def add ( self , class_id = None , managed_object = None , prop = None , success_value = [ ] , poll_sec = None , timeout_sec = None , call_back = None , context = None ) : if class_id is not None and managed_object is not None : raise UcscValidationException ( "Specify either class_id or managedObject, not both" ) if class_id is not None : filter_callback = self . _add_class_id_watch ( class_id ) elif managed_object is not None : filter_callback = self . _add_mo_watch ( managed_object , prop , success_value , poll_sec ) else : def watch_all_filter ( mce ) : """
                Callback method to work on all events.
                """ return True filter_callback = watch_all_filter param_dict = { 'class_id' : class_id , 'managed_object' : managed_object , 'prop' : prop , 'success_value' : success_value , 'poll_sec' : poll_sec , 'timeout_sec' : timeout_sec , 'call_back' : call_back , 'start_time' : datetime . datetime . now ( ) , 'context' : context } if filter_callback is None : raise UcscValidationException ( "Error adding WatchBlock..." ) watch_block = self . watch_block_add ( params = param_dict , filter_callback = filter_callback , callback = call_back ) if watch_block is not None and len ( self . _wbs ) == 1 : if poll_sec is None : self . _thread_enqueue_start ( ) self . _thread_dequeue_start ( ) return watch_block
Adds an event handler.
Adds an event handler .
"""
        Adds an event handler.

        An event handler can be added using this method where an user can
        subscribe for the event channel from UcsCentral and can monitor those
        events for any specific success value for a managed object.

        Args:
            class_id (str): managed object class id
            managed_object (ManagedObject)
            prop (str) - property of the managed object to monitor
            success_value (list) - success values of a prop
            poll_sec - specifies the time in seconds for polling event.
            timeout_sec - time after which method should stop monitoring.
            call_back - call back method
        """ """
                Callback method to work on all events.
                """
self
class_id
managed_object
prop
success_value
poll_sec
timeout_sec
call_back
context