diff --git a/aws_lambda_powertools/utilities/data_classes/__init__.py b/aws_lambda_powertools/utilities/data_classes/__init__.py index be3abb4fe18..2dd8f405018 100644 --- a/aws_lambda_powertools/utilities/data_classes/__init__.py +++ b/aws_lambda_powertools/utilities/data_classes/__init__.py @@ -18,7 +18,7 @@ from .kinesis_stream_event import KinesisStreamEvent from .lambda_function_url_event import LambdaFunctionUrlEvent from .s3_event import S3Event, S3EventBridgeNotificationEvent -from .secrets_event import SecretManagerEvents +from .secrets_event import SecretManagerEvent from .ses_event import SESEvent from .sns_event import SNSEvent from .sqs_event import SQSEvent @@ -27,7 +27,7 @@ __all__ = [ "APIGatewayProxyEvent", "APIGatewayProxyEventV2", - "SecretManagerEvents", + "SecretManagerEvent", "AppSyncResolverEvent", "ALBEvent", "CloudWatchDashboardCustomWidgetEvent", diff --git a/docs/utilities/data_classes.md b/docs/utilities/data_classes.md index 7b3aa74e275..b11583f230e 100644 --- a/docs/utilities/data_classes.md +++ b/docs/utilities/data_classes.md @@ -1161,6 +1161,26 @@ You can register your Lambda functions as targets within an Amazon VPC Lattice s --8<-- "examples/event_sources/src/vpc_lattice_payload.json" ``` +### Secrets Manager + +=== "app.py" + + ```python + from aws_lambda_powertools.utilities.data_classes import event_source, SecretManagerEvent + + @event_source(data_class=SecretManagerEvent) + def lambda_handler(event: SecretManagerEvent, context): + # Multiple records can be delivered in a single event + service_client = boto3.client('secretsmanager', endpoint_url=os.environ['SECRETS_MANAGER_ENDPOINT']) + create_secret(service_client, event.secret_id, event.client_request_token) + ... + ``` +=== "Secrets Manager Example Event" + + ```json + --8<-- "tests/events/secretManagerEvent.json" + ``` + ## Advanced ### Debugging