From 1594e81d4d2bd8e1dcd68f479c005c823c4ba644 Mon Sep 17 00:00:00 2001 From: Adam Sachs Date: Fri, 30 Jun 2023 07:16:08 -0400 Subject: [PATCH] avoid circular deps caused within `api.api.v1` (#3692) --- CHANGELOG.md | 1 + .../docs/development/development_tips.md | 2 +- scripts/quickstart.py | 2 +- .../api/api/v1/endpoints/config_endpoints.py | 2 +- .../api/v1/endpoints/connection_endpoints.py | 16 ++++---- .../v1/endpoints/connection_type_endpoints.py | 10 ++--- .../v1/endpoints/consent_request_endpoints.py | 16 ++++---- .../api/api/v1/endpoints/dataset_endpoints.py | 22 +++++----- .../api/api/v1/endpoints/drp_endpoints.py | 2 +- .../api/v1/endpoints/encryption_endpoints.py | 12 +++--- .../identity_verification_endpoints.py | 2 +- .../v1/endpoints/manual_webhook_endpoints.py | 10 ++--- .../api/api/v1/endpoints/masking_endpoints.py | 2 +- .../api/v1/endpoints/messaging_endpoints.py | 24 +++++------ .../api/api/v1/endpoints/oauth_endpoints.py | 20 +++++----- .../api/api/v1/endpoints/policy_endpoints.py | 2 +- .../v1/endpoints/policy_webhook_endpoints.py | 2 +- .../privacy_experience_config_endpoints.py | 4 +- .../endpoints/privacy_experience_endpoints.py | 4 +- .../v1/endpoints/privacy_notice_endpoints.py | 4 +- .../endpoints/privacy_preference_endpoints.py | 21 +++++----- .../v1/endpoints/privacy_request_endpoints.py | 40 +++++++++---------- .../v1/endpoints/registration_endpoints.py | 2 +- .../api/api/v1/endpoints/router_factory.py | 14 +++---- .../api/v1/endpoints/saas_config_endpoints.py | 18 ++++----- .../api/api/v1/endpoints/storage_endpoints.py | 24 +++++------ src/fides/api/api/v1/endpoints/system.py | 10 ++--- .../api/api/v1/endpoints/user_endpoints.py | 4 +- .../v1/endpoints/user_permission_endpoints.py | 4 +- src/fides/api/api/v1/endpoints/validate.py | 2 +- src/fides/api/app_setup.py | 2 +- src/fides/api/main.py | 2 +- src/fides/api/oauth/utils.py | 2 +- src/fides/api/schemas/privacy_experience.py | 2 +- .../service/connectors/fides/fides_client.py | 2 +- .../privacy_request/request_runner_service.py | 8 ++-- .../privacy_request/request_service.py | 2 +- src/fides/api/util/connection_util.py | 2 +- src/fides/api/util/consent_util.py | 2 +- .../utils.py => util/endpoint_utils.py} | 0 src/fides/cli/utils.py | 2 +- src/fides/common/api/v1/__init__.py | 0 .../{api => common}/api/v1/urn_registry.py | 0 src/fides/core/api.py | 2 +- tests/ctl/api/test_admin.py | 2 +- tests/ctl/api/test_generate.py | 2 +- tests/ctl/api/test_validate.py | 2 +- tests/ctl/core/test_api.py | 4 +- tests/ops/api/test_ratelimit.py | 2 +- .../api/v1/endpoints/test_config_endpoints.py | 2 +- .../test_connection_config_endpoints.py | 2 +- .../test_connection_template_endpoints.py | 12 +++--- .../test_consent_request_endpoints.py | 14 +++---- .../v1/endpoints/test_dataset_endpoints.py | 18 ++++----- .../api/v1/endpoints/test_drp_endpoints.py | 14 +++---- .../v1/endpoints/test_encryption_endpoints.py | 12 +++--- .../api/v1/endpoints/test_health_endpoints.py | 2 +- .../test_identity_verification_endpoints.py | 2 +- .../api/v1/endpoints/test_manual_webhooks.py | 12 +++--- .../v1/endpoints/test_masking_endpoints.py | 2 +- .../v1/endpoints/test_messaging_endpoints.py | 24 +++++------ .../api/v1/endpoints/test_oauth_endpoints.py | 20 +++++----- .../api/v1/endpoints/test_policy_endpoints.py | 18 ++++----- .../test_policy_webhook_endpoints.py | 14 +++---- ...est_privacy_experience_config_endpoints.py | 2 +- .../test_privacy_experience_endpoints.py | 2 +- .../test_privacy_notice_endpoints.py | 12 +++--- .../test_privacy_preference_endpoints.py | 16 ++++---- .../test_privacy_request_endpoints.py | 38 +++++++++--------- .../endpoints/test_registration_endpoints.py | 2 +- .../endpoints/test_saas_config_endpoints.py | 14 +++---- .../v1/endpoints/test_storage_endpoints.py | 24 +++++------ tests/ops/api/v1/endpoints/test_system.py | 2 +- .../api/v1/endpoints/test_user_endpoints.py | 14 +++---- .../test_user_permission_endpoints.py | 2 +- tests/ops/api/v1/test_exception_handlers.py | 2 +- tests/ops/api/v1/test_utils.py | 4 +- ...st_connection_configuration_integration.py | 2 +- .../privacy_request/test_request_service.py | 2 +- tests/ops/util/test_api_router.py | 2 +- 80 files changed, 322 insertions(+), 324 deletions(-) rename src/fides/api/{api/v1/endpoints/utils.py => util/endpoint_utils.py} (100%) create mode 100644 src/fides/common/api/v1/__init__.py rename src/fides/{api => common}/api/v1/urn_registry.py (100%) diff --git a/CHANGELOG.md b/CHANGELOG.md index 7be964b866..02bb90a3d3 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -27,6 +27,7 @@ The types of changes are: - Render linebreaks in the Fides.js overlay descriptions, etc. [#3665](https://github.com/ethyca/fides/pull/3665) - Broken link to Fides docs site on the About Fides page in Admin UI [#3643](https://github.com/ethyca/fides/pull/3643) - Add Systems Applicable Filter to Privacy Experience List [#3654](https://github.com/ethyca/fides/pull/3654) +- Reorganized some `api.api.v1` code to avoid circular dependencies on `quickstart` [#3692](https://github.com/ethyca/fides/pull/3692) ### Developer Experience diff --git a/docs/fides/docs/development/development_tips.md b/docs/fides/docs/development/development_tips.md index 6d5b557539..321286559a 100644 --- a/docs/fides/docs/development/development_tips.md +++ b/docs/fides/docs/development/development_tips.md @@ -10,7 +10,7 @@ If you're looking for a general getting started guide, please see the [Overview] ### API URLs -We define API URLs for specific API versions as constants within `fides.api.api.v1.urn_registry` (where `v1` can be substituted for that particular API version), then import those URLs into their specific API views. Since we are on the first version, there is no clear precedent set for overriding URLs between versions yet. The most likely change is that we'll override the `APIRouter` class instantiation with a different base path (ie. `/api/v2` instead of `/api/v1`). For example: +We define API URLs for specific API versions as constants within `fides.common.api.v1.urn_registry` (where `v1` can be substituted for that particular API version), then import those URLs into their specific API views. Since we are on the first version, there is no clear precedent set for overriding URLs between versions yet. The most likely change is that we'll override the `APIRouter` class instantiation with a different base path (ie. `/api/v2` instead of `/api/v1`). For example: ```sh PRIVACY_REQUEST = "/privacy-request" diff --git a/scripts/quickstart.py b/scripts/quickstart.py index 0a0fa8d905..69b7e61b73 100644 --- a/scripts/quickstart.py +++ b/scripts/quickstart.py @@ -13,10 +13,10 @@ import yaml from loguru import logger -from fides.api.api.v1 import urn_registry as ops_urls from fides.api.models.connectionconfig import ConnectionType from fides.api.models.policy import ActionType from fides.common.api.scope_registry import SCOPE_REGISTRY +from fides.common.api.v1 import urn_registry as ops_urls from fides.config import get_config CONFIG = get_config() diff --git a/src/fides/api/api/v1/endpoints/config_endpoints.py b/src/fides/api/api/v1/endpoints/config_endpoints.py index 00204470a5..269576ed01 100644 --- a/src/fides/api/api/v1/endpoints/config_endpoints.py +++ b/src/fides/api/api/v1/endpoints/config_endpoints.py @@ -7,7 +7,6 @@ from starlette.status import HTTP_200_OK from fides.api.api import deps -from fides.api.api.v1 import urn_registry as urls from fides.api.models.application_config import ApplicationConfig from fides.api.oauth.utils import verify_oauth_client from fides.api.schemas.application_config import ( @@ -15,6 +14,7 @@ ) from fides.api.util.api_router import APIRouter from fides.common.api import scope_registry as scopes +from fides.common.api.v1 import urn_registry as urls from fides.config import censor_config from fides.config import get_config as get_app_config diff --git a/src/fides/api/api/v1/endpoints/connection_endpoints.py b/src/fides/api/api/v1/endpoints/connection_endpoints.py index c0e472b960..2e414d32f5 100644 --- a/src/fides/api/api/v1/endpoints/connection_endpoints.py +++ b/src/fides/api/api/v1/endpoints/connection_endpoints.py @@ -16,13 +16,6 @@ from starlette.status import HTTP_200_OK, HTTP_204_NO_CONTENT, HTTP_404_NOT_FOUND from fides.api.api import deps -from fides.api.api.v1.urn_registry import ( - CONNECTION_BY_KEY, - CONNECTION_SECRETS, - CONNECTION_TEST, - CONNECTIONS, - V1_URL_PREFIX, -) from fides.api.common_exceptions import ClientUnsuccessfulException, ConnectionException from fides.api.models.connectionconfig import ( ConnectionConfig, @@ -30,7 +23,7 @@ ConnectionType, ) from fides.api.models.datasetconfig import DatasetConfig -from fides.api.models.sql_models import ( # type: ignore[attr-defined] +from fides.api.models.sql_models import ( # type: ignore[attr-defined] Dataset as CtlDataset, ) from fides.api.oauth.utils import verify_oauth_client @@ -58,6 +51,13 @@ CONNECTION_DELETE, CONNECTION_READ, ) +from fides.common.api.v1.urn_registry import ( + CONNECTION_BY_KEY, + CONNECTION_SECRETS, + CONNECTION_TEST, + CONNECTIONS, + V1_URL_PREFIX, +) router = APIRouter(tags=["Connections"], prefix=V1_URL_PREFIX) diff --git a/src/fides/api/api/v1/endpoints/connection_type_endpoints.py b/src/fides/api/api/v1/endpoints/connection_type_endpoints.py index 2960643971..b846b8d961 100644 --- a/src/fides/api/api/v1/endpoints/connection_type_endpoints.py +++ b/src/fides/api/api/v1/endpoints/connection_type_endpoints.py @@ -6,11 +6,6 @@ from fastapi_pagination.bases import AbstractPage from starlette.status import HTTP_404_NOT_FOUND -from fides.api.api.v1.urn_registry import ( - CONNECTION_TYPE_SECRETS, - CONNECTION_TYPES, - V1_URL_PREFIX, -) from fides.api.common_exceptions import NoSuchConnectionTypeSecretSchemaError from fides.api.oauth.utils import verify_oauth_client from fides.api.schemas.connection_configuration.connection_config import ( @@ -24,6 +19,11 @@ get_connection_types, ) from fides.common.api.scope_registry import CONNECTION_TYPE_READ +from fides.common.api.v1.urn_registry import ( + CONNECTION_TYPE_SECRETS, + CONNECTION_TYPES, + V1_URL_PREFIX, +) router = APIRouter(tags=["Connection Types"], prefix=V1_URL_PREFIX) diff --git a/src/fides/api/api/v1/endpoints/consent_request_endpoints.py b/src/fides/api/api/v1/endpoints/consent_request_endpoints.py index 4f3a0899b1..8feae125c2 100644 --- a/src/fides/api/api/v1/endpoints/consent_request_endpoints.py +++ b/src/fides/api/api/v1/endpoints/consent_request_endpoints.py @@ -26,14 +26,6 @@ from fides.api.api.v1.endpoints.privacy_request_endpoints import ( create_privacy_request_func, ) -from fides.api.api.v1.endpoints.utils import validate_start_and_end_filters -from fides.api.api.v1.urn_registry import ( - CONSENT_REQUEST, - CONSENT_REQUEST_PREFERENCES, - CONSENT_REQUEST_PREFERENCES_WITH_ID, - CONSENT_REQUEST_VERIFY, - V1_URL_PREFIX, -) from fides.api.common_exceptions import ( FunctionalityNotConfigured, IdentityVerificationException, @@ -66,8 +58,16 @@ from fides.api.util.consent_util import ( get_or_create_fides_user_device_id_provided_identity, ) +from fides.api.util.endpoint_utils import validate_start_and_end_filters from fides.api.util.logger import Pii from fides.common.api.scope_registry import CONSENT_READ +from fides.common.api.v1.urn_registry import ( + CONSENT_REQUEST, + CONSENT_REQUEST_PREFERENCES, + CONSENT_REQUEST_PREFERENCES_WITH_ID, + CONSENT_REQUEST_VERIFY, + V1_URL_PREFIX, +) from fides.config import CONFIG from fides.config.config_proxy import ConfigProxy diff --git a/src/fides/api/api/v1/endpoints/dataset_endpoints.py b/src/fides/api/api/v1/endpoints/dataset_endpoints.py index 70f2aa9076..f1b59dbd5a 100644 --- a/src/fides/api/api/v1/endpoints/dataset_endpoints.py +++ b/src/fides/api/api/v1/endpoints/dataset_endpoints.py @@ -24,16 +24,6 @@ ) from fides.api.api import deps -from fides.api.api.v1.urn_registry import ( - CONNECTION_DATASETS, - DATASET_BY_KEY, - DATASET_CONFIGS, - DATASET_VALIDATE, - DATASETCONFIG_BY_KEY, - DATASETS, - V1_URL_PREFIX, - YAML_DATASETS, -) from fides.api.common_exceptions import ( SaaSConfigNotFoundException, TraversalError, @@ -47,7 +37,7 @@ convert_dataset_to_graph, to_graph_field, ) -from fides.api.models.sql_models import ( # type: ignore[attr-defined] +from fides.api.models.sql_models import ( # type: ignore[attr-defined] Dataset as CtlDataset, ) from fides.api.oauth.utils import verify_oauth_client @@ -68,6 +58,16 @@ DATASET_DELETE, DATASET_READ, ) +from fides.common.api.v1.urn_registry import ( + CONNECTION_DATASETS, + DATASET_BY_KEY, + DATASET_CONFIGS, + DATASET_VALIDATE, + DATASETCONFIG_BY_KEY, + DATASETS, + V1_URL_PREFIX, + YAML_DATASETS, +) X_YAML = "application/x-yaml" diff --git a/src/fides/api/api/v1/endpoints/drp_endpoints.py b/src/fides/api/api/v1/endpoints/drp_endpoints.py index 697d1306c2..a5ddd480d9 100644 --- a/src/fides/api/api/v1/endpoints/drp_endpoints.py +++ b/src/fides/api/api/v1/endpoints/drp_endpoints.py @@ -15,7 +15,6 @@ from fides.api import common_exceptions from fides.api.api import deps -from fides.api.api.v1 import urn_registry as urls from fides.api.api.v1.endpoints.privacy_request_endpoints import ( get_privacy_request_or_error, ) @@ -47,6 +46,7 @@ from fides.api.util.cache import FidesopsRedis from fides.api.util.logger import Pii from fides.common.api import scope_registry as scopes +from fides.common.api.v1 import urn_registry as urls from fides.config import CONFIG from fides.config.config_proxy import ConfigProxy diff --git a/src/fides/api/api/v1/endpoints/encryption_endpoints.py b/src/fides/api/api/v1/endpoints/encryption_endpoints.py index a89369ebc2..c8d20bed35 100644 --- a/src/fides/api/api/v1/endpoints/encryption_endpoints.py +++ b/src/fides/api/api/v1/endpoints/encryption_endpoints.py @@ -3,12 +3,6 @@ from fastapi import Security from loguru import logger -from fides.api.api.v1.urn_registry import ( - DECRYPT_AES, - ENCRYPT_AES, - ENCRYPTION_KEY, - V1_URL_PREFIX, -) from fides.api.cryptography import cryptographic_util from fides.api.cryptography.cryptographic_util import b64_str_to_bytes, bytes_to_b64_str from fides.api.oauth.utils import verify_oauth_client @@ -26,6 +20,12 @@ encrypt_verify_secret_length as aes_gcm_encrypt, ) from fides.common.api.scope_registry import ENCRYPTION_EXEC +from fides.common.api.v1.urn_registry import ( + DECRYPT_AES, + ENCRYPT_AES, + ENCRYPTION_KEY, + V1_URL_PREFIX, +) from fides.config import CONFIG router = APIRouter(tags=["Encryption"], prefix=V1_URL_PREFIX) diff --git a/src/fides/api/api/v1/endpoints/identity_verification_endpoints.py b/src/fides/api/api/v1/endpoints/identity_verification_endpoints.py index 5f141cfa5d..032a02c399 100644 --- a/src/fides/api/api/v1/endpoints/identity_verification_endpoints.py +++ b/src/fides/api/api/v1/endpoints/identity_verification_endpoints.py @@ -4,10 +4,10 @@ from sqlalchemy.orm import Session from fides.api.api import deps -from fides.api.api.v1 import urn_registry as urls from fides.api.models.messaging import MessagingConfig from fides.api.schemas.identity_verification import IdentityVerificationConfigResponse from fides.api.util.api_router import APIRouter +from fides.common.api.v1 import urn_registry as urls from fides.config.config_proxy import ConfigProxy router = APIRouter(tags=["Identity Verification"], prefix=urls.V1_URL_PREFIX) diff --git a/src/fides/api/api/v1/endpoints/manual_webhook_endpoints.py b/src/fides/api/api/v1/endpoints/manual_webhook_endpoints.py index 48ec0036cb..6a72aa17e2 100644 --- a/src/fides/api/api/v1/endpoints/manual_webhook_endpoints.py +++ b/src/fides/api/api/v1/endpoints/manual_webhook_endpoints.py @@ -16,11 +16,6 @@ from fides.api.api import deps from fides.api.api.v1.endpoints.dataset_endpoints import _get_connection_config -from fides.api.api.v1.urn_registry import ( - ACCESS_MANUAL_WEBHOOK, - ACCESS_MANUAL_WEBHOOKS, - V1_URL_PREFIX, -) from fides.api.models.connectionconfig import ConnectionConfig, ConnectionType from fides.api.models.manual_webhook import AccessManualWebhook from fides.api.oauth.utils import verify_oauth_client @@ -35,6 +30,11 @@ WEBHOOK_DELETE, WEBHOOK_READ, ) +from fides.common.api.v1.urn_registry import ( + ACCESS_MANUAL_WEBHOOK, + ACCESS_MANUAL_WEBHOOKS, + V1_URL_PREFIX, +) router = APIRouter(tags=["Manual Webhooks"], prefix=V1_URL_PREFIX) diff --git a/src/fides/api/api/v1/endpoints/masking_endpoints.py b/src/fides/api/api/v1/endpoints/masking_endpoints.py index d57f155c2c..b01ddd5bcf 100644 --- a/src/fides/api/api/v1/endpoints/masking_endpoints.py +++ b/src/fides/api/api/v1/endpoints/masking_endpoints.py @@ -4,7 +4,6 @@ from loguru import logger from starlette.status import HTTP_400_BAD_REQUEST, HTTP_404_NOT_FOUND -from fides.api.api.v1.urn_registry import MASKING, MASKING_STRATEGY, V1_URL_PREFIX from fides.api.common_exceptions import NoSuchStrategyException, ValidationError from fides.api.oauth.utils import verify_oauth_client_prod from fides.api.schemas.masking.masking_api import MaskingAPIRequest, MaskingAPIResponse @@ -15,6 +14,7 @@ from fides.api.service.masking.strategy.masking_strategy import MaskingStrategy from fides.api.util.api_router import APIRouter from fides.common.api.scope_registry import MASKING_EXEC, MASKING_READ +from fides.common.api.v1.urn_registry import MASKING, MASKING_STRATEGY, V1_URL_PREFIX router = APIRouter(tags=["Masking"], prefix=V1_URL_PREFIX) diff --git a/src/fides/api/api/v1/endpoints/messaging_endpoints.py b/src/fides/api/api/v1/endpoints/messaging_endpoints.py index 60459c454c..05b62ed05e 100644 --- a/src/fides/api/api/v1/endpoints/messaging_endpoints.py +++ b/src/fides/api/api/v1/endpoints/messaging_endpoints.py @@ -18,18 +18,6 @@ ) from fides.api.api import deps -from fides.api.api.v1.urn_registry import ( - MESSAGING_ACTIVE_DEFAULT, - MESSAGING_BY_KEY, - MESSAGING_CONFIG, - MESSAGING_DEFAULT, - MESSAGING_DEFAULT_BY_TYPE, - MESSAGING_DEFAULT_SECRETS, - MESSAGING_SECRETS, - MESSAGING_STATUS, - MESSAGING_TEST, - V1_URL_PREFIX, -) from fides.api.common_exceptions import ( MessageDispatchException, MessagingConfigNotFoundException, @@ -69,6 +57,18 @@ MESSAGING_DELETE, MESSAGING_READ, ) +from fides.common.api.v1.urn_registry import ( + MESSAGING_ACTIVE_DEFAULT, + MESSAGING_BY_KEY, + MESSAGING_CONFIG, + MESSAGING_DEFAULT, + MESSAGING_DEFAULT_BY_TYPE, + MESSAGING_DEFAULT_SECRETS, + MESSAGING_SECRETS, + MESSAGING_STATUS, + MESSAGING_TEST, + V1_URL_PREFIX, +) from fides.config.config_proxy import ConfigProxy router = APIRouter(tags=["Messaging"], prefix=V1_URL_PREFIX) diff --git a/src/fides/api/api/v1/endpoints/oauth_endpoints.py b/src/fides/api/api/v1/endpoints/oauth_endpoints.py index 5eeeac3b9c..1aba22e98d 100644 --- a/src/fides/api/api/v1/endpoints/oauth_endpoints.py +++ b/src/fides/api/api/v1/endpoints/oauth_endpoints.py @@ -14,16 +14,6 @@ from fides.api.api.v1.endpoints.saas_config_endpoints import ( verify_oauth_connection_config, ) -from fides.api.api.v1.urn_registry import ( - CLIENT, - CLIENT_BY_ID, - CLIENT_SCOPE, - OAUTH_CALLBACK, - ROLE, - SCOPE, - TOKEN, - V1_URL_PREFIX, -) from fides.api.common_exceptions import ( AuthenticationFailure, FidesopsException, @@ -52,6 +42,16 @@ SCOPE_REGISTRY, ScopeRegistryEnum, ) +from fides.common.api.v1.urn_registry import ( + CLIENT, + CLIENT_BY_ID, + CLIENT_SCOPE, + OAUTH_CALLBACK, + ROLE, + SCOPE, + TOKEN, + V1_URL_PREFIX, +) from fides.config import CONFIG router = APIRouter(tags=["OAuth"], prefix=V1_URL_PREFIX) diff --git a/src/fides/api/api/v1/endpoints/policy_endpoints.py b/src/fides/api/api/v1/endpoints/policy_endpoints.py index d97a6ef5af..9b2159c2f0 100644 --- a/src/fides/api/api/v1/endpoints/policy_endpoints.py +++ b/src/fides/api/api/v1/endpoints/policy_endpoints.py @@ -18,7 +18,6 @@ ) from fides.api.api import deps -from fides.api.api.v1 import urn_registry as urls from fides.api.common_exceptions import ( DataCategoryNotSupported, DrpActionValidationError, @@ -38,6 +37,7 @@ from fides.api.util.api_router import APIRouter from fides.api.util.logger import Pii from fides.common.api import scope_registry +from fides.common.api.v1 import urn_registry as urls router = APIRouter(tags=["DSR Policy"], prefix=urls.V1_URL_PREFIX) diff --git a/src/fides/api/api/v1/endpoints/policy_webhook_endpoints.py b/src/fides/api/api/v1/endpoints/policy_webhook_endpoints.py index 9829837e71..3d68b4e5e9 100644 --- a/src/fides/api/api/v1/endpoints/policy_webhook_endpoints.py +++ b/src/fides/api/api/v1/endpoints/policy_webhook_endpoints.py @@ -12,7 +12,6 @@ from starlette.status import HTTP_200_OK, HTTP_400_BAD_REQUEST, HTTP_404_NOT_FOUND from fides.api.api import deps -from fides.api.api.v1 import urn_registry as urls from fides.api.api.v1.endpoints.connection_endpoints import ( get_connection_config_or_error, ) @@ -30,6 +29,7 @@ from fides.api.schemas.policy_webhooks import PolicyWebhookDeleteResponse from fides.api.util.api_router import APIRouter from fides.common.api import scope_registry as scopes +from fides.common.api.v1 import urn_registry as urls router = APIRouter(tags=["DSR Policy Webhooks"], prefix=urls.V1_URL_PREFIX) diff --git a/src/fides/api/api/v1/endpoints/privacy_experience_config_endpoints.py b/src/fides/api/api/v1/endpoints/privacy_experience_config_endpoints.py index 4ba42b8aa4..1fcf8eb2c8 100644 --- a/src/fides/api/api/v1/endpoints/privacy_experience_config_endpoints.py +++ b/src/fides/api/api/v1/endpoints/privacy_experience_config_endpoints.py @@ -16,8 +16,6 @@ ) from fides.api.api import deps -from fides.api.api.v1 import urn_registry as urls -from fides.api.api.v1.endpoints.utils import human_friendly_list, transform_fields from fides.api.models.privacy_experience import ( ComponentType, PrivacyExperience, @@ -37,8 +35,10 @@ PRIVACY_EXPERIENCE_ESCAPE_FIELDS, UNESCAPE_SAFESTR_HEADER, ) +from fides.api.util.endpoint_utils import human_friendly_list, transform_fields from fides.common.api import scope_registry from fides.common.api.scope_registry import PRIVACY_EXPERIENCE_UPDATE +from fides.common.api.v1 import urn_registry as urls router = APIRouter(tags=["Privacy Experience Config"], prefix=urls.V1_URL_PREFIX) diff --git a/src/fides/api/api/v1/endpoints/privacy_experience_endpoints.py b/src/fides/api/api/v1/endpoints/privacy_experience_endpoints.py index 5e24916300..555b05beaa 100644 --- a/src/fides/api/api/v1/endpoints/privacy_experience_endpoints.py +++ b/src/fides/api/api/v1/endpoints/privacy_experience_endpoints.py @@ -15,8 +15,6 @@ ) from fides.api.api import deps -from fides.api.api.v1 import urn_registry as urls -from fides.api.api.v1.endpoints.utils import fides_limiter, transform_fields from fides.api.models.privacy_experience import ( ComponentType, PrivacyExperience, @@ -32,6 +30,8 @@ UNESCAPE_SAFESTR_HEADER, get_fides_user_device_id_provided_identity, ) +from fides.api.util.endpoint_utils import fides_limiter, transform_fields +from fides.common.api.v1 import urn_registry as urls from fides.config import CONFIG router = APIRouter(tags=["Privacy Experience"], prefix=urls.V1_URL_PREFIX) diff --git a/src/fides/api/api/v1/endpoints/privacy_notice_endpoints.py b/src/fides/api/api/v1/endpoints/privacy_notice_endpoints.py index 596181f586..dd489de6ba 100644 --- a/src/fides/api/api/v1/endpoints/privacy_notice_endpoints.py +++ b/src/fides/api/api/v1/endpoints/privacy_notice_endpoints.py @@ -15,8 +15,6 @@ ) from fides.api.api import deps -from fides.api.api.v1 import urn_registry as urls -from fides.api.api.v1.endpoints.utils import transform_fields from fides.api.common_exceptions import ValidationError from fides.api.models.privacy_experience import ( upsert_privacy_experiences_after_notice_update, @@ -34,7 +32,9 @@ prepare_privacy_notice_patches, validate_notice_data_uses, ) +from fides.api.util.endpoint_utils import transform_fields from fides.common.api import scope_registry +from fides.common.api.v1 import urn_registry as urls router = APIRouter(tags=["Privacy Notice"], prefix=urls.V1_URL_PREFIX) diff --git a/src/fides/api/api/v1/endpoints/privacy_preference_endpoints.py b/src/fides/api/api/v1/endpoints/privacy_preference_endpoints.py index fd2180c13c..dd863b45a1 100644 --- a/src/fides/api/api/v1/endpoints/privacy_preference_endpoints.py +++ b/src/fides/api/api/v1/endpoints/privacy_preference_endpoints.py @@ -19,18 +19,6 @@ from fides.api.api.v1.endpoints.privacy_request_endpoints import ( create_privacy_request_func, ) -from fides.api.api.v1.endpoints.utils import ( - fides_limiter, - validate_start_and_end_filters, -) -from fides.api.api.v1.urn_registry import ( - CONSENT_REQUEST_PRIVACY_PREFERENCES_VERIFY, - CONSENT_REQUEST_PRIVACY_PREFERENCES_WITH_ID, - CURRENT_PRIVACY_PREFERENCES_REPORT, - HISTORICAL_PRIVACY_PREFERENCES_REPORT, - PRIVACY_PREFERENCES, - V1_URL_PREFIX, -) from fides.api.db.seed import DEFAULT_CONSENT_POLICY from fides.api.models.fides_user import FidesUser from fides.api.models.privacy_experience import PrivacyExperience @@ -67,10 +55,19 @@ from fides.api.util.consent_util import ( get_or_create_fides_user_device_id_provided_identity, ) +from fides.api.util.endpoint_utils import fides_limiter, validate_start_and_end_filters from fides.common.api.scope_registry import ( CURRENT_PRIVACY_PREFERENCE_READ, PRIVACY_PREFERENCE_HISTORY_READ, ) +from fides.common.api.v1.urn_registry import ( + CONSENT_REQUEST_PRIVACY_PREFERENCES_VERIFY, + CONSENT_REQUEST_PRIVACY_PREFERENCES_WITH_ID, + CURRENT_PRIVACY_PREFERENCES_REPORT, + HISTORICAL_PRIVACY_PREFERENCES_REPORT, + PRIVACY_PREFERENCES, + V1_URL_PREFIX, +) from fides.config import CONFIG from fides.config.config_proxy import ConfigProxy diff --git a/src/fides/api/api/v1/endpoints/privacy_request_endpoints.py b/src/fides/api/api/v1/endpoints/privacy_request_endpoints.py index f707702c33..5a355d93fa 100644 --- a/src/fides/api/api/v1/endpoints/privacy_request_endpoints.py +++ b/src/fides/api/api/v1/endpoints/privacy_request_endpoints.py @@ -34,26 +34,6 @@ from fides.api.api.v1.endpoints.manual_webhook_endpoints import ( get_access_manual_webhook_or_404, ) -from fides.api.api.v1.endpoints.utils import validate_start_and_end_filters -from fides.api.api.v1.urn_registry import ( - PRIVACY_REQUEST_ACCESS_MANUAL_WEBHOOK_INPUT, - PRIVACY_REQUEST_APPROVE, - PRIVACY_REQUEST_AUTHENTICATED, - PRIVACY_REQUEST_BULK_RETRY, - PRIVACY_REQUEST_DENY, - PRIVACY_REQUEST_MANUAL_ERASURE, - PRIVACY_REQUEST_MANUAL_INPUT, - PRIVACY_REQUEST_NOTIFICATIONS, - PRIVACY_REQUEST_RESUME, - PRIVACY_REQUEST_RESUME_FROM_REQUIRES_INPUT, - PRIVACY_REQUEST_RETRY, - PRIVACY_REQUEST_TRANSFER_TO_PARENT, - PRIVACY_REQUEST_VERIFY_IDENTITY, - PRIVACY_REQUESTS, - REQUEST_PREVIEW, - REQUEST_STATUS_LOGS, - V1_URL_PREFIX, -) from fides.api.common_exceptions import ( FunctionalityNotConfigured, IdentityNotFoundException, @@ -129,6 +109,7 @@ from fides.api.util.api_router import APIRouter from fides.api.util.cache import FidesopsRedis from fides.api.util.collection_util import Row +from fides.api.util.endpoint_utils import validate_start_and_end_filters from fides.api.util.enums import ColumnSort from fides.api.util.logger import Pii from fides.common.api.scope_registry import ( @@ -142,6 +123,25 @@ PRIVACY_REQUEST_UPLOAD_DATA, PRIVACY_REQUEST_VIEW_DATA, ) +from fides.common.api.v1.urn_registry import ( + PRIVACY_REQUEST_ACCESS_MANUAL_WEBHOOK_INPUT, + PRIVACY_REQUEST_APPROVE, + PRIVACY_REQUEST_AUTHENTICATED, + PRIVACY_REQUEST_BULK_RETRY, + PRIVACY_REQUEST_DENY, + PRIVACY_REQUEST_MANUAL_ERASURE, + PRIVACY_REQUEST_MANUAL_INPUT, + PRIVACY_REQUEST_NOTIFICATIONS, + PRIVACY_REQUEST_RESUME, + PRIVACY_REQUEST_RESUME_FROM_REQUIRES_INPUT, + PRIVACY_REQUEST_RETRY, + PRIVACY_REQUEST_TRANSFER_TO_PARENT, + PRIVACY_REQUEST_VERIFY_IDENTITY, + PRIVACY_REQUESTS, + REQUEST_PREVIEW, + REQUEST_STATUS_LOGS, + V1_URL_PREFIX, +) from fides.config import CONFIG from fides.config.config_proxy import ConfigProxy diff --git a/src/fides/api/api/v1/endpoints/registration_endpoints.py b/src/fides/api/api/v1/endpoints/registration_endpoints.py index 8a61d49a04..73f374cc0f 100644 --- a/src/fides/api/api/v1/endpoints/registration_endpoints.py +++ b/src/fides/api/api/v1/endpoints/registration_endpoints.py @@ -5,10 +5,10 @@ from fides.api.analytics import send_registration from fides.api.api import deps -from fides.api.api.v1 import urn_registry as urls from fides.api.models.registration import UserRegistration from fides.api.schemas import registration as schemas from fides.api.util.api_router import APIRouter +from fides.common.api.v1 import urn_registry as urls router = APIRouter( tags=["Registration"], diff --git a/src/fides/api/api/v1/endpoints/router_factory.py b/src/fides/api/api/v1/endpoints/router_factory.py index ced90ef5ec..09fa13f4a9 100644 --- a/src/fides/api/api/v1/endpoints/router_factory.py +++ b/src/fides/api/api/v1/endpoints/router_factory.py @@ -14,13 +14,6 @@ from sqlalchemy.ext.asyncio import AsyncSession from starlette.status import HTTP_422_UNPROCESSABLE_ENTITY -from fides.api.api.v1.endpoints.utils import ( - API_PREFIX, - CLI_SCOPE_PREFIX_MAPPING, - forbid_if_default, - forbid_if_editing_any_is_default, - forbid_if_editing_is_default, -) from fides.api.db.crud import ( create_resource, delete_resource, @@ -39,6 +32,13 @@ from fides.api.schemas.dataset import validate_data_categories_against_db from fides.api.util import errors from fides.api.util.api_router import APIRouter +from fides.api.util.endpoint_utils import ( + API_PREFIX, + CLI_SCOPE_PREFIX_MAPPING, + forbid_if_default, + forbid_if_editing_any_is_default, + forbid_if_editing_is_default, +) from fides.common.api.scope_registry import CREATE, DELETE, READ, UPDATE diff --git a/src/fides/api/api/v1/endpoints/saas_config_endpoints.py b/src/fides/api/api/v1/endpoints/saas_config_endpoints.py index 385bf0dd8a..642f68c789 100644 --- a/src/fides/api/api/v1/endpoints/saas_config_endpoints.py +++ b/src/fides/api/api/v1/endpoints/saas_config_endpoints.py @@ -18,15 +18,6 @@ ) from fides.api.api import deps -from fides.api.api.v1.urn_registry import ( - AUTHORIZE, - CONNECTION_TYPES, - REGISTER_CONNECTOR_TEMPLATE, - SAAS_CONFIG, - SAAS_CONFIG_VALIDATE, - SAAS_CONNECTOR_FROM_TEMPLATE, - V1_URL_PREFIX, -) from fides.api.common_exceptions import FidesopsException, KeyOrNameAlreadyExists from fides.api.models.connectionconfig import ConnectionConfig, ConnectionType from fides.api.models.datasetconfig import DatasetConfig @@ -64,6 +55,15 @@ SAAS_CONFIG_READ, SAAS_CONNECTION_INSTANTIATE, ) +from fides.common.api.v1.urn_registry import ( + AUTHORIZE, + CONNECTION_TYPES, + REGISTER_CONNECTOR_TEMPLATE, + SAAS_CONFIG, + SAAS_CONFIG_VALIDATE, + SAAS_CONNECTOR_FROM_TEMPLATE, + V1_URL_PREFIX, +) router = APIRouter(tags=["SaaS Configs"], prefix=V1_URL_PREFIX) diff --git a/src/fides/api/api/v1/endpoints/storage_endpoints.py b/src/fides/api/api/v1/endpoints/storage_endpoints.py index 2b2f76d47d..a2d6ff637b 100644 --- a/src/fides/api/api/v1/endpoints/storage_endpoints.py +++ b/src/fides/api/api/v1/endpoints/storage_endpoints.py @@ -21,18 +21,6 @@ ) from fides.api.api import deps -from fides.api.api.v1.urn_registry import ( - STORAGE_ACTIVE_DEFAULT, - STORAGE_BY_KEY, - STORAGE_CONFIG, - STORAGE_DEFAULT, - STORAGE_DEFAULT_BY_TYPE, - STORAGE_DEFAULT_SECRETS, - STORAGE_SECRETS, - STORAGE_STATUS, - STORAGE_UPLOAD, - V1_URL_PREFIX, -) from fides.api.common_exceptions import KeyOrNameAlreadyExists, StorageUploadError from fides.api.models.connectionconfig import ConnectionTestStatus from fides.api.models.privacy_request import PrivacyRequest @@ -71,6 +59,18 @@ STORAGE_DELETE, STORAGE_READ, ) +from fides.common.api.v1.urn_registry import ( + STORAGE_ACTIVE_DEFAULT, + STORAGE_BY_KEY, + STORAGE_CONFIG, + STORAGE_DEFAULT, + STORAGE_DEFAULT_BY_TYPE, + STORAGE_DEFAULT_SECRETS, + STORAGE_SECRETS, + STORAGE_STATUS, + STORAGE_UPLOAD, + V1_URL_PREFIX, +) router = APIRouter(tags=["Storage"], prefix=V1_URL_PREFIX) diff --git a/src/fides/api/api/v1/endpoints/system.py b/src/fides/api/api/v1/endpoints/system.py index cd8fbe7823..1c56ab7c92 100644 --- a/src/fides/api/api/v1/endpoints/system.py +++ b/src/fides/api/api/v1/endpoints/system.py @@ -13,11 +13,6 @@ from fides.api.api import deps from fides.api.api.v1.endpoints.saas_config_endpoints import instantiate_connection -from fides.api.api.v1.urn_registry import ( - INSTANTIATE_SYSTEM_CONNECTION, - SYSTEM_CONNECTIONS, - V1_URL_PREFIX, -) from fides.api.db.crud import ( get_resource, get_resource_with_custom_fields, @@ -57,6 +52,11 @@ SYSTEM_READ, SYSTEM_UPDATE, ) +from fides.common.api.v1.urn_registry import ( + INSTANTIATE_SYSTEM_CONNECTION, + SYSTEM_CONNECTIONS, + V1_URL_PREFIX, +) SYSTEM_ROUTER = APIRouter(tags=["System"], prefix=f"{V1_URL_PREFIX}/system") SYSTEM_CONNECTIONS_ROUTER = APIRouter( diff --git a/src/fides/api/api/v1/endpoints/user_endpoints.py b/src/fides/api/api/v1/endpoints/user_endpoints.py index ce341f0bc1..692526deb2 100644 --- a/src/fides/api/api/v1/endpoints/user_endpoints.py +++ b/src/fides/api/api/v1/endpoints/user_endpoints.py @@ -24,9 +24,7 @@ from fides.api.api import deps from fides.api.api.deps import get_db -from fides.api.api.v1 import urn_registry as urls from fides.api.api.v1.endpoints.user_permission_endpoints import validate_user_id -from fides.api.api.v1.urn_registry import V1_URL_PREFIX from fides.api.common_exceptions import AuthenticationError, AuthorizationError from fides.api.cryptography.cryptographic_util import b64_str_to_str from fides.api.cryptography.schemas.jwt import JWE_PAYLOAD_CLIENT_ID @@ -64,6 +62,8 @@ USER_READ, USER_UPDATE, ) +from fides.common.api.v1 import urn_registry as urls +from fides.common.api.v1.urn_registry import V1_URL_PREFIX from fides.config import CONFIG, FidesConfig, get_config router = APIRouter(tags=["Users"], prefix=V1_URL_PREFIX) diff --git a/src/fides/api/api/v1/endpoints/user_permission_endpoints.py b/src/fides/api/api/v1/endpoints/user_permission_endpoints.py index 6e21c39590..a1ee269fca 100644 --- a/src/fides/api/api/v1/endpoints/user_permission_endpoints.py +++ b/src/fides/api/api/v1/endpoints/user_permission_endpoints.py @@ -7,8 +7,6 @@ from starlette.status import HTTP_201_CREATED, HTTP_400_BAD_REQUEST, HTTP_404_NOT_FOUND from fides.api.api import deps -from fides.api.api.v1 import urn_registry as urls -from fides.api.api.v1.urn_registry import V1_URL_PREFIX from fides.api.models.fides_user import FidesUser from fides.api.models.fides_user_permissions import FidesUserPermissions from fides.api.oauth.roles import APPROVER, OWNER, RoleRegistryEnum @@ -25,6 +23,8 @@ USER_PERMISSION_READ, USER_PERMISSION_UPDATE, ) +from fides.common.api.v1 import urn_registry as urls +from fides.common.api.v1.urn_registry import V1_URL_PREFIX from fides.config import CONFIG router = APIRouter(tags=["User Permissions"], prefix=V1_URL_PREFIX) diff --git a/src/fides/api/api/v1/endpoints/validate.py b/src/fides/api/api/v1/endpoints/validate.py index 297b1d64d6..0792065c98 100644 --- a/src/fides/api/api/v1/endpoints/validate.py +++ b/src/fides/api/api/v1/endpoints/validate.py @@ -7,9 +7,9 @@ from fastapi import Response, Security, status from pydantic import BaseModel -from fides.api.api.v1.endpoints.utils import API_PREFIX from fides.api.oauth.utils import verify_oauth_client_prod from fides.api.util.api_router import APIRouter +from fides.api.util.endpoint_utils import API_PREFIX from fides.common.api import scope_registry from fides.connectors.models import ( AWSConfig, diff --git a/src/fides/api/app_setup.py b/src/fides/api/app_setup.py index bc864ba691..3af79f82d3 100644 --- a/src/fides/api/app_setup.py +++ b/src/fides/api/app_setup.py @@ -17,7 +17,6 @@ from fides.api.api.deps import get_api_session from fides.api.api.v1 import CTL_ROUTER from fides.api.api.v1.api import api_router -from fides.api.api.v1.endpoints.utils import fides_limiter from fides.api.api.v1.exception_handlers import ExceptionHandlers from fides.api.common_exceptions import FunctionalityNotConfigured, RedisConnectionError from fides.api.db.database import configure_db @@ -35,6 +34,7 @@ load_default_experience_configs_on_startup, load_default_notices_on_startup, ) +from fides.api.util.endpoint_utils import fides_limiter from fides.api.util.errors import FidesError from fides.api.util.logger import setup as setup_logging from fides.api.util.system_manager_oauth_util import ( diff --git a/src/fides/api/main.py b/src/fides/api/main.py index 000e6049fc..809d843ccc 100644 --- a/src/fides/api/main.py +++ b/src/fides/api/main.py @@ -14,7 +14,6 @@ from uvicorn import Config, Server import fides -from fides.api.api.v1.endpoints.utils import API_PREFIX from fides.api.app_setup import ( check_redis, create_fides_app, @@ -36,6 +35,7 @@ match_route, path_is_in_ui_directory, ) +from fides.api.util.endpoint_utils import API_PREFIX from fides.api.util.logger import _log_exception from fides.cli.utils import FIDES_ASCII_ART from fides.config import CONFIG, check_required_webserver_config_values diff --git a/src/fides/api/oauth/utils.py b/src/fides/api/oauth/utils.py index a10266e703..9f8041262d 100644 --- a/src/fides/api/oauth/utils.py +++ b/src/fides/api/oauth/utils.py @@ -16,7 +16,6 @@ from starlette.status import HTTP_404_NOT_FOUND from fides.api.api.deps import get_db -from fides.api.api.v1.urn_registry import TOKEN, V1_URL_PREFIX from fides.api.common_exceptions import AuthenticationError, AuthorizationError from fides.api.cryptography.schemas.jwt import ( JWE_ISSUED_AT, @@ -30,6 +29,7 @@ from fides.api.oauth.roles import get_scopes_from_roles from fides.api.schemas.external_https import WebhookJWE from fides.api.schemas.oauth import OAuth2ClientCredentialsBearer +from fides.common.api.v1.urn_registry import TOKEN, V1_URL_PREFIX from fides.config import CONFIG JWT_ENCRYPTION_ALGORITHM = ALGORITHMS.A256GCM diff --git a/src/fides/api/schemas/privacy_experience.py b/src/fides/api/schemas/privacy_experience.py index 6b876b7bb0..0ad68e30a2 100644 --- a/src/fides/api/schemas/privacy_experience.py +++ b/src/fides/api/schemas/privacy_experience.py @@ -5,11 +5,11 @@ from pydantic import Extra, Field, root_validator, validator -from fides.api.api.v1.endpoints.utils import human_friendly_list from fides.api.models.privacy_experience import BannerEnabled, ComponentType from fides.api.models.privacy_notice import PrivacyNoticeRegion from fides.api.schemas.base_class import FidesSchema from fides.api.schemas.privacy_notice import PrivacyNoticeResponseWithUserPreferences +from fides.api.util.endpoint_utils import human_friendly_list class ExperienceConfigSchema(FidesSchema): diff --git a/src/fides/api/service/connectors/fides/fides_client.py b/src/fides/api/service/connectors/fides/fides_client.py index 47167a1335..a2f65c9bf2 100644 --- a/src/fides/api/service/connectors/fides/fides_client.py +++ b/src/fides/api/service/connectors/fides/fides_client.py @@ -6,7 +6,6 @@ from httpx import AsyncClient, Client, HTTPStatusError, Request, RequestError, Timeout from loguru import logger -from fides.api.api.v1 import urn_registry as urls from fides.api.models.privacy_request import PrivacyRequestStatus from fides.api.schemas.privacy_request import ( PrivacyRequestCreate, @@ -18,6 +17,7 @@ from fides.api.util.collection_util import Row from fides.api.util.errors import FidesError from fides.api.util.wrappers import sync +from fides.common.api.v1 import urn_registry as urls COMPLETION_STATUSES = [ PrivacyRequestStatus.complete, diff --git a/src/fides/api/service/privacy_request/request_runner_service.py b/src/fides/api/service/privacy_request/request_runner_service.py index b7d5116a63..1e854150e0 100644 --- a/src/fides/api/service/privacy_request/request_runner_service.py +++ b/src/fides/api/service/privacy_request/request_runner_service.py @@ -9,10 +9,6 @@ from sqlalchemy.orm import Query, Session from fides.api import common_exceptions -from fides.api.api.v1.urn_registry import ( - PRIVACY_REQUEST_TRANSFER_TO_PARENT, - V1_URL_PREFIX, -) from fides.api.common_exceptions import ( ClientUnsuccessfulException, IdentityNotFoundException, @@ -83,6 +79,10 @@ from fides.api.util.collection_util import Row from fides.api.util.logger import Pii, _log_exception, _log_warning from fides.api.util.wrappers import sync +from fides.common.api.v1.urn_registry import ( + PRIVACY_REQUEST_TRANSFER_TO_PARENT, + V1_URL_PREFIX, +) from fides.config import CONFIG from fides.config.config_proxy import ConfigProxy diff --git a/src/fides/api/service/privacy_request/request_service.py b/src/fides/api/service/privacy_request/request_service.py index ca8d588622..10a6b7545b 100644 --- a/src/fides/api/service/privacy_request/request_service.py +++ b/src/fides/api/service/privacy_request/request_service.py @@ -7,7 +7,6 @@ from httpx import AsyncClient from loguru import logger -from fides.api.api.v1.urn_registry import PRIVACY_REQUESTS, V1_URL_PREFIX from fides.api.common_exceptions import PrivacyRequestNotFound from fides.api.models.policy import Policy from fides.api.models.privacy_request import PrivacyRequest, PrivacyRequestStatus @@ -17,6 +16,7 @@ from fides.api.schemas.privacy_request import PrivacyRequestResponse from fides.api.schemas.redis_cache import Identity from fides.api.service.masking.strategy.masking_strategy import MaskingStrategy +from fides.common.api.v1.urn_registry import PRIVACY_REQUESTS, V1_URL_PREFIX def build_required_privacy_request_kwargs( diff --git a/src/fides/api/util/connection_util.py b/src/fides/api/util/connection_util.py index 48b391e4dd..c8d6770f42 100644 --- a/src/fides/api/util/connection_util.py +++ b/src/fides/api/util/connection_util.py @@ -11,7 +11,6 @@ HTTP_422_UNPROCESSABLE_ENTITY, ) -from fides.api.api.v1.urn_registry import CONNECTION_TYPES, SAAS_CONFIG from fides.api.common_exceptions import KeyOrNameAlreadyExists from fides.api.common_exceptions import ValidationError as FidesValidationError from fides.api.models.connectionconfig import ConnectionConfig, ConnectionType @@ -40,6 +39,7 @@ from fides.api.service.privacy_request.request_runner_service import ( queue_privacy_request, ) +from fides.common.api.v1.urn_registry import CONNECTION_TYPES, SAAS_CONFIG # pylint: disable=too-many-nested-blocks,too-many-branches,too-many-statements diff --git a/src/fides/api/util/consent_util.py b/src/fides/api/util/consent_util.py index cf94f4b621..9a892100ec 100644 --- a/src/fides/api/util/consent_util.py +++ b/src/fides/api/util/consent_util.py @@ -7,7 +7,6 @@ from sqlalchemy.orm import Session from starlette.status import HTTP_404_NOT_FOUND, HTTP_422_UNPROCESSABLE_ENTITY -from fides.api.api.v1.endpoints.utils import transform_fields from fides.api.common_exceptions import ValidationError from fides.api.custom_types import SafeStr from fides.api.models.connectionconfig import ConnectionConfig @@ -35,6 +34,7 @@ from fides.api.schemas.privacy_experience import ExperienceConfigCreateWithId from fides.api.schemas.privacy_notice import PrivacyNoticeCreation, PrivacyNoticeWithId from fides.api.schemas.redis_cache import Identity +from fides.api.util.endpoint_utils import transform_fields from fides.config.helpers import load_file PRIVACY_NOTICE_ESCAPE_FIELDS = ["name", "description", "internal_description"] diff --git a/src/fides/api/api/v1/endpoints/utils.py b/src/fides/api/util/endpoint_utils.py similarity index 100% rename from src/fides/api/api/v1/endpoints/utils.py rename to src/fides/api/util/endpoint_utils.py diff --git a/src/fides/cli/utils.py b/src/fides/cli/utils.py index e246ce5a1e..9cf1893f9c 100644 --- a/src/fides/cli/utils.py +++ b/src/fides/cli/utils.py @@ -24,7 +24,7 @@ from requests import get, put import fides -from fides.api.api.v1.urn_registry import REGISTRATION, V1_URL_PREFIX +from fides.common.api.v1.urn_registry import REGISTRATION, V1_URL_PREFIX from fides.common.utils import check_response, echo_green, echo_red from fides.config import FidesConfig from fides.config.credentials_settings import ( diff --git a/src/fides/common/api/v1/__init__.py b/src/fides/common/api/v1/__init__.py new file mode 100644 index 0000000000..e69de29bb2 diff --git a/src/fides/api/api/v1/urn_registry.py b/src/fides/common/api/v1/urn_registry.py similarity index 100% rename from src/fides/api/api/v1/urn_registry.py rename to src/fides/common/api/v1/urn_registry.py diff --git a/src/fides/core/api.py b/src/fides/core/api.py index aed5df1d63..339e9c19e0 100644 --- a/src/fides/core/api.py +++ b/src/fides/core/api.py @@ -3,7 +3,7 @@ import requests -from fides.api.api.v1.endpoints.utils import API_PREFIX +from fides.api.util.endpoint_utils import API_PREFIX def generate_resource_url( diff --git a/tests/ctl/api/test_admin.py b/tests/ctl/api/test_admin.py index 0d2ca2b533..e623dc254b 100644 --- a/tests/ctl/api/test_admin.py +++ b/tests/ctl/api/test_admin.py @@ -2,8 +2,8 @@ import pytest from starlette.testclient import TestClient -from fides.api.api.v1.endpoints.utils import API_PREFIX from fides.api.util import errors +from fides.api.util.endpoint_utils import API_PREFIX from fides.config import FidesConfig diff --git a/tests/ctl/api/test_generate.py b/tests/ctl/api/test_generate.py index c6cd3c6fe2..08c27f0b42 100644 --- a/tests/ctl/api/test_generate.py +++ b/tests/ctl/api/test_generate.py @@ -7,7 +7,7 @@ from starlette.testclient import TestClient from fides.api.api.v1.endpoints.generate import GenerateResponse -from fides.api.api.v1.endpoints.utils import API_PREFIX +from fides.api.util.endpoint_utils import API_PREFIX from fides.config import FidesConfig EXTERNAL_CONFIG_BODY = { diff --git a/tests/ctl/api/test_validate.py b/tests/ctl/api/test_validate.py index 7c4257bedf..7d299e7608 100644 --- a/tests/ctl/api/test_validate.py +++ b/tests/ctl/api/test_validate.py @@ -6,8 +6,8 @@ import pytest from starlette.testclient import TestClient -from fides.api.api.v1.endpoints.utils import API_PREFIX from fides.api.api.v1.endpoints.validate import ValidateResponse +from fides.api.util.endpoint_utils import API_PREFIX from fides.config import FidesConfig EXTERNAL_CONFIG_BODY = { diff --git a/tests/ctl/core/test_api.py b/tests/ctl/core/test_api.py index 727119e3bd..7a95d94718 100644 --- a/tests/ctl/core/test_api.py +++ b/tests/ctl/core/test_api.py @@ -21,12 +21,11 @@ from starlette.testclient import TestClient from fides.api.api.v1.endpoints import health -from fides.api.api.v1.endpoints.utils import API_PREFIX, CLI_SCOPE_PREFIX_MAPPING -from fides.api.api.v1.urn_registry import V1_URL_PREFIX from fides.api.db.crud import get_resource from fides.api.models.sql_models import Dataset, PrivacyDeclaration, System from fides.api.oauth.roles import OWNER, VIEWER from fides.api.schemas.system import PrivacyDeclarationResponse +from fides.api.util.endpoint_utils import API_PREFIX, CLI_SCOPE_PREFIX_MAPPING from fides.common.api.scope_registry import ( CREATE, DELETE, @@ -41,6 +40,7 @@ SYSTEM_UPDATE, UPDATE, ) +from fides.common.api.v1.urn_registry import V1_URL_PREFIX from fides.config import FidesConfig, get_config from fides.core import api as _api diff --git a/tests/ops/api/test_ratelimit.py b/tests/ops/api/test_ratelimit.py index b4988cd2b2..7051e53f89 100644 --- a/tests/ops/api/test_ratelimit.py +++ b/tests/ops/api/test_ratelimit.py @@ -5,8 +5,8 @@ from slowapi.extension import Limiter from slowapi.util import get_remote_address -from fides.api.api.v1.urn_registry import HEALTH from fides.api.main import app +from fides.common.api.v1.urn_registry import HEALTH from fides.config import CONFIG, SecuritySettings LIMIT = 2 diff --git a/tests/ops/api/v1/endpoints/test_config_endpoints.py b/tests/ops/api/v1/endpoints/test_config_endpoints.py index 546f2c5b06..3a0722552e 100644 --- a/tests/ops/api/v1/endpoints/test_config_endpoints.py +++ b/tests/ops/api/v1/endpoints/test_config_endpoints.py @@ -6,11 +6,11 @@ from sqlalchemy.orm import Session from starlette.testclient import TestClient -from fides.api.api.v1 import urn_registry as urls from fides.api.models.application_config import ApplicationConfig from fides.api.oauth.roles import CONTRIBUTOR, OWNER, VIEWER from fides.api.schemas.storage.storage import StorageType from fides.common.api import scope_registry as scopes +from fides.common.api.v1 import urn_registry as urls class TestPatchApplicationConfig: diff --git a/tests/ops/api/v1/endpoints/test_connection_config_endpoints.py b/tests/ops/api/v1/endpoints/test_connection_config_endpoints.py index fd047b9a15..e6b9e46be4 100644 --- a/tests/ops/api/v1/endpoints/test_connection_config_endpoints.py +++ b/tests/ops/api/v1/endpoints/test_connection_config_endpoints.py @@ -10,7 +10,6 @@ from sqlalchemy.orm import Session from starlette.testclient import TestClient -from fides.api.api.v1.urn_registry import CONNECTIONS, SAAS_CONFIG, V1_URL_PREFIX from fides.api.models.client import ClientDetail from fides.api.models.connectionconfig import ( AccessLevel, @@ -28,6 +27,7 @@ CONNECTION_READ, STORAGE_DELETE, ) +from fides.common.api.v1.urn_registry import CONNECTIONS, SAAS_CONFIG, V1_URL_PREFIX from tests.fixtures.application_fixtures import integration_secrets from tests.fixtures.saas.connection_template_fixtures import instantiate_connector diff --git a/tests/ops/api/v1/endpoints/test_connection_template_endpoints.py b/tests/ops/api/v1/endpoints/test_connection_template_endpoints.py index 6efcffc382..70845423c2 100644 --- a/tests/ops/api/v1/endpoints/test_connection_template_endpoints.py +++ b/tests/ops/api/v1/endpoints/test_connection_template_endpoints.py @@ -4,12 +4,6 @@ import pytest from starlette.testclient import TestClient -from fides.api.api.v1.urn_registry import ( - CONNECTION_TYPE_SECRETS, - CONNECTION_TYPES, - SAAS_CONNECTOR_FROM_TEMPLATE, - V1_URL_PREFIX, -) from fides.api.models.client import ClientDetail from fides.api.models.connectionconfig import ( AccessLevel, @@ -27,6 +21,12 @@ CONNECTION_TYPE_READ, SAAS_CONNECTION_INSTANTIATE, ) +from fides.common.api.v1.urn_registry import ( + CONNECTION_TYPE_SECRETS, + CONNECTION_TYPES, + SAAS_CONNECTOR_FROM_TEMPLATE, + V1_URL_PREFIX, +) class TestGetConnections: diff --git a/tests/ops/api/v1/endpoints/test_consent_request_endpoints.py b/tests/ops/api/v1/endpoints/test_consent_request_endpoints.py index e47cb9d5f8..3235e385ea 100644 --- a/tests/ops/api/v1/endpoints/test_consent_request_endpoints.py +++ b/tests/ops/api/v1/endpoints/test_consent_request_endpoints.py @@ -8,13 +8,6 @@ import pytest from requests import Session -from fides.api.api.v1.urn_registry import ( - CONSENT_REQUEST, - CONSENT_REQUEST_PREFERENCES, - CONSENT_REQUEST_PREFERENCES_WITH_ID, - CONSENT_REQUEST_VERIFY, - V1_URL_PREFIX, -) from fides.api.models.application_config import ApplicationConfig from fides.api.models.privacy_request import ( Consent, @@ -25,6 +18,13 @@ from fides.api.schemas.messaging.messaging import MessagingServiceType from fides.api.util.consent_util import get_fides_user_device_id_provided_identity from fides.common.api.scope_registry import CONNECTION_READ, CONSENT_READ +from fides.common.api.v1.urn_registry import ( + CONSENT_REQUEST, + CONSENT_REQUEST_PREFERENCES, + CONSENT_REQUEST_PREFERENCES_WITH_ID, + CONSENT_REQUEST_VERIFY, + V1_URL_PREFIX, +) from fides.config import CONFIG diff --git a/tests/ops/api/v1/endpoints/test_dataset_endpoints.py b/tests/ops/api/v1/endpoints/test_dataset_endpoints.py index 3d20bb331f..be63c605c4 100644 --- a/tests/ops/api/v1/endpoints/test_dataset_endpoints.py +++ b/tests/ops/api/v1/endpoints/test_dataset_endpoints.py @@ -14,7 +14,15 @@ from sqlalchemy.orm.attributes import flag_modified from starlette.testclient import TestClient -from fides.api.api.v1.urn_registry import ( +from fides.api.models.connectionconfig import ConnectionConfig +from fides.api.models.datasetconfig import DatasetConfig +from fides.common.api.scope_registry import ( + CTL_DATASET_READ, + DATASET_CREATE_OR_UPDATE, + DATASET_DELETE, + DATASET_READ, +) +from fides.common.api.v1.urn_registry import ( CONNECTION_DATASETS, DATASET_BY_KEY, DATASET_CONFIGS, @@ -24,14 +32,6 @@ V1_URL_PREFIX, YAML_DATASETS, ) -from fides.api.models.connectionconfig import ConnectionConfig -from fides.api.models.datasetconfig import DatasetConfig -from fides.common.api.scope_registry import ( - CTL_DATASET_READ, - DATASET_CREATE_OR_UPDATE, - DATASET_DELETE, - DATASET_READ, -) def _reject_key(dict: Dict, key: str) -> Dict: diff --git a/tests/ops/api/v1/endpoints/test_drp_endpoints.py b/tests/ops/api/v1/endpoints/test_drp_endpoints.py index c25afe982e..322e68e3cd 100644 --- a/tests/ops/api/v1/endpoints/test_drp_endpoints.py +++ b/tests/ops/api/v1/endpoints/test_drp_endpoints.py @@ -8,13 +8,6 @@ from sqlalchemy.orm import Session from starlette.testclient import TestClient -from fides.api.api.v1.urn_registry import ( - DRP_DATA_RIGHTS, - DRP_EXERCISE, - DRP_REVOKE, - DRP_STATUS, - V1_URL_PREFIX, -) from fides.api.models.policy import DrpAction from fides.api.models.privacy_request import ( PrivacyRequest, @@ -30,6 +23,13 @@ PRIVACY_REQUEST_REVIEW, STORAGE_CREATE_OR_UPDATE, ) +from fides.common.api.v1.urn_registry import ( + DRP_DATA_RIGHTS, + DRP_EXERCISE, + DRP_REVOKE, + DRP_STATUS, + V1_URL_PREFIX, +) from fides.config import CONFIG diff --git a/tests/ops/api/v1/endpoints/test_encryption_endpoints.py b/tests/ops/api/v1/endpoints/test_encryption_endpoints.py index 6593cf007a..04272f4f8c 100644 --- a/tests/ops/api/v1/endpoints/test_encryption_endpoints.py +++ b/tests/ops/api/v1/endpoints/test_encryption_endpoints.py @@ -5,18 +5,18 @@ import pytest from starlette.testclient import TestClient -from fides.api.api.v1.urn_registry import ( - DECRYPT_AES, - ENCRYPT_AES, - ENCRYPTION_KEY, - V1_URL_PREFIX, -) from fides.api.cryptography.cryptographic_util import b64_str_to_bytes, bytes_to_b64_str from fides.api.util.encryption.aes_gcm_encryption_scheme import ( decrypt, encrypt_verify_secret_length, ) from fides.common.api.scope_registry import ENCRYPTION_EXEC, STORAGE_CREATE_OR_UPDATE +from fides.common.api.v1.urn_registry import ( + DECRYPT_AES, + ENCRYPT_AES, + ENCRYPTION_KEY, + V1_URL_PREFIX, +) from fides.config import CONFIG diff --git a/tests/ops/api/v1/endpoints/test_health_endpoints.py b/tests/ops/api/v1/endpoints/test_health_endpoints.py index 089b64625e..6f5c3b03f7 100644 --- a/tests/ops/api/v1/endpoints/test_health_endpoints.py +++ b/tests/ops/api/v1/endpoints/test_health_endpoints.py @@ -1,7 +1,7 @@ from starlette.testclient import TestClient import fides -from fides.api.api.v1.urn_registry import HEALTH +from fides.common.api.v1.urn_registry import HEALTH def test_health(api_client: TestClient) -> None: diff --git a/tests/ops/api/v1/endpoints/test_identity_verification_endpoints.py b/tests/ops/api/v1/endpoints/test_identity_verification_endpoints.py index 75f853486c..b46165f39b 100644 --- a/tests/ops/api/v1/endpoints/test_identity_verification_endpoints.py +++ b/tests/ops/api/v1/endpoints/test_identity_verification_endpoints.py @@ -1,8 +1,8 @@ import pytest from starlette.testclient import TestClient -from fides.api.api.v1.urn_registry import ID_VERIFICATION_CONFIG, V1_URL_PREFIX from fides.api.models.application_config import ApplicationConfig +from fides.common.api.v1.urn_registry import ID_VERIFICATION_CONFIG, V1_URL_PREFIX from fides.config import get_config diff --git a/tests/ops/api/v1/endpoints/test_manual_webhooks.py b/tests/ops/api/v1/endpoints/test_manual_webhooks.py index 2b219cb128..c8c5a994b4 100644 --- a/tests/ops/api/v1/endpoints/test_manual_webhooks.py +++ b/tests/ops/api/v1/endpoints/test_manual_webhooks.py @@ -2,12 +2,6 @@ from sqlalchemy.orm import Session from starlette.testclient import TestClient -from fides.api.api.v1.urn_registry import ( - ACCESS_MANUAL_WEBHOOK, - ACCESS_MANUAL_WEBHOOKS, - CONNECTION_TEST, - V1_URL_PREFIX, -) from fides.api.models.manual_webhook import AccessManualWebhook from fides.common.api.scope_registry import ( CONNECTION_READ, @@ -16,6 +10,12 @@ WEBHOOK_DELETE, WEBHOOK_READ, ) +from fides.common.api.v1.urn_registry import ( + ACCESS_MANUAL_WEBHOOK, + ACCESS_MANUAL_WEBHOOKS, + CONNECTION_TEST, + V1_URL_PREFIX, +) class TestGetAccessManualWebhook: diff --git a/tests/ops/api/v1/endpoints/test_masking_endpoints.py b/tests/ops/api/v1/endpoints/test_masking_endpoints.py index aff4a6f987..ed094139e8 100644 --- a/tests/ops/api/v1/endpoints/test_masking_endpoints.py +++ b/tests/ops/api/v1/endpoints/test_masking_endpoints.py @@ -2,7 +2,6 @@ from starlette.testclient import TestClient -from fides.api.api.v1.urn_registry import MASKING, MASKING_STRATEGY, V1_URL_PREFIX from fides.api.schemas.masking.masking_api import MaskingAPIResponse from fides.api.schemas.masking.masking_configuration import ( AesEncryptionMaskingConfiguration, @@ -23,6 +22,7 @@ StringRewriteMaskingStrategy, ) from fides.common.api.scope_registry import MASKING_EXEC, MASKING_READ +from fides.common.api.v1.urn_registry import MASKING, MASKING_STRATEGY, V1_URL_PREFIX class TestGetMaskingStrategies: diff --git a/tests/ops/api/v1/endpoints/test_messaging_endpoints.py b/tests/ops/api/v1/endpoints/test_messaging_endpoints.py index 15bd4f6fb2..e8e5feac02 100644 --- a/tests/ops/api/v1/endpoints/test_messaging_endpoints.py +++ b/tests/ops/api/v1/endpoints/test_messaging_endpoints.py @@ -7,18 +7,6 @@ from sqlalchemy.orm import Session from starlette.testclient import TestClient -from fides.api.api.v1.urn_registry import ( - MESSAGING_ACTIVE_DEFAULT, - MESSAGING_BY_KEY, - MESSAGING_CONFIG, - MESSAGING_DEFAULT, - MESSAGING_DEFAULT_BY_TYPE, - MESSAGING_DEFAULT_SECRETS, - MESSAGING_SECRETS, - MESSAGING_STATUS, - MESSAGING_TEST, - V1_URL_PREFIX, -) from fides.api.common_exceptions import MessageDispatchException from fides.api.models.application_config import ApplicationConfig from fides.api.models.messaging import MessagingConfig @@ -34,6 +22,18 @@ MESSAGING_DELETE, MESSAGING_READ, ) +from fides.common.api.v1.urn_registry import ( + MESSAGING_ACTIVE_DEFAULT, + MESSAGING_BY_KEY, + MESSAGING_CONFIG, + MESSAGING_DEFAULT, + MESSAGING_DEFAULT_BY_TYPE, + MESSAGING_DEFAULT_SECRETS, + MESSAGING_SECRETS, + MESSAGING_STATUS, + MESSAGING_TEST, + V1_URL_PREFIX, +) from fides.config import get_config PAGE_SIZE = Params().size diff --git a/tests/ops/api/v1/endpoints/test_oauth_endpoints.py b/tests/ops/api/v1/endpoints/test_oauth_endpoints.py index 5b0583010e..6caa312595 100644 --- a/tests/ops/api/v1/endpoints/test_oauth_endpoints.py +++ b/tests/ops/api/v1/endpoints/test_oauth_endpoints.py @@ -6,16 +6,6 @@ import pytest from starlette.testclient import TestClient -from fides.api.api.v1.urn_registry import ( - CLIENT, - CLIENT_BY_ID, - CLIENT_SCOPE, - OAUTH_CALLBACK, - ROLE, - SCOPE, - TOKEN, - V1_URL_PREFIX, -) from fides.api.common_exceptions import OAuth2TokenException from fides.api.cryptography.schemas.jwt import ( JWE_ISSUED_AT, @@ -37,6 +27,16 @@ SCOPE_REGISTRY, STORAGE_READ, ) +from fides.common.api.v1.urn_registry import ( + CLIENT, + CLIENT_BY_ID, + CLIENT_SCOPE, + OAUTH_CALLBACK, + ROLE, + SCOPE, + TOKEN, + V1_URL_PREFIX, +) from fides.config import CONFIG diff --git a/tests/ops/api/v1/endpoints/test_policy_endpoints.py b/tests/ops/api/v1/endpoints/test_policy_endpoints.py index a9c3830a8c..313280a632 100644 --- a/tests/ops/api/v1/endpoints/test_policy_endpoints.py +++ b/tests/ops/api/v1/endpoints/test_policy_endpoints.py @@ -5,15 +5,6 @@ import pytest from starlette.testclient import TestClient -from fides.api.api.v1.urn_registry import POLICY_DETAIL as POLICY_DETAIL_URI -from fides.api.api.v1.urn_registry import POLICY_LIST as POLICY_CREATE_URI -from fides.api.api.v1.urn_registry import RULE_DETAIL as RULE_DETAIL_URI -from fides.api.api.v1.urn_registry import RULE_LIST as RULE_CREATE_URI -from fides.api.api.v1.urn_registry import ( - RULE_TARGET_DETAIL, - RULE_TARGET_LIST, - V1_URL_PREFIX, -) from fides.api.models.client import ClientDetail from fides.api.models.policy import ActionType, DrpAction, Policy, Rule, RuleTarget from fides.api.service.masking.strategy.masking_strategy_nullify import ( @@ -21,6 +12,15 @@ ) from fides.api.util.data_category import DataCategory, generate_fides_data_categories from fides.common.api import scope_registry as scopes +from fides.common.api.v1.urn_registry import POLICY_DETAIL as POLICY_DETAIL_URI +from fides.common.api.v1.urn_registry import POLICY_LIST as POLICY_CREATE_URI +from fides.common.api.v1.urn_registry import RULE_DETAIL as RULE_DETAIL_URI +from fides.common.api.v1.urn_registry import RULE_LIST as RULE_CREATE_URI +from fides.common.api.v1.urn_registry import ( + RULE_TARGET_DETAIL, + RULE_TARGET_LIST, + V1_URL_PREFIX, +) class TestGetPolicies: diff --git a/tests/ops/api/v1/endpoints/test_policy_webhook_endpoints.py b/tests/ops/api/v1/endpoints/test_policy_webhook_endpoints.py index c7faf2ebe8..d86192d249 100644 --- a/tests/ops/api/v1/endpoints/test_policy_webhook_endpoints.py +++ b/tests/ops/api/v1/endpoints/test_policy_webhook_endpoints.py @@ -3,13 +3,6 @@ import pytest -from fides.api.api.v1.urn_registry import ( - POLICY_POST_WEBHOOK_DETAIL, - POLICY_PRE_WEBHOOK_DETAIL, - POLICY_WEBHOOKS_POST, - POLICY_WEBHOOKS_PRE, - V1_URL_PREFIX, -) from fides.api.models.connectionconfig import ConnectionConfig from fides.api.models.policy import PolicyPostWebhook, PolicyPreWebhook from fides.common.api.scope_registry import ( @@ -18,6 +11,13 @@ WEBHOOK_DELETE, WEBHOOK_READ, ) +from fides.common.api.v1.urn_registry import ( + POLICY_POST_WEBHOOK_DETAIL, + POLICY_PRE_WEBHOOK_DETAIL, + POLICY_WEBHOOKS_POST, + POLICY_WEBHOOKS_PRE, + V1_URL_PREFIX, +) from tests.ops.api.v1.endpoints.test_privacy_request_endpoints import stringify_date diff --git a/tests/ops/api/v1/endpoints/test_privacy_experience_config_endpoints.py b/tests/ops/api/v1/endpoints/test_privacy_experience_config_endpoints.py index e80e7b0ec0..e0e801350f 100644 --- a/tests/ops/api/v1/endpoints/test_privacy_experience_config_endpoints.py +++ b/tests/ops/api/v1/endpoints/test_privacy_experience_config_endpoints.py @@ -7,7 +7,6 @@ from fides.api.api.v1.endpoints.privacy_experience_config_endpoints import ( get_experience_config_or_error, ) -from fides.api.api.v1.urn_registry import EXPERIENCE_CONFIG, V1_URL_PREFIX from fides.api.models.privacy_experience import ( BannerEnabled, ComponentType, @@ -17,6 +16,7 @@ ) from fides.api.models.privacy_notice import PrivacyNoticeRegion from fides.common.api import scope_registry as scopes +from fides.common.api.v1.urn_registry import EXPERIENCE_CONFIG, V1_URL_PREFIX class TestGetExperienceConfigList: diff --git a/tests/ops/api/v1/endpoints/test_privacy_experience_endpoints.py b/tests/ops/api/v1/endpoints/test_privacy_experience_endpoints.py index b2f9f6646a..cc9aba6e9e 100644 --- a/tests/ops/api/v1/endpoints/test_privacy_experience_endpoints.py +++ b/tests/ops/api/v1/endpoints/test_privacy_experience_endpoints.py @@ -4,8 +4,8 @@ from starlette.status import HTTP_200_OK from starlette.testclient import TestClient -from fides.api.api.v1.urn_registry import PRIVACY_EXPERIENCE, V1_URL_PREFIX from fides.api.models.privacy_notice import ConsentMechanism +from fides.common.api.v1.urn_registry import PRIVACY_EXPERIENCE, V1_URL_PREFIX class TestGetPrivacyExperiences: diff --git a/tests/ops/api/v1/endpoints/test_privacy_notice_endpoints.py b/tests/ops/api/v1/endpoints/test_privacy_notice_endpoints.py index 8026787cc4..66aeaac6e9 100644 --- a/tests/ops/api/v1/endpoints/test_privacy_notice_endpoints.py +++ b/tests/ops/api/v1/endpoints/test_privacy_notice_endpoints.py @@ -9,12 +9,6 @@ from sqlalchemy.orm import Session from starlette.testclient import TestClient -from fides.api.api.v1.urn_registry import ( - PRIVACY_NOTICE, - PRIVACY_NOTICE_BY_DATA_USE, - PRIVACY_NOTICE_DETAIL, - V1_URL_PREFIX, -) from fides.api.models.privacy_experience import ComponentType, PrivacyExperience from fides.api.models.privacy_notice import ( ConsentMechanism, @@ -25,6 +19,12 @@ ) from fides.api.schemas.privacy_notice import PrivacyNoticeResponse from fides.common.api import scope_registry as scopes +from fides.common.api.v1.urn_registry import ( + PRIVACY_NOTICE, + PRIVACY_NOTICE_BY_DATA_USE, + PRIVACY_NOTICE_DETAIL, + V1_URL_PREFIX, +) class TestGetPrivacyNotices: diff --git a/tests/ops/api/v1/endpoints/test_privacy_preference_endpoints.py b/tests/ops/api/v1/endpoints/test_privacy_preference_endpoints.py index aa26f2326d..24d569d556 100644 --- a/tests/ops/api/v1/endpoints/test_privacy_preference_endpoints.py +++ b/tests/ops/api/v1/endpoints/test_privacy_preference_endpoints.py @@ -7,14 +7,6 @@ from starlette.status import HTTP_200_OK, HTTP_403_FORBIDDEN from starlette.testclient import TestClient -from fides.api.api.v1.urn_registry import ( - CONSENT_REQUEST_PRIVACY_PREFERENCES_VERIFY, - CONSENT_REQUEST_PRIVACY_PREFERENCES_WITH_ID, - CURRENT_PRIVACY_PREFERENCES_REPORT, - HISTORICAL_PRIVACY_PREFERENCES_REPORT, - PRIVACY_PREFERENCES, - V1_URL_PREFIX, -) from fides.api.models.privacy_preference import ( ConsentMethod, CurrentPrivacyPreference, @@ -34,6 +26,14 @@ CURRENT_PRIVACY_PREFERENCE_READ, PRIVACY_PREFERENCE_HISTORY_READ, ) +from fides.common.api.v1.urn_registry import ( + CONSENT_REQUEST_PRIVACY_PREFERENCES_VERIFY, + CONSENT_REQUEST_PRIVACY_PREFERENCES_WITH_ID, + CURRENT_PRIVACY_PREFERENCES_REPORT, + HISTORICAL_PRIVACY_PREFERENCES_REPORT, + PRIVACY_PREFERENCES, + V1_URL_PREFIX, +) from fides.config import CONFIG diff --git a/tests/ops/api/v1/endpoints/test_privacy_request_endpoints.py b/tests/ops/api/v1/endpoints/test_privacy_request_endpoints.py index fbe218c008..480df0274c 100644 --- a/tests/ops/api/v1/endpoints/test_privacy_request_endpoints.py +++ b/tests/ops/api/v1/endpoints/test_privacy_request_endpoints.py @@ -18,25 +18,6 @@ EMBEDDED_EXECUTION_LOG_LIMIT, validate_manual_input, ) -from fides.api.api.v1.urn_registry import ( - CONNECTION_DATASETS, - PRIVACY_REQUEST_ACCESS_MANUAL_WEBHOOK_INPUT, - PRIVACY_REQUEST_APPROVE, - PRIVACY_REQUEST_AUTHENTICATED, - PRIVACY_REQUEST_BULK_RETRY, - PRIVACY_REQUEST_DENY, - PRIVACY_REQUEST_MANUAL_ERASURE, - PRIVACY_REQUEST_MANUAL_INPUT, - PRIVACY_REQUEST_NOTIFICATIONS, - PRIVACY_REQUEST_RESUME, - PRIVACY_REQUEST_RESUME_FROM_REQUIRES_INPUT, - PRIVACY_REQUEST_RETRY, - PRIVACY_REQUEST_TRANSFER_TO_PARENT, - PRIVACY_REQUEST_VERIFY_IDENTITY, - PRIVACY_REQUESTS, - REQUEST_PREVIEW, - V1_URL_PREFIX, -) from fides.api.cryptography.schemas.jwt import ( JWE_ISSUED_AT, JWE_PAYLOAD_CLIENT_ID, @@ -93,6 +74,25 @@ PRIVACY_REQUEST_VIEW_DATA, STORAGE_CREATE_OR_UPDATE, ) +from fides.common.api.v1.urn_registry import ( + CONNECTION_DATASETS, + PRIVACY_REQUEST_ACCESS_MANUAL_WEBHOOK_INPUT, + PRIVACY_REQUEST_APPROVE, + PRIVACY_REQUEST_AUTHENTICATED, + PRIVACY_REQUEST_BULK_RETRY, + PRIVACY_REQUEST_DENY, + PRIVACY_REQUEST_MANUAL_ERASURE, + PRIVACY_REQUEST_MANUAL_INPUT, + PRIVACY_REQUEST_NOTIFICATIONS, + PRIVACY_REQUEST_RESUME, + PRIVACY_REQUEST_RESUME_FROM_REQUIRES_INPUT, + PRIVACY_REQUEST_RETRY, + PRIVACY_REQUEST_TRANSFER_TO_PARENT, + PRIVACY_REQUEST_VERIFY_IDENTITY, + PRIVACY_REQUESTS, + REQUEST_PREVIEW, + V1_URL_PREFIX, +) from fides.config import CONFIG page_size = Params().size diff --git a/tests/ops/api/v1/endpoints/test_registration_endpoints.py b/tests/ops/api/v1/endpoints/test_registration_endpoints.py index 820845a5f1..a7ee947d67 100644 --- a/tests/ops/api/v1/endpoints/test_registration_endpoints.py +++ b/tests/ops/api/v1/endpoints/test_registration_endpoints.py @@ -2,8 +2,8 @@ import pytest -from fides.api.api.v1.urn_registry import REGISTRATION, V1_URL_PREFIX from fides.api.models.registration import UserRegistration +from fides.common.api.v1.urn_registry import REGISTRATION, V1_URL_PREFIX class TestUserRegistration: diff --git a/tests/ops/api/v1/endpoints/test_saas_config_endpoints.py b/tests/ops/api/v1/endpoints/test_saas_config_endpoints.py index a511c6ba5e..d4e98c5efd 100644 --- a/tests/ops/api/v1/endpoints/test_saas_config_endpoints.py +++ b/tests/ops/api/v1/endpoints/test_saas_config_endpoints.py @@ -7,13 +7,6 @@ from sqlalchemy.orm import Session from starlette.testclient import TestClient -from fides.api.api.v1.urn_registry import ( - AUTHORIZE, - REGISTER_CONNECTOR_TEMPLATE, - SAAS_CONFIG, - SAAS_CONFIG_VALIDATE, - V1_URL_PREFIX, -) from fides.api.models.connectionconfig import ( AccessLevel, ConnectionConfig, @@ -27,6 +20,13 @@ SAAS_CONFIG_DELETE, SAAS_CONFIG_READ, ) +from fides.common.api.v1.urn_registry import ( + AUTHORIZE, + REGISTER_CONNECTOR_TEMPLATE, + SAAS_CONFIG, + SAAS_CONFIG_VALIDATE, + V1_URL_PREFIX, +) from fides.config import CONFIG from tests.ops.api.v1.endpoints.test_dataset_endpoints import _reject_key from tests.ops.test_helpers.saas_test_utils import create_zip_file diff --git a/tests/ops/api/v1/endpoints/test_storage_endpoints.py b/tests/ops/api/v1/endpoints/test_storage_endpoints.py index e587393919..2af9932c40 100644 --- a/tests/ops/api/v1/endpoints/test_storage_endpoints.py +++ b/tests/ops/api/v1/endpoints/test_storage_endpoints.py @@ -8,18 +8,6 @@ from sqlalchemy.orm import Session from starlette.testclient import TestClient -from fides.api.api.v1.urn_registry import ( - STORAGE_ACTIVE_DEFAULT, - STORAGE_BY_KEY, - STORAGE_CONFIG, - STORAGE_DEFAULT, - STORAGE_DEFAULT_BY_TYPE, - STORAGE_DEFAULT_SECRETS, - STORAGE_SECRETS, - STORAGE_STATUS, - STORAGE_UPLOAD, - V1_URL_PREFIX, -) from fides.api.common_exceptions import KeyOrNameAlreadyExists, KeyValidationError from fides.api.models.application_config import ApplicationConfig from fides.api.models.client import ClientDetail @@ -40,6 +28,18 @@ STORAGE_DELETE, STORAGE_READ, ) +from fides.common.api.v1.urn_registry import ( + STORAGE_ACTIVE_DEFAULT, + STORAGE_BY_KEY, + STORAGE_CONFIG, + STORAGE_DEFAULT, + STORAGE_DEFAULT_BY_TYPE, + STORAGE_DEFAULT_SECRETS, + STORAGE_SECRETS, + STORAGE_STATUS, + STORAGE_UPLOAD, + V1_URL_PREFIX, +) from fides.config import get_config from fides.config.config_proxy import ConfigProxy diff --git a/tests/ops/api/v1/endpoints/test_system.py b/tests/ops/api/v1/endpoints/test_system.py index a27fed9f31..7a8f5edcea 100644 --- a/tests/ops/api/v1/endpoints/test_system.py +++ b/tests/ops/api/v1/endpoints/test_system.py @@ -11,7 +11,6 @@ ) from starlette.testclient import TestClient -from fides.api.api.v1.urn_registry import V1_URL_PREFIX from fides.api.models.connectionconfig import ( AccessLevel, ConnectionConfig, @@ -24,6 +23,7 @@ SAAS_CONNECTION_INSTANTIATE, STORAGE_DELETE, ) +from fides.common.api.v1.urn_registry import V1_URL_PREFIX page_size = Params().size diff --git a/tests/ops/api/v1/endpoints/test_user_endpoints.py b/tests/ops/api/v1/endpoints/test_user_endpoints.py index d74db97fe9..88c83a4a0b 100644 --- a/tests/ops/api/v1/endpoints/test_user_endpoints.py +++ b/tests/ops/api/v1/endpoints/test_user_endpoints.py @@ -16,13 +16,6 @@ ) from starlette.testclient import TestClient -from fides.api.api.v1.urn_registry import ( - LOGIN, - LOGOUT, - USER_DETAIL, - USERS, - V1_URL_PREFIX, -) from fides.api.cryptography.cryptographic_util import str_to_b64_str from fides.api.cryptography.schemas.jwt import ( JWE_ISSUED_AT, @@ -50,6 +43,13 @@ USER_READ, USER_UPDATE, ) +from fides.common.api.v1.urn_registry import ( + LOGIN, + LOGOUT, + USER_DETAIL, + USERS, + V1_URL_PREFIX, +) from fides.config import CONFIG from tests.conftest import generate_auth_header_for_user diff --git a/tests/ops/api/v1/endpoints/test_user_permission_endpoints.py b/tests/ops/api/v1/endpoints/test_user_permission_endpoints.py index ab8f41c1ae..31afa30e6e 100644 --- a/tests/ops/api/v1/endpoints/test_user_permission_endpoints.py +++ b/tests/ops/api/v1/endpoints/test_user_permission_endpoints.py @@ -8,7 +8,6 @@ HTTP_422_UNPROCESSABLE_ENTITY, ) -from fides.api.api.v1.urn_registry import USER_PERMISSIONS, V1_URL_PREFIX from fides.api.models.client import ClientDetail from fides.api.models.fides_user import FidesUser from fides.api.models.fides_user_permissions import FidesUserPermissions @@ -29,6 +28,7 @@ USER_PERMISSION_READ, USER_PERMISSION_UPDATE, ) +from fides.common.api.v1.urn_registry import USER_PERMISSIONS, V1_URL_PREFIX from fides.config import CONFIG from tests.conftest import generate_auth_header_for_user, generate_role_header_for_user diff --git a/tests/ops/api/v1/test_exception_handlers.py b/tests/ops/api/v1/test_exception_handlers.py index 95235fdb70..76cd8a2c77 100644 --- a/tests/ops/api/v1/test_exception_handlers.py +++ b/tests/ops/api/v1/test_exception_handlers.py @@ -3,8 +3,8 @@ import pytest from starlette.testclient import TestClient -from fides.api.api.v1.urn_registry import HEALTH, PRIVACY_REQUESTS, V1_URL_PREFIX from fides.common.api.scope_registry import CLIENT_CREATE +from fides.common.api.v1.urn_registry import HEALTH, PRIVACY_REQUESTS, V1_URL_PREFIX from fides.config import CONFIG diff --git a/tests/ops/api/v1/test_utils.py b/tests/ops/api/v1/test_utils.py index c79296207c..cf25b4ee9f 100644 --- a/tests/ops/api/v1/test_utils.py +++ b/tests/ops/api/v1/test_utils.py @@ -4,12 +4,12 @@ import pytest from fastapi import HTTPException -from fides.api.api.v1.endpoints.utils import ( +from fides.api.schemas.privacy_notice import PrivacyNotice +from fides.api.util.endpoint_utils import ( human_friendly_list, transform_fields, validate_start_and_end_filters, ) -from fides.api.schemas.privacy_notice import PrivacyNotice class TestValidateStartAndEndFilters: diff --git a/tests/ops/integration_tests/test_connection_configuration_integration.py b/tests/ops/integration_tests/test_connection_configuration_integration.py index e7da2f0c56..490fea8b77 100644 --- a/tests/ops/integration_tests/test_connection_configuration_integration.py +++ b/tests/ops/integration_tests/test_connection_configuration_integration.py @@ -6,7 +6,6 @@ from sqlalchemy.orm import Session from starlette.testclient import TestClient -from fides.api.api.v1.urn_registry import CONNECTIONS, V1_URL_PREFIX from fides.api.common_exceptions import ConnectionException from fides.api.models.client import ClientDetail from fides.api.models.connectionconfig import ConnectionTestStatus @@ -27,6 +26,7 @@ CONNECTION_READ, STORAGE_READ, ) +from fides.common.api.v1.urn_registry import CONNECTIONS, V1_URL_PREFIX @pytest.mark.integration_postgres diff --git a/tests/ops/service/privacy_request/test_request_service.py b/tests/ops/service/privacy_request/test_request_service.py index c6000b60c4..8e889fc8de 100644 --- a/tests/ops/service/privacy_request/test_request_service.py +++ b/tests/ops/service/privacy_request/test_request_service.py @@ -3,7 +3,6 @@ import pytest from httpx import HTTPStatusError -from fides.api.api.v1.urn_registry import LOGIN, V1_URL_PREFIX from fides.api.cryptography.cryptographic_util import str_to_b64_str from fides.api.db.seed import create_or_update_parent_user from fides.api.models.privacy_request import PrivacyRequest, PrivacyRequestStatus @@ -11,6 +10,7 @@ build_required_privacy_request_kwargs, poll_server_for_completion, ) +from fides.common.api.v1.urn_registry import LOGIN, V1_URL_PREFIX from fides.config import CONFIG diff --git a/tests/ops/util/test_api_router.py b/tests/ops/util/test_api_router.py index ab8d16ec64..d468b947c5 100644 --- a/tests/ops/util/test_api_router.py +++ b/tests/ops/util/test_api_router.py @@ -2,9 +2,9 @@ from starlette.status import HTTP_200_OK, HTTP_404_NOT_FOUND from starlette.testclient import TestClient -from fides.api.api.v1.urn_registry import PRIVACY_REQUESTS, V1_URL_PREFIX from fides.api.models.client import ClientDetail from fides.common.api.scope_registry import PRIVACY_REQUEST_READ +from fides.common.api.v1.urn_registry import PRIVACY_REQUESTS, V1_URL_PREFIX class TestApiRouter: