|
2 | 2 | Amazon DynamoDB parameter retrieval and caching utility |
3 | 3 | """ |
4 | 4 |
|
| 5 | +import warnings |
5 | 6 | from typing import TYPE_CHECKING, Dict, Optional |
6 | 7 |
|
7 | 8 | import boto3 |
8 | 9 | from boto3.dynamodb.conditions import Key |
9 | 10 | from botocore.config import Config |
10 | 11 |
|
| 12 | +from aws_lambda_powertools.warnings import PowertoolsDeprecationWarning |
| 13 | + |
11 | 14 | from .base import BaseProvider |
12 | 15 |
|
13 | 16 | if TYPE_CHECKING: |
@@ -155,15 +158,25 @@ def __init__( |
155 | 158 | value_attr: str = "value", |
156 | 159 | endpoint_url: Optional[str] = None, |
157 | 160 | config: Optional[Config] = None, |
| 161 | + boto_config: Optional[Config] = None, |
158 | 162 | boto3_session: Optional[boto3.session.Session] = None, |
159 | 163 | boto3_client: Optional["DynamoDBServiceResource"] = None, |
160 | 164 | ): |
161 | 165 | """ |
162 | 166 | Initialize the DynamoDB client |
163 | 167 | """ |
| 168 | + if config: |
| 169 | + warnings.warn( |
| 170 | + message="The 'config' parameter is deprecated in V3 and will be removed in V4. " |
| 171 | + "Please use 'boto_config' instead.", |
| 172 | + category=PowertoolsDeprecationWarning, |
| 173 | + stacklevel=2, |
| 174 | + ) |
| 175 | + |
164 | 176 | if boto3_client is None: |
165 | 177 | boto3_session = boto3_session or boto3.session.Session() |
166 | | - boto3_client = boto3_session.resource("dynamodb", config=config, endpoint_url=endpoint_url) |
| 178 | + boto3_client = boto3_session.resource("dynamodb", config=boto_config or config, endpoint_url=endpoint_url) |
| 179 | + |
167 | 180 | self.table = boto3_client.Table(table_name) |
168 | 181 | self.key_attr = key_attr |
169 | 182 | self.sort_attr = sort_attr |
|
0 commit comments