Skip to content

Commit

Permalink
add example
Browse files Browse the repository at this point in the history
  • Loading branch information
roger-zhangg committed Sep 7, 2023
1 parent 0622127 commit 0c790c0
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 2 deletions.
4 changes: 2 additions & 2 deletions aws_lambda_powertools/utilities/data_classes/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -27,7 +27,7 @@
__all__ = [
"APIGatewayProxyEvent",
"APIGatewayProxyEventV2",
"SecretManagerEvents",
"SecretManagerEvent",
"AppSyncResolverEvent",
"ALBEvent",
"CloudWatchDashboardCustomWidgetEvent",
Expand Down
20 changes: 20 additions & 0 deletions docs/utilities/data_classes.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 0c790c0

Please sign in to comment.