From 5d1687ed1dc525fafda404c16b5e8240d0432a48 Mon Sep 17 00:00:00 2001 From: Leandro Damascena Date: Wed, 20 Dec 2023 15:42:15 +0000 Subject: [PATCH] Making utility public --- .../utilities/_data_masking/provider/__init__.py | 5 ----- .../utilities/_data_masking/provider/kms/__init__.py | 5 ----- .../utilities/{_data_masking => data_masking}/__init__.py | 2 +- .../utilities/{_data_masking => data_masking}/base.py | 4 ++-- .../{_data_masking => data_masking}/constants.py | 0 .../{_data_masking => data_masking}/exceptions.py | 0 .../utilities/data_masking/provider/__init__.py | 5 +++++ .../{_data_masking => data_masking}/provider/base.py | 2 +- .../utilities/data_masking/provider/kms/__init__.py | 5 +++++ .../provider/kms/aws_encryption_sdk.py | 6 +++--- examples/data_masking/src/advanced_custom_serializer.py | 4 ++-- .../data_masking/src/data_masking_function_example.py | 4 ++-- examples/data_masking/src/getting_started_decrypt_data.py | 4 ++-- .../src/getting_started_decryption_context.py | 4 ++-- examples/data_masking/src/getting_started_encrypt_data.py | 4 ++-- .../src/getting_started_encryption_context.py | 4 ++-- examples/data_masking/src/getting_started_mask_data.py | 2 +- tests/e2e/data_masking/handlers/basic_handler.py | 4 ++-- tests/e2e/data_masking/test_e2e_data_masking.py | 6 +++--- tests/functional/data_masking/test_aws_encryption_sdk.py | 8 ++++---- .../pt-load-test-stack/function_1024/app.py | 4 ++-- .../pt-load-test-stack/function_128/app.py | 4 ++-- .../pt-load-test-stack/function_1769/app.py | 4 ++-- tests/performance/data_masking/test_perf_data_masking.py | 4 ++-- tests/unit/data_masking/test_kms_provider.py | 4 ++-- tests/unit/data_masking/test_unit_data_masking.py | 6 +++--- 26 files changed, 52 insertions(+), 52 deletions(-) delete mode 100644 aws_lambda_powertools/utilities/_data_masking/provider/__init__.py delete mode 100644 aws_lambda_powertools/utilities/_data_masking/provider/kms/__init__.py rename aws_lambda_powertools/utilities/{_data_masking => data_masking}/__init__.py (81%) rename aws_lambda_powertools/utilities/{_data_masking => data_masking}/base.py (98%) rename aws_lambda_powertools/utilities/{_data_masking => data_masking}/constants.py (100%) rename aws_lambda_powertools/utilities/{_data_masking => data_masking}/exceptions.py (100%) create mode 100644 aws_lambda_powertools/utilities/data_masking/provider/__init__.py rename aws_lambda_powertools/utilities/{_data_masking => data_masking}/provider/base.py (96%) create mode 100644 aws_lambda_powertools/utilities/data_masking/provider/kms/__init__.py rename aws_lambda_powertools/utilities/{_data_masking => data_masking}/provider/kms/aws_encryption_sdk.py (97%) diff --git a/aws_lambda_powertools/utilities/_data_masking/provider/__init__.py b/aws_lambda_powertools/utilities/_data_masking/provider/__init__.py deleted file mode 100644 index 7ee07f964b..0000000000 --- a/aws_lambda_powertools/utilities/_data_masking/provider/__init__.py +++ /dev/null @@ -1,5 +0,0 @@ -from aws_lambda_powertools.utilities._data_masking.provider.base import BaseProvider - -__all__ = [ - "BaseProvider", -] diff --git a/aws_lambda_powertools/utilities/_data_masking/provider/kms/__init__.py b/aws_lambda_powertools/utilities/_data_masking/provider/kms/__init__.py deleted file mode 100644 index dfcf1f163f..0000000000 --- a/aws_lambda_powertools/utilities/_data_masking/provider/kms/__init__.py +++ /dev/null @@ -1,5 +0,0 @@ -from aws_lambda_powertools.utilities._data_masking.provider.kms.aws_encryption_sdk import AWSEncryptionSDKProvider - -__all__ = [ - "AWSEncryptionSDKProvider", -] diff --git a/aws_lambda_powertools/utilities/_data_masking/__init__.py b/aws_lambda_powertools/utilities/data_masking/__init__.py similarity index 81% rename from aws_lambda_powertools/utilities/_data_masking/__init__.py rename to aws_lambda_powertools/utilities/data_masking/__init__.py index 806c856ba7..4d767e83ce 100644 --- a/aws_lambda_powertools/utilities/_data_masking/__init__.py +++ b/aws_lambda_powertools/utilities/data_masking/__init__.py @@ -4,7 +4,7 @@ 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 +from aws_lambda_powertools.utilities.data_masking.base import DataMasking __all__ = [ "DataMasking", diff --git a/aws_lambda_powertools/utilities/_data_masking/base.py b/aws_lambda_powertools/utilities/data_masking/base.py similarity index 98% rename from aws_lambda_powertools/utilities/_data_masking/base.py rename to aws_lambda_powertools/utilities/data_masking/base.py index f4ab69d209..8c43800769 100644 --- a/aws_lambda_powertools/utilities/_data_masking/base.py +++ b/aws_lambda_powertools/utilities/data_masking/base.py @@ -8,11 +8,11 @@ from jsonpath_ng.ext import parse -from aws_lambda_powertools.utilities._data_masking.exceptions import ( +from aws_lambda_powertools.utilities.data_masking.exceptions import ( DataMaskingFieldNotFoundError, DataMaskingUnsupportedTypeError, ) -from aws_lambda_powertools.utilities._data_masking.provider import BaseProvider +from aws_lambda_powertools.utilities.data_masking.provider import BaseProvider logger = logging.getLogger(__name__) diff --git a/aws_lambda_powertools/utilities/_data_masking/constants.py b/aws_lambda_powertools/utilities/data_masking/constants.py similarity index 100% rename from aws_lambda_powertools/utilities/_data_masking/constants.py rename to aws_lambda_powertools/utilities/data_masking/constants.py diff --git a/aws_lambda_powertools/utilities/_data_masking/exceptions.py b/aws_lambda_powertools/utilities/data_masking/exceptions.py similarity index 100% rename from aws_lambda_powertools/utilities/_data_masking/exceptions.py rename to aws_lambda_powertools/utilities/data_masking/exceptions.py diff --git a/aws_lambda_powertools/utilities/data_masking/provider/__init__.py b/aws_lambda_powertools/utilities/data_masking/provider/__init__.py new file mode 100644 index 0000000000..5a0180eb82 --- /dev/null +++ b/aws_lambda_powertools/utilities/data_masking/provider/__init__.py @@ -0,0 +1,5 @@ +from aws_lambda_powertools.utilities.data_masking.provider.base import BaseProvider + +__all__ = [ + "BaseProvider", +] diff --git a/aws_lambda_powertools/utilities/_data_masking/provider/base.py b/aws_lambda_powertools/utilities/data_masking/provider/base.py similarity index 96% rename from aws_lambda_powertools/utilities/_data_masking/provider/base.py rename to aws_lambda_powertools/utilities/data_masking/provider/base.py index 1a4d4dd65c..23958f90eb 100644 --- a/aws_lambda_powertools/utilities/_data_masking/provider/base.py +++ b/aws_lambda_powertools/utilities/data_masking/provider/base.py @@ -4,7 +4,7 @@ import json from typing import Any, Callable, Iterable -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: diff --git a/aws_lambda_powertools/utilities/data_masking/provider/kms/__init__.py b/aws_lambda_powertools/utilities/data_masking/provider/kms/__init__.py new file mode 100644 index 0000000000..c135309414 --- /dev/null +++ b/aws_lambda_powertools/utilities/data_masking/provider/kms/__init__.py @@ -0,0 +1,5 @@ +from aws_lambda_powertools.utilities.data_masking.provider.kms.aws_encryption_sdk import AWSEncryptionSDKProvider + +__all__ = [ + "AWSEncryptionSDKProvider", +] diff --git a/aws_lambda_powertools/utilities/_data_masking/provider/kms/aws_encryption_sdk.py b/aws_lambda_powertools/utilities/data_masking/provider/kms/aws_encryption_sdk.py similarity index 97% rename from aws_lambda_powertools/utilities/_data_masking/provider/kms/aws_encryption_sdk.py rename to aws_lambda_powertools/utilities/data_masking/provider/kms/aws_encryption_sdk.py index 2c6a84f91d..7a992aae24 100644 --- a/aws_lambda_powertools/utilities/_data_masking/provider/kms/aws_encryption_sdk.py +++ b/aws_lambda_powertools/utilities/data_masking/provider/kms/aws_encryption_sdk.py @@ -26,21 +26,21 @@ bytes_to_string, ) 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, ENCRYPTED_DATA_KEY_CTX_KEY, MAX_BYTES_ENCRYPTED, MAX_CACHE_AGE_SECONDS, MAX_MESSAGES_ENCRYPTED, ) -from aws_lambda_powertools.utilities._data_masking.exceptions import ( +from aws_lambda_powertools.utilities.data_masking.exceptions import ( DataMaskingContextMismatchError, DataMaskingDecryptKeyError, DataMaskingDecryptValueError, DataMaskingEncryptKeyError, DataMaskingUnsupportedTypeError, ) -from aws_lambda_powertools.utilities._data_masking.provider import BaseProvider +from aws_lambda_powertools.utilities.data_masking.provider import BaseProvider logger = logging.getLogger(__name__) diff --git a/examples/data_masking/src/advanced_custom_serializer.py b/examples/data_masking/src/advanced_custom_serializer.py index 2c5a5025f7..f870624bcc 100644 --- a/examples/data_masking/src/advanced_custom_serializer.py +++ b/examples/data_masking/src/advanced_custom_serializer.py @@ -4,8 +4,8 @@ import ujson -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, ) from aws_lambda_powertools.utilities.typing import LambdaContext diff --git a/examples/data_masking/src/data_masking_function_example.py b/examples/data_masking/src/data_masking_function_example.py index b25449d8ed..bb9a1ed5f0 100644 --- a/examples/data_masking/src/data_masking_function_example.py +++ b/examples/data_masking/src/data_masking_function_example.py @@ -3,8 +3,8 @@ import os from aws_lambda_powertools import Logger, Tracer -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.getenv("KMS_KEY_ARN", "") diff --git a/examples/data_masking/src/getting_started_decrypt_data.py b/examples/data_masking/src/getting_started_decrypt_data.py index cf7b58bb3f..eaab64097c 100644 --- a/examples/data_masking/src/getting_started_decrypt_data.py +++ b/examples/data_masking/src/getting_started_decrypt_data.py @@ -3,8 +3,8 @@ import os 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 from aws_lambda_powertools.utilities.typing import LambdaContext KMS_KEY_ARN = os.getenv("KMS_KEY_ARN", "") # (1)! diff --git a/examples/data_masking/src/getting_started_decryption_context.py b/examples/data_masking/src/getting_started_decryption_context.py index f0360403dd..fd6540ebac 100644 --- a/examples/data_masking/src/getting_started_decryption_context.py +++ b/examples/data_masking/src/getting_started_decryption_context.py @@ -3,8 +3,8 @@ import os 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 from aws_lambda_powertools.utilities.typing import LambdaContext KMS_KEY_ARN = os.getenv("KMS_KEY_ARN", "") diff --git a/examples/data_masking/src/getting_started_encrypt_data.py b/examples/data_masking/src/getting_started_encrypt_data.py index d6307a196f..aeba96a839 100644 --- a/examples/data_masking/src/getting_started_encrypt_data.py +++ b/examples/data_masking/src/getting_started_encrypt_data.py @@ -3,8 +3,8 @@ import os 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 ( +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 diff --git a/examples/data_masking/src/getting_started_encryption_context.py b/examples/data_masking/src/getting_started_encryption_context.py index 4e30301a11..1cf6ce882a 100644 --- a/examples/data_masking/src/getting_started_encryption_context.py +++ b/examples/data_masking/src/getting_started_encryption_context.py @@ -3,8 +3,8 @@ import os 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 from aws_lambda_powertools.utilities.typing import LambdaContext KMS_KEY_ARN = os.getenv("KMS_KEY_ARN", "") diff --git a/examples/data_masking/src/getting_started_mask_data.py b/examples/data_masking/src/getting_started_mask_data.py index dc9526253a..37dfd7b4da 100644 --- a/examples/data_masking/src/getting_started_mask_data.py +++ b/examples/data_masking/src/getting_started_mask_data.py @@ -1,7 +1,7 @@ from __future__ import annotations from aws_lambda_powertools import Logger -from aws_lambda_powertools.utilities._data_masking import DataMasking +from aws_lambda_powertools.utilities.data_masking import DataMasking from aws_lambda_powertools.utilities.typing import LambdaContext logger = Logger() diff --git a/tests/e2e/data_masking/handlers/basic_handler.py b/tests/e2e/data_masking/handlers/basic_handler.py index 2ad3b37943..6f69639182 100644 --- a/tests/e2e/data_masking/handlers/basic_handler.py +++ b/tests/e2e/data_masking/handlers/basic_handler.py @@ -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() diff --git a/tests/e2e/data_masking/test_e2e_data_masking.py b/tests/e2e/data_masking/test_e2e_data_masking.py index b5e5203b4c..5664858d5d 100644 --- a/tests/e2e/data_masking/test_e2e_data_masking.py +++ b/tests/e2e/data_masking/test_e2e_data_masking.py @@ -4,9 +4,9 @@ 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.exceptions import DataMaskingContextMismatchError -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.exceptions import DataMaskingContextMismatchError +from aws_lambda_powertools.utilities.data_masking.provider.kms.aws_encryption_sdk import ( AWSEncryptionSDKProvider, ) from tests.e2e.utils import data_fetcher diff --git a/tests/functional/data_masking/test_aws_encryption_sdk.py b/tests/functional/data_masking/test_aws_encryption_sdk.py index e409235be5..10b09894b8 100644 --- a/tests/functional/data_masking/test_aws_encryption_sdk.py +++ b/tests/functional/data_masking/test_aws_encryption_sdk.py @@ -7,10 +7,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, ) diff --git a/tests/performance/data_masking/load_test_data_masking/pt-load-test-stack/function_1024/app.py b/tests/performance/data_masking/load_test_data_masking/pt-load-test-stack/function_1024/app.py index 33b9673154..76081b2039 100644 --- a/tests/performance/data_masking/load_test_data_masking/pt-load-test-stack/function_1024/app.py +++ b/tests/performance/data_masking/load_test_data_masking/pt-load-test-stack/function_1024/app.py @@ -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"] diff --git a/tests/performance/data_masking/load_test_data_masking/pt-load-test-stack/function_128/app.py b/tests/performance/data_masking/load_test_data_masking/pt-load-test-stack/function_128/app.py index 81fffefb2e..b191ade241 100644 --- a/tests/performance/data_masking/load_test_data_masking/pt-load-test-stack/function_128/app.py +++ b/tests/performance/data_masking/load_test_data_masking/pt-load-test-stack/function_128/app.py @@ -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"] diff --git a/tests/performance/data_masking/load_test_data_masking/pt-load-test-stack/function_1769/app.py b/tests/performance/data_masking/load_test_data_masking/pt-load-test-stack/function_1769/app.py index 3fbe0d6011..19d287e601 100644 --- a/tests/performance/data_masking/load_test_data_masking/pt-load-test-stack/function_1769/app.py +++ b/tests/performance/data_masking/load_test_data_masking/pt-load-test-stack/function_1769/app.py @@ -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"] diff --git a/tests/performance/data_masking/test_perf_data_masking.py b/tests/performance/data_masking/test_perf_data_masking.py index 53eae937f0..9fae80b3a0 100644 --- a/tests/performance/data_masking/test_perf_data_masking.py +++ b/tests/performance/data_masking/test_perf_data_masking.py @@ -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.05 diff --git a/tests/unit/data_masking/test_kms_provider.py b/tests/unit/data_masking/test_kms_provider.py index f8cbdf6b34..5fe9b2e53e 100644 --- a/tests/unit/data_masking/test_kms_provider.py +++ b/tests/unit/data_masking/test_kms_provider.py @@ -1,10 +1,10 @@ import pytest -from aws_lambda_powertools.utilities._data_masking.exceptions import ( +from aws_lambda_powertools.utilities.data_masking.exceptions import ( DataMaskingContextMismatchError, DataMaskingUnsupportedTypeError, ) -from aws_lambda_powertools.utilities._data_masking.provider.kms.aws_encryption_sdk import ( +from aws_lambda_powertools.utilities.data_masking.provider.kms.aws_encryption_sdk import ( KMSKeyProvider, ) diff --git a/tests/unit/data_masking/test_unit_data_masking.py b/tests/unit/data_masking/test_unit_data_masking.py index 681b197e2d..552abab416 100644 --- a/tests/unit/data_masking/test_unit_data_masking.py +++ b/tests/unit/data_masking/test_unit_data_masking.py @@ -2,9 +2,9 @@ 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.exceptions import ( +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.exceptions import ( DataMaskingFieldNotFoundError, DataMaskingUnsupportedTypeError, )