Skip to content

Commit 0142f15

Browse files
optional dependency
Co-authored-by: Lucas McDonald <[email protected]>
1 parent 522b0f9 commit 0142f15

File tree

5 files changed

+11
-16
lines changed

5 files changed

+11
-16
lines changed

DynamoDbEncryption/runtimes/python/pyproject.toml

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,11 @@ include = ["**/internaldafny/generated/*.py"]
1313
[tool.poetry.dependencies]
1414
python = "^3.11.0"
1515
aws-cryptographic-material-providers = { path = "../../../submodules/MaterialProviders/AwsCryptographicMaterialProviders/runtimes/python", develop = false}
16-
dynamodb_encryption_sdk = "^3.3.0"
16+
# Optional dependencies
17+
dynamodb_encryption_sdk = { version = "^3.3.0", optional = true }
18+
19+
[tool.poetry.extras]
20+
legacy-ddbec = ["dynamodb_encryption_sdk"]
1721

1822
# Package testing
1923

DynamoDbEncryption/runtimes/python/src/aws_dbesdk_dynamodb/internaldafny/extern/InternalLegacyOverride.py

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,6 @@
33
from aws_dbesdk_dynamodb.internaldafny.generated.AwsCryptographyDbEncryptionSdkDynamoDbItemEncryptorTypes import (
44
DynamoDbItemEncryptorConfig_DynamoDbItemEncryptorConfig,
55
Error_DynamoDbItemEncryptorException,
6-
EncryptItemOutput_EncryptItemOutput,
7-
DecryptItemOutput_DecryptItemOutput,
86
DecryptItemInput_DecryptItemInput,
97
EncryptItemInput_EncryptItemInput,
108
)
@@ -72,10 +70,6 @@ def Build(config: DynamoDbItemEncryptorConfig_DynamoDbItemEncryptorConfig):
7270
legacy_instance = InternalLegacyOverride()
7371
legacy_instance.encryptor = legacy_override.encryptor
7472
legacy_instance.policy = legacy_override.policy
75-
# # Access the value property, not calling it as a function
76-
# legacy_instance.encryption_context = maybe_encryption_context.value
77-
# # Access the value property, not calling it as a function
78-
# legacy_instance.attribute_actions = maybe_actions.value
7973
legacy_instance.crypto_config = CryptoConfig(
8074
materials_provider=legacy_override.encryptor._materials_provider,
8175
encryption_context=maybe_encryption_context.value,

Examples/runtimes/python/Migration/src/ddbec_to_awsdbe/awsdbe/common.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -157,7 +157,7 @@ def setup_awsdbe_client_with_legacy_override(kms_key_id: str, ddb_table_name: st
157157
policy=policy,
158158
)
159159

160-
# 1. Create a Keyring. This Keyring will be responsible for protecting the data keys that protect your data.
160+
# 3. Create a Keyring. This Keyring will be responsible for protecting the data keys that protect your data.
161161
# For this example, we will create a AWS KMS Keyring with the AWS KMS Key we want to use.
162162
# We will use the `CreateMrkMultiKeyring` method to create this keyring,
163163
# as it will correctly handle both single region and Multi-Region KMS Keys.
@@ -167,7 +167,7 @@ def setup_awsdbe_client_with_legacy_override(kms_key_id: str, ddb_table_name: st
167167
)
168168
kms_mrk_multi_keyring: IKeyring = mat_prov.create_aws_kms_mrk_multi_keyring(input=kms_mrk_multi_keyring_input)
169169

170-
# 2. Configure which attributes are encrypted and/or signed when writing new items.
170+
# 4. Configure which attributes are encrypted and/or signed when writing new items.
171171
# For each attribute that may exist on the items we plan to write to our DynamoDbTable,
172172
# we must explicitly configure how they should be treated during item encryption:
173173
# - ENCRYPT_AND_SIGN: The attribute is encrypted and included in the signature
@@ -181,7 +181,7 @@ def setup_awsdbe_client_with_legacy_override(kms_key_id: str, ddb_table_name: st
181181
":attribute3": CryptoAction.DO_NOTHING,
182182
}
183183

184-
# 3. Configure which attributes we expect to be included in the signature
184+
# 5. Configure which attributes we expect to be included in the signature
185185
# when reading items. There are two options for configuring this:
186186
#
187187
# - (Recommended) Configure `allowedUnsignedAttributesPrefix`:
@@ -211,7 +211,7 @@ def setup_awsdbe_client_with_legacy_override(kms_key_id: str, ddb_table_name: st
211211
# the ":" prefix should be considered unauthenticated.
212212
unsignAttrPrefix: str = ":"
213213

214-
# 4. Create the DynamoDb Encryption configuration for the table we will be writing to.
214+
# 6. Create the DynamoDb Encryption configuration for the table we will be writing to.
215215
# without the legacy override
216216
table_configs = {}
217217
table_config = DynamoDbTableEncryptionConfig(
@@ -235,7 +235,7 @@ def setup_awsdbe_client_with_legacy_override(kms_key_id: str, ddb_table_name: st
235235
table_configs[ddb_table_name] = table_config
236236
tables_config = DynamoDbTablesEncryptionConfig(table_encryption_configs=table_configs)
237237

238-
# 5. Create the EncryptedClient
238+
# 7. Create the EncryptedClient
239239
return EncryptedClient(
240240
client=boto3.client("dynamodb"),
241241
encryption_config=tables_config,

Examples/runtimes/python/Migration/src/ddbec_to_awsdbe/awsdbe/migration_step_1.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,6 @@
2424
"""
2525
from aws_dbesdk_dynamodb.structures.dynamodb import LegacyPolicy
2626

27-
# Import from new AWS Database Encryption SDK
28-
# Import from legacy DynamoDB Encryption Client
2927
from .common import setup_awsdbe_client_with_legacy_override
3028

3129

Examples/runtimes/python/pyproject.toml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,7 @@ authors = ["AWS Crypto Tools <[email protected]>"]
66

77
[tool.poetry.dependencies]
88
python = "^3.11.0"
9-
aws-dbesdk-dynamodb = { path = "../../../DynamoDbEncryption/runtimes/python", develop = false}
10-
dynamodb_encryption_sdk = "^3.3.0"
9+
aws-dbesdk-dynamodb = { path = "../../../DynamoDbEncryption/runtimes/python", develop = false, extras = ["legacy-ddbec"]}
1110

1211
[tool.poetry.group.test.dependencies]
1312
pytest = "^7.4.0"

0 commit comments

Comments
 (0)