Skip to content

Commit 603b68a

Browse files
author
Lucas McDonald
committed
m
1 parent 72eadd1 commit 603b68a

File tree

3 files changed

+13
-7
lines changed

3 files changed

+13
-7
lines changed

DynamoDbEncryption/runtimes/python/src/aws_dbesdk_dynamodb/encrypted/item.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# Copyright Amazon.com Inc. or its affiliates. All Rights Reserved.
22
# SPDX-License-Identifier: Apache-2.0
3-
"""Top-level class for encrypting and decrypting individual DynamoDB items."""
3+
"""Class for encrypting and decrypting individual DynamoDB items."""
44
from typing import Any
55

66
from aws_dbesdk_dynamodb.smithygenerated.aws_cryptography_dbencryptionsdk_dynamodb_itemencryptor.client import (

DynamoDbEncryption/runtimes/python/src/aws_dbesdk_dynamodb/encrypted/paginator.py

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# Copyright Amazon.com Inc. or its affiliates. All Rights Reserved.
22
# SPDX-License-Identifier: Apache-2.0
3-
"""High-level helper class to provide an encrypting wrapper for boto3 DynamoDB clients."""
3+
"""High-level helper class to provide an encrypting wrapper for boto3 DynamoDB paginators."""
44
from collections.abc import Callable, Generator
55
from copy import deepcopy
66
from typing import Any
@@ -45,7 +45,7 @@ def __init__(
4545
encryption_config (DynamoDbTablesEncryptionConfig): Encryption configuration object.
4646
expect_standard_dictionaries (Optional[bool]): Does the underlying boto3 client expect items
4747
to be standard Python dictionaries? This should only be set to True if you are using a
48-
client obtained from a service resource or table resource (ex: `table.meta.client`).
48+
client obtained from a service resource or table resource (ex: ``table.meta.client``).
4949
If this is True, EncryptedClient will expect item-like shapes to be
5050
standard Python dictionaries (default: False).
5151
@@ -62,24 +62,28 @@ def paginate(self, **kwargs) -> Generator[dict, None, None]:
6262
Yield a generator that paginates through responses from DynamoDB, decrypting items.
6363
6464
Note:
65-
Calling `botocore.paginate.Paginator`'s `paginate` method for Query or Scan
66-
returns a `PageIterator` object, but this implementation returns a Python generator.
65+
Calling ``botocore.paginate.Paginator``'s ``paginate`` method for Query or Scan
66+
returns a ``PageIterator`` object, but this implementation returns a Python generator.
6767
However, you can use this generator to iterate exactly as described in the
6868
boto3 documentation:
69+
6970
https://botocore.amazonaws.com/v1/documentation/api/latest/topics/paginators.html
71+
7072
Any other operations on this class will defer to the underlying boto3 Paginator's implementation.
7173
7274
Args:
7375
**kwargs: Keyword arguments passed directly to the underlying DynamoDB paginator.
7476
For a Scan operation, structure these arguments according to:
77+
7578
https://boto3.amazonaws.com/v1/documentation/api/latest/reference/services/dynamodb/paginator/Scan.html
7679
7780
For a Query operation, structure these arguments according to:
81+
7882
https://boto3.amazonaws.com/v1/documentation/api/latest/reference/services/dynamodb/paginator/Query.html
7983
8084
Returns:
8185
Generator[dict, None, None]: A generator yielding pages as dictionaries.
82-
The items in the pages will be decrypted locally after being read from DynamoDB.
86+
The items in the pages will be decrypted locally after being read from DynamoDB.
8387
8488
"""
8589
if self._paginator._model.name == "Query":

DynamoDbEncryption/runtimes/python/src/aws_dbesdk_dynamodb/encrypted/table.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
# SPDX-License-Identifier: Apache-2.0
33
"""High-level helper class to provide an encrypting wrapper for boto3 DynamoDB tables."""
44
from collections.abc import Callable
5+
from copy import deepcopy
56
from typing import Any
67

78
from boto3.dynamodb.table import BatchWriter
@@ -268,9 +269,10 @@ def _table_operation_logic(
268269
dict: The transformed response from DynamoDB
269270
270271
"""
272+
table_input = deepcopy(operation_input)
271273
# EncryptedTable inputs are formatted as standard dictionaries, but DBESDK transformations expect DynamoDB JSON.
272274
# Convert from standard dictionaries to DynamoDB JSON.
273-
input_transform_input = input_resource_to_client_shape_transform_method(operation_input)
275+
input_transform_input = input_resource_to_client_shape_transform_method(table_input)
274276

275277
# Apply DBESDK transformation to the input
276278
input_transform_output = input_encryption_transform_method(

0 commit comments

Comments
 (0)