Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

docs(api): migrating the idempotency utility to mkdocstrings #6007

Merged
merged 1 commit into from
Feb 3, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions aws_lambda_powertools/utilities/idempotency/base.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
"""
Base for Idempotency utility
!!! abstract "Usage Documentation"
[`Idempotency`](../../utilities/idempotency.md)
"""

from __future__ import annotations

import datetime
Expand Down
24 changes: 12 additions & 12 deletions aws_lambda_powertools/utilities/idempotency/idempotency.py
Original file line number Diff line number Diff line change
Expand Up @@ -61,20 +61,20 @@ def idempotent(
key_prefix: str | Optional
Custom prefix for idempotency key: key_prefix#hash

Examples
Example
--------
**Processes Lambda's event in an idempotent manner**

>>> from aws_lambda_powertools.utilities.idempotency import (
>>> idempotent, DynamoDBPersistenceLayer, IdempotencyConfig
>>> )
>>>
>>> idem_config=IdempotencyConfig(event_key_jmespath="body")
>>> persistence_layer = DynamoDBPersistenceLayer(table_name="idempotency_store")
>>>
>>> @idempotent(config=idem_config, persistence_store=persistence_layer)
>>> def handler(event, context):
>>> return {"StatusCode": 200}
from aws_lambda_powertools.utilities.idempotency import (
idempotent, DynamoDBPersistenceLayer, IdempotencyConfig
)

idem_config=IdempotencyConfig(event_key_jmespath="body")
persistence_layer = DynamoDBPersistenceLayer(table_name="idempotency_store")

@idempotent(config=idem_config, persistence_store=persistence_layer)
def handler(event, context):
return {"StatusCode": 200}
"""

# Skip idempotency controls when POWERTOOLS_IDEMPOTENCY_DISABLED has a truthy value
Expand Down Expand Up @@ -136,7 +136,7 @@ def idempotent_function(
key_prefix: str | Optional
Custom prefix for idempotency key: key_prefix#hash

Examples
Example
--------
**Processes an order in an idempotent manner**

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ def __init__(
boto3_client : DynamoDBClient, optional
Boto3 DynamoDB Client to use, boto3_session and boto_config will be ignored if both are provided

Examples
Example
--------
**Create a DynamoDB persistence layer with custom settings**

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ def __init__(
ssl: bool, optional: default True
set whether to use ssl for Redis connection

Examples
Example
--------

```python
Expand Down
2 changes: 1 addition & 1 deletion aws_lambda_powertools/utilities/parameters/base.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
"""
Base for Parameter providers
!!! abstract "Usage Documentation"
[`Parameters`](../utilities/parameters.md)
[`Parameters`](../../utilities/parameters.md)
"""

from __future__ import annotations
Expand Down
2 changes: 2 additions & 0 deletions docs/api_doc/idempotency/base.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
<!-- markdownlint-disable MD043 MD041 -->
::: aws_lambda_powertools.utilities.idempotency.base
2 changes: 2 additions & 0 deletions docs/api_doc/idempotency/config.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
<!-- markdownlint-disable MD043 MD041 -->
::: aws_lambda_powertools.utilities.idempotency.config
2 changes: 2 additions & 0 deletions docs/api_doc/idempotency/exceptions.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
<!-- markdownlint-disable MD043 MD041 -->
::: aws_lambda_powertools.utilities.idempotency.exceptions
2 changes: 2 additions & 0 deletions docs/api_doc/idempotency/persistence.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
<!-- markdownlint-disable MD043 MD041 -->
::: aws_lambda_powertools.utilities.idempotency.persistence
2 changes: 2 additions & 0 deletions docs/api_doc/idempotency/serialization.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
<!-- markdownlint-disable MD043 MD041 -->
::: aws_lambda_powertools.utilities.idempotency.serialization
6 changes: 6 additions & 0 deletions mkdocs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,12 @@ nav:
# - Casual to regular contributor: contributing/tracks/casual_regular_contributor.md
# - Customer to advocate: contributing/tracks/customer_advocate.md
- API Documentation:
- Idempotency:
- Base: api_doc/idempotency/base.md
- Config: api_doc/idempotency/config.md
- Exceptions: api_doc/idempotency/exceptions.md
- Persistence: api_doc/idempotency/persistence.md
- Serialization: api_doc/idempotency/serialization.md
- JMESPath Functions: api_doc/jmespath_functions.md
- Parameters:
- Base: api_doc/parameters/base.md
Expand Down
Loading