Skip to content

Commit

Permalink
refactor(data_masking): move Data Masking utility to a private folder (
Browse files Browse the repository at this point in the history
…#3202)

Moving DataMasking to a private folder
  • Loading branch information
leandrodamascena authored Oct 13, 2023
1 parent 4be04cb commit 5bfb60f
Show file tree
Hide file tree
Showing 18 changed files with 47 additions and 37 deletions.
11 changes: 11 additions & 0 deletions aws_lambda_powertools/utilities/_data_masking/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
"""
Note: This utility is currently in a Non-General Availability (Non-GA) phase and may have limitations.
Please DON'T USE THIS utility in production environments.
Keep in mind that when we transition to General Availability (GA), there might be breaking changes introduced.
"""

from aws_lambda_powertools.utilities._data_masking.base import DataMasking

__all__ = [
"DataMasking",
]
Original file line number Diff line number Diff line change
@@ -1,11 +1,15 @@
import json
from typing import Optional, Union

from aws_lambda_powertools.utilities.data_masking.provider import BaseProvider
from aws_lambda_powertools.utilities._data_masking.provider import BaseProvider


class DataMasking:
"""
Note: This utility is currently in a Non-General Availability (Non-GA) phase and may have limitations.
Please DON'T USE THIS utility in production environments.
Keep in mind that when we transition to General Availability (GA), there might be breaking changes introduced.
A utility class for masking sensitive data within various data types.
This class provides methods for masking sensitive information, such as personal
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
from aws_lambda_powertools.utilities._data_masking.provider.base import BaseProvider

__all__ = [
"BaseProvider",
]
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import json
from typing import Any

from aws_lambda_powertools.utilities.data_masking.constants import DATA_MASKING_STRING
from aws_lambda_powertools.utilities._data_masking.constants import DATA_MASKING_STRING


class BaseProvider:
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
from aws_lambda_powertools.utilities._data_masking.provider.kms.aws_encryption_sdk import AwsEncryptionSdkProvider

__all__ = [
"AwsEncryptionSdkProvider",
]
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,12 @@
)

from aws_lambda_powertools.shared.user_agent import register_feature_to_botocore_session
from aws_lambda_powertools.utilities.data_masking.constants import (
from aws_lambda_powertools.utilities._data_masking.constants import (
CACHE_CAPACITY,
MAX_CACHE_AGE_SECONDS,
MAX_MESSAGES_ENCRYPTED,
)
from aws_lambda_powertools.utilities.data_masking.provider import BaseProvider
from aws_lambda_powertools.utilities._data_masking.provider import BaseProvider


class ContextMismatchError(Exception):
Expand Down
5 changes: 0 additions & 5 deletions aws_lambda_powertools/utilities/data_masking/__init__.py

This file was deleted.

This file was deleted.

This file was deleted.

4 changes: 2 additions & 2 deletions tests/e2e/data_masking/handlers/basic_handler.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
from aws_lambda_powertools import Logger
from aws_lambda_powertools.utilities.data_masking import DataMasking
from aws_lambda_powertools.utilities.data_masking.provider.kms.aws_encryption_sdk import AwsEncryptionSdkProvider
from aws_lambda_powertools.utilities._data_masking import DataMasking
from aws_lambda_powertools.utilities._data_masking.provider.kms.aws_encryption_sdk import AwsEncryptionSdkProvider

logger = Logger()

Expand Down
4 changes: 2 additions & 2 deletions tests/e2e/data_masking/test_e2e_data_masking.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@
import pytest
from aws_encryption_sdk.exceptions import DecryptKeyError

from aws_lambda_powertools.utilities.data_masking import DataMasking
from aws_lambda_powertools.utilities.data_masking.provider.kms.aws_encryption_sdk import (
from aws_lambda_powertools.utilities._data_masking import DataMasking
from aws_lambda_powertools.utilities._data_masking.provider.kms.aws_encryption_sdk import (
AwsEncryptionSdkProvider,
ContextMismatchError,
)
Expand Down
8 changes: 4 additions & 4 deletions tests/functional/data_masking/test_aws_encryption_sdk.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,10 @@

import pytest

from aws_lambda_powertools.utilities.data_masking import DataMasking
from aws_lambda_powertools.utilities.data_masking.constants import DATA_MASKING_STRING
from aws_lambda_powertools.utilities.data_masking.provider import BaseProvider
from aws_lambda_powertools.utilities.data_masking.provider.kms import (
from aws_lambda_powertools.utilities._data_masking import DataMasking
from aws_lambda_powertools.utilities._data_masking.constants import DATA_MASKING_STRING
from aws_lambda_powertools.utilities._data_masking.provider import BaseProvider
from aws_lambda_powertools.utilities._data_masking.provider.kms import (
AwsEncryptionSdkProvider,
)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
from aws_lambda_powertools import Logger, Tracer
from aws_lambda_powertools.event_handler import APIGatewayRestResolver
from aws_lambda_powertools.logging import correlation_paths
from aws_lambda_powertools.utilities.data_masking import DataMasking
from aws_lambda_powertools.utilities.data_masking.provider.kms.aws_encryption_sdk import AwsEncryptionSdkProvider
from aws_lambda_powertools.utilities._data_masking import DataMasking
from aws_lambda_powertools.utilities._data_masking.provider.kms.aws_encryption_sdk import AwsEncryptionSdkProvider
from aws_lambda_powertools.utilities.typing import LambdaContext

KMS_KEY_ARN = os.environ["KMS_KEY_ARN"]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
from aws_lambda_powertools import Logger, Tracer
from aws_lambda_powertools.event_handler import APIGatewayRestResolver
from aws_lambda_powertools.logging import correlation_paths
from aws_lambda_powertools.utilities.data_masking import DataMasking
from aws_lambda_powertools.utilities.data_masking.provider.kms.aws_encryption_sdk import AwsEncryptionSdkProvider
from aws_lambda_powertools.utilities._data_masking import DataMasking
from aws_lambda_powertools.utilities._data_masking.provider.kms.aws_encryption_sdk import AwsEncryptionSdkProvider
from aws_lambda_powertools.utilities.typing import LambdaContext

KMS_KEY_ARN = os.environ["KMS_KEY_ARN"]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
from aws_lambda_powertools import Logger, Tracer
from aws_lambda_powertools.event_handler import APIGatewayRestResolver
from aws_lambda_powertools.logging import correlation_paths
from aws_lambda_powertools.utilities.data_masking import DataMasking
from aws_lambda_powertools.utilities.data_masking.provider.kms.aws_encryption_sdk import AwsEncryptionSdkProvider
from aws_lambda_powertools.utilities._data_masking import DataMasking
from aws_lambda_powertools.utilities._data_masking.provider.kms.aws_encryption_sdk import AwsEncryptionSdkProvider
from aws_lambda_powertools.utilities.typing import LambdaContext

KMS_KEY_ARN = os.environ["KMS_KEY_ARN"]
Expand Down
4 changes: 2 additions & 2 deletions tests/performance/data_masking/test_perf_data_masking.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@

import pytest

from aws_lambda_powertools.utilities.data_masking.base import DataMasking
from aws_lambda_powertools.utilities._data_masking.base import DataMasking

DATA_MASKING_PACKAGE = "aws_lambda_powertools.utilities.data_masking"
DATA_MASKING_PACKAGE = "aws_lambda_powertools.utilities._data_masking"
DATA_MASKING_INIT_SLA: float = 0.002
DATA_MASKING_NESTED_ENCRYPT_SLA: float = 0.001

Expand Down
4 changes: 2 additions & 2 deletions tests/unit/data_masking/test_unit_data_masking.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@

import pytest

from aws_lambda_powertools.utilities.data_masking.base import DataMasking
from aws_lambda_powertools.utilities.data_masking.constants import DATA_MASKING_STRING
from aws_lambda_powertools.utilities._data_masking.base import DataMasking
from aws_lambda_powertools.utilities._data_masking.constants import DATA_MASKING_STRING


@pytest.fixture
Expand Down

0 comments on commit 5bfb60f

Please sign in to comment.