From a01c21c42ce212d8167b5ab96829fa87aa6b5ac6 Mon Sep 17 00:00:00 2001 From: Adrian Galvan Date: Wed, 20 Nov 2024 10:47:44 -0800 Subject: [PATCH] Removing Segment request overrides (#5521) --- .../segment_request_overrides.py | 52 ------------------- 1 file changed, 52 deletions(-) delete mode 100644 src/fides/api/service/saas_request/override_implementations/segment_request_overrides.py diff --git a/src/fides/api/service/saas_request/override_implementations/segment_request_overrides.py b/src/fides/api/service/saas_request/override_implementations/segment_request_overrides.py deleted file mode 100644 index 6cc42a8916..0000000000 --- a/src/fides/api/service/saas_request/override_implementations/segment_request_overrides.py +++ /dev/null @@ -1,52 +0,0 @@ -import hashlib -import json -from typing import Any, Dict, List - -from fides.api.models.policy import Policy -from fides.api.models.privacy_request import PrivacyRequest -from fides.api.schemas.saas.shared_schemas import HTTPMethod, SaaSRequestParams -from fides.api.service.connectors.saas.authenticated_client import AuthenticatedClient -from fides.api.service.saas_request.saas_request_override_factory import ( - SaaSRequestType, - register, -) - - -@register("segment_delete_md5", [SaaSRequestType.DELETE]) -def segment_delete_md5( - client: AuthenticatedClient, - param_values_per_row: List[Dict[str, Any]], - policy: Policy, - privacy_request: PrivacyRequest, - secrets: Dict[str, Any], -) -> int: - rows_deleted = 0 - - headers = { - "Content-Type": "application/json", - } - - for row_param_values in param_values_per_row: - email = row_param_values["email"] - hashed_email = hashlib.md5(email.encode("utf-8")).hexdigest() - - payload = json.dumps( - { - "regulation_type": "Suppress_With_Delete", - "attributes": {"name": "userId", "values": [hashed_email]}, - } - ) - - workspace_name = row_param_values["workspace_name"] - - client.send( - SaaSRequestParams( - method=HTTPMethod.POST, - path=f"/v1beta/workspaces/{workspace_name}/regulations", - headers=headers, - body=payload, - ) - ) - rows_deleted += 1 - - return rows_deleted