(self, request, tenant_id)
return b''
Create a new suppression.
Create a new suppression.
Create a new suppression .
def create_suppression(self, request, tenant_id):
        """
        Create a new suppression.
        """
        content = request.content.read()
        postdata = json.loads(content.decode("utf-8"))
        newsp = create_suppression(self._session_store.clock, postdata)
        suppressions = self._entity_cache_for_tenant(tenant_id).suppressions
        suppressions[newsp.id] = newsp
        status = 201
        request.setResponseCode(status)
        request.setHeader(b'location', base_uri_from_request(request).rstrip('/').encode('utf-8') +
                          request.path + b'/' + newsp.id.encode('utf-8'))
        request.setHeader(b'x-object-id', newsp.id.encode('utf-8'))
        request.setHeader(b'content-type', b'text/plain')
        self._audit('suppressions', request, tenant_id, status, content)
        return b''
def create_suppression ( self , request , tenant_id ) : content = request . content . read ( ) postdata = json . loads ( content . decode ( "utf-8" ) ) newsp = create_suppression ( self . _session_store . clock , postdata ) suppressions = self . _entity_cache_for_tenant ( tenant_id ) . suppressions suppressions [ newsp . id ] = newsp status = 201 request . setResponseCode ( status ) request . setHeader ( b'location' , base_uri_from_request ( request ) . rstrip ( '/' ) . encode ( 'utf-8' ) + request . path + b'/' + newsp . id . encode ( 'utf-8' ) ) request . setHeader ( b'x-object-id' , newsp . id . encode ( 'utf-8' ) ) request . setHeader ( b'content-type' , b'text/plain' ) self . _audit ( 'suppressions' , request , tenant_id , status , content ) return b''