Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Generic shares_base module and specific s3_datasets_shares module - part 1 (renaming, enums and permissions) #1284

Merged
merged 4 commits into from
May 22, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 0 additions & 3 deletions backend/dataall/modules/dataset_sharing/cdk/__init__.py

This file was deleted.

3 changes: 0 additions & 3 deletions backend/dataall/modules/dataset_sharing/handlers/__init__.py

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
log = logging.getLogger(__name__)


class SharingApiModuleInterface(ModuleInterface):
class S3DatasetsSharesApiModuleInterface(ModuleInterface):
@staticmethod
def is_supported(modes: Set[ImportMode]) -> bool:
return ImportMode.API in modes
Expand All @@ -16,25 +16,26 @@ def is_supported(modes: Set[ImportMode]) -> bool:
def depends_on() -> List[Type['ModuleInterface']]:
from dataall.modules.notifications import NotificationsModuleInterface
from dataall.modules.s3_datasets import DatasetApiModuleInterface
from dataall.modules.shares_base import SharesBaseModuleInterface

return [DatasetApiModuleInterface, NotificationsModuleInterface]
return [DatasetApiModuleInterface, NotificationsModuleInterface, SharesBaseModuleInterface]

def __init__(self):
from dataall.core.environment.services.environment_resource_manager import EnvironmentResourceManager
from dataall.modules.dataset_sharing import api
from dataall.modules.dataset_sharing.services.managed_share_policy_service import SharePolicyService
from dataall.modules.s3_datasets_shares import api
from dataall.modules.s3_datasets_shares.services.managed_share_policy_service import SharePolicyService
from dataall.modules.s3_datasets.services.dataset_service import DatasetService
from dataall.modules.datasets_base.services.dataset_list_service import DatasetListService
from dataall.modules.dataset_sharing.services.dataset_sharing_service import DatasetSharingService
from dataall.modules.dataset_sharing.db.share_object_repositories import ShareEnvironmentResource
from dataall.modules.s3_datasets_shares.services.dataset_sharing_service import DatasetSharingService
from dataall.modules.s3_datasets_shares.db.share_object_repositories import ShareEnvironmentResource

EnvironmentResourceManager.register(ShareEnvironmentResource())
DatasetService.register(DatasetSharingService())
DatasetListService.register(DatasetSharingService())
log.info('API of dataset sharing has been imported')


class SharingAsyncHandlersModuleInterface(ModuleInterface):
class S3DatasetsSharesAsyncHandlersModuleInterface(ModuleInterface):
"""Implements ModuleInterface for dataset async lambda"""

@staticmethod
Expand All @@ -45,24 +46,25 @@ def is_supported(modes: List[ImportMode]):
def depends_on() -> List[Type['ModuleInterface']]:
from dataall.modules.notifications import NotificationsModuleInterface
from dataall.modules.s3_datasets import DatasetAsyncHandlersModuleInterface
from dataall.modules.shares_base import SharesBaseModuleInterface

return [DatasetAsyncHandlersModuleInterface, NotificationsModuleInterface]
return [DatasetAsyncHandlersModuleInterface, NotificationsModuleInterface, SharesBaseModuleInterface]

def __init__(self):
import dataall.modules.dataset_sharing.handlers
import dataall.modules.s3_datasets_shares.handlers

log.info('Sharing handlers have been imported')


class DataSharingCdkModuleInterface(ModuleInterface):
class S3DatasetsSharesCdkModuleInterface(ModuleInterface):
"""Implements ModuleInterface for data sharing"""

@staticmethod
def is_supported(modes):
return ImportMode.CDK in modes

def __init__(self):
import dataall.modules.dataset_sharing.cdk
from dataall.modules.dataset_sharing.services.managed_share_policy_service import SharePolicyService
import dataall.modules.s3_datasets_shares.cdk
from dataall.modules.s3_datasets_shares.services.managed_share_policy_service import SharePolicyService

