Skip to content

Commit 6d280b3

Browse files
authored
fix(hc): Move OrganizationApiKeyIndexEndpoint to control silo (#52824)
The ApiKey model lives in the control silo. #52776 took care of the details endpoint
1 parent e47172f commit 6d280b3

File tree

2 files changed

+11
-8
lines changed

2 files changed

+11
-8
lines changed

src/sentry/api/endpoints/organization_api_key_index.py

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,19 +3,22 @@
33
from rest_framework.response import Response
44

55
from sentry import audit_log
6-
from sentry.api.base import region_silo_endpoint
7-
from sentry.api.bases.organization import OrganizationAdminPermission, OrganizationEndpoint
6+
from sentry.api.base import control_silo_endpoint
7+
from sentry.api.bases.organization import (
8+
ControlSiloOrganizationEndpoint,
9+
OrganizationAdminPermission,
10+
)
811
from sentry.api.serializers import serialize
912
from sentry.models import ApiKey
1013

1114
DEFAULT_SCOPES = ["project:read", "event:read", "team:read", "org:read", "member:read"]
1215

1316

14-
@region_silo_endpoint
15-
class OrganizationApiKeyIndexEndpoint(OrganizationEndpoint):
17+
@control_silo_endpoint
18+
class OrganizationApiKeyIndexEndpoint(ControlSiloOrganizationEndpoint):
1619
permission_classes = (OrganizationAdminPermission,)
1720

18-
def get(self, request: Request, organization) -> Response:
21+
def get(self, request: Request, organization_context, organization) -> Response:
1922
"""
2023
List an Organization's API Keys
2124
```````````````````````````````````
@@ -29,7 +32,7 @@ def get(self, request: Request, organization) -> Response:
2932

3033
return Response(serialize(queryset, request.user))
3134

32-
def post(self, request: Request, organization) -> Response:
35+
def post(self, request: Request, organization_context, organization) -> Response:
3336
"""
3437
Create an Organization API Key
3538
```````````````````````````````````

tests/sentry/api/endpoints/test_organization_api_key_index.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
from sentry.testutils import APITestCase
2-
from sentry.testutils.silo import region_silo_test
2+
from sentry.testutils.silo import control_silo_test
33

44

5-
@region_silo_test
5+
@control_silo_test(stable=True)
66
class OrganizationApiKeyIndex(APITestCase):
77
endpoint = "sentry-api-0-organization-api-key-index"
88

0 commit comments

Comments
 (0)