Skip to content

Commit 8761c9e

Browse files
author
Lucas McDonald
committed
m
1 parent f47746e commit 8761c9e

File tree

3 files changed

+13
-1
lines changed

3 files changed

+13
-1
lines changed

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -431,7 +431,7 @@ def _client_operation_logic(
431431
transformed_request = input_transform_method(input_transform_shape(sdk_input=sdk_input)).transformed_input
432432

433433
# If _expect_standard_dictionaries is true, the boto3 client expects items to be standard dictionaries,
434-
# and needs to convert the DDB-JSON to a standard dictionary before passing the request to the boto3 client.
434+
# and need to be converted from DDB-JSON to a standard dictionary before being passed to the boto3 client.
435435
if self._expect_standard_dictionaries:
436436
transformed_request = input_item_to_dict_transform_method(transformed_request)
437437

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

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -138,13 +138,18 @@ def _paginate_request(
138138
except KeyError:
139139
pagination_config = None
140140

141+
# If _expect_standard_dictionaries is true, input items are expected to be standard dictionaries,
142+
# and need to be converted to DDB-JSON before encryption.
141143
if self._expect_standard_dictionaries:
142144
if "TableName" in client_kwargs:
143145
self._resource_to_client_shape_converter.table_name = client_kwargs["TableName"]
144146
client_kwargs = input_item_to_ddb_transform_method(client_kwargs)
145147

148+
# Apply DBESDK transformations to the input
146149
transformed_request = input_transform_method(input_transform_shape(sdk_input=client_kwargs)).transformed_input
147150

151+
# If _expect_standard_dictionaries is true, the boto3 client expects items to be standard dictionaries,
152+
# and need to be converted from DDB-JSON to a standard dictionary before being passed to the boto3 client.
148153
if self._expect_standard_dictionaries:
149154
transformed_request = input_item_to_dict_transform_method(transformed_request)
150155

@@ -154,18 +159,24 @@ def _paginate_request(
154159
sdk_page_response = self._paginator.paginate(**transformed_request)
155160

156161
for page in sdk_page_response:
162+
# If _expect_standard_dictionaries is true, the boto3 client returns items as standard dictionaries,
163+
# and needs to convert the standard dictionary to DDB-JSON before passing the response to the DBESDK.
157164
if self._expect_standard_dictionaries:
158165
page = output_item_to_ddb_transform_method(page)
159166

167+
# Apply DBESDK transformation to the boto3 output
160168
dbesdk_response = output_transform_method(
161169
output_transform_shape(
162170
original_input=client_kwargs,
163171
sdk_output=page,
164172
)
165173
).transformed_output
166174

175+
# Copy any missing fields from the SDK output to the response (e.g. ConsumedCapacity)
167176
dbesdk_response = self._copy_sdk_response_to_dbesdk_response(page, dbesdk_response)
168177

178+
# If _expect_standard_dictionaries is true, the boto3 client expects items to be standard dictionaries,
179+
# and need to be converted from DDB-JSON to a standard dictionary before returning the response.
169180
if self._expect_standard_dictionaries:
170181
dbesdk_response = output_item_to_dict_transform_method(dbesdk_response)
171182

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ class EncryptedTablesCollectionManager(EncryptedBotoInterface):
3131
Collection manager that provides EncryptedTable objects.
3232
3333
The API matches boto3's tables collection manager interface:
34+
3435
https://boto3.amazonaws.com/v1/documentation/api/latest/reference/services/dynamodb/service-resource/tables.html
3536
3637
All operations on this class will yield EncryptedTable objects.

0 commit comments

Comments
 (0)