(self, request, tenant_id, entity_id)
Get all alarms for the specified entity.
Get all alarms for the specified entity.
Get all alarms for the specified entity .
def get_alarms_for_entity(self, request, tenant_id, entity_id):
        """
        Get all alarms for the specified entity.
        """
        entities = self._entity_cache_for_tenant(tenant_id).entities

        try:
            entity = _get_parent_entity(entities, entity_id)
            alarms = entity.list_alarms()
            metadata = {'count': len(alarms),
                        'limit': 1000,
                        'marker': None,
                        'next_marker': None,
                        'next_href': None}
            request.setResponseCode(200)
            return json.dumps({'metadata': metadata, 'values': alarms})
        except ParentDoesNotExist as e:
            request.setResponseCode(e.code)
            return json.dumps(e.to_json())
def get_alarms_for_entity ( self , request , tenant_id , entity_id ) : entities = self . _entity_cache_for_tenant ( tenant_id ) . entities try : entity = _get_parent_entity ( entities , entity_id ) alarms = entity . list_alarms ( ) metadata = { 'count' : len ( alarms ) , 'limit' : 1000 , 'marker' : None , 'next_marker' : None , 'next_href' : None } request . setResponseCode ( 200 ) return json . dumps ( { 'metadata' : metadata , 'values' : alarms } ) except ParentDoesNotExist as e : request . setResponseCode ( e . code ) return json . dumps ( e . to_json ( ) )