forked from aws-powertools/powertools-lambda-python
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
ebcc343
commit f41026b
Showing
3 changed files
with
31 additions
and
14 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,18 @@ | ||
from typing import Dict | ||
|
||
from aws_lambda_powertools import Logger | ||
from aws_lambda_powertools.utilities._data_masking import DataMasking | ||
from aws_lambda_powertools.utilities.typing import LambdaContext | ||
|
||
logger = Logger() | ||
data_masker = DataMasking() | ||
|
||
|
||
def lambda_handler(event, context): | ||
def lambda_handler(event: dict, context: LambdaContext) -> Dict: | ||
data = event.get("body") | ||
|
||
data_masker = DataMasking() | ||
logger.info("Masking fields email, address.street, and company_address") | ||
|
||
data = event["body"] | ||
fields_masked = data_masker.mask(data=data, fields=["email", "address.street", "company_address"]) | ||
|
||
data_masker.mask(data=data, fields=["email", "address.street", "company_address"]) | ||
return {"fields_masked": fields_masked} |