log.info('CDK module data_sharing has been imported')
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
from dataall.modules.dataset_sharing.api import (
from dataall.modules.s3_datasets_shares.api import (
input_types,
mutations,
queries,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
from dataall.base.api.constants import SortDirection, gql
from dataall.modules.dataset_sharing.services.dataset_sharing_enums import ShareableType, ShareSortField
from dataall.modules.shares_base.services.shares_enums import ShareableType, ShareSortField


NewShareObjectInput = gql.InputType(
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
from dataall.base.api import gql
from dataall.modules.dataset_sharing.api.resolvers import (
from dataall.modules.s3_datasets_shares.api.resolvers import (
add_shared_item,
approve_share_object,
create_share_object,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
from dataall.base.api import gql
from dataall.modules.dataset_sharing.api.resolvers import (
from dataall.modules.s3_datasets_shares.api.resolvers import (
get_dataset_shared_assume_role_url,
get_share_object,
list_shared_with_environment_data_items,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,12 @@
from dataall.core.organizations.db.organization_repositories import OrganizationRepository
from dataall.base.db.exceptions import RequiredParameter
from dataall.base.feature_toggle_checker import is_feature_enabled
from dataall.modules.dataset_sharing.services.dataset_sharing_enums import ShareObjectPermission
from dataall.modules.dataset_sharing.db.share_object_models import ShareObjectItem, ShareObject
from dataall.modules.dataset_sharing.services.share_item_service import ShareItemService
from dataall.modules.dataset_sharing.services.share_object_service import ShareObjectService
from dataall.modules.dataset_sharing.services.dataset_sharing_service import DatasetSharingService
from dataall.modules.dataset_sharing.aws.glue_client import GlueClient
from dataall.modules.shares_base.services.shares_enums import ShareObjectPermission
from dataall.modules.s3_datasets_shares.db.share_object_models import ShareObjectItem, ShareObject
from dataall.modules.s3_datasets_shares.services.share_item_service import ShareItemService
from dataall.modules.s3_datasets_shares.services.share_object_service import ShareObjectService
from dataall.modules.s3_datasets_shares.services.dataset_sharing_service import DatasetSharingService
from dataall.modules.s3_datasets_shares.aws.glue_client import GlueClient
from dataall.modules.s3_datasets.db.dataset_repositories import DatasetRepository
from dataall.modules.s3_datasets.db.dataset_models import DatasetStorageLocation, DatasetTable, S3Dataset

Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
from dataall.base.api import gql
from dataall.modules.dataset_sharing.services.dataset_sharing_enums import (
from dataall.modules.shares_base.services.shares_enums import (
ShareableType,
PrincipalType,
ShareItemHealthStatus,
)
from dataall.modules.dataset_sharing.api.resolvers import (
from dataall.modules.s3_datasets_shares.api.resolvers import (
union_resolver,
resolve_shared_item,
resolve_dataset,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

from dataall.base.aws.sts import SessionHelper
from botocore.exceptions import ClientError
from dataall.modules.dataset_sharing.aws.share_policy_verifier import SharePolicyVerifier
from dataall.modules.s3_datasets_shares.aws.share_policy_verifier import SharePolicyVerifier


log = logging.getLogger(__name__)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
from botocore.exceptions import ClientError


from dataall.modules.dataset_sharing.aws.share_policy_verifier import SharePolicyVerifier
from dataall.modules.s3_datasets_shares.aws.share_policy_verifier import SharePolicyVerifier

log = logging.getLogger(__name__)

Expand Down
3 changes: 3 additions & 0 deletions backend/dataall/modules/s3_datasets_shares/cdk/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
from dataall.modules.s3_datasets_shares.cdk import pivot_role_data_sharing_policy

__all__ = ['pivot_role_data_sharing_policy']
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
from sqlalchemy.orm import query_expression

from dataall.base.db import Base, utils
from dataall.modules.dataset_sharing.services.dataset_sharing_enums import (
from dataall.modules.shares_base.services.shares_enums import (
ShareObjectStatus,
ShareItemStatus,
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
from dataall.core.environment.services.environment_resource_manager import EnvironmentResource
from dataall.core.organizations.db.organization_models import Organization
from dataall.base.db import exceptions, paginate
from dataall.modules.dataset_sharing.services.dataset_sharing_enums import (
from dataall.modules.shares_base.services.shares_enums import (
ShareItemHealthStatus,
ShareObjectActions,
ShareObjectStatus,
Expand All @@ -19,7 +19,7 @@
ShareableType,
PrincipalType,
)
from dataall.modules.dataset_sharing.db.share_object_models import ShareObjectItem, ShareObject
from dataall.modules.s3_datasets_shares.db.share_object_models import ShareObjectItem, ShareObject
from dataall.modules.s3_datasets.db.dataset_repositories import DatasetRepository
from dataall.modules.s3_datasets.db.dataset_models import DatasetStorageLocation, DatasetTable, S3Dataset, DatasetBucket
from dataall.modules.datasets_base.db.dataset_models import DatasetBase
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
from dataall.modules.s3_datasets_shares.handlers import ecs_share_handler

__all__ = ['ecs_share_handler']
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
from dataall.core.tasks.service_handlers import Worker
from dataall.core.stacks.aws.ecs import Ecs
from dataall.core.tasks.db.task_models import Task
from dataall.modules.dataset_sharing.services.data_sharing_service import DataSharingService
from dataall.modules.s3_datasets_shares.services.data_sharing_service import DataSharingService

log = logging.getLogger(__name__)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,22 +5,22 @@
from datetime import datetime

from dataall.base.db import Engine
from dataall.modules.dataset_sharing.db.share_object_repositories import (
from dataall.modules.s3_datasets_shares.db.share_object_repositories import (
ShareObjectSM,
ShareObjectRepository,
ShareItemSM,
)
from dataall.modules.dataset_sharing.services.share_item_service import ShareItemService
from dataall.modules.dataset_sharing.services.share_object_service import ShareObjectService
from dataall.modules.dataset_sharing.services.share_processors.lakeformation_process_share import (
from dataall.modules.s3_datasets_shares.services.share_item_service import ShareItemService
from dataall.modules.s3_datasets_shares.services.share_object_service import ShareObjectService
from dataall.modules.s3_datasets_shares.services.share_processors.lakeformation_process_share import (
ProcessLakeFormationShare,
)
from dataall.modules.dataset_sharing.services.share_processors.s3_access_point_process_share import (
from dataall.modules.s3_datasets_shares.services.share_processors.s3_access_point_process_share import (
ProcessS3AccessPointShare,
)
from dataall.modules.dataset_sharing.services.share_processors.s3_bucket_process_share import ProcessS3BucketShare
from dataall.modules.s3_datasets_shares.services.share_processors.s3_bucket_process_share import ProcessS3BucketShare

from dataall.modules.dataset_sharing.services.dataset_sharing_enums import (
from dataall.modules.shares_base.services.shares_enums import (
ShareItemHealthStatus,
ShareObjectActions,
ShareItemStatus,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
from datetime import datetime

from dataall.core.environment.db.environment_models import Environment
from dataall.modules.dataset_sharing.db.share_object_models import ShareObject
from dataall.modules.s3_datasets_shares.db.share_object_models import ShareObject
from dataall.modules.s3_datasets.db.dataset_models import DatasetTable, DatasetStorageLocation, DatasetBucket
from dataall.base.utils.alarm_service import AlarmService

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,13 @@
from dataall.base.context import get_context
from dataall.base.db import exceptions
from dataall.base.aws.sts import SessionHelper
from dataall.modules.dataset_sharing.db.share_object_models import ShareObject
from dataall.modules.dataset_sharing.db.share_object_repositories import (
from dataall.modules.s3_datasets_shares.db.share_object_models import ShareObject
from dataall.modules.s3_datasets_shares.db.share_object_repositories import (
ShareObjectRepository,
ShareItemSM,
)
from dataall.modules.dataset_sharing.services.share_permissions import SHARE_OBJECT_APPROVER
from dataall.modules.dataset_sharing.services.share_item_service import ShareItemService
from dataall.modules.shares_base.services.share_permissions import SHARE_OBJECT_APPROVER
from dataall.modules.s3_datasets_shares.services.share_item_service import ShareItemService
from dataall.modules.s3_datasets.db.dataset_repositories import DatasetRepository
from dataall.modules.s3_datasets.services.dataset_permissions import (
MANAGE_DATASETS,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,23 +7,23 @@
from dataall.core.tasks.db.task_models import Task
from dataall.base.db import utils
from dataall.base.db.exceptions import ObjectNotFound, UnauthorizedOperation
from dataall.modules.dataset_sharing.services.dataset_sharing_enums import (
from dataall.modules.shares_base.services.shares_enums import (
ShareObjectActions,
ShareableType,
ShareItemStatus,
ShareItemActions,
ShareItemHealthStatus,
)
from dataall.modules.dataset_sharing.aws.glue_client import GlueClient
from dataall.modules.dataset_sharing.db.share_object_models import ShareObjectItem
from dataall.modules.dataset_sharing.db.share_object_repositories import (
from dataall.modules.s3_datasets_shares.aws.glue_client import GlueClient
from dataall.modules.s3_datasets_shares.db.share_object_models import ShareObjectItem
from dataall.modules.s3_datasets_shares.db.share_object_repositories import (
ShareObjectRepository,
ShareObjectSM,
ShareItemSM,
)
from dataall.modules.dataset_sharing.services.share_exceptions import ShareItemsFound
from dataall.modules.dataset_sharing.services.share_notification_service import ShareNotificationService
from dataall.modules.dataset_sharing.services.share_permissions import (
from dataall.modules.s3_datasets_shares.services.share_exceptions import ShareItemsFound
from dataall.modules.s3_datasets_shares.services.share_notification_service import ShareNotificationService
from dataall.modules.shares_base.services.share_permissions import (
GET_SHARE_OBJECT,
ADD_ITEM,
REMOVE_ITEM,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,23 +5,23 @@
from warnings import warn
from dataall.core.environment.db.environment_models import Environment, EnvironmentGroup
from dataall.core.environment.services.environment_service import EnvironmentService
from dataall.modules.dataset_sharing.aws.glue_client import GlueClient
from dataall.modules.dataset_sharing.aws.lakeformation_client import LakeFormationClient
from dataall.modules.s3_datasets_shares.aws.glue_client import GlueClient
from dataall.modules.s3_datasets_shares.aws.lakeformation_client import LakeFormationClient
from dataall.base.aws.quicksight import QuicksightClient
from dataall.base.aws.iam import IAM
from dataall.base.aws.sts import SessionHelper
from dataall.base.db import exceptions
from dataall.modules.dataset_sharing.db.share_object_repositories import ShareObjectRepository, ShareItemSM
from dataall.modules.dataset_sharing.services.dataset_sharing_enums import (
from dataall.modules.s3_datasets_shares.db.share_object_repositories import ShareObjectRepository, ShareItemSM
from dataall.modules.shares_base.services.shares_enums import (
ShareItemStatus,
ShareObjectActions,
ShareItemActions,
ShareItemHealthStatus,
)
from dataall.modules.s3_datasets.db.dataset_models import DatasetTable, S3Dataset
from dataall.modules.dataset_sharing.services.dataset_sharing_alarm_service import DatasetSharingAlarmService
from dataall.modules.dataset_sharing.db.share_object_models import ShareObjectItem, ShareObject
from dataall.modules.dataset_sharing.services.share_managers.share_manager_utils import ShareErrorFormatter
from dataall.modules.s3_datasets_shares.services.dataset_sharing_alarm_service import DatasetSharingAlarmService
from dataall.modules.s3_datasets_shares.db.share_object_models import ShareObjectItem, ShareObject
from dataall.modules.s3_datasets_shares.services.share_managers.share_manager_utils import ShareErrorFormatter

logger = logging.getLogger(__name__)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,29 +8,29 @@
from dataall.core.environment.services.environment_service import EnvironmentService
from dataall.base.db import utils
from dataall.base.aws.sts import SessionHelper
from dataall.modules.dataset_sharing.aws.s3_client import (
from dataall.modules.s3_datasets_shares.aws.s3_client import (
S3ControlClient,
S3Client,
DATAALL_ALLOW_OWNER_SID,
DATAALL_DELEGATE_TO_ACCESS_POINT,
)
from dataall.modules.dataset_sharing.aws.kms_client import (
from dataall.modules.s3_datasets_shares.aws.kms_client import (
KmsClient,
DATAALL_ACCESS_POINT_KMS_DECRYPT_SID,
DATAALL_KMS_PIVOT_ROLE_PERMISSIONS_SID,
)
from dataall.base.aws.iam import IAM
from dataall.modules.dataset_sharing.db.share_object_models import ShareObject
from dataall.modules.dataset_sharing.services.dataset_sharing_alarm_service import DatasetSharingAlarmService
from dataall.modules.dataset_sharing.db.share_object_repositories import ShareObjectRepository
from dataall.modules.dataset_sharing.services.share_exceptions import PrincipalRoleNotFound
from dataall.modules.dataset_sharing.services.share_managers.share_manager_utils import ShareErrorFormatter
from dataall.modules.dataset_sharing.services.managed_share_policy_service import (
from dataall.modules.s3_datasets_shares.db.share_object_models import ShareObject
from dataall.modules.s3_datasets_shares.services.dataset_sharing_alarm_service import DatasetSharingAlarmService
from dataall.modules.s3_datasets_shares.db.share_object_repositories import ShareObjectRepository
from dataall.modules.s3_datasets_shares.services.share_exceptions import PrincipalRoleNotFound
from dataall.modules.s3_datasets_shares.services.share_managers.share_manager_utils import ShareErrorFormatter
from dataall.modules.s3_datasets_shares.services.managed_share_policy_service import (
SharePolicyService,
IAM_S3_ACCESS_POINTS_STATEMENT_SID,
EMPTY_STATEMENT_SID,
)
from dataall.modules.dataset_sharing.services.dataset_sharing_enums import PrincipalType
from dataall.modules.shares_base.services.shares_enums import PrincipalType
from dataall.modules.s3_datasets.db.dataset_models import DatasetStorageLocation, S3Dataset

logger = logging.getLogger(__name__)
Expand Down
Loading
Loading