impr(detectors api): Add new endpoint with project in path for detector creation#110285
impr(detectors api): Add new endpoint with project in path for detector creation#110285Christinarlong wants to merge 4 commits intomasterfrom
Conversation
|
🚨 Warning: This pull request contains Frontend and Backend changes! It's discouraged to make changes to Sentry's Frontend and Backend in a single pull request. The Frontend and Backend are not atomically deployed. If the changes are interdependent of each other, they must be separated into two pull requests and be made forward or backwards compatible, such that the Backend or Frontend can be safely deployed independently. Have questions? Please ask in the |
| class OrganizationProjectDetectorPermission(ProjectPermission): | ||
| scope_map = { | ||
| "POST": ["project:write", "project:admin", "alerts:write"], | ||
| } |
There was a problem hiding this comment.
This scope map is based off of ProjectAlertRulePermission, since the old endpoint's map was org based.
| | '/organizations/$organizationIdOrSlug/project-transaction-threshold-override/' | ||
| | '/organizations/$organizationIdOrSlug/projects-count/' | ||
| | '/organizations/$organizationIdOrSlug/projects/' | ||
| | '/organizations/$organizationIdOrSlug/projects/$projectIdOrSlug/detectors/' |
There was a problem hiding this comment.
why did pre-commit do this 😭
| 404: RESPONSE_NOT_FOUND, | ||
| }, | ||
| ) | ||
| def post(self, request: Request, project: Project) -> Response: |
There was a problem hiding this comment.
The logic of this endpoint is all copied from OrganizationDetectorIndex's POST, minus the projectId validation parts since the base ProjectEndpoint will handle that validation for us.
|
The thread about the direction of this was long but I thought we were just going to have the existing endpoint accept a |
We want to support taking in the project id & slug for detector creation. We can't blanket change the current
OrganizationDetectorIndexendpoint to be project qualified as the PUT, DELETE & GET endpoints take in many projects via query parameters. This PR introduces a new endpoint w/ project_id or slug in the path params for detector creation specific to a project.OrganizationDetectorIndexendpoint.