Skip to content

Commit

Permalink
ref(sentry_apps): move sentryapp model to sentry_apps dir (#77521)
Browse files Browse the repository at this point in the history
issue ref(#73857)
  • Loading branch information
Christinarlong authored and harshithadurai committed Sep 19, 2024
1 parent b3e05a9 commit 4abba45
Show file tree
Hide file tree
Showing 61 changed files with 340 additions and 333 deletions.
2 changes: 1 addition & 1 deletion src/sentry/api/authentication.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@
from sentry.models.apiapplication import ApiApplication
from sentry.models.apikey import ApiKey
from sentry.models.apitoken import ApiToken
from sentry.models.integrations.sentry_app import SentryApp
from sentry.models.orgauthtoken import (
OrgAuthToken,
is_org_auth_token_auth,
Expand All @@ -35,6 +34,7 @@
from sentry.models.projectkey import ProjectKey
from sentry.models.relay import Relay
from sentry.relay.utils import get_header_relay_id, get_header_relay_signature
from sentry.sentry_apps.models.sentry_app import SentryApp
from sentry.silo.base import SiloLimit, SiloMode
from sentry.users.models.user import User
from sentry.users.services.user import RpcUser
Expand Down
2 changes: 1 addition & 1 deletion src/sentry/api/bases/sentryapps.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,12 +19,12 @@
from sentry.coreapi import APIError
from sentry.integrations.api.bases.integration import PARANOID_GET
from sentry.middleware.stats import add_request_metric_tags
from sentry.models.integrations.sentry_app import SentryApp
from sentry.models.organization import OrganizationStatus
from sentry.organizations.services.organization import (
RpcUserOrganizationContext,
organization_service,
)
from sentry.sentry_apps.models.sentry_app import SentryApp
from sentry.sentry_apps.services.app import RpcSentryApp, app_service
from sentry.users.services.user import RpcUser
from sentry.users.services.user.service import user_service
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,10 @@
from sentry.auth.staff import is_active_staff
from sentry.constants import SentryAppStatus
from sentry.mediators.sentry_app_installations.installation_notifier import InstallationNotifier
from sentry.models.integrations.sentry_app import SentryApp
from sentry.models.integrations.sentry_app_installation import SentryAppInstallation
from sentry.organizations.services.organization import organization_service
from sentry.sentry_apps.logic import SentryAppUpdater
from sentry.sentry_apps.models.sentry_app import SentryApp
from sentry.utils.audit import create_audit_entry

logger = logging.getLogger(__name__)
Expand Down
2 changes: 1 addition & 1 deletion src/sentry/api/endpoints/integrations/sentry_apps/index.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@
from sentry.auth.staff import is_active_staff
from sentry.auth.superuser import is_active_superuser
from sentry.constants import SentryAppStatus
from sentry.models.integrations.sentry_app import SentryApp
from sentry.sentry_apps.logic import SentryAppCreator
from sentry.sentry_apps.models.sentry_app import SentryApp
from sentry.users.services.user.service import user_service

logger = logging.getLogger(__name__)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,9 @@
from sentry.constants import SENTRY_APP_SLUG_MAX_LENGTH, SentryAppStatus
from sentry.features.exceptions import FeatureNotRegistered
from sentry.integrations.models.integration_feature import IntegrationFeature, IntegrationTypes
from sentry.models.integrations.sentry_app import SentryApp
from sentry.models.integrations.sentry_app_installation import SentryAppInstallation
from sentry.sentry_apps.installations import SentryAppInstallationCreator
from sentry.sentry_apps.models.sentry_app import SentryApp


class SentryAppInstallationsSerializer(serializers.Serializer):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
from sentry.api.base import StatsMixin, region_silo_endpoint
from sentry.api.bases import RegionSentryAppBaseEndpoint, SentryAppStatsPermission
from sentry.api.bases.sentryapps import COMPONENT_TYPES
from sentry.models.integrations.sentry_app import SentryApp
from sentry.sentry_apps.models.sentry_app import SentryApp
from sentry.sentry_apps.services.app import RpcSentryApp, app_service
from sentry.tsdb.base import TSDBModel

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,9 @@
from sentry.api.serializers.models.apitoken import ApiTokenSerializer
from sentry.exceptions import ApiTokenLimitError
from sentry.models.apitoken import ApiToken
from sentry.models.integrations.sentry_app import MASKED_VALUE
from sentry.models.integrations.sentry_app_installation import SentryAppInstallation
from sentry.sentry_apps.installations import SentryAppInstallationTokenCreator
from sentry.sentry_apps.models.sentry_app import MASKED_VALUE


@control_silo_endpoint
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,9 @@
from sentry.api.paginator import OffsetPaginator
from sentry.api.serializers import serialize
from sentry.constants import SentryAppStatus
from sentry.models.integrations.sentry_app import SentryApp
from sentry.organizations.services.organization import RpcOrganization
from sentry.organizations.services.organization.model import RpcUserOrganizationContext
from sentry.sentry_apps.models.sentry_app import SentryApp


@control_silo_endpoint
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@
from sentry.auth.superuser import superuser_has_permission
from sentry.constants import SentryAppStatus
from sentry.models.apiapplication import generate_token
from sentry.models.integrations.sentry_app import SentryApp
from sentry.organizations.services.organization import organization_service
from sentry.sentry_apps.models.sentry_app import SentryApp
from sentry.users.services.user.service import user_service

logger = logging.getLogger(__name__)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
from sentry.api.permissions import SuperuserOrStaffFeatureFlaggedPermission
from sentry.api.serializers import serialize
from sentry.models.avatars.sentry_app_avatar import SentryAppAvatar
from sentry.models.integrations.sentry_app import SentryApp
from sentry.sentry_apps.models.sentry_app import SentryApp


@control_silo_endpoint
Expand Down
2 changes: 1 addition & 1 deletion src/sentry/api/serializers/models/sentry_app.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@
from sentry.integrations.models.integration_feature import IntegrationFeature, IntegrationTypes
from sentry.models.apiapplication import ApiApplication
from sentry.models.avatars.sentry_app_avatar import SentryAppAvatar
from sentry.models.integrations.sentry_app import MASKED_VALUE, SentryApp
from sentry.organizations.services.organization import organization_service
from sentry.sentry_apps.models.sentry_app import MASKED_VALUE, SentryApp
from sentry.users.models.user import User
from sentry.users.services.user.service import user_service

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@
from sentry.api.serializers import Serializer, register
from sentry.constants import SentryAppInstallationStatus
from sentry.hybridcloud.services.organization_mapping import organization_mapping_service
from sentry.models.integrations.sentry_app import SentryApp
from sentry.models.integrations.sentry_app_installation import SentryAppInstallation
from sentry.sentry_apps.models.sentry_app import SentryApp
from sentry.users.models.user import User
from sentry.users.services.user import RpcUser

Expand Down
2 changes: 1 addition & 1 deletion src/sentry/api/serializers/rest_framework/sentry_app.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
from sentry.api.validators.sentry_apps.schema import validate_ui_element_schema
from sentry.integrations.models.integration_feature import Feature
from sentry.models.apiscopes import ApiScopes
from sentry.models.integrations.sentry_app import (
from sentry.sentry_apps.models.sentry_app import (
REQUIRED_EVENT_PERMISSIONS,
UUID_CHARS_IN_SLUG,
VALID_EVENT_RESOURCES,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@

from sentry import eventstore
from sentry.api.serializers import Serializer
from sentry.models.integrations.sentry_app import SentryApp
from sentry.models.organization import Organization
from sentry.models.project import Project
from sentry.sentry_apps.models.sentry_app import SentryApp
from sentry.utils.sentry_apps.webhooks import TIMEOUT_STATUS_CODE


Expand Down
2 changes: 1 addition & 1 deletion src/sentry/auth/access.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@
from sentry.auth.superuser import get_superuser_scopes, is_active_superuser
from sentry.auth.system import SystemToken, is_system_auth
from sentry.models.apikey import ApiKey
from sentry.models.integrations.sentry_app import SentryApp
from sentry.models.organization import Organization
from sentry.models.organizationmember import OrganizationMember
from sentry.models.organizationmemberteam import OrganizationMemberTeam
Expand All @@ -39,6 +38,7 @@
from sentry.organizations.services.organization.serial import summarize_member
from sentry.roles import organization_roles
from sentry.roles.manager import OrganizationRole, TeamRole
from sentry.sentry_apps.models.sentry_app import SentryApp
from sentry.users.models.user import User
from sentry.users.services.user import RpcUser
from sentry.utils import metrics
Expand Down
1 change: 1 addition & 0 deletions src/sentry/conf/server.py
Original file line number Diff line number Diff line change
Expand Up @@ -396,6 +396,7 @@ def env(
"sentry.analytics.events",
"sentry.nodestore",
"sentry.users",
"sentry.sentry_apps",
"sentry.integrations",
"sentry.monitors",
"sentry.uptime",
Expand Down
3 changes: 2 additions & 1 deletion src/sentry/deletions/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,7 @@ def load_defaults() -> None:
from sentry.models.commitfilechange import CommitFileChange
from sentry.models.rulefirehistory import RuleFireHistory
from sentry.monitors import models as monitor_models
from sentry.sentry_apps.models.sentry_app import SentryApp
from sentry.snuba import models as snuba_models

from . import defaults
Expand Down Expand Up @@ -163,7 +164,7 @@ def load_defaults() -> None:
default_manager.register(
RepositoryProjectPathConfig, defaults.RepositoryProjectPathConfigDeletionTask
)
default_manager.register(models.SentryApp, defaults.SentryAppDeletionTask)
default_manager.register(SentryApp, defaults.SentryAppDeletionTask)
default_manager.register(
models.SentryAppInstallation, defaults.SentryAppInstallationDeletionTask
)
Expand Down
2 changes: 1 addition & 1 deletion src/sentry/hybridcloud/apigateway/proxy.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,9 @@

from sentry import options
from sentry.api.exceptions import RequestTimeout
from sentry.models.integrations.sentry_app import SentryApp
from sentry.models.integrations.sentry_app_installation import SentryAppInstallation
from sentry.models.organizationmapping import OrganizationMapping
from sentry.sentry_apps.models.sentry_app import SentryApp
from sentry.silo.util import (
PROXY_DIRECT_LOCATION_HEADER,
clean_outbound_headers,
Expand Down
4 changes: 2 additions & 2 deletions src/sentry/integrations/models/integration_feature.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
)
from sentry.db.models.manager.base import BaseManager
from sentry.integrations.models.doc_integration import DocIntegration
from sentry.models.integrations.sentry_app import SentryApp
from sentry.sentry_apps.models.sentry_app import SentryApp


class Feature:
Expand Down Expand Up @@ -209,7 +209,7 @@ def feature_str(self) -> str:
@property
def description(self) -> str:
from sentry.integrations.models.doc_integration import DocIntegration
from sentry.models.integrations.sentry_app import SentryApp
from sentry.sentry_apps.models.sentry_app import SentryApp

if self.user_description:
return self.user_description
Expand Down
2 changes: 1 addition & 1 deletion src/sentry/integrations/models/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
)
from sentry.integrations.models.integration import Integration
from sentry.integrations.services.integration.model import RpcIntegration
from sentry.models.integrations.sentry_app import SentryApp
from sentry.sentry_apps.models.sentry_app import SentryApp
from sentry.sentry_apps.services.app.model import RpcSentryApp


Expand Down
2 changes: 1 addition & 1 deletion src/sentry/integrations/services/integration/impl.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,9 +34,9 @@
serialize_integration_external_project,
serialize_organization_integration,
)
from sentry.models.integrations.sentry_app import SentryApp
from sentry.models.integrations.sentry_app_installation import SentryAppInstallation
from sentry.rules.actions.notify_event_service import find_alert_rule_action_ui_component
from sentry.sentry_apps.models.sentry_app import SentryApp
from sentry.shared_integrations.exceptions import ApiError
from sentry.utils import json, metrics
from sentry.utils.sentry_apps import send_and_save_webhook_request
Expand Down
2 changes: 1 addition & 1 deletion src/sentry/mediators/external_requests/util.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
from requests.models import Response

from sentry.http import safe_urlopen
from sentry.models.integrations.sentry_app import SentryApp, track_response_code
from sentry.sentry_apps.models.sentry_app import SentryApp, track_response_code
from sentry.utils.sentry_apps import SentryAppWebhookRequestsBuffer
from sentry.utils.sentry_apps.webhooks import TIMEOUT_STATUS_CODE

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@
from sentry.mediators.mediator import Mediator
from sentry.mediators.param import Param
from sentry.models.apigrant import ApiGrant
from sentry.models.integrations.sentry_app import SentryApp
from sentry.models.integrations.sentry_app_installation import SentryAppInstallation
from sentry.sentry_apps.models.sentry_app import SentryApp
from sentry.users.services.user.model import RpcUser
from sentry.utils.sentry_apps import send_and_save_webhook_request

Expand Down
2 changes: 1 addition & 1 deletion src/sentry/mediators/token_exchange/grant_exchanger.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@
from sentry.models.apiapplication import ApiApplication
from sentry.models.apigrant import ApiGrant
from sentry.models.apitoken import ApiToken
from sentry.models.integrations.sentry_app import SentryApp
from sentry.models.integrations.sentry_app_installation import SentryAppInstallation
from sentry.sentry_apps.models.sentry_app import SentryApp
from sentry.sentry_apps.services.app import RpcSentryAppInstallation
from sentry.silo.safety import unguarded_write
from sentry.users.models.user import User
Expand Down
2 changes: 1 addition & 1 deletion src/sentry/mediators/token_exchange/refresher.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@
from sentry.mediators.token_exchange.validator import Validator
from sentry.models.apiapplication import ApiApplication
from sentry.models.apitoken import ApiToken
from sentry.models.integrations.sentry_app import SentryApp
from sentry.models.integrations.sentry_app_installation import SentryAppInstallation
from sentry.sentry_apps.models.sentry_app import SentryApp
from sentry.sentry_apps.services.app import RpcSentryAppInstallation
from sentry.users.models.user import User

Expand Down
2 changes: 1 addition & 1 deletion src/sentry/mediators/token_exchange/validator.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
from sentry.mediators.mediator import Mediator
from sentry.mediators.param import Param
from sentry.models.apiapplication import ApiApplication
from sentry.models.integrations.sentry_app import SentryApp
from sentry.sentry_apps.models.sentry_app import SentryApp
from sentry.sentry_apps.services.app import RpcSentryAppInstallation
from sentry.users.models.user import User

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,10 +31,10 @@
import sentry.models.apitoken
import sentry.models.broadcast
import sentry.models.groupshare
import sentry.models.integrations.sentry_app
import sentry.models.integrations.sentry_app_installation
import sentry.models.scheduledeletion
import sentry.models.servicehook
import sentry.sentry_apps.models.sentry_app
import sentry.users.models.authenticator
import sentry.users.models.user
import sentry.utils.security.hash
Expand Down Expand Up @@ -1842,7 +1842,7 @@ class Migration(CheckedMigration):
(
"uuid",
models.CharField(
default=sentry.models.integrations.sentry_app.default_uuid, max_length=64
default=sentry.sentry_apps.models.sentry_app.default_uuid, max_length=64
),
),
("redirect_url", models.URLField(null=True)),
Expand Down
2 changes: 1 addition & 1 deletion src/sentry/models/avatars/sentry_app_avatar.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
from . import ControlAvatarBase

if TYPE_CHECKING:
from sentry.models.integrations.sentry_app import SentryApp
from sentry.sentry_apps.models.sentry_app import SentryApp


class SentryAppAvatarTypes(Enum):
Expand Down
2 changes: 1 addition & 1 deletion src/sentry/models/integrations/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,10 @@

# REQUIRED for migrations to run.
from sentry.integrations.types import ExternalProviders # NOQA
from sentry.models.integrations.sentry_app import SentryApp
from sentry.models.integrations.sentry_app_component import SentryAppComponent
from sentry.models.integrations.sentry_app_installation import SentryAppInstallation
from sentry.models.integrations.sentry_app_installation_for_provider import (
SentryAppInstallationForProvider,
)
from sentry.models.integrations.sentry_app_installation_token import SentryAppInstallationToken
from sentry.sentry_apps.models.sentry_app import SentryApp
Loading

0 comments on commit 4abba45

Please sign in to comment.