@@ -44,23 +44,25 @@ class EncryptedClient(EncryptedBotoInterface):
44
44
drop-in replacement that transparently handles encryption and decryption of items.
45
45
46
46
The API matches the standard boto3 DynamoDB client interface:
47
+
47
48
https://boto3.amazonaws.com/v1/documentation/api/latest/reference/services/dynamodb.html#client
48
49
49
50
This class will encrypt/decrypt items for the following operations:
50
- * put_item
51
- * get_item
52
- * query
53
- * scan
54
- * batch_write_item
55
- * batch_get_item
56
- * transact_get_items
57
- * transact_write_items
58
51
59
- The update_item operation is not currently supported. Calling this operation will raise NotImplementedError.
52
+ * ``put_item``
53
+ * ``get_item``
54
+ * ``query``
55
+ * ``scan``
56
+ * ``batch_write_item``
57
+ * ``batch_get_item``
58
+ * ``transact_get_items``
59
+ * ``transact_write_items``
60
+
61
+ The ``update_item`` operation is not currently supported. Calling this operation will raise ``NotImplementedError``.
60
62
61
63
Any other operations on this class will defer to the underlying boto3 DynamoDB client's implementation.
62
64
63
- EncryptedClient can also return an EncryptedPaginator for transparent decryption of paginated results.
65
+ `` EncryptedClient`` can also return an `` EncryptedPaginator`` for transparent decryption of paginated results.
64
66
"""
65
67
66
68
_client : botocore .client .BaseClient
@@ -76,15 +78,15 @@ def __init__(
76
78
expect_standard_dictionaries : bool | None = False ,
77
79
):
78
80
"""
79
- Create an EncryptedClient object.
81
+ Create an `` EncryptedClient`` object.
80
82
81
83
Args:
82
84
client (botocore.client.BaseClient): Initialized boto3 DynamoDB client
83
85
encryption_config (DynamoDbTablesEncryptionConfig): Initialized DynamoDbTablesEncryptionConfig
84
86
expect_standard_dictionaries (Optional[bool]): Does the underlying boto3 client expect items
85
87
to be standard Python dictionaries? This should only be set to True if you are using a
86
- client obtained from a service resource or table resource (ex: `table.meta.client`).
87
- If this is True, EncryptedClient will expect item-like shapes to be
88
+ client obtained from a service resource or table resource (ex: `` table.meta.client` `).
89
+ If this is True, `` EncryptedClient`` will expect item-like shapes to be
88
90
standard Python dictionaries (default: False).
89
91
90
92
"""
@@ -99,15 +101,16 @@ def put_item(self, **kwargs) -> dict[str, Any]:
99
101
"""
100
102
Put a single item to a table. Encrypts the item before writing to DynamoDB.
101
103
102
- The parameters and return value match the boto3 DynamoDB put_item API:
104
+ The input and output syntaxes match those for the boto3 DynamoDB ``put_item`` API:
105
+
103
106
https://boto3.amazonaws.com/v1/documentation/api/latest/reference/services/dynamodb/client/put_item.html
104
107
105
108
Args:
106
- **kwargs: Keyword arguments to pass to the operation. These match the boto3 put_item API parameters .
107
- The "Item" argument will be encrypted locally before being written to DynamoDB.
109
+ **kwargs: Keyword arguments to pass to the operation. This matches the boto3 `` put_item`` request syntax .
110
+ The value in `` "Item"`` will be encrypted locally before being written to DynamoDB.
108
111
109
112
Returns:
110
- dict: The response from DynamoDB. This matches the boto3 put_item API response.
113
+ dict: The response from DynamoDB. This matches the boto3 `` put_item`` response syntax .
111
114
112
115
"""
113
116
return self ._client_operation_logic (
@@ -127,15 +130,16 @@ def get_item(self, **kwargs) -> dict[str, Any]:
127
130
"""
128
131
Get a single item from a table. Decrypts the item after reading from DynamoDB.
129
132
130
- The parameters and return value match the boto3 DynamoDB get_item API:
133
+ The input and output syntaxes match those for the boto3 DynamoDB ``get_item`` API:
134
+
131
135
https://boto3.amazonaws.com/v1/documentation/api/latest/reference/services/dynamodb/client/get_item.html
132
136
133
137
Args:
134
- **kwargs: Keyword arguments to pass to the operation. These match the boto3 get_item API parameters .
138
+ **kwargs: Keyword arguments to pass to the operation. This matches the boto3 `` get_item`` request syntax .
135
139
136
140
Returns:
137
- dict: The response from DynamoDB. This matches the boto3 get_item API response.
138
- The "Item" field will be decrypted locally after being read from DynamoDB.
141
+ dict: The response from DynamoDB. This matches the boto3 `` get_item`` response syntax .
142
+ The value in `` "Item"`` field be decrypted locally after being read from DynamoDB.
139
143
140
144
"""
141
145
return self ._client_operation_logic (
@@ -156,6 +160,7 @@ def query(self, **kwargs) -> dict[str, Any]:
156
160
Query items from a table or index. Decrypts any returned items.
157
161
158
162
The parameters and return value match the boto3 DynamoDB query API:
163
+
159
164
https://boto3.amazonaws.com/v1/documentation/api/latest/reference/services/dynamodb/client/query.html
160
165
161
166
Args:
@@ -183,15 +188,16 @@ def scan(self, **kwargs) -> dict[str, Any]:
183
188
"""
184
189
Scan an entire table or index. Decrypts any returned items.
185
190
186
- The parameters and return value match the boto3 DynamoDB scan API:
191
+ The input and output syntaxes match those for the boto3 DynamoDB ``scan`` API:
192
+
187
193
https://boto3.amazonaws.com/v1/documentation/api/latest/reference/services/dynamodb/client/scan.html
188
194
189
195
Args:
190
- **kwargs: Keyword arguments to pass to the operation. These match the boto3 scan API parameters .
196
+ **kwargs: Keyword arguments to pass to the operation. This matches the boto3 `` scan`` request syntax .
191
197
192
198
Returns:
193
- dict: The response from DynamoDB. This matches the boto3 scan API response.
194
- The "Items" field will be decrypted locally after being read from DynamoDB.
199
+ dict: The response from DynamoDB. This matches the boto3 `` scan`` response syntax .
200
+ The values in `` "Items"`` will be decrypted locally after being read from DynamoDB.
195
201
196
202
"""
197
203
return self ._client_operation_logic (
@@ -213,16 +219,17 @@ def batch_write_item(self, **kwargs) -> dict[str, Any]:
213
219
214
220
For put operations, encrypts items before writing.
215
221
216
- The parameters and return value match the boto3 DynamoDB batch_write_item API:
222
+ The input and output syntaxes match those for the boto3 DynamoDB ``batch_write_item`` API:
223
+
217
224
https://boto3.amazonaws.com/v1/documentation/api/latest/reference/services/dynamodb/client/batch_write_item.html
218
225
219
226
Args:
220
- **kwargs: Keyword arguments to pass to the operation. These match the boto3 batch_write_item API parameters.
221
- Any put operations in the "RequestItems" argument will be encrypted locally
222
- before being written to DynamoDB.
227
+ **kwargs: Keyword arguments to pass to the operation. This matches the boto3 `` batch_write_item``
228
+ request syntax. Items in ``"PutRequest"`` values in the `` "RequestItems"`` argument will be encrypted
229
+ locally before being written to DynamoDB.
223
230
224
231
Returns:
225
- dict: The response from DynamoDB. This matches the boto3 batch_write_item API response.
232
+ dict: The response from DynamoDB. This matches the boto3 `` batch_write_item`` response syntax .
226
233
227
234
"""
228
235
return self ._client_operation_logic (
@@ -242,15 +249,17 @@ def batch_get_item(self, **kwargs) -> dict[str, Any]:
242
249
"""
243
250
Get multiple items from one or more tables. Decrypts any returned items.
244
251
245
- The parameters and return value match the boto3 DynamoDB batch_get_item API:
252
+ The input and output syntaxes match those for the boto3 DynamoDB ``batch_get_item`` API:
253
+
246
254
https://boto3.amazonaws.com/v1/documentation/api/latest/reference/services/dynamodb/client/batch_get_item.html
247
255
248
256
Args:
249
- **kwargs: Keyword arguments to pass to the operation. These match the boto3 batch_get_item API parameters.
257
+ **kwargs: Keyword arguments to pass to the operation. This matches the boto3 ``batch_get_item``
258
+ request syntax.
250
259
251
260
Returns:
252
- dict: The response from DynamoDB. This matches the boto3 batch_get_item API response.
253
- The "Responses" field will be decrypted locally after being read from DynamoDB.
261
+ dict: The response from DynamoDB. This matches the boto3 `` batch_get_item`` response syntax .
262
+ The values in `` "Responses"`` will be decrypted locally after being read from DynamoDB.
254
263
255
264
"""
256
265
return self ._client_operation_logic (
@@ -270,15 +279,16 @@ def transact_get_items(self, **kwargs) -> dict[str, Any]:
270
279
"""
271
280
Get multiple items in a single transaction. Decrypts any returned items.
272
281
273
- The parameters and return value match the boto3 DynamoDB transact_get_items API:
282
+ The input and output syntaxes match those for the boto3 DynamoDB ``transact_get_items`` API:
283
+
274
284
https://boto3.amazonaws.com/v1/documentation/api/latest/reference/services/dynamodb/client/transact_get_items.html
275
285
276
286
Args:
277
- **kwargs: Keyword arguments to pass to the operation. These match the boto3 transact_get_items API
278
- parameters .
287
+ **kwargs: Keyword arguments to pass to the operation. This matches the boto3 `` transact_get_items``
288
+ request syntax .
279
289
280
290
Returns:
281
- dict: The response from DynamoDB. This matches the boto3 transact_get_items API response.
291
+ dict: The response from DynamoDB. This matches the boto3 `` transact_get_items`` response syntax .
282
292
283
293
"""
284
294
return self ._client_operation_logic (
@@ -300,16 +310,17 @@ def transact_write_items(self, **kwargs) -> dict[str, Any]:
300
310
301
311
For put operations, encrypts items before writing.
302
312
303
- The parameters and return value match the boto3 DynamoDB transact_write_items API:
313
+ The input and output syntaxes match those for the boto3 DynamoDB ``transact_write_items`` API:
314
+
304
315
https://boto3.amazonaws.com/v1/documentation/api/latest/reference/services/dynamodb/client/transact_write_items.html
305
316
306
317
Args:
307
- **kwargs: Keyword arguments to pass to the operation. These match the boto3 transact_write_items API
308
- parameters . Any put operations in the "TransactItems" argument will be encrypted locally
309
- before being written to DynamoDB.
318
+ **kwargs: Keyword arguments to pass to the operation. This matches the boto3 `` transact_write_items``
319
+ request syntax . Any ``"PutRequest"`` values in the `` "TransactItems"`` argument will be encrypted
320
+ locally before being written to DynamoDB.
310
321
311
322
Returns:
312
- dict: The response from DynamoDB. This matches the boto3 transact_write_items API response.
323
+ dict: The response from DynamoDB. This matches the boto3 `` transact_write_items`` response syntax .
313
324
314
325
"""
315
326
return self ._client_operation_logic (
@@ -351,8 +362,8 @@ def get_paginator(self, operation_name: str) -> EncryptedPaginator | botocore.cl
351
362
operation_name (str): Name of operation for which to get paginator
352
363
353
364
Returns:
354
- EncryptedPaginator | botocore.client.Paginator: A paginator that will transparently decrypt items
355
- for scan/ query operations, or the standard paginator for other operations .
365
+ EncryptedPaginator | botocore.client.Paginator: An EncryptedPaginator that will transparently decrypt items
366
+ for `` scan``/`` query`` operations; for other operations, the standard paginator.
356
367
357
368
"""
358
369
paginator = self ._client .get_paginator (operation_name )
0 commit comments