def delete(self, api_key_id_or_key): """ Delete the key value pair. Handles requests: DELETE /apikeys/1 """ api_key_db = ApiKey.get_by_key_or_id(api_key_id_or_key) LOG.debug('DELETE /apikeys/ lookup with api_key_id_or_key=%s found object: %s', api_key_id_or_key, api_key_db) ApiKey.delete(api_key_db) extra = {'api_key_db': api_key_db} LOG.audit('ApiKey deleted. ApiKey.id=%s' % (api_key_db.id), extra=extra)
def delete(self, api_key_id_or_key, requester_user): """ Delete the key value pair. Handles requests: DELETE /apikeys/1 """ api_key_db = ApiKey.get_by_key_or_id(api_key_id_or_key) permission_type = PermissionType.API_KEY_DELETE rbac_utils.assert_user_has_resource_db_permission(user_db=requester_user, resource_db=api_key_db, permission_type=permission_type) ApiKey.delete(api_key_db) extra = {'api_key_db': api_key_db} LOG.audit('ApiKey deleted. ApiKey.id=%s' % (api_key_db.id), extra=extra) return Response(status=http_client.NO_CONTENT)