Skip to content

Commit 8f40da8

Browse files
chore(ACI): Remove unused detector workflow endpoints (#106328)
We don't actually use these endpoints - instead to connect a workflow to a detector we add the workflow ID to the detector PUT endpoint request body and vice versa. --------- Co-authored-by: getsantry[bot] <66042841+getsantry[bot]@users.noreply.github.com>
1 parent a666510 commit 8f40da8

File tree

9 files changed

+1
-858
lines changed

9 files changed

+1
-858
lines changed

src/sentry/workflow_engine/endpoints/organization_detector_workflow_details.py

Lines changed: 0 additions & 115 deletions
This file was deleted.

src/sentry/workflow_engine/endpoints/organization_detector_workflow_index.py

Lines changed: 0 additions & 155 deletions
This file was deleted.

src/sentry/workflow_engine/endpoints/serializers/__init__.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@
66
"DataConditionSerializer",
77
"DataSourceSerializer",
88
"DetectorSerializer",
9-
"DetectorWorkflowSerializer",
109
"WorkflowSerializer",
1110
"GroupOpenPeriodSerializer",
1211
)
@@ -19,6 +18,5 @@
1918
from .data_condition_serializer import DataConditionSerializer
2019
from .data_source_serializer import DataSourceSerializer
2120
from .detector_serializer import DetectorSerializer
22-
from .detector_workflow_serializer import DetectorWorkflowSerializer
2321
from .group_open_period_serializer import GroupOpenPeriodSerializer
2422
from .workflow_serializer import WorkflowSerializer

src/sentry/workflow_engine/endpoints/serializers/detector_workflow_serializer.py

Lines changed: 0 additions & 23 deletions
This file was deleted.

src/sentry/workflow_engine/endpoints/urls.py

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,6 @@
99
from .organization_detector_details import OrganizationDetectorDetailsEndpoint
1010
from .organization_detector_index import OrganizationDetectorIndexEndpoint
1111
from .organization_detector_types import OrganizationDetectorTypeIndexEndpoint
12-
from .organization_detector_workflow_details import OrganizationDetectorWorkflowDetailsEndpoint
13-
from .organization_detector_workflow_index import OrganizationDetectorWorkflowIndexEndpoint
1412
from .organization_incident_groupopenperiod_index import (
1513
OrganizationIncidentGroupOpenPeriodIndexEndpoint,
1614
)
@@ -83,16 +81,6 @@
8381
OrganizationDetectorTypeIndexEndpoint.as_view(),
8482
name="sentry-api-0-organization-detector-type-index",
8583
),
86-
re_path(
87-
r"^(?P<organization_id_or_slug>[^/]+)/detector-workflow/$",
88-
OrganizationDetectorWorkflowIndexEndpoint.as_view(),
89-
name="sentry-api-0-organization-detector-workflow-index",
90-
),
91-
re_path(
92-
r"^(?P<organization_id_or_slug>[^/]+)/detector-workflow/(?P<detector_workflow_id>\d+)/$",
93-
OrganizationDetectorWorkflowDetailsEndpoint.as_view(),
94-
name="sentry-api-0-organization-detector-workflow-details",
95-
),
9684
re_path(
9785
r"^(?P<organization_id_or_slug>[^/]+)/available-actions/$",
9886
OrganizationAvailableActionIndexEndpoint.as_view(),

src/sentry/workflow_engine/endpoints/validators/detector_workflow.py

Lines changed: 1 addition & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
from collections.abc import Sequence
22
from typing import Literal
33

4-
from django.db import IntegrityError, router, transaction
4+
from django.db import router, transaction
55
from django.db.models import QuerySet
66
from rest_framework import serializers
77
from rest_framework.exceptions import PermissionDenied
@@ -177,43 +177,6 @@ def perform_bulk_detector_workflow_operations(
177177
)
178178

179179

180-
class DetectorWorkflowValidator(CamelSnakeSerializer):
181-
detector_id = serializers.IntegerField(required=True)
182-
workflow_id = serializers.IntegerField(required=True)
183-
184-
def create(self, validated_data):
185-
with transaction.atomic(router.db_for_write(DetectorWorkflow)):
186-
try:
187-
detector = Detector.objects.get(
188-
project__organization=self.context["organization"],
189-
id=validated_data["detector_id"],
190-
)
191-
if not can_edit_detector_workflow_connections(detector, self.context["request"]):
192-
raise PermissionDenied
193-
workflow = Workflow.objects.get(
194-
organization=self.context["organization"], id=validated_data["workflow_id"]
195-
)
196-
except (Detector.DoesNotExist, Workflow.DoesNotExist) as e:
197-
raise serializers.ValidationError(str(e))
198-
199-
try:
200-
detector_workflow = DetectorWorkflow.objects.create(
201-
detector=detector, workflow=workflow
202-
)
203-
except IntegrityError as e:
204-
raise serializers.ValidationError(str(e))
205-
206-
create_audit_entry(
207-
request=self.context["request"],
208-
organization=self.context["organization"],
209-
target_object=detector_workflow.id,
210-
event=audit_log.get_event_id("DETECTOR_WORKFLOW_ADD"),
211-
data=detector_workflow.get_audit_log_data(),
212-
)
213-
214-
return detector_workflow
215-
216-
217180
class BulkDetectorWorkflowsValidator(CamelSnakeSerializer):
218181
"""
219182
Connect/disconnect multiple workflows to a single detector all at once.

static/app/utils/api/knownSentryApiUrls.generated.ts

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -231,8 +231,6 @@ export type KnownSentryApiUrls =
231231
| '/organizations/$organizationIdOrSlug/data-secrecy/'
232232
| '/organizations/$organizationIdOrSlug/derive-code-mappings/'
233233
| '/organizations/$organizationIdOrSlug/detector-types/'
234-
| '/organizations/$organizationIdOrSlug/detector-workflow/'
235-
| '/organizations/$organizationIdOrSlug/detector-workflow/$detectorWorkflowId/'
236234
| '/organizations/$organizationIdOrSlug/detectors/'
237235
| '/organizations/$organizationIdOrSlug/detectors/$detectorId/'
238236
| '/organizations/$organizationIdOrSlug/detectors/$detectorId/anomaly-data/'

0 commit comments

Comments
 (0)