(self, request, tenant_id, entity_id, check_id)
return b''
Updates a check in place.
Updates a check in place.
Updates a check in place .
def update_check(self, request, tenant_id, entity_id, check_id):
        """
        Updates a check in place.
        """
        content = request.content.read()
        update = json.loads(content.decode("utf-8"))
        update_kwargs = dict(update)
        entities = self._entity_cache_for_tenant(tenant_id).entities

        try:
            check = _get_check(entities, entity_id, check_id)
            check.update(clock=self._session_store.clock, **update_kwargs)
        except (ObjectDoesNotExist, ParentDoesNotExist) as e:
            request.setResponseCode(e.code)
            self._audit('checks', request, tenant_id, e.code, content)
            return json.dumps(e.to_json())

        status = 204
        request.setResponseCode(status)
        request.setHeader(b'location', base_uri_from_request(request).rstrip('/').encode('utf-8') +
                          request.path)
        request.setHeader(b'x-object-id', check_id.encode('utf-8'))
        request.setHeader(b'content-type', b'text/plain')
        self._audit('checks', request, tenant_id, status, content)
        return b''
def update_check ( self , request , tenant_id , entity_id , check_id ) : content = request . content . read ( ) update = json . loads ( content . decode ( "utf-8" ) ) update_kwargs = dict ( update ) entities = self . _entity_cache_for_tenant ( tenant_id ) . entities try : check = _get_check ( entities , entity_id , check_id ) check . update ( clock = self . _session_store . clock , * * update_kwargs ) except ( ObjectDoesNotExist , ParentDoesNotExist ) as e : request . setResponseCode ( e . code ) self . _audit ( 'checks' , request , tenant_id , e . code , content ) return json . dumps ( e . to_json ( ) ) status = 204 request . setResponseCode ( status ) request . setHeader ( b'location' , base_uri_from_request ( request ) . rstrip ( '/' ) . encode ( 'utf-8' ) + request . path ) request . setHeader ( b'x-object-id' , check_id . encode ( 'utf-8' ) ) request . setHeader ( b'content-type' , b'text/plain' ) self . _audit ( 'checks' , request , tenant_id , status , content ) return b''