Skip to content

Commit af13807

Browse files
docs(api): migrating the idempotency utility to mkdocstrings (#6007)
Mkdocstrings - Idempotency module
1 parent 9043ee2 commit af13807

File tree

11 files changed

+37
-15
lines changed

11 files changed

+37
-15
lines changed

aws_lambda_powertools/utilities/idempotency/base.py

+6
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,9 @@
1+
"""
2+
Base for Idempotency utility
3+
!!! abstract "Usage Documentation"
4+
[`Idempotency`](../../utilities/idempotency.md)
5+
"""
6+
17
from __future__ import annotations
28

39
import datetime

aws_lambda_powertools/utilities/idempotency/idempotency.py

+12-12
Original file line numberDiff line numberDiff line change
@@ -61,20 +61,20 @@ def idempotent(
6161
key_prefix: str | Optional
6262
Custom prefix for idempotency key: key_prefix#hash
6363
64-
Examples
64+
Example
6565
--------
6666
**Processes Lambda's event in an idempotent manner**
6767
68-
>>> from aws_lambda_powertools.utilities.idempotency import (
69-
>>> idempotent, DynamoDBPersistenceLayer, IdempotencyConfig
70-
>>> )
71-
>>>
72-
>>> idem_config=IdempotencyConfig(event_key_jmespath="body")
73-
>>> persistence_layer = DynamoDBPersistenceLayer(table_name="idempotency_store")
74-
>>>
75-
>>> @idempotent(config=idem_config, persistence_store=persistence_layer)
76-
>>> def handler(event, context):
77-
>>> return {"StatusCode": 200}
68+
from aws_lambda_powertools.utilities.idempotency import (
69+
idempotent, DynamoDBPersistenceLayer, IdempotencyConfig
70+
)
71+
72+
idem_config=IdempotencyConfig(event_key_jmespath="body")
73+
persistence_layer = DynamoDBPersistenceLayer(table_name="idempotency_store")
74+
75+
@idempotent(config=idem_config, persistence_store=persistence_layer)
76+
def handler(event, context):
77+
return {"StatusCode": 200}
7878
"""
7979

8080
# Skip idempotency controls when POWERTOOLS_IDEMPOTENCY_DISABLED has a truthy value
@@ -136,7 +136,7 @@ def idempotent_function(
136136
key_prefix: str | Optional
137137
Custom prefix for idempotency key: key_prefix#hash
138138
139-
Examples
139+
Example
140140
--------
141141
**Processes an order in an idempotent manner**
142142

aws_lambda_powertools/utilities/idempotency/persistence/dynamodb.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ def __init__(
7676
boto3_client : DynamoDBClient, optional
7777
Boto3 DynamoDB Client to use, boto3_session and boto_config will be ignored if both are provided
7878
79-
Examples
79+
Example
8080
--------
8181
**Create a DynamoDB persistence layer with custom settings**
8282

aws_lambda_powertools/utilities/idempotency/persistence/redis.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,7 @@ def __init__(
112112
ssl: bool, optional: default True
113113
set whether to use ssl for Redis connection
114114
115-
Examples
115+
Example
116116
--------
117117
118118
```python

aws_lambda_powertools/utilities/parameters/base.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
"""
22
Base for Parameter providers
33
!!! abstract "Usage Documentation"
4-
[`Parameters`](../utilities/parameters.md)
4+
[`Parameters`](../../utilities/parameters.md)
55
"""
66

77
from __future__ import annotations

docs/api_doc/idempotency/base.md

+2
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
<!-- markdownlint-disable MD043 MD041 -->
2+
::: aws_lambda_powertools.utilities.idempotency.base

docs/api_doc/idempotency/config.md

+2
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
<!-- markdownlint-disable MD043 MD041 -->
2+
::: aws_lambda_powertools.utilities.idempotency.config
+2
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
<!-- markdownlint-disable MD043 MD041 -->
2+
::: aws_lambda_powertools.utilities.idempotency.exceptions
+2
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
<!-- markdownlint-disable MD043 MD041 -->
2+
::: aws_lambda_powertools.utilities.idempotency.persistence
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
<!-- markdownlint-disable MD043 MD041 -->
2+
::: aws_lambda_powertools.utilities.idempotency.serialization

mkdocs.yml

+6
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,12 @@ nav:
6363
# - Casual to regular contributor: contributing/tracks/casual_regular_contributor.md
6464
# - Customer to advocate: contributing/tracks/customer_advocate.md
6565
- API Documentation:
66+
- Idempotency:
67+
- Base: api_doc/idempotency/base.md
68+
- Config: api_doc/idempotency/config.md
69+
- Exceptions: api_doc/idempotency/exceptions.md
70+
- Persistence: api_doc/idempotency/persistence.md
71+
- Serialization: api_doc/idempotency/serialization.md
6672
- JMESPath Functions: api_doc/jmespath_functions.md
6773
- Parameters:
6874
- Base: api_doc/parameters/base.md

0 commit comments

Comments
 (0)