diff --git a/.gitignore b/.gitignore index c2ed8d7e5a..98e6d4280e 100644 --- a/.gitignore +++ b/.gitignore @@ -1,7 +1,6 @@ -fidesctl/api/src/main/resources/application.conf docs/fides/docs/api/openapi.json docs/fides/docs/schemas/config_schema.json -fidesctl/api/build/static +fidesctl/api/ctl/build/static ## generic files to ignore *~ diff --git a/CHANGELOG.md b/CHANGELOG.md index 7bc977fba8..ecdaf16292 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -39,6 +39,7 @@ The types of changes are: * Added taxonomy page to UI [#902](https://github.com/ethyca/fides/pull/902) * Added a nested accordion component for displaying taxonomy data [#910](https://github.com/ethyca/fides/pull/910) * Add lru cache to get_config [927](https://github.com/ethyca/fides/pull/927) +* `fides` is now an alias for `fidesctl` as a CLI entrypoint [#926](https://github.com/ethyca/fides/pull/926) * Add user auth routes [929](https://github.com/ethyca/fides/pull/929) * Bump fideslib to 3.0.1 and remove patch code[931](https://github.com/ethyca/fides/pull/931) diff --git a/Dockerfile b/Dockerfile index 75a9f90779..7284853177 100644 --- a/Dockerfile +++ b/Dockerfile @@ -91,7 +91,7 @@ ENV PYTHONUNBUFFERED=TRUE ENV RUNNING_IN_DOCKER=TRUE # Make a static files directory -RUN mkdir -p src/fidesctl/api/build/static +RUN mkdir -p src/fidesctl/api/ctl/build/static EXPOSE 8080 CMD ["fidesctl", "webserver"] @@ -116,4 +116,4 @@ RUN python setup.py sdist RUN pip install dist/fidesctl-*.tar.gz # Copy frontend build over -COPY --from=frontend /fides/clients/admin-ui/out/ /fides/src/fidesctl/api/build/static/ +COPY --from=frontend /fides/clients/admin-ui/out/ /fides/src/fidesctl/api/ctl/build/static/ diff --git a/MANIFEST.in b/MANIFEST.in index 269cc29410..2e4b523b9c 100644 --- a/MANIFEST.in +++ b/MANIFEST.in @@ -2,5 +2,5 @@ include LICENSE include requirements.txt include dev-requirements.txt include versioneer.py -include src/fidesctl/api/alembic.ini +include src/fidesctl/api/ctl/alembic.ini include src/fidesctl/templates/fides_datamap_template.xlsx diff --git a/clients/admin-ui/package.json b/clients/admin-ui/package.json index 30db53b04a..1f425a4557 100644 --- a/clients/admin-ui/package.json +++ b/clients/admin-ui/package.json @@ -14,7 +14,7 @@ "analyze:server": "cross-env BUNDLE_ANALYZE=server next build", "analyze:browser": "cross-env BUNDLE_ANALYZE=browser next build", "export": "next build && next export", - "copy-export": "rsync -a --delete out/ ../../src/fidesctl/api/build/static/", + "copy-export": "rsync -a --delete out/ ../../src/fidesctl/api/ctl/build/static/", "prod-export": "npm run export && npm run copy-export", "cy:open": "cypress open", "cy:run": "cypress run", diff --git a/docs/fides/docs/development/database_migration.md b/docs/fides/docs/development/database_migration.md index 01a65003ab..e46bb9de5c 100644 --- a/docs/fides/docs/development/database_migration.md +++ b/docs/fides/docs/development/database_migration.md @@ -2,12 +2,12 @@ --- -Changes to fidesctl could require a change to the database model. This includes scenarios where you want to persist a new field or replace an existing field. Changes made to the fidesctl database are done through alembic migration scripts. Migrations can be found in the following direcotry: `fidesctl/src/fidesctl/api/migrations/versions` +Changes to fidesctl could require a change to the database model. This includes scenarios where you want to persist a new field or replace an existing field. Changes made to the fidesctl database are done through alembic migration scripts. Migrations can be found in the following direcotry: `src/fidesctl/api/ctl/migrations/versions` To create a new migration we use the `alembic revision` command: ```bash -cd fidesctl/src/fidesctl/api +cd src/fidesctl/api/ctl alembic revision --autogenerate -m "migration message" ``` diff --git a/noxfiles/constants_nox.py b/noxfiles/constants_nox.py index b70beabe61..65f05dcbb6 100644 --- a/noxfiles/constants_nox.py +++ b/noxfiles/constants_nox.py @@ -16,7 +16,7 @@ def get_current_tag() -> str: # Files COMPOSE_FILE = "docker-compose.yml" INTEGRATION_COMPOSE_FILE = "docker-compose.integration-tests.yml" -WITH_TEST_CONFIG = ("-f", "tests/test_config.toml") +WITH_TEST_CONFIG = ("-f", "tests/ctl/test_config.toml") # Image Names & Tags REGISTRY = "ethyca" diff --git a/pyproject.toml b/pyproject.toml index 8e3d10145d..576fa63d5e 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -78,9 +78,8 @@ good-names="_,i,setUp,tearDown,maxDiff,default_app_config" [tool.pytest.ini_options] testpaths="tests" log_level = "DEBUG" -addopts = ["--cov=fidesctl.core", +addopts = ["--cov=fidesctl.ctl.core", "--cov=fidesctl.cli", - "--cov=fideslang", "--cov-report=term-missing", "-vv", "--no-cov-on-fail", diff --git a/setup.py b/setup.py index 83380c4e2a..7ed8df88fb 100644 --- a/setup.py +++ b/setup.py @@ -44,7 +44,7 @@ long_description=long_description, long_description_content_type="text/markdown", url="https://github.com/ethyca/fides", - entry_points={"console_scripts": ["fidesctl=fidesctl.cli:cli"]}, + entry_points={"console_scripts": ["fidesctl=fidesctl.cli:cli","fides=fidesctl.cli:cli"]}, python_requires=">=3.8, <4", package_dir={"": "src"}, packages=find_packages(where="src"), diff --git a/src/fidesctl.egg-info/entry_points.txt b/src/fidesctl.egg-info/entry_points.txt index c6df1cc547..81280657b7 100644 --- a/src/fidesctl.egg-info/entry_points.txt +++ b/src/fidesctl.egg-info/entry_points.txt @@ -1,2 +1,3 @@ [console_scripts] +fides = fidesctl.cli:cli fidesctl = fidesctl.cli:cli diff --git a/src/fidesctl/api/database/__init__.py b/src/fidesctl/api/ctl/__init__.py similarity index 100% rename from src/fidesctl/api/database/__init__.py rename to src/fidesctl/api/ctl/__init__.py diff --git a/src/fidesctl/api/alembic.ini b/src/fidesctl/api/ctl/alembic.ini similarity index 100% rename from src/fidesctl/api/alembic.ini rename to src/fidesctl/api/ctl/alembic.ini diff --git a/src/fidesctl/api/migrations/__init__.py b/src/fidesctl/api/ctl/database/__init__.py similarity index 100% rename from src/fidesctl/api/migrations/__init__.py rename to src/fidesctl/api/ctl/database/__init__.py diff --git a/src/fidesctl/api/database/crud.py b/src/fidesctl/api/ctl/database/crud.py similarity index 98% rename from src/fidesctl/api/database/crud.py rename to src/fidesctl/api/ctl/database/crud.py index 451ce84d95..c489b6b0e1 100644 --- a/src/fidesctl/api/database/crud.py +++ b/src/fidesctl/api/ctl/database/crud.py @@ -13,8 +13,8 @@ from sqlalchemy.exc import SQLAlchemyError from sqlalchemy.future import select -from fidesctl.api.database.session import async_session -from fidesctl.api.utils import errors +from fidesctl.api.ctl.database.session import async_session +from fidesctl.api.ctl.utils import errors # CRUD Functions diff --git a/src/fidesctl/api/database/database.py b/src/fidesctl/api/ctl/database/database.py similarity index 97% rename from src/fidesctl/api/database/database.py rename to src/fidesctl/api/ctl/database/database.py index 4c3b7ab4fe..f739e2e634 100644 --- a/src/fidesctl/api/database/database.py +++ b/src/fidesctl/api/ctl/database/database.py @@ -12,13 +12,13 @@ from sqlalchemy import create_engine from sqlalchemy_utils.functions import create_database, database_exists -from fidesctl.api.sql_models import sql_model_map -from fidesctl.api.utils.errors import ( +from fidesctl.api.ctl.sql_models import sql_model_map +from fidesctl.api.ctl.utils.errors import ( AlreadyExistsError, QueryError, get_full_exception_name, ) -from fidesctl.core.utils import get_db_engine +from fidesctl.ctl.core.utils import get_db_engine from .crud import create_resource, upsert_resources diff --git a/src/fidesctl/api/database/session.py b/src/fidesctl/api/ctl/database/session.py similarity index 91% rename from src/fidesctl/api/database/session.py rename to src/fidesctl/api/ctl/database/session.py index 5e80106faa..524eb59cd0 100644 --- a/src/fidesctl/api/database/session.py +++ b/src/fidesctl/api/ctl/database/session.py @@ -2,7 +2,7 @@ from sqlalchemy.ext.asyncio import AsyncSession, create_async_engine from sqlalchemy.orm import Session, sessionmaker -from fidesctl.core.config import get_config +from fidesctl.ctl.core.config import get_config config = get_config() engine = create_async_engine( diff --git a/src/fidesctl/api/deps.py b/src/fidesctl/api/ctl/deps.py similarity index 93% rename from src/fidesctl/api/deps.py rename to src/fidesctl/api/ctl/deps.py index 478bb002b3..a421b9c61f 100644 --- a/src/fidesctl/api/deps.py +++ b/src/fidesctl/api/ctl/deps.py @@ -15,10 +15,10 @@ from fideslib.oauth.scopes import SCOPES from sqlalchemy.orm import Session -from fidesctl.api.database.session import sync_session -from fidesctl.api.routes.util import API_PREFIX -from fidesctl.api.sql_models import ClientDetail, FidesUser -from fidesctl.core.config import get_config +from fidesctl.api.ctl.database.session import sync_session +from fidesctl.api.ctl.routes.util import API_PREFIX +from fidesctl.api.ctl.sql_models import ClientDetail, FidesUser +from fidesctl.ctl.core.config import get_config oauth2_scheme = OAuth2ClientCredentialsBearer( tokenUrl=(f"{API_PREFIX}/oauth/token"), diff --git a/src/fidesctl/api/migrations/versions/__init__.py b/src/fidesctl/api/ctl/migrations/__init__.py similarity index 100% rename from src/fidesctl/api/migrations/versions/__init__.py rename to src/fidesctl/api/ctl/migrations/__init__.py diff --git a/src/fidesctl/api/migrations/env.py b/src/fidesctl/api/ctl/migrations/env.py similarity index 93% rename from src/fidesctl/api/migrations/env.py rename to src/fidesctl/api/ctl/migrations/env.py index 16eaaccebb..3683140a92 100644 --- a/src/fidesctl/api/migrations/env.py +++ b/src/fidesctl/api/ctl/migrations/env.py @@ -3,8 +3,8 @@ from alembic import context from sqlalchemy import engine_from_config, pool -from fidesctl.api.utils.logger import setup as setup_fidesapi_logger -from fidesctl.core.config import get_config +from fidesctl.api.ctl.utils.logger import setup as setup_fidesapi_logger +from fidesctl.ctl.core.config import get_config # this is the Alembic Config object, which provides # access to the values within the .ini file in use. @@ -24,7 +24,7 @@ # for 'autogenerate' support # from myapp import mymodel # target_metadata = mymodel.Base.metadata -from fidesctl.api.sql_models import Base +from fidesctl.api.ctl.sql_models import Base target_metadata = Base.metadata diff --git a/src/fidesctl/api/migrations/script.py.mako b/src/fidesctl/api/ctl/migrations/script.py.mako similarity index 100% rename from src/fidesctl/api/migrations/script.py.mako rename to src/fidesctl/api/ctl/migrations/script.py.mako diff --git a/src/fidesctl/api/migrations/versions/150f234ef1de_add_fidesctl_meta_to_organization_object.py b/src/fidesctl/api/ctl/migrations/versions/150f234ef1de_add_fidesctl_meta_to_organization_object.py similarity index 100% rename from src/fidesctl/api/migrations/versions/150f234ef1de_add_fidesctl_meta_to_organization_object.py rename to src/fidesctl/api/ctl/migrations/versions/150f234ef1de_add_fidesctl_meta_to_organization_object.py diff --git a/src/fidesctl/api/migrations/versions/155fd8e51d9d_add_fideslib_models.py b/src/fidesctl/api/ctl/migrations/versions/155fd8e51d9d_add_fideslib_models.py similarity index 100% rename from src/fidesctl/api/migrations/versions/155fd8e51d9d_add_fideslib_models.py rename to src/fidesctl/api/ctl/migrations/versions/155fd8e51d9d_add_fideslib_models.py diff --git a/src/fidesctl/api/migrations/versions/1739aa4a4ab7_add_security_policy_link_and_erasure_.py b/src/fidesctl/api/ctl/migrations/versions/1739aa4a4ab7_add_security_policy_link_and_erasure_.py similarity index 100% rename from src/fidesctl/api/migrations/versions/1739aa4a4ab7_add_security_policy_link_and_erasure_.py rename to src/fidesctl/api/ctl/migrations/versions/1739aa4a4ab7_add_security_policy_link_and_erasure_.py diff --git a/src/fidesctl/api/migrations/versions/26934c96ec80_initial_migration.py b/src/fidesctl/api/ctl/migrations/versions/26934c96ec80_initial_migration.py similarity index 100% rename from src/fidesctl/api/migrations/versions/26934c96ec80_initial_migration.py rename to src/fidesctl/api/ctl/migrations/versions/26934c96ec80_initial_migration.py diff --git a/src/fidesctl/api/migrations/versions/312aff72b275_migrate_to_usage_of_evaluation_.py b/src/fidesctl/api/ctl/migrations/versions/312aff72b275_migrate_to_usage_of_evaluation_.py similarity index 100% rename from src/fidesctl/api/migrations/versions/312aff72b275_migrate_to_usage_of_evaluation_.py rename to src/fidesctl/api/ctl/migrations/versions/312aff72b275_migrate_to_usage_of_evaluation_.py diff --git a/src/fidesctl/api/migrations/versions/327cd266f7b3_update_dataset_depth.py b/src/fidesctl/api/ctl/migrations/versions/327cd266f7b3_update_dataset_depth.py similarity index 100% rename from src/fidesctl/api/migrations/versions/327cd266f7b3_update_dataset_depth.py rename to src/fidesctl/api/ctl/migrations/versions/327cd266f7b3_update_dataset_depth.py diff --git a/src/fidesctl/api/migrations/versions/45c7a349db68_remove_qualifier_lists_from_data_set_.py b/src/fidesctl/api/ctl/migrations/versions/45c7a349db68_remove_qualifier_lists_from_data_set_.py similarity index 100% rename from src/fidesctl/api/migrations/versions/45c7a349db68_remove_qualifier_lists_from_data_set_.py rename to src/fidesctl/api/ctl/migrations/versions/45c7a349db68_remove_qualifier_lists_from_data_set_.py diff --git a/src/fidesctl/api/migrations/versions/4c3693c289d0_add_optional_contact_information_for_.py b/src/fidesctl/api/ctl/migrations/versions/4c3693c289d0_add_optional_contact_information_for_.py similarity index 100% rename from src/fidesctl/api/migrations/versions/4c3693c289d0_add_optional_contact_information_for_.py rename to src/fidesctl/api/ctl/migrations/versions/4c3693c289d0_add_optional_contact_information_for_.py diff --git a/src/fidesctl/api/migrations/versions/50b3736634d2_extend_data_use_with_recipients_and_.py b/src/fidesctl/api/ctl/migrations/versions/50b3736634d2_extend_data_use_with_recipients_and_.py similarity index 100% rename from src/fidesctl/api/migrations/versions/50b3736634d2_extend_data_use_with_recipients_and_.py rename to src/fidesctl/api/ctl/migrations/versions/50b3736634d2_extend_data_use_with_recipients_and_.py diff --git a/src/fidesctl/api/migrations/versions/732105cd54e3_update_dataset_field_name.py b/src/fidesctl/api/ctl/migrations/versions/732105cd54e3_update_dataset_field_name.py similarity index 100% rename from src/fidesctl/api/migrations/versions/732105cd54e3_update_dataset_field_name.py rename to src/fidesctl/api/ctl/migrations/versions/732105cd54e3_update_dataset_field_name.py diff --git a/src/fidesctl/api/migrations/versions/7a94527643a1_add_column_for_special_category_to_data_.py b/src/fidesctl/api/ctl/migrations/versions/7a94527643a1_add_column_for_special_category_to_data_.py similarity index 100% rename from src/fidesctl/api/migrations/versions/7a94527643a1_add_column_for_special_category_to_data_.py rename to src/fidesctl/api/ctl/migrations/versions/7a94527643a1_add_column_for_special_category_to_data_.py diff --git a/src/fidesctl/api/migrations/versions/7c851d8a102a_add_created_at_and_updated_at.py b/src/fidesctl/api/ctl/migrations/versions/7c851d8a102a_add_created_at_and_updated_at.py similarity index 96% rename from src/fidesctl/api/migrations/versions/7c851d8a102a_add_created_at_and_updated_at.py rename to src/fidesctl/api/ctl/migrations/versions/7c851d8a102a_add_created_at_and_updated_at.py index 2524d16842..c7c6a0a8ab 100644 --- a/src/fidesctl/api/migrations/versions/7c851d8a102a_add_created_at_and_updated_at.py +++ b/src/fidesctl/api/ctl/migrations/versions/7c851d8a102a_add_created_at_and_updated_at.py @@ -8,7 +8,7 @@ from alembic import op from sqlalchemy import Column, DateTime, text -from fidesctl.api.sql_models import sql_model_map +from fidesctl.api.ctl.sql_models import sql_model_map # revision identifiers, used by Alembic. revision = "7c851d8a102a" diff --git a/src/fidesctl/api/routes/__init__.py b/src/fidesctl/api/ctl/migrations/versions/__init__.py similarity index 100% rename from src/fidesctl/api/routes/__init__.py rename to src/fidesctl/api/ctl/migrations/versions/__init__.py diff --git a/src/fidesctl/api/migrations/versions/a2b9b156ebaf_data_protection_impact_assessments_.py b/src/fidesctl/api/ctl/migrations/versions/a2b9b156ebaf_data_protection_impact_assessments_.py similarity index 100% rename from src/fidesctl/api/migrations/versions/a2b9b156ebaf_data_protection_impact_assessments_.py rename to src/fidesctl/api/ctl/migrations/versions/a2b9b156ebaf_data_protection_impact_assessments_.py diff --git a/src/fidesctl/api/migrations/versions/adad3be6af08_privacy_notice_attributes.py b/src/fidesctl/api/ctl/migrations/versions/adad3be6af08_privacy_notice_attributes.py similarity index 100% rename from src/fidesctl/api/migrations/versions/adad3be6af08_privacy_notice_attributes.py rename to src/fidesctl/api/ctl/migrations/versions/adad3be6af08_privacy_notice_attributes.py diff --git a/src/fidesctl/api/migrations/versions/be432bd23596_add_fidesctl_meta_field_to_dataset.py b/src/fidesctl/api/ctl/migrations/versions/be432bd23596_add_fidesctl_meta_field_to_dataset.py similarity index 100% rename from src/fidesctl/api/migrations/versions/be432bd23596_add_fidesctl_meta_field_to_dataset.py rename to src/fidesctl/api/ctl/migrations/versions/be432bd23596_add_fidesctl_meta_field_to_dataset.py diff --git a/src/fidesctl/api/migrations/versions/d8f8bd52754f_add_tags_as_part_of_fideslang_1_1_0.py b/src/fidesctl/api/ctl/migrations/versions/d8f8bd52754f_add_tags_as_part_of_fideslang_1_1_0.py similarity index 100% rename from src/fidesctl/api/migrations/versions/d8f8bd52754f_add_tags_as_part_of_fideslang_1_1_0.py rename to src/fidesctl/api/ctl/migrations/versions/d8f8bd52754f_add_tags_as_part_of_fideslang_1_1_0.py diff --git a/src/fidesctl/api/migrations/versions/e576b6a80a49_add_parent_key_to_dataqualifier.py b/src/fidesctl/api/ctl/migrations/versions/e576b6a80a49_add_parent_key_to_dataqualifier.py similarity index 100% rename from src/fidesctl/api/migrations/versions/e576b6a80a49_add_parent_key_to_dataqualifier.py rename to src/fidesctl/api/ctl/migrations/versions/e576b6a80a49_add_parent_key_to_dataqualifier.py diff --git a/src/fidesctl/api/migrations/versions/edcd28ede1f7_add_fidesctl_meta_to_system.py b/src/fidesctl/api/ctl/migrations/versions/edcd28ede1f7_add_fidesctl_meta_to_system.py similarity index 100% rename from src/fidesctl/api/migrations/versions/edcd28ede1f7_add_fidesctl_meta_to_system.py rename to src/fidesctl/api/ctl/migrations/versions/edcd28ede1f7_add_fidesctl_meta_to_system.py diff --git a/src/fidesctl/api/migrations/versions/f53e04e5b7f5_merge_heads.py b/src/fidesctl/api/ctl/migrations/versions/f53e04e5b7f5_merge_heads.py similarity index 100% rename from src/fidesctl/api/migrations/versions/f53e04e5b7f5_merge_heads.py rename to src/fidesctl/api/ctl/migrations/versions/f53e04e5b7f5_merge_heads.py diff --git a/src/fidesctl/api/migrations/versions/fdd28c39a679_add_responsibility_role_attribute_for_.py b/src/fidesctl/api/ctl/migrations/versions/fdd28c39a679_add_responsibility_role_attribute_for_.py similarity index 100% rename from src/fidesctl/api/migrations/versions/fdd28c39a679_add_responsibility_role_attribute_for_.py rename to src/fidesctl/api/ctl/migrations/versions/fdd28c39a679_add_responsibility_role_attribute_for_.py diff --git a/src/fidesctl/api/utils/__init__.py b/src/fidesctl/api/ctl/routes/__init__.py similarity index 100% rename from src/fidesctl/api/utils/__init__.py rename to src/fidesctl/api/ctl/routes/__init__.py diff --git a/src/fidesctl/api/routes/admin.py b/src/fidesctl/api/ctl/routes/admin.py similarity index 77% rename from src/fidesctl/api/routes/admin.py rename to src/fidesctl/api/ctl/routes/admin.py index bce17d0d5f..a1f1baa5a2 100644 --- a/src/fidesctl/api/routes/admin.py +++ b/src/fidesctl/api/ctl/routes/admin.py @@ -1,10 +1,10 @@ from enum import Enum from typing import Dict -from fidesctl.api.database import database -from fidesctl.api.routes.util import API_PREFIX -from fidesctl.api.utils.api_router import APIRouter -from fidesctl.core.config import FidesctlConfig, get_config +from fidesctl.api.ctl.database import database +from fidesctl.api.ctl.routes.util import API_PREFIX +from fidesctl.api.ctl.utils.api_router import APIRouter +from fidesctl.ctl.core.config import FidesctlConfig, get_config CONFIG: FidesctlConfig = get_config() router = APIRouter(prefix=API_PREFIX, tags=["Admin"]) diff --git a/src/fidesctl/api/routes/crud.py b/src/fidesctl/api/ctl/routes/crud.py similarity index 95% rename from src/fidesctl/api/routes/crud.py rename to src/fidesctl/api/ctl/routes/crud.py index 5156176a78..36b7609795 100644 --- a/src/fidesctl/api/routes/crud.py +++ b/src/fidesctl/api/ctl/routes/crud.py @@ -11,7 +11,7 @@ from fastapi import Response, status from fideslang import model_map -from fidesctl.api.database.crud import ( +from fidesctl.api.ctl.database.crud import ( create_resource, delete_resource, get_resource, @@ -19,9 +19,9 @@ update_resource, upsert_resources, ) -from fidesctl.api.routes.util import API_PREFIX, get_resource_type -from fidesctl.api.sql_models import sql_model_map -from fidesctl.api.utils.api_router import APIRouter +from fidesctl.api.ctl.routes.util import API_PREFIX, get_resource_type +from fidesctl.api.ctl.sql_models import sql_model_map +from fidesctl.api.ctl.utils.api_router import APIRouter # CRUD Endpoints routers = [] diff --git a/src/fidesctl/api/routes/datamap.py b/src/fidesctl/api/ctl/routes/datamap.py similarity index 92% rename from src/fidesctl/api/routes/datamap.py rename to src/fidesctl/api/ctl/routes/datamap.py index b88967faf5..e013f5495f 100644 --- a/src/fidesctl/api/routes/datamap.py +++ b/src/fidesctl/api/ctl/routes/datamap.py @@ -8,13 +8,13 @@ from loguru import logger as log from pandas import DataFrame -from fidesctl.api.routes.crud import get_resource, list_resource -from fidesctl.api.routes.util import API_PREFIX -from fidesctl.api.sql_models import sql_model_map -from fidesctl.api.utils.api_router import APIRouter -from fidesctl.api.utils.errors import DatabaseUnavailableError, NotFoundError -from fidesctl.core.export import build_joined_dataframe -from fidesctl.core.export_helpers import DATAMAP_COLUMNS +from fidesctl.api.ctl.routes.crud import get_resource, list_resource +from fidesctl.api.ctl.routes.util import API_PREFIX +from fidesctl.api.ctl.sql_models import sql_model_map +from fidesctl.api.ctl.utils.api_router import APIRouter +from fidesctl.api.ctl.utils.errors import DatabaseUnavailableError, NotFoundError +from fidesctl.ctl.core.export import build_joined_dataframe +from fidesctl.ctl.core.export_helpers import DATAMAP_COLUMNS router = APIRouter(tags=["Datamap"], prefix=f"{API_PREFIX}/datamap") diff --git a/src/fidesctl/api/routes/generate.py b/src/fidesctl/api/ctl/routes/generate.py similarity index 93% rename from src/fidesctl/api/routes/generate.py rename to src/fidesctl/api/ctl/routes/generate.py index ca13037e11..caea288e8f 100644 --- a/src/fidesctl/api/routes/generate.py +++ b/src/fidesctl/api/ctl/routes/generate.py @@ -9,24 +9,24 @@ from loguru import logger as log from pydantic import BaseModel, root_validator -from fidesctl.api.routes.crud import get_resource -from fidesctl.api.routes.util import ( +from fidesctl.api.ctl.routes.crud import get_resource +from fidesctl.api.ctl.routes.util import ( API_PREFIX, route_requires_aws_connector, route_requires_bigquery_connector, route_requires_okta_connector, ) -from fidesctl.api.sql_models import sql_model_map -from fidesctl.api.utils.api_router import APIRouter -from fidesctl.connectors.models import ( +from fidesctl.api.ctl.sql_models import sql_model_map +from fidesctl.api.ctl.utils.api_router import APIRouter +from fidesctl.ctl.connectors.models import ( AWSConfig, BigQueryConfig, ConnectorAuthFailureException, DatabaseConfig, OktaConfig, ) -from fidesctl.core.dataset import generate_bigquery_datasets, generate_db_datasets -from fidesctl.core.system import generate_aws_systems, generate_okta_systems +from fidesctl.ctl.core.dataset import generate_bigquery_datasets, generate_db_datasets +from fidesctl.ctl.core.system import generate_aws_systems, generate_okta_systems class ValidTargets(str, Enum): diff --git a/src/fidesctl/api/routes/health.py b/src/fidesctl/api/ctl/routes/health.py similarity index 86% rename from src/fidesctl/api/routes/health.py rename to src/fidesctl/api/ctl/routes/health.py index b14c305773..9cc4784da3 100644 --- a/src/fidesctl/api/routes/health.py +++ b/src/fidesctl/api/ctl/routes/health.py @@ -3,10 +3,10 @@ from fastapi import HTTPException, status import fidesctl -from fidesctl.api.database.database import get_db_health -from fidesctl.api.routes.util import API_PREFIX -from fidesctl.api.utils.api_router import APIRouter -from fidesctl.core.config import FidesctlConfig, get_config +from fidesctl.api.ctl.database.database import get_db_health +from fidesctl.api.ctl.routes.util import API_PREFIX +from fidesctl.api.ctl.utils.api_router import APIRouter +from fidesctl.ctl.core.config import FidesctlConfig, get_config CONFIG: FidesctlConfig = get_config() diff --git a/src/fidesctl/api/routes/user.py b/src/fidesctl/api/ctl/routes/user.py similarity index 92% rename from src/fidesctl/api/routes/user.py rename to src/fidesctl/api/ctl/routes/user.py index b9d60dc88b..d277f25b75 100644 --- a/src/fidesctl/api/routes/user.py +++ b/src/fidesctl/api/ctl/routes/user.py @@ -13,10 +13,10 @@ HTTP_404_NOT_FOUND, ) -from fidesctl.api.deps import get_current_user, get_db, verify_oauth_client -from fidesctl.api.routes.util import API_PREFIX -from fidesctl.api.utils.api_router import APIRouter -from fidesctl.core.config import FidesctlConfig, get_config +from fidesctl.api.ctl.deps import get_current_user, get_db, verify_oauth_client +from fidesctl.api.ctl.routes.util import API_PREFIX +from fidesctl.api.ctl.utils.api_router import APIRouter +from fidesctl.ctl.core.config import FidesctlConfig, get_config router = APIRouter(tags=["Users"], prefix=f"{API_PREFIX}") diff --git a/src/fidesctl/api/routes/util.py b/src/fidesctl/api/ctl/routes/util.py similarity index 89% rename from src/fidesctl/api/routes/util.py rename to src/fidesctl/api/ctl/routes/util.py index 23c720f255..6cb3c9208a 100644 --- a/src/fidesctl/api/routes/util.py +++ b/src/fidesctl/api/ctl/routes/util.py @@ -4,7 +4,7 @@ from fastapi import HTTPException, status -from fidesctl.api.utils.api_router import APIRouter +from fidesctl.api.ctl.utils.api_router import APIRouter API_PREFIX = "/api/v1" WEBAPP_DIRECTORY = Path("src/fidesctl/api/build/static") @@ -31,7 +31,7 @@ def route_requires_aws_connector(func: Callable) -> Callable: def wrapper_func(*args, **kwargs) -> Any: # type: ignore try: - import fidesctl.connectors.aws # pylint: disable=unused-import + import fidesctl.ctl.connectors.aws # pylint: disable=unused-import except ModuleNotFoundError: raise HTTPException( status_code=status.HTTP_400_BAD_REQUEST, @@ -50,7 +50,7 @@ def route_requires_okta_connector(func: Callable) -> Callable: def wrapper_func(*args, **kwargs) -> Any: # type: ignore try: - import fidesctl.connectors.okta # pylint: disable=unused-import + import fidesctl.ctl.connectors.okta # pylint: disable=unused-import except ModuleNotFoundError: raise HTTPException( status_code=status.HTTP_400_BAD_REQUEST, @@ -69,7 +69,7 @@ def route_requires_bigquery_connector(func: Callable) -> Callable: def wrapper_func(*args, **kwargs) -> Any: # type: ignore try: - import fidesctl.connectors.bigquery # pylint: disable=unused-import + import fidesctl.ctl.connectors.bigquery # pylint: disable=unused-import except ModuleNotFoundError: raise HTTPException( status_code=status.HTTP_400_BAD_REQUEST, diff --git a/src/fidesctl/api/routes/validate.py b/src/fidesctl/api/ctl/routes/validate.py similarity index 90% rename from src/fidesctl/api/routes/validate.py rename to src/fidesctl/api/ctl/routes/validate.py index 5b2cd57331..165bda9f4a 100644 --- a/src/fidesctl/api/routes/validate.py +++ b/src/fidesctl/api/ctl/routes/validate.py @@ -7,14 +7,14 @@ from fastapi import Response, status from pydantic import BaseModel -from fidesctl.api.routes.util import ( +from fidesctl.api.ctl.routes.util import ( API_PREFIX, route_requires_aws_connector, route_requires_bigquery_connector, route_requires_okta_connector, ) -from fidesctl.api.utils.api_router import APIRouter -from fidesctl.connectors.models import ( +from fidesctl.api.ctl.utils.api_router import APIRouter +from fidesctl.ctl.connectors.models import ( AWSConfig, BigQueryConfig, ConnectorAuthFailureException, @@ -105,7 +105,7 @@ async def validate_aws(aws_config: AWSConfig) -> None: Validates that given aws credentials are valid. Dependency exception is raised if failure occurs. """ - import fidesctl.connectors.aws as aws_connector + import fidesctl.ctl.connectors.aws as aws_connector aws_connector.validate_credentials(aws_config=aws_config) @@ -116,7 +116,7 @@ async def validate_bigquery(bigquery_config: BigQueryConfig) -> None: Validates that given GCP BigQuery credentials are valid. Dependency exception is raised if failure occurs. """ - import fidesctl.connectors.bigquery as bigquery_connector + import fidesctl.ctl.connectors.bigquery as bigquery_connector bigquery_engine = bigquery_connector.get_bigquery_engine(bigquery_config) bigquery_connector.validate_bigquery_engine(bigquery_engine) @@ -128,6 +128,6 @@ async def validate_okta(okta_config: OktaConfig) -> None: Validates that given okta credentials are valid. Dependency exception is raised if failure occurs. """ - import fidesctl.connectors.okta as okta_connector + import fidesctl.ctl.connectors.okta as okta_connector await okta_connector.validate_credentials(okta_config=okta_config) diff --git a/src/fidesctl/api/routes/visualize.py b/src/fidesctl/api/ctl/routes/visualize.py similarity index 87% rename from src/fidesctl/api/routes/visualize.py rename to src/fidesctl/api/ctl/routes/visualize.py index 0f10087589..c94c5b8cae 100644 --- a/src/fidesctl/api/routes/visualize.py +++ b/src/fidesctl/api/ctl/routes/visualize.py @@ -8,11 +8,11 @@ from fastapi.responses import HTMLResponse from fideslang import model_map -from fidesctl.api.routes.crud import list_resource -from fidesctl.api.routes.util import API_PREFIX, get_resource_type -from fidesctl.api.sql_models import sql_model_map -from fidesctl.api.utils.api_router import APIRouter -from fidesctl.core import visualize +from fidesctl.api.ctl.routes.crud import list_resource +from fidesctl.api.ctl.routes.util import API_PREFIX, get_resource_type +from fidesctl.api.ctl.sql_models import sql_model_map +from fidesctl.api.ctl.utils.api_router import APIRouter +from fidesctl.ctl.core import visualize # pylint: disable=redefined-outer-name,cell-var-from-loop diff --git a/src/fidesctl/api/sql_models.py b/src/fidesctl/api/ctl/sql_models.py similarity index 98% rename from src/fidesctl/api/sql_models.py rename to src/fidesctl/api/ctl/sql_models.py index 3f214a6d00..3127edb78a 100644 --- a/src/fidesctl/api/sql_models.py +++ b/src/fidesctl/api/ctl/sql_models.py @@ -23,7 +23,7 @@ from sqlalchemy.sql import func from sqlalchemy.sql.sqltypes import DateTime -from fidesctl.core.config import FidesctlConfig, get_config +from fidesctl.ctl.core.config import FidesctlConfig, get_config CONFIG: FidesctlConfig = get_config() diff --git a/src/fidesctl/connectors/__init__.py b/src/fidesctl/api/ctl/utils/__init__.py similarity index 100% rename from src/fidesctl/connectors/__init__.py rename to src/fidesctl/api/ctl/utils/__init__.py diff --git a/src/fidesctl/api/utils/api_router.py b/src/fidesctl/api/ctl/utils/api_router.py similarity index 100% rename from src/fidesctl/api/utils/api_router.py rename to src/fidesctl/api/ctl/utils/api_router.py diff --git a/src/fidesctl/api/utils/errors.py b/src/fidesctl/api/ctl/utils/errors.py similarity index 100% rename from src/fidesctl/api/utils/errors.py rename to src/fidesctl/api/ctl/utils/errors.py diff --git a/src/fidesctl/api/utils/logger.py b/src/fidesctl/api/ctl/utils/logger.py similarity index 100% rename from src/fidesctl/api/utils/logger.py rename to src/fidesctl/api/ctl/utils/logger.py diff --git a/src/fidesctl/api/view.py b/src/fidesctl/api/ctl/view.py similarity index 91% rename from src/fidesctl/api/view.py rename to src/fidesctl/api/ctl/view.py index b528d7fe26..7e943243dc 100644 --- a/src/fidesctl/api/view.py +++ b/src/fidesctl/api/ctl/view.py @@ -3,9 +3,9 @@ """ from fastapi.responses import HTMLResponse -from fidesctl.api.routes.crud import list_resource -from fidesctl.api.sql_models import Evaluation -from fidesctl.api.utils.api_router import APIRouter +from fidesctl.api.ctl.routes.crud import list_resource +from fidesctl.api.ctl.sql_models import Evaluation +from fidesctl.api.ctl.utils.api_router import APIRouter router = APIRouter( tags=["View"], diff --git a/src/fidesctl/api/main.py b/src/fidesctl/api/main.py index 8a86b11da0..dc167a8fe4 100644 --- a/src/fidesctl/api/main.py +++ b/src/fidesctl/api/main.py @@ -16,10 +16,10 @@ from loguru import logger as log from uvicorn import Config, Server -from fidesctl.api import view -from fidesctl.api.database.database import configure_db -from fidesctl.api.deps import get_db, verify_oauth_client -from fidesctl.api.routes import ( +from fidesctl.api.ctl import view +from fidesctl.api.ctl.database.database import configure_db +from fidesctl.api.ctl.deps import get_db, verify_oauth_client +from fidesctl.api.ctl.routes import ( admin, crud, datamap, @@ -29,9 +29,9 @@ validate, visualize, ) -from fidesctl.api.routes.util import API_PREFIX, WEBAPP_DIRECTORY, WEBAPP_INDEX -from fidesctl.api.utils.logger import setup as setup_logging -from fidesctl.core.config import FidesctlConfig, get_config +from fidesctl.api.ctl.routes.util import API_PREFIX, WEBAPP_DIRECTORY, WEBAPP_INDEX +from fidesctl.api.ctl.utils.logger import setup as setup_logging +from fidesctl.ctl.core.config import FidesctlConfig, get_config app = FastAPI(title="fidesctl") CONFIG: FidesctlConfig = get_config() diff --git a/src/fidesctl/cli/__init__.py b/src/fidesctl/cli/__init__.py index 2a68caaa0d..20ae324c18 100644 --- a/src/fidesctl/cli/__init__.py +++ b/src/fidesctl/cli/__init__.py @@ -8,7 +8,7 @@ import fidesctl from fidesctl.cli.utils import check_and_update_analytics_config, check_server -from fidesctl.core.config import get_config +from fidesctl.ctl.core.config import get_config from .commands.annotate import annotate from .commands.core import apply, evaluate, parse, pull diff --git a/src/fidesctl/cli/commands/annotate.py b/src/fidesctl/cli/commands/annotate.py index f1ac4f3def..78ed31c73b 100644 --- a/src/fidesctl/cli/commands/annotate.py +++ b/src/fidesctl/cli/commands/annotate.py @@ -3,7 +3,7 @@ import click from fidesctl.cli.utils import with_analytics -from fidesctl.core import annotate_dataset as _annotate_dataset +from fidesctl.ctl.core import annotate_dataset as _annotate_dataset @click.group(name="annotate") diff --git a/src/fidesctl/cli/commands/core.py b/src/fidesctl/cli/commands/core.py index 01ca21d8d5..adc2d7d4ca 100644 --- a/src/fidesctl/cli/commands/core.py +++ b/src/fidesctl/cli/commands/core.py @@ -10,12 +10,12 @@ verbose_flag, ) from fidesctl.cli.utils import echo_red, pretty_echo, print_divider, with_analytics -from fidesctl.core import apply as _apply -from fidesctl.core import audit as _audit -from fidesctl.core import evaluate as _evaluate -from fidesctl.core import parse as _parse -from fidesctl.core import pull as _pull -from fidesctl.core.utils import git_is_dirty +from fidesctl.ctl.core import apply as _apply +from fidesctl.ctl.core import audit as _audit +from fidesctl.ctl.core import evaluate as _evaluate +from fidesctl.ctl.core import parse as _parse +from fidesctl.ctl.core import pull as _pull +from fidesctl.ctl.core.utils import git_is_dirty @click.command() diff --git a/src/fidesctl/cli/commands/crud.py b/src/fidesctl/cli/commands/crud.py index 15d1544ff0..b034c8d0f5 100644 --- a/src/fidesctl/cli/commands/crud.py +++ b/src/fidesctl/cli/commands/crud.py @@ -4,7 +4,7 @@ from fidesctl.cli.options import fides_key_argument, resource_type_argument from fidesctl.cli.utils import handle_cli_response, with_analytics -from fidesctl.core import api as _api +from fidesctl.ctl.core import api as _api @click.command() diff --git a/src/fidesctl/cli/commands/db.py b/src/fidesctl/cli/commands/db.py index c4b218757a..d631d82c12 100644 --- a/src/fidesctl/cli/commands/db.py +++ b/src/fidesctl/cli/commands/db.py @@ -3,8 +3,8 @@ from fidesctl.cli.options import yes_flag from fidesctl.cli.utils import handle_cli_response, with_analytics -from fidesctl.core import api as _api -from fidesctl.core.utils import echo_red +from fidesctl.ctl.core import api as _api +from fidesctl.ctl.core.utils import echo_red @click.group(name="db") diff --git a/src/fidesctl/cli/commands/export.py b/src/fidesctl/cli/commands/export.py index dffd56f780..a9530ab11e 100644 --- a/src/fidesctl/cli/commands/export.py +++ b/src/fidesctl/cli/commands/export.py @@ -8,8 +8,8 @@ output_directory_option, ) from fidesctl.cli.utils import with_analytics -from fidesctl.core import export as _export -from fidesctl.core import parse as _parse +from fidesctl.ctl.core import export as _export +from fidesctl.ctl.core import parse as _parse @click.group(name="export") diff --git a/src/fidesctl/cli/commands/generate.py b/src/fidesctl/cli/commands/generate.py index 1d03aadfde..5341dad533 100644 --- a/src/fidesctl/cli/commands/generate.py +++ b/src/fidesctl/cli/commands/generate.py @@ -19,8 +19,8 @@ handle_okta_credentials_options, with_analytics, ) -from fidesctl.core import dataset as _dataset -from fidesctl.core import system as _system +from fidesctl.ctl.core import dataset as _dataset +from fidesctl.ctl.core import system as _system @click.group(name="generate") diff --git a/src/fidesctl/cli/commands/scan.py b/src/fidesctl/cli/commands/scan.py index 1c34a9febd..1315b62ff5 100644 --- a/src/fidesctl/cli/commands/scan.py +++ b/src/fidesctl/cli/commands/scan.py @@ -20,8 +20,8 @@ handle_okta_credentials_options, with_analytics, ) -from fidesctl.core import dataset as _dataset -from fidesctl.core import system as _system +from fidesctl.ctl.core import dataset as _dataset +from fidesctl.ctl.core import system as _system @click.group(name="scan") diff --git a/src/fidesctl/cli/commands/util.py b/src/fidesctl/cli/commands/util.py index fdfcffb90c..e9e428537e 100644 --- a/src/fidesctl/cli/commands/util.py +++ b/src/fidesctl/cli/commands/util.py @@ -13,7 +13,7 @@ send_init_analytics, with_analytics, ) -from fidesctl.core.utils import echo_green +from fidesctl.ctl.core.utils import echo_green @click.command() diff --git a/src/fidesctl/cli/utils.py b/src/fidesctl/cli/utils.py index e2d46639fa..7ba0406cca 100644 --- a/src/fidesctl/cli/utils.py +++ b/src/fidesctl/cli/utils.py @@ -22,18 +22,18 @@ ) import fidesctl -from fidesctl.api.routes.util import API_PREFIX -from fidesctl.connectors.models import AWSConfig, BigQueryConfig, OktaConfig -from fidesctl.core import api as _api -from fidesctl.core.config import FidesctlConfig -from fidesctl.core.config.credentials_settings import ( +from fidesctl.api.ctl.routes.util import API_PREFIX +from fidesctl.ctl.connectors.models import AWSConfig, BigQueryConfig, OktaConfig +from fidesctl.ctl.core import api as _api +from fidesctl.ctl.core.config import FidesctlConfig +from fidesctl.ctl.core.config.credentials_settings import ( get_config_aws_credentials, get_config_bigquery_credentials, get_config_database_credentials, get_config_okta_credentials, ) -from fidesctl.core.config.utils import get_config_from_file, update_config_file -from fidesctl.core.utils import check_response, echo_green, echo_red +from fidesctl.ctl.core.config.utils import get_config_from_file, update_config_file +from fidesctl.ctl.core.utils import check_response, echo_green, echo_red FIDESCTL_ASCII_ART = """ ███████╗██╗██████╗ ███████╗███████╗ ██████╗████████╗██╗ diff --git a/src/fidesctl/core/__init__.py b/src/fidesctl/ctl/__init__.py similarity index 100% rename from src/fidesctl/core/__init__.py rename to src/fidesctl/ctl/__init__.py diff --git a/tests/api/__init__.py b/src/fidesctl/ctl/connectors/__init__.py similarity index 100% rename from tests/api/__init__.py rename to src/fidesctl/ctl/connectors/__init__.py diff --git a/src/fidesctl/connectors/aws.py b/src/fidesctl/ctl/connectors/aws.py similarity index 99% rename from src/fidesctl/connectors/aws.py rename to src/fidesctl/ctl/connectors/aws.py index 8a87794b6c..115f3f4234 100644 --- a/src/fidesctl/connectors/aws.py +++ b/src/fidesctl/ctl/connectors/aws.py @@ -6,7 +6,7 @@ from botocore.exceptions import ClientError from fideslang.models import System, SystemMetadata -from fidesctl.connectors.models import ( +from fidesctl.ctl.connectors.models import ( AWSConfig, ConnectorAuthFailureException, ConnectorFailureException, diff --git a/src/fidesctl/connectors/bigquery.py b/src/fidesctl/ctl/connectors/bigquery.py similarity index 92% rename from src/fidesctl/connectors/bigquery.py rename to src/fidesctl/ctl/connectors/bigquery.py index 64b2a04d16..9c29032c36 100644 --- a/src/fidesctl/connectors/bigquery.py +++ b/src/fidesctl/ctl/connectors/bigquery.py @@ -3,7 +3,7 @@ from sqlalchemy import create_engine, inspect from sqlalchemy.engine import Engine -from fidesctl.connectors.models import BigQueryConfig, ConnectorFailureException +from fidesctl.ctl.connectors.models import BigQueryConfig, ConnectorFailureException def get_bigquery_engine(bigquery_config: BigQueryConfig) -> Engine: diff --git a/src/fidesctl/connectors/models.py b/src/fidesctl/ctl/connectors/models.py similarity index 100% rename from src/fidesctl/connectors/models.py rename to src/fidesctl/ctl/connectors/models.py diff --git a/src/fidesctl/connectors/okta.py b/src/fidesctl/ctl/connectors/okta.py similarity index 98% rename from src/fidesctl/connectors/okta.py rename to src/fidesctl/ctl/connectors/okta.py index 1cc9b6404d..aebf3066b9 100644 --- a/src/fidesctl/connectors/okta.py +++ b/src/fidesctl/ctl/connectors/okta.py @@ -8,7 +8,7 @@ from okta.exceptions import OktaAPIException from okta.models import Application as OktaApplication -from fidesctl.connectors.models import ( +from fidesctl.ctl.connectors.models import ( ConnectorAuthFailureException, ConnectorFailureException, OktaConfig, diff --git a/tests/cli/__init__.py b/src/fidesctl/ctl/core/__init__.py similarity index 100% rename from tests/cli/__init__.py rename to src/fidesctl/ctl/core/__init__.py diff --git a/src/fidesctl/core/annotate_dataset.py b/src/fidesctl/ctl/core/annotate_dataset.py similarity index 97% rename from src/fidesctl/core/annotate_dataset.py rename to src/fidesctl/ctl/core/annotate_dataset.py index 2d053008e2..7a73fa9d2c 100644 --- a/src/fidesctl/core/annotate_dataset.py +++ b/src/fidesctl/ctl/core/annotate_dataset.py @@ -9,10 +9,10 @@ from fideslang.models import Dataset, DatasetCollection, DatasetField, FidesKey from fideslang.validation import FidesValidationError -from fidesctl.core import api_helpers -from fidesctl.core import parse as core_parse -from fidesctl.core.config import FidesctlConfig -from fidesctl.core.utils import echo_green, get_all_level_fields +from fidesctl.ctl.core import api_helpers +from fidesctl.ctl.core import parse as core_parse +from fidesctl.ctl.core.config import FidesctlConfig +from fidesctl.ctl.core.utils import echo_green, get_all_level_fields class AnnotationAbortError(Exception): diff --git a/src/fidesctl/core/api.py b/src/fidesctl/ctl/core/api.py similarity index 98% rename from src/fidesctl/core/api.py rename to src/fidesctl/ctl/core/api.py index 6c16b18d02..1d1da10a95 100644 --- a/src/fidesctl/core/api.py +++ b/src/fidesctl/ctl/core/api.py @@ -3,7 +3,7 @@ import requests -from fidesctl.api.routes.util import API_PREFIX +from fidesctl.api.ctl.routes.util import API_PREFIX def generate_resource_url( diff --git a/src/fidesctl/core/api_helpers.py b/src/fidesctl/ctl/core/api_helpers.py similarity index 98% rename from src/fidesctl/core/api_helpers.py rename to src/fidesctl/ctl/core/api_helpers.py index 4c9b258f72..6fabcbd2a8 100644 --- a/src/fidesctl/core/api_helpers.py +++ b/src/fidesctl/ctl/core/api_helpers.py @@ -9,7 +9,7 @@ from fideslang.validation import FidesKey from requests import Response -from fidesctl.core import api +from fidesctl.ctl.core import api def get_server_resources( diff --git a/src/fidesctl/core/apply.py b/src/fidesctl/ctl/core/apply.py similarity index 96% rename from src/fidesctl/core/apply.py rename to src/fidesctl/ctl/core/apply.py index 4820348386..5e220495d1 100644 --- a/src/fidesctl/core/apply.py +++ b/src/fidesctl/ctl/core/apply.py @@ -7,9 +7,9 @@ from fideslang import FidesModel, Taxonomy from fidesctl.cli.utils import handle_cli_response -from fidesctl.core import api -from fidesctl.core.api_helpers import get_server_resources -from fidesctl.core.utils import echo_green, echo_red +from fidesctl.ctl.core import api +from fidesctl.ctl.core.api_helpers import get_server_resources +from fidesctl.ctl.core.utils import echo_green, echo_red def sort_create_update( diff --git a/src/fidesctl/core/audit.py b/src/fidesctl/ctl/core/audit.py similarity index 98% rename from src/fidesctl/core/audit.py rename to src/fidesctl/ctl/core/audit.py index 6670fd33b2..53b95cb036 100644 --- a/src/fidesctl/core/audit.py +++ b/src/fidesctl/ctl/core/audit.py @@ -3,12 +3,12 @@ from fideslang.models import DataSubject, DataUse, Organization, System from fidesctl.cli.utils import pretty_echo -from fidesctl.core.api_helpers import ( +from fidesctl.ctl.core.api_helpers import ( get_server_resource, get_server_resources, list_server_resources, ) -from fidesctl.core.utils import echo_green, echo_red +from fidesctl.ctl.core.utils import echo_green, echo_red def audit_systems( diff --git a/src/fidesctl/core/config/__init__.py b/src/fidesctl/ctl/core/config/__init__.py similarity index 98% rename from src/fidesctl/core/config/__init__.py rename to src/fidesctl/ctl/core/config/__init__.py index 136155de82..209a3f1a8d 100644 --- a/src/fidesctl/core/config/__init__.py +++ b/src/fidesctl/ctl/core/config/__init__.py @@ -9,7 +9,7 @@ from fideslib.core.config import load_toml from pydantic import BaseModel -from fidesctl.core.utils import echo_red +from fidesctl.ctl.core.utils import echo_red from .cli_settings import FidesctlCLISettings from .credentials_settings import merge_credentials_environment diff --git a/src/fidesctl/core/config/cli_settings.py b/src/fidesctl/ctl/core/config/cli_settings.py similarity index 100% rename from src/fidesctl/core/config/cli_settings.py rename to src/fidesctl/ctl/core/config/cli_settings.py diff --git a/src/fidesctl/core/config/credentials_settings.py b/src/fidesctl/ctl/core/config/credentials_settings.py similarity index 98% rename from src/fidesctl/core/config/credentials_settings.py rename to src/fidesctl/ctl/core/config/credentials_settings.py index af7d905af2..344493b861 100644 --- a/src/fidesctl/core/config/credentials_settings.py +++ b/src/fidesctl/ctl/core/config/credentials_settings.py @@ -4,7 +4,7 @@ import os from typing import Dict, Optional -from fidesctl.connectors.models import ( +from fidesctl.ctl.connectors.models import ( AWSConfig, BigQueryConfig, DatabaseConfig, diff --git a/src/fidesctl/core/config/database_settings.py b/src/fidesctl/ctl/core/config/database_settings.py similarity index 100% rename from src/fidesctl/core/config/database_settings.py rename to src/fidesctl/ctl/core/config/database_settings.py diff --git a/src/fidesctl/core/config/fides_settings.py b/src/fidesctl/ctl/core/config/fides_settings.py similarity index 100% rename from src/fidesctl/core/config/fides_settings.py rename to src/fidesctl/ctl/core/config/fides_settings.py diff --git a/src/fidesctl/core/config/logging_settings.py b/src/fidesctl/ctl/core/config/logging_settings.py similarity index 100% rename from src/fidesctl/core/config/logging_settings.py rename to src/fidesctl/ctl/core/config/logging_settings.py diff --git a/src/fidesctl/core/config/security_settings.py b/src/fidesctl/ctl/core/config/security_settings.py similarity index 100% rename from src/fidesctl/core/config/security_settings.py rename to src/fidesctl/ctl/core/config/security_settings.py diff --git a/src/fidesctl/core/config/user_settings.py b/src/fidesctl/ctl/core/config/user_settings.py similarity index 93% rename from src/fidesctl/core/config/user_settings.py rename to src/fidesctl/ctl/core/config/user_settings.py index 262fb1f282..e950b56edf 100644 --- a/src/fidesctl/core/config/user_settings.py +++ b/src/fidesctl/ctl/core/config/user_settings.py @@ -6,7 +6,7 @@ from pydantic import BaseModel, validator -from fidesctl.core.utils import generate_request_headers +from fidesctl.ctl.core.utils import generate_request_headers from .fides_settings import FidesSettings diff --git a/src/fidesctl/core/config/utils.py b/src/fidesctl/ctl/core/config/utils.py similarity index 97% rename from src/fidesctl/core/config/utils.py rename to src/fidesctl/ctl/core/config/utils.py index 01e69809e6..6a459a1800 100644 --- a/src/fidesctl/core/config/utils.py +++ b/src/fidesctl/ctl/core/config/utils.py @@ -4,7 +4,7 @@ from fideslib.core.config import load_file from toml import dump, load -from fidesctl.core.config import DEFAULT_CONFIG_PATH +from fidesctl.ctl.core.config import DEFAULT_CONFIG_PATH def get_config_from_file( diff --git a/src/fidesctl/core/dataset.py b/src/fidesctl/ctl/core/dataset.py similarity index 97% rename from src/fidesctl/core/dataset.py rename to src/fidesctl/ctl/core/dataset.py index 065077faa8..cb3368ab2f 100644 --- a/src/fidesctl/core/dataset.py +++ b/src/fidesctl/ctl/core/dataset.py @@ -7,10 +7,10 @@ from pydantic import AnyHttpUrl from sqlalchemy.engine import Engine -from fidesctl.connectors.bigquery import get_bigquery_engine -from fidesctl.connectors.models import BigQueryConfig -from fidesctl.core.api_helpers import list_server_resources -from fidesctl.core.parse import parse +from fidesctl.ctl.connectors.bigquery import get_bigquery_engine +from fidesctl.ctl.connectors.models import BigQueryConfig +from fidesctl.ctl.core.api_helpers import list_server_resources +from fidesctl.ctl.core.parse import parse from .utils import check_fides_key, echo_green, echo_red, get_db_engine diff --git a/src/fidesctl/core/evaluate.py b/src/fidesctl/ctl/core/evaluate.py similarity index 98% rename from src/fidesctl/core/evaluate.py rename to src/fidesctl/ctl/core/evaluate.py index e3d53e9c63..e6a473cd2d 100644 --- a/src/fidesctl/core/evaluate.py +++ b/src/fidesctl/ctl/core/evaluate.py @@ -22,10 +22,10 @@ from pydantic import AnyHttpUrl from fidesctl.cli.utils import handle_cli_response, pretty_echo -from fidesctl.core import api -from fidesctl.core.api_helpers import get_server_resource, get_server_resources -from fidesctl.core.parse import parse -from fidesctl.core.utils import echo_green, echo_red, get_all_level_fields +from fidesctl.ctl.core import api +from fidesctl.ctl.core.api_helpers import get_server_resource, get_server_resources +from fidesctl.ctl.core.parse import parse +from fidesctl.ctl.core.utils import echo_green, echo_red, get_all_level_fields def get_evaluation_policies( diff --git a/src/fidesctl/core/export.py b/src/fidesctl/ctl/core/export.py similarity index 99% rename from src/fidesctl/core/export.py rename to src/fidesctl/ctl/core/export.py index 9e45cf07d2..921452a5da 100644 --- a/src/fidesctl/core/export.py +++ b/src/fidesctl/ctl/core/export.py @@ -7,12 +7,12 @@ import pandas as pd from fideslang.models import ContactDetails -from fidesctl.core.api_helpers import ( +from fidesctl.ctl.core.api_helpers import ( get_server_resource, get_server_resources, list_server_resources, ) -from fidesctl.core.export_helpers import ( +from fidesctl.ctl.core.export_helpers import ( convert_tuple_to_string, export_datamap_to_excel, export_to_csv, @@ -22,7 +22,7 @@ get_formatted_data_protection_impact_assessment, union_data_categories_in_joined_dataframe, ) -from fidesctl.core.utils import echo_green, get_all_level_fields +from fidesctl.ctl.core.utils import echo_green, get_all_level_fields def generate_dataset_records( diff --git a/src/fidesctl/core/export_helpers.py b/src/fidesctl/ctl/core/export_helpers.py similarity index 99% rename from src/fidesctl/core/export_helpers.py rename to src/fidesctl/ctl/core/export_helpers.py index 1219361570..dea67faff0 100644 --- a/src/fidesctl/core/export_helpers.py +++ b/src/fidesctl/ctl/core/export_helpers.py @@ -9,7 +9,7 @@ DATAMAP_TEMPLATE = join( dirname(__file__), - "../templates", + "../../templates", "fides_datamap_template.xlsx", ) diff --git a/src/fidesctl/core/filters.py b/src/fidesctl/ctl/core/filters.py similarity index 100% rename from src/fidesctl/core/filters.py rename to src/fidesctl/ctl/core/filters.py diff --git a/src/fidesctl/core/parse.py b/src/fidesctl/ctl/core/parse.py similarity index 92% rename from src/fidesctl/core/parse.py rename to src/fidesctl/ctl/core/parse.py index 77e06b7356..6d8a3cf7b2 100644 --- a/src/fidesctl/core/parse.py +++ b/src/fidesctl/ctl/core/parse.py @@ -3,7 +3,7 @@ from fideslang.manifests import ingest_manifests from fideslang.parse import load_manifests_into_taxonomy -from fidesctl.core.utils import echo_green +from fidesctl.ctl.core.utils import echo_green def parse(manifests_dir: str) -> Taxonomy: diff --git a/src/fidesctl/core/pull.py b/src/fidesctl/ctl/core/pull.py similarity index 96% rename from src/fidesctl/core/pull.py rename to src/fidesctl/ctl/core/pull.py index e09a029d57..017b024596 100644 --- a/src/fidesctl/core/pull.py +++ b/src/fidesctl/ctl/core/pull.py @@ -5,8 +5,8 @@ from fideslang.manifests import load_yaml_into_dict from fidesctl.cli.utils import echo_green, print_divider -from fidesctl.core.api_helpers import get_server_resource, list_server_resources -from fidesctl.core.utils import get_manifest_list +from fidesctl.ctl.core.api_helpers import get_server_resource, list_server_resources +from fidesctl.ctl.core.utils import get_manifest_list def write_manifest_file(manifest_path: str, manifest: Dict) -> None: diff --git a/src/fidesctl/core/system.py b/src/fidesctl/ctl/core/system.py similarity index 96% rename from src/fidesctl/core/system.py rename to src/fidesctl/ctl/core/system.py index 6a2edf9550..3810698263 100644 --- a/src/fidesctl/core/system.py +++ b/src/fidesctl/ctl/core/system.py @@ -8,10 +8,10 @@ from pydantic import AnyHttpUrl from fidesctl.cli.utils import handle_cli_response -from fidesctl.connectors.models import AWSConfig, OktaConfig -from fidesctl.core import api -from fidesctl.core.api_helpers import get_server_resource, get_server_resources -from fidesctl.core.parse import parse +from fidesctl.ctl.connectors.models import AWSConfig, OktaConfig +from fidesctl.ctl.core import api +from fidesctl.ctl.core.api_helpers import get_server_resource, get_server_resources +from fidesctl.ctl.core.parse import parse from .filters import filter_aws_systems from .utils import echo_green, echo_red @@ -23,7 +23,7 @@ def generate_redshift_systems( """ Fetches Redshift clusters from AWS and returns the transformed Sytem representations. """ - import fidesctl.connectors.aws as aws_connector + import fidesctl.ctl.connectors.aws as aws_connector client = aws_connector.get_aws_client(service="redshift", aws_config=aws_config) describe_clusters = aws_connector.describe_redshift_clusters(client=client) @@ -39,7 +39,7 @@ def generate_rds_systems( """ Fetches RDS clusters and instances from AWS and returns the transformed Sytem representations. """ - import fidesctl.connectors.aws as aws_connector + import fidesctl.ctl.connectors.aws as aws_connector client = aws_connector.get_aws_client(service="rds", aws_config=aws_config) describe_clusters = aws_connector.describe_rds_clusters(client=client) @@ -162,7 +162,7 @@ async def generate_okta_systems( applications and returns the corresponding systems. """ - import fidesctl.connectors.okta as okta_connector + import fidesctl.ctl.connectors.okta as okta_connector okta_client = okta_connector.get_okta_client(okta_config) okta_applications = await okta_connector.list_okta_applications( @@ -433,7 +433,7 @@ def scan_system_okta( def _check_okta_connector_import() -> None: "Validate okta can be imported" try: - import fidesctl.connectors.okta # pylint: disable=unused-import + import fidesctl.ctl.connectors.okta # pylint: disable=unused-import except ModuleNotFoundError: echo_red('Packages not found, try: pip install "fidesctl[okta]"') raise SystemExit @@ -442,7 +442,7 @@ def _check_okta_connector_import() -> None: def _check_aws_connector_import() -> None: "Validates boto3 is installed and can be imported" try: - import fidesctl.connectors.aws # pylint: disable=unused-import + import fidesctl.ctl.connectors.aws # pylint: disable=unused-import except ModuleNotFoundError: echo_red('Packages not found, try: pip install "fidesctl[aws]"') raise SystemExit diff --git a/src/fidesctl/core/utils.py b/src/fidesctl/ctl/core/utils.py similarity index 100% rename from src/fidesctl/core/utils.py rename to src/fidesctl/ctl/core/utils.py diff --git a/src/fidesctl/core/visualize.py b/src/fidesctl/ctl/core/visualize.py similarity index 100% rename from src/fidesctl/core/visualize.py rename to src/fidesctl/ctl/core/visualize.py diff --git a/tests/connectors/__init__.py b/tests/ctl/__init__.py similarity index 100% rename from tests/connectors/__init__.py rename to tests/ctl/__init__.py diff --git a/tests/core/__init__.py b/tests/ctl/api/__init__.py similarity index 100% rename from tests/core/__init__.py rename to tests/ctl/api/__init__.py diff --git a/tests/api/test_datamap.py b/tests/ctl/api/test_datamap.py similarity index 87% rename from tests/api/test_datamap.py rename to tests/ctl/api/test_datamap.py index e2e02a58a6..e8fecdaa9b 100644 --- a/tests/api/test_datamap.py +++ b/tests/ctl/api/test_datamap.py @@ -2,8 +2,8 @@ import pytest from starlette.testclient import TestClient -from fidesctl.api.routes.util import API_PREFIX -from fidesctl.core.config import FidesctlConfig +from fidesctl.api.ctl.routes.util import API_PREFIX +from fidesctl.ctl.core.config import FidesctlConfig @pytest.mark.integration diff --git a/tests/api/test_generate.py b/tests/ctl/api/test_generate.py similarity index 91% rename from tests/api/test_generate.py rename to tests/ctl/api/test_generate.py index 145e5dffa7..dca6cd4152 100644 --- a/tests/api/test_generate.py +++ b/tests/ctl/api/test_generate.py @@ -6,9 +6,9 @@ import pytest from starlette.testclient import TestClient -from fidesctl.api.routes.generate import GenerateResponse -from fidesctl.api.routes.util import API_PREFIX -from fidesctl.core.config import FidesctlConfig +from fidesctl.api.ctl.routes.generate import GenerateResponse +from fidesctl.api.ctl.routes.util import API_PREFIX +from fidesctl.ctl.core.config import FidesctlConfig EXTERNAL_CONFIG_BODY = { "aws": { diff --git a/tests/api/test_user_endpoints.py b/tests/ctl/api/test_user_endpoints.py similarity index 98% rename from tests/api/test_user_endpoints.py rename to tests/ctl/api/test_user_endpoints.py index 6be561785a..e7693a39b9 100644 --- a/tests/api/test_user_endpoints.py +++ b/tests/ctl/api/test_user_endpoints.py @@ -38,10 +38,10 @@ ) from starlette.testclient import TestClient -from fidesctl.api.routes.util import API_PREFIX -from fidesctl.api.sql_models import ClientDetail, FidesUser, FidesUserPermissions -from fidesctl.core.config import FidesctlConfig -from tests.conftest import generate_auth_header_for_user +from fidesctl.api.ctl.routes.util import API_PREFIX +from fidesctl.api.ctl.sql_models import ClientDetail, FidesUser, FidesUserPermissions +from fidesctl.ctl.core.config import FidesctlConfig +from tests.ctl.conftest import generate_auth_header_for_user URL = f"{API_PREFIX}{USERS}" LOGIN_URL = f"{API_PREFIX}{LOGIN}" diff --git a/tests/api/test_validate.py b/tests/ctl/api/test_validate.py similarity index 95% rename from tests/api/test_validate.py rename to tests/ctl/api/test_validate.py index b998745854..bf25cfc06a 100644 --- a/tests/api/test_validate.py +++ b/tests/ctl/api/test_validate.py @@ -6,9 +6,9 @@ import pytest from starlette.testclient import TestClient -from fidesctl.api.routes.util import API_PREFIX -from fidesctl.api.routes.validate import ValidateResponse -from fidesctl.core.config import FidesctlConfig +from fidesctl.api.ctl.routes.util import API_PREFIX +from fidesctl.api.ctl.routes.validate import ValidateResponse +from fidesctl.ctl.core.config import FidesctlConfig EXTERNAL_CONFIG_BODY = { "aws": { diff --git a/tests/ctl/cli/__init__.py b/tests/ctl/cli/__init__.py new file mode 100644 index 0000000000..e69de29bb2 diff --git a/tests/cli/test_cli.py b/tests/ctl/cli/test_cli.py similarity index 97% rename from tests/cli/test_cli.py rename to tests/ctl/cli/test_cli.py index bab98da6bb..7903d7ab90 100644 --- a/tests/cli/test_cli.py +++ b/tests/ctl/cli/test_cli.py @@ -187,7 +187,7 @@ def test_evaluate_with_declaration_pass( "-f", test_config_path, "evaluate", - "tests/data/passing_declaration_taxonomy.yml", + "tests/ctl/data/passing_declaration_taxonomy.yml", ], ) print(result.output) @@ -217,7 +217,7 @@ def test_local_evaluate( "-f", test_invalid_config_path, "evaluate", - "tests/data/passing_declaration_taxonomy.yml", + "tests/ctl/data/passing_declaration_taxonomy.yml", ], ) print(result.output) @@ -254,7 +254,7 @@ def test_evaluate_with_key_pass( "evaluate", "-k", "primary_privacy_policy", - "tests/data/passing_declaration_taxonomy.yml", + "tests/ctl/data/passing_declaration_taxonomy.yml", ], ) print(result.output) @@ -271,7 +271,7 @@ def test_evaluate_with_declaration_failed( "-f", test_config_path, "evaluate", - "tests/data/failing_declaration_taxonomy.yml", + "tests/ctl/data/failing_declaration_taxonomy.yml", ], ) print(result.output) @@ -284,7 +284,12 @@ def test_evaluate_with_dataset_failed( ) -> None: result = test_cli_runner.invoke( cli, - ["-f", test_config_path, "evaluate", "tests/data/failing_dataset_taxonomy.yml"], + [ + "-f", + test_config_path, + "evaluate", + "tests/ctl/data/failing_dataset_taxonomy.yml", + ], ) print(result.output) assert result.exit_code == 1 @@ -300,7 +305,7 @@ def test_evaluate_with_dataset_field_failed( "-f", test_config_path, "evaluate", - "tests/data/failing_dataset_collection_taxonomy.yml", + "tests/ctl/data/failing_dataset_collection_taxonomy.yml", ], ) print(result.output) @@ -317,7 +322,7 @@ def test_evaluate_with_dataset_collection_failed( "-f", test_config_path, "evaluate", - "tests/data/failing_dataset_field_taxonomy.yml", + "tests/ctl/data/failing_dataset_field_taxonomy.yml", ], ) print(result.output) @@ -365,7 +370,7 @@ def test_nested_field_fails_evaluation( "-f", test_config_path, "evaluate", - "tests/data/failing_nested_dataset.yml", + "tests/ctl/data/failing_nested_dataset.yml", ], ) print(result.output) diff --git a/tests/cli/test_cli_utils.py b/tests/ctl/cli/test_cli_utils.py similarity index 99% rename from tests/cli/test_cli_utils.py rename to tests/ctl/cli/test_cli_utils.py index c4b1ca5e88..c3f4520d6d 100644 --- a/tests/cli/test_cli_utils.py +++ b/tests/ctl/cli/test_cli_utils.py @@ -4,8 +4,8 @@ from requests_mock import Mocker import fidesctl.cli.utils as utils -from fidesctl.api.routes.util import API_PREFIX -from fidesctl.core.config import FidesctlConfig +from fidesctl.api.ctl.routes.util import API_PREFIX +from fidesctl.ctl.core.config import FidesctlConfig @pytest.mark.unit diff --git a/tests/conftest.py b/tests/ctl/conftest.py similarity index 97% rename from tests/conftest.py rename to tests/ctl/conftest.py index 38d5bfa952..67b15cd30b 100644 --- a/tests/conftest.py +++ b/tests/ctl/conftest.py @@ -26,13 +26,13 @@ from starlette.testclient import TestClient from fidesctl.api import main -from fidesctl.api.database.session import sync_session -from fidesctl.api.sql_models import FidesUser, FidesUserPermissions -from fidesctl.core import api -from fidesctl.core.config import FidesctlConfig, get_config +from fidesctl.api.ctl.database.session import sync_session +from fidesctl.api.ctl.sql_models import FidesUser, FidesUserPermissions +from fidesctl.ctl.core import api +from fidesctl.ctl.core.config import FidesctlConfig, get_config -TEST_CONFIG_PATH = "tests/test_config.toml" -TEST_INVALID_CONFIG_PATH = "tests/test_invalid_config.toml" +TEST_CONFIG_PATH = "tests/ctl/test_config.toml" +TEST_INVALID_CONFIG_PATH = "tests/ctl/test_invalid_config.toml" @pytest.fixture(scope="session") diff --git a/tests/ctl/connectors/__init__.py b/tests/ctl/connectors/__init__.py new file mode 100644 index 0000000000..e69de29bb2 diff --git a/tests/connectors/test_aws.py b/tests/ctl/connectors/test_aws.py similarity index 97% rename from tests/connectors/test_aws.py rename to tests/ctl/connectors/test_aws.py index ea13a53a54..cbec92a2ce 100644 --- a/tests/connectors/test_aws.py +++ b/tests/ctl/connectors/test_aws.py @@ -6,9 +6,9 @@ from fideslang.models import System, SystemMetadata from py._path.local import LocalPath -import fidesctl.connectors.aws as aws_connector -from fidesctl.connectors.models import AWSConfig -from fidesctl.core.config import FidesctlConfig +import fidesctl.ctl.connectors.aws as aws_connector +from fidesctl.ctl.connectors.models import AWSConfig +from fidesctl.ctl.core.config import FidesctlConfig @pytest.fixture() diff --git a/tests/connectors/test_okta.py b/tests/ctl/connectors/test_okta.py similarity index 95% rename from tests/connectors/test_okta.py rename to tests/ctl/connectors/test_okta.py index 33c98d4adb..427f143e39 100644 --- a/tests/connectors/test_okta.py +++ b/tests/ctl/connectors/test_okta.py @@ -7,9 +7,9 @@ from okta.models import Application as OktaApplication from py._path.local import LocalPath -import fidesctl.connectors.okta as okta_connector -from fidesctl.connectors.models import OktaConfig -from fidesctl.core.config import FidesctlConfig +import fidesctl.ctl.connectors.okta as okta_connector +from fidesctl.ctl.connectors.models import OktaConfig +from fidesctl.ctl.core.config import FidesctlConfig @pytest.fixture() diff --git a/tests/ctl/core/__init__.py b/tests/ctl/core/__init__.py new file mode 100644 index 0000000000..e69de29bb2 diff --git a/tests/core/config/test_credentials_settings.py b/tests/ctl/core/config/test_credentials_settings.py similarity index 97% rename from tests/core/config/test_credentials_settings.py rename to tests/ctl/core/config/test_credentials_settings.py index eea499d01e..75a606b97f 100644 --- a/tests/core/config/test_credentials_settings.py +++ b/tests/ctl/core/config/test_credentials_settings.py @@ -5,7 +5,7 @@ import pytest -from fidesctl.core.config.credentials_settings import merge_credentials_environment +from fidesctl.ctl.core.config.credentials_settings import merge_credentials_environment @pytest.mark.unit diff --git a/tests/core/test_api.py b/tests/ctl/core/test_api.py similarity index 97% rename from tests/core/test_api.py rename to tests/ctl/core/test_api.py index 95b438a8f3..d16ad0ffc9 100644 --- a/tests/core/test_api.py +++ b/tests/ctl/core/test_api.py @@ -9,10 +9,10 @@ from pytest import MonkeyPatch from starlette.testclient import TestClient -from fidesctl.api.routes import health -from fidesctl.api.routes.util import API_PREFIX -from fidesctl.core import api as _api -from fidesctl.core.config import FidesctlConfig +from fidesctl.api.ctl.routes import health +from fidesctl.api.ctl.routes.util import API_PREFIX +from fidesctl.ctl.core import api as _api +from fidesctl.ctl.core.config import FidesctlConfig # Helper Functions diff --git a/tests/core/test_api_helpers.py b/tests/ctl/core/test_api_helpers.py similarity index 97% rename from tests/core/test_api_helpers.py rename to tests/ctl/core/test_api_helpers.py index 3e0717e400..bfb4897e0e 100644 --- a/tests/core/test_api_helpers.py +++ b/tests/ctl/core/test_api_helpers.py @@ -5,9 +5,9 @@ import pytest from fideslang import FidesModel, model_list -from fidesctl.core import api as _api -from fidesctl.core import api_helpers as _api_helpers -from fidesctl.core.config import FidesctlConfig +from fidesctl.ctl.core import api as _api +from fidesctl.ctl.core import api_helpers as _api_helpers +from fidesctl.ctl.core.config import FidesctlConfig RESOURCE_CREATION_COUNT = 5 # These resources have tricky validation so the fides_key replacement doesn't work diff --git a/tests/core/test_apply.py b/tests/ctl/core/test_apply.py similarity index 98% rename from tests/core/test_apply.py rename to tests/ctl/core/test_apply.py index 7430dddd85..f2ea43f071 100644 --- a/tests/core/test_apply.py +++ b/tests/ctl/core/test_apply.py @@ -5,7 +5,7 @@ import fideslang as models import pytest -from fidesctl.core.apply import get_orphan_datasets, sort_create_update +from fidesctl.ctl.core.apply import get_orphan_datasets, sort_create_update # Helpers diff --git a/tests/core/test_audit.py b/tests/ctl/core/test_audit.py similarity index 98% rename from tests/core/test_audit.py rename to tests/ctl/core/test_audit.py index 09e01e413f..a382a3b558 100644 --- a/tests/core/test_audit.py +++ b/tests/ctl/core/test_audit.py @@ -10,7 +10,7 @@ Organization, ) -from fidesctl.core import audit +from fidesctl.ctl.core import audit @pytest.fixture diff --git a/tests/core/test_config.py b/tests/ctl/core/test_config.py similarity index 95% rename from tests/core/test_config.py rename to tests/ctl/core/test_config.py index 05b9d50e4f..cc8b7ce001 100644 --- a/tests/core/test_config.py +++ b/tests/ctl/core/test_config.py @@ -4,8 +4,8 @@ import pytest -from fidesctl.core.config import get_config -from fidesctl.core.config.database_settings import FidesctlDatabaseSettings +from fidesctl.ctl.core.config import get_config +from fidesctl.ctl.core.config.database_settings import FidesctlDatabaseSettings # Unit @@ -17,7 +17,7 @@ @pytest.mark.unit def test_get_config() -> None: """Test that the actual config matches what the function returns.""" - config = get_config("tests/test_config.toml") + config = get_config("tests/ctl/test_config.toml") assert config.user.user_id == "1" assert config.user.api_key == "test_api_key" assert config.cli.server_url == "http://fidesctl:8080" diff --git a/tests/core/test_config_utils.py b/tests/ctl/core/test_config_utils.py similarity index 92% rename from tests/core/test_config_utils.py rename to tests/ctl/core/test_config_utils.py index 4b20361ace..498c770ccc 100644 --- a/tests/core/test_config_utils.py +++ b/tests/ctl/core/test_config_utils.py @@ -6,8 +6,8 @@ from py._path.local import LocalPath from toml import dump, load -from fidesctl.core.config import FidesctlConfig -from fidesctl.core.config.utils import update_config_file +from fidesctl.ctl.core.config import FidesctlConfig +from fidesctl.ctl.core.config.utils import update_config_file @pytest.fixture diff --git a/tests/core/test_dataset.py b/tests/ctl/core/test_dataset.py similarity index 96% rename from tests/core/test_dataset.py rename to tests/ctl/core/test_dataset.py index afc27009c9..cf69271fd4 100644 --- a/tests/core/test_dataset.py +++ b/tests/ctl/core/test_dataset.py @@ -9,9 +9,9 @@ from fideslang.models import Dataset, DatasetCollection, DatasetField from py._path.local import LocalPath -from fidesctl.core import api -from fidesctl.core import dataset as _dataset -from fidesctl.core.config import FidesctlConfig +from fidesctl.ctl.core import api +from fidesctl.ctl.core import dataset as _dataset +from fidesctl.ctl.core.config import FidesctlConfig def create_server_datasets( @@ -264,7 +264,7 @@ def test_unsupported_dialect_error() -> None: "postgresql": { "url": POSTGRES_URL, "setup_url": POSTGRES_URL, - "init_script_path": "tests/data/example_sql/postgres_example.sql", + "init_script_path": "tests/ctl/data/example_sql/postgres_example.sql", "is_external": False, "expected_collection": { "public": { @@ -276,7 +276,7 @@ def test_unsupported_dialect_error() -> None: "mysql": { "url": MYSQL_URL, "setup_url": MYSQL_URL, - "init_script_path": "tests/data/example_sql/mysql_example.sql", + "init_script_path": "tests/ctl/data/example_sql/mysql_example.sql", "is_external": False, "expected_collection": { "mysql_example": { @@ -288,7 +288,7 @@ def test_unsupported_dialect_error() -> None: "mssql": { "url": MSSQL_URL, "setup_url": MASTER_MSSQL_URL, - "init_script_path": "tests/data/example_sql/sqlserver_example.sql", + "init_script_path": "tests/ctl/data/example_sql/sqlserver_example.sql", "is_external": False, "expected_collection": { "dbo": { @@ -300,7 +300,7 @@ def test_unsupported_dialect_error() -> None: "snowflake": { "url": SNOWFLAKE_URL, "setup_url": SNOWFLAKE_URL, - "init_script_path": "tests/data/example_sql/snowflake_example.sql", + "init_script_path": "tests/ctl/data/example_sql/snowflake_example.sql", "is_external": True, "expected_collection": { "public": { @@ -312,7 +312,7 @@ def test_unsupported_dialect_error() -> None: "redshift": { "url": REDSHIFT_URL, "setup_url": REDSHIFT_URL, - "init_script_path": "tests/data/example_sql/redshift_example.sql", + "init_script_path": "tests/ctl/data/example_sql/redshift_example.sql", "is_external": True, "expected_collection": { "public": { diff --git a/tests/core/test_evaluate.py b/tests/ctl/core/test_evaluate.py similarity index 97% rename from tests/core/test_evaluate.py rename to tests/ctl/core/test_evaluate.py index d2087d3f32..4de4f4ca57 100644 --- a/tests/core/test_evaluate.py +++ b/tests/ctl/core/test_evaluate.py @@ -18,8 +18,8 @@ Taxonomy, ) -from fidesctl.core import evaluate -from fidesctl.core.config import FidesctlConfig +from fidesctl.ctl.core import evaluate +from fidesctl.ctl.core.config import FidesctlConfig # Helpers @@ -223,7 +223,9 @@ def test_get_evaluation_policies_with_key_found_local() -> None: local_policy_1 = Policy(fides_key="fides_key_1", rules=[]) local_policy_2 = Policy(fides_key="fides_key_2", rules=[]) get_server_resource_mock = MagicMock(return_value=server_policy) - with patch("fidesctl.core.evaluate.get_server_resource", get_server_resource_mock): + with patch( + "fidesctl.ctl.core.evaluate.get_server_resource", get_server_resource_mock + ): policies = evaluate.get_evaluation_policies( local_policies=[local_policy_1, local_policy_2], evaluate_fides_key="fides_key_1", @@ -244,7 +246,9 @@ def test_get_evaluation_policies_with_key_found_remote() -> None: server_policy = Policy(fides_key="fides_key_1", rules=[]) local_policy = Policy(fides_key="fides_key_2", rules=[]) get_server_resource_mock = MagicMock(return_value=server_policy) - with patch("fidesctl.core.evaluate.get_server_resource", get_server_resource_mock): + with patch( + "fidesctl.ctl.core.evaluate.get_server_resource", get_server_resource_mock + ): policies = evaluate.get_evaluation_policies( local_policies=[local_policy], evaluate_fides_key="fides_key_1", @@ -273,7 +277,8 @@ def test_get_evaluation_policies_with_no_key(test_config: FidesctlConfig) -> Non return_value=[server_policy_1, server_policy_2] ) with patch( - "fidesctl.core.evaluate.get_all_server_policies", get_all_server_policies_mock + "fidesctl.ctl.core.evaluate.get_all_server_policies", + get_all_server_policies_mock, ): policies = evaluate.get_evaluation_policies( local_policies=[local_policy_1, local_policy_2], diff --git a/tests/core/test_export.py b/tests/ctl/core/test_export.py similarity index 97% rename from tests/core/test_export.py rename to tests/ctl/core/test_export.py index ba6d3b4b35..04293d73d8 100644 --- a/tests/core/test_export.py +++ b/tests/ctl/core/test_export.py @@ -13,8 +13,8 @@ System, ) -from fidesctl.core import export -from fidesctl.core.config import FidesctlConfig +from fidesctl.ctl.core import export +from fidesctl.ctl.core.config import FidesctlConfig @pytest.fixture() diff --git a/tests/core/test_export_helpers.py b/tests/ctl/core/test_export_helpers.py similarity index 99% rename from tests/core/test_export_helpers.py rename to tests/ctl/core/test_export_helpers.py index 30f127e653..c97023b370 100644 --- a/tests/core/test_export_helpers.py +++ b/tests/ctl/core/test_export_helpers.py @@ -13,7 +13,7 @@ ) from py._path.local import LocalPath -from fidesctl.core import export_helpers +from fidesctl.ctl.core import export_helpers @pytest.fixture() diff --git a/tests/core/test_filters.py b/tests/ctl/core/test_filters.py similarity index 99% rename from tests/core/test_filters.py rename to tests/ctl/core/test_filters.py index a059466f9f..f295df2339 100644 --- a/tests/core/test_filters.py +++ b/tests/ctl/core/test_filters.py @@ -10,7 +10,7 @@ SystemMetadata, ) -from fidesctl.core import filters as _filters +from fidesctl.ctl.core import filters as _filters @pytest.fixture() diff --git a/tests/core/test_pull.py b/tests/ctl/core/test_pull.py similarity index 83% rename from tests/core/test_pull.py rename to tests/ctl/core/test_pull.py index b7aa522bbf..306eea47ef 100644 --- a/tests/core/test_pull.py +++ b/tests/ctl/core/test_pull.py @@ -1,8 +1,8 @@ import pytest from git.repo import Repo -from fidesctl.core.config import FidesctlConfig -from fidesctl.core.pull import pull_existing_resources +from fidesctl.ctl.core.config import FidesctlConfig +from fidesctl.ctl.core.pull import pull_existing_resources def git_reset(change_dir: str) -> None: diff --git a/tests/core/test_system.py b/tests/ctl/core/test_system.py similarity index 98% rename from tests/core/test_system.py rename to tests/ctl/core/test_system.py index 6b47f6b00a..e5c9a86608 100644 --- a/tests/core/test_system.py +++ b/tests/ctl/core/test_system.py @@ -6,10 +6,10 @@ from fideslang.models import System, SystemMetadata from py._path.local import LocalPath -from fidesctl.connectors.models import OktaConfig -from fidesctl.core import api -from fidesctl.core import system as _system -from fidesctl.core.config import FidesctlConfig +from fidesctl.ctl.connectors.models import OktaConfig +from fidesctl.ctl.core import api +from fidesctl.ctl.core import system as _system +from fidesctl.ctl.core.config import FidesctlConfig def create_server_systems(test_config: FidesctlConfig, systems: List[System]) -> None: diff --git a/tests/core/test_utils.py b/tests/ctl/core/test_utils.py similarity index 93% rename from tests/core/test_utils.py rename to tests/ctl/core/test_utils.py index 3ce35a1091..b3de289cc8 100644 --- a/tests/core/test_utils.py +++ b/tests/ctl/core/test_utils.py @@ -6,8 +6,8 @@ import pytest from fideslang.models import DatasetCollection, DatasetField -from fidesctl.core import utils -from fidesctl.core.config import get_config +from fidesctl.ctl.core import utils +from fidesctl.ctl.core.config import get_config @pytest.fixture() @@ -105,10 +105,10 @@ class TestGitIsDirty: """ def test_not_dirty(self) -> None: - assert not utils.git_is_dirty("tests/data/example_sql/") + assert not utils.git_is_dirty("tests/ctl/data/example_sql/") def test_new_file_is_dirty(self) -> None: - test_file = "tests/data/example_sql/new_file.txt" + test_file = "tests/ctl/data/example_sql/new_file.txt" with open(test_file, "w") as file: file.write("test file") assert utils.git_is_dirty() diff --git a/tests/core/test_visualize.py b/tests/ctl/core/test_visualize.py similarity index 94% rename from tests/core/test_visualize.py rename to tests/ctl/core/test_visualize.py index ec4b4d5d62..dffdf592cb 100644 --- a/tests/core/test_visualize.py +++ b/tests/ctl/core/test_visualize.py @@ -7,7 +7,7 @@ import pytest -from fidesctl.core import visualize +from fidesctl.ctl.core import visualize @pytest.fixture @@ -39,7 +39,7 @@ def sample_categories_list() -> List: @pytest.mark.unit def test_hierarchy_figures(sample_categories_list: List) -> None: - with open("tests/data/sample_hierarchy_figures.json", "r") as sample_hierarchy: + with open("tests/ctl/data/sample_hierarchy_figures.json", "r") as sample_hierarchy: expected_sample_hierarchy_figures = json.load(sample_hierarchy) hierarchy_figures = visualize.hierarchy_figures( sample_categories_list, resource_type="data_category", json_out=True diff --git a/tests/data/example_sql/mysql_example.sql b/tests/ctl/data/example_sql/mysql_example.sql similarity index 100% rename from tests/data/example_sql/mysql_example.sql rename to tests/ctl/data/example_sql/mysql_example.sql diff --git a/tests/data/example_sql/postgres_example.sql b/tests/ctl/data/example_sql/postgres_example.sql similarity index 100% rename from tests/data/example_sql/postgres_example.sql rename to tests/ctl/data/example_sql/postgres_example.sql diff --git a/tests/data/example_sql/redshift_example.sql b/tests/ctl/data/example_sql/redshift_example.sql similarity index 100% rename from tests/data/example_sql/redshift_example.sql rename to tests/ctl/data/example_sql/redshift_example.sql diff --git a/tests/data/example_sql/snowflake_example.sql b/tests/ctl/data/example_sql/snowflake_example.sql similarity index 100% rename from tests/data/example_sql/snowflake_example.sql rename to tests/ctl/data/example_sql/snowflake_example.sql diff --git a/tests/data/example_sql/sqlserver_example.sql b/tests/ctl/data/example_sql/sqlserver_example.sql similarity index 100% rename from tests/data/example_sql/sqlserver_example.sql rename to tests/ctl/data/example_sql/sqlserver_example.sql diff --git a/tests/data/failing_dataset_collection_taxonomy.yml b/tests/ctl/data/failing_dataset_collection_taxonomy.yml similarity index 100% rename from tests/data/failing_dataset_collection_taxonomy.yml rename to tests/ctl/data/failing_dataset_collection_taxonomy.yml diff --git a/tests/data/failing_dataset_field_taxonomy.yml b/tests/ctl/data/failing_dataset_field_taxonomy.yml similarity index 100% rename from tests/data/failing_dataset_field_taxonomy.yml rename to tests/ctl/data/failing_dataset_field_taxonomy.yml diff --git a/tests/data/failing_dataset_taxonomy.yml b/tests/ctl/data/failing_dataset_taxonomy.yml similarity index 100% rename from tests/data/failing_dataset_taxonomy.yml rename to tests/ctl/data/failing_dataset_taxonomy.yml diff --git a/tests/data/failing_declaration_taxonomy.yml b/tests/ctl/data/failing_declaration_taxonomy.yml similarity index 100% rename from tests/data/failing_declaration_taxonomy.yml rename to tests/ctl/data/failing_declaration_taxonomy.yml diff --git a/tests/data/failing_nested_dataset.yml b/tests/ctl/data/failing_nested_dataset.yml similarity index 100% rename from tests/data/failing_nested_dataset.yml rename to tests/ctl/data/failing_nested_dataset.yml diff --git a/tests/data/passing_declaration_taxonomy.yml b/tests/ctl/data/passing_declaration_taxonomy.yml similarity index 100% rename from tests/data/passing_declaration_taxonomy.yml rename to tests/ctl/data/passing_declaration_taxonomy.yml diff --git a/tests/data/sample_hierarchy_figures.json b/tests/ctl/data/sample_hierarchy_figures.json similarity index 100% rename from tests/data/sample_hierarchy_figures.json rename to tests/ctl/data/sample_hierarchy_figures.json diff --git a/tests/data/sample_manifest.yml b/tests/ctl/data/sample_manifest.yml similarity index 100% rename from tests/data/sample_manifest.yml rename to tests/ctl/data/sample_manifest.yml diff --git a/tests/test_config.toml b/tests/ctl/test_config.toml similarity index 100% rename from tests/test_config.toml rename to tests/ctl/test_config.toml diff --git a/tests/test_invalid_config.toml b/tests/ctl/test_invalid_config.toml similarity index 100% rename from tests/test_invalid_config.toml rename to tests/ctl/test_invalid_config.toml