From 0f800109ca9ad2be785adf0051946c550edce2e0 Mon Sep 17 00:00:00 2001 From: rishav-karanjit Date: Tue, 19 Mar 2024 15:50:10 -0700 Subject: [PATCH 01/67] Add parser --- ...yptographyDbEncryptionSdkDynamoDbTypes.dfy | 69 ++++++++++++++++ .../Model/DynamoDbEncryption.smithy | 40 +++++++++- ...raphyDbEncryptionSdkDynamoDbOperations.dfy | 78 +++++++++++++++++++ 3 files changed, 185 insertions(+), 2 deletions(-) diff --git a/DynamoDbEncryption/dafny/DynamoDbEncryption/Model/AwsCryptographyDbEncryptionSdkDynamoDbTypes.dfy b/DynamoDbEncryption/dafny/DynamoDbEncryption/Model/AwsCryptographyDbEncryptionSdkDynamoDbTypes.dfy index 9d2bbb34e..418b5bb97 100644 --- a/DynamoDbEncryption/dafny/DynamoDbEncryption/Model/AwsCryptographyDbEncryptionSdkDynamoDbTypes.dfy +++ b/DynamoDbEncryption/dafny/DynamoDbEncryption/Model/AwsCryptographyDbEncryptionSdkDynamoDbTypes.dfy @@ -91,8 +91,10 @@ include "../../../../submodules/MaterialProviders/StandardLibrary/src/Index.dfy" class IDynamoDbEncryptionClientCallHistory { ghost constructor() { CreateDynamoDbEncryptionBranchKeyIdSupplier := []; + GetEncryptedDataKeyDescription := []; } ghost var CreateDynamoDbEncryptionBranchKeyIdSupplier: seq>> + ghost var GetEncryptedDataKeyDescription: seq>> } trait {:termination false} IDynamoDbEncryptionClient { @@ -145,6 +147,21 @@ include "../../../../submodules/MaterialProviders/StandardLibrary/src/Index.dfy" ensures CreateDynamoDbEncryptionBranchKeyIdSupplierEnsuresPublicly(input, output) ensures History.CreateDynamoDbEncryptionBranchKeyIdSupplier == old(History.CreateDynamoDbEncryptionBranchKeyIdSupplier) + [DafnyCallEvent(input, output)] + predicate GetEncryptedDataKeyDescriptionEnsuresPublicly(input: GetEncryptedDataKeyDescriptionInput , output: Result) + // The public method to be called by library consumers + method GetEncryptedDataKeyDescription ( input: GetEncryptedDataKeyDescriptionInput ) + returns (output: Result) + requires + && ValidState() + modifies Modifies - {History} , + History`GetEncryptedDataKeyDescription + // Dafny will skip type parameters when generating a default decreases clause. + decreases Modifies - {History} + ensures + && ValidState() + ensures GetEncryptedDataKeyDescriptionEnsuresPublicly(input, output) + ensures History.GetEncryptedDataKeyDescription == old(History.GetEncryptedDataKeyDescription) + [DafnyCallEvent(input, output)] + } datatype DynamoDbEncryptionConfig = | DynamoDbEncryptionConfig ( @@ -232,6 +249,13 @@ include "../../../../submodules/MaterialProviders/StandardLibrary/src/Index.dfy" datatype DynamoDbTablesEncryptionConfig = | DynamoDbTablesEncryptionConfig ( nameonly tableEncryptionConfigs: DynamoDbTableEncryptionConfigList ) + type EncryptedDataKeyDescriptionList = seq + datatype EncryptedDataKeyDescriptionOutput = | EncryptedDataKeyDescriptionOutput ( + nameonly keyProviderId: string , + nameonly keyProviderInfo: string , + nameonly branchKeyId: Option , + nameonly branchKeyVersion: Option + ) datatype EncryptedPart = | EncryptedPart ( nameonly name: string , nameonly prefix: Prefix @@ -246,6 +270,15 @@ include "../../../../submodules/MaterialProviders/StandardLibrary/src/Index.dfy" datatype GetBranchKeyIdFromDdbKeyOutput = | GetBranchKeyIdFromDdbKeyOutput ( nameonly branchKeyId: string ) + datatype GetEncryptedDataKeyDescriptionInput = | GetEncryptedDataKeyDescriptionInput ( + nameonly input: GetEncryptedDataKeyDescriptionUnion + ) + datatype GetEncryptedDataKeyDescriptionOutput = | GetEncryptedDataKeyDescriptionOutput ( + nameonly EncryptedDataKeyDescriptionOutput: EncryptedDataKeyDescriptionList + ) + datatype GetEncryptedDataKeyDescriptionUnion = + | header(header: seq) + | plaintextItem(plaintextItem: ComAmazonawsDynamodbTypes.AttributeMap) datatype GetPrefix = | GetPrefix ( nameonly length: int32 ) @@ -510,6 +543,26 @@ include "../../../../submodules/MaterialProviders/StandardLibrary/src/Index.dfy" History.CreateDynamoDbEncryptionBranchKeyIdSupplier := History.CreateDynamoDbEncryptionBranchKeyIdSupplier + [DafnyCallEvent(input, output)]; } + predicate GetEncryptedDataKeyDescriptionEnsuresPublicly(input: GetEncryptedDataKeyDescriptionInput , output: Result) + {Operations.GetEncryptedDataKeyDescriptionEnsuresPublicly(input, output)} + // The public method to be called by library consumers + method GetEncryptedDataKeyDescription ( input: GetEncryptedDataKeyDescriptionInput ) + returns (output: Result) + requires + && ValidState() + modifies Modifies - {History} , + History`GetEncryptedDataKeyDescription + // Dafny will skip type parameters when generating a default decreases clause. + decreases Modifies - {History} + ensures + && ValidState() + ensures GetEncryptedDataKeyDescriptionEnsuresPublicly(input, output) + ensures History.GetEncryptedDataKeyDescription == old(History.GetEncryptedDataKeyDescription) + [DafnyCallEvent(input, output)] + { + output := Operations.GetEncryptedDataKeyDescription(config, input); + History.GetEncryptedDataKeyDescription := History.GetEncryptedDataKeyDescription + [DafnyCallEvent(input, output)]; +} + } } abstract module AbstractAwsCryptographyDbEncryptionSdkDynamoDbOperations { @@ -541,4 +594,20 @@ include "../../../../submodules/MaterialProviders/StandardLibrary/src/Index.dfy" && fresh(output.value.branchKeyIdSupplier) && fresh ( output.value.branchKeyIdSupplier.Modifies - ModifiesInternalConfig(config) - input.ddbKeyBranchKeyIdSupplier.Modifies ) ) ensures CreateDynamoDbEncryptionBranchKeyIdSupplierEnsuresPublicly(input, output) + + + predicate GetEncryptedDataKeyDescriptionEnsuresPublicly(input: GetEncryptedDataKeyDescriptionInput , output: Result) + // The private method to be refined by the library developer + + + method GetEncryptedDataKeyDescription ( config: InternalConfig , input: GetEncryptedDataKeyDescriptionInput ) + returns (output: Result) + requires + && ValidInternalConfig?(config) + modifies ModifiesInternalConfig(config) + // Dafny will skip type parameters when generating a default decreases clause. + decreases ModifiesInternalConfig(config) + ensures + && ValidInternalConfig?(config) + ensures GetEncryptedDataKeyDescriptionEnsuresPublicly(input, output) } diff --git a/DynamoDbEncryption/dafny/DynamoDbEncryption/Model/DynamoDbEncryption.smithy b/DynamoDbEncryption/dafny/DynamoDbEncryption/Model/DynamoDbEncryption.smithy index eac7192b1..56dc96c48 100644 --- a/DynamoDbEncryption/dafny/DynamoDbEncryption/Model/DynamoDbEncryption.smithy +++ b/DynamoDbEncryption/dafny/DynamoDbEncryption/Model/DynamoDbEncryption.smithy @@ -20,6 +20,7 @@ use aws.cryptography.keyStore#KeyStore use aws.cryptography.dbEncryptionSdk.structuredEncryption#CryptoAction use com.amazonaws.dynamodb#DynamoDB_20120810 +use com.amazonaws.dynamodb#AttributeMap use com.amazonaws.dynamodb#TableName use com.amazonaws.dynamodb#AttributeName use com.amazonaws.dynamodb#Key @@ -42,11 +43,46 @@ use aws.cryptography.materialProviders#AwsCryptographicMaterialProviders ] ) service DynamoDbEncryption { - version: "2022-11-21", - operations: [ CreateDynamoDbEncryptionBranchKeyIdSupplier ], + version: "2024-03-06", + operations: [ CreateDynamoDbEncryptionBranchKeyIdSupplier, GetEncryptedDataKeyDescription], errors: [ DynamoDbEncryptionException ] } +operation GetEncryptedDataKeyDescription { + input: GetEncryptedDataKeyDescriptionInput, + output: GetEncryptedDataKeyDescriptionOutput, +} + +structure GetEncryptedDataKeyDescriptionInput { + @required + input: GetEncryptedDataKeyDescriptionUnion +} + +union GetEncryptedDataKeyDescriptionUnion { + header: Blob, + plaintextItem: AttributeMap, +} + +structure GetEncryptedDataKeyDescriptionOutput { + @required + EncryptedDataKeyDescriptionOutput: EncryptedDataKeyDescriptionList +} + +list EncryptedDataKeyDescriptionList { + member: EncryptedDataKeyDescriptionOutput +} + +structure EncryptedDataKeyDescriptionOutput { + @required + keyProviderId: String, + + @required + keyProviderInfo: String, + + branchKeyId: String, + + branchKeyVersion: String +} // The top level DynamoDbEncryption local service takes in no config structure DynamoDbEncryptionConfig { } diff --git a/DynamoDbEncryption/dafny/DynamoDbEncryption/src/AwsCryptographyDbEncryptionSdkDynamoDbOperations.dfy b/DynamoDbEncryption/dafny/DynamoDbEncryption/src/AwsCryptographyDbEncryptionSdkDynamoDbOperations.dfy index b2138e353..02f90c568 100644 --- a/DynamoDbEncryption/dafny/DynamoDbEncryption/src/AwsCryptographyDbEncryptionSdkDynamoDbOperations.dfy +++ b/DynamoDbEncryption/dafny/DynamoDbEncryption/src/AwsCryptographyDbEncryptionSdkDynamoDbOperations.dfy @@ -5,6 +5,12 @@ include "DynamoDbEncryptionBranchKeyIdSupplier.dfy" module AwsCryptographyDbEncryptionSdkDynamoDbOperations refines AbstractAwsCryptographyDbEncryptionSdkDynamoDbOperations { import DynamoDbEncryptionBranchKeyIdSupplier + import EdkWrapping + import UUID + import AlgorithmSuites + import DynamoToStruct + + import Header = StructuredEncryptionHeader predicate ValidInternalConfig?(config: InternalConfig) {true} @@ -33,4 +39,76 @@ module AwsCryptographyDbEncryptionSdkDynamoDbOperations refines AbstractAwsCrypt ) ); } + predicate GetEncryptedDataKeyDescriptionEnsuresPublicly(input: GetEncryptedDataKeyDescriptionInput , output: Result) + {true} + + method GetEncryptedDataKeyDescription(config: InternalConfig, input: GetEncryptedDataKeyDescriptionInput) + returns (output: Result) + ensures GetEncryptedDataKeyDescriptionEnsuresPublicly(input, output) + ensures output.Success? ==> ( + match input.input { + case plaintextItem(item) => + "aws_dbe_head" in DynamoToStruct.ItemToStructured(item).Extract().Keys + && Header.PartialDeserialize(DynamoToStruct.ItemToStructured(item).Extract()["aws_dbe_head"].content.Terminal.value).Success? + case header(header) => + Header.PartialDeserialize(header).Success? + } + ) + { + var header; + match input.input + { + case plaintextItem(plaintextItem) =>{ + header := DynamoToStruct.ItemToStructured(plaintextItem).Extract()["aws_dbe_head"].content.Terminal.value; + } + case header(headeritem) => { + header := headeritem; + } + } + var deserializedHeader := Header.PartialDeserialize(header); + print deserializedHeader; + + var algorithmSuite; + if deserializedHeader.Extract().flavor == 0{ + algorithmSuite := AlgorithmSuites.DBE_ALG_AES_256_GCM_HKDF_SHA512_COMMIT_KEY_SYMSIG_HMAC_SHA384; + } + else{ + algorithmSuite := AlgorithmSuites.DBE_ALG_AES_256_GCM_HKDF_SHA512_COMMIT_KEY_ECDSA_P384_SYMSIG_HMAC_SHA384; + } + + var datakeys := deserializedHeader.Extract().dataKeys; + var list : EncryptedDataKeyDescriptionList; + for i := 0 to |datakeys| { + var singleDataKeyOutput : EncryptedDataKeyDescriptionOutput; + if UTF8.Decode(datakeys[i].keyProviderId).Extract() == "aws-kms-hierarchy" { + + var providerWrappedMaterial := EdkWrapping.GetProviderWrappedMaterial(datakeys[i].ciphertext, algorithmSuite).Extract(); + + var EDK_CIPHERTEXT_BRANCH_KEY_VERSION_INDEX := 12 + 16; + var EDK_CIPHERTEXT_VERSION_INDEX := EDK_CIPHERTEXT_BRANCH_KEY_VERSION_INDEX + 16; + + var branchKeyVersionUuid := providerWrappedMaterial[EDK_CIPHERTEXT_BRANCH_KEY_VERSION_INDEX .. EDK_CIPHERTEXT_VERSION_INDEX]; + + singleDataKeyOutput := EncryptedDataKeyDescriptionOutput( + keyProviderId := UTF8.Decode(datakeys[i].keyProviderId).Extract(), + keyProviderInfo := UTF8.Decode(datakeys[i].keyProviderInfo).Extract(), + branchKeyId := Some(UTF8.Decode(datakeys[i].keyProviderInfo).Extract()), + branchKeyVersion := Some(UUID.FromByteArray(branchKeyVersionUuid).Extract()) + ); + } + else { + singleDataKeyOutput := EncryptedDataKeyDescriptionOutput( + keyProviderId := UTF8.Decode(datakeys[i].keyProviderId).Extract(), + keyProviderInfo := UTF8.Decode(datakeys[i].keyProviderInfo).Extract(), + branchKeyId := None, + branchKeyVersion := None + ); + } + list := list + [singleDataKeyOutput]; + } + + output := Success(GetEncryptedDataKeyDescriptionOutput( + EncryptedDataKeyDescriptionOutput := list + )); + } } From a5944c6167773bcc7f50667c1e32233cbd3b6d68 Mon Sep 17 00:00:00 2001 From: rishav-karanjit Date: Thu, 21 Mar 2024 17:11:49 -0700 Subject: [PATCH 02/67] Fixed verify --- ...raphyDbEncryptionSdkDynamoDbOperations.dfy | 34 ++++++++++++++----- 1 file changed, 26 insertions(+), 8 deletions(-) diff --git a/DynamoDbEncryption/dafny/DynamoDbEncryption/src/AwsCryptographyDbEncryptionSdkDynamoDbOperations.dfy b/DynamoDbEncryption/dafny/DynamoDbEncryption/src/AwsCryptographyDbEncryptionSdkDynamoDbOperations.dfy index 02f90c568..dcc7a02d1 100644 --- a/DynamoDbEncryption/dafny/DynamoDbEncryption/src/AwsCryptographyDbEncryptionSdkDynamoDbOperations.dfy +++ b/DynamoDbEncryption/dafny/DynamoDbEncryption/src/AwsCryptographyDbEncryptionSdkDynamoDbOperations.dfy @@ -9,6 +9,7 @@ module AwsCryptographyDbEncryptionSdkDynamoDbOperations refines AbstractAwsCrypt import UUID import AlgorithmSuites import DynamoToStruct + import opened DynamoDbEncryptionUtil import Header = StructuredEncryptionHeader @@ -48,8 +49,12 @@ module AwsCryptographyDbEncryptionSdkDynamoDbOperations refines AbstractAwsCrypt ensures output.Success? ==> ( match input.input { case plaintextItem(item) => - "aws_dbe_head" in DynamoToStruct.ItemToStructured(item).Extract().Keys - && Header.PartialDeserialize(DynamoToStruct.ItemToStructured(item).Extract()["aws_dbe_head"].content.Terminal.value).Success? + DynamoToStruct.ItemToStructured(item).Success? + && var extracted := DynamoToStruct.ItemToStructured(item).Extract(); + && var keys := extracted.Keys; + && "aws_dbe_head" in DynamoToStruct.ItemToStructured(item).Extract() + && var header := DynamoToStruct.ItemToStructured(item).Extract()["aws_dbe_head"].content.Terminal.value; + && Header.PartialDeserialize(header).Success? case header(header) => Header.PartialDeserialize(header).Success? } @@ -59,16 +64,18 @@ module AwsCryptographyDbEncryptionSdkDynamoDbOperations refines AbstractAwsCrypt match input.input { case plaintextItem(plaintextItem) =>{ + :- Need(DynamoToStruct.ItemToStructured(plaintextItem).Success?, E("error")); + :- Need("aws_dbe_head" in DynamoToStruct.ItemToStructured(plaintextItem).Extract(), E("error")); header := DynamoToStruct.ItemToStructured(plaintextItem).Extract()["aws_dbe_head"].content.Terminal.value; } - case header(headeritem) => { + case header(headeritem) => header := headeritem; - } } + :- Need(Header.PartialDeserialize(header).Success?, E("error")); var deserializedHeader := Header.PartialDeserialize(header); - print deserializedHeader; var algorithmSuite; + if deserializedHeader.Extract().flavor == 0{ algorithmSuite := AlgorithmSuites.DBE_ALG_AES_256_GCM_HKDF_SHA512_COMMIT_KEY_SYMSIG_HMAC_SHA384; } @@ -77,18 +84,29 @@ module AwsCryptographyDbEncryptionSdkDynamoDbOperations refines AbstractAwsCrypt } var datakeys := deserializedHeader.Extract().dataKeys; - var list : EncryptedDataKeyDescriptionList; + var list : EncryptedDataKeyDescriptionList := []; for i := 0 to |datakeys| { var singleDataKeyOutput : EncryptedDataKeyDescriptionOutput; + + :- Need(UTF8.Decode(datakeys[i].keyProviderId).Success?, E("error")); + :- Need(UTF8.Decode(datakeys[i].keyProviderInfo).Success?, E("error")); if UTF8.Decode(datakeys[i].keyProviderId).Extract() == "aws-kms-hierarchy" { - + :- Need(EdkWrapping.GetProviderWrappedMaterial(datakeys[i].ciphertext, algorithmSuite).Success?, E("error")); + var providerWrappedMaterial := EdkWrapping.GetProviderWrappedMaterial(datakeys[i].ciphertext, algorithmSuite).Extract(); + // The ciphertext structure in the hierarchy keyring contains Salt and IV before Version. + // The length of Salt is 16 and IV is 12 bytes. + // https://github.com/awslabs/aws-encryption-sdk-specification/blob/master/framework/aws-kms/aws-kms-hierarchical-keyring.md#ciphertext + var EDK_CIPHERTEXT_BRANCH_KEY_VERSION_INDEX := 12 + 16; var EDK_CIPHERTEXT_VERSION_INDEX := EDK_CIPHERTEXT_BRANCH_KEY_VERSION_INDEX + 16; + :- Need(EDK_CIPHERTEXT_BRANCH_KEY_VERSION_INDEX < EDK_CIPHERTEXT_VERSION_INDEX, E("error")); + :- Need(|providerWrappedMaterial| >= EDK_CIPHERTEXT_VERSION_INDEX, E("error")); var branchKeyVersionUuid := providerWrappedMaterial[EDK_CIPHERTEXT_BRANCH_KEY_VERSION_INDEX .. EDK_CIPHERTEXT_VERSION_INDEX]; - + :- Need(UUID.FromByteArray(branchKeyVersionUuid).Success?, E("error")); + singleDataKeyOutput := EncryptedDataKeyDescriptionOutput( keyProviderId := UTF8.Decode(datakeys[i].keyProviderId).Extract(), keyProviderInfo := UTF8.Decode(datakeys[i].keyProviderInfo).Extract(), From 689e83dc0e654a8fd21c934894b02d80902ec6c3 Mon Sep 17 00:00:00 2001 From: rishav-karanjit Date: Mon, 25 Mar 2024 10:56:10 -0700 Subject: [PATCH 03/67] Updated Smithy to make keyProviderInfo optional --- .../Model/AwsCryptographyDbEncryptionSdkDynamoDbTypes.dfy | 6 +++--- .../DynamoDbEncryption/Model/DynamoDbEncryption.smithy | 1 - 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/DynamoDbEncryption/dafny/DynamoDbEncryption/Model/AwsCryptographyDbEncryptionSdkDynamoDbTypes.dfy b/DynamoDbEncryption/dafny/DynamoDbEncryption/Model/AwsCryptographyDbEncryptionSdkDynamoDbTypes.dfy index 418b5bb97..1f40fd366 100644 --- a/DynamoDbEncryption/dafny/DynamoDbEncryption/Model/AwsCryptographyDbEncryptionSdkDynamoDbTypes.dfy +++ b/DynamoDbEncryption/dafny/DynamoDbEncryption/Model/AwsCryptographyDbEncryptionSdkDynamoDbTypes.dfy @@ -252,9 +252,9 @@ include "../../../../submodules/MaterialProviders/StandardLibrary/src/Index.dfy" type EncryptedDataKeyDescriptionList = seq datatype EncryptedDataKeyDescriptionOutput = | EncryptedDataKeyDescriptionOutput ( nameonly keyProviderId: string , - nameonly keyProviderInfo: string , - nameonly branchKeyId: Option , - nameonly branchKeyVersion: Option + nameonly keyProviderInfo: Option := Option.None , + nameonly branchKeyId: Option := Option.None , + nameonly branchKeyVersion: Option := Option.None ) datatype EncryptedPart = | EncryptedPart ( nameonly name: string , diff --git a/DynamoDbEncryption/dafny/DynamoDbEncryption/Model/DynamoDbEncryption.smithy b/DynamoDbEncryption/dafny/DynamoDbEncryption/Model/DynamoDbEncryption.smithy index 56dc96c48..2872fbd95 100644 --- a/DynamoDbEncryption/dafny/DynamoDbEncryption/Model/DynamoDbEncryption.smithy +++ b/DynamoDbEncryption/dafny/DynamoDbEncryption/Model/DynamoDbEncryption.smithy @@ -76,7 +76,6 @@ structure EncryptedDataKeyDescriptionOutput { @required keyProviderId: String, - @required keyProviderInfo: String, branchKeyId: String, From 8f720cd51c4fef42157183d95a9994b8dd7bafb6 Mon Sep 17 00:00:00 2001 From: rishav-karanjit Date: Mon, 25 Mar 2024 10:57:21 -0700 Subject: [PATCH 04/67] Added preconditions for GetEncryptedDataKeyDescription operation --- ...raphyDbEncryptionSdkDynamoDbOperations.dfy | 42 ++++++++++++------- 1 file changed, 28 insertions(+), 14 deletions(-) diff --git a/DynamoDbEncryption/dafny/DynamoDbEncryption/src/AwsCryptographyDbEncryptionSdkDynamoDbOperations.dfy b/DynamoDbEncryption/dafny/DynamoDbEncryption/src/AwsCryptographyDbEncryptionSdkDynamoDbOperations.dfy index dcc7a02d1..b0fba2990 100644 --- a/DynamoDbEncryption/dafny/DynamoDbEncryption/src/AwsCryptographyDbEncryptionSdkDynamoDbOperations.dfy +++ b/DynamoDbEncryption/dafny/DynamoDbEncryption/src/AwsCryptographyDbEncryptionSdkDynamoDbOperations.dfy @@ -64,22 +64,20 @@ module AwsCryptographyDbEncryptionSdkDynamoDbOperations refines AbstractAwsCrypt match input.input { case plaintextItem(plaintextItem) =>{ - :- Need(DynamoToStruct.ItemToStructured(plaintextItem).Success?, E("error")); + :- Need(DynamoToStruct.ItemToStructured(plaintextItem).Success?, E("Failed to convert AttributeMap to StructuredDataMap.")); :- Need("aws_dbe_head" in DynamoToStruct.ItemToStructured(plaintextItem).Extract(), E("error")); header := DynamoToStruct.ItemToStructured(plaintextItem).Extract()["aws_dbe_head"].content.Terminal.value; } case header(headeritem) => header := headeritem; } - :- Need(Header.PartialDeserialize(header).Success?, E("error")); + :- Need(Header.PartialDeserialize(header).Success?, E("Failed to deserialize header.")); var deserializedHeader := Header.PartialDeserialize(header); - var algorithmSuite; if deserializedHeader.Extract().flavor == 0{ algorithmSuite := AlgorithmSuites.DBE_ALG_AES_256_GCM_HKDF_SHA512_COMMIT_KEY_SYMSIG_HMAC_SHA384; - } - else{ + } else { algorithmSuite := AlgorithmSuites.DBE_ALG_AES_256_GCM_HKDF_SHA512_COMMIT_KEY_ECDSA_P384_SYMSIG_HMAC_SHA384; } @@ -88,9 +86,23 @@ module AwsCryptographyDbEncryptionSdkDynamoDbOperations refines AbstractAwsCrypt for i := 0 to |datakeys| { var singleDataKeyOutput : EncryptedDataKeyDescriptionOutput; - :- Need(UTF8.Decode(datakeys[i].keyProviderId).Success?, E("error")); - :- Need(UTF8.Decode(datakeys[i].keyProviderInfo).Success?, E("error")); - if UTF8.Decode(datakeys[i].keyProviderId).Extract() == "aws-kms-hierarchy" { + :- Need(UTF8.Decode(datakeys[i].keyProviderId).Success?, E("Failed to extract keyProviderId")); + :- Need(UTF8.Decode(datakeys[i].keyProviderInfo).Success?, E("Failed to extract keyProviderInfo")); + + var extractedKeyProviderId := UTF8.Decode(datakeys[i].keyProviderId).Extract(); + var extractedKeyProviderIdInfo := UTF8.Decode(datakeys[i].keyProviderInfo).Extract(); + + :- Need(|extractedKeyProviderId| > 7 && extractedKeyProviderId[0..7] == "aws-kms", E("Data encrypted with " + UTF8.Decode(datakeys[i].keyProviderId).Extract() + " not supported")); + + if |extractedKeyProviderId| < 7 || extractedKeyProviderId[0..7] != "aws-kms" { + singleDataKeyOutput := EncryptedDataKeyDescriptionOutput( + keyProviderId := extractedKeyProviderId, + keyProviderInfo := None, + branchKeyId := None, + branchKeyVersion := None + ); + } + if extractedKeyProviderId == "aws-kms-hierarchy" { :- Need(EdkWrapping.GetProviderWrappedMaterial(datakeys[i].ciphertext, algorithmSuite).Success?, E("error")); var providerWrappedMaterial := EdkWrapping.GetProviderWrappedMaterial(datakeys[i].ciphertext, algorithmSuite).Extract(); @@ -105,19 +117,21 @@ module AwsCryptographyDbEncryptionSdkDynamoDbOperations refines AbstractAwsCrypt :- Need(EDK_CIPHERTEXT_BRANCH_KEY_VERSION_INDEX < EDK_CIPHERTEXT_VERSION_INDEX, E("error")); :- Need(|providerWrappedMaterial| >= EDK_CIPHERTEXT_VERSION_INDEX, E("error")); var branchKeyVersionUuid := providerWrappedMaterial[EDK_CIPHERTEXT_BRANCH_KEY_VERSION_INDEX .. EDK_CIPHERTEXT_VERSION_INDEX]; + :- Need(UUID.FromByteArray(branchKeyVersionUuid).Success?, E("error")); + var expectedBranchKeyVersion := UUID.FromByteArray(branchKeyVersionUuid).Extract(); singleDataKeyOutput := EncryptedDataKeyDescriptionOutput( - keyProviderId := UTF8.Decode(datakeys[i].keyProviderId).Extract(), - keyProviderInfo := UTF8.Decode(datakeys[i].keyProviderInfo).Extract(), - branchKeyId := Some(UTF8.Decode(datakeys[i].keyProviderInfo).Extract()), - branchKeyVersion := Some(UUID.FromByteArray(branchKeyVersionUuid).Extract()) + keyProviderId := extractedKeyProviderId, + keyProviderInfo := Some(extractedKeyProviderIdInfo), + branchKeyId := Some(extractedKeyProviderIdInfo), + branchKeyVersion := Some(expectedBranchKeyVersion) ); } else { singleDataKeyOutput := EncryptedDataKeyDescriptionOutput( - keyProviderId := UTF8.Decode(datakeys[i].keyProviderId).Extract(), - keyProviderInfo := UTF8.Decode(datakeys[i].keyProviderInfo).Extract(), + keyProviderId := extractedKeyProviderId, + keyProviderInfo := Some(extractedKeyProviderIdInfo), branchKeyId := None, branchKeyVersion := None ); From 79b70da10060d48fad4db9f2f31be979fa657966 Mon Sep 17 00:00:00 2001 From: rishav-karanjit Date: Mon, 25 Mar 2024 11:00:39 -0700 Subject: [PATCH 05/67] Add unit test for DynamoDbGetEncryptedDataKeyDescription --- ...moDbGetEncryptedDataKeyDescriptionTest.dfy | 115 ++++++++++++++++++ 1 file changed, 115 insertions(+) create mode 100644 DynamoDbEncryption/dafny/DynamoDbEncryption/test/DynamoDbGetEncryptedDataKeyDescriptionTest.dfy diff --git a/DynamoDbEncryption/dafny/DynamoDbEncryption/test/DynamoDbGetEncryptedDataKeyDescriptionTest.dfy b/DynamoDbEncryption/dafny/DynamoDbEncryption/test/DynamoDbGetEncryptedDataKeyDescriptionTest.dfy new file mode 100644 index 000000000..e80387881 --- /dev/null +++ b/DynamoDbEncryption/dafny/DynamoDbEncryption/test/DynamoDbGetEncryptedDataKeyDescriptionTest.dfy @@ -0,0 +1,115 @@ +include "../src/Index.dfy" + +module DynamoDbGetEncryptedDataKeyDescriptionTest { + import DynamoDbEncryption + import opened StandardLibrary.UInt + import opened StructuredEncryptionHeader + import opened UTF8 + import Types = AwsCryptographyDbEncryptionSdkDynamoDbTypes + import UUID + import ComAmazonawsDynamodbTypes + import EdkWrapping + import AlgorithmSuites + + const expectedHead := PartialHeader ( + version := 1, + flavor := 1, + msgID := [1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32], + legend := [0x65, 0x73], + encContext := map[EncodeAscii("abc") := EncodeAscii("def")], + dataKeys := [CMP.EncryptedDataKey( + keyProviderId := EncodeAscii("aws-kms-hierarchy") , + keyProviderInfo := EncodeAscii("keyproviderInfo"), + ciphertext := [ + 64, 92, 115, 7, 85, 121, 112, 79, 69, 12, 82, 25, 67, 34, + 11, 66, 93, 45, 40, 23, 90, 61, 16, 28, 59, 114, 52, 122, + 50, 23, 11, 101, 48, 53, 30, 120, 51, 74, 77, 53, 57, 99, + 53, 13, 30, 21, 109, 85, 15, 86, 47, 84, 91, 85, 87, 60, 4, + 56, 67, 74, 29, 87, 85, 106, 8, 82, 63, 114, 100, 110, 68, + 58, 83, 24, 111, 41, 21, 91, 122, 61, 118, 37, 72, 38, 67, 2, + 17, 61, 17, 121, 7, 90, 117, 49, 30, 20, 89, 68, 33, 111, + 107, 5, 120, 20, 95, 78, 70, 2, 49, 84, 39, 50, 40, 40, 115, + 114, 76, 18, 103, 84, 34, 123, 1, 125, 61, 33, 13, 18, 81, + 24, 53, 53, 26, 60, 52, 85, 81, 96, 85, 72])] + ) + const serializedHeader := expectedHead.serialize() + expectedHead.msgID + const algorithmSuite := AlgorithmSuites.DBE_ALG_AES_256_GCM_HKDF_SHA512_COMMIT_KEY_ECDSA_P384_SYMSIG_HMAC_SHA384 + + method {:test} TestHeaderInputCase() + { + expect EdkWrapping.GetProviderWrappedMaterial(expectedHead.dataKeys[0].ciphertext, algorithmSuite).Success?; + var providerWrappedMaterial := EdkWrapping.GetProviderWrappedMaterial(expectedHead.dataKeys[0].ciphertext, algorithmSuite).Extract(); + + expect |providerWrappedMaterial| >= (28 + 16); + var expectedBranchKeyVersionUuid := UUID.FromByteArray(providerWrappedMaterial[28 .. (28 + 16)]); + var ddbEncResources :- expect DynamoDbEncryption.DynamoDbEncryption(); + + var inputVariable: Types.GetEncryptedDataKeyDescriptionInput := + Types.GetEncryptedDataKeyDescriptionInput( + input := Types.header(header := serializedHeader) + ); + + var actualDataKeyDescription := ddbEncResources.GetEncryptedDataKeyDescription(inputVariable); + + expect expectedBranchKeyVersionUuid.Success?; + expect UTF8.Decode(expectedHead.dataKeys[0].keyProviderId).Success?; + expect UTF8.Decode(expectedHead.dataKeys[0].keyProviderInfo).Success?; + expect actualDataKeyDescription.Success?; + expect |actualDataKeyDescription.Extract().EncryptedDataKeyDescriptionOutput| > 0; + + expect |actualDataKeyDescription.Extract().EncryptedDataKeyDescriptionOutput| == |expectedHead.dataKeys|; + expect actualDataKeyDescription.Extract().EncryptedDataKeyDescriptionOutput[0].keyProviderId == UTF8.Decode(expectedHead.dataKeys[0].keyProviderId).Extract(); + + expect actualDataKeyDescription.Extract().EncryptedDataKeyDescriptionOutput[0].keyProviderInfo.Some?; + expect actualDataKeyDescription.Extract().EncryptedDataKeyDescriptionOutput[0].keyProviderInfo.Extract() == UTF8.Decode(expectedHead.dataKeys[0].keyProviderInfo).Extract(); + + if actualDataKeyDescription.Extract().EncryptedDataKeyDescriptionOutput[0].keyProviderId == "aws-kms-hierarchy"{ + expect actualDataKeyDescription.Extract().EncryptedDataKeyDescriptionOutput[0].branchKeyId.Some?; + expect actualDataKeyDescription.Extract().EncryptedDataKeyDescriptionOutput[0].branchKeyVersion.Some?; + + expect actualDataKeyDescription.Extract().EncryptedDataKeyDescriptionOutput[0].branchKeyId.Extract() == UTF8.Decode(expectedHead.dataKeys[0].keyProviderInfo).Extract(); + expect actualDataKeyDescription.Extract().EncryptedDataKeyDescriptionOutput[0].branchKeyVersion.Extract() == expectedBranchKeyVersionUuid.Extract(); + } + } + + method {:test} TestDDBItemInputCase() + { + expect EdkWrapping.GetProviderWrappedMaterial(expectedHead.dataKeys[0].ciphertext, algorithmSuite).Success?; + var providerWrappedMaterial := EdkWrapping.GetProviderWrappedMaterial(expectedHead.dataKeys[0].ciphertext, algorithmSuite).Extract(); + + expect |providerWrappedMaterial| >= (28 + 16); + + var expectedBranchKeyVersionUuid := UUID.FromByteArray(providerWrappedMaterial[28 .. (28 + 16)]); + var attr := map["aws_dbe_head" := ComAmazonawsDynamodbTypes.AttributeValue.B(serializedHeader)]; + var ddbEncResources :- expect DynamoDbEncryption.DynamoDbEncryption(); + + + var inputVariable: Types.GetEncryptedDataKeyDescriptionInput := + Types.GetEncryptedDataKeyDescriptionInput( + input := Types.plaintextItem(plaintextItem := attr) + ); + + var actualDataKeyDescription := ddbEncResources.GetEncryptedDataKeyDescription(inputVariable); + + expect expectedBranchKeyVersionUuid.Success?; + expect UTF8.Decode(expectedHead.dataKeys[0].keyProviderId).Success?; + expect UTF8.Decode(expectedHead.dataKeys[0].keyProviderInfo).Success?; + expect actualDataKeyDescription.Success?; + expect |actualDataKeyDescription.Extract().EncryptedDataKeyDescriptionOutput| > 0; + + expect |actualDataKeyDescription.Extract().EncryptedDataKeyDescriptionOutput| == |expectedHead.dataKeys|; + expect actualDataKeyDescription.Extract().EncryptedDataKeyDescriptionOutput[0].keyProviderId == UTF8.Decode(expectedHead.dataKeys[0].keyProviderId).Extract(); + + expect actualDataKeyDescription.Extract().EncryptedDataKeyDescriptionOutput[0].keyProviderInfo.Some?; + expect actualDataKeyDescription.Extract().EncryptedDataKeyDescriptionOutput[0].keyProviderInfo.Extract() == UTF8.Decode(expectedHead.dataKeys[0].keyProviderInfo).Extract(); + + if actualDataKeyDescription.Extract().EncryptedDataKeyDescriptionOutput[0].keyProviderId == "aws-kms-hierarchy"{ + expect actualDataKeyDescription.Extract().EncryptedDataKeyDescriptionOutput[0].branchKeyId.Some?; + expect actualDataKeyDescription.Extract().EncryptedDataKeyDescriptionOutput[0].branchKeyVersion.Some?; + + expect actualDataKeyDescription.Extract().EncryptedDataKeyDescriptionOutput[0].branchKeyId.Extract() == UTF8.Decode(expectedHead.dataKeys[0].keyProviderInfo).Extract(); + expect actualDataKeyDescription.Extract().EncryptedDataKeyDescriptionOutput[0].branchKeyVersion.Extract() == expectedBranchKeyVersionUuid.Extract(); + } + } + +} \ No newline at end of file From 24f8f9025af0b1bfa0f3db6f0a1761f898b8be9f Mon Sep 17 00:00:00 2001 From: rishav-karanjit Date: Mon, 25 Mar 2024 14:07:21 -0700 Subject: [PATCH 06/67] Added specification for Get Encrypted Data Key Description --- .../ddb-get-encrypted-data-key-description.md | 40 +++++++++++++++++++ 1 file changed, 40 insertions(+) create mode 100644 specification/dynamodb-encryption-client/ddb-get-encrypted-data-key-description.md diff --git a/specification/dynamodb-encryption-client/ddb-get-encrypted-data-key-description.md b/specification/dynamodb-encryption-client/ddb-get-encrypted-data-key-description.md new file mode 100644 index 000000000..fb78e9f37 --- /dev/null +++ b/specification/dynamodb-encryption-client/ddb-get-encrypted-data-key-description.md @@ -0,0 +1,40 @@ +[//]: # "Copyright Amazon.com Inc. or its affiliates. All Rights Reserved." +[//]: # "SPDX-License-Identifier: CC-BY-SA-4.0" + +# DynamoDb Get Encrypted Data Key Description + +## Overview + +Currently, Keyring's Encrypted Data Key serialization includes metadata like key provider id, key provider info, branch Key id (only Hierarchy Keyring), and the version of the branch Key (only Hierarchy Keyring). Encrypted Data Key Description operation provides a way for the customers to get these meta data. This operation will provide them with an insight of the keys the data is encrypted with. + +## Operation + +### Input + +This operation MUST take in either of the following: +- A binary [header](https://github.com/aws/aws-database-encryption-sdk-dynamodb/blob/main/specification/structured-encryption/header.md) +- A [encrypted DynamoDB item](https://github.com/aws/aws-database-encryption-sdk-dynamodb/blob/ff9f08a355a20c81540e4ca652e09aaeffe90c4b/specification/dynamodb-encryption-client/encrypt-item.md#encrypted-dynamodb-item) + +### Output + +This operation MUST return a list of following: + +- [keyProviderId](https://github.com/aws/aws-database-encryption-sdk-dynamodb/blob/main/specification/structured-encryption/header.md#key-provider-id) +- [keyProviderInfo](https://github.com/aws/aws-database-encryption-sdk-dynamodb/blob/main/specification/structured-encryption/header.md#key-provider-information) (only for AWS Cryptographic Materials Provider Keyring) +- [branchKeyId](https://github.com/aws/aws-database-encryption-sdk-dynamodb/blob/main/specification/structured-encryption/header.md#key-provider-information) (only for hierarchy keyring) +- [branchKeyVersion](https://github.com/aws/aws-database-encryption-sdk-dynamodb/blob/main/specification/structured-encryption/header.md#key-provider-information) (only for hierarchy keyring) + +### Behavior + +This operation should behave in following ways: + +- The operation MUST NEVER DECRYPT the Data Keys. +- If the input is a encrypted DynamoDB item, it MUST attempt to extract "aws_dbe_head" attribute from the DynamoDB item to get binary header. +- This operation MUST deserialize the header bytes according to the header format. +- This operation MUST extract the Format Flavor from the deserialize header. Format Flavor is used to identify the algorithm suite. +- This operation MUST extract the dataKeys from the deserialize header. +- For every Data Key in Data Keys, the operation MUST attempt to extract a description of the Data Key. + - If the Data Key does not belong to AWS Cryptographic Materials Provider Keyring, the operation will only return keyProviderId. + - This description SHOULD be as detailed as possible, parsing but NOT decrypting the cipher-text field of the Data Key for embedded fields such as the Hierarchical Keyring’s branchKeyVersion. + + From 346bf279717a0de473850e7879bd3072ecc6ac0c Mon Sep 17 00:00:00 2001 From: rishav-karanjit Date: Mon, 25 Mar 2024 14:26:47 -0700 Subject: [PATCH 07/67] Refactor GetEncryptedDataKeyDescription operation --- ...tographyDbEncryptionSdkDynamoDbOperations.dfy | 16 ++++++++-------- ...ynamoDbGetEncryptedDataKeyDescriptionTest.dfy | 7 +++---- 2 files changed, 11 insertions(+), 12 deletions(-) diff --git a/DynamoDbEncryption/dafny/DynamoDbEncryption/src/AwsCryptographyDbEncryptionSdkDynamoDbOperations.dfy b/DynamoDbEncryption/dafny/DynamoDbEncryption/src/AwsCryptographyDbEncryptionSdkDynamoDbOperations.dfy index b0fba2990..d44eb18ed 100644 --- a/DynamoDbEncryption/dafny/DynamoDbEncryption/src/AwsCryptographyDbEncryptionSdkDynamoDbOperations.dfy +++ b/DynamoDbEncryption/dafny/DynamoDbEncryption/src/AwsCryptographyDbEncryptionSdkDynamoDbOperations.dfy @@ -65,7 +65,7 @@ module AwsCryptographyDbEncryptionSdkDynamoDbOperations refines AbstractAwsCrypt { case plaintextItem(plaintextItem) =>{ :- Need(DynamoToStruct.ItemToStructured(plaintextItem).Success?, E("Failed to convert AttributeMap to StructuredDataMap.")); - :- Need("aws_dbe_head" in DynamoToStruct.ItemToStructured(plaintextItem).Extract(), E("error")); + :- Need("aws_dbe_head" in DynamoToStruct.ItemToStructured(plaintextItem).Extract(), E("aws_dbe_head is not present in the attribute map.")); header := DynamoToStruct.ItemToStructured(plaintextItem).Extract()["aws_dbe_head"].content.Terminal.value; } case header(headeritem) => @@ -86,13 +86,13 @@ module AwsCryptographyDbEncryptionSdkDynamoDbOperations refines AbstractAwsCrypt for i := 0 to |datakeys| { var singleDataKeyOutput : EncryptedDataKeyDescriptionOutput; - :- Need(UTF8.Decode(datakeys[i].keyProviderId).Success?, E("Failed to extract keyProviderId")); - :- Need(UTF8.Decode(datakeys[i].keyProviderInfo).Success?, E("Failed to extract keyProviderInfo")); + :- Need(UTF8.Decode(datakeys[i].keyProviderId).Success?, E("Failed to extract keyProviderId.")); + :- Need(UTF8.Decode(datakeys[i].keyProviderInfo).Success?, E("Failed to extract keyProviderInfo.")); var extractedKeyProviderId := UTF8.Decode(datakeys[i].keyProviderId).Extract(); var extractedKeyProviderIdInfo := UTF8.Decode(datakeys[i].keyProviderInfo).Extract(); - :- Need(|extractedKeyProviderId| > 7 && extractedKeyProviderId[0..7] == "aws-kms", E("Data encrypted with " + UTF8.Decode(datakeys[i].keyProviderId).Extract() + " not supported")); + :- Need(|extractedKeyProviderId| > 7 && extractedKeyProviderId[0..7] == "aws-kms", E("Data encrypted with " + UTF8.Decode(datakeys[i].keyProviderId).Extract() + " not supported.")); if |extractedKeyProviderId| < 7 || extractedKeyProviderId[0..7] != "aws-kms" { singleDataKeyOutput := EncryptedDataKeyDescriptionOutput( @@ -103,7 +103,7 @@ module AwsCryptographyDbEncryptionSdkDynamoDbOperations refines AbstractAwsCrypt ); } if extractedKeyProviderId == "aws-kms-hierarchy" { - :- Need(EdkWrapping.GetProviderWrappedMaterial(datakeys[i].ciphertext, algorithmSuite).Success?, E("error")); + :- Need(EdkWrapping.GetProviderWrappedMaterial(datakeys[i].ciphertext, algorithmSuite).Success?, E("Failed to get provider wrapped material.")); var providerWrappedMaterial := EdkWrapping.GetProviderWrappedMaterial(datakeys[i].ciphertext, algorithmSuite).Extract(); @@ -114,11 +114,11 @@ module AwsCryptographyDbEncryptionSdkDynamoDbOperations refines AbstractAwsCrypt var EDK_CIPHERTEXT_BRANCH_KEY_VERSION_INDEX := 12 + 16; var EDK_CIPHERTEXT_VERSION_INDEX := EDK_CIPHERTEXT_BRANCH_KEY_VERSION_INDEX + 16; - :- Need(EDK_CIPHERTEXT_BRANCH_KEY_VERSION_INDEX < EDK_CIPHERTEXT_VERSION_INDEX, E("error")); - :- Need(|providerWrappedMaterial| >= EDK_CIPHERTEXT_VERSION_INDEX, E("error")); + :- Need(EDK_CIPHERTEXT_BRANCH_KEY_VERSION_INDEX < EDK_CIPHERTEXT_VERSION_INDEX, E("Wrong branch key version index.")); + :- Need(|providerWrappedMaterial| >= EDK_CIPHERTEXT_VERSION_INDEX, E("Incorrect ciphertext structure length.")); var branchKeyVersionUuid := providerWrappedMaterial[EDK_CIPHERTEXT_BRANCH_KEY_VERSION_INDEX .. EDK_CIPHERTEXT_VERSION_INDEX]; - :- Need(UUID.FromByteArray(branchKeyVersionUuid).Success?, E("error")); + :- Need(UUID.FromByteArray(branchKeyVersionUuid).Success?, E("Failed to convert UUID from byte array.")); var expectedBranchKeyVersion := UUID.FromByteArray(branchKeyVersionUuid).Extract(); singleDataKeyOutput := EncryptedDataKeyDescriptionOutput( diff --git a/DynamoDbEncryption/dafny/DynamoDbEncryption/test/DynamoDbGetEncryptedDataKeyDescriptionTest.dfy b/DynamoDbEncryption/dafny/DynamoDbEncryption/test/DynamoDbGetEncryptedDataKeyDescriptionTest.dfy index e80387881..fb9a2943a 100644 --- a/DynamoDbEncryption/dafny/DynamoDbEncryption/test/DynamoDbGetEncryptedDataKeyDescriptionTest.dfy +++ b/DynamoDbEncryption/dafny/DynamoDbEncryption/test/DynamoDbGetEncryptedDataKeyDescriptionTest.dfy @@ -63,7 +63,7 @@ module DynamoDbGetEncryptedDataKeyDescriptionTest { expect actualDataKeyDescription.Extract().EncryptedDataKeyDescriptionOutput[0].keyProviderInfo.Some?; expect actualDataKeyDescription.Extract().EncryptedDataKeyDescriptionOutput[0].keyProviderInfo.Extract() == UTF8.Decode(expectedHead.dataKeys[0].keyProviderInfo).Extract(); - if actualDataKeyDescription.Extract().EncryptedDataKeyDescriptionOutput[0].keyProviderId == "aws-kms-hierarchy"{ + if actualDataKeyDescription.Extract().EncryptedDataKeyDescriptionOutput[0].keyProviderId == "aws-kms-hierarchy" { expect actualDataKeyDescription.Extract().EncryptedDataKeyDescriptionOutput[0].branchKeyId.Some?; expect actualDataKeyDescription.Extract().EncryptedDataKeyDescriptionOutput[0].branchKeyVersion.Some?; @@ -103,7 +103,7 @@ module DynamoDbGetEncryptedDataKeyDescriptionTest { expect actualDataKeyDescription.Extract().EncryptedDataKeyDescriptionOutput[0].keyProviderInfo.Some?; expect actualDataKeyDescription.Extract().EncryptedDataKeyDescriptionOutput[0].keyProviderInfo.Extract() == UTF8.Decode(expectedHead.dataKeys[0].keyProviderInfo).Extract(); - if actualDataKeyDescription.Extract().EncryptedDataKeyDescriptionOutput[0].keyProviderId == "aws-kms-hierarchy"{ + if actualDataKeyDescription.Extract().EncryptedDataKeyDescriptionOutput[0].keyProviderId == "aws-kms-hierarchy" { expect actualDataKeyDescription.Extract().EncryptedDataKeyDescriptionOutput[0].branchKeyId.Some?; expect actualDataKeyDescription.Extract().EncryptedDataKeyDescriptionOutput[0].branchKeyVersion.Some?; @@ -111,5 +111,4 @@ module DynamoDbGetEncryptedDataKeyDescriptionTest { expect actualDataKeyDescription.Extract().EncryptedDataKeyDescriptionOutput[0].branchKeyVersion.Extract() == expectedBranchKeyVersionUuid.Extract(); } } - -} \ No newline at end of file +} From e909d69f0e0367b587226248075ef0c9eb4fdfeb Mon Sep 17 00:00:00 2001 From: rishav-karanjit Date: Mon, 25 Mar 2024 14:47:13 -0700 Subject: [PATCH 08/67] Refactor the tests --- .../test/DynamoDbGetEncryptedDataKeyDescriptionTest.dfy | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/DynamoDbEncryption/dafny/DynamoDbEncryption/test/DynamoDbGetEncryptedDataKeyDescriptionTest.dfy b/DynamoDbEncryption/dafny/DynamoDbEncryption/test/DynamoDbGetEncryptedDataKeyDescriptionTest.dfy index fb9a2943a..aa7a37b40 100644 --- a/DynamoDbEncryption/dafny/DynamoDbEncryption/test/DynamoDbGetEncryptedDataKeyDescriptionTest.dfy +++ b/DynamoDbEncryption/dafny/DynamoDbEncryption/test/DynamoDbGetEncryptedDataKeyDescriptionTest.dfy @@ -40,8 +40,12 @@ module DynamoDbGetEncryptedDataKeyDescriptionTest { expect EdkWrapping.GetProviderWrappedMaterial(expectedHead.dataKeys[0].ciphertext, algorithmSuite).Success?; var providerWrappedMaterial := EdkWrapping.GetProviderWrappedMaterial(expectedHead.dataKeys[0].ciphertext, algorithmSuite).Extract(); - expect |providerWrappedMaterial| >= (28 + 16); - var expectedBranchKeyVersionUuid := UUID.FromByteArray(providerWrappedMaterial[28 .. (28 + 16)]); + // The ciphertext structure in the hierarchy keyring contains Salt and IV before Version. + // The length of Salt is 16 and IV is 12 bytes. The length of Version is 16 bytes. + // https://github.com/awslabs/aws-encryption-sdk-specification/blob/master/framework/aws-kms/aws-kms-hierarchical-keyring.md#ciphertext + + expect |providerWrappedMaterial| >= (16 + 12 + 16); + var expectedBranchKeyVersionUuid := UUID.FromByteArray(providerWrappedMaterial[16 + 12 .. (16 + 12 + 16)]); var ddbEncResources :- expect DynamoDbEncryption.DynamoDbEncryption(); var inputVariable: Types.GetEncryptedDataKeyDescriptionInput := From 7de56f31a9de7bedaba2537b9677f00350d02e28 Mon Sep 17 00:00:00 2001 From: rishav-karanjit Date: Mon, 25 Mar 2024 14:49:56 -0700 Subject: [PATCH 09/67] Add more info in comments --- .../src/AwsCryptographyDbEncryptionSdkDynamoDbOperations.dfy | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/DynamoDbEncryption/dafny/DynamoDbEncryption/src/AwsCryptographyDbEncryptionSdkDynamoDbOperations.dfy b/DynamoDbEncryption/dafny/DynamoDbEncryption/src/AwsCryptographyDbEncryptionSdkDynamoDbOperations.dfy index d44eb18ed..0bf26f45d 100644 --- a/DynamoDbEncryption/dafny/DynamoDbEncryption/src/AwsCryptographyDbEncryptionSdkDynamoDbOperations.dfy +++ b/DynamoDbEncryption/dafny/DynamoDbEncryption/src/AwsCryptographyDbEncryptionSdkDynamoDbOperations.dfy @@ -108,7 +108,7 @@ module AwsCryptographyDbEncryptionSdkDynamoDbOperations refines AbstractAwsCrypt var providerWrappedMaterial := EdkWrapping.GetProviderWrappedMaterial(datakeys[i].ciphertext, algorithmSuite).Extract(); // The ciphertext structure in the hierarchy keyring contains Salt and IV before Version. - // The length of Salt is 16 and IV is 12 bytes. + // The length of Salt is 16 and IV is 12 bytes. The length of Version is 16 bytes. // https://github.com/awslabs/aws-encryption-sdk-specification/blob/master/framework/aws-kms/aws-kms-hierarchical-keyring.md#ciphertext var EDK_CIPHERTEXT_BRANCH_KEY_VERSION_INDEX := 12 + 16; From d72193e5e59d07a276d070e4c8ebcb28e8af9f55 Mon Sep 17 00:00:00 2001 From: rishav-karanjit Date: Mon, 25 Mar 2024 16:37:22 -0700 Subject: [PATCH 10/67] Add smithy generated java files --- .../dynamodb/DynamoDbEncryption.java | 12 ++ .../dbencryptionsdk/dynamodb/ToDafny.java | 56 ++++++++ .../dbencryptionsdk/dynamodb/ToNative.java | 53 +++++++ .../EncryptedDataKeyDescriptionOutput.java | 130 ++++++++++++++++++ .../GetEncryptedDataKeyDescriptionInput.java | 61 ++++++++ .../GetEncryptedDataKeyDescriptionOutput.java | 64 +++++++++ .../GetEncryptedDataKeyDescriptionUnion.java | 101 ++++++++++++++ 7 files changed, 477 insertions(+) create mode 100644 DynamoDbEncryption/runtimes/java/src/main/smithy-generated/software/amazon/cryptography/dbencryptionsdk/dynamodb/model/EncryptedDataKeyDescriptionOutput.java create mode 100644 DynamoDbEncryption/runtimes/java/src/main/smithy-generated/software/amazon/cryptography/dbencryptionsdk/dynamodb/model/GetEncryptedDataKeyDescriptionInput.java create mode 100644 DynamoDbEncryption/runtimes/java/src/main/smithy-generated/software/amazon/cryptography/dbencryptionsdk/dynamodb/model/GetEncryptedDataKeyDescriptionOutput.java create mode 100644 DynamoDbEncryption/runtimes/java/src/main/smithy-generated/software/amazon/cryptography/dbencryptionsdk/dynamodb/model/GetEncryptedDataKeyDescriptionUnion.java diff --git a/DynamoDbEncryption/runtimes/java/src/main/smithy-generated/software/amazon/cryptography/dbencryptionsdk/dynamodb/DynamoDbEncryption.java b/DynamoDbEncryption/runtimes/java/src/main/smithy-generated/software/amazon/cryptography/dbencryptionsdk/dynamodb/DynamoDbEncryption.java index b44d6b65a..a418aa268 100644 --- a/DynamoDbEncryption/runtimes/java/src/main/smithy-generated/software/amazon/cryptography/dbencryptionsdk/dynamodb/DynamoDbEncryption.java +++ b/DynamoDbEncryption/runtimes/java/src/main/smithy-generated/software/amazon/cryptography/dbencryptionsdk/dynamodb/DynamoDbEncryption.java @@ -12,6 +12,8 @@ import software.amazon.cryptography.dbencryptionsdk.dynamodb.model.CreateDynamoDbEncryptionBranchKeyIdSupplierInput; import software.amazon.cryptography.dbencryptionsdk.dynamodb.model.CreateDynamoDbEncryptionBranchKeyIdSupplierOutput; import software.amazon.cryptography.dbencryptionsdk.dynamodb.model.DynamoDbEncryptionConfig; +import software.amazon.cryptography.dbencryptionsdk.dynamodb.model.GetEncryptedDataKeyDescriptionInput; +import software.amazon.cryptography.dbencryptionsdk.dynamodb.model.GetEncryptedDataKeyDescriptionOutput; public class DynamoDbEncryption { private final IDynamoDbEncryptionClient _impl; @@ -50,6 +52,16 @@ public CreateDynamoDbEncryptionBranchKeyIdSupplierOutput CreateDynamoDbEncryptio return ToNative.CreateDynamoDbEncryptionBranchKeyIdSupplierOutput(result.dtor_value()); } + public GetEncryptedDataKeyDescriptionOutput GetEncryptedDataKeyDescription( + GetEncryptedDataKeyDescriptionInput input) { + software.amazon.cryptography.dbencryptionsdk.dynamodb.internaldafny.types.GetEncryptedDataKeyDescriptionInput dafnyValue = ToDafny.GetEncryptedDataKeyDescriptionInput(input); + Result result = this._impl.GetEncryptedDataKeyDescription(dafnyValue); + if (result.is_Failure()) { + throw ToNative.Error(result.dtor_error()); + } + return ToNative.GetEncryptedDataKeyDescriptionOutput(result.dtor_value()); + } + protected IDynamoDbEncryptionClient impl() { return this._impl; } diff --git a/DynamoDbEncryption/runtimes/java/src/main/smithy-generated/software/amazon/cryptography/dbencryptionsdk/dynamodb/ToDafny.java b/DynamoDbEncryption/runtimes/java/src/main/smithy-generated/software/amazon/cryptography/dbencryptionsdk/dynamodb/ToDafny.java index b3e5ccf18..d9209b10a 100644 --- a/DynamoDbEncryption/runtimes/java/src/main/smithy-generated/software/amazon/cryptography/dbencryptionsdk/dynamodb/ToDafny.java +++ b/DynamoDbEncryption/runtimes/java/src/main/smithy-generated/software/amazon/cryptography/dbencryptionsdk/dynamodb/ToDafny.java @@ -27,11 +27,15 @@ import software.amazon.cryptography.dbencryptionsdk.dynamodb.internaldafny.types.DynamoDbEncryptionConfig; import software.amazon.cryptography.dbencryptionsdk.dynamodb.internaldafny.types.DynamoDbTableEncryptionConfig; import software.amazon.cryptography.dbencryptionsdk.dynamodb.internaldafny.types.DynamoDbTablesEncryptionConfig; +import software.amazon.cryptography.dbencryptionsdk.dynamodb.internaldafny.types.EncryptedDataKeyDescriptionOutput; import software.amazon.cryptography.dbencryptionsdk.dynamodb.internaldafny.types.EncryptedPart; import software.amazon.cryptography.dbencryptionsdk.dynamodb.internaldafny.types.Error; import software.amazon.cryptography.dbencryptionsdk.dynamodb.internaldafny.types.Error_DynamoDbEncryptionException; import software.amazon.cryptography.dbencryptionsdk.dynamodb.internaldafny.types.GetBranchKeyIdFromDdbKeyInput; import software.amazon.cryptography.dbencryptionsdk.dynamodb.internaldafny.types.GetBranchKeyIdFromDdbKeyOutput; +import software.amazon.cryptography.dbencryptionsdk.dynamodb.internaldafny.types.GetEncryptedDataKeyDescriptionInput; +import software.amazon.cryptography.dbencryptionsdk.dynamodb.internaldafny.types.GetEncryptedDataKeyDescriptionOutput; +import software.amazon.cryptography.dbencryptionsdk.dynamodb.internaldafny.types.GetEncryptedDataKeyDescriptionUnion; import software.amazon.cryptography.dbencryptionsdk.dynamodb.internaldafny.types.GetPrefix; import software.amazon.cryptography.dbencryptionsdk.dynamodb.internaldafny.types.GetSegment; import software.amazon.cryptography.dbencryptionsdk.dynamodb.internaldafny.types.GetSegments; @@ -238,6 +242,25 @@ public static DynamoDbTablesEncryptionConfig DynamoDbTablesEncryptionConfig( return new DynamoDbTablesEncryptionConfig(tableEncryptionConfigs); } + public static EncryptedDataKeyDescriptionOutput EncryptedDataKeyDescriptionOutput( + software.amazon.cryptography.dbencryptionsdk.dynamodb.model.EncryptedDataKeyDescriptionOutput nativeValue) { + DafnySequence keyProviderId; + keyProviderId = software.amazon.smithy.dafny.conversion.ToDafny.Simple.CharacterSequence(nativeValue.keyProviderId()); + Option> keyProviderInfo; + keyProviderInfo = Objects.nonNull(nativeValue.keyProviderInfo()) ? + Option.create_Some(software.amazon.smithy.dafny.conversion.ToDafny.Simple.CharacterSequence(nativeValue.keyProviderInfo())) + : Option.create_None(); + Option> branchKeyId; + branchKeyId = Objects.nonNull(nativeValue.branchKeyId()) ? + Option.create_Some(software.amazon.smithy.dafny.conversion.ToDafny.Simple.CharacterSequence(nativeValue.branchKeyId())) + : Option.create_None(); + Option> branchKeyVersion; + branchKeyVersion = Objects.nonNull(nativeValue.branchKeyVersion()) ? + Option.create_Some(software.amazon.smithy.dafny.conversion.ToDafny.Simple.CharacterSequence(nativeValue.branchKeyVersion())) + : Option.create_None(); + return new EncryptedDataKeyDescriptionOutput(keyProviderId, keyProviderInfo, branchKeyId, branchKeyVersion); + } + public static EncryptedPart EncryptedPart( software.amazon.cryptography.dbencryptionsdk.dynamodb.model.EncryptedPart nativeValue) { DafnySequence name; @@ -261,6 +284,20 @@ public static GetBranchKeyIdFromDdbKeyOutput GetBranchKeyIdFromDdbKeyOutput( return new GetBranchKeyIdFromDdbKeyOutput(branchKeyId); } + public static GetEncryptedDataKeyDescriptionInput GetEncryptedDataKeyDescriptionInput( + software.amazon.cryptography.dbencryptionsdk.dynamodb.model.GetEncryptedDataKeyDescriptionInput nativeValue) { + GetEncryptedDataKeyDescriptionUnion input; + input = ToDafny.GetEncryptedDataKeyDescriptionUnion(nativeValue.input()); + return new GetEncryptedDataKeyDescriptionInput(input); + } + + public static GetEncryptedDataKeyDescriptionOutput GetEncryptedDataKeyDescriptionOutput( + software.amazon.cryptography.dbencryptionsdk.dynamodb.model.GetEncryptedDataKeyDescriptionOutput nativeValue) { + DafnySequence encryptedDataKeyDescriptionOutput; + encryptedDataKeyDescriptionOutput = ToDafny.EncryptedDataKeyDescriptionList(nativeValue.EncryptedDataKeyDescriptionOutput()); + return new GetEncryptedDataKeyDescriptionOutput(encryptedDataKeyDescriptionOutput); + } + public static GetPrefix GetPrefix( software.amazon.cryptography.dbencryptionsdk.dynamodb.model.GetPrefix nativeValue) { Integer length; @@ -506,6 +543,17 @@ public static BeaconStyle BeaconStyle( throw new IllegalArgumentException("Cannot convert " + nativeValue + " to software.amazon.cryptography.dbencryptionsdk.dynamodb.internaldafny.types.BeaconStyle."); } + public static GetEncryptedDataKeyDescriptionUnion GetEncryptedDataKeyDescriptionUnion( + software.amazon.cryptography.dbencryptionsdk.dynamodb.model.GetEncryptedDataKeyDescriptionUnion nativeValue) { + if (Objects.nonNull(nativeValue.header())) { + return GetEncryptedDataKeyDescriptionUnion.create_header(software.amazon.smithy.dafny.conversion.ToDafny.Simple.ByteSequence(nativeValue.header())); + } + if (Objects.nonNull(nativeValue.plaintextItem())) { + return GetEncryptedDataKeyDescriptionUnion.create_plaintextItem(software.amazon.cryptography.services.dynamodb.internaldafny.ToDafny.AttributeMap(nativeValue.plaintextItem())); + } + throw new IllegalArgumentException("Cannot convert " + nativeValue + " to software.amazon.cryptography.dbencryptionsdk.dynamodb.internaldafny.types.GetEncryptedDataKeyDescriptionUnion."); + } + public static VirtualTransform VirtualTransform( software.amazon.cryptography.dbencryptionsdk.dynamodb.model.VirtualTransform nativeValue) { if (Objects.nonNull(nativeValue.upper())) { @@ -567,6 +615,14 @@ public static DafnySequence ConstructorPartList( ConstructorPart._typeDescriptor()); } + public static DafnySequence EncryptedDataKeyDescriptionList( + List nativeValue) { + return software.amazon.smithy.dafny.conversion.ToDafny.Aggregate.GenericToSequence( + nativeValue, + software.amazon.cryptography.dbencryptionsdk.dynamodb.ToDafny::EncryptedDataKeyDescriptionOutput, + EncryptedDataKeyDescriptionOutput._typeDescriptor()); + } + public static DafnySequence EncryptedPartsList( List nativeValue) { return software.amazon.smithy.dafny.conversion.ToDafny.Aggregate.GenericToSequence( diff --git a/DynamoDbEncryption/runtimes/java/src/main/smithy-generated/software/amazon/cryptography/dbencryptionsdk/dynamodb/ToNative.java b/DynamoDbEncryption/runtimes/java/src/main/smithy-generated/software/amazon/cryptography/dbencryptionsdk/dynamodb/ToNative.java index ee31ab4eb..bd6dff77d 100644 --- a/DynamoDbEncryption/runtimes/java/src/main/smithy-generated/software/amazon/cryptography/dbencryptionsdk/dynamodb/ToNative.java +++ b/DynamoDbEncryption/runtimes/java/src/main/smithy-generated/software/amazon/cryptography/dbencryptionsdk/dynamodb/ToNative.java @@ -30,9 +30,13 @@ import software.amazon.cryptography.dbencryptionsdk.dynamodb.model.DynamoDbEncryptionException; import software.amazon.cryptography.dbencryptionsdk.dynamodb.model.DynamoDbTableEncryptionConfig; import software.amazon.cryptography.dbencryptionsdk.dynamodb.model.DynamoDbTablesEncryptionConfig; +import software.amazon.cryptography.dbencryptionsdk.dynamodb.model.EncryptedDataKeyDescriptionOutput; import software.amazon.cryptography.dbencryptionsdk.dynamodb.model.EncryptedPart; import software.amazon.cryptography.dbencryptionsdk.dynamodb.model.GetBranchKeyIdFromDdbKeyInput; import software.amazon.cryptography.dbencryptionsdk.dynamodb.model.GetBranchKeyIdFromDdbKeyOutput; +import software.amazon.cryptography.dbencryptionsdk.dynamodb.model.GetEncryptedDataKeyDescriptionInput; +import software.amazon.cryptography.dbencryptionsdk.dynamodb.model.GetEncryptedDataKeyDescriptionOutput; +import software.amazon.cryptography.dbencryptionsdk.dynamodb.model.GetEncryptedDataKeyDescriptionUnion; import software.amazon.cryptography.dbencryptionsdk.dynamodb.model.GetPrefix; import software.amazon.cryptography.dbencryptionsdk.dynamodb.model.GetSegment; import software.amazon.cryptography.dbencryptionsdk.dynamodb.model.GetSegments; @@ -231,6 +235,22 @@ public static DynamoDbTablesEncryptionConfig DynamoDbTablesEncryptionConfig( return nativeBuilder.build(); } + public static EncryptedDataKeyDescriptionOutput EncryptedDataKeyDescriptionOutput( + software.amazon.cryptography.dbencryptionsdk.dynamodb.internaldafny.types.EncryptedDataKeyDescriptionOutput dafnyValue) { + EncryptedDataKeyDescriptionOutput.Builder nativeBuilder = EncryptedDataKeyDescriptionOutput.builder(); + nativeBuilder.keyProviderId(software.amazon.smithy.dafny.conversion.ToNative.Simple.String(dafnyValue.dtor_keyProviderId())); + if (dafnyValue.dtor_keyProviderInfo().is_Some()) { + nativeBuilder.keyProviderInfo(software.amazon.smithy.dafny.conversion.ToNative.Simple.String(dafnyValue.dtor_keyProviderInfo().dtor_value())); + } + if (dafnyValue.dtor_branchKeyId().is_Some()) { + nativeBuilder.branchKeyId(software.amazon.smithy.dafny.conversion.ToNative.Simple.String(dafnyValue.dtor_branchKeyId().dtor_value())); + } + if (dafnyValue.dtor_branchKeyVersion().is_Some()) { + nativeBuilder.branchKeyVersion(software.amazon.smithy.dafny.conversion.ToNative.Simple.String(dafnyValue.dtor_branchKeyVersion().dtor_value())); + } + return nativeBuilder.build(); + } + public static EncryptedPart EncryptedPart( software.amazon.cryptography.dbencryptionsdk.dynamodb.internaldafny.types.EncryptedPart dafnyValue) { EncryptedPart.Builder nativeBuilder = EncryptedPart.builder(); @@ -253,6 +273,20 @@ public static GetBranchKeyIdFromDdbKeyOutput GetBranchKeyIdFromDdbKeyOutput( return nativeBuilder.build(); } + public static GetEncryptedDataKeyDescriptionInput GetEncryptedDataKeyDescriptionInput( + software.amazon.cryptography.dbencryptionsdk.dynamodb.internaldafny.types.GetEncryptedDataKeyDescriptionInput dafnyValue) { + GetEncryptedDataKeyDescriptionInput.Builder nativeBuilder = GetEncryptedDataKeyDescriptionInput.builder(); + nativeBuilder.input(ToNative.GetEncryptedDataKeyDescriptionUnion(dafnyValue.dtor_input())); + return nativeBuilder.build(); + } + + public static GetEncryptedDataKeyDescriptionOutput GetEncryptedDataKeyDescriptionOutput( + software.amazon.cryptography.dbencryptionsdk.dynamodb.internaldafny.types.GetEncryptedDataKeyDescriptionOutput dafnyValue) { + GetEncryptedDataKeyDescriptionOutput.Builder nativeBuilder = GetEncryptedDataKeyDescriptionOutput.builder(); + nativeBuilder.EncryptedDataKeyDescriptionOutput(ToNative.EncryptedDataKeyDescriptionList(dafnyValue.dtor_EncryptedDataKeyDescriptionOutput())); + return nativeBuilder.build(); + } + public static GetPrefix GetPrefix( software.amazon.cryptography.dbencryptionsdk.dynamodb.internaldafny.types.GetPrefix dafnyValue) { GetPrefix.Builder nativeBuilder = GetPrefix.builder(); @@ -471,6 +505,18 @@ public static BeaconStyle BeaconStyle( return nativeBuilder.build(); } + public static GetEncryptedDataKeyDescriptionUnion GetEncryptedDataKeyDescriptionUnion( + software.amazon.cryptography.dbencryptionsdk.dynamodb.internaldafny.types.GetEncryptedDataKeyDescriptionUnion dafnyValue) { + GetEncryptedDataKeyDescriptionUnion.Builder nativeBuilder = GetEncryptedDataKeyDescriptionUnion.builder(); + if (dafnyValue.is_header()) { + nativeBuilder.header(software.amazon.smithy.dafny.conversion.ToNative.Simple.ByteBuffer(dafnyValue.dtor_header())); + } + if (dafnyValue.is_plaintextItem()) { + nativeBuilder.plaintextItem(software.amazon.cryptography.services.dynamodb.internaldafny.ToNative.AttributeMap(dafnyValue.dtor_plaintextItem())); + } + return nativeBuilder.build(); + } + public static VirtualTransform VirtualTransform( software.amazon.cryptography.dbencryptionsdk.dynamodb.internaldafny.types.VirtualTransform dafnyValue) { VirtualTransform.Builder nativeBuilder = VirtualTransform.builder(); @@ -529,6 +575,13 @@ public static List ConstructorPartList( software.amazon.cryptography.dbencryptionsdk.dynamodb.ToNative::ConstructorPart); } + public static List EncryptedDataKeyDescriptionList( + DafnySequence dafnyValue) { + return software.amazon.smithy.dafny.conversion.ToNative.Aggregate.GenericToList( + dafnyValue, + software.amazon.cryptography.dbencryptionsdk.dynamodb.ToNative::EncryptedDataKeyDescriptionOutput); + } + public static List EncryptedPartsList( DafnySequence dafnyValue) { return software.amazon.smithy.dafny.conversion.ToNative.Aggregate.GenericToList( diff --git a/DynamoDbEncryption/runtimes/java/src/main/smithy-generated/software/amazon/cryptography/dbencryptionsdk/dynamodb/model/EncryptedDataKeyDescriptionOutput.java b/DynamoDbEncryption/runtimes/java/src/main/smithy-generated/software/amazon/cryptography/dbencryptionsdk/dynamodb/model/EncryptedDataKeyDescriptionOutput.java new file mode 100644 index 000000000..974750bcf --- /dev/null +++ b/DynamoDbEncryption/runtimes/java/src/main/smithy-generated/software/amazon/cryptography/dbencryptionsdk/dynamodb/model/EncryptedDataKeyDescriptionOutput.java @@ -0,0 +1,130 @@ +// Copyright Amazon.com Inc. or its affiliates. All Rights Reserved. +// SPDX-License-Identifier: Apache-2.0 +// Do not modify this file. This file is machine generated, and any changes to it will be overwritten. +package software.amazon.cryptography.dbencryptionsdk.dynamodb.model; + +import java.util.Objects; + +public class EncryptedDataKeyDescriptionOutput { + private final String keyProviderId; + + private final String keyProviderInfo; + + private final String branchKeyId; + + private final String branchKeyVersion; + + protected EncryptedDataKeyDescriptionOutput(BuilderImpl builder) { + this.keyProviderId = builder.keyProviderId(); + this.keyProviderInfo = builder.keyProviderInfo(); + this.branchKeyId = builder.branchKeyId(); + this.branchKeyVersion = builder.branchKeyVersion(); + } + + public String keyProviderId() { + return this.keyProviderId; + } + + public String keyProviderInfo() { + return this.keyProviderInfo; + } + + public String branchKeyId() { + return this.branchKeyId; + } + + public String branchKeyVersion() { + return this.branchKeyVersion; + } + + public Builder toBuilder() { + return new BuilderImpl(this); + } + + public static Builder builder() { + return new BuilderImpl(); + } + + public interface Builder { + Builder keyProviderId(String keyProviderId); + + String keyProviderId(); + + Builder keyProviderInfo(String keyProviderInfo); + + String keyProviderInfo(); + + Builder branchKeyId(String branchKeyId); + + String branchKeyId(); + + Builder branchKeyVersion(String branchKeyVersion); + + String branchKeyVersion(); + + EncryptedDataKeyDescriptionOutput build(); + } + + static class BuilderImpl implements Builder { + protected String keyProviderId; + + protected String keyProviderInfo; + + protected String branchKeyId; + + protected String branchKeyVersion; + + protected BuilderImpl() { + } + + protected BuilderImpl(EncryptedDataKeyDescriptionOutput model) { + this.keyProviderId = model.keyProviderId(); + this.keyProviderInfo = model.keyProviderInfo(); + this.branchKeyId = model.branchKeyId(); + this.branchKeyVersion = model.branchKeyVersion(); + } + + public Builder keyProviderId(String keyProviderId) { + this.keyProviderId = keyProviderId; + return this; + } + + public String keyProviderId() { + return this.keyProviderId; + } + + public Builder keyProviderInfo(String keyProviderInfo) { + this.keyProviderInfo = keyProviderInfo; + return this; + } + + public String keyProviderInfo() { + return this.keyProviderInfo; + } + + public Builder branchKeyId(String branchKeyId) { + this.branchKeyId = branchKeyId; + return this; + } + + public String branchKeyId() { + return this.branchKeyId; + } + + public Builder branchKeyVersion(String branchKeyVersion) { + this.branchKeyVersion = branchKeyVersion; + return this; + } + + public String branchKeyVersion() { + return this.branchKeyVersion; + } + + public EncryptedDataKeyDescriptionOutput build() { + if (Objects.isNull(this.keyProviderId())) { + throw new IllegalArgumentException("Missing value for required field `keyProviderId`"); + } + return new EncryptedDataKeyDescriptionOutput(this); + } + } +} diff --git a/DynamoDbEncryption/runtimes/java/src/main/smithy-generated/software/amazon/cryptography/dbencryptionsdk/dynamodb/model/GetEncryptedDataKeyDescriptionInput.java b/DynamoDbEncryption/runtimes/java/src/main/smithy-generated/software/amazon/cryptography/dbencryptionsdk/dynamodb/model/GetEncryptedDataKeyDescriptionInput.java new file mode 100644 index 000000000..ef55a98ae --- /dev/null +++ b/DynamoDbEncryption/runtimes/java/src/main/smithy-generated/software/amazon/cryptography/dbencryptionsdk/dynamodb/model/GetEncryptedDataKeyDescriptionInput.java @@ -0,0 +1,61 @@ +// Copyright Amazon.com Inc. or its affiliates. All Rights Reserved. +// SPDX-License-Identifier: Apache-2.0 +// Do not modify this file. This file is machine generated, and any changes to it will be overwritten. +package software.amazon.cryptography.dbencryptionsdk.dynamodb.model; + +import java.util.Objects; + +public class GetEncryptedDataKeyDescriptionInput { + private final GetEncryptedDataKeyDescriptionUnion input; + + protected GetEncryptedDataKeyDescriptionInput(BuilderImpl builder) { + this.input = builder.input(); + } + + public GetEncryptedDataKeyDescriptionUnion input() { + return this.input; + } + + public Builder toBuilder() { + return new BuilderImpl(this); + } + + public static Builder builder() { + return new BuilderImpl(); + } + + public interface Builder { + Builder input(GetEncryptedDataKeyDescriptionUnion input); + + GetEncryptedDataKeyDescriptionUnion input(); + + GetEncryptedDataKeyDescriptionInput build(); + } + + static class BuilderImpl implements Builder { + protected GetEncryptedDataKeyDescriptionUnion input; + + protected BuilderImpl() { + } + + protected BuilderImpl(GetEncryptedDataKeyDescriptionInput model) { + this.input = model.input(); + } + + public Builder input(GetEncryptedDataKeyDescriptionUnion input) { + this.input = input; + return this; + } + + public GetEncryptedDataKeyDescriptionUnion input() { + return this.input; + } + + public GetEncryptedDataKeyDescriptionInput build() { + if (Objects.isNull(this.input())) { + throw new IllegalArgumentException("Missing value for required field `input`"); + } + return new GetEncryptedDataKeyDescriptionInput(this); + } + } +} diff --git a/DynamoDbEncryption/runtimes/java/src/main/smithy-generated/software/amazon/cryptography/dbencryptionsdk/dynamodb/model/GetEncryptedDataKeyDescriptionOutput.java b/DynamoDbEncryption/runtimes/java/src/main/smithy-generated/software/amazon/cryptography/dbencryptionsdk/dynamodb/model/GetEncryptedDataKeyDescriptionOutput.java new file mode 100644 index 000000000..b4ca94f86 --- /dev/null +++ b/DynamoDbEncryption/runtimes/java/src/main/smithy-generated/software/amazon/cryptography/dbencryptionsdk/dynamodb/model/GetEncryptedDataKeyDescriptionOutput.java @@ -0,0 +1,64 @@ +// Copyright Amazon.com Inc. or its affiliates. All Rights Reserved. +// SPDX-License-Identifier: Apache-2.0 +// Do not modify this file. This file is machine generated, and any changes to it will be overwritten. +package software.amazon.cryptography.dbencryptionsdk.dynamodb.model; + +import java.util.List; +import java.util.Objects; + +public class GetEncryptedDataKeyDescriptionOutput { + private final List EncryptedDataKeyDescriptionOutput; + + protected GetEncryptedDataKeyDescriptionOutput(BuilderImpl builder) { + this.EncryptedDataKeyDescriptionOutput = builder.EncryptedDataKeyDescriptionOutput(); + } + + public List EncryptedDataKeyDescriptionOutput() { + return this.EncryptedDataKeyDescriptionOutput; + } + + public Builder toBuilder() { + return new BuilderImpl(this); + } + + public static Builder builder() { + return new BuilderImpl(); + } + + public interface Builder { + Builder EncryptedDataKeyDescriptionOutput( + List EncryptedDataKeyDescriptionOutput); + + List EncryptedDataKeyDescriptionOutput(); + + GetEncryptedDataKeyDescriptionOutput build(); + } + + static class BuilderImpl implements Builder { + protected List EncryptedDataKeyDescriptionOutput; + + protected BuilderImpl() { + } + + protected BuilderImpl(GetEncryptedDataKeyDescriptionOutput model) { + this.EncryptedDataKeyDescriptionOutput = model.EncryptedDataKeyDescriptionOutput(); + } + + public Builder EncryptedDataKeyDescriptionOutput( + List EncryptedDataKeyDescriptionOutput) { + this.EncryptedDataKeyDescriptionOutput = EncryptedDataKeyDescriptionOutput; + return this; + } + + public List EncryptedDataKeyDescriptionOutput() { + return this.EncryptedDataKeyDescriptionOutput; + } + + public GetEncryptedDataKeyDescriptionOutput build() { + if (Objects.isNull(this.EncryptedDataKeyDescriptionOutput())) { + throw new IllegalArgumentException("Missing value for required field `EncryptedDataKeyDescriptionOutput`"); + } + return new GetEncryptedDataKeyDescriptionOutput(this); + } + } +} diff --git a/DynamoDbEncryption/runtimes/java/src/main/smithy-generated/software/amazon/cryptography/dbencryptionsdk/dynamodb/model/GetEncryptedDataKeyDescriptionUnion.java b/DynamoDbEncryption/runtimes/java/src/main/smithy-generated/software/amazon/cryptography/dbencryptionsdk/dynamodb/model/GetEncryptedDataKeyDescriptionUnion.java new file mode 100644 index 000000000..580c4de80 --- /dev/null +++ b/DynamoDbEncryption/runtimes/java/src/main/smithy-generated/software/amazon/cryptography/dbencryptionsdk/dynamodb/model/GetEncryptedDataKeyDescriptionUnion.java @@ -0,0 +1,101 @@ +// Copyright Amazon.com Inc. or its affiliates. All Rights Reserved. +// SPDX-License-Identifier: Apache-2.0 +// Do not modify this file. This file is machine generated, and any changes to it will be overwritten. +package software.amazon.cryptography.dbencryptionsdk.dynamodb.model; + +import java.nio.ByteBuffer; +import java.util.Map; +import java.util.Objects; +import software.amazon.awssdk.services.dynamodb.model.AttributeValue; + +public class GetEncryptedDataKeyDescriptionUnion { + private final ByteBuffer header; + + private final Map plaintextItem; + + protected GetEncryptedDataKeyDescriptionUnion(BuilderImpl builder) { + this.header = builder.header(); + this.plaintextItem = builder.plaintextItem(); + } + + public ByteBuffer header() { + return this.header; + } + + public Map plaintextItem() { + return this.plaintextItem; + } + + public Builder toBuilder() { + return new BuilderImpl(this); + } + + public static Builder builder() { + return new BuilderImpl(); + } + + public interface Builder { + Builder header(ByteBuffer header); + + ByteBuffer header(); + + Builder plaintextItem(Map plaintextItem); + + Map plaintextItem(); + + GetEncryptedDataKeyDescriptionUnion build(); + } + + static class BuilderImpl implements Builder { + protected ByteBuffer header; + + protected Map plaintextItem; + + protected BuilderImpl() { + } + + protected BuilderImpl(GetEncryptedDataKeyDescriptionUnion model) { + this.header = model.header(); + this.plaintextItem = model.plaintextItem(); + } + + public Builder header(ByteBuffer header) { + this.header = header; + return this; + } + + public ByteBuffer header() { + return this.header; + } + + public Builder plaintextItem(Map plaintextItem) { + this.plaintextItem = plaintextItem; + return this; + } + + public Map plaintextItem() { + return this.plaintextItem; + } + + public GetEncryptedDataKeyDescriptionUnion build() { + if (!onlyOneNonNull()) { + throw new IllegalArgumentException("`GetEncryptedDataKeyDescriptionUnion` is a Union. A Union MUST have one and only one value set."); + } + return new GetEncryptedDataKeyDescriptionUnion(this); + } + + private boolean onlyOneNonNull() { + Object[] allValues = {this.header, this.plaintextItem}; + boolean haveOneNonNull = false; + for (Object o : allValues) { + if (Objects.nonNull(o)) { + if (haveOneNonNull) { + return false; + } + haveOneNonNull = true; + } + } + return haveOneNonNull; + } + } +} From 44f22b7b3765d83e45129775ef54c6711e2b0a34 Mon Sep 17 00:00:00 2001 From: rishav-karanjit Date: Mon, 25 Mar 2024 18:10:46 -0700 Subject: [PATCH 11/67] Removed exception for custom keyring --- .../src/AwsCryptographyDbEncryptionSdkDynamoDbOperations.dfy | 2 -- 1 file changed, 2 deletions(-) diff --git a/DynamoDbEncryption/dafny/DynamoDbEncryption/src/AwsCryptographyDbEncryptionSdkDynamoDbOperations.dfy b/DynamoDbEncryption/dafny/DynamoDbEncryption/src/AwsCryptographyDbEncryptionSdkDynamoDbOperations.dfy index 0bf26f45d..75e1b7a8a 100644 --- a/DynamoDbEncryption/dafny/DynamoDbEncryption/src/AwsCryptographyDbEncryptionSdkDynamoDbOperations.dfy +++ b/DynamoDbEncryption/dafny/DynamoDbEncryption/src/AwsCryptographyDbEncryptionSdkDynamoDbOperations.dfy @@ -92,8 +92,6 @@ module AwsCryptographyDbEncryptionSdkDynamoDbOperations refines AbstractAwsCrypt var extractedKeyProviderId := UTF8.Decode(datakeys[i].keyProviderId).Extract(); var extractedKeyProviderIdInfo := UTF8.Decode(datakeys[i].keyProviderInfo).Extract(); - :- Need(|extractedKeyProviderId| > 7 && extractedKeyProviderId[0..7] == "aws-kms", E("Data encrypted with " + UTF8.Decode(datakeys[i].keyProviderId).Extract() + " not supported.")); - if |extractedKeyProviderId| < 7 || extractedKeyProviderId[0..7] != "aws-kms" { singleDataKeyOutput := EncryptedDataKeyDescriptionOutput( keyProviderId := extractedKeyProviderId, From 447630d2b4ca1d2d5f03a2536577305602c00f0e Mon Sep 17 00:00:00 2001 From: rishav-karanjit Date: Mon, 25 Mar 2024 18:23:17 -0700 Subject: [PATCH 12/67] Add polymorph generated code --- ...DbEncryptionSdkDynamoDbTransformsTypes.dfy | 38 +++++++++---------- 1 file changed, 18 insertions(+), 20 deletions(-) diff --git a/DynamoDbEncryption/dafny/DynamoDbEncryptionTransforms/Model/AwsCryptographyDbEncryptionSdkDynamoDbTransformsTypes.dfy b/DynamoDbEncryption/dafny/DynamoDbEncryptionTransforms/Model/AwsCryptographyDbEncryptionSdkDynamoDbTransformsTypes.dfy index 87da7669b..cc8dd79ea 100644 --- a/DynamoDbEncryption/dafny/DynamoDbEncryptionTransforms/Model/AwsCryptographyDbEncryptionSdkDynamoDbTransformsTypes.dfy +++ b/DynamoDbEncryption/dafny/DynamoDbEncryptionTransforms/Model/AwsCryptographyDbEncryptionSdkDynamoDbTransformsTypes.dfy @@ -741,7 +741,6 @@ include "../../../../submodules/MaterialProviders/StandardLibrary/src/Index.dfy" function method DefaultDynamoDbTablesEncryptionConfig(): AwsCryptographyDbEncryptionSdkDynamoDbTypes.DynamoDbTablesEncryptionConfig method DynamoDbEncryptionTransforms(config: AwsCryptographyDbEncryptionSdkDynamoDbTypes.DynamoDbTablesEncryptionConfig := DefaultDynamoDbTablesEncryptionConfig()) returns (res: Result) -// BEGIN MANUAL EDIT requires var tmps0 := set t0 | t0 in config.tableEncryptionConfigs.Values; forall tmp0 :: tmp0 in tmps0 ==> tmp0.keyring.Some? ==> @@ -838,25 +837,24 @@ include "../../../../submodules/MaterialProviders/StandardLibrary/src/Index.dfy" ) ) && fresh(res.value.History) && res.value.ValidState() - ensures var tmps23 := set t23 | t23 in config.tableEncryptionConfigs.Values; - forall tmp23 :: tmp23 in tmps23 ==> - tmp23.keyring.Some? ==> - tmp23.keyring.value.ValidState() - ensures var tmps24 := set t24 | t24 in config.tableEncryptionConfigs.Values; - forall tmp24 :: tmp24 in tmps24 ==> - tmp24.cmm.Some? ==> - tmp24.cmm.value.ValidState() - ensures var tmps25 := set t25 | t25 in config.tableEncryptionConfigs.Values; - forall tmp25 :: tmp25 in tmps25 ==> - tmp25.legacyOverride.Some? ==> - tmp25.legacyOverride.value.encryptor.ValidState() - ensures var tmps26 := set t26 | t26 in config.tableEncryptionConfigs.Values; - forall tmp26 :: tmp26 in tmps26 ==> - tmp26.search.Some? ==> - var tmps27 := set t27 | t27 in tmp26.search.value.versions; - forall tmp27 :: tmp27 in tmps27 ==> - tmp27.keyStore.ValidState() -// END MANUAL EDIT + ensures var tmps15 := set t15 | t15 in config.tableEncryptionConfigs.Values; + forall tmp15 :: tmp15 in tmps15 ==> + tmp15.keyring.Some? ==> + tmp15.keyring.value.ValidState() + ensures var tmps16 := set t16 | t16 in config.tableEncryptionConfigs.Values; + forall tmp16 :: tmp16 in tmps16 ==> + tmp16.cmm.Some? ==> + tmp16.cmm.value.ValidState() + ensures var tmps17 := set t17 | t17 in config.tableEncryptionConfigs.Values; + forall tmp17 :: tmp17 in tmps17 ==> + tmp17.legacyOverride.Some? ==> + tmp17.legacyOverride.value.encryptor.ValidState() + ensures var tmps18 := set t18 | t18 in config.tableEncryptionConfigs.Values; + forall tmp18 :: tmp18 in tmps18 ==> + tmp18.search.Some? ==> + var tmps19 := set t19 | t19 in tmp18.search.value.versions; + forall tmp19 :: tmp19 in tmps19 ==> + tmp19.keyStore.ValidState() // Helper function for the benefit of native code to create a Success(client) without referring to Dafny internals function method CreateSuccessOfClient(client: IDynamoDbEncryptionTransformsClient): Result { From 5d0a9fb6cfa19ae5a0ebff175c23ad5370e919e0 Mon Sep 17 00:00:00 2001 From: rishav-karanjit Date: Mon, 25 Mar 2024 18:33:45 -0700 Subject: [PATCH 13/67] Revert "Add polymorph generated code" This reverts commit 447630d2b4ca1d2d5f03a2536577305602c00f0e. --- ...DbEncryptionSdkDynamoDbTransformsTypes.dfy | 38 ++++++++++--------- 1 file changed, 20 insertions(+), 18 deletions(-) diff --git a/DynamoDbEncryption/dafny/DynamoDbEncryptionTransforms/Model/AwsCryptographyDbEncryptionSdkDynamoDbTransformsTypes.dfy b/DynamoDbEncryption/dafny/DynamoDbEncryptionTransforms/Model/AwsCryptographyDbEncryptionSdkDynamoDbTransformsTypes.dfy index cc8dd79ea..87da7669b 100644 --- a/DynamoDbEncryption/dafny/DynamoDbEncryptionTransforms/Model/AwsCryptographyDbEncryptionSdkDynamoDbTransformsTypes.dfy +++ b/DynamoDbEncryption/dafny/DynamoDbEncryptionTransforms/Model/AwsCryptographyDbEncryptionSdkDynamoDbTransformsTypes.dfy @@ -741,6 +741,7 @@ include "../../../../submodules/MaterialProviders/StandardLibrary/src/Index.dfy" function method DefaultDynamoDbTablesEncryptionConfig(): AwsCryptographyDbEncryptionSdkDynamoDbTypes.DynamoDbTablesEncryptionConfig method DynamoDbEncryptionTransforms(config: AwsCryptographyDbEncryptionSdkDynamoDbTypes.DynamoDbTablesEncryptionConfig := DefaultDynamoDbTablesEncryptionConfig()) returns (res: Result) +// BEGIN MANUAL EDIT requires var tmps0 := set t0 | t0 in config.tableEncryptionConfigs.Values; forall tmp0 :: tmp0 in tmps0 ==> tmp0.keyring.Some? ==> @@ -837,24 +838,25 @@ include "../../../../submodules/MaterialProviders/StandardLibrary/src/Index.dfy" ) ) && fresh(res.value.History) && res.value.ValidState() - ensures var tmps15 := set t15 | t15 in config.tableEncryptionConfigs.Values; - forall tmp15 :: tmp15 in tmps15 ==> - tmp15.keyring.Some? ==> - tmp15.keyring.value.ValidState() - ensures var tmps16 := set t16 | t16 in config.tableEncryptionConfigs.Values; - forall tmp16 :: tmp16 in tmps16 ==> - tmp16.cmm.Some? ==> - tmp16.cmm.value.ValidState() - ensures var tmps17 := set t17 | t17 in config.tableEncryptionConfigs.Values; - forall tmp17 :: tmp17 in tmps17 ==> - tmp17.legacyOverride.Some? ==> - tmp17.legacyOverride.value.encryptor.ValidState() - ensures var tmps18 := set t18 | t18 in config.tableEncryptionConfigs.Values; - forall tmp18 :: tmp18 in tmps18 ==> - tmp18.search.Some? ==> - var tmps19 := set t19 | t19 in tmp18.search.value.versions; - forall tmp19 :: tmp19 in tmps19 ==> - tmp19.keyStore.ValidState() + ensures var tmps23 := set t23 | t23 in config.tableEncryptionConfigs.Values; + forall tmp23 :: tmp23 in tmps23 ==> + tmp23.keyring.Some? ==> + tmp23.keyring.value.ValidState() + ensures var tmps24 := set t24 | t24 in config.tableEncryptionConfigs.Values; + forall tmp24 :: tmp24 in tmps24 ==> + tmp24.cmm.Some? ==> + tmp24.cmm.value.ValidState() + ensures var tmps25 := set t25 | t25 in config.tableEncryptionConfigs.Values; + forall tmp25 :: tmp25 in tmps25 ==> + tmp25.legacyOverride.Some? ==> + tmp25.legacyOverride.value.encryptor.ValidState() + ensures var tmps26 := set t26 | t26 in config.tableEncryptionConfigs.Values; + forall tmp26 :: tmp26 in tmps26 ==> + tmp26.search.Some? ==> + var tmps27 := set t27 | t27 in tmp26.search.value.versions; + forall tmp27 :: tmp27 in tmps27 ==> + tmp27.keyStore.ValidState() +// END MANUAL EDIT // Helper function for the benefit of native code to create a Success(client) without referring to Dafny internals function method CreateSuccessOfClient(client: IDynamoDbEncryptionTransformsClient): Result { From 09b61341c420f1dd3403317cc32d1644de7372c3 Mon Sep 17 00:00:00 2001 From: rishav-karanjit Date: Mon, 25 Mar 2024 23:02:12 -0700 Subject: [PATCH 14/67] Add GetEncryptedDataKeyDescription Example --- ...GetEncryptedDataKeyDescriptionExample.java | 103 ++++++++++++++++++ ...GetEncryptedDataKeyDescriptionExample.java | 10 ++ 2 files changed, 113 insertions(+) create mode 100644 Examples/runtimes/java/DynamoDbEncryption/src/main/java/software/amazon/cryptography/examples/GetEncryptedDataKeyDescriptionExample.java create mode 100644 Examples/runtimes/java/DynamoDbEncryption/src/test/java/software/amazon/cryptography/examples/TestGetEncryptedDataKeyDescriptionExample.java diff --git a/Examples/runtimes/java/DynamoDbEncryption/src/main/java/software/amazon/cryptography/examples/GetEncryptedDataKeyDescriptionExample.java b/Examples/runtimes/java/DynamoDbEncryption/src/main/java/software/amazon/cryptography/examples/GetEncryptedDataKeyDescriptionExample.java new file mode 100644 index 000000000..1d6cb04f7 --- /dev/null +++ b/Examples/runtimes/java/DynamoDbEncryption/src/main/java/software/amazon/cryptography/examples/GetEncryptedDataKeyDescriptionExample.java @@ -0,0 +1,103 @@ +package software.amazon.cryptography.examples; + +import software.amazon.awssdk.regions.Region; +import software.amazon.awssdk.services.dynamodb.model.*; +import software.amazon.awssdk.services.dynamodb.DynamoDbClient; +import software.amazon.cryptography.dbencryptionsdk.dynamodb.DynamoDbEncryption; +import software.amazon.cryptography.dbencryptionsdk.dynamodb.model.DynamoDbEncryptionConfig; + +import software.amazon.cryptography.dbencryptionsdk.dynamodb.model.GetEncryptedDataKeyDescriptionUnion; +import software.amazon.cryptography.dbencryptionsdk.dynamodb.model.GetEncryptedDataKeyDescriptionInput; +import software.amazon.cryptography.dbencryptionsdk.dynamodb.model.GetEncryptedDataKeyDescriptionOutput; +import java.nio.ByteBuffer; + +import java.util.HashMap; +import java.util.Map; +import java.util.*; + +public class GetEncryptedDataKeyDescriptionExample{ + public static void getEncryptedDataKeyDescription( + String tableName, String partitionKey, String partitionKeyVal, String sortKeyName, String sortKeyValue, + String expectedKeyProviderId, String expectedKeyProviderInfo, String expectedBranchKeyId, String expectedBranchKeyVersion + ) { + DynamoDbEncryption ddbEnc = DynamoDbEncryption.builder() + .DynamoDbEncryptionConfig(DynamoDbEncryptionConfig.builder().build()) + .build(); + + String header_column = "aws_dbe_head"; + + DynamoDbClient ddb = DynamoDbClient.builder() + .region(Region.US_WEST_2) + .build(); + + HashMap keyToGet = new HashMap<>(); + keyToGet.put(partitionKey, AttributeValue.builder() + .s(partitionKeyVal) + .build()); + + keyToGet.put(sortKeyName, AttributeValue.builder() + .n(sortKeyValue) + .build()); + + // ddbEnc.GetHeader(ddbEnc.GetHeaderInput.builder().build()); + GetItemRequest request = GetItemRequest.builder() + .tableName(tableName) + .key(keyToGet) + .build(); + + Map returnedItem = ddb.getItem(request).item(); + + if (returnedItem.isEmpty()) + System.out.format("No item found with the key %s!\n", partitionKey); + + ByteBuffer header = returnedItem.get(header_column).b().asByteBuffer(); + + GetEncryptedDataKeyDescriptionUnion InputUnion = GetEncryptedDataKeyDescriptionUnion.builder() + .plaintextItem(returnedItem) + .build(); + + // GetEncryptedDataKeyDescriptionUnion InputUnion = GetEncryptedDataKeyDescriptionUnion.builder() + // .header(header) + // .build(); + + // Create input + software.amazon.cryptography.dbencryptionsdk.dynamodb.model.GetEncryptedDataKeyDescriptionInput input = GetEncryptedDataKeyDescriptionInput.builder() + .input(InputUnion) + .build(); + + // Call GetHeader method + GetEncryptedDataKeyDescriptionOutput output = ddbEnc.GetEncryptedDataKeyDescription(input); + + assert output.EncryptedDataKeyDescriptionOutput().get(0).keyProviderId().equals(expectedKeyProviderId); + + if(expectedKeyProviderId.startsWith("aws-kms")) { + assert output.EncryptedDataKeyDescriptionOutput().get(0).keyProviderInfo().equals(expectedKeyProviderInfo); + } else { + assert output.EncryptedDataKeyDescriptionOutput().get(0).keyProviderInfo() == expectedKeyProviderInfo; + } + + if(output.EncryptedDataKeyDescriptionOutput().get(0).keyProviderId().equals("aws-kms-hierarchy")) { + assert output.EncryptedDataKeyDescriptionOutput().get(0).branchKeyId().equals(expectedBranchKeyId); + assert output.EncryptedDataKeyDescriptionOutput().get(0).branchKeyVersion().equals(expectedBranchKeyVersion); + } else { + assert output.EncryptedDataKeyDescriptionOutput().get(0).branchKeyId() == expectedBranchKeyId; + assert output.EncryptedDataKeyDescriptionOutput().get(0).branchKeyVersion() == expectedBranchKeyVersion; + } + } + public static void main(final String[] args) { + if (args.length < 9) { + throw new IllegalArgumentException("To run this example, include the tableName, partitionKey, partitionKeyVal," + + "sortKeyName, sortKeyValue, expectedKeyProviderId, expectedKeyProviderInfo, expectedBranchKeyId and expectedBranchKeyVersion in args"); + } + final String tableName = args[0]; + final String partitionKey = args[1]; + final String partitionKeyVal = args[2]; + final String sortKeyName = args[3]; + final String sortKeyValue = args[4]; + final String expectedKeyProviderId = args[5]; + final String expectedKeyProviderInfo = args[6]; + final String expectedBranchKeyId = args[7]; + final String expectedBranchKeyVersion = args[8]; + getEncryptedDataKeyDescription(tableName, partitionKey, partitionKeyVal, sortKeyName, sortKeyValue, expectedKeyProviderId, expectedKeyProviderInfo, expectedBranchKeyId, expectedBranchKeyVersion); + } +} \ No newline at end of file diff --git a/Examples/runtimes/java/DynamoDbEncryption/src/test/java/software/amazon/cryptography/examples/TestGetEncryptedDataKeyDescriptionExample.java b/Examples/runtimes/java/DynamoDbEncryption/src/test/java/software/amazon/cryptography/examples/TestGetEncryptedDataKeyDescriptionExample.java new file mode 100644 index 000000000..475bb6e5b --- /dev/null +++ b/Examples/runtimes/java/DynamoDbEncryption/src/test/java/software/amazon/cryptography/examples/TestGetEncryptedDataKeyDescriptionExample.java @@ -0,0 +1,10 @@ +package software.amazon.cryptography.examples; + +import org.testng.annotations.Test; + +public class TestGetEncryptedDataKeyDescriptionExample { + @Test + public void TestGetEncryptedDataKeyDescription() { + GetEncryptedDataKeyDescriptionExample.getEncryptedDataKeyDescription(TestUtils.TEST_DDB_TABLE_NAME,"partition_key","BasicPutGetExample","sort_key","0","aws-kms",TestUtils.TEST_KMS_KEY_ID,null,null); + } +} \ No newline at end of file From 9deae04f00349cef79f95cd5b042f8ea284cf82a Mon Sep 17 00:00:00 2001 From: rishav-karanjit Date: Tue, 26 Mar 2024 16:59:33 -0700 Subject: [PATCH 15/67] Add more test coverage and decrease resource count --- ...moDbGetEncryptedDataKeyDescriptionTest.dfy | 259 ++++++++++++++++-- 1 file changed, 230 insertions(+), 29 deletions(-) diff --git a/DynamoDbEncryption/dafny/DynamoDbEncryption/test/DynamoDbGetEncryptedDataKeyDescriptionTest.dfy b/DynamoDbEncryption/dafny/DynamoDbEncryption/test/DynamoDbGetEncryptedDataKeyDescriptionTest.dfy index aa7a37b40..45319e8d7 100644 --- a/DynamoDbEncryption/dafny/DynamoDbEncryption/test/DynamoDbGetEncryptedDataKeyDescriptionTest.dfy +++ b/DynamoDbEncryption/dafny/DynamoDbEncryption/test/DynamoDbGetEncryptedDataKeyDescriptionTest.dfy @@ -4,6 +4,7 @@ module DynamoDbGetEncryptedDataKeyDescriptionTest { import DynamoDbEncryption import opened StandardLibrary.UInt import opened StructuredEncryptionHeader + import opened StructuredEncryptionUtil import opened UTF8 import Types = AwsCryptographyDbEncryptionSdkDynamoDbTypes import UUID @@ -11,39 +12,100 @@ module DynamoDbGetEncryptedDataKeyDescriptionTest { import EdkWrapping import AlgorithmSuites - const expectedHead := PartialHeader ( - version := 1, - flavor := 1, - msgID := [1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32], - legend := [0x65, 0x73], - encContext := map[EncodeAscii("abc") := EncodeAscii("def")], - dataKeys := [CMP.EncryptedDataKey( - keyProviderId := EncodeAscii("aws-kms-hierarchy") , - keyProviderInfo := EncodeAscii("keyproviderInfo"), - ciphertext := [ - 64, 92, 115, 7, 85, 121, 112, 79, 69, 12, 82, 25, 67, 34, - 11, 66, 93, 45, 40, 23, 90, 61, 16, 28, 59, 114, 52, 122, - 50, 23, 11, 101, 48, 53, 30, 120, 51, 74, 77, 53, 57, 99, - 53, 13, 30, 21, 109, 85, 15, 86, 47, 84, 91, 85, 87, 60, 4, - 56, 67, 74, 29, 87, 85, 106, 8, 82, 63, 114, 100, 110, 68, - 58, 83, 24, 111, 41, 21, 91, 122, 61, 118, 37, 72, 38, 67, 2, - 17, 61, 17, 121, 7, 90, 117, 49, 30, 20, 89, 68, 33, 111, - 107, 5, 120, 20, 95, 78, 70, 2, 49, 84, 39, 50, 40, 40, 115, - 114, 76, 18, 103, 84, 34, 123, 1, 125, 61, 33, 13, 18, 81, - 24, 53, 53, 26, 60, 52, 85, 81, 96, 85, 72])] - ) - const serializedHeader := expectedHead.serialize() + expectedHead.msgID + const testVersion : Version := 1 + + const testFlavor : Flavor := 1 + + const testMsgID : MessageID := [1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32] + + const testLegend : Legend := [0x65, 0x73] + + const testEncContext : CMPEncryptionContext := map[EncodeAscii("abc") := EncodeAscii("def")] + + const testAwsKmsDataKey := CMP.EncryptedDataKey( + keyProviderId := EncodeAscii("aws-kms") , + keyProviderInfo := EncodeAscii("keyproviderInfo"), + ciphertext := [1, 2, 3, 4, 5]) + + const testAwsKmsHDataKey := CMP.EncryptedDataKey( + keyProviderId := EncodeAscii("aws-kms-hierarchy") , + keyProviderInfo := EncodeAscii("keyproviderInfo"), + ciphertext := [ + 64, 92, 115, 7, 85, 121, 112, 79, 69, 12, 82, 25, 67, 34, + 11, 66, 93, 45, 40, 23, 90, 61, 16, 28, 59, 114, 52, 122, + 50, 23, 11, 101, 48, 53, 30, 120, 51, 74, 77, 53, 57, 99, + 53, 13, 30, 21, 109, 85, 15, 86, 47, 84, 91, 85, 87, 60, 4, + 56, 67, 74, 29, 87, 85, 106, 8, 82, 63, 114, 100, 110, 68, + 58, 83, 24, 111, 41, 21, 91, 122, 61, 118, 37, 72, 38, 67, 2, + 17, 61, 17, 121, 7, 90, 117, 49, 30, 20, 89, 68, 33, 111, + 107, 5, 120, 20, 95, 78, 70, 2, 49, 84, 39, 50, 40, 40, 115, + 114, 76, 18, 103, 84, 34, 123, 1, 125, 61, 33, 13, 18, 81, + 24, 53, 53, 26, 60, 52, 85, 81, 96, 85, 72]) + + const testRawRsaDataKey := CMP.EncryptedDataKey( + keyProviderId := EncodeAscii("raw-rsa") , + keyProviderInfo := [1, 2, 3, 4, 5], + ciphertext := [6, 7, 8, 9]) + + const testAwsKmsRsaDataKey := CMP.EncryptedDataKey( + keyProviderId := EncodeAscii("aws-kms-rsa") , + keyProviderInfo := EncodeAscii("keyproviderInfo"), + ciphertext := [1, 2, 3, 4, 5]) + const algorithmSuite := AlgorithmSuites.DBE_ALG_AES_256_GCM_HKDF_SHA512_COMMIT_KEY_ECDSA_P384_SYMSIG_HMAC_SHA384 - method {:test} TestHeaderInputCase() + method CreatePartialHeader(version : Version, flavor : Flavor, msgID : MessageID, legend : Legend, encContext : CMPEncryptionContext, dataKeyList : CMPEncryptedDataKeyList) + returns (result: PartialHeader) + ensures result.version == version + ensures result.flavor == flavor + ensures result.msgID == msgID + ensures result.legend == legend + ensures result.encContext == encContext + ensures result.dataKeys == dataKeyList { - expect EdkWrapping.GetProviderWrappedMaterial(expectedHead.dataKeys[0].ciphertext, algorithmSuite).Success?; - var providerWrappedMaterial := EdkWrapping.GetProviderWrappedMaterial(expectedHead.dataKeys[0].ciphertext, algorithmSuite).Extract(); + result := PartialHeader ( + version := version, + flavor := flavor, + msgID := msgID, + legend := legend, + encContext := encContext, + dataKeys := dataKeyList + ); + } + + method {:test} TestHeaderInputAwsKmsDataKeyCase() + { + var expectedHead := CreatePartialHeader(testVersion, testFlavor, testMsgID, testLegend, testEncContext, [testAwsKmsDataKey]); + var serializedHeader := expectedHead.serialize() + expectedHead.msgID; + + var ddbEncResources :- expect DynamoDbEncryption.DynamoDbEncryption(); + + var inputVariable: Types.GetEncryptedDataKeyDescriptionInput := + Types.GetEncryptedDataKeyDescriptionInput( + input := Types.header(header := serializedHeader) + ); + + var actualDataKeyDescription := ddbEncResources.GetEncryptedDataKeyDescription(inputVariable); + + expect UTF8.Decode(expectedHead.dataKeys[0].keyProviderId).Success?; + expect UTF8.Decode(expectedHead.dataKeys[0].keyProviderInfo).Success?; + expect actualDataKeyDescription.Success?; + expect |actualDataKeyDescription.Extract().EncryptedDataKeyDescriptionOutput| > 0; + + expect |actualDataKeyDescription.Extract().EncryptedDataKeyDescriptionOutput| == |expectedHead.dataKeys|; + expect actualDataKeyDescription.Extract().EncryptedDataKeyDescriptionOutput[0].keyProviderId == UTF8.Decode(expectedHead.dataKeys[0].keyProviderId).Extract(); - // The ciphertext structure in the hierarchy keyring contains Salt and IV before Version. - // The length of Salt is 16 and IV is 12 bytes. The length of Version is 16 bytes. - // https://github.com/awslabs/aws-encryption-sdk-specification/blob/master/framework/aws-kms/aws-kms-hierarchical-keyring.md#ciphertext + expect actualDataKeyDescription.Extract().EncryptedDataKeyDescriptionOutput[0].keyProviderInfo.Some?; + expect actualDataKeyDescription.Extract().EncryptedDataKeyDescriptionOutput[0].keyProviderInfo.Extract() == UTF8.Decode(expectedHead.dataKeys[0].keyProviderInfo).Extract(); + } + + method {:test} TestHeaderInputAwsKmsHDataKeyCase() + { + var expectedHead := CreatePartialHeader(testVersion, testFlavor, testMsgID, testLegend, testEncContext, [testAwsKmsHDataKey]); + var serializedHeader := expectedHead.serialize() + expectedHead.msgID; + expect EdkWrapping.GetProviderWrappedMaterial(expectedHead.dataKeys[0].ciphertext, algorithmSuite).Success?; + var providerWrappedMaterial := EdkWrapping.GetProviderWrappedMaterial(expectedHead.dataKeys[0].ciphertext, algorithmSuite).Extract(); expect |providerWrappedMaterial| >= (16 + 12 + 16); var expectedBranchKeyVersionUuid := UUID.FromByteArray(providerWrappedMaterial[16 + 12 .. (16 + 12 + 16)]); var ddbEncResources :- expect DynamoDbEncryption.DynamoDbEncryption(); @@ -76,8 +138,91 @@ module DynamoDbGetEncryptedDataKeyDescriptionTest { } } - method {:test} TestDDBItemInputCase() + method {:test} TestHeaderInputRawRsaDataKeyDataKeyCase() + { + var expectedHead := CreatePartialHeader(testVersion, testFlavor, testMsgID, testLegend, testEncContext, [testRawRsaDataKey]); + var serializedHeader := expectedHead.serialize() + expectedHead.msgID; + + var ddbEncResources :- expect DynamoDbEncryption.DynamoDbEncryption(); + + var inputVariable: Types.GetEncryptedDataKeyDescriptionInput := + Types.GetEncryptedDataKeyDescriptionInput( + input := Types.header(header := serializedHeader) + ); + + var actualDataKeyDescription := ddbEncResources.GetEncryptedDataKeyDescription(inputVariable); + + expect UTF8.Decode(expectedHead.dataKeys[0].keyProviderId).Success?; + expect UTF8.Decode(expectedHead.dataKeys[0].keyProviderInfo).Success?; + expect actualDataKeyDescription.Success?; + expect |actualDataKeyDescription.Extract().EncryptedDataKeyDescriptionOutput| > 0; + + expect |actualDataKeyDescription.Extract().EncryptedDataKeyDescriptionOutput| == |expectedHead.dataKeys|; + expect actualDataKeyDescription.Extract().EncryptedDataKeyDescriptionOutput[0].keyProviderId == UTF8.Decode(expectedHead.dataKeys[0].keyProviderId).Extract(); + + expect actualDataKeyDescription.Extract().EncryptedDataKeyDescriptionOutput[0].keyProviderInfo.Some?; + expect actualDataKeyDescription.Extract().EncryptedDataKeyDescriptionOutput[0].keyProviderInfo.Extract() == UTF8.Decode(expectedHead.dataKeys[0].keyProviderInfo).Extract(); + } + + method {:test} TestHeaderInputAwsKmsRsaDataKeyCase() + { + var expectedHead := CreatePartialHeader(testVersion, testFlavor, testMsgID, testLegend, testEncContext, [testAwsKmsRsaDataKey]); + var serializedHeader := expectedHead.serialize() + expectedHead.msgID; + + var ddbEncResources :- expect DynamoDbEncryption.DynamoDbEncryption(); + + var inputVariable: Types.GetEncryptedDataKeyDescriptionInput := + Types.GetEncryptedDataKeyDescriptionInput( + input := Types.header(header := serializedHeader) + ); + + var actualDataKeyDescription := ddbEncResources.GetEncryptedDataKeyDescription(inputVariable); + + expect UTF8.Decode(expectedHead.dataKeys[0].keyProviderId).Success?; + expect UTF8.Decode(expectedHead.dataKeys[0].keyProviderInfo).Success?; + expect actualDataKeyDescription.Success?; + expect |actualDataKeyDescription.Extract().EncryptedDataKeyDescriptionOutput| > 0; + + expect |actualDataKeyDescription.Extract().EncryptedDataKeyDescriptionOutput| == |expectedHead.dataKeys|; + expect actualDataKeyDescription.Extract().EncryptedDataKeyDescriptionOutput[0].keyProviderId == UTF8.Decode(expectedHead.dataKeys[0].keyProviderId).Extract(); + + expect actualDataKeyDescription.Extract().EncryptedDataKeyDescriptionOutput[0].keyProviderInfo.Some?; + expect actualDataKeyDescription.Extract().EncryptedDataKeyDescriptionOutput[0].keyProviderInfo.Extract() == UTF8.Decode(expectedHead.dataKeys[0].keyProviderInfo).Extract(); + } + + + method {:test} TestDDBItemInputAwsKmsDataKeyCase() + { + var expectedHead := CreatePartialHeader(testVersion, testFlavor, testMsgID, testLegend, testEncContext, [testAwsKmsDataKey]); + var serializedHeader := expectedHead.serialize() + expectedHead.msgID; + + var attr := map["aws_dbe_head" := ComAmazonawsDynamodbTypes.AttributeValue.B(serializedHeader)]; + var ddbEncResources :- expect DynamoDbEncryption.DynamoDbEncryption(); + + var inputVariable: Types.GetEncryptedDataKeyDescriptionInput := + Types.GetEncryptedDataKeyDescriptionInput( + input := Types.plaintextItem(plaintextItem := attr) + ); + + var actualDataKeyDescription := ddbEncResources.GetEncryptedDataKeyDescription(inputVariable); + + expect UTF8.Decode(expectedHead.dataKeys[0].keyProviderId).Success?; + expect UTF8.Decode(expectedHead.dataKeys[0].keyProviderInfo).Success?; + expect actualDataKeyDescription.Success?; + expect |actualDataKeyDescription.Extract().EncryptedDataKeyDescriptionOutput| > 0; + + expect |actualDataKeyDescription.Extract().EncryptedDataKeyDescriptionOutput| == |expectedHead.dataKeys|; + expect actualDataKeyDescription.Extract().EncryptedDataKeyDescriptionOutput[0].keyProviderId == UTF8.Decode(expectedHead.dataKeys[0].keyProviderId).Extract(); + + expect actualDataKeyDescription.Extract().EncryptedDataKeyDescriptionOutput[0].keyProviderInfo.Some?; + expect actualDataKeyDescription.Extract().EncryptedDataKeyDescriptionOutput[0].keyProviderInfo.Extract() == UTF8.Decode(expectedHead.dataKeys[0].keyProviderInfo).Extract(); + } + + method {:test} TestDDBItemInputAwsKmsHDataKeyCase() { + var expectedHead := CreatePartialHeader(testVersion, testFlavor, testMsgID, testLegend, testEncContext, [testAwsKmsHDataKey]); + var serializedHeader := expectedHead.serialize() + expectedHead.msgID; + expect EdkWrapping.GetProviderWrappedMaterial(expectedHead.dataKeys[0].ciphertext, algorithmSuite).Success?; var providerWrappedMaterial := EdkWrapping.GetProviderWrappedMaterial(expectedHead.dataKeys[0].ciphertext, algorithmSuite).Extract(); @@ -115,4 +260,60 @@ module DynamoDbGetEncryptedDataKeyDescriptionTest { expect actualDataKeyDescription.Extract().EncryptedDataKeyDescriptionOutput[0].branchKeyVersion.Extract() == expectedBranchKeyVersionUuid.Extract(); } } + + method {:test} TestDDBItemInputRawRsaDataKeyCase() + { + var expectedHead := CreatePartialHeader(testVersion, testFlavor, testMsgID, testLegend, testEncContext, [testRawRsaDataKey]); + var serializedHeader := expectedHead.serialize() + expectedHead.msgID; + + var attr := map["aws_dbe_head" := ComAmazonawsDynamodbTypes.AttributeValue.B(serializedHeader)]; + var ddbEncResources :- expect DynamoDbEncryption.DynamoDbEncryption(); + + + var inputVariable: Types.GetEncryptedDataKeyDescriptionInput := + Types.GetEncryptedDataKeyDescriptionInput( + input := Types.plaintextItem(plaintextItem := attr) + ); + + var actualDataKeyDescription := ddbEncResources.GetEncryptedDataKeyDescription(inputVariable); + + expect UTF8.Decode(expectedHead.dataKeys[0].keyProviderId).Success?; + expect UTF8.Decode(expectedHead.dataKeys[0].keyProviderInfo).Success?; + expect actualDataKeyDescription.Success?; + expect |actualDataKeyDescription.Extract().EncryptedDataKeyDescriptionOutput| > 0; + + expect |actualDataKeyDescription.Extract().EncryptedDataKeyDescriptionOutput| == |expectedHead.dataKeys|; + expect actualDataKeyDescription.Extract().EncryptedDataKeyDescriptionOutput[0].keyProviderId == UTF8.Decode(expectedHead.dataKeys[0].keyProviderId).Extract(); + + expect actualDataKeyDescription.Extract().EncryptedDataKeyDescriptionOutput[0].keyProviderInfo.Some?; + expect actualDataKeyDescription.Extract().EncryptedDataKeyDescriptionOutput[0].keyProviderInfo.Extract() == UTF8.Decode(expectedHead.dataKeys[0].keyProviderInfo).Extract(); + } + + method {:test} TestDDBItemInputAwsKmsRsaDataKeyCase() + { + var expectedHead := CreatePartialHeader(testVersion, testFlavor, testMsgID, testLegend, testEncContext, [testAwsKmsRsaDataKey]); + var serializedHeader := expectedHead.serialize() + expectedHead.msgID; + + var attr := map["aws_dbe_head" := ComAmazonawsDynamodbTypes.AttributeValue.B(serializedHeader)]; + var ddbEncResources :- expect DynamoDbEncryption.DynamoDbEncryption(); + + + var inputVariable: Types.GetEncryptedDataKeyDescriptionInput := + Types.GetEncryptedDataKeyDescriptionInput( + input := Types.plaintextItem(plaintextItem := attr) + ); + + var actualDataKeyDescription := ddbEncResources.GetEncryptedDataKeyDescription(inputVariable); + + expect UTF8.Decode(expectedHead.dataKeys[0].keyProviderId).Success?; + expect UTF8.Decode(expectedHead.dataKeys[0].keyProviderInfo).Success?; + expect actualDataKeyDescription.Success?; + expect |actualDataKeyDescription.Extract().EncryptedDataKeyDescriptionOutput| > 0; + + expect |actualDataKeyDescription.Extract().EncryptedDataKeyDescriptionOutput| == |expectedHead.dataKeys|; + expect actualDataKeyDescription.Extract().EncryptedDataKeyDescriptionOutput[0].keyProviderId == UTF8.Decode(expectedHead.dataKeys[0].keyProviderId).Extract(); + + expect actualDataKeyDescription.Extract().EncryptedDataKeyDescriptionOutput[0].keyProviderInfo.Some?; + expect actualDataKeyDescription.Extract().EncryptedDataKeyDescriptionOutput[0].keyProviderInfo.Extract() == UTF8.Decode(expectedHead.dataKeys[0].keyProviderInfo).Extract(); + } } From 23b5de72f98fe6b78a6bd8d0a640e99eca6c5ae3 Mon Sep 17 00:00:00 2001 From: rishav-karanjit Date: Tue, 26 Mar 2024 20:46:52 -0700 Subject: [PATCH 16/67] Add getBranchKeyVersion to decrease resource count --- ...moDbGetEncryptedDataKeyDescriptionTest.dfy | 34 +++++++++++-------- 1 file changed, 19 insertions(+), 15 deletions(-) diff --git a/DynamoDbEncryption/dafny/DynamoDbEncryption/test/DynamoDbGetEncryptedDataKeyDescriptionTest.dfy b/DynamoDbEncryption/dafny/DynamoDbEncryption/test/DynamoDbGetEncryptedDataKeyDescriptionTest.dfy index 45319e8d7..93edc0c86 100644 --- a/DynamoDbEncryption/dafny/DynamoDbEncryption/test/DynamoDbGetEncryptedDataKeyDescriptionTest.dfy +++ b/DynamoDbEncryption/dafny/DynamoDbEncryption/test/DynamoDbGetEncryptedDataKeyDescriptionTest.dfy @@ -104,10 +104,7 @@ module DynamoDbGetEncryptedDataKeyDescriptionTest { var expectedHead := CreatePartialHeader(testVersion, testFlavor, testMsgID, testLegend, testEncContext, [testAwsKmsHDataKey]); var serializedHeader := expectedHead.serialize() + expectedHead.msgID; - expect EdkWrapping.GetProviderWrappedMaterial(expectedHead.dataKeys[0].ciphertext, algorithmSuite).Success?; - var providerWrappedMaterial := EdkWrapping.GetProviderWrappedMaterial(expectedHead.dataKeys[0].ciphertext, algorithmSuite).Extract(); - expect |providerWrappedMaterial| >= (16 + 12 + 16); - var expectedBranchKeyVersionUuid := UUID.FromByteArray(providerWrappedMaterial[16 + 12 .. (16 + 12 + 16)]); + var expectedBranchKeyVersion := getBranchKeyVersion(expectedHead); var ddbEncResources :- expect DynamoDbEncryption.DynamoDbEncryption(); var inputVariable: Types.GetEncryptedDataKeyDescriptionInput := @@ -117,7 +114,6 @@ module DynamoDbGetEncryptedDataKeyDescriptionTest { var actualDataKeyDescription := ddbEncResources.GetEncryptedDataKeyDescription(inputVariable); - expect expectedBranchKeyVersionUuid.Success?; expect UTF8.Decode(expectedHead.dataKeys[0].keyProviderId).Success?; expect UTF8.Decode(expectedHead.dataKeys[0].keyProviderInfo).Success?; expect actualDataKeyDescription.Success?; @@ -134,7 +130,7 @@ module DynamoDbGetEncryptedDataKeyDescriptionTest { expect actualDataKeyDescription.Extract().EncryptedDataKeyDescriptionOutput[0].branchKeyVersion.Some?; expect actualDataKeyDescription.Extract().EncryptedDataKeyDescriptionOutput[0].branchKeyId.Extract() == UTF8.Decode(expectedHead.dataKeys[0].keyProviderInfo).Extract(); - expect actualDataKeyDescription.Extract().EncryptedDataKeyDescriptionOutput[0].branchKeyVersion.Extract() == expectedBranchKeyVersionUuid.Extract(); + expect actualDataKeyDescription.Extract().EncryptedDataKeyDescriptionOutput[0].branchKeyVersion.Extract() == expectedBranchKeyVersion; } } @@ -223,16 +219,10 @@ module DynamoDbGetEncryptedDataKeyDescriptionTest { var expectedHead := CreatePartialHeader(testVersion, testFlavor, testMsgID, testLegend, testEncContext, [testAwsKmsHDataKey]); var serializedHeader := expectedHead.serialize() + expectedHead.msgID; - expect EdkWrapping.GetProviderWrappedMaterial(expectedHead.dataKeys[0].ciphertext, algorithmSuite).Success?; - var providerWrappedMaterial := EdkWrapping.GetProviderWrappedMaterial(expectedHead.dataKeys[0].ciphertext, algorithmSuite).Extract(); - - expect |providerWrappedMaterial| >= (28 + 16); - - var expectedBranchKeyVersionUuid := UUID.FromByteArray(providerWrappedMaterial[28 .. (28 + 16)]); + var expectedBranchKeyVersion := getBranchKeyVersion(expectedHead); var attr := map["aws_dbe_head" := ComAmazonawsDynamodbTypes.AttributeValue.B(serializedHeader)]; var ddbEncResources :- expect DynamoDbEncryption.DynamoDbEncryption(); - var inputVariable: Types.GetEncryptedDataKeyDescriptionInput := Types.GetEncryptedDataKeyDescriptionInput( input := Types.plaintextItem(plaintextItem := attr) @@ -240,7 +230,6 @@ module DynamoDbGetEncryptedDataKeyDescriptionTest { var actualDataKeyDescription := ddbEncResources.GetEncryptedDataKeyDescription(inputVariable); - expect expectedBranchKeyVersionUuid.Success?; expect UTF8.Decode(expectedHead.dataKeys[0].keyProviderId).Success?; expect UTF8.Decode(expectedHead.dataKeys[0].keyProviderInfo).Success?; expect actualDataKeyDescription.Success?; @@ -257,7 +246,7 @@ module DynamoDbGetEncryptedDataKeyDescriptionTest { expect actualDataKeyDescription.Extract().EncryptedDataKeyDescriptionOutput[0].branchKeyVersion.Some?; expect actualDataKeyDescription.Extract().EncryptedDataKeyDescriptionOutput[0].branchKeyId.Extract() == UTF8.Decode(expectedHead.dataKeys[0].keyProviderInfo).Extract(); - expect actualDataKeyDescription.Extract().EncryptedDataKeyDescriptionOutput[0].branchKeyVersion.Extract() == expectedBranchKeyVersionUuid.Extract(); + expect actualDataKeyDescription.Extract().EncryptedDataKeyDescriptionOutput[0].branchKeyVersion.Extract() == expectedBranchKeyVersion; } } @@ -316,4 +305,19 @@ module DynamoDbGetEncryptedDataKeyDescriptionTest { expect actualDataKeyDescription.Extract().EncryptedDataKeyDescriptionOutput[0].keyProviderInfo.Some?; expect actualDataKeyDescription.Extract().EncryptedDataKeyDescriptionOutput[0].keyProviderInfo.Extract() == UTF8.Decode(expectedHead.dataKeys[0].keyProviderInfo).Extract(); } + + method getBranchKeyVersion (expectedHead : PartialHeader) + returns (expectedBranchKeyVersion : string) + { + expect EdkWrapping.GetProviderWrappedMaterial(expectedHead.dataKeys[0].ciphertext, algorithmSuite).Success?; + var providerWrappedMaterial := EdkWrapping.GetProviderWrappedMaterial(expectedHead.dataKeys[0].ciphertext, algorithmSuite).Extract(); + + expect |providerWrappedMaterial| >= (28 + 16); + + var expectedBranchKeyVersionResult := UUID.FromByteArray(providerWrappedMaterial[28 .. (28 + 16)]); + + expect expectedBranchKeyVersionResult.Success?; + + expectedBranchKeyVersion := expectedBranchKeyVersionResult.Extract(); + } } From ee7ba8d1cb0d84aeefede339ed9bb68c7f5ce470 Mon Sep 17 00:00:00 2001 From: rishav-karanjit Date: Wed, 27 Mar 2024 09:50:38 -0700 Subject: [PATCH 17/67] Add polymorph generated code --- .../DynamoDbEncryption/DynamoDbEncryption.cs | 7 + .../EncryptedDataKeyDescriptionOutput.cs | 56 ++++++ .../GetEncryptedDataKeyDescriptionInput.cs | 26 +++ .../GetEncryptedDataKeyDescriptionOutput.cs | 26 +++ .../GetEncryptedDataKeyDescriptionUnion.cs | 40 ++++ .../DynamoDbEncryption/TypeConversion.cs | 189 +++++++++++++++++- .../TypeConversion.cs | 20 +- .../DynamoDbItemEncryptor/TypeConversion.cs | 16 +- 8 files changed, 354 insertions(+), 26 deletions(-) create mode 100644 DynamoDbEncryption/runtimes/net/Generated/DynamoDbEncryption/EncryptedDataKeyDescriptionOutput.cs create mode 100644 DynamoDbEncryption/runtimes/net/Generated/DynamoDbEncryption/GetEncryptedDataKeyDescriptionInput.cs create mode 100644 DynamoDbEncryption/runtimes/net/Generated/DynamoDbEncryption/GetEncryptedDataKeyDescriptionOutput.cs create mode 100644 DynamoDbEncryption/runtimes/net/Generated/DynamoDbEncryption/GetEncryptedDataKeyDescriptionUnion.cs diff --git a/DynamoDbEncryption/runtimes/net/Generated/DynamoDbEncryption/DynamoDbEncryption.cs b/DynamoDbEncryption/runtimes/net/Generated/DynamoDbEncryption/DynamoDbEncryption.cs index e20ef0ee3..99cfc88b5 100644 --- a/DynamoDbEncryption/runtimes/net/Generated/DynamoDbEncryption/DynamoDbEncryption.cs +++ b/DynamoDbEncryption/runtimes/net/Generated/DynamoDbEncryption/DynamoDbEncryption.cs @@ -33,5 +33,12 @@ public AWS.Cryptography.DbEncryptionSDK.DynamoDb.CreateDynamoDbEncryptionBranchK if (result.is_Failure) throw TypeConversion.FromDafny_CommonError(result.dtor_error); return TypeConversion.FromDafny_N3_aws__N12_cryptography__N15_dbEncryptionSdk__N8_dynamoDb__S49_CreateDynamoDbEncryptionBranchKeyIdSupplierOutput(result.dtor_value); } + public AWS.Cryptography.DbEncryptionSDK.DynamoDb.GetEncryptedDataKeyDescriptionOutput GetEncryptedDataKeyDescription(AWS.Cryptography.DbEncryptionSDK.DynamoDb.GetEncryptedDataKeyDescriptionInput input) + { + software.amazon.cryptography.dbencryptionsdk.dynamodb.internaldafny.types._IGetEncryptedDataKeyDescriptionInput internalInput = TypeConversion.ToDafny_N3_aws__N12_cryptography__N15_dbEncryptionSdk__N8_dynamoDb__S35_GetEncryptedDataKeyDescriptionInput(input); + Wrappers_Compile._IResult result = _impl.GetEncryptedDataKeyDescription(internalInput); + if (result.is_Failure) throw TypeConversion.FromDafny_CommonError(result.dtor_error); + return TypeConversion.FromDafny_N3_aws__N12_cryptography__N15_dbEncryptionSdk__N8_dynamoDb__S36_GetEncryptedDataKeyDescriptionOutput(result.dtor_value); + } } } diff --git a/DynamoDbEncryption/runtimes/net/Generated/DynamoDbEncryption/EncryptedDataKeyDescriptionOutput.cs b/DynamoDbEncryption/runtimes/net/Generated/DynamoDbEncryption/EncryptedDataKeyDescriptionOutput.cs new file mode 100644 index 000000000..b7b9d3897 --- /dev/null +++ b/DynamoDbEncryption/runtimes/net/Generated/DynamoDbEncryption/EncryptedDataKeyDescriptionOutput.cs @@ -0,0 +1,56 @@ +// Copyright Amazon.com Inc. or its affiliates. All Rights Reserved. +// SPDX-License-Identifier: Apache-2.0 +// Do not modify this file. This file is machine generated, and any changes to it will be overwritten. +using System; +using AWS.Cryptography.DbEncryptionSDK.DynamoDb; +namespace AWS.Cryptography.DbEncryptionSDK.DynamoDb +{ + public class EncryptedDataKeyDescriptionOutput + { + private string _keyProviderId; + private string _keyProviderInfo; + private string _branchKeyId; + private string _branchKeyVersion; + public string KeyProviderId + { + get { return this._keyProviderId; } + set { this._keyProviderId = value; } + } + public bool IsSetKeyProviderId() + { + return this._keyProviderId != null; + } + public string KeyProviderInfo + { + get { return this._keyProviderInfo; } + set { this._keyProviderInfo = value; } + } + public bool IsSetKeyProviderInfo() + { + return this._keyProviderInfo != null; + } + public string BranchKeyId + { + get { return this._branchKeyId; } + set { this._branchKeyId = value; } + } + public bool IsSetBranchKeyId() + { + return this._branchKeyId != null; + } + public string BranchKeyVersion + { + get { return this._branchKeyVersion; } + set { this._branchKeyVersion = value; } + } + public bool IsSetBranchKeyVersion() + { + return this._branchKeyVersion != null; + } + public void Validate() + { + if (!IsSetKeyProviderId()) throw new System.ArgumentException("Missing value for required property 'KeyProviderId'"); + + } + } +} diff --git a/DynamoDbEncryption/runtimes/net/Generated/DynamoDbEncryption/GetEncryptedDataKeyDescriptionInput.cs b/DynamoDbEncryption/runtimes/net/Generated/DynamoDbEncryption/GetEncryptedDataKeyDescriptionInput.cs new file mode 100644 index 000000000..9517b6dc0 --- /dev/null +++ b/DynamoDbEncryption/runtimes/net/Generated/DynamoDbEncryption/GetEncryptedDataKeyDescriptionInput.cs @@ -0,0 +1,26 @@ +// Copyright Amazon.com Inc. or its affiliates. All Rights Reserved. +// SPDX-License-Identifier: Apache-2.0 +// Do not modify this file. This file is machine generated, and any changes to it will be overwritten. +using System; +using AWS.Cryptography.DbEncryptionSDK.DynamoDb; +namespace AWS.Cryptography.DbEncryptionSDK.DynamoDb +{ + public class GetEncryptedDataKeyDescriptionInput + { + private AWS.Cryptography.DbEncryptionSDK.DynamoDb.GetEncryptedDataKeyDescriptionUnion _input; + public AWS.Cryptography.DbEncryptionSDK.DynamoDb.GetEncryptedDataKeyDescriptionUnion Input + { + get { return this._input; } + set { this._input = value; } + } + public bool IsSetInput() + { + return this._input != null; + } + public void Validate() + { + if (!IsSetInput()) throw new System.ArgumentException("Missing value for required property 'Input'"); + + } + } +} diff --git a/DynamoDbEncryption/runtimes/net/Generated/DynamoDbEncryption/GetEncryptedDataKeyDescriptionOutput.cs b/DynamoDbEncryption/runtimes/net/Generated/DynamoDbEncryption/GetEncryptedDataKeyDescriptionOutput.cs new file mode 100644 index 000000000..1f75f9ab9 --- /dev/null +++ b/DynamoDbEncryption/runtimes/net/Generated/DynamoDbEncryption/GetEncryptedDataKeyDescriptionOutput.cs @@ -0,0 +1,26 @@ +// Copyright Amazon.com Inc. or its affiliates. All Rights Reserved. +// SPDX-License-Identifier: Apache-2.0 +// Do not modify this file. This file is machine generated, and any changes to it will be overwritten. +using System; +using AWS.Cryptography.DbEncryptionSDK.DynamoDb; +namespace AWS.Cryptography.DbEncryptionSDK.DynamoDb +{ + public class GetEncryptedDataKeyDescriptionOutput + { + private System.Collections.Generic.List _encryptedDataKeyDescriptionOutput; + public System.Collections.Generic.List EncryptedDataKeyDescriptionOutput + { + get { return this._encryptedDataKeyDescriptionOutput; } + set { this._encryptedDataKeyDescriptionOutput = value; } + } + public bool IsSetEncryptedDataKeyDescriptionOutput() + { + return this._encryptedDataKeyDescriptionOutput != null; + } + public void Validate() + { + if (!IsSetEncryptedDataKeyDescriptionOutput()) throw new System.ArgumentException("Missing value for required property 'EncryptedDataKeyDescriptionOutput'"); + + } + } +} diff --git a/DynamoDbEncryption/runtimes/net/Generated/DynamoDbEncryption/GetEncryptedDataKeyDescriptionUnion.cs b/DynamoDbEncryption/runtimes/net/Generated/DynamoDbEncryption/GetEncryptedDataKeyDescriptionUnion.cs new file mode 100644 index 000000000..ab55a2bdb --- /dev/null +++ b/DynamoDbEncryption/runtimes/net/Generated/DynamoDbEncryption/GetEncryptedDataKeyDescriptionUnion.cs @@ -0,0 +1,40 @@ +// Copyright Amazon.com Inc. or its affiliates. All Rights Reserved. +// SPDX-License-Identifier: Apache-2.0 +// Do not modify this file. This file is machine generated, and any changes to it will be overwritten. +using System; +using AWS.Cryptography.DbEncryptionSDK.DynamoDb; +namespace AWS.Cryptography.DbEncryptionSDK.DynamoDb +{ + public class GetEncryptedDataKeyDescriptionUnion + { + private System.IO.MemoryStream _header; + private System.Collections.Generic.Dictionary _plaintextItem; + public System.IO.MemoryStream Header + { + get { return this._header; } + set { this._header = value; } + } + public bool IsSetHeader() + { + return this._header != null; + } + public System.Collections.Generic.Dictionary PlaintextItem + { + get { return this._plaintextItem; } + set { this._plaintextItem = value; } + } + public bool IsSetPlaintextItem() + { + return this._plaintextItem != null; + } + public void Validate() + { + var numberOfPropertiesSet = Convert.ToUInt16(IsSetHeader()) + + Convert.ToUInt16(IsSetPlaintextItem()); + if (numberOfPropertiesSet == 0) throw new System.ArgumentException("No union value set"); + + if (numberOfPropertiesSet > 1) throw new System.ArgumentException("Multiple union values set"); + + } + } +} diff --git a/DynamoDbEncryption/runtimes/net/Generated/DynamoDbEncryption/TypeConversion.cs b/DynamoDbEncryption/runtimes/net/Generated/DynamoDbEncryption/TypeConversion.cs index 439bc499c..51a528a1f 100644 --- a/DynamoDbEncryption/runtimes/net/Generated/DynamoDbEncryption/TypeConversion.cs +++ b/DynamoDbEncryption/runtimes/net/Generated/DynamoDbEncryption/TypeConversion.cs @@ -174,6 +174,51 @@ public static software.amazon.cryptography.dbencryptionsdk.dynamodb.internaldafn return new software.amazon.cryptography.dbencryptionsdk.dynamodb.internaldafny.types.GetBranchKeyIdFromDdbKeyOutput(ToDafny_N3_aws__N12_cryptography__N15_dbEncryptionSdk__N8_dynamoDb__S30_GetBranchKeyIdFromDdbKeyOutput__M11_branchKeyId(value.BranchKeyId)); } + public static AWS.Cryptography.DbEncryptionSDK.DynamoDb.GetEncryptedDataKeyDescriptionInput FromDafny_N3_aws__N12_cryptography__N15_dbEncryptionSdk__N8_dynamoDb__S35_GetEncryptedDataKeyDescriptionInput(software.amazon.cryptography.dbencryptionsdk.dynamodb.internaldafny.types._IGetEncryptedDataKeyDescriptionInput value) + { + software.amazon.cryptography.dbencryptionsdk.dynamodb.internaldafny.types.GetEncryptedDataKeyDescriptionInput concrete = (software.amazon.cryptography.dbencryptionsdk.dynamodb.internaldafny.types.GetEncryptedDataKeyDescriptionInput)value; AWS.Cryptography.DbEncryptionSDK.DynamoDb.GetEncryptedDataKeyDescriptionInput converted = new AWS.Cryptography.DbEncryptionSDK.DynamoDb.GetEncryptedDataKeyDescriptionInput(); converted.Input = (AWS.Cryptography.DbEncryptionSDK.DynamoDb.GetEncryptedDataKeyDescriptionUnion)FromDafny_N3_aws__N12_cryptography__N15_dbEncryptionSdk__N8_dynamoDb__S35_GetEncryptedDataKeyDescriptionInput__M5_input(concrete._input); return converted; + } + public static software.amazon.cryptography.dbencryptionsdk.dynamodb.internaldafny.types._IGetEncryptedDataKeyDescriptionInput ToDafny_N3_aws__N12_cryptography__N15_dbEncryptionSdk__N8_dynamoDb__S35_GetEncryptedDataKeyDescriptionInput(AWS.Cryptography.DbEncryptionSDK.DynamoDb.GetEncryptedDataKeyDescriptionInput value) + { + + return new software.amazon.cryptography.dbencryptionsdk.dynamodb.internaldafny.types.GetEncryptedDataKeyDescriptionInput(ToDafny_N3_aws__N12_cryptography__N15_dbEncryptionSdk__N8_dynamoDb__S35_GetEncryptedDataKeyDescriptionInput__M5_input(value.Input)); + } + public static AWS.Cryptography.DbEncryptionSDK.DynamoDb.GetEncryptedDataKeyDescriptionOutput FromDafny_N3_aws__N12_cryptography__N15_dbEncryptionSdk__N8_dynamoDb__S36_GetEncryptedDataKeyDescriptionOutput(software.amazon.cryptography.dbencryptionsdk.dynamodb.internaldafny.types._IGetEncryptedDataKeyDescriptionOutput value) + { + software.amazon.cryptography.dbencryptionsdk.dynamodb.internaldafny.types.GetEncryptedDataKeyDescriptionOutput concrete = (software.amazon.cryptography.dbencryptionsdk.dynamodb.internaldafny.types.GetEncryptedDataKeyDescriptionOutput)value; AWS.Cryptography.DbEncryptionSDK.DynamoDb.GetEncryptedDataKeyDescriptionOutput converted = new AWS.Cryptography.DbEncryptionSDK.DynamoDb.GetEncryptedDataKeyDescriptionOutput(); converted.EncryptedDataKeyDescriptionOutput = (System.Collections.Generic.List)FromDafny_N3_aws__N12_cryptography__N15_dbEncryptionSdk__N8_dynamoDb__S36_GetEncryptedDataKeyDescriptionOutput__M33_EncryptedDataKeyDescriptionOutput(concrete._EncryptedDataKeyDescriptionOutput); return converted; + } + public static software.amazon.cryptography.dbencryptionsdk.dynamodb.internaldafny.types._IGetEncryptedDataKeyDescriptionOutput ToDafny_N3_aws__N12_cryptography__N15_dbEncryptionSdk__N8_dynamoDb__S36_GetEncryptedDataKeyDescriptionOutput(AWS.Cryptography.DbEncryptionSDK.DynamoDb.GetEncryptedDataKeyDescriptionOutput value) + { + + return new software.amazon.cryptography.dbencryptionsdk.dynamodb.internaldafny.types.GetEncryptedDataKeyDescriptionOutput(ToDafny_N3_aws__N12_cryptography__N15_dbEncryptionSdk__N8_dynamoDb__S36_GetEncryptedDataKeyDescriptionOutput__M33_EncryptedDataKeyDescriptionOutput(value.EncryptedDataKeyDescriptionOutput)); + } + public static AWS.Cryptography.DbEncryptionSDK.DynamoDb.GetEncryptedDataKeyDescriptionUnion FromDafny_N3_aws__N12_cryptography__N15_dbEncryptionSdk__N8_dynamoDb__S35_GetEncryptedDataKeyDescriptionUnion(software.amazon.cryptography.dbencryptionsdk.dynamodb.internaldafny.types._IGetEncryptedDataKeyDescriptionUnion value) + { + software.amazon.cryptography.dbencryptionsdk.dynamodb.internaldafny.types.GetEncryptedDataKeyDescriptionUnion concrete = (software.amazon.cryptography.dbencryptionsdk.dynamodb.internaldafny.types.GetEncryptedDataKeyDescriptionUnion)value; + var converted = new AWS.Cryptography.DbEncryptionSDK.DynamoDb.GetEncryptedDataKeyDescriptionUnion(); if (value.is_header) + { + converted.Header = FromDafny_N3_aws__N12_cryptography__N15_dbEncryptionSdk__N8_dynamoDb__S35_GetEncryptedDataKeyDescriptionUnion__M6_header(concrete.dtor_header); + return converted; + } + if (value.is_plaintextItem) + { + converted.PlaintextItem = FromDafny_N3_aws__N12_cryptography__N15_dbEncryptionSdk__N8_dynamoDb__S35_GetEncryptedDataKeyDescriptionUnion__M13_plaintextItem(concrete.dtor_plaintextItem); + return converted; + } + throw new System.ArgumentException("Invalid AWS.Cryptography.DbEncryptionSDK.DynamoDb.GetEncryptedDataKeyDescriptionUnion state"); + } + public static software.amazon.cryptography.dbencryptionsdk.dynamodb.internaldafny.types._IGetEncryptedDataKeyDescriptionUnion ToDafny_N3_aws__N12_cryptography__N15_dbEncryptionSdk__N8_dynamoDb__S35_GetEncryptedDataKeyDescriptionUnion(AWS.Cryptography.DbEncryptionSDK.DynamoDb.GetEncryptedDataKeyDescriptionUnion value) + { + if (value.IsSetHeader()) + { + return software.amazon.cryptography.dbencryptionsdk.dynamodb.internaldafny.types.GetEncryptedDataKeyDescriptionUnion.create_header(ToDafny_N3_aws__N12_cryptography__N15_dbEncryptionSdk__N8_dynamoDb__S35_GetEncryptedDataKeyDescriptionUnion__M6_header(value.Header)); + } + if (value.IsSetPlaintextItem()) + { + return software.amazon.cryptography.dbencryptionsdk.dynamodb.internaldafny.types.GetEncryptedDataKeyDescriptionUnion.create_plaintextItem(ToDafny_N3_aws__N12_cryptography__N15_dbEncryptionSdk__N8_dynamoDb__S35_GetEncryptedDataKeyDescriptionUnion__M13_plaintextItem(value.PlaintextItem)); + } + throw new System.ArgumentException("Invalid AWS.Cryptography.DbEncryptionSDK.DynamoDb.GetEncryptedDataKeyDescriptionUnion state"); + } public static AWS.Cryptography.DbEncryptionSDK.DynamoDb.LegacyPolicy FromDafny_N3_aws__N12_cryptography__N15_dbEncryptionSdk__N8_dynamoDb__S12_LegacyPolicy(software.amazon.cryptography.dbencryptionsdk.dynamodb.internaldafny.types._ILegacyPolicy value) { if (value.is_FORCE__LEGACY__ENCRYPT__ALLOW__LEGACY__DECRYPT) return AWS.Cryptography.DbEncryptionSDK.DynamoDb.LegacyPolicy.FORCE_LEGACY_ENCRYPT_ALLOW_LEGACY_DECRYPT; @@ -371,6 +416,38 @@ public static Dafny.ISequence ToDafny_N3_aws__N12_cryptography__N15_dbEncr { return ToDafny_N6_smithy__N3_api__S6_String(value); } + public static AWS.Cryptography.DbEncryptionSDK.DynamoDb.GetEncryptedDataKeyDescriptionUnion FromDafny_N3_aws__N12_cryptography__N15_dbEncryptionSdk__N8_dynamoDb__S35_GetEncryptedDataKeyDescriptionInput__M5_input(software.amazon.cryptography.dbencryptionsdk.dynamodb.internaldafny.types._IGetEncryptedDataKeyDescriptionUnion value) + { + return FromDafny_N3_aws__N12_cryptography__N15_dbEncryptionSdk__N8_dynamoDb__S35_GetEncryptedDataKeyDescriptionUnion(value); + } + public static software.amazon.cryptography.dbencryptionsdk.dynamodb.internaldafny.types._IGetEncryptedDataKeyDescriptionUnion ToDafny_N3_aws__N12_cryptography__N15_dbEncryptionSdk__N8_dynamoDb__S35_GetEncryptedDataKeyDescriptionInput__M5_input(AWS.Cryptography.DbEncryptionSDK.DynamoDb.GetEncryptedDataKeyDescriptionUnion value) + { + return ToDafny_N3_aws__N12_cryptography__N15_dbEncryptionSdk__N8_dynamoDb__S35_GetEncryptedDataKeyDescriptionUnion(value); + } + public static System.Collections.Generic.List FromDafny_N3_aws__N12_cryptography__N15_dbEncryptionSdk__N8_dynamoDb__S36_GetEncryptedDataKeyDescriptionOutput__M33_EncryptedDataKeyDescriptionOutput(Dafny.ISequence value) + { + return FromDafny_N3_aws__N12_cryptography__N15_dbEncryptionSdk__N8_dynamoDb__S31_EncryptedDataKeyDescriptionList(value); + } + public static Dafny.ISequence ToDafny_N3_aws__N12_cryptography__N15_dbEncryptionSdk__N8_dynamoDb__S36_GetEncryptedDataKeyDescriptionOutput__M33_EncryptedDataKeyDescriptionOutput(System.Collections.Generic.List value) + { + return ToDafny_N3_aws__N12_cryptography__N15_dbEncryptionSdk__N8_dynamoDb__S31_EncryptedDataKeyDescriptionList(value); + } + public static System.IO.MemoryStream FromDafny_N3_aws__N12_cryptography__N15_dbEncryptionSdk__N8_dynamoDb__S35_GetEncryptedDataKeyDescriptionUnion__M6_header(Dafny.ISequence value) + { + return FromDafny_N6_smithy__N3_api__S4_Blob(value); + } + public static Dafny.ISequence ToDafny_N3_aws__N12_cryptography__N15_dbEncryptionSdk__N8_dynamoDb__S35_GetEncryptedDataKeyDescriptionUnion__M6_header(System.IO.MemoryStream value) + { + return ToDafny_N6_smithy__N3_api__S4_Blob(value); + } + public static System.Collections.Generic.Dictionary FromDafny_N3_aws__N12_cryptography__N15_dbEncryptionSdk__N8_dynamoDb__S35_GetEncryptedDataKeyDescriptionUnion__M13_plaintextItem(Dafny.IMap, software.amazon.cryptography.services.dynamodb.internaldafny.types._IAttributeValue> value) + { + return FromDafny_N3_com__N9_amazonaws__N8_dynamodb__S12_AttributeMap(value); + } + public static Dafny.IMap, software.amazon.cryptography.services.dynamodb.internaldafny.types._IAttributeValue> ToDafny_N3_aws__N12_cryptography__N15_dbEncryptionSdk__N8_dynamoDb__S35_GetEncryptedDataKeyDescriptionUnion__M13_plaintextItem(System.Collections.Generic.Dictionary value) + { + return ToDafny_N3_com__N9_amazonaws__N8_dynamodb__S12_AttributeMap(value); + } public static AWS.Cryptography.DbEncryptionSDK.DynamoDb.Upper FromDafny_N3_aws__N12_cryptography__N15_dbEncryptionSdk__N8_dynamoDb__S16_VirtualTransform__M5_upper(software.amazon.cryptography.dbencryptionsdk.dynamodb.internaldafny.types._IUpper value) { return FromDafny_N3_aws__N12_cryptography__N15_dbEncryptionSdk__N8_dynamoDb__S5_Upper(value); @@ -541,6 +618,32 @@ public static Dafny.ISequence ToDafny_N6_smithy__N3_api__S6_String(string new Dafny.Pair, software.amazon.cryptography.services.dynamodb.internaldafny.types._IAttributeValue>(ToDafny_N3_com__N9_amazonaws__N8_dynamodb__S3_Key__M3_key(pair.Key), ToDafny_N3_com__N9_amazonaws__N8_dynamodb__S3_Key__M5_value(pair.Value)) )); } + public static System.Collections.Generic.List FromDafny_N3_aws__N12_cryptography__N15_dbEncryptionSdk__N8_dynamoDb__S31_EncryptedDataKeyDescriptionList(Dafny.ISequence value) + { + return new System.Collections.Generic.List(value.Elements.Select(FromDafny_N3_aws__N12_cryptography__N15_dbEncryptionSdk__N8_dynamoDb__S31_EncryptedDataKeyDescriptionList__M6_member)); + } + public static Dafny.ISequence ToDafny_N3_aws__N12_cryptography__N15_dbEncryptionSdk__N8_dynamoDb__S31_EncryptedDataKeyDescriptionList(System.Collections.Generic.List value) + { + return Dafny.Sequence.FromArray(value.Select(ToDafny_N3_aws__N12_cryptography__N15_dbEncryptionSdk__N8_dynamoDb__S31_EncryptedDataKeyDescriptionList__M6_member).ToArray()); + } + public static System.IO.MemoryStream FromDafny_N6_smithy__N3_api__S4_Blob(Dafny.ISequence value) + { + return new System.IO.MemoryStream(value.Elements); + } + public static Dafny.ISequence ToDafny_N6_smithy__N3_api__S4_Blob(System.IO.MemoryStream value) + { + return Dafny.Sequence.FromArray(value.ToArray()); + } + public static System.Collections.Generic.Dictionary FromDafny_N3_com__N9_amazonaws__N8_dynamodb__S12_AttributeMap(Dafny.IMap, software.amazon.cryptography.services.dynamodb.internaldafny.types._IAttributeValue> value) + { + return value.ItemEnumerable.ToDictionary(pair => FromDafny_N3_com__N9_amazonaws__N8_dynamodb__S12_AttributeMap__M3_key(pair.Car), pair => FromDafny_N3_com__N9_amazonaws__N8_dynamodb__S12_AttributeMap__M5_value(pair.Cdr)); + } + public static Dafny.IMap, software.amazon.cryptography.services.dynamodb.internaldafny.types._IAttributeValue> ToDafny_N3_com__N9_amazonaws__N8_dynamodb__S12_AttributeMap(System.Collections.Generic.Dictionary value) + { + return Dafny.Map, software.amazon.cryptography.services.dynamodb.internaldafny.types._IAttributeValue>.FromCollection(value.Select(pair => + new Dafny.Pair, software.amazon.cryptography.services.dynamodb.internaldafny.types._IAttributeValue>(ToDafny_N3_com__N9_amazonaws__N8_dynamodb__S12_AttributeMap__M3_key(pair.Key), ToDafny_N3_com__N9_amazonaws__N8_dynamodb__S12_AttributeMap__M5_value(pair.Value)) + )); + } public static AWS.Cryptography.DbEncryptionSDK.DynamoDb.Upper FromDafny_N3_aws__N12_cryptography__N15_dbEncryptionSdk__N8_dynamoDb__S5_Upper(software.amazon.cryptography.dbencryptionsdk.dynamodb.internaldafny.types._IUpper value) { software.amazon.cryptography.dbencryptionsdk.dynamodb.internaldafny.types.Upper concrete = (software.amazon.cryptography.dbencryptionsdk.dynamodb.internaldafny.types.Upper)value; AWS.Cryptography.DbEncryptionSDK.DynamoDb.Upper converted = new AWS.Cryptography.DbEncryptionSDK.DynamoDb.Upper(); return converted; @@ -689,6 +792,30 @@ public static software.amazon.cryptography.services.dynamodb.internaldafny.types { return ToDafny_N3_com__N9_amazonaws__N8_dynamodb__S14_AttributeValue(value); } + public static AWS.Cryptography.DbEncryptionSDK.DynamoDb.EncryptedDataKeyDescriptionOutput FromDafny_N3_aws__N12_cryptography__N15_dbEncryptionSdk__N8_dynamoDb__S31_EncryptedDataKeyDescriptionList__M6_member(software.amazon.cryptography.dbencryptionsdk.dynamodb.internaldafny.types._IEncryptedDataKeyDescriptionOutput value) + { + return FromDafny_N3_aws__N12_cryptography__N15_dbEncryptionSdk__N8_dynamoDb__S33_EncryptedDataKeyDescriptionOutput(value); + } + public static software.amazon.cryptography.dbencryptionsdk.dynamodb.internaldafny.types._IEncryptedDataKeyDescriptionOutput ToDafny_N3_aws__N12_cryptography__N15_dbEncryptionSdk__N8_dynamoDb__S31_EncryptedDataKeyDescriptionList__M6_member(AWS.Cryptography.DbEncryptionSDK.DynamoDb.EncryptedDataKeyDescriptionOutput value) + { + return ToDafny_N3_aws__N12_cryptography__N15_dbEncryptionSdk__N8_dynamoDb__S33_EncryptedDataKeyDescriptionOutput(value); + } + public static string FromDafny_N3_com__N9_amazonaws__N8_dynamodb__S12_AttributeMap__M3_key(Dafny.ISequence value) + { + return FromDafny_N3_com__N9_amazonaws__N8_dynamodb__S13_AttributeName(value); + } + public static Dafny.ISequence ToDafny_N3_com__N9_amazonaws__N8_dynamodb__S12_AttributeMap__M3_key(string value) + { + return ToDafny_N3_com__N9_amazonaws__N8_dynamodb__S13_AttributeName(value); + } + public static Amazon.DynamoDBv2.Model.AttributeValue FromDafny_N3_com__N9_amazonaws__N8_dynamodb__S12_AttributeMap__M5_value(software.amazon.cryptography.services.dynamodb.internaldafny.types._IAttributeValue value) + { + return FromDafny_N3_com__N9_amazonaws__N8_dynamodb__S14_AttributeValue(value); + } + public static software.amazon.cryptography.services.dynamodb.internaldafny.types._IAttributeValue ToDafny_N3_com__N9_amazonaws__N8_dynamodb__S12_AttributeMap__M5_value(Amazon.DynamoDBv2.Model.AttributeValue value) + { + return ToDafny_N3_com__N9_amazonaws__N8_dynamodb__S14_AttributeValue(value); + } public static string FromDafny_N3_aws__N12_cryptography__N15_dbEncryptionSdk__N8_dynamoDb__S6_Insert__M7_literal(Dafny.ISequence value) { return FromDafny_N6_smithy__N3_api__S6_String(value); @@ -938,6 +1065,20 @@ public static software.amazon.cryptography.services.dynamodb.internaldafny.types } throw new System.ArgumentException("Invalid Amazon.DynamoDBv2.Model.AttributeValue state"); } + public static AWS.Cryptography.DbEncryptionSDK.DynamoDb.EncryptedDataKeyDescriptionOutput FromDafny_N3_aws__N12_cryptography__N15_dbEncryptionSdk__N8_dynamoDb__S33_EncryptedDataKeyDescriptionOutput(software.amazon.cryptography.dbencryptionsdk.dynamodb.internaldafny.types._IEncryptedDataKeyDescriptionOutput value) + { + software.amazon.cryptography.dbencryptionsdk.dynamodb.internaldafny.types.EncryptedDataKeyDescriptionOutput concrete = (software.amazon.cryptography.dbencryptionsdk.dynamodb.internaldafny.types.EncryptedDataKeyDescriptionOutput)value; AWS.Cryptography.DbEncryptionSDK.DynamoDb.EncryptedDataKeyDescriptionOutput converted = new AWS.Cryptography.DbEncryptionSDK.DynamoDb.EncryptedDataKeyDescriptionOutput(); converted.KeyProviderId = (string)FromDafny_N3_aws__N12_cryptography__N15_dbEncryptionSdk__N8_dynamoDb__S33_EncryptedDataKeyDescriptionOutput__M13_keyProviderId(concrete._keyProviderId); + if (concrete._keyProviderInfo.is_Some) converted.KeyProviderInfo = (string)FromDafny_N3_aws__N12_cryptography__N15_dbEncryptionSdk__N8_dynamoDb__S33_EncryptedDataKeyDescriptionOutput__M15_keyProviderInfo(concrete._keyProviderInfo); + if (concrete._branchKeyId.is_Some) converted.BranchKeyId = (string)FromDafny_N3_aws__N12_cryptography__N15_dbEncryptionSdk__N8_dynamoDb__S33_EncryptedDataKeyDescriptionOutput__M11_branchKeyId(concrete._branchKeyId); + if (concrete._branchKeyVersion.is_Some) converted.BranchKeyVersion = (string)FromDafny_N3_aws__N12_cryptography__N15_dbEncryptionSdk__N8_dynamoDb__S33_EncryptedDataKeyDescriptionOutput__M16_branchKeyVersion(concrete._branchKeyVersion); return converted; + } + public static software.amazon.cryptography.dbencryptionsdk.dynamodb.internaldafny.types._IEncryptedDataKeyDescriptionOutput ToDafny_N3_aws__N12_cryptography__N15_dbEncryptionSdk__N8_dynamoDb__S33_EncryptedDataKeyDescriptionOutput(AWS.Cryptography.DbEncryptionSDK.DynamoDb.EncryptedDataKeyDescriptionOutput value) + { + string var_keyProviderInfo = value.IsSetKeyProviderInfo() ? value.KeyProviderInfo : (string)null; + string var_branchKeyId = value.IsSetBranchKeyId() ? value.BranchKeyId : (string)null; + string var_branchKeyVersion = value.IsSetBranchKeyVersion() ? value.BranchKeyVersion : (string)null; + return new software.amazon.cryptography.dbencryptionsdk.dynamodb.internaldafny.types.EncryptedDataKeyDescriptionOutput(ToDafny_N3_aws__N12_cryptography__N15_dbEncryptionSdk__N8_dynamoDb__S33_EncryptedDataKeyDescriptionOutput__M13_keyProviderId(value.KeyProviderId), ToDafny_N3_aws__N12_cryptography__N15_dbEncryptionSdk__N8_dynamoDb__S33_EncryptedDataKeyDescriptionOutput__M15_keyProviderInfo(var_keyProviderInfo), ToDafny_N3_aws__N12_cryptography__N15_dbEncryptionSdk__N8_dynamoDb__S33_EncryptedDataKeyDescriptionOutput__M11_branchKeyId(var_branchKeyId), ToDafny_N3_aws__N12_cryptography__N15_dbEncryptionSdk__N8_dynamoDb__S33_EncryptedDataKeyDescriptionOutput__M16_branchKeyVersion(var_branchKeyVersion)); + } public static string FromDafny_N3_aws__N12_cryptography__N15_dbEncryptionSdk__N8_dynamoDb__S4_Char(Dafny.ISequence value) { return new string(value.Elements); @@ -1066,6 +1207,38 @@ public static bool ToDafny_N3_com__N9_amazonaws__N8_dynamodb__S14_AttributeValue { return ToDafny_N3_com__N9_amazonaws__N8_dynamodb__S21_BooleanAttributeValue(value); } + public static string FromDafny_N3_aws__N12_cryptography__N15_dbEncryptionSdk__N8_dynamoDb__S33_EncryptedDataKeyDescriptionOutput__M13_keyProviderId(Dafny.ISequence value) + { + return FromDafny_N6_smithy__N3_api__S6_String(value); + } + public static Dafny.ISequence ToDafny_N3_aws__N12_cryptography__N15_dbEncryptionSdk__N8_dynamoDb__S33_EncryptedDataKeyDescriptionOutput__M13_keyProviderId(string value) + { + return ToDafny_N6_smithy__N3_api__S6_String(value); + } + public static string FromDafny_N3_aws__N12_cryptography__N15_dbEncryptionSdk__N8_dynamoDb__S33_EncryptedDataKeyDescriptionOutput__M15_keyProviderInfo(Wrappers_Compile._IOption> value) + { + return value.is_None ? (string)null : FromDafny_N6_smithy__N3_api__S6_String(value.Extract()); + } + public static Wrappers_Compile._IOption> ToDafny_N3_aws__N12_cryptography__N15_dbEncryptionSdk__N8_dynamoDb__S33_EncryptedDataKeyDescriptionOutput__M15_keyProviderInfo(string value) + { + return value == null ? Wrappers_Compile.Option>.create_None() : Wrappers_Compile.Option>.create_Some(ToDafny_N6_smithy__N3_api__S6_String((string)value)); + } + public static string FromDafny_N3_aws__N12_cryptography__N15_dbEncryptionSdk__N8_dynamoDb__S33_EncryptedDataKeyDescriptionOutput__M11_branchKeyId(Wrappers_Compile._IOption> value) + { + return value.is_None ? (string)null : FromDafny_N6_smithy__N3_api__S6_String(value.Extract()); + } + public static Wrappers_Compile._IOption> ToDafny_N3_aws__N12_cryptography__N15_dbEncryptionSdk__N8_dynamoDb__S33_EncryptedDataKeyDescriptionOutput__M11_branchKeyId(string value) + { + return value == null ? Wrappers_Compile.Option>.create_None() : Wrappers_Compile.Option>.create_Some(ToDafny_N6_smithy__N3_api__S6_String((string)value)); + } + public static string FromDafny_N3_aws__N12_cryptography__N15_dbEncryptionSdk__N8_dynamoDb__S33_EncryptedDataKeyDescriptionOutput__M16_branchKeyVersion(Wrappers_Compile._IOption> value) + { + return value.is_None ? (string)null : FromDafny_N6_smithy__N3_api__S6_String(value.Extract()); + } + public static Wrappers_Compile._IOption> ToDafny_N3_aws__N12_cryptography__N15_dbEncryptionSdk__N8_dynamoDb__S33_EncryptedDataKeyDescriptionOutput__M16_branchKeyVersion(string value) + { + return value == null ? Wrappers_Compile.Option>.create_None() : Wrappers_Compile.Option>.create_Some(ToDafny_N6_smithy__N3_api__S6_String((string)value)); + } public static AWS.Cryptography.MaterialProviders.DefaultCache FromDafny_N3_aws__N12_cryptography__N17_materialProviders__S12_DefaultCache(software.amazon.cryptography.materialproviders.internaldafny.types._IDefaultCache value) { software.amazon.cryptography.materialproviders.internaldafny.types.DefaultCache concrete = (software.amazon.cryptography.materialproviders.internaldafny.types.DefaultCache)value; AWS.Cryptography.MaterialProviders.DefaultCache converted = new AWS.Cryptography.MaterialProviders.DefaultCache(); converted.EntryCapacity = (int)FromDafny_N3_aws__N12_cryptography__N17_materialProviders__S12_DefaultCache__M13_entryCapacity(concrete._entryCapacity); return converted; @@ -1357,14 +1530,6 @@ public static System.Exception FromDafny_CommonError(software.amazon.cryptograph { switch (value) { - case software.amazon.cryptography.dbencryptionsdk.dynamodb.internaldafny.types.Error_AwsCryptographyDbEncryptionSdkStructuredEncryption dafnyVal: - return AWS.Cryptography.DbEncryptionSDK.StructuredEncryption.TypeConversion.FromDafny_CommonError( - dafnyVal._AwsCryptographyDbEncryptionSdkStructuredEncryption - ); - case software.amazon.cryptography.dbencryptionsdk.dynamodb.internaldafny.types.Error_AwsCryptographyMaterialProviders dafnyVal: - return AWS.Cryptography.MaterialProviders.TypeConversion.FromDafny_CommonError( - dafnyVal._AwsCryptographyMaterialProviders - ); case software.amazon.cryptography.dbencryptionsdk.dynamodb.internaldafny.types.Error_ComAmazonawsDynamodb dafnyVal: return Com.Amazonaws.Dynamodb.TypeConversion.FromDafny_CommonError( dafnyVal._ComAmazonawsDynamodb @@ -1373,6 +1538,14 @@ public static System.Exception FromDafny_CommonError(software.amazon.cryptograph return AWS.Cryptography.Primitives.TypeConversion.FromDafny_CommonError( dafnyVal._AwsCryptographyPrimitives ); + case software.amazon.cryptography.dbencryptionsdk.dynamodb.internaldafny.types.Error_AwsCryptographyMaterialProviders dafnyVal: + return AWS.Cryptography.MaterialProviders.TypeConversion.FromDafny_CommonError( + dafnyVal._AwsCryptographyMaterialProviders + ); + case software.amazon.cryptography.dbencryptionsdk.dynamodb.internaldafny.types.Error_AwsCryptographyDbEncryptionSdkStructuredEncryption dafnyVal: + return AWS.Cryptography.DbEncryptionSDK.StructuredEncryption.TypeConversion.FromDafny_CommonError( + dafnyVal._AwsCryptographyDbEncryptionSdkStructuredEncryption + ); case software.amazon.cryptography.dbencryptionsdk.dynamodb.internaldafny.types.Error_DynamoDbEncryptionException dafnyVal: return FromDafny_N3_aws__N12_cryptography__N15_dbEncryptionSdk__N8_dynamoDb__S27_DynamoDbEncryptionException(dafnyVal); case software.amazon.cryptography.dbencryptionsdk.dynamodb.internaldafny.types.Error_CollectionOfErrors dafnyVal: diff --git a/DynamoDbEncryption/runtimes/net/Generated/DynamoDbEncryptionTransforms/TypeConversion.cs b/DynamoDbEncryption/runtimes/net/Generated/DynamoDbEncryptionTransforms/TypeConversion.cs index 396852a23..e3eaef28e 100644 --- a/DynamoDbEncryption/runtimes/net/Generated/DynamoDbEncryptionTransforms/TypeConversion.cs +++ b/DynamoDbEncryption/runtimes/net/Generated/DynamoDbEncryptionTransforms/TypeConversion.cs @@ -6485,25 +6485,25 @@ public static System.Exception FromDafny_CommonError(software.amazon.cryptograph { switch (value) { - case software.amazon.cryptography.dbencryptionsdk.dynamodb.transforms.internaldafny.types.Error_AwsCryptographyDbEncryptionSdkDynamoDb dafnyVal: - return AWS.Cryptography.DbEncryptionSDK.DynamoDb.TypeConversion.FromDafny_CommonError( - dafnyVal._AwsCryptographyDbEncryptionSdkDynamoDb - ); case software.amazon.cryptography.dbencryptionsdk.dynamodb.transforms.internaldafny.types.Error_AwsCryptographyDbEncryptionSdkStructuredEncryption dafnyVal: return AWS.Cryptography.DbEncryptionSDK.StructuredEncryption.TypeConversion.FromDafny_CommonError( dafnyVal._AwsCryptographyDbEncryptionSdkStructuredEncryption ); - case software.amazon.cryptography.dbencryptionsdk.dynamodb.transforms.internaldafny.types.Error_AwsCryptographyMaterialProviders dafnyVal: - return AWS.Cryptography.MaterialProviders.TypeConversion.FromDafny_CommonError( - dafnyVal._AwsCryptographyMaterialProviders + case software.amazon.cryptography.dbencryptionsdk.dynamodb.transforms.internaldafny.types.Error_AwsCryptographyDbEncryptionSdkDynamoDb dafnyVal: + return AWS.Cryptography.DbEncryptionSDK.DynamoDb.TypeConversion.FromDafny_CommonError( + dafnyVal._AwsCryptographyDbEncryptionSdkDynamoDb + ); + case software.amazon.cryptography.dbencryptionsdk.dynamodb.transforms.internaldafny.types.Error_AwsCryptographyDbEncryptionSdkDynamoDbItemEncryptor dafnyVal: + return AWS.Cryptography.DbEncryptionSDK.DynamoDb.ItemEncryptor.TypeConversion.FromDafny_CommonError( + dafnyVal._AwsCryptographyDbEncryptionSdkDynamoDbItemEncryptor ); case software.amazon.cryptography.dbencryptionsdk.dynamodb.transforms.internaldafny.types.Error_ComAmazonawsDynamodb dafnyVal: return Com.Amazonaws.Dynamodb.TypeConversion.FromDafny_CommonError( dafnyVal._ComAmazonawsDynamodb ); - case software.amazon.cryptography.dbencryptionsdk.dynamodb.transforms.internaldafny.types.Error_AwsCryptographyDbEncryptionSdkDynamoDbItemEncryptor dafnyVal: - return AWS.Cryptography.DbEncryptionSDK.DynamoDb.ItemEncryptor.TypeConversion.FromDafny_CommonError( - dafnyVal._AwsCryptographyDbEncryptionSdkDynamoDbItemEncryptor + case software.amazon.cryptography.dbencryptionsdk.dynamodb.transforms.internaldafny.types.Error_AwsCryptographyMaterialProviders dafnyVal: + return AWS.Cryptography.MaterialProviders.TypeConversion.FromDafny_CommonError( + dafnyVal._AwsCryptographyMaterialProviders ); case software.amazon.cryptography.dbencryptionsdk.dynamodb.transforms.internaldafny.types.Error_DynamoDbEncryptionTransformsException dafnyVal: return FromDafny_N3_aws__N12_cryptography__N15_dbEncryptionSdk__N8_dynamoDb__N10_transforms__S37_DynamoDbEncryptionTransformsException(dafnyVal); diff --git a/DynamoDbEncryption/runtimes/net/Generated/DynamoDbItemEncryptor/TypeConversion.cs b/DynamoDbEncryption/runtimes/net/Generated/DynamoDbItemEncryptor/TypeConversion.cs index 54124cea9..ba9644013 100644 --- a/DynamoDbEncryption/runtimes/net/Generated/DynamoDbItemEncryptor/TypeConversion.cs +++ b/DynamoDbEncryption/runtimes/net/Generated/DynamoDbItemEncryptor/TypeConversion.cs @@ -952,26 +952,26 @@ public static System.Exception FromDafny_CommonError(software.amazon.cryptograph { switch (value) { - case software.amazon.cryptography.dbencryptionsdk.dynamodb.itemencryptor.internaldafny.types.Error_AwsCryptographyPrimitives dafnyVal: - return AWS.Cryptography.Primitives.TypeConversion.FromDafny_CommonError( - dafnyVal._AwsCryptographyPrimitives - ); case software.amazon.cryptography.dbencryptionsdk.dynamodb.itemencryptor.internaldafny.types.Error_AwsCryptographyMaterialProviders dafnyVal: return AWS.Cryptography.MaterialProviders.TypeConversion.FromDafny_CommonError( dafnyVal._AwsCryptographyMaterialProviders ); - case software.amazon.cryptography.dbencryptionsdk.dynamodb.itemencryptor.internaldafny.types.Error_AwsCryptographyDbEncryptionSdkStructuredEncryption dafnyVal: - return AWS.Cryptography.DbEncryptionSDK.StructuredEncryption.TypeConversion.FromDafny_CommonError( - dafnyVal._AwsCryptographyDbEncryptionSdkStructuredEncryption - ); case software.amazon.cryptography.dbencryptionsdk.dynamodb.itemencryptor.internaldafny.types.Error_ComAmazonawsDynamodb dafnyVal: return Com.Amazonaws.Dynamodb.TypeConversion.FromDafny_CommonError( dafnyVal._ComAmazonawsDynamodb ); + case software.amazon.cryptography.dbencryptionsdk.dynamodb.itemencryptor.internaldafny.types.Error_AwsCryptographyDbEncryptionSdkStructuredEncryption dafnyVal: + return AWS.Cryptography.DbEncryptionSDK.StructuredEncryption.TypeConversion.FromDafny_CommonError( + dafnyVal._AwsCryptographyDbEncryptionSdkStructuredEncryption + ); case software.amazon.cryptography.dbencryptionsdk.dynamodb.itemencryptor.internaldafny.types.Error_AwsCryptographyDbEncryptionSdkDynamoDb dafnyVal: return AWS.Cryptography.DbEncryptionSDK.DynamoDb.TypeConversion.FromDafny_CommonError( dafnyVal._AwsCryptographyDbEncryptionSdkDynamoDb ); + case software.amazon.cryptography.dbencryptionsdk.dynamodb.itemencryptor.internaldafny.types.Error_AwsCryptographyPrimitives dafnyVal: + return AWS.Cryptography.Primitives.TypeConversion.FromDafny_CommonError( + dafnyVal._AwsCryptographyPrimitives + ); case software.amazon.cryptography.dbencryptionsdk.dynamodb.itemencryptor.internaldafny.types.Error_DynamoDbItemEncryptorException dafnyVal: return FromDafny_N3_aws__N12_cryptography__N15_dbEncryptionSdk__N8_dynamoDb__N13_itemEncryptor__S30_DynamoDbItemEncryptorException(dafnyVal); case software.amazon.cryptography.dbencryptionsdk.dynamodb.itemencryptor.internaldafny.types.Error_CollectionOfErrors dafnyVal: From dda196af7838a165c26267073306fb80d40af1d3 Mon Sep 17 00:00:00 2001 From: rishav-karanjit Date: Wed, 27 Mar 2024 10:47:24 -0700 Subject: [PATCH 18/67] Add some more generated dotnet --- .../DynamoDbEncryption/TypeConversion.cs | 12 +++++----- .../TypeConversion.cs | 22 +++++++++---------- .../DynamoDbItemEncryptor/TypeConversion.cs | 18 +++++++-------- .../StructuredEncryption/TypeConversion.cs | 8 +++---- 4 files changed, 30 insertions(+), 30 deletions(-) diff --git a/DynamoDbEncryption/runtimes/net/Generated/DynamoDbEncryption/TypeConversion.cs b/DynamoDbEncryption/runtimes/net/Generated/DynamoDbEncryption/TypeConversion.cs index 51a528a1f..bcb4a958a 100644 --- a/DynamoDbEncryption/runtimes/net/Generated/DynamoDbEncryption/TypeConversion.cs +++ b/DynamoDbEncryption/runtimes/net/Generated/DynamoDbEncryption/TypeConversion.cs @@ -1534,17 +1534,17 @@ public static System.Exception FromDafny_CommonError(software.amazon.cryptograph return Com.Amazonaws.Dynamodb.TypeConversion.FromDafny_CommonError( dafnyVal._ComAmazonawsDynamodb ); - case software.amazon.cryptography.dbencryptionsdk.dynamodb.internaldafny.types.Error_AwsCryptographyPrimitives dafnyVal: - return AWS.Cryptography.Primitives.TypeConversion.FromDafny_CommonError( - dafnyVal._AwsCryptographyPrimitives + case software.amazon.cryptography.dbencryptionsdk.dynamodb.internaldafny.types.Error_AwsCryptographyDbEncryptionSdkStructuredEncryption dafnyVal: + return AWS.Cryptography.DbEncryptionSDK.StructuredEncryption.TypeConversion.FromDafny_CommonError( + dafnyVal._AwsCryptographyDbEncryptionSdkStructuredEncryption ); case software.amazon.cryptography.dbencryptionsdk.dynamodb.internaldafny.types.Error_AwsCryptographyMaterialProviders dafnyVal: return AWS.Cryptography.MaterialProviders.TypeConversion.FromDafny_CommonError( dafnyVal._AwsCryptographyMaterialProviders ); - case software.amazon.cryptography.dbencryptionsdk.dynamodb.internaldafny.types.Error_AwsCryptographyDbEncryptionSdkStructuredEncryption dafnyVal: - return AWS.Cryptography.DbEncryptionSDK.StructuredEncryption.TypeConversion.FromDafny_CommonError( - dafnyVal._AwsCryptographyDbEncryptionSdkStructuredEncryption + case software.amazon.cryptography.dbencryptionsdk.dynamodb.internaldafny.types.Error_AwsCryptographyPrimitives dafnyVal: + return AWS.Cryptography.Primitives.TypeConversion.FromDafny_CommonError( + dafnyVal._AwsCryptographyPrimitives ); case software.amazon.cryptography.dbencryptionsdk.dynamodb.internaldafny.types.Error_DynamoDbEncryptionException dafnyVal: return FromDafny_N3_aws__N12_cryptography__N15_dbEncryptionSdk__N8_dynamoDb__S27_DynamoDbEncryptionException(dafnyVal); diff --git a/DynamoDbEncryption/runtimes/net/Generated/DynamoDbEncryptionTransforms/TypeConversion.cs b/DynamoDbEncryption/runtimes/net/Generated/DynamoDbEncryptionTransforms/TypeConversion.cs index e3eaef28e..f4b8da84a 100644 --- a/DynamoDbEncryption/runtimes/net/Generated/DynamoDbEncryptionTransforms/TypeConversion.cs +++ b/DynamoDbEncryption/runtimes/net/Generated/DynamoDbEncryptionTransforms/TypeConversion.cs @@ -6485,26 +6485,26 @@ public static System.Exception FromDafny_CommonError(software.amazon.cryptograph { switch (value) { - case software.amazon.cryptography.dbencryptionsdk.dynamodb.transforms.internaldafny.types.Error_AwsCryptographyDbEncryptionSdkStructuredEncryption dafnyVal: - return AWS.Cryptography.DbEncryptionSDK.StructuredEncryption.TypeConversion.FromDafny_CommonError( - dafnyVal._AwsCryptographyDbEncryptionSdkStructuredEncryption + case software.amazon.cryptography.dbencryptionsdk.dynamodb.transforms.internaldafny.types.Error_ComAmazonawsDynamodb dafnyVal: + return Com.Amazonaws.Dynamodb.TypeConversion.FromDafny_CommonError( + dafnyVal._ComAmazonawsDynamodb + ); + case software.amazon.cryptography.dbencryptionsdk.dynamodb.transforms.internaldafny.types.Error_AwsCryptographyMaterialProviders dafnyVal: + return AWS.Cryptography.MaterialProviders.TypeConversion.FromDafny_CommonError( + dafnyVal._AwsCryptographyMaterialProviders ); case software.amazon.cryptography.dbencryptionsdk.dynamodb.transforms.internaldafny.types.Error_AwsCryptographyDbEncryptionSdkDynamoDb dafnyVal: return AWS.Cryptography.DbEncryptionSDK.DynamoDb.TypeConversion.FromDafny_CommonError( dafnyVal._AwsCryptographyDbEncryptionSdkDynamoDb ); + case software.amazon.cryptography.dbencryptionsdk.dynamodb.transforms.internaldafny.types.Error_AwsCryptographyDbEncryptionSdkStructuredEncryption dafnyVal: + return AWS.Cryptography.DbEncryptionSDK.StructuredEncryption.TypeConversion.FromDafny_CommonError( + dafnyVal._AwsCryptographyDbEncryptionSdkStructuredEncryption + ); case software.amazon.cryptography.dbencryptionsdk.dynamodb.transforms.internaldafny.types.Error_AwsCryptographyDbEncryptionSdkDynamoDbItemEncryptor dafnyVal: return AWS.Cryptography.DbEncryptionSDK.DynamoDb.ItemEncryptor.TypeConversion.FromDafny_CommonError( dafnyVal._AwsCryptographyDbEncryptionSdkDynamoDbItemEncryptor ); - case software.amazon.cryptography.dbencryptionsdk.dynamodb.transforms.internaldafny.types.Error_ComAmazonawsDynamodb dafnyVal: - return Com.Amazonaws.Dynamodb.TypeConversion.FromDafny_CommonError( - dafnyVal._ComAmazonawsDynamodb - ); - case software.amazon.cryptography.dbencryptionsdk.dynamodb.transforms.internaldafny.types.Error_AwsCryptographyMaterialProviders dafnyVal: - return AWS.Cryptography.MaterialProviders.TypeConversion.FromDafny_CommonError( - dafnyVal._AwsCryptographyMaterialProviders - ); case software.amazon.cryptography.dbencryptionsdk.dynamodb.transforms.internaldafny.types.Error_DynamoDbEncryptionTransformsException dafnyVal: return FromDafny_N3_aws__N12_cryptography__N15_dbEncryptionSdk__N8_dynamoDb__N10_transforms__S37_DynamoDbEncryptionTransformsException(dafnyVal); case software.amazon.cryptography.dbencryptionsdk.dynamodb.transforms.internaldafny.types.Error_CollectionOfErrors dafnyVal: diff --git a/DynamoDbEncryption/runtimes/net/Generated/DynamoDbItemEncryptor/TypeConversion.cs b/DynamoDbEncryption/runtimes/net/Generated/DynamoDbItemEncryptor/TypeConversion.cs index ba9644013..ebcd0d3c7 100644 --- a/DynamoDbEncryption/runtimes/net/Generated/DynamoDbItemEncryptor/TypeConversion.cs +++ b/DynamoDbEncryption/runtimes/net/Generated/DynamoDbItemEncryptor/TypeConversion.cs @@ -952,25 +952,25 @@ public static System.Exception FromDafny_CommonError(software.amazon.cryptograph { switch (value) { - case software.amazon.cryptography.dbencryptionsdk.dynamodb.itemencryptor.internaldafny.types.Error_AwsCryptographyMaterialProviders dafnyVal: - return AWS.Cryptography.MaterialProviders.TypeConversion.FromDafny_CommonError( - dafnyVal._AwsCryptographyMaterialProviders + case software.amazon.cryptography.dbencryptionsdk.dynamodb.itemencryptor.internaldafny.types.Error_AwsCryptographyDbEncryptionSdkStructuredEncryption dafnyVal: + return AWS.Cryptography.DbEncryptionSDK.StructuredEncryption.TypeConversion.FromDafny_CommonError( + dafnyVal._AwsCryptographyDbEncryptionSdkStructuredEncryption ); case software.amazon.cryptography.dbencryptionsdk.dynamodb.itemencryptor.internaldafny.types.Error_ComAmazonawsDynamodb dafnyVal: return Com.Amazonaws.Dynamodb.TypeConversion.FromDafny_CommonError( dafnyVal._ComAmazonawsDynamodb ); - case software.amazon.cryptography.dbencryptionsdk.dynamodb.itemencryptor.internaldafny.types.Error_AwsCryptographyDbEncryptionSdkStructuredEncryption dafnyVal: - return AWS.Cryptography.DbEncryptionSDK.StructuredEncryption.TypeConversion.FromDafny_CommonError( - dafnyVal._AwsCryptographyDbEncryptionSdkStructuredEncryption + case software.amazon.cryptography.dbencryptionsdk.dynamodb.itemencryptor.internaldafny.types.Error_AwsCryptographyPrimitives dafnyVal: + return AWS.Cryptography.Primitives.TypeConversion.FromDafny_CommonError( + dafnyVal._AwsCryptographyPrimitives ); case software.amazon.cryptography.dbencryptionsdk.dynamodb.itemencryptor.internaldafny.types.Error_AwsCryptographyDbEncryptionSdkDynamoDb dafnyVal: return AWS.Cryptography.DbEncryptionSDK.DynamoDb.TypeConversion.FromDafny_CommonError( dafnyVal._AwsCryptographyDbEncryptionSdkDynamoDb ); - case software.amazon.cryptography.dbencryptionsdk.dynamodb.itemencryptor.internaldafny.types.Error_AwsCryptographyPrimitives dafnyVal: - return AWS.Cryptography.Primitives.TypeConversion.FromDafny_CommonError( - dafnyVal._AwsCryptographyPrimitives + case software.amazon.cryptography.dbencryptionsdk.dynamodb.itemencryptor.internaldafny.types.Error_AwsCryptographyMaterialProviders dafnyVal: + return AWS.Cryptography.MaterialProviders.TypeConversion.FromDafny_CommonError( + dafnyVal._AwsCryptographyMaterialProviders ); case software.amazon.cryptography.dbencryptionsdk.dynamodb.itemencryptor.internaldafny.types.Error_DynamoDbItemEncryptorException dafnyVal: return FromDafny_N3_aws__N12_cryptography__N15_dbEncryptionSdk__N8_dynamoDb__N13_itemEncryptor__S30_DynamoDbItemEncryptorException(dafnyVal); diff --git a/DynamoDbEncryption/runtimes/net/Generated/StructuredEncryption/TypeConversion.cs b/DynamoDbEncryption/runtimes/net/Generated/StructuredEncryption/TypeConversion.cs index e83e3b2e6..b352a6ed0 100644 --- a/DynamoDbEncryption/runtimes/net/Generated/StructuredEncryption/TypeConversion.cs +++ b/DynamoDbEncryption/runtimes/net/Generated/StructuredEncryption/TypeConversion.cs @@ -921,14 +921,14 @@ public static System.Exception FromDafny_CommonError(software.amazon.cryptograph { switch (value) { - case software.amazon.cryptography.dbencryptionsdk.structuredencryption.internaldafny.types.Error_AwsCryptographyPrimitives dafnyVal: - return AWS.Cryptography.Primitives.TypeConversion.FromDafny_CommonError( - dafnyVal._AwsCryptographyPrimitives - ); case software.amazon.cryptography.dbencryptionsdk.structuredencryption.internaldafny.types.Error_AwsCryptographyMaterialProviders dafnyVal: return AWS.Cryptography.MaterialProviders.TypeConversion.FromDafny_CommonError( dafnyVal._AwsCryptographyMaterialProviders ); + case software.amazon.cryptography.dbencryptionsdk.structuredencryption.internaldafny.types.Error_AwsCryptographyPrimitives dafnyVal: + return AWS.Cryptography.Primitives.TypeConversion.FromDafny_CommonError( + dafnyVal._AwsCryptographyPrimitives + ); case software.amazon.cryptography.dbencryptionsdk.structuredencryption.internaldafny.types.Error_StructuredEncryptionException dafnyVal: return FromDafny_N3_aws__N12_cryptography__N15_dbEncryptionSdk__N20_structuredEncryption__S29_StructuredEncryptionException(dafnyVal); case software.amazon.cryptography.dbencryptionsdk.structuredencryption.internaldafny.types.Error_CollectionOfErrors dafnyVal: From 6e6fd6b4bc60e5a3dc78343ef0cad25b3f6f1f88 Mon Sep 17 00:00:00 2001 From: rishav-karanjit Date: Wed, 27 Mar 2024 10:52:23 -0700 Subject: [PATCH 19/67] format code --- ...raphyDbEncryptionSdkDynamoDbOperations.dfy | 50 +- ...moDbGetEncryptedDataKeyDescriptionTest.dfy | 580 +++++++++--------- 2 files changed, 315 insertions(+), 315 deletions(-) diff --git a/DynamoDbEncryption/dafny/DynamoDbEncryption/src/AwsCryptographyDbEncryptionSdkDynamoDbOperations.dfy b/DynamoDbEncryption/dafny/DynamoDbEncryption/src/AwsCryptographyDbEncryptionSdkDynamoDbOperations.dfy index 75e1b7a8a..05186a71a 100644 --- a/DynamoDbEncryption/dafny/DynamoDbEncryption/src/AwsCryptographyDbEncryptionSdkDynamoDbOperations.dfy +++ b/DynamoDbEncryption/dafny/DynamoDbEncryption/src/AwsCryptographyDbEncryptionSdkDynamoDbOperations.dfy @@ -20,7 +20,7 @@ module AwsCryptographyDbEncryptionSdkDynamoDbOperations refines AbstractAwsCrypt { {} } datatype Config = Config( - ) + ) type InternalConfig = Config @@ -32,13 +32,13 @@ module AwsCryptographyDbEncryptionSdkDynamoDbOperations refines AbstractAwsCrypt input: CreateDynamoDbEncryptionBranchKeyIdSupplierInput ) returns (output: Result) { var supplier := new DynamoDbEncryptionBranchKeyIdSupplier.DynamoDbEncryptionBranchKeyIdSupplier( - input.ddbKeyBranchKeyIdSupplier + input.ddbKeyBranchKeyIdSupplier ); return Success( CreateDynamoDbEncryptionBranchKeyIdSupplierOutput( branchKeyIdSupplier := supplier ) - ); + ); } predicate GetEncryptedDataKeyDescriptionEnsuresPublicly(input: GetEncryptedDataKeyDescriptionInput , output: Result) {true} @@ -46,19 +46,19 @@ module AwsCryptographyDbEncryptionSdkDynamoDbOperations refines AbstractAwsCrypt method GetEncryptedDataKeyDescription(config: InternalConfig, input: GetEncryptedDataKeyDescriptionInput) returns (output: Result) ensures GetEncryptedDataKeyDescriptionEnsuresPublicly(input, output) - ensures output.Success? ==> ( - match input.input { - case plaintextItem(item) => - DynamoToStruct.ItemToStructured(item).Success? - && var extracted := DynamoToStruct.ItemToStructured(item).Extract(); - && var keys := extracted.Keys; - && "aws_dbe_head" in DynamoToStruct.ItemToStructured(item).Extract() - && var header := DynamoToStruct.ItemToStructured(item).Extract()["aws_dbe_head"].content.Terminal.value; - && Header.PartialDeserialize(header).Success? - case header(header) => - Header.PartialDeserialize(header).Success? - } - ) + ensures output.Success? ==> ( + match input.input { + case plaintextItem(item) => + DynamoToStruct.ItemToStructured(item).Success? + && var extracted := DynamoToStruct.ItemToStructured(item).Extract(); + && var keys := extracted.Keys; + && "aws_dbe_head" in DynamoToStruct.ItemToStructured(item).Extract() + && var header := DynamoToStruct.ItemToStructured(item).Extract()["aws_dbe_head"].content.Terminal.value; + && Header.PartialDeserialize(header).Success? + case header(header) => + Header.PartialDeserialize(header).Success? + } + ) { var header; match input.input @@ -74,7 +74,7 @@ module AwsCryptographyDbEncryptionSdkDynamoDbOperations refines AbstractAwsCrypt :- Need(Header.PartialDeserialize(header).Success?, E("Failed to deserialize header.")); var deserializedHeader := Header.PartialDeserialize(header); var algorithmSuite; - + if deserializedHeader.Extract().flavor == 0{ algorithmSuite := AlgorithmSuites.DBE_ALG_AES_256_GCM_HKDF_SHA512_COMMIT_KEY_SYMSIG_HMAC_SHA384; } else { @@ -85,7 +85,7 @@ module AwsCryptographyDbEncryptionSdkDynamoDbOperations refines AbstractAwsCrypt var list : EncryptedDataKeyDescriptionList := []; for i := 0 to |datakeys| { var singleDataKeyOutput : EncryptedDataKeyDescriptionOutput; - + :- Need(UTF8.Decode(datakeys[i].keyProviderId).Success?, E("Failed to extract keyProviderId.")); :- Need(UTF8.Decode(datakeys[i].keyProviderInfo).Success?, E("Failed to extract keyProviderInfo.")); @@ -95,33 +95,33 @@ module AwsCryptographyDbEncryptionSdkDynamoDbOperations refines AbstractAwsCrypt if |extractedKeyProviderId| < 7 || extractedKeyProviderId[0..7] != "aws-kms" { singleDataKeyOutput := EncryptedDataKeyDescriptionOutput( keyProviderId := extractedKeyProviderId, - keyProviderInfo := None, + keyProviderInfo := None, branchKeyId := None, branchKeyVersion := None ); } if extractedKeyProviderId == "aws-kms-hierarchy" { :- Need(EdkWrapping.GetProviderWrappedMaterial(datakeys[i].ciphertext, algorithmSuite).Success?, E("Failed to get provider wrapped material.")); - + var providerWrappedMaterial := EdkWrapping.GetProviderWrappedMaterial(datakeys[i].ciphertext, algorithmSuite).Extract(); // The ciphertext structure in the hierarchy keyring contains Salt and IV before Version. // The length of Salt is 16 and IV is 12 bytes. The length of Version is 16 bytes. // https://github.com/awslabs/aws-encryption-sdk-specification/blob/master/framework/aws-kms/aws-kms-hierarchical-keyring.md#ciphertext - + var EDK_CIPHERTEXT_BRANCH_KEY_VERSION_INDEX := 12 + 16; var EDK_CIPHERTEXT_VERSION_INDEX := EDK_CIPHERTEXT_BRANCH_KEY_VERSION_INDEX + 16; :- Need(EDK_CIPHERTEXT_BRANCH_KEY_VERSION_INDEX < EDK_CIPHERTEXT_VERSION_INDEX, E("Wrong branch key version index.")); :- Need(|providerWrappedMaterial| >= EDK_CIPHERTEXT_VERSION_INDEX, E("Incorrect ciphertext structure length.")); var branchKeyVersionUuid := providerWrappedMaterial[EDK_CIPHERTEXT_BRANCH_KEY_VERSION_INDEX .. EDK_CIPHERTEXT_VERSION_INDEX]; - + :- Need(UUID.FromByteArray(branchKeyVersionUuid).Success?, E("Failed to convert UUID from byte array.")); var expectedBranchKeyVersion := UUID.FromByteArray(branchKeyVersionUuid).Extract(); singleDataKeyOutput := EncryptedDataKeyDescriptionOutput( keyProviderId := extractedKeyProviderId, - keyProviderInfo := Some(extractedKeyProviderIdInfo), + keyProviderInfo := Some(extractedKeyProviderIdInfo), branchKeyId := Some(extractedKeyProviderIdInfo), branchKeyVersion := Some(expectedBranchKeyVersion) ); @@ -129,14 +129,14 @@ module AwsCryptographyDbEncryptionSdkDynamoDbOperations refines AbstractAwsCrypt else { singleDataKeyOutput := EncryptedDataKeyDescriptionOutput( keyProviderId := extractedKeyProviderId, - keyProviderInfo := Some(extractedKeyProviderIdInfo), + keyProviderInfo := Some(extractedKeyProviderIdInfo), branchKeyId := None, branchKeyVersion := None ); } list := list + [singleDataKeyOutput]; } - + output := Success(GetEncryptedDataKeyDescriptionOutput( EncryptedDataKeyDescriptionOutput := list )); diff --git a/DynamoDbEncryption/dafny/DynamoDbEncryption/test/DynamoDbGetEncryptedDataKeyDescriptionTest.dfy b/DynamoDbEncryption/dafny/DynamoDbEncryption/test/DynamoDbGetEncryptedDataKeyDescriptionTest.dfy index 93edc0c86..6172e3840 100644 --- a/DynamoDbEncryption/dafny/DynamoDbEncryption/test/DynamoDbGetEncryptedDataKeyDescriptionTest.dfy +++ b/DynamoDbEncryption/dafny/DynamoDbEncryption/test/DynamoDbGetEncryptedDataKeyDescriptionTest.dfy @@ -1,323 +1,323 @@ include "../src/Index.dfy" module DynamoDbGetEncryptedDataKeyDescriptionTest { - import DynamoDbEncryption - import opened StandardLibrary.UInt - import opened StructuredEncryptionHeader - import opened StructuredEncryptionUtil - import opened UTF8 - import Types = AwsCryptographyDbEncryptionSdkDynamoDbTypes - import UUID - import ComAmazonawsDynamodbTypes - import EdkWrapping - import AlgorithmSuites - - const testVersion : Version := 1 - - const testFlavor : Flavor := 1 - - const testMsgID : MessageID := [1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32] - - const testLegend : Legend := [0x65, 0x73] - - const testEncContext : CMPEncryptionContext := map[EncodeAscii("abc") := EncodeAscii("def")] - - const testAwsKmsDataKey := CMP.EncryptedDataKey( - keyProviderId := EncodeAscii("aws-kms") , - keyProviderInfo := EncodeAscii("keyproviderInfo"), - ciphertext := [1, 2, 3, 4, 5]) - - const testAwsKmsHDataKey := CMP.EncryptedDataKey( - keyProviderId := EncodeAscii("aws-kms-hierarchy") , - keyProviderInfo := EncodeAscii("keyproviderInfo"), - ciphertext := [ - 64, 92, 115, 7, 85, 121, 112, 79, 69, 12, 82, 25, 67, 34, - 11, 66, 93, 45, 40, 23, 90, 61, 16, 28, 59, 114, 52, 122, - 50, 23, 11, 101, 48, 53, 30, 120, 51, 74, 77, 53, 57, 99, - 53, 13, 30, 21, 109, 85, 15, 86, 47, 84, 91, 85, 87, 60, 4, - 56, 67, 74, 29, 87, 85, 106, 8, 82, 63, 114, 100, 110, 68, - 58, 83, 24, 111, 41, 21, 91, 122, 61, 118, 37, 72, 38, 67, 2, - 17, 61, 17, 121, 7, 90, 117, 49, 30, 20, 89, 68, 33, 111, - 107, 5, 120, 20, 95, 78, 70, 2, 49, 84, 39, 50, 40, 40, 115, - 114, 76, 18, 103, 84, 34, 123, 1, 125, 61, 33, 13, 18, 81, - 24, 53, 53, 26, 60, 52, 85, 81, 96, 85, 72]) - - const testRawRsaDataKey := CMP.EncryptedDataKey( - keyProviderId := EncodeAscii("raw-rsa") , - keyProviderInfo := [1, 2, 3, 4, 5], - ciphertext := [6, 7, 8, 9]) - - const testAwsKmsRsaDataKey := CMP.EncryptedDataKey( - keyProviderId := EncodeAscii("aws-kms-rsa") , - keyProviderInfo := EncodeAscii("keyproviderInfo"), - ciphertext := [1, 2, 3, 4, 5]) - - const algorithmSuite := AlgorithmSuites.DBE_ALG_AES_256_GCM_HKDF_SHA512_COMMIT_KEY_ECDSA_P384_SYMSIG_HMAC_SHA384 - - method CreatePartialHeader(version : Version, flavor : Flavor, msgID : MessageID, legend : Legend, encContext : CMPEncryptionContext, dataKeyList : CMPEncryptedDataKeyList) - returns (result: PartialHeader) - ensures result.version == version - ensures result.flavor == flavor - ensures result.msgID == msgID - ensures result.legend == legend - ensures result.encContext == encContext - ensures result.dataKeys == dataKeyList - { - result := PartialHeader ( - version := version, - flavor := flavor, - msgID := msgID, - legend := legend, - encContext := encContext, - dataKeys := dataKeyList - ); + import DynamoDbEncryption + import opened StandardLibrary.UInt + import opened StructuredEncryptionHeader + import opened StructuredEncryptionUtil + import opened UTF8 + import Types = AwsCryptographyDbEncryptionSdkDynamoDbTypes + import UUID + import ComAmazonawsDynamodbTypes + import EdkWrapping + import AlgorithmSuites + + const testVersion : Version := 1 + + const testFlavor : Flavor := 1 + + const testMsgID : MessageID := [1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32] + + const testLegend : Legend := [0x65, 0x73] + + const testEncContext : CMPEncryptionContext := map[EncodeAscii("abc") := EncodeAscii("def")] + + const testAwsKmsDataKey := CMP.EncryptedDataKey( + keyProviderId := EncodeAscii("aws-kms") , + keyProviderInfo := EncodeAscii("keyproviderInfo"), + ciphertext := [1, 2, 3, 4, 5]) + + const testAwsKmsHDataKey := CMP.EncryptedDataKey( + keyProviderId := EncodeAscii("aws-kms-hierarchy") , + keyProviderInfo := EncodeAscii("keyproviderInfo"), + ciphertext := [ + 64, 92, 115, 7, 85, 121, 112, 79, 69, 12, 82, 25, 67, 34, + 11, 66, 93, 45, 40, 23, 90, 61, 16, 28, 59, 114, 52, 122, + 50, 23, 11, 101, 48, 53, 30, 120, 51, 74, 77, 53, 57, 99, + 53, 13, 30, 21, 109, 85, 15, 86, 47, 84, 91, 85, 87, 60, 4, + 56, 67, 74, 29, 87, 85, 106, 8, 82, 63, 114, 100, 110, 68, + 58, 83, 24, 111, 41, 21, 91, 122, 61, 118, 37, 72, 38, 67, 2, + 17, 61, 17, 121, 7, 90, 117, 49, 30, 20, 89, 68, 33, 111, + 107, 5, 120, 20, 95, 78, 70, 2, 49, 84, 39, 50, 40, 40, 115, + 114, 76, 18, 103, 84, 34, 123, 1, 125, 61, 33, 13, 18, 81, + 24, 53, 53, 26, 60, 52, 85, 81, 96, 85, 72]) + + const testRawRsaDataKey := CMP.EncryptedDataKey( + keyProviderId := EncodeAscii("raw-rsa") , + keyProviderInfo := [1, 2, 3, 4, 5], + ciphertext := [6, 7, 8, 9]) + + const testAwsKmsRsaDataKey := CMP.EncryptedDataKey( + keyProviderId := EncodeAscii("aws-kms-rsa") , + keyProviderInfo := EncodeAscii("keyproviderInfo"), + ciphertext := [1, 2, 3, 4, 5]) + + const algorithmSuite := AlgorithmSuites.DBE_ALG_AES_256_GCM_HKDF_SHA512_COMMIT_KEY_ECDSA_P384_SYMSIG_HMAC_SHA384 + + method CreatePartialHeader(version : Version, flavor : Flavor, msgID : MessageID, legend : Legend, encContext : CMPEncryptionContext, dataKeyList : CMPEncryptedDataKeyList) + returns (result: PartialHeader) + ensures result.version == version + ensures result.flavor == flavor + ensures result.msgID == msgID + ensures result.legend == legend + ensures result.encContext == encContext + ensures result.dataKeys == dataKeyList + { + result := PartialHeader ( + version := version, + flavor := flavor, + msgID := msgID, + legend := legend, + encContext := encContext, + dataKeys := dataKeyList + ); + } + + method {:test} TestHeaderInputAwsKmsDataKeyCase() + { + var expectedHead := CreatePartialHeader(testVersion, testFlavor, testMsgID, testLegend, testEncContext, [testAwsKmsDataKey]); + var serializedHeader := expectedHead.serialize() + expectedHead.msgID; + + var ddbEncResources :- expect DynamoDbEncryption.DynamoDbEncryption(); + + var inputVariable: Types.GetEncryptedDataKeyDescriptionInput := + Types.GetEncryptedDataKeyDescriptionInput( + input := Types.header(header := serializedHeader) + ); + + var actualDataKeyDescription := ddbEncResources.GetEncryptedDataKeyDescription(inputVariable); + + expect UTF8.Decode(expectedHead.dataKeys[0].keyProviderId).Success?; + expect UTF8.Decode(expectedHead.dataKeys[0].keyProviderInfo).Success?; + expect actualDataKeyDescription.Success?; + expect |actualDataKeyDescription.Extract().EncryptedDataKeyDescriptionOutput| > 0; + + expect |actualDataKeyDescription.Extract().EncryptedDataKeyDescriptionOutput| == |expectedHead.dataKeys|; + expect actualDataKeyDescription.Extract().EncryptedDataKeyDescriptionOutput[0].keyProviderId == UTF8.Decode(expectedHead.dataKeys[0].keyProviderId).Extract(); + + expect actualDataKeyDescription.Extract().EncryptedDataKeyDescriptionOutput[0].keyProviderInfo.Some?; + expect actualDataKeyDescription.Extract().EncryptedDataKeyDescriptionOutput[0].keyProviderInfo.Extract() == UTF8.Decode(expectedHead.dataKeys[0].keyProviderInfo).Extract(); + } + + method {:test} TestHeaderInputAwsKmsHDataKeyCase() + { + var expectedHead := CreatePartialHeader(testVersion, testFlavor, testMsgID, testLegend, testEncContext, [testAwsKmsHDataKey]); + var serializedHeader := expectedHead.serialize() + expectedHead.msgID; + + var expectedBranchKeyVersion := getBranchKeyVersion(expectedHead); + var ddbEncResources :- expect DynamoDbEncryption.DynamoDbEncryption(); + + var inputVariable: Types.GetEncryptedDataKeyDescriptionInput := + Types.GetEncryptedDataKeyDescriptionInput( + input := Types.header(header := serializedHeader) + ); + + var actualDataKeyDescription := ddbEncResources.GetEncryptedDataKeyDescription(inputVariable); + + expect UTF8.Decode(expectedHead.dataKeys[0].keyProviderId).Success?; + expect UTF8.Decode(expectedHead.dataKeys[0].keyProviderInfo).Success?; + expect actualDataKeyDescription.Success?; + expect |actualDataKeyDescription.Extract().EncryptedDataKeyDescriptionOutput| > 0; + + expect |actualDataKeyDescription.Extract().EncryptedDataKeyDescriptionOutput| == |expectedHead.dataKeys|; + expect actualDataKeyDescription.Extract().EncryptedDataKeyDescriptionOutput[0].keyProviderId == UTF8.Decode(expectedHead.dataKeys[0].keyProviderId).Extract(); + + expect actualDataKeyDescription.Extract().EncryptedDataKeyDescriptionOutput[0].keyProviderInfo.Some?; + expect actualDataKeyDescription.Extract().EncryptedDataKeyDescriptionOutput[0].keyProviderInfo.Extract() == UTF8.Decode(expectedHead.dataKeys[0].keyProviderInfo).Extract(); + + if actualDataKeyDescription.Extract().EncryptedDataKeyDescriptionOutput[0].keyProviderId == "aws-kms-hierarchy" { + expect actualDataKeyDescription.Extract().EncryptedDataKeyDescriptionOutput[0].branchKeyId.Some?; + expect actualDataKeyDescription.Extract().EncryptedDataKeyDescriptionOutput[0].branchKeyVersion.Some?; + + expect actualDataKeyDescription.Extract().EncryptedDataKeyDescriptionOutput[0].branchKeyId.Extract() == UTF8.Decode(expectedHead.dataKeys[0].keyProviderInfo).Extract(); + expect actualDataKeyDescription.Extract().EncryptedDataKeyDescriptionOutput[0].branchKeyVersion.Extract() == expectedBranchKeyVersion; } + } - method {:test} TestHeaderInputAwsKmsDataKeyCase() - { - var expectedHead := CreatePartialHeader(testVersion, testFlavor, testMsgID, testLegend, testEncContext, [testAwsKmsDataKey]); - var serializedHeader := expectedHead.serialize() + expectedHead.msgID; - - var ddbEncResources :- expect DynamoDbEncryption.DynamoDbEncryption(); - - var inputVariable: Types.GetEncryptedDataKeyDescriptionInput := - Types.GetEncryptedDataKeyDescriptionInput( - input := Types.header(header := serializedHeader) - ); - - var actualDataKeyDescription := ddbEncResources.GetEncryptedDataKeyDescription(inputVariable); - - expect UTF8.Decode(expectedHead.dataKeys[0].keyProviderId).Success?; - expect UTF8.Decode(expectedHead.dataKeys[0].keyProviderInfo).Success?; - expect actualDataKeyDescription.Success?; - expect |actualDataKeyDescription.Extract().EncryptedDataKeyDescriptionOutput| > 0; - - expect |actualDataKeyDescription.Extract().EncryptedDataKeyDescriptionOutput| == |expectedHead.dataKeys|; - expect actualDataKeyDescription.Extract().EncryptedDataKeyDescriptionOutput[0].keyProviderId == UTF8.Decode(expectedHead.dataKeys[0].keyProviderId).Extract(); - - expect actualDataKeyDescription.Extract().EncryptedDataKeyDescriptionOutput[0].keyProviderInfo.Some?; - expect actualDataKeyDescription.Extract().EncryptedDataKeyDescriptionOutput[0].keyProviderInfo.Extract() == UTF8.Decode(expectedHead.dataKeys[0].keyProviderInfo).Extract(); - } + method {:test} TestHeaderInputRawRsaDataKeyDataKeyCase() + { + var expectedHead := CreatePartialHeader(testVersion, testFlavor, testMsgID, testLegend, testEncContext, [testRawRsaDataKey]); + var serializedHeader := expectedHead.serialize() + expectedHead.msgID; - method {:test} TestHeaderInputAwsKmsHDataKeyCase() - { - var expectedHead := CreatePartialHeader(testVersion, testFlavor, testMsgID, testLegend, testEncContext, [testAwsKmsHDataKey]); - var serializedHeader := expectedHead.serialize() + expectedHead.msgID; - - var expectedBranchKeyVersion := getBranchKeyVersion(expectedHead); - var ddbEncResources :- expect DynamoDbEncryption.DynamoDbEncryption(); - - var inputVariable: Types.GetEncryptedDataKeyDescriptionInput := - Types.GetEncryptedDataKeyDescriptionInput( - input := Types.header(header := serializedHeader) - ); - - var actualDataKeyDescription := ddbEncResources.GetEncryptedDataKeyDescription(inputVariable); - - expect UTF8.Decode(expectedHead.dataKeys[0].keyProviderId).Success?; - expect UTF8.Decode(expectedHead.dataKeys[0].keyProviderInfo).Success?; - expect actualDataKeyDescription.Success?; - expect |actualDataKeyDescription.Extract().EncryptedDataKeyDescriptionOutput| > 0; - - expect |actualDataKeyDescription.Extract().EncryptedDataKeyDescriptionOutput| == |expectedHead.dataKeys|; - expect actualDataKeyDescription.Extract().EncryptedDataKeyDescriptionOutput[0].keyProviderId == UTF8.Decode(expectedHead.dataKeys[0].keyProviderId).Extract(); - - expect actualDataKeyDescription.Extract().EncryptedDataKeyDescriptionOutput[0].keyProviderInfo.Some?; - expect actualDataKeyDescription.Extract().EncryptedDataKeyDescriptionOutput[0].keyProviderInfo.Extract() == UTF8.Decode(expectedHead.dataKeys[0].keyProviderInfo).Extract(); - - if actualDataKeyDescription.Extract().EncryptedDataKeyDescriptionOutput[0].keyProviderId == "aws-kms-hierarchy" { - expect actualDataKeyDescription.Extract().EncryptedDataKeyDescriptionOutput[0].branchKeyId.Some?; - expect actualDataKeyDescription.Extract().EncryptedDataKeyDescriptionOutput[0].branchKeyVersion.Some?; - - expect actualDataKeyDescription.Extract().EncryptedDataKeyDescriptionOutput[0].branchKeyId.Extract() == UTF8.Decode(expectedHead.dataKeys[0].keyProviderInfo).Extract(); - expect actualDataKeyDescription.Extract().EncryptedDataKeyDescriptionOutput[0].branchKeyVersion.Extract() == expectedBranchKeyVersion; - } - } + var ddbEncResources :- expect DynamoDbEncryption.DynamoDbEncryption(); - method {:test} TestHeaderInputRawRsaDataKeyDataKeyCase() - { - var expectedHead := CreatePartialHeader(testVersion, testFlavor, testMsgID, testLegend, testEncContext, [testRawRsaDataKey]); - var serializedHeader := expectedHead.serialize() + expectedHead.msgID; - - var ddbEncResources :- expect DynamoDbEncryption.DynamoDbEncryption(); - - var inputVariable: Types.GetEncryptedDataKeyDescriptionInput := - Types.GetEncryptedDataKeyDescriptionInput( - input := Types.header(header := serializedHeader) - ); - - var actualDataKeyDescription := ddbEncResources.GetEncryptedDataKeyDescription(inputVariable); - - expect UTF8.Decode(expectedHead.dataKeys[0].keyProviderId).Success?; - expect UTF8.Decode(expectedHead.dataKeys[0].keyProviderInfo).Success?; - expect actualDataKeyDescription.Success?; - expect |actualDataKeyDescription.Extract().EncryptedDataKeyDescriptionOutput| > 0; - - expect |actualDataKeyDescription.Extract().EncryptedDataKeyDescriptionOutput| == |expectedHead.dataKeys|; - expect actualDataKeyDescription.Extract().EncryptedDataKeyDescriptionOutput[0].keyProviderId == UTF8.Decode(expectedHead.dataKeys[0].keyProviderId).Extract(); - - expect actualDataKeyDescription.Extract().EncryptedDataKeyDescriptionOutput[0].keyProviderInfo.Some?; - expect actualDataKeyDescription.Extract().EncryptedDataKeyDescriptionOutput[0].keyProviderInfo.Extract() == UTF8.Decode(expectedHead.dataKeys[0].keyProviderInfo).Extract(); - } + var inputVariable: Types.GetEncryptedDataKeyDescriptionInput := + Types.GetEncryptedDataKeyDescriptionInput( + input := Types.header(header := serializedHeader) + ); - method {:test} TestHeaderInputAwsKmsRsaDataKeyCase() - { - var expectedHead := CreatePartialHeader(testVersion, testFlavor, testMsgID, testLegend, testEncContext, [testAwsKmsRsaDataKey]); - var serializedHeader := expectedHead.serialize() + expectedHead.msgID; - - var ddbEncResources :- expect DynamoDbEncryption.DynamoDbEncryption(); - - var inputVariable: Types.GetEncryptedDataKeyDescriptionInput := - Types.GetEncryptedDataKeyDescriptionInput( - input := Types.header(header := serializedHeader) - ); - - var actualDataKeyDescription := ddbEncResources.GetEncryptedDataKeyDescription(inputVariable); - - expect UTF8.Decode(expectedHead.dataKeys[0].keyProviderId).Success?; - expect UTF8.Decode(expectedHead.dataKeys[0].keyProviderInfo).Success?; - expect actualDataKeyDescription.Success?; - expect |actualDataKeyDescription.Extract().EncryptedDataKeyDescriptionOutput| > 0; - - expect |actualDataKeyDescription.Extract().EncryptedDataKeyDescriptionOutput| == |expectedHead.dataKeys|; - expect actualDataKeyDescription.Extract().EncryptedDataKeyDescriptionOutput[0].keyProviderId == UTF8.Decode(expectedHead.dataKeys[0].keyProviderId).Extract(); - - expect actualDataKeyDescription.Extract().EncryptedDataKeyDescriptionOutput[0].keyProviderInfo.Some?; - expect actualDataKeyDescription.Extract().EncryptedDataKeyDescriptionOutput[0].keyProviderInfo.Extract() == UTF8.Decode(expectedHead.dataKeys[0].keyProviderInfo).Extract(); - } + var actualDataKeyDescription := ddbEncResources.GetEncryptedDataKeyDescription(inputVariable); + expect UTF8.Decode(expectedHead.dataKeys[0].keyProviderId).Success?; + expect UTF8.Decode(expectedHead.dataKeys[0].keyProviderInfo).Success?; + expect actualDataKeyDescription.Success?; + expect |actualDataKeyDescription.Extract().EncryptedDataKeyDescriptionOutput| > 0; - method {:test} TestDDBItemInputAwsKmsDataKeyCase() - { - var expectedHead := CreatePartialHeader(testVersion, testFlavor, testMsgID, testLegend, testEncContext, [testAwsKmsDataKey]); - var serializedHeader := expectedHead.serialize() + expectedHead.msgID; + expect |actualDataKeyDescription.Extract().EncryptedDataKeyDescriptionOutput| == |expectedHead.dataKeys|; + expect actualDataKeyDescription.Extract().EncryptedDataKeyDescriptionOutput[0].keyProviderId == UTF8.Decode(expectedHead.dataKeys[0].keyProviderId).Extract(); - var attr := map["aws_dbe_head" := ComAmazonawsDynamodbTypes.AttributeValue.B(serializedHeader)]; - var ddbEncResources :- expect DynamoDbEncryption.DynamoDbEncryption(); - - var inputVariable: Types.GetEncryptedDataKeyDescriptionInput := - Types.GetEncryptedDataKeyDescriptionInput( - input := Types.plaintextItem(plaintextItem := attr) - ); + expect actualDataKeyDescription.Extract().EncryptedDataKeyDescriptionOutput[0].keyProviderInfo.Some?; + expect actualDataKeyDescription.Extract().EncryptedDataKeyDescriptionOutput[0].keyProviderInfo.Extract() == UTF8.Decode(expectedHead.dataKeys[0].keyProviderInfo).Extract(); + } - var actualDataKeyDescription := ddbEncResources.GetEncryptedDataKeyDescription(inputVariable); - - expect UTF8.Decode(expectedHead.dataKeys[0].keyProviderId).Success?; - expect UTF8.Decode(expectedHead.dataKeys[0].keyProviderInfo).Success?; - expect actualDataKeyDescription.Success?; - expect |actualDataKeyDescription.Extract().EncryptedDataKeyDescriptionOutput| > 0; + method {:test} TestHeaderInputAwsKmsRsaDataKeyCase() + { + var expectedHead := CreatePartialHeader(testVersion, testFlavor, testMsgID, testLegend, testEncContext, [testAwsKmsRsaDataKey]); + var serializedHeader := expectedHead.serialize() + expectedHead.msgID; - expect |actualDataKeyDescription.Extract().EncryptedDataKeyDescriptionOutput| == |expectedHead.dataKeys|; - expect actualDataKeyDescription.Extract().EncryptedDataKeyDescriptionOutput[0].keyProviderId == UTF8.Decode(expectedHead.dataKeys[0].keyProviderId).Extract(); + var ddbEncResources :- expect DynamoDbEncryption.DynamoDbEncryption(); - expect actualDataKeyDescription.Extract().EncryptedDataKeyDescriptionOutput[0].keyProviderInfo.Some?; - expect actualDataKeyDescription.Extract().EncryptedDataKeyDescriptionOutput[0].keyProviderInfo.Extract() == UTF8.Decode(expectedHead.dataKeys[0].keyProviderInfo).Extract(); - } + var inputVariable: Types.GetEncryptedDataKeyDescriptionInput := + Types.GetEncryptedDataKeyDescriptionInput( + input := Types.header(header := serializedHeader) + ); - method {:test} TestDDBItemInputAwsKmsHDataKeyCase() - { - var expectedHead := CreatePartialHeader(testVersion, testFlavor, testMsgID, testLegend, testEncContext, [testAwsKmsHDataKey]); - var serializedHeader := expectedHead.serialize() + expectedHead.msgID; - - var expectedBranchKeyVersion := getBranchKeyVersion(expectedHead); - var attr := map["aws_dbe_head" := ComAmazonawsDynamodbTypes.AttributeValue.B(serializedHeader)]; - var ddbEncResources :- expect DynamoDbEncryption.DynamoDbEncryption(); - - var inputVariable: Types.GetEncryptedDataKeyDescriptionInput := - Types.GetEncryptedDataKeyDescriptionInput( - input := Types.plaintextItem(plaintextItem := attr) - ); - - var actualDataKeyDescription := ddbEncResources.GetEncryptedDataKeyDescription(inputVariable); - - expect UTF8.Decode(expectedHead.dataKeys[0].keyProviderId).Success?; - expect UTF8.Decode(expectedHead.dataKeys[0].keyProviderInfo).Success?; - expect actualDataKeyDescription.Success?; - expect |actualDataKeyDescription.Extract().EncryptedDataKeyDescriptionOutput| > 0; - - expect |actualDataKeyDescription.Extract().EncryptedDataKeyDescriptionOutput| == |expectedHead.dataKeys|; - expect actualDataKeyDescription.Extract().EncryptedDataKeyDescriptionOutput[0].keyProviderId == UTF8.Decode(expectedHead.dataKeys[0].keyProviderId).Extract(); - - expect actualDataKeyDescription.Extract().EncryptedDataKeyDescriptionOutput[0].keyProviderInfo.Some?; - expect actualDataKeyDescription.Extract().EncryptedDataKeyDescriptionOutput[0].keyProviderInfo.Extract() == UTF8.Decode(expectedHead.dataKeys[0].keyProviderInfo).Extract(); - - if actualDataKeyDescription.Extract().EncryptedDataKeyDescriptionOutput[0].keyProviderId == "aws-kms-hierarchy" { - expect actualDataKeyDescription.Extract().EncryptedDataKeyDescriptionOutput[0].branchKeyId.Some?; - expect actualDataKeyDescription.Extract().EncryptedDataKeyDescriptionOutput[0].branchKeyVersion.Some?; - - expect actualDataKeyDescription.Extract().EncryptedDataKeyDescriptionOutput[0].branchKeyId.Extract() == UTF8.Decode(expectedHead.dataKeys[0].keyProviderInfo).Extract(); - expect actualDataKeyDescription.Extract().EncryptedDataKeyDescriptionOutput[0].branchKeyVersion.Extract() == expectedBranchKeyVersion; - } - } + var actualDataKeyDescription := ddbEncResources.GetEncryptedDataKeyDescription(inputVariable); - method {:test} TestDDBItemInputRawRsaDataKeyCase() - { - var expectedHead := CreatePartialHeader(testVersion, testFlavor, testMsgID, testLegend, testEncContext, [testRawRsaDataKey]); - var serializedHeader := expectedHead.serialize() + expectedHead.msgID; + expect UTF8.Decode(expectedHead.dataKeys[0].keyProviderId).Success?; + expect UTF8.Decode(expectedHead.dataKeys[0].keyProviderInfo).Success?; + expect actualDataKeyDescription.Success?; + expect |actualDataKeyDescription.Extract().EncryptedDataKeyDescriptionOutput| > 0; - var attr := map["aws_dbe_head" := ComAmazonawsDynamodbTypes.AttributeValue.B(serializedHeader)]; - var ddbEncResources :- expect DynamoDbEncryption.DynamoDbEncryption(); - + expect |actualDataKeyDescription.Extract().EncryptedDataKeyDescriptionOutput| == |expectedHead.dataKeys|; + expect actualDataKeyDescription.Extract().EncryptedDataKeyDescriptionOutput[0].keyProviderId == UTF8.Decode(expectedHead.dataKeys[0].keyProviderId).Extract(); - var inputVariable: Types.GetEncryptedDataKeyDescriptionInput := - Types.GetEncryptedDataKeyDescriptionInput( - input := Types.plaintextItem(plaintextItem := attr) - ); + expect actualDataKeyDescription.Extract().EncryptedDataKeyDescriptionOutput[0].keyProviderInfo.Some?; + expect actualDataKeyDescription.Extract().EncryptedDataKeyDescriptionOutput[0].keyProviderInfo.Extract() == UTF8.Decode(expectedHead.dataKeys[0].keyProviderInfo).Extract(); + } - var actualDataKeyDescription := ddbEncResources.GetEncryptedDataKeyDescription(inputVariable); - - expect UTF8.Decode(expectedHead.dataKeys[0].keyProviderId).Success?; - expect UTF8.Decode(expectedHead.dataKeys[0].keyProviderInfo).Success?; - expect actualDataKeyDescription.Success?; - expect |actualDataKeyDescription.Extract().EncryptedDataKeyDescriptionOutput| > 0; - expect |actualDataKeyDescription.Extract().EncryptedDataKeyDescriptionOutput| == |expectedHead.dataKeys|; - expect actualDataKeyDescription.Extract().EncryptedDataKeyDescriptionOutput[0].keyProviderId == UTF8.Decode(expectedHead.dataKeys[0].keyProviderId).Extract(); + method {:test} TestDDBItemInputAwsKmsDataKeyCase() + { + var expectedHead := CreatePartialHeader(testVersion, testFlavor, testMsgID, testLegend, testEncContext, [testAwsKmsDataKey]); + var serializedHeader := expectedHead.serialize() + expectedHead.msgID; - expect actualDataKeyDescription.Extract().EncryptedDataKeyDescriptionOutput[0].keyProviderInfo.Some?; - expect actualDataKeyDescription.Extract().EncryptedDataKeyDescriptionOutput[0].keyProviderInfo.Extract() == UTF8.Decode(expectedHead.dataKeys[0].keyProviderInfo).Extract(); - } + var attr := map["aws_dbe_head" := ComAmazonawsDynamodbTypes.AttributeValue.B(serializedHeader)]; + var ddbEncResources :- expect DynamoDbEncryption.DynamoDbEncryption(); - method {:test} TestDDBItemInputAwsKmsRsaDataKeyCase() - { - var expectedHead := CreatePartialHeader(testVersion, testFlavor, testMsgID, testLegend, testEncContext, [testAwsKmsRsaDataKey]); - var serializedHeader := expectedHead.serialize() + expectedHead.msgID; + var inputVariable: Types.GetEncryptedDataKeyDescriptionInput := + Types.GetEncryptedDataKeyDescriptionInput( + input := Types.plaintextItem(plaintextItem := attr) + ); - var attr := map["aws_dbe_head" := ComAmazonawsDynamodbTypes.AttributeValue.B(serializedHeader)]; - var ddbEncResources :- expect DynamoDbEncryption.DynamoDbEncryption(); - + var actualDataKeyDescription := ddbEncResources.GetEncryptedDataKeyDescription(inputVariable); - var inputVariable: Types.GetEncryptedDataKeyDescriptionInput := - Types.GetEncryptedDataKeyDescriptionInput( - input := Types.plaintextItem(plaintextItem := attr) - ); + expect UTF8.Decode(expectedHead.dataKeys[0].keyProviderId).Success?; + expect UTF8.Decode(expectedHead.dataKeys[0].keyProviderInfo).Success?; + expect actualDataKeyDescription.Success?; + expect |actualDataKeyDescription.Extract().EncryptedDataKeyDescriptionOutput| > 0; - var actualDataKeyDescription := ddbEncResources.GetEncryptedDataKeyDescription(inputVariable); - - expect UTF8.Decode(expectedHead.dataKeys[0].keyProviderId).Success?; - expect UTF8.Decode(expectedHead.dataKeys[0].keyProviderInfo).Success?; - expect actualDataKeyDescription.Success?; - expect |actualDataKeyDescription.Extract().EncryptedDataKeyDescriptionOutput| > 0; + expect |actualDataKeyDescription.Extract().EncryptedDataKeyDescriptionOutput| == |expectedHead.dataKeys|; + expect actualDataKeyDescription.Extract().EncryptedDataKeyDescriptionOutput[0].keyProviderId == UTF8.Decode(expectedHead.dataKeys[0].keyProviderId).Extract(); - expect |actualDataKeyDescription.Extract().EncryptedDataKeyDescriptionOutput| == |expectedHead.dataKeys|; - expect actualDataKeyDescription.Extract().EncryptedDataKeyDescriptionOutput[0].keyProviderId == UTF8.Decode(expectedHead.dataKeys[0].keyProviderId).Extract(); + expect actualDataKeyDescription.Extract().EncryptedDataKeyDescriptionOutput[0].keyProviderInfo.Some?; + expect actualDataKeyDescription.Extract().EncryptedDataKeyDescriptionOutput[0].keyProviderInfo.Extract() == UTF8.Decode(expectedHead.dataKeys[0].keyProviderInfo).Extract(); + } - expect actualDataKeyDescription.Extract().EncryptedDataKeyDescriptionOutput[0].keyProviderInfo.Some?; - expect actualDataKeyDescription.Extract().EncryptedDataKeyDescriptionOutput[0].keyProviderInfo.Extract() == UTF8.Decode(expectedHead.dataKeys[0].keyProviderInfo).Extract(); - } + method {:test} TestDDBItemInputAwsKmsHDataKeyCase() + { + var expectedHead := CreatePartialHeader(testVersion, testFlavor, testMsgID, testLegend, testEncContext, [testAwsKmsHDataKey]); + var serializedHeader := expectedHead.serialize() + expectedHead.msgID; + + var expectedBranchKeyVersion := getBranchKeyVersion(expectedHead); + var attr := map["aws_dbe_head" := ComAmazonawsDynamodbTypes.AttributeValue.B(serializedHeader)]; + var ddbEncResources :- expect DynamoDbEncryption.DynamoDbEncryption(); - method getBranchKeyVersion (expectedHead : PartialHeader) - returns (expectedBranchKeyVersion : string) - { - expect EdkWrapping.GetProviderWrappedMaterial(expectedHead.dataKeys[0].ciphertext, algorithmSuite).Success?; - var providerWrappedMaterial := EdkWrapping.GetProviderWrappedMaterial(expectedHead.dataKeys[0].ciphertext, algorithmSuite).Extract(); - - expect |providerWrappedMaterial| >= (28 + 16); + var inputVariable: Types.GetEncryptedDataKeyDescriptionInput := + Types.GetEncryptedDataKeyDescriptionInput( + input := Types.plaintextItem(plaintextItem := attr) + ); - var expectedBranchKeyVersionResult := UUID.FromByteArray(providerWrappedMaterial[28 .. (28 + 16)]); + var actualDataKeyDescription := ddbEncResources.GetEncryptedDataKeyDescription(inputVariable); - expect expectedBranchKeyVersionResult.Success?; + expect UTF8.Decode(expectedHead.dataKeys[0].keyProviderId).Success?; + expect UTF8.Decode(expectedHead.dataKeys[0].keyProviderInfo).Success?; + expect actualDataKeyDescription.Success?; + expect |actualDataKeyDescription.Extract().EncryptedDataKeyDescriptionOutput| > 0; - expectedBranchKeyVersion := expectedBranchKeyVersionResult.Extract(); + expect |actualDataKeyDescription.Extract().EncryptedDataKeyDescriptionOutput| == |expectedHead.dataKeys|; + expect actualDataKeyDescription.Extract().EncryptedDataKeyDescriptionOutput[0].keyProviderId == UTF8.Decode(expectedHead.dataKeys[0].keyProviderId).Extract(); + + expect actualDataKeyDescription.Extract().EncryptedDataKeyDescriptionOutput[0].keyProviderInfo.Some?; + expect actualDataKeyDescription.Extract().EncryptedDataKeyDescriptionOutput[0].keyProviderInfo.Extract() == UTF8.Decode(expectedHead.dataKeys[0].keyProviderInfo).Extract(); + + if actualDataKeyDescription.Extract().EncryptedDataKeyDescriptionOutput[0].keyProviderId == "aws-kms-hierarchy" { + expect actualDataKeyDescription.Extract().EncryptedDataKeyDescriptionOutput[0].branchKeyId.Some?; + expect actualDataKeyDescription.Extract().EncryptedDataKeyDescriptionOutput[0].branchKeyVersion.Some?; + + expect actualDataKeyDescription.Extract().EncryptedDataKeyDescriptionOutput[0].branchKeyId.Extract() == UTF8.Decode(expectedHead.dataKeys[0].keyProviderInfo).Extract(); + expect actualDataKeyDescription.Extract().EncryptedDataKeyDescriptionOutput[0].branchKeyVersion.Extract() == expectedBranchKeyVersion; } + } + + method {:test} TestDDBItemInputRawRsaDataKeyCase() + { + var expectedHead := CreatePartialHeader(testVersion, testFlavor, testMsgID, testLegend, testEncContext, [testRawRsaDataKey]); + var serializedHeader := expectedHead.serialize() + expectedHead.msgID; + + var attr := map["aws_dbe_head" := ComAmazonawsDynamodbTypes.AttributeValue.B(serializedHeader)]; + var ddbEncResources :- expect DynamoDbEncryption.DynamoDbEncryption(); + + + var inputVariable: Types.GetEncryptedDataKeyDescriptionInput := + Types.GetEncryptedDataKeyDescriptionInput( + input := Types.plaintextItem(plaintextItem := attr) + ); + + var actualDataKeyDescription := ddbEncResources.GetEncryptedDataKeyDescription(inputVariable); + + expect UTF8.Decode(expectedHead.dataKeys[0].keyProviderId).Success?; + expect UTF8.Decode(expectedHead.dataKeys[0].keyProviderInfo).Success?; + expect actualDataKeyDescription.Success?; + expect |actualDataKeyDescription.Extract().EncryptedDataKeyDescriptionOutput| > 0; + + expect |actualDataKeyDescription.Extract().EncryptedDataKeyDescriptionOutput| == |expectedHead.dataKeys|; + expect actualDataKeyDescription.Extract().EncryptedDataKeyDescriptionOutput[0].keyProviderId == UTF8.Decode(expectedHead.dataKeys[0].keyProviderId).Extract(); + + expect actualDataKeyDescription.Extract().EncryptedDataKeyDescriptionOutput[0].keyProviderInfo.Some?; + expect actualDataKeyDescription.Extract().EncryptedDataKeyDescriptionOutput[0].keyProviderInfo.Extract() == UTF8.Decode(expectedHead.dataKeys[0].keyProviderInfo).Extract(); + } + + method {:test} TestDDBItemInputAwsKmsRsaDataKeyCase() + { + var expectedHead := CreatePartialHeader(testVersion, testFlavor, testMsgID, testLegend, testEncContext, [testAwsKmsRsaDataKey]); + var serializedHeader := expectedHead.serialize() + expectedHead.msgID; + + var attr := map["aws_dbe_head" := ComAmazonawsDynamodbTypes.AttributeValue.B(serializedHeader)]; + var ddbEncResources :- expect DynamoDbEncryption.DynamoDbEncryption(); + + + var inputVariable: Types.GetEncryptedDataKeyDescriptionInput := + Types.GetEncryptedDataKeyDescriptionInput( + input := Types.plaintextItem(plaintextItem := attr) + ); + + var actualDataKeyDescription := ddbEncResources.GetEncryptedDataKeyDescription(inputVariable); + + expect UTF8.Decode(expectedHead.dataKeys[0].keyProviderId).Success?; + expect UTF8.Decode(expectedHead.dataKeys[0].keyProviderInfo).Success?; + expect actualDataKeyDescription.Success?; + expect |actualDataKeyDescription.Extract().EncryptedDataKeyDescriptionOutput| > 0; + + expect |actualDataKeyDescription.Extract().EncryptedDataKeyDescriptionOutput| == |expectedHead.dataKeys|; + expect actualDataKeyDescription.Extract().EncryptedDataKeyDescriptionOutput[0].keyProviderId == UTF8.Decode(expectedHead.dataKeys[0].keyProviderId).Extract(); + + expect actualDataKeyDescription.Extract().EncryptedDataKeyDescriptionOutput[0].keyProviderInfo.Some?; + expect actualDataKeyDescription.Extract().EncryptedDataKeyDescriptionOutput[0].keyProviderInfo.Extract() == UTF8.Decode(expectedHead.dataKeys[0].keyProviderInfo).Extract(); + } + + method getBranchKeyVersion (expectedHead : PartialHeader) + returns (expectedBranchKeyVersion : string) + { + expect EdkWrapping.GetProviderWrappedMaterial(expectedHead.dataKeys[0].ciphertext, algorithmSuite).Success?; + var providerWrappedMaterial := EdkWrapping.GetProviderWrappedMaterial(expectedHead.dataKeys[0].ciphertext, algorithmSuite).Extract(); + + expect |providerWrappedMaterial| >= (28 + 16); + + var expectedBranchKeyVersionResult := UUID.FromByteArray(providerWrappedMaterial[28 .. (28 + 16)]); + + expect expectedBranchKeyVersionResult.Success?; + + expectedBranchKeyVersion := expectedBranchKeyVersionResult.Extract(); + } } From 9fc726f3580a56b7e23e5af8ecf8b56407f2c59d Mon Sep 17 00:00:00 2001 From: rishav-karanjit Date: Wed, 27 Mar 2024 11:30:39 -0700 Subject: [PATCH 20/67] Add copyright and license in the comments --- .../test/DynamoDbGetEncryptedDataKeyDescriptionTest.dfy | 2 ++ 1 file changed, 2 insertions(+) diff --git a/DynamoDbEncryption/dafny/DynamoDbEncryption/test/DynamoDbGetEncryptedDataKeyDescriptionTest.dfy b/DynamoDbEncryption/dafny/DynamoDbEncryption/test/DynamoDbGetEncryptedDataKeyDescriptionTest.dfy index 6172e3840..7871723c1 100644 --- a/DynamoDbEncryption/dafny/DynamoDbEncryption/test/DynamoDbGetEncryptedDataKeyDescriptionTest.dfy +++ b/DynamoDbEncryption/dafny/DynamoDbEncryption/test/DynamoDbGetEncryptedDataKeyDescriptionTest.dfy @@ -1,3 +1,5 @@ +// Copyright Amazon.com Inc. or its affiliates. All Rights Reserved. +// SPDX-License-Identifier: Apache-2.0 include "../src/Index.dfy" module DynamoDbGetEncryptedDataKeyDescriptionTest { From 0ebcbe33d81023c289ce9dc778337d6975f02520 Mon Sep 17 00:00:00 2001 From: rishav-karanjit Date: Wed, 27 Mar 2024 19:45:18 -0700 Subject: [PATCH 21/67] Add dotnet example --- Examples/runtimes/net/src/Examples.cs | 1 + .../GetEncryptedDataKeyDescriptionExample.cs | 68 +++++++++++++++++++ 2 files changed, 69 insertions(+) create mode 100644 Examples/runtimes/net/src/GetEncryptedDataKeyDescriptionExample.cs diff --git a/Examples/runtimes/net/src/Examples.cs b/Examples/runtimes/net/src/Examples.cs index f4a84288d..64ed261b4 100644 --- a/Examples/runtimes/net/src/Examples.cs +++ b/Examples/runtimes/net/src/Examples.cs @@ -12,6 +12,7 @@ static async Task Main() ItemEncryptDecryptExample.PutItemGetItem(); await BasicPutGetExample.PutItemGetItem(); + await GetEncryptedDataKeyDescriptionExample.GetEncryptedDataKeyDescription(); await MultiPutGetExample.MultiPutGet(); await ClientSupplierExample.ClientSupplierPutItemGetItem(); await MultiMrkKeyringExample.MultiMrkKeyringGetItemPutItem(); diff --git a/Examples/runtimes/net/src/GetEncryptedDataKeyDescriptionExample.cs b/Examples/runtimes/net/src/GetEncryptedDataKeyDescriptionExample.cs new file mode 100644 index 000000000..0701bd4b8 --- /dev/null +++ b/Examples/runtimes/net/src/GetEncryptedDataKeyDescriptionExample.cs @@ -0,0 +1,68 @@ +using System; +using System.Diagnostics; +using System.Net; +using System.Threading.Tasks; +using System.Collections.Generic; +using Amazon.DynamoDBv2.Model; +using AWS.Cryptography.DbEncryptionSDK.DynamoDb; + +public class GetEncryptedDataKeyDescriptionExample +{ + public static async Task GetEncryptedDataKeyDescription() + { + var kmsKeyId = TestUtils.TEST_KMS_KEY_ID; + var ddbTableName = TestUtils.TEST_DDB_TABLE_NAME; + + var ddbEnc = new DynamoDbEncryption(new DynamoDbEncryptionConfig()); + + string header_column = "aws_dbe_head"; + + var keyToGet = new Dictionary + { + ["partition_key"] = new AttributeValue("BasicPutGetExample"), + ["sort_key"] = new AttributeValue { N = "0" }, + }; + + // 4. Create the DynamoDb Encryption configuration for the table we will be writing to. + Dictionary tableConfigs = + new Dictionary(); + DynamoDbTableEncryptionConfig config = new DynamoDbTableEncryptionConfig + { + LogicalTableName = ddbTableName, + PartitionKeyName = "partition_key", + SortKeyName = "sort_key", + }; + tableConfigs.Add(ddbTableName, config); + + // 5. Create a new AWS SDK DynamoDb client using the TableEncryptionConfigs + var ddb = new Client.DynamoDbClient( + new DynamoDbTablesEncryptionConfig { TableEncryptionConfigs = tableConfigs }); + + GetItemRequest getRequest = new GetItemRequest + { + Key = keyToGet, + TableName = ddbTableName, + }; + + GetItemResponse getResponse = await ddb.GetItemAsync(getRequest); + + Debug.Assert(getResponse.HttpStatusCode == HttpStatusCode.OK); + var returnedItem = getResponse.Item; + + GetEncryptedDataKeyDescriptionUnion InputUnion = new GetEncryptedDataKeyDescriptionUnion(); + + InputUnion.Header = returnedItem[header_column].B; + + GetEncryptedDataKeyDescriptionInput Input = new GetEncryptedDataKeyDescriptionInput(); + + Input.Input = InputUnion; + + GetEncryptedDataKeyDescriptionOutput output = ddbEnc.GetEncryptedDataKeyDescription(Input); + + var encryptedDataKeyDescriptions = output.EncryptedDataKeyDescriptionOutput; + + Debug.Assert(encryptedDataKeyDescriptions[0].KeyProviderId == "aws-kms"); + Debug.Assert(encryptedDataKeyDescriptions[0].KeyProviderId == kmsKeyId); + } +} + From f1a00518a99936a5cf54fb8f7eed755842a48237 Mon Sep 17 00:00:00 2001 From: rishav-karanjit Date: Wed, 27 Mar 2024 20:08:25 -0700 Subject: [PATCH 22/67] format code --- ...yptographyDbEncryptionSdkDynamoDbTypes.dfy | 1192 ++++++++--------- 1 file changed, 596 insertions(+), 596 deletions(-) diff --git a/DynamoDbEncryption/dafny/DynamoDbEncryption/Model/AwsCryptographyDbEncryptionSdkDynamoDbTypes.dfy b/DynamoDbEncryption/dafny/DynamoDbEncryption/Model/AwsCryptographyDbEncryptionSdkDynamoDbTypes.dfy index 1f40fd366..8b63080d9 100644 --- a/DynamoDbEncryption/dafny/DynamoDbEncryption/Model/AwsCryptographyDbEncryptionSdkDynamoDbTypes.dfy +++ b/DynamoDbEncryption/dafny/DynamoDbEncryption/Model/AwsCryptographyDbEncryptionSdkDynamoDbTypes.dfy @@ -2,612 +2,612 @@ // SPDX-License-Identifier: Apache-2.0 // Do not modify this file. This file is machine generated, and any changes to it will be overwritten. include "../../../../submodules/MaterialProviders/StandardLibrary/src/Index.dfy" - include "../../StructuredEncryption/src/Index.dfy" - include "../../../../submodules/MaterialProviders/AwsCryptographicMaterialProviders/dafny/AwsCryptographicMaterialProviders/src/Index.dfy" - include "../../../../submodules/MaterialProviders/AwsCryptographicMaterialProviders/dafny/AwsCryptographyKeyStore/src/Index.dfy" - include "../../../../submodules/MaterialProviders/AwsCryptographyPrimitives/src/Index.dfy" - include "../../../../submodules/MaterialProviders/ComAmazonawsDynamodb/src/Index.dfy" - module {:extern "software.amazon.cryptography.dbencryptionsdk.dynamodb.internaldafny.types" } AwsCryptographyDbEncryptionSdkDynamoDbTypes - { - import opened Wrappers - import opened StandardLibrary.UInt - import opened UTF8 - import AwsCryptographyDbEncryptionSdkStructuredEncryptionTypes - import AwsCryptographyMaterialProvidersTypes - import AwsCryptographyKeyStoreTypes - import AwsCryptographyPrimitivesTypes - import ComAmazonawsDynamodbTypes - // Generic helpers for verification of mock/unit tests. - datatype DafnyCallEvent = DafnyCallEvent(input: I, output: O) - - // Begin Generated Types - - datatype AsSet = | AsSet ( - - ) - type AttributeActions = map - type BeaconBitLength = x: int32 | IsValid_BeaconBitLength(x) witness * - predicate method IsValid_BeaconBitLength(x: int32) { - ( 1 <= x <= 63 ) -} - datatype BeaconKeySource = - | single(single: SingleKeyStore) - | multi(multi: MultiKeyStore) - datatype BeaconStyle = - | partOnly(partOnly: PartOnly) - | shared(shared: Shared) - | asSet(asSet: AsSet) - | sharedSet(sharedSet: SharedSet) - datatype BeaconVersion = | BeaconVersion ( - nameonly version: VersionNumber , - nameonly keyStore: AwsCryptographyKeyStoreTypes.IKeyStoreClient , - nameonly keySource: BeaconKeySource , - nameonly standardBeacons: StandardBeaconList , - nameonly compoundBeacons: Option := Option.None , - nameonly virtualFields: Option := Option.None , - nameonly encryptedParts: Option := Option.None , - nameonly signedParts: Option := Option.None - ) - type BeaconVersionList = x: seq | IsValid_BeaconVersionList(x) witness * - predicate method IsValid_BeaconVersionList(x: seq) { - ( 1 <= |x| <= 1 ) -} - type Char = x: string | IsValid_Char(x) witness * - predicate method IsValid_Char(x: string) { - ( 1 <= |x| <= 1 ) -} - datatype CompoundBeacon = | CompoundBeacon ( - nameonly name: string , - nameonly split: Char , - nameonly encrypted: Option := Option.None , - nameonly signed: Option := Option.None , - nameonly constructors: Option := Option.None - ) - type CompoundBeaconList = x: seq | IsValid_CompoundBeaconList(x) witness * - predicate method IsValid_CompoundBeaconList(x: seq) { - ( 1 <= |x| ) -} - datatype Constructor = | Constructor ( - nameonly parts: ConstructorPartList - ) - type ConstructorList = x: seq | IsValid_ConstructorList(x) witness * - predicate method IsValid_ConstructorList(x: seq) { - ( 1 <= |x| ) -} - datatype ConstructorPart = | ConstructorPart ( - nameonly name: string , - nameonly required: bool - ) - type ConstructorPartList = x: seq | IsValid_ConstructorPartList(x) witness * - predicate method IsValid_ConstructorPartList(x: seq) { - ( 1 <= |x| ) -} - datatype CreateDynamoDbEncryptionBranchKeyIdSupplierInput = | CreateDynamoDbEncryptionBranchKeyIdSupplierInput ( - nameonly ddbKeyBranchKeyIdSupplier: IDynamoDbKeyBranchKeyIdSupplier - ) - datatype CreateDynamoDbEncryptionBranchKeyIdSupplierOutput = | CreateDynamoDbEncryptionBranchKeyIdSupplierOutput ( - nameonly branchKeyIdSupplier: AwsCryptographyMaterialProvidersTypes.IBranchKeyIdSupplier - ) - class IDynamoDbEncryptionClientCallHistory { - ghost constructor() { - CreateDynamoDbEncryptionBranchKeyIdSupplier := []; - GetEncryptedDataKeyDescription := []; -} - ghost var CreateDynamoDbEncryptionBranchKeyIdSupplier: seq>> - ghost var GetEncryptedDataKeyDescription: seq>> -} - trait {:termination false} IDynamoDbEncryptionClient - { - // Helper to define any additional modifies/reads clauses. - // If your operations need to mutate state, - // add it in your constructor function: - // Modifies := {your, fields, here, History}; - // If you do not need to mutate anything: -// Modifies := {History}; +include "../../StructuredEncryption/src/Index.dfy" +include "../../../../submodules/MaterialProviders/AwsCryptographicMaterialProviders/dafny/AwsCryptographicMaterialProviders/src/Index.dfy" +include "../../../../submodules/MaterialProviders/AwsCryptographicMaterialProviders/dafny/AwsCryptographyKeyStore/src/Index.dfy" +include "../../../../submodules/MaterialProviders/AwsCryptographyPrimitives/src/Index.dfy" +include "../../../../submodules/MaterialProviders/ComAmazonawsDynamodb/src/Index.dfy" +module {:extern "software.amazon.cryptography.dbencryptionsdk.dynamodb.internaldafny.types" } AwsCryptographyDbEncryptionSdkDynamoDbTypes +{ + import opened Wrappers + import opened StandardLibrary.UInt + import opened UTF8 + import AwsCryptographyDbEncryptionSdkStructuredEncryptionTypes + import AwsCryptographyMaterialProvidersTypes + import AwsCryptographyKeyStoreTypes + import AwsCryptographyPrimitivesTypes + import ComAmazonawsDynamodbTypes + // Generic helpers for verification of mock/unit tests. + datatype DafnyCallEvent = DafnyCallEvent(input: I, output: O) - ghost const Modifies: set - // For an unassigned field defined in a trait, - // Dafny can only assign a value in the constructor. - // This means that for Dafny to reason about this value, - // it needs some way to know (an invariant), - // about the state of the object. - // This builds on the Valid/Repr paradigm - // To make this kind requires safe to add - // to methods called from unverified code, - // the predicate MUST NOT take any arguments. - // This means that the correctness of this requires - // MUST only be evaluated by the class itself. - // If you require any additional mutation, - // then you MUST ensure everything you need in ValidState. - // You MUST also ensure ValidState in your constructor. - predicate ValidState() - ensures ValidState() ==> History in Modifies - ghost const History: IDynamoDbEncryptionClientCallHistory - predicate CreateDynamoDbEncryptionBranchKeyIdSupplierEnsuresPublicly(input: CreateDynamoDbEncryptionBranchKeyIdSupplierInput , output: Result) - // The public method to be called by library consumers - method CreateDynamoDbEncryptionBranchKeyIdSupplier ( input: CreateDynamoDbEncryptionBranchKeyIdSupplierInput ) - returns (output: Result) - requires - && ValidState() - && input.ddbKeyBranchKeyIdSupplier.ValidState() - && input.ddbKeyBranchKeyIdSupplier.Modifies !! {History} - modifies Modifies - {History} , - input.ddbKeyBranchKeyIdSupplier.Modifies , - History`CreateDynamoDbEncryptionBranchKeyIdSupplier - // Dafny will skip type parameters when generating a default decreases clause. - decreases Modifies - {History} , - input.ddbKeyBranchKeyIdSupplier.Modifies - ensures - && ValidState() - && ( output.Success? ==> - && output.value.branchKeyIdSupplier.ValidState() - && output.value.branchKeyIdSupplier.Modifies !! {History} - && fresh(output.value.branchKeyIdSupplier) - && fresh ( output.value.branchKeyIdSupplier.Modifies - Modifies - {History} - input.ddbKeyBranchKeyIdSupplier.Modifies ) ) - ensures CreateDynamoDbEncryptionBranchKeyIdSupplierEnsuresPublicly(input, output) - ensures History.CreateDynamoDbEncryptionBranchKeyIdSupplier == old(History.CreateDynamoDbEncryptionBranchKeyIdSupplier) + [DafnyCallEvent(input, output)] - - predicate GetEncryptedDataKeyDescriptionEnsuresPublicly(input: GetEncryptedDataKeyDescriptionInput , output: Result) - // The public method to be called by library consumers - method GetEncryptedDataKeyDescription ( input: GetEncryptedDataKeyDescriptionInput ) - returns (output: Result) - requires - && ValidState() - modifies Modifies - {History} , - History`GetEncryptedDataKeyDescription - // Dafny will skip type parameters when generating a default decreases clause. - decreases Modifies - {History} - ensures - && ValidState() - ensures GetEncryptedDataKeyDescriptionEnsuresPublicly(input, output) - ensures History.GetEncryptedDataKeyDescription == old(History.GetEncryptedDataKeyDescription) + [DafnyCallEvent(input, output)] - -} - datatype DynamoDbEncryptionConfig = | DynamoDbEncryptionConfig ( - - ) - class IDynamoDbKeyBranchKeyIdSupplierCallHistory { - ghost constructor() { - GetBranchKeyIdFromDdbKey := []; -} - ghost var GetBranchKeyIdFromDdbKey: seq>> -} - trait {:termination false} IDynamoDbKeyBranchKeyIdSupplier - { - // Helper to define any additional modifies/reads clauses. - // If your operations need to mutate state, - // add it in your constructor function: - // Modifies := {your, fields, here, History}; - // If you do not need to mutate anything: -// Modifies := {History}; + // Begin Generated Types - ghost const Modifies: set - // For an unassigned field defined in a trait, - // Dafny can only assign a value in the constructor. - // This means that for Dafny to reason about this value, - // it needs some way to know (an invariant), - // about the state of the object. - // This builds on the Valid/Repr paradigm - // To make this kind requires safe to add - // to methods called from unverified code, - // the predicate MUST NOT take any arguments. - // This means that the correctness of this requires - // MUST only be evaluated by the class itself. - // If you require any additional mutation, - // then you MUST ensure everything you need in ValidState. - // You MUST also ensure ValidState in your constructor. - predicate ValidState() - ensures ValidState() ==> History in Modifies - ghost const History: IDynamoDbKeyBranchKeyIdSupplierCallHistory - predicate GetBranchKeyIdFromDdbKeyEnsuresPublicly(input: GetBranchKeyIdFromDdbKeyInput , output: Result) - // The public method to be called by library consumers - method GetBranchKeyIdFromDdbKey ( input: GetBranchKeyIdFromDdbKeyInput ) - returns (output: Result) - requires - && ValidState() - modifies Modifies - {History} , - History`GetBranchKeyIdFromDdbKey - // Dafny will skip type parameters when generating a default decreases clause. - decreases Modifies - {History} - ensures - && ValidState() - ensures GetBranchKeyIdFromDdbKeyEnsuresPublicly(input, output) - ensures History.GetBranchKeyIdFromDdbKey == old(History.GetBranchKeyIdFromDdbKey) + [DafnyCallEvent(input, output)] - { - output := GetBranchKeyIdFromDdbKey' (input); - History.GetBranchKeyIdFromDdbKey := History.GetBranchKeyIdFromDdbKey + [DafnyCallEvent(input, output)]; -} - // The method to implement in the concrete class. - method GetBranchKeyIdFromDdbKey' ( input: GetBranchKeyIdFromDdbKeyInput ) - returns (output: Result) - requires - && ValidState() - modifies Modifies - {History} - // Dafny will skip type parameters when generating a default decreases clause. - decreases Modifies - {History} - ensures - && ValidState() - ensures GetBranchKeyIdFromDdbKeyEnsuresPublicly(input, output) - ensures unchanged(History) - -} - datatype DynamoDbTableEncryptionConfig = | DynamoDbTableEncryptionConfig ( - nameonly logicalTableName: string , - nameonly partitionKeyName: ComAmazonawsDynamodbTypes.KeySchemaAttributeName , - nameonly sortKeyName: Option := Option.None , - nameonly search: Option := Option.None , - nameonly attributeActionsOnEncrypt: AttributeActions , - nameonly allowedUnsignedAttributes: Option := Option.None , - nameonly allowedUnsignedAttributePrefix: Option := Option.None , - nameonly algorithmSuiteId: Option := Option.None , - nameonly keyring: Option := Option.None , - nameonly cmm: Option := Option.None , - nameonly legacyOverride: Option := Option.None , - nameonly plaintextOverride: Option := Option.None - ) - type DynamoDbTableEncryptionConfigList = map - datatype DynamoDbTablesEncryptionConfig = | DynamoDbTablesEncryptionConfig ( - nameonly tableEncryptionConfigs: DynamoDbTableEncryptionConfigList - ) - type EncryptedDataKeyDescriptionList = seq - datatype EncryptedDataKeyDescriptionOutput = | EncryptedDataKeyDescriptionOutput ( - nameonly keyProviderId: string , - nameonly keyProviderInfo: Option := Option.None , - nameonly branchKeyId: Option := Option.None , - nameonly branchKeyVersion: Option := Option.None - ) - datatype EncryptedPart = | EncryptedPart ( - nameonly name: string , - nameonly prefix: Prefix - ) - type EncryptedPartsList = x: seq | IsValid_EncryptedPartsList(x) witness * - predicate method IsValid_EncryptedPartsList(x: seq) { - ( 1 <= |x| ) -} - datatype GetBranchKeyIdFromDdbKeyInput = | GetBranchKeyIdFromDdbKeyInput ( - nameonly ddbKey: ComAmazonawsDynamodbTypes.Key - ) - datatype GetBranchKeyIdFromDdbKeyOutput = | GetBranchKeyIdFromDdbKeyOutput ( - nameonly branchKeyId: string - ) - datatype GetEncryptedDataKeyDescriptionInput = | GetEncryptedDataKeyDescriptionInput ( - nameonly input: GetEncryptedDataKeyDescriptionUnion - ) - datatype GetEncryptedDataKeyDescriptionOutput = | GetEncryptedDataKeyDescriptionOutput ( - nameonly EncryptedDataKeyDescriptionOutput: EncryptedDataKeyDescriptionList - ) - datatype GetEncryptedDataKeyDescriptionUnion = - | header(header: seq) - | plaintextItem(plaintextItem: ComAmazonawsDynamodbTypes.AttributeMap) - datatype GetPrefix = | GetPrefix ( - nameonly length: int32 - ) - datatype GetSegment = | GetSegment ( - nameonly split: Char , - nameonly index: int32 - ) - datatype GetSegments = | GetSegments ( - nameonly split: Char , - nameonly low: int32 , - nameonly high: int32 - ) - datatype GetSubstring = | GetSubstring ( - nameonly low: int32 , - nameonly high: int32 - ) - datatype GetSuffix = | GetSuffix ( - nameonly length: int32 - ) - datatype Insert = | Insert ( - nameonly literal: string - ) - class ILegacyDynamoDbEncryptorCallHistory { - ghost constructor() { - -} - -} - trait {:termination false} ILegacyDynamoDbEncryptor - { - // Helper to define any additional modifies/reads clauses. - // If your operations need to mutate state, - // add it in your constructor function: - // Modifies := {your, fields, here, History}; - // If you do not need to mutate anything: -// Modifies := {History}; + datatype AsSet = | AsSet ( - ghost const Modifies: set - // For an unassigned field defined in a trait, - // Dafny can only assign a value in the constructor. - // This means that for Dafny to reason about this value, - // it needs some way to know (an invariant), - // about the state of the object. - // This builds on the Valid/Repr paradigm - // To make this kind requires safe to add - // to methods called from unverified code, - // the predicate MUST NOT take any arguments. - // This means that the correctness of this requires - // MUST only be evaluated by the class itself. - // If you require any additional mutation, - // then you MUST ensure everything you need in ValidState. - // You MUST also ensure ValidState in your constructor. - predicate ValidState() - ensures ValidState() ==> History in Modifies - ghost const History: ILegacyDynamoDbEncryptorCallHistory - -} - datatype LegacyOverride = | LegacyOverride ( - nameonly policy: LegacyPolicy , - nameonly encryptor: ILegacyDynamoDbEncryptor , - nameonly attributeActionsOnEncrypt: AttributeActions , - nameonly defaultAttributeFlag: Option := Option.None - ) - datatype LegacyPolicy = - | FORCE_LEGACY_ENCRYPT_ALLOW_LEGACY_DECRYPT - | FORBID_LEGACY_ENCRYPT_ALLOW_LEGACY_DECRYPT - | FORBID_LEGACY_ENCRYPT_FORBID_LEGACY_DECRYPT - datatype Lower = | Lower ( - - ) - datatype MultiKeyStore = | MultiKeyStore ( - nameonly keyFieldName: string , - nameonly cacheTTL: int32 , - nameonly cache: Option := Option.None - ) - datatype PartOnly = | PartOnly ( - - ) - datatype PlaintextOverride = - | FORCE_PLAINTEXT_WRITE_ALLOW_PLAINTEXT_READ - | FORBID_PLAINTEXT_WRITE_ALLOW_PLAINTEXT_READ - | FORBID_PLAINTEXT_WRITE_FORBID_PLAINTEXT_READ - type Prefix = x: string | IsValid_Prefix(x) witness * - predicate method IsValid_Prefix(x: string) { - ( 1 <= |x| ) -} - datatype SearchConfig = | SearchConfig ( - nameonly versions: BeaconVersionList , - nameonly writeVersion: VersionNumber - ) - datatype Shared = | Shared ( - nameonly other: string - ) - datatype SharedSet = | SharedSet ( - nameonly other: string - ) - datatype SignedPart = | SignedPart ( - nameonly name: string , - nameonly prefix: Prefix , - nameonly loc: Option := Option.None - ) - type SignedPartsList = x: seq | IsValid_SignedPartsList(x) witness * - predicate method IsValid_SignedPartsList(x: seq) { - ( 1 <= |x| ) -} - datatype SingleKeyStore = | SingleKeyStore ( - nameonly keyId: string , - nameonly cacheTTL: int32 - ) - datatype StandardBeacon = | StandardBeacon ( - nameonly name: string , - nameonly length: BeaconBitLength , - nameonly loc: Option := Option.None , - nameonly style: Option := Option.None - ) - type StandardBeaconList = x: seq | IsValid_StandardBeaconList(x) witness * - predicate method IsValid_StandardBeaconList(x: seq) { - ( 1 <= |x| ) -} - type TerminalLocation = x: string | IsValid_TerminalLocation(x) witness * - predicate method IsValid_TerminalLocation(x: string) { - ( 1 <= |x| ) -} - datatype Upper = | Upper ( - - ) - type VersionNumber = x: int32 | IsValid_VersionNumber(x) witness * - predicate method IsValid_VersionNumber(x: int32) { - ( 1 <= x ) -} - datatype VirtualField = | VirtualField ( - nameonly name: string , - nameonly parts: VirtualPartList - ) - type VirtualFieldList = x: seq | IsValid_VirtualFieldList(x) witness * - predicate method IsValid_VirtualFieldList(x: seq) { - ( 1 <= |x| ) -} - datatype VirtualPart = | VirtualPart ( - nameonly loc: TerminalLocation , - nameonly trans: Option := Option.None - ) - type VirtualPartList = x: seq | IsValid_VirtualPartList(x) witness * - predicate method IsValid_VirtualPartList(x: seq) { - ( 1 <= |x| ) -} - datatype VirtualTransform = - | upper(upper: Upper) - | lower(lower: Lower) - | insert(insert: Insert) - | prefix(prefix: GetPrefix) - | suffix(suffix: GetSuffix) - | substring(substring: GetSubstring) - | segment(segment: GetSegment) - | segments(segments: GetSegments) - type VirtualTransformList = x: seq | IsValid_VirtualTransformList(x) witness * - predicate method IsValid_VirtualTransformList(x: seq) { - ( 1 <= |x| ) -} - datatype Error = - // Local Error structures are listed here - | DynamoDbEncryptionException ( - nameonly message: string - ) - // Any dependent models are listed here - | AwsCryptographyDbEncryptionSdkStructuredEncryption(AwsCryptographyDbEncryptionSdkStructuredEncryption: AwsCryptographyDbEncryptionSdkStructuredEncryptionTypes.Error) - | AwsCryptographyMaterialProviders(AwsCryptographyMaterialProviders: AwsCryptographyMaterialProvidersTypes.Error) - | AwsCryptographyKeyStore(AwsCryptographyKeyStore: AwsCryptographyKeyStoreTypes.Error) - | AwsCryptographyPrimitives(AwsCryptographyPrimitives: AwsCryptographyPrimitivesTypes.Error) - | ComAmazonawsDynamodb(ComAmazonawsDynamodb: ComAmazonawsDynamodbTypes.Error) - // The Collection error is used to collect several errors together - // This is useful when composing OR logic. - // Consider the following method: - // - // method FN(n:I) - // returns (res: Result) - // ensures A(I).Success? ==> res.Success? - // ensures B(I).Success? ==> res.Success? - // ensures A(I).Failure? && B(I).Failure? ==> res.Failure? - // - // If either A || B is successful then FN is successful. - // And if A && B fail then FN will fail. - // But what information should FN transmit back to the caller? - // While it may be correct to hide these details from the caller, - // this can not be the globally correct option. - // Suppose that A and B can be blocked by different ACLs, - // and that their representation of I is only eventually consistent. - // How can the caller distinguish, at a minimum for logging, - // the difference between the four failure modes? - // || (!access(A(I)) && !access(B(I))) - // || (!exit(A(I)) && !exit(B(I))) - // || (!access(A(I)) && !exit(B(I))) - // || (!exit(A(I)) && !access(B(I))) - | CollectionOfErrors(list: seq, nameonly message: string) - // The Opaque error, used for native, extern, wrapped or unknown errors - | Opaque(obj: object) - type OpaqueError = e: Error | e.Opaque? witness * -} - abstract module AbstractAwsCryptographyDbEncryptionSdkDynamoDbService - { - import opened Wrappers - import opened StandardLibrary.UInt - import opened UTF8 - import opened Types = AwsCryptographyDbEncryptionSdkDynamoDbTypes - import Operations : AbstractAwsCryptographyDbEncryptionSdkDynamoDbOperations - function method DefaultDynamoDbEncryptionConfig(): DynamoDbEncryptionConfig - method DynamoDbEncryption(config: DynamoDbEncryptionConfig := DefaultDynamoDbEncryptionConfig()) - returns (res: Result) - ensures res.Success? ==> - && fresh(res.value) - && fresh(res.value.Modifies) - && fresh(res.value.History) - && res.value.ValidState() + ) + type AttributeActions = map + type BeaconBitLength = x: int32 | IsValid_BeaconBitLength(x) witness * + predicate method IsValid_BeaconBitLength(x: int32) { + ( 1 <= x <= 63 ) + } + datatype BeaconKeySource = + | single(single: SingleKeyStore) + | multi(multi: MultiKeyStore) + datatype BeaconStyle = + | partOnly(partOnly: PartOnly) + | shared(shared: Shared) + | asSet(asSet: AsSet) + | sharedSet(sharedSet: SharedSet) + datatype BeaconVersion = | BeaconVersion ( + nameonly version: VersionNumber , + nameonly keyStore: AwsCryptographyKeyStoreTypes.IKeyStoreClient , + nameonly keySource: BeaconKeySource , + nameonly standardBeacons: StandardBeaconList , + nameonly compoundBeacons: Option := Option.None , + nameonly virtualFields: Option := Option.None , + nameonly encryptedParts: Option := Option.None , + nameonly signedParts: Option := Option.None + ) + type BeaconVersionList = x: seq | IsValid_BeaconVersionList(x) witness * + predicate method IsValid_BeaconVersionList(x: seq) { + ( 1 <= |x| <= 1 ) + } + type Char = x: string | IsValid_Char(x) witness * + predicate method IsValid_Char(x: string) { + ( 1 <= |x| <= 1 ) + } + datatype CompoundBeacon = | CompoundBeacon ( + nameonly name: string , + nameonly split: Char , + nameonly encrypted: Option := Option.None , + nameonly signed: Option := Option.None , + nameonly constructors: Option := Option.None + ) + type CompoundBeaconList = x: seq | IsValid_CompoundBeaconList(x) witness * + predicate method IsValid_CompoundBeaconList(x: seq) { + ( 1 <= |x| ) + } + datatype Constructor = | Constructor ( + nameonly parts: ConstructorPartList + ) + type ConstructorList = x: seq | IsValid_ConstructorList(x) witness * + predicate method IsValid_ConstructorList(x: seq) { + ( 1 <= |x| ) + } + datatype ConstructorPart = | ConstructorPart ( + nameonly name: string , + nameonly required: bool + ) + type ConstructorPartList = x: seq | IsValid_ConstructorPartList(x) witness * + predicate method IsValid_ConstructorPartList(x: seq) { + ( 1 <= |x| ) + } + datatype CreateDynamoDbEncryptionBranchKeyIdSupplierInput = | CreateDynamoDbEncryptionBranchKeyIdSupplierInput ( + nameonly ddbKeyBranchKeyIdSupplier: IDynamoDbKeyBranchKeyIdSupplier + ) + datatype CreateDynamoDbEncryptionBranchKeyIdSupplierOutput = | CreateDynamoDbEncryptionBranchKeyIdSupplierOutput ( + nameonly branchKeyIdSupplier: AwsCryptographyMaterialProvidersTypes.IBranchKeyIdSupplier + ) + class IDynamoDbEncryptionClientCallHistory { + ghost constructor() { + CreateDynamoDbEncryptionBranchKeyIdSupplier := []; + GetEncryptedDataKeyDescription := []; + } + ghost var CreateDynamoDbEncryptionBranchKeyIdSupplier: seq>> + ghost var GetEncryptedDataKeyDescription: seq>> + } + trait {:termination false} IDynamoDbEncryptionClient + { + // Helper to define any additional modifies/reads clauses. + // If your operations need to mutate state, + // add it in your constructor function: + // Modifies := {your, fields, here, History}; + // If you do not need to mutate anything: + // Modifies := {History}; - // Helper function for the benefit of native code to create a Success(client) without referring to Dafny internals - function method CreateSuccessOfClient(client: IDynamoDbEncryptionClient): Result { - Success(client) - } // Helper function for the benefit of native code to create a Failure(error) without referring to Dafny internals - function method CreateFailureOfError(error: Error): Result { - Failure(error) - } - class DynamoDbEncryptionClient extends IDynamoDbEncryptionClient - { - constructor(config: Operations.InternalConfig) - requires Operations.ValidInternalConfig?(config) - ensures - && ValidState() - && fresh(History) - && this.config == config - const config: Operations.InternalConfig - predicate ValidState() - ensures ValidState() ==> - && Operations.ValidInternalConfig?(config) - && History !in Operations.ModifiesInternalConfig(config) - && Modifies == Operations.ModifiesInternalConfig(config) + {History} - predicate CreateDynamoDbEncryptionBranchKeyIdSupplierEnsuresPublicly(input: CreateDynamoDbEncryptionBranchKeyIdSupplierInput , output: Result) - {Operations.CreateDynamoDbEncryptionBranchKeyIdSupplierEnsuresPublicly(input, output)} - // The public method to be called by library consumers - method CreateDynamoDbEncryptionBranchKeyIdSupplier ( input: CreateDynamoDbEncryptionBranchKeyIdSupplierInput ) - returns (output: Result) - requires - && ValidState() - && input.ddbKeyBranchKeyIdSupplier.ValidState() - && input.ddbKeyBranchKeyIdSupplier.Modifies !! {History} - modifies Modifies - {History} , - input.ddbKeyBranchKeyIdSupplier.Modifies , - History`CreateDynamoDbEncryptionBranchKeyIdSupplier - // Dafny will skip type parameters when generating a default decreases clause. - decreases Modifies - {History} , - input.ddbKeyBranchKeyIdSupplier.Modifies - ensures - && ValidState() - && ( output.Success? ==> - && output.value.branchKeyIdSupplier.ValidState() - && output.value.branchKeyIdSupplier.Modifies !! {History} - && fresh(output.value.branchKeyIdSupplier) - && fresh ( output.value.branchKeyIdSupplier.Modifies - Modifies - {History} - input.ddbKeyBranchKeyIdSupplier.Modifies ) ) - ensures CreateDynamoDbEncryptionBranchKeyIdSupplierEnsuresPublicly(input, output) - ensures History.CreateDynamoDbEncryptionBranchKeyIdSupplier == old(History.CreateDynamoDbEncryptionBranchKeyIdSupplier) + [DafnyCallEvent(input, output)] - { - output := Operations.CreateDynamoDbEncryptionBranchKeyIdSupplier(config, input); - History.CreateDynamoDbEncryptionBranchKeyIdSupplier := History.CreateDynamoDbEncryptionBranchKeyIdSupplier + [DafnyCallEvent(input, output)]; -} - - predicate GetEncryptedDataKeyDescriptionEnsuresPublicly(input: GetEncryptedDataKeyDescriptionInput , output: Result) - {Operations.GetEncryptedDataKeyDescriptionEnsuresPublicly(input, output)} - // The public method to be called by library consumers - method GetEncryptedDataKeyDescription ( input: GetEncryptedDataKeyDescriptionInput ) - returns (output: Result) - requires - && ValidState() - modifies Modifies - {History} , - History`GetEncryptedDataKeyDescription - // Dafny will skip type parameters when generating a default decreases clause. - decreases Modifies - {History} - ensures - && ValidState() - ensures GetEncryptedDataKeyDescriptionEnsuresPublicly(input, output) - ensures History.GetEncryptedDataKeyDescription == old(History.GetEncryptedDataKeyDescription) + [DafnyCallEvent(input, output)] - { - output := Operations.GetEncryptedDataKeyDescription(config, input); - History.GetEncryptedDataKeyDescription := History.GetEncryptedDataKeyDescription + [DafnyCallEvent(input, output)]; -} - + ghost const Modifies: set + // For an unassigned field defined in a trait, + // Dafny can only assign a value in the constructor. + // This means that for Dafny to reason about this value, + // it needs some way to know (an invariant), + // about the state of the object. + // This builds on the Valid/Repr paradigm + // To make this kind requires safe to add + // to methods called from unverified code, + // the predicate MUST NOT take any arguments. + // This means that the correctness of this requires + // MUST only be evaluated by the class itself. + // If you require any additional mutation, + // then you MUST ensure everything you need in ValidState. + // You MUST also ensure ValidState in your constructor. + predicate ValidState() + ensures ValidState() ==> History in Modifies + ghost const History: IDynamoDbEncryptionClientCallHistory + predicate CreateDynamoDbEncryptionBranchKeyIdSupplierEnsuresPublicly(input: CreateDynamoDbEncryptionBranchKeyIdSupplierInput , output: Result) + // The public method to be called by library consumers + method CreateDynamoDbEncryptionBranchKeyIdSupplier ( input: CreateDynamoDbEncryptionBranchKeyIdSupplierInput ) + returns (output: Result) + requires + && ValidState() + && input.ddbKeyBranchKeyIdSupplier.ValidState() + && input.ddbKeyBranchKeyIdSupplier.Modifies !! {History} + modifies Modifies - {History} , + input.ddbKeyBranchKeyIdSupplier.Modifies , + History`CreateDynamoDbEncryptionBranchKeyIdSupplier + // Dafny will skip type parameters when generating a default decreases clause. + decreases Modifies - {History} , + input.ddbKeyBranchKeyIdSupplier.Modifies + ensures + && ValidState() + && ( output.Success? ==> + && output.value.branchKeyIdSupplier.ValidState() + && output.value.branchKeyIdSupplier.Modifies !! {History} + && fresh(output.value.branchKeyIdSupplier) + && fresh ( output.value.branchKeyIdSupplier.Modifies - Modifies - {History} - input.ddbKeyBranchKeyIdSupplier.Modifies ) ) + ensures CreateDynamoDbEncryptionBranchKeyIdSupplierEnsuresPublicly(input, output) + ensures History.CreateDynamoDbEncryptionBranchKeyIdSupplier == old(History.CreateDynamoDbEncryptionBranchKeyIdSupplier) + [DafnyCallEvent(input, output)] + + predicate GetEncryptedDataKeyDescriptionEnsuresPublicly(input: GetEncryptedDataKeyDescriptionInput , output: Result) + // The public method to be called by library consumers + method GetEncryptedDataKeyDescription ( input: GetEncryptedDataKeyDescriptionInput ) + returns (output: Result) + requires + && ValidState() + modifies Modifies - {History} , + History`GetEncryptedDataKeyDescription + // Dafny will skip type parameters when generating a default decreases clause. + decreases Modifies - {History} + ensures + && ValidState() + ensures GetEncryptedDataKeyDescriptionEnsuresPublicly(input, output) + ensures History.GetEncryptedDataKeyDescription == old(History.GetEncryptedDataKeyDescription) + [DafnyCallEvent(input, output)] + + } + datatype DynamoDbEncryptionConfig = | DynamoDbEncryptionConfig ( + + ) + class IDynamoDbKeyBranchKeyIdSupplierCallHistory { + ghost constructor() { + GetBranchKeyIdFromDdbKey := []; + } + ghost var GetBranchKeyIdFromDdbKey: seq>> + } + trait {:termination false} IDynamoDbKeyBranchKeyIdSupplier + { + // Helper to define any additional modifies/reads clauses. + // If your operations need to mutate state, + // add it in your constructor function: + // Modifies := {your, fields, here, History}; + // If you do not need to mutate anything: + // Modifies := {History}; + + ghost const Modifies: set + // For an unassigned field defined in a trait, + // Dafny can only assign a value in the constructor. + // This means that for Dafny to reason about this value, + // it needs some way to know (an invariant), + // about the state of the object. + // This builds on the Valid/Repr paradigm + // To make this kind requires safe to add + // to methods called from unverified code, + // the predicate MUST NOT take any arguments. + // This means that the correctness of this requires + // MUST only be evaluated by the class itself. + // If you require any additional mutation, + // then you MUST ensure everything you need in ValidState. + // You MUST also ensure ValidState in your constructor. + predicate ValidState() + ensures ValidState() ==> History in Modifies + ghost const History: IDynamoDbKeyBranchKeyIdSupplierCallHistory + predicate GetBranchKeyIdFromDdbKeyEnsuresPublicly(input: GetBranchKeyIdFromDdbKeyInput , output: Result) + // The public method to be called by library consumers + method GetBranchKeyIdFromDdbKey ( input: GetBranchKeyIdFromDdbKeyInput ) + returns (output: Result) + requires + && ValidState() + modifies Modifies - {History} , + History`GetBranchKeyIdFromDdbKey + // Dafny will skip type parameters when generating a default decreases clause. + decreases Modifies - {History} + ensures + && ValidState() + ensures GetBranchKeyIdFromDdbKeyEnsuresPublicly(input, output) + ensures History.GetBranchKeyIdFromDdbKey == old(History.GetBranchKeyIdFromDdbKey) + [DafnyCallEvent(input, output)] + { + output := GetBranchKeyIdFromDdbKey' (input); + History.GetBranchKeyIdFromDdbKey := History.GetBranchKeyIdFromDdbKey + [DafnyCallEvent(input, output)]; + } + // The method to implement in the concrete class. + method GetBranchKeyIdFromDdbKey' ( input: GetBranchKeyIdFromDdbKeyInput ) + returns (output: Result) + requires + && ValidState() + modifies Modifies - {History} + // Dafny will skip type parameters when generating a default decreases clause. + decreases Modifies - {History} + ensures + && ValidState() + ensures GetBranchKeyIdFromDdbKeyEnsuresPublicly(input, output) + ensures unchanged(History) + + } + datatype DynamoDbTableEncryptionConfig = | DynamoDbTableEncryptionConfig ( + nameonly logicalTableName: string , + nameonly partitionKeyName: ComAmazonawsDynamodbTypes.KeySchemaAttributeName , + nameonly sortKeyName: Option := Option.None , + nameonly search: Option := Option.None , + nameonly attributeActionsOnEncrypt: AttributeActions , + nameonly allowedUnsignedAttributes: Option := Option.None , + nameonly allowedUnsignedAttributePrefix: Option := Option.None , + nameonly algorithmSuiteId: Option := Option.None , + nameonly keyring: Option := Option.None , + nameonly cmm: Option := Option.None , + nameonly legacyOverride: Option := Option.None , + nameonly plaintextOverride: Option := Option.None + ) + type DynamoDbTableEncryptionConfigList = map + datatype DynamoDbTablesEncryptionConfig = | DynamoDbTablesEncryptionConfig ( + nameonly tableEncryptionConfigs: DynamoDbTableEncryptionConfigList + ) + type EncryptedDataKeyDescriptionList = seq + datatype EncryptedDataKeyDescriptionOutput = | EncryptedDataKeyDescriptionOutput ( + nameonly keyProviderId: string , + nameonly keyProviderInfo: Option := Option.None , + nameonly branchKeyId: Option := Option.None , + nameonly branchKeyVersion: Option := Option.None + ) + datatype EncryptedPart = | EncryptedPart ( + nameonly name: string , + nameonly prefix: Prefix + ) + type EncryptedPartsList = x: seq | IsValid_EncryptedPartsList(x) witness * + predicate method IsValid_EncryptedPartsList(x: seq) { + ( 1 <= |x| ) + } + datatype GetBranchKeyIdFromDdbKeyInput = | GetBranchKeyIdFromDdbKeyInput ( + nameonly ddbKey: ComAmazonawsDynamodbTypes.Key + ) + datatype GetBranchKeyIdFromDdbKeyOutput = | GetBranchKeyIdFromDdbKeyOutput ( + nameonly branchKeyId: string + ) + datatype GetEncryptedDataKeyDescriptionInput = | GetEncryptedDataKeyDescriptionInput ( + nameonly input: GetEncryptedDataKeyDescriptionUnion + ) + datatype GetEncryptedDataKeyDescriptionOutput = | GetEncryptedDataKeyDescriptionOutput ( + nameonly EncryptedDataKeyDescriptionOutput: EncryptedDataKeyDescriptionList + ) + datatype GetEncryptedDataKeyDescriptionUnion = + | header(header: seq) + | plaintextItem(plaintextItem: ComAmazonawsDynamodbTypes.AttributeMap) + datatype GetPrefix = | GetPrefix ( + nameonly length: int32 + ) + datatype GetSegment = | GetSegment ( + nameonly split: Char , + nameonly index: int32 + ) + datatype GetSegments = | GetSegments ( + nameonly split: Char , + nameonly low: int32 , + nameonly high: int32 + ) + datatype GetSubstring = | GetSubstring ( + nameonly low: int32 , + nameonly high: int32 + ) + datatype GetSuffix = | GetSuffix ( + nameonly length: int32 + ) + datatype Insert = | Insert ( + nameonly literal: string + ) + class ILegacyDynamoDbEncryptorCallHistory { + ghost constructor() { + + } + + } + trait {:termination false} ILegacyDynamoDbEncryptor + { + // Helper to define any additional modifies/reads clauses. + // If your operations need to mutate state, + // add it in your constructor function: + // Modifies := {your, fields, here, History}; + // If you do not need to mutate anything: + // Modifies := {History}; + + ghost const Modifies: set + // For an unassigned field defined in a trait, + // Dafny can only assign a value in the constructor. + // This means that for Dafny to reason about this value, + // it needs some way to know (an invariant), + // about the state of the object. + // This builds on the Valid/Repr paradigm + // To make this kind requires safe to add + // to methods called from unverified code, + // the predicate MUST NOT take any arguments. + // This means that the correctness of this requires + // MUST only be evaluated by the class itself. + // If you require any additional mutation, + // then you MUST ensure everything you need in ValidState. + // You MUST also ensure ValidState in your constructor. + predicate ValidState() + ensures ValidState() ==> History in Modifies + ghost const History: ILegacyDynamoDbEncryptorCallHistory + + } + datatype LegacyOverride = | LegacyOverride ( + nameonly policy: LegacyPolicy , + nameonly encryptor: ILegacyDynamoDbEncryptor , + nameonly attributeActionsOnEncrypt: AttributeActions , + nameonly defaultAttributeFlag: Option := Option.None + ) + datatype LegacyPolicy = + | FORCE_LEGACY_ENCRYPT_ALLOW_LEGACY_DECRYPT + | FORBID_LEGACY_ENCRYPT_ALLOW_LEGACY_DECRYPT + | FORBID_LEGACY_ENCRYPT_FORBID_LEGACY_DECRYPT + datatype Lower = | Lower ( + + ) + datatype MultiKeyStore = | MultiKeyStore ( + nameonly keyFieldName: string , + nameonly cacheTTL: int32 , + nameonly cache: Option := Option.None + ) + datatype PartOnly = | PartOnly ( + + ) + datatype PlaintextOverride = + | FORCE_PLAINTEXT_WRITE_ALLOW_PLAINTEXT_READ + | FORBID_PLAINTEXT_WRITE_ALLOW_PLAINTEXT_READ + | FORBID_PLAINTEXT_WRITE_FORBID_PLAINTEXT_READ + type Prefix = x: string | IsValid_Prefix(x) witness * + predicate method IsValid_Prefix(x: string) { + ( 1 <= |x| ) + } + datatype SearchConfig = | SearchConfig ( + nameonly versions: BeaconVersionList , + nameonly writeVersion: VersionNumber + ) + datatype Shared = | Shared ( + nameonly other: string + ) + datatype SharedSet = | SharedSet ( + nameonly other: string + ) + datatype SignedPart = | SignedPart ( + nameonly name: string , + nameonly prefix: Prefix , + nameonly loc: Option := Option.None + ) + type SignedPartsList = x: seq | IsValid_SignedPartsList(x) witness * + predicate method IsValid_SignedPartsList(x: seq) { + ( 1 <= |x| ) + } + datatype SingleKeyStore = | SingleKeyStore ( + nameonly keyId: string , + nameonly cacheTTL: int32 + ) + datatype StandardBeacon = | StandardBeacon ( + nameonly name: string , + nameonly length: BeaconBitLength , + nameonly loc: Option := Option.None , + nameonly style: Option := Option.None + ) + type StandardBeaconList = x: seq | IsValid_StandardBeaconList(x) witness * + predicate method IsValid_StandardBeaconList(x: seq) { + ( 1 <= |x| ) + } + type TerminalLocation = x: string | IsValid_TerminalLocation(x) witness * + predicate method IsValid_TerminalLocation(x: string) { + ( 1 <= |x| ) + } + datatype Upper = | Upper ( + + ) + type VersionNumber = x: int32 | IsValid_VersionNumber(x) witness * + predicate method IsValid_VersionNumber(x: int32) { + ( 1 <= x ) + } + datatype VirtualField = | VirtualField ( + nameonly name: string , + nameonly parts: VirtualPartList + ) + type VirtualFieldList = x: seq | IsValid_VirtualFieldList(x) witness * + predicate method IsValid_VirtualFieldList(x: seq) { + ( 1 <= |x| ) + } + datatype VirtualPart = | VirtualPart ( + nameonly loc: TerminalLocation , + nameonly trans: Option := Option.None + ) + type VirtualPartList = x: seq | IsValid_VirtualPartList(x) witness * + predicate method IsValid_VirtualPartList(x: seq) { + ( 1 <= |x| ) + } + datatype VirtualTransform = + | upper(upper: Upper) + | lower(lower: Lower) + | insert(insert: Insert) + | prefix(prefix: GetPrefix) + | suffix(suffix: GetSuffix) + | substring(substring: GetSubstring) + | segment(segment: GetSegment) + | segments(segments: GetSegments) + type VirtualTransformList = x: seq | IsValid_VirtualTransformList(x) witness * + predicate method IsValid_VirtualTransformList(x: seq) { + ( 1 <= |x| ) + } + datatype Error = + // Local Error structures are listed here + | DynamoDbEncryptionException ( + nameonly message: string + ) + // Any dependent models are listed here + | AwsCryptographyDbEncryptionSdkStructuredEncryption(AwsCryptographyDbEncryptionSdkStructuredEncryption: AwsCryptographyDbEncryptionSdkStructuredEncryptionTypes.Error) + | AwsCryptographyMaterialProviders(AwsCryptographyMaterialProviders: AwsCryptographyMaterialProvidersTypes.Error) + | AwsCryptographyKeyStore(AwsCryptographyKeyStore: AwsCryptographyKeyStoreTypes.Error) + | AwsCryptographyPrimitives(AwsCryptographyPrimitives: AwsCryptographyPrimitivesTypes.Error) + | ComAmazonawsDynamodb(ComAmazonawsDynamodb: ComAmazonawsDynamodbTypes.Error) + // The Collection error is used to collect several errors together + // This is useful when composing OR logic. + // Consider the following method: + // + // method FN(n:I) + // returns (res: Result) + // ensures A(I).Success? ==> res.Success? + // ensures B(I).Success? ==> res.Success? + // ensures A(I).Failure? && B(I).Failure? ==> res.Failure? + // + // If either A || B is successful then FN is successful. + // And if A && B fail then FN will fail. + // But what information should FN transmit back to the caller? + // While it may be correct to hide these details from the caller, + // this can not be the globally correct option. + // Suppose that A and B can be blocked by different ACLs, + // and that their representation of I is only eventually consistent. + // How can the caller distinguish, at a minimum for logging, + // the difference between the four failure modes? + // || (!access(A(I)) && !access(B(I))) + // || (!exit(A(I)) && !exit(B(I))) + // || (!access(A(I)) && !exit(B(I))) + // || (!exit(A(I)) && !access(B(I))) + | CollectionOfErrors(list: seq, nameonly message: string) + // The Opaque error, used for native, extern, wrapped or unknown errors + | Opaque(obj: object) + type OpaqueError = e: Error | e.Opaque? witness * } +abstract module AbstractAwsCryptographyDbEncryptionSdkDynamoDbService +{ + import opened Wrappers + import opened StandardLibrary.UInt + import opened UTF8 + import opened Types = AwsCryptographyDbEncryptionSdkDynamoDbTypes + import Operations : AbstractAwsCryptographyDbEncryptionSdkDynamoDbOperations + function method DefaultDynamoDbEncryptionConfig(): DynamoDbEncryptionConfig + method DynamoDbEncryption(config: DynamoDbEncryptionConfig := DefaultDynamoDbEncryptionConfig()) + returns (res: Result) + ensures res.Success? ==> + && fresh(res.value) + && fresh(res.value.Modifies) + && fresh(res.value.History) + && res.value.ValidState() + + // Helper function for the benefit of native code to create a Success(client) without referring to Dafny internals + function method CreateSuccessOfClient(client: IDynamoDbEncryptionClient): Result { + Success(client) + } // Helper function for the benefit of native code to create a Failure(error) without referring to Dafny internals + function method CreateFailureOfError(error: Error): Result { + Failure(error) + } + class DynamoDbEncryptionClient extends IDynamoDbEncryptionClient + { + constructor(config: Operations.InternalConfig) + requires Operations.ValidInternalConfig?(config) + ensures + && ValidState() + && fresh(History) + && this.config == config + const config: Operations.InternalConfig + predicate ValidState() + ensures ValidState() ==> + && Operations.ValidInternalConfig?(config) + && History !in Operations.ModifiesInternalConfig(config) + && Modifies == Operations.ModifiesInternalConfig(config) + {History} + predicate CreateDynamoDbEncryptionBranchKeyIdSupplierEnsuresPublicly(input: CreateDynamoDbEncryptionBranchKeyIdSupplierInput , output: Result) + {Operations.CreateDynamoDbEncryptionBranchKeyIdSupplierEnsuresPublicly(input, output)} + // The public method to be called by library consumers + method CreateDynamoDbEncryptionBranchKeyIdSupplier ( input: CreateDynamoDbEncryptionBranchKeyIdSupplierInput ) + returns (output: Result) + requires + && ValidState() + && input.ddbKeyBranchKeyIdSupplier.ValidState() + && input.ddbKeyBranchKeyIdSupplier.Modifies !! {History} + modifies Modifies - {History} , + input.ddbKeyBranchKeyIdSupplier.Modifies , + History`CreateDynamoDbEncryptionBranchKeyIdSupplier + // Dafny will skip type parameters when generating a default decreases clause. + decreases Modifies - {History} , + input.ddbKeyBranchKeyIdSupplier.Modifies + ensures + && ValidState() + && ( output.Success? ==> + && output.value.branchKeyIdSupplier.ValidState() + && output.value.branchKeyIdSupplier.Modifies !! {History} + && fresh(output.value.branchKeyIdSupplier) + && fresh ( output.value.branchKeyIdSupplier.Modifies - Modifies - {History} - input.ddbKeyBranchKeyIdSupplier.Modifies ) ) + ensures CreateDynamoDbEncryptionBranchKeyIdSupplierEnsuresPublicly(input, output) + ensures History.CreateDynamoDbEncryptionBranchKeyIdSupplier == old(History.CreateDynamoDbEncryptionBranchKeyIdSupplier) + [DafnyCallEvent(input, output)] + { + output := Operations.CreateDynamoDbEncryptionBranchKeyIdSupplier(config, input); + History.CreateDynamoDbEncryptionBranchKeyIdSupplier := History.CreateDynamoDbEncryptionBranchKeyIdSupplier + [DafnyCallEvent(input, output)]; + } + + predicate GetEncryptedDataKeyDescriptionEnsuresPublicly(input: GetEncryptedDataKeyDescriptionInput , output: Result) + {Operations.GetEncryptedDataKeyDescriptionEnsuresPublicly(input, output)} + // The public method to be called by library consumers + method GetEncryptedDataKeyDescription ( input: GetEncryptedDataKeyDescriptionInput ) + returns (output: Result) + requires + && ValidState() + modifies Modifies - {History} , + History`GetEncryptedDataKeyDescription + // Dafny will skip type parameters when generating a default decreases clause. + decreases Modifies - {History} + ensures + && ValidState() + ensures GetEncryptedDataKeyDescriptionEnsuresPublicly(input, output) + ensures History.GetEncryptedDataKeyDescription == old(History.GetEncryptedDataKeyDescription) + [DafnyCallEvent(input, output)] + { + output := Operations.GetEncryptedDataKeyDescription(config, input); + History.GetEncryptedDataKeyDescription := History.GetEncryptedDataKeyDescription + [DafnyCallEvent(input, output)]; + } + + } } - abstract module AbstractAwsCryptographyDbEncryptionSdkDynamoDbOperations { - import opened Wrappers - import opened StandardLibrary.UInt - import opened UTF8 - import opened Types = AwsCryptographyDbEncryptionSdkDynamoDbTypes - type InternalConfig - predicate ValidInternalConfig?(config: InternalConfig) - function ModifiesInternalConfig(config: InternalConfig): set - predicate CreateDynamoDbEncryptionBranchKeyIdSupplierEnsuresPublicly(input: CreateDynamoDbEncryptionBranchKeyIdSupplierInput , output: Result) - // The private method to be refined by the library developer +abstract module AbstractAwsCryptographyDbEncryptionSdkDynamoDbOperations { + import opened Wrappers + import opened StandardLibrary.UInt + import opened UTF8 + import opened Types = AwsCryptographyDbEncryptionSdkDynamoDbTypes + type InternalConfig + predicate ValidInternalConfig?(config: InternalConfig) + function ModifiesInternalConfig(config: InternalConfig): set + predicate CreateDynamoDbEncryptionBranchKeyIdSupplierEnsuresPublicly(input: CreateDynamoDbEncryptionBranchKeyIdSupplierInput , output: Result) + // The private method to be refined by the library developer - method CreateDynamoDbEncryptionBranchKeyIdSupplier ( config: InternalConfig , input: CreateDynamoDbEncryptionBranchKeyIdSupplierInput ) - returns (output: Result) - requires - && ValidInternalConfig?(config) - && input.ddbKeyBranchKeyIdSupplier.ValidState() - modifies ModifiesInternalConfig(config) , - input.ddbKeyBranchKeyIdSupplier.Modifies - // Dafny will skip type parameters when generating a default decreases clause. - decreases ModifiesInternalConfig(config) , - input.ddbKeyBranchKeyIdSupplier.Modifies - ensures - && ValidInternalConfig?(config) - && ( output.Success? ==> - && output.value.branchKeyIdSupplier.ValidState() - && fresh(output.value.branchKeyIdSupplier) - && fresh ( output.value.branchKeyIdSupplier.Modifies - ModifiesInternalConfig(config) - input.ddbKeyBranchKeyIdSupplier.Modifies ) ) - ensures CreateDynamoDbEncryptionBranchKeyIdSupplierEnsuresPublicly(input, output) + method CreateDynamoDbEncryptionBranchKeyIdSupplier ( config: InternalConfig , input: CreateDynamoDbEncryptionBranchKeyIdSupplierInput ) + returns (output: Result) + requires + && ValidInternalConfig?(config) + && input.ddbKeyBranchKeyIdSupplier.ValidState() + modifies ModifiesInternalConfig(config) , + input.ddbKeyBranchKeyIdSupplier.Modifies + // Dafny will skip type parameters when generating a default decreases clause. + decreases ModifiesInternalConfig(config) , + input.ddbKeyBranchKeyIdSupplier.Modifies + ensures + && ValidInternalConfig?(config) + && ( output.Success? ==> + && output.value.branchKeyIdSupplier.ValidState() + && fresh(output.value.branchKeyIdSupplier) + && fresh ( output.value.branchKeyIdSupplier.Modifies - ModifiesInternalConfig(config) - input.ddbKeyBranchKeyIdSupplier.Modifies ) ) + ensures CreateDynamoDbEncryptionBranchKeyIdSupplierEnsuresPublicly(input, output) - predicate GetEncryptedDataKeyDescriptionEnsuresPublicly(input: GetEncryptedDataKeyDescriptionInput , output: Result) - // The private method to be refined by the library developer + predicate GetEncryptedDataKeyDescriptionEnsuresPublicly(input: GetEncryptedDataKeyDescriptionInput , output: Result) + // The private method to be refined by the library developer - method GetEncryptedDataKeyDescription ( config: InternalConfig , input: GetEncryptedDataKeyDescriptionInput ) - returns (output: Result) - requires - && ValidInternalConfig?(config) - modifies ModifiesInternalConfig(config) - // Dafny will skip type parameters when generating a default decreases clause. - decreases ModifiesInternalConfig(config) - ensures - && ValidInternalConfig?(config) - ensures GetEncryptedDataKeyDescriptionEnsuresPublicly(input, output) + method GetEncryptedDataKeyDescription ( config: InternalConfig , input: GetEncryptedDataKeyDescriptionInput ) + returns (output: Result) + requires + && ValidInternalConfig?(config) + modifies ModifiesInternalConfig(config) + // Dafny will skip type parameters when generating a default decreases clause. + decreases ModifiesInternalConfig(config) + ensures + && ValidInternalConfig?(config) + ensures GetEncryptedDataKeyDescriptionEnsuresPublicly(input, output) } From 707ecf77709be6347a12753412f51e3eb932d7b5 Mon Sep 17 00:00:00 2001 From: rishav-karanjit Date: Wed, 27 Mar 2024 20:13:04 -0700 Subject: [PATCH 23/67] Merge format --- ...wsCryptographyDbEncryptionSdkDynamoDbTypes.dfy | 15 --------------- 1 file changed, 15 deletions(-) diff --git a/DynamoDbEncryption/dafny/DynamoDbEncryption/Model/AwsCryptographyDbEncryptionSdkDynamoDbTypes.dfy b/DynamoDbEncryption/dafny/DynamoDbEncryption/Model/AwsCryptographyDbEncryptionSdkDynamoDbTypes.dfy index 22af05adf..e6159d94b 100644 --- a/DynamoDbEncryption/dafny/DynamoDbEncryption/Model/AwsCryptographyDbEncryptionSdkDynamoDbTypes.dfy +++ b/DynamoDbEncryption/dafny/DynamoDbEncryption/Model/AwsCryptographyDbEncryptionSdkDynamoDbTypes.dfy @@ -152,7 +152,6 @@ module {:extern "software.amazon.cryptography.dbencryptionsdk.dynamodb.internald ensures CreateDynamoDbEncryptionBranchKeyIdSupplierEnsuresPublicly(input, output) ensures History.CreateDynamoDbEncryptionBranchKeyIdSupplier == old(History.CreateDynamoDbEncryptionBranchKeyIdSupplier) + [DafnyCallEvent(input, output)] -<<<<<<< HEAD predicate GetEncryptedDataKeyDescriptionEnsuresPublicly(input: GetEncryptedDataKeyDescriptionInput , output: Result) // The public method to be called by library consumers method GetEncryptedDataKeyDescription ( input: GetEncryptedDataKeyDescriptionInput ) @@ -168,8 +167,6 @@ module {:extern "software.amazon.cryptography.dbencryptionsdk.dynamodb.internald ensures GetEncryptedDataKeyDescriptionEnsuresPublicly(input, output) ensures History.GetEncryptedDataKeyDescription == old(History.GetEncryptedDataKeyDescription) + [DafnyCallEvent(input, output)] -======= ->>>>>>> dfc0dbd84f3ab23bd12be6abf8600f472576173e } datatype DynamoDbEncryptionConfig = | DynamoDbEncryptionConfig ( @@ -257,7 +254,6 @@ module {:extern "software.amazon.cryptography.dbencryptionsdk.dynamodb.internald datatype DynamoDbTablesEncryptionConfig = | DynamoDbTablesEncryptionConfig ( nameonly tableEncryptionConfigs: DynamoDbTableEncryptionConfigList ) -<<<<<<< HEAD type EncryptedDataKeyDescriptionList = seq datatype EncryptedDataKeyDescriptionOutput = | EncryptedDataKeyDescriptionOutput ( nameonly keyProviderId: string , @@ -265,8 +261,6 @@ module {:extern "software.amazon.cryptography.dbencryptionsdk.dynamodb.internald nameonly branchKeyId: Option := Option.None , nameonly branchKeyVersion: Option := Option.None ) -======= ->>>>>>> dfc0dbd84f3ab23bd12be6abf8600f472576173e datatype EncryptedPart = | EncryptedPart ( nameonly name: string , nameonly prefix: Prefix @@ -281,7 +275,6 @@ module {:extern "software.amazon.cryptography.dbencryptionsdk.dynamodb.internald datatype GetBranchKeyIdFromDdbKeyOutput = | GetBranchKeyIdFromDdbKeyOutput ( nameonly branchKeyId: string ) -<<<<<<< HEAD datatype GetEncryptedDataKeyDescriptionInput = | GetEncryptedDataKeyDescriptionInput ( nameonly input: GetEncryptedDataKeyDescriptionUnion ) @@ -291,8 +284,6 @@ module {:extern "software.amazon.cryptography.dbencryptionsdk.dynamodb.internald datatype GetEncryptedDataKeyDescriptionUnion = | header(header: seq) | plaintextItem(plaintextItem: ComAmazonawsDynamodbTypes.AttributeMap) -======= ->>>>>>> dfc0dbd84f3ab23bd12be6abf8600f472576173e datatype GetPrefix = | GetPrefix ( nameonly length: int32 ) @@ -557,7 +548,6 @@ abstract module AbstractAwsCryptographyDbEncryptionSdkDynamoDbService History.CreateDynamoDbEncryptionBranchKeyIdSupplier := History.CreateDynamoDbEncryptionBranchKeyIdSupplier + [DafnyCallEvent(input, output)]; } -<<<<<<< HEAD predicate GetEncryptedDataKeyDescriptionEnsuresPublicly(input: GetEncryptedDataKeyDescriptionInput , output: Result) {Operations.GetEncryptedDataKeyDescriptionEnsuresPublicly(input, output)} // The public method to be called by library consumers @@ -578,8 +568,6 @@ abstract module AbstractAwsCryptographyDbEncryptionSdkDynamoDbService History.GetEncryptedDataKeyDescription := History.GetEncryptedDataKeyDescription + [DafnyCallEvent(input, output)]; } -======= ->>>>>>> dfc0dbd84f3ab23bd12be6abf8600f472576173e } } abstract module AbstractAwsCryptographyDbEncryptionSdkDynamoDbOperations { @@ -611,7 +599,6 @@ abstract module AbstractAwsCryptographyDbEncryptionSdkDynamoDbOperations { && fresh(output.value.branchKeyIdSupplier) && fresh ( output.value.branchKeyIdSupplier.Modifies - ModifiesInternalConfig(config) - input.ddbKeyBranchKeyIdSupplier.Modifies ) ) ensures CreateDynamoDbEncryptionBranchKeyIdSupplierEnsuresPublicly(input, output) -<<<<<<< HEAD predicate GetEncryptedDataKeyDescriptionEnsuresPublicly(input: GetEncryptedDataKeyDescriptionInput , output: Result) @@ -628,6 +615,4 @@ abstract module AbstractAwsCryptographyDbEncryptionSdkDynamoDbOperations { ensures && ValidInternalConfig?(config) ensures GetEncryptedDataKeyDescriptionEnsuresPublicly(input, output) -======= ->>>>>>> dfc0dbd84f3ab23bd12be6abf8600f472576173e } From 8c7bcafcaf3b0ab1bf52eea6464810e4479b9c18 Mon Sep 17 00:00:00 2001 From: rishav-karanjit Date: Wed, 27 Mar 2024 20:58:49 -0700 Subject: [PATCH 24/67] fix: merge errors --- ...yptographyDbEncryptionSdkDynamoDbTypes.dfy | 5 ----- .../DynamoDbEncryption/TypeConversion.cs | 8 ++++---- .../TypeConversion.cs | 16 +++++++-------- .../DynamoDbItemEncryptor/TypeConversion.cs | 20 +++++++++---------- 4 files changed, 22 insertions(+), 27 deletions(-) diff --git a/DynamoDbEncryption/dafny/DynamoDbEncryption/Model/AwsCryptographyDbEncryptionSdkDynamoDbTypes.dfy b/DynamoDbEncryption/dafny/DynamoDbEncryption/Model/AwsCryptographyDbEncryptionSdkDynamoDbTypes.dfy index e6159d94b..8b63080d9 100644 --- a/DynamoDbEncryption/dafny/DynamoDbEncryption/Model/AwsCryptographyDbEncryptionSdkDynamoDbTypes.dfy +++ b/DynamoDbEncryption/dafny/DynamoDbEncryption/Model/AwsCryptographyDbEncryptionSdkDynamoDbTypes.dfy @@ -91,15 +91,10 @@ module {:extern "software.amazon.cryptography.dbencryptionsdk.dynamodb.internald class IDynamoDbEncryptionClientCallHistory { ghost constructor() { CreateDynamoDbEncryptionBranchKeyIdSupplier := []; -<<<<<<< HEAD GetEncryptedDataKeyDescription := []; } ghost var CreateDynamoDbEncryptionBranchKeyIdSupplier: seq>> ghost var GetEncryptedDataKeyDescription: seq>> -======= - } - ghost var CreateDynamoDbEncryptionBranchKeyIdSupplier: seq>> ->>>>>>> dfc0dbd84f3ab23bd12be6abf8600f472576173e } trait {:termination false} IDynamoDbEncryptionClient { diff --git a/DynamoDbEncryption/runtimes/net/Generated/DynamoDbEncryption/TypeConversion.cs b/DynamoDbEncryption/runtimes/net/Generated/DynamoDbEncryption/TypeConversion.cs index bcb4a958a..a9ec2594b 100644 --- a/DynamoDbEncryption/runtimes/net/Generated/DynamoDbEncryption/TypeConversion.cs +++ b/DynamoDbEncryption/runtimes/net/Generated/DynamoDbEncryption/TypeConversion.cs @@ -1534,10 +1534,6 @@ public static System.Exception FromDafny_CommonError(software.amazon.cryptograph return Com.Amazonaws.Dynamodb.TypeConversion.FromDafny_CommonError( dafnyVal._ComAmazonawsDynamodb ); - case software.amazon.cryptography.dbencryptionsdk.dynamodb.internaldafny.types.Error_AwsCryptographyDbEncryptionSdkStructuredEncryption dafnyVal: - return AWS.Cryptography.DbEncryptionSDK.StructuredEncryption.TypeConversion.FromDafny_CommonError( - dafnyVal._AwsCryptographyDbEncryptionSdkStructuredEncryption - ); case software.amazon.cryptography.dbencryptionsdk.dynamodb.internaldafny.types.Error_AwsCryptographyMaterialProviders dafnyVal: return AWS.Cryptography.MaterialProviders.TypeConversion.FromDafny_CommonError( dafnyVal._AwsCryptographyMaterialProviders @@ -1546,6 +1542,10 @@ public static System.Exception FromDafny_CommonError(software.amazon.cryptograph return AWS.Cryptography.Primitives.TypeConversion.FromDafny_CommonError( dafnyVal._AwsCryptographyPrimitives ); + case software.amazon.cryptography.dbencryptionsdk.dynamodb.internaldafny.types.Error_AwsCryptographyDbEncryptionSdkStructuredEncryption dafnyVal: + return AWS.Cryptography.DbEncryptionSDK.StructuredEncryption.TypeConversion.FromDafny_CommonError( + dafnyVal._AwsCryptographyDbEncryptionSdkStructuredEncryption + ); case software.amazon.cryptography.dbencryptionsdk.dynamodb.internaldafny.types.Error_DynamoDbEncryptionException dafnyVal: return FromDafny_N3_aws__N12_cryptography__N15_dbEncryptionSdk__N8_dynamoDb__S27_DynamoDbEncryptionException(dafnyVal); case software.amazon.cryptography.dbencryptionsdk.dynamodb.internaldafny.types.Error_CollectionOfErrors dafnyVal: diff --git a/DynamoDbEncryption/runtimes/net/Generated/DynamoDbEncryptionTransforms/TypeConversion.cs b/DynamoDbEncryption/runtimes/net/Generated/DynamoDbEncryptionTransforms/TypeConversion.cs index f4b8da84a..3738d55d6 100644 --- a/DynamoDbEncryption/runtimes/net/Generated/DynamoDbEncryptionTransforms/TypeConversion.cs +++ b/DynamoDbEncryption/runtimes/net/Generated/DynamoDbEncryptionTransforms/TypeConversion.cs @@ -6485,14 +6485,6 @@ public static System.Exception FromDafny_CommonError(software.amazon.cryptograph { switch (value) { - case software.amazon.cryptography.dbencryptionsdk.dynamodb.transforms.internaldafny.types.Error_ComAmazonawsDynamodb dafnyVal: - return Com.Amazonaws.Dynamodb.TypeConversion.FromDafny_CommonError( - dafnyVal._ComAmazonawsDynamodb - ); - case software.amazon.cryptography.dbencryptionsdk.dynamodb.transforms.internaldafny.types.Error_AwsCryptographyMaterialProviders dafnyVal: - return AWS.Cryptography.MaterialProviders.TypeConversion.FromDafny_CommonError( - dafnyVal._AwsCryptographyMaterialProviders - ); case software.amazon.cryptography.dbencryptionsdk.dynamodb.transforms.internaldafny.types.Error_AwsCryptographyDbEncryptionSdkDynamoDb dafnyVal: return AWS.Cryptography.DbEncryptionSDK.DynamoDb.TypeConversion.FromDafny_CommonError( dafnyVal._AwsCryptographyDbEncryptionSdkDynamoDb @@ -6501,10 +6493,18 @@ public static System.Exception FromDafny_CommonError(software.amazon.cryptograph return AWS.Cryptography.DbEncryptionSDK.StructuredEncryption.TypeConversion.FromDafny_CommonError( dafnyVal._AwsCryptographyDbEncryptionSdkStructuredEncryption ); + case software.amazon.cryptography.dbencryptionsdk.dynamodb.transforms.internaldafny.types.Error_ComAmazonawsDynamodb dafnyVal: + return Com.Amazonaws.Dynamodb.TypeConversion.FromDafny_CommonError( + dafnyVal._ComAmazonawsDynamodb + ); case software.amazon.cryptography.dbencryptionsdk.dynamodb.transforms.internaldafny.types.Error_AwsCryptographyDbEncryptionSdkDynamoDbItemEncryptor dafnyVal: return AWS.Cryptography.DbEncryptionSDK.DynamoDb.ItemEncryptor.TypeConversion.FromDafny_CommonError( dafnyVal._AwsCryptographyDbEncryptionSdkDynamoDbItemEncryptor ); + case software.amazon.cryptography.dbencryptionsdk.dynamodb.transforms.internaldafny.types.Error_AwsCryptographyMaterialProviders dafnyVal: + return AWS.Cryptography.MaterialProviders.TypeConversion.FromDafny_CommonError( + dafnyVal._AwsCryptographyMaterialProviders + ); case software.amazon.cryptography.dbencryptionsdk.dynamodb.transforms.internaldafny.types.Error_DynamoDbEncryptionTransformsException dafnyVal: return FromDafny_N3_aws__N12_cryptography__N15_dbEncryptionSdk__N8_dynamoDb__N10_transforms__S37_DynamoDbEncryptionTransformsException(dafnyVal); case software.amazon.cryptography.dbencryptionsdk.dynamodb.transforms.internaldafny.types.Error_CollectionOfErrors dafnyVal: diff --git a/DynamoDbEncryption/runtimes/net/Generated/DynamoDbItemEncryptor/TypeConversion.cs b/DynamoDbEncryption/runtimes/net/Generated/DynamoDbItemEncryptor/TypeConversion.cs index ebcd0d3c7..2fea0d004 100644 --- a/DynamoDbEncryption/runtimes/net/Generated/DynamoDbItemEncryptor/TypeConversion.cs +++ b/DynamoDbEncryption/runtimes/net/Generated/DynamoDbItemEncryptor/TypeConversion.cs @@ -952,25 +952,25 @@ public static System.Exception FromDafny_CommonError(software.amazon.cryptograph { switch (value) { + case software.amazon.cryptography.dbencryptionsdk.dynamodb.itemencryptor.internaldafny.types.Error_AwsCryptographyMaterialProviders dafnyVal: + return AWS.Cryptography.MaterialProviders.TypeConversion.FromDafny_CommonError( + dafnyVal._AwsCryptographyMaterialProviders + ); case software.amazon.cryptography.dbencryptionsdk.dynamodb.itemencryptor.internaldafny.types.Error_AwsCryptographyDbEncryptionSdkStructuredEncryption dafnyVal: return AWS.Cryptography.DbEncryptionSDK.StructuredEncryption.TypeConversion.FromDafny_CommonError( dafnyVal._AwsCryptographyDbEncryptionSdkStructuredEncryption ); - case software.amazon.cryptography.dbencryptionsdk.dynamodb.itemencryptor.internaldafny.types.Error_ComAmazonawsDynamodb dafnyVal: - return Com.Amazonaws.Dynamodb.TypeConversion.FromDafny_CommonError( - dafnyVal._ComAmazonawsDynamodb + case software.amazon.cryptography.dbencryptionsdk.dynamodb.itemencryptor.internaldafny.types.Error_AwsCryptographyDbEncryptionSdkDynamoDb dafnyVal: + return AWS.Cryptography.DbEncryptionSDK.DynamoDb.TypeConversion.FromDafny_CommonError( + dafnyVal._AwsCryptographyDbEncryptionSdkDynamoDb ); case software.amazon.cryptography.dbencryptionsdk.dynamodb.itemencryptor.internaldafny.types.Error_AwsCryptographyPrimitives dafnyVal: return AWS.Cryptography.Primitives.TypeConversion.FromDafny_CommonError( dafnyVal._AwsCryptographyPrimitives ); - case software.amazon.cryptography.dbencryptionsdk.dynamodb.itemencryptor.internaldafny.types.Error_AwsCryptographyDbEncryptionSdkDynamoDb dafnyVal: - return AWS.Cryptography.DbEncryptionSDK.DynamoDb.TypeConversion.FromDafny_CommonError( - dafnyVal._AwsCryptographyDbEncryptionSdkDynamoDb - ); - case software.amazon.cryptography.dbencryptionsdk.dynamodb.itemencryptor.internaldafny.types.Error_AwsCryptographyMaterialProviders dafnyVal: - return AWS.Cryptography.MaterialProviders.TypeConversion.FromDafny_CommonError( - dafnyVal._AwsCryptographyMaterialProviders + case software.amazon.cryptography.dbencryptionsdk.dynamodb.itemencryptor.internaldafny.types.Error_ComAmazonawsDynamodb dafnyVal: + return Com.Amazonaws.Dynamodb.TypeConversion.FromDafny_CommonError( + dafnyVal._ComAmazonawsDynamodb ); case software.amazon.cryptography.dbencryptionsdk.dynamodb.itemencryptor.internaldafny.types.Error_DynamoDbItemEncryptorException dafnyVal: return FromDafny_N3_aws__N12_cryptography__N15_dbEncryptionSdk__N8_dynamoDb__N13_itemEncryptor__S30_DynamoDbItemEncryptorException(dafnyVal); From 85ea7033615333612424e0241bd0c386fb346e07 Mon Sep 17 00:00:00 2001 From: rishav-karanjit Date: Thu, 28 Mar 2024 13:47:35 -0700 Subject: [PATCH 25/67] Fix examples --- .../net/src/GetEncryptedDataKeyDescriptionExample.cs | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/Examples/runtimes/net/src/GetEncryptedDataKeyDescriptionExample.cs b/Examples/runtimes/net/src/GetEncryptedDataKeyDescriptionExample.cs index 0701bd4b8..92fe4ad3f 100644 --- a/Examples/runtimes/net/src/GetEncryptedDataKeyDescriptionExample.cs +++ b/Examples/runtimes/net/src/GetEncryptedDataKeyDescriptionExample.cs @@ -4,6 +4,7 @@ using System.Threading.Tasks; using System.Collections.Generic; using Amazon.DynamoDBv2.Model; +using Amazon.DynamoDBv2; using AWS.Cryptography.DbEncryptionSDK.DynamoDb; public class GetEncryptedDataKeyDescriptionExample @@ -13,6 +14,8 @@ public static async Task GetEncryptedDataKeyDescription() var kmsKeyId = TestUtils.TEST_KMS_KEY_ID; var ddbTableName = TestUtils.TEST_DDB_TABLE_NAME; + var region = Amazon.RegionEndpoint.GetBySystemName("us-east-1"); + var ddbEnc = new DynamoDbEncryption(new DynamoDbEncryptionConfig()); string header_column = "aws_dbe_head"; @@ -22,7 +25,7 @@ public static async Task GetEncryptedDataKeyDescription() ["partition_key"] = new AttributeValue("BasicPutGetExample"), ["sort_key"] = new AttributeValue { N = "0" }, }; - + // 4. Create the DynamoDb Encryption configuration for the table we will be writing to. Dictionary tableConfigs = new Dictionary(); @@ -33,10 +36,9 @@ public static async Task GetEncryptedDataKeyDescription() SortKeyName = "sort_key", }; tableConfigs.Add(ddbTableName, config); - + // 5. Create a new AWS SDK DynamoDb client using the TableEncryptionConfigs - var ddb = new Client.DynamoDbClient( - new DynamoDbTablesEncryptionConfig { TableEncryptionConfigs = tableConfigs }); + var ddb = new AmazonDynamoDBClient(); GetItemRequest getRequest = new GetItemRequest { @@ -62,7 +64,7 @@ public static async Task GetEncryptedDataKeyDescription() var encryptedDataKeyDescriptions = output.EncryptedDataKeyDescriptionOutput; Debug.Assert(encryptedDataKeyDescriptions[0].KeyProviderId == "aws-kms"); - Debug.Assert(encryptedDataKeyDescriptions[0].KeyProviderId == kmsKeyId); + Debug.Assert(encryptedDataKeyDescriptions[0].KeyProviderId == kmsKeyId); } } From 6b4a32475b1791a06d30cbb8ce71e4649fe4861a Mon Sep 17 00:00:00 2001 From: rishav-karanjit Date: Thu, 28 Mar 2024 13:49:19 -0700 Subject: [PATCH 26/67] removed unused variable --- .../runtimes/net/src/GetEncryptedDataKeyDescriptionExample.cs | 2 -- 1 file changed, 2 deletions(-) diff --git a/Examples/runtimes/net/src/GetEncryptedDataKeyDescriptionExample.cs b/Examples/runtimes/net/src/GetEncryptedDataKeyDescriptionExample.cs index 92fe4ad3f..cc12c640e 100644 --- a/Examples/runtimes/net/src/GetEncryptedDataKeyDescriptionExample.cs +++ b/Examples/runtimes/net/src/GetEncryptedDataKeyDescriptionExample.cs @@ -14,8 +14,6 @@ public static async Task GetEncryptedDataKeyDescription() var kmsKeyId = TestUtils.TEST_KMS_KEY_ID; var ddbTableName = TestUtils.TEST_DDB_TABLE_NAME; - var region = Amazon.RegionEndpoint.GetBySystemName("us-east-1"); - var ddbEnc = new DynamoDbEncryption(new DynamoDbEncryptionConfig()); string header_column = "aws_dbe_head"; From 1810c1d9907016dfec084b7254cdcd43ae87b51a Mon Sep 17 00:00:00 2001 From: rishav-karanjit Date: Thu, 28 Mar 2024 15:05:21 -0700 Subject: [PATCH 27/67] Fix example --- .../runtimes/net/src/GetEncryptedDataKeyDescriptionExample.cs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Examples/runtimes/net/src/GetEncryptedDataKeyDescriptionExample.cs b/Examples/runtimes/net/src/GetEncryptedDataKeyDescriptionExample.cs index cc12c640e..d78326573 100644 --- a/Examples/runtimes/net/src/GetEncryptedDataKeyDescriptionExample.cs +++ b/Examples/runtimes/net/src/GetEncryptedDataKeyDescriptionExample.cs @@ -6,6 +6,7 @@ using Amazon.DynamoDBv2.Model; using Amazon.DynamoDBv2; using AWS.Cryptography.DbEncryptionSDK.DynamoDb; +using Amazon.Runtime; public class GetEncryptedDataKeyDescriptionExample { @@ -62,7 +63,7 @@ public static async Task GetEncryptedDataKeyDescription() var encryptedDataKeyDescriptions = output.EncryptedDataKeyDescriptionOutput; Debug.Assert(encryptedDataKeyDescriptions[0].KeyProviderId == "aws-kms"); - Debug.Assert(encryptedDataKeyDescriptions[0].KeyProviderId == kmsKeyId); + Debug.Assert(encryptedDataKeyDescriptions[0].KeyProviderInfo == kmsKeyId); } } From 900c398e925eb508505c46e258023a21d80e1833 Mon Sep 17 00:00:00 2001 From: rishav-karanjit Date: Thu, 28 Mar 2024 15:18:14 -0700 Subject: [PATCH 28/67] Format dafny code --- .../src/AwsCryptographyDbEncryptionSdkDynamoDbOperations.dfy | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/DynamoDbEncryption/dafny/DynamoDbEncryption/src/AwsCryptographyDbEncryptionSdkDynamoDbOperations.dfy b/DynamoDbEncryption/dafny/DynamoDbEncryption/src/AwsCryptographyDbEncryptionSdkDynamoDbOperations.dfy index b9c605365..05186a71a 100644 --- a/DynamoDbEncryption/dafny/DynamoDbEncryption/src/AwsCryptographyDbEncryptionSdkDynamoDbOperations.dfy +++ b/DynamoDbEncryption/dafny/DynamoDbEncryption/src/AwsCryptographyDbEncryptionSdkDynamoDbOperations.dfy @@ -20,7 +20,7 @@ module AwsCryptographyDbEncryptionSdkDynamoDbOperations refines AbstractAwsCrypt { {} } datatype Config = Config( - ) + ) type InternalConfig = Config From 92751512f6e004cfd83e8fff85a1827df42c8f08 Mon Sep 17 00:00:00 2001 From: rishav-karanjit Date: Fri, 29 Mar 2024 09:08:29 -0700 Subject: [PATCH 29/67] Add comments to dotnet example --- .../GetEncryptedDataKeyDescriptionExample.cs | 30 +++++-------------- 1 file changed, 7 insertions(+), 23 deletions(-) diff --git a/Examples/runtimes/net/src/GetEncryptedDataKeyDescriptionExample.cs b/Examples/runtimes/net/src/GetEncryptedDataKeyDescriptionExample.cs index d78326573..72700c336 100644 --- a/Examples/runtimes/net/src/GetEncryptedDataKeyDescriptionExample.cs +++ b/Examples/runtimes/net/src/GetEncryptedDataKeyDescriptionExample.cs @@ -6,7 +6,6 @@ using Amazon.DynamoDBv2.Model; using Amazon.DynamoDBv2; using AWS.Cryptography.DbEncryptionSDK.DynamoDb; -using Amazon.Runtime; public class GetEncryptedDataKeyDescriptionExample { @@ -14,54 +13,39 @@ public static async Task GetEncryptedDataKeyDescription() { var kmsKeyId = TestUtils.TEST_KMS_KEY_ID; var ddbTableName = TestUtils.TEST_DDB_TABLE_NAME; - var ddbEnc = new DynamoDbEncryption(new DynamoDbEncryptionConfig()); - string header_column = "aws_dbe_head"; + // 1. Define keys that will be used to retrieve item from the DynamoDB table. var keyToGet = new Dictionary { ["partition_key"] = new AttributeValue("BasicPutGetExample"), ["sort_key"] = new AttributeValue { N = "0" }, }; - // 4. Create the DynamoDb Encryption configuration for the table we will be writing to. - Dictionary tableConfigs = - new Dictionary(); - DynamoDbTableEncryptionConfig config = new DynamoDbTableEncryptionConfig - { - LogicalTableName = ddbTableName, - PartitionKeyName = "partition_key", - SortKeyName = "sort_key", - }; - tableConfigs.Add(ddbTableName, config); - - // 5. Create a new AWS SDK DynamoDb client using the TableEncryptionConfigs + // 2. Create a Amazon DynamoDB Client and retrieve item from DynamoDB table var ddb = new AmazonDynamoDBClient(); - GetItemRequest getRequest = new GetItemRequest { Key = keyToGet, TableName = ddbTableName, }; - GetItemResponse getResponse = await ddb.GetItemAsync(getRequest); + // Demonstrate that PutItem succeeded Debug.Assert(getResponse.HttpStatusCode == HttpStatusCode.OK); + + // 3. Extract the item from the dynamoDB table and prepare input for the GetEncryptedDataKeyDescription method. + // Here, we are sending header as the input by getting it from "aws_dbe_head" attribute but you can send a complete DDB item as well. var returnedItem = getResponse.Item; - GetEncryptedDataKeyDescriptionUnion InputUnion = new GetEncryptedDataKeyDescriptionUnion(); - InputUnion.Header = returnedItem[header_column].B; - GetEncryptedDataKeyDescriptionInput Input = new GetEncryptedDataKeyDescriptionInput(); - Input.Input = InputUnion; - GetEncryptedDataKeyDescriptionOutput output = ddbEnc.GetEncryptedDataKeyDescription(Input); + // 4. Get encrypted DataKey Descriptions from GetEncryptedDataKeyDescription method output and assert if its true. var encryptedDataKeyDescriptions = output.EncryptedDataKeyDescriptionOutput; - Debug.Assert(encryptedDataKeyDescriptions[0].KeyProviderId == "aws-kms"); Debug.Assert(encryptedDataKeyDescriptions[0].KeyProviderInfo == kmsKeyId); } From fe44b3fe55978b207f7fd32a01e50c7ea64575ea Mon Sep 17 00:00:00 2001 From: rishav-karanjit Date: Fri, 29 Mar 2024 09:47:10 -0700 Subject: [PATCH 30/67] Update dafny test --- ...moDbGetEncryptedDataKeyDescriptionTest.dfy | 64 +++++++++++++++++++ 1 file changed, 64 insertions(+) diff --git a/DynamoDbEncryption/dafny/DynamoDbEncryption/test/DynamoDbGetEncryptedDataKeyDescriptionTest.dfy b/DynamoDbEncryption/dafny/DynamoDbEncryption/test/DynamoDbGetEncryptedDataKeyDescriptionTest.dfy index 7871723c1..d237b6d0a 100644 --- a/DynamoDbEncryption/dafny/DynamoDbEncryption/test/DynamoDbGetEncryptedDataKeyDescriptionTest.dfy +++ b/DynamoDbEncryption/dafny/DynamoDbEncryption/test/DynamoDbGetEncryptedDataKeyDescriptionTest.dfy @@ -308,6 +308,70 @@ module DynamoDbGetEncryptedDataKeyDescriptionTest { expect actualDataKeyDescription.Extract().EncryptedDataKeyDescriptionOutput[0].keyProviderInfo.Extract() == UTF8.Decode(expectedHead.dataKeys[0].keyProviderInfo).Extract(); } + method {:test} TestHeaderMultiDataKeyCase() + { + var expectedHead := CreatePartialHeader(testVersion, testFlavor, testMsgID, testLegend, testEncContext, [testAwsKmsDataKey, testAwsKmsRsaDataKey]); + var serializedHeader := expectedHead.serialize() + expectedHead.msgID; + + var ddbEncResources :- expect DynamoDbEncryption.DynamoDbEncryption(); + + var inputVariable: Types.GetEncryptedDataKeyDescriptionInput := + Types.GetEncryptedDataKeyDescriptionInput( + input := Types.header(header := serializedHeader) + ); + + var actualDataKeyDescription := ddbEncResources.GetEncryptedDataKeyDescription(inputVariable); + + expect actualDataKeyDescription.Success?; + expect |actualDataKeyDescription.Extract().EncryptedDataKeyDescriptionOutput| == |expectedHead.dataKeys|; + expect |actualDataKeyDescription.Extract().EncryptedDataKeyDescriptionOutput| > 0; + + var i := 0; + while (i < |expectedHead.dataKeys|) { + expect UTF8.Decode(expectedHead.dataKeys[i].keyProviderId).Success?; + expect UTF8.Decode(expectedHead.dataKeys[i].keyProviderInfo).Success?; + expect actualDataKeyDescription.Extract().EncryptedDataKeyDescriptionOutput[i].keyProviderInfo.Some?; + + expect actualDataKeyDescription.Extract().EncryptedDataKeyDescriptionOutput[i].keyProviderId == UTF8.Decode(expectedHead.dataKeys[i].keyProviderId).Extract(); + expect actualDataKeyDescription.Extract().EncryptedDataKeyDescriptionOutput[i].keyProviderInfo.Extract() == UTF8.Decode(expectedHead.dataKeys[i].keyProviderInfo).Extract(); + + i := i + 1; + } + } + + method {:test} TestDDBItemInputMultiDataKeyCase() + { + var expectedHead := CreatePartialHeader(testVersion, testFlavor, testMsgID, testLegend, testEncContext, [testAwsKmsDataKey, testAwsKmsRsaDataKey]); + var serializedHeader := expectedHead.serialize() + expectedHead.msgID; + + var attr := map["aws_dbe_head" := ComAmazonawsDynamodbTypes.AttributeValue.B(serializedHeader)]; + var ddbEncResources :- expect DynamoDbEncryption.DynamoDbEncryption(); + + + var inputVariable: Types.GetEncryptedDataKeyDescriptionInput := + Types.GetEncryptedDataKeyDescriptionInput( + input := Types.plaintextItem(plaintextItem := attr) + ); + + var actualDataKeyDescription := ddbEncResources.GetEncryptedDataKeyDescription(inputVariable); + + expect actualDataKeyDescription.Success?; + expect |actualDataKeyDescription.Extract().EncryptedDataKeyDescriptionOutput| == |expectedHead.dataKeys|; + expect |actualDataKeyDescription.Extract().EncryptedDataKeyDescriptionOutput| > 0; + + var i := 0; + while (i < |expectedHead.dataKeys|) { + expect UTF8.Decode(expectedHead.dataKeys[i].keyProviderId).Success?; + expect UTF8.Decode(expectedHead.dataKeys[i].keyProviderInfo).Success?; + expect actualDataKeyDescription.Extract().EncryptedDataKeyDescriptionOutput[i].keyProviderInfo.Some?; + + expect actualDataKeyDescription.Extract().EncryptedDataKeyDescriptionOutput[i].keyProviderId == UTF8.Decode(expectedHead.dataKeys[i].keyProviderId).Extract(); + expect actualDataKeyDescription.Extract().EncryptedDataKeyDescriptionOutput[i].keyProviderInfo.Extract() == UTF8.Decode(expectedHead.dataKeys[i].keyProviderInfo).Extract(); + + i := i + 1; + } + } + method getBranchKeyVersion (expectedHead : PartialHeader) returns (expectedBranchKeyVersion : string) { From 29ab4f5a2639a75cde5aa10f3aecd750ee6112b7 Mon Sep 17 00:00:00 2001 From: rishav-karanjit Date: Fri, 29 Mar 2024 11:14:25 -0700 Subject: [PATCH 31/67] Add dotnet generated --- .../net/Generated/DDBEncryption/AsSet.cs | 13 + .../DDBEncryption/BeaconKeySource.cs | 32 + .../Generated/DDBEncryption/BeaconStyle.cs | 50 + .../Generated/DDBEncryption/BeaconVersion.cs | 79 ++ .../DDBEncryption/CollectionOfErrors.cs | 13 + .../Generated/DDBEncryption/CompoundBeacon.cs | 53 + .../Generated/DDBEncryption/Constructor.cs | 20 + .../DDBEncryption/ConstructorPart.cs | 29 + ...amoDbEncryptionBranchKeyIdSupplierInput.cs | 20 + ...moDbEncryptionBranchKeyIdSupplierOutput.cs | 20 + .../DDBEncryption/DynamoDbEncryption.cs | 37 + .../DDBEncryption/DynamoDbEncryptionConfig.cs | 13 + .../DynamoDbEncryptionException.cs | 10 + .../DynamoDbKeyBranchKeyIdSupplier.cs | 19 + .../DynamoDbKeyBranchKeyIdSupplierBase.cs | 13 + .../DynamoDbTableEncryptionConfig.cs | 110 ++ .../DynamoDbTablesEncryptionConfig.cs | 20 + .../EncryptedDataKeyDescriptionOutput.cs | 44 + .../Generated/DDBEncryption/EncryptedPart.cs | 29 + .../GetBranchKeyIdFromDdbKeyInput.cs | 20 + .../GetBranchKeyIdFromDdbKeyOutput.cs | 20 + .../GetEncryptedDataKeyDescriptionInput.cs | 20 + .../GetEncryptedDataKeyDescriptionOutput.cs | 20 + .../GetEncryptedDataKeyDescriptionUnion.cs | 32 + .../net/Generated/DDBEncryption/GetPrefix.cs | 20 + .../net/Generated/DDBEncryption/GetSegment.cs | 29 + .../Generated/DDBEncryption/GetSegments.cs | 38 + .../Generated/DDBEncryption/GetSubstring.cs | 29 + .../net/Generated/DDBEncryption/GetSuffix.cs | 20 + .../IDynamoDbKeyBranchKeyIdSupplier.cs | 9 + .../DDBEncryption/ILegacyDynamoDbEncryptor.cs | 9 + .../net/Generated/DDBEncryption/Insert.cs | 20 + .../DDBEncryption/LegacyDynamoDbEncryptor.cs | 14 + .../LegacyDynamoDbEncryptorBase.cs | 9 + .../Generated/DDBEncryption/LegacyOverride.cs | 46 + .../Generated/DDBEncryption/LegacyPolicy.cs | 19 + .../net/Generated/DDBEncryption/Lower.cs | 13 + .../Generated/DDBEncryption/MultiKeyStore.cs | 37 + ...eWrapper_DynamoDbKeyBranchKeyIdSupplier.cs | 45 + .../NativeWrapper_LegacyDynamoDbEncryptor.cs | 21 + .../Generated/DDBEncryption/OpaqueError.cs | 13 + .../net/Generated/DDBEncryption/PartOnly.cs | 13 + .../DDBEncryption/PlaintextOverride.cs | 19 + .../Generated/DDBEncryption/SearchConfig.cs | 29 + .../net/Generated/DDBEncryption/Shared.cs | 20 + .../net/Generated/DDBEncryption/SharedSet.cs | 20 + .../net/Generated/DDBEncryption/SignedPart.cs | 37 + .../Generated/DDBEncryption/SingleKeyStore.cs | 29 + .../Generated/DDBEncryption/StandardBeacon.cs | 45 + .../Generated/DDBEncryption/TypeConversion.cs | 1157 +++++++++++++++++ .../net/Generated/DDBEncryption/Upper.cs | 13 + .../Generated/DDBEncryption/VirtualField.cs | 29 + .../Generated/DDBEncryption/VirtualPart.cs | 28 + .../DDBEncryption/VirtualTransform.cs | 86 ++ 54 files changed, 2652 insertions(+) create mode 100644 TestVectors/runtimes/net/Generated/DDBEncryption/AsSet.cs create mode 100644 TestVectors/runtimes/net/Generated/DDBEncryption/BeaconKeySource.cs create mode 100644 TestVectors/runtimes/net/Generated/DDBEncryption/BeaconStyle.cs create mode 100644 TestVectors/runtimes/net/Generated/DDBEncryption/BeaconVersion.cs create mode 100644 TestVectors/runtimes/net/Generated/DDBEncryption/CollectionOfErrors.cs create mode 100644 TestVectors/runtimes/net/Generated/DDBEncryption/CompoundBeacon.cs create mode 100644 TestVectors/runtimes/net/Generated/DDBEncryption/Constructor.cs create mode 100644 TestVectors/runtimes/net/Generated/DDBEncryption/ConstructorPart.cs create mode 100644 TestVectors/runtimes/net/Generated/DDBEncryption/CreateDynamoDbEncryptionBranchKeyIdSupplierInput.cs create mode 100644 TestVectors/runtimes/net/Generated/DDBEncryption/CreateDynamoDbEncryptionBranchKeyIdSupplierOutput.cs create mode 100644 TestVectors/runtimes/net/Generated/DDBEncryption/DynamoDbEncryption.cs create mode 100644 TestVectors/runtimes/net/Generated/DDBEncryption/DynamoDbEncryptionConfig.cs create mode 100644 TestVectors/runtimes/net/Generated/DDBEncryption/DynamoDbEncryptionException.cs create mode 100644 TestVectors/runtimes/net/Generated/DDBEncryption/DynamoDbKeyBranchKeyIdSupplier.cs create mode 100644 TestVectors/runtimes/net/Generated/DDBEncryption/DynamoDbKeyBranchKeyIdSupplierBase.cs create mode 100644 TestVectors/runtimes/net/Generated/DDBEncryption/DynamoDbTableEncryptionConfig.cs create mode 100644 TestVectors/runtimes/net/Generated/DDBEncryption/DynamoDbTablesEncryptionConfig.cs create mode 100644 TestVectors/runtimes/net/Generated/DDBEncryption/EncryptedDataKeyDescriptionOutput.cs create mode 100644 TestVectors/runtimes/net/Generated/DDBEncryption/EncryptedPart.cs create mode 100644 TestVectors/runtimes/net/Generated/DDBEncryption/GetBranchKeyIdFromDdbKeyInput.cs create mode 100644 TestVectors/runtimes/net/Generated/DDBEncryption/GetBranchKeyIdFromDdbKeyOutput.cs create mode 100644 TestVectors/runtimes/net/Generated/DDBEncryption/GetEncryptedDataKeyDescriptionInput.cs create mode 100644 TestVectors/runtimes/net/Generated/DDBEncryption/GetEncryptedDataKeyDescriptionOutput.cs create mode 100644 TestVectors/runtimes/net/Generated/DDBEncryption/GetEncryptedDataKeyDescriptionUnion.cs create mode 100644 TestVectors/runtimes/net/Generated/DDBEncryption/GetPrefix.cs create mode 100644 TestVectors/runtimes/net/Generated/DDBEncryption/GetSegment.cs create mode 100644 TestVectors/runtimes/net/Generated/DDBEncryption/GetSegments.cs create mode 100644 TestVectors/runtimes/net/Generated/DDBEncryption/GetSubstring.cs create mode 100644 TestVectors/runtimes/net/Generated/DDBEncryption/GetSuffix.cs create mode 100644 TestVectors/runtimes/net/Generated/DDBEncryption/IDynamoDbKeyBranchKeyIdSupplier.cs create mode 100644 TestVectors/runtimes/net/Generated/DDBEncryption/ILegacyDynamoDbEncryptor.cs create mode 100644 TestVectors/runtimes/net/Generated/DDBEncryption/Insert.cs create mode 100644 TestVectors/runtimes/net/Generated/DDBEncryption/LegacyDynamoDbEncryptor.cs create mode 100644 TestVectors/runtimes/net/Generated/DDBEncryption/LegacyDynamoDbEncryptorBase.cs create mode 100644 TestVectors/runtimes/net/Generated/DDBEncryption/LegacyOverride.cs create mode 100644 TestVectors/runtimes/net/Generated/DDBEncryption/LegacyPolicy.cs create mode 100644 TestVectors/runtimes/net/Generated/DDBEncryption/Lower.cs create mode 100644 TestVectors/runtimes/net/Generated/DDBEncryption/MultiKeyStore.cs create mode 100644 TestVectors/runtimes/net/Generated/DDBEncryption/NativeWrapper_DynamoDbKeyBranchKeyIdSupplier.cs create mode 100644 TestVectors/runtimes/net/Generated/DDBEncryption/NativeWrapper_LegacyDynamoDbEncryptor.cs create mode 100644 TestVectors/runtimes/net/Generated/DDBEncryption/OpaqueError.cs create mode 100644 TestVectors/runtimes/net/Generated/DDBEncryption/PartOnly.cs create mode 100644 TestVectors/runtimes/net/Generated/DDBEncryption/PlaintextOverride.cs create mode 100644 TestVectors/runtimes/net/Generated/DDBEncryption/SearchConfig.cs create mode 100644 TestVectors/runtimes/net/Generated/DDBEncryption/Shared.cs create mode 100644 TestVectors/runtimes/net/Generated/DDBEncryption/SharedSet.cs create mode 100644 TestVectors/runtimes/net/Generated/DDBEncryption/SignedPart.cs create mode 100644 TestVectors/runtimes/net/Generated/DDBEncryption/SingleKeyStore.cs create mode 100644 TestVectors/runtimes/net/Generated/DDBEncryption/StandardBeacon.cs create mode 100644 TestVectors/runtimes/net/Generated/DDBEncryption/TypeConversion.cs create mode 100644 TestVectors/runtimes/net/Generated/DDBEncryption/Upper.cs create mode 100644 TestVectors/runtimes/net/Generated/DDBEncryption/VirtualField.cs create mode 100644 TestVectors/runtimes/net/Generated/DDBEncryption/VirtualPart.cs create mode 100644 TestVectors/runtimes/net/Generated/DDBEncryption/VirtualTransform.cs diff --git a/TestVectors/runtimes/net/Generated/DDBEncryption/AsSet.cs b/TestVectors/runtimes/net/Generated/DDBEncryption/AsSet.cs new file mode 100644 index 000000000..d565d1965 --- /dev/null +++ b/TestVectors/runtimes/net/Generated/DDBEncryption/AsSet.cs @@ -0,0 +1,13 @@ +// Copyright Amazon.com Inc. or its affiliates. All Rights Reserved. +// SPDX-License-Identifier: Apache-2.0 +// Do not modify this file. This file is machine generated, and any changes to it will be overwritten. +using System; + using AWS.Cryptography.DbEncryptionSDK.DynamoDb; namespace AWS.Cryptography.DbEncryptionSDK.DynamoDb { + public class AsSet { + + + public void Validate() { + +} +} +} diff --git a/TestVectors/runtimes/net/Generated/DDBEncryption/BeaconKeySource.cs b/TestVectors/runtimes/net/Generated/DDBEncryption/BeaconKeySource.cs new file mode 100644 index 000000000..e9ab915de --- /dev/null +++ b/TestVectors/runtimes/net/Generated/DDBEncryption/BeaconKeySource.cs @@ -0,0 +1,32 @@ +// Copyright Amazon.com Inc. or its affiliates. All Rights Reserved. +// SPDX-License-Identifier: Apache-2.0 +// Do not modify this file. This file is machine generated, and any changes to it will be overwritten. +using System; + using AWS.Cryptography.DbEncryptionSDK.DynamoDb; namespace AWS.Cryptography.DbEncryptionSDK.DynamoDb { + public class BeaconKeySource { + private AWS.Cryptography.DbEncryptionSDK.DynamoDb.SingleKeyStore _single ; + private AWS.Cryptography.DbEncryptionSDK.DynamoDb.MultiKeyStore _multi ; + public AWS.Cryptography.DbEncryptionSDK.DynamoDb.SingleKeyStore Single { + get { return this._single; } + set { this._single = value; } +} + public bool IsSetSingle () { + return this._single != null; +} + public AWS.Cryptography.DbEncryptionSDK.DynamoDb.MultiKeyStore Multi { + get { return this._multi; } + set { this._multi = value; } +} + public bool IsSetMulti () { + return this._multi != null; +} + public void Validate() { + var numberOfPropertiesSet = Convert.ToUInt16(IsSetSingle()) + + Convert.ToUInt16(IsSetMulti()) ; + if (numberOfPropertiesSet == 0) throw new System.ArgumentException("No union value set"); + + if (numberOfPropertiesSet > 1) throw new System.ArgumentException("Multiple union values set"); + +} +} +} diff --git a/TestVectors/runtimes/net/Generated/DDBEncryption/BeaconStyle.cs b/TestVectors/runtimes/net/Generated/DDBEncryption/BeaconStyle.cs new file mode 100644 index 000000000..a3cfa70f5 --- /dev/null +++ b/TestVectors/runtimes/net/Generated/DDBEncryption/BeaconStyle.cs @@ -0,0 +1,50 @@ +// Copyright Amazon.com Inc. or its affiliates. All Rights Reserved. +// SPDX-License-Identifier: Apache-2.0 +// Do not modify this file. This file is machine generated, and any changes to it will be overwritten. +using System; + using AWS.Cryptography.DbEncryptionSDK.DynamoDb; namespace AWS.Cryptography.DbEncryptionSDK.DynamoDb { + public class BeaconStyle { + private AWS.Cryptography.DbEncryptionSDK.DynamoDb.PartOnly _partOnly ; + private AWS.Cryptography.DbEncryptionSDK.DynamoDb.Shared _shared ; + private AWS.Cryptography.DbEncryptionSDK.DynamoDb.AsSet _asSet ; + private AWS.Cryptography.DbEncryptionSDK.DynamoDb.SharedSet _sharedSet ; + public AWS.Cryptography.DbEncryptionSDK.DynamoDb.PartOnly PartOnly { + get { return this._partOnly; } + set { this._partOnly = value; } +} + public bool IsSetPartOnly () { + return this._partOnly != null; +} + public AWS.Cryptography.DbEncryptionSDK.DynamoDb.Shared Shared { + get { return this._shared; } + set { this._shared = value; } +} + public bool IsSetShared () { + return this._shared != null; +} + public AWS.Cryptography.DbEncryptionSDK.DynamoDb.AsSet AsSet { + get { return this._asSet; } + set { this._asSet = value; } +} + public bool IsSetAsSet () { + return this._asSet != null; +} + public AWS.Cryptography.DbEncryptionSDK.DynamoDb.SharedSet SharedSet { + get { return this._sharedSet; } + set { this._sharedSet = value; } +} + public bool IsSetSharedSet () { + return this._sharedSet != null; +} + public void Validate() { + var numberOfPropertiesSet = Convert.ToUInt16(IsSetPartOnly()) + + Convert.ToUInt16(IsSetShared()) + + Convert.ToUInt16(IsSetAsSet()) + + Convert.ToUInt16(IsSetSharedSet()) ; + if (numberOfPropertiesSet == 0) throw new System.ArgumentException("No union value set"); + + if (numberOfPropertiesSet > 1) throw new System.ArgumentException("Multiple union values set"); + +} +} +} diff --git a/TestVectors/runtimes/net/Generated/DDBEncryption/BeaconVersion.cs b/TestVectors/runtimes/net/Generated/DDBEncryption/BeaconVersion.cs new file mode 100644 index 000000000..c3b66814d --- /dev/null +++ b/TestVectors/runtimes/net/Generated/DDBEncryption/BeaconVersion.cs @@ -0,0 +1,79 @@ +// Copyright Amazon.com Inc. or its affiliates. All Rights Reserved. +// SPDX-License-Identifier: Apache-2.0 +// Do not modify this file. This file is machine generated, and any changes to it will be overwritten. +using System; + using AWS.Cryptography.DbEncryptionSDK.DynamoDb; namespace AWS.Cryptography.DbEncryptionSDK.DynamoDb { + public class BeaconVersion { + private int? _version ; + private AWS.Cryptography.KeyStore.KeyStore _keyStore ; + private AWS.Cryptography.DbEncryptionSDK.DynamoDb.BeaconKeySource _keySource ; + private System.Collections.Generic.List _standardBeacons ; + private System.Collections.Generic.List _compoundBeacons ; + private System.Collections.Generic.List _virtualFields ; + private System.Collections.Generic.List _encryptedParts ; + private System.Collections.Generic.List _signedParts ; + public int Version { + get { return this._version.GetValueOrDefault(); } + set { this._version = value; } +} + public bool IsSetVersion () { + return this._version.HasValue; +} + public AWS.Cryptography.KeyStore.KeyStore KeyStore { + get { return this._keyStore; } + set { this._keyStore = value; } +} + public bool IsSetKeyStore () { + return this._keyStore != null; +} + public AWS.Cryptography.DbEncryptionSDK.DynamoDb.BeaconKeySource KeySource { + get { return this._keySource; } + set { this._keySource = value; } +} + public bool IsSetKeySource () { + return this._keySource != null; +} + public System.Collections.Generic.List StandardBeacons { + get { return this._standardBeacons; } + set { this._standardBeacons = value; } +} + public bool IsSetStandardBeacons () { + return this._standardBeacons != null; +} + public System.Collections.Generic.List CompoundBeacons { + get { return this._compoundBeacons; } + set { this._compoundBeacons = value; } +} + public bool IsSetCompoundBeacons () { + return this._compoundBeacons != null; +} + public System.Collections.Generic.List VirtualFields { + get { return this._virtualFields; } + set { this._virtualFields = value; } +} + public bool IsSetVirtualFields () { + return this._virtualFields != null; +} + public System.Collections.Generic.List EncryptedParts { + get { return this._encryptedParts; } + set { this._encryptedParts = value; } +} + public bool IsSetEncryptedParts () { + return this._encryptedParts != null; +} + public System.Collections.Generic.List SignedParts { + get { return this._signedParts; } + set { this._signedParts = value; } +} + public bool IsSetSignedParts () { + return this._signedParts != null; +} + public void Validate() { + if (!IsSetVersion()) throw new System.ArgumentException("Missing value for required property 'Version'"); + if (!IsSetKeyStore()) throw new System.ArgumentException("Missing value for required property 'KeyStore'"); + if (!IsSetKeySource()) throw new System.ArgumentException("Missing value for required property 'KeySource'"); + if (!IsSetStandardBeacons()) throw new System.ArgumentException("Missing value for required property 'StandardBeacons'"); + +} +} +} diff --git a/TestVectors/runtimes/net/Generated/DDBEncryption/CollectionOfErrors.cs b/TestVectors/runtimes/net/Generated/DDBEncryption/CollectionOfErrors.cs new file mode 100644 index 000000000..f249d91c7 --- /dev/null +++ b/TestVectors/runtimes/net/Generated/DDBEncryption/CollectionOfErrors.cs @@ -0,0 +1,13 @@ +// Copyright Amazon.com Inc. or its affiliates. All Rights Reserved. +// SPDX-License-Identifier: Apache-2.0 +// Do not modify this file. This file is machine generated, and any changes to it will be overwritten. +using System; + using AWS.Cryptography.DbEncryptionSDK.DynamoDb; namespace AWS.Cryptography.DbEncryptionSDK.DynamoDb { + public class CollectionOfErrors : Exception { + public readonly System.Collections.Generic.List list; + public CollectionOfErrors(System.Collections.Generic.List list, string message) : base(message) { this.list = list; } + public CollectionOfErrors(string message) : base(message) { this.list = new System.Collections.Generic.List(); } + public CollectionOfErrors() : base("CollectionOfErrors") { this.list = new System.Collections.Generic.List(); } +} + +} diff --git a/TestVectors/runtimes/net/Generated/DDBEncryption/CompoundBeacon.cs b/TestVectors/runtimes/net/Generated/DDBEncryption/CompoundBeacon.cs new file mode 100644 index 000000000..911a75926 --- /dev/null +++ b/TestVectors/runtimes/net/Generated/DDBEncryption/CompoundBeacon.cs @@ -0,0 +1,53 @@ +// Copyright Amazon.com Inc. or its affiliates. All Rights Reserved. +// SPDX-License-Identifier: Apache-2.0 +// Do not modify this file. This file is machine generated, and any changes to it will be overwritten. +using System; + using AWS.Cryptography.DbEncryptionSDK.DynamoDb; namespace AWS.Cryptography.DbEncryptionSDK.DynamoDb { + public class CompoundBeacon { + private string _name ; + private string _split ; + private System.Collections.Generic.List _encrypted ; + private System.Collections.Generic.List _signed ; + private System.Collections.Generic.List _constructors ; + public string Name { + get { return this._name; } + set { this._name = value; } +} + public bool IsSetName () { + return this._name != null; +} + public string Split { + get { return this._split; } + set { this._split = value; } +} + public bool IsSetSplit () { + return this._split != null; +} + public System.Collections.Generic.List Encrypted { + get { return this._encrypted; } + set { this._encrypted = value; } +} + public bool IsSetEncrypted () { + return this._encrypted != null; +} + public System.Collections.Generic.List Signed { + get { return this._signed; } + set { this._signed = value; } +} + public bool IsSetSigned () { + return this._signed != null; +} + public System.Collections.Generic.List Constructors { + get { return this._constructors; } + set { this._constructors = value; } +} + public bool IsSetConstructors () { + return this._constructors != null; +} + public void Validate() { + if (!IsSetName()) throw new System.ArgumentException("Missing value for required property 'Name'"); + if (!IsSetSplit()) throw new System.ArgumentException("Missing value for required property 'Split'"); + +} +} +} diff --git a/TestVectors/runtimes/net/Generated/DDBEncryption/Constructor.cs b/TestVectors/runtimes/net/Generated/DDBEncryption/Constructor.cs new file mode 100644 index 000000000..5a3c39934 --- /dev/null +++ b/TestVectors/runtimes/net/Generated/DDBEncryption/Constructor.cs @@ -0,0 +1,20 @@ +// Copyright Amazon.com Inc. or its affiliates. All Rights Reserved. +// SPDX-License-Identifier: Apache-2.0 +// Do not modify this file. This file is machine generated, and any changes to it will be overwritten. +using System; + using AWS.Cryptography.DbEncryptionSDK.DynamoDb; namespace AWS.Cryptography.DbEncryptionSDK.DynamoDb { + public class Constructor { + private System.Collections.Generic.List _parts ; + public System.Collections.Generic.List Parts { + get { return this._parts; } + set { this._parts = value; } +} + public bool IsSetParts () { + return this._parts != null; +} + public void Validate() { + if (!IsSetParts()) throw new System.ArgumentException("Missing value for required property 'Parts'"); + +} +} +} diff --git a/TestVectors/runtimes/net/Generated/DDBEncryption/ConstructorPart.cs b/TestVectors/runtimes/net/Generated/DDBEncryption/ConstructorPart.cs new file mode 100644 index 000000000..e773a8133 --- /dev/null +++ b/TestVectors/runtimes/net/Generated/DDBEncryption/ConstructorPart.cs @@ -0,0 +1,29 @@ +// Copyright Amazon.com Inc. or its affiliates. All Rights Reserved. +// SPDX-License-Identifier: Apache-2.0 +// Do not modify this file. This file is machine generated, and any changes to it will be overwritten. +using System; + using AWS.Cryptography.DbEncryptionSDK.DynamoDb; namespace AWS.Cryptography.DbEncryptionSDK.DynamoDb { + public class ConstructorPart { + private string _name ; + private bool? _required ; + public string Name { + get { return this._name; } + set { this._name = value; } +} + public bool IsSetName () { + return this._name != null; +} + public bool Required { + get { return this._required.GetValueOrDefault(); } + set { this._required = value; } +} + public bool IsSetRequired () { + return this._required.HasValue; +} + public void Validate() { + if (!IsSetName()) throw new System.ArgumentException("Missing value for required property 'Name'"); + if (!IsSetRequired()) throw new System.ArgumentException("Missing value for required property 'Required'"); + +} +} +} diff --git a/TestVectors/runtimes/net/Generated/DDBEncryption/CreateDynamoDbEncryptionBranchKeyIdSupplierInput.cs b/TestVectors/runtimes/net/Generated/DDBEncryption/CreateDynamoDbEncryptionBranchKeyIdSupplierInput.cs new file mode 100644 index 000000000..bd3f96700 --- /dev/null +++ b/TestVectors/runtimes/net/Generated/DDBEncryption/CreateDynamoDbEncryptionBranchKeyIdSupplierInput.cs @@ -0,0 +1,20 @@ +// Copyright Amazon.com Inc. or its affiliates. All Rights Reserved. +// SPDX-License-Identifier: Apache-2.0 +// Do not modify this file. This file is machine generated, and any changes to it will be overwritten. +using System; + using AWS.Cryptography.DbEncryptionSDK.DynamoDb; namespace AWS.Cryptography.DbEncryptionSDK.DynamoDb { + public class CreateDynamoDbEncryptionBranchKeyIdSupplierInput { + private AWS.Cryptography.DbEncryptionSDK.DynamoDb.IDynamoDbKeyBranchKeyIdSupplier _ddbKeyBranchKeyIdSupplier ; + public AWS.Cryptography.DbEncryptionSDK.DynamoDb.IDynamoDbKeyBranchKeyIdSupplier DdbKeyBranchKeyIdSupplier { + get { return this._ddbKeyBranchKeyIdSupplier; } + set { this._ddbKeyBranchKeyIdSupplier = value; } +} + public bool IsSetDdbKeyBranchKeyIdSupplier () { + return this._ddbKeyBranchKeyIdSupplier != null; +} + public void Validate() { + if (!IsSetDdbKeyBranchKeyIdSupplier()) throw new System.ArgumentException("Missing value for required property 'DdbKeyBranchKeyIdSupplier'"); + +} +} +} diff --git a/TestVectors/runtimes/net/Generated/DDBEncryption/CreateDynamoDbEncryptionBranchKeyIdSupplierOutput.cs b/TestVectors/runtimes/net/Generated/DDBEncryption/CreateDynamoDbEncryptionBranchKeyIdSupplierOutput.cs new file mode 100644 index 000000000..6765712ae --- /dev/null +++ b/TestVectors/runtimes/net/Generated/DDBEncryption/CreateDynamoDbEncryptionBranchKeyIdSupplierOutput.cs @@ -0,0 +1,20 @@ +// Copyright Amazon.com Inc. or its affiliates. All Rights Reserved. +// SPDX-License-Identifier: Apache-2.0 +// Do not modify this file. This file is machine generated, and any changes to it will be overwritten. +using System; + using AWS.Cryptography.DbEncryptionSDK.DynamoDb; namespace AWS.Cryptography.DbEncryptionSDK.DynamoDb { + public class CreateDynamoDbEncryptionBranchKeyIdSupplierOutput { + private AWS.Cryptography.MaterialProviders.IBranchKeyIdSupplier _branchKeyIdSupplier ; + public AWS.Cryptography.MaterialProviders.IBranchKeyIdSupplier BranchKeyIdSupplier { + get { return this._branchKeyIdSupplier; } + set { this._branchKeyIdSupplier = value; } +} + public bool IsSetBranchKeyIdSupplier () { + return this._branchKeyIdSupplier != null; +} + public void Validate() { + if (!IsSetBranchKeyIdSupplier()) throw new System.ArgumentException("Missing value for required property 'BranchKeyIdSupplier'"); + +} +} +} diff --git a/TestVectors/runtimes/net/Generated/DDBEncryption/DynamoDbEncryption.cs b/TestVectors/runtimes/net/Generated/DDBEncryption/DynamoDbEncryption.cs new file mode 100644 index 000000000..2be057a61 --- /dev/null +++ b/TestVectors/runtimes/net/Generated/DDBEncryption/DynamoDbEncryption.cs @@ -0,0 +1,37 @@ +// Copyright Amazon.com Inc. or its affiliates. All Rights Reserved. +// SPDX-License-Identifier: Apache-2.0 +// Do not modify this file. This file is machine generated, and any changes to it will be overwritten. +using System; + using System.IO; + using System.Collections.Generic; + using AWS.Cryptography.DbEncryptionSDK.DynamoDb; + using software.amazon.cryptography.dbencryptionsdk.dynamodb.internaldafny.types; namespace AWS.Cryptography.DbEncryptionSDK.DynamoDb { + public class DynamoDbEncryption { + private readonly software.amazon.cryptography.dbencryptionsdk.dynamodb.internaldafny.types.IDynamoDbEncryptionClient _impl; + public DynamoDbEncryption(software.amazon.cryptography.dbencryptionsdk.dynamodb.internaldafny.types.IDynamoDbEncryptionClient impl) { + this._impl = impl; +} + public software.amazon.cryptography.dbencryptionsdk.dynamodb.internaldafny.types.IDynamoDbEncryptionClient impl() { + return this._impl; +} + public DynamoDbEncryption(AWS.Cryptography.DbEncryptionSDK.DynamoDb.DynamoDbEncryptionConfig input) + { + software.amazon.cryptography.dbencryptionsdk.dynamodb.internaldafny.types._IDynamoDbEncryptionConfig internalInput = TypeConversion.ToDafny_N3_aws__N12_cryptography__N15_dbEncryptionSdk__N8_dynamoDb__S24_DynamoDbEncryptionConfig(input); + var result = software.amazon.cryptography.dbencryptionsdk.dynamodb.internaldafny.__default.DynamoDbEncryption(internalInput); + if (result.is_Failure) throw TypeConversion.FromDafny_CommonError(result.dtor_error); + this._impl = result.dtor_value; +} + public AWS.Cryptography.DbEncryptionSDK.DynamoDb.CreateDynamoDbEncryptionBranchKeyIdSupplierOutput CreateDynamoDbEncryptionBranchKeyIdSupplier(AWS.Cryptography.DbEncryptionSDK.DynamoDb.CreateDynamoDbEncryptionBranchKeyIdSupplierInput input) { + software.amazon.cryptography.dbencryptionsdk.dynamodb.internaldafny.types._ICreateDynamoDbEncryptionBranchKeyIdSupplierInput internalInput = TypeConversion.ToDafny_N3_aws__N12_cryptography__N15_dbEncryptionSdk__N8_dynamoDb__S48_CreateDynamoDbEncryptionBranchKeyIdSupplierInput(input); + Wrappers_Compile._IResult result = _impl.CreateDynamoDbEncryptionBranchKeyIdSupplier(internalInput); + if (result.is_Failure) throw TypeConversion.FromDafny_CommonError(result.dtor_error); + return TypeConversion.FromDafny_N3_aws__N12_cryptography__N15_dbEncryptionSdk__N8_dynamoDb__S49_CreateDynamoDbEncryptionBranchKeyIdSupplierOutput(result.dtor_value); +} + public AWS.Cryptography.DbEncryptionSDK.DynamoDb.GetEncryptedDataKeyDescriptionOutput GetEncryptedDataKeyDescription(AWS.Cryptography.DbEncryptionSDK.DynamoDb.GetEncryptedDataKeyDescriptionInput input) { + software.amazon.cryptography.dbencryptionsdk.dynamodb.internaldafny.types._IGetEncryptedDataKeyDescriptionInput internalInput = TypeConversion.ToDafny_N3_aws__N12_cryptography__N15_dbEncryptionSdk__N8_dynamoDb__S35_GetEncryptedDataKeyDescriptionInput(input); + Wrappers_Compile._IResult result = _impl.GetEncryptedDataKeyDescription(internalInput); + if (result.is_Failure) throw TypeConversion.FromDafny_CommonError(result.dtor_error); + return TypeConversion.FromDafny_N3_aws__N12_cryptography__N15_dbEncryptionSdk__N8_dynamoDb__S36_GetEncryptedDataKeyDescriptionOutput(result.dtor_value); +} +} +} diff --git a/TestVectors/runtimes/net/Generated/DDBEncryption/DynamoDbEncryptionConfig.cs b/TestVectors/runtimes/net/Generated/DDBEncryption/DynamoDbEncryptionConfig.cs new file mode 100644 index 000000000..d79b232c3 --- /dev/null +++ b/TestVectors/runtimes/net/Generated/DDBEncryption/DynamoDbEncryptionConfig.cs @@ -0,0 +1,13 @@ +// Copyright Amazon.com Inc. or its affiliates. All Rights Reserved. +// SPDX-License-Identifier: Apache-2.0 +// Do not modify this file. This file is machine generated, and any changes to it will be overwritten. +using System; + using AWS.Cryptography.DbEncryptionSDK.DynamoDb; namespace AWS.Cryptography.DbEncryptionSDK.DynamoDb { + public class DynamoDbEncryptionConfig { + + + public void Validate() { + +} +} +} diff --git a/TestVectors/runtimes/net/Generated/DDBEncryption/DynamoDbEncryptionException.cs b/TestVectors/runtimes/net/Generated/DDBEncryption/DynamoDbEncryptionException.cs new file mode 100644 index 000000000..7f575c46c --- /dev/null +++ b/TestVectors/runtimes/net/Generated/DDBEncryption/DynamoDbEncryptionException.cs @@ -0,0 +1,10 @@ +// Copyright Amazon.com Inc. or its affiliates. All Rights Reserved. +// SPDX-License-Identifier: Apache-2.0 +// Do not modify this file. This file is machine generated, and any changes to it will be overwritten. +using System; + using AWS.Cryptography.DbEncryptionSDK.DynamoDb; namespace AWS.Cryptography.DbEncryptionSDK.DynamoDb { + public class DynamoDbEncryptionException : Exception { + public DynamoDbEncryptionException(string message) : base(message) {} +public string getMessage() { return this.Message; } +} +} diff --git a/TestVectors/runtimes/net/Generated/DDBEncryption/DynamoDbKeyBranchKeyIdSupplier.cs b/TestVectors/runtimes/net/Generated/DDBEncryption/DynamoDbKeyBranchKeyIdSupplier.cs new file mode 100644 index 000000000..d2985193e --- /dev/null +++ b/TestVectors/runtimes/net/Generated/DDBEncryption/DynamoDbKeyBranchKeyIdSupplier.cs @@ -0,0 +1,19 @@ +// Copyright Amazon.com Inc. or its affiliates. All Rights Reserved. +// SPDX-License-Identifier: Apache-2.0 +// Do not modify this file. This file is machine generated, and any changes to it will be overwritten. +using System; + using System.IO; + using System.Collections.Generic; + using AWS.Cryptography.DbEncryptionSDK.DynamoDb; + using software.amazon.cryptography.dbencryptionsdk.dynamodb.internaldafny.types; namespace AWS.Cryptography.DbEncryptionSDK.DynamoDb { + internal class DynamoDbKeyBranchKeyIdSupplier : DynamoDbKeyBranchKeyIdSupplierBase { + internal readonly software.amazon.cryptography.dbencryptionsdk.dynamodb.internaldafny.types.IDynamoDbKeyBranchKeyIdSupplier _impl; + internal DynamoDbKeyBranchKeyIdSupplier(software.amazon.cryptography.dbencryptionsdk.dynamodb.internaldafny.types.IDynamoDbKeyBranchKeyIdSupplier impl) { this._impl = impl; } + protected override AWS.Cryptography.DbEncryptionSDK.DynamoDb.GetBranchKeyIdFromDdbKeyOutput _GetBranchKeyIdFromDdbKey(AWS.Cryptography.DbEncryptionSDK.DynamoDb.GetBranchKeyIdFromDdbKeyInput input) { + software.amazon.cryptography.dbencryptionsdk.dynamodb.internaldafny.types._IGetBranchKeyIdFromDdbKeyInput internalInput = TypeConversion.ToDafny_N3_aws__N12_cryptography__N15_dbEncryptionSdk__N8_dynamoDb__S29_GetBranchKeyIdFromDdbKeyInput(input); + Wrappers_Compile._IResult result = this._impl.GetBranchKeyIdFromDdbKey(internalInput); + if (result.is_Failure) throw TypeConversion.FromDafny_CommonError(result.dtor_error); + return TypeConversion.FromDafny_N3_aws__N12_cryptography__N15_dbEncryptionSdk__N8_dynamoDb__S30_GetBranchKeyIdFromDdbKeyOutput(result.dtor_value); +} +} +} diff --git a/TestVectors/runtimes/net/Generated/DDBEncryption/DynamoDbKeyBranchKeyIdSupplierBase.cs b/TestVectors/runtimes/net/Generated/DDBEncryption/DynamoDbKeyBranchKeyIdSupplierBase.cs new file mode 100644 index 000000000..cc95ae57b --- /dev/null +++ b/TestVectors/runtimes/net/Generated/DDBEncryption/DynamoDbKeyBranchKeyIdSupplierBase.cs @@ -0,0 +1,13 @@ +// Copyright Amazon.com Inc. or its affiliates. All Rights Reserved. +// SPDX-License-Identifier: Apache-2.0 +// Do not modify this file. This file is machine generated, and any changes to it will be overwritten. +using System; + using AWS.Cryptography.DbEncryptionSDK.DynamoDb; namespace AWS.Cryptography.DbEncryptionSDK.DynamoDb { + public abstract class DynamoDbKeyBranchKeyIdSupplierBase : IDynamoDbKeyBranchKeyIdSupplier { + public AWS.Cryptography.DbEncryptionSDK.DynamoDb.GetBranchKeyIdFromDdbKeyOutput GetBranchKeyIdFromDdbKey ( AWS.Cryptography.DbEncryptionSDK.DynamoDb.GetBranchKeyIdFromDdbKeyInput input ) + { + input.Validate(); return _GetBranchKeyIdFromDdbKey ( input ) ; +} + protected abstract AWS.Cryptography.DbEncryptionSDK.DynamoDb.GetBranchKeyIdFromDdbKeyOutput _GetBranchKeyIdFromDdbKey ( AWS.Cryptography.DbEncryptionSDK.DynamoDb.GetBranchKeyIdFromDdbKeyInput input ) ; +} +} diff --git a/TestVectors/runtimes/net/Generated/DDBEncryption/DynamoDbTableEncryptionConfig.cs b/TestVectors/runtimes/net/Generated/DDBEncryption/DynamoDbTableEncryptionConfig.cs new file mode 100644 index 000000000..e9fa06001 --- /dev/null +++ b/TestVectors/runtimes/net/Generated/DDBEncryption/DynamoDbTableEncryptionConfig.cs @@ -0,0 +1,110 @@ +// Copyright Amazon.com Inc. or its affiliates. All Rights Reserved. +// SPDX-License-Identifier: Apache-2.0 +// Do not modify this file. This file is machine generated, and any changes to it will be overwritten. +using System; + using AWS.Cryptography.DbEncryptionSDK.DynamoDb; namespace AWS.Cryptography.DbEncryptionSDK.DynamoDb { + public class DynamoDbTableEncryptionConfig { + private string _logicalTableName ; + private string _partitionKeyName ; + private string _sortKeyName ; + private AWS.Cryptography.DbEncryptionSDK.DynamoDb.SearchConfig _search ; + private System.Collections.Generic.Dictionary _attributeActionsOnEncrypt ; + private System.Collections.Generic.List _allowedUnsignedAttributes ; + private string _allowedUnsignedAttributePrefix ; + private AWS.Cryptography.MaterialProviders.DBEAlgorithmSuiteId _algorithmSuiteId ; + private AWS.Cryptography.MaterialProviders.IKeyring _keyring ; + private AWS.Cryptography.MaterialProviders.ICryptographicMaterialsManager _cmm ; + private AWS.Cryptography.DbEncryptionSDK.DynamoDb.LegacyOverride _legacyOverride ; + private AWS.Cryptography.DbEncryptionSDK.DynamoDb.PlaintextOverride _plaintextOverride ; + public string LogicalTableName { + get { return this._logicalTableName; } + set { this._logicalTableName = value; } +} + public bool IsSetLogicalTableName () { + return this._logicalTableName != null; +} + public string PartitionKeyName { + get { return this._partitionKeyName; } + set { this._partitionKeyName = value; } +} + public bool IsSetPartitionKeyName () { + return this._partitionKeyName != null; +} + public string SortKeyName { + get { return this._sortKeyName; } + set { this._sortKeyName = value; } +} + public bool IsSetSortKeyName () { + return this._sortKeyName != null; +} + public AWS.Cryptography.DbEncryptionSDK.DynamoDb.SearchConfig Search { + get { return this._search; } + set { this._search = value; } +} + public bool IsSetSearch () { + return this._search != null; +} + public System.Collections.Generic.Dictionary AttributeActionsOnEncrypt { + get { return this._attributeActionsOnEncrypt; } + set { this._attributeActionsOnEncrypt = value; } +} + public bool IsSetAttributeActionsOnEncrypt () { + return this._attributeActionsOnEncrypt != null; +} + public System.Collections.Generic.List AllowedUnsignedAttributes { + get { return this._allowedUnsignedAttributes; } + set { this._allowedUnsignedAttributes = value; } +} + public bool IsSetAllowedUnsignedAttributes () { + return this._allowedUnsignedAttributes != null; +} + public string AllowedUnsignedAttributePrefix { + get { return this._allowedUnsignedAttributePrefix; } + set { this._allowedUnsignedAttributePrefix = value; } +} + public bool IsSetAllowedUnsignedAttributePrefix () { + return this._allowedUnsignedAttributePrefix != null; +} + public AWS.Cryptography.MaterialProviders.DBEAlgorithmSuiteId AlgorithmSuiteId { + get { return this._algorithmSuiteId; } + set { this._algorithmSuiteId = value; } +} + public bool IsSetAlgorithmSuiteId () { + return this._algorithmSuiteId != null; +} + public AWS.Cryptography.MaterialProviders.IKeyring Keyring { + get { return this._keyring; } + set { this._keyring = value; } +} + public bool IsSetKeyring () { + return this._keyring != null; +} + public AWS.Cryptography.MaterialProviders.ICryptographicMaterialsManager Cmm { + get { return this._cmm; } + set { this._cmm = value; } +} + public bool IsSetCmm () { + return this._cmm != null; +} + public AWS.Cryptography.DbEncryptionSDK.DynamoDb.LegacyOverride LegacyOverride { + get { return this._legacyOverride; } + set { this._legacyOverride = value; } +} + public bool IsSetLegacyOverride () { + return this._legacyOverride != null; +} + public AWS.Cryptography.DbEncryptionSDK.DynamoDb.PlaintextOverride PlaintextOverride { + get { return this._plaintextOverride; } + set { this._plaintextOverride = value; } +} + public bool IsSetPlaintextOverride () { + return this._plaintextOverride != null; +} + public void Validate() { + if (!IsSetLogicalTableName()) throw new System.ArgumentException("Missing value for required property 'LogicalTableName'"); + if (!IsSetPartitionKeyName()) throw new System.ArgumentException("Missing value for required property 'PartitionKeyName'"); + if (!IsSetAttributeActionsOnEncrypt()) throw new System.ArgumentException("Missing value for required property 'AttributeActionsOnEncrypt'"); + +} +} +} diff --git a/TestVectors/runtimes/net/Generated/DDBEncryption/DynamoDbTablesEncryptionConfig.cs b/TestVectors/runtimes/net/Generated/DDBEncryption/DynamoDbTablesEncryptionConfig.cs new file mode 100644 index 000000000..d78449ab7 --- /dev/null +++ b/TestVectors/runtimes/net/Generated/DDBEncryption/DynamoDbTablesEncryptionConfig.cs @@ -0,0 +1,20 @@ +// Copyright Amazon.com Inc. or its affiliates. All Rights Reserved. +// SPDX-License-Identifier: Apache-2.0 +// Do not modify this file. This file is machine generated, and any changes to it will be overwritten. +using System; + using AWS.Cryptography.DbEncryptionSDK.DynamoDb; namespace AWS.Cryptography.DbEncryptionSDK.DynamoDb { + public class DynamoDbTablesEncryptionConfig { + private System.Collections.Generic.Dictionary _tableEncryptionConfigs ; + public System.Collections.Generic.Dictionary TableEncryptionConfigs { + get { return this._tableEncryptionConfigs; } + set { this._tableEncryptionConfigs = value; } +} + public bool IsSetTableEncryptionConfigs () { + return this._tableEncryptionConfigs != null; +} + public void Validate() { + if (!IsSetTableEncryptionConfigs()) throw new System.ArgumentException("Missing value for required property 'TableEncryptionConfigs'"); + +} +} +} diff --git a/TestVectors/runtimes/net/Generated/DDBEncryption/EncryptedDataKeyDescriptionOutput.cs b/TestVectors/runtimes/net/Generated/DDBEncryption/EncryptedDataKeyDescriptionOutput.cs new file mode 100644 index 000000000..7e021e4b1 --- /dev/null +++ b/TestVectors/runtimes/net/Generated/DDBEncryption/EncryptedDataKeyDescriptionOutput.cs @@ -0,0 +1,44 @@ +// Copyright Amazon.com Inc. or its affiliates. All Rights Reserved. +// SPDX-License-Identifier: Apache-2.0 +// Do not modify this file. This file is machine generated, and any changes to it will be overwritten. +using System; + using AWS.Cryptography.DbEncryptionSDK.DynamoDb; namespace AWS.Cryptography.DbEncryptionSDK.DynamoDb { + public class EncryptedDataKeyDescriptionOutput { + private string _keyProviderId ; + private string _keyProviderInfo ; + private string _branchKeyId ; + private string _branchKeyVersion ; + public string KeyProviderId { + get { return this._keyProviderId; } + set { this._keyProviderId = value; } +} + public bool IsSetKeyProviderId () { + return this._keyProviderId != null; +} + public string KeyProviderInfo { + get { return this._keyProviderInfo; } + set { this._keyProviderInfo = value; } +} + public bool IsSetKeyProviderInfo () { + return this._keyProviderInfo != null; +} + public string BranchKeyId { + get { return this._branchKeyId; } + set { this._branchKeyId = value; } +} + public bool IsSetBranchKeyId () { + return this._branchKeyId != null; +} + public string BranchKeyVersion { + get { return this._branchKeyVersion; } + set { this._branchKeyVersion = value; } +} + public bool IsSetBranchKeyVersion () { + return this._branchKeyVersion != null; +} + public void Validate() { + if (!IsSetKeyProviderId()) throw new System.ArgumentException("Missing value for required property 'KeyProviderId'"); + +} +} +} diff --git a/TestVectors/runtimes/net/Generated/DDBEncryption/EncryptedPart.cs b/TestVectors/runtimes/net/Generated/DDBEncryption/EncryptedPart.cs new file mode 100644 index 000000000..f07ef4833 --- /dev/null +++ b/TestVectors/runtimes/net/Generated/DDBEncryption/EncryptedPart.cs @@ -0,0 +1,29 @@ +// Copyright Amazon.com Inc. or its affiliates. All Rights Reserved. +// SPDX-License-Identifier: Apache-2.0 +// Do not modify this file. This file is machine generated, and any changes to it will be overwritten. +using System; + using AWS.Cryptography.DbEncryptionSDK.DynamoDb; namespace AWS.Cryptography.DbEncryptionSDK.DynamoDb { + public class EncryptedPart { + private string _name ; + private string _prefix ; + public string Name { + get { return this._name; } + set { this._name = value; } +} + public bool IsSetName () { + return this._name != null; +} + public string Prefix { + get { return this._prefix; } + set { this._prefix = value; } +} + public bool IsSetPrefix () { + return this._prefix != null; +} + public void Validate() { + if (!IsSetName()) throw new System.ArgumentException("Missing value for required property 'Name'"); + if (!IsSetPrefix()) throw new System.ArgumentException("Missing value for required property 'Prefix'"); + +} +} +} diff --git a/TestVectors/runtimes/net/Generated/DDBEncryption/GetBranchKeyIdFromDdbKeyInput.cs b/TestVectors/runtimes/net/Generated/DDBEncryption/GetBranchKeyIdFromDdbKeyInput.cs new file mode 100644 index 000000000..e28ddcfad --- /dev/null +++ b/TestVectors/runtimes/net/Generated/DDBEncryption/GetBranchKeyIdFromDdbKeyInput.cs @@ -0,0 +1,20 @@ +// Copyright Amazon.com Inc. or its affiliates. All Rights Reserved. +// SPDX-License-Identifier: Apache-2.0 +// Do not modify this file. This file is machine generated, and any changes to it will be overwritten. +using System; + using AWS.Cryptography.DbEncryptionSDK.DynamoDb; namespace AWS.Cryptography.DbEncryptionSDK.DynamoDb { + public class GetBranchKeyIdFromDdbKeyInput { + private System.Collections.Generic.Dictionary _ddbKey ; + public System.Collections.Generic.Dictionary DdbKey { + get { return this._ddbKey; } + set { this._ddbKey = value; } +} + public bool IsSetDdbKey () { + return this._ddbKey != null; +} + public void Validate() { + if (!IsSetDdbKey()) throw new System.ArgumentException("Missing value for required property 'DdbKey'"); + +} +} +} diff --git a/TestVectors/runtimes/net/Generated/DDBEncryption/GetBranchKeyIdFromDdbKeyOutput.cs b/TestVectors/runtimes/net/Generated/DDBEncryption/GetBranchKeyIdFromDdbKeyOutput.cs new file mode 100644 index 000000000..1f980339d --- /dev/null +++ b/TestVectors/runtimes/net/Generated/DDBEncryption/GetBranchKeyIdFromDdbKeyOutput.cs @@ -0,0 +1,20 @@ +// Copyright Amazon.com Inc. or its affiliates. All Rights Reserved. +// SPDX-License-Identifier: Apache-2.0 +// Do not modify this file. This file is machine generated, and any changes to it will be overwritten. +using System; + using AWS.Cryptography.DbEncryptionSDK.DynamoDb; namespace AWS.Cryptography.DbEncryptionSDK.DynamoDb { + public class GetBranchKeyIdFromDdbKeyOutput { + private string _branchKeyId ; + public string BranchKeyId { + get { return this._branchKeyId; } + set { this._branchKeyId = value; } +} + public bool IsSetBranchKeyId () { + return this._branchKeyId != null; +} + public void Validate() { + if (!IsSetBranchKeyId()) throw new System.ArgumentException("Missing value for required property 'BranchKeyId'"); + +} +} +} diff --git a/TestVectors/runtimes/net/Generated/DDBEncryption/GetEncryptedDataKeyDescriptionInput.cs b/TestVectors/runtimes/net/Generated/DDBEncryption/GetEncryptedDataKeyDescriptionInput.cs new file mode 100644 index 000000000..0dce691fd --- /dev/null +++ b/TestVectors/runtimes/net/Generated/DDBEncryption/GetEncryptedDataKeyDescriptionInput.cs @@ -0,0 +1,20 @@ +// Copyright Amazon.com Inc. or its affiliates. All Rights Reserved. +// SPDX-License-Identifier: Apache-2.0 +// Do not modify this file. This file is machine generated, and any changes to it will be overwritten. +using System; + using AWS.Cryptography.DbEncryptionSDK.DynamoDb; namespace AWS.Cryptography.DbEncryptionSDK.DynamoDb { + public class GetEncryptedDataKeyDescriptionInput { + private AWS.Cryptography.DbEncryptionSDK.DynamoDb.GetEncryptedDataKeyDescriptionUnion _input ; + public AWS.Cryptography.DbEncryptionSDK.DynamoDb.GetEncryptedDataKeyDescriptionUnion Input { + get { return this._input; } + set { this._input = value; } +} + public bool IsSetInput () { + return this._input != null; +} + public void Validate() { + if (!IsSetInput()) throw new System.ArgumentException("Missing value for required property 'Input'"); + +} +} +} diff --git a/TestVectors/runtimes/net/Generated/DDBEncryption/GetEncryptedDataKeyDescriptionOutput.cs b/TestVectors/runtimes/net/Generated/DDBEncryption/GetEncryptedDataKeyDescriptionOutput.cs new file mode 100644 index 000000000..cdc8ec16d --- /dev/null +++ b/TestVectors/runtimes/net/Generated/DDBEncryption/GetEncryptedDataKeyDescriptionOutput.cs @@ -0,0 +1,20 @@ +// Copyright Amazon.com Inc. or its affiliates. All Rights Reserved. +// SPDX-License-Identifier: Apache-2.0 +// Do not modify this file. This file is machine generated, and any changes to it will be overwritten. +using System; + using AWS.Cryptography.DbEncryptionSDK.DynamoDb; namespace AWS.Cryptography.DbEncryptionSDK.DynamoDb { + public class GetEncryptedDataKeyDescriptionOutput { + private System.Collections.Generic.List _encryptedDataKeyDescriptionOutput ; + public System.Collections.Generic.List EncryptedDataKeyDescriptionOutput { + get { return this._encryptedDataKeyDescriptionOutput; } + set { this._encryptedDataKeyDescriptionOutput = value; } +} + public bool IsSetEncryptedDataKeyDescriptionOutput () { + return this._encryptedDataKeyDescriptionOutput != null; +} + public void Validate() { + if (!IsSetEncryptedDataKeyDescriptionOutput()) throw new System.ArgumentException("Missing value for required property 'EncryptedDataKeyDescriptionOutput'"); + +} +} +} diff --git a/TestVectors/runtimes/net/Generated/DDBEncryption/GetEncryptedDataKeyDescriptionUnion.cs b/TestVectors/runtimes/net/Generated/DDBEncryption/GetEncryptedDataKeyDescriptionUnion.cs new file mode 100644 index 000000000..afc3fc7b8 --- /dev/null +++ b/TestVectors/runtimes/net/Generated/DDBEncryption/GetEncryptedDataKeyDescriptionUnion.cs @@ -0,0 +1,32 @@ +// Copyright Amazon.com Inc. or its affiliates. All Rights Reserved. +// SPDX-License-Identifier: Apache-2.0 +// Do not modify this file. This file is machine generated, and any changes to it will be overwritten. +using System; + using AWS.Cryptography.DbEncryptionSDK.DynamoDb; namespace AWS.Cryptography.DbEncryptionSDK.DynamoDb { + public class GetEncryptedDataKeyDescriptionUnion { + private System.IO.MemoryStream _header ; + private System.Collections.Generic.Dictionary _plaintextItem ; + public System.IO.MemoryStream Header { + get { return this._header; } + set { this._header = value; } +} + public bool IsSetHeader () { + return this._header != null; +} + public System.Collections.Generic.Dictionary PlaintextItem { + get { return this._plaintextItem; } + set { this._plaintextItem = value; } +} + public bool IsSetPlaintextItem () { + return this._plaintextItem != null; +} + public void Validate() { + var numberOfPropertiesSet = Convert.ToUInt16(IsSetHeader()) + + Convert.ToUInt16(IsSetPlaintextItem()) ; + if (numberOfPropertiesSet == 0) throw new System.ArgumentException("No union value set"); + + if (numberOfPropertiesSet > 1) throw new System.ArgumentException("Multiple union values set"); + +} +} +} diff --git a/TestVectors/runtimes/net/Generated/DDBEncryption/GetPrefix.cs b/TestVectors/runtimes/net/Generated/DDBEncryption/GetPrefix.cs new file mode 100644 index 000000000..0b6d4e0d9 --- /dev/null +++ b/TestVectors/runtimes/net/Generated/DDBEncryption/GetPrefix.cs @@ -0,0 +1,20 @@ +// Copyright Amazon.com Inc. or its affiliates. All Rights Reserved. +// SPDX-License-Identifier: Apache-2.0 +// Do not modify this file. This file is machine generated, and any changes to it will be overwritten. +using System; + using AWS.Cryptography.DbEncryptionSDK.DynamoDb; namespace AWS.Cryptography.DbEncryptionSDK.DynamoDb { + public class GetPrefix { + private int? _length ; + public int Length { + get { return this._length.GetValueOrDefault(); } + set { this._length = value; } +} + public bool IsSetLength () { + return this._length.HasValue; +} + public void Validate() { + if (!IsSetLength()) throw new System.ArgumentException("Missing value for required property 'Length'"); + +} +} +} diff --git a/TestVectors/runtimes/net/Generated/DDBEncryption/GetSegment.cs b/TestVectors/runtimes/net/Generated/DDBEncryption/GetSegment.cs new file mode 100644 index 000000000..5cf157b2e --- /dev/null +++ b/TestVectors/runtimes/net/Generated/DDBEncryption/GetSegment.cs @@ -0,0 +1,29 @@ +// Copyright Amazon.com Inc. or its affiliates. All Rights Reserved. +// SPDX-License-Identifier: Apache-2.0 +// Do not modify this file. This file is machine generated, and any changes to it will be overwritten. +using System; + using AWS.Cryptography.DbEncryptionSDK.DynamoDb; namespace AWS.Cryptography.DbEncryptionSDK.DynamoDb { + public class GetSegment { + private string _split ; + private int? _index ; + public string Split { + get { return this._split; } + set { this._split = value; } +} + public bool IsSetSplit () { + return this._split != null; +} + public int Index { + get { return this._index.GetValueOrDefault(); } + set { this._index = value; } +} + public bool IsSetIndex () { + return this._index.HasValue; +} + public void Validate() { + if (!IsSetSplit()) throw new System.ArgumentException("Missing value for required property 'Split'"); + if (!IsSetIndex()) throw new System.ArgumentException("Missing value for required property 'Index'"); + +} +} +} diff --git a/TestVectors/runtimes/net/Generated/DDBEncryption/GetSegments.cs b/TestVectors/runtimes/net/Generated/DDBEncryption/GetSegments.cs new file mode 100644 index 000000000..da498b4a0 --- /dev/null +++ b/TestVectors/runtimes/net/Generated/DDBEncryption/GetSegments.cs @@ -0,0 +1,38 @@ +// Copyright Amazon.com Inc. or its affiliates. All Rights Reserved. +// SPDX-License-Identifier: Apache-2.0 +// Do not modify this file. This file is machine generated, and any changes to it will be overwritten. +using System; + using AWS.Cryptography.DbEncryptionSDK.DynamoDb; namespace AWS.Cryptography.DbEncryptionSDK.DynamoDb { + public class GetSegments { + private string _split ; + private int? _low ; + private int? _high ; + public string Split { + get { return this._split; } + set { this._split = value; } +} + public bool IsSetSplit () { + return this._split != null; +} + public int Low { + get { return this._low.GetValueOrDefault(); } + set { this._low = value; } +} + public bool IsSetLow () { + return this._low.HasValue; +} + public int High { + get { return this._high.GetValueOrDefault(); } + set { this._high = value; } +} + public bool IsSetHigh () { + return this._high.HasValue; +} + public void Validate() { + if (!IsSetSplit()) throw new System.ArgumentException("Missing value for required property 'Split'"); + if (!IsSetLow()) throw new System.ArgumentException("Missing value for required property 'Low'"); + if (!IsSetHigh()) throw new System.ArgumentException("Missing value for required property 'High'"); + +} +} +} diff --git a/TestVectors/runtimes/net/Generated/DDBEncryption/GetSubstring.cs b/TestVectors/runtimes/net/Generated/DDBEncryption/GetSubstring.cs new file mode 100644 index 000000000..4dec9d952 --- /dev/null +++ b/TestVectors/runtimes/net/Generated/DDBEncryption/GetSubstring.cs @@ -0,0 +1,29 @@ +// Copyright Amazon.com Inc. or its affiliates. All Rights Reserved. +// SPDX-License-Identifier: Apache-2.0 +// Do not modify this file. This file is machine generated, and any changes to it will be overwritten. +using System; + using AWS.Cryptography.DbEncryptionSDK.DynamoDb; namespace AWS.Cryptography.DbEncryptionSDK.DynamoDb { + public class GetSubstring { + private int? _low ; + private int? _high ; + public int Low { + get { return this._low.GetValueOrDefault(); } + set { this._low = value; } +} + public bool IsSetLow () { + return this._low.HasValue; +} + public int High { + get { return this._high.GetValueOrDefault(); } + set { this._high = value; } +} + public bool IsSetHigh () { + return this._high.HasValue; +} + public void Validate() { + if (!IsSetLow()) throw new System.ArgumentException("Missing value for required property 'Low'"); + if (!IsSetHigh()) throw new System.ArgumentException("Missing value for required property 'High'"); + +} +} +} diff --git a/TestVectors/runtimes/net/Generated/DDBEncryption/GetSuffix.cs b/TestVectors/runtimes/net/Generated/DDBEncryption/GetSuffix.cs new file mode 100644 index 000000000..45df6e9ef --- /dev/null +++ b/TestVectors/runtimes/net/Generated/DDBEncryption/GetSuffix.cs @@ -0,0 +1,20 @@ +// Copyright Amazon.com Inc. or its affiliates. All Rights Reserved. +// SPDX-License-Identifier: Apache-2.0 +// Do not modify this file. This file is machine generated, and any changes to it will be overwritten. +using System; + using AWS.Cryptography.DbEncryptionSDK.DynamoDb; namespace AWS.Cryptography.DbEncryptionSDK.DynamoDb { + public class GetSuffix { + private int? _length ; + public int Length { + get { return this._length.GetValueOrDefault(); } + set { this._length = value; } +} + public bool IsSetLength () { + return this._length.HasValue; +} + public void Validate() { + if (!IsSetLength()) throw new System.ArgumentException("Missing value for required property 'Length'"); + +} +} +} diff --git a/TestVectors/runtimes/net/Generated/DDBEncryption/IDynamoDbKeyBranchKeyIdSupplier.cs b/TestVectors/runtimes/net/Generated/DDBEncryption/IDynamoDbKeyBranchKeyIdSupplier.cs new file mode 100644 index 000000000..956318311 --- /dev/null +++ b/TestVectors/runtimes/net/Generated/DDBEncryption/IDynamoDbKeyBranchKeyIdSupplier.cs @@ -0,0 +1,9 @@ +// Copyright Amazon.com Inc. or its affiliates. All Rights Reserved. +// SPDX-License-Identifier: Apache-2.0 +// Do not modify this file. This file is machine generated, and any changes to it will be overwritten. +using System; + using AWS.Cryptography.DbEncryptionSDK.DynamoDb; namespace AWS.Cryptography.DbEncryptionSDK.DynamoDb { + public interface IDynamoDbKeyBranchKeyIdSupplier { + AWS.Cryptography.DbEncryptionSDK.DynamoDb.GetBranchKeyIdFromDdbKeyOutput GetBranchKeyIdFromDdbKey ( AWS.Cryptography.DbEncryptionSDK.DynamoDb.GetBranchKeyIdFromDdbKeyInput input ) ; +} +} diff --git a/TestVectors/runtimes/net/Generated/DDBEncryption/ILegacyDynamoDbEncryptor.cs b/TestVectors/runtimes/net/Generated/DDBEncryption/ILegacyDynamoDbEncryptor.cs new file mode 100644 index 000000000..218a9770c --- /dev/null +++ b/TestVectors/runtimes/net/Generated/DDBEncryption/ILegacyDynamoDbEncryptor.cs @@ -0,0 +1,9 @@ +// Copyright Amazon.com Inc. or its affiliates. All Rights Reserved. +// SPDX-License-Identifier: Apache-2.0 +// Do not modify this file. This file is machine generated, and any changes to it will be overwritten. +using System; + using AWS.Cryptography.DbEncryptionSDK.DynamoDb; namespace AWS.Cryptography.DbEncryptionSDK.DynamoDb { + public interface ILegacyDynamoDbEncryptor { + +} +} diff --git a/TestVectors/runtimes/net/Generated/DDBEncryption/Insert.cs b/TestVectors/runtimes/net/Generated/DDBEncryption/Insert.cs new file mode 100644 index 000000000..b4a9552c4 --- /dev/null +++ b/TestVectors/runtimes/net/Generated/DDBEncryption/Insert.cs @@ -0,0 +1,20 @@ +// Copyright Amazon.com Inc. or its affiliates. All Rights Reserved. +// SPDX-License-Identifier: Apache-2.0 +// Do not modify this file. This file is machine generated, and any changes to it will be overwritten. +using System; + using AWS.Cryptography.DbEncryptionSDK.DynamoDb; namespace AWS.Cryptography.DbEncryptionSDK.DynamoDb { + public class Insert { + private string _literal ; + public string Literal { + get { return this._literal; } + set { this._literal = value; } +} + public bool IsSetLiteral () { + return this._literal != null; +} + public void Validate() { + if (!IsSetLiteral()) throw new System.ArgumentException("Missing value for required property 'Literal'"); + +} +} +} diff --git a/TestVectors/runtimes/net/Generated/DDBEncryption/LegacyDynamoDbEncryptor.cs b/TestVectors/runtimes/net/Generated/DDBEncryption/LegacyDynamoDbEncryptor.cs new file mode 100644 index 000000000..3dc107b19 --- /dev/null +++ b/TestVectors/runtimes/net/Generated/DDBEncryption/LegacyDynamoDbEncryptor.cs @@ -0,0 +1,14 @@ +// Copyright Amazon.com Inc. or its affiliates. All Rights Reserved. +// SPDX-License-Identifier: Apache-2.0 +// Do not modify this file. This file is machine generated, and any changes to it will be overwritten. +using System; + using System.IO; + using System.Collections.Generic; + using AWS.Cryptography.DbEncryptionSDK.DynamoDb; + using software.amazon.cryptography.dbencryptionsdk.dynamodb.internaldafny.types; namespace AWS.Cryptography.DbEncryptionSDK.DynamoDb { + internal class LegacyDynamoDbEncryptor : LegacyDynamoDbEncryptorBase { + internal readonly software.amazon.cryptography.dbencryptionsdk.dynamodb.internaldafny.types.ILegacyDynamoDbEncryptor _impl; + internal LegacyDynamoDbEncryptor(software.amazon.cryptography.dbencryptionsdk.dynamodb.internaldafny.types.ILegacyDynamoDbEncryptor impl) { this._impl = impl; } + +} +} diff --git a/TestVectors/runtimes/net/Generated/DDBEncryption/LegacyDynamoDbEncryptorBase.cs b/TestVectors/runtimes/net/Generated/DDBEncryption/LegacyDynamoDbEncryptorBase.cs new file mode 100644 index 000000000..eaed724d6 --- /dev/null +++ b/TestVectors/runtimes/net/Generated/DDBEncryption/LegacyDynamoDbEncryptorBase.cs @@ -0,0 +1,9 @@ +// Copyright Amazon.com Inc. or its affiliates. All Rights Reserved. +// SPDX-License-Identifier: Apache-2.0 +// Do not modify this file. This file is machine generated, and any changes to it will be overwritten. +using System; + using AWS.Cryptography.DbEncryptionSDK.DynamoDb; namespace AWS.Cryptography.DbEncryptionSDK.DynamoDb { + public abstract class LegacyDynamoDbEncryptorBase : ILegacyDynamoDbEncryptor { + +} +} diff --git a/TestVectors/runtimes/net/Generated/DDBEncryption/LegacyOverride.cs b/TestVectors/runtimes/net/Generated/DDBEncryption/LegacyOverride.cs new file mode 100644 index 000000000..62af3b999 --- /dev/null +++ b/TestVectors/runtimes/net/Generated/DDBEncryption/LegacyOverride.cs @@ -0,0 +1,46 @@ +// Copyright Amazon.com Inc. or its affiliates. All Rights Reserved. +// SPDX-License-Identifier: Apache-2.0 +// Do not modify this file. This file is machine generated, and any changes to it will be overwritten. +using System; + using AWS.Cryptography.DbEncryptionSDK.DynamoDb; namespace AWS.Cryptography.DbEncryptionSDK.DynamoDb { + public class LegacyOverride { + private AWS.Cryptography.DbEncryptionSDK.DynamoDb.LegacyPolicy _policy ; + private AWS.Cryptography.DbEncryptionSDK.DynamoDb.ILegacyDynamoDbEncryptor _encryptor ; + private System.Collections.Generic.Dictionary _attributeActionsOnEncrypt ; + private AWS.Cryptography.DbEncryptionSDK.StructuredEncryption.CryptoAction _defaultAttributeFlag ; + public AWS.Cryptography.DbEncryptionSDK.DynamoDb.LegacyPolicy Policy { + get { return this._policy; } + set { this._policy = value; } +} + public bool IsSetPolicy () { + return this._policy != null; +} + public AWS.Cryptography.DbEncryptionSDK.DynamoDb.ILegacyDynamoDbEncryptor Encryptor { + get { return this._encryptor; } + set { this._encryptor = value; } +} + public bool IsSetEncryptor () { + return this._encryptor != null; +} + public System.Collections.Generic.Dictionary AttributeActionsOnEncrypt { + get { return this._attributeActionsOnEncrypt; } + set { this._attributeActionsOnEncrypt = value; } +} + public bool IsSetAttributeActionsOnEncrypt () { + return this._attributeActionsOnEncrypt != null; +} + public AWS.Cryptography.DbEncryptionSDK.StructuredEncryption.CryptoAction DefaultAttributeFlag { + get { return this._defaultAttributeFlag; } + set { this._defaultAttributeFlag = value; } +} + public bool IsSetDefaultAttributeFlag () { + return this._defaultAttributeFlag != null; +} + public void Validate() { + if (!IsSetPolicy()) throw new System.ArgumentException("Missing value for required property 'Policy'"); + if (!IsSetEncryptor()) throw new System.ArgumentException("Missing value for required property 'Encryptor'"); + if (!IsSetAttributeActionsOnEncrypt()) throw new System.ArgumentException("Missing value for required property 'AttributeActionsOnEncrypt'"); + +} +} +} diff --git a/TestVectors/runtimes/net/Generated/DDBEncryption/LegacyPolicy.cs b/TestVectors/runtimes/net/Generated/DDBEncryption/LegacyPolicy.cs new file mode 100644 index 000000000..b989976f3 --- /dev/null +++ b/TestVectors/runtimes/net/Generated/DDBEncryption/LegacyPolicy.cs @@ -0,0 +1,19 @@ +// Copyright Amazon.com Inc. or its affiliates. All Rights Reserved. +// SPDX-License-Identifier: Apache-2.0 +// Do not modify this file. This file is machine generated, and any changes to it will be overwritten. +using System; + using AWS.Cryptography.DbEncryptionSDK.DynamoDb; namespace AWS.Cryptography.DbEncryptionSDK.DynamoDb { + using Amazon.Runtime; public class LegacyPolicy : ConstantClass { + + + public static readonly LegacyPolicy FORCE_LEGACY_ENCRYPT_ALLOW_LEGACY_DECRYPT = new LegacyPolicy ("FORCE_LEGACY_ENCRYPT_ALLOW_LEGACY_DECRYPT"); + + public static readonly LegacyPolicy FORBID_LEGACY_ENCRYPT_ALLOW_LEGACY_DECRYPT = new LegacyPolicy ("FORBID_LEGACY_ENCRYPT_ALLOW_LEGACY_DECRYPT"); + + public static readonly LegacyPolicy FORBID_LEGACY_ENCRYPT_FORBID_LEGACY_DECRYPT = new LegacyPolicy ("FORBID_LEGACY_ENCRYPT_FORBID_LEGACY_DECRYPT"); + public static readonly LegacyPolicy [] Values = { + FORBID_LEGACY_ENCRYPT_ALLOW_LEGACY_DECRYPT , FORBID_LEGACY_ENCRYPT_FORBID_LEGACY_DECRYPT , FORCE_LEGACY_ENCRYPT_ALLOW_LEGACY_DECRYPT +} ; + public LegacyPolicy (string value) : base(value) {} +} +} diff --git a/TestVectors/runtimes/net/Generated/DDBEncryption/Lower.cs b/TestVectors/runtimes/net/Generated/DDBEncryption/Lower.cs new file mode 100644 index 000000000..eb81f9b7c --- /dev/null +++ b/TestVectors/runtimes/net/Generated/DDBEncryption/Lower.cs @@ -0,0 +1,13 @@ +// Copyright Amazon.com Inc. or its affiliates. All Rights Reserved. +// SPDX-License-Identifier: Apache-2.0 +// Do not modify this file. This file is machine generated, and any changes to it will be overwritten. +using System; + using AWS.Cryptography.DbEncryptionSDK.DynamoDb; namespace AWS.Cryptography.DbEncryptionSDK.DynamoDb { + public class Lower { + + + public void Validate() { + +} +} +} diff --git a/TestVectors/runtimes/net/Generated/DDBEncryption/MultiKeyStore.cs b/TestVectors/runtimes/net/Generated/DDBEncryption/MultiKeyStore.cs new file mode 100644 index 000000000..d41aa44b6 --- /dev/null +++ b/TestVectors/runtimes/net/Generated/DDBEncryption/MultiKeyStore.cs @@ -0,0 +1,37 @@ +// Copyright Amazon.com Inc. or its affiliates. All Rights Reserved. +// SPDX-License-Identifier: Apache-2.0 +// Do not modify this file. This file is machine generated, and any changes to it will be overwritten. +using System; + using AWS.Cryptography.DbEncryptionSDK.DynamoDb; namespace AWS.Cryptography.DbEncryptionSDK.DynamoDb { + public class MultiKeyStore { + private string _keyFieldName ; + private int? _cacheTTL ; + private AWS.Cryptography.MaterialProviders.CacheType _cache ; + public string KeyFieldName { + get { return this._keyFieldName; } + set { this._keyFieldName = value; } +} + public bool IsSetKeyFieldName () { + return this._keyFieldName != null; +} + public int CacheTTL { + get { return this._cacheTTL.GetValueOrDefault(); } + set { this._cacheTTL = value; } +} + public bool IsSetCacheTTL () { + return this._cacheTTL.HasValue; +} + public AWS.Cryptography.MaterialProviders.CacheType Cache { + get { return this._cache; } + set { this._cache = value; } +} + public bool IsSetCache () { + return this._cache != null; +} + public void Validate() { + if (!IsSetKeyFieldName()) throw new System.ArgumentException("Missing value for required property 'KeyFieldName'"); + if (!IsSetCacheTTL()) throw new System.ArgumentException("Missing value for required property 'CacheTTL'"); + +} +} +} diff --git a/TestVectors/runtimes/net/Generated/DDBEncryption/NativeWrapper_DynamoDbKeyBranchKeyIdSupplier.cs b/TestVectors/runtimes/net/Generated/DDBEncryption/NativeWrapper_DynamoDbKeyBranchKeyIdSupplier.cs new file mode 100644 index 000000000..c60f28873 --- /dev/null +++ b/TestVectors/runtimes/net/Generated/DDBEncryption/NativeWrapper_DynamoDbKeyBranchKeyIdSupplier.cs @@ -0,0 +1,45 @@ +// Copyright Amazon.com Inc. or its affiliates. All Rights Reserved. +// SPDX-License-Identifier: Apache-2.0 +// Do not modify this file. This file is machine generated, and any changes to it will be overwritten. +// ReSharper disable RedundantUsingDirective +// ReSharper disable RedundantNameQualifier +// ReSharper disable SuggestVarOrType_SimpleTypes + using System; + using _System; + using Wrappers_Compile; + + namespace AWS.Cryptography.DbEncryptionSDK.DynamoDb { + internal class NativeWrapper_DynamoDbKeyBranchKeyIdSupplier : software.amazon.cryptography.dbencryptionsdk.dynamodb.internaldafny.types.IDynamoDbKeyBranchKeyIdSupplier + { + internal readonly DynamoDbKeyBranchKeyIdSupplierBase _impl; + public NativeWrapper_DynamoDbKeyBranchKeyIdSupplier(DynamoDbKeyBranchKeyIdSupplierBase nativeImpl) + { + _impl = nativeImpl; +} + public Wrappers_Compile._IResult GetBranchKeyIdFromDdbKey(software.amazon.cryptography.dbencryptionsdk.dynamodb.internaldafny.types._IGetBranchKeyIdFromDdbKeyInput input) + { + void validateOutput(AWS.Cryptography.DbEncryptionSDK.DynamoDb.GetBranchKeyIdFromDdbKeyOutput nativeOutput) { + try { nativeOutput.Validate(); } catch (ArgumentException e) + { + var message = $"Output of {_impl}._GetBranchKeyIdFromDdbKey is invalid. {e.Message}"; + throw new DynamoDbEncryptionException(message); +} +} + AWS.Cryptography.DbEncryptionSDK.DynamoDb.GetBranchKeyIdFromDdbKeyInput nativeInput = TypeConversion.FromDafny_N3_aws__N12_cryptography__N15_dbEncryptionSdk__N8_dynamoDb__S29_GetBranchKeyIdFromDdbKeyInput(input); + try { + AWS.Cryptography.DbEncryptionSDK.DynamoDb.GetBranchKeyIdFromDdbKeyOutput nativeOutput = _impl.GetBranchKeyIdFromDdbKey(nativeInput); + _ = nativeOutput ?? throw new DynamoDbEncryptionException($"{_impl}._GetBranchKeyIdFromDdbKey returned null, should be {typeof(AWS.Cryptography.DbEncryptionSDK.DynamoDb.GetBranchKeyIdFromDdbKeyOutput)}"); + validateOutput(nativeOutput); + return Wrappers_Compile.Result.create_Success(TypeConversion.ToDafny_N3_aws__N12_cryptography__N15_dbEncryptionSdk__N8_dynamoDb__S30_GetBranchKeyIdFromDdbKeyOutput(nativeOutput)); +} + catch(Exception e) + { + return Wrappers_Compile.Result.create_Failure(TypeConversion.ToDafny_CommonError(e)); +} +} + public Wrappers_Compile._IResult GetBranchKeyIdFromDdbKey_k(software.amazon.cryptography.dbencryptionsdk.dynamodb.internaldafny.types._IGetBranchKeyIdFromDdbKeyInput input) + { + throw new DynamoDbEncryptionException("Not supported at this time."); +} +} +} diff --git a/TestVectors/runtimes/net/Generated/DDBEncryption/NativeWrapper_LegacyDynamoDbEncryptor.cs b/TestVectors/runtimes/net/Generated/DDBEncryption/NativeWrapper_LegacyDynamoDbEncryptor.cs new file mode 100644 index 000000000..37d4a600a --- /dev/null +++ b/TestVectors/runtimes/net/Generated/DDBEncryption/NativeWrapper_LegacyDynamoDbEncryptor.cs @@ -0,0 +1,21 @@ +// Copyright Amazon.com Inc. or its affiliates. All Rights Reserved. +// SPDX-License-Identifier: Apache-2.0 +// Do not modify this file. This file is machine generated, and any changes to it will be overwritten. +// ReSharper disable RedundantUsingDirective +// ReSharper disable RedundantNameQualifier +// ReSharper disable SuggestVarOrType_SimpleTypes + using System; + using _System; + using Wrappers_Compile; + + namespace AWS.Cryptography.DbEncryptionSDK.DynamoDb { + internal class NativeWrapper_LegacyDynamoDbEncryptor : software.amazon.cryptography.dbencryptionsdk.dynamodb.internaldafny.types.ILegacyDynamoDbEncryptor + { + internal readonly LegacyDynamoDbEncryptorBase _impl; + public NativeWrapper_LegacyDynamoDbEncryptor(LegacyDynamoDbEncryptorBase nativeImpl) + { + _impl = nativeImpl; +} + +} +} diff --git a/TestVectors/runtimes/net/Generated/DDBEncryption/OpaqueError.cs b/TestVectors/runtimes/net/Generated/DDBEncryption/OpaqueError.cs new file mode 100644 index 000000000..c92f08d6a --- /dev/null +++ b/TestVectors/runtimes/net/Generated/DDBEncryption/OpaqueError.cs @@ -0,0 +1,13 @@ +// Copyright Amazon.com Inc. or its affiliates. All Rights Reserved. +// SPDX-License-Identifier: Apache-2.0 +// Do not modify this file. This file is machine generated, and any changes to it will be overwritten. +using System; + using AWS.Cryptography.DbEncryptionSDK.DynamoDb; namespace AWS.Cryptography.DbEncryptionSDK.DynamoDb { + public class OpaqueError : Exception { + public readonly object obj; + public OpaqueError(Exception ex) : base("OpaqueError:", ex) { this.obj = ex; } + public OpaqueError() : base("Unknown Unexpected Error") { } + public OpaqueError(object obj) : base(obj is Exception ? "OpaqueError:" : "Opaque obj is not an Exception.", obj as Exception) { this.obj = obj;} +} + +} diff --git a/TestVectors/runtimes/net/Generated/DDBEncryption/PartOnly.cs b/TestVectors/runtimes/net/Generated/DDBEncryption/PartOnly.cs new file mode 100644 index 000000000..35f7039c4 --- /dev/null +++ b/TestVectors/runtimes/net/Generated/DDBEncryption/PartOnly.cs @@ -0,0 +1,13 @@ +// Copyright Amazon.com Inc. or its affiliates. All Rights Reserved. +// SPDX-License-Identifier: Apache-2.0 +// Do not modify this file. This file is machine generated, and any changes to it will be overwritten. +using System; + using AWS.Cryptography.DbEncryptionSDK.DynamoDb; namespace AWS.Cryptography.DbEncryptionSDK.DynamoDb { + public class PartOnly { + + + public void Validate() { + +} +} +} diff --git a/TestVectors/runtimes/net/Generated/DDBEncryption/PlaintextOverride.cs b/TestVectors/runtimes/net/Generated/DDBEncryption/PlaintextOverride.cs new file mode 100644 index 000000000..04f9efcb7 --- /dev/null +++ b/TestVectors/runtimes/net/Generated/DDBEncryption/PlaintextOverride.cs @@ -0,0 +1,19 @@ +// Copyright Amazon.com Inc. or its affiliates. All Rights Reserved. +// SPDX-License-Identifier: Apache-2.0 +// Do not modify this file. This file is machine generated, and any changes to it will be overwritten. +using System; + using AWS.Cryptography.DbEncryptionSDK.DynamoDb; namespace AWS.Cryptography.DbEncryptionSDK.DynamoDb { + using Amazon.Runtime; public class PlaintextOverride : ConstantClass { + + + public static readonly PlaintextOverride FORCE_PLAINTEXT_WRITE_ALLOW_PLAINTEXT_READ = new PlaintextOverride ("FORCE_PLAINTEXT_WRITE_ALLOW_PLAINTEXT_READ"); + + public static readonly PlaintextOverride FORBID_PLAINTEXT_WRITE_ALLOW_PLAINTEXT_READ = new PlaintextOverride ("FORBID_PLAINTEXT_WRITE_ALLOW_PLAINTEXT_READ"); + + public static readonly PlaintextOverride FORBID_PLAINTEXT_WRITE_FORBID_PLAINTEXT_READ = new PlaintextOverride ("FORBID_PLAINTEXT_WRITE_FORBID_PLAINTEXT_READ"); + public static readonly PlaintextOverride [] Values = { + FORBID_PLAINTEXT_WRITE_ALLOW_PLAINTEXT_READ , FORBID_PLAINTEXT_WRITE_FORBID_PLAINTEXT_READ , FORCE_PLAINTEXT_WRITE_ALLOW_PLAINTEXT_READ +} ; + public PlaintextOverride (string value) : base(value) {} +} +} diff --git a/TestVectors/runtimes/net/Generated/DDBEncryption/SearchConfig.cs b/TestVectors/runtimes/net/Generated/DDBEncryption/SearchConfig.cs new file mode 100644 index 000000000..2729d66b1 --- /dev/null +++ b/TestVectors/runtimes/net/Generated/DDBEncryption/SearchConfig.cs @@ -0,0 +1,29 @@ +// Copyright Amazon.com Inc. or its affiliates. All Rights Reserved. +// SPDX-License-Identifier: Apache-2.0 +// Do not modify this file. This file is machine generated, and any changes to it will be overwritten. +using System; + using AWS.Cryptography.DbEncryptionSDK.DynamoDb; namespace AWS.Cryptography.DbEncryptionSDK.DynamoDb { + public class SearchConfig { + private System.Collections.Generic.List _versions ; + private int? _writeVersion ; + public System.Collections.Generic.List Versions { + get { return this._versions; } + set { this._versions = value; } +} + public bool IsSetVersions () { + return this._versions != null; +} + public int WriteVersion { + get { return this._writeVersion.GetValueOrDefault(); } + set { this._writeVersion = value; } +} + public bool IsSetWriteVersion () { + return this._writeVersion.HasValue; +} + public void Validate() { + if (!IsSetVersions()) throw new System.ArgumentException("Missing value for required property 'Versions'"); + if (!IsSetWriteVersion()) throw new System.ArgumentException("Missing value for required property 'WriteVersion'"); + +} +} +} diff --git a/TestVectors/runtimes/net/Generated/DDBEncryption/Shared.cs b/TestVectors/runtimes/net/Generated/DDBEncryption/Shared.cs new file mode 100644 index 000000000..840ea2673 --- /dev/null +++ b/TestVectors/runtimes/net/Generated/DDBEncryption/Shared.cs @@ -0,0 +1,20 @@ +// Copyright Amazon.com Inc. or its affiliates. All Rights Reserved. +// SPDX-License-Identifier: Apache-2.0 +// Do not modify this file. This file is machine generated, and any changes to it will be overwritten. +using System; + using AWS.Cryptography.DbEncryptionSDK.DynamoDb; namespace AWS.Cryptography.DbEncryptionSDK.DynamoDb { + public class Shared { + private string _other ; + public string Other { + get { return this._other; } + set { this._other = value; } +} + public bool IsSetOther () { + return this._other != null; +} + public void Validate() { + if (!IsSetOther()) throw new System.ArgumentException("Missing value for required property 'Other'"); + +} +} +} diff --git a/TestVectors/runtimes/net/Generated/DDBEncryption/SharedSet.cs b/TestVectors/runtimes/net/Generated/DDBEncryption/SharedSet.cs new file mode 100644 index 000000000..7b338feae --- /dev/null +++ b/TestVectors/runtimes/net/Generated/DDBEncryption/SharedSet.cs @@ -0,0 +1,20 @@ +// Copyright Amazon.com Inc. or its affiliates. All Rights Reserved. +// SPDX-License-Identifier: Apache-2.0 +// Do not modify this file. This file is machine generated, and any changes to it will be overwritten. +using System; + using AWS.Cryptography.DbEncryptionSDK.DynamoDb; namespace AWS.Cryptography.DbEncryptionSDK.DynamoDb { + public class SharedSet { + private string _other ; + public string Other { + get { return this._other; } + set { this._other = value; } +} + public bool IsSetOther () { + return this._other != null; +} + public void Validate() { + if (!IsSetOther()) throw new System.ArgumentException("Missing value for required property 'Other'"); + +} +} +} diff --git a/TestVectors/runtimes/net/Generated/DDBEncryption/SignedPart.cs b/TestVectors/runtimes/net/Generated/DDBEncryption/SignedPart.cs new file mode 100644 index 000000000..53ba318ef --- /dev/null +++ b/TestVectors/runtimes/net/Generated/DDBEncryption/SignedPart.cs @@ -0,0 +1,37 @@ +// Copyright Amazon.com Inc. or its affiliates. All Rights Reserved. +// SPDX-License-Identifier: Apache-2.0 +// Do not modify this file. This file is machine generated, and any changes to it will be overwritten. +using System; + using AWS.Cryptography.DbEncryptionSDK.DynamoDb; namespace AWS.Cryptography.DbEncryptionSDK.DynamoDb { + public class SignedPart { + private string _name ; + private string _prefix ; + private string _loc ; + public string Name { + get { return this._name; } + set { this._name = value; } +} + public bool IsSetName () { + return this._name != null; +} + public string Prefix { + get { return this._prefix; } + set { this._prefix = value; } +} + public bool IsSetPrefix () { + return this._prefix != null; +} + public string Loc { + get { return this._loc; } + set { this._loc = value; } +} + public bool IsSetLoc () { + return this._loc != null; +} + public void Validate() { + if (!IsSetName()) throw new System.ArgumentException("Missing value for required property 'Name'"); + if (!IsSetPrefix()) throw new System.ArgumentException("Missing value for required property 'Prefix'"); + +} +} +} diff --git a/TestVectors/runtimes/net/Generated/DDBEncryption/SingleKeyStore.cs b/TestVectors/runtimes/net/Generated/DDBEncryption/SingleKeyStore.cs new file mode 100644 index 000000000..7d3164717 --- /dev/null +++ b/TestVectors/runtimes/net/Generated/DDBEncryption/SingleKeyStore.cs @@ -0,0 +1,29 @@ +// Copyright Amazon.com Inc. or its affiliates. All Rights Reserved. +// SPDX-License-Identifier: Apache-2.0 +// Do not modify this file. This file is machine generated, and any changes to it will be overwritten. +using System; + using AWS.Cryptography.DbEncryptionSDK.DynamoDb; namespace AWS.Cryptography.DbEncryptionSDK.DynamoDb { + public class SingleKeyStore { + private string _keyId ; + private int? _cacheTTL ; + public string KeyId { + get { return this._keyId; } + set { this._keyId = value; } +} + public bool IsSetKeyId () { + return this._keyId != null; +} + public int CacheTTL { + get { return this._cacheTTL.GetValueOrDefault(); } + set { this._cacheTTL = value; } +} + public bool IsSetCacheTTL () { + return this._cacheTTL.HasValue; +} + public void Validate() { + if (!IsSetKeyId()) throw new System.ArgumentException("Missing value for required property 'KeyId'"); + if (!IsSetCacheTTL()) throw new System.ArgumentException("Missing value for required property 'CacheTTL'"); + +} +} +} diff --git a/TestVectors/runtimes/net/Generated/DDBEncryption/StandardBeacon.cs b/TestVectors/runtimes/net/Generated/DDBEncryption/StandardBeacon.cs new file mode 100644 index 000000000..21f2f7106 --- /dev/null +++ b/TestVectors/runtimes/net/Generated/DDBEncryption/StandardBeacon.cs @@ -0,0 +1,45 @@ +// Copyright Amazon.com Inc. or its affiliates. All Rights Reserved. +// SPDX-License-Identifier: Apache-2.0 +// Do not modify this file. This file is machine generated, and any changes to it will be overwritten. +using System; + using AWS.Cryptography.DbEncryptionSDK.DynamoDb; namespace AWS.Cryptography.DbEncryptionSDK.DynamoDb { + public class StandardBeacon { + private string _name ; + private int? _length ; + private string _loc ; + private AWS.Cryptography.DbEncryptionSDK.DynamoDb.BeaconStyle _style ; + public string Name { + get { return this._name; } + set { this._name = value; } +} + public bool IsSetName () { + return this._name != null; +} + public int Length { + get { return this._length.GetValueOrDefault(); } + set { this._length = value; } +} + public bool IsSetLength () { + return this._length.HasValue; +} + public string Loc { + get { return this._loc; } + set { this._loc = value; } +} + public bool IsSetLoc () { + return this._loc != null; +} + public AWS.Cryptography.DbEncryptionSDK.DynamoDb.BeaconStyle Style { + get { return this._style; } + set { this._style = value; } +} + public bool IsSetStyle () { + return this._style != null; +} + public void Validate() { + if (!IsSetName()) throw new System.ArgumentException("Missing value for required property 'Name'"); + if (!IsSetLength()) throw new System.ArgumentException("Missing value for required property 'Length'"); + +} +} +} diff --git a/TestVectors/runtimes/net/Generated/DDBEncryption/TypeConversion.cs b/TestVectors/runtimes/net/Generated/DDBEncryption/TypeConversion.cs new file mode 100644 index 000000000..7d54002b3 --- /dev/null +++ b/TestVectors/runtimes/net/Generated/DDBEncryption/TypeConversion.cs @@ -0,0 +1,1157 @@ +// Copyright Amazon.com Inc. or its affiliates. All Rights Reserved. +// SPDX-License-Identifier: Apache-2.0 +// Do not modify this file. This file is machine generated, and any changes to it will be overwritten. +using System.Linq; using System; namespace AWS.Cryptography.DbEncryptionSDK.DynamoDb { + public static class TypeConversion { + public static AWS.Cryptography.DbEncryptionSDK.DynamoDb.BeaconKeySource FromDafny_N3_aws__N12_cryptography__N15_dbEncryptionSdk__N8_dynamoDb__S15_BeaconKeySource (software.amazon.cryptography.dbencryptionsdk.dynamodb.internaldafny.types._IBeaconKeySource value) { + software.amazon.cryptography.dbencryptionsdk.dynamodb.internaldafny.types.BeaconKeySource concrete = (software.amazon.cryptography.dbencryptionsdk.dynamodb.internaldafny.types.BeaconKeySource)value; + var converted = new AWS.Cryptography.DbEncryptionSDK.DynamoDb.BeaconKeySource(); if (value.is_single) { + converted.Single = FromDafny_N3_aws__N12_cryptography__N15_dbEncryptionSdk__N8_dynamoDb__S15_BeaconKeySource__M6_single(concrete.dtor_single); + return converted; +} if (value.is_multi) { + converted.Multi = FromDafny_N3_aws__N12_cryptography__N15_dbEncryptionSdk__N8_dynamoDb__S15_BeaconKeySource__M5_multi(concrete.dtor_multi); + return converted; +} +throw new System.ArgumentException("Invalid AWS.Cryptography.DbEncryptionSDK.DynamoDb.BeaconKeySource state"); +} + public static software.amazon.cryptography.dbencryptionsdk.dynamodb.internaldafny.types._IBeaconKeySource ToDafny_N3_aws__N12_cryptography__N15_dbEncryptionSdk__N8_dynamoDb__S15_BeaconKeySource (AWS.Cryptography.DbEncryptionSDK.DynamoDb.BeaconKeySource value) { + if (value.IsSetSingle()) { + return software.amazon.cryptography.dbencryptionsdk.dynamodb.internaldafny.types.BeaconKeySource.create_single(ToDafny_N3_aws__N12_cryptography__N15_dbEncryptionSdk__N8_dynamoDb__S15_BeaconKeySource__M6_single(value.Single)); +} if (value.IsSetMulti()) { + return software.amazon.cryptography.dbencryptionsdk.dynamodb.internaldafny.types.BeaconKeySource.create_multi(ToDafny_N3_aws__N12_cryptography__N15_dbEncryptionSdk__N8_dynamoDb__S15_BeaconKeySource__M5_multi(value.Multi)); +} +throw new System.ArgumentException("Invalid AWS.Cryptography.DbEncryptionSDK.DynamoDb.BeaconKeySource state"); +} + public static AWS.Cryptography.DbEncryptionSDK.DynamoDb.BeaconStyle FromDafny_N3_aws__N12_cryptography__N15_dbEncryptionSdk__N8_dynamoDb__S11_BeaconStyle (software.amazon.cryptography.dbencryptionsdk.dynamodb.internaldafny.types._IBeaconStyle value) { + software.amazon.cryptography.dbencryptionsdk.dynamodb.internaldafny.types.BeaconStyle concrete = (software.amazon.cryptography.dbencryptionsdk.dynamodb.internaldafny.types.BeaconStyle)value; + var converted = new AWS.Cryptography.DbEncryptionSDK.DynamoDb.BeaconStyle(); if (value.is_partOnly) { + converted.PartOnly = FromDafny_N3_aws__N12_cryptography__N15_dbEncryptionSdk__N8_dynamoDb__S11_BeaconStyle__M8_partOnly(concrete.dtor_partOnly); + return converted; +} if (value.is_shared) { + converted.Shared = FromDafny_N3_aws__N12_cryptography__N15_dbEncryptionSdk__N8_dynamoDb__S11_BeaconStyle__M6_shared(concrete.dtor_shared); + return converted; +} if (value.is_asSet) { + converted.AsSet = FromDafny_N3_aws__N12_cryptography__N15_dbEncryptionSdk__N8_dynamoDb__S11_BeaconStyle__M5_asSet(concrete.dtor_asSet); + return converted; +} if (value.is_sharedSet) { + converted.SharedSet = FromDafny_N3_aws__N12_cryptography__N15_dbEncryptionSdk__N8_dynamoDb__S11_BeaconStyle__M9_sharedSet(concrete.dtor_sharedSet); + return converted; +} +throw new System.ArgumentException("Invalid AWS.Cryptography.DbEncryptionSDK.DynamoDb.BeaconStyle state"); +} + public static software.amazon.cryptography.dbencryptionsdk.dynamodb.internaldafny.types._IBeaconStyle ToDafny_N3_aws__N12_cryptography__N15_dbEncryptionSdk__N8_dynamoDb__S11_BeaconStyle (AWS.Cryptography.DbEncryptionSDK.DynamoDb.BeaconStyle value) { + if (value.IsSetPartOnly()) { + return software.amazon.cryptography.dbencryptionsdk.dynamodb.internaldafny.types.BeaconStyle.create_partOnly(ToDafny_N3_aws__N12_cryptography__N15_dbEncryptionSdk__N8_dynamoDb__S11_BeaconStyle__M8_partOnly(value.PartOnly)); +} if (value.IsSetShared()) { + return software.amazon.cryptography.dbencryptionsdk.dynamodb.internaldafny.types.BeaconStyle.create_shared(ToDafny_N3_aws__N12_cryptography__N15_dbEncryptionSdk__N8_dynamoDb__S11_BeaconStyle__M6_shared(value.Shared)); +} if (value.IsSetAsSet()) { + return software.amazon.cryptography.dbencryptionsdk.dynamodb.internaldafny.types.BeaconStyle.create_asSet(ToDafny_N3_aws__N12_cryptography__N15_dbEncryptionSdk__N8_dynamoDb__S11_BeaconStyle__M5_asSet(value.AsSet)); +} if (value.IsSetSharedSet()) { + return software.amazon.cryptography.dbencryptionsdk.dynamodb.internaldafny.types.BeaconStyle.create_sharedSet(ToDafny_N3_aws__N12_cryptography__N15_dbEncryptionSdk__N8_dynamoDb__S11_BeaconStyle__M9_sharedSet(value.SharedSet)); +} +throw new System.ArgumentException("Invalid AWS.Cryptography.DbEncryptionSDK.DynamoDb.BeaconStyle state"); +} + public static AWS.Cryptography.DbEncryptionSDK.DynamoDb.CreateDynamoDbEncryptionBranchKeyIdSupplierInput FromDafny_N3_aws__N12_cryptography__N15_dbEncryptionSdk__N8_dynamoDb__S48_CreateDynamoDbEncryptionBranchKeyIdSupplierInput (software.amazon.cryptography.dbencryptionsdk.dynamodb.internaldafny.types._ICreateDynamoDbEncryptionBranchKeyIdSupplierInput value) { + software.amazon.cryptography.dbencryptionsdk.dynamodb.internaldafny.types.CreateDynamoDbEncryptionBranchKeyIdSupplierInput concrete = (software.amazon.cryptography.dbencryptionsdk.dynamodb.internaldafny.types.CreateDynamoDbEncryptionBranchKeyIdSupplierInput)value; AWS.Cryptography.DbEncryptionSDK.DynamoDb.CreateDynamoDbEncryptionBranchKeyIdSupplierInput converted = new AWS.Cryptography.DbEncryptionSDK.DynamoDb.CreateDynamoDbEncryptionBranchKeyIdSupplierInput(); converted.DdbKeyBranchKeyIdSupplier = (AWS.Cryptography.DbEncryptionSDK.DynamoDb.IDynamoDbKeyBranchKeyIdSupplier) FromDafny_N3_aws__N12_cryptography__N15_dbEncryptionSdk__N8_dynamoDb__S48_CreateDynamoDbEncryptionBranchKeyIdSupplierInput__M25_ddbKeyBranchKeyIdSupplier(concrete._ddbKeyBranchKeyIdSupplier); return converted; +} + public static software.amazon.cryptography.dbencryptionsdk.dynamodb.internaldafny.types._ICreateDynamoDbEncryptionBranchKeyIdSupplierInput ToDafny_N3_aws__N12_cryptography__N15_dbEncryptionSdk__N8_dynamoDb__S48_CreateDynamoDbEncryptionBranchKeyIdSupplierInput (AWS.Cryptography.DbEncryptionSDK.DynamoDb.CreateDynamoDbEncryptionBranchKeyIdSupplierInput value) { + + return new software.amazon.cryptography.dbencryptionsdk.dynamodb.internaldafny.types.CreateDynamoDbEncryptionBranchKeyIdSupplierInput ( ToDafny_N3_aws__N12_cryptography__N15_dbEncryptionSdk__N8_dynamoDb__S48_CreateDynamoDbEncryptionBranchKeyIdSupplierInput__M25_ddbKeyBranchKeyIdSupplier(value.DdbKeyBranchKeyIdSupplier) ) ; +} + public static AWS.Cryptography.DbEncryptionSDK.DynamoDb.CreateDynamoDbEncryptionBranchKeyIdSupplierOutput FromDafny_N3_aws__N12_cryptography__N15_dbEncryptionSdk__N8_dynamoDb__S49_CreateDynamoDbEncryptionBranchKeyIdSupplierOutput (software.amazon.cryptography.dbencryptionsdk.dynamodb.internaldafny.types._ICreateDynamoDbEncryptionBranchKeyIdSupplierOutput value) { + software.amazon.cryptography.dbencryptionsdk.dynamodb.internaldafny.types.CreateDynamoDbEncryptionBranchKeyIdSupplierOutput concrete = (software.amazon.cryptography.dbencryptionsdk.dynamodb.internaldafny.types.CreateDynamoDbEncryptionBranchKeyIdSupplierOutput)value; AWS.Cryptography.DbEncryptionSDK.DynamoDb.CreateDynamoDbEncryptionBranchKeyIdSupplierOutput converted = new AWS.Cryptography.DbEncryptionSDK.DynamoDb.CreateDynamoDbEncryptionBranchKeyIdSupplierOutput(); converted.BranchKeyIdSupplier = (AWS.Cryptography.MaterialProviders.IBranchKeyIdSupplier) FromDafny_N3_aws__N12_cryptography__N15_dbEncryptionSdk__N8_dynamoDb__S49_CreateDynamoDbEncryptionBranchKeyIdSupplierOutput__M19_branchKeyIdSupplier(concrete._branchKeyIdSupplier); return converted; +} + public static software.amazon.cryptography.dbencryptionsdk.dynamodb.internaldafny.types._ICreateDynamoDbEncryptionBranchKeyIdSupplierOutput ToDafny_N3_aws__N12_cryptography__N15_dbEncryptionSdk__N8_dynamoDb__S49_CreateDynamoDbEncryptionBranchKeyIdSupplierOutput (AWS.Cryptography.DbEncryptionSDK.DynamoDb.CreateDynamoDbEncryptionBranchKeyIdSupplierOutput value) { + + return new software.amazon.cryptography.dbencryptionsdk.dynamodb.internaldafny.types.CreateDynamoDbEncryptionBranchKeyIdSupplierOutput ( ToDafny_N3_aws__N12_cryptography__N15_dbEncryptionSdk__N8_dynamoDb__S49_CreateDynamoDbEncryptionBranchKeyIdSupplierOutput__M19_branchKeyIdSupplier(value.BranchKeyIdSupplier) ) ; +} + public static AWS.Cryptography.DbEncryptionSDK.DynamoDb.DynamoDbEncryptionConfig FromDafny_N3_aws__N12_cryptography__N15_dbEncryptionSdk__N8_dynamoDb__S24_DynamoDbEncryptionConfig (software.amazon.cryptography.dbencryptionsdk.dynamodb.internaldafny.types._IDynamoDbEncryptionConfig value) { + software.amazon.cryptography.dbencryptionsdk.dynamodb.internaldafny.types.DynamoDbEncryptionConfig concrete = (software.amazon.cryptography.dbencryptionsdk.dynamodb.internaldafny.types.DynamoDbEncryptionConfig)value; AWS.Cryptography.DbEncryptionSDK.DynamoDb.DynamoDbEncryptionConfig converted = new AWS.Cryptography.DbEncryptionSDK.DynamoDb.DynamoDbEncryptionConfig(); return converted; +} + public static software.amazon.cryptography.dbencryptionsdk.dynamodb.internaldafny.types._IDynamoDbEncryptionConfig ToDafny_N3_aws__N12_cryptography__N15_dbEncryptionSdk__N8_dynamoDb__S24_DynamoDbEncryptionConfig (AWS.Cryptography.DbEncryptionSDK.DynamoDb.DynamoDbEncryptionConfig value) { + + return new software.amazon.cryptography.dbencryptionsdk.dynamodb.internaldafny.types.DynamoDbEncryptionConfig ( ) ; +} + public static AWS.Cryptography.DbEncryptionSDK.DynamoDb.DynamoDbEncryptionException FromDafny_N3_aws__N12_cryptography__N15_dbEncryptionSdk__N8_dynamoDb__S27_DynamoDbEncryptionException (software.amazon.cryptography.dbencryptionsdk.dynamodb.internaldafny.types.Error_DynamoDbEncryptionException value) { + return new AWS.Cryptography.DbEncryptionSDK.DynamoDb.DynamoDbEncryptionException ( + FromDafny_N3_aws__N12_cryptography__N15_dbEncryptionSdk__N8_dynamoDb__S27_DynamoDbEncryptionException__M7_message(value._message) + ) ; +} + public static software.amazon.cryptography.dbencryptionsdk.dynamodb.internaldafny.types.Error_DynamoDbEncryptionException ToDafny_N3_aws__N12_cryptography__N15_dbEncryptionSdk__N8_dynamoDb__S27_DynamoDbEncryptionException (AWS.Cryptography.DbEncryptionSDK.DynamoDb.DynamoDbEncryptionException value) { + + return new software.amazon.cryptography.dbencryptionsdk.dynamodb.internaldafny.types.Error_DynamoDbEncryptionException ( + ToDafny_N3_aws__N12_cryptography__N15_dbEncryptionSdk__N8_dynamoDb__S27_DynamoDbEncryptionException__M7_message(value.Message) + ) ; +} + public static AWS.Cryptography.DbEncryptionSDK.DynamoDb.GetBranchKeyIdFromDdbKeyInput FromDafny_N3_aws__N12_cryptography__N15_dbEncryptionSdk__N8_dynamoDb__S29_GetBranchKeyIdFromDdbKeyInput (software.amazon.cryptography.dbencryptionsdk.dynamodb.internaldafny.types._IGetBranchKeyIdFromDdbKeyInput value) { + software.amazon.cryptography.dbencryptionsdk.dynamodb.internaldafny.types.GetBranchKeyIdFromDdbKeyInput concrete = (software.amazon.cryptography.dbencryptionsdk.dynamodb.internaldafny.types.GetBranchKeyIdFromDdbKeyInput)value; AWS.Cryptography.DbEncryptionSDK.DynamoDb.GetBranchKeyIdFromDdbKeyInput converted = new AWS.Cryptography.DbEncryptionSDK.DynamoDb.GetBranchKeyIdFromDdbKeyInput(); converted.DdbKey = (System.Collections.Generic.Dictionary) FromDafny_N3_aws__N12_cryptography__N15_dbEncryptionSdk__N8_dynamoDb__S29_GetBranchKeyIdFromDdbKeyInput__M6_ddbKey(concrete._ddbKey); return converted; +} + public static software.amazon.cryptography.dbencryptionsdk.dynamodb.internaldafny.types._IGetBranchKeyIdFromDdbKeyInput ToDafny_N3_aws__N12_cryptography__N15_dbEncryptionSdk__N8_dynamoDb__S29_GetBranchKeyIdFromDdbKeyInput (AWS.Cryptography.DbEncryptionSDK.DynamoDb.GetBranchKeyIdFromDdbKeyInput value) { + + return new software.amazon.cryptography.dbencryptionsdk.dynamodb.internaldafny.types.GetBranchKeyIdFromDdbKeyInput ( ToDafny_N3_aws__N12_cryptography__N15_dbEncryptionSdk__N8_dynamoDb__S29_GetBranchKeyIdFromDdbKeyInput__M6_ddbKey(value.DdbKey) ) ; +} + public static AWS.Cryptography.DbEncryptionSDK.DynamoDb.GetBranchKeyIdFromDdbKeyOutput FromDafny_N3_aws__N12_cryptography__N15_dbEncryptionSdk__N8_dynamoDb__S30_GetBranchKeyIdFromDdbKeyOutput (software.amazon.cryptography.dbencryptionsdk.dynamodb.internaldafny.types._IGetBranchKeyIdFromDdbKeyOutput value) { + software.amazon.cryptography.dbencryptionsdk.dynamodb.internaldafny.types.GetBranchKeyIdFromDdbKeyOutput concrete = (software.amazon.cryptography.dbencryptionsdk.dynamodb.internaldafny.types.GetBranchKeyIdFromDdbKeyOutput)value; AWS.Cryptography.DbEncryptionSDK.DynamoDb.GetBranchKeyIdFromDdbKeyOutput converted = new AWS.Cryptography.DbEncryptionSDK.DynamoDb.GetBranchKeyIdFromDdbKeyOutput(); converted.BranchKeyId = (string) FromDafny_N3_aws__N12_cryptography__N15_dbEncryptionSdk__N8_dynamoDb__S30_GetBranchKeyIdFromDdbKeyOutput__M11_branchKeyId(concrete._branchKeyId); return converted; +} + public static software.amazon.cryptography.dbencryptionsdk.dynamodb.internaldafny.types._IGetBranchKeyIdFromDdbKeyOutput ToDafny_N3_aws__N12_cryptography__N15_dbEncryptionSdk__N8_dynamoDb__S30_GetBranchKeyIdFromDdbKeyOutput (AWS.Cryptography.DbEncryptionSDK.DynamoDb.GetBranchKeyIdFromDdbKeyOutput value) { + + return new software.amazon.cryptography.dbencryptionsdk.dynamodb.internaldafny.types.GetBranchKeyIdFromDdbKeyOutput ( ToDafny_N3_aws__N12_cryptography__N15_dbEncryptionSdk__N8_dynamoDb__S30_GetBranchKeyIdFromDdbKeyOutput__M11_branchKeyId(value.BranchKeyId) ) ; +} + public static AWS.Cryptography.DbEncryptionSDK.DynamoDb.GetEncryptedDataKeyDescriptionInput FromDafny_N3_aws__N12_cryptography__N15_dbEncryptionSdk__N8_dynamoDb__S35_GetEncryptedDataKeyDescriptionInput (software.amazon.cryptography.dbencryptionsdk.dynamodb.internaldafny.types._IGetEncryptedDataKeyDescriptionInput value) { + software.amazon.cryptography.dbencryptionsdk.dynamodb.internaldafny.types.GetEncryptedDataKeyDescriptionInput concrete = (software.amazon.cryptography.dbencryptionsdk.dynamodb.internaldafny.types.GetEncryptedDataKeyDescriptionInput)value; AWS.Cryptography.DbEncryptionSDK.DynamoDb.GetEncryptedDataKeyDescriptionInput converted = new AWS.Cryptography.DbEncryptionSDK.DynamoDb.GetEncryptedDataKeyDescriptionInput(); converted.Input = (AWS.Cryptography.DbEncryptionSDK.DynamoDb.GetEncryptedDataKeyDescriptionUnion) FromDafny_N3_aws__N12_cryptography__N15_dbEncryptionSdk__N8_dynamoDb__S35_GetEncryptedDataKeyDescriptionInput__M5_input(concrete._input); return converted; +} + public static software.amazon.cryptography.dbencryptionsdk.dynamodb.internaldafny.types._IGetEncryptedDataKeyDescriptionInput ToDafny_N3_aws__N12_cryptography__N15_dbEncryptionSdk__N8_dynamoDb__S35_GetEncryptedDataKeyDescriptionInput (AWS.Cryptography.DbEncryptionSDK.DynamoDb.GetEncryptedDataKeyDescriptionInput value) { + + return new software.amazon.cryptography.dbencryptionsdk.dynamodb.internaldafny.types.GetEncryptedDataKeyDescriptionInput ( ToDafny_N3_aws__N12_cryptography__N15_dbEncryptionSdk__N8_dynamoDb__S35_GetEncryptedDataKeyDescriptionInput__M5_input(value.Input) ) ; +} + public static AWS.Cryptography.DbEncryptionSDK.DynamoDb.GetEncryptedDataKeyDescriptionOutput FromDafny_N3_aws__N12_cryptography__N15_dbEncryptionSdk__N8_dynamoDb__S36_GetEncryptedDataKeyDescriptionOutput (software.amazon.cryptography.dbencryptionsdk.dynamodb.internaldafny.types._IGetEncryptedDataKeyDescriptionOutput value) { + software.amazon.cryptography.dbencryptionsdk.dynamodb.internaldafny.types.GetEncryptedDataKeyDescriptionOutput concrete = (software.amazon.cryptography.dbencryptionsdk.dynamodb.internaldafny.types.GetEncryptedDataKeyDescriptionOutput)value; AWS.Cryptography.DbEncryptionSDK.DynamoDb.GetEncryptedDataKeyDescriptionOutput converted = new AWS.Cryptography.DbEncryptionSDK.DynamoDb.GetEncryptedDataKeyDescriptionOutput(); converted.EncryptedDataKeyDescriptionOutput = (System.Collections.Generic.List) FromDafny_N3_aws__N12_cryptography__N15_dbEncryptionSdk__N8_dynamoDb__S36_GetEncryptedDataKeyDescriptionOutput__M33_EncryptedDataKeyDescriptionOutput(concrete._EncryptedDataKeyDescriptionOutput); return converted; +} + public static software.amazon.cryptography.dbencryptionsdk.dynamodb.internaldafny.types._IGetEncryptedDataKeyDescriptionOutput ToDafny_N3_aws__N12_cryptography__N15_dbEncryptionSdk__N8_dynamoDb__S36_GetEncryptedDataKeyDescriptionOutput (AWS.Cryptography.DbEncryptionSDK.DynamoDb.GetEncryptedDataKeyDescriptionOutput value) { + + return new software.amazon.cryptography.dbencryptionsdk.dynamodb.internaldafny.types.GetEncryptedDataKeyDescriptionOutput ( ToDafny_N3_aws__N12_cryptography__N15_dbEncryptionSdk__N8_dynamoDb__S36_GetEncryptedDataKeyDescriptionOutput__M33_EncryptedDataKeyDescriptionOutput(value.EncryptedDataKeyDescriptionOutput) ) ; +} + public static AWS.Cryptography.DbEncryptionSDK.DynamoDb.GetEncryptedDataKeyDescriptionUnion FromDafny_N3_aws__N12_cryptography__N15_dbEncryptionSdk__N8_dynamoDb__S35_GetEncryptedDataKeyDescriptionUnion (software.amazon.cryptography.dbencryptionsdk.dynamodb.internaldafny.types._IGetEncryptedDataKeyDescriptionUnion value) { + software.amazon.cryptography.dbencryptionsdk.dynamodb.internaldafny.types.GetEncryptedDataKeyDescriptionUnion concrete = (software.amazon.cryptography.dbencryptionsdk.dynamodb.internaldafny.types.GetEncryptedDataKeyDescriptionUnion)value; + var converted = new AWS.Cryptography.DbEncryptionSDK.DynamoDb.GetEncryptedDataKeyDescriptionUnion(); if (value.is_header) { + converted.Header = FromDafny_N3_aws__N12_cryptography__N15_dbEncryptionSdk__N8_dynamoDb__S35_GetEncryptedDataKeyDescriptionUnion__M6_header(concrete.dtor_header); + return converted; +} if (value.is_plaintextItem) { + converted.PlaintextItem = FromDafny_N3_aws__N12_cryptography__N15_dbEncryptionSdk__N8_dynamoDb__S35_GetEncryptedDataKeyDescriptionUnion__M13_plaintextItem(concrete.dtor_plaintextItem); + return converted; +} +throw new System.ArgumentException("Invalid AWS.Cryptography.DbEncryptionSDK.DynamoDb.GetEncryptedDataKeyDescriptionUnion state"); +} + public static software.amazon.cryptography.dbencryptionsdk.dynamodb.internaldafny.types._IGetEncryptedDataKeyDescriptionUnion ToDafny_N3_aws__N12_cryptography__N15_dbEncryptionSdk__N8_dynamoDb__S35_GetEncryptedDataKeyDescriptionUnion (AWS.Cryptography.DbEncryptionSDK.DynamoDb.GetEncryptedDataKeyDescriptionUnion value) { + if (value.IsSetHeader()) { + return software.amazon.cryptography.dbencryptionsdk.dynamodb.internaldafny.types.GetEncryptedDataKeyDescriptionUnion.create_header(ToDafny_N3_aws__N12_cryptography__N15_dbEncryptionSdk__N8_dynamoDb__S35_GetEncryptedDataKeyDescriptionUnion__M6_header(value.Header)); +} if (value.IsSetPlaintextItem()) { + return software.amazon.cryptography.dbencryptionsdk.dynamodb.internaldafny.types.GetEncryptedDataKeyDescriptionUnion.create_plaintextItem(ToDafny_N3_aws__N12_cryptography__N15_dbEncryptionSdk__N8_dynamoDb__S35_GetEncryptedDataKeyDescriptionUnion__M13_plaintextItem(value.PlaintextItem)); +} +throw new System.ArgumentException("Invalid AWS.Cryptography.DbEncryptionSDK.DynamoDb.GetEncryptedDataKeyDescriptionUnion state"); +} + public static AWS.Cryptography.DbEncryptionSDK.DynamoDb.LegacyPolicy FromDafny_N3_aws__N12_cryptography__N15_dbEncryptionSdk__N8_dynamoDb__S12_LegacyPolicy (software.amazon.cryptography.dbencryptionsdk.dynamodb.internaldafny.types._ILegacyPolicy value) { + if (value.is_FORCE__LEGACY__ENCRYPT__ALLOW__LEGACY__DECRYPT) return AWS.Cryptography.DbEncryptionSDK.DynamoDb.LegacyPolicy.FORCE_LEGACY_ENCRYPT_ALLOW_LEGACY_DECRYPT; + if (value.is_FORBID__LEGACY__ENCRYPT__ALLOW__LEGACY__DECRYPT) return AWS.Cryptography.DbEncryptionSDK.DynamoDb.LegacyPolicy.FORBID_LEGACY_ENCRYPT_ALLOW_LEGACY_DECRYPT; + if (value.is_FORBID__LEGACY__ENCRYPT__FORBID__LEGACY__DECRYPT) return AWS.Cryptography.DbEncryptionSDK.DynamoDb.LegacyPolicy.FORBID_LEGACY_ENCRYPT_FORBID_LEGACY_DECRYPT; +throw new System.ArgumentException("Invalid AWS.Cryptography.DbEncryptionSDK.DynamoDb.LegacyPolicy value"); +} + public static software.amazon.cryptography.dbencryptionsdk.dynamodb.internaldafny.types._ILegacyPolicy ToDafny_N3_aws__N12_cryptography__N15_dbEncryptionSdk__N8_dynamoDb__S12_LegacyPolicy (AWS.Cryptography.DbEncryptionSDK.DynamoDb.LegacyPolicy value) { + if (AWS.Cryptography.DbEncryptionSDK.DynamoDb.LegacyPolicy.FORCE_LEGACY_ENCRYPT_ALLOW_LEGACY_DECRYPT.Equals(value)) return software.amazon.cryptography.dbencryptionsdk.dynamodb.internaldafny.types.LegacyPolicy.create_FORCE__LEGACY__ENCRYPT__ALLOW__LEGACY__DECRYPT(); + if (AWS.Cryptography.DbEncryptionSDK.DynamoDb.LegacyPolicy.FORBID_LEGACY_ENCRYPT_ALLOW_LEGACY_DECRYPT.Equals(value)) return software.amazon.cryptography.dbencryptionsdk.dynamodb.internaldafny.types.LegacyPolicy.create_FORBID__LEGACY__ENCRYPT__ALLOW__LEGACY__DECRYPT(); + if (AWS.Cryptography.DbEncryptionSDK.DynamoDb.LegacyPolicy.FORBID_LEGACY_ENCRYPT_FORBID_LEGACY_DECRYPT.Equals(value)) return software.amazon.cryptography.dbencryptionsdk.dynamodb.internaldafny.types.LegacyPolicy.create_FORBID__LEGACY__ENCRYPT__FORBID__LEGACY__DECRYPT(); +throw new System.ArgumentException("Invalid AWS.Cryptography.DbEncryptionSDK.DynamoDb.LegacyPolicy value"); +} + public static AWS.Cryptography.DbEncryptionSDK.DynamoDb.PlaintextOverride FromDafny_N3_aws__N12_cryptography__N15_dbEncryptionSdk__N8_dynamoDb__S17_PlaintextOverride (software.amazon.cryptography.dbencryptionsdk.dynamodb.internaldafny.types._IPlaintextOverride value) { + if (value.is_FORCE__PLAINTEXT__WRITE__ALLOW__PLAINTEXT__READ) return AWS.Cryptography.DbEncryptionSDK.DynamoDb.PlaintextOverride.FORCE_PLAINTEXT_WRITE_ALLOW_PLAINTEXT_READ; + if (value.is_FORBID__PLAINTEXT__WRITE__ALLOW__PLAINTEXT__READ) return AWS.Cryptography.DbEncryptionSDK.DynamoDb.PlaintextOverride.FORBID_PLAINTEXT_WRITE_ALLOW_PLAINTEXT_READ; + if (value.is_FORBID__PLAINTEXT__WRITE__FORBID__PLAINTEXT__READ) return AWS.Cryptography.DbEncryptionSDK.DynamoDb.PlaintextOverride.FORBID_PLAINTEXT_WRITE_FORBID_PLAINTEXT_READ; +throw new System.ArgumentException("Invalid AWS.Cryptography.DbEncryptionSDK.DynamoDb.PlaintextOverride value"); +} + public static software.amazon.cryptography.dbencryptionsdk.dynamodb.internaldafny.types._IPlaintextOverride ToDafny_N3_aws__N12_cryptography__N15_dbEncryptionSdk__N8_dynamoDb__S17_PlaintextOverride (AWS.Cryptography.DbEncryptionSDK.DynamoDb.PlaintextOverride value) { + if (AWS.Cryptography.DbEncryptionSDK.DynamoDb.PlaintextOverride.FORCE_PLAINTEXT_WRITE_ALLOW_PLAINTEXT_READ.Equals(value)) return software.amazon.cryptography.dbencryptionsdk.dynamodb.internaldafny.types.PlaintextOverride.create_FORCE__PLAINTEXT__WRITE__ALLOW__PLAINTEXT__READ(); + if (AWS.Cryptography.DbEncryptionSDK.DynamoDb.PlaintextOverride.FORBID_PLAINTEXT_WRITE_ALLOW_PLAINTEXT_READ.Equals(value)) return software.amazon.cryptography.dbencryptionsdk.dynamodb.internaldafny.types.PlaintextOverride.create_FORBID__PLAINTEXT__WRITE__ALLOW__PLAINTEXT__READ(); + if (AWS.Cryptography.DbEncryptionSDK.DynamoDb.PlaintextOverride.FORBID_PLAINTEXT_WRITE_FORBID_PLAINTEXT_READ.Equals(value)) return software.amazon.cryptography.dbencryptionsdk.dynamodb.internaldafny.types.PlaintextOverride.create_FORBID__PLAINTEXT__WRITE__FORBID__PLAINTEXT__READ(); +throw new System.ArgumentException("Invalid AWS.Cryptography.DbEncryptionSDK.DynamoDb.PlaintextOverride value"); +} + public static AWS.Cryptography.DbEncryptionSDK.DynamoDb.VirtualTransform FromDafny_N3_aws__N12_cryptography__N15_dbEncryptionSdk__N8_dynamoDb__S16_VirtualTransform (software.amazon.cryptography.dbencryptionsdk.dynamodb.internaldafny.types._IVirtualTransform value) { + software.amazon.cryptography.dbencryptionsdk.dynamodb.internaldafny.types.VirtualTransform concrete = (software.amazon.cryptography.dbencryptionsdk.dynamodb.internaldafny.types.VirtualTransform)value; + var converted = new AWS.Cryptography.DbEncryptionSDK.DynamoDb.VirtualTransform(); if (value.is_upper) { + converted.Upper = FromDafny_N3_aws__N12_cryptography__N15_dbEncryptionSdk__N8_dynamoDb__S16_VirtualTransform__M5_upper(concrete.dtor_upper); + return converted; +} if (value.is_lower) { + converted.Lower = FromDafny_N3_aws__N12_cryptography__N15_dbEncryptionSdk__N8_dynamoDb__S16_VirtualTransform__M5_lower(concrete.dtor_lower); + return converted; +} if (value.is_insert) { + converted.Insert = FromDafny_N3_aws__N12_cryptography__N15_dbEncryptionSdk__N8_dynamoDb__S16_VirtualTransform__M6_insert(concrete.dtor_insert); + return converted; +} if (value.is_prefix) { + converted.Prefix = FromDafny_N3_aws__N12_cryptography__N15_dbEncryptionSdk__N8_dynamoDb__S16_VirtualTransform__M6_prefix(concrete.dtor_prefix); + return converted; +} if (value.is_suffix) { + converted.Suffix = FromDafny_N3_aws__N12_cryptography__N15_dbEncryptionSdk__N8_dynamoDb__S16_VirtualTransform__M6_suffix(concrete.dtor_suffix); + return converted; +} if (value.is_substring) { + converted.Substring = FromDafny_N3_aws__N12_cryptography__N15_dbEncryptionSdk__N8_dynamoDb__S16_VirtualTransform__M9_substring(concrete.dtor_substring); + return converted; +} if (value.is_segment) { + converted.Segment = FromDafny_N3_aws__N12_cryptography__N15_dbEncryptionSdk__N8_dynamoDb__S16_VirtualTransform__M7_segment(concrete.dtor_segment); + return converted; +} if (value.is_segments) { + converted.Segments = FromDafny_N3_aws__N12_cryptography__N15_dbEncryptionSdk__N8_dynamoDb__S16_VirtualTransform__M8_segments(concrete.dtor_segments); + return converted; +} +throw new System.ArgumentException("Invalid AWS.Cryptography.DbEncryptionSDK.DynamoDb.VirtualTransform state"); +} + public static software.amazon.cryptography.dbencryptionsdk.dynamodb.internaldafny.types._IVirtualTransform ToDafny_N3_aws__N12_cryptography__N15_dbEncryptionSdk__N8_dynamoDb__S16_VirtualTransform (AWS.Cryptography.DbEncryptionSDK.DynamoDb.VirtualTransform value) { + if (value.IsSetUpper()) { + return software.amazon.cryptography.dbencryptionsdk.dynamodb.internaldafny.types.VirtualTransform.create_upper(ToDafny_N3_aws__N12_cryptography__N15_dbEncryptionSdk__N8_dynamoDb__S16_VirtualTransform__M5_upper(value.Upper)); +} if (value.IsSetLower()) { + return software.amazon.cryptography.dbencryptionsdk.dynamodb.internaldafny.types.VirtualTransform.create_lower(ToDafny_N3_aws__N12_cryptography__N15_dbEncryptionSdk__N8_dynamoDb__S16_VirtualTransform__M5_lower(value.Lower)); +} if (value.IsSetInsert()) { + return software.amazon.cryptography.dbencryptionsdk.dynamodb.internaldafny.types.VirtualTransform.create_insert(ToDafny_N3_aws__N12_cryptography__N15_dbEncryptionSdk__N8_dynamoDb__S16_VirtualTransform__M6_insert(value.Insert)); +} if (value.IsSetPrefix()) { + return software.amazon.cryptography.dbencryptionsdk.dynamodb.internaldafny.types.VirtualTransform.create_prefix(ToDafny_N3_aws__N12_cryptography__N15_dbEncryptionSdk__N8_dynamoDb__S16_VirtualTransform__M6_prefix(value.Prefix)); +} if (value.IsSetSuffix()) { + return software.amazon.cryptography.dbencryptionsdk.dynamodb.internaldafny.types.VirtualTransform.create_suffix(ToDafny_N3_aws__N12_cryptography__N15_dbEncryptionSdk__N8_dynamoDb__S16_VirtualTransform__M6_suffix(value.Suffix)); +} if (value.IsSetSubstring()) { + return software.amazon.cryptography.dbencryptionsdk.dynamodb.internaldafny.types.VirtualTransform.create_substring(ToDafny_N3_aws__N12_cryptography__N15_dbEncryptionSdk__N8_dynamoDb__S16_VirtualTransform__M9_substring(value.Substring)); +} if (value.IsSetSegment()) { + return software.amazon.cryptography.dbencryptionsdk.dynamodb.internaldafny.types.VirtualTransform.create_segment(ToDafny_N3_aws__N12_cryptography__N15_dbEncryptionSdk__N8_dynamoDb__S16_VirtualTransform__M7_segment(value.Segment)); +} if (value.IsSetSegments()) { + return software.amazon.cryptography.dbencryptionsdk.dynamodb.internaldafny.types.VirtualTransform.create_segments(ToDafny_N3_aws__N12_cryptography__N15_dbEncryptionSdk__N8_dynamoDb__S16_VirtualTransform__M8_segments(value.Segments)); +} +throw new System.ArgumentException("Invalid AWS.Cryptography.DbEncryptionSDK.DynamoDb.VirtualTransform state"); +} + public static AWS.Cryptography.DbEncryptionSDK.DynamoDb.SingleKeyStore FromDafny_N3_aws__N12_cryptography__N15_dbEncryptionSdk__N8_dynamoDb__S15_BeaconKeySource__M6_single (software.amazon.cryptography.dbencryptionsdk.dynamodb.internaldafny.types._ISingleKeyStore value) { + return FromDafny_N3_aws__N12_cryptography__N15_dbEncryptionSdk__N8_dynamoDb__S14_SingleKeyStore(value); +} + public static software.amazon.cryptography.dbencryptionsdk.dynamodb.internaldafny.types._ISingleKeyStore ToDafny_N3_aws__N12_cryptography__N15_dbEncryptionSdk__N8_dynamoDb__S15_BeaconKeySource__M6_single (AWS.Cryptography.DbEncryptionSDK.DynamoDb.SingleKeyStore value) { + return ToDafny_N3_aws__N12_cryptography__N15_dbEncryptionSdk__N8_dynamoDb__S14_SingleKeyStore(value); +} + public static AWS.Cryptography.DbEncryptionSDK.DynamoDb.MultiKeyStore FromDafny_N3_aws__N12_cryptography__N15_dbEncryptionSdk__N8_dynamoDb__S15_BeaconKeySource__M5_multi (software.amazon.cryptography.dbencryptionsdk.dynamodb.internaldafny.types._IMultiKeyStore value) { + return FromDafny_N3_aws__N12_cryptography__N15_dbEncryptionSdk__N8_dynamoDb__S13_MultiKeyStore(value); +} + public static software.amazon.cryptography.dbencryptionsdk.dynamodb.internaldafny.types._IMultiKeyStore ToDafny_N3_aws__N12_cryptography__N15_dbEncryptionSdk__N8_dynamoDb__S15_BeaconKeySource__M5_multi (AWS.Cryptography.DbEncryptionSDK.DynamoDb.MultiKeyStore value) { + return ToDafny_N3_aws__N12_cryptography__N15_dbEncryptionSdk__N8_dynamoDb__S13_MultiKeyStore(value); +} + public static AWS.Cryptography.DbEncryptionSDK.DynamoDb.PartOnly FromDafny_N3_aws__N12_cryptography__N15_dbEncryptionSdk__N8_dynamoDb__S11_BeaconStyle__M8_partOnly (software.amazon.cryptography.dbencryptionsdk.dynamodb.internaldafny.types._IPartOnly value) { + return FromDafny_N3_aws__N12_cryptography__N15_dbEncryptionSdk__N8_dynamoDb__S8_PartOnly(value); +} + public static software.amazon.cryptography.dbencryptionsdk.dynamodb.internaldafny.types._IPartOnly ToDafny_N3_aws__N12_cryptography__N15_dbEncryptionSdk__N8_dynamoDb__S11_BeaconStyle__M8_partOnly (AWS.Cryptography.DbEncryptionSDK.DynamoDb.PartOnly value) { + return ToDafny_N3_aws__N12_cryptography__N15_dbEncryptionSdk__N8_dynamoDb__S8_PartOnly(value); +} + public static AWS.Cryptography.DbEncryptionSDK.DynamoDb.Shared FromDafny_N3_aws__N12_cryptography__N15_dbEncryptionSdk__N8_dynamoDb__S11_BeaconStyle__M6_shared (software.amazon.cryptography.dbencryptionsdk.dynamodb.internaldafny.types._IShared value) { + return FromDafny_N3_aws__N12_cryptography__N15_dbEncryptionSdk__N8_dynamoDb__S6_Shared(value); +} + public static software.amazon.cryptography.dbencryptionsdk.dynamodb.internaldafny.types._IShared ToDafny_N3_aws__N12_cryptography__N15_dbEncryptionSdk__N8_dynamoDb__S11_BeaconStyle__M6_shared (AWS.Cryptography.DbEncryptionSDK.DynamoDb.Shared value) { + return ToDafny_N3_aws__N12_cryptography__N15_dbEncryptionSdk__N8_dynamoDb__S6_Shared(value); +} + public static AWS.Cryptography.DbEncryptionSDK.DynamoDb.AsSet FromDafny_N3_aws__N12_cryptography__N15_dbEncryptionSdk__N8_dynamoDb__S11_BeaconStyle__M5_asSet (software.amazon.cryptography.dbencryptionsdk.dynamodb.internaldafny.types._IAsSet value) { + return FromDafny_N3_aws__N12_cryptography__N15_dbEncryptionSdk__N8_dynamoDb__S5_AsSet(value); +} + public static software.amazon.cryptography.dbencryptionsdk.dynamodb.internaldafny.types._IAsSet ToDafny_N3_aws__N12_cryptography__N15_dbEncryptionSdk__N8_dynamoDb__S11_BeaconStyle__M5_asSet (AWS.Cryptography.DbEncryptionSDK.DynamoDb.AsSet value) { + return ToDafny_N3_aws__N12_cryptography__N15_dbEncryptionSdk__N8_dynamoDb__S5_AsSet(value); +} + public static AWS.Cryptography.DbEncryptionSDK.DynamoDb.SharedSet FromDafny_N3_aws__N12_cryptography__N15_dbEncryptionSdk__N8_dynamoDb__S11_BeaconStyle__M9_sharedSet (software.amazon.cryptography.dbencryptionsdk.dynamodb.internaldafny.types._ISharedSet value) { + return FromDafny_N3_aws__N12_cryptography__N15_dbEncryptionSdk__N8_dynamoDb__S9_SharedSet(value); +} + public static software.amazon.cryptography.dbencryptionsdk.dynamodb.internaldafny.types._ISharedSet ToDafny_N3_aws__N12_cryptography__N15_dbEncryptionSdk__N8_dynamoDb__S11_BeaconStyle__M9_sharedSet (AWS.Cryptography.DbEncryptionSDK.DynamoDb.SharedSet value) { + return ToDafny_N3_aws__N12_cryptography__N15_dbEncryptionSdk__N8_dynamoDb__S9_SharedSet(value); +} + public static AWS.Cryptography.DbEncryptionSDK.DynamoDb.IDynamoDbKeyBranchKeyIdSupplier FromDafny_N3_aws__N12_cryptography__N15_dbEncryptionSdk__N8_dynamoDb__S48_CreateDynamoDbEncryptionBranchKeyIdSupplierInput__M25_ddbKeyBranchKeyIdSupplier (software.amazon.cryptography.dbencryptionsdk.dynamodb.internaldafny.types.IDynamoDbKeyBranchKeyIdSupplier value) { + return FromDafny_N3_aws__N12_cryptography__N15_dbEncryptionSdk__N8_dynamoDb__S39_DynamoDbKeyBranchKeyIdSupplierReference(value); +} + public static software.amazon.cryptography.dbencryptionsdk.dynamodb.internaldafny.types.IDynamoDbKeyBranchKeyIdSupplier ToDafny_N3_aws__N12_cryptography__N15_dbEncryptionSdk__N8_dynamoDb__S48_CreateDynamoDbEncryptionBranchKeyIdSupplierInput__M25_ddbKeyBranchKeyIdSupplier (AWS.Cryptography.DbEncryptionSDK.DynamoDb.IDynamoDbKeyBranchKeyIdSupplier value) { + return ToDafny_N3_aws__N12_cryptography__N15_dbEncryptionSdk__N8_dynamoDb__S39_DynamoDbKeyBranchKeyIdSupplierReference(value); +} + public static AWS.Cryptography.MaterialProviders.IBranchKeyIdSupplier FromDafny_N3_aws__N12_cryptography__N15_dbEncryptionSdk__N8_dynamoDb__S49_CreateDynamoDbEncryptionBranchKeyIdSupplierOutput__M19_branchKeyIdSupplier (software.amazon.cryptography.materialproviders.internaldafny.types.IBranchKeyIdSupplier value) { + return FromDafny_N3_aws__N12_cryptography__N17_materialProviders__S28_BranchKeyIdSupplierReference(value); +} + public static software.amazon.cryptography.materialproviders.internaldafny.types.IBranchKeyIdSupplier ToDafny_N3_aws__N12_cryptography__N15_dbEncryptionSdk__N8_dynamoDb__S49_CreateDynamoDbEncryptionBranchKeyIdSupplierOutput__M19_branchKeyIdSupplier (AWS.Cryptography.MaterialProviders.IBranchKeyIdSupplier value) { + return ToDafny_N3_aws__N12_cryptography__N17_materialProviders__S28_BranchKeyIdSupplierReference(value); +} + public static string FromDafny_N3_aws__N12_cryptography__N15_dbEncryptionSdk__N8_dynamoDb__S27_DynamoDbEncryptionException__M7_message (Dafny.ISequence value) { + return FromDafny_N6_smithy__N3_api__S6_String(value); +} + public static Dafny.ISequence ToDafny_N3_aws__N12_cryptography__N15_dbEncryptionSdk__N8_dynamoDb__S27_DynamoDbEncryptionException__M7_message (string value) { + return ToDafny_N6_smithy__N3_api__S6_String(value); +} + public static System.Collections.Generic.Dictionary FromDafny_N3_aws__N12_cryptography__N15_dbEncryptionSdk__N8_dynamoDb__S29_GetBranchKeyIdFromDdbKeyInput__M6_ddbKey (Dafny.IMap, software.amazon.cryptography.services.dynamodb.internaldafny.types._IAttributeValue> value) { + return FromDafny_N3_com__N9_amazonaws__N8_dynamodb__S3_Key(value); +} + public static Dafny.IMap, software.amazon.cryptography.services.dynamodb.internaldafny.types._IAttributeValue> ToDafny_N3_aws__N12_cryptography__N15_dbEncryptionSdk__N8_dynamoDb__S29_GetBranchKeyIdFromDdbKeyInput__M6_ddbKey (System.Collections.Generic.Dictionary value) { + return ToDafny_N3_com__N9_amazonaws__N8_dynamodb__S3_Key(value); +} + public static string FromDafny_N3_aws__N12_cryptography__N15_dbEncryptionSdk__N8_dynamoDb__S30_GetBranchKeyIdFromDdbKeyOutput__M11_branchKeyId (Dafny.ISequence value) { + return FromDafny_N6_smithy__N3_api__S6_String(value); +} + public static Dafny.ISequence ToDafny_N3_aws__N12_cryptography__N15_dbEncryptionSdk__N8_dynamoDb__S30_GetBranchKeyIdFromDdbKeyOutput__M11_branchKeyId (string value) { + return ToDafny_N6_smithy__N3_api__S6_String(value); +} + public static AWS.Cryptography.DbEncryptionSDK.DynamoDb.GetEncryptedDataKeyDescriptionUnion FromDafny_N3_aws__N12_cryptography__N15_dbEncryptionSdk__N8_dynamoDb__S35_GetEncryptedDataKeyDescriptionInput__M5_input (software.amazon.cryptography.dbencryptionsdk.dynamodb.internaldafny.types._IGetEncryptedDataKeyDescriptionUnion value) { + return FromDafny_N3_aws__N12_cryptography__N15_dbEncryptionSdk__N8_dynamoDb__S35_GetEncryptedDataKeyDescriptionUnion(value); +} + public static software.amazon.cryptography.dbencryptionsdk.dynamodb.internaldafny.types._IGetEncryptedDataKeyDescriptionUnion ToDafny_N3_aws__N12_cryptography__N15_dbEncryptionSdk__N8_dynamoDb__S35_GetEncryptedDataKeyDescriptionInput__M5_input (AWS.Cryptography.DbEncryptionSDK.DynamoDb.GetEncryptedDataKeyDescriptionUnion value) { + return ToDafny_N3_aws__N12_cryptography__N15_dbEncryptionSdk__N8_dynamoDb__S35_GetEncryptedDataKeyDescriptionUnion(value); +} + public static System.Collections.Generic.List FromDafny_N3_aws__N12_cryptography__N15_dbEncryptionSdk__N8_dynamoDb__S36_GetEncryptedDataKeyDescriptionOutput__M33_EncryptedDataKeyDescriptionOutput (Dafny.ISequence value) { + return FromDafny_N3_aws__N12_cryptography__N15_dbEncryptionSdk__N8_dynamoDb__S31_EncryptedDataKeyDescriptionList(value); +} + public static Dafny.ISequence ToDafny_N3_aws__N12_cryptography__N15_dbEncryptionSdk__N8_dynamoDb__S36_GetEncryptedDataKeyDescriptionOutput__M33_EncryptedDataKeyDescriptionOutput (System.Collections.Generic.List value) { + return ToDafny_N3_aws__N12_cryptography__N15_dbEncryptionSdk__N8_dynamoDb__S31_EncryptedDataKeyDescriptionList(value); +} + public static System.IO.MemoryStream FromDafny_N3_aws__N12_cryptography__N15_dbEncryptionSdk__N8_dynamoDb__S35_GetEncryptedDataKeyDescriptionUnion__M6_header (Dafny.ISequence value) { + return FromDafny_N6_smithy__N3_api__S4_Blob(value); +} + public static Dafny.ISequence ToDafny_N3_aws__N12_cryptography__N15_dbEncryptionSdk__N8_dynamoDb__S35_GetEncryptedDataKeyDescriptionUnion__M6_header (System.IO.MemoryStream value) { + return ToDafny_N6_smithy__N3_api__S4_Blob(value); +} + public static System.Collections.Generic.Dictionary FromDafny_N3_aws__N12_cryptography__N15_dbEncryptionSdk__N8_dynamoDb__S35_GetEncryptedDataKeyDescriptionUnion__M13_plaintextItem (Dafny.IMap, software.amazon.cryptography.services.dynamodb.internaldafny.types._IAttributeValue> value) { + return FromDafny_N3_com__N9_amazonaws__N8_dynamodb__S12_AttributeMap(value); +} + public static Dafny.IMap, software.amazon.cryptography.services.dynamodb.internaldafny.types._IAttributeValue> ToDafny_N3_aws__N12_cryptography__N15_dbEncryptionSdk__N8_dynamoDb__S35_GetEncryptedDataKeyDescriptionUnion__M13_plaintextItem (System.Collections.Generic.Dictionary value) { + return ToDafny_N3_com__N9_amazonaws__N8_dynamodb__S12_AttributeMap(value); +} + public static AWS.Cryptography.DbEncryptionSDK.DynamoDb.Upper FromDafny_N3_aws__N12_cryptography__N15_dbEncryptionSdk__N8_dynamoDb__S16_VirtualTransform__M5_upper (software.amazon.cryptography.dbencryptionsdk.dynamodb.internaldafny.types._IUpper value) { + return FromDafny_N3_aws__N12_cryptography__N15_dbEncryptionSdk__N8_dynamoDb__S5_Upper(value); +} + public static software.amazon.cryptography.dbencryptionsdk.dynamodb.internaldafny.types._IUpper ToDafny_N3_aws__N12_cryptography__N15_dbEncryptionSdk__N8_dynamoDb__S16_VirtualTransform__M5_upper (AWS.Cryptography.DbEncryptionSDK.DynamoDb.Upper value) { + return ToDafny_N3_aws__N12_cryptography__N15_dbEncryptionSdk__N8_dynamoDb__S5_Upper(value); +} + public static AWS.Cryptography.DbEncryptionSDK.DynamoDb.Lower FromDafny_N3_aws__N12_cryptography__N15_dbEncryptionSdk__N8_dynamoDb__S16_VirtualTransform__M5_lower (software.amazon.cryptography.dbencryptionsdk.dynamodb.internaldafny.types._ILower value) { + return FromDafny_N3_aws__N12_cryptography__N15_dbEncryptionSdk__N8_dynamoDb__S5_Lower(value); +} + public static software.amazon.cryptography.dbencryptionsdk.dynamodb.internaldafny.types._ILower ToDafny_N3_aws__N12_cryptography__N15_dbEncryptionSdk__N8_dynamoDb__S16_VirtualTransform__M5_lower (AWS.Cryptography.DbEncryptionSDK.DynamoDb.Lower value) { + return ToDafny_N3_aws__N12_cryptography__N15_dbEncryptionSdk__N8_dynamoDb__S5_Lower(value); +} + public static AWS.Cryptography.DbEncryptionSDK.DynamoDb.Insert FromDafny_N3_aws__N12_cryptography__N15_dbEncryptionSdk__N8_dynamoDb__S16_VirtualTransform__M6_insert (software.amazon.cryptography.dbencryptionsdk.dynamodb.internaldafny.types._IInsert value) { + return FromDafny_N3_aws__N12_cryptography__N15_dbEncryptionSdk__N8_dynamoDb__S6_Insert(value); +} + public static software.amazon.cryptography.dbencryptionsdk.dynamodb.internaldafny.types._IInsert ToDafny_N3_aws__N12_cryptography__N15_dbEncryptionSdk__N8_dynamoDb__S16_VirtualTransform__M6_insert (AWS.Cryptography.DbEncryptionSDK.DynamoDb.Insert value) { + return ToDafny_N3_aws__N12_cryptography__N15_dbEncryptionSdk__N8_dynamoDb__S6_Insert(value); +} + public static AWS.Cryptography.DbEncryptionSDK.DynamoDb.GetPrefix FromDafny_N3_aws__N12_cryptography__N15_dbEncryptionSdk__N8_dynamoDb__S16_VirtualTransform__M6_prefix (software.amazon.cryptography.dbencryptionsdk.dynamodb.internaldafny.types._IGetPrefix value) { + return FromDafny_N3_aws__N12_cryptography__N15_dbEncryptionSdk__N8_dynamoDb__S9_GetPrefix(value); +} + public static software.amazon.cryptography.dbencryptionsdk.dynamodb.internaldafny.types._IGetPrefix ToDafny_N3_aws__N12_cryptography__N15_dbEncryptionSdk__N8_dynamoDb__S16_VirtualTransform__M6_prefix (AWS.Cryptography.DbEncryptionSDK.DynamoDb.GetPrefix value) { + return ToDafny_N3_aws__N12_cryptography__N15_dbEncryptionSdk__N8_dynamoDb__S9_GetPrefix(value); +} + public static AWS.Cryptography.DbEncryptionSDK.DynamoDb.GetSuffix FromDafny_N3_aws__N12_cryptography__N15_dbEncryptionSdk__N8_dynamoDb__S16_VirtualTransform__M6_suffix (software.amazon.cryptography.dbencryptionsdk.dynamodb.internaldafny.types._IGetSuffix value) { + return FromDafny_N3_aws__N12_cryptography__N15_dbEncryptionSdk__N8_dynamoDb__S9_GetSuffix(value); +} + public static software.amazon.cryptography.dbencryptionsdk.dynamodb.internaldafny.types._IGetSuffix ToDafny_N3_aws__N12_cryptography__N15_dbEncryptionSdk__N8_dynamoDb__S16_VirtualTransform__M6_suffix (AWS.Cryptography.DbEncryptionSDK.DynamoDb.GetSuffix value) { + return ToDafny_N3_aws__N12_cryptography__N15_dbEncryptionSdk__N8_dynamoDb__S9_GetSuffix(value); +} + public static AWS.Cryptography.DbEncryptionSDK.DynamoDb.GetSubstring FromDafny_N3_aws__N12_cryptography__N15_dbEncryptionSdk__N8_dynamoDb__S16_VirtualTransform__M9_substring (software.amazon.cryptography.dbencryptionsdk.dynamodb.internaldafny.types._IGetSubstring value) { + return FromDafny_N3_aws__N12_cryptography__N15_dbEncryptionSdk__N8_dynamoDb__S12_GetSubstring(value); +} + public static software.amazon.cryptography.dbencryptionsdk.dynamodb.internaldafny.types._IGetSubstring ToDafny_N3_aws__N12_cryptography__N15_dbEncryptionSdk__N8_dynamoDb__S16_VirtualTransform__M9_substring (AWS.Cryptography.DbEncryptionSDK.DynamoDb.GetSubstring value) { + return ToDafny_N3_aws__N12_cryptography__N15_dbEncryptionSdk__N8_dynamoDb__S12_GetSubstring(value); +} + public static AWS.Cryptography.DbEncryptionSDK.DynamoDb.GetSegment FromDafny_N3_aws__N12_cryptography__N15_dbEncryptionSdk__N8_dynamoDb__S16_VirtualTransform__M7_segment (software.amazon.cryptography.dbencryptionsdk.dynamodb.internaldafny.types._IGetSegment value) { + return FromDafny_N3_aws__N12_cryptography__N15_dbEncryptionSdk__N8_dynamoDb__S10_GetSegment(value); +} + public static software.amazon.cryptography.dbencryptionsdk.dynamodb.internaldafny.types._IGetSegment ToDafny_N3_aws__N12_cryptography__N15_dbEncryptionSdk__N8_dynamoDb__S16_VirtualTransform__M7_segment (AWS.Cryptography.DbEncryptionSDK.DynamoDb.GetSegment value) { + return ToDafny_N3_aws__N12_cryptography__N15_dbEncryptionSdk__N8_dynamoDb__S10_GetSegment(value); +} + public static AWS.Cryptography.DbEncryptionSDK.DynamoDb.GetSegments FromDafny_N3_aws__N12_cryptography__N15_dbEncryptionSdk__N8_dynamoDb__S16_VirtualTransform__M8_segments (software.amazon.cryptography.dbencryptionsdk.dynamodb.internaldafny.types._IGetSegments value) { + return FromDafny_N3_aws__N12_cryptography__N15_dbEncryptionSdk__N8_dynamoDb__S11_GetSegments(value); +} + public static software.amazon.cryptography.dbencryptionsdk.dynamodb.internaldafny.types._IGetSegments ToDafny_N3_aws__N12_cryptography__N15_dbEncryptionSdk__N8_dynamoDb__S16_VirtualTransform__M8_segments (AWS.Cryptography.DbEncryptionSDK.DynamoDb.GetSegments value) { + return ToDafny_N3_aws__N12_cryptography__N15_dbEncryptionSdk__N8_dynamoDb__S11_GetSegments(value); +} + public static AWS.Cryptography.DbEncryptionSDK.DynamoDb.SingleKeyStore FromDafny_N3_aws__N12_cryptography__N15_dbEncryptionSdk__N8_dynamoDb__S14_SingleKeyStore (software.amazon.cryptography.dbencryptionsdk.dynamodb.internaldafny.types._ISingleKeyStore value) { + software.amazon.cryptography.dbencryptionsdk.dynamodb.internaldafny.types.SingleKeyStore concrete = (software.amazon.cryptography.dbencryptionsdk.dynamodb.internaldafny.types.SingleKeyStore)value; AWS.Cryptography.DbEncryptionSDK.DynamoDb.SingleKeyStore converted = new AWS.Cryptography.DbEncryptionSDK.DynamoDb.SingleKeyStore(); converted.KeyId = (string) FromDafny_N3_aws__N12_cryptography__N15_dbEncryptionSdk__N8_dynamoDb__S14_SingleKeyStore__M5_keyId(concrete._keyId); + converted.CacheTTL = (int) FromDafny_N3_aws__N12_cryptography__N15_dbEncryptionSdk__N8_dynamoDb__S14_SingleKeyStore__M8_cacheTTL(concrete._cacheTTL); return converted; +} + public static software.amazon.cryptography.dbencryptionsdk.dynamodb.internaldafny.types._ISingleKeyStore ToDafny_N3_aws__N12_cryptography__N15_dbEncryptionSdk__N8_dynamoDb__S14_SingleKeyStore (AWS.Cryptography.DbEncryptionSDK.DynamoDb.SingleKeyStore value) { + + return new software.amazon.cryptography.dbencryptionsdk.dynamodb.internaldafny.types.SingleKeyStore ( ToDafny_N3_aws__N12_cryptography__N15_dbEncryptionSdk__N8_dynamoDb__S14_SingleKeyStore__M5_keyId(value.KeyId) , ToDafny_N3_aws__N12_cryptography__N15_dbEncryptionSdk__N8_dynamoDb__S14_SingleKeyStore__M8_cacheTTL(value.CacheTTL) ) ; +} + public static AWS.Cryptography.DbEncryptionSDK.DynamoDb.MultiKeyStore FromDafny_N3_aws__N12_cryptography__N15_dbEncryptionSdk__N8_dynamoDb__S13_MultiKeyStore (software.amazon.cryptography.dbencryptionsdk.dynamodb.internaldafny.types._IMultiKeyStore value) { + software.amazon.cryptography.dbencryptionsdk.dynamodb.internaldafny.types.MultiKeyStore concrete = (software.amazon.cryptography.dbencryptionsdk.dynamodb.internaldafny.types.MultiKeyStore)value; AWS.Cryptography.DbEncryptionSDK.DynamoDb.MultiKeyStore converted = new AWS.Cryptography.DbEncryptionSDK.DynamoDb.MultiKeyStore(); converted.KeyFieldName = (string) FromDafny_N3_aws__N12_cryptography__N15_dbEncryptionSdk__N8_dynamoDb__S13_MultiKeyStore__M12_keyFieldName(concrete._keyFieldName); + converted.CacheTTL = (int) FromDafny_N3_aws__N12_cryptography__N15_dbEncryptionSdk__N8_dynamoDb__S13_MultiKeyStore__M8_cacheTTL(concrete._cacheTTL); + if (concrete._cache.is_Some) converted.Cache = (AWS.Cryptography.MaterialProviders.CacheType) FromDafny_N3_aws__N12_cryptography__N15_dbEncryptionSdk__N8_dynamoDb__S13_MultiKeyStore__M5_cache(concrete._cache); return converted; +} + public static software.amazon.cryptography.dbencryptionsdk.dynamodb.internaldafny.types._IMultiKeyStore ToDafny_N3_aws__N12_cryptography__N15_dbEncryptionSdk__N8_dynamoDb__S13_MultiKeyStore (AWS.Cryptography.DbEncryptionSDK.DynamoDb.MultiKeyStore value) { + AWS.Cryptography.MaterialProviders.CacheType var_cache = value.IsSetCache() ? value.Cache : (AWS.Cryptography.MaterialProviders.CacheType) null; + return new software.amazon.cryptography.dbencryptionsdk.dynamodb.internaldafny.types.MultiKeyStore ( ToDafny_N3_aws__N12_cryptography__N15_dbEncryptionSdk__N8_dynamoDb__S13_MultiKeyStore__M12_keyFieldName(value.KeyFieldName) , ToDafny_N3_aws__N12_cryptography__N15_dbEncryptionSdk__N8_dynamoDb__S13_MultiKeyStore__M8_cacheTTL(value.CacheTTL) , ToDafny_N3_aws__N12_cryptography__N15_dbEncryptionSdk__N8_dynamoDb__S13_MultiKeyStore__M5_cache(var_cache) ) ; +} + public static AWS.Cryptography.DbEncryptionSDK.DynamoDb.PartOnly FromDafny_N3_aws__N12_cryptography__N15_dbEncryptionSdk__N8_dynamoDb__S8_PartOnly (software.amazon.cryptography.dbencryptionsdk.dynamodb.internaldafny.types._IPartOnly value) { + software.amazon.cryptography.dbencryptionsdk.dynamodb.internaldafny.types.PartOnly concrete = (software.amazon.cryptography.dbencryptionsdk.dynamodb.internaldafny.types.PartOnly)value; AWS.Cryptography.DbEncryptionSDK.DynamoDb.PartOnly converted = new AWS.Cryptography.DbEncryptionSDK.DynamoDb.PartOnly(); return converted; +} + public static software.amazon.cryptography.dbencryptionsdk.dynamodb.internaldafny.types._IPartOnly ToDafny_N3_aws__N12_cryptography__N15_dbEncryptionSdk__N8_dynamoDb__S8_PartOnly (AWS.Cryptography.DbEncryptionSDK.DynamoDb.PartOnly value) { + + return new software.amazon.cryptography.dbencryptionsdk.dynamodb.internaldafny.types.PartOnly ( ) ; +} + public static AWS.Cryptography.DbEncryptionSDK.DynamoDb.Shared FromDafny_N3_aws__N12_cryptography__N15_dbEncryptionSdk__N8_dynamoDb__S6_Shared (software.amazon.cryptography.dbencryptionsdk.dynamodb.internaldafny.types._IShared value) { + software.amazon.cryptography.dbencryptionsdk.dynamodb.internaldafny.types.Shared concrete = (software.amazon.cryptography.dbencryptionsdk.dynamodb.internaldafny.types.Shared)value; AWS.Cryptography.DbEncryptionSDK.DynamoDb.Shared converted = new AWS.Cryptography.DbEncryptionSDK.DynamoDb.Shared(); converted.Other = (string) FromDafny_N3_aws__N12_cryptography__N15_dbEncryptionSdk__N8_dynamoDb__S6_Shared__M5_other(concrete._other); return converted; +} + public static software.amazon.cryptography.dbencryptionsdk.dynamodb.internaldafny.types._IShared ToDafny_N3_aws__N12_cryptography__N15_dbEncryptionSdk__N8_dynamoDb__S6_Shared (AWS.Cryptography.DbEncryptionSDK.DynamoDb.Shared value) { + + return new software.amazon.cryptography.dbencryptionsdk.dynamodb.internaldafny.types.Shared ( ToDafny_N3_aws__N12_cryptography__N15_dbEncryptionSdk__N8_dynamoDb__S6_Shared__M5_other(value.Other) ) ; +} + public static AWS.Cryptography.DbEncryptionSDK.DynamoDb.AsSet FromDafny_N3_aws__N12_cryptography__N15_dbEncryptionSdk__N8_dynamoDb__S5_AsSet (software.amazon.cryptography.dbencryptionsdk.dynamodb.internaldafny.types._IAsSet value) { + software.amazon.cryptography.dbencryptionsdk.dynamodb.internaldafny.types.AsSet concrete = (software.amazon.cryptography.dbencryptionsdk.dynamodb.internaldafny.types.AsSet)value; AWS.Cryptography.DbEncryptionSDK.DynamoDb.AsSet converted = new AWS.Cryptography.DbEncryptionSDK.DynamoDb.AsSet(); return converted; +} + public static software.amazon.cryptography.dbencryptionsdk.dynamodb.internaldafny.types._IAsSet ToDafny_N3_aws__N12_cryptography__N15_dbEncryptionSdk__N8_dynamoDb__S5_AsSet (AWS.Cryptography.DbEncryptionSDK.DynamoDb.AsSet value) { + + return new software.amazon.cryptography.dbencryptionsdk.dynamodb.internaldafny.types.AsSet ( ) ; +} + public static AWS.Cryptography.DbEncryptionSDK.DynamoDb.SharedSet FromDafny_N3_aws__N12_cryptography__N15_dbEncryptionSdk__N8_dynamoDb__S9_SharedSet (software.amazon.cryptography.dbencryptionsdk.dynamodb.internaldafny.types._ISharedSet value) { + software.amazon.cryptography.dbencryptionsdk.dynamodb.internaldafny.types.SharedSet concrete = (software.amazon.cryptography.dbencryptionsdk.dynamodb.internaldafny.types.SharedSet)value; AWS.Cryptography.DbEncryptionSDK.DynamoDb.SharedSet converted = new AWS.Cryptography.DbEncryptionSDK.DynamoDb.SharedSet(); converted.Other = (string) FromDafny_N3_aws__N12_cryptography__N15_dbEncryptionSdk__N8_dynamoDb__S9_SharedSet__M5_other(concrete._other); return converted; +} + public static software.amazon.cryptography.dbencryptionsdk.dynamodb.internaldafny.types._ISharedSet ToDafny_N3_aws__N12_cryptography__N15_dbEncryptionSdk__N8_dynamoDb__S9_SharedSet (AWS.Cryptography.DbEncryptionSDK.DynamoDb.SharedSet value) { + + return new software.amazon.cryptography.dbencryptionsdk.dynamodb.internaldafny.types.SharedSet ( ToDafny_N3_aws__N12_cryptography__N15_dbEncryptionSdk__N8_dynamoDb__S9_SharedSet__M5_other(value.Other) ) ; +} + public static AWS.Cryptography.DbEncryptionSDK.DynamoDb.IDynamoDbKeyBranchKeyIdSupplier FromDafny_N3_aws__N12_cryptography__N15_dbEncryptionSdk__N8_dynamoDb__S39_DynamoDbKeyBranchKeyIdSupplierReference (software.amazon.cryptography.dbencryptionsdk.dynamodb.internaldafny.types.IDynamoDbKeyBranchKeyIdSupplier value) { + if (value is NativeWrapper_DynamoDbKeyBranchKeyIdSupplier nativeWrapper) return nativeWrapper._impl; +return new DynamoDbKeyBranchKeyIdSupplier(value); + +} + public static software.amazon.cryptography.dbencryptionsdk.dynamodb.internaldafny.types.IDynamoDbKeyBranchKeyIdSupplier ToDafny_N3_aws__N12_cryptography__N15_dbEncryptionSdk__N8_dynamoDb__S39_DynamoDbKeyBranchKeyIdSupplierReference (AWS.Cryptography.DbEncryptionSDK.DynamoDb.IDynamoDbKeyBranchKeyIdSupplier value) { + switch (value) + { + case DynamoDbKeyBranchKeyIdSupplier valueWithImpl: + return valueWithImpl._impl; + case DynamoDbKeyBranchKeyIdSupplierBase nativeImpl: + return new NativeWrapper_DynamoDbKeyBranchKeyIdSupplier(nativeImpl); + default: + throw new System.ArgumentException( + "Custom implementations of DynamoDbKeyBranchKeyIdSupplier must extend DynamoDbKeyBranchKeyIdSupplierBase."); +} +} + public static AWS.Cryptography.MaterialProviders.IBranchKeyIdSupplier FromDafny_N3_aws__N12_cryptography__N17_materialProviders__S28_BranchKeyIdSupplierReference (software.amazon.cryptography.materialproviders.internaldafny.types.IBranchKeyIdSupplier value) { + // This is converting a reference type in a dependant module. + // Therefore it defers to the dependant module for conversion + return AWS.Cryptography.MaterialProviders.TypeConversion.FromDafny_N3_aws__N12_cryptography__N17_materialProviders__S28_BranchKeyIdSupplierReference(value); +} + public static software.amazon.cryptography.materialproviders.internaldafny.types.IBranchKeyIdSupplier ToDafny_N3_aws__N12_cryptography__N17_materialProviders__S28_BranchKeyIdSupplierReference (AWS.Cryptography.MaterialProviders.IBranchKeyIdSupplier value) { + // This is converting a reference type in a dependant module. + // Therefore it defers to the dependant module for conversion + return AWS.Cryptography.MaterialProviders.TypeConversion.ToDafny_N3_aws__N12_cryptography__N17_materialProviders__S28_BranchKeyIdSupplierReference(value); +} + public static string FromDafny_N6_smithy__N3_api__S6_String (Dafny.ISequence value) { + return new string(value.Elements); +} + public static Dafny.ISequence ToDafny_N6_smithy__N3_api__S6_String (string value) { + return Dafny.Sequence.FromString(value); +} + public static System.Collections.Generic.Dictionary FromDafny_N3_com__N9_amazonaws__N8_dynamodb__S3_Key (Dafny.IMap, software.amazon.cryptography.services.dynamodb.internaldafny.types._IAttributeValue> value) { + return value.ItemEnumerable.ToDictionary(pair => FromDafny_N3_com__N9_amazonaws__N8_dynamodb__S3_Key__M3_key(pair.Car), pair => FromDafny_N3_com__N9_amazonaws__N8_dynamodb__S3_Key__M5_value(pair.Cdr)); +} + public static Dafny.IMap, software.amazon.cryptography.services.dynamodb.internaldafny.types._IAttributeValue> ToDafny_N3_com__N9_amazonaws__N8_dynamodb__S3_Key (System.Collections.Generic.Dictionary value) { + return Dafny.Map, software.amazon.cryptography.services.dynamodb.internaldafny.types._IAttributeValue>.FromCollection(value.Select(pair => + new Dafny.Pair, software.amazon.cryptography.services.dynamodb.internaldafny.types._IAttributeValue>(ToDafny_N3_com__N9_amazonaws__N8_dynamodb__S3_Key__M3_key(pair.Key), ToDafny_N3_com__N9_amazonaws__N8_dynamodb__S3_Key__M5_value(pair.Value)) +)); +} + public static System.Collections.Generic.List FromDafny_N3_aws__N12_cryptography__N15_dbEncryptionSdk__N8_dynamoDb__S31_EncryptedDataKeyDescriptionList (Dafny.ISequence value) { + return new System.Collections.Generic.List(value.Elements.Select(FromDafny_N3_aws__N12_cryptography__N15_dbEncryptionSdk__N8_dynamoDb__S31_EncryptedDataKeyDescriptionList__M6_member)); +} + public static Dafny.ISequence ToDafny_N3_aws__N12_cryptography__N15_dbEncryptionSdk__N8_dynamoDb__S31_EncryptedDataKeyDescriptionList (System.Collections.Generic.List value) { + return Dafny.Sequence.FromArray(value.Select(ToDafny_N3_aws__N12_cryptography__N15_dbEncryptionSdk__N8_dynamoDb__S31_EncryptedDataKeyDescriptionList__M6_member).ToArray()); +} + public static System.IO.MemoryStream FromDafny_N6_smithy__N3_api__S4_Blob (Dafny.ISequence value) { + return new System.IO.MemoryStream(value.Elements); +} + public static Dafny.ISequence ToDafny_N6_smithy__N3_api__S4_Blob (System.IO.MemoryStream value) { + return Dafny.Sequence.FromArray(value.ToArray()); +} + public static System.Collections.Generic.Dictionary FromDafny_N3_com__N9_amazonaws__N8_dynamodb__S12_AttributeMap (Dafny.IMap, software.amazon.cryptography.services.dynamodb.internaldafny.types._IAttributeValue> value) { + return value.ItemEnumerable.ToDictionary(pair => FromDafny_N3_com__N9_amazonaws__N8_dynamodb__S12_AttributeMap__M3_key(pair.Car), pair => FromDafny_N3_com__N9_amazonaws__N8_dynamodb__S12_AttributeMap__M5_value(pair.Cdr)); +} + public static Dafny.IMap, software.amazon.cryptography.services.dynamodb.internaldafny.types._IAttributeValue> ToDafny_N3_com__N9_amazonaws__N8_dynamodb__S12_AttributeMap (System.Collections.Generic.Dictionary value) { + return Dafny.Map, software.amazon.cryptography.services.dynamodb.internaldafny.types._IAttributeValue>.FromCollection(value.Select(pair => + new Dafny.Pair, software.amazon.cryptography.services.dynamodb.internaldafny.types._IAttributeValue>(ToDafny_N3_com__N9_amazonaws__N8_dynamodb__S12_AttributeMap__M3_key(pair.Key), ToDafny_N3_com__N9_amazonaws__N8_dynamodb__S12_AttributeMap__M5_value(pair.Value)) +)); +} + public static AWS.Cryptography.DbEncryptionSDK.DynamoDb.Upper FromDafny_N3_aws__N12_cryptography__N15_dbEncryptionSdk__N8_dynamoDb__S5_Upper (software.amazon.cryptography.dbencryptionsdk.dynamodb.internaldafny.types._IUpper value) { + software.amazon.cryptography.dbencryptionsdk.dynamodb.internaldafny.types.Upper concrete = (software.amazon.cryptography.dbencryptionsdk.dynamodb.internaldafny.types.Upper)value; AWS.Cryptography.DbEncryptionSDK.DynamoDb.Upper converted = new AWS.Cryptography.DbEncryptionSDK.DynamoDb.Upper(); return converted; +} + public static software.amazon.cryptography.dbencryptionsdk.dynamodb.internaldafny.types._IUpper ToDafny_N3_aws__N12_cryptography__N15_dbEncryptionSdk__N8_dynamoDb__S5_Upper (AWS.Cryptography.DbEncryptionSDK.DynamoDb.Upper value) { + + return new software.amazon.cryptography.dbencryptionsdk.dynamodb.internaldafny.types.Upper ( ) ; +} + public static AWS.Cryptography.DbEncryptionSDK.DynamoDb.Lower FromDafny_N3_aws__N12_cryptography__N15_dbEncryptionSdk__N8_dynamoDb__S5_Lower (software.amazon.cryptography.dbencryptionsdk.dynamodb.internaldafny.types._ILower value) { + software.amazon.cryptography.dbencryptionsdk.dynamodb.internaldafny.types.Lower concrete = (software.amazon.cryptography.dbencryptionsdk.dynamodb.internaldafny.types.Lower)value; AWS.Cryptography.DbEncryptionSDK.DynamoDb.Lower converted = new AWS.Cryptography.DbEncryptionSDK.DynamoDb.Lower(); return converted; +} + public static software.amazon.cryptography.dbencryptionsdk.dynamodb.internaldafny.types._ILower ToDafny_N3_aws__N12_cryptography__N15_dbEncryptionSdk__N8_dynamoDb__S5_Lower (AWS.Cryptography.DbEncryptionSDK.DynamoDb.Lower value) { + + return new software.amazon.cryptography.dbencryptionsdk.dynamodb.internaldafny.types.Lower ( ) ; +} + public static AWS.Cryptography.DbEncryptionSDK.DynamoDb.Insert FromDafny_N3_aws__N12_cryptography__N15_dbEncryptionSdk__N8_dynamoDb__S6_Insert (software.amazon.cryptography.dbencryptionsdk.dynamodb.internaldafny.types._IInsert value) { + software.amazon.cryptography.dbencryptionsdk.dynamodb.internaldafny.types.Insert concrete = (software.amazon.cryptography.dbencryptionsdk.dynamodb.internaldafny.types.Insert)value; AWS.Cryptography.DbEncryptionSDK.DynamoDb.Insert converted = new AWS.Cryptography.DbEncryptionSDK.DynamoDb.Insert(); converted.Literal = (string) FromDafny_N3_aws__N12_cryptography__N15_dbEncryptionSdk__N8_dynamoDb__S6_Insert__M7_literal(concrete._literal); return converted; +} + public static software.amazon.cryptography.dbencryptionsdk.dynamodb.internaldafny.types._IInsert ToDafny_N3_aws__N12_cryptography__N15_dbEncryptionSdk__N8_dynamoDb__S6_Insert (AWS.Cryptography.DbEncryptionSDK.DynamoDb.Insert value) { + + return new software.amazon.cryptography.dbencryptionsdk.dynamodb.internaldafny.types.Insert ( ToDafny_N3_aws__N12_cryptography__N15_dbEncryptionSdk__N8_dynamoDb__S6_Insert__M7_literal(value.Literal) ) ; +} + public static AWS.Cryptography.DbEncryptionSDK.DynamoDb.GetPrefix FromDafny_N3_aws__N12_cryptography__N15_dbEncryptionSdk__N8_dynamoDb__S9_GetPrefix (software.amazon.cryptography.dbencryptionsdk.dynamodb.internaldafny.types._IGetPrefix value) { + software.amazon.cryptography.dbencryptionsdk.dynamodb.internaldafny.types.GetPrefix concrete = (software.amazon.cryptography.dbencryptionsdk.dynamodb.internaldafny.types.GetPrefix)value; AWS.Cryptography.DbEncryptionSDK.DynamoDb.GetPrefix converted = new AWS.Cryptography.DbEncryptionSDK.DynamoDb.GetPrefix(); converted.Length = (int) FromDafny_N3_aws__N12_cryptography__N15_dbEncryptionSdk__N8_dynamoDb__S9_GetPrefix__M6_length(concrete._length); return converted; +} + public static software.amazon.cryptography.dbencryptionsdk.dynamodb.internaldafny.types._IGetPrefix ToDafny_N3_aws__N12_cryptography__N15_dbEncryptionSdk__N8_dynamoDb__S9_GetPrefix (AWS.Cryptography.DbEncryptionSDK.DynamoDb.GetPrefix value) { + + return new software.amazon.cryptography.dbencryptionsdk.dynamodb.internaldafny.types.GetPrefix ( ToDafny_N3_aws__N12_cryptography__N15_dbEncryptionSdk__N8_dynamoDb__S9_GetPrefix__M6_length(value.Length) ) ; +} + public static AWS.Cryptography.DbEncryptionSDK.DynamoDb.GetSuffix FromDafny_N3_aws__N12_cryptography__N15_dbEncryptionSdk__N8_dynamoDb__S9_GetSuffix (software.amazon.cryptography.dbencryptionsdk.dynamodb.internaldafny.types._IGetSuffix value) { + software.amazon.cryptography.dbencryptionsdk.dynamodb.internaldafny.types.GetSuffix concrete = (software.amazon.cryptography.dbencryptionsdk.dynamodb.internaldafny.types.GetSuffix)value; AWS.Cryptography.DbEncryptionSDK.DynamoDb.GetSuffix converted = new AWS.Cryptography.DbEncryptionSDK.DynamoDb.GetSuffix(); converted.Length = (int) FromDafny_N3_aws__N12_cryptography__N15_dbEncryptionSdk__N8_dynamoDb__S9_GetSuffix__M6_length(concrete._length); return converted; +} + public static software.amazon.cryptography.dbencryptionsdk.dynamodb.internaldafny.types._IGetSuffix ToDafny_N3_aws__N12_cryptography__N15_dbEncryptionSdk__N8_dynamoDb__S9_GetSuffix (AWS.Cryptography.DbEncryptionSDK.DynamoDb.GetSuffix value) { + + return new software.amazon.cryptography.dbencryptionsdk.dynamodb.internaldafny.types.GetSuffix ( ToDafny_N3_aws__N12_cryptography__N15_dbEncryptionSdk__N8_dynamoDb__S9_GetSuffix__M6_length(value.Length) ) ; +} + public static AWS.Cryptography.DbEncryptionSDK.DynamoDb.GetSubstring FromDafny_N3_aws__N12_cryptography__N15_dbEncryptionSdk__N8_dynamoDb__S12_GetSubstring (software.amazon.cryptography.dbencryptionsdk.dynamodb.internaldafny.types._IGetSubstring value) { + software.amazon.cryptography.dbencryptionsdk.dynamodb.internaldafny.types.GetSubstring concrete = (software.amazon.cryptography.dbencryptionsdk.dynamodb.internaldafny.types.GetSubstring)value; AWS.Cryptography.DbEncryptionSDK.DynamoDb.GetSubstring converted = new AWS.Cryptography.DbEncryptionSDK.DynamoDb.GetSubstring(); converted.Low = (int) FromDafny_N3_aws__N12_cryptography__N15_dbEncryptionSdk__N8_dynamoDb__S12_GetSubstring__M3_low(concrete._low); + converted.High = (int) FromDafny_N3_aws__N12_cryptography__N15_dbEncryptionSdk__N8_dynamoDb__S12_GetSubstring__M4_high(concrete._high); return converted; +} + public static software.amazon.cryptography.dbencryptionsdk.dynamodb.internaldafny.types._IGetSubstring ToDafny_N3_aws__N12_cryptography__N15_dbEncryptionSdk__N8_dynamoDb__S12_GetSubstring (AWS.Cryptography.DbEncryptionSDK.DynamoDb.GetSubstring value) { + + return new software.amazon.cryptography.dbencryptionsdk.dynamodb.internaldafny.types.GetSubstring ( ToDafny_N3_aws__N12_cryptography__N15_dbEncryptionSdk__N8_dynamoDb__S12_GetSubstring__M3_low(value.Low) , ToDafny_N3_aws__N12_cryptography__N15_dbEncryptionSdk__N8_dynamoDb__S12_GetSubstring__M4_high(value.High) ) ; +} + public static AWS.Cryptography.DbEncryptionSDK.DynamoDb.GetSegment FromDafny_N3_aws__N12_cryptography__N15_dbEncryptionSdk__N8_dynamoDb__S10_GetSegment (software.amazon.cryptography.dbencryptionsdk.dynamodb.internaldafny.types._IGetSegment value) { + software.amazon.cryptography.dbencryptionsdk.dynamodb.internaldafny.types.GetSegment concrete = (software.amazon.cryptography.dbencryptionsdk.dynamodb.internaldafny.types.GetSegment)value; AWS.Cryptography.DbEncryptionSDK.DynamoDb.GetSegment converted = new AWS.Cryptography.DbEncryptionSDK.DynamoDb.GetSegment(); converted.Split = (string) FromDafny_N3_aws__N12_cryptography__N15_dbEncryptionSdk__N8_dynamoDb__S10_GetSegment__M5_split(concrete._split); + converted.Index = (int) FromDafny_N3_aws__N12_cryptography__N15_dbEncryptionSdk__N8_dynamoDb__S10_GetSegment__M5_index(concrete._index); return converted; +} + public static software.amazon.cryptography.dbencryptionsdk.dynamodb.internaldafny.types._IGetSegment ToDafny_N3_aws__N12_cryptography__N15_dbEncryptionSdk__N8_dynamoDb__S10_GetSegment (AWS.Cryptography.DbEncryptionSDK.DynamoDb.GetSegment value) { + + return new software.amazon.cryptography.dbencryptionsdk.dynamodb.internaldafny.types.GetSegment ( ToDafny_N3_aws__N12_cryptography__N15_dbEncryptionSdk__N8_dynamoDb__S10_GetSegment__M5_split(value.Split) , ToDafny_N3_aws__N12_cryptography__N15_dbEncryptionSdk__N8_dynamoDb__S10_GetSegment__M5_index(value.Index) ) ; +} + public static AWS.Cryptography.DbEncryptionSDK.DynamoDb.GetSegments FromDafny_N3_aws__N12_cryptography__N15_dbEncryptionSdk__N8_dynamoDb__S11_GetSegments (software.amazon.cryptography.dbencryptionsdk.dynamodb.internaldafny.types._IGetSegments value) { + software.amazon.cryptography.dbencryptionsdk.dynamodb.internaldafny.types.GetSegments concrete = (software.amazon.cryptography.dbencryptionsdk.dynamodb.internaldafny.types.GetSegments)value; AWS.Cryptography.DbEncryptionSDK.DynamoDb.GetSegments converted = new AWS.Cryptography.DbEncryptionSDK.DynamoDb.GetSegments(); converted.Split = (string) FromDafny_N3_aws__N12_cryptography__N15_dbEncryptionSdk__N8_dynamoDb__S11_GetSegments__M5_split(concrete._split); + converted.Low = (int) FromDafny_N3_aws__N12_cryptography__N15_dbEncryptionSdk__N8_dynamoDb__S11_GetSegments__M3_low(concrete._low); + converted.High = (int) FromDafny_N3_aws__N12_cryptography__N15_dbEncryptionSdk__N8_dynamoDb__S11_GetSegments__M4_high(concrete._high); return converted; +} + public static software.amazon.cryptography.dbencryptionsdk.dynamodb.internaldafny.types._IGetSegments ToDafny_N3_aws__N12_cryptography__N15_dbEncryptionSdk__N8_dynamoDb__S11_GetSegments (AWS.Cryptography.DbEncryptionSDK.DynamoDb.GetSegments value) { + + return new software.amazon.cryptography.dbencryptionsdk.dynamodb.internaldafny.types.GetSegments ( ToDafny_N3_aws__N12_cryptography__N15_dbEncryptionSdk__N8_dynamoDb__S11_GetSegments__M5_split(value.Split) , ToDafny_N3_aws__N12_cryptography__N15_dbEncryptionSdk__N8_dynamoDb__S11_GetSegments__M3_low(value.Low) , ToDafny_N3_aws__N12_cryptography__N15_dbEncryptionSdk__N8_dynamoDb__S11_GetSegments__M4_high(value.High) ) ; +} + public static string FromDafny_N3_aws__N12_cryptography__N15_dbEncryptionSdk__N8_dynamoDb__S14_SingleKeyStore__M5_keyId (Dafny.ISequence value) { + return FromDafny_N6_smithy__N3_api__S6_String(value); +} + public static Dafny.ISequence ToDafny_N3_aws__N12_cryptography__N15_dbEncryptionSdk__N8_dynamoDb__S14_SingleKeyStore__M5_keyId (string value) { + return ToDafny_N6_smithy__N3_api__S6_String(value); +} + public static int FromDafny_N3_aws__N12_cryptography__N15_dbEncryptionSdk__N8_dynamoDb__S14_SingleKeyStore__M8_cacheTTL (int value) { + return FromDafny_N6_smithy__N3_api__S7_Integer(value); +} + public static int ToDafny_N3_aws__N12_cryptography__N15_dbEncryptionSdk__N8_dynamoDb__S14_SingleKeyStore__M8_cacheTTL (int value) { + return ToDafny_N6_smithy__N3_api__S7_Integer(value); +} + public static string FromDafny_N3_aws__N12_cryptography__N15_dbEncryptionSdk__N8_dynamoDb__S13_MultiKeyStore__M12_keyFieldName (Dafny.ISequence value) { + return FromDafny_N6_smithy__N3_api__S6_String(value); +} + public static Dafny.ISequence ToDafny_N3_aws__N12_cryptography__N15_dbEncryptionSdk__N8_dynamoDb__S13_MultiKeyStore__M12_keyFieldName (string value) { + return ToDafny_N6_smithy__N3_api__S6_String(value); +} + public static int FromDafny_N3_aws__N12_cryptography__N15_dbEncryptionSdk__N8_dynamoDb__S13_MultiKeyStore__M8_cacheTTL (int value) { + return FromDafny_N6_smithy__N3_api__S7_Integer(value); +} + public static int ToDafny_N3_aws__N12_cryptography__N15_dbEncryptionSdk__N8_dynamoDb__S13_MultiKeyStore__M8_cacheTTL (int value) { + return ToDafny_N6_smithy__N3_api__S7_Integer(value); +} + public static AWS.Cryptography.MaterialProviders.CacheType FromDafny_N3_aws__N12_cryptography__N15_dbEncryptionSdk__N8_dynamoDb__S13_MultiKeyStore__M5_cache (Wrappers_Compile._IOption value) { + return value.is_None ? (AWS.Cryptography.MaterialProviders.CacheType) null : FromDafny_N3_aws__N12_cryptography__N17_materialProviders__S9_CacheType(value.Extract()); +} + public static Wrappers_Compile._IOption ToDafny_N3_aws__N12_cryptography__N15_dbEncryptionSdk__N8_dynamoDb__S13_MultiKeyStore__M5_cache (AWS.Cryptography.MaterialProviders.CacheType value) { + return value == null ? Wrappers_Compile.Option.create_None() : Wrappers_Compile.Option.create_Some(ToDafny_N3_aws__N12_cryptography__N17_materialProviders__S9_CacheType((AWS.Cryptography.MaterialProviders.CacheType) value)); +} + public static string FromDafny_N3_aws__N12_cryptography__N15_dbEncryptionSdk__N8_dynamoDb__S6_Shared__M5_other (Dafny.ISequence value) { + return FromDafny_N6_smithy__N3_api__S6_String(value); +} + public static Dafny.ISequence ToDafny_N3_aws__N12_cryptography__N15_dbEncryptionSdk__N8_dynamoDb__S6_Shared__M5_other (string value) { + return ToDafny_N6_smithy__N3_api__S6_String(value); +} + public static string FromDafny_N3_aws__N12_cryptography__N15_dbEncryptionSdk__N8_dynamoDb__S9_SharedSet__M5_other (Dafny.ISequence value) { + return FromDafny_N6_smithy__N3_api__S6_String(value); +} + public static Dafny.ISequence ToDafny_N3_aws__N12_cryptography__N15_dbEncryptionSdk__N8_dynamoDb__S9_SharedSet__M5_other (string value) { + return ToDafny_N6_smithy__N3_api__S6_String(value); +} + public static string FromDafny_N3_com__N9_amazonaws__N8_dynamodb__S3_Key__M3_key (Dafny.ISequence value) { + return FromDafny_N3_com__N9_amazonaws__N8_dynamodb__S13_AttributeName(value); +} + public static Dafny.ISequence ToDafny_N3_com__N9_amazonaws__N8_dynamodb__S3_Key__M3_key (string value) { + return ToDafny_N3_com__N9_amazonaws__N8_dynamodb__S13_AttributeName(value); +} + public static Amazon.DynamoDBv2.Model.AttributeValue FromDafny_N3_com__N9_amazonaws__N8_dynamodb__S3_Key__M5_value (software.amazon.cryptography.services.dynamodb.internaldafny.types._IAttributeValue value) { + return FromDafny_N3_com__N9_amazonaws__N8_dynamodb__S14_AttributeValue(value); +} + public static software.amazon.cryptography.services.dynamodb.internaldafny.types._IAttributeValue ToDafny_N3_com__N9_amazonaws__N8_dynamodb__S3_Key__M5_value (Amazon.DynamoDBv2.Model.AttributeValue value) { + return ToDafny_N3_com__N9_amazonaws__N8_dynamodb__S14_AttributeValue(value); +} + public static AWS.Cryptography.DbEncryptionSDK.DynamoDb.EncryptedDataKeyDescriptionOutput FromDafny_N3_aws__N12_cryptography__N15_dbEncryptionSdk__N8_dynamoDb__S31_EncryptedDataKeyDescriptionList__M6_member (software.amazon.cryptography.dbencryptionsdk.dynamodb.internaldafny.types._IEncryptedDataKeyDescriptionOutput value) { + return FromDafny_N3_aws__N12_cryptography__N15_dbEncryptionSdk__N8_dynamoDb__S33_EncryptedDataKeyDescriptionOutput(value); +} + public static software.amazon.cryptography.dbencryptionsdk.dynamodb.internaldafny.types._IEncryptedDataKeyDescriptionOutput ToDafny_N3_aws__N12_cryptography__N15_dbEncryptionSdk__N8_dynamoDb__S31_EncryptedDataKeyDescriptionList__M6_member (AWS.Cryptography.DbEncryptionSDK.DynamoDb.EncryptedDataKeyDescriptionOutput value) { + return ToDafny_N3_aws__N12_cryptography__N15_dbEncryptionSdk__N8_dynamoDb__S33_EncryptedDataKeyDescriptionOutput(value); +} + public static string FromDafny_N3_com__N9_amazonaws__N8_dynamodb__S12_AttributeMap__M3_key (Dafny.ISequence value) { + return FromDafny_N3_com__N9_amazonaws__N8_dynamodb__S13_AttributeName(value); +} + public static Dafny.ISequence ToDafny_N3_com__N9_amazonaws__N8_dynamodb__S12_AttributeMap__M3_key (string value) { + return ToDafny_N3_com__N9_amazonaws__N8_dynamodb__S13_AttributeName(value); +} + public static Amazon.DynamoDBv2.Model.AttributeValue FromDafny_N3_com__N9_amazonaws__N8_dynamodb__S12_AttributeMap__M5_value (software.amazon.cryptography.services.dynamodb.internaldafny.types._IAttributeValue value) { + return FromDafny_N3_com__N9_amazonaws__N8_dynamodb__S14_AttributeValue(value); +} + public static software.amazon.cryptography.services.dynamodb.internaldafny.types._IAttributeValue ToDafny_N3_com__N9_amazonaws__N8_dynamodb__S12_AttributeMap__M5_value (Amazon.DynamoDBv2.Model.AttributeValue value) { + return ToDafny_N3_com__N9_amazonaws__N8_dynamodb__S14_AttributeValue(value); +} + public static string FromDafny_N3_aws__N12_cryptography__N15_dbEncryptionSdk__N8_dynamoDb__S6_Insert__M7_literal (Dafny.ISequence value) { + return FromDafny_N6_smithy__N3_api__S6_String(value); +} + public static Dafny.ISequence ToDafny_N3_aws__N12_cryptography__N15_dbEncryptionSdk__N8_dynamoDb__S6_Insert__M7_literal (string value) { + return ToDafny_N6_smithy__N3_api__S6_String(value); +} + public static int FromDafny_N3_aws__N12_cryptography__N15_dbEncryptionSdk__N8_dynamoDb__S9_GetPrefix__M6_length (int value) { + return FromDafny_N6_smithy__N3_api__S7_Integer(value); +} + public static int ToDafny_N3_aws__N12_cryptography__N15_dbEncryptionSdk__N8_dynamoDb__S9_GetPrefix__M6_length (int value) { + return ToDafny_N6_smithy__N3_api__S7_Integer(value); +} + public static int FromDafny_N3_aws__N12_cryptography__N15_dbEncryptionSdk__N8_dynamoDb__S9_GetSuffix__M6_length (int value) { + return FromDafny_N6_smithy__N3_api__S7_Integer(value); +} + public static int ToDafny_N3_aws__N12_cryptography__N15_dbEncryptionSdk__N8_dynamoDb__S9_GetSuffix__M6_length (int value) { + return ToDafny_N6_smithy__N3_api__S7_Integer(value); +} + public static int FromDafny_N3_aws__N12_cryptography__N15_dbEncryptionSdk__N8_dynamoDb__S12_GetSubstring__M3_low (int value) { + return FromDafny_N6_smithy__N3_api__S7_Integer(value); +} + public static int ToDafny_N3_aws__N12_cryptography__N15_dbEncryptionSdk__N8_dynamoDb__S12_GetSubstring__M3_low (int value) { + return ToDafny_N6_smithy__N3_api__S7_Integer(value); +} + public static int FromDafny_N3_aws__N12_cryptography__N15_dbEncryptionSdk__N8_dynamoDb__S12_GetSubstring__M4_high (int value) { + return FromDafny_N6_smithy__N3_api__S7_Integer(value); +} + public static int ToDafny_N3_aws__N12_cryptography__N15_dbEncryptionSdk__N8_dynamoDb__S12_GetSubstring__M4_high (int value) { + return ToDafny_N6_smithy__N3_api__S7_Integer(value); +} + public static string FromDafny_N3_aws__N12_cryptography__N15_dbEncryptionSdk__N8_dynamoDb__S10_GetSegment__M5_split (Dafny.ISequence value) { + return FromDafny_N3_aws__N12_cryptography__N15_dbEncryptionSdk__N8_dynamoDb__S4_Char(value); +} + public static Dafny.ISequence ToDafny_N3_aws__N12_cryptography__N15_dbEncryptionSdk__N8_dynamoDb__S10_GetSegment__M5_split (string value) { + return ToDafny_N3_aws__N12_cryptography__N15_dbEncryptionSdk__N8_dynamoDb__S4_Char(value); +} + public static int FromDafny_N3_aws__N12_cryptography__N15_dbEncryptionSdk__N8_dynamoDb__S10_GetSegment__M5_index (int value) { + return FromDafny_N6_smithy__N3_api__S7_Integer(value); +} + public static int ToDafny_N3_aws__N12_cryptography__N15_dbEncryptionSdk__N8_dynamoDb__S10_GetSegment__M5_index (int value) { + return ToDafny_N6_smithy__N3_api__S7_Integer(value); +} + public static string FromDafny_N3_aws__N12_cryptography__N15_dbEncryptionSdk__N8_dynamoDb__S11_GetSegments__M5_split (Dafny.ISequence value) { + return FromDafny_N3_aws__N12_cryptography__N15_dbEncryptionSdk__N8_dynamoDb__S4_Char(value); +} + public static Dafny.ISequence ToDafny_N3_aws__N12_cryptography__N15_dbEncryptionSdk__N8_dynamoDb__S11_GetSegments__M5_split (string value) { + return ToDafny_N3_aws__N12_cryptography__N15_dbEncryptionSdk__N8_dynamoDb__S4_Char(value); +} + public static int FromDafny_N3_aws__N12_cryptography__N15_dbEncryptionSdk__N8_dynamoDb__S11_GetSegments__M3_low (int value) { + return FromDafny_N6_smithy__N3_api__S7_Integer(value); +} + public static int ToDafny_N3_aws__N12_cryptography__N15_dbEncryptionSdk__N8_dynamoDb__S11_GetSegments__M3_low (int value) { + return ToDafny_N6_smithy__N3_api__S7_Integer(value); +} + public static int FromDafny_N3_aws__N12_cryptography__N15_dbEncryptionSdk__N8_dynamoDb__S11_GetSegments__M4_high (int value) { + return FromDafny_N6_smithy__N3_api__S7_Integer(value); +} + public static int ToDafny_N3_aws__N12_cryptography__N15_dbEncryptionSdk__N8_dynamoDb__S11_GetSegments__M4_high (int value) { + return ToDafny_N6_smithy__N3_api__S7_Integer(value); +} + public static int FromDafny_N6_smithy__N3_api__S7_Integer (int value) { + return value; +} + public static int ToDafny_N6_smithy__N3_api__S7_Integer (int value) { + return value; +} + public static AWS.Cryptography.MaterialProviders.CacheType FromDafny_N3_aws__N12_cryptography__N17_materialProviders__S9_CacheType (software.amazon.cryptography.materialproviders.internaldafny.types._ICacheType value) { + software.amazon.cryptography.materialproviders.internaldafny.types.CacheType concrete = (software.amazon.cryptography.materialproviders.internaldafny.types.CacheType)value; + var converted = new AWS.Cryptography.MaterialProviders.CacheType(); if (value.is_Default) { + converted.Default = FromDafny_N3_aws__N12_cryptography__N17_materialProviders__S9_CacheType__M7_Default(concrete.dtor_Default); + return converted; +} if (value.is_No) { + converted.No = FromDafny_N3_aws__N12_cryptography__N17_materialProviders__S9_CacheType__M2_No(concrete.dtor_No); + return converted; +} if (value.is_SingleThreaded) { + converted.SingleThreaded = FromDafny_N3_aws__N12_cryptography__N17_materialProviders__S9_CacheType__M14_SingleThreaded(concrete.dtor_SingleThreaded); + return converted; +} if (value.is_MultiThreaded) { + converted.MultiThreaded = FromDafny_N3_aws__N12_cryptography__N17_materialProviders__S9_CacheType__M13_MultiThreaded(concrete.dtor_MultiThreaded); + return converted; +} if (value.is_StormTracking) { + converted.StormTracking = FromDafny_N3_aws__N12_cryptography__N17_materialProviders__S9_CacheType__M13_StormTracking(concrete.dtor_StormTracking); + return converted; +} +throw new System.ArgumentException("Invalid AWS.Cryptography.MaterialProviders.CacheType state"); +} + public static software.amazon.cryptography.materialproviders.internaldafny.types._ICacheType ToDafny_N3_aws__N12_cryptography__N17_materialProviders__S9_CacheType (AWS.Cryptography.MaterialProviders.CacheType value) { + if (value.IsSetDefault()) { + return software.amazon.cryptography.materialproviders.internaldafny.types.CacheType.create_Default(ToDafny_N3_aws__N12_cryptography__N17_materialProviders__S9_CacheType__M7_Default(value.Default)); +} if (value.IsSetNo()) { + return software.amazon.cryptography.materialproviders.internaldafny.types.CacheType.create_No(ToDafny_N3_aws__N12_cryptography__N17_materialProviders__S9_CacheType__M2_No(value.No)); +} if (value.IsSetSingleThreaded()) { + return software.amazon.cryptography.materialproviders.internaldafny.types.CacheType.create_SingleThreaded(ToDafny_N3_aws__N12_cryptography__N17_materialProviders__S9_CacheType__M14_SingleThreaded(value.SingleThreaded)); +} if (value.IsSetMultiThreaded()) { + return software.amazon.cryptography.materialproviders.internaldafny.types.CacheType.create_MultiThreaded(ToDafny_N3_aws__N12_cryptography__N17_materialProviders__S9_CacheType__M13_MultiThreaded(value.MultiThreaded)); +} if (value.IsSetStormTracking()) { + return software.amazon.cryptography.materialproviders.internaldafny.types.CacheType.create_StormTracking(ToDafny_N3_aws__N12_cryptography__N17_materialProviders__S9_CacheType__M13_StormTracking(value.StormTracking)); +} +throw new System.ArgumentException("Invalid AWS.Cryptography.MaterialProviders.CacheType state"); +} + public static string FromDafny_N3_com__N9_amazonaws__N8_dynamodb__S13_AttributeName (Dafny.ISequence value) { + return new string(value.Elements); +} + public static Dafny.ISequence ToDafny_N3_com__N9_amazonaws__N8_dynamodb__S13_AttributeName (string value) { + return Dafny.Sequence.FromString(value); +} + public static Amazon.DynamoDBv2.Model.AttributeValue FromDafny_N3_com__N9_amazonaws__N8_dynamodb__S14_AttributeValue (software.amazon.cryptography.services.dynamodb.internaldafny.types._IAttributeValue value) { + software.amazon.cryptography.services.dynamodb.internaldafny.types.AttributeValue concrete = (software.amazon.cryptography.services.dynamodb.internaldafny.types.AttributeValue)value; + var converted = new Amazon.DynamoDBv2.Model.AttributeValue(); if (value.is_S) { + converted.S = FromDafny_N3_com__N9_amazonaws__N8_dynamodb__S14_AttributeValue__M1_S(concrete.dtor_S); + return converted; +} if (value.is_N) { + converted.N = FromDafny_N3_com__N9_amazonaws__N8_dynamodb__S14_AttributeValue__M1_N(concrete.dtor_N); + return converted; +} if (value.is_B) { + converted.B = FromDafny_N3_com__N9_amazonaws__N8_dynamodb__S14_AttributeValue__M1_B(concrete.dtor_B); + return converted; +} if (value.is_SS) { + converted.SS = FromDafny_N3_com__N9_amazonaws__N8_dynamodb__S14_AttributeValue__M2_SS(concrete.dtor_SS); + return converted; +} if (value.is_NS) { + converted.NS = FromDafny_N3_com__N9_amazonaws__N8_dynamodb__S14_AttributeValue__M2_NS(concrete.dtor_NS); + return converted; +} if (value.is_BS) { + converted.BS = FromDafny_N3_com__N9_amazonaws__N8_dynamodb__S14_AttributeValue__M2_BS(concrete.dtor_BS); + return converted; +} if (value.is_M) { + converted.M = FromDafny_N3_com__N9_amazonaws__N8_dynamodb__S14_AttributeValue__M1_M(concrete.dtor_M); + return converted; +} if (value.is_L) { + converted.L = FromDafny_N3_com__N9_amazonaws__N8_dynamodb__S14_AttributeValue__M1_L(concrete.dtor_L); + return converted; +} if (value.is_NULL) { + converted.NULL = FromDafny_N3_com__N9_amazonaws__N8_dynamodb__S14_AttributeValue__M4_NULL(concrete.dtor_NULL); + return converted; +} if (value.is_BOOL) { + converted.BOOL = FromDafny_N3_com__N9_amazonaws__N8_dynamodb__S14_AttributeValue__M4_BOOL(concrete.dtor_BOOL); + return converted; +} +throw new System.ArgumentException("Invalid Amazon.DynamoDBv2.Model.AttributeValue state"); +} + public static software.amazon.cryptography.services.dynamodb.internaldafny.types._IAttributeValue ToDafny_N3_com__N9_amazonaws__N8_dynamodb__S14_AttributeValue (Amazon.DynamoDBv2.Model.AttributeValue value) { + if (value.S != null) { + return software.amazon.cryptography.services.dynamodb.internaldafny.types.AttributeValue.create_S(ToDafny_N3_com__N9_amazonaws__N8_dynamodb__S14_AttributeValue__M1_S(value.S)); +} if (value.N != null) { + return software.amazon.cryptography.services.dynamodb.internaldafny.types.AttributeValue.create_N(ToDafny_N3_com__N9_amazonaws__N8_dynamodb__S14_AttributeValue__M1_N(value.N)); +} if (value.B != null) { + return software.amazon.cryptography.services.dynamodb.internaldafny.types.AttributeValue.create_B(ToDafny_N3_com__N9_amazonaws__N8_dynamodb__S14_AttributeValue__M1_B(value.B)); +} if (value.SS.Any()) { + return software.amazon.cryptography.services.dynamodb.internaldafny.types.AttributeValue.create_SS(ToDafny_N3_com__N9_amazonaws__N8_dynamodb__S14_AttributeValue__M2_SS(value.SS)); +} if (value.NS.Any()) { + return software.amazon.cryptography.services.dynamodb.internaldafny.types.AttributeValue.create_NS(ToDafny_N3_com__N9_amazonaws__N8_dynamodb__S14_AttributeValue__M2_NS(value.NS)); +} if (value.BS.Any()) { + return software.amazon.cryptography.services.dynamodb.internaldafny.types.AttributeValue.create_BS(ToDafny_N3_com__N9_amazonaws__N8_dynamodb__S14_AttributeValue__M2_BS(value.BS)); +} if (value.IsMSet) { + return software.amazon.cryptography.services.dynamodb.internaldafny.types.AttributeValue.create_M(ToDafny_N3_com__N9_amazonaws__N8_dynamodb__S14_AttributeValue__M1_M(value.M)); +} if (value.IsLSet) { + return software.amazon.cryptography.services.dynamodb.internaldafny.types.AttributeValue.create_L(ToDafny_N3_com__N9_amazonaws__N8_dynamodb__S14_AttributeValue__M1_L(value.L)); +} if (value.NULL == true) { + return software.amazon.cryptography.services.dynamodb.internaldafny.types.AttributeValue.create_NULL(ToDafny_N3_com__N9_amazonaws__N8_dynamodb__S14_AttributeValue__M4_NULL(value.NULL)); +} if (value.IsBOOLSet) { + return software.amazon.cryptography.services.dynamodb.internaldafny.types.AttributeValue.create_BOOL(ToDafny_N3_com__N9_amazonaws__N8_dynamodb__S14_AttributeValue__M4_BOOL(value.BOOL)); +} +throw new System.ArgumentException("Invalid Amazon.DynamoDBv2.Model.AttributeValue state"); +} + public static AWS.Cryptography.DbEncryptionSDK.DynamoDb.EncryptedDataKeyDescriptionOutput FromDafny_N3_aws__N12_cryptography__N15_dbEncryptionSdk__N8_dynamoDb__S33_EncryptedDataKeyDescriptionOutput (software.amazon.cryptography.dbencryptionsdk.dynamodb.internaldafny.types._IEncryptedDataKeyDescriptionOutput value) { + software.amazon.cryptography.dbencryptionsdk.dynamodb.internaldafny.types.EncryptedDataKeyDescriptionOutput concrete = (software.amazon.cryptography.dbencryptionsdk.dynamodb.internaldafny.types.EncryptedDataKeyDescriptionOutput)value; AWS.Cryptography.DbEncryptionSDK.DynamoDb.EncryptedDataKeyDescriptionOutput converted = new AWS.Cryptography.DbEncryptionSDK.DynamoDb.EncryptedDataKeyDescriptionOutput(); converted.KeyProviderId = (string) FromDafny_N3_aws__N12_cryptography__N15_dbEncryptionSdk__N8_dynamoDb__S33_EncryptedDataKeyDescriptionOutput__M13_keyProviderId(concrete._keyProviderId); + if (concrete._keyProviderInfo.is_Some) converted.KeyProviderInfo = (string) FromDafny_N3_aws__N12_cryptography__N15_dbEncryptionSdk__N8_dynamoDb__S33_EncryptedDataKeyDescriptionOutput__M15_keyProviderInfo(concrete._keyProviderInfo); + if (concrete._branchKeyId.is_Some) converted.BranchKeyId = (string) FromDafny_N3_aws__N12_cryptography__N15_dbEncryptionSdk__N8_dynamoDb__S33_EncryptedDataKeyDescriptionOutput__M11_branchKeyId(concrete._branchKeyId); + if (concrete._branchKeyVersion.is_Some) converted.BranchKeyVersion = (string) FromDafny_N3_aws__N12_cryptography__N15_dbEncryptionSdk__N8_dynamoDb__S33_EncryptedDataKeyDescriptionOutput__M16_branchKeyVersion(concrete._branchKeyVersion); return converted; +} + public static software.amazon.cryptography.dbencryptionsdk.dynamodb.internaldafny.types._IEncryptedDataKeyDescriptionOutput ToDafny_N3_aws__N12_cryptography__N15_dbEncryptionSdk__N8_dynamoDb__S33_EncryptedDataKeyDescriptionOutput (AWS.Cryptography.DbEncryptionSDK.DynamoDb.EncryptedDataKeyDescriptionOutput value) { + string var_keyProviderInfo = value.IsSetKeyProviderInfo() ? value.KeyProviderInfo : (string) null; + string var_branchKeyId = value.IsSetBranchKeyId() ? value.BranchKeyId : (string) null; + string var_branchKeyVersion = value.IsSetBranchKeyVersion() ? value.BranchKeyVersion : (string) null; + return new software.amazon.cryptography.dbencryptionsdk.dynamodb.internaldafny.types.EncryptedDataKeyDescriptionOutput ( ToDafny_N3_aws__N12_cryptography__N15_dbEncryptionSdk__N8_dynamoDb__S33_EncryptedDataKeyDescriptionOutput__M13_keyProviderId(value.KeyProviderId) , ToDafny_N3_aws__N12_cryptography__N15_dbEncryptionSdk__N8_dynamoDb__S33_EncryptedDataKeyDescriptionOutput__M15_keyProviderInfo(var_keyProviderInfo) , ToDafny_N3_aws__N12_cryptography__N15_dbEncryptionSdk__N8_dynamoDb__S33_EncryptedDataKeyDescriptionOutput__M11_branchKeyId(var_branchKeyId) , ToDafny_N3_aws__N12_cryptography__N15_dbEncryptionSdk__N8_dynamoDb__S33_EncryptedDataKeyDescriptionOutput__M16_branchKeyVersion(var_branchKeyVersion) ) ; +} + public static string FromDafny_N3_aws__N12_cryptography__N15_dbEncryptionSdk__N8_dynamoDb__S4_Char (Dafny.ISequence value) { + return new string(value.Elements); +} + public static Dafny.ISequence ToDafny_N3_aws__N12_cryptography__N15_dbEncryptionSdk__N8_dynamoDb__S4_Char (string value) { + return Dafny.Sequence.FromString(value); +} + public static AWS.Cryptography.MaterialProviders.DefaultCache FromDafny_N3_aws__N12_cryptography__N17_materialProviders__S9_CacheType__M7_Default (software.amazon.cryptography.materialproviders.internaldafny.types._IDefaultCache value) { + return FromDafny_N3_aws__N12_cryptography__N17_materialProviders__S12_DefaultCache(value); +} + public static software.amazon.cryptography.materialproviders.internaldafny.types._IDefaultCache ToDafny_N3_aws__N12_cryptography__N17_materialProviders__S9_CacheType__M7_Default (AWS.Cryptography.MaterialProviders.DefaultCache value) { + return ToDafny_N3_aws__N12_cryptography__N17_materialProviders__S12_DefaultCache(value); +} + public static AWS.Cryptography.MaterialProviders.NoCache FromDafny_N3_aws__N12_cryptography__N17_materialProviders__S9_CacheType__M2_No (software.amazon.cryptography.materialproviders.internaldafny.types._INoCache value) { + return FromDafny_N3_aws__N12_cryptography__N17_materialProviders__S7_NoCache(value); +} + public static software.amazon.cryptography.materialproviders.internaldafny.types._INoCache ToDafny_N3_aws__N12_cryptography__N17_materialProviders__S9_CacheType__M2_No (AWS.Cryptography.MaterialProviders.NoCache value) { + return ToDafny_N3_aws__N12_cryptography__N17_materialProviders__S7_NoCache(value); +} + public static AWS.Cryptography.MaterialProviders.SingleThreadedCache FromDafny_N3_aws__N12_cryptography__N17_materialProviders__S9_CacheType__M14_SingleThreaded (software.amazon.cryptography.materialproviders.internaldafny.types._ISingleThreadedCache value) { + return FromDafny_N3_aws__N12_cryptography__N17_materialProviders__S19_SingleThreadedCache(value); +} + public static software.amazon.cryptography.materialproviders.internaldafny.types._ISingleThreadedCache ToDafny_N3_aws__N12_cryptography__N17_materialProviders__S9_CacheType__M14_SingleThreaded (AWS.Cryptography.MaterialProviders.SingleThreadedCache value) { + return ToDafny_N3_aws__N12_cryptography__N17_materialProviders__S19_SingleThreadedCache(value); +} + public static AWS.Cryptography.MaterialProviders.MultiThreadedCache FromDafny_N3_aws__N12_cryptography__N17_materialProviders__S9_CacheType__M13_MultiThreaded (software.amazon.cryptography.materialproviders.internaldafny.types._IMultiThreadedCache value) { + return FromDafny_N3_aws__N12_cryptography__N17_materialProviders__S18_MultiThreadedCache(value); +} + public static software.amazon.cryptography.materialproviders.internaldafny.types._IMultiThreadedCache ToDafny_N3_aws__N12_cryptography__N17_materialProviders__S9_CacheType__M13_MultiThreaded (AWS.Cryptography.MaterialProviders.MultiThreadedCache value) { + return ToDafny_N3_aws__N12_cryptography__N17_materialProviders__S18_MultiThreadedCache(value); +} + public static AWS.Cryptography.MaterialProviders.StormTrackingCache FromDafny_N3_aws__N12_cryptography__N17_materialProviders__S9_CacheType__M13_StormTracking (software.amazon.cryptography.materialproviders.internaldafny.types._IStormTrackingCache value) { + return FromDafny_N3_aws__N12_cryptography__N17_materialProviders__S18_StormTrackingCache(value); +} + public static software.amazon.cryptography.materialproviders.internaldafny.types._IStormTrackingCache ToDafny_N3_aws__N12_cryptography__N17_materialProviders__S9_CacheType__M13_StormTracking (AWS.Cryptography.MaterialProviders.StormTrackingCache value) { + return ToDafny_N3_aws__N12_cryptography__N17_materialProviders__S18_StormTrackingCache(value); +} + public static string FromDafny_N3_com__N9_amazonaws__N8_dynamodb__S14_AttributeValue__M1_S (Dafny.ISequence value) { + return FromDafny_N3_com__N9_amazonaws__N8_dynamodb__S20_StringAttributeValue(value); +} + public static Dafny.ISequence ToDafny_N3_com__N9_amazonaws__N8_dynamodb__S14_AttributeValue__M1_S (string value) { + return ToDafny_N3_com__N9_amazonaws__N8_dynamodb__S20_StringAttributeValue(value); +} + public static string FromDafny_N3_com__N9_amazonaws__N8_dynamodb__S14_AttributeValue__M1_N (Dafny.ISequence value) { + return FromDafny_N3_com__N9_amazonaws__N8_dynamodb__S20_NumberAttributeValue(value); +} + public static Dafny.ISequence ToDafny_N3_com__N9_amazonaws__N8_dynamodb__S14_AttributeValue__M1_N (string value) { + return ToDafny_N3_com__N9_amazonaws__N8_dynamodb__S20_NumberAttributeValue(value); +} + public static System.IO.MemoryStream FromDafny_N3_com__N9_amazonaws__N8_dynamodb__S14_AttributeValue__M1_B (Dafny.ISequence value) { + return FromDafny_N3_com__N9_amazonaws__N8_dynamodb__S20_BinaryAttributeValue(value); +} + public static Dafny.ISequence ToDafny_N3_com__N9_amazonaws__N8_dynamodb__S14_AttributeValue__M1_B (System.IO.MemoryStream value) { + return ToDafny_N3_com__N9_amazonaws__N8_dynamodb__S20_BinaryAttributeValue(value); +} + public static System.Collections.Generic.List FromDafny_N3_com__N9_amazonaws__N8_dynamodb__S14_AttributeValue__M2_SS (Dafny.ISequence> value) { + return FromDafny_N3_com__N9_amazonaws__N8_dynamodb__S23_StringSetAttributeValue(value); +} + public static Dafny.ISequence> ToDafny_N3_com__N9_amazonaws__N8_dynamodb__S14_AttributeValue__M2_SS (System.Collections.Generic.List value) { + return ToDafny_N3_com__N9_amazonaws__N8_dynamodb__S23_StringSetAttributeValue(value); +} + public static System.Collections.Generic.List FromDafny_N3_com__N9_amazonaws__N8_dynamodb__S14_AttributeValue__M2_NS (Dafny.ISequence> value) { + return FromDafny_N3_com__N9_amazonaws__N8_dynamodb__S23_NumberSetAttributeValue(value); +} + public static Dafny.ISequence> ToDafny_N3_com__N9_amazonaws__N8_dynamodb__S14_AttributeValue__M2_NS (System.Collections.Generic.List value) { + return ToDafny_N3_com__N9_amazonaws__N8_dynamodb__S23_NumberSetAttributeValue(value); +} + public static System.Collections.Generic.List FromDafny_N3_com__N9_amazonaws__N8_dynamodb__S14_AttributeValue__M2_BS (Dafny.ISequence> value) { + return FromDafny_N3_com__N9_amazonaws__N8_dynamodb__S23_BinarySetAttributeValue(value); +} + public static Dafny.ISequence> ToDafny_N3_com__N9_amazonaws__N8_dynamodb__S14_AttributeValue__M2_BS (System.Collections.Generic.List value) { + return ToDafny_N3_com__N9_amazonaws__N8_dynamodb__S23_BinarySetAttributeValue(value); +} + public static System.Collections.Generic.Dictionary FromDafny_N3_com__N9_amazonaws__N8_dynamodb__S14_AttributeValue__M1_M (Dafny.IMap, software.amazon.cryptography.services.dynamodb.internaldafny.types._IAttributeValue> value) { + return FromDafny_N3_com__N9_amazonaws__N8_dynamodb__S17_MapAttributeValue(value); +} + public static Dafny.IMap, software.amazon.cryptography.services.dynamodb.internaldafny.types._IAttributeValue> ToDafny_N3_com__N9_amazonaws__N8_dynamodb__S14_AttributeValue__M1_M (System.Collections.Generic.Dictionary value) { + return ToDafny_N3_com__N9_amazonaws__N8_dynamodb__S17_MapAttributeValue(value); +} + public static System.Collections.Generic.List FromDafny_N3_com__N9_amazonaws__N8_dynamodb__S14_AttributeValue__M1_L (Dafny.ISequence value) { + return FromDafny_N3_com__N9_amazonaws__N8_dynamodb__S18_ListAttributeValue(value); +} + public static Dafny.ISequence ToDafny_N3_com__N9_amazonaws__N8_dynamodb__S14_AttributeValue__M1_L (System.Collections.Generic.List value) { + return ToDafny_N3_com__N9_amazonaws__N8_dynamodb__S18_ListAttributeValue(value); +} + public static bool FromDafny_N3_com__N9_amazonaws__N8_dynamodb__S14_AttributeValue__M4_NULL (bool value) { + return FromDafny_N3_com__N9_amazonaws__N8_dynamodb__S18_NullAttributeValue(value); +} + public static bool ToDafny_N3_com__N9_amazonaws__N8_dynamodb__S14_AttributeValue__M4_NULL (bool value) { + return ToDafny_N3_com__N9_amazonaws__N8_dynamodb__S18_NullAttributeValue(value); +} + public static bool FromDafny_N3_com__N9_amazonaws__N8_dynamodb__S14_AttributeValue__M4_BOOL (bool value) { + return FromDafny_N3_com__N9_amazonaws__N8_dynamodb__S21_BooleanAttributeValue(value); +} + public static bool ToDafny_N3_com__N9_amazonaws__N8_dynamodb__S14_AttributeValue__M4_BOOL (bool value) { + return ToDafny_N3_com__N9_amazonaws__N8_dynamodb__S21_BooleanAttributeValue(value); +} + public static string FromDafny_N3_aws__N12_cryptography__N15_dbEncryptionSdk__N8_dynamoDb__S33_EncryptedDataKeyDescriptionOutput__M13_keyProviderId (Dafny.ISequence value) { + return FromDafny_N6_smithy__N3_api__S6_String(value); +} + public static Dafny.ISequence ToDafny_N3_aws__N12_cryptography__N15_dbEncryptionSdk__N8_dynamoDb__S33_EncryptedDataKeyDescriptionOutput__M13_keyProviderId (string value) { + return ToDafny_N6_smithy__N3_api__S6_String(value); +} + public static string FromDafny_N3_aws__N12_cryptography__N15_dbEncryptionSdk__N8_dynamoDb__S33_EncryptedDataKeyDescriptionOutput__M15_keyProviderInfo (Wrappers_Compile._IOption> value) { + return value.is_None ? (string) null : FromDafny_N6_smithy__N3_api__S6_String(value.Extract()); +} + public static Wrappers_Compile._IOption> ToDafny_N3_aws__N12_cryptography__N15_dbEncryptionSdk__N8_dynamoDb__S33_EncryptedDataKeyDescriptionOutput__M15_keyProviderInfo (string value) { + return value == null ? Wrappers_Compile.Option>.create_None() : Wrappers_Compile.Option>.create_Some(ToDafny_N6_smithy__N3_api__S6_String((string) value)); +} + public static string FromDafny_N3_aws__N12_cryptography__N15_dbEncryptionSdk__N8_dynamoDb__S33_EncryptedDataKeyDescriptionOutput__M11_branchKeyId (Wrappers_Compile._IOption> value) { + return value.is_None ? (string) null : FromDafny_N6_smithy__N3_api__S6_String(value.Extract()); +} + public static Wrappers_Compile._IOption> ToDafny_N3_aws__N12_cryptography__N15_dbEncryptionSdk__N8_dynamoDb__S33_EncryptedDataKeyDescriptionOutput__M11_branchKeyId (string value) { + return value == null ? Wrappers_Compile.Option>.create_None() : Wrappers_Compile.Option>.create_Some(ToDafny_N6_smithy__N3_api__S6_String((string) value)); +} + public static string FromDafny_N3_aws__N12_cryptography__N15_dbEncryptionSdk__N8_dynamoDb__S33_EncryptedDataKeyDescriptionOutput__M16_branchKeyVersion (Wrappers_Compile._IOption> value) { + return value.is_None ? (string) null : FromDafny_N6_smithy__N3_api__S6_String(value.Extract()); +} + public static Wrappers_Compile._IOption> ToDafny_N3_aws__N12_cryptography__N15_dbEncryptionSdk__N8_dynamoDb__S33_EncryptedDataKeyDescriptionOutput__M16_branchKeyVersion (string value) { + return value == null ? Wrappers_Compile.Option>.create_None() : Wrappers_Compile.Option>.create_Some(ToDafny_N6_smithy__N3_api__S6_String((string) value)); +} + public static AWS.Cryptography.MaterialProviders.DefaultCache FromDafny_N3_aws__N12_cryptography__N17_materialProviders__S12_DefaultCache (software.amazon.cryptography.materialproviders.internaldafny.types._IDefaultCache value) { + software.amazon.cryptography.materialproviders.internaldafny.types.DefaultCache concrete = (software.amazon.cryptography.materialproviders.internaldafny.types.DefaultCache)value; AWS.Cryptography.MaterialProviders.DefaultCache converted = new AWS.Cryptography.MaterialProviders.DefaultCache(); converted.EntryCapacity = (int) FromDafny_N3_aws__N12_cryptography__N17_materialProviders__S12_DefaultCache__M13_entryCapacity(concrete._entryCapacity); return converted; +} + public static software.amazon.cryptography.materialproviders.internaldafny.types._IDefaultCache ToDafny_N3_aws__N12_cryptography__N17_materialProviders__S12_DefaultCache (AWS.Cryptography.MaterialProviders.DefaultCache value) { + + return new software.amazon.cryptography.materialproviders.internaldafny.types.DefaultCache ( ToDafny_N3_aws__N12_cryptography__N17_materialProviders__S12_DefaultCache__M13_entryCapacity(value.EntryCapacity) ) ; +} + public static AWS.Cryptography.MaterialProviders.NoCache FromDafny_N3_aws__N12_cryptography__N17_materialProviders__S7_NoCache (software.amazon.cryptography.materialproviders.internaldafny.types._INoCache value) { + software.amazon.cryptography.materialproviders.internaldafny.types.NoCache concrete = (software.amazon.cryptography.materialproviders.internaldafny.types.NoCache)value; AWS.Cryptography.MaterialProviders.NoCache converted = new AWS.Cryptography.MaterialProviders.NoCache(); return converted; +} + public static software.amazon.cryptography.materialproviders.internaldafny.types._INoCache ToDafny_N3_aws__N12_cryptography__N17_materialProviders__S7_NoCache (AWS.Cryptography.MaterialProviders.NoCache value) { + + return new software.amazon.cryptography.materialproviders.internaldafny.types.NoCache ( ) ; +} + public static AWS.Cryptography.MaterialProviders.SingleThreadedCache FromDafny_N3_aws__N12_cryptography__N17_materialProviders__S19_SingleThreadedCache (software.amazon.cryptography.materialproviders.internaldafny.types._ISingleThreadedCache value) { + software.amazon.cryptography.materialproviders.internaldafny.types.SingleThreadedCache concrete = (software.amazon.cryptography.materialproviders.internaldafny.types.SingleThreadedCache)value; AWS.Cryptography.MaterialProviders.SingleThreadedCache converted = new AWS.Cryptography.MaterialProviders.SingleThreadedCache(); converted.EntryCapacity = (int) FromDafny_N3_aws__N12_cryptography__N17_materialProviders__S19_SingleThreadedCache__M13_entryCapacity(concrete._entryCapacity); + if (concrete._entryPruningTailSize.is_Some) converted.EntryPruningTailSize = (int) FromDafny_N3_aws__N12_cryptography__N17_materialProviders__S19_SingleThreadedCache__M20_entryPruningTailSize(concrete._entryPruningTailSize); return converted; +} + public static software.amazon.cryptography.materialproviders.internaldafny.types._ISingleThreadedCache ToDafny_N3_aws__N12_cryptography__N17_materialProviders__S19_SingleThreadedCache (AWS.Cryptography.MaterialProviders.SingleThreadedCache value) { + int? var_entryPruningTailSize = value.IsSetEntryPruningTailSize() ? value.EntryPruningTailSize : (int?) null; + return new software.amazon.cryptography.materialproviders.internaldafny.types.SingleThreadedCache ( ToDafny_N3_aws__N12_cryptography__N17_materialProviders__S19_SingleThreadedCache__M13_entryCapacity(value.EntryCapacity) , ToDafny_N3_aws__N12_cryptography__N17_materialProviders__S19_SingleThreadedCache__M20_entryPruningTailSize(var_entryPruningTailSize) ) ; +} + public static AWS.Cryptography.MaterialProviders.MultiThreadedCache FromDafny_N3_aws__N12_cryptography__N17_materialProviders__S18_MultiThreadedCache (software.amazon.cryptography.materialproviders.internaldafny.types._IMultiThreadedCache value) { + software.amazon.cryptography.materialproviders.internaldafny.types.MultiThreadedCache concrete = (software.amazon.cryptography.materialproviders.internaldafny.types.MultiThreadedCache)value; AWS.Cryptography.MaterialProviders.MultiThreadedCache converted = new AWS.Cryptography.MaterialProviders.MultiThreadedCache(); converted.EntryCapacity = (int) FromDafny_N3_aws__N12_cryptography__N17_materialProviders__S18_MultiThreadedCache__M13_entryCapacity(concrete._entryCapacity); + if (concrete._entryPruningTailSize.is_Some) converted.EntryPruningTailSize = (int) FromDafny_N3_aws__N12_cryptography__N17_materialProviders__S18_MultiThreadedCache__M20_entryPruningTailSize(concrete._entryPruningTailSize); return converted; +} + public static software.amazon.cryptography.materialproviders.internaldafny.types._IMultiThreadedCache ToDafny_N3_aws__N12_cryptography__N17_materialProviders__S18_MultiThreadedCache (AWS.Cryptography.MaterialProviders.MultiThreadedCache value) { + int? var_entryPruningTailSize = value.IsSetEntryPruningTailSize() ? value.EntryPruningTailSize : (int?) null; + return new software.amazon.cryptography.materialproviders.internaldafny.types.MultiThreadedCache ( ToDafny_N3_aws__N12_cryptography__N17_materialProviders__S18_MultiThreadedCache__M13_entryCapacity(value.EntryCapacity) , ToDafny_N3_aws__N12_cryptography__N17_materialProviders__S18_MultiThreadedCache__M20_entryPruningTailSize(var_entryPruningTailSize) ) ; +} + public static AWS.Cryptography.MaterialProviders.StormTrackingCache FromDafny_N3_aws__N12_cryptography__N17_materialProviders__S18_StormTrackingCache (software.amazon.cryptography.materialproviders.internaldafny.types._IStormTrackingCache value) { + software.amazon.cryptography.materialproviders.internaldafny.types.StormTrackingCache concrete = (software.amazon.cryptography.materialproviders.internaldafny.types.StormTrackingCache)value; AWS.Cryptography.MaterialProviders.StormTrackingCache converted = new AWS.Cryptography.MaterialProviders.StormTrackingCache(); converted.EntryCapacity = (int) FromDafny_N3_aws__N12_cryptography__N17_materialProviders__S18_StormTrackingCache__M13_entryCapacity(concrete._entryCapacity); + if (concrete._entryPruningTailSize.is_Some) converted.EntryPruningTailSize = (int) FromDafny_N3_aws__N12_cryptography__N17_materialProviders__S18_StormTrackingCache__M20_entryPruningTailSize(concrete._entryPruningTailSize); + converted.GracePeriod = (int) FromDafny_N3_aws__N12_cryptography__N17_materialProviders__S18_StormTrackingCache__M11_gracePeriod(concrete._gracePeriod); + converted.GraceInterval = (int) FromDafny_N3_aws__N12_cryptography__N17_materialProviders__S18_StormTrackingCache__M13_graceInterval(concrete._graceInterval); + converted.FanOut = (int) FromDafny_N3_aws__N12_cryptography__N17_materialProviders__S18_StormTrackingCache__M6_fanOut(concrete._fanOut); + converted.InFlightTTL = (int) FromDafny_N3_aws__N12_cryptography__N17_materialProviders__S18_StormTrackingCache__M11_inFlightTTL(concrete._inFlightTTL); + converted.SleepMilli = (int) FromDafny_N3_aws__N12_cryptography__N17_materialProviders__S18_StormTrackingCache__M10_sleepMilli(concrete._sleepMilli); return converted; +} + public static software.amazon.cryptography.materialproviders.internaldafny.types._IStormTrackingCache ToDafny_N3_aws__N12_cryptography__N17_materialProviders__S18_StormTrackingCache (AWS.Cryptography.MaterialProviders.StormTrackingCache value) { + int? var_entryPruningTailSize = value.IsSetEntryPruningTailSize() ? value.EntryPruningTailSize : (int?) null; + return new software.amazon.cryptography.materialproviders.internaldafny.types.StormTrackingCache ( ToDafny_N3_aws__N12_cryptography__N17_materialProviders__S18_StormTrackingCache__M13_entryCapacity(value.EntryCapacity) , ToDafny_N3_aws__N12_cryptography__N17_materialProviders__S18_StormTrackingCache__M20_entryPruningTailSize(var_entryPruningTailSize) , ToDafny_N3_aws__N12_cryptography__N17_materialProviders__S18_StormTrackingCache__M11_gracePeriod(value.GracePeriod) , ToDafny_N3_aws__N12_cryptography__N17_materialProviders__S18_StormTrackingCache__M13_graceInterval(value.GraceInterval) , ToDafny_N3_aws__N12_cryptography__N17_materialProviders__S18_StormTrackingCache__M6_fanOut(value.FanOut) , ToDafny_N3_aws__N12_cryptography__N17_materialProviders__S18_StormTrackingCache__M11_inFlightTTL(value.InFlightTTL) , ToDafny_N3_aws__N12_cryptography__N17_materialProviders__S18_StormTrackingCache__M10_sleepMilli(value.SleepMilli) ) ; +} + public static string FromDafny_N3_com__N9_amazonaws__N8_dynamodb__S20_StringAttributeValue (Dafny.ISequence value) { + return new string(value.Elements); +} + public static Dafny.ISequence ToDafny_N3_com__N9_amazonaws__N8_dynamodb__S20_StringAttributeValue (string value) { + return Dafny.Sequence.FromString(value); +} + public static string FromDafny_N3_com__N9_amazonaws__N8_dynamodb__S20_NumberAttributeValue (Dafny.ISequence value) { + return new string(value.Elements); +} + public static Dafny.ISequence ToDafny_N3_com__N9_amazonaws__N8_dynamodb__S20_NumberAttributeValue (string value) { + return Dafny.Sequence.FromString(value); +} + public static System.IO.MemoryStream FromDafny_N3_com__N9_amazonaws__N8_dynamodb__S20_BinaryAttributeValue (Dafny.ISequence value) { + return new System.IO.MemoryStream(value.Elements); +} + public static Dafny.ISequence ToDafny_N3_com__N9_amazonaws__N8_dynamodb__S20_BinaryAttributeValue (System.IO.MemoryStream value) { + return Dafny.Sequence.FromArray(value.ToArray()); +} + public static System.Collections.Generic.List FromDafny_N3_com__N9_amazonaws__N8_dynamodb__S23_StringSetAttributeValue (Dafny.ISequence> value) { + return new System.Collections.Generic.List(value.Elements.Select(FromDafny_N3_com__N9_amazonaws__N8_dynamodb__S23_StringSetAttributeValue__M6_member)); +} + public static Dafny.ISequence> ToDafny_N3_com__N9_amazonaws__N8_dynamodb__S23_StringSetAttributeValue (System.Collections.Generic.List value) { + return Dafny.Sequence>.FromArray(value.Select(ToDafny_N3_com__N9_amazonaws__N8_dynamodb__S23_StringSetAttributeValue__M6_member).ToArray()); +} + public static System.Collections.Generic.List FromDafny_N3_com__N9_amazonaws__N8_dynamodb__S23_NumberSetAttributeValue (Dafny.ISequence> value) { + return new System.Collections.Generic.List(value.Elements.Select(FromDafny_N3_com__N9_amazonaws__N8_dynamodb__S23_NumberSetAttributeValue__M6_member)); +} + public static Dafny.ISequence> ToDafny_N3_com__N9_amazonaws__N8_dynamodb__S23_NumberSetAttributeValue (System.Collections.Generic.List value) { + return Dafny.Sequence>.FromArray(value.Select(ToDafny_N3_com__N9_amazonaws__N8_dynamodb__S23_NumberSetAttributeValue__M6_member).ToArray()); +} + public static System.Collections.Generic.List FromDafny_N3_com__N9_amazonaws__N8_dynamodb__S23_BinarySetAttributeValue (Dafny.ISequence> value) { + return new System.Collections.Generic.List(value.Elements.Select(FromDafny_N3_com__N9_amazonaws__N8_dynamodb__S23_BinarySetAttributeValue__M6_member)); +} + public static Dafny.ISequence> ToDafny_N3_com__N9_amazonaws__N8_dynamodb__S23_BinarySetAttributeValue (System.Collections.Generic.List value) { + return Dafny.Sequence>.FromArray(value.Select(ToDafny_N3_com__N9_amazonaws__N8_dynamodb__S23_BinarySetAttributeValue__M6_member).ToArray()); +} + public static System.Collections.Generic.Dictionary FromDafny_N3_com__N9_amazonaws__N8_dynamodb__S17_MapAttributeValue (Dafny.IMap, software.amazon.cryptography.services.dynamodb.internaldafny.types._IAttributeValue> value) { + return value.ItemEnumerable.ToDictionary(pair => FromDafny_N3_com__N9_amazonaws__N8_dynamodb__S17_MapAttributeValue__M3_key(pair.Car), pair => FromDafny_N3_com__N9_amazonaws__N8_dynamodb__S17_MapAttributeValue__M5_value(pair.Cdr)); +} + public static Dafny.IMap, software.amazon.cryptography.services.dynamodb.internaldafny.types._IAttributeValue> ToDafny_N3_com__N9_amazonaws__N8_dynamodb__S17_MapAttributeValue (System.Collections.Generic.Dictionary value) { + return Dafny.Map, software.amazon.cryptography.services.dynamodb.internaldafny.types._IAttributeValue>.FromCollection(value.Select(pair => + new Dafny.Pair, software.amazon.cryptography.services.dynamodb.internaldafny.types._IAttributeValue>(ToDafny_N3_com__N9_amazonaws__N8_dynamodb__S17_MapAttributeValue__M3_key(pair.Key), ToDafny_N3_com__N9_amazonaws__N8_dynamodb__S17_MapAttributeValue__M5_value(pair.Value)) +)); +} + public static System.Collections.Generic.List FromDafny_N3_com__N9_amazonaws__N8_dynamodb__S18_ListAttributeValue (Dafny.ISequence value) { + return new System.Collections.Generic.List(value.Elements.Select(FromDafny_N3_com__N9_amazonaws__N8_dynamodb__S18_ListAttributeValue__M6_member)); +} + public static Dafny.ISequence ToDafny_N3_com__N9_amazonaws__N8_dynamodb__S18_ListAttributeValue (System.Collections.Generic.List value) { + return Dafny.Sequence.FromArray(value.Select(ToDafny_N3_com__N9_amazonaws__N8_dynamodb__S18_ListAttributeValue__M6_member).ToArray()); +} + public static bool FromDafny_N3_com__N9_amazonaws__N8_dynamodb__S18_NullAttributeValue (bool value) { + return value; +} + public static bool ToDafny_N3_com__N9_amazonaws__N8_dynamodb__S18_NullAttributeValue (bool value) { + return value; +} + public static bool FromDafny_N3_com__N9_amazonaws__N8_dynamodb__S21_BooleanAttributeValue (bool value) { + return value; +} + public static bool ToDafny_N3_com__N9_amazonaws__N8_dynamodb__S21_BooleanAttributeValue (bool value) { + return value; +} + public static int FromDafny_N3_aws__N12_cryptography__N17_materialProviders__S12_DefaultCache__M13_entryCapacity (int value) { + return FromDafny_N3_aws__N12_cryptography__N17_materialProviders__S14_CountingNumber(value); +} + public static int ToDafny_N3_aws__N12_cryptography__N17_materialProviders__S12_DefaultCache__M13_entryCapacity (int value) { + return ToDafny_N3_aws__N12_cryptography__N17_materialProviders__S14_CountingNumber(value); +} + public static int FromDafny_N3_aws__N12_cryptography__N17_materialProviders__S19_SingleThreadedCache__M13_entryCapacity (int value) { + return FromDafny_N3_aws__N12_cryptography__N17_materialProviders__S14_CountingNumber(value); +} + public static int ToDafny_N3_aws__N12_cryptography__N17_materialProviders__S19_SingleThreadedCache__M13_entryCapacity (int value) { + return ToDafny_N3_aws__N12_cryptography__N17_materialProviders__S14_CountingNumber(value); +} + public static int? FromDafny_N3_aws__N12_cryptography__N17_materialProviders__S19_SingleThreadedCache__M20_entryPruningTailSize (Wrappers_Compile._IOption value) { + return value.is_None ? (int?) null : FromDafny_N3_aws__N12_cryptography__N17_materialProviders__S14_CountingNumber(value.Extract()); +} + public static Wrappers_Compile._IOption ToDafny_N3_aws__N12_cryptography__N17_materialProviders__S19_SingleThreadedCache__M20_entryPruningTailSize (int? value) { + return value == null ? Wrappers_Compile.Option.create_None() : Wrappers_Compile.Option.create_Some(ToDafny_N3_aws__N12_cryptography__N17_materialProviders__S14_CountingNumber((int) value)); +} + public static int FromDafny_N3_aws__N12_cryptography__N17_materialProviders__S18_MultiThreadedCache__M13_entryCapacity (int value) { + return FromDafny_N3_aws__N12_cryptography__N17_materialProviders__S14_CountingNumber(value); +} + public static int ToDafny_N3_aws__N12_cryptography__N17_materialProviders__S18_MultiThreadedCache__M13_entryCapacity (int value) { + return ToDafny_N3_aws__N12_cryptography__N17_materialProviders__S14_CountingNumber(value); +} + public static int? FromDafny_N3_aws__N12_cryptography__N17_materialProviders__S18_MultiThreadedCache__M20_entryPruningTailSize (Wrappers_Compile._IOption value) { + return value.is_None ? (int?) null : FromDafny_N3_aws__N12_cryptography__N17_materialProviders__S14_CountingNumber(value.Extract()); +} + public static Wrappers_Compile._IOption ToDafny_N3_aws__N12_cryptography__N17_materialProviders__S18_MultiThreadedCache__M20_entryPruningTailSize (int? value) { + return value == null ? Wrappers_Compile.Option.create_None() : Wrappers_Compile.Option.create_Some(ToDafny_N3_aws__N12_cryptography__N17_materialProviders__S14_CountingNumber((int) value)); +} + public static int FromDafny_N3_aws__N12_cryptography__N17_materialProviders__S18_StormTrackingCache__M13_entryCapacity (int value) { + return FromDafny_N3_aws__N12_cryptography__N17_materialProviders__S14_CountingNumber(value); +} + public static int ToDafny_N3_aws__N12_cryptography__N17_materialProviders__S18_StormTrackingCache__M13_entryCapacity (int value) { + return ToDafny_N3_aws__N12_cryptography__N17_materialProviders__S14_CountingNumber(value); +} + public static int? FromDafny_N3_aws__N12_cryptography__N17_materialProviders__S18_StormTrackingCache__M20_entryPruningTailSize (Wrappers_Compile._IOption value) { + return value.is_None ? (int?) null : FromDafny_N3_aws__N12_cryptography__N17_materialProviders__S14_CountingNumber(value.Extract()); +} + public static Wrappers_Compile._IOption ToDafny_N3_aws__N12_cryptography__N17_materialProviders__S18_StormTrackingCache__M20_entryPruningTailSize (int? value) { + return value == null ? Wrappers_Compile.Option.create_None() : Wrappers_Compile.Option.create_Some(ToDafny_N3_aws__N12_cryptography__N17_materialProviders__S14_CountingNumber((int) value)); +} + public static int FromDafny_N3_aws__N12_cryptography__N17_materialProviders__S18_StormTrackingCache__M11_gracePeriod (int value) { + return FromDafny_N3_aws__N12_cryptography__N17_materialProviders__S14_CountingNumber(value); +} + public static int ToDafny_N3_aws__N12_cryptography__N17_materialProviders__S18_StormTrackingCache__M11_gracePeriod (int value) { + return ToDafny_N3_aws__N12_cryptography__N17_materialProviders__S14_CountingNumber(value); +} + public static int FromDafny_N3_aws__N12_cryptography__N17_materialProviders__S18_StormTrackingCache__M13_graceInterval (int value) { + return FromDafny_N3_aws__N12_cryptography__N17_materialProviders__S14_CountingNumber(value); +} + public static int ToDafny_N3_aws__N12_cryptography__N17_materialProviders__S18_StormTrackingCache__M13_graceInterval (int value) { + return ToDafny_N3_aws__N12_cryptography__N17_materialProviders__S14_CountingNumber(value); +} + public static int FromDafny_N3_aws__N12_cryptography__N17_materialProviders__S18_StormTrackingCache__M6_fanOut (int value) { + return FromDafny_N3_aws__N12_cryptography__N17_materialProviders__S14_CountingNumber(value); +} + public static int ToDafny_N3_aws__N12_cryptography__N17_materialProviders__S18_StormTrackingCache__M6_fanOut (int value) { + return ToDafny_N3_aws__N12_cryptography__N17_materialProviders__S14_CountingNumber(value); +} + public static int FromDafny_N3_aws__N12_cryptography__N17_materialProviders__S18_StormTrackingCache__M11_inFlightTTL (int value) { + return FromDafny_N3_aws__N12_cryptography__N17_materialProviders__S14_CountingNumber(value); +} + public static int ToDafny_N3_aws__N12_cryptography__N17_materialProviders__S18_StormTrackingCache__M11_inFlightTTL (int value) { + return ToDafny_N3_aws__N12_cryptography__N17_materialProviders__S14_CountingNumber(value); +} + public static int FromDafny_N3_aws__N12_cryptography__N17_materialProviders__S18_StormTrackingCache__M10_sleepMilli (int value) { + return FromDafny_N3_aws__N12_cryptography__N17_materialProviders__S14_CountingNumber(value); +} + public static int ToDafny_N3_aws__N12_cryptography__N17_materialProviders__S18_StormTrackingCache__M10_sleepMilli (int value) { + return ToDafny_N3_aws__N12_cryptography__N17_materialProviders__S14_CountingNumber(value); +} + public static string FromDafny_N3_com__N9_amazonaws__N8_dynamodb__S23_StringSetAttributeValue__M6_member (Dafny.ISequence value) { + return FromDafny_N3_com__N9_amazonaws__N8_dynamodb__S20_StringAttributeValue(value); +} + public static Dafny.ISequence ToDafny_N3_com__N9_amazonaws__N8_dynamodb__S23_StringSetAttributeValue__M6_member (string value) { + return ToDafny_N3_com__N9_amazonaws__N8_dynamodb__S20_StringAttributeValue(value); +} + public static string FromDafny_N3_com__N9_amazonaws__N8_dynamodb__S23_NumberSetAttributeValue__M6_member (Dafny.ISequence value) { + return FromDafny_N3_com__N9_amazonaws__N8_dynamodb__S20_NumberAttributeValue(value); +} + public static Dafny.ISequence ToDafny_N3_com__N9_amazonaws__N8_dynamodb__S23_NumberSetAttributeValue__M6_member (string value) { + return ToDafny_N3_com__N9_amazonaws__N8_dynamodb__S20_NumberAttributeValue(value); +} + public static System.IO.MemoryStream FromDafny_N3_com__N9_amazonaws__N8_dynamodb__S23_BinarySetAttributeValue__M6_member (Dafny.ISequence value) { + return FromDafny_N3_com__N9_amazonaws__N8_dynamodb__S20_BinaryAttributeValue(value); +} + public static Dafny.ISequence ToDafny_N3_com__N9_amazonaws__N8_dynamodb__S23_BinarySetAttributeValue__M6_member (System.IO.MemoryStream value) { + return ToDafny_N3_com__N9_amazonaws__N8_dynamodb__S20_BinaryAttributeValue(value); +} + public static string FromDafny_N3_com__N9_amazonaws__N8_dynamodb__S17_MapAttributeValue__M3_key (Dafny.ISequence value) { + return FromDafny_N3_com__N9_amazonaws__N8_dynamodb__S13_AttributeName(value); +} + public static Dafny.ISequence ToDafny_N3_com__N9_amazonaws__N8_dynamodb__S17_MapAttributeValue__M3_key (string value) { + return ToDafny_N3_com__N9_amazonaws__N8_dynamodb__S13_AttributeName(value); +} + public static Amazon.DynamoDBv2.Model.AttributeValue FromDafny_N3_com__N9_amazonaws__N8_dynamodb__S17_MapAttributeValue__M5_value (software.amazon.cryptography.services.dynamodb.internaldafny.types._IAttributeValue value) { + return FromDafny_N3_com__N9_amazonaws__N8_dynamodb__S14_AttributeValue(value); +} + public static software.amazon.cryptography.services.dynamodb.internaldafny.types._IAttributeValue ToDafny_N3_com__N9_amazonaws__N8_dynamodb__S17_MapAttributeValue__M5_value (Amazon.DynamoDBv2.Model.AttributeValue value) { + return ToDafny_N3_com__N9_amazonaws__N8_dynamodb__S14_AttributeValue(value); +} + public static Amazon.DynamoDBv2.Model.AttributeValue FromDafny_N3_com__N9_amazonaws__N8_dynamodb__S18_ListAttributeValue__M6_member (software.amazon.cryptography.services.dynamodb.internaldafny.types._IAttributeValue value) { + return FromDafny_N3_com__N9_amazonaws__N8_dynamodb__S14_AttributeValue(value); +} + public static software.amazon.cryptography.services.dynamodb.internaldafny.types._IAttributeValue ToDafny_N3_com__N9_amazonaws__N8_dynamodb__S18_ListAttributeValue__M6_member (Amazon.DynamoDBv2.Model.AttributeValue value) { + return ToDafny_N3_com__N9_amazonaws__N8_dynamodb__S14_AttributeValue(value); +} + public static int FromDafny_N3_aws__N12_cryptography__N17_materialProviders__S14_CountingNumber (int value) { + return value; +} + public static int ToDafny_N3_aws__N12_cryptography__N17_materialProviders__S14_CountingNumber (int value) { + return value; +} + public static System.Exception FromDafny_CommonError(software.amazon.cryptography.dbencryptionsdk.dynamodb.internaldafny.types._IError value) { + switch(value) + { + case software.amazon.cryptography.dbencryptionsdk.dynamodb.internaldafny.types.Error_ComAmazonawsDynamodb dafnyVal: + return Com.Amazonaws.Dynamodb.TypeConversion.FromDafny_CommonError( + dafnyVal._ComAmazonawsDynamodb + ); + case software.amazon.cryptography.dbencryptionsdk.dynamodb.internaldafny.types.Error_AwsCryptographyDbEncryptionSdkStructuredEncryption dafnyVal: + return AWS.Cryptography.DbEncryptionSDK.StructuredEncryption.TypeConversion.FromDafny_CommonError( + dafnyVal._AwsCryptographyDbEncryptionSdkStructuredEncryption + ); + case software.amazon.cryptography.dbencryptionsdk.dynamodb.internaldafny.types.Error_AwsCryptographyMaterialProviders dafnyVal: + return AWS.Cryptography.MaterialProviders.TypeConversion.FromDafny_CommonError( + dafnyVal._AwsCryptographyMaterialProviders + ); + case software.amazon.cryptography.dbencryptionsdk.dynamodb.internaldafny.types.Error_AwsCryptographyPrimitives dafnyVal: + return AWS.Cryptography.Primitives.TypeConversion.FromDafny_CommonError( + dafnyVal._AwsCryptographyPrimitives + ); + case software.amazon.cryptography.dbencryptionsdk.dynamodb.internaldafny.types.Error_DynamoDbEncryptionException dafnyVal: +return FromDafny_N3_aws__N12_cryptography__N15_dbEncryptionSdk__N8_dynamoDb__S27_DynamoDbEncryptionException(dafnyVal); + case software.amazon.cryptography.dbencryptionsdk.dynamodb.internaldafny.types.Error_CollectionOfErrors dafnyVal: + return new CollectionOfErrors( + new System.Collections.Generic.List(dafnyVal.dtor_list.CloneAsArray() + .Select(x => TypeConversion.FromDafny_CommonError(x))), + new string(dafnyVal.dtor_message.Elements)); + case software.amazon.cryptography.dbencryptionsdk.dynamodb.internaldafny.types.Error_Opaque dafnyVal: + return new OpaqueError(dafnyVal._obj); + default: + // The switch MUST be complete for _IError, so `value` MUST NOT be an _IError. (How did you get here?) + return new OpaqueError(); +} +} + public static software.amazon.cryptography.dbencryptionsdk.dynamodb.internaldafny.types._IError ToDafny_CommonError(System.Exception value) { + + switch (value) + { + case AWS.Cryptography.DbEncryptionSDK.DynamoDb.DynamoDbEncryptionException exception: + return ToDafny_N3_aws__N12_cryptography__N15_dbEncryptionSdk__N8_dynamoDb__S27_DynamoDbEncryptionException(exception); + case CollectionOfErrors collectionOfErrors: + return new software.amazon.cryptography.dbencryptionsdk.dynamodb.internaldafny.types.Error_CollectionOfErrors( + Dafny.Sequence + .FromArray( + collectionOfErrors.list.Select + (x => TypeConversion.ToDafny_CommonError(x)) + .ToArray()), + Dafny.Sequence.FromString(collectionOfErrors.Message) + ); + // OpaqueError is redundant, but listed for completeness. + case OpaqueError exception: + return new software.amazon.cryptography.dbencryptionsdk.dynamodb.internaldafny.types.Error_Opaque(exception); + case System.Exception exception: + return new software.amazon.cryptography.dbencryptionsdk.dynamodb.internaldafny.types.Error_Opaque(exception); + default: + // The switch MUST be complete for System.Exception, so `value` MUST NOT be an System.Exception. (How did you get here?) + return new software.amazon.cryptography.dbencryptionsdk.dynamodb.internaldafny.types.Error_Opaque(value); +} +} +} +} diff --git a/TestVectors/runtimes/net/Generated/DDBEncryption/Upper.cs b/TestVectors/runtimes/net/Generated/DDBEncryption/Upper.cs new file mode 100644 index 000000000..fb0cf7c25 --- /dev/null +++ b/TestVectors/runtimes/net/Generated/DDBEncryption/Upper.cs @@ -0,0 +1,13 @@ +// Copyright Amazon.com Inc. or its affiliates. All Rights Reserved. +// SPDX-License-Identifier: Apache-2.0 +// Do not modify this file. This file is machine generated, and any changes to it will be overwritten. +using System; + using AWS.Cryptography.DbEncryptionSDK.DynamoDb; namespace AWS.Cryptography.DbEncryptionSDK.DynamoDb { + public class Upper { + + + public void Validate() { + +} +} +} diff --git a/TestVectors/runtimes/net/Generated/DDBEncryption/VirtualField.cs b/TestVectors/runtimes/net/Generated/DDBEncryption/VirtualField.cs new file mode 100644 index 000000000..4508620e1 --- /dev/null +++ b/TestVectors/runtimes/net/Generated/DDBEncryption/VirtualField.cs @@ -0,0 +1,29 @@ +// Copyright Amazon.com Inc. or its affiliates. All Rights Reserved. +// SPDX-License-Identifier: Apache-2.0 +// Do not modify this file. This file is machine generated, and any changes to it will be overwritten. +using System; + using AWS.Cryptography.DbEncryptionSDK.DynamoDb; namespace AWS.Cryptography.DbEncryptionSDK.DynamoDb { + public class VirtualField { + private string _name ; + private System.Collections.Generic.List _parts ; + public string Name { + get { return this._name; } + set { this._name = value; } +} + public bool IsSetName () { + return this._name != null; +} + public System.Collections.Generic.List Parts { + get { return this._parts; } + set { this._parts = value; } +} + public bool IsSetParts () { + return this._parts != null; +} + public void Validate() { + if (!IsSetName()) throw new System.ArgumentException("Missing value for required property 'Name'"); + if (!IsSetParts()) throw new System.ArgumentException("Missing value for required property 'Parts'"); + +} +} +} diff --git a/TestVectors/runtimes/net/Generated/DDBEncryption/VirtualPart.cs b/TestVectors/runtimes/net/Generated/DDBEncryption/VirtualPart.cs new file mode 100644 index 000000000..a9738268d --- /dev/null +++ b/TestVectors/runtimes/net/Generated/DDBEncryption/VirtualPart.cs @@ -0,0 +1,28 @@ +// Copyright Amazon.com Inc. or its affiliates. All Rights Reserved. +// SPDX-License-Identifier: Apache-2.0 +// Do not modify this file. This file is machine generated, and any changes to it will be overwritten. +using System; + using AWS.Cryptography.DbEncryptionSDK.DynamoDb; namespace AWS.Cryptography.DbEncryptionSDK.DynamoDb { + public class VirtualPart { + private string _loc ; + private System.Collections.Generic.List _trans ; + public string Loc { + get { return this._loc; } + set { this._loc = value; } +} + public bool IsSetLoc () { + return this._loc != null; +} + public System.Collections.Generic.List Trans { + get { return this._trans; } + set { this._trans = value; } +} + public bool IsSetTrans () { + return this._trans != null; +} + public void Validate() { + if (!IsSetLoc()) throw new System.ArgumentException("Missing value for required property 'Loc'"); + +} +} +} diff --git a/TestVectors/runtimes/net/Generated/DDBEncryption/VirtualTransform.cs b/TestVectors/runtimes/net/Generated/DDBEncryption/VirtualTransform.cs new file mode 100644 index 000000000..64313ce67 --- /dev/null +++ b/TestVectors/runtimes/net/Generated/DDBEncryption/VirtualTransform.cs @@ -0,0 +1,86 @@ +// Copyright Amazon.com Inc. or its affiliates. All Rights Reserved. +// SPDX-License-Identifier: Apache-2.0 +// Do not modify this file. This file is machine generated, and any changes to it will be overwritten. +using System; + using AWS.Cryptography.DbEncryptionSDK.DynamoDb; namespace AWS.Cryptography.DbEncryptionSDK.DynamoDb { + public class VirtualTransform { + private AWS.Cryptography.DbEncryptionSDK.DynamoDb.Upper _upper ; + private AWS.Cryptography.DbEncryptionSDK.DynamoDb.Lower _lower ; + private AWS.Cryptography.DbEncryptionSDK.DynamoDb.Insert _insert ; + private AWS.Cryptography.DbEncryptionSDK.DynamoDb.GetPrefix _prefix ; + private AWS.Cryptography.DbEncryptionSDK.DynamoDb.GetSuffix _suffix ; + private AWS.Cryptography.DbEncryptionSDK.DynamoDb.GetSubstring _substring ; + private AWS.Cryptography.DbEncryptionSDK.DynamoDb.GetSegment _segment ; + private AWS.Cryptography.DbEncryptionSDK.DynamoDb.GetSegments _segments ; + public AWS.Cryptography.DbEncryptionSDK.DynamoDb.Upper Upper { + get { return this._upper; } + set { this._upper = value; } +} + public bool IsSetUpper () { + return this._upper != null; +} + public AWS.Cryptography.DbEncryptionSDK.DynamoDb.Lower Lower { + get { return this._lower; } + set { this._lower = value; } +} + public bool IsSetLower () { + return this._lower != null; +} + public AWS.Cryptography.DbEncryptionSDK.DynamoDb.Insert Insert { + get { return this._insert; } + set { this._insert = value; } +} + public bool IsSetInsert () { + return this._insert != null; +} + public AWS.Cryptography.DbEncryptionSDK.DynamoDb.GetPrefix Prefix { + get { return this._prefix; } + set { this._prefix = value; } +} + public bool IsSetPrefix () { + return this._prefix != null; +} + public AWS.Cryptography.DbEncryptionSDK.DynamoDb.GetSuffix Suffix { + get { return this._suffix; } + set { this._suffix = value; } +} + public bool IsSetSuffix () { + return this._suffix != null; +} + public AWS.Cryptography.DbEncryptionSDK.DynamoDb.GetSubstring Substring { + get { return this._substring; } + set { this._substring = value; } +} + public bool IsSetSubstring () { + return this._substring != null; +} + public AWS.Cryptography.DbEncryptionSDK.DynamoDb.GetSegment Segment { + get { return this._segment; } + set { this._segment = value; } +} + public bool IsSetSegment () { + return this._segment != null; +} + public AWS.Cryptography.DbEncryptionSDK.DynamoDb.GetSegments Segments { + get { return this._segments; } + set { this._segments = value; } +} + public bool IsSetSegments () { + return this._segments != null; +} + public void Validate() { + var numberOfPropertiesSet = Convert.ToUInt16(IsSetUpper()) + + Convert.ToUInt16(IsSetLower()) + + Convert.ToUInt16(IsSetInsert()) + + Convert.ToUInt16(IsSetPrefix()) + + Convert.ToUInt16(IsSetSuffix()) + + Convert.ToUInt16(IsSetSubstring()) + + Convert.ToUInt16(IsSetSegment()) + + Convert.ToUInt16(IsSetSegments()) ; + if (numberOfPropertiesSet == 0) throw new System.ArgumentException("No union value set"); + + if (numberOfPropertiesSet > 1) throw new System.ArgumentException("Multiple union values set"); + +} +} +} From 0811022852da1662ca5c2c2761b32bba341b2a28 Mon Sep 17 00:00:00 2001 From: rishav-karanjit Date: Fri, 29 Mar 2024 11:27:37 -0700 Subject: [PATCH 32/67] Add smithy generated java --- ...yptographyDbEncryptionSdkDynamoDbTypes.dfy | 613 +++++++++++++++ .../dynamodb/DynamoDbEncryption.java | 99 +++ .../DynamoDbKeyBranchKeyIdSupplier.java | 85 +++ .../IDynamoDbKeyBranchKeyIdSupplier.java | 17 + .../dynamodb/ILegacyDynamoDbEncryptor.java | 7 + .../dynamodb/LegacyDynamoDbEncryptor.java | 47 ++ .../dbencryptionsdk/dynamodb/ToDafny.java | 703 ++++++++++++++++++ .../dbencryptionsdk/dynamodb/ToNative.java | 662 +++++++++++++++++ .../dbencryptionsdk/dynamodb/model/AsSet.java | 36 + .../dynamodb/model/BeaconKeySource.java | 122 +++ .../dynamodb/model/BeaconStyle.java | 192 +++++ .../dynamodb/model/BeaconVersion.java | 354 +++++++++ .../dynamodb/model/CollectionOfErrors.java | 139 ++++ .../dynamodb/model/CompoundBeacon.java | 235 ++++++ .../dynamodb/model/Constructor.java | 80 ++ .../dynamodb/model/ConstructorPart.java | 114 +++ ...oDbEncryptionBranchKeyIdSupplierInput.java | 79 ++ ...DbEncryptionBranchKeyIdSupplierOutput.java | 78 ++ .../model/DynamoDbEncryptionConfig.java | 33 + .../model/DynamoDbEncryptionException.java | 107 +++ .../model/DynamoDbTableEncryptionConfig.java | 490 ++++++++++++ .../model/DynamoDbTablesEncryptionConfig.java | 79 ++ .../EncryptedDataKeyDescriptionOutput.java | 130 ++++ .../dynamodb/model/EncryptedPart.java | 117 +++ .../model/GetBranchKeyIdFromDdbKeyInput.java | 78 ++ .../model/GetBranchKeyIdFromDdbKeyOutput.java | 76 ++ .../GetEncryptedDataKeyDescriptionInput.java | 61 ++ .../GetEncryptedDataKeyDescriptionOutput.java | 64 ++ .../GetEncryptedDataKeyDescriptionUnion.java | 101 +++ .../dynamodb/model/GetPrefix.java | 76 ++ .../dynamodb/model/GetSegment.java | 120 +++ .../dynamodb/model/GetSegments.java | 158 ++++ .../dynamodb/model/GetSubstring.java | 114 +++ .../dynamodb/model/GetSuffix.java | 76 ++ .../dynamodb/model/Insert.java | 76 ++ .../dynamodb/model/LegacyOverride.java | 191 +++++ .../dynamodb/model/LegacyPolicy.java | 22 + .../dbencryptionsdk/dynamodb/model/Lower.java | 36 + .../dynamodb/model/MultiKeyStore.java | 150 ++++ .../dynamodb/model/OpaqueError.java | 142 ++++ .../dynamodb/model/PartOnly.java | 36 + .../dynamodb/model/PlaintextOverride.java | 22 + .../dynamodb/model/SearchConfig.java | 128 ++++ .../dynamodb/model/Shared.java | 76 ++ .../dynamodb/model/SharedSet.java | 76 ++ .../dynamodb/model/SignedPart.java | 155 ++++ .../dynamodb/model/SingleKeyStore.java | 114 +++ .../dynamodb/model/StandardBeacon.java | 197 +++++ .../dbencryptionsdk/dynamodb/model/Upper.java | 36 + .../dynamodb/model/VirtualField.java | 118 +++ .../dynamodb/model/VirtualPart.java | 118 +++ .../dynamodb/model/VirtualTransform.java | 332 +++++++++ 52 files changed, 7567 insertions(+) create mode 100644 TestVectors/dafny/DDBEncryption/Model/AwsCryptographyDbEncryptionSdkDynamoDbTypes.dfy create mode 100644 TestVectors/runtimes/java/src/main/smithy-generated/software/amazon/cryptography/dbencryptionsdk/dynamodb/DynamoDbEncryption.java create mode 100644 TestVectors/runtimes/java/src/main/smithy-generated/software/amazon/cryptography/dbencryptionsdk/dynamodb/DynamoDbKeyBranchKeyIdSupplier.java create mode 100644 TestVectors/runtimes/java/src/main/smithy-generated/software/amazon/cryptography/dbencryptionsdk/dynamodb/IDynamoDbKeyBranchKeyIdSupplier.java create mode 100644 TestVectors/runtimes/java/src/main/smithy-generated/software/amazon/cryptography/dbencryptionsdk/dynamodb/ILegacyDynamoDbEncryptor.java create mode 100644 TestVectors/runtimes/java/src/main/smithy-generated/software/amazon/cryptography/dbencryptionsdk/dynamodb/LegacyDynamoDbEncryptor.java create mode 100644 TestVectors/runtimes/java/src/main/smithy-generated/software/amazon/cryptography/dbencryptionsdk/dynamodb/ToDafny.java create mode 100644 TestVectors/runtimes/java/src/main/smithy-generated/software/amazon/cryptography/dbencryptionsdk/dynamodb/ToNative.java create mode 100644 TestVectors/runtimes/java/src/main/smithy-generated/software/amazon/cryptography/dbencryptionsdk/dynamodb/model/AsSet.java create mode 100644 TestVectors/runtimes/java/src/main/smithy-generated/software/amazon/cryptography/dbencryptionsdk/dynamodb/model/BeaconKeySource.java create mode 100644 TestVectors/runtimes/java/src/main/smithy-generated/software/amazon/cryptography/dbencryptionsdk/dynamodb/model/BeaconStyle.java create mode 100644 TestVectors/runtimes/java/src/main/smithy-generated/software/amazon/cryptography/dbencryptionsdk/dynamodb/model/BeaconVersion.java create mode 100644 TestVectors/runtimes/java/src/main/smithy-generated/software/amazon/cryptography/dbencryptionsdk/dynamodb/model/CollectionOfErrors.java create mode 100644 TestVectors/runtimes/java/src/main/smithy-generated/software/amazon/cryptography/dbencryptionsdk/dynamodb/model/CompoundBeacon.java create mode 100644 TestVectors/runtimes/java/src/main/smithy-generated/software/amazon/cryptography/dbencryptionsdk/dynamodb/model/Constructor.java create mode 100644 TestVectors/runtimes/java/src/main/smithy-generated/software/amazon/cryptography/dbencryptionsdk/dynamodb/model/ConstructorPart.java create mode 100644 TestVectors/runtimes/java/src/main/smithy-generated/software/amazon/cryptography/dbencryptionsdk/dynamodb/model/CreateDynamoDbEncryptionBranchKeyIdSupplierInput.java create mode 100644 TestVectors/runtimes/java/src/main/smithy-generated/software/amazon/cryptography/dbencryptionsdk/dynamodb/model/CreateDynamoDbEncryptionBranchKeyIdSupplierOutput.java create mode 100644 TestVectors/runtimes/java/src/main/smithy-generated/software/amazon/cryptography/dbencryptionsdk/dynamodb/model/DynamoDbEncryptionConfig.java create mode 100644 TestVectors/runtimes/java/src/main/smithy-generated/software/amazon/cryptography/dbencryptionsdk/dynamodb/model/DynamoDbEncryptionException.java create mode 100644 TestVectors/runtimes/java/src/main/smithy-generated/software/amazon/cryptography/dbencryptionsdk/dynamodb/model/DynamoDbTableEncryptionConfig.java create mode 100644 TestVectors/runtimes/java/src/main/smithy-generated/software/amazon/cryptography/dbencryptionsdk/dynamodb/model/DynamoDbTablesEncryptionConfig.java create mode 100644 TestVectors/runtimes/java/src/main/smithy-generated/software/amazon/cryptography/dbencryptionsdk/dynamodb/model/EncryptedDataKeyDescriptionOutput.java create mode 100644 TestVectors/runtimes/java/src/main/smithy-generated/software/amazon/cryptography/dbencryptionsdk/dynamodb/model/EncryptedPart.java create mode 100644 TestVectors/runtimes/java/src/main/smithy-generated/software/amazon/cryptography/dbencryptionsdk/dynamodb/model/GetBranchKeyIdFromDdbKeyInput.java create mode 100644 TestVectors/runtimes/java/src/main/smithy-generated/software/amazon/cryptography/dbencryptionsdk/dynamodb/model/GetBranchKeyIdFromDdbKeyOutput.java create mode 100644 TestVectors/runtimes/java/src/main/smithy-generated/software/amazon/cryptography/dbencryptionsdk/dynamodb/model/GetEncryptedDataKeyDescriptionInput.java create mode 100644 TestVectors/runtimes/java/src/main/smithy-generated/software/amazon/cryptography/dbencryptionsdk/dynamodb/model/GetEncryptedDataKeyDescriptionOutput.java create mode 100644 TestVectors/runtimes/java/src/main/smithy-generated/software/amazon/cryptography/dbencryptionsdk/dynamodb/model/GetEncryptedDataKeyDescriptionUnion.java create mode 100644 TestVectors/runtimes/java/src/main/smithy-generated/software/amazon/cryptography/dbencryptionsdk/dynamodb/model/GetPrefix.java create mode 100644 TestVectors/runtimes/java/src/main/smithy-generated/software/amazon/cryptography/dbencryptionsdk/dynamodb/model/GetSegment.java create mode 100644 TestVectors/runtimes/java/src/main/smithy-generated/software/amazon/cryptography/dbencryptionsdk/dynamodb/model/GetSegments.java create mode 100644 TestVectors/runtimes/java/src/main/smithy-generated/software/amazon/cryptography/dbencryptionsdk/dynamodb/model/GetSubstring.java create mode 100644 TestVectors/runtimes/java/src/main/smithy-generated/software/amazon/cryptography/dbencryptionsdk/dynamodb/model/GetSuffix.java create mode 100644 TestVectors/runtimes/java/src/main/smithy-generated/software/amazon/cryptography/dbencryptionsdk/dynamodb/model/Insert.java create mode 100644 TestVectors/runtimes/java/src/main/smithy-generated/software/amazon/cryptography/dbencryptionsdk/dynamodb/model/LegacyOverride.java create mode 100644 TestVectors/runtimes/java/src/main/smithy-generated/software/amazon/cryptography/dbencryptionsdk/dynamodb/model/LegacyPolicy.java create mode 100644 TestVectors/runtimes/java/src/main/smithy-generated/software/amazon/cryptography/dbencryptionsdk/dynamodb/model/Lower.java create mode 100644 TestVectors/runtimes/java/src/main/smithy-generated/software/amazon/cryptography/dbencryptionsdk/dynamodb/model/MultiKeyStore.java create mode 100644 TestVectors/runtimes/java/src/main/smithy-generated/software/amazon/cryptography/dbencryptionsdk/dynamodb/model/OpaqueError.java create mode 100644 TestVectors/runtimes/java/src/main/smithy-generated/software/amazon/cryptography/dbencryptionsdk/dynamodb/model/PartOnly.java create mode 100644 TestVectors/runtimes/java/src/main/smithy-generated/software/amazon/cryptography/dbencryptionsdk/dynamodb/model/PlaintextOverride.java create mode 100644 TestVectors/runtimes/java/src/main/smithy-generated/software/amazon/cryptography/dbencryptionsdk/dynamodb/model/SearchConfig.java create mode 100644 TestVectors/runtimes/java/src/main/smithy-generated/software/amazon/cryptography/dbencryptionsdk/dynamodb/model/Shared.java create mode 100644 TestVectors/runtimes/java/src/main/smithy-generated/software/amazon/cryptography/dbencryptionsdk/dynamodb/model/SharedSet.java create mode 100644 TestVectors/runtimes/java/src/main/smithy-generated/software/amazon/cryptography/dbencryptionsdk/dynamodb/model/SignedPart.java create mode 100644 TestVectors/runtimes/java/src/main/smithy-generated/software/amazon/cryptography/dbencryptionsdk/dynamodb/model/SingleKeyStore.java create mode 100644 TestVectors/runtimes/java/src/main/smithy-generated/software/amazon/cryptography/dbencryptionsdk/dynamodb/model/StandardBeacon.java create mode 100644 TestVectors/runtimes/java/src/main/smithy-generated/software/amazon/cryptography/dbencryptionsdk/dynamodb/model/Upper.java create mode 100644 TestVectors/runtimes/java/src/main/smithy-generated/software/amazon/cryptography/dbencryptionsdk/dynamodb/model/VirtualField.java create mode 100644 TestVectors/runtimes/java/src/main/smithy-generated/software/amazon/cryptography/dbencryptionsdk/dynamodb/model/VirtualPart.java create mode 100644 TestVectors/runtimes/java/src/main/smithy-generated/software/amazon/cryptography/dbencryptionsdk/dynamodb/model/VirtualTransform.java diff --git a/TestVectors/dafny/DDBEncryption/Model/AwsCryptographyDbEncryptionSdkDynamoDbTypes.dfy b/TestVectors/dafny/DDBEncryption/Model/AwsCryptographyDbEncryptionSdkDynamoDbTypes.dfy new file mode 100644 index 000000000..509a539f5 --- /dev/null +++ b/TestVectors/dafny/DDBEncryption/Model/AwsCryptographyDbEncryptionSdkDynamoDbTypes.dfy @@ -0,0 +1,613 @@ +// Copyright Amazon.com Inc. or its affiliates. All Rights Reserved. +// SPDX-License-Identifier: Apache-2.0 +// Do not modify this file. This file is machine generated, and any changes to it will be overwritten. +include "../../../../submodules/MaterialProviders/StandardLibrary/src/Index.dfy" + include "../../../../DynamoDbEncryption/dafny/StructuredEncryption/src/Index.dfy" + include "../../../../submodules/MaterialProviders/AwsCryptographicMaterialProviders/dafny/AwsCryptographicMaterialProviders/src/Index.dfy" + include "../../../../submodules/MaterialProviders/AwsCryptographicMaterialProviders/dafny/AwsCryptographyKeyStore/src/Index.dfy" + include "../../../../submodules/MaterialProviders/AwsCryptographyPrimitives/src/Index.dfy" + include "../../../../submodules/MaterialProviders/ComAmazonawsDynamodb/src/Index.dfy" + module {:extern "software.amazon.cryptography.dbencryptionsdk.dynamodb.internaldafny.types" } AwsCryptographyDbEncryptionSdkDynamoDbTypes + { + import opened Wrappers + import opened StandardLibrary.UInt + import opened UTF8 + import AwsCryptographyDbEncryptionSdkStructuredEncryptionTypes + import AwsCryptographyMaterialProvidersTypes + import AwsCryptographyKeyStoreTypes + import AwsCryptographyPrimitivesTypes + import ComAmazonawsDynamodbTypes + // Generic helpers for verification of mock/unit tests. + datatype DafnyCallEvent = DafnyCallEvent(input: I, output: O) + + // Begin Generated Types + + datatype AsSet = | AsSet ( + + ) + type AttributeActions = map + type BeaconBitLength = x: int32 | IsValid_BeaconBitLength(x) witness * + predicate method IsValid_BeaconBitLength(x: int32) { + ( 1 <= x <= 63 ) +} + datatype BeaconKeySource = + | single(single: SingleKeyStore) + | multi(multi: MultiKeyStore) + datatype BeaconStyle = + | partOnly(partOnly: PartOnly) + | shared(shared: Shared) + | asSet(asSet: AsSet) + | sharedSet(sharedSet: SharedSet) + datatype BeaconVersion = | BeaconVersion ( + nameonly version: VersionNumber , + nameonly keyStore: AwsCryptographyKeyStoreTypes.IKeyStoreClient , + nameonly keySource: BeaconKeySource , + nameonly standardBeacons: StandardBeaconList , + nameonly compoundBeacons: Option := Option.None , + nameonly virtualFields: Option := Option.None , + nameonly encryptedParts: Option := Option.None , + nameonly signedParts: Option := Option.None + ) + type BeaconVersionList = x: seq | IsValid_BeaconVersionList(x) witness * + predicate method IsValid_BeaconVersionList(x: seq) { + ( 1 <= |x| <= 1 ) +} + type Char = x: string | IsValid_Char(x) witness * + predicate method IsValid_Char(x: string) { + ( 1 <= |x| <= 1 ) +} + datatype CompoundBeacon = | CompoundBeacon ( + nameonly name: string , + nameonly split: Char , + nameonly encrypted: Option := Option.None , + nameonly signed: Option := Option.None , + nameonly constructors: Option := Option.None + ) + type CompoundBeaconList = x: seq | IsValid_CompoundBeaconList(x) witness * + predicate method IsValid_CompoundBeaconList(x: seq) { + ( 1 <= |x| ) +} + datatype Constructor = | Constructor ( + nameonly parts: ConstructorPartList + ) + type ConstructorList = x: seq | IsValid_ConstructorList(x) witness * + predicate method IsValid_ConstructorList(x: seq) { + ( 1 <= |x| ) +} + datatype ConstructorPart = | ConstructorPart ( + nameonly name: string , + nameonly required: bool + ) + type ConstructorPartList = x: seq | IsValid_ConstructorPartList(x) witness * + predicate method IsValid_ConstructorPartList(x: seq) { + ( 1 <= |x| ) +} + datatype CreateDynamoDbEncryptionBranchKeyIdSupplierInput = | CreateDynamoDbEncryptionBranchKeyIdSupplierInput ( + nameonly ddbKeyBranchKeyIdSupplier: IDynamoDbKeyBranchKeyIdSupplier + ) + datatype CreateDynamoDbEncryptionBranchKeyIdSupplierOutput = | CreateDynamoDbEncryptionBranchKeyIdSupplierOutput ( + nameonly branchKeyIdSupplier: AwsCryptographyMaterialProvidersTypes.IBranchKeyIdSupplier + ) + class IDynamoDbEncryptionClientCallHistory { + ghost constructor() { + CreateDynamoDbEncryptionBranchKeyIdSupplier := []; + GetEncryptedDataKeyDescription := []; +} + ghost var CreateDynamoDbEncryptionBranchKeyIdSupplier: seq>> + ghost var GetEncryptedDataKeyDescription: seq>> +} + trait {:termination false} IDynamoDbEncryptionClient + { + // Helper to define any additional modifies/reads clauses. + // If your operations need to mutate state, + // add it in your constructor function: + // Modifies := {your, fields, here, History}; + // If you do not need to mutate anything: +// Modifies := {History}; + + ghost const Modifies: set + // For an unassigned field defined in a trait, + // Dafny can only assign a value in the constructor. + // This means that for Dafny to reason about this value, + // it needs some way to know (an invariant), + // about the state of the object. + // This builds on the Valid/Repr paradigm + // To make this kind requires safe to add + // to methods called from unverified code, + // the predicate MUST NOT take any arguments. + // This means that the correctness of this requires + // MUST only be evaluated by the class itself. + // If you require any additional mutation, + // then you MUST ensure everything you need in ValidState. + // You MUST also ensure ValidState in your constructor. + predicate ValidState() + ensures ValidState() ==> History in Modifies + ghost const History: IDynamoDbEncryptionClientCallHistory + predicate CreateDynamoDbEncryptionBranchKeyIdSupplierEnsuresPublicly(input: CreateDynamoDbEncryptionBranchKeyIdSupplierInput , output: Result) + // The public method to be called by library consumers + method CreateDynamoDbEncryptionBranchKeyIdSupplier ( input: CreateDynamoDbEncryptionBranchKeyIdSupplierInput ) + returns (output: Result) + requires + && ValidState() + && input.ddbKeyBranchKeyIdSupplier.ValidState() + && input.ddbKeyBranchKeyIdSupplier.Modifies !! {History} + modifies Modifies - {History} , + input.ddbKeyBranchKeyIdSupplier.Modifies , + History`CreateDynamoDbEncryptionBranchKeyIdSupplier + // Dafny will skip type parameters when generating a default decreases clause. + decreases Modifies - {History} , + input.ddbKeyBranchKeyIdSupplier.Modifies + ensures + && ValidState() + && ( output.Success? ==> + && output.value.branchKeyIdSupplier.ValidState() + && output.value.branchKeyIdSupplier.Modifies !! {History} + && fresh(output.value.branchKeyIdSupplier) + && fresh ( output.value.branchKeyIdSupplier.Modifies - Modifies - {History} - input.ddbKeyBranchKeyIdSupplier.Modifies ) ) + ensures CreateDynamoDbEncryptionBranchKeyIdSupplierEnsuresPublicly(input, output) + ensures History.CreateDynamoDbEncryptionBranchKeyIdSupplier == old(History.CreateDynamoDbEncryptionBranchKeyIdSupplier) + [DafnyCallEvent(input, output)] + + predicate GetEncryptedDataKeyDescriptionEnsuresPublicly(input: GetEncryptedDataKeyDescriptionInput , output: Result) + // The public method to be called by library consumers + method GetEncryptedDataKeyDescription ( input: GetEncryptedDataKeyDescriptionInput ) + returns (output: Result) + requires + && ValidState() + modifies Modifies - {History} , + History`GetEncryptedDataKeyDescription + // Dafny will skip type parameters when generating a default decreases clause. + decreases Modifies - {History} + ensures + && ValidState() + ensures GetEncryptedDataKeyDescriptionEnsuresPublicly(input, output) + ensures History.GetEncryptedDataKeyDescription == old(History.GetEncryptedDataKeyDescription) + [DafnyCallEvent(input, output)] + +} + datatype DynamoDbEncryptionConfig = | DynamoDbEncryptionConfig ( + + ) + class IDynamoDbKeyBranchKeyIdSupplierCallHistory { + ghost constructor() { + GetBranchKeyIdFromDdbKey := []; +} + ghost var GetBranchKeyIdFromDdbKey: seq>> +} + trait {:termination false} IDynamoDbKeyBranchKeyIdSupplier + { + // Helper to define any additional modifies/reads clauses. + // If your operations need to mutate state, + // add it in your constructor function: + // Modifies := {your, fields, here, History}; + // If you do not need to mutate anything: +// Modifies := {History}; + + ghost const Modifies: set + // For an unassigned field defined in a trait, + // Dafny can only assign a value in the constructor. + // This means that for Dafny to reason about this value, + // it needs some way to know (an invariant), + // about the state of the object. + // This builds on the Valid/Repr paradigm + // To make this kind requires safe to add + // to methods called from unverified code, + // the predicate MUST NOT take any arguments. + // This means that the correctness of this requires + // MUST only be evaluated by the class itself. + // If you require any additional mutation, + // then you MUST ensure everything you need in ValidState. + // You MUST also ensure ValidState in your constructor. + predicate ValidState() + ensures ValidState() ==> History in Modifies + ghost const History: IDynamoDbKeyBranchKeyIdSupplierCallHistory + predicate GetBranchKeyIdFromDdbKeyEnsuresPublicly(input: GetBranchKeyIdFromDdbKeyInput , output: Result) + // The public method to be called by library consumers + method GetBranchKeyIdFromDdbKey ( input: GetBranchKeyIdFromDdbKeyInput ) + returns (output: Result) + requires + && ValidState() + modifies Modifies - {History} , + History`GetBranchKeyIdFromDdbKey + // Dafny will skip type parameters when generating a default decreases clause. + decreases Modifies - {History} + ensures + && ValidState() + ensures GetBranchKeyIdFromDdbKeyEnsuresPublicly(input, output) + ensures History.GetBranchKeyIdFromDdbKey == old(History.GetBranchKeyIdFromDdbKey) + [DafnyCallEvent(input, output)] + { + output := GetBranchKeyIdFromDdbKey' (input); + History.GetBranchKeyIdFromDdbKey := History.GetBranchKeyIdFromDdbKey + [DafnyCallEvent(input, output)]; +} + // The method to implement in the concrete class. + method GetBranchKeyIdFromDdbKey' ( input: GetBranchKeyIdFromDdbKeyInput ) + returns (output: Result) + requires + && ValidState() + modifies Modifies - {History} + // Dafny will skip type parameters when generating a default decreases clause. + decreases Modifies - {History} + ensures + && ValidState() + ensures GetBranchKeyIdFromDdbKeyEnsuresPublicly(input, output) + ensures unchanged(History) + +} + datatype DynamoDbTableEncryptionConfig = | DynamoDbTableEncryptionConfig ( + nameonly logicalTableName: string , + nameonly partitionKeyName: ComAmazonawsDynamodbTypes.KeySchemaAttributeName , + nameonly sortKeyName: Option := Option.None , + nameonly search: Option := Option.None , + nameonly attributeActionsOnEncrypt: AttributeActions , + nameonly allowedUnsignedAttributes: Option := Option.None , + nameonly allowedUnsignedAttributePrefix: Option := Option.None , + nameonly algorithmSuiteId: Option := Option.None , + nameonly keyring: Option := Option.None , + nameonly cmm: Option := Option.None , + nameonly legacyOverride: Option := Option.None , + nameonly plaintextOverride: Option := Option.None + ) + type DynamoDbTableEncryptionConfigList = map + datatype DynamoDbTablesEncryptionConfig = | DynamoDbTablesEncryptionConfig ( + nameonly tableEncryptionConfigs: DynamoDbTableEncryptionConfigList + ) + type EncryptedDataKeyDescriptionList = seq + datatype EncryptedDataKeyDescriptionOutput = | EncryptedDataKeyDescriptionOutput ( + nameonly keyProviderId: string , + nameonly keyProviderInfo: Option := Option.None , + nameonly branchKeyId: Option := Option.None , + nameonly branchKeyVersion: Option := Option.None + ) + datatype EncryptedPart = | EncryptedPart ( + nameonly name: string , + nameonly prefix: Prefix + ) + type EncryptedPartsList = x: seq | IsValid_EncryptedPartsList(x) witness * + predicate method IsValid_EncryptedPartsList(x: seq) { + ( 1 <= |x| ) +} + datatype GetBranchKeyIdFromDdbKeyInput = | GetBranchKeyIdFromDdbKeyInput ( + nameonly ddbKey: ComAmazonawsDynamodbTypes.Key + ) + datatype GetBranchKeyIdFromDdbKeyOutput = | GetBranchKeyIdFromDdbKeyOutput ( + nameonly branchKeyId: string + ) + datatype GetEncryptedDataKeyDescriptionInput = | GetEncryptedDataKeyDescriptionInput ( + nameonly input: GetEncryptedDataKeyDescriptionUnion + ) + datatype GetEncryptedDataKeyDescriptionOutput = | GetEncryptedDataKeyDescriptionOutput ( + nameonly EncryptedDataKeyDescriptionOutput: EncryptedDataKeyDescriptionList + ) + datatype GetEncryptedDataKeyDescriptionUnion = + | header(header: seq) + | plaintextItem(plaintextItem: ComAmazonawsDynamodbTypes.AttributeMap) + datatype GetPrefix = | GetPrefix ( + nameonly length: int32 + ) + datatype GetSegment = | GetSegment ( + nameonly split: Char , + nameonly index: int32 + ) + datatype GetSegments = | GetSegments ( + nameonly split: Char , + nameonly low: int32 , + nameonly high: int32 + ) + datatype GetSubstring = | GetSubstring ( + nameonly low: int32 , + nameonly high: int32 + ) + datatype GetSuffix = | GetSuffix ( + nameonly length: int32 + ) + datatype Insert = | Insert ( + nameonly literal: string + ) + class ILegacyDynamoDbEncryptorCallHistory { + ghost constructor() { + +} + +} + trait {:termination false} ILegacyDynamoDbEncryptor + { + // Helper to define any additional modifies/reads clauses. + // If your operations need to mutate state, + // add it in your constructor function: + // Modifies := {your, fields, here, History}; + // If you do not need to mutate anything: +// Modifies := {History}; + + ghost const Modifies: set + // For an unassigned field defined in a trait, + // Dafny can only assign a value in the constructor. + // This means that for Dafny to reason about this value, + // it needs some way to know (an invariant), + // about the state of the object. + // This builds on the Valid/Repr paradigm + // To make this kind requires safe to add + // to methods called from unverified code, + // the predicate MUST NOT take any arguments. + // This means that the correctness of this requires + // MUST only be evaluated by the class itself. + // If you require any additional mutation, + // then you MUST ensure everything you need in ValidState. + // You MUST also ensure ValidState in your constructor. + predicate ValidState() + ensures ValidState() ==> History in Modifies + ghost const History: ILegacyDynamoDbEncryptorCallHistory + +} + datatype LegacyOverride = | LegacyOverride ( + nameonly policy: LegacyPolicy , + nameonly encryptor: ILegacyDynamoDbEncryptor , + nameonly attributeActionsOnEncrypt: AttributeActions , + nameonly defaultAttributeFlag: Option := Option.None + ) + datatype LegacyPolicy = + | FORCE_LEGACY_ENCRYPT_ALLOW_LEGACY_DECRYPT + | FORBID_LEGACY_ENCRYPT_ALLOW_LEGACY_DECRYPT + | FORBID_LEGACY_ENCRYPT_FORBID_LEGACY_DECRYPT + datatype Lower = | Lower ( + + ) + datatype MultiKeyStore = | MultiKeyStore ( + nameonly keyFieldName: string , + nameonly cacheTTL: int32 , + nameonly cache: Option := Option.None + ) + datatype PartOnly = | PartOnly ( + + ) + datatype PlaintextOverride = + | FORCE_PLAINTEXT_WRITE_ALLOW_PLAINTEXT_READ + | FORBID_PLAINTEXT_WRITE_ALLOW_PLAINTEXT_READ + | FORBID_PLAINTEXT_WRITE_FORBID_PLAINTEXT_READ + type Prefix = x: string | IsValid_Prefix(x) witness * + predicate method IsValid_Prefix(x: string) { + ( 1 <= |x| ) +} + datatype SearchConfig = | SearchConfig ( + nameonly versions: BeaconVersionList , + nameonly writeVersion: VersionNumber + ) + datatype Shared = | Shared ( + nameonly other: string + ) + datatype SharedSet = | SharedSet ( + nameonly other: string + ) + datatype SignedPart = | SignedPart ( + nameonly name: string , + nameonly prefix: Prefix , + nameonly loc: Option := Option.None + ) + type SignedPartsList = x: seq | IsValid_SignedPartsList(x) witness * + predicate method IsValid_SignedPartsList(x: seq) { + ( 1 <= |x| ) +} + datatype SingleKeyStore = | SingleKeyStore ( + nameonly keyId: string , + nameonly cacheTTL: int32 + ) + datatype StandardBeacon = | StandardBeacon ( + nameonly name: string , + nameonly length: BeaconBitLength , + nameonly loc: Option := Option.None , + nameonly style: Option := Option.None + ) + type StandardBeaconList = x: seq | IsValid_StandardBeaconList(x) witness * + predicate method IsValid_StandardBeaconList(x: seq) { + ( 1 <= |x| ) +} + type TerminalLocation = x: string | IsValid_TerminalLocation(x) witness * + predicate method IsValid_TerminalLocation(x: string) { + ( 1 <= |x| ) +} + datatype Upper = | Upper ( + + ) + type VersionNumber = x: int32 | IsValid_VersionNumber(x) witness * + predicate method IsValid_VersionNumber(x: int32) { + ( 1 <= x ) +} + datatype VirtualField = | VirtualField ( + nameonly name: string , + nameonly parts: VirtualPartList + ) + type VirtualFieldList = x: seq | IsValid_VirtualFieldList(x) witness * + predicate method IsValid_VirtualFieldList(x: seq) { + ( 1 <= |x| ) +} + datatype VirtualPart = | VirtualPart ( + nameonly loc: TerminalLocation , + nameonly trans: Option := Option.None + ) + type VirtualPartList = x: seq | IsValid_VirtualPartList(x) witness * + predicate method IsValid_VirtualPartList(x: seq) { + ( 1 <= |x| ) +} + datatype VirtualTransform = + | upper(upper: Upper) + | lower(lower: Lower) + | insert(insert: Insert) + | prefix(prefix: GetPrefix) + | suffix(suffix: GetSuffix) + | substring(substring: GetSubstring) + | segment(segment: GetSegment) + | segments(segments: GetSegments) + type VirtualTransformList = x: seq | IsValid_VirtualTransformList(x) witness * + predicate method IsValid_VirtualTransformList(x: seq) { + ( 1 <= |x| ) +} + datatype Error = + // Local Error structures are listed here + | DynamoDbEncryptionException ( + nameonly message: string + ) + // Any dependent models are listed here + | AwsCryptographyDbEncryptionSdkStructuredEncryption(AwsCryptographyDbEncryptionSdkStructuredEncryption: AwsCryptographyDbEncryptionSdkStructuredEncryptionTypes.Error) + | AwsCryptographyMaterialProviders(AwsCryptographyMaterialProviders: AwsCryptographyMaterialProvidersTypes.Error) + | AwsCryptographyKeyStore(AwsCryptographyKeyStore: AwsCryptographyKeyStoreTypes.Error) + | AwsCryptographyPrimitives(AwsCryptographyPrimitives: AwsCryptographyPrimitivesTypes.Error) + | ComAmazonawsDynamodb(ComAmazonawsDynamodb: ComAmazonawsDynamodbTypes.Error) + // The Collection error is used to collect several errors together + // This is useful when composing OR logic. + // Consider the following method: + // + // method FN(n:I) + // returns (res: Result) + // ensures A(I).Success? ==> res.Success? + // ensures B(I).Success? ==> res.Success? + // ensures A(I).Failure? && B(I).Failure? ==> res.Failure? + // + // If either A || B is successful then FN is successful. + // And if A && B fail then FN will fail. + // But what information should FN transmit back to the caller? + // While it may be correct to hide these details from the caller, + // this can not be the globally correct option. + // Suppose that A and B can be blocked by different ACLs, + // and that their representation of I is only eventually consistent. + // How can the caller distinguish, at a minimum for logging, + // the difference between the four failure modes? + // || (!access(A(I)) && !access(B(I))) + // || (!exit(A(I)) && !exit(B(I))) + // || (!access(A(I)) && !exit(B(I))) + // || (!exit(A(I)) && !access(B(I))) + | CollectionOfErrors(list: seq, nameonly message: string) + // The Opaque error, used for native, extern, wrapped or unknown errors + | Opaque(obj: object) + type OpaqueError = e: Error | e.Opaque? witness * +} + abstract module AbstractAwsCryptographyDbEncryptionSdkDynamoDbService + { + import opened Wrappers + import opened StandardLibrary.UInt + import opened UTF8 + import opened Types = AwsCryptographyDbEncryptionSdkDynamoDbTypes + import Operations : AbstractAwsCryptographyDbEncryptionSdkDynamoDbOperations + function method DefaultDynamoDbEncryptionConfig(): DynamoDbEncryptionConfig + method DynamoDbEncryption(config: DynamoDbEncryptionConfig := DefaultDynamoDbEncryptionConfig()) + returns (res: Result) + ensures res.Success? ==> + && fresh(res.value) + && fresh(res.value.Modifies) + && fresh(res.value.History) + && res.value.ValidState() + + // Helper function for the benefit of native code to create a Success(client) without referring to Dafny internals + function method CreateSuccessOfClient(client: IDynamoDbEncryptionClient): Result { + Success(client) + } // Helper function for the benefit of native code to create a Failure(error) without referring to Dafny internals + function method CreateFailureOfError(error: Error): Result { + Failure(error) + } + class DynamoDbEncryptionClient extends IDynamoDbEncryptionClient + { + constructor(config: Operations.InternalConfig) + requires Operations.ValidInternalConfig?(config) + ensures + && ValidState() + && fresh(History) + && this.config == config + const config: Operations.InternalConfig + predicate ValidState() + ensures ValidState() ==> + && Operations.ValidInternalConfig?(config) + && History !in Operations.ModifiesInternalConfig(config) + && Modifies == Operations.ModifiesInternalConfig(config) + {History} + predicate CreateDynamoDbEncryptionBranchKeyIdSupplierEnsuresPublicly(input: CreateDynamoDbEncryptionBranchKeyIdSupplierInput , output: Result) + {Operations.CreateDynamoDbEncryptionBranchKeyIdSupplierEnsuresPublicly(input, output)} + // The public method to be called by library consumers + method CreateDynamoDbEncryptionBranchKeyIdSupplier ( input: CreateDynamoDbEncryptionBranchKeyIdSupplierInput ) + returns (output: Result) + requires + && ValidState() + && input.ddbKeyBranchKeyIdSupplier.ValidState() + && input.ddbKeyBranchKeyIdSupplier.Modifies !! {History} + modifies Modifies - {History} , + input.ddbKeyBranchKeyIdSupplier.Modifies , + History`CreateDynamoDbEncryptionBranchKeyIdSupplier + // Dafny will skip type parameters when generating a default decreases clause. + decreases Modifies - {History} , + input.ddbKeyBranchKeyIdSupplier.Modifies + ensures + && ValidState() + && ( output.Success? ==> + && output.value.branchKeyIdSupplier.ValidState() + && output.value.branchKeyIdSupplier.Modifies !! {History} + && fresh(output.value.branchKeyIdSupplier) + && fresh ( output.value.branchKeyIdSupplier.Modifies - Modifies - {History} - input.ddbKeyBranchKeyIdSupplier.Modifies ) ) + ensures CreateDynamoDbEncryptionBranchKeyIdSupplierEnsuresPublicly(input, output) + ensures History.CreateDynamoDbEncryptionBranchKeyIdSupplier == old(History.CreateDynamoDbEncryptionBranchKeyIdSupplier) + [DafnyCallEvent(input, output)] + { + output := Operations.CreateDynamoDbEncryptionBranchKeyIdSupplier(config, input); + History.CreateDynamoDbEncryptionBranchKeyIdSupplier := History.CreateDynamoDbEncryptionBranchKeyIdSupplier + [DafnyCallEvent(input, output)]; +} + + predicate GetEncryptedDataKeyDescriptionEnsuresPublicly(input: GetEncryptedDataKeyDescriptionInput , output: Result) + {Operations.GetEncryptedDataKeyDescriptionEnsuresPublicly(input, output)} + // The public method to be called by library consumers + method GetEncryptedDataKeyDescription ( input: GetEncryptedDataKeyDescriptionInput ) + returns (output: Result) + requires + && ValidState() + modifies Modifies - {History} , + History`GetEncryptedDataKeyDescription + // Dafny will skip type parameters when generating a default decreases clause. + decreases Modifies - {History} + ensures + && ValidState() + ensures GetEncryptedDataKeyDescriptionEnsuresPublicly(input, output) + ensures History.GetEncryptedDataKeyDescription == old(History.GetEncryptedDataKeyDescription) + [DafnyCallEvent(input, output)] + { + output := Operations.GetEncryptedDataKeyDescription(config, input); + History.GetEncryptedDataKeyDescription := History.GetEncryptedDataKeyDescription + [DafnyCallEvent(input, output)]; +} + +} +} + abstract module AbstractAwsCryptographyDbEncryptionSdkDynamoDbOperations { + import opened Wrappers + import opened StandardLibrary.UInt + import opened UTF8 + import opened Types = AwsCryptographyDbEncryptionSdkDynamoDbTypes + type InternalConfig + predicate ValidInternalConfig?(config: InternalConfig) + function ModifiesInternalConfig(config: InternalConfig): set + predicate CreateDynamoDbEncryptionBranchKeyIdSupplierEnsuresPublicly(input: CreateDynamoDbEncryptionBranchKeyIdSupplierInput , output: Result) + // The private method to be refined by the library developer + + + method CreateDynamoDbEncryptionBranchKeyIdSupplier ( config: InternalConfig , input: CreateDynamoDbEncryptionBranchKeyIdSupplierInput ) + returns (output: Result) + requires + && ValidInternalConfig?(config) + && input.ddbKeyBranchKeyIdSupplier.ValidState() + modifies ModifiesInternalConfig(config) , + input.ddbKeyBranchKeyIdSupplier.Modifies + // Dafny will skip type parameters when generating a default decreases clause. + decreases ModifiesInternalConfig(config) , + input.ddbKeyBranchKeyIdSupplier.Modifies + ensures + && ValidInternalConfig?(config) + && ( output.Success? ==> + && output.value.branchKeyIdSupplier.ValidState() + && fresh(output.value.branchKeyIdSupplier) + && fresh ( output.value.branchKeyIdSupplier.Modifies - ModifiesInternalConfig(config) - input.ddbKeyBranchKeyIdSupplier.Modifies ) ) + ensures CreateDynamoDbEncryptionBranchKeyIdSupplierEnsuresPublicly(input, output) + + + predicate GetEncryptedDataKeyDescriptionEnsuresPublicly(input: GetEncryptedDataKeyDescriptionInput , output: Result) + // The private method to be refined by the library developer + + + method GetEncryptedDataKeyDescription ( config: InternalConfig , input: GetEncryptedDataKeyDescriptionInput ) + returns (output: Result) + requires + && ValidInternalConfig?(config) + modifies ModifiesInternalConfig(config) + // Dafny will skip type parameters when generating a default decreases clause. + decreases ModifiesInternalConfig(config) + ensures + && ValidInternalConfig?(config) + ensures GetEncryptedDataKeyDescriptionEnsuresPublicly(input, output) +} diff --git a/TestVectors/runtimes/java/src/main/smithy-generated/software/amazon/cryptography/dbencryptionsdk/dynamodb/DynamoDbEncryption.java b/TestVectors/runtimes/java/src/main/smithy-generated/software/amazon/cryptography/dbencryptionsdk/dynamodb/DynamoDbEncryption.java new file mode 100644 index 000000000..a418aa268 --- /dev/null +++ b/TestVectors/runtimes/java/src/main/smithy-generated/software/amazon/cryptography/dbencryptionsdk/dynamodb/DynamoDbEncryption.java @@ -0,0 +1,99 @@ +// Copyright Amazon.com Inc. or its affiliates. All Rights Reserved. +// SPDX-License-Identifier: Apache-2.0 +// Do not modify this file. This file is machine generated, and any changes to it will be overwritten. +package software.amazon.cryptography.dbencryptionsdk.dynamodb; + +import Wrappers_Compile.Result; +import java.lang.IllegalArgumentException; +import java.util.Objects; +import software.amazon.cryptography.dbencryptionsdk.dynamodb.internaldafny.__default; +import software.amazon.cryptography.dbencryptionsdk.dynamodb.internaldafny.types.Error; +import software.amazon.cryptography.dbencryptionsdk.dynamodb.internaldafny.types.IDynamoDbEncryptionClient; +import software.amazon.cryptography.dbencryptionsdk.dynamodb.model.CreateDynamoDbEncryptionBranchKeyIdSupplierInput; +import software.amazon.cryptography.dbencryptionsdk.dynamodb.model.CreateDynamoDbEncryptionBranchKeyIdSupplierOutput; +import software.amazon.cryptography.dbencryptionsdk.dynamodb.model.DynamoDbEncryptionConfig; +import software.amazon.cryptography.dbencryptionsdk.dynamodb.model.GetEncryptedDataKeyDescriptionInput; +import software.amazon.cryptography.dbencryptionsdk.dynamodb.model.GetEncryptedDataKeyDescriptionOutput; + +public class DynamoDbEncryption { + private final IDynamoDbEncryptionClient _impl; + + protected DynamoDbEncryption(BuilderImpl builder) { + DynamoDbEncryptionConfig input = builder.DynamoDbEncryptionConfig(); + software.amazon.cryptography.dbencryptionsdk.dynamodb.internaldafny.types.DynamoDbEncryptionConfig dafnyValue = ToDafny.DynamoDbEncryptionConfig(input); + Result result = __default.DynamoDbEncryption(dafnyValue); + if (result.is_Failure()) { + throw ToNative.Error(result.dtor_error()); + } + this._impl = result.dtor_value(); + } + + DynamoDbEncryption(IDynamoDbEncryptionClient impl) { + this._impl = impl; + } + + public static Builder builder() { + return new BuilderImpl(); + } + + /** + * Create a Branch Key Supplier for use with the Hierarchical Keyring that decides what Branch Key to use based on the primary key of the DynamoDB item being read or written. + * + * @param input Inputs for creating a Branch Key Supplier from a DynamoDB Key Branch Key Id Supplier + * @return Outputs for creating a Branch Key Supplier from a DynamoDB Key Branch Key Id Supplier + */ + public CreateDynamoDbEncryptionBranchKeyIdSupplierOutput CreateDynamoDbEncryptionBranchKeyIdSupplier( + CreateDynamoDbEncryptionBranchKeyIdSupplierInput input) { + software.amazon.cryptography.dbencryptionsdk.dynamodb.internaldafny.types.CreateDynamoDbEncryptionBranchKeyIdSupplierInput dafnyValue = ToDafny.CreateDynamoDbEncryptionBranchKeyIdSupplierInput(input); + Result result = this._impl.CreateDynamoDbEncryptionBranchKeyIdSupplier(dafnyValue); + if (result.is_Failure()) { + throw ToNative.Error(result.dtor_error()); + } + return ToNative.CreateDynamoDbEncryptionBranchKeyIdSupplierOutput(result.dtor_value()); + } + + public GetEncryptedDataKeyDescriptionOutput GetEncryptedDataKeyDescription( + GetEncryptedDataKeyDescriptionInput input) { + software.amazon.cryptography.dbencryptionsdk.dynamodb.internaldafny.types.GetEncryptedDataKeyDescriptionInput dafnyValue = ToDafny.GetEncryptedDataKeyDescriptionInput(input); + Result result = this._impl.GetEncryptedDataKeyDescription(dafnyValue); + if (result.is_Failure()) { + throw ToNative.Error(result.dtor_error()); + } + return ToNative.GetEncryptedDataKeyDescriptionOutput(result.dtor_value()); + } + + protected IDynamoDbEncryptionClient impl() { + return this._impl; + } + + public interface Builder { + Builder DynamoDbEncryptionConfig(DynamoDbEncryptionConfig DynamoDbEncryptionConfig); + + DynamoDbEncryptionConfig DynamoDbEncryptionConfig(); + + DynamoDbEncryption build(); + } + + static class BuilderImpl implements Builder { + protected DynamoDbEncryptionConfig DynamoDbEncryptionConfig; + + protected BuilderImpl() { + } + + public Builder DynamoDbEncryptionConfig(DynamoDbEncryptionConfig DynamoDbEncryptionConfig) { + this.DynamoDbEncryptionConfig = DynamoDbEncryptionConfig; + return this; + } + + public DynamoDbEncryptionConfig DynamoDbEncryptionConfig() { + return this.DynamoDbEncryptionConfig; + } + + public DynamoDbEncryption build() { + if (Objects.isNull(this.DynamoDbEncryptionConfig())) { + throw new IllegalArgumentException("Missing value for required field `DynamoDbEncryptionConfig`"); + } + return new DynamoDbEncryption(this); + } + } +} diff --git a/TestVectors/runtimes/java/src/main/smithy-generated/software/amazon/cryptography/dbencryptionsdk/dynamodb/DynamoDbKeyBranchKeyIdSupplier.java b/TestVectors/runtimes/java/src/main/smithy-generated/software/amazon/cryptography/dbencryptionsdk/dynamodb/DynamoDbKeyBranchKeyIdSupplier.java new file mode 100644 index 000000000..cbb65800e --- /dev/null +++ b/TestVectors/runtimes/java/src/main/smithy-generated/software/amazon/cryptography/dbencryptionsdk/dynamodb/DynamoDbKeyBranchKeyIdSupplier.java @@ -0,0 +1,85 @@ +// Copyright Amazon.com Inc. or its affiliates. All Rights Reserved. +// SPDX-License-Identifier: Apache-2.0 +// Do not modify this file. This file is machine generated, and any changes to it will be overwritten. +package software.amazon.cryptography.dbencryptionsdk.dynamodb; + +import Wrappers_Compile.Result; +import java.lang.IllegalArgumentException; +import java.lang.RuntimeException; +import java.util.Objects; +import software.amazon.cryptography.dbencryptionsdk.dynamodb.internaldafny.types.Error; +import software.amazon.cryptography.dbencryptionsdk.dynamodb.model.GetBranchKeyIdFromDdbKeyInput; +import software.amazon.cryptography.dbencryptionsdk.dynamodb.model.GetBranchKeyIdFromDdbKeyOutput; + +public final class DynamoDbKeyBranchKeyIdSupplier implements IDynamoDbKeyBranchKeyIdSupplier { + private final software.amazon.cryptography.dbencryptionsdk.dynamodb.internaldafny.types.IDynamoDbKeyBranchKeyIdSupplier _impl; + + private DynamoDbKeyBranchKeyIdSupplier( + software.amazon.cryptography.dbencryptionsdk.dynamodb.internaldafny.types.IDynamoDbKeyBranchKeyIdSupplier iDynamoDbKeyBranchKeyIdSupplier) { + Objects.requireNonNull(iDynamoDbKeyBranchKeyIdSupplier, "Missing value for required argument `iDynamoDbKeyBranchKeyIdSupplier`"); + this._impl = iDynamoDbKeyBranchKeyIdSupplier; + } + + public static DynamoDbKeyBranchKeyIdSupplier wrap( + software.amazon.cryptography.dbencryptionsdk.dynamodb.internaldafny.types.IDynamoDbKeyBranchKeyIdSupplier iDynamoDbKeyBranchKeyIdSupplier) { + return new DynamoDbKeyBranchKeyIdSupplier(iDynamoDbKeyBranchKeyIdSupplier); + } + + public static DynamoDbKeyBranchKeyIdSupplier wrap( + I iDynamoDbKeyBranchKeyIdSupplier) { + Objects.requireNonNull(iDynamoDbKeyBranchKeyIdSupplier, "Missing value for required argument `iDynamoDbKeyBranchKeyIdSupplier`"); + if (iDynamoDbKeyBranchKeyIdSupplier instanceof software.amazon.cryptography.dbencryptionsdk.dynamodb.DynamoDbKeyBranchKeyIdSupplier) { + return ((DynamoDbKeyBranchKeyIdSupplier) iDynamoDbKeyBranchKeyIdSupplier); + } + return DynamoDbKeyBranchKeyIdSupplier.wrap(new NativeWrapper(iDynamoDbKeyBranchKeyIdSupplier)); + } + + public software.amazon.cryptography.dbencryptionsdk.dynamodb.internaldafny.types.IDynamoDbKeyBranchKeyIdSupplier impl( + ) { + return this._impl; + } + + /** + * Get the Branch Key that should be used for wrapping and unwrapping data keys based on the primary key of the item being read or written. + * + * @param input Inputs for getting the Branch Key that should be used for wrapping and unwrapping data keys. + * @return Outputs for getting the Branch Key that should be used for wrapping and unwrapping data keys. + */ + public GetBranchKeyIdFromDdbKeyOutput GetBranchKeyIdFromDdbKey( + GetBranchKeyIdFromDdbKeyInput input) { + software.amazon.cryptography.dbencryptionsdk.dynamodb.internaldafny.types.GetBranchKeyIdFromDdbKeyInput dafnyValue = ToDafny.GetBranchKeyIdFromDdbKeyInput(input); + Result result = this._impl.GetBranchKeyIdFromDdbKey(dafnyValue); + if (result.is_Failure()) { + throw ToNative.Error(result.dtor_error()); + } + return ToNative.GetBranchKeyIdFromDdbKeyOutput(result.dtor_value()); + } + + protected static final class NativeWrapper implements software.amazon.cryptography.dbencryptionsdk.dynamodb.internaldafny.types.IDynamoDbKeyBranchKeyIdSupplier { + protected final IDynamoDbKeyBranchKeyIdSupplier _impl; + + NativeWrapper(IDynamoDbKeyBranchKeyIdSupplier nativeImpl) { + if (nativeImpl instanceof DynamoDbKeyBranchKeyIdSupplier) { + throw new IllegalArgumentException("Recursive wrapping is strictly forbidden."); + } + this._impl = nativeImpl; + } + + public Result GetBranchKeyIdFromDdbKey( + software.amazon.cryptography.dbencryptionsdk.dynamodb.internaldafny.types.GetBranchKeyIdFromDdbKeyInput dafnyInput) { + GetBranchKeyIdFromDdbKeyInput nativeInput = ToNative.GetBranchKeyIdFromDdbKeyInput(dafnyInput); + try { + GetBranchKeyIdFromDdbKeyOutput nativeOutput = this._impl.GetBranchKeyIdFromDdbKey(nativeInput); + software.amazon.cryptography.dbencryptionsdk.dynamodb.internaldafny.types.GetBranchKeyIdFromDdbKeyOutput dafnyOutput = ToDafny.GetBranchKeyIdFromDdbKeyOutput(nativeOutput); + return Result.create_Success(dafnyOutput); + } catch (RuntimeException ex) { + return Result.create_Failure(ToDafny.Error(ex)); + } + } + + public Result GetBranchKeyIdFromDdbKey_k( + software.amazon.cryptography.dbencryptionsdk.dynamodb.internaldafny.types.GetBranchKeyIdFromDdbKeyInput dafnyInput) { + throw new RuntimeException("Not supported at this time."); + } + } +} diff --git a/TestVectors/runtimes/java/src/main/smithy-generated/software/amazon/cryptography/dbencryptionsdk/dynamodb/IDynamoDbKeyBranchKeyIdSupplier.java b/TestVectors/runtimes/java/src/main/smithy-generated/software/amazon/cryptography/dbencryptionsdk/dynamodb/IDynamoDbKeyBranchKeyIdSupplier.java new file mode 100644 index 000000000..e6ddaba2c --- /dev/null +++ b/TestVectors/runtimes/java/src/main/smithy-generated/software/amazon/cryptography/dbencryptionsdk/dynamodb/IDynamoDbKeyBranchKeyIdSupplier.java @@ -0,0 +1,17 @@ +// Copyright Amazon.com Inc. or its affiliates. All Rights Reserved. +// SPDX-License-Identifier: Apache-2.0 +// Do not modify this file. This file is machine generated, and any changes to it will be overwritten. +package software.amazon.cryptography.dbencryptionsdk.dynamodb; + +import software.amazon.cryptography.dbencryptionsdk.dynamodb.model.GetBranchKeyIdFromDdbKeyInput; +import software.amazon.cryptography.dbencryptionsdk.dynamodb.model.GetBranchKeyIdFromDdbKeyOutput; + +public interface IDynamoDbKeyBranchKeyIdSupplier { + /** + * Get the Branch Key that should be used for wrapping and unwrapping data keys based on the primary key of the item being read or written. + * + * @param input Inputs for getting the Branch Key that should be used for wrapping and unwrapping data keys. + * @return Outputs for getting the Branch Key that should be used for wrapping and unwrapping data keys. + */ + GetBranchKeyIdFromDdbKeyOutput GetBranchKeyIdFromDdbKey(GetBranchKeyIdFromDdbKeyInput input); +} diff --git a/TestVectors/runtimes/java/src/main/smithy-generated/software/amazon/cryptography/dbencryptionsdk/dynamodb/ILegacyDynamoDbEncryptor.java b/TestVectors/runtimes/java/src/main/smithy-generated/software/amazon/cryptography/dbencryptionsdk/dynamodb/ILegacyDynamoDbEncryptor.java new file mode 100644 index 000000000..825d315a4 --- /dev/null +++ b/TestVectors/runtimes/java/src/main/smithy-generated/software/amazon/cryptography/dbencryptionsdk/dynamodb/ILegacyDynamoDbEncryptor.java @@ -0,0 +1,7 @@ +// Copyright Amazon.com Inc. or its affiliates. All Rights Reserved. +// SPDX-License-Identifier: Apache-2.0 +// Do not modify this file. This file is machine generated, and any changes to it will be overwritten. +package software.amazon.cryptography.dbencryptionsdk.dynamodb; + +public interface ILegacyDynamoDbEncryptor { +} diff --git a/TestVectors/runtimes/java/src/main/smithy-generated/software/amazon/cryptography/dbencryptionsdk/dynamodb/LegacyDynamoDbEncryptor.java b/TestVectors/runtimes/java/src/main/smithy-generated/software/amazon/cryptography/dbencryptionsdk/dynamodb/LegacyDynamoDbEncryptor.java new file mode 100644 index 000000000..07ac066d6 --- /dev/null +++ b/TestVectors/runtimes/java/src/main/smithy-generated/software/amazon/cryptography/dbencryptionsdk/dynamodb/LegacyDynamoDbEncryptor.java @@ -0,0 +1,47 @@ +// Copyright Amazon.com Inc. or its affiliates. All Rights Reserved. +// SPDX-License-Identifier: Apache-2.0 +// Do not modify this file. This file is machine generated, and any changes to it will be overwritten. +package software.amazon.cryptography.dbencryptionsdk.dynamodb; + +import java.lang.IllegalArgumentException; +import java.util.Objects; + +public final class LegacyDynamoDbEncryptor implements ILegacyDynamoDbEncryptor { + private final software.amazon.cryptography.dbencryptionsdk.dynamodb.internaldafny.types.ILegacyDynamoDbEncryptor _impl; + + private LegacyDynamoDbEncryptor( + software.amazon.cryptography.dbencryptionsdk.dynamodb.internaldafny.types.ILegacyDynamoDbEncryptor iLegacyDynamoDbEncryptor) { + Objects.requireNonNull(iLegacyDynamoDbEncryptor, "Missing value for required argument `iLegacyDynamoDbEncryptor`"); + this._impl = iLegacyDynamoDbEncryptor; + } + + public static LegacyDynamoDbEncryptor wrap( + software.amazon.cryptography.dbencryptionsdk.dynamodb.internaldafny.types.ILegacyDynamoDbEncryptor iLegacyDynamoDbEncryptor) { + return new LegacyDynamoDbEncryptor(iLegacyDynamoDbEncryptor); + } + + public static LegacyDynamoDbEncryptor wrap( + I iLegacyDynamoDbEncryptor) { + Objects.requireNonNull(iLegacyDynamoDbEncryptor, "Missing value for required argument `iLegacyDynamoDbEncryptor`"); + if (iLegacyDynamoDbEncryptor instanceof software.amazon.cryptography.dbencryptionsdk.dynamodb.LegacyDynamoDbEncryptor) { + return ((LegacyDynamoDbEncryptor) iLegacyDynamoDbEncryptor); + } + return LegacyDynamoDbEncryptor.wrap(new NativeWrapper(iLegacyDynamoDbEncryptor)); + } + + public software.amazon.cryptography.dbencryptionsdk.dynamodb.internaldafny.types.ILegacyDynamoDbEncryptor impl( + ) { + return this._impl; + } + + protected static final class NativeWrapper implements software.amazon.cryptography.dbencryptionsdk.dynamodb.internaldafny.types.ILegacyDynamoDbEncryptor { + protected final ILegacyDynamoDbEncryptor _impl; + + NativeWrapper(ILegacyDynamoDbEncryptor nativeImpl) { + if (nativeImpl instanceof LegacyDynamoDbEncryptor) { + throw new IllegalArgumentException("Recursive wrapping is strictly forbidden."); + } + this._impl = nativeImpl; + } + } +} diff --git a/TestVectors/runtimes/java/src/main/smithy-generated/software/amazon/cryptography/dbencryptionsdk/dynamodb/ToDafny.java b/TestVectors/runtimes/java/src/main/smithy-generated/software/amazon/cryptography/dbencryptionsdk/dynamodb/ToDafny.java new file mode 100644 index 000000000..d9209b10a --- /dev/null +++ b/TestVectors/runtimes/java/src/main/smithy-generated/software/amazon/cryptography/dbencryptionsdk/dynamodb/ToDafny.java @@ -0,0 +1,703 @@ +// Copyright Amazon.com Inc. or its affiliates. All Rights Reserved. +// SPDX-License-Identifier: Apache-2.0 +// Do not modify this file. This file is machine generated, and any changes to it will be overwritten. +package software.amazon.cryptography.dbencryptionsdk.dynamodb; + +import Wrappers_Compile.Option; +import dafny.DafnyMap; +import dafny.DafnySequence; +import java.lang.Boolean; +import java.lang.Character; +import java.lang.IllegalArgumentException; +import java.lang.Integer; +import java.lang.RuntimeException; +import java.lang.String; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import software.amazon.cryptography.dbencryptionsdk.dynamodb.internaldafny.types.AsSet; +import software.amazon.cryptography.dbencryptionsdk.dynamodb.internaldafny.types.BeaconKeySource; +import software.amazon.cryptography.dbencryptionsdk.dynamodb.internaldafny.types.BeaconStyle; +import software.amazon.cryptography.dbencryptionsdk.dynamodb.internaldafny.types.BeaconVersion; +import software.amazon.cryptography.dbencryptionsdk.dynamodb.internaldafny.types.CompoundBeacon; +import software.amazon.cryptography.dbencryptionsdk.dynamodb.internaldafny.types.Constructor; +import software.amazon.cryptography.dbencryptionsdk.dynamodb.internaldafny.types.ConstructorPart; +import software.amazon.cryptography.dbencryptionsdk.dynamodb.internaldafny.types.CreateDynamoDbEncryptionBranchKeyIdSupplierInput; +import software.amazon.cryptography.dbencryptionsdk.dynamodb.internaldafny.types.CreateDynamoDbEncryptionBranchKeyIdSupplierOutput; +import software.amazon.cryptography.dbencryptionsdk.dynamodb.internaldafny.types.DynamoDbEncryptionConfig; +import software.amazon.cryptography.dbencryptionsdk.dynamodb.internaldafny.types.DynamoDbTableEncryptionConfig; +import software.amazon.cryptography.dbencryptionsdk.dynamodb.internaldafny.types.DynamoDbTablesEncryptionConfig; +import software.amazon.cryptography.dbencryptionsdk.dynamodb.internaldafny.types.EncryptedDataKeyDescriptionOutput; +import software.amazon.cryptography.dbencryptionsdk.dynamodb.internaldafny.types.EncryptedPart; +import software.amazon.cryptography.dbencryptionsdk.dynamodb.internaldafny.types.Error; +import software.amazon.cryptography.dbencryptionsdk.dynamodb.internaldafny.types.Error_DynamoDbEncryptionException; +import software.amazon.cryptography.dbencryptionsdk.dynamodb.internaldafny.types.GetBranchKeyIdFromDdbKeyInput; +import software.amazon.cryptography.dbencryptionsdk.dynamodb.internaldafny.types.GetBranchKeyIdFromDdbKeyOutput; +import software.amazon.cryptography.dbencryptionsdk.dynamodb.internaldafny.types.GetEncryptedDataKeyDescriptionInput; +import software.amazon.cryptography.dbencryptionsdk.dynamodb.internaldafny.types.GetEncryptedDataKeyDescriptionOutput; +import software.amazon.cryptography.dbencryptionsdk.dynamodb.internaldafny.types.GetEncryptedDataKeyDescriptionUnion; +import software.amazon.cryptography.dbencryptionsdk.dynamodb.internaldafny.types.GetPrefix; +import software.amazon.cryptography.dbencryptionsdk.dynamodb.internaldafny.types.GetSegment; +import software.amazon.cryptography.dbencryptionsdk.dynamodb.internaldafny.types.GetSegments; +import software.amazon.cryptography.dbencryptionsdk.dynamodb.internaldafny.types.GetSubstring; +import software.amazon.cryptography.dbencryptionsdk.dynamodb.internaldafny.types.GetSuffix; +import software.amazon.cryptography.dbencryptionsdk.dynamodb.internaldafny.types.IDynamoDbEncryptionClient; +import software.amazon.cryptography.dbencryptionsdk.dynamodb.internaldafny.types.Insert; +import software.amazon.cryptography.dbencryptionsdk.dynamodb.internaldafny.types.LegacyOverride; +import software.amazon.cryptography.dbencryptionsdk.dynamodb.internaldafny.types.LegacyPolicy; +import software.amazon.cryptography.dbencryptionsdk.dynamodb.internaldafny.types.Lower; +import software.amazon.cryptography.dbencryptionsdk.dynamodb.internaldafny.types.MultiKeyStore; +import software.amazon.cryptography.dbencryptionsdk.dynamodb.internaldafny.types.PartOnly; +import software.amazon.cryptography.dbencryptionsdk.dynamodb.internaldafny.types.PlaintextOverride; +import software.amazon.cryptography.dbencryptionsdk.dynamodb.internaldafny.types.SearchConfig; +import software.amazon.cryptography.dbencryptionsdk.dynamodb.internaldafny.types.Shared; +import software.amazon.cryptography.dbencryptionsdk.dynamodb.internaldafny.types.SharedSet; +import software.amazon.cryptography.dbencryptionsdk.dynamodb.internaldafny.types.SignedPart; +import software.amazon.cryptography.dbencryptionsdk.dynamodb.internaldafny.types.SingleKeyStore; +import software.amazon.cryptography.dbencryptionsdk.dynamodb.internaldafny.types.StandardBeacon; +import software.amazon.cryptography.dbencryptionsdk.dynamodb.internaldafny.types.Upper; +import software.amazon.cryptography.dbencryptionsdk.dynamodb.internaldafny.types.VirtualField; +import software.amazon.cryptography.dbencryptionsdk.dynamodb.internaldafny.types.VirtualPart; +import software.amazon.cryptography.dbencryptionsdk.dynamodb.internaldafny.types.VirtualTransform; +import software.amazon.cryptography.dbencryptionsdk.dynamodb.model.CollectionOfErrors; +import software.amazon.cryptography.dbencryptionsdk.dynamodb.model.DynamoDbEncryptionException; +import software.amazon.cryptography.dbencryptionsdk.dynamodb.model.OpaqueError; +import software.amazon.cryptography.dbencryptionsdk.structuredencryption.internaldafny.types.CryptoAction; +import software.amazon.cryptography.keystore.internaldafny.types.IKeyStoreClient; +import software.amazon.cryptography.materialproviders.internaldafny.types.CacheType; +import software.amazon.cryptography.materialproviders.internaldafny.types.DBEAlgorithmSuiteId; +import software.amazon.cryptography.materialproviders.internaldafny.types.IBranchKeyIdSupplier; +import software.amazon.cryptography.materialproviders.internaldafny.types.ICryptographicMaterialsManager; +import software.amazon.cryptography.materialproviders.internaldafny.types.IKeyring; +import software.amazon.cryptography.services.dynamodb.internaldafny.types.AttributeValue; + +public class ToDafny { + public static Error Error(RuntimeException nativeValue) { + if (nativeValue instanceof DynamoDbEncryptionException) { + return ToDafny.Error((DynamoDbEncryptionException) nativeValue); + } + if (nativeValue instanceof OpaqueError) { + return ToDafny.Error((OpaqueError) nativeValue); + } + if (nativeValue instanceof CollectionOfErrors) { + return ToDafny.Error((CollectionOfErrors) nativeValue); + } + return Error.create_Opaque(nativeValue); + } + + public static Error Error(OpaqueError nativeValue) { + return Error.create_Opaque(nativeValue.obj()); + } + + public static Error Error(CollectionOfErrors nativeValue) { + DafnySequence list = software.amazon.smithy.dafny.conversion.ToDafny.Aggregate.GenericToSequence( + nativeValue.list(), + ToDafny::Error, + Error._typeDescriptor()); + DafnySequence message = software.amazon.smithy.dafny.conversion.ToDafny.Simple.CharacterSequence(nativeValue.getMessage()); + return Error.create_CollectionOfErrors(list, message); + } + + public static AsSet AsSet( + software.amazon.cryptography.dbencryptionsdk.dynamodb.model.AsSet nativeValue) { + return new AsSet(); + } + + public static BeaconVersion BeaconVersion( + software.amazon.cryptography.dbencryptionsdk.dynamodb.model.BeaconVersion nativeValue) { + Integer version; + version = (nativeValue.version()); + IKeyStoreClient keyStore; + keyStore = software.amazon.cryptography.keystore.ToDafny.KeyStore(nativeValue.keyStore()); + BeaconKeySource keySource; + keySource = ToDafny.BeaconKeySource(nativeValue.keySource()); + DafnySequence standardBeacons; + standardBeacons = ToDafny.StandardBeaconList(nativeValue.standardBeacons()); + Option> compoundBeacons; + compoundBeacons = (Objects.nonNull(nativeValue.compoundBeacons()) && nativeValue.compoundBeacons().size() > 0) ? + Option.create_Some(ToDafny.CompoundBeaconList(nativeValue.compoundBeacons())) + : Option.create_None(); + Option> virtualFields; + virtualFields = (Objects.nonNull(nativeValue.virtualFields()) && nativeValue.virtualFields().size() > 0) ? + Option.create_Some(ToDafny.VirtualFieldList(nativeValue.virtualFields())) + : Option.create_None(); + Option> encryptedParts; + encryptedParts = (Objects.nonNull(nativeValue.encryptedParts()) && nativeValue.encryptedParts().size() > 0) ? + Option.create_Some(ToDafny.EncryptedPartsList(nativeValue.encryptedParts())) + : Option.create_None(); + Option> signedParts; + signedParts = (Objects.nonNull(nativeValue.signedParts()) && nativeValue.signedParts().size() > 0) ? + Option.create_Some(ToDafny.SignedPartsList(nativeValue.signedParts())) + : Option.create_None(); + return new BeaconVersion(version, keyStore, keySource, standardBeacons, compoundBeacons, virtualFields, encryptedParts, signedParts); + } + + public static CompoundBeacon CompoundBeacon( + software.amazon.cryptography.dbencryptionsdk.dynamodb.model.CompoundBeacon nativeValue) { + DafnySequence name; + name = software.amazon.smithy.dafny.conversion.ToDafny.Simple.CharacterSequence(nativeValue.name()); + DafnySequence split; + split = software.amazon.smithy.dafny.conversion.ToDafny.Simple.CharacterSequence(nativeValue.split()); + Option> encrypted; + encrypted = (Objects.nonNull(nativeValue.encrypted()) && nativeValue.encrypted().size() > 0) ? + Option.create_Some(ToDafny.EncryptedPartsList(nativeValue.encrypted())) + : Option.create_None(); + Option> signed; + signed = (Objects.nonNull(nativeValue.signed()) && nativeValue.signed().size() > 0) ? + Option.create_Some(ToDafny.SignedPartsList(nativeValue.signed())) + : Option.create_None(); + Option> constructors; + constructors = (Objects.nonNull(nativeValue.constructors()) && nativeValue.constructors().size() > 0) ? + Option.create_Some(ToDafny.ConstructorList(nativeValue.constructors())) + : Option.create_None(); + return new CompoundBeacon(name, split, encrypted, signed, constructors); + } + + public static Constructor Constructor( + software.amazon.cryptography.dbencryptionsdk.dynamodb.model.Constructor nativeValue) { + DafnySequence parts; + parts = ToDafny.ConstructorPartList(nativeValue.parts()); + return new Constructor(parts); + } + + public static ConstructorPart ConstructorPart( + software.amazon.cryptography.dbencryptionsdk.dynamodb.model.ConstructorPart nativeValue) { + DafnySequence name; + name = software.amazon.smithy.dafny.conversion.ToDafny.Simple.CharacterSequence(nativeValue.name()); + Boolean required; + required = (nativeValue.required()); + return new ConstructorPart(name, required); + } + + public static CreateDynamoDbEncryptionBranchKeyIdSupplierInput CreateDynamoDbEncryptionBranchKeyIdSupplierInput( + software.amazon.cryptography.dbencryptionsdk.dynamodb.model.CreateDynamoDbEncryptionBranchKeyIdSupplierInput nativeValue) { + software.amazon.cryptography.dbencryptionsdk.dynamodb.internaldafny.types.IDynamoDbKeyBranchKeyIdSupplier ddbKeyBranchKeyIdSupplier; + ddbKeyBranchKeyIdSupplier = ToDafny.DynamoDbKeyBranchKeyIdSupplier(nativeValue.ddbKeyBranchKeyIdSupplier()); + return new CreateDynamoDbEncryptionBranchKeyIdSupplierInput(ddbKeyBranchKeyIdSupplier); + } + + public static CreateDynamoDbEncryptionBranchKeyIdSupplierOutput CreateDynamoDbEncryptionBranchKeyIdSupplierOutput( + software.amazon.cryptography.dbencryptionsdk.dynamodb.model.CreateDynamoDbEncryptionBranchKeyIdSupplierOutput nativeValue) { + IBranchKeyIdSupplier branchKeyIdSupplier; + branchKeyIdSupplier = software.amazon.cryptography.materialproviders.ToDafny.BranchKeyIdSupplier(nativeValue.branchKeyIdSupplier()); + return new CreateDynamoDbEncryptionBranchKeyIdSupplierOutput(branchKeyIdSupplier); + } + + public static DynamoDbEncryptionConfig DynamoDbEncryptionConfig( + software.amazon.cryptography.dbencryptionsdk.dynamodb.model.DynamoDbEncryptionConfig nativeValue) { + return new DynamoDbEncryptionConfig(); + } + + public static DynamoDbTableEncryptionConfig DynamoDbTableEncryptionConfig( + software.amazon.cryptography.dbencryptionsdk.dynamodb.model.DynamoDbTableEncryptionConfig nativeValue) { + DafnySequence logicalTableName; + logicalTableName = software.amazon.smithy.dafny.conversion.ToDafny.Simple.CharacterSequence(nativeValue.logicalTableName()); + DafnySequence partitionKeyName; + partitionKeyName = software.amazon.smithy.dafny.conversion.ToDafny.Simple.CharacterSequence(nativeValue.partitionKeyName()); + Option> sortKeyName; + sortKeyName = Objects.nonNull(nativeValue.sortKeyName()) ? + Option.create_Some(software.amazon.smithy.dafny.conversion.ToDafny.Simple.CharacterSequence(nativeValue.sortKeyName())) + : Option.create_None(); + Option search; + search = Objects.nonNull(nativeValue.search()) ? + Option.create_Some(ToDafny.SearchConfig(nativeValue.search())) + : Option.create_None(); + DafnyMap, ? extends CryptoAction> attributeActionsOnEncrypt; + attributeActionsOnEncrypt = ToDafny.AttributeActions(nativeValue.attributeActionsOnEncrypt()); + Option>> allowedUnsignedAttributes; + allowedUnsignedAttributes = (Objects.nonNull(nativeValue.allowedUnsignedAttributes()) && nativeValue.allowedUnsignedAttributes().size() > 0) ? + Option.create_Some(software.amazon.cryptography.services.dynamodb.internaldafny.ToDafny.AttributeNameList(nativeValue.allowedUnsignedAttributes())) + : Option.create_None(); + Option> allowedUnsignedAttributePrefix; + allowedUnsignedAttributePrefix = Objects.nonNull(nativeValue.allowedUnsignedAttributePrefix()) ? + Option.create_Some(software.amazon.smithy.dafny.conversion.ToDafny.Simple.CharacterSequence(nativeValue.allowedUnsignedAttributePrefix())) + : Option.create_None(); + Option algorithmSuiteId; + algorithmSuiteId = Objects.nonNull(nativeValue.algorithmSuiteId()) ? + Option.create_Some(software.amazon.cryptography.materialproviders.ToDafny.DBEAlgorithmSuiteId(nativeValue.algorithmSuiteId())) + : Option.create_None(); + Option keyring; + keyring = Objects.nonNull(nativeValue.keyring()) ? + Option.create_Some(software.amazon.cryptography.materialproviders.ToDafny.Keyring(nativeValue.keyring())) + : Option.create_None(); + Option cmm; + cmm = Objects.nonNull(nativeValue.cmm()) ? + Option.create_Some(software.amazon.cryptography.materialproviders.ToDafny.CryptographicMaterialsManager(nativeValue.cmm())) + : Option.create_None(); + Option legacyOverride; + legacyOverride = Objects.nonNull(nativeValue.legacyOverride()) ? + Option.create_Some(ToDafny.LegacyOverride(nativeValue.legacyOverride())) + : Option.create_None(); + Option plaintextOverride; + plaintextOverride = Objects.nonNull(nativeValue.plaintextOverride()) ? + Option.create_Some(ToDafny.PlaintextOverride(nativeValue.plaintextOverride())) + : Option.create_None(); + return new DynamoDbTableEncryptionConfig(logicalTableName, partitionKeyName, sortKeyName, search, attributeActionsOnEncrypt, allowedUnsignedAttributes, allowedUnsignedAttributePrefix, algorithmSuiteId, keyring, cmm, legacyOverride, plaintextOverride); + } + + public static DynamoDbTablesEncryptionConfig DynamoDbTablesEncryptionConfig( + software.amazon.cryptography.dbencryptionsdk.dynamodb.model.DynamoDbTablesEncryptionConfig nativeValue) { + DafnyMap, ? extends DynamoDbTableEncryptionConfig> tableEncryptionConfigs; + tableEncryptionConfigs = ToDafny.DynamoDbTableEncryptionConfigList(nativeValue.tableEncryptionConfigs()); + return new DynamoDbTablesEncryptionConfig(tableEncryptionConfigs); + } + + public static EncryptedDataKeyDescriptionOutput EncryptedDataKeyDescriptionOutput( + software.amazon.cryptography.dbencryptionsdk.dynamodb.model.EncryptedDataKeyDescriptionOutput nativeValue) { + DafnySequence keyProviderId; + keyProviderId = software.amazon.smithy.dafny.conversion.ToDafny.Simple.CharacterSequence(nativeValue.keyProviderId()); + Option> keyProviderInfo; + keyProviderInfo = Objects.nonNull(nativeValue.keyProviderInfo()) ? + Option.create_Some(software.amazon.smithy.dafny.conversion.ToDafny.Simple.CharacterSequence(nativeValue.keyProviderInfo())) + : Option.create_None(); + Option> branchKeyId; + branchKeyId = Objects.nonNull(nativeValue.branchKeyId()) ? + Option.create_Some(software.amazon.smithy.dafny.conversion.ToDafny.Simple.CharacterSequence(nativeValue.branchKeyId())) + : Option.create_None(); + Option> branchKeyVersion; + branchKeyVersion = Objects.nonNull(nativeValue.branchKeyVersion()) ? + Option.create_Some(software.amazon.smithy.dafny.conversion.ToDafny.Simple.CharacterSequence(nativeValue.branchKeyVersion())) + : Option.create_None(); + return new EncryptedDataKeyDescriptionOutput(keyProviderId, keyProviderInfo, branchKeyId, branchKeyVersion); + } + + public static EncryptedPart EncryptedPart( + software.amazon.cryptography.dbencryptionsdk.dynamodb.model.EncryptedPart nativeValue) { + DafnySequence name; + name = software.amazon.smithy.dafny.conversion.ToDafny.Simple.CharacterSequence(nativeValue.name()); + DafnySequence prefix; + prefix = software.amazon.smithy.dafny.conversion.ToDafny.Simple.CharacterSequence(nativeValue.prefix()); + return new EncryptedPart(name, prefix); + } + + public static GetBranchKeyIdFromDdbKeyInput GetBranchKeyIdFromDdbKeyInput( + software.amazon.cryptography.dbencryptionsdk.dynamodb.model.GetBranchKeyIdFromDdbKeyInput nativeValue) { + DafnyMap, ? extends AttributeValue> ddbKey; + ddbKey = software.amazon.cryptography.services.dynamodb.internaldafny.ToDafny.Key(nativeValue.ddbKey()); + return new GetBranchKeyIdFromDdbKeyInput(ddbKey); + } + + public static GetBranchKeyIdFromDdbKeyOutput GetBranchKeyIdFromDdbKeyOutput( + software.amazon.cryptography.dbencryptionsdk.dynamodb.model.GetBranchKeyIdFromDdbKeyOutput nativeValue) { + DafnySequence branchKeyId; + branchKeyId = software.amazon.smithy.dafny.conversion.ToDafny.Simple.CharacterSequence(nativeValue.branchKeyId()); + return new GetBranchKeyIdFromDdbKeyOutput(branchKeyId); + } + + public static GetEncryptedDataKeyDescriptionInput GetEncryptedDataKeyDescriptionInput( + software.amazon.cryptography.dbencryptionsdk.dynamodb.model.GetEncryptedDataKeyDescriptionInput nativeValue) { + GetEncryptedDataKeyDescriptionUnion input; + input = ToDafny.GetEncryptedDataKeyDescriptionUnion(nativeValue.input()); + return new GetEncryptedDataKeyDescriptionInput(input); + } + + public static GetEncryptedDataKeyDescriptionOutput GetEncryptedDataKeyDescriptionOutput( + software.amazon.cryptography.dbencryptionsdk.dynamodb.model.GetEncryptedDataKeyDescriptionOutput nativeValue) { + DafnySequence encryptedDataKeyDescriptionOutput; + encryptedDataKeyDescriptionOutput = ToDafny.EncryptedDataKeyDescriptionList(nativeValue.EncryptedDataKeyDescriptionOutput()); + return new GetEncryptedDataKeyDescriptionOutput(encryptedDataKeyDescriptionOutput); + } + + public static GetPrefix GetPrefix( + software.amazon.cryptography.dbencryptionsdk.dynamodb.model.GetPrefix nativeValue) { + Integer length; + length = (nativeValue.length()); + return new GetPrefix(length); + } + + public static GetSegment GetSegment( + software.amazon.cryptography.dbencryptionsdk.dynamodb.model.GetSegment nativeValue) { + DafnySequence split; + split = software.amazon.smithy.dafny.conversion.ToDafny.Simple.CharacterSequence(nativeValue.split()); + Integer index; + index = (nativeValue.index()); + return new GetSegment(split, index); + } + + public static GetSegments GetSegments( + software.amazon.cryptography.dbencryptionsdk.dynamodb.model.GetSegments nativeValue) { + DafnySequence split; + split = software.amazon.smithy.dafny.conversion.ToDafny.Simple.CharacterSequence(nativeValue.split()); + Integer low; + low = (nativeValue.low()); + Integer high; + high = (nativeValue.high()); + return new GetSegments(split, low, high); + } + + public static GetSubstring GetSubstring( + software.amazon.cryptography.dbencryptionsdk.dynamodb.model.GetSubstring nativeValue) { + Integer low; + low = (nativeValue.low()); + Integer high; + high = (nativeValue.high()); + return new GetSubstring(low, high); + } + + public static GetSuffix GetSuffix( + software.amazon.cryptography.dbencryptionsdk.dynamodb.model.GetSuffix nativeValue) { + Integer length; + length = (nativeValue.length()); + return new GetSuffix(length); + } + + public static Insert Insert( + software.amazon.cryptography.dbencryptionsdk.dynamodb.model.Insert nativeValue) { + DafnySequence literal; + literal = software.amazon.smithy.dafny.conversion.ToDafny.Simple.CharacterSequence(nativeValue.literal()); + return new Insert(literal); + } + + public static LegacyOverride LegacyOverride( + software.amazon.cryptography.dbencryptionsdk.dynamodb.model.LegacyOverride nativeValue) { + LegacyPolicy policy; + policy = ToDafny.LegacyPolicy(nativeValue.policy()); + software.amazon.cryptography.dbencryptionsdk.dynamodb.internaldafny.types.ILegacyDynamoDbEncryptor encryptor; + encryptor = ToDafny.LegacyDynamoDbEncryptor(nativeValue.encryptor()); + DafnyMap, ? extends CryptoAction> attributeActionsOnEncrypt; + attributeActionsOnEncrypt = ToDafny.AttributeActions(nativeValue.attributeActionsOnEncrypt()); + Option defaultAttributeFlag; + defaultAttributeFlag = Objects.nonNull(nativeValue.defaultAttributeFlag()) ? + Option.create_Some(software.amazon.cryptography.dbencryptionsdk.structuredencryption.ToDafny.CryptoAction(nativeValue.defaultAttributeFlag())) + : Option.create_None(); + return new LegacyOverride(policy, encryptor, attributeActionsOnEncrypt, defaultAttributeFlag); + } + + public static Lower Lower( + software.amazon.cryptography.dbencryptionsdk.dynamodb.model.Lower nativeValue) { + return new Lower(); + } + + public static MultiKeyStore MultiKeyStore( + software.amazon.cryptography.dbencryptionsdk.dynamodb.model.MultiKeyStore nativeValue) { + DafnySequence keyFieldName; + keyFieldName = software.amazon.smithy.dafny.conversion.ToDafny.Simple.CharacterSequence(nativeValue.keyFieldName()); + Integer cacheTTL; + cacheTTL = (nativeValue.cacheTTL()); + Option cache; + cache = Objects.nonNull(nativeValue.cache()) ? + Option.create_Some(software.amazon.cryptography.materialproviders.ToDafny.CacheType(nativeValue.cache())) + : Option.create_None(); + return new MultiKeyStore(keyFieldName, cacheTTL, cache); + } + + public static PartOnly PartOnly( + software.amazon.cryptography.dbencryptionsdk.dynamodb.model.PartOnly nativeValue) { + return new PartOnly(); + } + + public static SearchConfig SearchConfig( + software.amazon.cryptography.dbencryptionsdk.dynamodb.model.SearchConfig nativeValue) { + DafnySequence versions; + versions = ToDafny.BeaconVersionList(nativeValue.versions()); + Integer writeVersion; + writeVersion = (nativeValue.writeVersion()); + return new SearchConfig(versions, writeVersion); + } + + public static Shared Shared( + software.amazon.cryptography.dbencryptionsdk.dynamodb.model.Shared nativeValue) { + DafnySequence other; + other = software.amazon.smithy.dafny.conversion.ToDafny.Simple.CharacterSequence(nativeValue.other()); + return new Shared(other); + } + + public static SharedSet SharedSet( + software.amazon.cryptography.dbencryptionsdk.dynamodb.model.SharedSet nativeValue) { + DafnySequence other; + other = software.amazon.smithy.dafny.conversion.ToDafny.Simple.CharacterSequence(nativeValue.other()); + return new SharedSet(other); + } + + public static SignedPart SignedPart( + software.amazon.cryptography.dbencryptionsdk.dynamodb.model.SignedPart nativeValue) { + DafnySequence name; + name = software.amazon.smithy.dafny.conversion.ToDafny.Simple.CharacterSequence(nativeValue.name()); + DafnySequence prefix; + prefix = software.amazon.smithy.dafny.conversion.ToDafny.Simple.CharacterSequence(nativeValue.prefix()); + Option> loc; + loc = Objects.nonNull(nativeValue.loc()) ? + Option.create_Some(software.amazon.smithy.dafny.conversion.ToDafny.Simple.CharacterSequence(nativeValue.loc())) + : Option.create_None(); + return new SignedPart(name, prefix, loc); + } + + public static SingleKeyStore SingleKeyStore( + software.amazon.cryptography.dbencryptionsdk.dynamodb.model.SingleKeyStore nativeValue) { + DafnySequence keyId; + keyId = software.amazon.smithy.dafny.conversion.ToDafny.Simple.CharacterSequence(nativeValue.keyId()); + Integer cacheTTL; + cacheTTL = (nativeValue.cacheTTL()); + return new SingleKeyStore(keyId, cacheTTL); + } + + public static StandardBeacon StandardBeacon( + software.amazon.cryptography.dbencryptionsdk.dynamodb.model.StandardBeacon nativeValue) { + DafnySequence name; + name = software.amazon.smithy.dafny.conversion.ToDafny.Simple.CharacterSequence(nativeValue.name()); + Integer length; + length = (nativeValue.length()); + Option> loc; + loc = Objects.nonNull(nativeValue.loc()) ? + Option.create_Some(software.amazon.smithy.dafny.conversion.ToDafny.Simple.CharacterSequence(nativeValue.loc())) + : Option.create_None(); + Option style; + style = Objects.nonNull(nativeValue.style()) ? + Option.create_Some(ToDafny.BeaconStyle(nativeValue.style())) + : Option.create_None(); + return new StandardBeacon(name, length, loc, style); + } + + public static Upper Upper( + software.amazon.cryptography.dbencryptionsdk.dynamodb.model.Upper nativeValue) { + return new Upper(); + } + + public static VirtualField VirtualField( + software.amazon.cryptography.dbencryptionsdk.dynamodb.model.VirtualField nativeValue) { + DafnySequence name; + name = software.amazon.smithy.dafny.conversion.ToDafny.Simple.CharacterSequence(nativeValue.name()); + DafnySequence parts; + parts = ToDafny.VirtualPartList(nativeValue.parts()); + return new VirtualField(name, parts); + } + + public static VirtualPart VirtualPart( + software.amazon.cryptography.dbencryptionsdk.dynamodb.model.VirtualPart nativeValue) { + DafnySequence loc; + loc = software.amazon.smithy.dafny.conversion.ToDafny.Simple.CharacterSequence(nativeValue.loc()); + Option> trans; + trans = (Objects.nonNull(nativeValue.trans()) && nativeValue.trans().size() > 0) ? + Option.create_Some(ToDafny.VirtualTransformList(nativeValue.trans())) + : Option.create_None(); + return new VirtualPart(loc, trans); + } + + public static Error Error(DynamoDbEncryptionException nativeValue) { + DafnySequence message; + message = software.amazon.smithy.dafny.conversion.ToDafny.Simple.CharacterSequence(nativeValue.message()); + return new Error_DynamoDbEncryptionException(message); + } + + public static LegacyPolicy LegacyPolicy( + software.amazon.cryptography.dbencryptionsdk.dynamodb.model.LegacyPolicy nativeValue) { + switch (nativeValue) { + case FORCE_LEGACY_ENCRYPT_ALLOW_LEGACY_DECRYPT: { + return LegacyPolicy.create_FORCE__LEGACY__ENCRYPT__ALLOW__LEGACY__DECRYPT(); + } + case FORBID_LEGACY_ENCRYPT_ALLOW_LEGACY_DECRYPT: { + return LegacyPolicy.create_FORBID__LEGACY__ENCRYPT__ALLOW__LEGACY__DECRYPT(); + } + case FORBID_LEGACY_ENCRYPT_FORBID_LEGACY_DECRYPT: { + return LegacyPolicy.create_FORBID__LEGACY__ENCRYPT__FORBID__LEGACY__DECRYPT(); + } + default: { + throw new RuntimeException("Cannot convert " + nativeValue + " to software.amazon.cryptography.dbencryptionsdk.dynamodb.internaldafny.types.LegacyPolicy."); + } + } + } + + public static PlaintextOverride PlaintextOverride( + software.amazon.cryptography.dbencryptionsdk.dynamodb.model.PlaintextOverride nativeValue) { + switch (nativeValue) { + case FORCE_PLAINTEXT_WRITE_ALLOW_PLAINTEXT_READ: { + return PlaintextOverride.create_FORCE__PLAINTEXT__WRITE__ALLOW__PLAINTEXT__READ(); + } + case FORBID_PLAINTEXT_WRITE_ALLOW_PLAINTEXT_READ: { + return PlaintextOverride.create_FORBID__PLAINTEXT__WRITE__ALLOW__PLAINTEXT__READ(); + } + case FORBID_PLAINTEXT_WRITE_FORBID_PLAINTEXT_READ: { + return PlaintextOverride.create_FORBID__PLAINTEXT__WRITE__FORBID__PLAINTEXT__READ(); + } + default: { + throw new RuntimeException("Cannot convert " + nativeValue + " to software.amazon.cryptography.dbencryptionsdk.dynamodb.internaldafny.types.PlaintextOverride."); + } + } + } + + public static BeaconKeySource BeaconKeySource( + software.amazon.cryptography.dbencryptionsdk.dynamodb.model.BeaconKeySource nativeValue) { + if (Objects.nonNull(nativeValue.single())) { + return BeaconKeySource.create_single(ToDafny.SingleKeyStore(nativeValue.single())); + } + if (Objects.nonNull(nativeValue.multi())) { + return BeaconKeySource.create_multi(ToDafny.MultiKeyStore(nativeValue.multi())); + } + throw new IllegalArgumentException("Cannot convert " + nativeValue + " to software.amazon.cryptography.dbencryptionsdk.dynamodb.internaldafny.types.BeaconKeySource."); + } + + public static BeaconStyle BeaconStyle( + software.amazon.cryptography.dbencryptionsdk.dynamodb.model.BeaconStyle nativeValue) { + if (Objects.nonNull(nativeValue.partOnly())) { + return BeaconStyle.create_partOnly(ToDafny.PartOnly(nativeValue.partOnly())); + } + if (Objects.nonNull(nativeValue.shared())) { + return BeaconStyle.create_shared(ToDafny.Shared(nativeValue.shared())); + } + if (Objects.nonNull(nativeValue.asSet())) { + return BeaconStyle.create_asSet(ToDafny.AsSet(nativeValue.asSet())); + } + if (Objects.nonNull(nativeValue.sharedSet())) { + return BeaconStyle.create_sharedSet(ToDafny.SharedSet(nativeValue.sharedSet())); + } + throw new IllegalArgumentException("Cannot convert " + nativeValue + " to software.amazon.cryptography.dbencryptionsdk.dynamodb.internaldafny.types.BeaconStyle."); + } + + public static GetEncryptedDataKeyDescriptionUnion GetEncryptedDataKeyDescriptionUnion( + software.amazon.cryptography.dbencryptionsdk.dynamodb.model.GetEncryptedDataKeyDescriptionUnion nativeValue) { + if (Objects.nonNull(nativeValue.header())) { + return GetEncryptedDataKeyDescriptionUnion.create_header(software.amazon.smithy.dafny.conversion.ToDafny.Simple.ByteSequence(nativeValue.header())); + } + if (Objects.nonNull(nativeValue.plaintextItem())) { + return GetEncryptedDataKeyDescriptionUnion.create_plaintextItem(software.amazon.cryptography.services.dynamodb.internaldafny.ToDafny.AttributeMap(nativeValue.plaintextItem())); + } + throw new IllegalArgumentException("Cannot convert " + nativeValue + " to software.amazon.cryptography.dbencryptionsdk.dynamodb.internaldafny.types.GetEncryptedDataKeyDescriptionUnion."); + } + + public static VirtualTransform VirtualTransform( + software.amazon.cryptography.dbencryptionsdk.dynamodb.model.VirtualTransform nativeValue) { + if (Objects.nonNull(nativeValue.upper())) { + return VirtualTransform.create_upper(ToDafny.Upper(nativeValue.upper())); + } + if (Objects.nonNull(nativeValue.lower())) { + return VirtualTransform.create_lower(ToDafny.Lower(nativeValue.lower())); + } + if (Objects.nonNull(nativeValue.insert())) { + return VirtualTransform.create_insert(ToDafny.Insert(nativeValue.insert())); + } + if (Objects.nonNull(nativeValue.prefix())) { + return VirtualTransform.create_prefix(ToDafny.GetPrefix(nativeValue.prefix())); + } + if (Objects.nonNull(nativeValue.suffix())) { + return VirtualTransform.create_suffix(ToDafny.GetSuffix(nativeValue.suffix())); + } + if (Objects.nonNull(nativeValue.substring())) { + return VirtualTransform.create_substring(ToDafny.GetSubstring(nativeValue.substring())); + } + if (Objects.nonNull(nativeValue.segment())) { + return VirtualTransform.create_segment(ToDafny.GetSegment(nativeValue.segment())); + } + if (Objects.nonNull(nativeValue.segments())) { + return VirtualTransform.create_segments(ToDafny.GetSegments(nativeValue.segments())); + } + throw new IllegalArgumentException("Cannot convert " + nativeValue + " to software.amazon.cryptography.dbencryptionsdk.dynamodb.internaldafny.types.VirtualTransform."); + } + + public static DafnySequence BeaconVersionList( + List nativeValue) { + return software.amazon.smithy.dafny.conversion.ToDafny.Aggregate.GenericToSequence( + nativeValue, + software.amazon.cryptography.dbencryptionsdk.dynamodb.ToDafny::BeaconVersion, + BeaconVersion._typeDescriptor()); + } + + public static DafnySequence CompoundBeaconList( + List nativeValue) { + return software.amazon.smithy.dafny.conversion.ToDafny.Aggregate.GenericToSequence( + nativeValue, + software.amazon.cryptography.dbencryptionsdk.dynamodb.ToDafny::CompoundBeacon, + CompoundBeacon._typeDescriptor()); + } + + public static DafnySequence ConstructorList( + List nativeValue) { + return software.amazon.smithy.dafny.conversion.ToDafny.Aggregate.GenericToSequence( + nativeValue, + software.amazon.cryptography.dbencryptionsdk.dynamodb.ToDafny::Constructor, + Constructor._typeDescriptor()); + } + + public static DafnySequence ConstructorPartList( + List nativeValue) { + return software.amazon.smithy.dafny.conversion.ToDafny.Aggregate.GenericToSequence( + nativeValue, + software.amazon.cryptography.dbencryptionsdk.dynamodb.ToDafny::ConstructorPart, + ConstructorPart._typeDescriptor()); + } + + public static DafnySequence EncryptedDataKeyDescriptionList( + List nativeValue) { + return software.amazon.smithy.dafny.conversion.ToDafny.Aggregate.GenericToSequence( + nativeValue, + software.amazon.cryptography.dbencryptionsdk.dynamodb.ToDafny::EncryptedDataKeyDescriptionOutput, + EncryptedDataKeyDescriptionOutput._typeDescriptor()); + } + + public static DafnySequence EncryptedPartsList( + List nativeValue) { + return software.amazon.smithy.dafny.conversion.ToDafny.Aggregate.GenericToSequence( + nativeValue, + software.amazon.cryptography.dbencryptionsdk.dynamodb.ToDafny::EncryptedPart, + EncryptedPart._typeDescriptor()); + } + + public static DafnySequence SignedPartsList( + List nativeValue) { + return software.amazon.smithy.dafny.conversion.ToDafny.Aggregate.GenericToSequence( + nativeValue, + software.amazon.cryptography.dbencryptionsdk.dynamodb.ToDafny::SignedPart, + SignedPart._typeDescriptor()); + } + + public static DafnySequence StandardBeaconList( + List nativeValue) { + return software.amazon.smithy.dafny.conversion.ToDafny.Aggregate.GenericToSequence( + nativeValue, + software.amazon.cryptography.dbencryptionsdk.dynamodb.ToDafny::StandardBeacon, + StandardBeacon._typeDescriptor()); + } + + public static DafnySequence VirtualFieldList( + List nativeValue) { + return software.amazon.smithy.dafny.conversion.ToDafny.Aggregate.GenericToSequence( + nativeValue, + software.amazon.cryptography.dbencryptionsdk.dynamodb.ToDafny::VirtualField, + VirtualField._typeDescriptor()); + } + + public static DafnySequence VirtualPartList( + List nativeValue) { + return software.amazon.smithy.dafny.conversion.ToDafny.Aggregate.GenericToSequence( + nativeValue, + software.amazon.cryptography.dbencryptionsdk.dynamodb.ToDafny::VirtualPart, + VirtualPart._typeDescriptor()); + } + + public static DafnySequence VirtualTransformList( + List nativeValue) { + return software.amazon.smithy.dafny.conversion.ToDafny.Aggregate.GenericToSequence( + nativeValue, + software.amazon.cryptography.dbencryptionsdk.dynamodb.ToDafny::VirtualTransform, + VirtualTransform._typeDescriptor()); + } + + public static DafnyMap, ? extends CryptoAction> AttributeActions( + Map nativeValue) { + return software.amazon.smithy.dafny.conversion.ToDafny.Aggregate.GenericToMap( + nativeValue, + software.amazon.smithy.dafny.conversion.ToDafny.Simple::CharacterSequence, + software.amazon.cryptography.dbencryptionsdk.structuredencryption.ToDafny::CryptoAction); + } + + public static DafnyMap, ? extends DynamoDbTableEncryptionConfig> DynamoDbTableEncryptionConfigList( + Map nativeValue) { + return software.amazon.smithy.dafny.conversion.ToDafny.Aggregate.GenericToMap( + nativeValue, + software.amazon.smithy.dafny.conversion.ToDafny.Simple::CharacterSequence, + software.amazon.cryptography.dbencryptionsdk.dynamodb.ToDafny::DynamoDbTableEncryptionConfig); + } + + public static software.amazon.cryptography.dbencryptionsdk.dynamodb.internaldafny.types.IDynamoDbKeyBranchKeyIdSupplier DynamoDbKeyBranchKeyIdSupplier( + IDynamoDbKeyBranchKeyIdSupplier nativeValue) { + return DynamoDbKeyBranchKeyIdSupplier.wrap(nativeValue).impl(); + } + + public static software.amazon.cryptography.dbencryptionsdk.dynamodb.internaldafny.types.ILegacyDynamoDbEncryptor LegacyDynamoDbEncryptor( + ILegacyDynamoDbEncryptor nativeValue) { + return LegacyDynamoDbEncryptor.wrap(nativeValue).impl(); + } + + public static IDynamoDbEncryptionClient DynamoDbEncryption(DynamoDbEncryption nativeValue) { + return nativeValue.impl(); + } +} diff --git a/TestVectors/runtimes/java/src/main/smithy-generated/software/amazon/cryptography/dbencryptionsdk/dynamodb/ToNative.java b/TestVectors/runtimes/java/src/main/smithy-generated/software/amazon/cryptography/dbencryptionsdk/dynamodb/ToNative.java new file mode 100644 index 000000000..bd6dff77d --- /dev/null +++ b/TestVectors/runtimes/java/src/main/smithy-generated/software/amazon/cryptography/dbencryptionsdk/dynamodb/ToNative.java @@ -0,0 +1,662 @@ +// Copyright Amazon.com Inc. or its affiliates. All Rights Reserved. +// SPDX-License-Identifier: Apache-2.0 +// Do not modify this file. This file is machine generated, and any changes to it will be overwritten. +package software.amazon.cryptography.dbencryptionsdk.dynamodb; + +import dafny.DafnyMap; +import dafny.DafnySequence; +import java.lang.Character; +import java.lang.IllegalArgumentException; +import java.lang.RuntimeException; +import java.lang.String; +import java.util.List; +import java.util.Map; +import software.amazon.cryptography.dbencryptionsdk.dynamodb.internaldafny.types.Error; +import software.amazon.cryptography.dbencryptionsdk.dynamodb.internaldafny.types.Error_CollectionOfErrors; +import software.amazon.cryptography.dbencryptionsdk.dynamodb.internaldafny.types.Error_DynamoDbEncryptionException; +import software.amazon.cryptography.dbencryptionsdk.dynamodb.internaldafny.types.Error_Opaque; +import software.amazon.cryptography.dbencryptionsdk.dynamodb.internaldafny.types.IDynamoDbEncryptionClient; +import software.amazon.cryptography.dbencryptionsdk.dynamodb.model.AsSet; +import software.amazon.cryptography.dbencryptionsdk.dynamodb.model.BeaconKeySource; +import software.amazon.cryptography.dbencryptionsdk.dynamodb.model.BeaconStyle; +import software.amazon.cryptography.dbencryptionsdk.dynamodb.model.BeaconVersion; +import software.amazon.cryptography.dbencryptionsdk.dynamodb.model.CollectionOfErrors; +import software.amazon.cryptography.dbencryptionsdk.dynamodb.model.CompoundBeacon; +import software.amazon.cryptography.dbencryptionsdk.dynamodb.model.Constructor; +import software.amazon.cryptography.dbencryptionsdk.dynamodb.model.ConstructorPart; +import software.amazon.cryptography.dbencryptionsdk.dynamodb.model.CreateDynamoDbEncryptionBranchKeyIdSupplierInput; +import software.amazon.cryptography.dbencryptionsdk.dynamodb.model.CreateDynamoDbEncryptionBranchKeyIdSupplierOutput; +import software.amazon.cryptography.dbencryptionsdk.dynamodb.model.DynamoDbEncryptionConfig; +import software.amazon.cryptography.dbencryptionsdk.dynamodb.model.DynamoDbEncryptionException; +import software.amazon.cryptography.dbencryptionsdk.dynamodb.model.DynamoDbTableEncryptionConfig; +import software.amazon.cryptography.dbencryptionsdk.dynamodb.model.DynamoDbTablesEncryptionConfig; +import software.amazon.cryptography.dbencryptionsdk.dynamodb.model.EncryptedDataKeyDescriptionOutput; +import software.amazon.cryptography.dbencryptionsdk.dynamodb.model.EncryptedPart; +import software.amazon.cryptography.dbencryptionsdk.dynamodb.model.GetBranchKeyIdFromDdbKeyInput; +import software.amazon.cryptography.dbencryptionsdk.dynamodb.model.GetBranchKeyIdFromDdbKeyOutput; +import software.amazon.cryptography.dbencryptionsdk.dynamodb.model.GetEncryptedDataKeyDescriptionInput; +import software.amazon.cryptography.dbencryptionsdk.dynamodb.model.GetEncryptedDataKeyDescriptionOutput; +import software.amazon.cryptography.dbencryptionsdk.dynamodb.model.GetEncryptedDataKeyDescriptionUnion; +import software.amazon.cryptography.dbencryptionsdk.dynamodb.model.GetPrefix; +import software.amazon.cryptography.dbencryptionsdk.dynamodb.model.GetSegment; +import software.amazon.cryptography.dbencryptionsdk.dynamodb.model.GetSegments; +import software.amazon.cryptography.dbencryptionsdk.dynamodb.model.GetSubstring; +import software.amazon.cryptography.dbencryptionsdk.dynamodb.model.GetSuffix; +import software.amazon.cryptography.dbencryptionsdk.dynamodb.model.Insert; +import software.amazon.cryptography.dbencryptionsdk.dynamodb.model.LegacyOverride; +import software.amazon.cryptography.dbencryptionsdk.dynamodb.model.LegacyPolicy; +import software.amazon.cryptography.dbencryptionsdk.dynamodb.model.Lower; +import software.amazon.cryptography.dbencryptionsdk.dynamodb.model.MultiKeyStore; +import software.amazon.cryptography.dbencryptionsdk.dynamodb.model.OpaqueError; +import software.amazon.cryptography.dbencryptionsdk.dynamodb.model.PartOnly; +import software.amazon.cryptography.dbencryptionsdk.dynamodb.model.PlaintextOverride; +import software.amazon.cryptography.dbencryptionsdk.dynamodb.model.SearchConfig; +import software.amazon.cryptography.dbencryptionsdk.dynamodb.model.Shared; +import software.amazon.cryptography.dbencryptionsdk.dynamodb.model.SharedSet; +import software.amazon.cryptography.dbencryptionsdk.dynamodb.model.SignedPart; +import software.amazon.cryptography.dbencryptionsdk.dynamodb.model.SingleKeyStore; +import software.amazon.cryptography.dbencryptionsdk.dynamodb.model.StandardBeacon; +import software.amazon.cryptography.dbencryptionsdk.dynamodb.model.Upper; +import software.amazon.cryptography.dbencryptionsdk.dynamodb.model.VirtualField; +import software.amazon.cryptography.dbencryptionsdk.dynamodb.model.VirtualPart; +import software.amazon.cryptography.dbencryptionsdk.dynamodb.model.VirtualTransform; +import software.amazon.cryptography.dbencryptionsdk.structuredencryption.model.CryptoAction; + +public class ToNative { + public static OpaqueError Error(Error_Opaque dafnyValue) { + OpaqueError.Builder nativeBuilder = OpaqueError.builder(); + nativeBuilder.obj(dafnyValue.dtor_obj()); + return nativeBuilder.build(); + } + + public static CollectionOfErrors Error(Error_CollectionOfErrors dafnyValue) { + CollectionOfErrors.Builder nativeBuilder = CollectionOfErrors.builder(); + nativeBuilder.list( + software.amazon.smithy.dafny.conversion.ToNative.Aggregate.GenericToList( + dafnyValue.dtor_list(), + ToNative::Error)); + nativeBuilder.message(software.amazon.smithy.dafny.conversion.ToNative.Simple.String(dafnyValue.dtor_message())); + return nativeBuilder.build(); + } + + public static DynamoDbEncryptionException Error(Error_DynamoDbEncryptionException dafnyValue) { + DynamoDbEncryptionException.Builder nativeBuilder = DynamoDbEncryptionException.builder(); + nativeBuilder.message(software.amazon.smithy.dafny.conversion.ToNative.Simple.String(dafnyValue.dtor_message())); + return nativeBuilder.build(); + } + + public static RuntimeException Error(Error dafnyValue) { + if (dafnyValue.is_DynamoDbEncryptionException()) { + return ToNative.Error((Error_DynamoDbEncryptionException) dafnyValue); + } + if (dafnyValue.is_Opaque()) { + return ToNative.Error((Error_Opaque) dafnyValue); + } + if (dafnyValue.is_CollectionOfErrors()) { + return ToNative.Error((Error_CollectionOfErrors) dafnyValue); + } + if (dafnyValue.is_AwsCryptographyPrimitives()) { + return software.amazon.cryptography.primitives.ToNative.Error(dafnyValue.dtor_AwsCryptographyPrimitives()); + } + if (dafnyValue.is_ComAmazonawsDynamodb()) { + return software.amazon.cryptography.services.dynamodb.internaldafny.ToNative.Error(dafnyValue.dtor_ComAmazonawsDynamodb()); + } + if (dafnyValue.is_AwsCryptographyMaterialProviders()) { + return software.amazon.cryptography.materialproviders.ToNative.Error(dafnyValue.dtor_AwsCryptographyMaterialProviders()); + } + if (dafnyValue.is_AwsCryptographyDbEncryptionSdkStructuredEncryption()) { + return software.amazon.cryptography.dbencryptionsdk.structuredencryption.ToNative.Error(dafnyValue.dtor_AwsCryptographyDbEncryptionSdkStructuredEncryption()); + } + OpaqueError.Builder nativeBuilder = OpaqueError.builder(); + nativeBuilder.obj(dafnyValue); + return nativeBuilder.build(); + } + + public static AsSet AsSet( + software.amazon.cryptography.dbencryptionsdk.dynamodb.internaldafny.types.AsSet dafnyValue) { + AsSet.Builder nativeBuilder = AsSet.builder(); + return nativeBuilder.build(); + } + + public static BeaconVersion BeaconVersion( + software.amazon.cryptography.dbencryptionsdk.dynamodb.internaldafny.types.BeaconVersion dafnyValue) { + BeaconVersion.Builder nativeBuilder = BeaconVersion.builder(); + nativeBuilder.version((dafnyValue.dtor_version())); + nativeBuilder.keyStore(software.amazon.cryptography.keystore.ToNative.KeyStore(dafnyValue.dtor_keyStore())); + nativeBuilder.keySource(ToNative.BeaconKeySource(dafnyValue.dtor_keySource())); + nativeBuilder.standardBeacons(ToNative.StandardBeaconList(dafnyValue.dtor_standardBeacons())); + if (dafnyValue.dtor_compoundBeacons().is_Some()) { + nativeBuilder.compoundBeacons(ToNative.CompoundBeaconList(dafnyValue.dtor_compoundBeacons().dtor_value())); + } + if (dafnyValue.dtor_virtualFields().is_Some()) { + nativeBuilder.virtualFields(ToNative.VirtualFieldList(dafnyValue.dtor_virtualFields().dtor_value())); + } + if (dafnyValue.dtor_encryptedParts().is_Some()) { + nativeBuilder.encryptedParts(ToNative.EncryptedPartsList(dafnyValue.dtor_encryptedParts().dtor_value())); + } + if (dafnyValue.dtor_signedParts().is_Some()) { + nativeBuilder.signedParts(ToNative.SignedPartsList(dafnyValue.dtor_signedParts().dtor_value())); + } + return nativeBuilder.build(); + } + + public static CompoundBeacon CompoundBeacon( + software.amazon.cryptography.dbencryptionsdk.dynamodb.internaldafny.types.CompoundBeacon dafnyValue) { + CompoundBeacon.Builder nativeBuilder = CompoundBeacon.builder(); + nativeBuilder.name(software.amazon.smithy.dafny.conversion.ToNative.Simple.String(dafnyValue.dtor_name())); + nativeBuilder.split(software.amazon.smithy.dafny.conversion.ToNative.Simple.String(dafnyValue.dtor_split())); + if (dafnyValue.dtor_encrypted().is_Some()) { + nativeBuilder.encrypted(ToNative.EncryptedPartsList(dafnyValue.dtor_encrypted().dtor_value())); + } + if (dafnyValue.dtor_signed().is_Some()) { + nativeBuilder.signed(ToNative.SignedPartsList(dafnyValue.dtor_signed().dtor_value())); + } + if (dafnyValue.dtor_constructors().is_Some()) { + nativeBuilder.constructors(ToNative.ConstructorList(dafnyValue.dtor_constructors().dtor_value())); + } + return nativeBuilder.build(); + } + + public static Constructor Constructor( + software.amazon.cryptography.dbencryptionsdk.dynamodb.internaldafny.types.Constructor dafnyValue) { + Constructor.Builder nativeBuilder = Constructor.builder(); + nativeBuilder.parts(ToNative.ConstructorPartList(dafnyValue.dtor_parts())); + return nativeBuilder.build(); + } + + public static ConstructorPart ConstructorPart( + software.amazon.cryptography.dbencryptionsdk.dynamodb.internaldafny.types.ConstructorPart dafnyValue) { + ConstructorPart.Builder nativeBuilder = ConstructorPart.builder(); + nativeBuilder.name(software.amazon.smithy.dafny.conversion.ToNative.Simple.String(dafnyValue.dtor_name())); + nativeBuilder.required((dafnyValue.dtor_required())); + return nativeBuilder.build(); + } + + public static CreateDynamoDbEncryptionBranchKeyIdSupplierInput CreateDynamoDbEncryptionBranchKeyIdSupplierInput( + software.amazon.cryptography.dbencryptionsdk.dynamodb.internaldafny.types.CreateDynamoDbEncryptionBranchKeyIdSupplierInput dafnyValue) { + CreateDynamoDbEncryptionBranchKeyIdSupplierInput.Builder nativeBuilder = CreateDynamoDbEncryptionBranchKeyIdSupplierInput.builder(); + nativeBuilder.ddbKeyBranchKeyIdSupplier(ToNative.DynamoDbKeyBranchKeyIdSupplier(dafnyValue.dtor_ddbKeyBranchKeyIdSupplier())); + return nativeBuilder.build(); + } + + public static CreateDynamoDbEncryptionBranchKeyIdSupplierOutput CreateDynamoDbEncryptionBranchKeyIdSupplierOutput( + software.amazon.cryptography.dbencryptionsdk.dynamodb.internaldafny.types.CreateDynamoDbEncryptionBranchKeyIdSupplierOutput dafnyValue) { + CreateDynamoDbEncryptionBranchKeyIdSupplierOutput.Builder nativeBuilder = CreateDynamoDbEncryptionBranchKeyIdSupplierOutput.builder(); + nativeBuilder.branchKeyIdSupplier(software.amazon.cryptography.materialproviders.ToNative.BranchKeyIdSupplier(dafnyValue.dtor_branchKeyIdSupplier())); + return nativeBuilder.build(); + } + + public static DynamoDbEncryptionConfig DynamoDbEncryptionConfig( + software.amazon.cryptography.dbencryptionsdk.dynamodb.internaldafny.types.DynamoDbEncryptionConfig dafnyValue) { + DynamoDbEncryptionConfig.Builder nativeBuilder = DynamoDbEncryptionConfig.builder(); + return nativeBuilder.build(); + } + + public static DynamoDbTableEncryptionConfig DynamoDbTableEncryptionConfig( + software.amazon.cryptography.dbencryptionsdk.dynamodb.internaldafny.types.DynamoDbTableEncryptionConfig dafnyValue) { + DynamoDbTableEncryptionConfig.Builder nativeBuilder = DynamoDbTableEncryptionConfig.builder(); + nativeBuilder.logicalTableName(software.amazon.smithy.dafny.conversion.ToNative.Simple.String(dafnyValue.dtor_logicalTableName())); + nativeBuilder.partitionKeyName(software.amazon.smithy.dafny.conversion.ToNative.Simple.String(dafnyValue.dtor_partitionKeyName())); + if (dafnyValue.dtor_sortKeyName().is_Some()) { + nativeBuilder.sortKeyName(software.amazon.smithy.dafny.conversion.ToNative.Simple.String(dafnyValue.dtor_sortKeyName().dtor_value())); + } + if (dafnyValue.dtor_search().is_Some()) { + nativeBuilder.search(ToNative.SearchConfig(dafnyValue.dtor_search().dtor_value())); + } + nativeBuilder.attributeActionsOnEncrypt(ToNative.AttributeActions(dafnyValue.dtor_attributeActionsOnEncrypt())); + if (dafnyValue.dtor_allowedUnsignedAttributes().is_Some()) { + nativeBuilder.allowedUnsignedAttributes(software.amazon.cryptography.services.dynamodb.internaldafny.ToNative.AttributeNameList(dafnyValue.dtor_allowedUnsignedAttributes().dtor_value())); + } + if (dafnyValue.dtor_allowedUnsignedAttributePrefix().is_Some()) { + nativeBuilder.allowedUnsignedAttributePrefix(software.amazon.smithy.dafny.conversion.ToNative.Simple.String(dafnyValue.dtor_allowedUnsignedAttributePrefix().dtor_value())); + } + if (dafnyValue.dtor_algorithmSuiteId().is_Some()) { + nativeBuilder.algorithmSuiteId(software.amazon.cryptography.materialproviders.ToNative.DBEAlgorithmSuiteId(dafnyValue.dtor_algorithmSuiteId().dtor_value())); + } + if (dafnyValue.dtor_keyring().is_Some()) { + nativeBuilder.keyring(software.amazon.cryptography.materialproviders.ToNative.Keyring(dafnyValue.dtor_keyring().dtor_value())); + } + if (dafnyValue.dtor_cmm().is_Some()) { + nativeBuilder.cmm(software.amazon.cryptography.materialproviders.ToNative.CryptographicMaterialsManager(dafnyValue.dtor_cmm().dtor_value())); + } + if (dafnyValue.dtor_legacyOverride().is_Some()) { + nativeBuilder.legacyOverride(ToNative.LegacyOverride(dafnyValue.dtor_legacyOverride().dtor_value())); + } + if (dafnyValue.dtor_plaintextOverride().is_Some()) { + nativeBuilder.plaintextOverride(ToNative.PlaintextOverride(dafnyValue.dtor_plaintextOverride().dtor_value())); + } + return nativeBuilder.build(); + } + + public static DynamoDbTablesEncryptionConfig DynamoDbTablesEncryptionConfig( + software.amazon.cryptography.dbencryptionsdk.dynamodb.internaldafny.types.DynamoDbTablesEncryptionConfig dafnyValue) { + DynamoDbTablesEncryptionConfig.Builder nativeBuilder = DynamoDbTablesEncryptionConfig.builder(); + nativeBuilder.tableEncryptionConfigs(ToNative.DynamoDbTableEncryptionConfigList(dafnyValue.dtor_tableEncryptionConfigs())); + return nativeBuilder.build(); + } + + public static EncryptedDataKeyDescriptionOutput EncryptedDataKeyDescriptionOutput( + software.amazon.cryptography.dbencryptionsdk.dynamodb.internaldafny.types.EncryptedDataKeyDescriptionOutput dafnyValue) { + EncryptedDataKeyDescriptionOutput.Builder nativeBuilder = EncryptedDataKeyDescriptionOutput.builder(); + nativeBuilder.keyProviderId(software.amazon.smithy.dafny.conversion.ToNative.Simple.String(dafnyValue.dtor_keyProviderId())); + if (dafnyValue.dtor_keyProviderInfo().is_Some()) { + nativeBuilder.keyProviderInfo(software.amazon.smithy.dafny.conversion.ToNative.Simple.String(dafnyValue.dtor_keyProviderInfo().dtor_value())); + } + if (dafnyValue.dtor_branchKeyId().is_Some()) { + nativeBuilder.branchKeyId(software.amazon.smithy.dafny.conversion.ToNative.Simple.String(dafnyValue.dtor_branchKeyId().dtor_value())); + } + if (dafnyValue.dtor_branchKeyVersion().is_Some()) { + nativeBuilder.branchKeyVersion(software.amazon.smithy.dafny.conversion.ToNative.Simple.String(dafnyValue.dtor_branchKeyVersion().dtor_value())); + } + return nativeBuilder.build(); + } + + public static EncryptedPart EncryptedPart( + software.amazon.cryptography.dbencryptionsdk.dynamodb.internaldafny.types.EncryptedPart dafnyValue) { + EncryptedPart.Builder nativeBuilder = EncryptedPart.builder(); + nativeBuilder.name(software.amazon.smithy.dafny.conversion.ToNative.Simple.String(dafnyValue.dtor_name())); + nativeBuilder.prefix(software.amazon.smithy.dafny.conversion.ToNative.Simple.String(dafnyValue.dtor_prefix())); + return nativeBuilder.build(); + } + + public static GetBranchKeyIdFromDdbKeyInput GetBranchKeyIdFromDdbKeyInput( + software.amazon.cryptography.dbencryptionsdk.dynamodb.internaldafny.types.GetBranchKeyIdFromDdbKeyInput dafnyValue) { + GetBranchKeyIdFromDdbKeyInput.Builder nativeBuilder = GetBranchKeyIdFromDdbKeyInput.builder(); + nativeBuilder.ddbKey(software.amazon.cryptography.services.dynamodb.internaldafny.ToNative.Key(dafnyValue.dtor_ddbKey())); + return nativeBuilder.build(); + } + + public static GetBranchKeyIdFromDdbKeyOutput GetBranchKeyIdFromDdbKeyOutput( + software.amazon.cryptography.dbencryptionsdk.dynamodb.internaldafny.types.GetBranchKeyIdFromDdbKeyOutput dafnyValue) { + GetBranchKeyIdFromDdbKeyOutput.Builder nativeBuilder = GetBranchKeyIdFromDdbKeyOutput.builder(); + nativeBuilder.branchKeyId(software.amazon.smithy.dafny.conversion.ToNative.Simple.String(dafnyValue.dtor_branchKeyId())); + return nativeBuilder.build(); + } + + public static GetEncryptedDataKeyDescriptionInput GetEncryptedDataKeyDescriptionInput( + software.amazon.cryptography.dbencryptionsdk.dynamodb.internaldafny.types.GetEncryptedDataKeyDescriptionInput dafnyValue) { + GetEncryptedDataKeyDescriptionInput.Builder nativeBuilder = GetEncryptedDataKeyDescriptionInput.builder(); + nativeBuilder.input(ToNative.GetEncryptedDataKeyDescriptionUnion(dafnyValue.dtor_input())); + return nativeBuilder.build(); + } + + public static GetEncryptedDataKeyDescriptionOutput GetEncryptedDataKeyDescriptionOutput( + software.amazon.cryptography.dbencryptionsdk.dynamodb.internaldafny.types.GetEncryptedDataKeyDescriptionOutput dafnyValue) { + GetEncryptedDataKeyDescriptionOutput.Builder nativeBuilder = GetEncryptedDataKeyDescriptionOutput.builder(); + nativeBuilder.EncryptedDataKeyDescriptionOutput(ToNative.EncryptedDataKeyDescriptionList(dafnyValue.dtor_EncryptedDataKeyDescriptionOutput())); + return nativeBuilder.build(); + } + + public static GetPrefix GetPrefix( + software.amazon.cryptography.dbencryptionsdk.dynamodb.internaldafny.types.GetPrefix dafnyValue) { + GetPrefix.Builder nativeBuilder = GetPrefix.builder(); + nativeBuilder.length((dafnyValue.dtor_length())); + return nativeBuilder.build(); + } + + public static GetSegment GetSegment( + software.amazon.cryptography.dbencryptionsdk.dynamodb.internaldafny.types.GetSegment dafnyValue) { + GetSegment.Builder nativeBuilder = GetSegment.builder(); + nativeBuilder.split(software.amazon.smithy.dafny.conversion.ToNative.Simple.String(dafnyValue.dtor_split())); + nativeBuilder.index((dafnyValue.dtor_index())); + return nativeBuilder.build(); + } + + public static GetSegments GetSegments( + software.amazon.cryptography.dbencryptionsdk.dynamodb.internaldafny.types.GetSegments dafnyValue) { + GetSegments.Builder nativeBuilder = GetSegments.builder(); + nativeBuilder.split(software.amazon.smithy.dafny.conversion.ToNative.Simple.String(dafnyValue.dtor_split())); + nativeBuilder.low((dafnyValue.dtor_low())); + nativeBuilder.high((dafnyValue.dtor_high())); + return nativeBuilder.build(); + } + + public static GetSubstring GetSubstring( + software.amazon.cryptography.dbencryptionsdk.dynamodb.internaldafny.types.GetSubstring dafnyValue) { + GetSubstring.Builder nativeBuilder = GetSubstring.builder(); + nativeBuilder.low((dafnyValue.dtor_low())); + nativeBuilder.high((dafnyValue.dtor_high())); + return nativeBuilder.build(); + } + + public static GetSuffix GetSuffix( + software.amazon.cryptography.dbencryptionsdk.dynamodb.internaldafny.types.GetSuffix dafnyValue) { + GetSuffix.Builder nativeBuilder = GetSuffix.builder(); + nativeBuilder.length((dafnyValue.dtor_length())); + return nativeBuilder.build(); + } + + public static Insert Insert( + software.amazon.cryptography.dbencryptionsdk.dynamodb.internaldafny.types.Insert dafnyValue) { + Insert.Builder nativeBuilder = Insert.builder(); + nativeBuilder.literal(software.amazon.smithy.dafny.conversion.ToNative.Simple.String(dafnyValue.dtor_literal())); + return nativeBuilder.build(); + } + + public static LegacyOverride LegacyOverride( + software.amazon.cryptography.dbencryptionsdk.dynamodb.internaldafny.types.LegacyOverride dafnyValue) { + LegacyOverride.Builder nativeBuilder = LegacyOverride.builder(); + nativeBuilder.policy(ToNative.LegacyPolicy(dafnyValue.dtor_policy())); + nativeBuilder.encryptor(ToNative.LegacyDynamoDbEncryptor(dafnyValue.dtor_encryptor())); + nativeBuilder.attributeActionsOnEncrypt(ToNative.AttributeActions(dafnyValue.dtor_attributeActionsOnEncrypt())); + if (dafnyValue.dtor_defaultAttributeFlag().is_Some()) { + nativeBuilder.defaultAttributeFlag(software.amazon.cryptography.dbencryptionsdk.structuredencryption.ToNative.CryptoAction(dafnyValue.dtor_defaultAttributeFlag().dtor_value())); + } + return nativeBuilder.build(); + } + + public static Lower Lower( + software.amazon.cryptography.dbencryptionsdk.dynamodb.internaldafny.types.Lower dafnyValue) { + Lower.Builder nativeBuilder = Lower.builder(); + return nativeBuilder.build(); + } + + public static MultiKeyStore MultiKeyStore( + software.amazon.cryptography.dbencryptionsdk.dynamodb.internaldafny.types.MultiKeyStore dafnyValue) { + MultiKeyStore.Builder nativeBuilder = MultiKeyStore.builder(); + nativeBuilder.keyFieldName(software.amazon.smithy.dafny.conversion.ToNative.Simple.String(dafnyValue.dtor_keyFieldName())); + nativeBuilder.cacheTTL((dafnyValue.dtor_cacheTTL())); + if (dafnyValue.dtor_cache().is_Some()) { + nativeBuilder.cache(software.amazon.cryptography.materialproviders.ToNative.CacheType(dafnyValue.dtor_cache().dtor_value())); + } + return nativeBuilder.build(); + } + + public static PartOnly PartOnly( + software.amazon.cryptography.dbencryptionsdk.dynamodb.internaldafny.types.PartOnly dafnyValue) { + PartOnly.Builder nativeBuilder = PartOnly.builder(); + return nativeBuilder.build(); + } + + public static SearchConfig SearchConfig( + software.amazon.cryptography.dbencryptionsdk.dynamodb.internaldafny.types.SearchConfig dafnyValue) { + SearchConfig.Builder nativeBuilder = SearchConfig.builder(); + nativeBuilder.versions(ToNative.BeaconVersionList(dafnyValue.dtor_versions())); + nativeBuilder.writeVersion((dafnyValue.dtor_writeVersion())); + return nativeBuilder.build(); + } + + public static Shared Shared( + software.amazon.cryptography.dbencryptionsdk.dynamodb.internaldafny.types.Shared dafnyValue) { + Shared.Builder nativeBuilder = Shared.builder(); + nativeBuilder.other(software.amazon.smithy.dafny.conversion.ToNative.Simple.String(dafnyValue.dtor_other())); + return nativeBuilder.build(); + } + + public static SharedSet SharedSet( + software.amazon.cryptography.dbencryptionsdk.dynamodb.internaldafny.types.SharedSet dafnyValue) { + SharedSet.Builder nativeBuilder = SharedSet.builder(); + nativeBuilder.other(software.amazon.smithy.dafny.conversion.ToNative.Simple.String(dafnyValue.dtor_other())); + return nativeBuilder.build(); + } + + public static SignedPart SignedPart( + software.amazon.cryptography.dbencryptionsdk.dynamodb.internaldafny.types.SignedPart dafnyValue) { + SignedPart.Builder nativeBuilder = SignedPart.builder(); + nativeBuilder.name(software.amazon.smithy.dafny.conversion.ToNative.Simple.String(dafnyValue.dtor_name())); + nativeBuilder.prefix(software.amazon.smithy.dafny.conversion.ToNative.Simple.String(dafnyValue.dtor_prefix())); + if (dafnyValue.dtor_loc().is_Some()) { + nativeBuilder.loc(software.amazon.smithy.dafny.conversion.ToNative.Simple.String(dafnyValue.dtor_loc().dtor_value())); + } + return nativeBuilder.build(); + } + + public static SingleKeyStore SingleKeyStore( + software.amazon.cryptography.dbencryptionsdk.dynamodb.internaldafny.types.SingleKeyStore dafnyValue) { + SingleKeyStore.Builder nativeBuilder = SingleKeyStore.builder(); + nativeBuilder.keyId(software.amazon.smithy.dafny.conversion.ToNative.Simple.String(dafnyValue.dtor_keyId())); + nativeBuilder.cacheTTL((dafnyValue.dtor_cacheTTL())); + return nativeBuilder.build(); + } + + public static StandardBeacon StandardBeacon( + software.amazon.cryptography.dbencryptionsdk.dynamodb.internaldafny.types.StandardBeacon dafnyValue) { + StandardBeacon.Builder nativeBuilder = StandardBeacon.builder(); + nativeBuilder.name(software.amazon.smithy.dafny.conversion.ToNative.Simple.String(dafnyValue.dtor_name())); + nativeBuilder.length((dafnyValue.dtor_length())); + if (dafnyValue.dtor_loc().is_Some()) { + nativeBuilder.loc(software.amazon.smithy.dafny.conversion.ToNative.Simple.String(dafnyValue.dtor_loc().dtor_value())); + } + if (dafnyValue.dtor_style().is_Some()) { + nativeBuilder.style(ToNative.BeaconStyle(dafnyValue.dtor_style().dtor_value())); + } + return nativeBuilder.build(); + } + + public static Upper Upper( + software.amazon.cryptography.dbencryptionsdk.dynamodb.internaldafny.types.Upper dafnyValue) { + Upper.Builder nativeBuilder = Upper.builder(); + return nativeBuilder.build(); + } + + public static VirtualField VirtualField( + software.amazon.cryptography.dbencryptionsdk.dynamodb.internaldafny.types.VirtualField dafnyValue) { + VirtualField.Builder nativeBuilder = VirtualField.builder(); + nativeBuilder.name(software.amazon.smithy.dafny.conversion.ToNative.Simple.String(dafnyValue.dtor_name())); + nativeBuilder.parts(ToNative.VirtualPartList(dafnyValue.dtor_parts())); + return nativeBuilder.build(); + } + + public static VirtualPart VirtualPart( + software.amazon.cryptography.dbencryptionsdk.dynamodb.internaldafny.types.VirtualPart dafnyValue) { + VirtualPart.Builder nativeBuilder = VirtualPart.builder(); + nativeBuilder.loc(software.amazon.smithy.dafny.conversion.ToNative.Simple.String(dafnyValue.dtor_loc())); + if (dafnyValue.dtor_trans().is_Some()) { + nativeBuilder.trans(ToNative.VirtualTransformList(dafnyValue.dtor_trans().dtor_value())); + } + return nativeBuilder.build(); + } + + public static LegacyPolicy LegacyPolicy( + software.amazon.cryptography.dbencryptionsdk.dynamodb.internaldafny.types.LegacyPolicy dafnyValue) { + if (dafnyValue.is_FORCE__LEGACY__ENCRYPT__ALLOW__LEGACY__DECRYPT()) { + return LegacyPolicy.FORCE_LEGACY_ENCRYPT_ALLOW_LEGACY_DECRYPT; + } + if (dafnyValue.is_FORBID__LEGACY__ENCRYPT__ALLOW__LEGACY__DECRYPT()) { + return LegacyPolicy.FORBID_LEGACY_ENCRYPT_ALLOW_LEGACY_DECRYPT; + } + if (dafnyValue.is_FORBID__LEGACY__ENCRYPT__FORBID__LEGACY__DECRYPT()) { + return LegacyPolicy.FORBID_LEGACY_ENCRYPT_FORBID_LEGACY_DECRYPT; + } + throw new IllegalArgumentException("No entry of software.amazon.cryptography.dbencryptionsdk.dynamodb.model.LegacyPolicy matches the input : " + dafnyValue); + } + + public static PlaintextOverride PlaintextOverride( + software.amazon.cryptography.dbencryptionsdk.dynamodb.internaldafny.types.PlaintextOverride dafnyValue) { + if (dafnyValue.is_FORCE__PLAINTEXT__WRITE__ALLOW__PLAINTEXT__READ()) { + return PlaintextOverride.FORCE_PLAINTEXT_WRITE_ALLOW_PLAINTEXT_READ; + } + if (dafnyValue.is_FORBID__PLAINTEXT__WRITE__ALLOW__PLAINTEXT__READ()) { + return PlaintextOverride.FORBID_PLAINTEXT_WRITE_ALLOW_PLAINTEXT_READ; + } + if (dafnyValue.is_FORBID__PLAINTEXT__WRITE__FORBID__PLAINTEXT__READ()) { + return PlaintextOverride.FORBID_PLAINTEXT_WRITE_FORBID_PLAINTEXT_READ; + } + throw new IllegalArgumentException("No entry of software.amazon.cryptography.dbencryptionsdk.dynamodb.model.PlaintextOverride matches the input : " + dafnyValue); + } + + public static BeaconKeySource BeaconKeySource( + software.amazon.cryptography.dbencryptionsdk.dynamodb.internaldafny.types.BeaconKeySource dafnyValue) { + BeaconKeySource.Builder nativeBuilder = BeaconKeySource.builder(); + if (dafnyValue.is_single()) { + nativeBuilder.single(ToNative.SingleKeyStore(dafnyValue.dtor_single())); + } + if (dafnyValue.is_multi()) { + nativeBuilder.multi(ToNative.MultiKeyStore(dafnyValue.dtor_multi())); + } + return nativeBuilder.build(); + } + + public static BeaconStyle BeaconStyle( + software.amazon.cryptography.dbencryptionsdk.dynamodb.internaldafny.types.BeaconStyle dafnyValue) { + BeaconStyle.Builder nativeBuilder = BeaconStyle.builder(); + if (dafnyValue.is_partOnly()) { + nativeBuilder.partOnly(ToNative.PartOnly(dafnyValue.dtor_partOnly())); + } + if (dafnyValue.is_shared()) { + nativeBuilder.shared(ToNative.Shared(dafnyValue.dtor_shared())); + } + if (dafnyValue.is_asSet()) { + nativeBuilder.asSet(ToNative.AsSet(dafnyValue.dtor_asSet())); + } + if (dafnyValue.is_sharedSet()) { + nativeBuilder.sharedSet(ToNative.SharedSet(dafnyValue.dtor_sharedSet())); + } + return nativeBuilder.build(); + } + + public static GetEncryptedDataKeyDescriptionUnion GetEncryptedDataKeyDescriptionUnion( + software.amazon.cryptography.dbencryptionsdk.dynamodb.internaldafny.types.GetEncryptedDataKeyDescriptionUnion dafnyValue) { + GetEncryptedDataKeyDescriptionUnion.Builder nativeBuilder = GetEncryptedDataKeyDescriptionUnion.builder(); + if (dafnyValue.is_header()) { + nativeBuilder.header(software.amazon.smithy.dafny.conversion.ToNative.Simple.ByteBuffer(dafnyValue.dtor_header())); + } + if (dafnyValue.is_plaintextItem()) { + nativeBuilder.plaintextItem(software.amazon.cryptography.services.dynamodb.internaldafny.ToNative.AttributeMap(dafnyValue.dtor_plaintextItem())); + } + return nativeBuilder.build(); + } + + public static VirtualTransform VirtualTransform( + software.amazon.cryptography.dbencryptionsdk.dynamodb.internaldafny.types.VirtualTransform dafnyValue) { + VirtualTransform.Builder nativeBuilder = VirtualTransform.builder(); + if (dafnyValue.is_upper()) { + nativeBuilder.upper(ToNative.Upper(dafnyValue.dtor_upper())); + } + if (dafnyValue.is_lower()) { + nativeBuilder.lower(ToNative.Lower(dafnyValue.dtor_lower())); + } + if (dafnyValue.is_insert()) { + nativeBuilder.insert(ToNative.Insert(dafnyValue.dtor_insert())); + } + if (dafnyValue.is_prefix()) { + nativeBuilder.prefix(ToNative.GetPrefix(dafnyValue.dtor_prefix())); + } + if (dafnyValue.is_suffix()) { + nativeBuilder.suffix(ToNative.GetSuffix(dafnyValue.dtor_suffix())); + } + if (dafnyValue.is_substring()) { + nativeBuilder.substring(ToNative.GetSubstring(dafnyValue.dtor_substring())); + } + if (dafnyValue.is_segment()) { + nativeBuilder.segment(ToNative.GetSegment(dafnyValue.dtor_segment())); + } + if (dafnyValue.is_segments()) { + nativeBuilder.segments(ToNative.GetSegments(dafnyValue.dtor_segments())); + } + return nativeBuilder.build(); + } + + public static List BeaconVersionList( + DafnySequence dafnyValue) { + return software.amazon.smithy.dafny.conversion.ToNative.Aggregate.GenericToList( + dafnyValue, + software.amazon.cryptography.dbencryptionsdk.dynamodb.ToNative::BeaconVersion); + } + + public static List CompoundBeaconList( + DafnySequence dafnyValue) { + return software.amazon.smithy.dafny.conversion.ToNative.Aggregate.GenericToList( + dafnyValue, + software.amazon.cryptography.dbencryptionsdk.dynamodb.ToNative::CompoundBeacon); + } + + public static List ConstructorList( + DafnySequence dafnyValue) { + return software.amazon.smithy.dafny.conversion.ToNative.Aggregate.GenericToList( + dafnyValue, + software.amazon.cryptography.dbencryptionsdk.dynamodb.ToNative::Constructor); + } + + public static List ConstructorPartList( + DafnySequence dafnyValue) { + return software.amazon.smithy.dafny.conversion.ToNative.Aggregate.GenericToList( + dafnyValue, + software.amazon.cryptography.dbencryptionsdk.dynamodb.ToNative::ConstructorPart); + } + + public static List EncryptedDataKeyDescriptionList( + DafnySequence dafnyValue) { + return software.amazon.smithy.dafny.conversion.ToNative.Aggregate.GenericToList( + dafnyValue, + software.amazon.cryptography.dbencryptionsdk.dynamodb.ToNative::EncryptedDataKeyDescriptionOutput); + } + + public static List EncryptedPartsList( + DafnySequence dafnyValue) { + return software.amazon.smithy.dafny.conversion.ToNative.Aggregate.GenericToList( + dafnyValue, + software.amazon.cryptography.dbencryptionsdk.dynamodb.ToNative::EncryptedPart); + } + + public static List SignedPartsList( + DafnySequence dafnyValue) { + return software.amazon.smithy.dafny.conversion.ToNative.Aggregate.GenericToList( + dafnyValue, + software.amazon.cryptography.dbencryptionsdk.dynamodb.ToNative::SignedPart); + } + + public static List StandardBeaconList( + DafnySequence dafnyValue) { + return software.amazon.smithy.dafny.conversion.ToNative.Aggregate.GenericToList( + dafnyValue, + software.amazon.cryptography.dbencryptionsdk.dynamodb.ToNative::StandardBeacon); + } + + public static List VirtualFieldList( + DafnySequence dafnyValue) { + return software.amazon.smithy.dafny.conversion.ToNative.Aggregate.GenericToList( + dafnyValue, + software.amazon.cryptography.dbencryptionsdk.dynamodb.ToNative::VirtualField); + } + + public static List VirtualPartList( + DafnySequence dafnyValue) { + return software.amazon.smithy.dafny.conversion.ToNative.Aggregate.GenericToList( + dafnyValue, + software.amazon.cryptography.dbencryptionsdk.dynamodb.ToNative::VirtualPart); + } + + public static List VirtualTransformList( + DafnySequence dafnyValue) { + return software.amazon.smithy.dafny.conversion.ToNative.Aggregate.GenericToList( + dafnyValue, + software.amazon.cryptography.dbencryptionsdk.dynamodb.ToNative::VirtualTransform); + } + + public static Map AttributeActions( + DafnyMap, ? extends software.amazon.cryptography.dbencryptionsdk.structuredencryption.internaldafny.types.CryptoAction> dafnyValue) { + return software.amazon.smithy.dafny.conversion.ToNative.Aggregate.GenericToMap( + dafnyValue, + software.amazon.smithy.dafny.conversion.ToNative.Simple::String, + software.amazon.cryptography.dbencryptionsdk.structuredencryption.ToNative::CryptoAction); + } + + public static Map DynamoDbTableEncryptionConfigList( + DafnyMap, ? extends software.amazon.cryptography.dbencryptionsdk.dynamodb.internaldafny.types.DynamoDbTableEncryptionConfig> dafnyValue) { + return software.amazon.smithy.dafny.conversion.ToNative.Aggregate.GenericToMap( + dafnyValue, + software.amazon.smithy.dafny.conversion.ToNative.Simple::String, + software.amazon.cryptography.dbencryptionsdk.dynamodb.ToNative::DynamoDbTableEncryptionConfig); + } + + public static IDynamoDbKeyBranchKeyIdSupplier DynamoDbKeyBranchKeyIdSupplier( + software.amazon.cryptography.dbencryptionsdk.dynamodb.internaldafny.types.IDynamoDbKeyBranchKeyIdSupplier dafnyValue) { + if (dafnyValue instanceof DynamoDbKeyBranchKeyIdSupplier.NativeWrapper) { + return ((DynamoDbKeyBranchKeyIdSupplier.NativeWrapper) dafnyValue)._impl; + } + return DynamoDbKeyBranchKeyIdSupplier.wrap(dafnyValue); + } + + public static ILegacyDynamoDbEncryptor LegacyDynamoDbEncryptor( + software.amazon.cryptography.dbencryptionsdk.dynamodb.internaldafny.types.ILegacyDynamoDbEncryptor dafnyValue) { + if (dafnyValue instanceof LegacyDynamoDbEncryptor.NativeWrapper) { + return ((LegacyDynamoDbEncryptor.NativeWrapper) dafnyValue)._impl; + } + return LegacyDynamoDbEncryptor.wrap(dafnyValue); + } + + public static DynamoDbEncryption DynamoDbEncryption(IDynamoDbEncryptionClient dafnyValue) { + return new DynamoDbEncryption(dafnyValue); + } +} diff --git a/TestVectors/runtimes/java/src/main/smithy-generated/software/amazon/cryptography/dbencryptionsdk/dynamodb/model/AsSet.java b/TestVectors/runtimes/java/src/main/smithy-generated/software/amazon/cryptography/dbencryptionsdk/dynamodb/model/AsSet.java new file mode 100644 index 000000000..0c217c8b6 --- /dev/null +++ b/TestVectors/runtimes/java/src/main/smithy-generated/software/amazon/cryptography/dbencryptionsdk/dynamodb/model/AsSet.java @@ -0,0 +1,36 @@ +// Copyright Amazon.com Inc. or its affiliates. All Rights Reserved. +// SPDX-License-Identifier: Apache-2.0 +// Do not modify this file. This file is machine generated, and any changes to it will be overwritten. +package software.amazon.cryptography.dbencryptionsdk.dynamodb.model; + +/** + * Attribute must be a Set. Beacon value will also be a Set. + */ +public class AsSet { + protected AsSet(BuilderImpl builder) { + } + + public Builder toBuilder() { + return new BuilderImpl(this); + } + + public static Builder builder() { + return new BuilderImpl(); + } + + public interface Builder { + AsSet build(); + } + + static class BuilderImpl implements Builder { + protected BuilderImpl() { + } + + protected BuilderImpl(AsSet model) { + } + + public AsSet build() { + return new AsSet(this); + } + } +} diff --git a/TestVectors/runtimes/java/src/main/smithy-generated/software/amazon/cryptography/dbencryptionsdk/dynamodb/model/BeaconKeySource.java b/TestVectors/runtimes/java/src/main/smithy-generated/software/amazon/cryptography/dbencryptionsdk/dynamodb/model/BeaconKeySource.java new file mode 100644 index 000000000..497eb096f --- /dev/null +++ b/TestVectors/runtimes/java/src/main/smithy-generated/software/amazon/cryptography/dbencryptionsdk/dynamodb/model/BeaconKeySource.java @@ -0,0 +1,122 @@ +// Copyright Amazon.com Inc. or its affiliates. All Rights Reserved. +// SPDX-License-Identifier: Apache-2.0 +// Do not modify this file. This file is machine generated, and any changes to it will be overwritten. +package software.amazon.cryptography.dbencryptionsdk.dynamodb.model; + +import java.util.Objects; + +public class BeaconKeySource { + /** + * The configuration for using a single Beacon Key. + */ + private final SingleKeyStore single; + + /** + * The configuration for using multiple Beacon Keys. + */ + private final MultiKeyStore multi; + + protected BeaconKeySource(BuilderImpl builder) { + this.single = builder.single(); + this.multi = builder.multi(); + } + + /** + * @return The configuration for using a single Beacon Key. + */ + public SingleKeyStore single() { + return this.single; + } + + /** + * @return The configuration for using multiple Beacon Keys. + */ + public MultiKeyStore multi() { + return this.multi; + } + + public Builder toBuilder() { + return new BuilderImpl(this); + } + + public static Builder builder() { + return new BuilderImpl(); + } + + public interface Builder { + /** + * @param single The configuration for using a single Beacon Key. + */ + Builder single(SingleKeyStore single); + + /** + * @return The configuration for using a single Beacon Key. + */ + SingleKeyStore single(); + + /** + * @param multi The configuration for using multiple Beacon Keys. + */ + Builder multi(MultiKeyStore multi); + + /** + * @return The configuration for using multiple Beacon Keys. + */ + MultiKeyStore multi(); + + BeaconKeySource build(); + } + + static class BuilderImpl implements Builder { + protected SingleKeyStore single; + + protected MultiKeyStore multi; + + protected BuilderImpl() { + } + + protected BuilderImpl(BeaconKeySource model) { + this.single = model.single(); + this.multi = model.multi(); + } + + public Builder single(SingleKeyStore single) { + this.single = single; + return this; + } + + public SingleKeyStore single() { + return this.single; + } + + public Builder multi(MultiKeyStore multi) { + this.multi = multi; + return this; + } + + public MultiKeyStore multi() { + return this.multi; + } + + public BeaconKeySource build() { + if (!onlyOneNonNull()) { + throw new IllegalArgumentException("`BeaconKeySource` is a Union. A Union MUST have one and only one value set."); + } + return new BeaconKeySource(this); + } + + private boolean onlyOneNonNull() { + Object[] allValues = {this.single, this.multi}; + boolean haveOneNonNull = false; + for (Object o : allValues) { + if (Objects.nonNull(o)) { + if (haveOneNonNull) { + return false; + } + haveOneNonNull = true; + } + } + return haveOneNonNull; + } + } +} diff --git a/TestVectors/runtimes/java/src/main/smithy-generated/software/amazon/cryptography/dbencryptionsdk/dynamodb/model/BeaconStyle.java b/TestVectors/runtimes/java/src/main/smithy-generated/software/amazon/cryptography/dbencryptionsdk/dynamodb/model/BeaconStyle.java new file mode 100644 index 000000000..faf05ebea --- /dev/null +++ b/TestVectors/runtimes/java/src/main/smithy-generated/software/amazon/cryptography/dbencryptionsdk/dynamodb/model/BeaconStyle.java @@ -0,0 +1,192 @@ +// Copyright Amazon.com Inc. or its affiliates. All Rights Reserved. +// SPDX-License-Identifier: Apache-2.0 +// Do not modify this file. This file is machine generated, and any changes to it will be overwritten. +package software.amazon.cryptography.dbencryptionsdk.dynamodb.model; + +import java.util.Objects; + +public class BeaconStyle { + /** + * Attribute must be used as part of a Compound Beacon, never alone. + */ + private final PartOnly partOnly; + + /** + * This beacon should calculate values like another beacon, so they can be compared. + */ + private final Shared shared; + + /** + * Attribute must be a Set. Beacon value will also be a Set. + */ + private final AsSet asSet; + + /** + * Both Shared and AsSet. + */ + private final SharedSet sharedSet; + + protected BeaconStyle(BuilderImpl builder) { + this.partOnly = builder.partOnly(); + this.shared = builder.shared(); + this.asSet = builder.asSet(); + this.sharedSet = builder.sharedSet(); + } + + /** + * @return Attribute must be used as part of a Compound Beacon, never alone. + */ + public PartOnly partOnly() { + return this.partOnly; + } + + /** + * @return This beacon should calculate values like another beacon, so they can be compared. + */ + public Shared shared() { + return this.shared; + } + + /** + * @return Attribute must be a Set. Beacon value will also be a Set. + */ + public AsSet asSet() { + return this.asSet; + } + + /** + * @return Both Shared and AsSet. + */ + public SharedSet sharedSet() { + return this.sharedSet; + } + + public Builder toBuilder() { + return new BuilderImpl(this); + } + + public static Builder builder() { + return new BuilderImpl(); + } + + public interface Builder { + /** + * @param partOnly Attribute must be used as part of a Compound Beacon, never alone. + */ + Builder partOnly(PartOnly partOnly); + + /** + * @return Attribute must be used as part of a Compound Beacon, never alone. + */ + PartOnly partOnly(); + + /** + * @param shared This beacon should calculate values like another beacon, so they can be compared. + */ + Builder shared(Shared shared); + + /** + * @return This beacon should calculate values like another beacon, so they can be compared. + */ + Shared shared(); + + /** + * @param asSet Attribute must be a Set. Beacon value will also be a Set. + */ + Builder asSet(AsSet asSet); + + /** + * @return Attribute must be a Set. Beacon value will also be a Set. + */ + AsSet asSet(); + + /** + * @param sharedSet Both Shared and AsSet. + */ + Builder sharedSet(SharedSet sharedSet); + + /** + * @return Both Shared and AsSet. + */ + SharedSet sharedSet(); + + BeaconStyle build(); + } + + static class BuilderImpl implements Builder { + protected PartOnly partOnly; + + protected Shared shared; + + protected AsSet asSet; + + protected SharedSet sharedSet; + + protected BuilderImpl() { + } + + protected BuilderImpl(BeaconStyle model) { + this.partOnly = model.partOnly(); + this.shared = model.shared(); + this.asSet = model.asSet(); + this.sharedSet = model.sharedSet(); + } + + public Builder partOnly(PartOnly partOnly) { + this.partOnly = partOnly; + return this; + } + + public PartOnly partOnly() { + return this.partOnly; + } + + public Builder shared(Shared shared) { + this.shared = shared; + return this; + } + + public Shared shared() { + return this.shared; + } + + public Builder asSet(AsSet asSet) { + this.asSet = asSet; + return this; + } + + public AsSet asSet() { + return this.asSet; + } + + public Builder sharedSet(SharedSet sharedSet) { + this.sharedSet = sharedSet; + return this; + } + + public SharedSet sharedSet() { + return this.sharedSet; + } + + public BeaconStyle build() { + if (!onlyOneNonNull()) { + throw new IllegalArgumentException("`BeaconStyle` is a Union. A Union MUST have one and only one value set."); + } + return new BeaconStyle(this); + } + + private boolean onlyOneNonNull() { + Object[] allValues = {this.partOnly, this.shared, this.asSet, this.sharedSet}; + boolean haveOneNonNull = false; + for (Object o : allValues) { + if (Objects.nonNull(o)) { + if (haveOneNonNull) { + return false; + } + haveOneNonNull = true; + } + } + return haveOneNonNull; + } + } +} diff --git a/TestVectors/runtimes/java/src/main/smithy-generated/software/amazon/cryptography/dbencryptionsdk/dynamodb/model/BeaconVersion.java b/TestVectors/runtimes/java/src/main/smithy-generated/software/amazon/cryptography/dbencryptionsdk/dynamodb/model/BeaconVersion.java new file mode 100644 index 000000000..3bc307d61 --- /dev/null +++ b/TestVectors/runtimes/java/src/main/smithy-generated/software/amazon/cryptography/dbencryptionsdk/dynamodb/model/BeaconVersion.java @@ -0,0 +1,354 @@ +// Copyright Amazon.com Inc. or its affiliates. All Rights Reserved. +// SPDX-License-Identifier: Apache-2.0 +// Do not modify this file. This file is machine generated, and any changes to it will be overwritten. +package software.amazon.cryptography.dbencryptionsdk.dynamodb.model; + +import java.util.List; +import java.util.Objects; +import software.amazon.cryptography.keystore.KeyStore; + +/** + * The configuration for a particular version of searchable encryption. Currently the only supported version is '1'. + */ +public class BeaconVersion { + /** + * The version of searchable encryption configured. This must be '1'. + */ + private final int version; + + /** + * The Key Store that contains the Beacon Keys to use with searchable encryption. + */ + private final KeyStore keyStore; + + /** + * The configuration for what beacon key(s) to use. + */ + private final BeaconKeySource keySource; + + /** + * The Standard Beacons to be written with items. + */ + private final List standardBeacons; + + /** + * The Compound Beacons to be written with items. + */ + private final List compoundBeacons; + + /** + * The Virtual Fields to be calculated, supporting other searchable enryption configurations. + */ + private final List virtualFields; + + /** + * The list of Encrypted Parts that may be included in any compound beacon. + */ + private final List encryptedParts; + + /** + * The list of Signed Parts that may be included in any compound beacon. + */ + private final List signedParts; + + protected BeaconVersion(BuilderImpl builder) { + this.version = builder.version(); + this.keyStore = builder.keyStore(); + this.keySource = builder.keySource(); + this.standardBeacons = builder.standardBeacons(); + this.compoundBeacons = builder.compoundBeacons(); + this.virtualFields = builder.virtualFields(); + this.encryptedParts = builder.encryptedParts(); + this.signedParts = builder.signedParts(); + } + + /** + * @return The version of searchable encryption configured. This must be '1'. + */ + public int version() { + return this.version; + } + + /** + * @return The Key Store that contains the Beacon Keys to use with searchable encryption. + */ + public KeyStore keyStore() { + return this.keyStore; + } + + /** + * @return The configuration for what beacon key(s) to use. + */ + public BeaconKeySource keySource() { + return this.keySource; + } + + /** + * @return The Standard Beacons to be written with items. + */ + public List standardBeacons() { + return this.standardBeacons; + } + + /** + * @return The Compound Beacons to be written with items. + */ + public List compoundBeacons() { + return this.compoundBeacons; + } + + /** + * @return The Virtual Fields to be calculated, supporting other searchable enryption configurations. + */ + public List virtualFields() { + return this.virtualFields; + } + + /** + * @return The list of Encrypted Parts that may be included in any compound beacon. + */ + public List encryptedParts() { + return this.encryptedParts; + } + + /** + * @return The list of Signed Parts that may be included in any compound beacon. + */ + public List signedParts() { + return this.signedParts; + } + + public Builder toBuilder() { + return new BuilderImpl(this); + } + + public static Builder builder() { + return new BuilderImpl(); + } + + public interface Builder { + /** + * @param version The version of searchable encryption configured. This must be '1'. + */ + Builder version(int version); + + /** + * @return The version of searchable encryption configured. This must be '1'. + */ + int version(); + + /** + * @param keyStore The Key Store that contains the Beacon Keys to use with searchable encryption. + */ + Builder keyStore(KeyStore keyStore); + + /** + * @return The Key Store that contains the Beacon Keys to use with searchable encryption. + */ + KeyStore keyStore(); + + /** + * @param keySource The configuration for what beacon key(s) to use. + */ + Builder keySource(BeaconKeySource keySource); + + /** + * @return The configuration for what beacon key(s) to use. + */ + BeaconKeySource keySource(); + + /** + * @param standardBeacons The Standard Beacons to be written with items. + */ + Builder standardBeacons(List standardBeacons); + + /** + * @return The Standard Beacons to be written with items. + */ + List standardBeacons(); + + /** + * @param compoundBeacons The Compound Beacons to be written with items. + */ + Builder compoundBeacons(List compoundBeacons); + + /** + * @return The Compound Beacons to be written with items. + */ + List compoundBeacons(); + + /** + * @param virtualFields The Virtual Fields to be calculated, supporting other searchable enryption configurations. + */ + Builder virtualFields(List virtualFields); + + /** + * @return The Virtual Fields to be calculated, supporting other searchable enryption configurations. + */ + List virtualFields(); + + /** + * @param encryptedParts The list of Encrypted Parts that may be included in any compound beacon. + */ + Builder encryptedParts(List encryptedParts); + + /** + * @return The list of Encrypted Parts that may be included in any compound beacon. + */ + List encryptedParts(); + + /** + * @param signedParts The list of Signed Parts that may be included in any compound beacon. + */ + Builder signedParts(List signedParts); + + /** + * @return The list of Signed Parts that may be included in any compound beacon. + */ + List signedParts(); + + BeaconVersion build(); + } + + static class BuilderImpl implements Builder { + protected int version; + + private boolean _versionSet = false; + + protected KeyStore keyStore; + + protected BeaconKeySource keySource; + + protected List standardBeacons; + + protected List compoundBeacons; + + protected List virtualFields; + + protected List encryptedParts; + + protected List signedParts; + + protected BuilderImpl() { + } + + protected BuilderImpl(BeaconVersion model) { + this.version = model.version(); + this._versionSet = true; + this.keyStore = model.keyStore(); + this.keySource = model.keySource(); + this.standardBeacons = model.standardBeacons(); + this.compoundBeacons = model.compoundBeacons(); + this.virtualFields = model.virtualFields(); + this.encryptedParts = model.encryptedParts(); + this.signedParts = model.signedParts(); + } + + public Builder version(int version) { + this.version = version; + this._versionSet = true; + return this; + } + + public int version() { + return this.version; + } + + public Builder keyStore(KeyStore keyStore) { + this.keyStore = keyStore; + return this; + } + + public KeyStore keyStore() { + return this.keyStore; + } + + public Builder keySource(BeaconKeySource keySource) { + this.keySource = keySource; + return this; + } + + public BeaconKeySource keySource() { + return this.keySource; + } + + public Builder standardBeacons(List standardBeacons) { + this.standardBeacons = standardBeacons; + return this; + } + + public List standardBeacons() { + return this.standardBeacons; + } + + public Builder compoundBeacons(List compoundBeacons) { + this.compoundBeacons = compoundBeacons; + return this; + } + + public List compoundBeacons() { + return this.compoundBeacons; + } + + public Builder virtualFields(List virtualFields) { + this.virtualFields = virtualFields; + return this; + } + + public List virtualFields() { + return this.virtualFields; + } + + public Builder encryptedParts(List encryptedParts) { + this.encryptedParts = encryptedParts; + return this; + } + + public List encryptedParts() { + return this.encryptedParts; + } + + public Builder signedParts(List signedParts) { + this.signedParts = signedParts; + return this; + } + + public List signedParts() { + return this.signedParts; + } + + public BeaconVersion build() { + if (!this._versionSet) { + throw new IllegalArgumentException("Missing value for required field `version`"); + } + if (this._versionSet && this.version() < 1) { + throw new IllegalArgumentException("`version` must be greater than or equal to 1"); + } + if (Objects.isNull(this.keyStore())) { + throw new IllegalArgumentException("Missing value for required field `keyStore`"); + } + if (Objects.isNull(this.keySource())) { + throw new IllegalArgumentException("Missing value for required field `keySource`"); + } + if (Objects.isNull(this.standardBeacons())) { + throw new IllegalArgumentException("Missing value for required field `standardBeacons`"); + } + if (Objects.nonNull(this.standardBeacons()) && this.standardBeacons().size() < 1) { + throw new IllegalArgumentException("The size of `standardBeacons` must be greater than or equal to 1"); + } + if (Objects.nonNull(this.compoundBeacons()) && this.compoundBeacons().size() < 1) { + throw new IllegalArgumentException("The size of `compoundBeacons` must be greater than or equal to 1"); + } + if (Objects.nonNull(this.virtualFields()) && this.virtualFields().size() < 1) { + throw new IllegalArgumentException("The size of `virtualFields` must be greater than or equal to 1"); + } + if (Objects.nonNull(this.encryptedParts()) && this.encryptedParts().size() < 1) { + throw new IllegalArgumentException("The size of `encryptedParts` must be greater than or equal to 1"); + } + if (Objects.nonNull(this.signedParts()) && this.signedParts().size() < 1) { + throw new IllegalArgumentException("The size of `signedParts` must be greater than or equal to 1"); + } + return new BeaconVersion(this); + } + } +} diff --git a/TestVectors/runtimes/java/src/main/smithy-generated/software/amazon/cryptography/dbencryptionsdk/dynamodb/model/CollectionOfErrors.java b/TestVectors/runtimes/java/src/main/smithy-generated/software/amazon/cryptography/dbencryptionsdk/dynamodb/model/CollectionOfErrors.java new file mode 100644 index 000000000..a6739ce8b --- /dev/null +++ b/TestVectors/runtimes/java/src/main/smithy-generated/software/amazon/cryptography/dbencryptionsdk/dynamodb/model/CollectionOfErrors.java @@ -0,0 +1,139 @@ +// Copyright Amazon.com Inc. or its affiliates. All Rights Reserved. +// SPDX-License-Identifier: Apache-2.0 +// Do not modify this file. This file is machine generated, and any changes to it will be overwritten. +package software.amazon.cryptography.dbencryptionsdk.dynamodb.model; + +import java.util.List; + +public class CollectionOfErrors extends RuntimeException { + /** + * The list of Exceptions encountered. + */ + private final List list; + + protected CollectionOfErrors(BuilderImpl builder) { + super(messageFromBuilder(builder), builder.cause()); + this.list = builder.list(); + } + + private static String messageFromBuilder(Builder builder) { + if (builder.message() != null) { + return builder.message(); + } + if (builder.cause() != null) { + return builder.cause().getMessage(); + } + return null; + } + + /** + * See {@link Throwable#getMessage()}. + */ + public String message() { + return this.getMessage(); + } + + /** + * See {@link Throwable#getCause()}. + */ + public Throwable cause() { + return this.getCause(); + } + + /** + * @return The list of Exceptions encountered. + */ + public List list() { + return this.list; + } + + public Builder toBuilder() { + return new BuilderImpl(this); + } + + public static Builder builder() { + return new BuilderImpl(); + } + + public interface Builder { + /** + * @param message The detailed message. The detail message is saved for later retrieval by the {@link #getMessage()} method. + */ + Builder message(String message); + + /** + * @return The detailed message. The detail message is saved for later retrieval by the {@link #getMessage()} method. + */ + String message(); + + /** + * @param cause The cause (which is saved for later retrieval by the {@link #getCause()} method). (A {@code null} value is permitted, and indicates that the cause is nonexistent or unknown.) + */ + Builder cause(Throwable cause); + + /** + * @return The cause (which is saved for later retrieval by the {@link #getCause()} method). (A {@code null} value is permitted, and indicates that the cause is nonexistent or unknown.) + */ + Throwable cause(); + + /** + * @param list The list of Exceptions encountered. + */ + Builder list(List list); + + /** + * @return The list of Exceptions encountered. + */ + List list(); + + CollectionOfErrors build(); + } + + static class BuilderImpl implements Builder { + protected String message; + + protected Throwable cause; + + protected List list; + + protected BuilderImpl() { + } + + protected BuilderImpl(CollectionOfErrors model) { + this.cause = model.getCause(); + this.message = model.getMessage(); + this.list = model.list(); + } + + public Builder message(String message) { + this.message = message; + return this; + } + + public String message() { + return this.message; + } + + public Builder cause(Throwable cause) { + this.cause = cause; + return this; + } + + public Throwable cause() { + return this.cause; + } + + public Builder list(List list) { + this.list = list; + return this; + } + + public List list() { + return this.list; + } + + public CollectionOfErrors build() { + return new CollectionOfErrors(this); + } + } +} diff --git a/TestVectors/runtimes/java/src/main/smithy-generated/software/amazon/cryptography/dbencryptionsdk/dynamodb/model/CompoundBeacon.java b/TestVectors/runtimes/java/src/main/smithy-generated/software/amazon/cryptography/dbencryptionsdk/dynamodb/model/CompoundBeacon.java new file mode 100644 index 000000000..92ab41ff1 --- /dev/null +++ b/TestVectors/runtimes/java/src/main/smithy-generated/software/amazon/cryptography/dbencryptionsdk/dynamodb/model/CompoundBeacon.java @@ -0,0 +1,235 @@ +// Copyright Amazon.com Inc. or its affiliates. All Rights Reserved. +// SPDX-License-Identifier: Apache-2.0 +// Do not modify this file. This file is machine generated, and any changes to it will be overwritten. +package software.amazon.cryptography.dbencryptionsdk.dynamodb.model; + +import java.util.List; +import java.util.Objects; + +/** + * The configuration for a Compound Beacon. + */ +public class CompoundBeacon { + /** + * The name of the Compound Beacon. + */ + private final String name; + + /** + * The characters used to split parts of a compound beacon. The split character should be a character that does not appear in any Signed Part or Prefix used by the Compound Beacon. + */ + private final String split; + + /** + * The list of Encrypted Parts that may be included in the compound beacon. + */ + private final List encrypted; + + /** + * The list of Signed Parts that may be included in the compound beacon. + */ + private final List signed; + + /** + * The ordered list of constructors that may be used to create the Compound Beacon. Each constructor is checked, in order, to see if it can construct the beacon. The first constructor that can construct the beacon is used. If no constructor can construct the beacon, the Compound Beacon is not written to the item. + */ + private final List constructors; + + protected CompoundBeacon(BuilderImpl builder) { + this.name = builder.name(); + this.split = builder.split(); + this.encrypted = builder.encrypted(); + this.signed = builder.signed(); + this.constructors = builder.constructors(); + } + + /** + * @return The name of the Compound Beacon. + */ + public String name() { + return this.name; + } + + /** + * @return The characters used to split parts of a compound beacon. The split character should be a character that does not appear in any Signed Part or Prefix used by the Compound Beacon. + */ + public String split() { + return this.split; + } + + /** + * @return The list of Encrypted Parts that may be included in the compound beacon. + */ + public List encrypted() { + return this.encrypted; + } + + /** + * @return The list of Signed Parts that may be included in the compound beacon. + */ + public List signed() { + return this.signed; + } + + /** + * @return The ordered list of constructors that may be used to create the Compound Beacon. Each constructor is checked, in order, to see if it can construct the beacon. The first constructor that can construct the beacon is used. If no constructor can construct the beacon, the Compound Beacon is not written to the item. + */ + public List constructors() { + return this.constructors; + } + + public Builder toBuilder() { + return new BuilderImpl(this); + } + + public static Builder builder() { + return new BuilderImpl(); + } + + public interface Builder { + /** + * @param name The name of the Compound Beacon. + */ + Builder name(String name); + + /** + * @return The name of the Compound Beacon. + */ + String name(); + + /** + * @param split The characters used to split parts of a compound beacon. The split character should be a character that does not appear in any Signed Part or Prefix used by the Compound Beacon. + */ + Builder split(String split); + + /** + * @return The characters used to split parts of a compound beacon. The split character should be a character that does not appear in any Signed Part or Prefix used by the Compound Beacon. + */ + String split(); + + /** + * @param encrypted The list of Encrypted Parts that may be included in the compound beacon. + */ + Builder encrypted(List encrypted); + + /** + * @return The list of Encrypted Parts that may be included in the compound beacon. + */ + List encrypted(); + + /** + * @param signed The list of Signed Parts that may be included in the compound beacon. + */ + Builder signed(List signed); + + /** + * @return The list of Signed Parts that may be included in the compound beacon. + */ + List signed(); + + /** + * @param constructors The ordered list of constructors that may be used to create the Compound Beacon. Each constructor is checked, in order, to see if it can construct the beacon. The first constructor that can construct the beacon is used. If no constructor can construct the beacon, the Compound Beacon is not written to the item. + */ + Builder constructors(List constructors); + + /** + * @return The ordered list of constructors that may be used to create the Compound Beacon. Each constructor is checked, in order, to see if it can construct the beacon. The first constructor that can construct the beacon is used. If no constructor can construct the beacon, the Compound Beacon is not written to the item. + */ + List constructors(); + + CompoundBeacon build(); + } + + static class BuilderImpl implements Builder { + protected String name; + + protected String split; + + protected List encrypted; + + protected List signed; + + protected List constructors; + + protected BuilderImpl() { + } + + protected BuilderImpl(CompoundBeacon model) { + this.name = model.name(); + this.split = model.split(); + this.encrypted = model.encrypted(); + this.signed = model.signed(); + this.constructors = model.constructors(); + } + + public Builder name(String name) { + this.name = name; + return this; + } + + public String name() { + return this.name; + } + + public Builder split(String split) { + this.split = split; + return this; + } + + public String split() { + return this.split; + } + + public Builder encrypted(List encrypted) { + this.encrypted = encrypted; + return this; + } + + public List encrypted() { + return this.encrypted; + } + + public Builder signed(List signed) { + this.signed = signed; + return this; + } + + public List signed() { + return this.signed; + } + + public Builder constructors(List constructors) { + this.constructors = constructors; + return this; + } + + public List constructors() { + return this.constructors; + } + + public CompoundBeacon build() { + if (Objects.isNull(this.name())) { + throw new IllegalArgumentException("Missing value for required field `name`"); + } + if (Objects.isNull(this.split())) { + throw new IllegalArgumentException("Missing value for required field `split`"); + } + if (Objects.nonNull(this.split()) && this.split().length() < 1) { + throw new IllegalArgumentException("The size of `split` must be greater than or equal to 1"); + } + if (Objects.nonNull(this.split()) && this.split().length() > 1) { + throw new IllegalArgumentException("The size of `split` must be less than or equal to 1"); + } + if (Objects.nonNull(this.encrypted()) && this.encrypted().size() < 1) { + throw new IllegalArgumentException("The size of `encrypted` must be greater than or equal to 1"); + } + if (Objects.nonNull(this.signed()) && this.signed().size() < 1) { + throw new IllegalArgumentException("The size of `signed` must be greater than or equal to 1"); + } + if (Objects.nonNull(this.constructors()) && this.constructors().size() < 1) { + throw new IllegalArgumentException("The size of `constructors` must be greater than or equal to 1"); + } + return new CompoundBeacon(this); + } + } +} diff --git a/TestVectors/runtimes/java/src/main/smithy-generated/software/amazon/cryptography/dbencryptionsdk/dynamodb/model/Constructor.java b/TestVectors/runtimes/java/src/main/smithy-generated/software/amazon/cryptography/dbencryptionsdk/dynamodb/model/Constructor.java new file mode 100644 index 000000000..8e7da3ece --- /dev/null +++ b/TestVectors/runtimes/java/src/main/smithy-generated/software/amazon/cryptography/dbencryptionsdk/dynamodb/model/Constructor.java @@ -0,0 +1,80 @@ +// Copyright Amazon.com Inc. or its affiliates. All Rights Reserved. +// SPDX-License-Identifier: Apache-2.0 +// Do not modify this file. This file is machine generated, and any changes to it will be overwritten. +package software.amazon.cryptography.dbencryptionsdk.dynamodb.model; + +import java.util.List; +import java.util.Objects; + +/** + * The configuration for a particular Compound Beacon construction. + */ +public class Constructor { + /** + * The ordered list of parts for a particular Compound Beacon construction. If the item contains all required Parts, a Compound beacon will be written using each Part that exists on the item, in the order specified. + */ + private final List parts; + + protected Constructor(BuilderImpl builder) { + this.parts = builder.parts(); + } + + /** + * @return The ordered list of parts for a particular Compound Beacon construction. If the item contains all required Parts, a Compound beacon will be written using each Part that exists on the item, in the order specified. + */ + public List parts() { + return this.parts; + } + + public Builder toBuilder() { + return new BuilderImpl(this); + } + + public static Builder builder() { + return new BuilderImpl(); + } + + public interface Builder { + /** + * @param parts The ordered list of parts for a particular Compound Beacon construction. If the item contains all required Parts, a Compound beacon will be written using each Part that exists on the item, in the order specified. + */ + Builder parts(List parts); + + /** + * @return The ordered list of parts for a particular Compound Beacon construction. If the item contains all required Parts, a Compound beacon will be written using each Part that exists on the item, in the order specified. + */ + List parts(); + + Constructor build(); + } + + static class BuilderImpl implements Builder { + protected List parts; + + protected BuilderImpl() { + } + + protected BuilderImpl(Constructor model) { + this.parts = model.parts(); + } + + public Builder parts(List parts) { + this.parts = parts; + return this; + } + + public List parts() { + return this.parts; + } + + public Constructor build() { + if (Objects.isNull(this.parts())) { + throw new IllegalArgumentException("Missing value for required field `parts`"); + } + if (Objects.nonNull(this.parts()) && this.parts().size() < 1) { + throw new IllegalArgumentException("The size of `parts` must be greater than or equal to 1"); + } + return new Constructor(this); + } + } +} diff --git a/TestVectors/runtimes/java/src/main/smithy-generated/software/amazon/cryptography/dbencryptionsdk/dynamodb/model/ConstructorPart.java b/TestVectors/runtimes/java/src/main/smithy-generated/software/amazon/cryptography/dbencryptionsdk/dynamodb/model/ConstructorPart.java new file mode 100644 index 000000000..295eabd26 --- /dev/null +++ b/TestVectors/runtimes/java/src/main/smithy-generated/software/amazon/cryptography/dbencryptionsdk/dynamodb/model/ConstructorPart.java @@ -0,0 +1,114 @@ +// Copyright Amazon.com Inc. or its affiliates. All Rights Reserved. +// SPDX-License-Identifier: Apache-2.0 +// Do not modify this file. This file is machine generated, and any changes to it will be overwritten. +package software.amazon.cryptography.dbencryptionsdk.dynamodb.model; + +import java.util.Objects; + +/** + * A part of a Compound Becaon Construction. + */ +public class ConstructorPart { + /** + * The name of the Encrypted Part or Signed Part for which this constructor part gets a value. + */ + private final String name; + + /** + * Whether this Encrypted Part or Signed Part is required for this construction to succeed. + */ + private final Boolean required; + + protected ConstructorPart(BuilderImpl builder) { + this.name = builder.name(); + this.required = builder.required(); + } + + /** + * @return The name of the Encrypted Part or Signed Part for which this constructor part gets a value. + */ + public String name() { + return this.name; + } + + /** + * @return Whether this Encrypted Part or Signed Part is required for this construction to succeed. + */ + public Boolean required() { + return this.required; + } + + public Builder toBuilder() { + return new BuilderImpl(this); + } + + public static Builder builder() { + return new BuilderImpl(); + } + + public interface Builder { + /** + * @param name The name of the Encrypted Part or Signed Part for which this constructor part gets a value. + */ + Builder name(String name); + + /** + * @return The name of the Encrypted Part or Signed Part for which this constructor part gets a value. + */ + String name(); + + /** + * @param required Whether this Encrypted Part or Signed Part is required for this construction to succeed. + */ + Builder required(Boolean required); + + /** + * @return Whether this Encrypted Part or Signed Part is required for this construction to succeed. + */ + Boolean required(); + + ConstructorPart build(); + } + + static class BuilderImpl implements Builder { + protected String name; + + protected Boolean required; + + protected BuilderImpl() { + } + + protected BuilderImpl(ConstructorPart model) { + this.name = model.name(); + this.required = model.required(); + } + + public Builder name(String name) { + this.name = name; + return this; + } + + public String name() { + return this.name; + } + + public Builder required(Boolean required) { + this.required = required; + return this; + } + + public Boolean required() { + return this.required; + } + + public ConstructorPart build() { + if (Objects.isNull(this.name())) { + throw new IllegalArgumentException("Missing value for required field `name`"); + } + if (Objects.isNull(this.required())) { + throw new IllegalArgumentException("Missing value for required field `required`"); + } + return new ConstructorPart(this); + } + } +} diff --git a/TestVectors/runtimes/java/src/main/smithy-generated/software/amazon/cryptography/dbencryptionsdk/dynamodb/model/CreateDynamoDbEncryptionBranchKeyIdSupplierInput.java b/TestVectors/runtimes/java/src/main/smithy-generated/software/amazon/cryptography/dbencryptionsdk/dynamodb/model/CreateDynamoDbEncryptionBranchKeyIdSupplierInput.java new file mode 100644 index 000000000..9f12c507f --- /dev/null +++ b/TestVectors/runtimes/java/src/main/smithy-generated/software/amazon/cryptography/dbencryptionsdk/dynamodb/model/CreateDynamoDbEncryptionBranchKeyIdSupplierInput.java @@ -0,0 +1,79 @@ +// Copyright Amazon.com Inc. or its affiliates. All Rights Reserved. +// SPDX-License-Identifier: Apache-2.0 +// Do not modify this file. This file is machine generated, and any changes to it will be overwritten. +package software.amazon.cryptography.dbencryptionsdk.dynamodb.model; + +import java.util.Objects; +import software.amazon.cryptography.dbencryptionsdk.dynamodb.DynamoDbKeyBranchKeyIdSupplier; +import software.amazon.cryptography.dbencryptionsdk.dynamodb.IDynamoDbKeyBranchKeyIdSupplier; + +/** + * Inputs for creating a Branch Key Supplier from a DynamoDB Key Branch Key Id Supplier + */ +public class CreateDynamoDbEncryptionBranchKeyIdSupplierInput { + /** + * An implementation of the DynamoDbKeyBranchKeyIdSupplier interface, which determines what Branch Key to use for data key wrapping/unwrapping based on the DynamoDB item being written/read. + */ + private final IDynamoDbKeyBranchKeyIdSupplier ddbKeyBranchKeyIdSupplier; + + protected CreateDynamoDbEncryptionBranchKeyIdSupplierInput(BuilderImpl builder) { + this.ddbKeyBranchKeyIdSupplier = builder.ddbKeyBranchKeyIdSupplier(); + } + + /** + * @return An implementation of the DynamoDbKeyBranchKeyIdSupplier interface, which determines what Branch Key to use for data key wrapping/unwrapping based on the DynamoDB item being written/read. + */ + public IDynamoDbKeyBranchKeyIdSupplier ddbKeyBranchKeyIdSupplier() { + return this.ddbKeyBranchKeyIdSupplier; + } + + public Builder toBuilder() { + return new BuilderImpl(this); + } + + public static Builder builder() { + return new BuilderImpl(); + } + + public interface Builder { + /** + * @param ddbKeyBranchKeyIdSupplier An implementation of the DynamoDbKeyBranchKeyIdSupplier interface, which determines what Branch Key to use for data key wrapping/unwrapping based on the DynamoDB item being written/read. + */ + Builder ddbKeyBranchKeyIdSupplier(IDynamoDbKeyBranchKeyIdSupplier ddbKeyBranchKeyIdSupplier); + + /** + * @return An implementation of the DynamoDbKeyBranchKeyIdSupplier interface, which determines what Branch Key to use for data key wrapping/unwrapping based on the DynamoDB item being written/read. + */ + IDynamoDbKeyBranchKeyIdSupplier ddbKeyBranchKeyIdSupplier(); + + CreateDynamoDbEncryptionBranchKeyIdSupplierInput build(); + } + + static class BuilderImpl implements Builder { + protected IDynamoDbKeyBranchKeyIdSupplier ddbKeyBranchKeyIdSupplier; + + protected BuilderImpl() { + } + + protected BuilderImpl(CreateDynamoDbEncryptionBranchKeyIdSupplierInput model) { + this.ddbKeyBranchKeyIdSupplier = model.ddbKeyBranchKeyIdSupplier(); + } + + public Builder ddbKeyBranchKeyIdSupplier( + IDynamoDbKeyBranchKeyIdSupplier ddbKeyBranchKeyIdSupplier) { + this.ddbKeyBranchKeyIdSupplier = DynamoDbKeyBranchKeyIdSupplier.wrap(ddbKeyBranchKeyIdSupplier); + return this; + } + + public IDynamoDbKeyBranchKeyIdSupplier ddbKeyBranchKeyIdSupplier() { + return this.ddbKeyBranchKeyIdSupplier; + } + + public CreateDynamoDbEncryptionBranchKeyIdSupplierInput build() { + if (Objects.isNull(this.ddbKeyBranchKeyIdSupplier())) { + throw new IllegalArgumentException("Missing value for required field `ddbKeyBranchKeyIdSupplier`"); + } + return new CreateDynamoDbEncryptionBranchKeyIdSupplierInput(this); + } + } +} diff --git a/TestVectors/runtimes/java/src/main/smithy-generated/software/amazon/cryptography/dbencryptionsdk/dynamodb/model/CreateDynamoDbEncryptionBranchKeyIdSupplierOutput.java b/TestVectors/runtimes/java/src/main/smithy-generated/software/amazon/cryptography/dbencryptionsdk/dynamodb/model/CreateDynamoDbEncryptionBranchKeyIdSupplierOutput.java new file mode 100644 index 000000000..4dc39acff --- /dev/null +++ b/TestVectors/runtimes/java/src/main/smithy-generated/software/amazon/cryptography/dbencryptionsdk/dynamodb/model/CreateDynamoDbEncryptionBranchKeyIdSupplierOutput.java @@ -0,0 +1,78 @@ +// Copyright Amazon.com Inc. or its affiliates. All Rights Reserved. +// SPDX-License-Identifier: Apache-2.0 +// Do not modify this file. This file is machine generated, and any changes to it will be overwritten. +package software.amazon.cryptography.dbencryptionsdk.dynamodb.model; + +import java.util.Objects; +import software.amazon.cryptography.materialproviders.BranchKeyIdSupplier; +import software.amazon.cryptography.materialproviders.IBranchKeyIdSupplier; + +/** + * Outputs for creating a Branch Key Supplier from a DynamoDB Key Branch Key Id Supplier + */ +public class CreateDynamoDbEncryptionBranchKeyIdSupplierOutput { + /** + * The Branch Key Supplier for use with the Hierarchical Keyring. + */ + private final IBranchKeyIdSupplier branchKeyIdSupplier; + + protected CreateDynamoDbEncryptionBranchKeyIdSupplierOutput(BuilderImpl builder) { + this.branchKeyIdSupplier = builder.branchKeyIdSupplier(); + } + + /** + * @return The Branch Key Supplier for use with the Hierarchical Keyring. + */ + public IBranchKeyIdSupplier branchKeyIdSupplier() { + return this.branchKeyIdSupplier; + } + + public Builder toBuilder() { + return new BuilderImpl(this); + } + + public static Builder builder() { + return new BuilderImpl(); + } + + public interface Builder { + /** + * @param branchKeyIdSupplier The Branch Key Supplier for use with the Hierarchical Keyring. + */ + Builder branchKeyIdSupplier(IBranchKeyIdSupplier branchKeyIdSupplier); + + /** + * @return The Branch Key Supplier for use with the Hierarchical Keyring. + */ + IBranchKeyIdSupplier branchKeyIdSupplier(); + + CreateDynamoDbEncryptionBranchKeyIdSupplierOutput build(); + } + + static class BuilderImpl implements Builder { + protected IBranchKeyIdSupplier branchKeyIdSupplier; + + protected BuilderImpl() { + } + + protected BuilderImpl(CreateDynamoDbEncryptionBranchKeyIdSupplierOutput model) { + this.branchKeyIdSupplier = model.branchKeyIdSupplier(); + } + + public Builder branchKeyIdSupplier(IBranchKeyIdSupplier branchKeyIdSupplier) { + this.branchKeyIdSupplier = BranchKeyIdSupplier.wrap(branchKeyIdSupplier); + return this; + } + + public IBranchKeyIdSupplier branchKeyIdSupplier() { + return this.branchKeyIdSupplier; + } + + public CreateDynamoDbEncryptionBranchKeyIdSupplierOutput build() { + if (Objects.isNull(this.branchKeyIdSupplier())) { + throw new IllegalArgumentException("Missing value for required field `branchKeyIdSupplier`"); + } + return new CreateDynamoDbEncryptionBranchKeyIdSupplierOutput(this); + } + } +} diff --git a/TestVectors/runtimes/java/src/main/smithy-generated/software/amazon/cryptography/dbencryptionsdk/dynamodb/model/DynamoDbEncryptionConfig.java b/TestVectors/runtimes/java/src/main/smithy-generated/software/amazon/cryptography/dbencryptionsdk/dynamodb/model/DynamoDbEncryptionConfig.java new file mode 100644 index 000000000..7321e21a6 --- /dev/null +++ b/TestVectors/runtimes/java/src/main/smithy-generated/software/amazon/cryptography/dbencryptionsdk/dynamodb/model/DynamoDbEncryptionConfig.java @@ -0,0 +1,33 @@ +// Copyright Amazon.com Inc. or its affiliates. All Rights Reserved. +// SPDX-License-Identifier: Apache-2.0 +// Do not modify this file. This file is machine generated, and any changes to it will be overwritten. +package software.amazon.cryptography.dbencryptionsdk.dynamodb.model; + +public class DynamoDbEncryptionConfig { + protected DynamoDbEncryptionConfig(BuilderImpl builder) { + } + + public Builder toBuilder() { + return new BuilderImpl(this); + } + + public static Builder builder() { + return new BuilderImpl(); + } + + public interface Builder { + DynamoDbEncryptionConfig build(); + } + + static class BuilderImpl implements Builder { + protected BuilderImpl() { + } + + protected BuilderImpl(DynamoDbEncryptionConfig model) { + } + + public DynamoDbEncryptionConfig build() { + return new DynamoDbEncryptionConfig(this); + } + } +} diff --git a/TestVectors/runtimes/java/src/main/smithy-generated/software/amazon/cryptography/dbencryptionsdk/dynamodb/model/DynamoDbEncryptionException.java b/TestVectors/runtimes/java/src/main/smithy-generated/software/amazon/cryptography/dbencryptionsdk/dynamodb/model/DynamoDbEncryptionException.java new file mode 100644 index 000000000..812de493c --- /dev/null +++ b/TestVectors/runtimes/java/src/main/smithy-generated/software/amazon/cryptography/dbencryptionsdk/dynamodb/model/DynamoDbEncryptionException.java @@ -0,0 +1,107 @@ +// Copyright Amazon.com Inc. or its affiliates. All Rights Reserved. +// SPDX-License-Identifier: Apache-2.0 +// Do not modify this file. This file is machine generated, and any changes to it will be overwritten. +package software.amazon.cryptography.dbencryptionsdk.dynamodb.model; + +import java.util.Objects; + +public class DynamoDbEncryptionException extends RuntimeException { + protected DynamoDbEncryptionException(BuilderImpl builder) { + super(messageFromBuilder(builder), builder.cause()); + } + + private static String messageFromBuilder(Builder builder) { + if (builder.message() != null) { + return builder.message(); + } + if (builder.cause() != null) { + return builder.cause().getMessage(); + } + return null; + } + + /** + * See {@link Throwable#getMessage()}. + */ + public String message() { + return this.getMessage(); + } + + /** + * See {@link Throwable#getCause()}. + */ + public Throwable cause() { + return this.getCause(); + } + + public Builder toBuilder() { + return new BuilderImpl(this); + } + + public static Builder builder() { + return new BuilderImpl(); + } + + public interface Builder { + /** + * @param message The detailed message. The detail message is saved for later retrieval by the {@link #getMessage()} method. + */ + Builder message(String message); + + /** + * @return The detailed message. The detail message is saved for later retrieval by the {@link #getMessage()} method. + */ + String message(); + + /** + * @param cause The cause (which is saved for later retrieval by the {@link #getCause()} method). (A {@code null} value is permitted, and indicates that the cause is nonexistent or unknown.) + */ + Builder cause(Throwable cause); + + /** + * @return The cause (which is saved for later retrieval by the {@link #getCause()} method). (A {@code null} value is permitted, and indicates that the cause is nonexistent or unknown.) + */ + Throwable cause(); + + DynamoDbEncryptionException build(); + } + + static class BuilderImpl implements Builder { + protected String message; + + protected Throwable cause; + + protected BuilderImpl() { + } + + protected BuilderImpl(DynamoDbEncryptionException model) { + this.message = model.message(); + this.cause = model.cause(); + } + + public Builder message(String message) { + this.message = message; + return this; + } + + public String message() { + return this.message; + } + + public Builder cause(Throwable cause) { + this.cause = cause; + return this; + } + + public Throwable cause() { + return this.cause; + } + + public DynamoDbEncryptionException build() { + if (Objects.isNull(this.message())) { + throw new IllegalArgumentException("Missing value for required field `message`"); + } + return new DynamoDbEncryptionException(this); + } + } +} diff --git a/TestVectors/runtimes/java/src/main/smithy-generated/software/amazon/cryptography/dbencryptionsdk/dynamodb/model/DynamoDbTableEncryptionConfig.java b/TestVectors/runtimes/java/src/main/smithy-generated/software/amazon/cryptography/dbencryptionsdk/dynamodb/model/DynamoDbTableEncryptionConfig.java new file mode 100644 index 000000000..9baef7fc2 --- /dev/null +++ b/TestVectors/runtimes/java/src/main/smithy-generated/software/amazon/cryptography/dbencryptionsdk/dynamodb/model/DynamoDbTableEncryptionConfig.java @@ -0,0 +1,490 @@ +// Copyright Amazon.com Inc. or its affiliates. All Rights Reserved. +// SPDX-License-Identifier: Apache-2.0 +// Do not modify this file. This file is machine generated, and any changes to it will be overwritten. +package software.amazon.cryptography.dbencryptionsdk.dynamodb.model; + +import java.util.List; +import java.util.Map; +import java.util.Objects; +import software.amazon.cryptography.dbencryptionsdk.structuredencryption.model.CryptoAction; +import software.amazon.cryptography.materialproviders.CryptographicMaterialsManager; +import software.amazon.cryptography.materialproviders.ICryptographicMaterialsManager; +import software.amazon.cryptography.materialproviders.IKeyring; +import software.amazon.cryptography.materialproviders.Keyring; +import software.amazon.cryptography.materialproviders.model.DBEAlgorithmSuiteId; + +/** + * The configuration for client-side encryption for a particular DynamoDB table. + */ +public class DynamoDbTableEncryptionConfig { + /** + * The logical table name for this table. This is the name that is cryptographically bound with your data. This can be the same as the actual DynamoDB table name. It's purpose is to be distinct from the DynamoDB table name so that the data may still be authenticated if being read from different (but logically similar) tables, such as a backup table. + */ + private final String logicalTableName; + + /** + * The name of the partition key on this table. + */ + private final String partitionKeyName; + + /** + * If this table contains a sort key, the name of the sort key on this table. + */ + private final String sortKeyName; + + /** + * The configuration for searchable encryption. + */ + private final SearchConfig search; + + /** + * A map that describes what attributes should be encrypted and/or signed on encrypt. This map must contain all attributes that might be encountered during encryption. + */ + private final Map attributeActionsOnEncrypt; + + /** + * A list of attribute names such that, if encountered during decryption, those attributes are treated as unsigned. + */ + private final List allowedUnsignedAttributes; + + /** + * A prefix such that, if during decryption any attribute has a name with this prefix, it is treated as unsigned. + */ + private final String allowedUnsignedAttributePrefix; + + /** + * An ID for the algorithm suite to use during encryption and decryption. + */ + private final DBEAlgorithmSuiteId algorithmSuiteId; + + /** + * The Keyring that should be used to wrap and unwrap data keys. If specified a Default Cryptographic Materials Manager with this Keyring is used to obtain materials for encryption and decryption. Either a Keyring or a Cryptographic Materials Manager must be specified. + */ + private final IKeyring keyring; + + /** + * The Cryptographic Materials Manager that is used to obtain materials for encryption and decryption. Either a Keyring or a Cryptographic Materials Manager must be specified. + */ + private final ICryptographicMaterialsManager cmm; + + /** + * A configuration that override encryption and/or decryption to instead perform legacy encryption and/or decryption. Used as part of migration from version 2.x to version 3.x. + */ + private final LegacyOverride legacyOverride; + + /** + * A configuration that override encryption and/or decryption to instead passthrough and write and/or read plaintext. Used to update plaintext tables to fully use client-side encryption. + */ + private final PlaintextOverride plaintextOverride; + + protected DynamoDbTableEncryptionConfig(BuilderImpl builder) { + this.logicalTableName = builder.logicalTableName(); + this.partitionKeyName = builder.partitionKeyName(); + this.sortKeyName = builder.sortKeyName(); + this.search = builder.search(); + this.attributeActionsOnEncrypt = builder.attributeActionsOnEncrypt(); + this.allowedUnsignedAttributes = builder.allowedUnsignedAttributes(); + this.allowedUnsignedAttributePrefix = builder.allowedUnsignedAttributePrefix(); + this.algorithmSuiteId = builder.algorithmSuiteId(); + this.keyring = builder.keyring(); + this.cmm = builder.cmm(); + this.legacyOverride = builder.legacyOverride(); + this.plaintextOverride = builder.plaintextOverride(); + } + + /** + * @return The logical table name for this table. This is the name that is cryptographically bound with your data. This can be the same as the actual DynamoDB table name. It's purpose is to be distinct from the DynamoDB table name so that the data may still be authenticated if being read from different (but logically similar) tables, such as a backup table. + */ + public String logicalTableName() { + return this.logicalTableName; + } + + /** + * @return The name of the partition key on this table. + */ + public String partitionKeyName() { + return this.partitionKeyName; + } + + /** + * @return If this table contains a sort key, the name of the sort key on this table. + */ + public String sortKeyName() { + return this.sortKeyName; + } + + /** + * @return The configuration for searchable encryption. + */ + public SearchConfig search() { + return this.search; + } + + /** + * @return A map that describes what attributes should be encrypted and/or signed on encrypt. This map must contain all attributes that might be encountered during encryption. + */ + public Map attributeActionsOnEncrypt() { + return this.attributeActionsOnEncrypt; + } + + /** + * @return A list of attribute names such that, if encountered during decryption, those attributes are treated as unsigned. + */ + public List allowedUnsignedAttributes() { + return this.allowedUnsignedAttributes; + } + + /** + * @return A prefix such that, if during decryption any attribute has a name with this prefix, it is treated as unsigned. + */ + public String allowedUnsignedAttributePrefix() { + return this.allowedUnsignedAttributePrefix; + } + + /** + * @return An ID for the algorithm suite to use during encryption and decryption. + */ + public DBEAlgorithmSuiteId algorithmSuiteId() { + return this.algorithmSuiteId; + } + + /** + * @return The Keyring that should be used to wrap and unwrap data keys. If specified a Default Cryptographic Materials Manager with this Keyring is used to obtain materials for encryption and decryption. Either a Keyring or a Cryptographic Materials Manager must be specified. + */ + public IKeyring keyring() { + return this.keyring; + } + + /** + * @return The Cryptographic Materials Manager that is used to obtain materials for encryption and decryption. Either a Keyring or a Cryptographic Materials Manager must be specified. + */ + public ICryptographicMaterialsManager cmm() { + return this.cmm; + } + + /** + * @return A configuration that override encryption and/or decryption to instead perform legacy encryption and/or decryption. Used as part of migration from version 2.x to version 3.x. + */ + public LegacyOverride legacyOverride() { + return this.legacyOverride; + } + + /** + * @return A configuration that override encryption and/or decryption to instead passthrough and write and/or read plaintext. Used to update plaintext tables to fully use client-side encryption. + */ + public PlaintextOverride plaintextOverride() { + return this.plaintextOverride; + } + + public Builder toBuilder() { + return new BuilderImpl(this); + } + + public static Builder builder() { + return new BuilderImpl(); + } + + public interface Builder { + /** + * @param logicalTableName The logical table name for this table. This is the name that is cryptographically bound with your data. This can be the same as the actual DynamoDB table name. It's purpose is to be distinct from the DynamoDB table name so that the data may still be authenticated if being read from different (but logically similar) tables, such as a backup table. + */ + Builder logicalTableName(String logicalTableName); + + /** + * @return The logical table name for this table. This is the name that is cryptographically bound with your data. This can be the same as the actual DynamoDB table name. It's purpose is to be distinct from the DynamoDB table name so that the data may still be authenticated if being read from different (but logically similar) tables, such as a backup table. + */ + String logicalTableName(); + + /** + * @param partitionKeyName The name of the partition key on this table. + */ + Builder partitionKeyName(String partitionKeyName); + + /** + * @return The name of the partition key on this table. + */ + String partitionKeyName(); + + /** + * @param sortKeyName If this table contains a sort key, the name of the sort key on this table. + */ + Builder sortKeyName(String sortKeyName); + + /** + * @return If this table contains a sort key, the name of the sort key on this table. + */ + String sortKeyName(); + + /** + * @param search The configuration for searchable encryption. + */ + Builder search(SearchConfig search); + + /** + * @return The configuration for searchable encryption. + */ + SearchConfig search(); + + /** + * @param attributeActionsOnEncrypt A map that describes what attributes should be encrypted and/or signed on encrypt. This map must contain all attributes that might be encountered during encryption. + */ + Builder attributeActionsOnEncrypt(Map attributeActionsOnEncrypt); + + /** + * @return A map that describes what attributes should be encrypted and/or signed on encrypt. This map must contain all attributes that might be encountered during encryption. + */ + Map attributeActionsOnEncrypt(); + + /** + * @param allowedUnsignedAttributes A list of attribute names such that, if encountered during decryption, those attributes are treated as unsigned. + */ + Builder allowedUnsignedAttributes(List allowedUnsignedAttributes); + + /** + * @return A list of attribute names such that, if encountered during decryption, those attributes are treated as unsigned. + */ + List allowedUnsignedAttributes(); + + /** + * @param allowedUnsignedAttributePrefix A prefix such that, if during decryption any attribute has a name with this prefix, it is treated as unsigned. + */ + Builder allowedUnsignedAttributePrefix(String allowedUnsignedAttributePrefix); + + /** + * @return A prefix such that, if during decryption any attribute has a name with this prefix, it is treated as unsigned. + */ + String allowedUnsignedAttributePrefix(); + + /** + * @param algorithmSuiteId An ID for the algorithm suite to use during encryption and decryption. + */ + Builder algorithmSuiteId(DBEAlgorithmSuiteId algorithmSuiteId); + + /** + * @return An ID for the algorithm suite to use during encryption and decryption. + */ + DBEAlgorithmSuiteId algorithmSuiteId(); + + /** + * @param keyring The Keyring that should be used to wrap and unwrap data keys. If specified a Default Cryptographic Materials Manager with this Keyring is used to obtain materials for encryption and decryption. Either a Keyring or a Cryptographic Materials Manager must be specified. + */ + Builder keyring(IKeyring keyring); + + /** + * @return The Keyring that should be used to wrap and unwrap data keys. If specified a Default Cryptographic Materials Manager with this Keyring is used to obtain materials for encryption and decryption. Either a Keyring or a Cryptographic Materials Manager must be specified. + */ + IKeyring keyring(); + + /** + * @param cmm The Cryptographic Materials Manager that is used to obtain materials for encryption and decryption. Either a Keyring or a Cryptographic Materials Manager must be specified. + */ + Builder cmm(ICryptographicMaterialsManager cmm); + + /** + * @return The Cryptographic Materials Manager that is used to obtain materials for encryption and decryption. Either a Keyring or a Cryptographic Materials Manager must be specified. + */ + ICryptographicMaterialsManager cmm(); + + /** + * @param legacyOverride A configuration that override encryption and/or decryption to instead perform legacy encryption and/or decryption. Used as part of migration from version 2.x to version 3.x. + */ + Builder legacyOverride(LegacyOverride legacyOverride); + + /** + * @return A configuration that override encryption and/or decryption to instead perform legacy encryption and/or decryption. Used as part of migration from version 2.x to version 3.x. + */ + LegacyOverride legacyOverride(); + + /** + * @param plaintextOverride A configuration that override encryption and/or decryption to instead passthrough and write and/or read plaintext. Used to update plaintext tables to fully use client-side encryption. + */ + Builder plaintextOverride(PlaintextOverride plaintextOverride); + + /** + * @return A configuration that override encryption and/or decryption to instead passthrough and write and/or read plaintext. Used to update plaintext tables to fully use client-side encryption. + */ + PlaintextOverride plaintextOverride(); + + DynamoDbTableEncryptionConfig build(); + } + + static class BuilderImpl implements Builder { + protected String logicalTableName; + + protected String partitionKeyName; + + protected String sortKeyName; + + protected SearchConfig search; + + protected Map attributeActionsOnEncrypt; + + protected List allowedUnsignedAttributes; + + protected String allowedUnsignedAttributePrefix; + + protected DBEAlgorithmSuiteId algorithmSuiteId; + + protected IKeyring keyring; + + protected ICryptographicMaterialsManager cmm; + + protected LegacyOverride legacyOverride; + + protected PlaintextOverride plaintextOverride; + + protected BuilderImpl() { + } + + protected BuilderImpl(DynamoDbTableEncryptionConfig model) { + this.logicalTableName = model.logicalTableName(); + this.partitionKeyName = model.partitionKeyName(); + this.sortKeyName = model.sortKeyName(); + this.search = model.search(); + this.attributeActionsOnEncrypt = model.attributeActionsOnEncrypt(); + this.allowedUnsignedAttributes = model.allowedUnsignedAttributes(); + this.allowedUnsignedAttributePrefix = model.allowedUnsignedAttributePrefix(); + this.algorithmSuiteId = model.algorithmSuiteId(); + this.keyring = model.keyring(); + this.cmm = model.cmm(); + this.legacyOverride = model.legacyOverride(); + this.plaintextOverride = model.plaintextOverride(); + } + + public Builder logicalTableName(String logicalTableName) { + this.logicalTableName = logicalTableName; + return this; + } + + public String logicalTableName() { + return this.logicalTableName; + } + + public Builder partitionKeyName(String partitionKeyName) { + this.partitionKeyName = partitionKeyName; + return this; + } + + public String partitionKeyName() { + return this.partitionKeyName; + } + + public Builder sortKeyName(String sortKeyName) { + this.sortKeyName = sortKeyName; + return this; + } + + public String sortKeyName() { + return this.sortKeyName; + } + + public Builder search(SearchConfig search) { + this.search = search; + return this; + } + + public SearchConfig search() { + return this.search; + } + + public Builder attributeActionsOnEncrypt(Map attributeActionsOnEncrypt) { + this.attributeActionsOnEncrypt = attributeActionsOnEncrypt; + return this; + } + + public Map attributeActionsOnEncrypt() { + return this.attributeActionsOnEncrypt; + } + + public Builder allowedUnsignedAttributes(List allowedUnsignedAttributes) { + this.allowedUnsignedAttributes = allowedUnsignedAttributes; + return this; + } + + public List allowedUnsignedAttributes() { + return this.allowedUnsignedAttributes; + } + + public Builder allowedUnsignedAttributePrefix(String allowedUnsignedAttributePrefix) { + this.allowedUnsignedAttributePrefix = allowedUnsignedAttributePrefix; + return this; + } + + public String allowedUnsignedAttributePrefix() { + return this.allowedUnsignedAttributePrefix; + } + + public Builder algorithmSuiteId(DBEAlgorithmSuiteId algorithmSuiteId) { + this.algorithmSuiteId = algorithmSuiteId; + return this; + } + + public DBEAlgorithmSuiteId algorithmSuiteId() { + return this.algorithmSuiteId; + } + + public Builder keyring(IKeyring keyring) { + this.keyring = Keyring.wrap(keyring); + return this; + } + + public IKeyring keyring() { + return this.keyring; + } + + public Builder cmm(ICryptographicMaterialsManager cmm) { + this.cmm = CryptographicMaterialsManager.wrap(cmm); + return this; + } + + public ICryptographicMaterialsManager cmm() { + return this.cmm; + } + + public Builder legacyOverride(LegacyOverride legacyOverride) { + this.legacyOverride = legacyOverride; + return this; + } + + public LegacyOverride legacyOverride() { + return this.legacyOverride; + } + + public Builder plaintextOverride(PlaintextOverride plaintextOverride) { + this.plaintextOverride = plaintextOverride; + return this; + } + + public PlaintextOverride plaintextOverride() { + return this.plaintextOverride; + } + + public DynamoDbTableEncryptionConfig build() { + if (Objects.isNull(this.logicalTableName())) { + throw new IllegalArgumentException("Missing value for required field `logicalTableName`"); + } + if (Objects.isNull(this.partitionKeyName())) { + throw new IllegalArgumentException("Missing value for required field `partitionKeyName`"); + } + if (Objects.nonNull(this.partitionKeyName()) && this.partitionKeyName().length() < 1) { + throw new IllegalArgumentException("The size of `partitionKeyName` must be greater than or equal to 1"); + } + if (Objects.nonNull(this.partitionKeyName()) && this.partitionKeyName().length() > 255) { + throw new IllegalArgumentException("The size of `partitionKeyName` must be less than or equal to 255"); + } + if (Objects.nonNull(this.sortKeyName()) && this.sortKeyName().length() < 1) { + throw new IllegalArgumentException("The size of `sortKeyName` must be greater than or equal to 1"); + } + if (Objects.nonNull(this.sortKeyName()) && this.sortKeyName().length() > 255) { + throw new IllegalArgumentException("The size of `sortKeyName` must be less than or equal to 255"); + } + if (Objects.isNull(this.attributeActionsOnEncrypt())) { + throw new IllegalArgumentException("Missing value for required field `attributeActionsOnEncrypt`"); + } + if (Objects.nonNull(this.allowedUnsignedAttributes()) && this.allowedUnsignedAttributes().size() < 1) { + throw new IllegalArgumentException("The size of `allowedUnsignedAttributes` must be greater than or equal to 1"); + } + return new DynamoDbTableEncryptionConfig(this); + } + } +} diff --git a/TestVectors/runtimes/java/src/main/smithy-generated/software/amazon/cryptography/dbencryptionsdk/dynamodb/model/DynamoDbTablesEncryptionConfig.java b/TestVectors/runtimes/java/src/main/smithy-generated/software/amazon/cryptography/dbencryptionsdk/dynamodb/model/DynamoDbTablesEncryptionConfig.java new file mode 100644 index 000000000..4a1f1c333 --- /dev/null +++ b/TestVectors/runtimes/java/src/main/smithy-generated/software/amazon/cryptography/dbencryptionsdk/dynamodb/model/DynamoDbTablesEncryptionConfig.java @@ -0,0 +1,79 @@ +// Copyright Amazon.com Inc. or its affiliates. All Rights Reserved. +// SPDX-License-Identifier: Apache-2.0 +// Do not modify this file. This file is machine generated, and any changes to it will be overwritten. +package software.amazon.cryptography.dbencryptionsdk.dynamodb.model; + +import java.util.Map; +import java.util.Objects; + +/** + * The configuration for client-side encryption with multiple DynamoDB table. + */ +public class DynamoDbTablesEncryptionConfig { + /** + * A map of DynamoDB table name to its configuration for client-side encryption. + */ + private final Map tableEncryptionConfigs; + + protected DynamoDbTablesEncryptionConfig(BuilderImpl builder) { + this.tableEncryptionConfigs = builder.tableEncryptionConfigs(); + } + + /** + * @return A map of DynamoDB table name to its configuration for client-side encryption. + */ + public Map tableEncryptionConfigs() { + return this.tableEncryptionConfigs; + } + + public Builder toBuilder() { + return new BuilderImpl(this); + } + + public static Builder builder() { + return new BuilderImpl(); + } + + public interface Builder { + /** + * @param tableEncryptionConfigs A map of DynamoDB table name to its configuration for client-side encryption. + */ + Builder tableEncryptionConfigs( + Map tableEncryptionConfigs); + + /** + * @return A map of DynamoDB table name to its configuration for client-side encryption. + */ + Map tableEncryptionConfigs(); + + DynamoDbTablesEncryptionConfig build(); + } + + static class BuilderImpl implements Builder { + protected Map tableEncryptionConfigs; + + protected BuilderImpl() { + } + + protected BuilderImpl(DynamoDbTablesEncryptionConfig model) { + this.tableEncryptionConfigs = model.tableEncryptionConfigs(); + } + + public Builder tableEncryptionConfigs( + Map tableEncryptionConfigs) { + this.tableEncryptionConfigs = tableEncryptionConfigs; + return this; + } + + public Map tableEncryptionConfigs() { + return this.tableEncryptionConfigs; + } + + public DynamoDbTablesEncryptionConfig build() { + if (Objects.isNull(this.tableEncryptionConfigs())) { + throw new IllegalArgumentException("Missing value for required field `tableEncryptionConfigs`"); + } + return new DynamoDbTablesEncryptionConfig(this); + } + } +} diff --git a/TestVectors/runtimes/java/src/main/smithy-generated/software/amazon/cryptography/dbencryptionsdk/dynamodb/model/EncryptedDataKeyDescriptionOutput.java b/TestVectors/runtimes/java/src/main/smithy-generated/software/amazon/cryptography/dbencryptionsdk/dynamodb/model/EncryptedDataKeyDescriptionOutput.java new file mode 100644 index 000000000..974750bcf --- /dev/null +++ b/TestVectors/runtimes/java/src/main/smithy-generated/software/amazon/cryptography/dbencryptionsdk/dynamodb/model/EncryptedDataKeyDescriptionOutput.java @@ -0,0 +1,130 @@ +// Copyright Amazon.com Inc. or its affiliates. All Rights Reserved. +// SPDX-License-Identifier: Apache-2.0 +// Do not modify this file. This file is machine generated, and any changes to it will be overwritten. +package software.amazon.cryptography.dbencryptionsdk.dynamodb.model; + +import java.util.Objects; + +public class EncryptedDataKeyDescriptionOutput { + private final String keyProviderId; + + private final String keyProviderInfo; + + private final String branchKeyId; + + private final String branchKeyVersion; + + protected EncryptedDataKeyDescriptionOutput(BuilderImpl builder) { + this.keyProviderId = builder.keyProviderId(); + this.keyProviderInfo = builder.keyProviderInfo(); + this.branchKeyId = builder.branchKeyId(); + this.branchKeyVersion = builder.branchKeyVersion(); + } + + public String keyProviderId() { + return this.keyProviderId; + } + + public String keyProviderInfo() { + return this.keyProviderInfo; + } + + public String branchKeyId() { + return this.branchKeyId; + } + + public String branchKeyVersion() { + return this.branchKeyVersion; + } + + public Builder toBuilder() { + return new BuilderImpl(this); + } + + public static Builder builder() { + return new BuilderImpl(); + } + + public interface Builder { + Builder keyProviderId(String keyProviderId); + + String keyProviderId(); + + Builder keyProviderInfo(String keyProviderInfo); + + String keyProviderInfo(); + + Builder branchKeyId(String branchKeyId); + + String branchKeyId(); + + Builder branchKeyVersion(String branchKeyVersion); + + String branchKeyVersion(); + + EncryptedDataKeyDescriptionOutput build(); + } + + static class BuilderImpl implements Builder { + protected String keyProviderId; + + protected String keyProviderInfo; + + protected String branchKeyId; + + protected String branchKeyVersion; + + protected BuilderImpl() { + } + + protected BuilderImpl(EncryptedDataKeyDescriptionOutput model) { + this.keyProviderId = model.keyProviderId(); + this.keyProviderInfo = model.keyProviderInfo(); + this.branchKeyId = model.branchKeyId(); + this.branchKeyVersion = model.branchKeyVersion(); + } + + public Builder keyProviderId(String keyProviderId) { + this.keyProviderId = keyProviderId; + return this; + } + + public String keyProviderId() { + return this.keyProviderId; + } + + public Builder keyProviderInfo(String keyProviderInfo) { + this.keyProviderInfo = keyProviderInfo; + return this; + } + + public String keyProviderInfo() { + return this.keyProviderInfo; + } + + public Builder branchKeyId(String branchKeyId) { + this.branchKeyId = branchKeyId; + return this; + } + + public String branchKeyId() { + return this.branchKeyId; + } + + public Builder branchKeyVersion(String branchKeyVersion) { + this.branchKeyVersion = branchKeyVersion; + return this; + } + + public String branchKeyVersion() { + return this.branchKeyVersion; + } + + public EncryptedDataKeyDescriptionOutput build() { + if (Objects.isNull(this.keyProviderId())) { + throw new IllegalArgumentException("Missing value for required field `keyProviderId`"); + } + return new EncryptedDataKeyDescriptionOutput(this); + } + } +} diff --git a/TestVectors/runtimes/java/src/main/smithy-generated/software/amazon/cryptography/dbencryptionsdk/dynamodb/model/EncryptedPart.java b/TestVectors/runtimes/java/src/main/smithy-generated/software/amazon/cryptography/dbencryptionsdk/dynamodb/model/EncryptedPart.java new file mode 100644 index 000000000..934cd47fa --- /dev/null +++ b/TestVectors/runtimes/java/src/main/smithy-generated/software/amazon/cryptography/dbencryptionsdk/dynamodb/model/EncryptedPart.java @@ -0,0 +1,117 @@ +// Copyright Amazon.com Inc. or its affiliates. All Rights Reserved. +// SPDX-License-Identifier: Apache-2.0 +// Do not modify this file. This file is machine generated, and any changes to it will be overwritten. +package software.amazon.cryptography.dbencryptionsdk.dynamodb.model; + +import java.util.Objects; + +/** + * A part of a Compound Beacon that contains a beacon over encrypted data. + */ +public class EncryptedPart { + /** + * The name of the Standard Beacon, whose value this Part will hold. + */ + private final String name; + + /** + * The prefix that is written with this Encrypted Part. + */ + private final String prefix; + + protected EncryptedPart(BuilderImpl builder) { + this.name = builder.name(); + this.prefix = builder.prefix(); + } + + /** + * @return The name of the Standard Beacon, whose value this Part will hold. + */ + public String name() { + return this.name; + } + + /** + * @return The prefix that is written with this Encrypted Part. + */ + public String prefix() { + return this.prefix; + } + + public Builder toBuilder() { + return new BuilderImpl(this); + } + + public static Builder builder() { + return new BuilderImpl(); + } + + public interface Builder { + /** + * @param name The name of the Standard Beacon, whose value this Part will hold. + */ + Builder name(String name); + + /** + * @return The name of the Standard Beacon, whose value this Part will hold. + */ + String name(); + + /** + * @param prefix The prefix that is written with this Encrypted Part. + */ + Builder prefix(String prefix); + + /** + * @return The prefix that is written with this Encrypted Part. + */ + String prefix(); + + EncryptedPart build(); + } + + static class BuilderImpl implements Builder { + protected String name; + + protected String prefix; + + protected BuilderImpl() { + } + + protected BuilderImpl(EncryptedPart model) { + this.name = model.name(); + this.prefix = model.prefix(); + } + + public Builder name(String name) { + this.name = name; + return this; + } + + public String name() { + return this.name; + } + + public Builder prefix(String prefix) { + this.prefix = prefix; + return this; + } + + public String prefix() { + return this.prefix; + } + + public EncryptedPart build() { + if (Objects.isNull(this.name())) { + throw new IllegalArgumentException("Missing value for required field `name`"); + } + if (Objects.isNull(this.prefix())) { + throw new IllegalArgumentException("Missing value for required field `prefix`"); + } + if (Objects.nonNull(this.prefix()) && this.prefix().length() < 1) { + throw new IllegalArgumentException("The size of `prefix` must be greater than or equal to 1"); + } + return new EncryptedPart(this); + } + } +} diff --git a/TestVectors/runtimes/java/src/main/smithy-generated/software/amazon/cryptography/dbencryptionsdk/dynamodb/model/GetBranchKeyIdFromDdbKeyInput.java b/TestVectors/runtimes/java/src/main/smithy-generated/software/amazon/cryptography/dbencryptionsdk/dynamodb/model/GetBranchKeyIdFromDdbKeyInput.java new file mode 100644 index 000000000..db7c03974 --- /dev/null +++ b/TestVectors/runtimes/java/src/main/smithy-generated/software/amazon/cryptography/dbencryptionsdk/dynamodb/model/GetBranchKeyIdFromDdbKeyInput.java @@ -0,0 +1,78 @@ +// Copyright Amazon.com Inc. or its affiliates. All Rights Reserved. +// SPDX-License-Identifier: Apache-2.0 +// Do not modify this file. This file is machine generated, and any changes to it will be overwritten. +package software.amazon.cryptography.dbencryptionsdk.dynamodb.model; + +import java.util.Map; +import java.util.Objects; +import software.amazon.awssdk.services.dynamodb.model.AttributeValue; + +/** + * Inputs for getting the Branch Key that should be used for wrapping and unwrapping data keys. + */ +public class GetBranchKeyIdFromDdbKeyInput { + /** + * The partition and sort (if it exists) attributes on the item being read or written. + */ + private final Map ddbKey; + + protected GetBranchKeyIdFromDdbKeyInput(BuilderImpl builder) { + this.ddbKey = builder.ddbKey(); + } + + /** + * @return The partition and sort (if it exists) attributes on the item being read or written. + */ + public Map ddbKey() { + return this.ddbKey; + } + + public Builder toBuilder() { + return new BuilderImpl(this); + } + + public static Builder builder() { + return new BuilderImpl(); + } + + public interface Builder { + /** + * @param ddbKey The partition and sort (if it exists) attributes on the item being read or written. + */ + Builder ddbKey(Map ddbKey); + + /** + * @return The partition and sort (if it exists) attributes on the item being read or written. + */ + Map ddbKey(); + + GetBranchKeyIdFromDdbKeyInput build(); + } + + static class BuilderImpl implements Builder { + protected Map ddbKey; + + protected BuilderImpl() { + } + + protected BuilderImpl(GetBranchKeyIdFromDdbKeyInput model) { + this.ddbKey = model.ddbKey(); + } + + public Builder ddbKey(Map ddbKey) { + this.ddbKey = ddbKey; + return this; + } + + public Map ddbKey() { + return this.ddbKey; + } + + public GetBranchKeyIdFromDdbKeyInput build() { + if (Objects.isNull(this.ddbKey())) { + throw new IllegalArgumentException("Missing value for required field `ddbKey`"); + } + return new GetBranchKeyIdFromDdbKeyInput(this); + } + } +} diff --git a/TestVectors/runtimes/java/src/main/smithy-generated/software/amazon/cryptography/dbencryptionsdk/dynamodb/model/GetBranchKeyIdFromDdbKeyOutput.java b/TestVectors/runtimes/java/src/main/smithy-generated/software/amazon/cryptography/dbencryptionsdk/dynamodb/model/GetBranchKeyIdFromDdbKeyOutput.java new file mode 100644 index 000000000..e4ec8d1f1 --- /dev/null +++ b/TestVectors/runtimes/java/src/main/smithy-generated/software/amazon/cryptography/dbencryptionsdk/dynamodb/model/GetBranchKeyIdFromDdbKeyOutput.java @@ -0,0 +1,76 @@ +// Copyright Amazon.com Inc. or its affiliates. All Rights Reserved. +// SPDX-License-Identifier: Apache-2.0 +// Do not modify this file. This file is machine generated, and any changes to it will be overwritten. +package software.amazon.cryptography.dbencryptionsdk.dynamodb.model; + +import java.util.Objects; + +/** + * Outputs for getting the Branch Key that should be used for wrapping and unwrapping data keys. + */ +public class GetBranchKeyIdFromDdbKeyOutput { + /** + * The ID of the Branch Key that should be used to wrap and unwrap data keys for this item. + */ + private final String branchKeyId; + + protected GetBranchKeyIdFromDdbKeyOutput(BuilderImpl builder) { + this.branchKeyId = builder.branchKeyId(); + } + + /** + * @return The ID of the Branch Key that should be used to wrap and unwrap data keys for this item. + */ + public String branchKeyId() { + return this.branchKeyId; + } + + public Builder toBuilder() { + return new BuilderImpl(this); + } + + public static Builder builder() { + return new BuilderImpl(); + } + + public interface Builder { + /** + * @param branchKeyId The ID of the Branch Key that should be used to wrap and unwrap data keys for this item. + */ + Builder branchKeyId(String branchKeyId); + + /** + * @return The ID of the Branch Key that should be used to wrap and unwrap data keys for this item. + */ + String branchKeyId(); + + GetBranchKeyIdFromDdbKeyOutput build(); + } + + static class BuilderImpl implements Builder { + protected String branchKeyId; + + protected BuilderImpl() { + } + + protected BuilderImpl(GetBranchKeyIdFromDdbKeyOutput model) { + this.branchKeyId = model.branchKeyId(); + } + + public Builder branchKeyId(String branchKeyId) { + this.branchKeyId = branchKeyId; + return this; + } + + public String branchKeyId() { + return this.branchKeyId; + } + + public GetBranchKeyIdFromDdbKeyOutput build() { + if (Objects.isNull(this.branchKeyId())) { + throw new IllegalArgumentException("Missing value for required field `branchKeyId`"); + } + return new GetBranchKeyIdFromDdbKeyOutput(this); + } + } +} diff --git a/TestVectors/runtimes/java/src/main/smithy-generated/software/amazon/cryptography/dbencryptionsdk/dynamodb/model/GetEncryptedDataKeyDescriptionInput.java b/TestVectors/runtimes/java/src/main/smithy-generated/software/amazon/cryptography/dbencryptionsdk/dynamodb/model/GetEncryptedDataKeyDescriptionInput.java new file mode 100644 index 000000000..ef55a98ae --- /dev/null +++ b/TestVectors/runtimes/java/src/main/smithy-generated/software/amazon/cryptography/dbencryptionsdk/dynamodb/model/GetEncryptedDataKeyDescriptionInput.java @@ -0,0 +1,61 @@ +// Copyright Amazon.com Inc. or its affiliates. All Rights Reserved. +// SPDX-License-Identifier: Apache-2.0 +// Do not modify this file. This file is machine generated, and any changes to it will be overwritten. +package software.amazon.cryptography.dbencryptionsdk.dynamodb.model; + +import java.util.Objects; + +public class GetEncryptedDataKeyDescriptionInput { + private final GetEncryptedDataKeyDescriptionUnion input; + + protected GetEncryptedDataKeyDescriptionInput(BuilderImpl builder) { + this.input = builder.input(); + } + + public GetEncryptedDataKeyDescriptionUnion input() { + return this.input; + } + + public Builder toBuilder() { + return new BuilderImpl(this); + } + + public static Builder builder() { + return new BuilderImpl(); + } + + public interface Builder { + Builder input(GetEncryptedDataKeyDescriptionUnion input); + + GetEncryptedDataKeyDescriptionUnion input(); + + GetEncryptedDataKeyDescriptionInput build(); + } + + static class BuilderImpl implements Builder { + protected GetEncryptedDataKeyDescriptionUnion input; + + protected BuilderImpl() { + } + + protected BuilderImpl(GetEncryptedDataKeyDescriptionInput model) { + this.input = model.input(); + } + + public Builder input(GetEncryptedDataKeyDescriptionUnion input) { + this.input = input; + return this; + } + + public GetEncryptedDataKeyDescriptionUnion input() { + return this.input; + } + + public GetEncryptedDataKeyDescriptionInput build() { + if (Objects.isNull(this.input())) { + throw new IllegalArgumentException("Missing value for required field `input`"); + } + return new GetEncryptedDataKeyDescriptionInput(this); + } + } +} diff --git a/TestVectors/runtimes/java/src/main/smithy-generated/software/amazon/cryptography/dbencryptionsdk/dynamodb/model/GetEncryptedDataKeyDescriptionOutput.java b/TestVectors/runtimes/java/src/main/smithy-generated/software/amazon/cryptography/dbencryptionsdk/dynamodb/model/GetEncryptedDataKeyDescriptionOutput.java new file mode 100644 index 000000000..b4ca94f86 --- /dev/null +++ b/TestVectors/runtimes/java/src/main/smithy-generated/software/amazon/cryptography/dbencryptionsdk/dynamodb/model/GetEncryptedDataKeyDescriptionOutput.java @@ -0,0 +1,64 @@ +// Copyright Amazon.com Inc. or its affiliates. All Rights Reserved. +// SPDX-License-Identifier: Apache-2.0 +// Do not modify this file. This file is machine generated, and any changes to it will be overwritten. +package software.amazon.cryptography.dbencryptionsdk.dynamodb.model; + +import java.util.List; +import java.util.Objects; + +public class GetEncryptedDataKeyDescriptionOutput { + private final List EncryptedDataKeyDescriptionOutput; + + protected GetEncryptedDataKeyDescriptionOutput(BuilderImpl builder) { + this.EncryptedDataKeyDescriptionOutput = builder.EncryptedDataKeyDescriptionOutput(); + } + + public List EncryptedDataKeyDescriptionOutput() { + return this.EncryptedDataKeyDescriptionOutput; + } + + public Builder toBuilder() { + return new BuilderImpl(this); + } + + public static Builder builder() { + return new BuilderImpl(); + } + + public interface Builder { + Builder EncryptedDataKeyDescriptionOutput( + List EncryptedDataKeyDescriptionOutput); + + List EncryptedDataKeyDescriptionOutput(); + + GetEncryptedDataKeyDescriptionOutput build(); + } + + static class BuilderImpl implements Builder { + protected List EncryptedDataKeyDescriptionOutput; + + protected BuilderImpl() { + } + + protected BuilderImpl(GetEncryptedDataKeyDescriptionOutput model) { + this.EncryptedDataKeyDescriptionOutput = model.EncryptedDataKeyDescriptionOutput(); + } + + public Builder EncryptedDataKeyDescriptionOutput( + List EncryptedDataKeyDescriptionOutput) { + this.EncryptedDataKeyDescriptionOutput = EncryptedDataKeyDescriptionOutput; + return this; + } + + public List EncryptedDataKeyDescriptionOutput() { + return this.EncryptedDataKeyDescriptionOutput; + } + + public GetEncryptedDataKeyDescriptionOutput build() { + if (Objects.isNull(this.EncryptedDataKeyDescriptionOutput())) { + throw new IllegalArgumentException("Missing value for required field `EncryptedDataKeyDescriptionOutput`"); + } + return new GetEncryptedDataKeyDescriptionOutput(this); + } + } +} diff --git a/TestVectors/runtimes/java/src/main/smithy-generated/software/amazon/cryptography/dbencryptionsdk/dynamodb/model/GetEncryptedDataKeyDescriptionUnion.java b/TestVectors/runtimes/java/src/main/smithy-generated/software/amazon/cryptography/dbencryptionsdk/dynamodb/model/GetEncryptedDataKeyDescriptionUnion.java new file mode 100644 index 000000000..580c4de80 --- /dev/null +++ b/TestVectors/runtimes/java/src/main/smithy-generated/software/amazon/cryptography/dbencryptionsdk/dynamodb/model/GetEncryptedDataKeyDescriptionUnion.java @@ -0,0 +1,101 @@ +// Copyright Amazon.com Inc. or its affiliates. All Rights Reserved. +// SPDX-License-Identifier: Apache-2.0 +// Do not modify this file. This file is machine generated, and any changes to it will be overwritten. +package software.amazon.cryptography.dbencryptionsdk.dynamodb.model; + +import java.nio.ByteBuffer; +import java.util.Map; +import java.util.Objects; +import software.amazon.awssdk.services.dynamodb.model.AttributeValue; + +public class GetEncryptedDataKeyDescriptionUnion { + private final ByteBuffer header; + + private final Map plaintextItem; + + protected GetEncryptedDataKeyDescriptionUnion(BuilderImpl builder) { + this.header = builder.header(); + this.plaintextItem = builder.plaintextItem(); + } + + public ByteBuffer header() { + return this.header; + } + + public Map plaintextItem() { + return this.plaintextItem; + } + + public Builder toBuilder() { + return new BuilderImpl(this); + } + + public static Builder builder() { + return new BuilderImpl(); + } + + public interface Builder { + Builder header(ByteBuffer header); + + ByteBuffer header(); + + Builder plaintextItem(Map plaintextItem); + + Map plaintextItem(); + + GetEncryptedDataKeyDescriptionUnion build(); + } + + static class BuilderImpl implements Builder { + protected ByteBuffer header; + + protected Map plaintextItem; + + protected BuilderImpl() { + } + + protected BuilderImpl(GetEncryptedDataKeyDescriptionUnion model) { + this.header = model.header(); + this.plaintextItem = model.plaintextItem(); + } + + public Builder header(ByteBuffer header) { + this.header = header; + return this; + } + + public ByteBuffer header() { + return this.header; + } + + public Builder plaintextItem(Map plaintextItem) { + this.plaintextItem = plaintextItem; + return this; + } + + public Map plaintextItem() { + return this.plaintextItem; + } + + public GetEncryptedDataKeyDescriptionUnion build() { + if (!onlyOneNonNull()) { + throw new IllegalArgumentException("`GetEncryptedDataKeyDescriptionUnion` is a Union. A Union MUST have one and only one value set."); + } + return new GetEncryptedDataKeyDescriptionUnion(this); + } + + private boolean onlyOneNonNull() { + Object[] allValues = {this.header, this.plaintextItem}; + boolean haveOneNonNull = false; + for (Object o : allValues) { + if (Objects.nonNull(o)) { + if (haveOneNonNull) { + return false; + } + haveOneNonNull = true; + } + } + return haveOneNonNull; + } + } +} diff --git a/TestVectors/runtimes/java/src/main/smithy-generated/software/amazon/cryptography/dbencryptionsdk/dynamodb/model/GetPrefix.java b/TestVectors/runtimes/java/src/main/smithy-generated/software/amazon/cryptography/dbencryptionsdk/dynamodb/model/GetPrefix.java new file mode 100644 index 000000000..29c7bad04 --- /dev/null +++ b/TestVectors/runtimes/java/src/main/smithy-generated/software/amazon/cryptography/dbencryptionsdk/dynamodb/model/GetPrefix.java @@ -0,0 +1,76 @@ +// Copyright Amazon.com Inc. or its affiliates. All Rights Reserved. +// SPDX-License-Identifier: Apache-2.0 +// Do not modify this file. This file is machine generated, and any changes to it will be overwritten. +package software.amazon.cryptography.dbencryptionsdk.dynamodb.model; + +import java.util.Objects; + +/** + * The Virtual Part Transformation that gets the prefix of a string. + */ +public class GetPrefix { + /** + * If positive, the number of characters to return from the front. If negative, the absolute number of characters to exclude from the end. e.g. GetPrefix(-1) returns all but the last character. + */ + private final Integer length; + + protected GetPrefix(BuilderImpl builder) { + this.length = builder.length(); + } + + /** + * @return If positive, the number of characters to return from the front. If negative, the absolute number of characters to exclude from the end. e.g. GetPrefix(-1) returns all but the last character. + */ + public Integer length() { + return this.length; + } + + public Builder toBuilder() { + return new BuilderImpl(this); + } + + public static Builder builder() { + return new BuilderImpl(); + } + + public interface Builder { + /** + * @param length If positive, the number of characters to return from the front. If negative, the absolute number of characters to exclude from the end. e.g. GetPrefix(-1) returns all but the last character. + */ + Builder length(Integer length); + + /** + * @return If positive, the number of characters to return from the front. If negative, the absolute number of characters to exclude from the end. e.g. GetPrefix(-1) returns all but the last character. + */ + Integer length(); + + GetPrefix build(); + } + + static class BuilderImpl implements Builder { + protected Integer length; + + protected BuilderImpl() { + } + + protected BuilderImpl(GetPrefix model) { + this.length = model.length(); + } + + public Builder length(Integer length) { + this.length = length; + return this; + } + + public Integer length() { + return this.length; + } + + public GetPrefix build() { + if (Objects.isNull(this.length())) { + throw new IllegalArgumentException("Missing value for required field `length`"); + } + return new GetPrefix(this); + } + } +} diff --git a/TestVectors/runtimes/java/src/main/smithy-generated/software/amazon/cryptography/dbencryptionsdk/dynamodb/model/GetSegment.java b/TestVectors/runtimes/java/src/main/smithy-generated/software/amazon/cryptography/dbencryptionsdk/dynamodb/model/GetSegment.java new file mode 100644 index 000000000..ec5481bbe --- /dev/null +++ b/TestVectors/runtimes/java/src/main/smithy-generated/software/amazon/cryptography/dbencryptionsdk/dynamodb/model/GetSegment.java @@ -0,0 +1,120 @@ +// Copyright Amazon.com Inc. or its affiliates. All Rights Reserved. +// SPDX-License-Identifier: Apache-2.0 +// Do not modify this file. This file is machine generated, and any changes to it will be overwritten. +package software.amazon.cryptography.dbencryptionsdk.dynamodb.model; + +import java.util.Objects; + +/** + * The Virtual Part Transformation that splits a string and gets a particular segment of that split. + */ +public class GetSegment { + /** + * The characters to split on. + */ + private final String split; + + /** + * The index of the split string result to return. 0 represents the segment before the first split character. -1 respresents the segment after the last split character. + */ + private final Integer index; + + protected GetSegment(BuilderImpl builder) { + this.split = builder.split(); + this.index = builder.index(); + } + + /** + * @return The characters to split on. + */ + public String split() { + return this.split; + } + + /** + * @return The index of the split string result to return. 0 represents the segment before the first split character. -1 respresents the segment after the last split character. + */ + public Integer index() { + return this.index; + } + + public Builder toBuilder() { + return new BuilderImpl(this); + } + + public static Builder builder() { + return new BuilderImpl(); + } + + public interface Builder { + /** + * @param split The characters to split on. + */ + Builder split(String split); + + /** + * @return The characters to split on. + */ + String split(); + + /** + * @param index The index of the split string result to return. 0 represents the segment before the first split character. -1 respresents the segment after the last split character. + */ + Builder index(Integer index); + + /** + * @return The index of the split string result to return. 0 represents the segment before the first split character. -1 respresents the segment after the last split character. + */ + Integer index(); + + GetSegment build(); + } + + static class BuilderImpl implements Builder { + protected String split; + + protected Integer index; + + protected BuilderImpl() { + } + + protected BuilderImpl(GetSegment model) { + this.split = model.split(); + this.index = model.index(); + } + + public Builder split(String split) { + this.split = split; + return this; + } + + public String split() { + return this.split; + } + + public Builder index(Integer index) { + this.index = index; + return this; + } + + public Integer index() { + return this.index; + } + + public GetSegment build() { + if (Objects.isNull(this.split())) { + throw new IllegalArgumentException("Missing value for required field `split`"); + } + if (Objects.nonNull(this.split()) && this.split().length() < 1) { + throw new IllegalArgumentException("The size of `split` must be greater than or equal to 1"); + } + if (Objects.nonNull(this.split()) && this.split().length() > 1) { + throw new IllegalArgumentException("The size of `split` must be less than or equal to 1"); + } + if (Objects.isNull(this.index())) { + throw new IllegalArgumentException("Missing value for required field `index`"); + } + return new GetSegment(this); + } + } +} diff --git a/TestVectors/runtimes/java/src/main/smithy-generated/software/amazon/cryptography/dbencryptionsdk/dynamodb/model/GetSegments.java b/TestVectors/runtimes/java/src/main/smithy-generated/software/amazon/cryptography/dbencryptionsdk/dynamodb/model/GetSegments.java new file mode 100644 index 000000000..d1cbc0771 --- /dev/null +++ b/TestVectors/runtimes/java/src/main/smithy-generated/software/amazon/cryptography/dbencryptionsdk/dynamodb/model/GetSegments.java @@ -0,0 +1,158 @@ +// Copyright Amazon.com Inc. or its affiliates. All Rights Reserved. +// SPDX-License-Identifier: Apache-2.0 +// Do not modify this file. This file is machine generated, and any changes to it will be overwritten. +package software.amazon.cryptography.dbencryptionsdk.dynamodb.model; + +import java.util.Objects; + +/** + * The Virtual Part Transformation that splits a string and gets a range of segments of that split. + */ +public class GetSegments { + /** + * The characters to split on. + */ + private final String split; + + /** + * The index to start the segments from, inclusive. Negative numbers count from the end. -1 is the last segment. + */ + private final Integer low; + + /** + * The index to stop the segments at, exclusive. Negative numbers count from the end. -1 is the last segment. + */ + private final Integer high; + + protected GetSegments(BuilderImpl builder) { + this.split = builder.split(); + this.low = builder.low(); + this.high = builder.high(); + } + + /** + * @return The characters to split on. + */ + public String split() { + return this.split; + } + + /** + * @return The index to start the segments from, inclusive. Negative numbers count from the end. -1 is the last segment. + */ + public Integer low() { + return this.low; + } + + /** + * @return The index to stop the segments at, exclusive. Negative numbers count from the end. -1 is the last segment. + */ + public Integer high() { + return this.high; + } + + public Builder toBuilder() { + return new BuilderImpl(this); + } + + public static Builder builder() { + return new BuilderImpl(); + } + + public interface Builder { + /** + * @param split The characters to split on. + */ + Builder split(String split); + + /** + * @return The characters to split on. + */ + String split(); + + /** + * @param low The index to start the segments from, inclusive. Negative numbers count from the end. -1 is the last segment. + */ + Builder low(Integer low); + + /** + * @return The index to start the segments from, inclusive. Negative numbers count from the end. -1 is the last segment. + */ + Integer low(); + + /** + * @param high The index to stop the segments at, exclusive. Negative numbers count from the end. -1 is the last segment. + */ + Builder high(Integer high); + + /** + * @return The index to stop the segments at, exclusive. Negative numbers count from the end. -1 is the last segment. + */ + Integer high(); + + GetSegments build(); + } + + static class BuilderImpl implements Builder { + protected String split; + + protected Integer low; + + protected Integer high; + + protected BuilderImpl() { + } + + protected BuilderImpl(GetSegments model) { + this.split = model.split(); + this.low = model.low(); + this.high = model.high(); + } + + public Builder split(String split) { + this.split = split; + return this; + } + + public String split() { + return this.split; + } + + public Builder low(Integer low) { + this.low = low; + return this; + } + + public Integer low() { + return this.low; + } + + public Builder high(Integer high) { + this.high = high; + return this; + } + + public Integer high() { + return this.high; + } + + public GetSegments build() { + if (Objects.isNull(this.split())) { + throw new IllegalArgumentException("Missing value for required field `split`"); + } + if (Objects.nonNull(this.split()) && this.split().length() < 1) { + throw new IllegalArgumentException("The size of `split` must be greater than or equal to 1"); + } + if (Objects.nonNull(this.split()) && this.split().length() > 1) { + throw new IllegalArgumentException("The size of `split` must be less than or equal to 1"); + } + if (Objects.isNull(this.low())) { + throw new IllegalArgumentException("Missing value for required field `low`"); + } + if (Objects.isNull(this.high())) { + throw new IllegalArgumentException("Missing value for required field `high`"); + } + return new GetSegments(this); + } + } +} diff --git a/TestVectors/runtimes/java/src/main/smithy-generated/software/amazon/cryptography/dbencryptionsdk/dynamodb/model/GetSubstring.java b/TestVectors/runtimes/java/src/main/smithy-generated/software/amazon/cryptography/dbencryptionsdk/dynamodb/model/GetSubstring.java new file mode 100644 index 000000000..7db87057e --- /dev/null +++ b/TestVectors/runtimes/java/src/main/smithy-generated/software/amazon/cryptography/dbencryptionsdk/dynamodb/model/GetSubstring.java @@ -0,0 +1,114 @@ +// Copyright Amazon.com Inc. or its affiliates. All Rights Reserved. +// SPDX-License-Identifier: Apache-2.0 +// Do not modify this file. This file is machine generated, and any changes to it will be overwritten. +package software.amazon.cryptography.dbencryptionsdk.dynamodb.model; + +import java.util.Objects; + +/** + * The Virtual Part Transformation that gets a substring from a string. + */ +public class GetSubstring { + /** + * The index to start the substring from, inclusive. Negative numbers count from the end. -1 is the last character of a string. + */ + private final Integer low; + + /** + * The index to stop the substring at, exclusive. Negative numbers count from the end. -1 is the last character of a string. + */ + private final Integer high; + + protected GetSubstring(BuilderImpl builder) { + this.low = builder.low(); + this.high = builder.high(); + } + + /** + * @return The index to start the substring from, inclusive. Negative numbers count from the end. -1 is the last character of a string. + */ + public Integer low() { + return this.low; + } + + /** + * @return The index to stop the substring at, exclusive. Negative numbers count from the end. -1 is the last character of a string. + */ + public Integer high() { + return this.high; + } + + public Builder toBuilder() { + return new BuilderImpl(this); + } + + public static Builder builder() { + return new BuilderImpl(); + } + + public interface Builder { + /** + * @param low The index to start the substring from, inclusive. Negative numbers count from the end. -1 is the last character of a string. + */ + Builder low(Integer low); + + /** + * @return The index to start the substring from, inclusive. Negative numbers count from the end. -1 is the last character of a string. + */ + Integer low(); + + /** + * @param high The index to stop the substring at, exclusive. Negative numbers count from the end. -1 is the last character of a string. + */ + Builder high(Integer high); + + /** + * @return The index to stop the substring at, exclusive. Negative numbers count from the end. -1 is the last character of a string. + */ + Integer high(); + + GetSubstring build(); + } + + static class BuilderImpl implements Builder { + protected Integer low; + + protected Integer high; + + protected BuilderImpl() { + } + + protected BuilderImpl(GetSubstring model) { + this.low = model.low(); + this.high = model.high(); + } + + public Builder low(Integer low) { + this.low = low; + return this; + } + + public Integer low() { + return this.low; + } + + public Builder high(Integer high) { + this.high = high; + return this; + } + + public Integer high() { + return this.high; + } + + public GetSubstring build() { + if (Objects.isNull(this.low())) { + throw new IllegalArgumentException("Missing value for required field `low`"); + } + if (Objects.isNull(this.high())) { + throw new IllegalArgumentException("Missing value for required field `high`"); + } + return new GetSubstring(this); + } + } +} diff --git a/TestVectors/runtimes/java/src/main/smithy-generated/software/amazon/cryptography/dbencryptionsdk/dynamodb/model/GetSuffix.java b/TestVectors/runtimes/java/src/main/smithy-generated/software/amazon/cryptography/dbencryptionsdk/dynamodb/model/GetSuffix.java new file mode 100644 index 000000000..fd421a413 --- /dev/null +++ b/TestVectors/runtimes/java/src/main/smithy-generated/software/amazon/cryptography/dbencryptionsdk/dynamodb/model/GetSuffix.java @@ -0,0 +1,76 @@ +// Copyright Amazon.com Inc. or its affiliates. All Rights Reserved. +// SPDX-License-Identifier: Apache-2.0 +// Do not modify this file. This file is machine generated, and any changes to it will be overwritten. +package software.amazon.cryptography.dbencryptionsdk.dynamodb.model; + +import java.util.Objects; + +/** + * The Virtual Part Transformation that gets the suffix of a string. + */ +public class GetSuffix { + /** + * If positive, the number of characters to return from the end. If negative, the absolute number of characters to exclude from the front. e.g. GetSuffix(-1) returns all but the first character. + */ + private final Integer length; + + protected GetSuffix(BuilderImpl builder) { + this.length = builder.length(); + } + + /** + * @return If positive, the number of characters to return from the end. If negative, the absolute number of characters to exclude from the front. e.g. GetSuffix(-1) returns all but the first character. + */ + public Integer length() { + return this.length; + } + + public Builder toBuilder() { + return new BuilderImpl(this); + } + + public static Builder builder() { + return new BuilderImpl(); + } + + public interface Builder { + /** + * @param length If positive, the number of characters to return from the end. If negative, the absolute number of characters to exclude from the front. e.g. GetSuffix(-1) returns all but the first character. + */ + Builder length(Integer length); + + /** + * @return If positive, the number of characters to return from the end. If negative, the absolute number of characters to exclude from the front. e.g. GetSuffix(-1) returns all but the first character. + */ + Integer length(); + + GetSuffix build(); + } + + static class BuilderImpl implements Builder { + protected Integer length; + + protected BuilderImpl() { + } + + protected BuilderImpl(GetSuffix model) { + this.length = model.length(); + } + + public Builder length(Integer length) { + this.length = length; + return this; + } + + public Integer length() { + return this.length; + } + + public GetSuffix build() { + if (Objects.isNull(this.length())) { + throw new IllegalArgumentException("Missing value for required field `length`"); + } + return new GetSuffix(this); + } + } +} diff --git a/TestVectors/runtimes/java/src/main/smithy-generated/software/amazon/cryptography/dbencryptionsdk/dynamodb/model/Insert.java b/TestVectors/runtimes/java/src/main/smithy-generated/software/amazon/cryptography/dbencryptionsdk/dynamodb/model/Insert.java new file mode 100644 index 000000000..031648da5 --- /dev/null +++ b/TestVectors/runtimes/java/src/main/smithy-generated/software/amazon/cryptography/dbencryptionsdk/dynamodb/model/Insert.java @@ -0,0 +1,76 @@ +// Copyright Amazon.com Inc. or its affiliates. All Rights Reserved. +// SPDX-License-Identifier: Apache-2.0 +// Do not modify this file. This file is machine generated, and any changes to it will be overwritten. +package software.amazon.cryptography.dbencryptionsdk.dynamodb.model; + +import java.util.Objects; + +/** + * The Virtual Part Transformation that appends a literal string. + */ +public class Insert { + /** + * The literal string to append. + */ + private final String literal; + + protected Insert(BuilderImpl builder) { + this.literal = builder.literal(); + } + + /** + * @return The literal string to append. + */ + public String literal() { + return this.literal; + } + + public Builder toBuilder() { + return new BuilderImpl(this); + } + + public static Builder builder() { + return new BuilderImpl(); + } + + public interface Builder { + /** + * @param literal The literal string to append. + */ + Builder literal(String literal); + + /** + * @return The literal string to append. + */ + String literal(); + + Insert build(); + } + + static class BuilderImpl implements Builder { + protected String literal; + + protected BuilderImpl() { + } + + protected BuilderImpl(Insert model) { + this.literal = model.literal(); + } + + public Builder literal(String literal) { + this.literal = literal; + return this; + } + + public String literal() { + return this.literal; + } + + public Insert build() { + if (Objects.isNull(this.literal())) { + throw new IllegalArgumentException("Missing value for required field `literal`"); + } + return new Insert(this); + } + } +} diff --git a/TestVectors/runtimes/java/src/main/smithy-generated/software/amazon/cryptography/dbencryptionsdk/dynamodb/model/LegacyOverride.java b/TestVectors/runtimes/java/src/main/smithy-generated/software/amazon/cryptography/dbencryptionsdk/dynamodb/model/LegacyOverride.java new file mode 100644 index 000000000..268864f59 --- /dev/null +++ b/TestVectors/runtimes/java/src/main/smithy-generated/software/amazon/cryptography/dbencryptionsdk/dynamodb/model/LegacyOverride.java @@ -0,0 +1,191 @@ +// Copyright Amazon.com Inc. or its affiliates. All Rights Reserved. +// SPDX-License-Identifier: Apache-2.0 +// Do not modify this file. This file is machine generated, and any changes to it will be overwritten. +package software.amazon.cryptography.dbencryptionsdk.dynamodb.model; + +import java.util.Map; +import java.util.Objects; +import software.amazon.cryptography.dbencryptionsdk.dynamodb.ILegacyDynamoDbEncryptor; +import software.amazon.cryptography.dbencryptionsdk.dynamodb.LegacyDynamoDbEncryptor; +import software.amazon.cryptography.dbencryptionsdk.structuredencryption.model.CryptoAction; + +/** + * A configuration for overriding encryption and/or decryption to instead perform legacy encryption and decryption. + */ +public class LegacyOverride { + /** + * A policy which configurates whether legacy behavior overrides encryption and/or decryption. + */ + private final LegacyPolicy policy; + + /** + * A configuration for the legacy DynamoDB Encryption Client's Encryptor. + */ + private final ILegacyDynamoDbEncryptor encryptor; + + /** + * Overrides which attributes are encrypted and/or signed for any items read or written with legacy behavior. + */ + private final Map attributeActionsOnEncrypt; + + /** + * This input is not used in the Java Client and should not be specified. + */ + private final CryptoAction defaultAttributeFlag; + + protected LegacyOverride(BuilderImpl builder) { + this.policy = builder.policy(); + this.encryptor = builder.encryptor(); + this.attributeActionsOnEncrypt = builder.attributeActionsOnEncrypt(); + this.defaultAttributeFlag = builder.defaultAttributeFlag(); + } + + /** + * @return A policy which configurates whether legacy behavior overrides encryption and/or decryption. + */ + public LegacyPolicy policy() { + return this.policy; + } + + /** + * @return A configuration for the legacy DynamoDB Encryption Client's Encryptor. + */ + public ILegacyDynamoDbEncryptor encryptor() { + return this.encryptor; + } + + /** + * @return Overrides which attributes are encrypted and/or signed for any items read or written with legacy behavior. + */ + public Map attributeActionsOnEncrypt() { + return this.attributeActionsOnEncrypt; + } + + /** + * @return This input is not used in the Java Client and should not be specified. + */ + public CryptoAction defaultAttributeFlag() { + return this.defaultAttributeFlag; + } + + public Builder toBuilder() { + return new BuilderImpl(this); + } + + public static Builder builder() { + return new BuilderImpl(); + } + + public interface Builder { + /** + * @param policy A policy which configurates whether legacy behavior overrides encryption and/or decryption. + */ + Builder policy(LegacyPolicy policy); + + /** + * @return A policy which configurates whether legacy behavior overrides encryption and/or decryption. + */ + LegacyPolicy policy(); + + /** + * @param encryptor A configuration for the legacy DynamoDB Encryption Client's Encryptor. + */ + Builder encryptor(ILegacyDynamoDbEncryptor encryptor); + + /** + * @return A configuration for the legacy DynamoDB Encryption Client's Encryptor. + */ + ILegacyDynamoDbEncryptor encryptor(); + + /** + * @param attributeActionsOnEncrypt Overrides which attributes are encrypted and/or signed for any items read or written with legacy behavior. + */ + Builder attributeActionsOnEncrypt(Map attributeActionsOnEncrypt); + + /** + * @return Overrides which attributes are encrypted and/or signed for any items read or written with legacy behavior. + */ + Map attributeActionsOnEncrypt(); + + /** + * @param defaultAttributeFlag This input is not used in the Java Client and should not be specified. + */ + Builder defaultAttributeFlag(CryptoAction defaultAttributeFlag); + + /** + * @return This input is not used in the Java Client and should not be specified. + */ + CryptoAction defaultAttributeFlag(); + + LegacyOverride build(); + } + + static class BuilderImpl implements Builder { + protected LegacyPolicy policy; + + protected ILegacyDynamoDbEncryptor encryptor; + + protected Map attributeActionsOnEncrypt; + + protected CryptoAction defaultAttributeFlag; + + protected BuilderImpl() { + } + + protected BuilderImpl(LegacyOverride model) { + this.policy = model.policy(); + this.encryptor = model.encryptor(); + this.attributeActionsOnEncrypt = model.attributeActionsOnEncrypt(); + this.defaultAttributeFlag = model.defaultAttributeFlag(); + } + + public Builder policy(LegacyPolicy policy) { + this.policy = policy; + return this; + } + + public LegacyPolicy policy() { + return this.policy; + } + + public Builder encryptor(ILegacyDynamoDbEncryptor encryptor) { + this.encryptor = LegacyDynamoDbEncryptor.wrap(encryptor); + return this; + } + + public ILegacyDynamoDbEncryptor encryptor() { + return this.encryptor; + } + + public Builder attributeActionsOnEncrypt(Map attributeActionsOnEncrypt) { + this.attributeActionsOnEncrypt = attributeActionsOnEncrypt; + return this; + } + + public Map attributeActionsOnEncrypt() { + return this.attributeActionsOnEncrypt; + } + + public Builder defaultAttributeFlag(CryptoAction defaultAttributeFlag) { + this.defaultAttributeFlag = defaultAttributeFlag; + return this; + } + + public CryptoAction defaultAttributeFlag() { + return this.defaultAttributeFlag; + } + + public LegacyOverride build() { + if (Objects.isNull(this.policy())) { + throw new IllegalArgumentException("Missing value for required field `policy`"); + } + if (Objects.isNull(this.encryptor())) { + throw new IllegalArgumentException("Missing value for required field `encryptor`"); + } + if (Objects.isNull(this.attributeActionsOnEncrypt())) { + throw new IllegalArgumentException("Missing value for required field `attributeActionsOnEncrypt`"); + } + return new LegacyOverride(this); + } + } +} diff --git a/TestVectors/runtimes/java/src/main/smithy-generated/software/amazon/cryptography/dbencryptionsdk/dynamodb/model/LegacyPolicy.java b/TestVectors/runtimes/java/src/main/smithy-generated/software/amazon/cryptography/dbencryptionsdk/dynamodb/model/LegacyPolicy.java new file mode 100644 index 000000000..6b56e2c5d --- /dev/null +++ b/TestVectors/runtimes/java/src/main/smithy-generated/software/amazon/cryptography/dbencryptionsdk/dynamodb/model/LegacyPolicy.java @@ -0,0 +1,22 @@ +// Copyright Amazon.com Inc. or its affiliates. All Rights Reserved. +// SPDX-License-Identifier: Apache-2.0 +// Do not modify this file. This file is machine generated, and any changes to it will be overwritten. +package software.amazon.cryptography.dbencryptionsdk.dynamodb.model; + +public enum LegacyPolicy { + FORCE_LEGACY_ENCRYPT_ALLOW_LEGACY_DECRYPT("FORCE_LEGACY_ENCRYPT_ALLOW_LEGACY_DECRYPT"), + + FORBID_LEGACY_ENCRYPT_ALLOW_LEGACY_DECRYPT("FORBID_LEGACY_ENCRYPT_ALLOW_LEGACY_DECRYPT"), + + FORBID_LEGACY_ENCRYPT_FORBID_LEGACY_DECRYPT("FORBID_LEGACY_ENCRYPT_FORBID_LEGACY_DECRYPT"); + + private final String value; + + private LegacyPolicy(String value) { + this.value = value; + } + + public String toString() { + return String.valueOf(value); + } +} diff --git a/TestVectors/runtimes/java/src/main/smithy-generated/software/amazon/cryptography/dbencryptionsdk/dynamodb/model/Lower.java b/TestVectors/runtimes/java/src/main/smithy-generated/software/amazon/cryptography/dbencryptionsdk/dynamodb/model/Lower.java new file mode 100644 index 000000000..f7d1637c1 --- /dev/null +++ b/TestVectors/runtimes/java/src/main/smithy-generated/software/amazon/cryptography/dbencryptionsdk/dynamodb/model/Lower.java @@ -0,0 +1,36 @@ +// Copyright Amazon.com Inc. or its affiliates. All Rights Reserved. +// SPDX-License-Identifier: Apache-2.0 +// Do not modify this file. This file is machine generated, and any changes to it will be overwritten. +package software.amazon.cryptography.dbencryptionsdk.dynamodb.model; + +/** + * The Virtual Part Transformation that converts ASCII characters to lower case. + */ +public class Lower { + protected Lower(BuilderImpl builder) { + } + + public Builder toBuilder() { + return new BuilderImpl(this); + } + + public static Builder builder() { + return new BuilderImpl(); + } + + public interface Builder { + Lower build(); + } + + static class BuilderImpl implements Builder { + protected BuilderImpl() { + } + + protected BuilderImpl(Lower model) { + } + + public Lower build() { + return new Lower(this); + } + } +} diff --git a/TestVectors/runtimes/java/src/main/smithy-generated/software/amazon/cryptography/dbencryptionsdk/dynamodb/model/MultiKeyStore.java b/TestVectors/runtimes/java/src/main/smithy-generated/software/amazon/cryptography/dbencryptionsdk/dynamodb/model/MultiKeyStore.java new file mode 100644 index 000000000..cbb58f3f8 --- /dev/null +++ b/TestVectors/runtimes/java/src/main/smithy-generated/software/amazon/cryptography/dbencryptionsdk/dynamodb/model/MultiKeyStore.java @@ -0,0 +1,150 @@ +// Copyright Amazon.com Inc. or its affiliates. All Rights Reserved. +// SPDX-License-Identifier: Apache-2.0 +// Do not modify this file. This file is machine generated, and any changes to it will be overwritten. +package software.amazon.cryptography.dbencryptionsdk.dynamodb.model; + +import java.util.Objects; +import software.amazon.cryptography.materialproviders.model.CacheType; + +/** + * The configuration for using multiple Beacon Keys. + */ +public class MultiKeyStore { + /** + * The name of the field that stores the Beacon Key. This may be a Virtual Field. + */ + private final String keyFieldName; + + /** + * How long (in seconds) the beacon key material is cached locally before it is re-retrieved from DynamoDB and re-authed with AWS KMS. + */ + private final Integer cacheTTL; + + /** + * Which type of local cache to use. + */ + private final CacheType cache; + + protected MultiKeyStore(BuilderImpl builder) { + this.keyFieldName = builder.keyFieldName(); + this.cacheTTL = builder.cacheTTL(); + this.cache = builder.cache(); + } + + /** + * @return The name of the field that stores the Beacon Key. This may be a Virtual Field. + */ + public String keyFieldName() { + return this.keyFieldName; + } + + /** + * @return How long (in seconds) the beacon key material is cached locally before it is re-retrieved from DynamoDB and re-authed with AWS KMS. + */ + public Integer cacheTTL() { + return this.cacheTTL; + } + + /** + * @return Which type of local cache to use. + */ + public CacheType cache() { + return this.cache; + } + + public Builder toBuilder() { + return new BuilderImpl(this); + } + + public static Builder builder() { + return new BuilderImpl(); + } + + public interface Builder { + /** + * @param keyFieldName The name of the field that stores the Beacon Key. This may be a Virtual Field. + */ + Builder keyFieldName(String keyFieldName); + + /** + * @return The name of the field that stores the Beacon Key. This may be a Virtual Field. + */ + String keyFieldName(); + + /** + * @param cacheTTL How long (in seconds) the beacon key material is cached locally before it is re-retrieved from DynamoDB and re-authed with AWS KMS. + */ + Builder cacheTTL(Integer cacheTTL); + + /** + * @return How long (in seconds) the beacon key material is cached locally before it is re-retrieved from DynamoDB and re-authed with AWS KMS. + */ + Integer cacheTTL(); + + /** + * @param cache Which type of local cache to use. + */ + Builder cache(CacheType cache); + + /** + * @return Which type of local cache to use. + */ + CacheType cache(); + + MultiKeyStore build(); + } + + static class BuilderImpl implements Builder { + protected String keyFieldName; + + protected Integer cacheTTL; + + protected CacheType cache; + + protected BuilderImpl() { + } + + protected BuilderImpl(MultiKeyStore model) { + this.keyFieldName = model.keyFieldName(); + this.cacheTTL = model.cacheTTL(); + this.cache = model.cache(); + } + + public Builder keyFieldName(String keyFieldName) { + this.keyFieldName = keyFieldName; + return this; + } + + public String keyFieldName() { + return this.keyFieldName; + } + + public Builder cacheTTL(Integer cacheTTL) { + this.cacheTTL = cacheTTL; + return this; + } + + public Integer cacheTTL() { + return this.cacheTTL; + } + + public Builder cache(CacheType cache) { + this.cache = cache; + return this; + } + + public CacheType cache() { + return this.cache; + } + + public MultiKeyStore build() { + if (Objects.isNull(this.keyFieldName())) { + throw new IllegalArgumentException("Missing value for required field `keyFieldName`"); + } + if (Objects.isNull(this.cacheTTL())) { + throw new IllegalArgumentException("Missing value for required field `cacheTTL`"); + } + return new MultiKeyStore(this); + } + } +} diff --git a/TestVectors/runtimes/java/src/main/smithy-generated/software/amazon/cryptography/dbencryptionsdk/dynamodb/model/OpaqueError.java b/TestVectors/runtimes/java/src/main/smithy-generated/software/amazon/cryptography/dbencryptionsdk/dynamodb/model/OpaqueError.java new file mode 100644 index 000000000..377a322a5 --- /dev/null +++ b/TestVectors/runtimes/java/src/main/smithy-generated/software/amazon/cryptography/dbencryptionsdk/dynamodb/model/OpaqueError.java @@ -0,0 +1,142 @@ +// Copyright Amazon.com Inc. or its affiliates. All Rights Reserved. +// SPDX-License-Identifier: Apache-2.0 +// Do not modify this file. This file is machine generated, and any changes to it will be overwritten. +package software.amazon.cryptography.dbencryptionsdk.dynamodb.model; + +public class OpaqueError extends RuntimeException { + /** + * The unexpected object encountered. It MIGHT BE an Exception, but that is not guaranteed. + */ + private final Object obj; + + protected OpaqueError(BuilderImpl builder) { + super(messageFromBuilder(builder), builder.cause()); + this.obj = builder.obj(); + } + + private static String messageFromBuilder(Builder builder) { + if (builder.message() != null) { + return builder.message(); + } + if (builder.cause() != null) { + return builder.cause().getMessage(); + } + return null; + } + + /** + * See {@link Throwable#getMessage()}. + */ + public String message() { + return this.getMessage(); + } + + /** + * See {@link Throwable#getCause()}. + */ + public Throwable cause() { + return this.getCause(); + } + + /** + * @return The unexpected object encountered. It MIGHT BE an Exception, but that is not guaranteed. + */ + public Object obj() { + return this.obj; + } + + public Builder toBuilder() { + return new BuilderImpl(this); + } + + public static Builder builder() { + return new BuilderImpl(); + } + + public interface Builder { + /** + * @param message The detailed message. The detail message is saved for later retrieval by the {@link #getMessage()} method. + */ + Builder message(String message); + + /** + * @return The detailed message. The detail message is saved for later retrieval by the {@link #getMessage()} method. + */ + String message(); + + /** + * @param cause The cause (which is saved for later retrieval by the {@link #getCause()} method). (A {@code null} value is permitted, and indicates that the cause is nonexistent or unknown.) + */ + Builder cause(Throwable cause); + + /** + * @return The cause (which is saved for later retrieval by the {@link #getCause()} method). (A {@code null} value is permitted, and indicates that the cause is nonexistent or unknown.) + */ + Throwable cause(); + + /** + * @param obj The unexpected object encountered. It MIGHT BE an Exception, but that is not guaranteed. + */ + Builder obj(Object obj); + + /** + * @return The unexpected object encountered. It MIGHT BE an Exception, but that is not guaranteed. + */ + Object obj(); + + OpaqueError build(); + } + + static class BuilderImpl implements Builder { + protected String message; + + protected Throwable cause; + + protected Object obj; + + protected BuilderImpl() { + } + + protected BuilderImpl(OpaqueError model) { + this.cause = model.getCause(); + this.message = model.getMessage(); + this.obj = model.obj(); + } + + public Builder message(String message) { + this.message = message; + return this; + } + + public String message() { + return this.message; + } + + public Builder cause(Throwable cause) { + this.cause = cause; + return this; + } + + public Throwable cause() { + return this.cause; + } + + public Builder obj(Object obj) { + this.obj = obj; + return this; + } + + public Object obj() { + return this.obj; + } + + public OpaqueError build() { + if (this.obj != null && this.cause == null && this.obj instanceof Throwable) { + this.cause = (Throwable) this.obj; + } else if (this.obj == null && this.cause != null) { + this.obj = this.cause; + } + return new OpaqueError(this); + } + } +} diff --git a/TestVectors/runtimes/java/src/main/smithy-generated/software/amazon/cryptography/dbencryptionsdk/dynamodb/model/PartOnly.java b/TestVectors/runtimes/java/src/main/smithy-generated/software/amazon/cryptography/dbencryptionsdk/dynamodb/model/PartOnly.java new file mode 100644 index 000000000..dfd41a508 --- /dev/null +++ b/TestVectors/runtimes/java/src/main/smithy-generated/software/amazon/cryptography/dbencryptionsdk/dynamodb/model/PartOnly.java @@ -0,0 +1,36 @@ +// Copyright Amazon.com Inc. or its affiliates. All Rights Reserved. +// SPDX-License-Identifier: Apache-2.0 +// Do not modify this file. This file is machine generated, and any changes to it will be overwritten. +package software.amazon.cryptography.dbencryptionsdk.dynamodb.model; + +/** + * Attribute must be used as part of a Compound Beacon, never alone. + */ +public class PartOnly { + protected PartOnly(BuilderImpl builder) { + } + + public Builder toBuilder() { + return new BuilderImpl(this); + } + + public static Builder builder() { + return new BuilderImpl(); + } + + public interface Builder { + PartOnly build(); + } + + static class BuilderImpl implements Builder { + protected BuilderImpl() { + } + + protected BuilderImpl(PartOnly model) { + } + + public PartOnly build() { + return new PartOnly(this); + } + } +} diff --git a/TestVectors/runtimes/java/src/main/smithy-generated/software/amazon/cryptography/dbencryptionsdk/dynamodb/model/PlaintextOverride.java b/TestVectors/runtimes/java/src/main/smithy-generated/software/amazon/cryptography/dbencryptionsdk/dynamodb/model/PlaintextOverride.java new file mode 100644 index 000000000..e440ef064 --- /dev/null +++ b/TestVectors/runtimes/java/src/main/smithy-generated/software/amazon/cryptography/dbencryptionsdk/dynamodb/model/PlaintextOverride.java @@ -0,0 +1,22 @@ +// Copyright Amazon.com Inc. or its affiliates. All Rights Reserved. +// SPDX-License-Identifier: Apache-2.0 +// Do not modify this file. This file is machine generated, and any changes to it will be overwritten. +package software.amazon.cryptography.dbencryptionsdk.dynamodb.model; + +public enum PlaintextOverride { + FORCE_PLAINTEXT_WRITE_ALLOW_PLAINTEXT_READ("FORCE_PLAINTEXT_WRITE_ALLOW_PLAINTEXT_READ"), + + FORBID_PLAINTEXT_WRITE_ALLOW_PLAINTEXT_READ("FORBID_PLAINTEXT_WRITE_ALLOW_PLAINTEXT_READ"), + + FORBID_PLAINTEXT_WRITE_FORBID_PLAINTEXT_READ("FORBID_PLAINTEXT_WRITE_FORBID_PLAINTEXT_READ"); + + private final String value; + + private PlaintextOverride(String value) { + this.value = value; + } + + public String toString() { + return String.valueOf(value); + } +} diff --git a/TestVectors/runtimes/java/src/main/smithy-generated/software/amazon/cryptography/dbencryptionsdk/dynamodb/model/SearchConfig.java b/TestVectors/runtimes/java/src/main/smithy-generated/software/amazon/cryptography/dbencryptionsdk/dynamodb/model/SearchConfig.java new file mode 100644 index 000000000..2f73db6f5 --- /dev/null +++ b/TestVectors/runtimes/java/src/main/smithy-generated/software/amazon/cryptography/dbencryptionsdk/dynamodb/model/SearchConfig.java @@ -0,0 +1,128 @@ +// Copyright Amazon.com Inc. or its affiliates. All Rights Reserved. +// SPDX-License-Identifier: Apache-2.0 +// Do not modify this file. This file is machine generated, and any changes to it will be overwritten. +package software.amazon.cryptography.dbencryptionsdk.dynamodb.model; + +import java.util.List; +import java.util.Objects; + +/** + * The configuration for searchable encryption. + */ +public class SearchConfig { + /** + * The versions of searchable encryption to support reading. Currently must contain a single configuration with version '1'. + */ + private final List versions; + + /** + * The searchable encryption version to use when writing new items. Must be '1'. + */ + private final int writeVersion; + + protected SearchConfig(BuilderImpl builder) { + this.versions = builder.versions(); + this.writeVersion = builder.writeVersion(); + } + + /** + * @return The versions of searchable encryption to support reading. Currently must contain a single configuration with version '1'. + */ + public List versions() { + return this.versions; + } + + /** + * @return The searchable encryption version to use when writing new items. Must be '1'. + */ + public int writeVersion() { + return this.writeVersion; + } + + public Builder toBuilder() { + return new BuilderImpl(this); + } + + public static Builder builder() { + return new BuilderImpl(); + } + + public interface Builder { + /** + * @param versions The versions of searchable encryption to support reading. Currently must contain a single configuration with version '1'. + */ + Builder versions(List versions); + + /** + * @return The versions of searchable encryption to support reading. Currently must contain a single configuration with version '1'. + */ + List versions(); + + /** + * @param writeVersion The searchable encryption version to use when writing new items. Must be '1'. + */ + Builder writeVersion(int writeVersion); + + /** + * @return The searchable encryption version to use when writing new items. Must be '1'. + */ + int writeVersion(); + + SearchConfig build(); + } + + static class BuilderImpl implements Builder { + protected List versions; + + protected int writeVersion; + + private boolean _writeVersionSet = false; + + protected BuilderImpl() { + } + + protected BuilderImpl(SearchConfig model) { + this.versions = model.versions(); + this.writeVersion = model.writeVersion(); + this._writeVersionSet = true; + } + + public Builder versions(List versions) { + this.versions = versions; + return this; + } + + public List versions() { + return this.versions; + } + + public Builder writeVersion(int writeVersion) { + this.writeVersion = writeVersion; + this._writeVersionSet = true; + return this; + } + + public int writeVersion() { + return this.writeVersion; + } + + public SearchConfig build() { + if (Objects.isNull(this.versions())) { + throw new IllegalArgumentException("Missing value for required field `versions`"); + } + if (Objects.nonNull(this.versions()) && this.versions().size() < 1) { + throw new IllegalArgumentException("The size of `versions` must be greater than or equal to 1"); + } + if (Objects.nonNull(this.versions()) && this.versions().size() > 1) { + throw new IllegalArgumentException("The size of `versions` must be less than or equal to 1"); + } + if (!this._writeVersionSet) { + throw new IllegalArgumentException("Missing value for required field `writeVersion`"); + } + if (this._writeVersionSet && this.writeVersion() < 1) { + throw new IllegalArgumentException("`writeVersion` must be greater than or equal to 1"); + } + return new SearchConfig(this); + } + } +} diff --git a/TestVectors/runtimes/java/src/main/smithy-generated/software/amazon/cryptography/dbencryptionsdk/dynamodb/model/Shared.java b/TestVectors/runtimes/java/src/main/smithy-generated/software/amazon/cryptography/dbencryptionsdk/dynamodb/model/Shared.java new file mode 100644 index 000000000..4be82055a --- /dev/null +++ b/TestVectors/runtimes/java/src/main/smithy-generated/software/amazon/cryptography/dbencryptionsdk/dynamodb/model/Shared.java @@ -0,0 +1,76 @@ +// Copyright Amazon.com Inc. or its affiliates. All Rights Reserved. +// SPDX-License-Identifier: Apache-2.0 +// Do not modify this file. This file is machine generated, and any changes to it will be overwritten. +package software.amazon.cryptography.dbencryptionsdk.dynamodb.model; + +import java.util.Objects; + +/** + * This beacon should calculate values like another beacon, so they can be compared. + */ +public class Shared { + /** + * Calculate beacon values as for this beacon. + */ + private final String other; + + protected Shared(BuilderImpl builder) { + this.other = builder.other(); + } + + /** + * @return Calculate beacon values as for this beacon. + */ + public String other() { + return this.other; + } + + public Builder toBuilder() { + return new BuilderImpl(this); + } + + public static Builder builder() { + return new BuilderImpl(); + } + + public interface Builder { + /** + * @param other Calculate beacon values as for this beacon. + */ + Builder other(String other); + + /** + * @return Calculate beacon values as for this beacon. + */ + String other(); + + Shared build(); + } + + static class BuilderImpl implements Builder { + protected String other; + + protected BuilderImpl() { + } + + protected BuilderImpl(Shared model) { + this.other = model.other(); + } + + public Builder other(String other) { + this.other = other; + return this; + } + + public String other() { + return this.other; + } + + public Shared build() { + if (Objects.isNull(this.other())) { + throw new IllegalArgumentException("Missing value for required field `other`"); + } + return new Shared(this); + } + } +} diff --git a/TestVectors/runtimes/java/src/main/smithy-generated/software/amazon/cryptography/dbencryptionsdk/dynamodb/model/SharedSet.java b/TestVectors/runtimes/java/src/main/smithy-generated/software/amazon/cryptography/dbencryptionsdk/dynamodb/model/SharedSet.java new file mode 100644 index 000000000..9b51d0c98 --- /dev/null +++ b/TestVectors/runtimes/java/src/main/smithy-generated/software/amazon/cryptography/dbencryptionsdk/dynamodb/model/SharedSet.java @@ -0,0 +1,76 @@ +// Copyright Amazon.com Inc. or its affiliates. All Rights Reserved. +// SPDX-License-Identifier: Apache-2.0 +// Do not modify this file. This file is machine generated, and any changes to it will be overwritten. +package software.amazon.cryptography.dbencryptionsdk.dynamodb.model; + +import java.util.Objects; + +/** + * Both Shared and AsSet. + */ +public class SharedSet { + /** + * Calculate beacon values as for this beacon. + */ + private final String other; + + protected SharedSet(BuilderImpl builder) { + this.other = builder.other(); + } + + /** + * @return Calculate beacon values as for this beacon. + */ + public String other() { + return this.other; + } + + public Builder toBuilder() { + return new BuilderImpl(this); + } + + public static Builder builder() { + return new BuilderImpl(); + } + + public interface Builder { + /** + * @param other Calculate beacon values as for this beacon. + */ + Builder other(String other); + + /** + * @return Calculate beacon values as for this beacon. + */ + String other(); + + SharedSet build(); + } + + static class BuilderImpl implements Builder { + protected String other; + + protected BuilderImpl() { + } + + protected BuilderImpl(SharedSet model) { + this.other = model.other(); + } + + public Builder other(String other) { + this.other = other; + return this; + } + + public String other() { + return this.other; + } + + public SharedSet build() { + if (Objects.isNull(this.other())) { + throw new IllegalArgumentException("Missing value for required field `other`"); + } + return new SharedSet(this); + } + } +} diff --git a/TestVectors/runtimes/java/src/main/smithy-generated/software/amazon/cryptography/dbencryptionsdk/dynamodb/model/SignedPart.java b/TestVectors/runtimes/java/src/main/smithy-generated/software/amazon/cryptography/dbencryptionsdk/dynamodb/model/SignedPart.java new file mode 100644 index 000000000..2166a61f2 --- /dev/null +++ b/TestVectors/runtimes/java/src/main/smithy-generated/software/amazon/cryptography/dbencryptionsdk/dynamodb/model/SignedPart.java @@ -0,0 +1,155 @@ +// Copyright Amazon.com Inc. or its affiliates. All Rights Reserved. +// SPDX-License-Identifier: Apache-2.0 +// Do not modify this file. This file is machine generated, and any changes to it will be overwritten. +package software.amazon.cryptography.dbencryptionsdk.dynamodb.model; + +import java.util.Objects; + +/** + * A part of a Compound Beacon that contains signed plaintext data. + */ +public class SignedPart { + /** + * The name for this Signed Part. + */ + private final String name; + + /** + * The prefix that is written with this Signed Part. + */ + private final String prefix; + + /** + * The DynamoDB document path to the value for this Signed Part. If not provided, the 'name' is used for the location. + */ + private final String loc; + + protected SignedPart(BuilderImpl builder) { + this.name = builder.name(); + this.prefix = builder.prefix(); + this.loc = builder.loc(); + } + + /** + * @return The name for this Signed Part. + */ + public String name() { + return this.name; + } + + /** + * @return The prefix that is written with this Signed Part. + */ + public String prefix() { + return this.prefix; + } + + /** + * @return The DynamoDB document path to the value for this Signed Part. If not provided, the 'name' is used for the location. + */ + public String loc() { + return this.loc; + } + + public Builder toBuilder() { + return new BuilderImpl(this); + } + + public static Builder builder() { + return new BuilderImpl(); + } + + public interface Builder { + /** + * @param name The name for this Signed Part. + */ + Builder name(String name); + + /** + * @return The name for this Signed Part. + */ + String name(); + + /** + * @param prefix The prefix that is written with this Signed Part. + */ + Builder prefix(String prefix); + + /** + * @return The prefix that is written with this Signed Part. + */ + String prefix(); + + /** + * @param loc The DynamoDB document path to the value for this Signed Part. If not provided, the 'name' is used for the location. + */ + Builder loc(String loc); + + /** + * @return The DynamoDB document path to the value for this Signed Part. If not provided, the 'name' is used for the location. + */ + String loc(); + + SignedPart build(); + } + + static class BuilderImpl implements Builder { + protected String name; + + protected String prefix; + + protected String loc; + + protected BuilderImpl() { + } + + protected BuilderImpl(SignedPart model) { + this.name = model.name(); + this.prefix = model.prefix(); + this.loc = model.loc(); + } + + public Builder name(String name) { + this.name = name; + return this; + } + + public String name() { + return this.name; + } + + public Builder prefix(String prefix) { + this.prefix = prefix; + return this; + } + + public String prefix() { + return this.prefix; + } + + public Builder loc(String loc) { + this.loc = loc; + return this; + } + + public String loc() { + return this.loc; + } + + public SignedPart build() { + if (Objects.isNull(this.name())) { + throw new IllegalArgumentException("Missing value for required field `name`"); + } + if (Objects.isNull(this.prefix())) { + throw new IllegalArgumentException("Missing value for required field `prefix`"); + } + if (Objects.nonNull(this.prefix()) && this.prefix().length() < 1) { + throw new IllegalArgumentException("The size of `prefix` must be greater than or equal to 1"); + } + if (Objects.nonNull(this.loc()) && this.loc().length() < 1) { + throw new IllegalArgumentException("The size of `loc` must be greater than or equal to 1"); + } + return new SignedPart(this); + } + } +} diff --git a/TestVectors/runtimes/java/src/main/smithy-generated/software/amazon/cryptography/dbencryptionsdk/dynamodb/model/SingleKeyStore.java b/TestVectors/runtimes/java/src/main/smithy-generated/software/amazon/cryptography/dbencryptionsdk/dynamodb/model/SingleKeyStore.java new file mode 100644 index 000000000..b4b520805 --- /dev/null +++ b/TestVectors/runtimes/java/src/main/smithy-generated/software/amazon/cryptography/dbencryptionsdk/dynamodb/model/SingleKeyStore.java @@ -0,0 +1,114 @@ +// Copyright Amazon.com Inc. or its affiliates. All Rights Reserved. +// SPDX-License-Identifier: Apache-2.0 +// Do not modify this file. This file is machine generated, and any changes to it will be overwritten. +package software.amazon.cryptography.dbencryptionsdk.dynamodb.model; + +import java.util.Objects; + +/** + * The configuration for using a single Beacon Key. + */ +public class SingleKeyStore { + /** + * The Beacon Key ID. + */ + private final String keyId; + + /** + * How long (in seconds) the beacon key material is cached locally before it is re-retrieved from DynamoDB and re-authed with AWS KMS. + */ + private final Integer cacheTTL; + + protected SingleKeyStore(BuilderImpl builder) { + this.keyId = builder.keyId(); + this.cacheTTL = builder.cacheTTL(); + } + + /** + * @return The Beacon Key ID. + */ + public String keyId() { + return this.keyId; + } + + /** + * @return How long (in seconds) the beacon key material is cached locally before it is re-retrieved from DynamoDB and re-authed with AWS KMS. + */ + public Integer cacheTTL() { + return this.cacheTTL; + } + + public Builder toBuilder() { + return new BuilderImpl(this); + } + + public static Builder builder() { + return new BuilderImpl(); + } + + public interface Builder { + /** + * @param keyId The Beacon Key ID. + */ + Builder keyId(String keyId); + + /** + * @return The Beacon Key ID. + */ + String keyId(); + + /** + * @param cacheTTL How long (in seconds) the beacon key material is cached locally before it is re-retrieved from DynamoDB and re-authed with AWS KMS. + */ + Builder cacheTTL(Integer cacheTTL); + + /** + * @return How long (in seconds) the beacon key material is cached locally before it is re-retrieved from DynamoDB and re-authed with AWS KMS. + */ + Integer cacheTTL(); + + SingleKeyStore build(); + } + + static class BuilderImpl implements Builder { + protected String keyId; + + protected Integer cacheTTL; + + protected BuilderImpl() { + } + + protected BuilderImpl(SingleKeyStore model) { + this.keyId = model.keyId(); + this.cacheTTL = model.cacheTTL(); + } + + public Builder keyId(String keyId) { + this.keyId = keyId; + return this; + } + + public String keyId() { + return this.keyId; + } + + public Builder cacheTTL(Integer cacheTTL) { + this.cacheTTL = cacheTTL; + return this; + } + + public Integer cacheTTL() { + return this.cacheTTL; + } + + public SingleKeyStore build() { + if (Objects.isNull(this.keyId())) { + throw new IllegalArgumentException("Missing value for required field `keyId`"); + } + if (Objects.isNull(this.cacheTTL())) { + throw new IllegalArgumentException("Missing value for required field `cacheTTL`"); + } + return new SingleKeyStore(this); + } + } +} diff --git a/TestVectors/runtimes/java/src/main/smithy-generated/software/amazon/cryptography/dbencryptionsdk/dynamodb/model/StandardBeacon.java b/TestVectors/runtimes/java/src/main/smithy-generated/software/amazon/cryptography/dbencryptionsdk/dynamodb/model/StandardBeacon.java new file mode 100644 index 000000000..bcd24a6ca --- /dev/null +++ b/TestVectors/runtimes/java/src/main/smithy-generated/software/amazon/cryptography/dbencryptionsdk/dynamodb/model/StandardBeacon.java @@ -0,0 +1,197 @@ +// Copyright Amazon.com Inc. or its affiliates. All Rights Reserved. +// SPDX-License-Identifier: Apache-2.0 +// Do not modify this file. This file is machine generated, and any changes to it will be overwritten. +package software.amazon.cryptography.dbencryptionsdk.dynamodb.model; + +import java.util.Objects; + +/** + * The configuration for a Standard Beacon. + */ +public class StandardBeacon { + /** + * The name for this Standard Beacon. + */ + private final String name; + + /** + * The length of the calculated beacon. + */ + private final int length; + + /** + * The DynamoDB document path to the value this beacon will calculate over. If not specified, the beacon will calculate values for the attribute with the name specified in 'name'. + */ + private final String loc; + + /** + * Optional augmented behavior. + */ + private final BeaconStyle style; + + protected StandardBeacon(BuilderImpl builder) { + this.name = builder.name(); + this.length = builder.length(); + this.loc = builder.loc(); + this.style = builder.style(); + } + + /** + * @return The name for this Standard Beacon. + */ + public String name() { + return this.name; + } + + /** + * @return The length of the calculated beacon. + */ + public int length() { + return this.length; + } + + /** + * @return The DynamoDB document path to the value this beacon will calculate over. If not specified, the beacon will calculate values for the attribute with the name specified in 'name'. + */ + public String loc() { + return this.loc; + } + + /** + * @return Optional augmented behavior. + */ + public BeaconStyle style() { + return this.style; + } + + public Builder toBuilder() { + return new BuilderImpl(this); + } + + public static Builder builder() { + return new BuilderImpl(); + } + + public interface Builder { + /** + * @param name The name for this Standard Beacon. + */ + Builder name(String name); + + /** + * @return The name for this Standard Beacon. + */ + String name(); + + /** + * @param length The length of the calculated beacon. + */ + Builder length(int length); + + /** + * @return The length of the calculated beacon. + */ + int length(); + + /** + * @param loc The DynamoDB document path to the value this beacon will calculate over. If not specified, the beacon will calculate values for the attribute with the name specified in 'name'. + */ + Builder loc(String loc); + + /** + * @return The DynamoDB document path to the value this beacon will calculate over. If not specified, the beacon will calculate values for the attribute with the name specified in 'name'. + */ + String loc(); + + /** + * @param style Optional augmented behavior. + */ + Builder style(BeaconStyle style); + + /** + * @return Optional augmented behavior. + */ + BeaconStyle style(); + + StandardBeacon build(); + } + + static class BuilderImpl implements Builder { + protected String name; + + protected int length; + + private boolean _lengthSet = false; + + protected String loc; + + protected BeaconStyle style; + + protected BuilderImpl() { + } + + protected BuilderImpl(StandardBeacon model) { + this.name = model.name(); + this.length = model.length(); + this._lengthSet = true; + this.loc = model.loc(); + this.style = model.style(); + } + + public Builder name(String name) { + this.name = name; + return this; + } + + public String name() { + return this.name; + } + + public Builder length(int length) { + this.length = length; + this._lengthSet = true; + return this; + } + + public int length() { + return this.length; + } + + public Builder loc(String loc) { + this.loc = loc; + return this; + } + + public String loc() { + return this.loc; + } + + public Builder style(BeaconStyle style) { + this.style = style; + return this; + } + + public BeaconStyle style() { + return this.style; + } + + public StandardBeacon build() { + if (Objects.isNull(this.name())) { + throw new IllegalArgumentException("Missing value for required field `name`"); + } + if (!this._lengthSet) { + throw new IllegalArgumentException("Missing value for required field `length`"); + } + if (this._lengthSet && this.length() < 1) { + throw new IllegalArgumentException("`length` must be greater than or equal to 1"); + } + if (this._lengthSet && this.length() > 63) { + throw new IllegalArgumentException("`length` must be less than or equal to 63."); + } + if (Objects.nonNull(this.loc()) && this.loc().length() < 1) { + throw new IllegalArgumentException("The size of `loc` must be greater than or equal to 1"); + } + return new StandardBeacon(this); + } + } +} diff --git a/TestVectors/runtimes/java/src/main/smithy-generated/software/amazon/cryptography/dbencryptionsdk/dynamodb/model/Upper.java b/TestVectors/runtimes/java/src/main/smithy-generated/software/amazon/cryptography/dbencryptionsdk/dynamodb/model/Upper.java new file mode 100644 index 000000000..faed92ccb --- /dev/null +++ b/TestVectors/runtimes/java/src/main/smithy-generated/software/amazon/cryptography/dbencryptionsdk/dynamodb/model/Upper.java @@ -0,0 +1,36 @@ +// Copyright Amazon.com Inc. or its affiliates. All Rights Reserved. +// SPDX-License-Identifier: Apache-2.0 +// Do not modify this file. This file is machine generated, and any changes to it will be overwritten. +package software.amazon.cryptography.dbencryptionsdk.dynamodb.model; + +/** + * The Virtual Part Transformation that converts ASCII characters to upper case. + */ +public class Upper { + protected Upper(BuilderImpl builder) { + } + + public Builder toBuilder() { + return new BuilderImpl(this); + } + + public static Builder builder() { + return new BuilderImpl(); + } + + public interface Builder { + Upper build(); + } + + static class BuilderImpl implements Builder { + protected BuilderImpl() { + } + + protected BuilderImpl(Upper model) { + } + + public Upper build() { + return new Upper(this); + } + } +} diff --git a/TestVectors/runtimes/java/src/main/smithy-generated/software/amazon/cryptography/dbencryptionsdk/dynamodb/model/VirtualField.java b/TestVectors/runtimes/java/src/main/smithy-generated/software/amazon/cryptography/dbencryptionsdk/dynamodb/model/VirtualField.java new file mode 100644 index 000000000..55fbeaad5 --- /dev/null +++ b/TestVectors/runtimes/java/src/main/smithy-generated/software/amazon/cryptography/dbencryptionsdk/dynamodb/model/VirtualField.java @@ -0,0 +1,118 @@ +// Copyright Amazon.com Inc. or its affiliates. All Rights Reserved. +// SPDX-License-Identifier: Apache-2.0 +// Do not modify this file. This file is machine generated, and any changes to it will be overwritten. +package software.amazon.cryptography.dbencryptionsdk.dynamodb.model; + +import java.util.List; +import java.util.Objects; + +/** + * The configuration for a Virtual Field. A Virtual Field is a field constructed from parts of other fields for use with beacons, but never itself stored on items. + */ +public class VirtualField { + /** + * The name of the Virtual Field. + */ + private final String name; + + /** + * The list of ordered parts that make up a Virtual Field. + */ + private final List parts; + + protected VirtualField(BuilderImpl builder) { + this.name = builder.name(); + this.parts = builder.parts(); + } + + /** + * @return The name of the Virtual Field. + */ + public String name() { + return this.name; + } + + /** + * @return The list of ordered parts that make up a Virtual Field. + */ + public List parts() { + return this.parts; + } + + public Builder toBuilder() { + return new BuilderImpl(this); + } + + public static Builder builder() { + return new BuilderImpl(); + } + + public interface Builder { + /** + * @param name The name of the Virtual Field. + */ + Builder name(String name); + + /** + * @return The name of the Virtual Field. + */ + String name(); + + /** + * @param parts The list of ordered parts that make up a Virtual Field. + */ + Builder parts(List parts); + + /** + * @return The list of ordered parts that make up a Virtual Field. + */ + List parts(); + + VirtualField build(); + } + + static class BuilderImpl implements Builder { + protected String name; + + protected List parts; + + protected BuilderImpl() { + } + + protected BuilderImpl(VirtualField model) { + this.name = model.name(); + this.parts = model.parts(); + } + + public Builder name(String name) { + this.name = name; + return this; + } + + public String name() { + return this.name; + } + + public Builder parts(List parts) { + this.parts = parts; + return this; + } + + public List parts() { + return this.parts; + } + + public VirtualField build() { + if (Objects.isNull(this.name())) { + throw new IllegalArgumentException("Missing value for required field `name`"); + } + if (Objects.isNull(this.parts())) { + throw new IllegalArgumentException("Missing value for required field `parts`"); + } + if (Objects.nonNull(this.parts()) && this.parts().size() < 1) { + throw new IllegalArgumentException("The size of `parts` must be greater than or equal to 1"); + } + return new VirtualField(this); + } + } +} diff --git a/TestVectors/runtimes/java/src/main/smithy-generated/software/amazon/cryptography/dbencryptionsdk/dynamodb/model/VirtualPart.java b/TestVectors/runtimes/java/src/main/smithy-generated/software/amazon/cryptography/dbencryptionsdk/dynamodb/model/VirtualPart.java new file mode 100644 index 000000000..0f92bc95d --- /dev/null +++ b/TestVectors/runtimes/java/src/main/smithy-generated/software/amazon/cryptography/dbencryptionsdk/dynamodb/model/VirtualPart.java @@ -0,0 +1,118 @@ +// Copyright Amazon.com Inc. or its affiliates. All Rights Reserved. +// SPDX-License-Identifier: Apache-2.0 +// Do not modify this file. This file is machine generated, and any changes to it will be overwritten. +package software.amazon.cryptography.dbencryptionsdk.dynamodb.model; + +import java.util.List; +import java.util.Objects; + +/** + * A Virtual Part is the configuration of a transformation on an existing field in an item. + */ +public class VirtualPart { + /** + * The DynamoDB document path to the value for this part. + */ + private final String loc; + + /** + * A list of transformations performed on the value for this part. + */ + private final List trans; + + protected VirtualPart(BuilderImpl builder) { + this.loc = builder.loc(); + this.trans = builder.trans(); + } + + /** + * @return The DynamoDB document path to the value for this part. + */ + public String loc() { + return this.loc; + } + + /** + * @return A list of transformations performed on the value for this part. + */ + public List trans() { + return this.trans; + } + + public Builder toBuilder() { + return new BuilderImpl(this); + } + + public static Builder builder() { + return new BuilderImpl(); + } + + public interface Builder { + /** + * @param loc The DynamoDB document path to the value for this part. + */ + Builder loc(String loc); + + /** + * @return The DynamoDB document path to the value for this part. + */ + String loc(); + + /** + * @param trans A list of transformations performed on the value for this part. + */ + Builder trans(List trans); + + /** + * @return A list of transformations performed on the value for this part. + */ + List trans(); + + VirtualPart build(); + } + + static class BuilderImpl implements Builder { + protected String loc; + + protected List trans; + + protected BuilderImpl() { + } + + protected BuilderImpl(VirtualPart model) { + this.loc = model.loc(); + this.trans = model.trans(); + } + + public Builder loc(String loc) { + this.loc = loc; + return this; + } + + public String loc() { + return this.loc; + } + + public Builder trans(List trans) { + this.trans = trans; + return this; + } + + public List trans() { + return this.trans; + } + + public VirtualPart build() { + if (Objects.isNull(this.loc())) { + throw new IllegalArgumentException("Missing value for required field `loc`"); + } + if (Objects.nonNull(this.loc()) && this.loc().length() < 1) { + throw new IllegalArgumentException("The size of `loc` must be greater than or equal to 1"); + } + if (Objects.nonNull(this.trans()) && this.trans().size() < 1) { + throw new IllegalArgumentException("The size of `trans` must be greater than or equal to 1"); + } + return new VirtualPart(this); + } + } +} diff --git a/TestVectors/runtimes/java/src/main/smithy-generated/software/amazon/cryptography/dbencryptionsdk/dynamodb/model/VirtualTransform.java b/TestVectors/runtimes/java/src/main/smithy-generated/software/amazon/cryptography/dbencryptionsdk/dynamodb/model/VirtualTransform.java new file mode 100644 index 000000000..84d29ea14 --- /dev/null +++ b/TestVectors/runtimes/java/src/main/smithy-generated/software/amazon/cryptography/dbencryptionsdk/dynamodb/model/VirtualTransform.java @@ -0,0 +1,332 @@ +// Copyright Amazon.com Inc. or its affiliates. All Rights Reserved. +// SPDX-License-Identifier: Apache-2.0 +// Do not modify this file. This file is machine generated, and any changes to it will be overwritten. +package software.amazon.cryptography.dbencryptionsdk.dynamodb.model; + +import java.util.Objects; + +public class VirtualTransform { + /** + * The Virtual Part Transformation that converts ASCII characters to upper case. + */ + private final Upper upper; + + /** + * The Virtual Part Transformation that converts ASCII characters to lower case. + */ + private final Lower lower; + + /** + * The Virtual Part Transformation that appends a literal string. + */ + private final Insert insert; + + /** + * The Virtual Part Transformation that gets the prefix of a string. + */ + private final GetPrefix prefix; + + /** + * The Virtual Part Transformation that gets the suffix of a string. + */ + private final GetSuffix suffix; + + /** + * The Virtual Part Transformation that gets a substring from a string. + */ + private final GetSubstring substring; + + /** + * The Virtual Part Transformation that splits a string and gets a particular segment of that split. + */ + private final GetSegment segment; + + /** + * The Virtual Part Transformation that splits a string and gets a range of segments of that split. + */ + private final GetSegments segments; + + protected VirtualTransform(BuilderImpl builder) { + this.upper = builder.upper(); + this.lower = builder.lower(); + this.insert = builder.insert(); + this.prefix = builder.prefix(); + this.suffix = builder.suffix(); + this.substring = builder.substring(); + this.segment = builder.segment(); + this.segments = builder.segments(); + } + + /** + * @return The Virtual Part Transformation that converts ASCII characters to upper case. + */ + public Upper upper() { + return this.upper; + } + + /** + * @return The Virtual Part Transformation that converts ASCII characters to lower case. + */ + public Lower lower() { + return this.lower; + } + + /** + * @return The Virtual Part Transformation that appends a literal string. + */ + public Insert insert() { + return this.insert; + } + + /** + * @return The Virtual Part Transformation that gets the prefix of a string. + */ + public GetPrefix prefix() { + return this.prefix; + } + + /** + * @return The Virtual Part Transformation that gets the suffix of a string. + */ + public GetSuffix suffix() { + return this.suffix; + } + + /** + * @return The Virtual Part Transformation that gets a substring from a string. + */ + public GetSubstring substring() { + return this.substring; + } + + /** + * @return The Virtual Part Transformation that splits a string and gets a particular segment of that split. + */ + public GetSegment segment() { + return this.segment; + } + + /** + * @return The Virtual Part Transformation that splits a string and gets a range of segments of that split. + */ + public GetSegments segments() { + return this.segments; + } + + public Builder toBuilder() { + return new BuilderImpl(this); + } + + public static Builder builder() { + return new BuilderImpl(); + } + + public interface Builder { + /** + * @param upper The Virtual Part Transformation that converts ASCII characters to upper case. + */ + Builder upper(Upper upper); + + /** + * @return The Virtual Part Transformation that converts ASCII characters to upper case. + */ + Upper upper(); + + /** + * @param lower The Virtual Part Transformation that converts ASCII characters to lower case. + */ + Builder lower(Lower lower); + + /** + * @return The Virtual Part Transformation that converts ASCII characters to lower case. + */ + Lower lower(); + + /** + * @param insert The Virtual Part Transformation that appends a literal string. + */ + Builder insert(Insert insert); + + /** + * @return The Virtual Part Transformation that appends a literal string. + */ + Insert insert(); + + /** + * @param prefix The Virtual Part Transformation that gets the prefix of a string. + */ + Builder prefix(GetPrefix prefix); + + /** + * @return The Virtual Part Transformation that gets the prefix of a string. + */ + GetPrefix prefix(); + + /** + * @param suffix The Virtual Part Transformation that gets the suffix of a string. + */ + Builder suffix(GetSuffix suffix); + + /** + * @return The Virtual Part Transformation that gets the suffix of a string. + */ + GetSuffix suffix(); + + /** + * @param substring The Virtual Part Transformation that gets a substring from a string. + */ + Builder substring(GetSubstring substring); + + /** + * @return The Virtual Part Transformation that gets a substring from a string. + */ + GetSubstring substring(); + + /** + * @param segment The Virtual Part Transformation that splits a string and gets a particular segment of that split. + */ + Builder segment(GetSegment segment); + + /** + * @return The Virtual Part Transformation that splits a string and gets a particular segment of that split. + */ + GetSegment segment(); + + /** + * @param segments The Virtual Part Transformation that splits a string and gets a range of segments of that split. + */ + Builder segments(GetSegments segments); + + /** + * @return The Virtual Part Transformation that splits a string and gets a range of segments of that split. + */ + GetSegments segments(); + + VirtualTransform build(); + } + + static class BuilderImpl implements Builder { + protected Upper upper; + + protected Lower lower; + + protected Insert insert; + + protected GetPrefix prefix; + + protected GetSuffix suffix; + + protected GetSubstring substring; + + protected GetSegment segment; + + protected GetSegments segments; + + protected BuilderImpl() { + } + + protected BuilderImpl(VirtualTransform model) { + this.upper = model.upper(); + this.lower = model.lower(); + this.insert = model.insert(); + this.prefix = model.prefix(); + this.suffix = model.suffix(); + this.substring = model.substring(); + this.segment = model.segment(); + this.segments = model.segments(); + } + + public Builder upper(Upper upper) { + this.upper = upper; + return this; + } + + public Upper upper() { + return this.upper; + } + + public Builder lower(Lower lower) { + this.lower = lower; + return this; + } + + public Lower lower() { + return this.lower; + } + + public Builder insert(Insert insert) { + this.insert = insert; + return this; + } + + public Insert insert() { + return this.insert; + } + + public Builder prefix(GetPrefix prefix) { + this.prefix = prefix; + return this; + } + + public GetPrefix prefix() { + return this.prefix; + } + + public Builder suffix(GetSuffix suffix) { + this.suffix = suffix; + return this; + } + + public GetSuffix suffix() { + return this.suffix; + } + + public Builder substring(GetSubstring substring) { + this.substring = substring; + return this; + } + + public GetSubstring substring() { + return this.substring; + } + + public Builder segment(GetSegment segment) { + this.segment = segment; + return this; + } + + public GetSegment segment() { + return this.segment; + } + + public Builder segments(GetSegments segments) { + this.segments = segments; + return this; + } + + public GetSegments segments() { + return this.segments; + } + + public VirtualTransform build() { + if (!onlyOneNonNull()) { + throw new IllegalArgumentException("`VirtualTransform` is a Union. A Union MUST have one and only one value set."); + } + return new VirtualTransform(this); + } + + private boolean onlyOneNonNull() { + Object[] allValues = {this.upper, this.lower, this.insert, this.prefix, this.suffix, this.substring, this.segment, this.segments}; + boolean haveOneNonNull = false; + for (Object o : allValues) { + if (Objects.nonNull(o)) { + if (haveOneNonNull) { + return false; + } + haveOneNonNull = true; + } + } + return haveOneNonNull; + } + } +} From 39668edfbcdc3fd836a791d5c86b5f0c3e07b6df Mon Sep 17 00:00:00 2001 From: rishav-karanjit Date: Fri, 29 Mar 2024 11:54:57 -0700 Subject: [PATCH 33/67] Add dotnet typeconversion --- .../net/Generated/DDBEncryption/TypeConversion.cs | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/TestVectors/runtimes/net/Generated/DDBEncryption/TypeConversion.cs b/TestVectors/runtimes/net/Generated/DDBEncryption/TypeConversion.cs index 7d54002b3..c10e673e1 100644 --- a/TestVectors/runtimes/net/Generated/DDBEncryption/TypeConversion.cs +++ b/TestVectors/runtimes/net/Generated/DDBEncryption/TypeConversion.cs @@ -1098,21 +1098,21 @@ public static int ToDafny_N3_aws__N12_cryptography__N17_materialProviders__S14_C public static System.Exception FromDafny_CommonError(software.amazon.cryptography.dbencryptionsdk.dynamodb.internaldafny.types._IError value) { switch(value) { - case software.amazon.cryptography.dbencryptionsdk.dynamodb.internaldafny.types.Error_ComAmazonawsDynamodb dafnyVal: - return Com.Amazonaws.Dynamodb.TypeConversion.FromDafny_CommonError( - dafnyVal._ComAmazonawsDynamodb - ); case software.amazon.cryptography.dbencryptionsdk.dynamodb.internaldafny.types.Error_AwsCryptographyDbEncryptionSdkStructuredEncryption dafnyVal: return AWS.Cryptography.DbEncryptionSDK.StructuredEncryption.TypeConversion.FromDafny_CommonError( dafnyVal._AwsCryptographyDbEncryptionSdkStructuredEncryption ); + case software.amazon.cryptography.dbencryptionsdk.dynamodb.internaldafny.types.Error_AwsCryptographyPrimitives dafnyVal: + return AWS.Cryptography.Primitives.TypeConversion.FromDafny_CommonError( + dafnyVal._AwsCryptographyPrimitives + ); case software.amazon.cryptography.dbencryptionsdk.dynamodb.internaldafny.types.Error_AwsCryptographyMaterialProviders dafnyVal: return AWS.Cryptography.MaterialProviders.TypeConversion.FromDafny_CommonError( dafnyVal._AwsCryptographyMaterialProviders ); - case software.amazon.cryptography.dbencryptionsdk.dynamodb.internaldafny.types.Error_AwsCryptographyPrimitives dafnyVal: - return AWS.Cryptography.Primitives.TypeConversion.FromDafny_CommonError( - dafnyVal._AwsCryptographyPrimitives + case software.amazon.cryptography.dbencryptionsdk.dynamodb.internaldafny.types.Error_ComAmazonawsDynamodb dafnyVal: + return Com.Amazonaws.Dynamodb.TypeConversion.FromDafny_CommonError( + dafnyVal._ComAmazonawsDynamodb ); case software.amazon.cryptography.dbencryptionsdk.dynamodb.internaldafny.types.Error_DynamoDbEncryptionException dafnyVal: return FromDafny_N3_aws__N12_cryptography__N15_dbEncryptionSdk__N8_dynamoDb__S27_DynamoDbEncryptionException(dafnyVal); From 5e6294a9ab38e7d8e8b83b5e5b4800993ba25038 Mon Sep 17 00:00:00 2001 From: rishav-karanjit Date: Mon, 1 Apr 2024 14:45:32 -0700 Subject: [PATCH 34/67] Revert head to 3 commits back --- ...yptographyDbEncryptionSdkDynamoDbTypes.dfy | 613 --------- .../dynamodb/DynamoDbEncryption.java | 99 -- .../DynamoDbKeyBranchKeyIdSupplier.java | 85 -- .../IDynamoDbKeyBranchKeyIdSupplier.java | 17 - .../dynamodb/ILegacyDynamoDbEncryptor.java | 7 - .../dynamodb/LegacyDynamoDbEncryptor.java | 47 - .../dbencryptionsdk/dynamodb/ToDafny.java | 703 ---------- .../dbencryptionsdk/dynamodb/ToNative.java | 662 ---------- .../dbencryptionsdk/dynamodb/model/AsSet.java | 36 - .../dynamodb/model/BeaconKeySource.java | 122 -- .../dynamodb/model/BeaconStyle.java | 192 --- .../dynamodb/model/BeaconVersion.java | 354 ----- .../dynamodb/model/CollectionOfErrors.java | 139 -- .../dynamodb/model/CompoundBeacon.java | 235 ---- .../dynamodb/model/Constructor.java | 80 -- .../dynamodb/model/ConstructorPart.java | 114 -- ...oDbEncryptionBranchKeyIdSupplierInput.java | 79 -- ...DbEncryptionBranchKeyIdSupplierOutput.java | 78 -- .../model/DynamoDbEncryptionConfig.java | 33 - .../model/DynamoDbEncryptionException.java | 107 -- .../model/DynamoDbTableEncryptionConfig.java | 490 ------- .../model/DynamoDbTablesEncryptionConfig.java | 79 -- .../EncryptedDataKeyDescriptionOutput.java | 130 -- .../dynamodb/model/EncryptedPart.java | 117 -- .../model/GetBranchKeyIdFromDdbKeyInput.java | 78 -- .../model/GetBranchKeyIdFromDdbKeyOutput.java | 76 -- .../GetEncryptedDataKeyDescriptionInput.java | 61 - .../GetEncryptedDataKeyDescriptionOutput.java | 64 - .../GetEncryptedDataKeyDescriptionUnion.java | 101 -- .../dynamodb/model/GetPrefix.java | 76 -- .../dynamodb/model/GetSegment.java | 120 -- .../dynamodb/model/GetSegments.java | 158 --- .../dynamodb/model/GetSubstring.java | 114 -- .../dynamodb/model/GetSuffix.java | 76 -- .../dynamodb/model/Insert.java | 76 -- .../dynamodb/model/LegacyOverride.java | 191 --- .../dynamodb/model/LegacyPolicy.java | 22 - .../dbencryptionsdk/dynamodb/model/Lower.java | 36 - .../dynamodb/model/MultiKeyStore.java | 150 --- .../dynamodb/model/OpaqueError.java | 142 -- .../dynamodb/model/PartOnly.java | 36 - .../dynamodb/model/PlaintextOverride.java | 22 - .../dynamodb/model/SearchConfig.java | 128 -- .../dynamodb/model/Shared.java | 76 -- .../dynamodb/model/SharedSet.java | 76 -- .../dynamodb/model/SignedPart.java | 155 --- .../dynamodb/model/SingleKeyStore.java | 114 -- .../dynamodb/model/StandardBeacon.java | 197 --- .../dbencryptionsdk/dynamodb/model/Upper.java | 36 - .../dynamodb/model/VirtualField.java | 118 -- .../dynamodb/model/VirtualPart.java | 118 -- .../dynamodb/model/VirtualTransform.java | 332 ----- .../net/Generated/DDBEncryption/AsSet.cs | 13 - .../DDBEncryption/BeaconKeySource.cs | 32 - .../Generated/DDBEncryption/BeaconStyle.cs | 50 - .../Generated/DDBEncryption/BeaconVersion.cs | 79 -- .../DDBEncryption/CollectionOfErrors.cs | 13 - .../Generated/DDBEncryption/CompoundBeacon.cs | 53 - .../Generated/DDBEncryption/Constructor.cs | 20 - .../DDBEncryption/ConstructorPart.cs | 29 - ...amoDbEncryptionBranchKeyIdSupplierInput.cs | 20 - ...moDbEncryptionBranchKeyIdSupplierOutput.cs | 20 - .../DDBEncryption/DynamoDbEncryption.cs | 37 - .../DDBEncryption/DynamoDbEncryptionConfig.cs | 13 - .../DynamoDbEncryptionException.cs | 10 - .../DynamoDbKeyBranchKeyIdSupplier.cs | 19 - .../DynamoDbKeyBranchKeyIdSupplierBase.cs | 13 - .../DynamoDbTableEncryptionConfig.cs | 110 -- .../DynamoDbTablesEncryptionConfig.cs | 20 - .../EncryptedDataKeyDescriptionOutput.cs | 44 - .../Generated/DDBEncryption/EncryptedPart.cs | 29 - .../GetBranchKeyIdFromDdbKeyInput.cs | 20 - .../GetBranchKeyIdFromDdbKeyOutput.cs | 20 - .../GetEncryptedDataKeyDescriptionInput.cs | 20 - .../GetEncryptedDataKeyDescriptionOutput.cs | 20 - .../GetEncryptedDataKeyDescriptionUnion.cs | 32 - .../net/Generated/DDBEncryption/GetPrefix.cs | 20 - .../net/Generated/DDBEncryption/GetSegment.cs | 29 - .../Generated/DDBEncryption/GetSegments.cs | 38 - .../Generated/DDBEncryption/GetSubstring.cs | 29 - .../net/Generated/DDBEncryption/GetSuffix.cs | 20 - .../IDynamoDbKeyBranchKeyIdSupplier.cs | 9 - .../DDBEncryption/ILegacyDynamoDbEncryptor.cs | 9 - .../net/Generated/DDBEncryption/Insert.cs | 20 - .../DDBEncryption/LegacyDynamoDbEncryptor.cs | 14 - .../LegacyDynamoDbEncryptorBase.cs | 9 - .../Generated/DDBEncryption/LegacyOverride.cs | 46 - .../Generated/DDBEncryption/LegacyPolicy.cs | 19 - .../net/Generated/DDBEncryption/Lower.cs | 13 - .../Generated/DDBEncryption/MultiKeyStore.cs | 37 - ...eWrapper_DynamoDbKeyBranchKeyIdSupplier.cs | 45 - .../NativeWrapper_LegacyDynamoDbEncryptor.cs | 21 - .../Generated/DDBEncryption/OpaqueError.cs | 13 - .../net/Generated/DDBEncryption/PartOnly.cs | 13 - .../DDBEncryption/PlaintextOverride.cs | 19 - .../Generated/DDBEncryption/SearchConfig.cs | 29 - .../net/Generated/DDBEncryption/Shared.cs | 20 - .../net/Generated/DDBEncryption/SharedSet.cs | 20 - .../net/Generated/DDBEncryption/SignedPart.cs | 37 - .../Generated/DDBEncryption/SingleKeyStore.cs | 29 - .../Generated/DDBEncryption/StandardBeacon.cs | 45 - .../Generated/DDBEncryption/TypeConversion.cs | 1157 ----------------- .../net/Generated/DDBEncryption/Upper.cs | 13 - .../Generated/DDBEncryption/VirtualField.cs | 29 - .../Generated/DDBEncryption/VirtualPart.cs | 28 - .../DDBEncryption/VirtualTransform.cs | 86 -- 106 files changed, 10219 deletions(-) delete mode 100644 TestVectors/dafny/DDBEncryption/Model/AwsCryptographyDbEncryptionSdkDynamoDbTypes.dfy delete mode 100644 TestVectors/runtimes/java/src/main/smithy-generated/software/amazon/cryptography/dbencryptionsdk/dynamodb/DynamoDbEncryption.java delete mode 100644 TestVectors/runtimes/java/src/main/smithy-generated/software/amazon/cryptography/dbencryptionsdk/dynamodb/DynamoDbKeyBranchKeyIdSupplier.java delete mode 100644 TestVectors/runtimes/java/src/main/smithy-generated/software/amazon/cryptography/dbencryptionsdk/dynamodb/IDynamoDbKeyBranchKeyIdSupplier.java delete mode 100644 TestVectors/runtimes/java/src/main/smithy-generated/software/amazon/cryptography/dbencryptionsdk/dynamodb/ILegacyDynamoDbEncryptor.java delete mode 100644 TestVectors/runtimes/java/src/main/smithy-generated/software/amazon/cryptography/dbencryptionsdk/dynamodb/LegacyDynamoDbEncryptor.java delete mode 100644 TestVectors/runtimes/java/src/main/smithy-generated/software/amazon/cryptography/dbencryptionsdk/dynamodb/ToDafny.java delete mode 100644 TestVectors/runtimes/java/src/main/smithy-generated/software/amazon/cryptography/dbencryptionsdk/dynamodb/ToNative.java delete mode 100644 TestVectors/runtimes/java/src/main/smithy-generated/software/amazon/cryptography/dbencryptionsdk/dynamodb/model/AsSet.java delete mode 100644 TestVectors/runtimes/java/src/main/smithy-generated/software/amazon/cryptography/dbencryptionsdk/dynamodb/model/BeaconKeySource.java delete mode 100644 TestVectors/runtimes/java/src/main/smithy-generated/software/amazon/cryptography/dbencryptionsdk/dynamodb/model/BeaconStyle.java delete mode 100644 TestVectors/runtimes/java/src/main/smithy-generated/software/amazon/cryptography/dbencryptionsdk/dynamodb/model/BeaconVersion.java delete mode 100644 TestVectors/runtimes/java/src/main/smithy-generated/software/amazon/cryptography/dbencryptionsdk/dynamodb/model/CollectionOfErrors.java delete mode 100644 TestVectors/runtimes/java/src/main/smithy-generated/software/amazon/cryptography/dbencryptionsdk/dynamodb/model/CompoundBeacon.java delete mode 100644 TestVectors/runtimes/java/src/main/smithy-generated/software/amazon/cryptography/dbencryptionsdk/dynamodb/model/Constructor.java delete mode 100644 TestVectors/runtimes/java/src/main/smithy-generated/software/amazon/cryptography/dbencryptionsdk/dynamodb/model/ConstructorPart.java delete mode 100644 TestVectors/runtimes/java/src/main/smithy-generated/software/amazon/cryptography/dbencryptionsdk/dynamodb/model/CreateDynamoDbEncryptionBranchKeyIdSupplierInput.java delete mode 100644 TestVectors/runtimes/java/src/main/smithy-generated/software/amazon/cryptography/dbencryptionsdk/dynamodb/model/CreateDynamoDbEncryptionBranchKeyIdSupplierOutput.java delete mode 100644 TestVectors/runtimes/java/src/main/smithy-generated/software/amazon/cryptography/dbencryptionsdk/dynamodb/model/DynamoDbEncryptionConfig.java delete mode 100644 TestVectors/runtimes/java/src/main/smithy-generated/software/amazon/cryptography/dbencryptionsdk/dynamodb/model/DynamoDbEncryptionException.java delete mode 100644 TestVectors/runtimes/java/src/main/smithy-generated/software/amazon/cryptography/dbencryptionsdk/dynamodb/model/DynamoDbTableEncryptionConfig.java delete mode 100644 TestVectors/runtimes/java/src/main/smithy-generated/software/amazon/cryptography/dbencryptionsdk/dynamodb/model/DynamoDbTablesEncryptionConfig.java delete mode 100644 TestVectors/runtimes/java/src/main/smithy-generated/software/amazon/cryptography/dbencryptionsdk/dynamodb/model/EncryptedDataKeyDescriptionOutput.java delete mode 100644 TestVectors/runtimes/java/src/main/smithy-generated/software/amazon/cryptography/dbencryptionsdk/dynamodb/model/EncryptedPart.java delete mode 100644 TestVectors/runtimes/java/src/main/smithy-generated/software/amazon/cryptography/dbencryptionsdk/dynamodb/model/GetBranchKeyIdFromDdbKeyInput.java delete mode 100644 TestVectors/runtimes/java/src/main/smithy-generated/software/amazon/cryptography/dbencryptionsdk/dynamodb/model/GetBranchKeyIdFromDdbKeyOutput.java delete mode 100644 TestVectors/runtimes/java/src/main/smithy-generated/software/amazon/cryptography/dbencryptionsdk/dynamodb/model/GetEncryptedDataKeyDescriptionInput.java delete mode 100644 TestVectors/runtimes/java/src/main/smithy-generated/software/amazon/cryptography/dbencryptionsdk/dynamodb/model/GetEncryptedDataKeyDescriptionOutput.java delete mode 100644 TestVectors/runtimes/java/src/main/smithy-generated/software/amazon/cryptography/dbencryptionsdk/dynamodb/model/GetEncryptedDataKeyDescriptionUnion.java delete mode 100644 TestVectors/runtimes/java/src/main/smithy-generated/software/amazon/cryptography/dbencryptionsdk/dynamodb/model/GetPrefix.java delete mode 100644 TestVectors/runtimes/java/src/main/smithy-generated/software/amazon/cryptography/dbencryptionsdk/dynamodb/model/GetSegment.java delete mode 100644 TestVectors/runtimes/java/src/main/smithy-generated/software/amazon/cryptography/dbencryptionsdk/dynamodb/model/GetSegments.java delete mode 100644 TestVectors/runtimes/java/src/main/smithy-generated/software/amazon/cryptography/dbencryptionsdk/dynamodb/model/GetSubstring.java delete mode 100644 TestVectors/runtimes/java/src/main/smithy-generated/software/amazon/cryptography/dbencryptionsdk/dynamodb/model/GetSuffix.java delete mode 100644 TestVectors/runtimes/java/src/main/smithy-generated/software/amazon/cryptography/dbencryptionsdk/dynamodb/model/Insert.java delete mode 100644 TestVectors/runtimes/java/src/main/smithy-generated/software/amazon/cryptography/dbencryptionsdk/dynamodb/model/LegacyOverride.java delete mode 100644 TestVectors/runtimes/java/src/main/smithy-generated/software/amazon/cryptography/dbencryptionsdk/dynamodb/model/LegacyPolicy.java delete mode 100644 TestVectors/runtimes/java/src/main/smithy-generated/software/amazon/cryptography/dbencryptionsdk/dynamodb/model/Lower.java delete mode 100644 TestVectors/runtimes/java/src/main/smithy-generated/software/amazon/cryptography/dbencryptionsdk/dynamodb/model/MultiKeyStore.java delete mode 100644 TestVectors/runtimes/java/src/main/smithy-generated/software/amazon/cryptography/dbencryptionsdk/dynamodb/model/OpaqueError.java delete mode 100644 TestVectors/runtimes/java/src/main/smithy-generated/software/amazon/cryptography/dbencryptionsdk/dynamodb/model/PartOnly.java delete mode 100644 TestVectors/runtimes/java/src/main/smithy-generated/software/amazon/cryptography/dbencryptionsdk/dynamodb/model/PlaintextOverride.java delete mode 100644 TestVectors/runtimes/java/src/main/smithy-generated/software/amazon/cryptography/dbencryptionsdk/dynamodb/model/SearchConfig.java delete mode 100644 TestVectors/runtimes/java/src/main/smithy-generated/software/amazon/cryptography/dbencryptionsdk/dynamodb/model/Shared.java delete mode 100644 TestVectors/runtimes/java/src/main/smithy-generated/software/amazon/cryptography/dbencryptionsdk/dynamodb/model/SharedSet.java delete mode 100644 TestVectors/runtimes/java/src/main/smithy-generated/software/amazon/cryptography/dbencryptionsdk/dynamodb/model/SignedPart.java delete mode 100644 TestVectors/runtimes/java/src/main/smithy-generated/software/amazon/cryptography/dbencryptionsdk/dynamodb/model/SingleKeyStore.java delete mode 100644 TestVectors/runtimes/java/src/main/smithy-generated/software/amazon/cryptography/dbencryptionsdk/dynamodb/model/StandardBeacon.java delete mode 100644 TestVectors/runtimes/java/src/main/smithy-generated/software/amazon/cryptography/dbencryptionsdk/dynamodb/model/Upper.java delete mode 100644 TestVectors/runtimes/java/src/main/smithy-generated/software/amazon/cryptography/dbencryptionsdk/dynamodb/model/VirtualField.java delete mode 100644 TestVectors/runtimes/java/src/main/smithy-generated/software/amazon/cryptography/dbencryptionsdk/dynamodb/model/VirtualPart.java delete mode 100644 TestVectors/runtimes/java/src/main/smithy-generated/software/amazon/cryptography/dbencryptionsdk/dynamodb/model/VirtualTransform.java delete mode 100644 TestVectors/runtimes/net/Generated/DDBEncryption/AsSet.cs delete mode 100644 TestVectors/runtimes/net/Generated/DDBEncryption/BeaconKeySource.cs delete mode 100644 TestVectors/runtimes/net/Generated/DDBEncryption/BeaconStyle.cs delete mode 100644 TestVectors/runtimes/net/Generated/DDBEncryption/BeaconVersion.cs delete mode 100644 TestVectors/runtimes/net/Generated/DDBEncryption/CollectionOfErrors.cs delete mode 100644 TestVectors/runtimes/net/Generated/DDBEncryption/CompoundBeacon.cs delete mode 100644 TestVectors/runtimes/net/Generated/DDBEncryption/Constructor.cs delete mode 100644 TestVectors/runtimes/net/Generated/DDBEncryption/ConstructorPart.cs delete mode 100644 TestVectors/runtimes/net/Generated/DDBEncryption/CreateDynamoDbEncryptionBranchKeyIdSupplierInput.cs delete mode 100644 TestVectors/runtimes/net/Generated/DDBEncryption/CreateDynamoDbEncryptionBranchKeyIdSupplierOutput.cs delete mode 100644 TestVectors/runtimes/net/Generated/DDBEncryption/DynamoDbEncryption.cs delete mode 100644 TestVectors/runtimes/net/Generated/DDBEncryption/DynamoDbEncryptionConfig.cs delete mode 100644 TestVectors/runtimes/net/Generated/DDBEncryption/DynamoDbEncryptionException.cs delete mode 100644 TestVectors/runtimes/net/Generated/DDBEncryption/DynamoDbKeyBranchKeyIdSupplier.cs delete mode 100644 TestVectors/runtimes/net/Generated/DDBEncryption/DynamoDbKeyBranchKeyIdSupplierBase.cs delete mode 100644 TestVectors/runtimes/net/Generated/DDBEncryption/DynamoDbTableEncryptionConfig.cs delete mode 100644 TestVectors/runtimes/net/Generated/DDBEncryption/DynamoDbTablesEncryptionConfig.cs delete mode 100644 TestVectors/runtimes/net/Generated/DDBEncryption/EncryptedDataKeyDescriptionOutput.cs delete mode 100644 TestVectors/runtimes/net/Generated/DDBEncryption/EncryptedPart.cs delete mode 100644 TestVectors/runtimes/net/Generated/DDBEncryption/GetBranchKeyIdFromDdbKeyInput.cs delete mode 100644 TestVectors/runtimes/net/Generated/DDBEncryption/GetBranchKeyIdFromDdbKeyOutput.cs delete mode 100644 TestVectors/runtimes/net/Generated/DDBEncryption/GetEncryptedDataKeyDescriptionInput.cs delete mode 100644 TestVectors/runtimes/net/Generated/DDBEncryption/GetEncryptedDataKeyDescriptionOutput.cs delete mode 100644 TestVectors/runtimes/net/Generated/DDBEncryption/GetEncryptedDataKeyDescriptionUnion.cs delete mode 100644 TestVectors/runtimes/net/Generated/DDBEncryption/GetPrefix.cs delete mode 100644 TestVectors/runtimes/net/Generated/DDBEncryption/GetSegment.cs delete mode 100644 TestVectors/runtimes/net/Generated/DDBEncryption/GetSegments.cs delete mode 100644 TestVectors/runtimes/net/Generated/DDBEncryption/GetSubstring.cs delete mode 100644 TestVectors/runtimes/net/Generated/DDBEncryption/GetSuffix.cs delete mode 100644 TestVectors/runtimes/net/Generated/DDBEncryption/IDynamoDbKeyBranchKeyIdSupplier.cs delete mode 100644 TestVectors/runtimes/net/Generated/DDBEncryption/ILegacyDynamoDbEncryptor.cs delete mode 100644 TestVectors/runtimes/net/Generated/DDBEncryption/Insert.cs delete mode 100644 TestVectors/runtimes/net/Generated/DDBEncryption/LegacyDynamoDbEncryptor.cs delete mode 100644 TestVectors/runtimes/net/Generated/DDBEncryption/LegacyDynamoDbEncryptorBase.cs delete mode 100644 TestVectors/runtimes/net/Generated/DDBEncryption/LegacyOverride.cs delete mode 100644 TestVectors/runtimes/net/Generated/DDBEncryption/LegacyPolicy.cs delete mode 100644 TestVectors/runtimes/net/Generated/DDBEncryption/Lower.cs delete mode 100644 TestVectors/runtimes/net/Generated/DDBEncryption/MultiKeyStore.cs delete mode 100644 TestVectors/runtimes/net/Generated/DDBEncryption/NativeWrapper_DynamoDbKeyBranchKeyIdSupplier.cs delete mode 100644 TestVectors/runtimes/net/Generated/DDBEncryption/NativeWrapper_LegacyDynamoDbEncryptor.cs delete mode 100644 TestVectors/runtimes/net/Generated/DDBEncryption/OpaqueError.cs delete mode 100644 TestVectors/runtimes/net/Generated/DDBEncryption/PartOnly.cs delete mode 100644 TestVectors/runtimes/net/Generated/DDBEncryption/PlaintextOverride.cs delete mode 100644 TestVectors/runtimes/net/Generated/DDBEncryption/SearchConfig.cs delete mode 100644 TestVectors/runtimes/net/Generated/DDBEncryption/Shared.cs delete mode 100644 TestVectors/runtimes/net/Generated/DDBEncryption/SharedSet.cs delete mode 100644 TestVectors/runtimes/net/Generated/DDBEncryption/SignedPart.cs delete mode 100644 TestVectors/runtimes/net/Generated/DDBEncryption/SingleKeyStore.cs delete mode 100644 TestVectors/runtimes/net/Generated/DDBEncryption/StandardBeacon.cs delete mode 100644 TestVectors/runtimes/net/Generated/DDBEncryption/TypeConversion.cs delete mode 100644 TestVectors/runtimes/net/Generated/DDBEncryption/Upper.cs delete mode 100644 TestVectors/runtimes/net/Generated/DDBEncryption/VirtualField.cs delete mode 100644 TestVectors/runtimes/net/Generated/DDBEncryption/VirtualPart.cs delete mode 100644 TestVectors/runtimes/net/Generated/DDBEncryption/VirtualTransform.cs diff --git a/TestVectors/dafny/DDBEncryption/Model/AwsCryptographyDbEncryptionSdkDynamoDbTypes.dfy b/TestVectors/dafny/DDBEncryption/Model/AwsCryptographyDbEncryptionSdkDynamoDbTypes.dfy deleted file mode 100644 index 509a539f5..000000000 --- a/TestVectors/dafny/DDBEncryption/Model/AwsCryptographyDbEncryptionSdkDynamoDbTypes.dfy +++ /dev/null @@ -1,613 +0,0 @@ -// Copyright Amazon.com Inc. or its affiliates. All Rights Reserved. -// SPDX-License-Identifier: Apache-2.0 -// Do not modify this file. This file is machine generated, and any changes to it will be overwritten. -include "../../../../submodules/MaterialProviders/StandardLibrary/src/Index.dfy" - include "../../../../DynamoDbEncryption/dafny/StructuredEncryption/src/Index.dfy" - include "../../../../submodules/MaterialProviders/AwsCryptographicMaterialProviders/dafny/AwsCryptographicMaterialProviders/src/Index.dfy" - include "../../../../submodules/MaterialProviders/AwsCryptographicMaterialProviders/dafny/AwsCryptographyKeyStore/src/Index.dfy" - include "../../../../submodules/MaterialProviders/AwsCryptographyPrimitives/src/Index.dfy" - include "../../../../submodules/MaterialProviders/ComAmazonawsDynamodb/src/Index.dfy" - module {:extern "software.amazon.cryptography.dbencryptionsdk.dynamodb.internaldafny.types" } AwsCryptographyDbEncryptionSdkDynamoDbTypes - { - import opened Wrappers - import opened StandardLibrary.UInt - import opened UTF8 - import AwsCryptographyDbEncryptionSdkStructuredEncryptionTypes - import AwsCryptographyMaterialProvidersTypes - import AwsCryptographyKeyStoreTypes - import AwsCryptographyPrimitivesTypes - import ComAmazonawsDynamodbTypes - // Generic helpers for verification of mock/unit tests. - datatype DafnyCallEvent = DafnyCallEvent(input: I, output: O) - - // Begin Generated Types - - datatype AsSet = | AsSet ( - - ) - type AttributeActions = map - type BeaconBitLength = x: int32 | IsValid_BeaconBitLength(x) witness * - predicate method IsValid_BeaconBitLength(x: int32) { - ( 1 <= x <= 63 ) -} - datatype BeaconKeySource = - | single(single: SingleKeyStore) - | multi(multi: MultiKeyStore) - datatype BeaconStyle = - | partOnly(partOnly: PartOnly) - | shared(shared: Shared) - | asSet(asSet: AsSet) - | sharedSet(sharedSet: SharedSet) - datatype BeaconVersion = | BeaconVersion ( - nameonly version: VersionNumber , - nameonly keyStore: AwsCryptographyKeyStoreTypes.IKeyStoreClient , - nameonly keySource: BeaconKeySource , - nameonly standardBeacons: StandardBeaconList , - nameonly compoundBeacons: Option := Option.None , - nameonly virtualFields: Option := Option.None , - nameonly encryptedParts: Option := Option.None , - nameonly signedParts: Option := Option.None - ) - type BeaconVersionList = x: seq | IsValid_BeaconVersionList(x) witness * - predicate method IsValid_BeaconVersionList(x: seq) { - ( 1 <= |x| <= 1 ) -} - type Char = x: string | IsValid_Char(x) witness * - predicate method IsValid_Char(x: string) { - ( 1 <= |x| <= 1 ) -} - datatype CompoundBeacon = | CompoundBeacon ( - nameonly name: string , - nameonly split: Char , - nameonly encrypted: Option := Option.None , - nameonly signed: Option := Option.None , - nameonly constructors: Option := Option.None - ) - type CompoundBeaconList = x: seq | IsValid_CompoundBeaconList(x) witness * - predicate method IsValid_CompoundBeaconList(x: seq) { - ( 1 <= |x| ) -} - datatype Constructor = | Constructor ( - nameonly parts: ConstructorPartList - ) - type ConstructorList = x: seq | IsValid_ConstructorList(x) witness * - predicate method IsValid_ConstructorList(x: seq) { - ( 1 <= |x| ) -} - datatype ConstructorPart = | ConstructorPart ( - nameonly name: string , - nameonly required: bool - ) - type ConstructorPartList = x: seq | IsValid_ConstructorPartList(x) witness * - predicate method IsValid_ConstructorPartList(x: seq) { - ( 1 <= |x| ) -} - datatype CreateDynamoDbEncryptionBranchKeyIdSupplierInput = | CreateDynamoDbEncryptionBranchKeyIdSupplierInput ( - nameonly ddbKeyBranchKeyIdSupplier: IDynamoDbKeyBranchKeyIdSupplier - ) - datatype CreateDynamoDbEncryptionBranchKeyIdSupplierOutput = | CreateDynamoDbEncryptionBranchKeyIdSupplierOutput ( - nameonly branchKeyIdSupplier: AwsCryptographyMaterialProvidersTypes.IBranchKeyIdSupplier - ) - class IDynamoDbEncryptionClientCallHistory { - ghost constructor() { - CreateDynamoDbEncryptionBranchKeyIdSupplier := []; - GetEncryptedDataKeyDescription := []; -} - ghost var CreateDynamoDbEncryptionBranchKeyIdSupplier: seq>> - ghost var GetEncryptedDataKeyDescription: seq>> -} - trait {:termination false} IDynamoDbEncryptionClient - { - // Helper to define any additional modifies/reads clauses. - // If your operations need to mutate state, - // add it in your constructor function: - // Modifies := {your, fields, here, History}; - // If you do not need to mutate anything: -// Modifies := {History}; - - ghost const Modifies: set - // For an unassigned field defined in a trait, - // Dafny can only assign a value in the constructor. - // This means that for Dafny to reason about this value, - // it needs some way to know (an invariant), - // about the state of the object. - // This builds on the Valid/Repr paradigm - // To make this kind requires safe to add - // to methods called from unverified code, - // the predicate MUST NOT take any arguments. - // This means that the correctness of this requires - // MUST only be evaluated by the class itself. - // If you require any additional mutation, - // then you MUST ensure everything you need in ValidState. - // You MUST also ensure ValidState in your constructor. - predicate ValidState() - ensures ValidState() ==> History in Modifies - ghost const History: IDynamoDbEncryptionClientCallHistory - predicate CreateDynamoDbEncryptionBranchKeyIdSupplierEnsuresPublicly(input: CreateDynamoDbEncryptionBranchKeyIdSupplierInput , output: Result) - // The public method to be called by library consumers - method CreateDynamoDbEncryptionBranchKeyIdSupplier ( input: CreateDynamoDbEncryptionBranchKeyIdSupplierInput ) - returns (output: Result) - requires - && ValidState() - && input.ddbKeyBranchKeyIdSupplier.ValidState() - && input.ddbKeyBranchKeyIdSupplier.Modifies !! {History} - modifies Modifies - {History} , - input.ddbKeyBranchKeyIdSupplier.Modifies , - History`CreateDynamoDbEncryptionBranchKeyIdSupplier - // Dafny will skip type parameters when generating a default decreases clause. - decreases Modifies - {History} , - input.ddbKeyBranchKeyIdSupplier.Modifies - ensures - && ValidState() - && ( output.Success? ==> - && output.value.branchKeyIdSupplier.ValidState() - && output.value.branchKeyIdSupplier.Modifies !! {History} - && fresh(output.value.branchKeyIdSupplier) - && fresh ( output.value.branchKeyIdSupplier.Modifies - Modifies - {History} - input.ddbKeyBranchKeyIdSupplier.Modifies ) ) - ensures CreateDynamoDbEncryptionBranchKeyIdSupplierEnsuresPublicly(input, output) - ensures History.CreateDynamoDbEncryptionBranchKeyIdSupplier == old(History.CreateDynamoDbEncryptionBranchKeyIdSupplier) + [DafnyCallEvent(input, output)] - - predicate GetEncryptedDataKeyDescriptionEnsuresPublicly(input: GetEncryptedDataKeyDescriptionInput , output: Result) - // The public method to be called by library consumers - method GetEncryptedDataKeyDescription ( input: GetEncryptedDataKeyDescriptionInput ) - returns (output: Result) - requires - && ValidState() - modifies Modifies - {History} , - History`GetEncryptedDataKeyDescription - // Dafny will skip type parameters when generating a default decreases clause. - decreases Modifies - {History} - ensures - && ValidState() - ensures GetEncryptedDataKeyDescriptionEnsuresPublicly(input, output) - ensures History.GetEncryptedDataKeyDescription == old(History.GetEncryptedDataKeyDescription) + [DafnyCallEvent(input, output)] - -} - datatype DynamoDbEncryptionConfig = | DynamoDbEncryptionConfig ( - - ) - class IDynamoDbKeyBranchKeyIdSupplierCallHistory { - ghost constructor() { - GetBranchKeyIdFromDdbKey := []; -} - ghost var GetBranchKeyIdFromDdbKey: seq>> -} - trait {:termination false} IDynamoDbKeyBranchKeyIdSupplier - { - // Helper to define any additional modifies/reads clauses. - // If your operations need to mutate state, - // add it in your constructor function: - // Modifies := {your, fields, here, History}; - // If you do not need to mutate anything: -// Modifies := {History}; - - ghost const Modifies: set - // For an unassigned field defined in a trait, - // Dafny can only assign a value in the constructor. - // This means that for Dafny to reason about this value, - // it needs some way to know (an invariant), - // about the state of the object. - // This builds on the Valid/Repr paradigm - // To make this kind requires safe to add - // to methods called from unverified code, - // the predicate MUST NOT take any arguments. - // This means that the correctness of this requires - // MUST only be evaluated by the class itself. - // If you require any additional mutation, - // then you MUST ensure everything you need in ValidState. - // You MUST also ensure ValidState in your constructor. - predicate ValidState() - ensures ValidState() ==> History in Modifies - ghost const History: IDynamoDbKeyBranchKeyIdSupplierCallHistory - predicate GetBranchKeyIdFromDdbKeyEnsuresPublicly(input: GetBranchKeyIdFromDdbKeyInput , output: Result) - // The public method to be called by library consumers - method GetBranchKeyIdFromDdbKey ( input: GetBranchKeyIdFromDdbKeyInput ) - returns (output: Result) - requires - && ValidState() - modifies Modifies - {History} , - History`GetBranchKeyIdFromDdbKey - // Dafny will skip type parameters when generating a default decreases clause. - decreases Modifies - {History} - ensures - && ValidState() - ensures GetBranchKeyIdFromDdbKeyEnsuresPublicly(input, output) - ensures History.GetBranchKeyIdFromDdbKey == old(History.GetBranchKeyIdFromDdbKey) + [DafnyCallEvent(input, output)] - { - output := GetBranchKeyIdFromDdbKey' (input); - History.GetBranchKeyIdFromDdbKey := History.GetBranchKeyIdFromDdbKey + [DafnyCallEvent(input, output)]; -} - // The method to implement in the concrete class. - method GetBranchKeyIdFromDdbKey' ( input: GetBranchKeyIdFromDdbKeyInput ) - returns (output: Result) - requires - && ValidState() - modifies Modifies - {History} - // Dafny will skip type parameters when generating a default decreases clause. - decreases Modifies - {History} - ensures - && ValidState() - ensures GetBranchKeyIdFromDdbKeyEnsuresPublicly(input, output) - ensures unchanged(History) - -} - datatype DynamoDbTableEncryptionConfig = | DynamoDbTableEncryptionConfig ( - nameonly logicalTableName: string , - nameonly partitionKeyName: ComAmazonawsDynamodbTypes.KeySchemaAttributeName , - nameonly sortKeyName: Option := Option.None , - nameonly search: Option := Option.None , - nameonly attributeActionsOnEncrypt: AttributeActions , - nameonly allowedUnsignedAttributes: Option := Option.None , - nameonly allowedUnsignedAttributePrefix: Option := Option.None , - nameonly algorithmSuiteId: Option := Option.None , - nameonly keyring: Option := Option.None , - nameonly cmm: Option := Option.None , - nameonly legacyOverride: Option := Option.None , - nameonly plaintextOverride: Option := Option.None - ) - type DynamoDbTableEncryptionConfigList = map - datatype DynamoDbTablesEncryptionConfig = | DynamoDbTablesEncryptionConfig ( - nameonly tableEncryptionConfigs: DynamoDbTableEncryptionConfigList - ) - type EncryptedDataKeyDescriptionList = seq - datatype EncryptedDataKeyDescriptionOutput = | EncryptedDataKeyDescriptionOutput ( - nameonly keyProviderId: string , - nameonly keyProviderInfo: Option := Option.None , - nameonly branchKeyId: Option := Option.None , - nameonly branchKeyVersion: Option := Option.None - ) - datatype EncryptedPart = | EncryptedPart ( - nameonly name: string , - nameonly prefix: Prefix - ) - type EncryptedPartsList = x: seq | IsValid_EncryptedPartsList(x) witness * - predicate method IsValid_EncryptedPartsList(x: seq) { - ( 1 <= |x| ) -} - datatype GetBranchKeyIdFromDdbKeyInput = | GetBranchKeyIdFromDdbKeyInput ( - nameonly ddbKey: ComAmazonawsDynamodbTypes.Key - ) - datatype GetBranchKeyIdFromDdbKeyOutput = | GetBranchKeyIdFromDdbKeyOutput ( - nameonly branchKeyId: string - ) - datatype GetEncryptedDataKeyDescriptionInput = | GetEncryptedDataKeyDescriptionInput ( - nameonly input: GetEncryptedDataKeyDescriptionUnion - ) - datatype GetEncryptedDataKeyDescriptionOutput = | GetEncryptedDataKeyDescriptionOutput ( - nameonly EncryptedDataKeyDescriptionOutput: EncryptedDataKeyDescriptionList - ) - datatype GetEncryptedDataKeyDescriptionUnion = - | header(header: seq) - | plaintextItem(plaintextItem: ComAmazonawsDynamodbTypes.AttributeMap) - datatype GetPrefix = | GetPrefix ( - nameonly length: int32 - ) - datatype GetSegment = | GetSegment ( - nameonly split: Char , - nameonly index: int32 - ) - datatype GetSegments = | GetSegments ( - nameonly split: Char , - nameonly low: int32 , - nameonly high: int32 - ) - datatype GetSubstring = | GetSubstring ( - nameonly low: int32 , - nameonly high: int32 - ) - datatype GetSuffix = | GetSuffix ( - nameonly length: int32 - ) - datatype Insert = | Insert ( - nameonly literal: string - ) - class ILegacyDynamoDbEncryptorCallHistory { - ghost constructor() { - -} - -} - trait {:termination false} ILegacyDynamoDbEncryptor - { - // Helper to define any additional modifies/reads clauses. - // If your operations need to mutate state, - // add it in your constructor function: - // Modifies := {your, fields, here, History}; - // If you do not need to mutate anything: -// Modifies := {History}; - - ghost const Modifies: set - // For an unassigned field defined in a trait, - // Dafny can only assign a value in the constructor. - // This means that for Dafny to reason about this value, - // it needs some way to know (an invariant), - // about the state of the object. - // This builds on the Valid/Repr paradigm - // To make this kind requires safe to add - // to methods called from unverified code, - // the predicate MUST NOT take any arguments. - // This means that the correctness of this requires - // MUST only be evaluated by the class itself. - // If you require any additional mutation, - // then you MUST ensure everything you need in ValidState. - // You MUST also ensure ValidState in your constructor. - predicate ValidState() - ensures ValidState() ==> History in Modifies - ghost const History: ILegacyDynamoDbEncryptorCallHistory - -} - datatype LegacyOverride = | LegacyOverride ( - nameonly policy: LegacyPolicy , - nameonly encryptor: ILegacyDynamoDbEncryptor , - nameonly attributeActionsOnEncrypt: AttributeActions , - nameonly defaultAttributeFlag: Option := Option.None - ) - datatype LegacyPolicy = - | FORCE_LEGACY_ENCRYPT_ALLOW_LEGACY_DECRYPT - | FORBID_LEGACY_ENCRYPT_ALLOW_LEGACY_DECRYPT - | FORBID_LEGACY_ENCRYPT_FORBID_LEGACY_DECRYPT - datatype Lower = | Lower ( - - ) - datatype MultiKeyStore = | MultiKeyStore ( - nameonly keyFieldName: string , - nameonly cacheTTL: int32 , - nameonly cache: Option := Option.None - ) - datatype PartOnly = | PartOnly ( - - ) - datatype PlaintextOverride = - | FORCE_PLAINTEXT_WRITE_ALLOW_PLAINTEXT_READ - | FORBID_PLAINTEXT_WRITE_ALLOW_PLAINTEXT_READ - | FORBID_PLAINTEXT_WRITE_FORBID_PLAINTEXT_READ - type Prefix = x: string | IsValid_Prefix(x) witness * - predicate method IsValid_Prefix(x: string) { - ( 1 <= |x| ) -} - datatype SearchConfig = | SearchConfig ( - nameonly versions: BeaconVersionList , - nameonly writeVersion: VersionNumber - ) - datatype Shared = | Shared ( - nameonly other: string - ) - datatype SharedSet = | SharedSet ( - nameonly other: string - ) - datatype SignedPart = | SignedPart ( - nameonly name: string , - nameonly prefix: Prefix , - nameonly loc: Option := Option.None - ) - type SignedPartsList = x: seq | IsValid_SignedPartsList(x) witness * - predicate method IsValid_SignedPartsList(x: seq) { - ( 1 <= |x| ) -} - datatype SingleKeyStore = | SingleKeyStore ( - nameonly keyId: string , - nameonly cacheTTL: int32 - ) - datatype StandardBeacon = | StandardBeacon ( - nameonly name: string , - nameonly length: BeaconBitLength , - nameonly loc: Option := Option.None , - nameonly style: Option := Option.None - ) - type StandardBeaconList = x: seq | IsValid_StandardBeaconList(x) witness * - predicate method IsValid_StandardBeaconList(x: seq) { - ( 1 <= |x| ) -} - type TerminalLocation = x: string | IsValid_TerminalLocation(x) witness * - predicate method IsValid_TerminalLocation(x: string) { - ( 1 <= |x| ) -} - datatype Upper = | Upper ( - - ) - type VersionNumber = x: int32 | IsValid_VersionNumber(x) witness * - predicate method IsValid_VersionNumber(x: int32) { - ( 1 <= x ) -} - datatype VirtualField = | VirtualField ( - nameonly name: string , - nameonly parts: VirtualPartList - ) - type VirtualFieldList = x: seq | IsValid_VirtualFieldList(x) witness * - predicate method IsValid_VirtualFieldList(x: seq) { - ( 1 <= |x| ) -} - datatype VirtualPart = | VirtualPart ( - nameonly loc: TerminalLocation , - nameonly trans: Option := Option.None - ) - type VirtualPartList = x: seq | IsValid_VirtualPartList(x) witness * - predicate method IsValid_VirtualPartList(x: seq) { - ( 1 <= |x| ) -} - datatype VirtualTransform = - | upper(upper: Upper) - | lower(lower: Lower) - | insert(insert: Insert) - | prefix(prefix: GetPrefix) - | suffix(suffix: GetSuffix) - | substring(substring: GetSubstring) - | segment(segment: GetSegment) - | segments(segments: GetSegments) - type VirtualTransformList = x: seq | IsValid_VirtualTransformList(x) witness * - predicate method IsValid_VirtualTransformList(x: seq) { - ( 1 <= |x| ) -} - datatype Error = - // Local Error structures are listed here - | DynamoDbEncryptionException ( - nameonly message: string - ) - // Any dependent models are listed here - | AwsCryptographyDbEncryptionSdkStructuredEncryption(AwsCryptographyDbEncryptionSdkStructuredEncryption: AwsCryptographyDbEncryptionSdkStructuredEncryptionTypes.Error) - | AwsCryptographyMaterialProviders(AwsCryptographyMaterialProviders: AwsCryptographyMaterialProvidersTypes.Error) - | AwsCryptographyKeyStore(AwsCryptographyKeyStore: AwsCryptographyKeyStoreTypes.Error) - | AwsCryptographyPrimitives(AwsCryptographyPrimitives: AwsCryptographyPrimitivesTypes.Error) - | ComAmazonawsDynamodb(ComAmazonawsDynamodb: ComAmazonawsDynamodbTypes.Error) - // The Collection error is used to collect several errors together - // This is useful when composing OR logic. - // Consider the following method: - // - // method FN(n:I) - // returns (res: Result) - // ensures A(I).Success? ==> res.Success? - // ensures B(I).Success? ==> res.Success? - // ensures A(I).Failure? && B(I).Failure? ==> res.Failure? - // - // If either A || B is successful then FN is successful. - // And if A && B fail then FN will fail. - // But what information should FN transmit back to the caller? - // While it may be correct to hide these details from the caller, - // this can not be the globally correct option. - // Suppose that A and B can be blocked by different ACLs, - // and that their representation of I is only eventually consistent. - // How can the caller distinguish, at a minimum for logging, - // the difference between the four failure modes? - // || (!access(A(I)) && !access(B(I))) - // || (!exit(A(I)) && !exit(B(I))) - // || (!access(A(I)) && !exit(B(I))) - // || (!exit(A(I)) && !access(B(I))) - | CollectionOfErrors(list: seq, nameonly message: string) - // The Opaque error, used for native, extern, wrapped or unknown errors - | Opaque(obj: object) - type OpaqueError = e: Error | e.Opaque? witness * -} - abstract module AbstractAwsCryptographyDbEncryptionSdkDynamoDbService - { - import opened Wrappers - import opened StandardLibrary.UInt - import opened UTF8 - import opened Types = AwsCryptographyDbEncryptionSdkDynamoDbTypes - import Operations : AbstractAwsCryptographyDbEncryptionSdkDynamoDbOperations - function method DefaultDynamoDbEncryptionConfig(): DynamoDbEncryptionConfig - method DynamoDbEncryption(config: DynamoDbEncryptionConfig := DefaultDynamoDbEncryptionConfig()) - returns (res: Result) - ensures res.Success? ==> - && fresh(res.value) - && fresh(res.value.Modifies) - && fresh(res.value.History) - && res.value.ValidState() - - // Helper function for the benefit of native code to create a Success(client) without referring to Dafny internals - function method CreateSuccessOfClient(client: IDynamoDbEncryptionClient): Result { - Success(client) - } // Helper function for the benefit of native code to create a Failure(error) without referring to Dafny internals - function method CreateFailureOfError(error: Error): Result { - Failure(error) - } - class DynamoDbEncryptionClient extends IDynamoDbEncryptionClient - { - constructor(config: Operations.InternalConfig) - requires Operations.ValidInternalConfig?(config) - ensures - && ValidState() - && fresh(History) - && this.config == config - const config: Operations.InternalConfig - predicate ValidState() - ensures ValidState() ==> - && Operations.ValidInternalConfig?(config) - && History !in Operations.ModifiesInternalConfig(config) - && Modifies == Operations.ModifiesInternalConfig(config) + {History} - predicate CreateDynamoDbEncryptionBranchKeyIdSupplierEnsuresPublicly(input: CreateDynamoDbEncryptionBranchKeyIdSupplierInput , output: Result) - {Operations.CreateDynamoDbEncryptionBranchKeyIdSupplierEnsuresPublicly(input, output)} - // The public method to be called by library consumers - method CreateDynamoDbEncryptionBranchKeyIdSupplier ( input: CreateDynamoDbEncryptionBranchKeyIdSupplierInput ) - returns (output: Result) - requires - && ValidState() - && input.ddbKeyBranchKeyIdSupplier.ValidState() - && input.ddbKeyBranchKeyIdSupplier.Modifies !! {History} - modifies Modifies - {History} , - input.ddbKeyBranchKeyIdSupplier.Modifies , - History`CreateDynamoDbEncryptionBranchKeyIdSupplier - // Dafny will skip type parameters when generating a default decreases clause. - decreases Modifies - {History} , - input.ddbKeyBranchKeyIdSupplier.Modifies - ensures - && ValidState() - && ( output.Success? ==> - && output.value.branchKeyIdSupplier.ValidState() - && output.value.branchKeyIdSupplier.Modifies !! {History} - && fresh(output.value.branchKeyIdSupplier) - && fresh ( output.value.branchKeyIdSupplier.Modifies - Modifies - {History} - input.ddbKeyBranchKeyIdSupplier.Modifies ) ) - ensures CreateDynamoDbEncryptionBranchKeyIdSupplierEnsuresPublicly(input, output) - ensures History.CreateDynamoDbEncryptionBranchKeyIdSupplier == old(History.CreateDynamoDbEncryptionBranchKeyIdSupplier) + [DafnyCallEvent(input, output)] - { - output := Operations.CreateDynamoDbEncryptionBranchKeyIdSupplier(config, input); - History.CreateDynamoDbEncryptionBranchKeyIdSupplier := History.CreateDynamoDbEncryptionBranchKeyIdSupplier + [DafnyCallEvent(input, output)]; -} - - predicate GetEncryptedDataKeyDescriptionEnsuresPublicly(input: GetEncryptedDataKeyDescriptionInput , output: Result) - {Operations.GetEncryptedDataKeyDescriptionEnsuresPublicly(input, output)} - // The public method to be called by library consumers - method GetEncryptedDataKeyDescription ( input: GetEncryptedDataKeyDescriptionInput ) - returns (output: Result) - requires - && ValidState() - modifies Modifies - {History} , - History`GetEncryptedDataKeyDescription - // Dafny will skip type parameters when generating a default decreases clause. - decreases Modifies - {History} - ensures - && ValidState() - ensures GetEncryptedDataKeyDescriptionEnsuresPublicly(input, output) - ensures History.GetEncryptedDataKeyDescription == old(History.GetEncryptedDataKeyDescription) + [DafnyCallEvent(input, output)] - { - output := Operations.GetEncryptedDataKeyDescription(config, input); - History.GetEncryptedDataKeyDescription := History.GetEncryptedDataKeyDescription + [DafnyCallEvent(input, output)]; -} - -} -} - abstract module AbstractAwsCryptographyDbEncryptionSdkDynamoDbOperations { - import opened Wrappers - import opened StandardLibrary.UInt - import opened UTF8 - import opened Types = AwsCryptographyDbEncryptionSdkDynamoDbTypes - type InternalConfig - predicate ValidInternalConfig?(config: InternalConfig) - function ModifiesInternalConfig(config: InternalConfig): set - predicate CreateDynamoDbEncryptionBranchKeyIdSupplierEnsuresPublicly(input: CreateDynamoDbEncryptionBranchKeyIdSupplierInput , output: Result) - // The private method to be refined by the library developer - - - method CreateDynamoDbEncryptionBranchKeyIdSupplier ( config: InternalConfig , input: CreateDynamoDbEncryptionBranchKeyIdSupplierInput ) - returns (output: Result) - requires - && ValidInternalConfig?(config) - && input.ddbKeyBranchKeyIdSupplier.ValidState() - modifies ModifiesInternalConfig(config) , - input.ddbKeyBranchKeyIdSupplier.Modifies - // Dafny will skip type parameters when generating a default decreases clause. - decreases ModifiesInternalConfig(config) , - input.ddbKeyBranchKeyIdSupplier.Modifies - ensures - && ValidInternalConfig?(config) - && ( output.Success? ==> - && output.value.branchKeyIdSupplier.ValidState() - && fresh(output.value.branchKeyIdSupplier) - && fresh ( output.value.branchKeyIdSupplier.Modifies - ModifiesInternalConfig(config) - input.ddbKeyBranchKeyIdSupplier.Modifies ) ) - ensures CreateDynamoDbEncryptionBranchKeyIdSupplierEnsuresPublicly(input, output) - - - predicate GetEncryptedDataKeyDescriptionEnsuresPublicly(input: GetEncryptedDataKeyDescriptionInput , output: Result) - // The private method to be refined by the library developer - - - method GetEncryptedDataKeyDescription ( config: InternalConfig , input: GetEncryptedDataKeyDescriptionInput ) - returns (output: Result) - requires - && ValidInternalConfig?(config) - modifies ModifiesInternalConfig(config) - // Dafny will skip type parameters when generating a default decreases clause. - decreases ModifiesInternalConfig(config) - ensures - && ValidInternalConfig?(config) - ensures GetEncryptedDataKeyDescriptionEnsuresPublicly(input, output) -} diff --git a/TestVectors/runtimes/java/src/main/smithy-generated/software/amazon/cryptography/dbencryptionsdk/dynamodb/DynamoDbEncryption.java b/TestVectors/runtimes/java/src/main/smithy-generated/software/amazon/cryptography/dbencryptionsdk/dynamodb/DynamoDbEncryption.java deleted file mode 100644 index a418aa268..000000000 --- a/TestVectors/runtimes/java/src/main/smithy-generated/software/amazon/cryptography/dbencryptionsdk/dynamodb/DynamoDbEncryption.java +++ /dev/null @@ -1,99 +0,0 @@ -// Copyright Amazon.com Inc. or its affiliates. All Rights Reserved. -// SPDX-License-Identifier: Apache-2.0 -// Do not modify this file. This file is machine generated, and any changes to it will be overwritten. -package software.amazon.cryptography.dbencryptionsdk.dynamodb; - -import Wrappers_Compile.Result; -import java.lang.IllegalArgumentException; -import java.util.Objects; -import software.amazon.cryptography.dbencryptionsdk.dynamodb.internaldafny.__default; -import software.amazon.cryptography.dbencryptionsdk.dynamodb.internaldafny.types.Error; -import software.amazon.cryptography.dbencryptionsdk.dynamodb.internaldafny.types.IDynamoDbEncryptionClient; -import software.amazon.cryptography.dbencryptionsdk.dynamodb.model.CreateDynamoDbEncryptionBranchKeyIdSupplierInput; -import software.amazon.cryptography.dbencryptionsdk.dynamodb.model.CreateDynamoDbEncryptionBranchKeyIdSupplierOutput; -import software.amazon.cryptography.dbencryptionsdk.dynamodb.model.DynamoDbEncryptionConfig; -import software.amazon.cryptography.dbencryptionsdk.dynamodb.model.GetEncryptedDataKeyDescriptionInput; -import software.amazon.cryptography.dbencryptionsdk.dynamodb.model.GetEncryptedDataKeyDescriptionOutput; - -public class DynamoDbEncryption { - private final IDynamoDbEncryptionClient _impl; - - protected DynamoDbEncryption(BuilderImpl builder) { - DynamoDbEncryptionConfig input = builder.DynamoDbEncryptionConfig(); - software.amazon.cryptography.dbencryptionsdk.dynamodb.internaldafny.types.DynamoDbEncryptionConfig dafnyValue = ToDafny.DynamoDbEncryptionConfig(input); - Result result = __default.DynamoDbEncryption(dafnyValue); - if (result.is_Failure()) { - throw ToNative.Error(result.dtor_error()); - } - this._impl = result.dtor_value(); - } - - DynamoDbEncryption(IDynamoDbEncryptionClient impl) { - this._impl = impl; - } - - public static Builder builder() { - return new BuilderImpl(); - } - - /** - * Create a Branch Key Supplier for use with the Hierarchical Keyring that decides what Branch Key to use based on the primary key of the DynamoDB item being read or written. - * - * @param input Inputs for creating a Branch Key Supplier from a DynamoDB Key Branch Key Id Supplier - * @return Outputs for creating a Branch Key Supplier from a DynamoDB Key Branch Key Id Supplier - */ - public CreateDynamoDbEncryptionBranchKeyIdSupplierOutput CreateDynamoDbEncryptionBranchKeyIdSupplier( - CreateDynamoDbEncryptionBranchKeyIdSupplierInput input) { - software.amazon.cryptography.dbencryptionsdk.dynamodb.internaldafny.types.CreateDynamoDbEncryptionBranchKeyIdSupplierInput dafnyValue = ToDafny.CreateDynamoDbEncryptionBranchKeyIdSupplierInput(input); - Result result = this._impl.CreateDynamoDbEncryptionBranchKeyIdSupplier(dafnyValue); - if (result.is_Failure()) { - throw ToNative.Error(result.dtor_error()); - } - return ToNative.CreateDynamoDbEncryptionBranchKeyIdSupplierOutput(result.dtor_value()); - } - - public GetEncryptedDataKeyDescriptionOutput GetEncryptedDataKeyDescription( - GetEncryptedDataKeyDescriptionInput input) { - software.amazon.cryptography.dbencryptionsdk.dynamodb.internaldafny.types.GetEncryptedDataKeyDescriptionInput dafnyValue = ToDafny.GetEncryptedDataKeyDescriptionInput(input); - Result result = this._impl.GetEncryptedDataKeyDescription(dafnyValue); - if (result.is_Failure()) { - throw ToNative.Error(result.dtor_error()); - } - return ToNative.GetEncryptedDataKeyDescriptionOutput(result.dtor_value()); - } - - protected IDynamoDbEncryptionClient impl() { - return this._impl; - } - - public interface Builder { - Builder DynamoDbEncryptionConfig(DynamoDbEncryptionConfig DynamoDbEncryptionConfig); - - DynamoDbEncryptionConfig DynamoDbEncryptionConfig(); - - DynamoDbEncryption build(); - } - - static class BuilderImpl implements Builder { - protected DynamoDbEncryptionConfig DynamoDbEncryptionConfig; - - protected BuilderImpl() { - } - - public Builder DynamoDbEncryptionConfig(DynamoDbEncryptionConfig DynamoDbEncryptionConfig) { - this.DynamoDbEncryptionConfig = DynamoDbEncryptionConfig; - return this; - } - - public DynamoDbEncryptionConfig DynamoDbEncryptionConfig() { - return this.DynamoDbEncryptionConfig; - } - - public DynamoDbEncryption build() { - if (Objects.isNull(this.DynamoDbEncryptionConfig())) { - throw new IllegalArgumentException("Missing value for required field `DynamoDbEncryptionConfig`"); - } - return new DynamoDbEncryption(this); - } - } -} diff --git a/TestVectors/runtimes/java/src/main/smithy-generated/software/amazon/cryptography/dbencryptionsdk/dynamodb/DynamoDbKeyBranchKeyIdSupplier.java b/TestVectors/runtimes/java/src/main/smithy-generated/software/amazon/cryptography/dbencryptionsdk/dynamodb/DynamoDbKeyBranchKeyIdSupplier.java deleted file mode 100644 index cbb65800e..000000000 --- a/TestVectors/runtimes/java/src/main/smithy-generated/software/amazon/cryptography/dbencryptionsdk/dynamodb/DynamoDbKeyBranchKeyIdSupplier.java +++ /dev/null @@ -1,85 +0,0 @@ -// Copyright Amazon.com Inc. or its affiliates. All Rights Reserved. -// SPDX-License-Identifier: Apache-2.0 -// Do not modify this file. This file is machine generated, and any changes to it will be overwritten. -package software.amazon.cryptography.dbencryptionsdk.dynamodb; - -import Wrappers_Compile.Result; -import java.lang.IllegalArgumentException; -import java.lang.RuntimeException; -import java.util.Objects; -import software.amazon.cryptography.dbencryptionsdk.dynamodb.internaldafny.types.Error; -import software.amazon.cryptography.dbencryptionsdk.dynamodb.model.GetBranchKeyIdFromDdbKeyInput; -import software.amazon.cryptography.dbencryptionsdk.dynamodb.model.GetBranchKeyIdFromDdbKeyOutput; - -public final class DynamoDbKeyBranchKeyIdSupplier implements IDynamoDbKeyBranchKeyIdSupplier { - private final software.amazon.cryptography.dbencryptionsdk.dynamodb.internaldafny.types.IDynamoDbKeyBranchKeyIdSupplier _impl; - - private DynamoDbKeyBranchKeyIdSupplier( - software.amazon.cryptography.dbencryptionsdk.dynamodb.internaldafny.types.IDynamoDbKeyBranchKeyIdSupplier iDynamoDbKeyBranchKeyIdSupplier) { - Objects.requireNonNull(iDynamoDbKeyBranchKeyIdSupplier, "Missing value for required argument `iDynamoDbKeyBranchKeyIdSupplier`"); - this._impl = iDynamoDbKeyBranchKeyIdSupplier; - } - - public static DynamoDbKeyBranchKeyIdSupplier wrap( - software.amazon.cryptography.dbencryptionsdk.dynamodb.internaldafny.types.IDynamoDbKeyBranchKeyIdSupplier iDynamoDbKeyBranchKeyIdSupplier) { - return new DynamoDbKeyBranchKeyIdSupplier(iDynamoDbKeyBranchKeyIdSupplier); - } - - public static DynamoDbKeyBranchKeyIdSupplier wrap( - I iDynamoDbKeyBranchKeyIdSupplier) { - Objects.requireNonNull(iDynamoDbKeyBranchKeyIdSupplier, "Missing value for required argument `iDynamoDbKeyBranchKeyIdSupplier`"); - if (iDynamoDbKeyBranchKeyIdSupplier instanceof software.amazon.cryptography.dbencryptionsdk.dynamodb.DynamoDbKeyBranchKeyIdSupplier) { - return ((DynamoDbKeyBranchKeyIdSupplier) iDynamoDbKeyBranchKeyIdSupplier); - } - return DynamoDbKeyBranchKeyIdSupplier.wrap(new NativeWrapper(iDynamoDbKeyBranchKeyIdSupplier)); - } - - public software.amazon.cryptography.dbencryptionsdk.dynamodb.internaldafny.types.IDynamoDbKeyBranchKeyIdSupplier impl( - ) { - return this._impl; - } - - /** - * Get the Branch Key that should be used for wrapping and unwrapping data keys based on the primary key of the item being read or written. - * - * @param input Inputs for getting the Branch Key that should be used for wrapping and unwrapping data keys. - * @return Outputs for getting the Branch Key that should be used for wrapping and unwrapping data keys. - */ - public GetBranchKeyIdFromDdbKeyOutput GetBranchKeyIdFromDdbKey( - GetBranchKeyIdFromDdbKeyInput input) { - software.amazon.cryptography.dbencryptionsdk.dynamodb.internaldafny.types.GetBranchKeyIdFromDdbKeyInput dafnyValue = ToDafny.GetBranchKeyIdFromDdbKeyInput(input); - Result result = this._impl.GetBranchKeyIdFromDdbKey(dafnyValue); - if (result.is_Failure()) { - throw ToNative.Error(result.dtor_error()); - } - return ToNative.GetBranchKeyIdFromDdbKeyOutput(result.dtor_value()); - } - - protected static final class NativeWrapper implements software.amazon.cryptography.dbencryptionsdk.dynamodb.internaldafny.types.IDynamoDbKeyBranchKeyIdSupplier { - protected final IDynamoDbKeyBranchKeyIdSupplier _impl; - - NativeWrapper(IDynamoDbKeyBranchKeyIdSupplier nativeImpl) { - if (nativeImpl instanceof DynamoDbKeyBranchKeyIdSupplier) { - throw new IllegalArgumentException("Recursive wrapping is strictly forbidden."); - } - this._impl = nativeImpl; - } - - public Result GetBranchKeyIdFromDdbKey( - software.amazon.cryptography.dbencryptionsdk.dynamodb.internaldafny.types.GetBranchKeyIdFromDdbKeyInput dafnyInput) { - GetBranchKeyIdFromDdbKeyInput nativeInput = ToNative.GetBranchKeyIdFromDdbKeyInput(dafnyInput); - try { - GetBranchKeyIdFromDdbKeyOutput nativeOutput = this._impl.GetBranchKeyIdFromDdbKey(nativeInput); - software.amazon.cryptography.dbencryptionsdk.dynamodb.internaldafny.types.GetBranchKeyIdFromDdbKeyOutput dafnyOutput = ToDafny.GetBranchKeyIdFromDdbKeyOutput(nativeOutput); - return Result.create_Success(dafnyOutput); - } catch (RuntimeException ex) { - return Result.create_Failure(ToDafny.Error(ex)); - } - } - - public Result GetBranchKeyIdFromDdbKey_k( - software.amazon.cryptography.dbencryptionsdk.dynamodb.internaldafny.types.GetBranchKeyIdFromDdbKeyInput dafnyInput) { - throw new RuntimeException("Not supported at this time."); - } - } -} diff --git a/TestVectors/runtimes/java/src/main/smithy-generated/software/amazon/cryptography/dbencryptionsdk/dynamodb/IDynamoDbKeyBranchKeyIdSupplier.java b/TestVectors/runtimes/java/src/main/smithy-generated/software/amazon/cryptography/dbencryptionsdk/dynamodb/IDynamoDbKeyBranchKeyIdSupplier.java deleted file mode 100644 index e6ddaba2c..000000000 --- a/TestVectors/runtimes/java/src/main/smithy-generated/software/amazon/cryptography/dbencryptionsdk/dynamodb/IDynamoDbKeyBranchKeyIdSupplier.java +++ /dev/null @@ -1,17 +0,0 @@ -// Copyright Amazon.com Inc. or its affiliates. All Rights Reserved. -// SPDX-License-Identifier: Apache-2.0 -// Do not modify this file. This file is machine generated, and any changes to it will be overwritten. -package software.amazon.cryptography.dbencryptionsdk.dynamodb; - -import software.amazon.cryptography.dbencryptionsdk.dynamodb.model.GetBranchKeyIdFromDdbKeyInput; -import software.amazon.cryptography.dbencryptionsdk.dynamodb.model.GetBranchKeyIdFromDdbKeyOutput; - -public interface IDynamoDbKeyBranchKeyIdSupplier { - /** - * Get the Branch Key that should be used for wrapping and unwrapping data keys based on the primary key of the item being read or written. - * - * @param input Inputs for getting the Branch Key that should be used for wrapping and unwrapping data keys. - * @return Outputs for getting the Branch Key that should be used for wrapping and unwrapping data keys. - */ - GetBranchKeyIdFromDdbKeyOutput GetBranchKeyIdFromDdbKey(GetBranchKeyIdFromDdbKeyInput input); -} diff --git a/TestVectors/runtimes/java/src/main/smithy-generated/software/amazon/cryptography/dbencryptionsdk/dynamodb/ILegacyDynamoDbEncryptor.java b/TestVectors/runtimes/java/src/main/smithy-generated/software/amazon/cryptography/dbencryptionsdk/dynamodb/ILegacyDynamoDbEncryptor.java deleted file mode 100644 index 825d315a4..000000000 --- a/TestVectors/runtimes/java/src/main/smithy-generated/software/amazon/cryptography/dbencryptionsdk/dynamodb/ILegacyDynamoDbEncryptor.java +++ /dev/null @@ -1,7 +0,0 @@ -// Copyright Amazon.com Inc. or its affiliates. All Rights Reserved. -// SPDX-License-Identifier: Apache-2.0 -// Do not modify this file. This file is machine generated, and any changes to it will be overwritten. -package software.amazon.cryptography.dbencryptionsdk.dynamodb; - -public interface ILegacyDynamoDbEncryptor { -} diff --git a/TestVectors/runtimes/java/src/main/smithy-generated/software/amazon/cryptography/dbencryptionsdk/dynamodb/LegacyDynamoDbEncryptor.java b/TestVectors/runtimes/java/src/main/smithy-generated/software/amazon/cryptography/dbencryptionsdk/dynamodb/LegacyDynamoDbEncryptor.java deleted file mode 100644 index 07ac066d6..000000000 --- a/TestVectors/runtimes/java/src/main/smithy-generated/software/amazon/cryptography/dbencryptionsdk/dynamodb/LegacyDynamoDbEncryptor.java +++ /dev/null @@ -1,47 +0,0 @@ -// Copyright Amazon.com Inc. or its affiliates. All Rights Reserved. -// SPDX-License-Identifier: Apache-2.0 -// Do not modify this file. This file is machine generated, and any changes to it will be overwritten. -package software.amazon.cryptography.dbencryptionsdk.dynamodb; - -import java.lang.IllegalArgumentException; -import java.util.Objects; - -public final class LegacyDynamoDbEncryptor implements ILegacyDynamoDbEncryptor { - private final software.amazon.cryptography.dbencryptionsdk.dynamodb.internaldafny.types.ILegacyDynamoDbEncryptor _impl; - - private LegacyDynamoDbEncryptor( - software.amazon.cryptography.dbencryptionsdk.dynamodb.internaldafny.types.ILegacyDynamoDbEncryptor iLegacyDynamoDbEncryptor) { - Objects.requireNonNull(iLegacyDynamoDbEncryptor, "Missing value for required argument `iLegacyDynamoDbEncryptor`"); - this._impl = iLegacyDynamoDbEncryptor; - } - - public static LegacyDynamoDbEncryptor wrap( - software.amazon.cryptography.dbencryptionsdk.dynamodb.internaldafny.types.ILegacyDynamoDbEncryptor iLegacyDynamoDbEncryptor) { - return new LegacyDynamoDbEncryptor(iLegacyDynamoDbEncryptor); - } - - public static LegacyDynamoDbEncryptor wrap( - I iLegacyDynamoDbEncryptor) { - Objects.requireNonNull(iLegacyDynamoDbEncryptor, "Missing value for required argument `iLegacyDynamoDbEncryptor`"); - if (iLegacyDynamoDbEncryptor instanceof software.amazon.cryptography.dbencryptionsdk.dynamodb.LegacyDynamoDbEncryptor) { - return ((LegacyDynamoDbEncryptor) iLegacyDynamoDbEncryptor); - } - return LegacyDynamoDbEncryptor.wrap(new NativeWrapper(iLegacyDynamoDbEncryptor)); - } - - public software.amazon.cryptography.dbencryptionsdk.dynamodb.internaldafny.types.ILegacyDynamoDbEncryptor impl( - ) { - return this._impl; - } - - protected static final class NativeWrapper implements software.amazon.cryptography.dbencryptionsdk.dynamodb.internaldafny.types.ILegacyDynamoDbEncryptor { - protected final ILegacyDynamoDbEncryptor _impl; - - NativeWrapper(ILegacyDynamoDbEncryptor nativeImpl) { - if (nativeImpl instanceof LegacyDynamoDbEncryptor) { - throw new IllegalArgumentException("Recursive wrapping is strictly forbidden."); - } - this._impl = nativeImpl; - } - } -} diff --git a/TestVectors/runtimes/java/src/main/smithy-generated/software/amazon/cryptography/dbencryptionsdk/dynamodb/ToDafny.java b/TestVectors/runtimes/java/src/main/smithy-generated/software/amazon/cryptography/dbencryptionsdk/dynamodb/ToDafny.java deleted file mode 100644 index d9209b10a..000000000 --- a/TestVectors/runtimes/java/src/main/smithy-generated/software/amazon/cryptography/dbencryptionsdk/dynamodb/ToDafny.java +++ /dev/null @@ -1,703 +0,0 @@ -// Copyright Amazon.com Inc. or its affiliates. All Rights Reserved. -// SPDX-License-Identifier: Apache-2.0 -// Do not modify this file. This file is machine generated, and any changes to it will be overwritten. -package software.amazon.cryptography.dbencryptionsdk.dynamodb; - -import Wrappers_Compile.Option; -import dafny.DafnyMap; -import dafny.DafnySequence; -import java.lang.Boolean; -import java.lang.Character; -import java.lang.IllegalArgumentException; -import java.lang.Integer; -import java.lang.RuntimeException; -import java.lang.String; -import java.util.List; -import java.util.Map; -import java.util.Objects; -import software.amazon.cryptography.dbencryptionsdk.dynamodb.internaldafny.types.AsSet; -import software.amazon.cryptography.dbencryptionsdk.dynamodb.internaldafny.types.BeaconKeySource; -import software.amazon.cryptography.dbencryptionsdk.dynamodb.internaldafny.types.BeaconStyle; -import software.amazon.cryptography.dbencryptionsdk.dynamodb.internaldafny.types.BeaconVersion; -import software.amazon.cryptography.dbencryptionsdk.dynamodb.internaldafny.types.CompoundBeacon; -import software.amazon.cryptography.dbencryptionsdk.dynamodb.internaldafny.types.Constructor; -import software.amazon.cryptography.dbencryptionsdk.dynamodb.internaldafny.types.ConstructorPart; -import software.amazon.cryptography.dbencryptionsdk.dynamodb.internaldafny.types.CreateDynamoDbEncryptionBranchKeyIdSupplierInput; -import software.amazon.cryptography.dbencryptionsdk.dynamodb.internaldafny.types.CreateDynamoDbEncryptionBranchKeyIdSupplierOutput; -import software.amazon.cryptography.dbencryptionsdk.dynamodb.internaldafny.types.DynamoDbEncryptionConfig; -import software.amazon.cryptography.dbencryptionsdk.dynamodb.internaldafny.types.DynamoDbTableEncryptionConfig; -import software.amazon.cryptography.dbencryptionsdk.dynamodb.internaldafny.types.DynamoDbTablesEncryptionConfig; -import software.amazon.cryptography.dbencryptionsdk.dynamodb.internaldafny.types.EncryptedDataKeyDescriptionOutput; -import software.amazon.cryptography.dbencryptionsdk.dynamodb.internaldafny.types.EncryptedPart; -import software.amazon.cryptography.dbencryptionsdk.dynamodb.internaldafny.types.Error; -import software.amazon.cryptography.dbencryptionsdk.dynamodb.internaldafny.types.Error_DynamoDbEncryptionException; -import software.amazon.cryptography.dbencryptionsdk.dynamodb.internaldafny.types.GetBranchKeyIdFromDdbKeyInput; -import software.amazon.cryptography.dbencryptionsdk.dynamodb.internaldafny.types.GetBranchKeyIdFromDdbKeyOutput; -import software.amazon.cryptography.dbencryptionsdk.dynamodb.internaldafny.types.GetEncryptedDataKeyDescriptionInput; -import software.amazon.cryptography.dbencryptionsdk.dynamodb.internaldafny.types.GetEncryptedDataKeyDescriptionOutput; -import software.amazon.cryptography.dbencryptionsdk.dynamodb.internaldafny.types.GetEncryptedDataKeyDescriptionUnion; -import software.amazon.cryptography.dbencryptionsdk.dynamodb.internaldafny.types.GetPrefix; -import software.amazon.cryptography.dbencryptionsdk.dynamodb.internaldafny.types.GetSegment; -import software.amazon.cryptography.dbencryptionsdk.dynamodb.internaldafny.types.GetSegments; -import software.amazon.cryptography.dbencryptionsdk.dynamodb.internaldafny.types.GetSubstring; -import software.amazon.cryptography.dbencryptionsdk.dynamodb.internaldafny.types.GetSuffix; -import software.amazon.cryptography.dbencryptionsdk.dynamodb.internaldafny.types.IDynamoDbEncryptionClient; -import software.amazon.cryptography.dbencryptionsdk.dynamodb.internaldafny.types.Insert; -import software.amazon.cryptography.dbencryptionsdk.dynamodb.internaldafny.types.LegacyOverride; -import software.amazon.cryptography.dbencryptionsdk.dynamodb.internaldafny.types.LegacyPolicy; -import software.amazon.cryptography.dbencryptionsdk.dynamodb.internaldafny.types.Lower; -import software.amazon.cryptography.dbencryptionsdk.dynamodb.internaldafny.types.MultiKeyStore; -import software.amazon.cryptography.dbencryptionsdk.dynamodb.internaldafny.types.PartOnly; -import software.amazon.cryptography.dbencryptionsdk.dynamodb.internaldafny.types.PlaintextOverride; -import software.amazon.cryptography.dbencryptionsdk.dynamodb.internaldafny.types.SearchConfig; -import software.amazon.cryptography.dbencryptionsdk.dynamodb.internaldafny.types.Shared; -import software.amazon.cryptography.dbencryptionsdk.dynamodb.internaldafny.types.SharedSet; -import software.amazon.cryptography.dbencryptionsdk.dynamodb.internaldafny.types.SignedPart; -import software.amazon.cryptography.dbencryptionsdk.dynamodb.internaldafny.types.SingleKeyStore; -import software.amazon.cryptography.dbencryptionsdk.dynamodb.internaldafny.types.StandardBeacon; -import software.amazon.cryptography.dbencryptionsdk.dynamodb.internaldafny.types.Upper; -import software.amazon.cryptography.dbencryptionsdk.dynamodb.internaldafny.types.VirtualField; -import software.amazon.cryptography.dbencryptionsdk.dynamodb.internaldafny.types.VirtualPart; -import software.amazon.cryptography.dbencryptionsdk.dynamodb.internaldafny.types.VirtualTransform; -import software.amazon.cryptography.dbencryptionsdk.dynamodb.model.CollectionOfErrors; -import software.amazon.cryptography.dbencryptionsdk.dynamodb.model.DynamoDbEncryptionException; -import software.amazon.cryptography.dbencryptionsdk.dynamodb.model.OpaqueError; -import software.amazon.cryptography.dbencryptionsdk.structuredencryption.internaldafny.types.CryptoAction; -import software.amazon.cryptography.keystore.internaldafny.types.IKeyStoreClient; -import software.amazon.cryptography.materialproviders.internaldafny.types.CacheType; -import software.amazon.cryptography.materialproviders.internaldafny.types.DBEAlgorithmSuiteId; -import software.amazon.cryptography.materialproviders.internaldafny.types.IBranchKeyIdSupplier; -import software.amazon.cryptography.materialproviders.internaldafny.types.ICryptographicMaterialsManager; -import software.amazon.cryptography.materialproviders.internaldafny.types.IKeyring; -import software.amazon.cryptography.services.dynamodb.internaldafny.types.AttributeValue; - -public class ToDafny { - public static Error Error(RuntimeException nativeValue) { - if (nativeValue instanceof DynamoDbEncryptionException) { - return ToDafny.Error((DynamoDbEncryptionException) nativeValue); - } - if (nativeValue instanceof OpaqueError) { - return ToDafny.Error((OpaqueError) nativeValue); - } - if (nativeValue instanceof CollectionOfErrors) { - return ToDafny.Error((CollectionOfErrors) nativeValue); - } - return Error.create_Opaque(nativeValue); - } - - public static Error Error(OpaqueError nativeValue) { - return Error.create_Opaque(nativeValue.obj()); - } - - public static Error Error(CollectionOfErrors nativeValue) { - DafnySequence list = software.amazon.smithy.dafny.conversion.ToDafny.Aggregate.GenericToSequence( - nativeValue.list(), - ToDafny::Error, - Error._typeDescriptor()); - DafnySequence message = software.amazon.smithy.dafny.conversion.ToDafny.Simple.CharacterSequence(nativeValue.getMessage()); - return Error.create_CollectionOfErrors(list, message); - } - - public static AsSet AsSet( - software.amazon.cryptography.dbencryptionsdk.dynamodb.model.AsSet nativeValue) { - return new AsSet(); - } - - public static BeaconVersion BeaconVersion( - software.amazon.cryptography.dbencryptionsdk.dynamodb.model.BeaconVersion nativeValue) { - Integer version; - version = (nativeValue.version()); - IKeyStoreClient keyStore; - keyStore = software.amazon.cryptography.keystore.ToDafny.KeyStore(nativeValue.keyStore()); - BeaconKeySource keySource; - keySource = ToDafny.BeaconKeySource(nativeValue.keySource()); - DafnySequence standardBeacons; - standardBeacons = ToDafny.StandardBeaconList(nativeValue.standardBeacons()); - Option> compoundBeacons; - compoundBeacons = (Objects.nonNull(nativeValue.compoundBeacons()) && nativeValue.compoundBeacons().size() > 0) ? - Option.create_Some(ToDafny.CompoundBeaconList(nativeValue.compoundBeacons())) - : Option.create_None(); - Option> virtualFields; - virtualFields = (Objects.nonNull(nativeValue.virtualFields()) && nativeValue.virtualFields().size() > 0) ? - Option.create_Some(ToDafny.VirtualFieldList(nativeValue.virtualFields())) - : Option.create_None(); - Option> encryptedParts; - encryptedParts = (Objects.nonNull(nativeValue.encryptedParts()) && nativeValue.encryptedParts().size() > 0) ? - Option.create_Some(ToDafny.EncryptedPartsList(nativeValue.encryptedParts())) - : Option.create_None(); - Option> signedParts; - signedParts = (Objects.nonNull(nativeValue.signedParts()) && nativeValue.signedParts().size() > 0) ? - Option.create_Some(ToDafny.SignedPartsList(nativeValue.signedParts())) - : Option.create_None(); - return new BeaconVersion(version, keyStore, keySource, standardBeacons, compoundBeacons, virtualFields, encryptedParts, signedParts); - } - - public static CompoundBeacon CompoundBeacon( - software.amazon.cryptography.dbencryptionsdk.dynamodb.model.CompoundBeacon nativeValue) { - DafnySequence name; - name = software.amazon.smithy.dafny.conversion.ToDafny.Simple.CharacterSequence(nativeValue.name()); - DafnySequence split; - split = software.amazon.smithy.dafny.conversion.ToDafny.Simple.CharacterSequence(nativeValue.split()); - Option> encrypted; - encrypted = (Objects.nonNull(nativeValue.encrypted()) && nativeValue.encrypted().size() > 0) ? - Option.create_Some(ToDafny.EncryptedPartsList(nativeValue.encrypted())) - : Option.create_None(); - Option> signed; - signed = (Objects.nonNull(nativeValue.signed()) && nativeValue.signed().size() > 0) ? - Option.create_Some(ToDafny.SignedPartsList(nativeValue.signed())) - : Option.create_None(); - Option> constructors; - constructors = (Objects.nonNull(nativeValue.constructors()) && nativeValue.constructors().size() > 0) ? - Option.create_Some(ToDafny.ConstructorList(nativeValue.constructors())) - : Option.create_None(); - return new CompoundBeacon(name, split, encrypted, signed, constructors); - } - - public static Constructor Constructor( - software.amazon.cryptography.dbencryptionsdk.dynamodb.model.Constructor nativeValue) { - DafnySequence parts; - parts = ToDafny.ConstructorPartList(nativeValue.parts()); - return new Constructor(parts); - } - - public static ConstructorPart ConstructorPart( - software.amazon.cryptography.dbencryptionsdk.dynamodb.model.ConstructorPart nativeValue) { - DafnySequence name; - name = software.amazon.smithy.dafny.conversion.ToDafny.Simple.CharacterSequence(nativeValue.name()); - Boolean required; - required = (nativeValue.required()); - return new ConstructorPart(name, required); - } - - public static CreateDynamoDbEncryptionBranchKeyIdSupplierInput CreateDynamoDbEncryptionBranchKeyIdSupplierInput( - software.amazon.cryptography.dbencryptionsdk.dynamodb.model.CreateDynamoDbEncryptionBranchKeyIdSupplierInput nativeValue) { - software.amazon.cryptography.dbencryptionsdk.dynamodb.internaldafny.types.IDynamoDbKeyBranchKeyIdSupplier ddbKeyBranchKeyIdSupplier; - ddbKeyBranchKeyIdSupplier = ToDafny.DynamoDbKeyBranchKeyIdSupplier(nativeValue.ddbKeyBranchKeyIdSupplier()); - return new CreateDynamoDbEncryptionBranchKeyIdSupplierInput(ddbKeyBranchKeyIdSupplier); - } - - public static CreateDynamoDbEncryptionBranchKeyIdSupplierOutput CreateDynamoDbEncryptionBranchKeyIdSupplierOutput( - software.amazon.cryptography.dbencryptionsdk.dynamodb.model.CreateDynamoDbEncryptionBranchKeyIdSupplierOutput nativeValue) { - IBranchKeyIdSupplier branchKeyIdSupplier; - branchKeyIdSupplier = software.amazon.cryptography.materialproviders.ToDafny.BranchKeyIdSupplier(nativeValue.branchKeyIdSupplier()); - return new CreateDynamoDbEncryptionBranchKeyIdSupplierOutput(branchKeyIdSupplier); - } - - public static DynamoDbEncryptionConfig DynamoDbEncryptionConfig( - software.amazon.cryptography.dbencryptionsdk.dynamodb.model.DynamoDbEncryptionConfig nativeValue) { - return new DynamoDbEncryptionConfig(); - } - - public static DynamoDbTableEncryptionConfig DynamoDbTableEncryptionConfig( - software.amazon.cryptography.dbencryptionsdk.dynamodb.model.DynamoDbTableEncryptionConfig nativeValue) { - DafnySequence logicalTableName; - logicalTableName = software.amazon.smithy.dafny.conversion.ToDafny.Simple.CharacterSequence(nativeValue.logicalTableName()); - DafnySequence partitionKeyName; - partitionKeyName = software.amazon.smithy.dafny.conversion.ToDafny.Simple.CharacterSequence(nativeValue.partitionKeyName()); - Option> sortKeyName; - sortKeyName = Objects.nonNull(nativeValue.sortKeyName()) ? - Option.create_Some(software.amazon.smithy.dafny.conversion.ToDafny.Simple.CharacterSequence(nativeValue.sortKeyName())) - : Option.create_None(); - Option search; - search = Objects.nonNull(nativeValue.search()) ? - Option.create_Some(ToDafny.SearchConfig(nativeValue.search())) - : Option.create_None(); - DafnyMap, ? extends CryptoAction> attributeActionsOnEncrypt; - attributeActionsOnEncrypt = ToDafny.AttributeActions(nativeValue.attributeActionsOnEncrypt()); - Option>> allowedUnsignedAttributes; - allowedUnsignedAttributes = (Objects.nonNull(nativeValue.allowedUnsignedAttributes()) && nativeValue.allowedUnsignedAttributes().size() > 0) ? - Option.create_Some(software.amazon.cryptography.services.dynamodb.internaldafny.ToDafny.AttributeNameList(nativeValue.allowedUnsignedAttributes())) - : Option.create_None(); - Option> allowedUnsignedAttributePrefix; - allowedUnsignedAttributePrefix = Objects.nonNull(nativeValue.allowedUnsignedAttributePrefix()) ? - Option.create_Some(software.amazon.smithy.dafny.conversion.ToDafny.Simple.CharacterSequence(nativeValue.allowedUnsignedAttributePrefix())) - : Option.create_None(); - Option algorithmSuiteId; - algorithmSuiteId = Objects.nonNull(nativeValue.algorithmSuiteId()) ? - Option.create_Some(software.amazon.cryptography.materialproviders.ToDafny.DBEAlgorithmSuiteId(nativeValue.algorithmSuiteId())) - : Option.create_None(); - Option keyring; - keyring = Objects.nonNull(nativeValue.keyring()) ? - Option.create_Some(software.amazon.cryptography.materialproviders.ToDafny.Keyring(nativeValue.keyring())) - : Option.create_None(); - Option cmm; - cmm = Objects.nonNull(nativeValue.cmm()) ? - Option.create_Some(software.amazon.cryptography.materialproviders.ToDafny.CryptographicMaterialsManager(nativeValue.cmm())) - : Option.create_None(); - Option legacyOverride; - legacyOverride = Objects.nonNull(nativeValue.legacyOverride()) ? - Option.create_Some(ToDafny.LegacyOverride(nativeValue.legacyOverride())) - : Option.create_None(); - Option plaintextOverride; - plaintextOverride = Objects.nonNull(nativeValue.plaintextOverride()) ? - Option.create_Some(ToDafny.PlaintextOverride(nativeValue.plaintextOverride())) - : Option.create_None(); - return new DynamoDbTableEncryptionConfig(logicalTableName, partitionKeyName, sortKeyName, search, attributeActionsOnEncrypt, allowedUnsignedAttributes, allowedUnsignedAttributePrefix, algorithmSuiteId, keyring, cmm, legacyOverride, plaintextOverride); - } - - public static DynamoDbTablesEncryptionConfig DynamoDbTablesEncryptionConfig( - software.amazon.cryptography.dbencryptionsdk.dynamodb.model.DynamoDbTablesEncryptionConfig nativeValue) { - DafnyMap, ? extends DynamoDbTableEncryptionConfig> tableEncryptionConfigs; - tableEncryptionConfigs = ToDafny.DynamoDbTableEncryptionConfigList(nativeValue.tableEncryptionConfigs()); - return new DynamoDbTablesEncryptionConfig(tableEncryptionConfigs); - } - - public static EncryptedDataKeyDescriptionOutput EncryptedDataKeyDescriptionOutput( - software.amazon.cryptography.dbencryptionsdk.dynamodb.model.EncryptedDataKeyDescriptionOutput nativeValue) { - DafnySequence keyProviderId; - keyProviderId = software.amazon.smithy.dafny.conversion.ToDafny.Simple.CharacterSequence(nativeValue.keyProviderId()); - Option> keyProviderInfo; - keyProviderInfo = Objects.nonNull(nativeValue.keyProviderInfo()) ? - Option.create_Some(software.amazon.smithy.dafny.conversion.ToDafny.Simple.CharacterSequence(nativeValue.keyProviderInfo())) - : Option.create_None(); - Option> branchKeyId; - branchKeyId = Objects.nonNull(nativeValue.branchKeyId()) ? - Option.create_Some(software.amazon.smithy.dafny.conversion.ToDafny.Simple.CharacterSequence(nativeValue.branchKeyId())) - : Option.create_None(); - Option> branchKeyVersion; - branchKeyVersion = Objects.nonNull(nativeValue.branchKeyVersion()) ? - Option.create_Some(software.amazon.smithy.dafny.conversion.ToDafny.Simple.CharacterSequence(nativeValue.branchKeyVersion())) - : Option.create_None(); - return new EncryptedDataKeyDescriptionOutput(keyProviderId, keyProviderInfo, branchKeyId, branchKeyVersion); - } - - public static EncryptedPart EncryptedPart( - software.amazon.cryptography.dbencryptionsdk.dynamodb.model.EncryptedPart nativeValue) { - DafnySequence name; - name = software.amazon.smithy.dafny.conversion.ToDafny.Simple.CharacterSequence(nativeValue.name()); - DafnySequence prefix; - prefix = software.amazon.smithy.dafny.conversion.ToDafny.Simple.CharacterSequence(nativeValue.prefix()); - return new EncryptedPart(name, prefix); - } - - public static GetBranchKeyIdFromDdbKeyInput GetBranchKeyIdFromDdbKeyInput( - software.amazon.cryptography.dbencryptionsdk.dynamodb.model.GetBranchKeyIdFromDdbKeyInput nativeValue) { - DafnyMap, ? extends AttributeValue> ddbKey; - ddbKey = software.amazon.cryptography.services.dynamodb.internaldafny.ToDafny.Key(nativeValue.ddbKey()); - return new GetBranchKeyIdFromDdbKeyInput(ddbKey); - } - - public static GetBranchKeyIdFromDdbKeyOutput GetBranchKeyIdFromDdbKeyOutput( - software.amazon.cryptography.dbencryptionsdk.dynamodb.model.GetBranchKeyIdFromDdbKeyOutput nativeValue) { - DafnySequence branchKeyId; - branchKeyId = software.amazon.smithy.dafny.conversion.ToDafny.Simple.CharacterSequence(nativeValue.branchKeyId()); - return new GetBranchKeyIdFromDdbKeyOutput(branchKeyId); - } - - public static GetEncryptedDataKeyDescriptionInput GetEncryptedDataKeyDescriptionInput( - software.amazon.cryptography.dbencryptionsdk.dynamodb.model.GetEncryptedDataKeyDescriptionInput nativeValue) { - GetEncryptedDataKeyDescriptionUnion input; - input = ToDafny.GetEncryptedDataKeyDescriptionUnion(nativeValue.input()); - return new GetEncryptedDataKeyDescriptionInput(input); - } - - public static GetEncryptedDataKeyDescriptionOutput GetEncryptedDataKeyDescriptionOutput( - software.amazon.cryptography.dbencryptionsdk.dynamodb.model.GetEncryptedDataKeyDescriptionOutput nativeValue) { - DafnySequence encryptedDataKeyDescriptionOutput; - encryptedDataKeyDescriptionOutput = ToDafny.EncryptedDataKeyDescriptionList(nativeValue.EncryptedDataKeyDescriptionOutput()); - return new GetEncryptedDataKeyDescriptionOutput(encryptedDataKeyDescriptionOutput); - } - - public static GetPrefix GetPrefix( - software.amazon.cryptography.dbencryptionsdk.dynamodb.model.GetPrefix nativeValue) { - Integer length; - length = (nativeValue.length()); - return new GetPrefix(length); - } - - public static GetSegment GetSegment( - software.amazon.cryptography.dbencryptionsdk.dynamodb.model.GetSegment nativeValue) { - DafnySequence split; - split = software.amazon.smithy.dafny.conversion.ToDafny.Simple.CharacterSequence(nativeValue.split()); - Integer index; - index = (nativeValue.index()); - return new GetSegment(split, index); - } - - public static GetSegments GetSegments( - software.amazon.cryptography.dbencryptionsdk.dynamodb.model.GetSegments nativeValue) { - DafnySequence split; - split = software.amazon.smithy.dafny.conversion.ToDafny.Simple.CharacterSequence(nativeValue.split()); - Integer low; - low = (nativeValue.low()); - Integer high; - high = (nativeValue.high()); - return new GetSegments(split, low, high); - } - - public static GetSubstring GetSubstring( - software.amazon.cryptography.dbencryptionsdk.dynamodb.model.GetSubstring nativeValue) { - Integer low; - low = (nativeValue.low()); - Integer high; - high = (nativeValue.high()); - return new GetSubstring(low, high); - } - - public static GetSuffix GetSuffix( - software.amazon.cryptography.dbencryptionsdk.dynamodb.model.GetSuffix nativeValue) { - Integer length; - length = (nativeValue.length()); - return new GetSuffix(length); - } - - public static Insert Insert( - software.amazon.cryptography.dbencryptionsdk.dynamodb.model.Insert nativeValue) { - DafnySequence literal; - literal = software.amazon.smithy.dafny.conversion.ToDafny.Simple.CharacterSequence(nativeValue.literal()); - return new Insert(literal); - } - - public static LegacyOverride LegacyOverride( - software.amazon.cryptography.dbencryptionsdk.dynamodb.model.LegacyOverride nativeValue) { - LegacyPolicy policy; - policy = ToDafny.LegacyPolicy(nativeValue.policy()); - software.amazon.cryptography.dbencryptionsdk.dynamodb.internaldafny.types.ILegacyDynamoDbEncryptor encryptor; - encryptor = ToDafny.LegacyDynamoDbEncryptor(nativeValue.encryptor()); - DafnyMap, ? extends CryptoAction> attributeActionsOnEncrypt; - attributeActionsOnEncrypt = ToDafny.AttributeActions(nativeValue.attributeActionsOnEncrypt()); - Option defaultAttributeFlag; - defaultAttributeFlag = Objects.nonNull(nativeValue.defaultAttributeFlag()) ? - Option.create_Some(software.amazon.cryptography.dbencryptionsdk.structuredencryption.ToDafny.CryptoAction(nativeValue.defaultAttributeFlag())) - : Option.create_None(); - return new LegacyOverride(policy, encryptor, attributeActionsOnEncrypt, defaultAttributeFlag); - } - - public static Lower Lower( - software.amazon.cryptography.dbencryptionsdk.dynamodb.model.Lower nativeValue) { - return new Lower(); - } - - public static MultiKeyStore MultiKeyStore( - software.amazon.cryptography.dbencryptionsdk.dynamodb.model.MultiKeyStore nativeValue) { - DafnySequence keyFieldName; - keyFieldName = software.amazon.smithy.dafny.conversion.ToDafny.Simple.CharacterSequence(nativeValue.keyFieldName()); - Integer cacheTTL; - cacheTTL = (nativeValue.cacheTTL()); - Option cache; - cache = Objects.nonNull(nativeValue.cache()) ? - Option.create_Some(software.amazon.cryptography.materialproviders.ToDafny.CacheType(nativeValue.cache())) - : Option.create_None(); - return new MultiKeyStore(keyFieldName, cacheTTL, cache); - } - - public static PartOnly PartOnly( - software.amazon.cryptography.dbencryptionsdk.dynamodb.model.PartOnly nativeValue) { - return new PartOnly(); - } - - public static SearchConfig SearchConfig( - software.amazon.cryptography.dbencryptionsdk.dynamodb.model.SearchConfig nativeValue) { - DafnySequence versions; - versions = ToDafny.BeaconVersionList(nativeValue.versions()); - Integer writeVersion; - writeVersion = (nativeValue.writeVersion()); - return new SearchConfig(versions, writeVersion); - } - - public static Shared Shared( - software.amazon.cryptography.dbencryptionsdk.dynamodb.model.Shared nativeValue) { - DafnySequence other; - other = software.amazon.smithy.dafny.conversion.ToDafny.Simple.CharacterSequence(nativeValue.other()); - return new Shared(other); - } - - public static SharedSet SharedSet( - software.amazon.cryptography.dbencryptionsdk.dynamodb.model.SharedSet nativeValue) { - DafnySequence other; - other = software.amazon.smithy.dafny.conversion.ToDafny.Simple.CharacterSequence(nativeValue.other()); - return new SharedSet(other); - } - - public static SignedPart SignedPart( - software.amazon.cryptography.dbencryptionsdk.dynamodb.model.SignedPart nativeValue) { - DafnySequence name; - name = software.amazon.smithy.dafny.conversion.ToDafny.Simple.CharacterSequence(nativeValue.name()); - DafnySequence prefix; - prefix = software.amazon.smithy.dafny.conversion.ToDafny.Simple.CharacterSequence(nativeValue.prefix()); - Option> loc; - loc = Objects.nonNull(nativeValue.loc()) ? - Option.create_Some(software.amazon.smithy.dafny.conversion.ToDafny.Simple.CharacterSequence(nativeValue.loc())) - : Option.create_None(); - return new SignedPart(name, prefix, loc); - } - - public static SingleKeyStore SingleKeyStore( - software.amazon.cryptography.dbencryptionsdk.dynamodb.model.SingleKeyStore nativeValue) { - DafnySequence keyId; - keyId = software.amazon.smithy.dafny.conversion.ToDafny.Simple.CharacterSequence(nativeValue.keyId()); - Integer cacheTTL; - cacheTTL = (nativeValue.cacheTTL()); - return new SingleKeyStore(keyId, cacheTTL); - } - - public static StandardBeacon StandardBeacon( - software.amazon.cryptography.dbencryptionsdk.dynamodb.model.StandardBeacon nativeValue) { - DafnySequence name; - name = software.amazon.smithy.dafny.conversion.ToDafny.Simple.CharacterSequence(nativeValue.name()); - Integer length; - length = (nativeValue.length()); - Option> loc; - loc = Objects.nonNull(nativeValue.loc()) ? - Option.create_Some(software.amazon.smithy.dafny.conversion.ToDafny.Simple.CharacterSequence(nativeValue.loc())) - : Option.create_None(); - Option style; - style = Objects.nonNull(nativeValue.style()) ? - Option.create_Some(ToDafny.BeaconStyle(nativeValue.style())) - : Option.create_None(); - return new StandardBeacon(name, length, loc, style); - } - - public static Upper Upper( - software.amazon.cryptography.dbencryptionsdk.dynamodb.model.Upper nativeValue) { - return new Upper(); - } - - public static VirtualField VirtualField( - software.amazon.cryptography.dbencryptionsdk.dynamodb.model.VirtualField nativeValue) { - DafnySequence name; - name = software.amazon.smithy.dafny.conversion.ToDafny.Simple.CharacterSequence(nativeValue.name()); - DafnySequence parts; - parts = ToDafny.VirtualPartList(nativeValue.parts()); - return new VirtualField(name, parts); - } - - public static VirtualPart VirtualPart( - software.amazon.cryptography.dbencryptionsdk.dynamodb.model.VirtualPart nativeValue) { - DafnySequence loc; - loc = software.amazon.smithy.dafny.conversion.ToDafny.Simple.CharacterSequence(nativeValue.loc()); - Option> trans; - trans = (Objects.nonNull(nativeValue.trans()) && nativeValue.trans().size() > 0) ? - Option.create_Some(ToDafny.VirtualTransformList(nativeValue.trans())) - : Option.create_None(); - return new VirtualPart(loc, trans); - } - - public static Error Error(DynamoDbEncryptionException nativeValue) { - DafnySequence message; - message = software.amazon.smithy.dafny.conversion.ToDafny.Simple.CharacterSequence(nativeValue.message()); - return new Error_DynamoDbEncryptionException(message); - } - - public static LegacyPolicy LegacyPolicy( - software.amazon.cryptography.dbencryptionsdk.dynamodb.model.LegacyPolicy nativeValue) { - switch (nativeValue) { - case FORCE_LEGACY_ENCRYPT_ALLOW_LEGACY_DECRYPT: { - return LegacyPolicy.create_FORCE__LEGACY__ENCRYPT__ALLOW__LEGACY__DECRYPT(); - } - case FORBID_LEGACY_ENCRYPT_ALLOW_LEGACY_DECRYPT: { - return LegacyPolicy.create_FORBID__LEGACY__ENCRYPT__ALLOW__LEGACY__DECRYPT(); - } - case FORBID_LEGACY_ENCRYPT_FORBID_LEGACY_DECRYPT: { - return LegacyPolicy.create_FORBID__LEGACY__ENCRYPT__FORBID__LEGACY__DECRYPT(); - } - default: { - throw new RuntimeException("Cannot convert " + nativeValue + " to software.amazon.cryptography.dbencryptionsdk.dynamodb.internaldafny.types.LegacyPolicy."); - } - } - } - - public static PlaintextOverride PlaintextOverride( - software.amazon.cryptography.dbencryptionsdk.dynamodb.model.PlaintextOverride nativeValue) { - switch (nativeValue) { - case FORCE_PLAINTEXT_WRITE_ALLOW_PLAINTEXT_READ: { - return PlaintextOverride.create_FORCE__PLAINTEXT__WRITE__ALLOW__PLAINTEXT__READ(); - } - case FORBID_PLAINTEXT_WRITE_ALLOW_PLAINTEXT_READ: { - return PlaintextOverride.create_FORBID__PLAINTEXT__WRITE__ALLOW__PLAINTEXT__READ(); - } - case FORBID_PLAINTEXT_WRITE_FORBID_PLAINTEXT_READ: { - return PlaintextOverride.create_FORBID__PLAINTEXT__WRITE__FORBID__PLAINTEXT__READ(); - } - default: { - throw new RuntimeException("Cannot convert " + nativeValue + " to software.amazon.cryptography.dbencryptionsdk.dynamodb.internaldafny.types.PlaintextOverride."); - } - } - } - - public static BeaconKeySource BeaconKeySource( - software.amazon.cryptography.dbencryptionsdk.dynamodb.model.BeaconKeySource nativeValue) { - if (Objects.nonNull(nativeValue.single())) { - return BeaconKeySource.create_single(ToDafny.SingleKeyStore(nativeValue.single())); - } - if (Objects.nonNull(nativeValue.multi())) { - return BeaconKeySource.create_multi(ToDafny.MultiKeyStore(nativeValue.multi())); - } - throw new IllegalArgumentException("Cannot convert " + nativeValue + " to software.amazon.cryptography.dbencryptionsdk.dynamodb.internaldafny.types.BeaconKeySource."); - } - - public static BeaconStyle BeaconStyle( - software.amazon.cryptography.dbencryptionsdk.dynamodb.model.BeaconStyle nativeValue) { - if (Objects.nonNull(nativeValue.partOnly())) { - return BeaconStyle.create_partOnly(ToDafny.PartOnly(nativeValue.partOnly())); - } - if (Objects.nonNull(nativeValue.shared())) { - return BeaconStyle.create_shared(ToDafny.Shared(nativeValue.shared())); - } - if (Objects.nonNull(nativeValue.asSet())) { - return BeaconStyle.create_asSet(ToDafny.AsSet(nativeValue.asSet())); - } - if (Objects.nonNull(nativeValue.sharedSet())) { - return BeaconStyle.create_sharedSet(ToDafny.SharedSet(nativeValue.sharedSet())); - } - throw new IllegalArgumentException("Cannot convert " + nativeValue + " to software.amazon.cryptography.dbencryptionsdk.dynamodb.internaldafny.types.BeaconStyle."); - } - - public static GetEncryptedDataKeyDescriptionUnion GetEncryptedDataKeyDescriptionUnion( - software.amazon.cryptography.dbencryptionsdk.dynamodb.model.GetEncryptedDataKeyDescriptionUnion nativeValue) { - if (Objects.nonNull(nativeValue.header())) { - return GetEncryptedDataKeyDescriptionUnion.create_header(software.amazon.smithy.dafny.conversion.ToDafny.Simple.ByteSequence(nativeValue.header())); - } - if (Objects.nonNull(nativeValue.plaintextItem())) { - return GetEncryptedDataKeyDescriptionUnion.create_plaintextItem(software.amazon.cryptography.services.dynamodb.internaldafny.ToDafny.AttributeMap(nativeValue.plaintextItem())); - } - throw new IllegalArgumentException("Cannot convert " + nativeValue + " to software.amazon.cryptography.dbencryptionsdk.dynamodb.internaldafny.types.GetEncryptedDataKeyDescriptionUnion."); - } - - public static VirtualTransform VirtualTransform( - software.amazon.cryptography.dbencryptionsdk.dynamodb.model.VirtualTransform nativeValue) { - if (Objects.nonNull(nativeValue.upper())) { - return VirtualTransform.create_upper(ToDafny.Upper(nativeValue.upper())); - } - if (Objects.nonNull(nativeValue.lower())) { - return VirtualTransform.create_lower(ToDafny.Lower(nativeValue.lower())); - } - if (Objects.nonNull(nativeValue.insert())) { - return VirtualTransform.create_insert(ToDafny.Insert(nativeValue.insert())); - } - if (Objects.nonNull(nativeValue.prefix())) { - return VirtualTransform.create_prefix(ToDafny.GetPrefix(nativeValue.prefix())); - } - if (Objects.nonNull(nativeValue.suffix())) { - return VirtualTransform.create_suffix(ToDafny.GetSuffix(nativeValue.suffix())); - } - if (Objects.nonNull(nativeValue.substring())) { - return VirtualTransform.create_substring(ToDafny.GetSubstring(nativeValue.substring())); - } - if (Objects.nonNull(nativeValue.segment())) { - return VirtualTransform.create_segment(ToDafny.GetSegment(nativeValue.segment())); - } - if (Objects.nonNull(nativeValue.segments())) { - return VirtualTransform.create_segments(ToDafny.GetSegments(nativeValue.segments())); - } - throw new IllegalArgumentException("Cannot convert " + nativeValue + " to software.amazon.cryptography.dbencryptionsdk.dynamodb.internaldafny.types.VirtualTransform."); - } - - public static DafnySequence BeaconVersionList( - List nativeValue) { - return software.amazon.smithy.dafny.conversion.ToDafny.Aggregate.GenericToSequence( - nativeValue, - software.amazon.cryptography.dbencryptionsdk.dynamodb.ToDafny::BeaconVersion, - BeaconVersion._typeDescriptor()); - } - - public static DafnySequence CompoundBeaconList( - List nativeValue) { - return software.amazon.smithy.dafny.conversion.ToDafny.Aggregate.GenericToSequence( - nativeValue, - software.amazon.cryptography.dbencryptionsdk.dynamodb.ToDafny::CompoundBeacon, - CompoundBeacon._typeDescriptor()); - } - - public static DafnySequence ConstructorList( - List nativeValue) { - return software.amazon.smithy.dafny.conversion.ToDafny.Aggregate.GenericToSequence( - nativeValue, - software.amazon.cryptography.dbencryptionsdk.dynamodb.ToDafny::Constructor, - Constructor._typeDescriptor()); - } - - public static DafnySequence ConstructorPartList( - List nativeValue) { - return software.amazon.smithy.dafny.conversion.ToDafny.Aggregate.GenericToSequence( - nativeValue, - software.amazon.cryptography.dbencryptionsdk.dynamodb.ToDafny::ConstructorPart, - ConstructorPart._typeDescriptor()); - } - - public static DafnySequence EncryptedDataKeyDescriptionList( - List nativeValue) { - return software.amazon.smithy.dafny.conversion.ToDafny.Aggregate.GenericToSequence( - nativeValue, - software.amazon.cryptography.dbencryptionsdk.dynamodb.ToDafny::EncryptedDataKeyDescriptionOutput, - EncryptedDataKeyDescriptionOutput._typeDescriptor()); - } - - public static DafnySequence EncryptedPartsList( - List nativeValue) { - return software.amazon.smithy.dafny.conversion.ToDafny.Aggregate.GenericToSequence( - nativeValue, - software.amazon.cryptography.dbencryptionsdk.dynamodb.ToDafny::EncryptedPart, - EncryptedPart._typeDescriptor()); - } - - public static DafnySequence SignedPartsList( - List nativeValue) { - return software.amazon.smithy.dafny.conversion.ToDafny.Aggregate.GenericToSequence( - nativeValue, - software.amazon.cryptography.dbencryptionsdk.dynamodb.ToDafny::SignedPart, - SignedPart._typeDescriptor()); - } - - public static DafnySequence StandardBeaconList( - List nativeValue) { - return software.amazon.smithy.dafny.conversion.ToDafny.Aggregate.GenericToSequence( - nativeValue, - software.amazon.cryptography.dbencryptionsdk.dynamodb.ToDafny::StandardBeacon, - StandardBeacon._typeDescriptor()); - } - - public static DafnySequence VirtualFieldList( - List nativeValue) { - return software.amazon.smithy.dafny.conversion.ToDafny.Aggregate.GenericToSequence( - nativeValue, - software.amazon.cryptography.dbencryptionsdk.dynamodb.ToDafny::VirtualField, - VirtualField._typeDescriptor()); - } - - public static DafnySequence VirtualPartList( - List nativeValue) { - return software.amazon.smithy.dafny.conversion.ToDafny.Aggregate.GenericToSequence( - nativeValue, - software.amazon.cryptography.dbencryptionsdk.dynamodb.ToDafny::VirtualPart, - VirtualPart._typeDescriptor()); - } - - public static DafnySequence VirtualTransformList( - List nativeValue) { - return software.amazon.smithy.dafny.conversion.ToDafny.Aggregate.GenericToSequence( - nativeValue, - software.amazon.cryptography.dbencryptionsdk.dynamodb.ToDafny::VirtualTransform, - VirtualTransform._typeDescriptor()); - } - - public static DafnyMap, ? extends CryptoAction> AttributeActions( - Map nativeValue) { - return software.amazon.smithy.dafny.conversion.ToDafny.Aggregate.GenericToMap( - nativeValue, - software.amazon.smithy.dafny.conversion.ToDafny.Simple::CharacterSequence, - software.amazon.cryptography.dbencryptionsdk.structuredencryption.ToDafny::CryptoAction); - } - - public static DafnyMap, ? extends DynamoDbTableEncryptionConfig> DynamoDbTableEncryptionConfigList( - Map nativeValue) { - return software.amazon.smithy.dafny.conversion.ToDafny.Aggregate.GenericToMap( - nativeValue, - software.amazon.smithy.dafny.conversion.ToDafny.Simple::CharacterSequence, - software.amazon.cryptography.dbencryptionsdk.dynamodb.ToDafny::DynamoDbTableEncryptionConfig); - } - - public static software.amazon.cryptography.dbencryptionsdk.dynamodb.internaldafny.types.IDynamoDbKeyBranchKeyIdSupplier DynamoDbKeyBranchKeyIdSupplier( - IDynamoDbKeyBranchKeyIdSupplier nativeValue) { - return DynamoDbKeyBranchKeyIdSupplier.wrap(nativeValue).impl(); - } - - public static software.amazon.cryptography.dbencryptionsdk.dynamodb.internaldafny.types.ILegacyDynamoDbEncryptor LegacyDynamoDbEncryptor( - ILegacyDynamoDbEncryptor nativeValue) { - return LegacyDynamoDbEncryptor.wrap(nativeValue).impl(); - } - - public static IDynamoDbEncryptionClient DynamoDbEncryption(DynamoDbEncryption nativeValue) { - return nativeValue.impl(); - } -} diff --git a/TestVectors/runtimes/java/src/main/smithy-generated/software/amazon/cryptography/dbencryptionsdk/dynamodb/ToNative.java b/TestVectors/runtimes/java/src/main/smithy-generated/software/amazon/cryptography/dbencryptionsdk/dynamodb/ToNative.java deleted file mode 100644 index bd6dff77d..000000000 --- a/TestVectors/runtimes/java/src/main/smithy-generated/software/amazon/cryptography/dbencryptionsdk/dynamodb/ToNative.java +++ /dev/null @@ -1,662 +0,0 @@ -// Copyright Amazon.com Inc. or its affiliates. All Rights Reserved. -// SPDX-License-Identifier: Apache-2.0 -// Do not modify this file. This file is machine generated, and any changes to it will be overwritten. -package software.amazon.cryptography.dbencryptionsdk.dynamodb; - -import dafny.DafnyMap; -import dafny.DafnySequence; -import java.lang.Character; -import java.lang.IllegalArgumentException; -import java.lang.RuntimeException; -import java.lang.String; -import java.util.List; -import java.util.Map; -import software.amazon.cryptography.dbencryptionsdk.dynamodb.internaldafny.types.Error; -import software.amazon.cryptography.dbencryptionsdk.dynamodb.internaldafny.types.Error_CollectionOfErrors; -import software.amazon.cryptography.dbencryptionsdk.dynamodb.internaldafny.types.Error_DynamoDbEncryptionException; -import software.amazon.cryptography.dbencryptionsdk.dynamodb.internaldafny.types.Error_Opaque; -import software.amazon.cryptography.dbencryptionsdk.dynamodb.internaldafny.types.IDynamoDbEncryptionClient; -import software.amazon.cryptography.dbencryptionsdk.dynamodb.model.AsSet; -import software.amazon.cryptography.dbencryptionsdk.dynamodb.model.BeaconKeySource; -import software.amazon.cryptography.dbencryptionsdk.dynamodb.model.BeaconStyle; -import software.amazon.cryptography.dbencryptionsdk.dynamodb.model.BeaconVersion; -import software.amazon.cryptography.dbencryptionsdk.dynamodb.model.CollectionOfErrors; -import software.amazon.cryptography.dbencryptionsdk.dynamodb.model.CompoundBeacon; -import software.amazon.cryptography.dbencryptionsdk.dynamodb.model.Constructor; -import software.amazon.cryptography.dbencryptionsdk.dynamodb.model.ConstructorPart; -import software.amazon.cryptography.dbencryptionsdk.dynamodb.model.CreateDynamoDbEncryptionBranchKeyIdSupplierInput; -import software.amazon.cryptography.dbencryptionsdk.dynamodb.model.CreateDynamoDbEncryptionBranchKeyIdSupplierOutput; -import software.amazon.cryptography.dbencryptionsdk.dynamodb.model.DynamoDbEncryptionConfig; -import software.amazon.cryptography.dbencryptionsdk.dynamodb.model.DynamoDbEncryptionException; -import software.amazon.cryptography.dbencryptionsdk.dynamodb.model.DynamoDbTableEncryptionConfig; -import software.amazon.cryptography.dbencryptionsdk.dynamodb.model.DynamoDbTablesEncryptionConfig; -import software.amazon.cryptography.dbencryptionsdk.dynamodb.model.EncryptedDataKeyDescriptionOutput; -import software.amazon.cryptography.dbencryptionsdk.dynamodb.model.EncryptedPart; -import software.amazon.cryptography.dbencryptionsdk.dynamodb.model.GetBranchKeyIdFromDdbKeyInput; -import software.amazon.cryptography.dbencryptionsdk.dynamodb.model.GetBranchKeyIdFromDdbKeyOutput; -import software.amazon.cryptography.dbencryptionsdk.dynamodb.model.GetEncryptedDataKeyDescriptionInput; -import software.amazon.cryptography.dbencryptionsdk.dynamodb.model.GetEncryptedDataKeyDescriptionOutput; -import software.amazon.cryptography.dbencryptionsdk.dynamodb.model.GetEncryptedDataKeyDescriptionUnion; -import software.amazon.cryptography.dbencryptionsdk.dynamodb.model.GetPrefix; -import software.amazon.cryptography.dbencryptionsdk.dynamodb.model.GetSegment; -import software.amazon.cryptography.dbencryptionsdk.dynamodb.model.GetSegments; -import software.amazon.cryptography.dbencryptionsdk.dynamodb.model.GetSubstring; -import software.amazon.cryptography.dbencryptionsdk.dynamodb.model.GetSuffix; -import software.amazon.cryptography.dbencryptionsdk.dynamodb.model.Insert; -import software.amazon.cryptography.dbencryptionsdk.dynamodb.model.LegacyOverride; -import software.amazon.cryptography.dbencryptionsdk.dynamodb.model.LegacyPolicy; -import software.amazon.cryptography.dbencryptionsdk.dynamodb.model.Lower; -import software.amazon.cryptography.dbencryptionsdk.dynamodb.model.MultiKeyStore; -import software.amazon.cryptography.dbencryptionsdk.dynamodb.model.OpaqueError; -import software.amazon.cryptography.dbencryptionsdk.dynamodb.model.PartOnly; -import software.amazon.cryptography.dbencryptionsdk.dynamodb.model.PlaintextOverride; -import software.amazon.cryptography.dbencryptionsdk.dynamodb.model.SearchConfig; -import software.amazon.cryptography.dbencryptionsdk.dynamodb.model.Shared; -import software.amazon.cryptography.dbencryptionsdk.dynamodb.model.SharedSet; -import software.amazon.cryptography.dbencryptionsdk.dynamodb.model.SignedPart; -import software.amazon.cryptography.dbencryptionsdk.dynamodb.model.SingleKeyStore; -import software.amazon.cryptography.dbencryptionsdk.dynamodb.model.StandardBeacon; -import software.amazon.cryptography.dbencryptionsdk.dynamodb.model.Upper; -import software.amazon.cryptography.dbencryptionsdk.dynamodb.model.VirtualField; -import software.amazon.cryptography.dbencryptionsdk.dynamodb.model.VirtualPart; -import software.amazon.cryptography.dbencryptionsdk.dynamodb.model.VirtualTransform; -import software.amazon.cryptography.dbencryptionsdk.structuredencryption.model.CryptoAction; - -public class ToNative { - public static OpaqueError Error(Error_Opaque dafnyValue) { - OpaqueError.Builder nativeBuilder = OpaqueError.builder(); - nativeBuilder.obj(dafnyValue.dtor_obj()); - return nativeBuilder.build(); - } - - public static CollectionOfErrors Error(Error_CollectionOfErrors dafnyValue) { - CollectionOfErrors.Builder nativeBuilder = CollectionOfErrors.builder(); - nativeBuilder.list( - software.amazon.smithy.dafny.conversion.ToNative.Aggregate.GenericToList( - dafnyValue.dtor_list(), - ToNative::Error)); - nativeBuilder.message(software.amazon.smithy.dafny.conversion.ToNative.Simple.String(dafnyValue.dtor_message())); - return nativeBuilder.build(); - } - - public static DynamoDbEncryptionException Error(Error_DynamoDbEncryptionException dafnyValue) { - DynamoDbEncryptionException.Builder nativeBuilder = DynamoDbEncryptionException.builder(); - nativeBuilder.message(software.amazon.smithy.dafny.conversion.ToNative.Simple.String(dafnyValue.dtor_message())); - return nativeBuilder.build(); - } - - public static RuntimeException Error(Error dafnyValue) { - if (dafnyValue.is_DynamoDbEncryptionException()) { - return ToNative.Error((Error_DynamoDbEncryptionException) dafnyValue); - } - if (dafnyValue.is_Opaque()) { - return ToNative.Error((Error_Opaque) dafnyValue); - } - if (dafnyValue.is_CollectionOfErrors()) { - return ToNative.Error((Error_CollectionOfErrors) dafnyValue); - } - if (dafnyValue.is_AwsCryptographyPrimitives()) { - return software.amazon.cryptography.primitives.ToNative.Error(dafnyValue.dtor_AwsCryptographyPrimitives()); - } - if (dafnyValue.is_ComAmazonawsDynamodb()) { - return software.amazon.cryptography.services.dynamodb.internaldafny.ToNative.Error(dafnyValue.dtor_ComAmazonawsDynamodb()); - } - if (dafnyValue.is_AwsCryptographyMaterialProviders()) { - return software.amazon.cryptography.materialproviders.ToNative.Error(dafnyValue.dtor_AwsCryptographyMaterialProviders()); - } - if (dafnyValue.is_AwsCryptographyDbEncryptionSdkStructuredEncryption()) { - return software.amazon.cryptography.dbencryptionsdk.structuredencryption.ToNative.Error(dafnyValue.dtor_AwsCryptographyDbEncryptionSdkStructuredEncryption()); - } - OpaqueError.Builder nativeBuilder = OpaqueError.builder(); - nativeBuilder.obj(dafnyValue); - return nativeBuilder.build(); - } - - public static AsSet AsSet( - software.amazon.cryptography.dbencryptionsdk.dynamodb.internaldafny.types.AsSet dafnyValue) { - AsSet.Builder nativeBuilder = AsSet.builder(); - return nativeBuilder.build(); - } - - public static BeaconVersion BeaconVersion( - software.amazon.cryptography.dbencryptionsdk.dynamodb.internaldafny.types.BeaconVersion dafnyValue) { - BeaconVersion.Builder nativeBuilder = BeaconVersion.builder(); - nativeBuilder.version((dafnyValue.dtor_version())); - nativeBuilder.keyStore(software.amazon.cryptography.keystore.ToNative.KeyStore(dafnyValue.dtor_keyStore())); - nativeBuilder.keySource(ToNative.BeaconKeySource(dafnyValue.dtor_keySource())); - nativeBuilder.standardBeacons(ToNative.StandardBeaconList(dafnyValue.dtor_standardBeacons())); - if (dafnyValue.dtor_compoundBeacons().is_Some()) { - nativeBuilder.compoundBeacons(ToNative.CompoundBeaconList(dafnyValue.dtor_compoundBeacons().dtor_value())); - } - if (dafnyValue.dtor_virtualFields().is_Some()) { - nativeBuilder.virtualFields(ToNative.VirtualFieldList(dafnyValue.dtor_virtualFields().dtor_value())); - } - if (dafnyValue.dtor_encryptedParts().is_Some()) { - nativeBuilder.encryptedParts(ToNative.EncryptedPartsList(dafnyValue.dtor_encryptedParts().dtor_value())); - } - if (dafnyValue.dtor_signedParts().is_Some()) { - nativeBuilder.signedParts(ToNative.SignedPartsList(dafnyValue.dtor_signedParts().dtor_value())); - } - return nativeBuilder.build(); - } - - public static CompoundBeacon CompoundBeacon( - software.amazon.cryptography.dbencryptionsdk.dynamodb.internaldafny.types.CompoundBeacon dafnyValue) { - CompoundBeacon.Builder nativeBuilder = CompoundBeacon.builder(); - nativeBuilder.name(software.amazon.smithy.dafny.conversion.ToNative.Simple.String(dafnyValue.dtor_name())); - nativeBuilder.split(software.amazon.smithy.dafny.conversion.ToNative.Simple.String(dafnyValue.dtor_split())); - if (dafnyValue.dtor_encrypted().is_Some()) { - nativeBuilder.encrypted(ToNative.EncryptedPartsList(dafnyValue.dtor_encrypted().dtor_value())); - } - if (dafnyValue.dtor_signed().is_Some()) { - nativeBuilder.signed(ToNative.SignedPartsList(dafnyValue.dtor_signed().dtor_value())); - } - if (dafnyValue.dtor_constructors().is_Some()) { - nativeBuilder.constructors(ToNative.ConstructorList(dafnyValue.dtor_constructors().dtor_value())); - } - return nativeBuilder.build(); - } - - public static Constructor Constructor( - software.amazon.cryptography.dbencryptionsdk.dynamodb.internaldafny.types.Constructor dafnyValue) { - Constructor.Builder nativeBuilder = Constructor.builder(); - nativeBuilder.parts(ToNative.ConstructorPartList(dafnyValue.dtor_parts())); - return nativeBuilder.build(); - } - - public static ConstructorPart ConstructorPart( - software.amazon.cryptography.dbencryptionsdk.dynamodb.internaldafny.types.ConstructorPart dafnyValue) { - ConstructorPart.Builder nativeBuilder = ConstructorPart.builder(); - nativeBuilder.name(software.amazon.smithy.dafny.conversion.ToNative.Simple.String(dafnyValue.dtor_name())); - nativeBuilder.required((dafnyValue.dtor_required())); - return nativeBuilder.build(); - } - - public static CreateDynamoDbEncryptionBranchKeyIdSupplierInput CreateDynamoDbEncryptionBranchKeyIdSupplierInput( - software.amazon.cryptography.dbencryptionsdk.dynamodb.internaldafny.types.CreateDynamoDbEncryptionBranchKeyIdSupplierInput dafnyValue) { - CreateDynamoDbEncryptionBranchKeyIdSupplierInput.Builder nativeBuilder = CreateDynamoDbEncryptionBranchKeyIdSupplierInput.builder(); - nativeBuilder.ddbKeyBranchKeyIdSupplier(ToNative.DynamoDbKeyBranchKeyIdSupplier(dafnyValue.dtor_ddbKeyBranchKeyIdSupplier())); - return nativeBuilder.build(); - } - - public static CreateDynamoDbEncryptionBranchKeyIdSupplierOutput CreateDynamoDbEncryptionBranchKeyIdSupplierOutput( - software.amazon.cryptography.dbencryptionsdk.dynamodb.internaldafny.types.CreateDynamoDbEncryptionBranchKeyIdSupplierOutput dafnyValue) { - CreateDynamoDbEncryptionBranchKeyIdSupplierOutput.Builder nativeBuilder = CreateDynamoDbEncryptionBranchKeyIdSupplierOutput.builder(); - nativeBuilder.branchKeyIdSupplier(software.amazon.cryptography.materialproviders.ToNative.BranchKeyIdSupplier(dafnyValue.dtor_branchKeyIdSupplier())); - return nativeBuilder.build(); - } - - public static DynamoDbEncryptionConfig DynamoDbEncryptionConfig( - software.amazon.cryptography.dbencryptionsdk.dynamodb.internaldafny.types.DynamoDbEncryptionConfig dafnyValue) { - DynamoDbEncryptionConfig.Builder nativeBuilder = DynamoDbEncryptionConfig.builder(); - return nativeBuilder.build(); - } - - public static DynamoDbTableEncryptionConfig DynamoDbTableEncryptionConfig( - software.amazon.cryptography.dbencryptionsdk.dynamodb.internaldafny.types.DynamoDbTableEncryptionConfig dafnyValue) { - DynamoDbTableEncryptionConfig.Builder nativeBuilder = DynamoDbTableEncryptionConfig.builder(); - nativeBuilder.logicalTableName(software.amazon.smithy.dafny.conversion.ToNative.Simple.String(dafnyValue.dtor_logicalTableName())); - nativeBuilder.partitionKeyName(software.amazon.smithy.dafny.conversion.ToNative.Simple.String(dafnyValue.dtor_partitionKeyName())); - if (dafnyValue.dtor_sortKeyName().is_Some()) { - nativeBuilder.sortKeyName(software.amazon.smithy.dafny.conversion.ToNative.Simple.String(dafnyValue.dtor_sortKeyName().dtor_value())); - } - if (dafnyValue.dtor_search().is_Some()) { - nativeBuilder.search(ToNative.SearchConfig(dafnyValue.dtor_search().dtor_value())); - } - nativeBuilder.attributeActionsOnEncrypt(ToNative.AttributeActions(dafnyValue.dtor_attributeActionsOnEncrypt())); - if (dafnyValue.dtor_allowedUnsignedAttributes().is_Some()) { - nativeBuilder.allowedUnsignedAttributes(software.amazon.cryptography.services.dynamodb.internaldafny.ToNative.AttributeNameList(dafnyValue.dtor_allowedUnsignedAttributes().dtor_value())); - } - if (dafnyValue.dtor_allowedUnsignedAttributePrefix().is_Some()) { - nativeBuilder.allowedUnsignedAttributePrefix(software.amazon.smithy.dafny.conversion.ToNative.Simple.String(dafnyValue.dtor_allowedUnsignedAttributePrefix().dtor_value())); - } - if (dafnyValue.dtor_algorithmSuiteId().is_Some()) { - nativeBuilder.algorithmSuiteId(software.amazon.cryptography.materialproviders.ToNative.DBEAlgorithmSuiteId(dafnyValue.dtor_algorithmSuiteId().dtor_value())); - } - if (dafnyValue.dtor_keyring().is_Some()) { - nativeBuilder.keyring(software.amazon.cryptography.materialproviders.ToNative.Keyring(dafnyValue.dtor_keyring().dtor_value())); - } - if (dafnyValue.dtor_cmm().is_Some()) { - nativeBuilder.cmm(software.amazon.cryptography.materialproviders.ToNative.CryptographicMaterialsManager(dafnyValue.dtor_cmm().dtor_value())); - } - if (dafnyValue.dtor_legacyOverride().is_Some()) { - nativeBuilder.legacyOverride(ToNative.LegacyOverride(dafnyValue.dtor_legacyOverride().dtor_value())); - } - if (dafnyValue.dtor_plaintextOverride().is_Some()) { - nativeBuilder.plaintextOverride(ToNative.PlaintextOverride(dafnyValue.dtor_plaintextOverride().dtor_value())); - } - return nativeBuilder.build(); - } - - public static DynamoDbTablesEncryptionConfig DynamoDbTablesEncryptionConfig( - software.amazon.cryptography.dbencryptionsdk.dynamodb.internaldafny.types.DynamoDbTablesEncryptionConfig dafnyValue) { - DynamoDbTablesEncryptionConfig.Builder nativeBuilder = DynamoDbTablesEncryptionConfig.builder(); - nativeBuilder.tableEncryptionConfigs(ToNative.DynamoDbTableEncryptionConfigList(dafnyValue.dtor_tableEncryptionConfigs())); - return nativeBuilder.build(); - } - - public static EncryptedDataKeyDescriptionOutput EncryptedDataKeyDescriptionOutput( - software.amazon.cryptography.dbencryptionsdk.dynamodb.internaldafny.types.EncryptedDataKeyDescriptionOutput dafnyValue) { - EncryptedDataKeyDescriptionOutput.Builder nativeBuilder = EncryptedDataKeyDescriptionOutput.builder(); - nativeBuilder.keyProviderId(software.amazon.smithy.dafny.conversion.ToNative.Simple.String(dafnyValue.dtor_keyProviderId())); - if (dafnyValue.dtor_keyProviderInfo().is_Some()) { - nativeBuilder.keyProviderInfo(software.amazon.smithy.dafny.conversion.ToNative.Simple.String(dafnyValue.dtor_keyProviderInfo().dtor_value())); - } - if (dafnyValue.dtor_branchKeyId().is_Some()) { - nativeBuilder.branchKeyId(software.amazon.smithy.dafny.conversion.ToNative.Simple.String(dafnyValue.dtor_branchKeyId().dtor_value())); - } - if (dafnyValue.dtor_branchKeyVersion().is_Some()) { - nativeBuilder.branchKeyVersion(software.amazon.smithy.dafny.conversion.ToNative.Simple.String(dafnyValue.dtor_branchKeyVersion().dtor_value())); - } - return nativeBuilder.build(); - } - - public static EncryptedPart EncryptedPart( - software.amazon.cryptography.dbencryptionsdk.dynamodb.internaldafny.types.EncryptedPart dafnyValue) { - EncryptedPart.Builder nativeBuilder = EncryptedPart.builder(); - nativeBuilder.name(software.amazon.smithy.dafny.conversion.ToNative.Simple.String(dafnyValue.dtor_name())); - nativeBuilder.prefix(software.amazon.smithy.dafny.conversion.ToNative.Simple.String(dafnyValue.dtor_prefix())); - return nativeBuilder.build(); - } - - public static GetBranchKeyIdFromDdbKeyInput GetBranchKeyIdFromDdbKeyInput( - software.amazon.cryptography.dbencryptionsdk.dynamodb.internaldafny.types.GetBranchKeyIdFromDdbKeyInput dafnyValue) { - GetBranchKeyIdFromDdbKeyInput.Builder nativeBuilder = GetBranchKeyIdFromDdbKeyInput.builder(); - nativeBuilder.ddbKey(software.amazon.cryptography.services.dynamodb.internaldafny.ToNative.Key(dafnyValue.dtor_ddbKey())); - return nativeBuilder.build(); - } - - public static GetBranchKeyIdFromDdbKeyOutput GetBranchKeyIdFromDdbKeyOutput( - software.amazon.cryptography.dbencryptionsdk.dynamodb.internaldafny.types.GetBranchKeyIdFromDdbKeyOutput dafnyValue) { - GetBranchKeyIdFromDdbKeyOutput.Builder nativeBuilder = GetBranchKeyIdFromDdbKeyOutput.builder(); - nativeBuilder.branchKeyId(software.amazon.smithy.dafny.conversion.ToNative.Simple.String(dafnyValue.dtor_branchKeyId())); - return nativeBuilder.build(); - } - - public static GetEncryptedDataKeyDescriptionInput GetEncryptedDataKeyDescriptionInput( - software.amazon.cryptography.dbencryptionsdk.dynamodb.internaldafny.types.GetEncryptedDataKeyDescriptionInput dafnyValue) { - GetEncryptedDataKeyDescriptionInput.Builder nativeBuilder = GetEncryptedDataKeyDescriptionInput.builder(); - nativeBuilder.input(ToNative.GetEncryptedDataKeyDescriptionUnion(dafnyValue.dtor_input())); - return nativeBuilder.build(); - } - - public static GetEncryptedDataKeyDescriptionOutput GetEncryptedDataKeyDescriptionOutput( - software.amazon.cryptography.dbencryptionsdk.dynamodb.internaldafny.types.GetEncryptedDataKeyDescriptionOutput dafnyValue) { - GetEncryptedDataKeyDescriptionOutput.Builder nativeBuilder = GetEncryptedDataKeyDescriptionOutput.builder(); - nativeBuilder.EncryptedDataKeyDescriptionOutput(ToNative.EncryptedDataKeyDescriptionList(dafnyValue.dtor_EncryptedDataKeyDescriptionOutput())); - return nativeBuilder.build(); - } - - public static GetPrefix GetPrefix( - software.amazon.cryptography.dbencryptionsdk.dynamodb.internaldafny.types.GetPrefix dafnyValue) { - GetPrefix.Builder nativeBuilder = GetPrefix.builder(); - nativeBuilder.length((dafnyValue.dtor_length())); - return nativeBuilder.build(); - } - - public static GetSegment GetSegment( - software.amazon.cryptography.dbencryptionsdk.dynamodb.internaldafny.types.GetSegment dafnyValue) { - GetSegment.Builder nativeBuilder = GetSegment.builder(); - nativeBuilder.split(software.amazon.smithy.dafny.conversion.ToNative.Simple.String(dafnyValue.dtor_split())); - nativeBuilder.index((dafnyValue.dtor_index())); - return nativeBuilder.build(); - } - - public static GetSegments GetSegments( - software.amazon.cryptography.dbencryptionsdk.dynamodb.internaldafny.types.GetSegments dafnyValue) { - GetSegments.Builder nativeBuilder = GetSegments.builder(); - nativeBuilder.split(software.amazon.smithy.dafny.conversion.ToNative.Simple.String(dafnyValue.dtor_split())); - nativeBuilder.low((dafnyValue.dtor_low())); - nativeBuilder.high((dafnyValue.dtor_high())); - return nativeBuilder.build(); - } - - public static GetSubstring GetSubstring( - software.amazon.cryptography.dbencryptionsdk.dynamodb.internaldafny.types.GetSubstring dafnyValue) { - GetSubstring.Builder nativeBuilder = GetSubstring.builder(); - nativeBuilder.low((dafnyValue.dtor_low())); - nativeBuilder.high((dafnyValue.dtor_high())); - return nativeBuilder.build(); - } - - public static GetSuffix GetSuffix( - software.amazon.cryptography.dbencryptionsdk.dynamodb.internaldafny.types.GetSuffix dafnyValue) { - GetSuffix.Builder nativeBuilder = GetSuffix.builder(); - nativeBuilder.length((dafnyValue.dtor_length())); - return nativeBuilder.build(); - } - - public static Insert Insert( - software.amazon.cryptography.dbencryptionsdk.dynamodb.internaldafny.types.Insert dafnyValue) { - Insert.Builder nativeBuilder = Insert.builder(); - nativeBuilder.literal(software.amazon.smithy.dafny.conversion.ToNative.Simple.String(dafnyValue.dtor_literal())); - return nativeBuilder.build(); - } - - public static LegacyOverride LegacyOverride( - software.amazon.cryptography.dbencryptionsdk.dynamodb.internaldafny.types.LegacyOverride dafnyValue) { - LegacyOverride.Builder nativeBuilder = LegacyOverride.builder(); - nativeBuilder.policy(ToNative.LegacyPolicy(dafnyValue.dtor_policy())); - nativeBuilder.encryptor(ToNative.LegacyDynamoDbEncryptor(dafnyValue.dtor_encryptor())); - nativeBuilder.attributeActionsOnEncrypt(ToNative.AttributeActions(dafnyValue.dtor_attributeActionsOnEncrypt())); - if (dafnyValue.dtor_defaultAttributeFlag().is_Some()) { - nativeBuilder.defaultAttributeFlag(software.amazon.cryptography.dbencryptionsdk.structuredencryption.ToNative.CryptoAction(dafnyValue.dtor_defaultAttributeFlag().dtor_value())); - } - return nativeBuilder.build(); - } - - public static Lower Lower( - software.amazon.cryptography.dbencryptionsdk.dynamodb.internaldafny.types.Lower dafnyValue) { - Lower.Builder nativeBuilder = Lower.builder(); - return nativeBuilder.build(); - } - - public static MultiKeyStore MultiKeyStore( - software.amazon.cryptography.dbencryptionsdk.dynamodb.internaldafny.types.MultiKeyStore dafnyValue) { - MultiKeyStore.Builder nativeBuilder = MultiKeyStore.builder(); - nativeBuilder.keyFieldName(software.amazon.smithy.dafny.conversion.ToNative.Simple.String(dafnyValue.dtor_keyFieldName())); - nativeBuilder.cacheTTL((dafnyValue.dtor_cacheTTL())); - if (dafnyValue.dtor_cache().is_Some()) { - nativeBuilder.cache(software.amazon.cryptography.materialproviders.ToNative.CacheType(dafnyValue.dtor_cache().dtor_value())); - } - return nativeBuilder.build(); - } - - public static PartOnly PartOnly( - software.amazon.cryptography.dbencryptionsdk.dynamodb.internaldafny.types.PartOnly dafnyValue) { - PartOnly.Builder nativeBuilder = PartOnly.builder(); - return nativeBuilder.build(); - } - - public static SearchConfig SearchConfig( - software.amazon.cryptography.dbencryptionsdk.dynamodb.internaldafny.types.SearchConfig dafnyValue) { - SearchConfig.Builder nativeBuilder = SearchConfig.builder(); - nativeBuilder.versions(ToNative.BeaconVersionList(dafnyValue.dtor_versions())); - nativeBuilder.writeVersion((dafnyValue.dtor_writeVersion())); - return nativeBuilder.build(); - } - - public static Shared Shared( - software.amazon.cryptography.dbencryptionsdk.dynamodb.internaldafny.types.Shared dafnyValue) { - Shared.Builder nativeBuilder = Shared.builder(); - nativeBuilder.other(software.amazon.smithy.dafny.conversion.ToNative.Simple.String(dafnyValue.dtor_other())); - return nativeBuilder.build(); - } - - public static SharedSet SharedSet( - software.amazon.cryptography.dbencryptionsdk.dynamodb.internaldafny.types.SharedSet dafnyValue) { - SharedSet.Builder nativeBuilder = SharedSet.builder(); - nativeBuilder.other(software.amazon.smithy.dafny.conversion.ToNative.Simple.String(dafnyValue.dtor_other())); - return nativeBuilder.build(); - } - - public static SignedPart SignedPart( - software.amazon.cryptography.dbencryptionsdk.dynamodb.internaldafny.types.SignedPart dafnyValue) { - SignedPart.Builder nativeBuilder = SignedPart.builder(); - nativeBuilder.name(software.amazon.smithy.dafny.conversion.ToNative.Simple.String(dafnyValue.dtor_name())); - nativeBuilder.prefix(software.amazon.smithy.dafny.conversion.ToNative.Simple.String(dafnyValue.dtor_prefix())); - if (dafnyValue.dtor_loc().is_Some()) { - nativeBuilder.loc(software.amazon.smithy.dafny.conversion.ToNative.Simple.String(dafnyValue.dtor_loc().dtor_value())); - } - return nativeBuilder.build(); - } - - public static SingleKeyStore SingleKeyStore( - software.amazon.cryptography.dbencryptionsdk.dynamodb.internaldafny.types.SingleKeyStore dafnyValue) { - SingleKeyStore.Builder nativeBuilder = SingleKeyStore.builder(); - nativeBuilder.keyId(software.amazon.smithy.dafny.conversion.ToNative.Simple.String(dafnyValue.dtor_keyId())); - nativeBuilder.cacheTTL((dafnyValue.dtor_cacheTTL())); - return nativeBuilder.build(); - } - - public static StandardBeacon StandardBeacon( - software.amazon.cryptography.dbencryptionsdk.dynamodb.internaldafny.types.StandardBeacon dafnyValue) { - StandardBeacon.Builder nativeBuilder = StandardBeacon.builder(); - nativeBuilder.name(software.amazon.smithy.dafny.conversion.ToNative.Simple.String(dafnyValue.dtor_name())); - nativeBuilder.length((dafnyValue.dtor_length())); - if (dafnyValue.dtor_loc().is_Some()) { - nativeBuilder.loc(software.amazon.smithy.dafny.conversion.ToNative.Simple.String(dafnyValue.dtor_loc().dtor_value())); - } - if (dafnyValue.dtor_style().is_Some()) { - nativeBuilder.style(ToNative.BeaconStyle(dafnyValue.dtor_style().dtor_value())); - } - return nativeBuilder.build(); - } - - public static Upper Upper( - software.amazon.cryptography.dbencryptionsdk.dynamodb.internaldafny.types.Upper dafnyValue) { - Upper.Builder nativeBuilder = Upper.builder(); - return nativeBuilder.build(); - } - - public static VirtualField VirtualField( - software.amazon.cryptography.dbencryptionsdk.dynamodb.internaldafny.types.VirtualField dafnyValue) { - VirtualField.Builder nativeBuilder = VirtualField.builder(); - nativeBuilder.name(software.amazon.smithy.dafny.conversion.ToNative.Simple.String(dafnyValue.dtor_name())); - nativeBuilder.parts(ToNative.VirtualPartList(dafnyValue.dtor_parts())); - return nativeBuilder.build(); - } - - public static VirtualPart VirtualPart( - software.amazon.cryptography.dbencryptionsdk.dynamodb.internaldafny.types.VirtualPart dafnyValue) { - VirtualPart.Builder nativeBuilder = VirtualPart.builder(); - nativeBuilder.loc(software.amazon.smithy.dafny.conversion.ToNative.Simple.String(dafnyValue.dtor_loc())); - if (dafnyValue.dtor_trans().is_Some()) { - nativeBuilder.trans(ToNative.VirtualTransformList(dafnyValue.dtor_trans().dtor_value())); - } - return nativeBuilder.build(); - } - - public static LegacyPolicy LegacyPolicy( - software.amazon.cryptography.dbencryptionsdk.dynamodb.internaldafny.types.LegacyPolicy dafnyValue) { - if (dafnyValue.is_FORCE__LEGACY__ENCRYPT__ALLOW__LEGACY__DECRYPT()) { - return LegacyPolicy.FORCE_LEGACY_ENCRYPT_ALLOW_LEGACY_DECRYPT; - } - if (dafnyValue.is_FORBID__LEGACY__ENCRYPT__ALLOW__LEGACY__DECRYPT()) { - return LegacyPolicy.FORBID_LEGACY_ENCRYPT_ALLOW_LEGACY_DECRYPT; - } - if (dafnyValue.is_FORBID__LEGACY__ENCRYPT__FORBID__LEGACY__DECRYPT()) { - return LegacyPolicy.FORBID_LEGACY_ENCRYPT_FORBID_LEGACY_DECRYPT; - } - throw new IllegalArgumentException("No entry of software.amazon.cryptography.dbencryptionsdk.dynamodb.model.LegacyPolicy matches the input : " + dafnyValue); - } - - public static PlaintextOverride PlaintextOverride( - software.amazon.cryptography.dbencryptionsdk.dynamodb.internaldafny.types.PlaintextOverride dafnyValue) { - if (dafnyValue.is_FORCE__PLAINTEXT__WRITE__ALLOW__PLAINTEXT__READ()) { - return PlaintextOverride.FORCE_PLAINTEXT_WRITE_ALLOW_PLAINTEXT_READ; - } - if (dafnyValue.is_FORBID__PLAINTEXT__WRITE__ALLOW__PLAINTEXT__READ()) { - return PlaintextOverride.FORBID_PLAINTEXT_WRITE_ALLOW_PLAINTEXT_READ; - } - if (dafnyValue.is_FORBID__PLAINTEXT__WRITE__FORBID__PLAINTEXT__READ()) { - return PlaintextOverride.FORBID_PLAINTEXT_WRITE_FORBID_PLAINTEXT_READ; - } - throw new IllegalArgumentException("No entry of software.amazon.cryptography.dbencryptionsdk.dynamodb.model.PlaintextOverride matches the input : " + dafnyValue); - } - - public static BeaconKeySource BeaconKeySource( - software.amazon.cryptography.dbencryptionsdk.dynamodb.internaldafny.types.BeaconKeySource dafnyValue) { - BeaconKeySource.Builder nativeBuilder = BeaconKeySource.builder(); - if (dafnyValue.is_single()) { - nativeBuilder.single(ToNative.SingleKeyStore(dafnyValue.dtor_single())); - } - if (dafnyValue.is_multi()) { - nativeBuilder.multi(ToNative.MultiKeyStore(dafnyValue.dtor_multi())); - } - return nativeBuilder.build(); - } - - public static BeaconStyle BeaconStyle( - software.amazon.cryptography.dbencryptionsdk.dynamodb.internaldafny.types.BeaconStyle dafnyValue) { - BeaconStyle.Builder nativeBuilder = BeaconStyle.builder(); - if (dafnyValue.is_partOnly()) { - nativeBuilder.partOnly(ToNative.PartOnly(dafnyValue.dtor_partOnly())); - } - if (dafnyValue.is_shared()) { - nativeBuilder.shared(ToNative.Shared(dafnyValue.dtor_shared())); - } - if (dafnyValue.is_asSet()) { - nativeBuilder.asSet(ToNative.AsSet(dafnyValue.dtor_asSet())); - } - if (dafnyValue.is_sharedSet()) { - nativeBuilder.sharedSet(ToNative.SharedSet(dafnyValue.dtor_sharedSet())); - } - return nativeBuilder.build(); - } - - public static GetEncryptedDataKeyDescriptionUnion GetEncryptedDataKeyDescriptionUnion( - software.amazon.cryptography.dbencryptionsdk.dynamodb.internaldafny.types.GetEncryptedDataKeyDescriptionUnion dafnyValue) { - GetEncryptedDataKeyDescriptionUnion.Builder nativeBuilder = GetEncryptedDataKeyDescriptionUnion.builder(); - if (dafnyValue.is_header()) { - nativeBuilder.header(software.amazon.smithy.dafny.conversion.ToNative.Simple.ByteBuffer(dafnyValue.dtor_header())); - } - if (dafnyValue.is_plaintextItem()) { - nativeBuilder.plaintextItem(software.amazon.cryptography.services.dynamodb.internaldafny.ToNative.AttributeMap(dafnyValue.dtor_plaintextItem())); - } - return nativeBuilder.build(); - } - - public static VirtualTransform VirtualTransform( - software.amazon.cryptography.dbencryptionsdk.dynamodb.internaldafny.types.VirtualTransform dafnyValue) { - VirtualTransform.Builder nativeBuilder = VirtualTransform.builder(); - if (dafnyValue.is_upper()) { - nativeBuilder.upper(ToNative.Upper(dafnyValue.dtor_upper())); - } - if (dafnyValue.is_lower()) { - nativeBuilder.lower(ToNative.Lower(dafnyValue.dtor_lower())); - } - if (dafnyValue.is_insert()) { - nativeBuilder.insert(ToNative.Insert(dafnyValue.dtor_insert())); - } - if (dafnyValue.is_prefix()) { - nativeBuilder.prefix(ToNative.GetPrefix(dafnyValue.dtor_prefix())); - } - if (dafnyValue.is_suffix()) { - nativeBuilder.suffix(ToNative.GetSuffix(dafnyValue.dtor_suffix())); - } - if (dafnyValue.is_substring()) { - nativeBuilder.substring(ToNative.GetSubstring(dafnyValue.dtor_substring())); - } - if (dafnyValue.is_segment()) { - nativeBuilder.segment(ToNative.GetSegment(dafnyValue.dtor_segment())); - } - if (dafnyValue.is_segments()) { - nativeBuilder.segments(ToNative.GetSegments(dafnyValue.dtor_segments())); - } - return nativeBuilder.build(); - } - - public static List BeaconVersionList( - DafnySequence dafnyValue) { - return software.amazon.smithy.dafny.conversion.ToNative.Aggregate.GenericToList( - dafnyValue, - software.amazon.cryptography.dbencryptionsdk.dynamodb.ToNative::BeaconVersion); - } - - public static List CompoundBeaconList( - DafnySequence dafnyValue) { - return software.amazon.smithy.dafny.conversion.ToNative.Aggregate.GenericToList( - dafnyValue, - software.amazon.cryptography.dbencryptionsdk.dynamodb.ToNative::CompoundBeacon); - } - - public static List ConstructorList( - DafnySequence dafnyValue) { - return software.amazon.smithy.dafny.conversion.ToNative.Aggregate.GenericToList( - dafnyValue, - software.amazon.cryptography.dbencryptionsdk.dynamodb.ToNative::Constructor); - } - - public static List ConstructorPartList( - DafnySequence dafnyValue) { - return software.amazon.smithy.dafny.conversion.ToNative.Aggregate.GenericToList( - dafnyValue, - software.amazon.cryptography.dbencryptionsdk.dynamodb.ToNative::ConstructorPart); - } - - public static List EncryptedDataKeyDescriptionList( - DafnySequence dafnyValue) { - return software.amazon.smithy.dafny.conversion.ToNative.Aggregate.GenericToList( - dafnyValue, - software.amazon.cryptography.dbencryptionsdk.dynamodb.ToNative::EncryptedDataKeyDescriptionOutput); - } - - public static List EncryptedPartsList( - DafnySequence dafnyValue) { - return software.amazon.smithy.dafny.conversion.ToNative.Aggregate.GenericToList( - dafnyValue, - software.amazon.cryptography.dbencryptionsdk.dynamodb.ToNative::EncryptedPart); - } - - public static List SignedPartsList( - DafnySequence dafnyValue) { - return software.amazon.smithy.dafny.conversion.ToNative.Aggregate.GenericToList( - dafnyValue, - software.amazon.cryptography.dbencryptionsdk.dynamodb.ToNative::SignedPart); - } - - public static List StandardBeaconList( - DafnySequence dafnyValue) { - return software.amazon.smithy.dafny.conversion.ToNative.Aggregate.GenericToList( - dafnyValue, - software.amazon.cryptography.dbencryptionsdk.dynamodb.ToNative::StandardBeacon); - } - - public static List VirtualFieldList( - DafnySequence dafnyValue) { - return software.amazon.smithy.dafny.conversion.ToNative.Aggregate.GenericToList( - dafnyValue, - software.amazon.cryptography.dbencryptionsdk.dynamodb.ToNative::VirtualField); - } - - public static List VirtualPartList( - DafnySequence dafnyValue) { - return software.amazon.smithy.dafny.conversion.ToNative.Aggregate.GenericToList( - dafnyValue, - software.amazon.cryptography.dbencryptionsdk.dynamodb.ToNative::VirtualPart); - } - - public static List VirtualTransformList( - DafnySequence dafnyValue) { - return software.amazon.smithy.dafny.conversion.ToNative.Aggregate.GenericToList( - dafnyValue, - software.amazon.cryptography.dbencryptionsdk.dynamodb.ToNative::VirtualTransform); - } - - public static Map AttributeActions( - DafnyMap, ? extends software.amazon.cryptography.dbencryptionsdk.structuredencryption.internaldafny.types.CryptoAction> dafnyValue) { - return software.amazon.smithy.dafny.conversion.ToNative.Aggregate.GenericToMap( - dafnyValue, - software.amazon.smithy.dafny.conversion.ToNative.Simple::String, - software.amazon.cryptography.dbencryptionsdk.structuredencryption.ToNative::CryptoAction); - } - - public static Map DynamoDbTableEncryptionConfigList( - DafnyMap, ? extends software.amazon.cryptography.dbencryptionsdk.dynamodb.internaldafny.types.DynamoDbTableEncryptionConfig> dafnyValue) { - return software.amazon.smithy.dafny.conversion.ToNative.Aggregate.GenericToMap( - dafnyValue, - software.amazon.smithy.dafny.conversion.ToNative.Simple::String, - software.amazon.cryptography.dbencryptionsdk.dynamodb.ToNative::DynamoDbTableEncryptionConfig); - } - - public static IDynamoDbKeyBranchKeyIdSupplier DynamoDbKeyBranchKeyIdSupplier( - software.amazon.cryptography.dbencryptionsdk.dynamodb.internaldafny.types.IDynamoDbKeyBranchKeyIdSupplier dafnyValue) { - if (dafnyValue instanceof DynamoDbKeyBranchKeyIdSupplier.NativeWrapper) { - return ((DynamoDbKeyBranchKeyIdSupplier.NativeWrapper) dafnyValue)._impl; - } - return DynamoDbKeyBranchKeyIdSupplier.wrap(dafnyValue); - } - - public static ILegacyDynamoDbEncryptor LegacyDynamoDbEncryptor( - software.amazon.cryptography.dbencryptionsdk.dynamodb.internaldafny.types.ILegacyDynamoDbEncryptor dafnyValue) { - if (dafnyValue instanceof LegacyDynamoDbEncryptor.NativeWrapper) { - return ((LegacyDynamoDbEncryptor.NativeWrapper) dafnyValue)._impl; - } - return LegacyDynamoDbEncryptor.wrap(dafnyValue); - } - - public static DynamoDbEncryption DynamoDbEncryption(IDynamoDbEncryptionClient dafnyValue) { - return new DynamoDbEncryption(dafnyValue); - } -} diff --git a/TestVectors/runtimes/java/src/main/smithy-generated/software/amazon/cryptography/dbencryptionsdk/dynamodb/model/AsSet.java b/TestVectors/runtimes/java/src/main/smithy-generated/software/amazon/cryptography/dbencryptionsdk/dynamodb/model/AsSet.java deleted file mode 100644 index 0c217c8b6..000000000 --- a/TestVectors/runtimes/java/src/main/smithy-generated/software/amazon/cryptography/dbencryptionsdk/dynamodb/model/AsSet.java +++ /dev/null @@ -1,36 +0,0 @@ -// Copyright Amazon.com Inc. or its affiliates. All Rights Reserved. -// SPDX-License-Identifier: Apache-2.0 -// Do not modify this file. This file is machine generated, and any changes to it will be overwritten. -package software.amazon.cryptography.dbencryptionsdk.dynamodb.model; - -/** - * Attribute must be a Set. Beacon value will also be a Set. - */ -public class AsSet { - protected AsSet(BuilderImpl builder) { - } - - public Builder toBuilder() { - return new BuilderImpl(this); - } - - public static Builder builder() { - return new BuilderImpl(); - } - - public interface Builder { - AsSet build(); - } - - static class BuilderImpl implements Builder { - protected BuilderImpl() { - } - - protected BuilderImpl(AsSet model) { - } - - public AsSet build() { - return new AsSet(this); - } - } -} diff --git a/TestVectors/runtimes/java/src/main/smithy-generated/software/amazon/cryptography/dbencryptionsdk/dynamodb/model/BeaconKeySource.java b/TestVectors/runtimes/java/src/main/smithy-generated/software/amazon/cryptography/dbencryptionsdk/dynamodb/model/BeaconKeySource.java deleted file mode 100644 index 497eb096f..000000000 --- a/TestVectors/runtimes/java/src/main/smithy-generated/software/amazon/cryptography/dbencryptionsdk/dynamodb/model/BeaconKeySource.java +++ /dev/null @@ -1,122 +0,0 @@ -// Copyright Amazon.com Inc. or its affiliates. All Rights Reserved. -// SPDX-License-Identifier: Apache-2.0 -// Do not modify this file. This file is machine generated, and any changes to it will be overwritten. -package software.amazon.cryptography.dbencryptionsdk.dynamodb.model; - -import java.util.Objects; - -public class BeaconKeySource { - /** - * The configuration for using a single Beacon Key. - */ - private final SingleKeyStore single; - - /** - * The configuration for using multiple Beacon Keys. - */ - private final MultiKeyStore multi; - - protected BeaconKeySource(BuilderImpl builder) { - this.single = builder.single(); - this.multi = builder.multi(); - } - - /** - * @return The configuration for using a single Beacon Key. - */ - public SingleKeyStore single() { - return this.single; - } - - /** - * @return The configuration for using multiple Beacon Keys. - */ - public MultiKeyStore multi() { - return this.multi; - } - - public Builder toBuilder() { - return new BuilderImpl(this); - } - - public static Builder builder() { - return new BuilderImpl(); - } - - public interface Builder { - /** - * @param single The configuration for using a single Beacon Key. - */ - Builder single(SingleKeyStore single); - - /** - * @return The configuration for using a single Beacon Key. - */ - SingleKeyStore single(); - - /** - * @param multi The configuration for using multiple Beacon Keys. - */ - Builder multi(MultiKeyStore multi); - - /** - * @return The configuration for using multiple Beacon Keys. - */ - MultiKeyStore multi(); - - BeaconKeySource build(); - } - - static class BuilderImpl implements Builder { - protected SingleKeyStore single; - - protected MultiKeyStore multi; - - protected BuilderImpl() { - } - - protected BuilderImpl(BeaconKeySource model) { - this.single = model.single(); - this.multi = model.multi(); - } - - public Builder single(SingleKeyStore single) { - this.single = single; - return this; - } - - public SingleKeyStore single() { - return this.single; - } - - public Builder multi(MultiKeyStore multi) { - this.multi = multi; - return this; - } - - public MultiKeyStore multi() { - return this.multi; - } - - public BeaconKeySource build() { - if (!onlyOneNonNull()) { - throw new IllegalArgumentException("`BeaconKeySource` is a Union. A Union MUST have one and only one value set."); - } - return new BeaconKeySource(this); - } - - private boolean onlyOneNonNull() { - Object[] allValues = {this.single, this.multi}; - boolean haveOneNonNull = false; - for (Object o : allValues) { - if (Objects.nonNull(o)) { - if (haveOneNonNull) { - return false; - } - haveOneNonNull = true; - } - } - return haveOneNonNull; - } - } -} diff --git a/TestVectors/runtimes/java/src/main/smithy-generated/software/amazon/cryptography/dbencryptionsdk/dynamodb/model/BeaconStyle.java b/TestVectors/runtimes/java/src/main/smithy-generated/software/amazon/cryptography/dbencryptionsdk/dynamodb/model/BeaconStyle.java deleted file mode 100644 index faf05ebea..000000000 --- a/TestVectors/runtimes/java/src/main/smithy-generated/software/amazon/cryptography/dbencryptionsdk/dynamodb/model/BeaconStyle.java +++ /dev/null @@ -1,192 +0,0 @@ -// Copyright Amazon.com Inc. or its affiliates. All Rights Reserved. -// SPDX-License-Identifier: Apache-2.0 -// Do not modify this file. This file is machine generated, and any changes to it will be overwritten. -package software.amazon.cryptography.dbencryptionsdk.dynamodb.model; - -import java.util.Objects; - -public class BeaconStyle { - /** - * Attribute must be used as part of a Compound Beacon, never alone. - */ - private final PartOnly partOnly; - - /** - * This beacon should calculate values like another beacon, so they can be compared. - */ - private final Shared shared; - - /** - * Attribute must be a Set. Beacon value will also be a Set. - */ - private final AsSet asSet; - - /** - * Both Shared and AsSet. - */ - private final SharedSet sharedSet; - - protected BeaconStyle(BuilderImpl builder) { - this.partOnly = builder.partOnly(); - this.shared = builder.shared(); - this.asSet = builder.asSet(); - this.sharedSet = builder.sharedSet(); - } - - /** - * @return Attribute must be used as part of a Compound Beacon, never alone. - */ - public PartOnly partOnly() { - return this.partOnly; - } - - /** - * @return This beacon should calculate values like another beacon, so they can be compared. - */ - public Shared shared() { - return this.shared; - } - - /** - * @return Attribute must be a Set. Beacon value will also be a Set. - */ - public AsSet asSet() { - return this.asSet; - } - - /** - * @return Both Shared and AsSet. - */ - public SharedSet sharedSet() { - return this.sharedSet; - } - - public Builder toBuilder() { - return new BuilderImpl(this); - } - - public static Builder builder() { - return new BuilderImpl(); - } - - public interface Builder { - /** - * @param partOnly Attribute must be used as part of a Compound Beacon, never alone. - */ - Builder partOnly(PartOnly partOnly); - - /** - * @return Attribute must be used as part of a Compound Beacon, never alone. - */ - PartOnly partOnly(); - - /** - * @param shared This beacon should calculate values like another beacon, so they can be compared. - */ - Builder shared(Shared shared); - - /** - * @return This beacon should calculate values like another beacon, so they can be compared. - */ - Shared shared(); - - /** - * @param asSet Attribute must be a Set. Beacon value will also be a Set. - */ - Builder asSet(AsSet asSet); - - /** - * @return Attribute must be a Set. Beacon value will also be a Set. - */ - AsSet asSet(); - - /** - * @param sharedSet Both Shared and AsSet. - */ - Builder sharedSet(SharedSet sharedSet); - - /** - * @return Both Shared and AsSet. - */ - SharedSet sharedSet(); - - BeaconStyle build(); - } - - static class BuilderImpl implements Builder { - protected PartOnly partOnly; - - protected Shared shared; - - protected AsSet asSet; - - protected SharedSet sharedSet; - - protected BuilderImpl() { - } - - protected BuilderImpl(BeaconStyle model) { - this.partOnly = model.partOnly(); - this.shared = model.shared(); - this.asSet = model.asSet(); - this.sharedSet = model.sharedSet(); - } - - public Builder partOnly(PartOnly partOnly) { - this.partOnly = partOnly; - return this; - } - - public PartOnly partOnly() { - return this.partOnly; - } - - public Builder shared(Shared shared) { - this.shared = shared; - return this; - } - - public Shared shared() { - return this.shared; - } - - public Builder asSet(AsSet asSet) { - this.asSet = asSet; - return this; - } - - public AsSet asSet() { - return this.asSet; - } - - public Builder sharedSet(SharedSet sharedSet) { - this.sharedSet = sharedSet; - return this; - } - - public SharedSet sharedSet() { - return this.sharedSet; - } - - public BeaconStyle build() { - if (!onlyOneNonNull()) { - throw new IllegalArgumentException("`BeaconStyle` is a Union. A Union MUST have one and only one value set."); - } - return new BeaconStyle(this); - } - - private boolean onlyOneNonNull() { - Object[] allValues = {this.partOnly, this.shared, this.asSet, this.sharedSet}; - boolean haveOneNonNull = false; - for (Object o : allValues) { - if (Objects.nonNull(o)) { - if (haveOneNonNull) { - return false; - } - haveOneNonNull = true; - } - } - return haveOneNonNull; - } - } -} diff --git a/TestVectors/runtimes/java/src/main/smithy-generated/software/amazon/cryptography/dbencryptionsdk/dynamodb/model/BeaconVersion.java b/TestVectors/runtimes/java/src/main/smithy-generated/software/amazon/cryptography/dbencryptionsdk/dynamodb/model/BeaconVersion.java deleted file mode 100644 index 3bc307d61..000000000 --- a/TestVectors/runtimes/java/src/main/smithy-generated/software/amazon/cryptography/dbencryptionsdk/dynamodb/model/BeaconVersion.java +++ /dev/null @@ -1,354 +0,0 @@ -// Copyright Amazon.com Inc. or its affiliates. All Rights Reserved. -// SPDX-License-Identifier: Apache-2.0 -// Do not modify this file. This file is machine generated, and any changes to it will be overwritten. -package software.amazon.cryptography.dbencryptionsdk.dynamodb.model; - -import java.util.List; -import java.util.Objects; -import software.amazon.cryptography.keystore.KeyStore; - -/** - * The configuration for a particular version of searchable encryption. Currently the only supported version is '1'. - */ -public class BeaconVersion { - /** - * The version of searchable encryption configured. This must be '1'. - */ - private final int version; - - /** - * The Key Store that contains the Beacon Keys to use with searchable encryption. - */ - private final KeyStore keyStore; - - /** - * The configuration for what beacon key(s) to use. - */ - private final BeaconKeySource keySource; - - /** - * The Standard Beacons to be written with items. - */ - private final List standardBeacons; - - /** - * The Compound Beacons to be written with items. - */ - private final List compoundBeacons; - - /** - * The Virtual Fields to be calculated, supporting other searchable enryption configurations. - */ - private final List virtualFields; - - /** - * The list of Encrypted Parts that may be included in any compound beacon. - */ - private final List encryptedParts; - - /** - * The list of Signed Parts that may be included in any compound beacon. - */ - private final List signedParts; - - protected BeaconVersion(BuilderImpl builder) { - this.version = builder.version(); - this.keyStore = builder.keyStore(); - this.keySource = builder.keySource(); - this.standardBeacons = builder.standardBeacons(); - this.compoundBeacons = builder.compoundBeacons(); - this.virtualFields = builder.virtualFields(); - this.encryptedParts = builder.encryptedParts(); - this.signedParts = builder.signedParts(); - } - - /** - * @return The version of searchable encryption configured. This must be '1'. - */ - public int version() { - return this.version; - } - - /** - * @return The Key Store that contains the Beacon Keys to use with searchable encryption. - */ - public KeyStore keyStore() { - return this.keyStore; - } - - /** - * @return The configuration for what beacon key(s) to use. - */ - public BeaconKeySource keySource() { - return this.keySource; - } - - /** - * @return The Standard Beacons to be written with items. - */ - public List standardBeacons() { - return this.standardBeacons; - } - - /** - * @return The Compound Beacons to be written with items. - */ - public List compoundBeacons() { - return this.compoundBeacons; - } - - /** - * @return The Virtual Fields to be calculated, supporting other searchable enryption configurations. - */ - public List virtualFields() { - return this.virtualFields; - } - - /** - * @return The list of Encrypted Parts that may be included in any compound beacon. - */ - public List encryptedParts() { - return this.encryptedParts; - } - - /** - * @return The list of Signed Parts that may be included in any compound beacon. - */ - public List signedParts() { - return this.signedParts; - } - - public Builder toBuilder() { - return new BuilderImpl(this); - } - - public static Builder builder() { - return new BuilderImpl(); - } - - public interface Builder { - /** - * @param version The version of searchable encryption configured. This must be '1'. - */ - Builder version(int version); - - /** - * @return The version of searchable encryption configured. This must be '1'. - */ - int version(); - - /** - * @param keyStore The Key Store that contains the Beacon Keys to use with searchable encryption. - */ - Builder keyStore(KeyStore keyStore); - - /** - * @return The Key Store that contains the Beacon Keys to use with searchable encryption. - */ - KeyStore keyStore(); - - /** - * @param keySource The configuration for what beacon key(s) to use. - */ - Builder keySource(BeaconKeySource keySource); - - /** - * @return The configuration for what beacon key(s) to use. - */ - BeaconKeySource keySource(); - - /** - * @param standardBeacons The Standard Beacons to be written with items. - */ - Builder standardBeacons(List standardBeacons); - - /** - * @return The Standard Beacons to be written with items. - */ - List standardBeacons(); - - /** - * @param compoundBeacons The Compound Beacons to be written with items. - */ - Builder compoundBeacons(List compoundBeacons); - - /** - * @return The Compound Beacons to be written with items. - */ - List compoundBeacons(); - - /** - * @param virtualFields The Virtual Fields to be calculated, supporting other searchable enryption configurations. - */ - Builder virtualFields(List virtualFields); - - /** - * @return The Virtual Fields to be calculated, supporting other searchable enryption configurations. - */ - List virtualFields(); - - /** - * @param encryptedParts The list of Encrypted Parts that may be included in any compound beacon. - */ - Builder encryptedParts(List encryptedParts); - - /** - * @return The list of Encrypted Parts that may be included in any compound beacon. - */ - List encryptedParts(); - - /** - * @param signedParts The list of Signed Parts that may be included in any compound beacon. - */ - Builder signedParts(List signedParts); - - /** - * @return The list of Signed Parts that may be included in any compound beacon. - */ - List signedParts(); - - BeaconVersion build(); - } - - static class BuilderImpl implements Builder { - protected int version; - - private boolean _versionSet = false; - - protected KeyStore keyStore; - - protected BeaconKeySource keySource; - - protected List standardBeacons; - - protected List compoundBeacons; - - protected List virtualFields; - - protected List encryptedParts; - - protected List signedParts; - - protected BuilderImpl() { - } - - protected BuilderImpl(BeaconVersion model) { - this.version = model.version(); - this._versionSet = true; - this.keyStore = model.keyStore(); - this.keySource = model.keySource(); - this.standardBeacons = model.standardBeacons(); - this.compoundBeacons = model.compoundBeacons(); - this.virtualFields = model.virtualFields(); - this.encryptedParts = model.encryptedParts(); - this.signedParts = model.signedParts(); - } - - public Builder version(int version) { - this.version = version; - this._versionSet = true; - return this; - } - - public int version() { - return this.version; - } - - public Builder keyStore(KeyStore keyStore) { - this.keyStore = keyStore; - return this; - } - - public KeyStore keyStore() { - return this.keyStore; - } - - public Builder keySource(BeaconKeySource keySource) { - this.keySource = keySource; - return this; - } - - public BeaconKeySource keySource() { - return this.keySource; - } - - public Builder standardBeacons(List standardBeacons) { - this.standardBeacons = standardBeacons; - return this; - } - - public List standardBeacons() { - return this.standardBeacons; - } - - public Builder compoundBeacons(List compoundBeacons) { - this.compoundBeacons = compoundBeacons; - return this; - } - - public List compoundBeacons() { - return this.compoundBeacons; - } - - public Builder virtualFields(List virtualFields) { - this.virtualFields = virtualFields; - return this; - } - - public List virtualFields() { - return this.virtualFields; - } - - public Builder encryptedParts(List encryptedParts) { - this.encryptedParts = encryptedParts; - return this; - } - - public List encryptedParts() { - return this.encryptedParts; - } - - public Builder signedParts(List signedParts) { - this.signedParts = signedParts; - return this; - } - - public List signedParts() { - return this.signedParts; - } - - public BeaconVersion build() { - if (!this._versionSet) { - throw new IllegalArgumentException("Missing value for required field `version`"); - } - if (this._versionSet && this.version() < 1) { - throw new IllegalArgumentException("`version` must be greater than or equal to 1"); - } - if (Objects.isNull(this.keyStore())) { - throw new IllegalArgumentException("Missing value for required field `keyStore`"); - } - if (Objects.isNull(this.keySource())) { - throw new IllegalArgumentException("Missing value for required field `keySource`"); - } - if (Objects.isNull(this.standardBeacons())) { - throw new IllegalArgumentException("Missing value for required field `standardBeacons`"); - } - if (Objects.nonNull(this.standardBeacons()) && this.standardBeacons().size() < 1) { - throw new IllegalArgumentException("The size of `standardBeacons` must be greater than or equal to 1"); - } - if (Objects.nonNull(this.compoundBeacons()) && this.compoundBeacons().size() < 1) { - throw new IllegalArgumentException("The size of `compoundBeacons` must be greater than or equal to 1"); - } - if (Objects.nonNull(this.virtualFields()) && this.virtualFields().size() < 1) { - throw new IllegalArgumentException("The size of `virtualFields` must be greater than or equal to 1"); - } - if (Objects.nonNull(this.encryptedParts()) && this.encryptedParts().size() < 1) { - throw new IllegalArgumentException("The size of `encryptedParts` must be greater than or equal to 1"); - } - if (Objects.nonNull(this.signedParts()) && this.signedParts().size() < 1) { - throw new IllegalArgumentException("The size of `signedParts` must be greater than or equal to 1"); - } - return new BeaconVersion(this); - } - } -} diff --git a/TestVectors/runtimes/java/src/main/smithy-generated/software/amazon/cryptography/dbencryptionsdk/dynamodb/model/CollectionOfErrors.java b/TestVectors/runtimes/java/src/main/smithy-generated/software/amazon/cryptography/dbencryptionsdk/dynamodb/model/CollectionOfErrors.java deleted file mode 100644 index a6739ce8b..000000000 --- a/TestVectors/runtimes/java/src/main/smithy-generated/software/amazon/cryptography/dbencryptionsdk/dynamodb/model/CollectionOfErrors.java +++ /dev/null @@ -1,139 +0,0 @@ -// Copyright Amazon.com Inc. or its affiliates. All Rights Reserved. -// SPDX-License-Identifier: Apache-2.0 -// Do not modify this file. This file is machine generated, and any changes to it will be overwritten. -package software.amazon.cryptography.dbencryptionsdk.dynamodb.model; - -import java.util.List; - -public class CollectionOfErrors extends RuntimeException { - /** - * The list of Exceptions encountered. - */ - private final List list; - - protected CollectionOfErrors(BuilderImpl builder) { - super(messageFromBuilder(builder), builder.cause()); - this.list = builder.list(); - } - - private static String messageFromBuilder(Builder builder) { - if (builder.message() != null) { - return builder.message(); - } - if (builder.cause() != null) { - return builder.cause().getMessage(); - } - return null; - } - - /** - * See {@link Throwable#getMessage()}. - */ - public String message() { - return this.getMessage(); - } - - /** - * See {@link Throwable#getCause()}. - */ - public Throwable cause() { - return this.getCause(); - } - - /** - * @return The list of Exceptions encountered. - */ - public List list() { - return this.list; - } - - public Builder toBuilder() { - return new BuilderImpl(this); - } - - public static Builder builder() { - return new BuilderImpl(); - } - - public interface Builder { - /** - * @param message The detailed message. The detail message is saved for later retrieval by the {@link #getMessage()} method. - */ - Builder message(String message); - - /** - * @return The detailed message. The detail message is saved for later retrieval by the {@link #getMessage()} method. - */ - String message(); - - /** - * @param cause The cause (which is saved for later retrieval by the {@link #getCause()} method). (A {@code null} value is permitted, and indicates that the cause is nonexistent or unknown.) - */ - Builder cause(Throwable cause); - - /** - * @return The cause (which is saved for later retrieval by the {@link #getCause()} method). (A {@code null} value is permitted, and indicates that the cause is nonexistent or unknown.) - */ - Throwable cause(); - - /** - * @param list The list of Exceptions encountered. - */ - Builder list(List list); - - /** - * @return The list of Exceptions encountered. - */ - List list(); - - CollectionOfErrors build(); - } - - static class BuilderImpl implements Builder { - protected String message; - - protected Throwable cause; - - protected List list; - - protected BuilderImpl() { - } - - protected BuilderImpl(CollectionOfErrors model) { - this.cause = model.getCause(); - this.message = model.getMessage(); - this.list = model.list(); - } - - public Builder message(String message) { - this.message = message; - return this; - } - - public String message() { - return this.message; - } - - public Builder cause(Throwable cause) { - this.cause = cause; - return this; - } - - public Throwable cause() { - return this.cause; - } - - public Builder list(List list) { - this.list = list; - return this; - } - - public List list() { - return this.list; - } - - public CollectionOfErrors build() { - return new CollectionOfErrors(this); - } - } -} diff --git a/TestVectors/runtimes/java/src/main/smithy-generated/software/amazon/cryptography/dbencryptionsdk/dynamodb/model/CompoundBeacon.java b/TestVectors/runtimes/java/src/main/smithy-generated/software/amazon/cryptography/dbencryptionsdk/dynamodb/model/CompoundBeacon.java deleted file mode 100644 index 92ab41ff1..000000000 --- a/TestVectors/runtimes/java/src/main/smithy-generated/software/amazon/cryptography/dbencryptionsdk/dynamodb/model/CompoundBeacon.java +++ /dev/null @@ -1,235 +0,0 @@ -// Copyright Amazon.com Inc. or its affiliates. All Rights Reserved. -// SPDX-License-Identifier: Apache-2.0 -// Do not modify this file. This file is machine generated, and any changes to it will be overwritten. -package software.amazon.cryptography.dbencryptionsdk.dynamodb.model; - -import java.util.List; -import java.util.Objects; - -/** - * The configuration for a Compound Beacon. - */ -public class CompoundBeacon { - /** - * The name of the Compound Beacon. - */ - private final String name; - - /** - * The characters used to split parts of a compound beacon. The split character should be a character that does not appear in any Signed Part or Prefix used by the Compound Beacon. - */ - private final String split; - - /** - * The list of Encrypted Parts that may be included in the compound beacon. - */ - private final List encrypted; - - /** - * The list of Signed Parts that may be included in the compound beacon. - */ - private final List signed; - - /** - * The ordered list of constructors that may be used to create the Compound Beacon. Each constructor is checked, in order, to see if it can construct the beacon. The first constructor that can construct the beacon is used. If no constructor can construct the beacon, the Compound Beacon is not written to the item. - */ - private final List constructors; - - protected CompoundBeacon(BuilderImpl builder) { - this.name = builder.name(); - this.split = builder.split(); - this.encrypted = builder.encrypted(); - this.signed = builder.signed(); - this.constructors = builder.constructors(); - } - - /** - * @return The name of the Compound Beacon. - */ - public String name() { - return this.name; - } - - /** - * @return The characters used to split parts of a compound beacon. The split character should be a character that does not appear in any Signed Part or Prefix used by the Compound Beacon. - */ - public String split() { - return this.split; - } - - /** - * @return The list of Encrypted Parts that may be included in the compound beacon. - */ - public List encrypted() { - return this.encrypted; - } - - /** - * @return The list of Signed Parts that may be included in the compound beacon. - */ - public List signed() { - return this.signed; - } - - /** - * @return The ordered list of constructors that may be used to create the Compound Beacon. Each constructor is checked, in order, to see if it can construct the beacon. The first constructor that can construct the beacon is used. If no constructor can construct the beacon, the Compound Beacon is not written to the item. - */ - public List constructors() { - return this.constructors; - } - - public Builder toBuilder() { - return new BuilderImpl(this); - } - - public static Builder builder() { - return new BuilderImpl(); - } - - public interface Builder { - /** - * @param name The name of the Compound Beacon. - */ - Builder name(String name); - - /** - * @return The name of the Compound Beacon. - */ - String name(); - - /** - * @param split The characters used to split parts of a compound beacon. The split character should be a character that does not appear in any Signed Part or Prefix used by the Compound Beacon. - */ - Builder split(String split); - - /** - * @return The characters used to split parts of a compound beacon. The split character should be a character that does not appear in any Signed Part or Prefix used by the Compound Beacon. - */ - String split(); - - /** - * @param encrypted The list of Encrypted Parts that may be included in the compound beacon. - */ - Builder encrypted(List encrypted); - - /** - * @return The list of Encrypted Parts that may be included in the compound beacon. - */ - List encrypted(); - - /** - * @param signed The list of Signed Parts that may be included in the compound beacon. - */ - Builder signed(List signed); - - /** - * @return The list of Signed Parts that may be included in the compound beacon. - */ - List signed(); - - /** - * @param constructors The ordered list of constructors that may be used to create the Compound Beacon. Each constructor is checked, in order, to see if it can construct the beacon. The first constructor that can construct the beacon is used. If no constructor can construct the beacon, the Compound Beacon is not written to the item. - */ - Builder constructors(List constructors); - - /** - * @return The ordered list of constructors that may be used to create the Compound Beacon. Each constructor is checked, in order, to see if it can construct the beacon. The first constructor that can construct the beacon is used. If no constructor can construct the beacon, the Compound Beacon is not written to the item. - */ - List constructors(); - - CompoundBeacon build(); - } - - static class BuilderImpl implements Builder { - protected String name; - - protected String split; - - protected List encrypted; - - protected List signed; - - protected List constructors; - - protected BuilderImpl() { - } - - protected BuilderImpl(CompoundBeacon model) { - this.name = model.name(); - this.split = model.split(); - this.encrypted = model.encrypted(); - this.signed = model.signed(); - this.constructors = model.constructors(); - } - - public Builder name(String name) { - this.name = name; - return this; - } - - public String name() { - return this.name; - } - - public Builder split(String split) { - this.split = split; - return this; - } - - public String split() { - return this.split; - } - - public Builder encrypted(List encrypted) { - this.encrypted = encrypted; - return this; - } - - public List encrypted() { - return this.encrypted; - } - - public Builder signed(List signed) { - this.signed = signed; - return this; - } - - public List signed() { - return this.signed; - } - - public Builder constructors(List constructors) { - this.constructors = constructors; - return this; - } - - public List constructors() { - return this.constructors; - } - - public CompoundBeacon build() { - if (Objects.isNull(this.name())) { - throw new IllegalArgumentException("Missing value for required field `name`"); - } - if (Objects.isNull(this.split())) { - throw new IllegalArgumentException("Missing value for required field `split`"); - } - if (Objects.nonNull(this.split()) && this.split().length() < 1) { - throw new IllegalArgumentException("The size of `split` must be greater than or equal to 1"); - } - if (Objects.nonNull(this.split()) && this.split().length() > 1) { - throw new IllegalArgumentException("The size of `split` must be less than or equal to 1"); - } - if (Objects.nonNull(this.encrypted()) && this.encrypted().size() < 1) { - throw new IllegalArgumentException("The size of `encrypted` must be greater than or equal to 1"); - } - if (Objects.nonNull(this.signed()) && this.signed().size() < 1) { - throw new IllegalArgumentException("The size of `signed` must be greater than or equal to 1"); - } - if (Objects.nonNull(this.constructors()) && this.constructors().size() < 1) { - throw new IllegalArgumentException("The size of `constructors` must be greater than or equal to 1"); - } - return new CompoundBeacon(this); - } - } -} diff --git a/TestVectors/runtimes/java/src/main/smithy-generated/software/amazon/cryptography/dbencryptionsdk/dynamodb/model/Constructor.java b/TestVectors/runtimes/java/src/main/smithy-generated/software/amazon/cryptography/dbencryptionsdk/dynamodb/model/Constructor.java deleted file mode 100644 index 8e7da3ece..000000000 --- a/TestVectors/runtimes/java/src/main/smithy-generated/software/amazon/cryptography/dbencryptionsdk/dynamodb/model/Constructor.java +++ /dev/null @@ -1,80 +0,0 @@ -// Copyright Amazon.com Inc. or its affiliates. All Rights Reserved. -// SPDX-License-Identifier: Apache-2.0 -// Do not modify this file. This file is machine generated, and any changes to it will be overwritten. -package software.amazon.cryptography.dbencryptionsdk.dynamodb.model; - -import java.util.List; -import java.util.Objects; - -/** - * The configuration for a particular Compound Beacon construction. - */ -public class Constructor { - /** - * The ordered list of parts for a particular Compound Beacon construction. If the item contains all required Parts, a Compound beacon will be written using each Part that exists on the item, in the order specified. - */ - private final List parts; - - protected Constructor(BuilderImpl builder) { - this.parts = builder.parts(); - } - - /** - * @return The ordered list of parts for a particular Compound Beacon construction. If the item contains all required Parts, a Compound beacon will be written using each Part that exists on the item, in the order specified. - */ - public List parts() { - return this.parts; - } - - public Builder toBuilder() { - return new BuilderImpl(this); - } - - public static Builder builder() { - return new BuilderImpl(); - } - - public interface Builder { - /** - * @param parts The ordered list of parts for a particular Compound Beacon construction. If the item contains all required Parts, a Compound beacon will be written using each Part that exists on the item, in the order specified. - */ - Builder parts(List parts); - - /** - * @return The ordered list of parts for a particular Compound Beacon construction. If the item contains all required Parts, a Compound beacon will be written using each Part that exists on the item, in the order specified. - */ - List parts(); - - Constructor build(); - } - - static class BuilderImpl implements Builder { - protected List parts; - - protected BuilderImpl() { - } - - protected BuilderImpl(Constructor model) { - this.parts = model.parts(); - } - - public Builder parts(List parts) { - this.parts = parts; - return this; - } - - public List parts() { - return this.parts; - } - - public Constructor build() { - if (Objects.isNull(this.parts())) { - throw new IllegalArgumentException("Missing value for required field `parts`"); - } - if (Objects.nonNull(this.parts()) && this.parts().size() < 1) { - throw new IllegalArgumentException("The size of `parts` must be greater than or equal to 1"); - } - return new Constructor(this); - } - } -} diff --git a/TestVectors/runtimes/java/src/main/smithy-generated/software/amazon/cryptography/dbencryptionsdk/dynamodb/model/ConstructorPart.java b/TestVectors/runtimes/java/src/main/smithy-generated/software/amazon/cryptography/dbencryptionsdk/dynamodb/model/ConstructorPart.java deleted file mode 100644 index 295eabd26..000000000 --- a/TestVectors/runtimes/java/src/main/smithy-generated/software/amazon/cryptography/dbencryptionsdk/dynamodb/model/ConstructorPart.java +++ /dev/null @@ -1,114 +0,0 @@ -// Copyright Amazon.com Inc. or its affiliates. All Rights Reserved. -// SPDX-License-Identifier: Apache-2.0 -// Do not modify this file. This file is machine generated, and any changes to it will be overwritten. -package software.amazon.cryptography.dbencryptionsdk.dynamodb.model; - -import java.util.Objects; - -/** - * A part of a Compound Becaon Construction. - */ -public class ConstructorPart { - /** - * The name of the Encrypted Part or Signed Part for which this constructor part gets a value. - */ - private final String name; - - /** - * Whether this Encrypted Part or Signed Part is required for this construction to succeed. - */ - private final Boolean required; - - protected ConstructorPart(BuilderImpl builder) { - this.name = builder.name(); - this.required = builder.required(); - } - - /** - * @return The name of the Encrypted Part or Signed Part for which this constructor part gets a value. - */ - public String name() { - return this.name; - } - - /** - * @return Whether this Encrypted Part or Signed Part is required for this construction to succeed. - */ - public Boolean required() { - return this.required; - } - - public Builder toBuilder() { - return new BuilderImpl(this); - } - - public static Builder builder() { - return new BuilderImpl(); - } - - public interface Builder { - /** - * @param name The name of the Encrypted Part or Signed Part for which this constructor part gets a value. - */ - Builder name(String name); - - /** - * @return The name of the Encrypted Part or Signed Part for which this constructor part gets a value. - */ - String name(); - - /** - * @param required Whether this Encrypted Part or Signed Part is required for this construction to succeed. - */ - Builder required(Boolean required); - - /** - * @return Whether this Encrypted Part or Signed Part is required for this construction to succeed. - */ - Boolean required(); - - ConstructorPart build(); - } - - static class BuilderImpl implements Builder { - protected String name; - - protected Boolean required; - - protected BuilderImpl() { - } - - protected BuilderImpl(ConstructorPart model) { - this.name = model.name(); - this.required = model.required(); - } - - public Builder name(String name) { - this.name = name; - return this; - } - - public String name() { - return this.name; - } - - public Builder required(Boolean required) { - this.required = required; - return this; - } - - public Boolean required() { - return this.required; - } - - public ConstructorPart build() { - if (Objects.isNull(this.name())) { - throw new IllegalArgumentException("Missing value for required field `name`"); - } - if (Objects.isNull(this.required())) { - throw new IllegalArgumentException("Missing value for required field `required`"); - } - return new ConstructorPart(this); - } - } -} diff --git a/TestVectors/runtimes/java/src/main/smithy-generated/software/amazon/cryptography/dbencryptionsdk/dynamodb/model/CreateDynamoDbEncryptionBranchKeyIdSupplierInput.java b/TestVectors/runtimes/java/src/main/smithy-generated/software/amazon/cryptography/dbencryptionsdk/dynamodb/model/CreateDynamoDbEncryptionBranchKeyIdSupplierInput.java deleted file mode 100644 index 9f12c507f..000000000 --- a/TestVectors/runtimes/java/src/main/smithy-generated/software/amazon/cryptography/dbencryptionsdk/dynamodb/model/CreateDynamoDbEncryptionBranchKeyIdSupplierInput.java +++ /dev/null @@ -1,79 +0,0 @@ -// Copyright Amazon.com Inc. or its affiliates. All Rights Reserved. -// SPDX-License-Identifier: Apache-2.0 -// Do not modify this file. This file is machine generated, and any changes to it will be overwritten. -package software.amazon.cryptography.dbencryptionsdk.dynamodb.model; - -import java.util.Objects; -import software.amazon.cryptography.dbencryptionsdk.dynamodb.DynamoDbKeyBranchKeyIdSupplier; -import software.amazon.cryptography.dbencryptionsdk.dynamodb.IDynamoDbKeyBranchKeyIdSupplier; - -/** - * Inputs for creating a Branch Key Supplier from a DynamoDB Key Branch Key Id Supplier - */ -public class CreateDynamoDbEncryptionBranchKeyIdSupplierInput { - /** - * An implementation of the DynamoDbKeyBranchKeyIdSupplier interface, which determines what Branch Key to use for data key wrapping/unwrapping based on the DynamoDB item being written/read. - */ - private final IDynamoDbKeyBranchKeyIdSupplier ddbKeyBranchKeyIdSupplier; - - protected CreateDynamoDbEncryptionBranchKeyIdSupplierInput(BuilderImpl builder) { - this.ddbKeyBranchKeyIdSupplier = builder.ddbKeyBranchKeyIdSupplier(); - } - - /** - * @return An implementation of the DynamoDbKeyBranchKeyIdSupplier interface, which determines what Branch Key to use for data key wrapping/unwrapping based on the DynamoDB item being written/read. - */ - public IDynamoDbKeyBranchKeyIdSupplier ddbKeyBranchKeyIdSupplier() { - return this.ddbKeyBranchKeyIdSupplier; - } - - public Builder toBuilder() { - return new BuilderImpl(this); - } - - public static Builder builder() { - return new BuilderImpl(); - } - - public interface Builder { - /** - * @param ddbKeyBranchKeyIdSupplier An implementation of the DynamoDbKeyBranchKeyIdSupplier interface, which determines what Branch Key to use for data key wrapping/unwrapping based on the DynamoDB item being written/read. - */ - Builder ddbKeyBranchKeyIdSupplier(IDynamoDbKeyBranchKeyIdSupplier ddbKeyBranchKeyIdSupplier); - - /** - * @return An implementation of the DynamoDbKeyBranchKeyIdSupplier interface, which determines what Branch Key to use for data key wrapping/unwrapping based on the DynamoDB item being written/read. - */ - IDynamoDbKeyBranchKeyIdSupplier ddbKeyBranchKeyIdSupplier(); - - CreateDynamoDbEncryptionBranchKeyIdSupplierInput build(); - } - - static class BuilderImpl implements Builder { - protected IDynamoDbKeyBranchKeyIdSupplier ddbKeyBranchKeyIdSupplier; - - protected BuilderImpl() { - } - - protected BuilderImpl(CreateDynamoDbEncryptionBranchKeyIdSupplierInput model) { - this.ddbKeyBranchKeyIdSupplier = model.ddbKeyBranchKeyIdSupplier(); - } - - public Builder ddbKeyBranchKeyIdSupplier( - IDynamoDbKeyBranchKeyIdSupplier ddbKeyBranchKeyIdSupplier) { - this.ddbKeyBranchKeyIdSupplier = DynamoDbKeyBranchKeyIdSupplier.wrap(ddbKeyBranchKeyIdSupplier); - return this; - } - - public IDynamoDbKeyBranchKeyIdSupplier ddbKeyBranchKeyIdSupplier() { - return this.ddbKeyBranchKeyIdSupplier; - } - - public CreateDynamoDbEncryptionBranchKeyIdSupplierInput build() { - if (Objects.isNull(this.ddbKeyBranchKeyIdSupplier())) { - throw new IllegalArgumentException("Missing value for required field `ddbKeyBranchKeyIdSupplier`"); - } - return new CreateDynamoDbEncryptionBranchKeyIdSupplierInput(this); - } - } -} diff --git a/TestVectors/runtimes/java/src/main/smithy-generated/software/amazon/cryptography/dbencryptionsdk/dynamodb/model/CreateDynamoDbEncryptionBranchKeyIdSupplierOutput.java b/TestVectors/runtimes/java/src/main/smithy-generated/software/amazon/cryptography/dbencryptionsdk/dynamodb/model/CreateDynamoDbEncryptionBranchKeyIdSupplierOutput.java deleted file mode 100644 index 4dc39acff..000000000 --- a/TestVectors/runtimes/java/src/main/smithy-generated/software/amazon/cryptography/dbencryptionsdk/dynamodb/model/CreateDynamoDbEncryptionBranchKeyIdSupplierOutput.java +++ /dev/null @@ -1,78 +0,0 @@ -// Copyright Amazon.com Inc. or its affiliates. All Rights Reserved. -// SPDX-License-Identifier: Apache-2.0 -// Do not modify this file. This file is machine generated, and any changes to it will be overwritten. -package software.amazon.cryptography.dbencryptionsdk.dynamodb.model; - -import java.util.Objects; -import software.amazon.cryptography.materialproviders.BranchKeyIdSupplier; -import software.amazon.cryptography.materialproviders.IBranchKeyIdSupplier; - -/** - * Outputs for creating a Branch Key Supplier from a DynamoDB Key Branch Key Id Supplier - */ -public class CreateDynamoDbEncryptionBranchKeyIdSupplierOutput { - /** - * The Branch Key Supplier for use with the Hierarchical Keyring. - */ - private final IBranchKeyIdSupplier branchKeyIdSupplier; - - protected CreateDynamoDbEncryptionBranchKeyIdSupplierOutput(BuilderImpl builder) { - this.branchKeyIdSupplier = builder.branchKeyIdSupplier(); - } - - /** - * @return The Branch Key Supplier for use with the Hierarchical Keyring. - */ - public IBranchKeyIdSupplier branchKeyIdSupplier() { - return this.branchKeyIdSupplier; - } - - public Builder toBuilder() { - return new BuilderImpl(this); - } - - public static Builder builder() { - return new BuilderImpl(); - } - - public interface Builder { - /** - * @param branchKeyIdSupplier The Branch Key Supplier for use with the Hierarchical Keyring. - */ - Builder branchKeyIdSupplier(IBranchKeyIdSupplier branchKeyIdSupplier); - - /** - * @return The Branch Key Supplier for use with the Hierarchical Keyring. - */ - IBranchKeyIdSupplier branchKeyIdSupplier(); - - CreateDynamoDbEncryptionBranchKeyIdSupplierOutput build(); - } - - static class BuilderImpl implements Builder { - protected IBranchKeyIdSupplier branchKeyIdSupplier; - - protected BuilderImpl() { - } - - protected BuilderImpl(CreateDynamoDbEncryptionBranchKeyIdSupplierOutput model) { - this.branchKeyIdSupplier = model.branchKeyIdSupplier(); - } - - public Builder branchKeyIdSupplier(IBranchKeyIdSupplier branchKeyIdSupplier) { - this.branchKeyIdSupplier = BranchKeyIdSupplier.wrap(branchKeyIdSupplier); - return this; - } - - public IBranchKeyIdSupplier branchKeyIdSupplier() { - return this.branchKeyIdSupplier; - } - - public CreateDynamoDbEncryptionBranchKeyIdSupplierOutput build() { - if (Objects.isNull(this.branchKeyIdSupplier())) { - throw new IllegalArgumentException("Missing value for required field `branchKeyIdSupplier`"); - } - return new CreateDynamoDbEncryptionBranchKeyIdSupplierOutput(this); - } - } -} diff --git a/TestVectors/runtimes/java/src/main/smithy-generated/software/amazon/cryptography/dbencryptionsdk/dynamodb/model/DynamoDbEncryptionConfig.java b/TestVectors/runtimes/java/src/main/smithy-generated/software/amazon/cryptography/dbencryptionsdk/dynamodb/model/DynamoDbEncryptionConfig.java deleted file mode 100644 index 7321e21a6..000000000 --- a/TestVectors/runtimes/java/src/main/smithy-generated/software/amazon/cryptography/dbencryptionsdk/dynamodb/model/DynamoDbEncryptionConfig.java +++ /dev/null @@ -1,33 +0,0 @@ -// Copyright Amazon.com Inc. or its affiliates. All Rights Reserved. -// SPDX-License-Identifier: Apache-2.0 -// Do not modify this file. This file is machine generated, and any changes to it will be overwritten. -package software.amazon.cryptography.dbencryptionsdk.dynamodb.model; - -public class DynamoDbEncryptionConfig { - protected DynamoDbEncryptionConfig(BuilderImpl builder) { - } - - public Builder toBuilder() { - return new BuilderImpl(this); - } - - public static Builder builder() { - return new BuilderImpl(); - } - - public interface Builder { - DynamoDbEncryptionConfig build(); - } - - static class BuilderImpl implements Builder { - protected BuilderImpl() { - } - - protected BuilderImpl(DynamoDbEncryptionConfig model) { - } - - public DynamoDbEncryptionConfig build() { - return new DynamoDbEncryptionConfig(this); - } - } -} diff --git a/TestVectors/runtimes/java/src/main/smithy-generated/software/amazon/cryptography/dbencryptionsdk/dynamodb/model/DynamoDbEncryptionException.java b/TestVectors/runtimes/java/src/main/smithy-generated/software/amazon/cryptography/dbencryptionsdk/dynamodb/model/DynamoDbEncryptionException.java deleted file mode 100644 index 812de493c..000000000 --- a/TestVectors/runtimes/java/src/main/smithy-generated/software/amazon/cryptography/dbencryptionsdk/dynamodb/model/DynamoDbEncryptionException.java +++ /dev/null @@ -1,107 +0,0 @@ -// Copyright Amazon.com Inc. or its affiliates. All Rights Reserved. -// SPDX-License-Identifier: Apache-2.0 -// Do not modify this file. This file is machine generated, and any changes to it will be overwritten. -package software.amazon.cryptography.dbencryptionsdk.dynamodb.model; - -import java.util.Objects; - -public class DynamoDbEncryptionException extends RuntimeException { - protected DynamoDbEncryptionException(BuilderImpl builder) { - super(messageFromBuilder(builder), builder.cause()); - } - - private static String messageFromBuilder(Builder builder) { - if (builder.message() != null) { - return builder.message(); - } - if (builder.cause() != null) { - return builder.cause().getMessage(); - } - return null; - } - - /** - * See {@link Throwable#getMessage()}. - */ - public String message() { - return this.getMessage(); - } - - /** - * See {@link Throwable#getCause()}. - */ - public Throwable cause() { - return this.getCause(); - } - - public Builder toBuilder() { - return new BuilderImpl(this); - } - - public static Builder builder() { - return new BuilderImpl(); - } - - public interface Builder { - /** - * @param message The detailed message. The detail message is saved for later retrieval by the {@link #getMessage()} method. - */ - Builder message(String message); - - /** - * @return The detailed message. The detail message is saved for later retrieval by the {@link #getMessage()} method. - */ - String message(); - - /** - * @param cause The cause (which is saved for later retrieval by the {@link #getCause()} method). (A {@code null} value is permitted, and indicates that the cause is nonexistent or unknown.) - */ - Builder cause(Throwable cause); - - /** - * @return The cause (which is saved for later retrieval by the {@link #getCause()} method). (A {@code null} value is permitted, and indicates that the cause is nonexistent or unknown.) - */ - Throwable cause(); - - DynamoDbEncryptionException build(); - } - - static class BuilderImpl implements Builder { - protected String message; - - protected Throwable cause; - - protected BuilderImpl() { - } - - protected BuilderImpl(DynamoDbEncryptionException model) { - this.message = model.message(); - this.cause = model.cause(); - } - - public Builder message(String message) { - this.message = message; - return this; - } - - public String message() { - return this.message; - } - - public Builder cause(Throwable cause) { - this.cause = cause; - return this; - } - - public Throwable cause() { - return this.cause; - } - - public DynamoDbEncryptionException build() { - if (Objects.isNull(this.message())) { - throw new IllegalArgumentException("Missing value for required field `message`"); - } - return new DynamoDbEncryptionException(this); - } - } -} diff --git a/TestVectors/runtimes/java/src/main/smithy-generated/software/amazon/cryptography/dbencryptionsdk/dynamodb/model/DynamoDbTableEncryptionConfig.java b/TestVectors/runtimes/java/src/main/smithy-generated/software/amazon/cryptography/dbencryptionsdk/dynamodb/model/DynamoDbTableEncryptionConfig.java deleted file mode 100644 index 9baef7fc2..000000000 --- a/TestVectors/runtimes/java/src/main/smithy-generated/software/amazon/cryptography/dbencryptionsdk/dynamodb/model/DynamoDbTableEncryptionConfig.java +++ /dev/null @@ -1,490 +0,0 @@ -// Copyright Amazon.com Inc. or its affiliates. All Rights Reserved. -// SPDX-License-Identifier: Apache-2.0 -// Do not modify this file. This file is machine generated, and any changes to it will be overwritten. -package software.amazon.cryptography.dbencryptionsdk.dynamodb.model; - -import java.util.List; -import java.util.Map; -import java.util.Objects; -import software.amazon.cryptography.dbencryptionsdk.structuredencryption.model.CryptoAction; -import software.amazon.cryptography.materialproviders.CryptographicMaterialsManager; -import software.amazon.cryptography.materialproviders.ICryptographicMaterialsManager; -import software.amazon.cryptography.materialproviders.IKeyring; -import software.amazon.cryptography.materialproviders.Keyring; -import software.amazon.cryptography.materialproviders.model.DBEAlgorithmSuiteId; - -/** - * The configuration for client-side encryption for a particular DynamoDB table. - */ -public class DynamoDbTableEncryptionConfig { - /** - * The logical table name for this table. This is the name that is cryptographically bound with your data. This can be the same as the actual DynamoDB table name. It's purpose is to be distinct from the DynamoDB table name so that the data may still be authenticated if being read from different (but logically similar) tables, such as a backup table. - */ - private final String logicalTableName; - - /** - * The name of the partition key on this table. - */ - private final String partitionKeyName; - - /** - * If this table contains a sort key, the name of the sort key on this table. - */ - private final String sortKeyName; - - /** - * The configuration for searchable encryption. - */ - private final SearchConfig search; - - /** - * A map that describes what attributes should be encrypted and/or signed on encrypt. This map must contain all attributes that might be encountered during encryption. - */ - private final Map attributeActionsOnEncrypt; - - /** - * A list of attribute names such that, if encountered during decryption, those attributes are treated as unsigned. - */ - private final List allowedUnsignedAttributes; - - /** - * A prefix such that, if during decryption any attribute has a name with this prefix, it is treated as unsigned. - */ - private final String allowedUnsignedAttributePrefix; - - /** - * An ID for the algorithm suite to use during encryption and decryption. - */ - private final DBEAlgorithmSuiteId algorithmSuiteId; - - /** - * The Keyring that should be used to wrap and unwrap data keys. If specified a Default Cryptographic Materials Manager with this Keyring is used to obtain materials for encryption and decryption. Either a Keyring or a Cryptographic Materials Manager must be specified. - */ - private final IKeyring keyring; - - /** - * The Cryptographic Materials Manager that is used to obtain materials for encryption and decryption. Either a Keyring or a Cryptographic Materials Manager must be specified. - */ - private final ICryptographicMaterialsManager cmm; - - /** - * A configuration that override encryption and/or decryption to instead perform legacy encryption and/or decryption. Used as part of migration from version 2.x to version 3.x. - */ - private final LegacyOverride legacyOverride; - - /** - * A configuration that override encryption and/or decryption to instead passthrough and write and/or read plaintext. Used to update plaintext tables to fully use client-side encryption. - */ - private final PlaintextOverride plaintextOverride; - - protected DynamoDbTableEncryptionConfig(BuilderImpl builder) { - this.logicalTableName = builder.logicalTableName(); - this.partitionKeyName = builder.partitionKeyName(); - this.sortKeyName = builder.sortKeyName(); - this.search = builder.search(); - this.attributeActionsOnEncrypt = builder.attributeActionsOnEncrypt(); - this.allowedUnsignedAttributes = builder.allowedUnsignedAttributes(); - this.allowedUnsignedAttributePrefix = builder.allowedUnsignedAttributePrefix(); - this.algorithmSuiteId = builder.algorithmSuiteId(); - this.keyring = builder.keyring(); - this.cmm = builder.cmm(); - this.legacyOverride = builder.legacyOverride(); - this.plaintextOverride = builder.plaintextOverride(); - } - - /** - * @return The logical table name for this table. This is the name that is cryptographically bound with your data. This can be the same as the actual DynamoDB table name. It's purpose is to be distinct from the DynamoDB table name so that the data may still be authenticated if being read from different (but logically similar) tables, such as a backup table. - */ - public String logicalTableName() { - return this.logicalTableName; - } - - /** - * @return The name of the partition key on this table. - */ - public String partitionKeyName() { - return this.partitionKeyName; - } - - /** - * @return If this table contains a sort key, the name of the sort key on this table. - */ - public String sortKeyName() { - return this.sortKeyName; - } - - /** - * @return The configuration for searchable encryption. - */ - public SearchConfig search() { - return this.search; - } - - /** - * @return A map that describes what attributes should be encrypted and/or signed on encrypt. This map must contain all attributes that might be encountered during encryption. - */ - public Map attributeActionsOnEncrypt() { - return this.attributeActionsOnEncrypt; - } - - /** - * @return A list of attribute names such that, if encountered during decryption, those attributes are treated as unsigned. - */ - public List allowedUnsignedAttributes() { - return this.allowedUnsignedAttributes; - } - - /** - * @return A prefix such that, if during decryption any attribute has a name with this prefix, it is treated as unsigned. - */ - public String allowedUnsignedAttributePrefix() { - return this.allowedUnsignedAttributePrefix; - } - - /** - * @return An ID for the algorithm suite to use during encryption and decryption. - */ - public DBEAlgorithmSuiteId algorithmSuiteId() { - return this.algorithmSuiteId; - } - - /** - * @return The Keyring that should be used to wrap and unwrap data keys. If specified a Default Cryptographic Materials Manager with this Keyring is used to obtain materials for encryption and decryption. Either a Keyring or a Cryptographic Materials Manager must be specified. - */ - public IKeyring keyring() { - return this.keyring; - } - - /** - * @return The Cryptographic Materials Manager that is used to obtain materials for encryption and decryption. Either a Keyring or a Cryptographic Materials Manager must be specified. - */ - public ICryptographicMaterialsManager cmm() { - return this.cmm; - } - - /** - * @return A configuration that override encryption and/or decryption to instead perform legacy encryption and/or decryption. Used as part of migration from version 2.x to version 3.x. - */ - public LegacyOverride legacyOverride() { - return this.legacyOverride; - } - - /** - * @return A configuration that override encryption and/or decryption to instead passthrough and write and/or read plaintext. Used to update plaintext tables to fully use client-side encryption. - */ - public PlaintextOverride plaintextOverride() { - return this.plaintextOverride; - } - - public Builder toBuilder() { - return new BuilderImpl(this); - } - - public static Builder builder() { - return new BuilderImpl(); - } - - public interface Builder { - /** - * @param logicalTableName The logical table name for this table. This is the name that is cryptographically bound with your data. This can be the same as the actual DynamoDB table name. It's purpose is to be distinct from the DynamoDB table name so that the data may still be authenticated if being read from different (but logically similar) tables, such as a backup table. - */ - Builder logicalTableName(String logicalTableName); - - /** - * @return The logical table name for this table. This is the name that is cryptographically bound with your data. This can be the same as the actual DynamoDB table name. It's purpose is to be distinct from the DynamoDB table name so that the data may still be authenticated if being read from different (but logically similar) tables, such as a backup table. - */ - String logicalTableName(); - - /** - * @param partitionKeyName The name of the partition key on this table. - */ - Builder partitionKeyName(String partitionKeyName); - - /** - * @return The name of the partition key on this table. - */ - String partitionKeyName(); - - /** - * @param sortKeyName If this table contains a sort key, the name of the sort key on this table. - */ - Builder sortKeyName(String sortKeyName); - - /** - * @return If this table contains a sort key, the name of the sort key on this table. - */ - String sortKeyName(); - - /** - * @param search The configuration for searchable encryption. - */ - Builder search(SearchConfig search); - - /** - * @return The configuration for searchable encryption. - */ - SearchConfig search(); - - /** - * @param attributeActionsOnEncrypt A map that describes what attributes should be encrypted and/or signed on encrypt. This map must contain all attributes that might be encountered during encryption. - */ - Builder attributeActionsOnEncrypt(Map attributeActionsOnEncrypt); - - /** - * @return A map that describes what attributes should be encrypted and/or signed on encrypt. This map must contain all attributes that might be encountered during encryption. - */ - Map attributeActionsOnEncrypt(); - - /** - * @param allowedUnsignedAttributes A list of attribute names such that, if encountered during decryption, those attributes are treated as unsigned. - */ - Builder allowedUnsignedAttributes(List allowedUnsignedAttributes); - - /** - * @return A list of attribute names such that, if encountered during decryption, those attributes are treated as unsigned. - */ - List allowedUnsignedAttributes(); - - /** - * @param allowedUnsignedAttributePrefix A prefix such that, if during decryption any attribute has a name with this prefix, it is treated as unsigned. - */ - Builder allowedUnsignedAttributePrefix(String allowedUnsignedAttributePrefix); - - /** - * @return A prefix such that, if during decryption any attribute has a name with this prefix, it is treated as unsigned. - */ - String allowedUnsignedAttributePrefix(); - - /** - * @param algorithmSuiteId An ID for the algorithm suite to use during encryption and decryption. - */ - Builder algorithmSuiteId(DBEAlgorithmSuiteId algorithmSuiteId); - - /** - * @return An ID for the algorithm suite to use during encryption and decryption. - */ - DBEAlgorithmSuiteId algorithmSuiteId(); - - /** - * @param keyring The Keyring that should be used to wrap and unwrap data keys. If specified a Default Cryptographic Materials Manager with this Keyring is used to obtain materials for encryption and decryption. Either a Keyring or a Cryptographic Materials Manager must be specified. - */ - Builder keyring(IKeyring keyring); - - /** - * @return The Keyring that should be used to wrap and unwrap data keys. If specified a Default Cryptographic Materials Manager with this Keyring is used to obtain materials for encryption and decryption. Either a Keyring or a Cryptographic Materials Manager must be specified. - */ - IKeyring keyring(); - - /** - * @param cmm The Cryptographic Materials Manager that is used to obtain materials for encryption and decryption. Either a Keyring or a Cryptographic Materials Manager must be specified. - */ - Builder cmm(ICryptographicMaterialsManager cmm); - - /** - * @return The Cryptographic Materials Manager that is used to obtain materials for encryption and decryption. Either a Keyring or a Cryptographic Materials Manager must be specified. - */ - ICryptographicMaterialsManager cmm(); - - /** - * @param legacyOverride A configuration that override encryption and/or decryption to instead perform legacy encryption and/or decryption. Used as part of migration from version 2.x to version 3.x. - */ - Builder legacyOverride(LegacyOverride legacyOverride); - - /** - * @return A configuration that override encryption and/or decryption to instead perform legacy encryption and/or decryption. Used as part of migration from version 2.x to version 3.x. - */ - LegacyOverride legacyOverride(); - - /** - * @param plaintextOverride A configuration that override encryption and/or decryption to instead passthrough and write and/or read plaintext. Used to update plaintext tables to fully use client-side encryption. - */ - Builder plaintextOverride(PlaintextOverride plaintextOverride); - - /** - * @return A configuration that override encryption and/or decryption to instead passthrough and write and/or read plaintext. Used to update plaintext tables to fully use client-side encryption. - */ - PlaintextOverride plaintextOverride(); - - DynamoDbTableEncryptionConfig build(); - } - - static class BuilderImpl implements Builder { - protected String logicalTableName; - - protected String partitionKeyName; - - protected String sortKeyName; - - protected SearchConfig search; - - protected Map attributeActionsOnEncrypt; - - protected List allowedUnsignedAttributes; - - protected String allowedUnsignedAttributePrefix; - - protected DBEAlgorithmSuiteId algorithmSuiteId; - - protected IKeyring keyring; - - protected ICryptographicMaterialsManager cmm; - - protected LegacyOverride legacyOverride; - - protected PlaintextOverride plaintextOverride; - - protected BuilderImpl() { - } - - protected BuilderImpl(DynamoDbTableEncryptionConfig model) { - this.logicalTableName = model.logicalTableName(); - this.partitionKeyName = model.partitionKeyName(); - this.sortKeyName = model.sortKeyName(); - this.search = model.search(); - this.attributeActionsOnEncrypt = model.attributeActionsOnEncrypt(); - this.allowedUnsignedAttributes = model.allowedUnsignedAttributes(); - this.allowedUnsignedAttributePrefix = model.allowedUnsignedAttributePrefix(); - this.algorithmSuiteId = model.algorithmSuiteId(); - this.keyring = model.keyring(); - this.cmm = model.cmm(); - this.legacyOverride = model.legacyOverride(); - this.plaintextOverride = model.plaintextOverride(); - } - - public Builder logicalTableName(String logicalTableName) { - this.logicalTableName = logicalTableName; - return this; - } - - public String logicalTableName() { - return this.logicalTableName; - } - - public Builder partitionKeyName(String partitionKeyName) { - this.partitionKeyName = partitionKeyName; - return this; - } - - public String partitionKeyName() { - return this.partitionKeyName; - } - - public Builder sortKeyName(String sortKeyName) { - this.sortKeyName = sortKeyName; - return this; - } - - public String sortKeyName() { - return this.sortKeyName; - } - - public Builder search(SearchConfig search) { - this.search = search; - return this; - } - - public SearchConfig search() { - return this.search; - } - - public Builder attributeActionsOnEncrypt(Map attributeActionsOnEncrypt) { - this.attributeActionsOnEncrypt = attributeActionsOnEncrypt; - return this; - } - - public Map attributeActionsOnEncrypt() { - return this.attributeActionsOnEncrypt; - } - - public Builder allowedUnsignedAttributes(List allowedUnsignedAttributes) { - this.allowedUnsignedAttributes = allowedUnsignedAttributes; - return this; - } - - public List allowedUnsignedAttributes() { - return this.allowedUnsignedAttributes; - } - - public Builder allowedUnsignedAttributePrefix(String allowedUnsignedAttributePrefix) { - this.allowedUnsignedAttributePrefix = allowedUnsignedAttributePrefix; - return this; - } - - public String allowedUnsignedAttributePrefix() { - return this.allowedUnsignedAttributePrefix; - } - - public Builder algorithmSuiteId(DBEAlgorithmSuiteId algorithmSuiteId) { - this.algorithmSuiteId = algorithmSuiteId; - return this; - } - - public DBEAlgorithmSuiteId algorithmSuiteId() { - return this.algorithmSuiteId; - } - - public Builder keyring(IKeyring keyring) { - this.keyring = Keyring.wrap(keyring); - return this; - } - - public IKeyring keyring() { - return this.keyring; - } - - public Builder cmm(ICryptographicMaterialsManager cmm) { - this.cmm = CryptographicMaterialsManager.wrap(cmm); - return this; - } - - public ICryptographicMaterialsManager cmm() { - return this.cmm; - } - - public Builder legacyOverride(LegacyOverride legacyOverride) { - this.legacyOverride = legacyOverride; - return this; - } - - public LegacyOverride legacyOverride() { - return this.legacyOverride; - } - - public Builder plaintextOverride(PlaintextOverride plaintextOverride) { - this.plaintextOverride = plaintextOverride; - return this; - } - - public PlaintextOverride plaintextOverride() { - return this.plaintextOverride; - } - - public DynamoDbTableEncryptionConfig build() { - if (Objects.isNull(this.logicalTableName())) { - throw new IllegalArgumentException("Missing value for required field `logicalTableName`"); - } - if (Objects.isNull(this.partitionKeyName())) { - throw new IllegalArgumentException("Missing value for required field `partitionKeyName`"); - } - if (Objects.nonNull(this.partitionKeyName()) && this.partitionKeyName().length() < 1) { - throw new IllegalArgumentException("The size of `partitionKeyName` must be greater than or equal to 1"); - } - if (Objects.nonNull(this.partitionKeyName()) && this.partitionKeyName().length() > 255) { - throw new IllegalArgumentException("The size of `partitionKeyName` must be less than or equal to 255"); - } - if (Objects.nonNull(this.sortKeyName()) && this.sortKeyName().length() < 1) { - throw new IllegalArgumentException("The size of `sortKeyName` must be greater than or equal to 1"); - } - if (Objects.nonNull(this.sortKeyName()) && this.sortKeyName().length() > 255) { - throw new IllegalArgumentException("The size of `sortKeyName` must be less than or equal to 255"); - } - if (Objects.isNull(this.attributeActionsOnEncrypt())) { - throw new IllegalArgumentException("Missing value for required field `attributeActionsOnEncrypt`"); - } - if (Objects.nonNull(this.allowedUnsignedAttributes()) && this.allowedUnsignedAttributes().size() < 1) { - throw new IllegalArgumentException("The size of `allowedUnsignedAttributes` must be greater than or equal to 1"); - } - return new DynamoDbTableEncryptionConfig(this); - } - } -} diff --git a/TestVectors/runtimes/java/src/main/smithy-generated/software/amazon/cryptography/dbencryptionsdk/dynamodb/model/DynamoDbTablesEncryptionConfig.java b/TestVectors/runtimes/java/src/main/smithy-generated/software/amazon/cryptography/dbencryptionsdk/dynamodb/model/DynamoDbTablesEncryptionConfig.java deleted file mode 100644 index 4a1f1c333..000000000 --- a/TestVectors/runtimes/java/src/main/smithy-generated/software/amazon/cryptography/dbencryptionsdk/dynamodb/model/DynamoDbTablesEncryptionConfig.java +++ /dev/null @@ -1,79 +0,0 @@ -// Copyright Amazon.com Inc. or its affiliates. All Rights Reserved. -// SPDX-License-Identifier: Apache-2.0 -// Do not modify this file. This file is machine generated, and any changes to it will be overwritten. -package software.amazon.cryptography.dbencryptionsdk.dynamodb.model; - -import java.util.Map; -import java.util.Objects; - -/** - * The configuration for client-side encryption with multiple DynamoDB table. - */ -public class DynamoDbTablesEncryptionConfig { - /** - * A map of DynamoDB table name to its configuration for client-side encryption. - */ - private final Map tableEncryptionConfigs; - - protected DynamoDbTablesEncryptionConfig(BuilderImpl builder) { - this.tableEncryptionConfigs = builder.tableEncryptionConfigs(); - } - - /** - * @return A map of DynamoDB table name to its configuration for client-side encryption. - */ - public Map tableEncryptionConfigs() { - return this.tableEncryptionConfigs; - } - - public Builder toBuilder() { - return new BuilderImpl(this); - } - - public static Builder builder() { - return new BuilderImpl(); - } - - public interface Builder { - /** - * @param tableEncryptionConfigs A map of DynamoDB table name to its configuration for client-side encryption. - */ - Builder tableEncryptionConfigs( - Map tableEncryptionConfigs); - - /** - * @return A map of DynamoDB table name to its configuration for client-side encryption. - */ - Map tableEncryptionConfigs(); - - DynamoDbTablesEncryptionConfig build(); - } - - static class BuilderImpl implements Builder { - protected Map tableEncryptionConfigs; - - protected BuilderImpl() { - } - - protected BuilderImpl(DynamoDbTablesEncryptionConfig model) { - this.tableEncryptionConfigs = model.tableEncryptionConfigs(); - } - - public Builder tableEncryptionConfigs( - Map tableEncryptionConfigs) { - this.tableEncryptionConfigs = tableEncryptionConfigs; - return this; - } - - public Map tableEncryptionConfigs() { - return this.tableEncryptionConfigs; - } - - public DynamoDbTablesEncryptionConfig build() { - if (Objects.isNull(this.tableEncryptionConfigs())) { - throw new IllegalArgumentException("Missing value for required field `tableEncryptionConfigs`"); - } - return new DynamoDbTablesEncryptionConfig(this); - } - } -} diff --git a/TestVectors/runtimes/java/src/main/smithy-generated/software/amazon/cryptography/dbencryptionsdk/dynamodb/model/EncryptedDataKeyDescriptionOutput.java b/TestVectors/runtimes/java/src/main/smithy-generated/software/amazon/cryptography/dbencryptionsdk/dynamodb/model/EncryptedDataKeyDescriptionOutput.java deleted file mode 100644 index 974750bcf..000000000 --- a/TestVectors/runtimes/java/src/main/smithy-generated/software/amazon/cryptography/dbencryptionsdk/dynamodb/model/EncryptedDataKeyDescriptionOutput.java +++ /dev/null @@ -1,130 +0,0 @@ -// Copyright Amazon.com Inc. or its affiliates. All Rights Reserved. -// SPDX-License-Identifier: Apache-2.0 -// Do not modify this file. This file is machine generated, and any changes to it will be overwritten. -package software.amazon.cryptography.dbencryptionsdk.dynamodb.model; - -import java.util.Objects; - -public class EncryptedDataKeyDescriptionOutput { - private final String keyProviderId; - - private final String keyProviderInfo; - - private final String branchKeyId; - - private final String branchKeyVersion; - - protected EncryptedDataKeyDescriptionOutput(BuilderImpl builder) { - this.keyProviderId = builder.keyProviderId(); - this.keyProviderInfo = builder.keyProviderInfo(); - this.branchKeyId = builder.branchKeyId(); - this.branchKeyVersion = builder.branchKeyVersion(); - } - - public String keyProviderId() { - return this.keyProviderId; - } - - public String keyProviderInfo() { - return this.keyProviderInfo; - } - - public String branchKeyId() { - return this.branchKeyId; - } - - public String branchKeyVersion() { - return this.branchKeyVersion; - } - - public Builder toBuilder() { - return new BuilderImpl(this); - } - - public static Builder builder() { - return new BuilderImpl(); - } - - public interface Builder { - Builder keyProviderId(String keyProviderId); - - String keyProviderId(); - - Builder keyProviderInfo(String keyProviderInfo); - - String keyProviderInfo(); - - Builder branchKeyId(String branchKeyId); - - String branchKeyId(); - - Builder branchKeyVersion(String branchKeyVersion); - - String branchKeyVersion(); - - EncryptedDataKeyDescriptionOutput build(); - } - - static class BuilderImpl implements Builder { - protected String keyProviderId; - - protected String keyProviderInfo; - - protected String branchKeyId; - - protected String branchKeyVersion; - - protected BuilderImpl() { - } - - protected BuilderImpl(EncryptedDataKeyDescriptionOutput model) { - this.keyProviderId = model.keyProviderId(); - this.keyProviderInfo = model.keyProviderInfo(); - this.branchKeyId = model.branchKeyId(); - this.branchKeyVersion = model.branchKeyVersion(); - } - - public Builder keyProviderId(String keyProviderId) { - this.keyProviderId = keyProviderId; - return this; - } - - public String keyProviderId() { - return this.keyProviderId; - } - - public Builder keyProviderInfo(String keyProviderInfo) { - this.keyProviderInfo = keyProviderInfo; - return this; - } - - public String keyProviderInfo() { - return this.keyProviderInfo; - } - - public Builder branchKeyId(String branchKeyId) { - this.branchKeyId = branchKeyId; - return this; - } - - public String branchKeyId() { - return this.branchKeyId; - } - - public Builder branchKeyVersion(String branchKeyVersion) { - this.branchKeyVersion = branchKeyVersion; - return this; - } - - public String branchKeyVersion() { - return this.branchKeyVersion; - } - - public EncryptedDataKeyDescriptionOutput build() { - if (Objects.isNull(this.keyProviderId())) { - throw new IllegalArgumentException("Missing value for required field `keyProviderId`"); - } - return new EncryptedDataKeyDescriptionOutput(this); - } - } -} diff --git a/TestVectors/runtimes/java/src/main/smithy-generated/software/amazon/cryptography/dbencryptionsdk/dynamodb/model/EncryptedPart.java b/TestVectors/runtimes/java/src/main/smithy-generated/software/amazon/cryptography/dbencryptionsdk/dynamodb/model/EncryptedPart.java deleted file mode 100644 index 934cd47fa..000000000 --- a/TestVectors/runtimes/java/src/main/smithy-generated/software/amazon/cryptography/dbencryptionsdk/dynamodb/model/EncryptedPart.java +++ /dev/null @@ -1,117 +0,0 @@ -// Copyright Amazon.com Inc. or its affiliates. All Rights Reserved. -// SPDX-License-Identifier: Apache-2.0 -// Do not modify this file. This file is machine generated, and any changes to it will be overwritten. -package software.amazon.cryptography.dbencryptionsdk.dynamodb.model; - -import java.util.Objects; - -/** - * A part of a Compound Beacon that contains a beacon over encrypted data. - */ -public class EncryptedPart { - /** - * The name of the Standard Beacon, whose value this Part will hold. - */ - private final String name; - - /** - * The prefix that is written with this Encrypted Part. - */ - private final String prefix; - - protected EncryptedPart(BuilderImpl builder) { - this.name = builder.name(); - this.prefix = builder.prefix(); - } - - /** - * @return The name of the Standard Beacon, whose value this Part will hold. - */ - public String name() { - return this.name; - } - - /** - * @return The prefix that is written with this Encrypted Part. - */ - public String prefix() { - return this.prefix; - } - - public Builder toBuilder() { - return new BuilderImpl(this); - } - - public static Builder builder() { - return new BuilderImpl(); - } - - public interface Builder { - /** - * @param name The name of the Standard Beacon, whose value this Part will hold. - */ - Builder name(String name); - - /** - * @return The name of the Standard Beacon, whose value this Part will hold. - */ - String name(); - - /** - * @param prefix The prefix that is written with this Encrypted Part. - */ - Builder prefix(String prefix); - - /** - * @return The prefix that is written with this Encrypted Part. - */ - String prefix(); - - EncryptedPart build(); - } - - static class BuilderImpl implements Builder { - protected String name; - - protected String prefix; - - protected BuilderImpl() { - } - - protected BuilderImpl(EncryptedPart model) { - this.name = model.name(); - this.prefix = model.prefix(); - } - - public Builder name(String name) { - this.name = name; - return this; - } - - public String name() { - return this.name; - } - - public Builder prefix(String prefix) { - this.prefix = prefix; - return this; - } - - public String prefix() { - return this.prefix; - } - - public EncryptedPart build() { - if (Objects.isNull(this.name())) { - throw new IllegalArgumentException("Missing value for required field `name`"); - } - if (Objects.isNull(this.prefix())) { - throw new IllegalArgumentException("Missing value for required field `prefix`"); - } - if (Objects.nonNull(this.prefix()) && this.prefix().length() < 1) { - throw new IllegalArgumentException("The size of `prefix` must be greater than or equal to 1"); - } - return new EncryptedPart(this); - } - } -} diff --git a/TestVectors/runtimes/java/src/main/smithy-generated/software/amazon/cryptography/dbencryptionsdk/dynamodb/model/GetBranchKeyIdFromDdbKeyInput.java b/TestVectors/runtimes/java/src/main/smithy-generated/software/amazon/cryptography/dbencryptionsdk/dynamodb/model/GetBranchKeyIdFromDdbKeyInput.java deleted file mode 100644 index db7c03974..000000000 --- a/TestVectors/runtimes/java/src/main/smithy-generated/software/amazon/cryptography/dbencryptionsdk/dynamodb/model/GetBranchKeyIdFromDdbKeyInput.java +++ /dev/null @@ -1,78 +0,0 @@ -// Copyright Amazon.com Inc. or its affiliates. All Rights Reserved. -// SPDX-License-Identifier: Apache-2.0 -// Do not modify this file. This file is machine generated, and any changes to it will be overwritten. -package software.amazon.cryptography.dbencryptionsdk.dynamodb.model; - -import java.util.Map; -import java.util.Objects; -import software.amazon.awssdk.services.dynamodb.model.AttributeValue; - -/** - * Inputs for getting the Branch Key that should be used for wrapping and unwrapping data keys. - */ -public class GetBranchKeyIdFromDdbKeyInput { - /** - * The partition and sort (if it exists) attributes on the item being read or written. - */ - private final Map ddbKey; - - protected GetBranchKeyIdFromDdbKeyInput(BuilderImpl builder) { - this.ddbKey = builder.ddbKey(); - } - - /** - * @return The partition and sort (if it exists) attributes on the item being read or written. - */ - public Map ddbKey() { - return this.ddbKey; - } - - public Builder toBuilder() { - return new BuilderImpl(this); - } - - public static Builder builder() { - return new BuilderImpl(); - } - - public interface Builder { - /** - * @param ddbKey The partition and sort (if it exists) attributes on the item being read or written. - */ - Builder ddbKey(Map ddbKey); - - /** - * @return The partition and sort (if it exists) attributes on the item being read or written. - */ - Map ddbKey(); - - GetBranchKeyIdFromDdbKeyInput build(); - } - - static class BuilderImpl implements Builder { - protected Map ddbKey; - - protected BuilderImpl() { - } - - protected BuilderImpl(GetBranchKeyIdFromDdbKeyInput model) { - this.ddbKey = model.ddbKey(); - } - - public Builder ddbKey(Map ddbKey) { - this.ddbKey = ddbKey; - return this; - } - - public Map ddbKey() { - return this.ddbKey; - } - - public GetBranchKeyIdFromDdbKeyInput build() { - if (Objects.isNull(this.ddbKey())) { - throw new IllegalArgumentException("Missing value for required field `ddbKey`"); - } - return new GetBranchKeyIdFromDdbKeyInput(this); - } - } -} diff --git a/TestVectors/runtimes/java/src/main/smithy-generated/software/amazon/cryptography/dbencryptionsdk/dynamodb/model/GetBranchKeyIdFromDdbKeyOutput.java b/TestVectors/runtimes/java/src/main/smithy-generated/software/amazon/cryptography/dbencryptionsdk/dynamodb/model/GetBranchKeyIdFromDdbKeyOutput.java deleted file mode 100644 index e4ec8d1f1..000000000 --- a/TestVectors/runtimes/java/src/main/smithy-generated/software/amazon/cryptography/dbencryptionsdk/dynamodb/model/GetBranchKeyIdFromDdbKeyOutput.java +++ /dev/null @@ -1,76 +0,0 @@ -// Copyright Amazon.com Inc. or its affiliates. All Rights Reserved. -// SPDX-License-Identifier: Apache-2.0 -// Do not modify this file. This file is machine generated, and any changes to it will be overwritten. -package software.amazon.cryptography.dbencryptionsdk.dynamodb.model; - -import java.util.Objects; - -/** - * Outputs for getting the Branch Key that should be used for wrapping and unwrapping data keys. - */ -public class GetBranchKeyIdFromDdbKeyOutput { - /** - * The ID of the Branch Key that should be used to wrap and unwrap data keys for this item. - */ - private final String branchKeyId; - - protected GetBranchKeyIdFromDdbKeyOutput(BuilderImpl builder) { - this.branchKeyId = builder.branchKeyId(); - } - - /** - * @return The ID of the Branch Key that should be used to wrap and unwrap data keys for this item. - */ - public String branchKeyId() { - return this.branchKeyId; - } - - public Builder toBuilder() { - return new BuilderImpl(this); - } - - public static Builder builder() { - return new BuilderImpl(); - } - - public interface Builder { - /** - * @param branchKeyId The ID of the Branch Key that should be used to wrap and unwrap data keys for this item. - */ - Builder branchKeyId(String branchKeyId); - - /** - * @return The ID of the Branch Key that should be used to wrap and unwrap data keys for this item. - */ - String branchKeyId(); - - GetBranchKeyIdFromDdbKeyOutput build(); - } - - static class BuilderImpl implements Builder { - protected String branchKeyId; - - protected BuilderImpl() { - } - - protected BuilderImpl(GetBranchKeyIdFromDdbKeyOutput model) { - this.branchKeyId = model.branchKeyId(); - } - - public Builder branchKeyId(String branchKeyId) { - this.branchKeyId = branchKeyId; - return this; - } - - public String branchKeyId() { - return this.branchKeyId; - } - - public GetBranchKeyIdFromDdbKeyOutput build() { - if (Objects.isNull(this.branchKeyId())) { - throw new IllegalArgumentException("Missing value for required field `branchKeyId`"); - } - return new GetBranchKeyIdFromDdbKeyOutput(this); - } - } -} diff --git a/TestVectors/runtimes/java/src/main/smithy-generated/software/amazon/cryptography/dbencryptionsdk/dynamodb/model/GetEncryptedDataKeyDescriptionInput.java b/TestVectors/runtimes/java/src/main/smithy-generated/software/amazon/cryptography/dbencryptionsdk/dynamodb/model/GetEncryptedDataKeyDescriptionInput.java deleted file mode 100644 index ef55a98ae..000000000 --- a/TestVectors/runtimes/java/src/main/smithy-generated/software/amazon/cryptography/dbencryptionsdk/dynamodb/model/GetEncryptedDataKeyDescriptionInput.java +++ /dev/null @@ -1,61 +0,0 @@ -// Copyright Amazon.com Inc. or its affiliates. All Rights Reserved. -// SPDX-License-Identifier: Apache-2.0 -// Do not modify this file. This file is machine generated, and any changes to it will be overwritten. -package software.amazon.cryptography.dbencryptionsdk.dynamodb.model; - -import java.util.Objects; - -public class GetEncryptedDataKeyDescriptionInput { - private final GetEncryptedDataKeyDescriptionUnion input; - - protected GetEncryptedDataKeyDescriptionInput(BuilderImpl builder) { - this.input = builder.input(); - } - - public GetEncryptedDataKeyDescriptionUnion input() { - return this.input; - } - - public Builder toBuilder() { - return new BuilderImpl(this); - } - - public static Builder builder() { - return new BuilderImpl(); - } - - public interface Builder { - Builder input(GetEncryptedDataKeyDescriptionUnion input); - - GetEncryptedDataKeyDescriptionUnion input(); - - GetEncryptedDataKeyDescriptionInput build(); - } - - static class BuilderImpl implements Builder { - protected GetEncryptedDataKeyDescriptionUnion input; - - protected BuilderImpl() { - } - - protected BuilderImpl(GetEncryptedDataKeyDescriptionInput model) { - this.input = model.input(); - } - - public Builder input(GetEncryptedDataKeyDescriptionUnion input) { - this.input = input; - return this; - } - - public GetEncryptedDataKeyDescriptionUnion input() { - return this.input; - } - - public GetEncryptedDataKeyDescriptionInput build() { - if (Objects.isNull(this.input())) { - throw new IllegalArgumentException("Missing value for required field `input`"); - } - return new GetEncryptedDataKeyDescriptionInput(this); - } - } -} diff --git a/TestVectors/runtimes/java/src/main/smithy-generated/software/amazon/cryptography/dbencryptionsdk/dynamodb/model/GetEncryptedDataKeyDescriptionOutput.java b/TestVectors/runtimes/java/src/main/smithy-generated/software/amazon/cryptography/dbencryptionsdk/dynamodb/model/GetEncryptedDataKeyDescriptionOutput.java deleted file mode 100644 index b4ca94f86..000000000 --- a/TestVectors/runtimes/java/src/main/smithy-generated/software/amazon/cryptography/dbencryptionsdk/dynamodb/model/GetEncryptedDataKeyDescriptionOutput.java +++ /dev/null @@ -1,64 +0,0 @@ -// Copyright Amazon.com Inc. or its affiliates. All Rights Reserved. -// SPDX-License-Identifier: Apache-2.0 -// Do not modify this file. This file is machine generated, and any changes to it will be overwritten. -package software.amazon.cryptography.dbencryptionsdk.dynamodb.model; - -import java.util.List; -import java.util.Objects; - -public class GetEncryptedDataKeyDescriptionOutput { - private final List EncryptedDataKeyDescriptionOutput; - - protected GetEncryptedDataKeyDescriptionOutput(BuilderImpl builder) { - this.EncryptedDataKeyDescriptionOutput = builder.EncryptedDataKeyDescriptionOutput(); - } - - public List EncryptedDataKeyDescriptionOutput() { - return this.EncryptedDataKeyDescriptionOutput; - } - - public Builder toBuilder() { - return new BuilderImpl(this); - } - - public static Builder builder() { - return new BuilderImpl(); - } - - public interface Builder { - Builder EncryptedDataKeyDescriptionOutput( - List EncryptedDataKeyDescriptionOutput); - - List EncryptedDataKeyDescriptionOutput(); - - GetEncryptedDataKeyDescriptionOutput build(); - } - - static class BuilderImpl implements Builder { - protected List EncryptedDataKeyDescriptionOutput; - - protected BuilderImpl() { - } - - protected BuilderImpl(GetEncryptedDataKeyDescriptionOutput model) { - this.EncryptedDataKeyDescriptionOutput = model.EncryptedDataKeyDescriptionOutput(); - } - - public Builder EncryptedDataKeyDescriptionOutput( - List EncryptedDataKeyDescriptionOutput) { - this.EncryptedDataKeyDescriptionOutput = EncryptedDataKeyDescriptionOutput; - return this; - } - - public List EncryptedDataKeyDescriptionOutput() { - return this.EncryptedDataKeyDescriptionOutput; - } - - public GetEncryptedDataKeyDescriptionOutput build() { - if (Objects.isNull(this.EncryptedDataKeyDescriptionOutput())) { - throw new IllegalArgumentException("Missing value for required field `EncryptedDataKeyDescriptionOutput`"); - } - return new GetEncryptedDataKeyDescriptionOutput(this); - } - } -} diff --git a/TestVectors/runtimes/java/src/main/smithy-generated/software/amazon/cryptography/dbencryptionsdk/dynamodb/model/GetEncryptedDataKeyDescriptionUnion.java b/TestVectors/runtimes/java/src/main/smithy-generated/software/amazon/cryptography/dbencryptionsdk/dynamodb/model/GetEncryptedDataKeyDescriptionUnion.java deleted file mode 100644 index 580c4de80..000000000 --- a/TestVectors/runtimes/java/src/main/smithy-generated/software/amazon/cryptography/dbencryptionsdk/dynamodb/model/GetEncryptedDataKeyDescriptionUnion.java +++ /dev/null @@ -1,101 +0,0 @@ -// Copyright Amazon.com Inc. or its affiliates. All Rights Reserved. -// SPDX-License-Identifier: Apache-2.0 -// Do not modify this file. This file is machine generated, and any changes to it will be overwritten. -package software.amazon.cryptography.dbencryptionsdk.dynamodb.model; - -import java.nio.ByteBuffer; -import java.util.Map; -import java.util.Objects; -import software.amazon.awssdk.services.dynamodb.model.AttributeValue; - -public class GetEncryptedDataKeyDescriptionUnion { - private final ByteBuffer header; - - private final Map plaintextItem; - - protected GetEncryptedDataKeyDescriptionUnion(BuilderImpl builder) { - this.header = builder.header(); - this.plaintextItem = builder.plaintextItem(); - } - - public ByteBuffer header() { - return this.header; - } - - public Map plaintextItem() { - return this.plaintextItem; - } - - public Builder toBuilder() { - return new BuilderImpl(this); - } - - public static Builder builder() { - return new BuilderImpl(); - } - - public interface Builder { - Builder header(ByteBuffer header); - - ByteBuffer header(); - - Builder plaintextItem(Map plaintextItem); - - Map plaintextItem(); - - GetEncryptedDataKeyDescriptionUnion build(); - } - - static class BuilderImpl implements Builder { - protected ByteBuffer header; - - protected Map plaintextItem; - - protected BuilderImpl() { - } - - protected BuilderImpl(GetEncryptedDataKeyDescriptionUnion model) { - this.header = model.header(); - this.plaintextItem = model.plaintextItem(); - } - - public Builder header(ByteBuffer header) { - this.header = header; - return this; - } - - public ByteBuffer header() { - return this.header; - } - - public Builder plaintextItem(Map plaintextItem) { - this.plaintextItem = plaintextItem; - return this; - } - - public Map plaintextItem() { - return this.plaintextItem; - } - - public GetEncryptedDataKeyDescriptionUnion build() { - if (!onlyOneNonNull()) { - throw new IllegalArgumentException("`GetEncryptedDataKeyDescriptionUnion` is a Union. A Union MUST have one and only one value set."); - } - return new GetEncryptedDataKeyDescriptionUnion(this); - } - - private boolean onlyOneNonNull() { - Object[] allValues = {this.header, this.plaintextItem}; - boolean haveOneNonNull = false; - for (Object o : allValues) { - if (Objects.nonNull(o)) { - if (haveOneNonNull) { - return false; - } - haveOneNonNull = true; - } - } - return haveOneNonNull; - } - } -} diff --git a/TestVectors/runtimes/java/src/main/smithy-generated/software/amazon/cryptography/dbencryptionsdk/dynamodb/model/GetPrefix.java b/TestVectors/runtimes/java/src/main/smithy-generated/software/amazon/cryptography/dbencryptionsdk/dynamodb/model/GetPrefix.java deleted file mode 100644 index 29c7bad04..000000000 --- a/TestVectors/runtimes/java/src/main/smithy-generated/software/amazon/cryptography/dbencryptionsdk/dynamodb/model/GetPrefix.java +++ /dev/null @@ -1,76 +0,0 @@ -// Copyright Amazon.com Inc. or its affiliates. All Rights Reserved. -// SPDX-License-Identifier: Apache-2.0 -// Do not modify this file. This file is machine generated, and any changes to it will be overwritten. -package software.amazon.cryptography.dbencryptionsdk.dynamodb.model; - -import java.util.Objects; - -/** - * The Virtual Part Transformation that gets the prefix of a string. - */ -public class GetPrefix { - /** - * If positive, the number of characters to return from the front. If negative, the absolute number of characters to exclude from the end. e.g. GetPrefix(-1) returns all but the last character. - */ - private final Integer length; - - protected GetPrefix(BuilderImpl builder) { - this.length = builder.length(); - } - - /** - * @return If positive, the number of characters to return from the front. If negative, the absolute number of characters to exclude from the end. e.g. GetPrefix(-1) returns all but the last character. - */ - public Integer length() { - return this.length; - } - - public Builder toBuilder() { - return new BuilderImpl(this); - } - - public static Builder builder() { - return new BuilderImpl(); - } - - public interface Builder { - /** - * @param length If positive, the number of characters to return from the front. If negative, the absolute number of characters to exclude from the end. e.g. GetPrefix(-1) returns all but the last character. - */ - Builder length(Integer length); - - /** - * @return If positive, the number of characters to return from the front. If negative, the absolute number of characters to exclude from the end. e.g. GetPrefix(-1) returns all but the last character. - */ - Integer length(); - - GetPrefix build(); - } - - static class BuilderImpl implements Builder { - protected Integer length; - - protected BuilderImpl() { - } - - protected BuilderImpl(GetPrefix model) { - this.length = model.length(); - } - - public Builder length(Integer length) { - this.length = length; - return this; - } - - public Integer length() { - return this.length; - } - - public GetPrefix build() { - if (Objects.isNull(this.length())) { - throw new IllegalArgumentException("Missing value for required field `length`"); - } - return new GetPrefix(this); - } - } -} diff --git a/TestVectors/runtimes/java/src/main/smithy-generated/software/amazon/cryptography/dbencryptionsdk/dynamodb/model/GetSegment.java b/TestVectors/runtimes/java/src/main/smithy-generated/software/amazon/cryptography/dbencryptionsdk/dynamodb/model/GetSegment.java deleted file mode 100644 index ec5481bbe..000000000 --- a/TestVectors/runtimes/java/src/main/smithy-generated/software/amazon/cryptography/dbencryptionsdk/dynamodb/model/GetSegment.java +++ /dev/null @@ -1,120 +0,0 @@ -// Copyright Amazon.com Inc. or its affiliates. All Rights Reserved. -// SPDX-License-Identifier: Apache-2.0 -// Do not modify this file. This file is machine generated, and any changes to it will be overwritten. -package software.amazon.cryptography.dbencryptionsdk.dynamodb.model; - -import java.util.Objects; - -/** - * The Virtual Part Transformation that splits a string and gets a particular segment of that split. - */ -public class GetSegment { - /** - * The characters to split on. - */ - private final String split; - - /** - * The index of the split string result to return. 0 represents the segment before the first split character. -1 respresents the segment after the last split character. - */ - private final Integer index; - - protected GetSegment(BuilderImpl builder) { - this.split = builder.split(); - this.index = builder.index(); - } - - /** - * @return The characters to split on. - */ - public String split() { - return this.split; - } - - /** - * @return The index of the split string result to return. 0 represents the segment before the first split character. -1 respresents the segment after the last split character. - */ - public Integer index() { - return this.index; - } - - public Builder toBuilder() { - return new BuilderImpl(this); - } - - public static Builder builder() { - return new BuilderImpl(); - } - - public interface Builder { - /** - * @param split The characters to split on. - */ - Builder split(String split); - - /** - * @return The characters to split on. - */ - String split(); - - /** - * @param index The index of the split string result to return. 0 represents the segment before the first split character. -1 respresents the segment after the last split character. - */ - Builder index(Integer index); - - /** - * @return The index of the split string result to return. 0 represents the segment before the first split character. -1 respresents the segment after the last split character. - */ - Integer index(); - - GetSegment build(); - } - - static class BuilderImpl implements Builder { - protected String split; - - protected Integer index; - - protected BuilderImpl() { - } - - protected BuilderImpl(GetSegment model) { - this.split = model.split(); - this.index = model.index(); - } - - public Builder split(String split) { - this.split = split; - return this; - } - - public String split() { - return this.split; - } - - public Builder index(Integer index) { - this.index = index; - return this; - } - - public Integer index() { - return this.index; - } - - public GetSegment build() { - if (Objects.isNull(this.split())) { - throw new IllegalArgumentException("Missing value for required field `split`"); - } - if (Objects.nonNull(this.split()) && this.split().length() < 1) { - throw new IllegalArgumentException("The size of `split` must be greater than or equal to 1"); - } - if (Objects.nonNull(this.split()) && this.split().length() > 1) { - throw new IllegalArgumentException("The size of `split` must be less than or equal to 1"); - } - if (Objects.isNull(this.index())) { - throw new IllegalArgumentException("Missing value for required field `index`"); - } - return new GetSegment(this); - } - } -} diff --git a/TestVectors/runtimes/java/src/main/smithy-generated/software/amazon/cryptography/dbencryptionsdk/dynamodb/model/GetSegments.java b/TestVectors/runtimes/java/src/main/smithy-generated/software/amazon/cryptography/dbencryptionsdk/dynamodb/model/GetSegments.java deleted file mode 100644 index d1cbc0771..000000000 --- a/TestVectors/runtimes/java/src/main/smithy-generated/software/amazon/cryptography/dbencryptionsdk/dynamodb/model/GetSegments.java +++ /dev/null @@ -1,158 +0,0 @@ -// Copyright Amazon.com Inc. or its affiliates. All Rights Reserved. -// SPDX-License-Identifier: Apache-2.0 -// Do not modify this file. This file is machine generated, and any changes to it will be overwritten. -package software.amazon.cryptography.dbencryptionsdk.dynamodb.model; - -import java.util.Objects; - -/** - * The Virtual Part Transformation that splits a string and gets a range of segments of that split. - */ -public class GetSegments { - /** - * The characters to split on. - */ - private final String split; - - /** - * The index to start the segments from, inclusive. Negative numbers count from the end. -1 is the last segment. - */ - private final Integer low; - - /** - * The index to stop the segments at, exclusive. Negative numbers count from the end. -1 is the last segment. - */ - private final Integer high; - - protected GetSegments(BuilderImpl builder) { - this.split = builder.split(); - this.low = builder.low(); - this.high = builder.high(); - } - - /** - * @return The characters to split on. - */ - public String split() { - return this.split; - } - - /** - * @return The index to start the segments from, inclusive. Negative numbers count from the end. -1 is the last segment. - */ - public Integer low() { - return this.low; - } - - /** - * @return The index to stop the segments at, exclusive. Negative numbers count from the end. -1 is the last segment. - */ - public Integer high() { - return this.high; - } - - public Builder toBuilder() { - return new BuilderImpl(this); - } - - public static Builder builder() { - return new BuilderImpl(); - } - - public interface Builder { - /** - * @param split The characters to split on. - */ - Builder split(String split); - - /** - * @return The characters to split on. - */ - String split(); - - /** - * @param low The index to start the segments from, inclusive. Negative numbers count from the end. -1 is the last segment. - */ - Builder low(Integer low); - - /** - * @return The index to start the segments from, inclusive. Negative numbers count from the end. -1 is the last segment. - */ - Integer low(); - - /** - * @param high The index to stop the segments at, exclusive. Negative numbers count from the end. -1 is the last segment. - */ - Builder high(Integer high); - - /** - * @return The index to stop the segments at, exclusive. Negative numbers count from the end. -1 is the last segment. - */ - Integer high(); - - GetSegments build(); - } - - static class BuilderImpl implements Builder { - protected String split; - - protected Integer low; - - protected Integer high; - - protected BuilderImpl() { - } - - protected BuilderImpl(GetSegments model) { - this.split = model.split(); - this.low = model.low(); - this.high = model.high(); - } - - public Builder split(String split) { - this.split = split; - return this; - } - - public String split() { - return this.split; - } - - public Builder low(Integer low) { - this.low = low; - return this; - } - - public Integer low() { - return this.low; - } - - public Builder high(Integer high) { - this.high = high; - return this; - } - - public Integer high() { - return this.high; - } - - public GetSegments build() { - if (Objects.isNull(this.split())) { - throw new IllegalArgumentException("Missing value for required field `split`"); - } - if (Objects.nonNull(this.split()) && this.split().length() < 1) { - throw new IllegalArgumentException("The size of `split` must be greater than or equal to 1"); - } - if (Objects.nonNull(this.split()) && this.split().length() > 1) { - throw new IllegalArgumentException("The size of `split` must be less than or equal to 1"); - } - if (Objects.isNull(this.low())) { - throw new IllegalArgumentException("Missing value for required field `low`"); - } - if (Objects.isNull(this.high())) { - throw new IllegalArgumentException("Missing value for required field `high`"); - } - return new GetSegments(this); - } - } -} diff --git a/TestVectors/runtimes/java/src/main/smithy-generated/software/amazon/cryptography/dbencryptionsdk/dynamodb/model/GetSubstring.java b/TestVectors/runtimes/java/src/main/smithy-generated/software/amazon/cryptography/dbencryptionsdk/dynamodb/model/GetSubstring.java deleted file mode 100644 index 7db87057e..000000000 --- a/TestVectors/runtimes/java/src/main/smithy-generated/software/amazon/cryptography/dbencryptionsdk/dynamodb/model/GetSubstring.java +++ /dev/null @@ -1,114 +0,0 @@ -// Copyright Amazon.com Inc. or its affiliates. All Rights Reserved. -// SPDX-License-Identifier: Apache-2.0 -// Do not modify this file. This file is machine generated, and any changes to it will be overwritten. -package software.amazon.cryptography.dbencryptionsdk.dynamodb.model; - -import java.util.Objects; - -/** - * The Virtual Part Transformation that gets a substring from a string. - */ -public class GetSubstring { - /** - * The index to start the substring from, inclusive. Negative numbers count from the end. -1 is the last character of a string. - */ - private final Integer low; - - /** - * The index to stop the substring at, exclusive. Negative numbers count from the end. -1 is the last character of a string. - */ - private final Integer high; - - protected GetSubstring(BuilderImpl builder) { - this.low = builder.low(); - this.high = builder.high(); - } - - /** - * @return The index to start the substring from, inclusive. Negative numbers count from the end. -1 is the last character of a string. - */ - public Integer low() { - return this.low; - } - - /** - * @return The index to stop the substring at, exclusive. Negative numbers count from the end. -1 is the last character of a string. - */ - public Integer high() { - return this.high; - } - - public Builder toBuilder() { - return new BuilderImpl(this); - } - - public static Builder builder() { - return new BuilderImpl(); - } - - public interface Builder { - /** - * @param low The index to start the substring from, inclusive. Negative numbers count from the end. -1 is the last character of a string. - */ - Builder low(Integer low); - - /** - * @return The index to start the substring from, inclusive. Negative numbers count from the end. -1 is the last character of a string. - */ - Integer low(); - - /** - * @param high The index to stop the substring at, exclusive. Negative numbers count from the end. -1 is the last character of a string. - */ - Builder high(Integer high); - - /** - * @return The index to stop the substring at, exclusive. Negative numbers count from the end. -1 is the last character of a string. - */ - Integer high(); - - GetSubstring build(); - } - - static class BuilderImpl implements Builder { - protected Integer low; - - protected Integer high; - - protected BuilderImpl() { - } - - protected BuilderImpl(GetSubstring model) { - this.low = model.low(); - this.high = model.high(); - } - - public Builder low(Integer low) { - this.low = low; - return this; - } - - public Integer low() { - return this.low; - } - - public Builder high(Integer high) { - this.high = high; - return this; - } - - public Integer high() { - return this.high; - } - - public GetSubstring build() { - if (Objects.isNull(this.low())) { - throw new IllegalArgumentException("Missing value for required field `low`"); - } - if (Objects.isNull(this.high())) { - throw new IllegalArgumentException("Missing value for required field `high`"); - } - return new GetSubstring(this); - } - } -} diff --git a/TestVectors/runtimes/java/src/main/smithy-generated/software/amazon/cryptography/dbencryptionsdk/dynamodb/model/GetSuffix.java b/TestVectors/runtimes/java/src/main/smithy-generated/software/amazon/cryptography/dbencryptionsdk/dynamodb/model/GetSuffix.java deleted file mode 100644 index fd421a413..000000000 --- a/TestVectors/runtimes/java/src/main/smithy-generated/software/amazon/cryptography/dbencryptionsdk/dynamodb/model/GetSuffix.java +++ /dev/null @@ -1,76 +0,0 @@ -// Copyright Amazon.com Inc. or its affiliates. All Rights Reserved. -// SPDX-License-Identifier: Apache-2.0 -// Do not modify this file. This file is machine generated, and any changes to it will be overwritten. -package software.amazon.cryptography.dbencryptionsdk.dynamodb.model; - -import java.util.Objects; - -/** - * The Virtual Part Transformation that gets the suffix of a string. - */ -public class GetSuffix { - /** - * If positive, the number of characters to return from the end. If negative, the absolute number of characters to exclude from the front. e.g. GetSuffix(-1) returns all but the first character. - */ - private final Integer length; - - protected GetSuffix(BuilderImpl builder) { - this.length = builder.length(); - } - - /** - * @return If positive, the number of characters to return from the end. If negative, the absolute number of characters to exclude from the front. e.g. GetSuffix(-1) returns all but the first character. - */ - public Integer length() { - return this.length; - } - - public Builder toBuilder() { - return new BuilderImpl(this); - } - - public static Builder builder() { - return new BuilderImpl(); - } - - public interface Builder { - /** - * @param length If positive, the number of characters to return from the end. If negative, the absolute number of characters to exclude from the front. e.g. GetSuffix(-1) returns all but the first character. - */ - Builder length(Integer length); - - /** - * @return If positive, the number of characters to return from the end. If negative, the absolute number of characters to exclude from the front. e.g. GetSuffix(-1) returns all but the first character. - */ - Integer length(); - - GetSuffix build(); - } - - static class BuilderImpl implements Builder { - protected Integer length; - - protected BuilderImpl() { - } - - protected BuilderImpl(GetSuffix model) { - this.length = model.length(); - } - - public Builder length(Integer length) { - this.length = length; - return this; - } - - public Integer length() { - return this.length; - } - - public GetSuffix build() { - if (Objects.isNull(this.length())) { - throw new IllegalArgumentException("Missing value for required field `length`"); - } - return new GetSuffix(this); - } - } -} diff --git a/TestVectors/runtimes/java/src/main/smithy-generated/software/amazon/cryptography/dbencryptionsdk/dynamodb/model/Insert.java b/TestVectors/runtimes/java/src/main/smithy-generated/software/amazon/cryptography/dbencryptionsdk/dynamodb/model/Insert.java deleted file mode 100644 index 031648da5..000000000 --- a/TestVectors/runtimes/java/src/main/smithy-generated/software/amazon/cryptography/dbencryptionsdk/dynamodb/model/Insert.java +++ /dev/null @@ -1,76 +0,0 @@ -// Copyright Amazon.com Inc. or its affiliates. All Rights Reserved. -// SPDX-License-Identifier: Apache-2.0 -// Do not modify this file. This file is machine generated, and any changes to it will be overwritten. -package software.amazon.cryptography.dbencryptionsdk.dynamodb.model; - -import java.util.Objects; - -/** - * The Virtual Part Transformation that appends a literal string. - */ -public class Insert { - /** - * The literal string to append. - */ - private final String literal; - - protected Insert(BuilderImpl builder) { - this.literal = builder.literal(); - } - - /** - * @return The literal string to append. - */ - public String literal() { - return this.literal; - } - - public Builder toBuilder() { - return new BuilderImpl(this); - } - - public static Builder builder() { - return new BuilderImpl(); - } - - public interface Builder { - /** - * @param literal The literal string to append. - */ - Builder literal(String literal); - - /** - * @return The literal string to append. - */ - String literal(); - - Insert build(); - } - - static class BuilderImpl implements Builder { - protected String literal; - - protected BuilderImpl() { - } - - protected BuilderImpl(Insert model) { - this.literal = model.literal(); - } - - public Builder literal(String literal) { - this.literal = literal; - return this; - } - - public String literal() { - return this.literal; - } - - public Insert build() { - if (Objects.isNull(this.literal())) { - throw new IllegalArgumentException("Missing value for required field `literal`"); - } - return new Insert(this); - } - } -} diff --git a/TestVectors/runtimes/java/src/main/smithy-generated/software/amazon/cryptography/dbencryptionsdk/dynamodb/model/LegacyOverride.java b/TestVectors/runtimes/java/src/main/smithy-generated/software/amazon/cryptography/dbencryptionsdk/dynamodb/model/LegacyOverride.java deleted file mode 100644 index 268864f59..000000000 --- a/TestVectors/runtimes/java/src/main/smithy-generated/software/amazon/cryptography/dbencryptionsdk/dynamodb/model/LegacyOverride.java +++ /dev/null @@ -1,191 +0,0 @@ -// Copyright Amazon.com Inc. or its affiliates. All Rights Reserved. -// SPDX-License-Identifier: Apache-2.0 -// Do not modify this file. This file is machine generated, and any changes to it will be overwritten. -package software.amazon.cryptography.dbencryptionsdk.dynamodb.model; - -import java.util.Map; -import java.util.Objects; -import software.amazon.cryptography.dbencryptionsdk.dynamodb.ILegacyDynamoDbEncryptor; -import software.amazon.cryptography.dbencryptionsdk.dynamodb.LegacyDynamoDbEncryptor; -import software.amazon.cryptography.dbencryptionsdk.structuredencryption.model.CryptoAction; - -/** - * A configuration for overriding encryption and/or decryption to instead perform legacy encryption and decryption. - */ -public class LegacyOverride { - /** - * A policy which configurates whether legacy behavior overrides encryption and/or decryption. - */ - private final LegacyPolicy policy; - - /** - * A configuration for the legacy DynamoDB Encryption Client's Encryptor. - */ - private final ILegacyDynamoDbEncryptor encryptor; - - /** - * Overrides which attributes are encrypted and/or signed for any items read or written with legacy behavior. - */ - private final Map attributeActionsOnEncrypt; - - /** - * This input is not used in the Java Client and should not be specified. - */ - private final CryptoAction defaultAttributeFlag; - - protected LegacyOverride(BuilderImpl builder) { - this.policy = builder.policy(); - this.encryptor = builder.encryptor(); - this.attributeActionsOnEncrypt = builder.attributeActionsOnEncrypt(); - this.defaultAttributeFlag = builder.defaultAttributeFlag(); - } - - /** - * @return A policy which configurates whether legacy behavior overrides encryption and/or decryption. - */ - public LegacyPolicy policy() { - return this.policy; - } - - /** - * @return A configuration for the legacy DynamoDB Encryption Client's Encryptor. - */ - public ILegacyDynamoDbEncryptor encryptor() { - return this.encryptor; - } - - /** - * @return Overrides which attributes are encrypted and/or signed for any items read or written with legacy behavior. - */ - public Map attributeActionsOnEncrypt() { - return this.attributeActionsOnEncrypt; - } - - /** - * @return This input is not used in the Java Client and should not be specified. - */ - public CryptoAction defaultAttributeFlag() { - return this.defaultAttributeFlag; - } - - public Builder toBuilder() { - return new BuilderImpl(this); - } - - public static Builder builder() { - return new BuilderImpl(); - } - - public interface Builder { - /** - * @param policy A policy which configurates whether legacy behavior overrides encryption and/or decryption. - */ - Builder policy(LegacyPolicy policy); - - /** - * @return A policy which configurates whether legacy behavior overrides encryption and/or decryption. - */ - LegacyPolicy policy(); - - /** - * @param encryptor A configuration for the legacy DynamoDB Encryption Client's Encryptor. - */ - Builder encryptor(ILegacyDynamoDbEncryptor encryptor); - - /** - * @return A configuration for the legacy DynamoDB Encryption Client's Encryptor. - */ - ILegacyDynamoDbEncryptor encryptor(); - - /** - * @param attributeActionsOnEncrypt Overrides which attributes are encrypted and/or signed for any items read or written with legacy behavior. - */ - Builder attributeActionsOnEncrypt(Map attributeActionsOnEncrypt); - - /** - * @return Overrides which attributes are encrypted and/or signed for any items read or written with legacy behavior. - */ - Map attributeActionsOnEncrypt(); - - /** - * @param defaultAttributeFlag This input is not used in the Java Client and should not be specified. - */ - Builder defaultAttributeFlag(CryptoAction defaultAttributeFlag); - - /** - * @return This input is not used in the Java Client and should not be specified. - */ - CryptoAction defaultAttributeFlag(); - - LegacyOverride build(); - } - - static class BuilderImpl implements Builder { - protected LegacyPolicy policy; - - protected ILegacyDynamoDbEncryptor encryptor; - - protected Map attributeActionsOnEncrypt; - - protected CryptoAction defaultAttributeFlag; - - protected BuilderImpl() { - } - - protected BuilderImpl(LegacyOverride model) { - this.policy = model.policy(); - this.encryptor = model.encryptor(); - this.attributeActionsOnEncrypt = model.attributeActionsOnEncrypt(); - this.defaultAttributeFlag = model.defaultAttributeFlag(); - } - - public Builder policy(LegacyPolicy policy) { - this.policy = policy; - return this; - } - - public LegacyPolicy policy() { - return this.policy; - } - - public Builder encryptor(ILegacyDynamoDbEncryptor encryptor) { - this.encryptor = LegacyDynamoDbEncryptor.wrap(encryptor); - return this; - } - - public ILegacyDynamoDbEncryptor encryptor() { - return this.encryptor; - } - - public Builder attributeActionsOnEncrypt(Map attributeActionsOnEncrypt) { - this.attributeActionsOnEncrypt = attributeActionsOnEncrypt; - return this; - } - - public Map attributeActionsOnEncrypt() { - return this.attributeActionsOnEncrypt; - } - - public Builder defaultAttributeFlag(CryptoAction defaultAttributeFlag) { - this.defaultAttributeFlag = defaultAttributeFlag; - return this; - } - - public CryptoAction defaultAttributeFlag() { - return this.defaultAttributeFlag; - } - - public LegacyOverride build() { - if (Objects.isNull(this.policy())) { - throw new IllegalArgumentException("Missing value for required field `policy`"); - } - if (Objects.isNull(this.encryptor())) { - throw new IllegalArgumentException("Missing value for required field `encryptor`"); - } - if (Objects.isNull(this.attributeActionsOnEncrypt())) { - throw new IllegalArgumentException("Missing value for required field `attributeActionsOnEncrypt`"); - } - return new LegacyOverride(this); - } - } -} diff --git a/TestVectors/runtimes/java/src/main/smithy-generated/software/amazon/cryptography/dbencryptionsdk/dynamodb/model/LegacyPolicy.java b/TestVectors/runtimes/java/src/main/smithy-generated/software/amazon/cryptography/dbencryptionsdk/dynamodb/model/LegacyPolicy.java deleted file mode 100644 index 6b56e2c5d..000000000 --- a/TestVectors/runtimes/java/src/main/smithy-generated/software/amazon/cryptography/dbencryptionsdk/dynamodb/model/LegacyPolicy.java +++ /dev/null @@ -1,22 +0,0 @@ -// Copyright Amazon.com Inc. or its affiliates. All Rights Reserved. -// SPDX-License-Identifier: Apache-2.0 -// Do not modify this file. This file is machine generated, and any changes to it will be overwritten. -package software.amazon.cryptography.dbencryptionsdk.dynamodb.model; - -public enum LegacyPolicy { - FORCE_LEGACY_ENCRYPT_ALLOW_LEGACY_DECRYPT("FORCE_LEGACY_ENCRYPT_ALLOW_LEGACY_DECRYPT"), - - FORBID_LEGACY_ENCRYPT_ALLOW_LEGACY_DECRYPT("FORBID_LEGACY_ENCRYPT_ALLOW_LEGACY_DECRYPT"), - - FORBID_LEGACY_ENCRYPT_FORBID_LEGACY_DECRYPT("FORBID_LEGACY_ENCRYPT_FORBID_LEGACY_DECRYPT"); - - private final String value; - - private LegacyPolicy(String value) { - this.value = value; - } - - public String toString() { - return String.valueOf(value); - } -} diff --git a/TestVectors/runtimes/java/src/main/smithy-generated/software/amazon/cryptography/dbencryptionsdk/dynamodb/model/Lower.java b/TestVectors/runtimes/java/src/main/smithy-generated/software/amazon/cryptography/dbencryptionsdk/dynamodb/model/Lower.java deleted file mode 100644 index f7d1637c1..000000000 --- a/TestVectors/runtimes/java/src/main/smithy-generated/software/amazon/cryptography/dbencryptionsdk/dynamodb/model/Lower.java +++ /dev/null @@ -1,36 +0,0 @@ -// Copyright Amazon.com Inc. or its affiliates. All Rights Reserved. -// SPDX-License-Identifier: Apache-2.0 -// Do not modify this file. This file is machine generated, and any changes to it will be overwritten. -package software.amazon.cryptography.dbencryptionsdk.dynamodb.model; - -/** - * The Virtual Part Transformation that converts ASCII characters to lower case. - */ -public class Lower { - protected Lower(BuilderImpl builder) { - } - - public Builder toBuilder() { - return new BuilderImpl(this); - } - - public static Builder builder() { - return new BuilderImpl(); - } - - public interface Builder { - Lower build(); - } - - static class BuilderImpl implements Builder { - protected BuilderImpl() { - } - - protected BuilderImpl(Lower model) { - } - - public Lower build() { - return new Lower(this); - } - } -} diff --git a/TestVectors/runtimes/java/src/main/smithy-generated/software/amazon/cryptography/dbencryptionsdk/dynamodb/model/MultiKeyStore.java b/TestVectors/runtimes/java/src/main/smithy-generated/software/amazon/cryptography/dbencryptionsdk/dynamodb/model/MultiKeyStore.java deleted file mode 100644 index cbb58f3f8..000000000 --- a/TestVectors/runtimes/java/src/main/smithy-generated/software/amazon/cryptography/dbencryptionsdk/dynamodb/model/MultiKeyStore.java +++ /dev/null @@ -1,150 +0,0 @@ -// Copyright Amazon.com Inc. or its affiliates. All Rights Reserved. -// SPDX-License-Identifier: Apache-2.0 -// Do not modify this file. This file is machine generated, and any changes to it will be overwritten. -package software.amazon.cryptography.dbencryptionsdk.dynamodb.model; - -import java.util.Objects; -import software.amazon.cryptography.materialproviders.model.CacheType; - -/** - * The configuration for using multiple Beacon Keys. - */ -public class MultiKeyStore { - /** - * The name of the field that stores the Beacon Key. This may be a Virtual Field. - */ - private final String keyFieldName; - - /** - * How long (in seconds) the beacon key material is cached locally before it is re-retrieved from DynamoDB and re-authed with AWS KMS. - */ - private final Integer cacheTTL; - - /** - * Which type of local cache to use. - */ - private final CacheType cache; - - protected MultiKeyStore(BuilderImpl builder) { - this.keyFieldName = builder.keyFieldName(); - this.cacheTTL = builder.cacheTTL(); - this.cache = builder.cache(); - } - - /** - * @return The name of the field that stores the Beacon Key. This may be a Virtual Field. - */ - public String keyFieldName() { - return this.keyFieldName; - } - - /** - * @return How long (in seconds) the beacon key material is cached locally before it is re-retrieved from DynamoDB and re-authed with AWS KMS. - */ - public Integer cacheTTL() { - return this.cacheTTL; - } - - /** - * @return Which type of local cache to use. - */ - public CacheType cache() { - return this.cache; - } - - public Builder toBuilder() { - return new BuilderImpl(this); - } - - public static Builder builder() { - return new BuilderImpl(); - } - - public interface Builder { - /** - * @param keyFieldName The name of the field that stores the Beacon Key. This may be a Virtual Field. - */ - Builder keyFieldName(String keyFieldName); - - /** - * @return The name of the field that stores the Beacon Key. This may be a Virtual Field. - */ - String keyFieldName(); - - /** - * @param cacheTTL How long (in seconds) the beacon key material is cached locally before it is re-retrieved from DynamoDB and re-authed with AWS KMS. - */ - Builder cacheTTL(Integer cacheTTL); - - /** - * @return How long (in seconds) the beacon key material is cached locally before it is re-retrieved from DynamoDB and re-authed with AWS KMS. - */ - Integer cacheTTL(); - - /** - * @param cache Which type of local cache to use. - */ - Builder cache(CacheType cache); - - /** - * @return Which type of local cache to use. - */ - CacheType cache(); - - MultiKeyStore build(); - } - - static class BuilderImpl implements Builder { - protected String keyFieldName; - - protected Integer cacheTTL; - - protected CacheType cache; - - protected BuilderImpl() { - } - - protected BuilderImpl(MultiKeyStore model) { - this.keyFieldName = model.keyFieldName(); - this.cacheTTL = model.cacheTTL(); - this.cache = model.cache(); - } - - public Builder keyFieldName(String keyFieldName) { - this.keyFieldName = keyFieldName; - return this; - } - - public String keyFieldName() { - return this.keyFieldName; - } - - public Builder cacheTTL(Integer cacheTTL) { - this.cacheTTL = cacheTTL; - return this; - } - - public Integer cacheTTL() { - return this.cacheTTL; - } - - public Builder cache(CacheType cache) { - this.cache = cache; - return this; - } - - public CacheType cache() { - return this.cache; - } - - public MultiKeyStore build() { - if (Objects.isNull(this.keyFieldName())) { - throw new IllegalArgumentException("Missing value for required field `keyFieldName`"); - } - if (Objects.isNull(this.cacheTTL())) { - throw new IllegalArgumentException("Missing value for required field `cacheTTL`"); - } - return new MultiKeyStore(this); - } - } -} diff --git a/TestVectors/runtimes/java/src/main/smithy-generated/software/amazon/cryptography/dbencryptionsdk/dynamodb/model/OpaqueError.java b/TestVectors/runtimes/java/src/main/smithy-generated/software/amazon/cryptography/dbencryptionsdk/dynamodb/model/OpaqueError.java deleted file mode 100644 index 377a322a5..000000000 --- a/TestVectors/runtimes/java/src/main/smithy-generated/software/amazon/cryptography/dbencryptionsdk/dynamodb/model/OpaqueError.java +++ /dev/null @@ -1,142 +0,0 @@ -// Copyright Amazon.com Inc. or its affiliates. All Rights Reserved. -// SPDX-License-Identifier: Apache-2.0 -// Do not modify this file. This file is machine generated, and any changes to it will be overwritten. -package software.amazon.cryptography.dbencryptionsdk.dynamodb.model; - -public class OpaqueError extends RuntimeException { - /** - * The unexpected object encountered. It MIGHT BE an Exception, but that is not guaranteed. - */ - private final Object obj; - - protected OpaqueError(BuilderImpl builder) { - super(messageFromBuilder(builder), builder.cause()); - this.obj = builder.obj(); - } - - private static String messageFromBuilder(Builder builder) { - if (builder.message() != null) { - return builder.message(); - } - if (builder.cause() != null) { - return builder.cause().getMessage(); - } - return null; - } - - /** - * See {@link Throwable#getMessage()}. - */ - public String message() { - return this.getMessage(); - } - - /** - * See {@link Throwable#getCause()}. - */ - public Throwable cause() { - return this.getCause(); - } - - /** - * @return The unexpected object encountered. It MIGHT BE an Exception, but that is not guaranteed. - */ - public Object obj() { - return this.obj; - } - - public Builder toBuilder() { - return new BuilderImpl(this); - } - - public static Builder builder() { - return new BuilderImpl(); - } - - public interface Builder { - /** - * @param message The detailed message. The detail message is saved for later retrieval by the {@link #getMessage()} method. - */ - Builder message(String message); - - /** - * @return The detailed message. The detail message is saved for later retrieval by the {@link #getMessage()} method. - */ - String message(); - - /** - * @param cause The cause (which is saved for later retrieval by the {@link #getCause()} method). (A {@code null} value is permitted, and indicates that the cause is nonexistent or unknown.) - */ - Builder cause(Throwable cause); - - /** - * @return The cause (which is saved for later retrieval by the {@link #getCause()} method). (A {@code null} value is permitted, and indicates that the cause is nonexistent or unknown.) - */ - Throwable cause(); - - /** - * @param obj The unexpected object encountered. It MIGHT BE an Exception, but that is not guaranteed. - */ - Builder obj(Object obj); - - /** - * @return The unexpected object encountered. It MIGHT BE an Exception, but that is not guaranteed. - */ - Object obj(); - - OpaqueError build(); - } - - static class BuilderImpl implements Builder { - protected String message; - - protected Throwable cause; - - protected Object obj; - - protected BuilderImpl() { - } - - protected BuilderImpl(OpaqueError model) { - this.cause = model.getCause(); - this.message = model.getMessage(); - this.obj = model.obj(); - } - - public Builder message(String message) { - this.message = message; - return this; - } - - public String message() { - return this.message; - } - - public Builder cause(Throwable cause) { - this.cause = cause; - return this; - } - - public Throwable cause() { - return this.cause; - } - - public Builder obj(Object obj) { - this.obj = obj; - return this; - } - - public Object obj() { - return this.obj; - } - - public OpaqueError build() { - if (this.obj != null && this.cause == null && this.obj instanceof Throwable) { - this.cause = (Throwable) this.obj; - } else if (this.obj == null && this.cause != null) { - this.obj = this.cause; - } - return new OpaqueError(this); - } - } -} diff --git a/TestVectors/runtimes/java/src/main/smithy-generated/software/amazon/cryptography/dbencryptionsdk/dynamodb/model/PartOnly.java b/TestVectors/runtimes/java/src/main/smithy-generated/software/amazon/cryptography/dbencryptionsdk/dynamodb/model/PartOnly.java deleted file mode 100644 index dfd41a508..000000000 --- a/TestVectors/runtimes/java/src/main/smithy-generated/software/amazon/cryptography/dbencryptionsdk/dynamodb/model/PartOnly.java +++ /dev/null @@ -1,36 +0,0 @@ -// Copyright Amazon.com Inc. or its affiliates. All Rights Reserved. -// SPDX-License-Identifier: Apache-2.0 -// Do not modify this file. This file is machine generated, and any changes to it will be overwritten. -package software.amazon.cryptography.dbencryptionsdk.dynamodb.model; - -/** - * Attribute must be used as part of a Compound Beacon, never alone. - */ -public class PartOnly { - protected PartOnly(BuilderImpl builder) { - } - - public Builder toBuilder() { - return new BuilderImpl(this); - } - - public static Builder builder() { - return new BuilderImpl(); - } - - public interface Builder { - PartOnly build(); - } - - static class BuilderImpl implements Builder { - protected BuilderImpl() { - } - - protected BuilderImpl(PartOnly model) { - } - - public PartOnly build() { - return new PartOnly(this); - } - } -} diff --git a/TestVectors/runtimes/java/src/main/smithy-generated/software/amazon/cryptography/dbencryptionsdk/dynamodb/model/PlaintextOverride.java b/TestVectors/runtimes/java/src/main/smithy-generated/software/amazon/cryptography/dbencryptionsdk/dynamodb/model/PlaintextOverride.java deleted file mode 100644 index e440ef064..000000000 --- a/TestVectors/runtimes/java/src/main/smithy-generated/software/amazon/cryptography/dbencryptionsdk/dynamodb/model/PlaintextOverride.java +++ /dev/null @@ -1,22 +0,0 @@ -// Copyright Amazon.com Inc. or its affiliates. All Rights Reserved. -// SPDX-License-Identifier: Apache-2.0 -// Do not modify this file. This file is machine generated, and any changes to it will be overwritten. -package software.amazon.cryptography.dbencryptionsdk.dynamodb.model; - -public enum PlaintextOverride { - FORCE_PLAINTEXT_WRITE_ALLOW_PLAINTEXT_READ("FORCE_PLAINTEXT_WRITE_ALLOW_PLAINTEXT_READ"), - - FORBID_PLAINTEXT_WRITE_ALLOW_PLAINTEXT_READ("FORBID_PLAINTEXT_WRITE_ALLOW_PLAINTEXT_READ"), - - FORBID_PLAINTEXT_WRITE_FORBID_PLAINTEXT_READ("FORBID_PLAINTEXT_WRITE_FORBID_PLAINTEXT_READ"); - - private final String value; - - private PlaintextOverride(String value) { - this.value = value; - } - - public String toString() { - return String.valueOf(value); - } -} diff --git a/TestVectors/runtimes/java/src/main/smithy-generated/software/amazon/cryptography/dbencryptionsdk/dynamodb/model/SearchConfig.java b/TestVectors/runtimes/java/src/main/smithy-generated/software/amazon/cryptography/dbencryptionsdk/dynamodb/model/SearchConfig.java deleted file mode 100644 index 2f73db6f5..000000000 --- a/TestVectors/runtimes/java/src/main/smithy-generated/software/amazon/cryptography/dbencryptionsdk/dynamodb/model/SearchConfig.java +++ /dev/null @@ -1,128 +0,0 @@ -// Copyright Amazon.com Inc. or its affiliates. All Rights Reserved. -// SPDX-License-Identifier: Apache-2.0 -// Do not modify this file. This file is machine generated, and any changes to it will be overwritten. -package software.amazon.cryptography.dbencryptionsdk.dynamodb.model; - -import java.util.List; -import java.util.Objects; - -/** - * The configuration for searchable encryption. - */ -public class SearchConfig { - /** - * The versions of searchable encryption to support reading. Currently must contain a single configuration with version '1'. - */ - private final List versions; - - /** - * The searchable encryption version to use when writing new items. Must be '1'. - */ - private final int writeVersion; - - protected SearchConfig(BuilderImpl builder) { - this.versions = builder.versions(); - this.writeVersion = builder.writeVersion(); - } - - /** - * @return The versions of searchable encryption to support reading. Currently must contain a single configuration with version '1'. - */ - public List versions() { - return this.versions; - } - - /** - * @return The searchable encryption version to use when writing new items. Must be '1'. - */ - public int writeVersion() { - return this.writeVersion; - } - - public Builder toBuilder() { - return new BuilderImpl(this); - } - - public static Builder builder() { - return new BuilderImpl(); - } - - public interface Builder { - /** - * @param versions The versions of searchable encryption to support reading. Currently must contain a single configuration with version '1'. - */ - Builder versions(List versions); - - /** - * @return The versions of searchable encryption to support reading. Currently must contain a single configuration with version '1'. - */ - List versions(); - - /** - * @param writeVersion The searchable encryption version to use when writing new items. Must be '1'. - */ - Builder writeVersion(int writeVersion); - - /** - * @return The searchable encryption version to use when writing new items. Must be '1'. - */ - int writeVersion(); - - SearchConfig build(); - } - - static class BuilderImpl implements Builder { - protected List versions; - - protected int writeVersion; - - private boolean _writeVersionSet = false; - - protected BuilderImpl() { - } - - protected BuilderImpl(SearchConfig model) { - this.versions = model.versions(); - this.writeVersion = model.writeVersion(); - this._writeVersionSet = true; - } - - public Builder versions(List versions) { - this.versions = versions; - return this; - } - - public List versions() { - return this.versions; - } - - public Builder writeVersion(int writeVersion) { - this.writeVersion = writeVersion; - this._writeVersionSet = true; - return this; - } - - public int writeVersion() { - return this.writeVersion; - } - - public SearchConfig build() { - if (Objects.isNull(this.versions())) { - throw new IllegalArgumentException("Missing value for required field `versions`"); - } - if (Objects.nonNull(this.versions()) && this.versions().size() < 1) { - throw new IllegalArgumentException("The size of `versions` must be greater than or equal to 1"); - } - if (Objects.nonNull(this.versions()) && this.versions().size() > 1) { - throw new IllegalArgumentException("The size of `versions` must be less than or equal to 1"); - } - if (!this._writeVersionSet) { - throw new IllegalArgumentException("Missing value for required field `writeVersion`"); - } - if (this._writeVersionSet && this.writeVersion() < 1) { - throw new IllegalArgumentException("`writeVersion` must be greater than or equal to 1"); - } - return new SearchConfig(this); - } - } -} diff --git a/TestVectors/runtimes/java/src/main/smithy-generated/software/amazon/cryptography/dbencryptionsdk/dynamodb/model/Shared.java b/TestVectors/runtimes/java/src/main/smithy-generated/software/amazon/cryptography/dbencryptionsdk/dynamodb/model/Shared.java deleted file mode 100644 index 4be82055a..000000000 --- a/TestVectors/runtimes/java/src/main/smithy-generated/software/amazon/cryptography/dbencryptionsdk/dynamodb/model/Shared.java +++ /dev/null @@ -1,76 +0,0 @@ -// Copyright Amazon.com Inc. or its affiliates. All Rights Reserved. -// SPDX-License-Identifier: Apache-2.0 -// Do not modify this file. This file is machine generated, and any changes to it will be overwritten. -package software.amazon.cryptography.dbencryptionsdk.dynamodb.model; - -import java.util.Objects; - -/** - * This beacon should calculate values like another beacon, so they can be compared. - */ -public class Shared { - /** - * Calculate beacon values as for this beacon. - */ - private final String other; - - protected Shared(BuilderImpl builder) { - this.other = builder.other(); - } - - /** - * @return Calculate beacon values as for this beacon. - */ - public String other() { - return this.other; - } - - public Builder toBuilder() { - return new BuilderImpl(this); - } - - public static Builder builder() { - return new BuilderImpl(); - } - - public interface Builder { - /** - * @param other Calculate beacon values as for this beacon. - */ - Builder other(String other); - - /** - * @return Calculate beacon values as for this beacon. - */ - String other(); - - Shared build(); - } - - static class BuilderImpl implements Builder { - protected String other; - - protected BuilderImpl() { - } - - protected BuilderImpl(Shared model) { - this.other = model.other(); - } - - public Builder other(String other) { - this.other = other; - return this; - } - - public String other() { - return this.other; - } - - public Shared build() { - if (Objects.isNull(this.other())) { - throw new IllegalArgumentException("Missing value for required field `other`"); - } - return new Shared(this); - } - } -} diff --git a/TestVectors/runtimes/java/src/main/smithy-generated/software/amazon/cryptography/dbencryptionsdk/dynamodb/model/SharedSet.java b/TestVectors/runtimes/java/src/main/smithy-generated/software/amazon/cryptography/dbencryptionsdk/dynamodb/model/SharedSet.java deleted file mode 100644 index 9b51d0c98..000000000 --- a/TestVectors/runtimes/java/src/main/smithy-generated/software/amazon/cryptography/dbencryptionsdk/dynamodb/model/SharedSet.java +++ /dev/null @@ -1,76 +0,0 @@ -// Copyright Amazon.com Inc. or its affiliates. All Rights Reserved. -// SPDX-License-Identifier: Apache-2.0 -// Do not modify this file. This file is machine generated, and any changes to it will be overwritten. -package software.amazon.cryptography.dbencryptionsdk.dynamodb.model; - -import java.util.Objects; - -/** - * Both Shared and AsSet. - */ -public class SharedSet { - /** - * Calculate beacon values as for this beacon. - */ - private final String other; - - protected SharedSet(BuilderImpl builder) { - this.other = builder.other(); - } - - /** - * @return Calculate beacon values as for this beacon. - */ - public String other() { - return this.other; - } - - public Builder toBuilder() { - return new BuilderImpl(this); - } - - public static Builder builder() { - return new BuilderImpl(); - } - - public interface Builder { - /** - * @param other Calculate beacon values as for this beacon. - */ - Builder other(String other); - - /** - * @return Calculate beacon values as for this beacon. - */ - String other(); - - SharedSet build(); - } - - static class BuilderImpl implements Builder { - protected String other; - - protected BuilderImpl() { - } - - protected BuilderImpl(SharedSet model) { - this.other = model.other(); - } - - public Builder other(String other) { - this.other = other; - return this; - } - - public String other() { - return this.other; - } - - public SharedSet build() { - if (Objects.isNull(this.other())) { - throw new IllegalArgumentException("Missing value for required field `other`"); - } - return new SharedSet(this); - } - } -} diff --git a/TestVectors/runtimes/java/src/main/smithy-generated/software/amazon/cryptography/dbencryptionsdk/dynamodb/model/SignedPart.java b/TestVectors/runtimes/java/src/main/smithy-generated/software/amazon/cryptography/dbencryptionsdk/dynamodb/model/SignedPart.java deleted file mode 100644 index 2166a61f2..000000000 --- a/TestVectors/runtimes/java/src/main/smithy-generated/software/amazon/cryptography/dbencryptionsdk/dynamodb/model/SignedPart.java +++ /dev/null @@ -1,155 +0,0 @@ -// Copyright Amazon.com Inc. or its affiliates. All Rights Reserved. -// SPDX-License-Identifier: Apache-2.0 -// Do not modify this file. This file is machine generated, and any changes to it will be overwritten. -package software.amazon.cryptography.dbencryptionsdk.dynamodb.model; - -import java.util.Objects; - -/** - * A part of a Compound Beacon that contains signed plaintext data. - */ -public class SignedPart { - /** - * The name for this Signed Part. - */ - private final String name; - - /** - * The prefix that is written with this Signed Part. - */ - private final String prefix; - - /** - * The DynamoDB document path to the value for this Signed Part. If not provided, the 'name' is used for the location. - */ - private final String loc; - - protected SignedPart(BuilderImpl builder) { - this.name = builder.name(); - this.prefix = builder.prefix(); - this.loc = builder.loc(); - } - - /** - * @return The name for this Signed Part. - */ - public String name() { - return this.name; - } - - /** - * @return The prefix that is written with this Signed Part. - */ - public String prefix() { - return this.prefix; - } - - /** - * @return The DynamoDB document path to the value for this Signed Part. If not provided, the 'name' is used for the location. - */ - public String loc() { - return this.loc; - } - - public Builder toBuilder() { - return new BuilderImpl(this); - } - - public static Builder builder() { - return new BuilderImpl(); - } - - public interface Builder { - /** - * @param name The name for this Signed Part. - */ - Builder name(String name); - - /** - * @return The name for this Signed Part. - */ - String name(); - - /** - * @param prefix The prefix that is written with this Signed Part. - */ - Builder prefix(String prefix); - - /** - * @return The prefix that is written with this Signed Part. - */ - String prefix(); - - /** - * @param loc The DynamoDB document path to the value for this Signed Part. If not provided, the 'name' is used for the location. - */ - Builder loc(String loc); - - /** - * @return The DynamoDB document path to the value for this Signed Part. If not provided, the 'name' is used for the location. - */ - String loc(); - - SignedPart build(); - } - - static class BuilderImpl implements Builder { - protected String name; - - protected String prefix; - - protected String loc; - - protected BuilderImpl() { - } - - protected BuilderImpl(SignedPart model) { - this.name = model.name(); - this.prefix = model.prefix(); - this.loc = model.loc(); - } - - public Builder name(String name) { - this.name = name; - return this; - } - - public String name() { - return this.name; - } - - public Builder prefix(String prefix) { - this.prefix = prefix; - return this; - } - - public String prefix() { - return this.prefix; - } - - public Builder loc(String loc) { - this.loc = loc; - return this; - } - - public String loc() { - return this.loc; - } - - public SignedPart build() { - if (Objects.isNull(this.name())) { - throw new IllegalArgumentException("Missing value for required field `name`"); - } - if (Objects.isNull(this.prefix())) { - throw new IllegalArgumentException("Missing value for required field `prefix`"); - } - if (Objects.nonNull(this.prefix()) && this.prefix().length() < 1) { - throw new IllegalArgumentException("The size of `prefix` must be greater than or equal to 1"); - } - if (Objects.nonNull(this.loc()) && this.loc().length() < 1) { - throw new IllegalArgumentException("The size of `loc` must be greater than or equal to 1"); - } - return new SignedPart(this); - } - } -} diff --git a/TestVectors/runtimes/java/src/main/smithy-generated/software/amazon/cryptography/dbencryptionsdk/dynamodb/model/SingleKeyStore.java b/TestVectors/runtimes/java/src/main/smithy-generated/software/amazon/cryptography/dbencryptionsdk/dynamodb/model/SingleKeyStore.java deleted file mode 100644 index b4b520805..000000000 --- a/TestVectors/runtimes/java/src/main/smithy-generated/software/amazon/cryptography/dbencryptionsdk/dynamodb/model/SingleKeyStore.java +++ /dev/null @@ -1,114 +0,0 @@ -// Copyright Amazon.com Inc. or its affiliates. All Rights Reserved. -// SPDX-License-Identifier: Apache-2.0 -// Do not modify this file. This file is machine generated, and any changes to it will be overwritten. -package software.amazon.cryptography.dbencryptionsdk.dynamodb.model; - -import java.util.Objects; - -/** - * The configuration for using a single Beacon Key. - */ -public class SingleKeyStore { - /** - * The Beacon Key ID. - */ - private final String keyId; - - /** - * How long (in seconds) the beacon key material is cached locally before it is re-retrieved from DynamoDB and re-authed with AWS KMS. - */ - private final Integer cacheTTL; - - protected SingleKeyStore(BuilderImpl builder) { - this.keyId = builder.keyId(); - this.cacheTTL = builder.cacheTTL(); - } - - /** - * @return The Beacon Key ID. - */ - public String keyId() { - return this.keyId; - } - - /** - * @return How long (in seconds) the beacon key material is cached locally before it is re-retrieved from DynamoDB and re-authed with AWS KMS. - */ - public Integer cacheTTL() { - return this.cacheTTL; - } - - public Builder toBuilder() { - return new BuilderImpl(this); - } - - public static Builder builder() { - return new BuilderImpl(); - } - - public interface Builder { - /** - * @param keyId The Beacon Key ID. - */ - Builder keyId(String keyId); - - /** - * @return The Beacon Key ID. - */ - String keyId(); - - /** - * @param cacheTTL How long (in seconds) the beacon key material is cached locally before it is re-retrieved from DynamoDB and re-authed with AWS KMS. - */ - Builder cacheTTL(Integer cacheTTL); - - /** - * @return How long (in seconds) the beacon key material is cached locally before it is re-retrieved from DynamoDB and re-authed with AWS KMS. - */ - Integer cacheTTL(); - - SingleKeyStore build(); - } - - static class BuilderImpl implements Builder { - protected String keyId; - - protected Integer cacheTTL; - - protected BuilderImpl() { - } - - protected BuilderImpl(SingleKeyStore model) { - this.keyId = model.keyId(); - this.cacheTTL = model.cacheTTL(); - } - - public Builder keyId(String keyId) { - this.keyId = keyId; - return this; - } - - public String keyId() { - return this.keyId; - } - - public Builder cacheTTL(Integer cacheTTL) { - this.cacheTTL = cacheTTL; - return this; - } - - public Integer cacheTTL() { - return this.cacheTTL; - } - - public SingleKeyStore build() { - if (Objects.isNull(this.keyId())) { - throw new IllegalArgumentException("Missing value for required field `keyId`"); - } - if (Objects.isNull(this.cacheTTL())) { - throw new IllegalArgumentException("Missing value for required field `cacheTTL`"); - } - return new SingleKeyStore(this); - } - } -} diff --git a/TestVectors/runtimes/java/src/main/smithy-generated/software/amazon/cryptography/dbencryptionsdk/dynamodb/model/StandardBeacon.java b/TestVectors/runtimes/java/src/main/smithy-generated/software/amazon/cryptography/dbencryptionsdk/dynamodb/model/StandardBeacon.java deleted file mode 100644 index bcd24a6ca..000000000 --- a/TestVectors/runtimes/java/src/main/smithy-generated/software/amazon/cryptography/dbencryptionsdk/dynamodb/model/StandardBeacon.java +++ /dev/null @@ -1,197 +0,0 @@ -// Copyright Amazon.com Inc. or its affiliates. All Rights Reserved. -// SPDX-License-Identifier: Apache-2.0 -// Do not modify this file. This file is machine generated, and any changes to it will be overwritten. -package software.amazon.cryptography.dbencryptionsdk.dynamodb.model; - -import java.util.Objects; - -/** - * The configuration for a Standard Beacon. - */ -public class StandardBeacon { - /** - * The name for this Standard Beacon. - */ - private final String name; - - /** - * The length of the calculated beacon. - */ - private final int length; - - /** - * The DynamoDB document path to the value this beacon will calculate over. If not specified, the beacon will calculate values for the attribute with the name specified in 'name'. - */ - private final String loc; - - /** - * Optional augmented behavior. - */ - private final BeaconStyle style; - - protected StandardBeacon(BuilderImpl builder) { - this.name = builder.name(); - this.length = builder.length(); - this.loc = builder.loc(); - this.style = builder.style(); - } - - /** - * @return The name for this Standard Beacon. - */ - public String name() { - return this.name; - } - - /** - * @return The length of the calculated beacon. - */ - public int length() { - return this.length; - } - - /** - * @return The DynamoDB document path to the value this beacon will calculate over. If not specified, the beacon will calculate values for the attribute with the name specified in 'name'. - */ - public String loc() { - return this.loc; - } - - /** - * @return Optional augmented behavior. - */ - public BeaconStyle style() { - return this.style; - } - - public Builder toBuilder() { - return new BuilderImpl(this); - } - - public static Builder builder() { - return new BuilderImpl(); - } - - public interface Builder { - /** - * @param name The name for this Standard Beacon. - */ - Builder name(String name); - - /** - * @return The name for this Standard Beacon. - */ - String name(); - - /** - * @param length The length of the calculated beacon. - */ - Builder length(int length); - - /** - * @return The length of the calculated beacon. - */ - int length(); - - /** - * @param loc The DynamoDB document path to the value this beacon will calculate over. If not specified, the beacon will calculate values for the attribute with the name specified in 'name'. - */ - Builder loc(String loc); - - /** - * @return The DynamoDB document path to the value this beacon will calculate over. If not specified, the beacon will calculate values for the attribute with the name specified in 'name'. - */ - String loc(); - - /** - * @param style Optional augmented behavior. - */ - Builder style(BeaconStyle style); - - /** - * @return Optional augmented behavior. - */ - BeaconStyle style(); - - StandardBeacon build(); - } - - static class BuilderImpl implements Builder { - protected String name; - - protected int length; - - private boolean _lengthSet = false; - - protected String loc; - - protected BeaconStyle style; - - protected BuilderImpl() { - } - - protected BuilderImpl(StandardBeacon model) { - this.name = model.name(); - this.length = model.length(); - this._lengthSet = true; - this.loc = model.loc(); - this.style = model.style(); - } - - public Builder name(String name) { - this.name = name; - return this; - } - - public String name() { - return this.name; - } - - public Builder length(int length) { - this.length = length; - this._lengthSet = true; - return this; - } - - public int length() { - return this.length; - } - - public Builder loc(String loc) { - this.loc = loc; - return this; - } - - public String loc() { - return this.loc; - } - - public Builder style(BeaconStyle style) { - this.style = style; - return this; - } - - public BeaconStyle style() { - return this.style; - } - - public StandardBeacon build() { - if (Objects.isNull(this.name())) { - throw new IllegalArgumentException("Missing value for required field `name`"); - } - if (!this._lengthSet) { - throw new IllegalArgumentException("Missing value for required field `length`"); - } - if (this._lengthSet && this.length() < 1) { - throw new IllegalArgumentException("`length` must be greater than or equal to 1"); - } - if (this._lengthSet && this.length() > 63) { - throw new IllegalArgumentException("`length` must be less than or equal to 63."); - } - if (Objects.nonNull(this.loc()) && this.loc().length() < 1) { - throw new IllegalArgumentException("The size of `loc` must be greater than or equal to 1"); - } - return new StandardBeacon(this); - } - } -} diff --git a/TestVectors/runtimes/java/src/main/smithy-generated/software/amazon/cryptography/dbencryptionsdk/dynamodb/model/Upper.java b/TestVectors/runtimes/java/src/main/smithy-generated/software/amazon/cryptography/dbencryptionsdk/dynamodb/model/Upper.java deleted file mode 100644 index faed92ccb..000000000 --- a/TestVectors/runtimes/java/src/main/smithy-generated/software/amazon/cryptography/dbencryptionsdk/dynamodb/model/Upper.java +++ /dev/null @@ -1,36 +0,0 @@ -// Copyright Amazon.com Inc. or its affiliates. All Rights Reserved. -// SPDX-License-Identifier: Apache-2.0 -// Do not modify this file. This file is machine generated, and any changes to it will be overwritten. -package software.amazon.cryptography.dbencryptionsdk.dynamodb.model; - -/** - * The Virtual Part Transformation that converts ASCII characters to upper case. - */ -public class Upper { - protected Upper(BuilderImpl builder) { - } - - public Builder toBuilder() { - return new BuilderImpl(this); - } - - public static Builder builder() { - return new BuilderImpl(); - } - - public interface Builder { - Upper build(); - } - - static class BuilderImpl implements Builder { - protected BuilderImpl() { - } - - protected BuilderImpl(Upper model) { - } - - public Upper build() { - return new Upper(this); - } - } -} diff --git a/TestVectors/runtimes/java/src/main/smithy-generated/software/amazon/cryptography/dbencryptionsdk/dynamodb/model/VirtualField.java b/TestVectors/runtimes/java/src/main/smithy-generated/software/amazon/cryptography/dbencryptionsdk/dynamodb/model/VirtualField.java deleted file mode 100644 index 55fbeaad5..000000000 --- a/TestVectors/runtimes/java/src/main/smithy-generated/software/amazon/cryptography/dbencryptionsdk/dynamodb/model/VirtualField.java +++ /dev/null @@ -1,118 +0,0 @@ -// Copyright Amazon.com Inc. or its affiliates. All Rights Reserved. -// SPDX-License-Identifier: Apache-2.0 -// Do not modify this file. This file is machine generated, and any changes to it will be overwritten. -package software.amazon.cryptography.dbencryptionsdk.dynamodb.model; - -import java.util.List; -import java.util.Objects; - -/** - * The configuration for a Virtual Field. A Virtual Field is a field constructed from parts of other fields for use with beacons, but never itself stored on items. - */ -public class VirtualField { - /** - * The name of the Virtual Field. - */ - private final String name; - - /** - * The list of ordered parts that make up a Virtual Field. - */ - private final List parts; - - protected VirtualField(BuilderImpl builder) { - this.name = builder.name(); - this.parts = builder.parts(); - } - - /** - * @return The name of the Virtual Field. - */ - public String name() { - return this.name; - } - - /** - * @return The list of ordered parts that make up a Virtual Field. - */ - public List parts() { - return this.parts; - } - - public Builder toBuilder() { - return new BuilderImpl(this); - } - - public static Builder builder() { - return new BuilderImpl(); - } - - public interface Builder { - /** - * @param name The name of the Virtual Field. - */ - Builder name(String name); - - /** - * @return The name of the Virtual Field. - */ - String name(); - - /** - * @param parts The list of ordered parts that make up a Virtual Field. - */ - Builder parts(List parts); - - /** - * @return The list of ordered parts that make up a Virtual Field. - */ - List parts(); - - VirtualField build(); - } - - static class BuilderImpl implements Builder { - protected String name; - - protected List parts; - - protected BuilderImpl() { - } - - protected BuilderImpl(VirtualField model) { - this.name = model.name(); - this.parts = model.parts(); - } - - public Builder name(String name) { - this.name = name; - return this; - } - - public String name() { - return this.name; - } - - public Builder parts(List parts) { - this.parts = parts; - return this; - } - - public List parts() { - return this.parts; - } - - public VirtualField build() { - if (Objects.isNull(this.name())) { - throw new IllegalArgumentException("Missing value for required field `name`"); - } - if (Objects.isNull(this.parts())) { - throw new IllegalArgumentException("Missing value for required field `parts`"); - } - if (Objects.nonNull(this.parts()) && this.parts().size() < 1) { - throw new IllegalArgumentException("The size of `parts` must be greater than or equal to 1"); - } - return new VirtualField(this); - } - } -} diff --git a/TestVectors/runtimes/java/src/main/smithy-generated/software/amazon/cryptography/dbencryptionsdk/dynamodb/model/VirtualPart.java b/TestVectors/runtimes/java/src/main/smithy-generated/software/amazon/cryptography/dbencryptionsdk/dynamodb/model/VirtualPart.java deleted file mode 100644 index 0f92bc95d..000000000 --- a/TestVectors/runtimes/java/src/main/smithy-generated/software/amazon/cryptography/dbencryptionsdk/dynamodb/model/VirtualPart.java +++ /dev/null @@ -1,118 +0,0 @@ -// Copyright Amazon.com Inc. or its affiliates. All Rights Reserved. -// SPDX-License-Identifier: Apache-2.0 -// Do not modify this file. This file is machine generated, and any changes to it will be overwritten. -package software.amazon.cryptography.dbencryptionsdk.dynamodb.model; - -import java.util.List; -import java.util.Objects; - -/** - * A Virtual Part is the configuration of a transformation on an existing field in an item. - */ -public class VirtualPart { - /** - * The DynamoDB document path to the value for this part. - */ - private final String loc; - - /** - * A list of transformations performed on the value for this part. - */ - private final List trans; - - protected VirtualPart(BuilderImpl builder) { - this.loc = builder.loc(); - this.trans = builder.trans(); - } - - /** - * @return The DynamoDB document path to the value for this part. - */ - public String loc() { - return this.loc; - } - - /** - * @return A list of transformations performed on the value for this part. - */ - public List trans() { - return this.trans; - } - - public Builder toBuilder() { - return new BuilderImpl(this); - } - - public static Builder builder() { - return new BuilderImpl(); - } - - public interface Builder { - /** - * @param loc The DynamoDB document path to the value for this part. - */ - Builder loc(String loc); - - /** - * @return The DynamoDB document path to the value for this part. - */ - String loc(); - - /** - * @param trans A list of transformations performed on the value for this part. - */ - Builder trans(List trans); - - /** - * @return A list of transformations performed on the value for this part. - */ - List trans(); - - VirtualPart build(); - } - - static class BuilderImpl implements Builder { - protected String loc; - - protected List trans; - - protected BuilderImpl() { - } - - protected BuilderImpl(VirtualPart model) { - this.loc = model.loc(); - this.trans = model.trans(); - } - - public Builder loc(String loc) { - this.loc = loc; - return this; - } - - public String loc() { - return this.loc; - } - - public Builder trans(List trans) { - this.trans = trans; - return this; - } - - public List trans() { - return this.trans; - } - - public VirtualPart build() { - if (Objects.isNull(this.loc())) { - throw new IllegalArgumentException("Missing value for required field `loc`"); - } - if (Objects.nonNull(this.loc()) && this.loc().length() < 1) { - throw new IllegalArgumentException("The size of `loc` must be greater than or equal to 1"); - } - if (Objects.nonNull(this.trans()) && this.trans().size() < 1) { - throw new IllegalArgumentException("The size of `trans` must be greater than or equal to 1"); - } - return new VirtualPart(this); - } - } -} diff --git a/TestVectors/runtimes/java/src/main/smithy-generated/software/amazon/cryptography/dbencryptionsdk/dynamodb/model/VirtualTransform.java b/TestVectors/runtimes/java/src/main/smithy-generated/software/amazon/cryptography/dbencryptionsdk/dynamodb/model/VirtualTransform.java deleted file mode 100644 index 84d29ea14..000000000 --- a/TestVectors/runtimes/java/src/main/smithy-generated/software/amazon/cryptography/dbencryptionsdk/dynamodb/model/VirtualTransform.java +++ /dev/null @@ -1,332 +0,0 @@ -// Copyright Amazon.com Inc. or its affiliates. All Rights Reserved. -// SPDX-License-Identifier: Apache-2.0 -// Do not modify this file. This file is machine generated, and any changes to it will be overwritten. -package software.amazon.cryptography.dbencryptionsdk.dynamodb.model; - -import java.util.Objects; - -public class VirtualTransform { - /** - * The Virtual Part Transformation that converts ASCII characters to upper case. - */ - private final Upper upper; - - /** - * The Virtual Part Transformation that converts ASCII characters to lower case. - */ - private final Lower lower; - - /** - * The Virtual Part Transformation that appends a literal string. - */ - private final Insert insert; - - /** - * The Virtual Part Transformation that gets the prefix of a string. - */ - private final GetPrefix prefix; - - /** - * The Virtual Part Transformation that gets the suffix of a string. - */ - private final GetSuffix suffix; - - /** - * The Virtual Part Transformation that gets a substring from a string. - */ - private final GetSubstring substring; - - /** - * The Virtual Part Transformation that splits a string and gets a particular segment of that split. - */ - private final GetSegment segment; - - /** - * The Virtual Part Transformation that splits a string and gets a range of segments of that split. - */ - private final GetSegments segments; - - protected VirtualTransform(BuilderImpl builder) { - this.upper = builder.upper(); - this.lower = builder.lower(); - this.insert = builder.insert(); - this.prefix = builder.prefix(); - this.suffix = builder.suffix(); - this.substring = builder.substring(); - this.segment = builder.segment(); - this.segments = builder.segments(); - } - - /** - * @return The Virtual Part Transformation that converts ASCII characters to upper case. - */ - public Upper upper() { - return this.upper; - } - - /** - * @return The Virtual Part Transformation that converts ASCII characters to lower case. - */ - public Lower lower() { - return this.lower; - } - - /** - * @return The Virtual Part Transformation that appends a literal string. - */ - public Insert insert() { - return this.insert; - } - - /** - * @return The Virtual Part Transformation that gets the prefix of a string. - */ - public GetPrefix prefix() { - return this.prefix; - } - - /** - * @return The Virtual Part Transformation that gets the suffix of a string. - */ - public GetSuffix suffix() { - return this.suffix; - } - - /** - * @return The Virtual Part Transformation that gets a substring from a string. - */ - public GetSubstring substring() { - return this.substring; - } - - /** - * @return The Virtual Part Transformation that splits a string and gets a particular segment of that split. - */ - public GetSegment segment() { - return this.segment; - } - - /** - * @return The Virtual Part Transformation that splits a string and gets a range of segments of that split. - */ - public GetSegments segments() { - return this.segments; - } - - public Builder toBuilder() { - return new BuilderImpl(this); - } - - public static Builder builder() { - return new BuilderImpl(); - } - - public interface Builder { - /** - * @param upper The Virtual Part Transformation that converts ASCII characters to upper case. - */ - Builder upper(Upper upper); - - /** - * @return The Virtual Part Transformation that converts ASCII characters to upper case. - */ - Upper upper(); - - /** - * @param lower The Virtual Part Transformation that converts ASCII characters to lower case. - */ - Builder lower(Lower lower); - - /** - * @return The Virtual Part Transformation that converts ASCII characters to lower case. - */ - Lower lower(); - - /** - * @param insert The Virtual Part Transformation that appends a literal string. - */ - Builder insert(Insert insert); - - /** - * @return The Virtual Part Transformation that appends a literal string. - */ - Insert insert(); - - /** - * @param prefix The Virtual Part Transformation that gets the prefix of a string. - */ - Builder prefix(GetPrefix prefix); - - /** - * @return The Virtual Part Transformation that gets the prefix of a string. - */ - GetPrefix prefix(); - - /** - * @param suffix The Virtual Part Transformation that gets the suffix of a string. - */ - Builder suffix(GetSuffix suffix); - - /** - * @return The Virtual Part Transformation that gets the suffix of a string. - */ - GetSuffix suffix(); - - /** - * @param substring The Virtual Part Transformation that gets a substring from a string. - */ - Builder substring(GetSubstring substring); - - /** - * @return The Virtual Part Transformation that gets a substring from a string. - */ - GetSubstring substring(); - - /** - * @param segment The Virtual Part Transformation that splits a string and gets a particular segment of that split. - */ - Builder segment(GetSegment segment); - - /** - * @return The Virtual Part Transformation that splits a string and gets a particular segment of that split. - */ - GetSegment segment(); - - /** - * @param segments The Virtual Part Transformation that splits a string and gets a range of segments of that split. - */ - Builder segments(GetSegments segments); - - /** - * @return The Virtual Part Transformation that splits a string and gets a range of segments of that split. - */ - GetSegments segments(); - - VirtualTransform build(); - } - - static class BuilderImpl implements Builder { - protected Upper upper; - - protected Lower lower; - - protected Insert insert; - - protected GetPrefix prefix; - - protected GetSuffix suffix; - - protected GetSubstring substring; - - protected GetSegment segment; - - protected GetSegments segments; - - protected BuilderImpl() { - } - - protected BuilderImpl(VirtualTransform model) { - this.upper = model.upper(); - this.lower = model.lower(); - this.insert = model.insert(); - this.prefix = model.prefix(); - this.suffix = model.suffix(); - this.substring = model.substring(); - this.segment = model.segment(); - this.segments = model.segments(); - } - - public Builder upper(Upper upper) { - this.upper = upper; - return this; - } - - public Upper upper() { - return this.upper; - } - - public Builder lower(Lower lower) { - this.lower = lower; - return this; - } - - public Lower lower() { - return this.lower; - } - - public Builder insert(Insert insert) { - this.insert = insert; - return this; - } - - public Insert insert() { - return this.insert; - } - - public Builder prefix(GetPrefix prefix) { - this.prefix = prefix; - return this; - } - - public GetPrefix prefix() { - return this.prefix; - } - - public Builder suffix(GetSuffix suffix) { - this.suffix = suffix; - return this; - } - - public GetSuffix suffix() { - return this.suffix; - } - - public Builder substring(GetSubstring substring) { - this.substring = substring; - return this; - } - - public GetSubstring substring() { - return this.substring; - } - - public Builder segment(GetSegment segment) { - this.segment = segment; - return this; - } - - public GetSegment segment() { - return this.segment; - } - - public Builder segments(GetSegments segments) { - this.segments = segments; - return this; - } - - public GetSegments segments() { - return this.segments; - } - - public VirtualTransform build() { - if (!onlyOneNonNull()) { - throw new IllegalArgumentException("`VirtualTransform` is a Union. A Union MUST have one and only one value set."); - } - return new VirtualTransform(this); - } - - private boolean onlyOneNonNull() { - Object[] allValues = {this.upper, this.lower, this.insert, this.prefix, this.suffix, this.substring, this.segment, this.segments}; - boolean haveOneNonNull = false; - for (Object o : allValues) { - if (Objects.nonNull(o)) { - if (haveOneNonNull) { - return false; - } - haveOneNonNull = true; - } - } - return haveOneNonNull; - } - } -} diff --git a/TestVectors/runtimes/net/Generated/DDBEncryption/AsSet.cs b/TestVectors/runtimes/net/Generated/DDBEncryption/AsSet.cs deleted file mode 100644 index d565d1965..000000000 --- a/TestVectors/runtimes/net/Generated/DDBEncryption/AsSet.cs +++ /dev/null @@ -1,13 +0,0 @@ -// Copyright Amazon.com Inc. or its affiliates. All Rights Reserved. -// SPDX-License-Identifier: Apache-2.0 -// Do not modify this file. This file is machine generated, and any changes to it will be overwritten. -using System; - using AWS.Cryptography.DbEncryptionSDK.DynamoDb; namespace AWS.Cryptography.DbEncryptionSDK.DynamoDb { - public class AsSet { - - - public void Validate() { - -} -} -} diff --git a/TestVectors/runtimes/net/Generated/DDBEncryption/BeaconKeySource.cs b/TestVectors/runtimes/net/Generated/DDBEncryption/BeaconKeySource.cs deleted file mode 100644 index e9ab915de..000000000 --- a/TestVectors/runtimes/net/Generated/DDBEncryption/BeaconKeySource.cs +++ /dev/null @@ -1,32 +0,0 @@ -// Copyright Amazon.com Inc. or its affiliates. All Rights Reserved. -// SPDX-License-Identifier: Apache-2.0 -// Do not modify this file. This file is machine generated, and any changes to it will be overwritten. -using System; - using AWS.Cryptography.DbEncryptionSDK.DynamoDb; namespace AWS.Cryptography.DbEncryptionSDK.DynamoDb { - public class BeaconKeySource { - private AWS.Cryptography.DbEncryptionSDK.DynamoDb.SingleKeyStore _single ; - private AWS.Cryptography.DbEncryptionSDK.DynamoDb.MultiKeyStore _multi ; - public AWS.Cryptography.DbEncryptionSDK.DynamoDb.SingleKeyStore Single { - get { return this._single; } - set { this._single = value; } -} - public bool IsSetSingle () { - return this._single != null; -} - public AWS.Cryptography.DbEncryptionSDK.DynamoDb.MultiKeyStore Multi { - get { return this._multi; } - set { this._multi = value; } -} - public bool IsSetMulti () { - return this._multi != null; -} - public void Validate() { - var numberOfPropertiesSet = Convert.ToUInt16(IsSetSingle()) + - Convert.ToUInt16(IsSetMulti()) ; - if (numberOfPropertiesSet == 0) throw new System.ArgumentException("No union value set"); - - if (numberOfPropertiesSet > 1) throw new System.ArgumentException("Multiple union values set"); - -} -} -} diff --git a/TestVectors/runtimes/net/Generated/DDBEncryption/BeaconStyle.cs b/TestVectors/runtimes/net/Generated/DDBEncryption/BeaconStyle.cs deleted file mode 100644 index a3cfa70f5..000000000 --- a/TestVectors/runtimes/net/Generated/DDBEncryption/BeaconStyle.cs +++ /dev/null @@ -1,50 +0,0 @@ -// Copyright Amazon.com Inc. or its affiliates. All Rights Reserved. -// SPDX-License-Identifier: Apache-2.0 -// Do not modify this file. This file is machine generated, and any changes to it will be overwritten. -using System; - using AWS.Cryptography.DbEncryptionSDK.DynamoDb; namespace AWS.Cryptography.DbEncryptionSDK.DynamoDb { - public class BeaconStyle { - private AWS.Cryptography.DbEncryptionSDK.DynamoDb.PartOnly _partOnly ; - private AWS.Cryptography.DbEncryptionSDK.DynamoDb.Shared _shared ; - private AWS.Cryptography.DbEncryptionSDK.DynamoDb.AsSet _asSet ; - private AWS.Cryptography.DbEncryptionSDK.DynamoDb.SharedSet _sharedSet ; - public AWS.Cryptography.DbEncryptionSDK.DynamoDb.PartOnly PartOnly { - get { return this._partOnly; } - set { this._partOnly = value; } -} - public bool IsSetPartOnly () { - return this._partOnly != null; -} - public AWS.Cryptography.DbEncryptionSDK.DynamoDb.Shared Shared { - get { return this._shared; } - set { this._shared = value; } -} - public bool IsSetShared () { - return this._shared != null; -} - public AWS.Cryptography.DbEncryptionSDK.DynamoDb.AsSet AsSet { - get { return this._asSet; } - set { this._asSet = value; } -} - public bool IsSetAsSet () { - return this._asSet != null; -} - public AWS.Cryptography.DbEncryptionSDK.DynamoDb.SharedSet SharedSet { - get { return this._sharedSet; } - set { this._sharedSet = value; } -} - public bool IsSetSharedSet () { - return this._sharedSet != null; -} - public void Validate() { - var numberOfPropertiesSet = Convert.ToUInt16(IsSetPartOnly()) + - Convert.ToUInt16(IsSetShared()) + - Convert.ToUInt16(IsSetAsSet()) + - Convert.ToUInt16(IsSetSharedSet()) ; - if (numberOfPropertiesSet == 0) throw new System.ArgumentException("No union value set"); - - if (numberOfPropertiesSet > 1) throw new System.ArgumentException("Multiple union values set"); - -} -} -} diff --git a/TestVectors/runtimes/net/Generated/DDBEncryption/BeaconVersion.cs b/TestVectors/runtimes/net/Generated/DDBEncryption/BeaconVersion.cs deleted file mode 100644 index c3b66814d..000000000 --- a/TestVectors/runtimes/net/Generated/DDBEncryption/BeaconVersion.cs +++ /dev/null @@ -1,79 +0,0 @@ -// Copyright Amazon.com Inc. or its affiliates. All Rights Reserved. -// SPDX-License-Identifier: Apache-2.0 -// Do not modify this file. This file is machine generated, and any changes to it will be overwritten. -using System; - using AWS.Cryptography.DbEncryptionSDK.DynamoDb; namespace AWS.Cryptography.DbEncryptionSDK.DynamoDb { - public class BeaconVersion { - private int? _version ; - private AWS.Cryptography.KeyStore.KeyStore _keyStore ; - private AWS.Cryptography.DbEncryptionSDK.DynamoDb.BeaconKeySource _keySource ; - private System.Collections.Generic.List _standardBeacons ; - private System.Collections.Generic.List _compoundBeacons ; - private System.Collections.Generic.List _virtualFields ; - private System.Collections.Generic.List _encryptedParts ; - private System.Collections.Generic.List _signedParts ; - public int Version { - get { return this._version.GetValueOrDefault(); } - set { this._version = value; } -} - public bool IsSetVersion () { - return this._version.HasValue; -} - public AWS.Cryptography.KeyStore.KeyStore KeyStore { - get { return this._keyStore; } - set { this._keyStore = value; } -} - public bool IsSetKeyStore () { - return this._keyStore != null; -} - public AWS.Cryptography.DbEncryptionSDK.DynamoDb.BeaconKeySource KeySource { - get { return this._keySource; } - set { this._keySource = value; } -} - public bool IsSetKeySource () { - return this._keySource != null; -} - public System.Collections.Generic.List StandardBeacons { - get { return this._standardBeacons; } - set { this._standardBeacons = value; } -} - public bool IsSetStandardBeacons () { - return this._standardBeacons != null; -} - public System.Collections.Generic.List CompoundBeacons { - get { return this._compoundBeacons; } - set { this._compoundBeacons = value; } -} - public bool IsSetCompoundBeacons () { - return this._compoundBeacons != null; -} - public System.Collections.Generic.List VirtualFields { - get { return this._virtualFields; } - set { this._virtualFields = value; } -} - public bool IsSetVirtualFields () { - return this._virtualFields != null; -} - public System.Collections.Generic.List EncryptedParts { - get { return this._encryptedParts; } - set { this._encryptedParts = value; } -} - public bool IsSetEncryptedParts () { - return this._encryptedParts != null; -} - public System.Collections.Generic.List SignedParts { - get { return this._signedParts; } - set { this._signedParts = value; } -} - public bool IsSetSignedParts () { - return this._signedParts != null; -} - public void Validate() { - if (!IsSetVersion()) throw new System.ArgumentException("Missing value for required property 'Version'"); - if (!IsSetKeyStore()) throw new System.ArgumentException("Missing value for required property 'KeyStore'"); - if (!IsSetKeySource()) throw new System.ArgumentException("Missing value for required property 'KeySource'"); - if (!IsSetStandardBeacons()) throw new System.ArgumentException("Missing value for required property 'StandardBeacons'"); - -} -} -} diff --git a/TestVectors/runtimes/net/Generated/DDBEncryption/CollectionOfErrors.cs b/TestVectors/runtimes/net/Generated/DDBEncryption/CollectionOfErrors.cs deleted file mode 100644 index f249d91c7..000000000 --- a/TestVectors/runtimes/net/Generated/DDBEncryption/CollectionOfErrors.cs +++ /dev/null @@ -1,13 +0,0 @@ -// Copyright Amazon.com Inc. or its affiliates. All Rights Reserved. -// SPDX-License-Identifier: Apache-2.0 -// Do not modify this file. This file is machine generated, and any changes to it will be overwritten. -using System; - using AWS.Cryptography.DbEncryptionSDK.DynamoDb; namespace AWS.Cryptography.DbEncryptionSDK.DynamoDb { - public class CollectionOfErrors : Exception { - public readonly System.Collections.Generic.List list; - public CollectionOfErrors(System.Collections.Generic.List list, string message) : base(message) { this.list = list; } - public CollectionOfErrors(string message) : base(message) { this.list = new System.Collections.Generic.List(); } - public CollectionOfErrors() : base("CollectionOfErrors") { this.list = new System.Collections.Generic.List(); } -} - -} diff --git a/TestVectors/runtimes/net/Generated/DDBEncryption/CompoundBeacon.cs b/TestVectors/runtimes/net/Generated/DDBEncryption/CompoundBeacon.cs deleted file mode 100644 index 911a75926..000000000 --- a/TestVectors/runtimes/net/Generated/DDBEncryption/CompoundBeacon.cs +++ /dev/null @@ -1,53 +0,0 @@ -// Copyright Amazon.com Inc. or its affiliates. All Rights Reserved. -// SPDX-License-Identifier: Apache-2.0 -// Do not modify this file. This file is machine generated, and any changes to it will be overwritten. -using System; - using AWS.Cryptography.DbEncryptionSDK.DynamoDb; namespace AWS.Cryptography.DbEncryptionSDK.DynamoDb { - public class CompoundBeacon { - private string _name ; - private string _split ; - private System.Collections.Generic.List _encrypted ; - private System.Collections.Generic.List _signed ; - private System.Collections.Generic.List _constructors ; - public string Name { - get { return this._name; } - set { this._name = value; } -} - public bool IsSetName () { - return this._name != null; -} - public string Split { - get { return this._split; } - set { this._split = value; } -} - public bool IsSetSplit () { - return this._split != null; -} - public System.Collections.Generic.List Encrypted { - get { return this._encrypted; } - set { this._encrypted = value; } -} - public bool IsSetEncrypted () { - return this._encrypted != null; -} - public System.Collections.Generic.List Signed { - get { return this._signed; } - set { this._signed = value; } -} - public bool IsSetSigned () { - return this._signed != null; -} - public System.Collections.Generic.List Constructors { - get { return this._constructors; } - set { this._constructors = value; } -} - public bool IsSetConstructors () { - return this._constructors != null; -} - public void Validate() { - if (!IsSetName()) throw new System.ArgumentException("Missing value for required property 'Name'"); - if (!IsSetSplit()) throw new System.ArgumentException("Missing value for required property 'Split'"); - -} -} -} diff --git a/TestVectors/runtimes/net/Generated/DDBEncryption/Constructor.cs b/TestVectors/runtimes/net/Generated/DDBEncryption/Constructor.cs deleted file mode 100644 index 5a3c39934..000000000 --- a/TestVectors/runtimes/net/Generated/DDBEncryption/Constructor.cs +++ /dev/null @@ -1,20 +0,0 @@ -// Copyright Amazon.com Inc. or its affiliates. All Rights Reserved. -// SPDX-License-Identifier: Apache-2.0 -// Do not modify this file. This file is machine generated, and any changes to it will be overwritten. -using System; - using AWS.Cryptography.DbEncryptionSDK.DynamoDb; namespace AWS.Cryptography.DbEncryptionSDK.DynamoDb { - public class Constructor { - private System.Collections.Generic.List _parts ; - public System.Collections.Generic.List Parts { - get { return this._parts; } - set { this._parts = value; } -} - public bool IsSetParts () { - return this._parts != null; -} - public void Validate() { - if (!IsSetParts()) throw new System.ArgumentException("Missing value for required property 'Parts'"); - -} -} -} diff --git a/TestVectors/runtimes/net/Generated/DDBEncryption/ConstructorPart.cs b/TestVectors/runtimes/net/Generated/DDBEncryption/ConstructorPart.cs deleted file mode 100644 index e773a8133..000000000 --- a/TestVectors/runtimes/net/Generated/DDBEncryption/ConstructorPart.cs +++ /dev/null @@ -1,29 +0,0 @@ -// Copyright Amazon.com Inc. or its affiliates. All Rights Reserved. -// SPDX-License-Identifier: Apache-2.0 -// Do not modify this file. This file is machine generated, and any changes to it will be overwritten. -using System; - using AWS.Cryptography.DbEncryptionSDK.DynamoDb; namespace AWS.Cryptography.DbEncryptionSDK.DynamoDb { - public class ConstructorPart { - private string _name ; - private bool? _required ; - public string Name { - get { return this._name; } - set { this._name = value; } -} - public bool IsSetName () { - return this._name != null; -} - public bool Required { - get { return this._required.GetValueOrDefault(); } - set { this._required = value; } -} - public bool IsSetRequired () { - return this._required.HasValue; -} - public void Validate() { - if (!IsSetName()) throw new System.ArgumentException("Missing value for required property 'Name'"); - if (!IsSetRequired()) throw new System.ArgumentException("Missing value for required property 'Required'"); - -} -} -} diff --git a/TestVectors/runtimes/net/Generated/DDBEncryption/CreateDynamoDbEncryptionBranchKeyIdSupplierInput.cs b/TestVectors/runtimes/net/Generated/DDBEncryption/CreateDynamoDbEncryptionBranchKeyIdSupplierInput.cs deleted file mode 100644 index bd3f96700..000000000 --- a/TestVectors/runtimes/net/Generated/DDBEncryption/CreateDynamoDbEncryptionBranchKeyIdSupplierInput.cs +++ /dev/null @@ -1,20 +0,0 @@ -// Copyright Amazon.com Inc. or its affiliates. All Rights Reserved. -// SPDX-License-Identifier: Apache-2.0 -// Do not modify this file. This file is machine generated, and any changes to it will be overwritten. -using System; - using AWS.Cryptography.DbEncryptionSDK.DynamoDb; namespace AWS.Cryptography.DbEncryptionSDK.DynamoDb { - public class CreateDynamoDbEncryptionBranchKeyIdSupplierInput { - private AWS.Cryptography.DbEncryptionSDK.DynamoDb.IDynamoDbKeyBranchKeyIdSupplier _ddbKeyBranchKeyIdSupplier ; - public AWS.Cryptography.DbEncryptionSDK.DynamoDb.IDynamoDbKeyBranchKeyIdSupplier DdbKeyBranchKeyIdSupplier { - get { return this._ddbKeyBranchKeyIdSupplier; } - set { this._ddbKeyBranchKeyIdSupplier = value; } -} - public bool IsSetDdbKeyBranchKeyIdSupplier () { - return this._ddbKeyBranchKeyIdSupplier != null; -} - public void Validate() { - if (!IsSetDdbKeyBranchKeyIdSupplier()) throw new System.ArgumentException("Missing value for required property 'DdbKeyBranchKeyIdSupplier'"); - -} -} -} diff --git a/TestVectors/runtimes/net/Generated/DDBEncryption/CreateDynamoDbEncryptionBranchKeyIdSupplierOutput.cs b/TestVectors/runtimes/net/Generated/DDBEncryption/CreateDynamoDbEncryptionBranchKeyIdSupplierOutput.cs deleted file mode 100644 index 6765712ae..000000000 --- a/TestVectors/runtimes/net/Generated/DDBEncryption/CreateDynamoDbEncryptionBranchKeyIdSupplierOutput.cs +++ /dev/null @@ -1,20 +0,0 @@ -// Copyright Amazon.com Inc. or its affiliates. All Rights Reserved. -// SPDX-License-Identifier: Apache-2.0 -// Do not modify this file. This file is machine generated, and any changes to it will be overwritten. -using System; - using AWS.Cryptography.DbEncryptionSDK.DynamoDb; namespace AWS.Cryptography.DbEncryptionSDK.DynamoDb { - public class CreateDynamoDbEncryptionBranchKeyIdSupplierOutput { - private AWS.Cryptography.MaterialProviders.IBranchKeyIdSupplier _branchKeyIdSupplier ; - public AWS.Cryptography.MaterialProviders.IBranchKeyIdSupplier BranchKeyIdSupplier { - get { return this._branchKeyIdSupplier; } - set { this._branchKeyIdSupplier = value; } -} - public bool IsSetBranchKeyIdSupplier () { - return this._branchKeyIdSupplier != null; -} - public void Validate() { - if (!IsSetBranchKeyIdSupplier()) throw new System.ArgumentException("Missing value for required property 'BranchKeyIdSupplier'"); - -} -} -} diff --git a/TestVectors/runtimes/net/Generated/DDBEncryption/DynamoDbEncryption.cs b/TestVectors/runtimes/net/Generated/DDBEncryption/DynamoDbEncryption.cs deleted file mode 100644 index 2be057a61..000000000 --- a/TestVectors/runtimes/net/Generated/DDBEncryption/DynamoDbEncryption.cs +++ /dev/null @@ -1,37 +0,0 @@ -// Copyright Amazon.com Inc. or its affiliates. All Rights Reserved. -// SPDX-License-Identifier: Apache-2.0 -// Do not modify this file. This file is machine generated, and any changes to it will be overwritten. -using System; - using System.IO; - using System.Collections.Generic; - using AWS.Cryptography.DbEncryptionSDK.DynamoDb; - using software.amazon.cryptography.dbencryptionsdk.dynamodb.internaldafny.types; namespace AWS.Cryptography.DbEncryptionSDK.DynamoDb { - public class DynamoDbEncryption { - private readonly software.amazon.cryptography.dbencryptionsdk.dynamodb.internaldafny.types.IDynamoDbEncryptionClient _impl; - public DynamoDbEncryption(software.amazon.cryptography.dbencryptionsdk.dynamodb.internaldafny.types.IDynamoDbEncryptionClient impl) { - this._impl = impl; -} - public software.amazon.cryptography.dbencryptionsdk.dynamodb.internaldafny.types.IDynamoDbEncryptionClient impl() { - return this._impl; -} - public DynamoDbEncryption(AWS.Cryptography.DbEncryptionSDK.DynamoDb.DynamoDbEncryptionConfig input) - { - software.amazon.cryptography.dbencryptionsdk.dynamodb.internaldafny.types._IDynamoDbEncryptionConfig internalInput = TypeConversion.ToDafny_N3_aws__N12_cryptography__N15_dbEncryptionSdk__N8_dynamoDb__S24_DynamoDbEncryptionConfig(input); - var result = software.amazon.cryptography.dbencryptionsdk.dynamodb.internaldafny.__default.DynamoDbEncryption(internalInput); - if (result.is_Failure) throw TypeConversion.FromDafny_CommonError(result.dtor_error); - this._impl = result.dtor_value; -} - public AWS.Cryptography.DbEncryptionSDK.DynamoDb.CreateDynamoDbEncryptionBranchKeyIdSupplierOutput CreateDynamoDbEncryptionBranchKeyIdSupplier(AWS.Cryptography.DbEncryptionSDK.DynamoDb.CreateDynamoDbEncryptionBranchKeyIdSupplierInput input) { - software.amazon.cryptography.dbencryptionsdk.dynamodb.internaldafny.types._ICreateDynamoDbEncryptionBranchKeyIdSupplierInput internalInput = TypeConversion.ToDafny_N3_aws__N12_cryptography__N15_dbEncryptionSdk__N8_dynamoDb__S48_CreateDynamoDbEncryptionBranchKeyIdSupplierInput(input); - Wrappers_Compile._IResult result = _impl.CreateDynamoDbEncryptionBranchKeyIdSupplier(internalInput); - if (result.is_Failure) throw TypeConversion.FromDafny_CommonError(result.dtor_error); - return TypeConversion.FromDafny_N3_aws__N12_cryptography__N15_dbEncryptionSdk__N8_dynamoDb__S49_CreateDynamoDbEncryptionBranchKeyIdSupplierOutput(result.dtor_value); -} - public AWS.Cryptography.DbEncryptionSDK.DynamoDb.GetEncryptedDataKeyDescriptionOutput GetEncryptedDataKeyDescription(AWS.Cryptography.DbEncryptionSDK.DynamoDb.GetEncryptedDataKeyDescriptionInput input) { - software.amazon.cryptography.dbencryptionsdk.dynamodb.internaldafny.types._IGetEncryptedDataKeyDescriptionInput internalInput = TypeConversion.ToDafny_N3_aws__N12_cryptography__N15_dbEncryptionSdk__N8_dynamoDb__S35_GetEncryptedDataKeyDescriptionInput(input); - Wrappers_Compile._IResult result = _impl.GetEncryptedDataKeyDescription(internalInput); - if (result.is_Failure) throw TypeConversion.FromDafny_CommonError(result.dtor_error); - return TypeConversion.FromDafny_N3_aws__N12_cryptography__N15_dbEncryptionSdk__N8_dynamoDb__S36_GetEncryptedDataKeyDescriptionOutput(result.dtor_value); -} -} -} diff --git a/TestVectors/runtimes/net/Generated/DDBEncryption/DynamoDbEncryptionConfig.cs b/TestVectors/runtimes/net/Generated/DDBEncryption/DynamoDbEncryptionConfig.cs deleted file mode 100644 index d79b232c3..000000000 --- a/TestVectors/runtimes/net/Generated/DDBEncryption/DynamoDbEncryptionConfig.cs +++ /dev/null @@ -1,13 +0,0 @@ -// Copyright Amazon.com Inc. or its affiliates. All Rights Reserved. -// SPDX-License-Identifier: Apache-2.0 -// Do not modify this file. This file is machine generated, and any changes to it will be overwritten. -using System; - using AWS.Cryptography.DbEncryptionSDK.DynamoDb; namespace AWS.Cryptography.DbEncryptionSDK.DynamoDb { - public class DynamoDbEncryptionConfig { - - - public void Validate() { - -} -} -} diff --git a/TestVectors/runtimes/net/Generated/DDBEncryption/DynamoDbEncryptionException.cs b/TestVectors/runtimes/net/Generated/DDBEncryption/DynamoDbEncryptionException.cs deleted file mode 100644 index 7f575c46c..000000000 --- a/TestVectors/runtimes/net/Generated/DDBEncryption/DynamoDbEncryptionException.cs +++ /dev/null @@ -1,10 +0,0 @@ -// Copyright Amazon.com Inc. or its affiliates. All Rights Reserved. -// SPDX-License-Identifier: Apache-2.0 -// Do not modify this file. This file is machine generated, and any changes to it will be overwritten. -using System; - using AWS.Cryptography.DbEncryptionSDK.DynamoDb; namespace AWS.Cryptography.DbEncryptionSDK.DynamoDb { - public class DynamoDbEncryptionException : Exception { - public DynamoDbEncryptionException(string message) : base(message) {} -public string getMessage() { return this.Message; } -} -} diff --git a/TestVectors/runtimes/net/Generated/DDBEncryption/DynamoDbKeyBranchKeyIdSupplier.cs b/TestVectors/runtimes/net/Generated/DDBEncryption/DynamoDbKeyBranchKeyIdSupplier.cs deleted file mode 100644 index d2985193e..000000000 --- a/TestVectors/runtimes/net/Generated/DDBEncryption/DynamoDbKeyBranchKeyIdSupplier.cs +++ /dev/null @@ -1,19 +0,0 @@ -// Copyright Amazon.com Inc. or its affiliates. All Rights Reserved. -// SPDX-License-Identifier: Apache-2.0 -// Do not modify this file. This file is machine generated, and any changes to it will be overwritten. -using System; - using System.IO; - using System.Collections.Generic; - using AWS.Cryptography.DbEncryptionSDK.DynamoDb; - using software.amazon.cryptography.dbencryptionsdk.dynamodb.internaldafny.types; namespace AWS.Cryptography.DbEncryptionSDK.DynamoDb { - internal class DynamoDbKeyBranchKeyIdSupplier : DynamoDbKeyBranchKeyIdSupplierBase { - internal readonly software.amazon.cryptography.dbencryptionsdk.dynamodb.internaldafny.types.IDynamoDbKeyBranchKeyIdSupplier _impl; - internal DynamoDbKeyBranchKeyIdSupplier(software.amazon.cryptography.dbencryptionsdk.dynamodb.internaldafny.types.IDynamoDbKeyBranchKeyIdSupplier impl) { this._impl = impl; } - protected override AWS.Cryptography.DbEncryptionSDK.DynamoDb.GetBranchKeyIdFromDdbKeyOutput _GetBranchKeyIdFromDdbKey(AWS.Cryptography.DbEncryptionSDK.DynamoDb.GetBranchKeyIdFromDdbKeyInput input) { - software.amazon.cryptography.dbencryptionsdk.dynamodb.internaldafny.types._IGetBranchKeyIdFromDdbKeyInput internalInput = TypeConversion.ToDafny_N3_aws__N12_cryptography__N15_dbEncryptionSdk__N8_dynamoDb__S29_GetBranchKeyIdFromDdbKeyInput(input); - Wrappers_Compile._IResult result = this._impl.GetBranchKeyIdFromDdbKey(internalInput); - if (result.is_Failure) throw TypeConversion.FromDafny_CommonError(result.dtor_error); - return TypeConversion.FromDafny_N3_aws__N12_cryptography__N15_dbEncryptionSdk__N8_dynamoDb__S30_GetBranchKeyIdFromDdbKeyOutput(result.dtor_value); -} -} -} diff --git a/TestVectors/runtimes/net/Generated/DDBEncryption/DynamoDbKeyBranchKeyIdSupplierBase.cs b/TestVectors/runtimes/net/Generated/DDBEncryption/DynamoDbKeyBranchKeyIdSupplierBase.cs deleted file mode 100644 index cc95ae57b..000000000 --- a/TestVectors/runtimes/net/Generated/DDBEncryption/DynamoDbKeyBranchKeyIdSupplierBase.cs +++ /dev/null @@ -1,13 +0,0 @@ -// Copyright Amazon.com Inc. or its affiliates. All Rights Reserved. -// SPDX-License-Identifier: Apache-2.0 -// Do not modify this file. This file is machine generated, and any changes to it will be overwritten. -using System; - using AWS.Cryptography.DbEncryptionSDK.DynamoDb; namespace AWS.Cryptography.DbEncryptionSDK.DynamoDb { - public abstract class DynamoDbKeyBranchKeyIdSupplierBase : IDynamoDbKeyBranchKeyIdSupplier { - public AWS.Cryptography.DbEncryptionSDK.DynamoDb.GetBranchKeyIdFromDdbKeyOutput GetBranchKeyIdFromDdbKey ( AWS.Cryptography.DbEncryptionSDK.DynamoDb.GetBranchKeyIdFromDdbKeyInput input ) - { - input.Validate(); return _GetBranchKeyIdFromDdbKey ( input ) ; -} - protected abstract AWS.Cryptography.DbEncryptionSDK.DynamoDb.GetBranchKeyIdFromDdbKeyOutput _GetBranchKeyIdFromDdbKey ( AWS.Cryptography.DbEncryptionSDK.DynamoDb.GetBranchKeyIdFromDdbKeyInput input ) ; -} -} diff --git a/TestVectors/runtimes/net/Generated/DDBEncryption/DynamoDbTableEncryptionConfig.cs b/TestVectors/runtimes/net/Generated/DDBEncryption/DynamoDbTableEncryptionConfig.cs deleted file mode 100644 index e9fa06001..000000000 --- a/TestVectors/runtimes/net/Generated/DDBEncryption/DynamoDbTableEncryptionConfig.cs +++ /dev/null @@ -1,110 +0,0 @@ -// Copyright Amazon.com Inc. or its affiliates. All Rights Reserved. -// SPDX-License-Identifier: Apache-2.0 -// Do not modify this file. This file is machine generated, and any changes to it will be overwritten. -using System; - using AWS.Cryptography.DbEncryptionSDK.DynamoDb; namespace AWS.Cryptography.DbEncryptionSDK.DynamoDb { - public class DynamoDbTableEncryptionConfig { - private string _logicalTableName ; - private string _partitionKeyName ; - private string _sortKeyName ; - private AWS.Cryptography.DbEncryptionSDK.DynamoDb.SearchConfig _search ; - private System.Collections.Generic.Dictionary _attributeActionsOnEncrypt ; - private System.Collections.Generic.List _allowedUnsignedAttributes ; - private string _allowedUnsignedAttributePrefix ; - private AWS.Cryptography.MaterialProviders.DBEAlgorithmSuiteId _algorithmSuiteId ; - private AWS.Cryptography.MaterialProviders.IKeyring _keyring ; - private AWS.Cryptography.MaterialProviders.ICryptographicMaterialsManager _cmm ; - private AWS.Cryptography.DbEncryptionSDK.DynamoDb.LegacyOverride _legacyOverride ; - private AWS.Cryptography.DbEncryptionSDK.DynamoDb.PlaintextOverride _plaintextOverride ; - public string LogicalTableName { - get { return this._logicalTableName; } - set { this._logicalTableName = value; } -} - public bool IsSetLogicalTableName () { - return this._logicalTableName != null; -} - public string PartitionKeyName { - get { return this._partitionKeyName; } - set { this._partitionKeyName = value; } -} - public bool IsSetPartitionKeyName () { - return this._partitionKeyName != null; -} - public string SortKeyName { - get { return this._sortKeyName; } - set { this._sortKeyName = value; } -} - public bool IsSetSortKeyName () { - return this._sortKeyName != null; -} - public AWS.Cryptography.DbEncryptionSDK.DynamoDb.SearchConfig Search { - get { return this._search; } - set { this._search = value; } -} - public bool IsSetSearch () { - return this._search != null; -} - public System.Collections.Generic.Dictionary AttributeActionsOnEncrypt { - get { return this._attributeActionsOnEncrypt; } - set { this._attributeActionsOnEncrypt = value; } -} - public bool IsSetAttributeActionsOnEncrypt () { - return this._attributeActionsOnEncrypt != null; -} - public System.Collections.Generic.List AllowedUnsignedAttributes { - get { return this._allowedUnsignedAttributes; } - set { this._allowedUnsignedAttributes = value; } -} - public bool IsSetAllowedUnsignedAttributes () { - return this._allowedUnsignedAttributes != null; -} - public string AllowedUnsignedAttributePrefix { - get { return this._allowedUnsignedAttributePrefix; } - set { this._allowedUnsignedAttributePrefix = value; } -} - public bool IsSetAllowedUnsignedAttributePrefix () { - return this._allowedUnsignedAttributePrefix != null; -} - public AWS.Cryptography.MaterialProviders.DBEAlgorithmSuiteId AlgorithmSuiteId { - get { return this._algorithmSuiteId; } - set { this._algorithmSuiteId = value; } -} - public bool IsSetAlgorithmSuiteId () { - return this._algorithmSuiteId != null; -} - public AWS.Cryptography.MaterialProviders.IKeyring Keyring { - get { return this._keyring; } - set { this._keyring = value; } -} - public bool IsSetKeyring () { - return this._keyring != null; -} - public AWS.Cryptography.MaterialProviders.ICryptographicMaterialsManager Cmm { - get { return this._cmm; } - set { this._cmm = value; } -} - public bool IsSetCmm () { - return this._cmm != null; -} - public AWS.Cryptography.DbEncryptionSDK.DynamoDb.LegacyOverride LegacyOverride { - get { return this._legacyOverride; } - set { this._legacyOverride = value; } -} - public bool IsSetLegacyOverride () { - return this._legacyOverride != null; -} - public AWS.Cryptography.DbEncryptionSDK.DynamoDb.PlaintextOverride PlaintextOverride { - get { return this._plaintextOverride; } - set { this._plaintextOverride = value; } -} - public bool IsSetPlaintextOverride () { - return this._plaintextOverride != null; -} - public void Validate() { - if (!IsSetLogicalTableName()) throw new System.ArgumentException("Missing value for required property 'LogicalTableName'"); - if (!IsSetPartitionKeyName()) throw new System.ArgumentException("Missing value for required property 'PartitionKeyName'"); - if (!IsSetAttributeActionsOnEncrypt()) throw new System.ArgumentException("Missing value for required property 'AttributeActionsOnEncrypt'"); - -} -} -} diff --git a/TestVectors/runtimes/net/Generated/DDBEncryption/DynamoDbTablesEncryptionConfig.cs b/TestVectors/runtimes/net/Generated/DDBEncryption/DynamoDbTablesEncryptionConfig.cs deleted file mode 100644 index d78449ab7..000000000 --- a/TestVectors/runtimes/net/Generated/DDBEncryption/DynamoDbTablesEncryptionConfig.cs +++ /dev/null @@ -1,20 +0,0 @@ -// Copyright Amazon.com Inc. or its affiliates. All Rights Reserved. -// SPDX-License-Identifier: Apache-2.0 -// Do not modify this file. This file is machine generated, and any changes to it will be overwritten. -using System; - using AWS.Cryptography.DbEncryptionSDK.DynamoDb; namespace AWS.Cryptography.DbEncryptionSDK.DynamoDb { - public class DynamoDbTablesEncryptionConfig { - private System.Collections.Generic.Dictionary _tableEncryptionConfigs ; - public System.Collections.Generic.Dictionary TableEncryptionConfigs { - get { return this._tableEncryptionConfigs; } - set { this._tableEncryptionConfigs = value; } -} - public bool IsSetTableEncryptionConfigs () { - return this._tableEncryptionConfigs != null; -} - public void Validate() { - if (!IsSetTableEncryptionConfigs()) throw new System.ArgumentException("Missing value for required property 'TableEncryptionConfigs'"); - -} -} -} diff --git a/TestVectors/runtimes/net/Generated/DDBEncryption/EncryptedDataKeyDescriptionOutput.cs b/TestVectors/runtimes/net/Generated/DDBEncryption/EncryptedDataKeyDescriptionOutput.cs deleted file mode 100644 index 7e021e4b1..000000000 --- a/TestVectors/runtimes/net/Generated/DDBEncryption/EncryptedDataKeyDescriptionOutput.cs +++ /dev/null @@ -1,44 +0,0 @@ -// Copyright Amazon.com Inc. or its affiliates. All Rights Reserved. -// SPDX-License-Identifier: Apache-2.0 -// Do not modify this file. This file is machine generated, and any changes to it will be overwritten. -using System; - using AWS.Cryptography.DbEncryptionSDK.DynamoDb; namespace AWS.Cryptography.DbEncryptionSDK.DynamoDb { - public class EncryptedDataKeyDescriptionOutput { - private string _keyProviderId ; - private string _keyProviderInfo ; - private string _branchKeyId ; - private string _branchKeyVersion ; - public string KeyProviderId { - get { return this._keyProviderId; } - set { this._keyProviderId = value; } -} - public bool IsSetKeyProviderId () { - return this._keyProviderId != null; -} - public string KeyProviderInfo { - get { return this._keyProviderInfo; } - set { this._keyProviderInfo = value; } -} - public bool IsSetKeyProviderInfo () { - return this._keyProviderInfo != null; -} - public string BranchKeyId { - get { return this._branchKeyId; } - set { this._branchKeyId = value; } -} - public bool IsSetBranchKeyId () { - return this._branchKeyId != null; -} - public string BranchKeyVersion { - get { return this._branchKeyVersion; } - set { this._branchKeyVersion = value; } -} - public bool IsSetBranchKeyVersion () { - return this._branchKeyVersion != null; -} - public void Validate() { - if (!IsSetKeyProviderId()) throw new System.ArgumentException("Missing value for required property 'KeyProviderId'"); - -} -} -} diff --git a/TestVectors/runtimes/net/Generated/DDBEncryption/EncryptedPart.cs b/TestVectors/runtimes/net/Generated/DDBEncryption/EncryptedPart.cs deleted file mode 100644 index f07ef4833..000000000 --- a/TestVectors/runtimes/net/Generated/DDBEncryption/EncryptedPart.cs +++ /dev/null @@ -1,29 +0,0 @@ -// Copyright Amazon.com Inc. or its affiliates. All Rights Reserved. -// SPDX-License-Identifier: Apache-2.0 -// Do not modify this file. This file is machine generated, and any changes to it will be overwritten. -using System; - using AWS.Cryptography.DbEncryptionSDK.DynamoDb; namespace AWS.Cryptography.DbEncryptionSDK.DynamoDb { - public class EncryptedPart { - private string _name ; - private string _prefix ; - public string Name { - get { return this._name; } - set { this._name = value; } -} - public bool IsSetName () { - return this._name != null; -} - public string Prefix { - get { return this._prefix; } - set { this._prefix = value; } -} - public bool IsSetPrefix () { - return this._prefix != null; -} - public void Validate() { - if (!IsSetName()) throw new System.ArgumentException("Missing value for required property 'Name'"); - if (!IsSetPrefix()) throw new System.ArgumentException("Missing value for required property 'Prefix'"); - -} -} -} diff --git a/TestVectors/runtimes/net/Generated/DDBEncryption/GetBranchKeyIdFromDdbKeyInput.cs b/TestVectors/runtimes/net/Generated/DDBEncryption/GetBranchKeyIdFromDdbKeyInput.cs deleted file mode 100644 index e28ddcfad..000000000 --- a/TestVectors/runtimes/net/Generated/DDBEncryption/GetBranchKeyIdFromDdbKeyInput.cs +++ /dev/null @@ -1,20 +0,0 @@ -// Copyright Amazon.com Inc. or its affiliates. All Rights Reserved. -// SPDX-License-Identifier: Apache-2.0 -// Do not modify this file. This file is machine generated, and any changes to it will be overwritten. -using System; - using AWS.Cryptography.DbEncryptionSDK.DynamoDb; namespace AWS.Cryptography.DbEncryptionSDK.DynamoDb { - public class GetBranchKeyIdFromDdbKeyInput { - private System.Collections.Generic.Dictionary _ddbKey ; - public System.Collections.Generic.Dictionary DdbKey { - get { return this._ddbKey; } - set { this._ddbKey = value; } -} - public bool IsSetDdbKey () { - return this._ddbKey != null; -} - public void Validate() { - if (!IsSetDdbKey()) throw new System.ArgumentException("Missing value for required property 'DdbKey'"); - -} -} -} diff --git a/TestVectors/runtimes/net/Generated/DDBEncryption/GetBranchKeyIdFromDdbKeyOutput.cs b/TestVectors/runtimes/net/Generated/DDBEncryption/GetBranchKeyIdFromDdbKeyOutput.cs deleted file mode 100644 index 1f980339d..000000000 --- a/TestVectors/runtimes/net/Generated/DDBEncryption/GetBranchKeyIdFromDdbKeyOutput.cs +++ /dev/null @@ -1,20 +0,0 @@ -// Copyright Amazon.com Inc. or its affiliates. All Rights Reserved. -// SPDX-License-Identifier: Apache-2.0 -// Do not modify this file. This file is machine generated, and any changes to it will be overwritten. -using System; - using AWS.Cryptography.DbEncryptionSDK.DynamoDb; namespace AWS.Cryptography.DbEncryptionSDK.DynamoDb { - public class GetBranchKeyIdFromDdbKeyOutput { - private string _branchKeyId ; - public string BranchKeyId { - get { return this._branchKeyId; } - set { this._branchKeyId = value; } -} - public bool IsSetBranchKeyId () { - return this._branchKeyId != null; -} - public void Validate() { - if (!IsSetBranchKeyId()) throw new System.ArgumentException("Missing value for required property 'BranchKeyId'"); - -} -} -} diff --git a/TestVectors/runtimes/net/Generated/DDBEncryption/GetEncryptedDataKeyDescriptionInput.cs b/TestVectors/runtimes/net/Generated/DDBEncryption/GetEncryptedDataKeyDescriptionInput.cs deleted file mode 100644 index 0dce691fd..000000000 --- a/TestVectors/runtimes/net/Generated/DDBEncryption/GetEncryptedDataKeyDescriptionInput.cs +++ /dev/null @@ -1,20 +0,0 @@ -// Copyright Amazon.com Inc. or its affiliates. All Rights Reserved. -// SPDX-License-Identifier: Apache-2.0 -// Do not modify this file. This file is machine generated, and any changes to it will be overwritten. -using System; - using AWS.Cryptography.DbEncryptionSDK.DynamoDb; namespace AWS.Cryptography.DbEncryptionSDK.DynamoDb { - public class GetEncryptedDataKeyDescriptionInput { - private AWS.Cryptography.DbEncryptionSDK.DynamoDb.GetEncryptedDataKeyDescriptionUnion _input ; - public AWS.Cryptography.DbEncryptionSDK.DynamoDb.GetEncryptedDataKeyDescriptionUnion Input { - get { return this._input; } - set { this._input = value; } -} - public bool IsSetInput () { - return this._input != null; -} - public void Validate() { - if (!IsSetInput()) throw new System.ArgumentException("Missing value for required property 'Input'"); - -} -} -} diff --git a/TestVectors/runtimes/net/Generated/DDBEncryption/GetEncryptedDataKeyDescriptionOutput.cs b/TestVectors/runtimes/net/Generated/DDBEncryption/GetEncryptedDataKeyDescriptionOutput.cs deleted file mode 100644 index cdc8ec16d..000000000 --- a/TestVectors/runtimes/net/Generated/DDBEncryption/GetEncryptedDataKeyDescriptionOutput.cs +++ /dev/null @@ -1,20 +0,0 @@ -// Copyright Amazon.com Inc. or its affiliates. All Rights Reserved. -// SPDX-License-Identifier: Apache-2.0 -// Do not modify this file. This file is machine generated, and any changes to it will be overwritten. -using System; - using AWS.Cryptography.DbEncryptionSDK.DynamoDb; namespace AWS.Cryptography.DbEncryptionSDK.DynamoDb { - public class GetEncryptedDataKeyDescriptionOutput { - private System.Collections.Generic.List _encryptedDataKeyDescriptionOutput ; - public System.Collections.Generic.List EncryptedDataKeyDescriptionOutput { - get { return this._encryptedDataKeyDescriptionOutput; } - set { this._encryptedDataKeyDescriptionOutput = value; } -} - public bool IsSetEncryptedDataKeyDescriptionOutput () { - return this._encryptedDataKeyDescriptionOutput != null; -} - public void Validate() { - if (!IsSetEncryptedDataKeyDescriptionOutput()) throw new System.ArgumentException("Missing value for required property 'EncryptedDataKeyDescriptionOutput'"); - -} -} -} diff --git a/TestVectors/runtimes/net/Generated/DDBEncryption/GetEncryptedDataKeyDescriptionUnion.cs b/TestVectors/runtimes/net/Generated/DDBEncryption/GetEncryptedDataKeyDescriptionUnion.cs deleted file mode 100644 index afc3fc7b8..000000000 --- a/TestVectors/runtimes/net/Generated/DDBEncryption/GetEncryptedDataKeyDescriptionUnion.cs +++ /dev/null @@ -1,32 +0,0 @@ -// Copyright Amazon.com Inc. or its affiliates. All Rights Reserved. -// SPDX-License-Identifier: Apache-2.0 -// Do not modify this file. This file is machine generated, and any changes to it will be overwritten. -using System; - using AWS.Cryptography.DbEncryptionSDK.DynamoDb; namespace AWS.Cryptography.DbEncryptionSDK.DynamoDb { - public class GetEncryptedDataKeyDescriptionUnion { - private System.IO.MemoryStream _header ; - private System.Collections.Generic.Dictionary _plaintextItem ; - public System.IO.MemoryStream Header { - get { return this._header; } - set { this._header = value; } -} - public bool IsSetHeader () { - return this._header != null; -} - public System.Collections.Generic.Dictionary PlaintextItem { - get { return this._plaintextItem; } - set { this._plaintextItem = value; } -} - public bool IsSetPlaintextItem () { - return this._plaintextItem != null; -} - public void Validate() { - var numberOfPropertiesSet = Convert.ToUInt16(IsSetHeader()) + - Convert.ToUInt16(IsSetPlaintextItem()) ; - if (numberOfPropertiesSet == 0) throw new System.ArgumentException("No union value set"); - - if (numberOfPropertiesSet > 1) throw new System.ArgumentException("Multiple union values set"); - -} -} -} diff --git a/TestVectors/runtimes/net/Generated/DDBEncryption/GetPrefix.cs b/TestVectors/runtimes/net/Generated/DDBEncryption/GetPrefix.cs deleted file mode 100644 index 0b6d4e0d9..000000000 --- a/TestVectors/runtimes/net/Generated/DDBEncryption/GetPrefix.cs +++ /dev/null @@ -1,20 +0,0 @@ -// Copyright Amazon.com Inc. or its affiliates. All Rights Reserved. -// SPDX-License-Identifier: Apache-2.0 -// Do not modify this file. This file is machine generated, and any changes to it will be overwritten. -using System; - using AWS.Cryptography.DbEncryptionSDK.DynamoDb; namespace AWS.Cryptography.DbEncryptionSDK.DynamoDb { - public class GetPrefix { - private int? _length ; - public int Length { - get { return this._length.GetValueOrDefault(); } - set { this._length = value; } -} - public bool IsSetLength () { - return this._length.HasValue; -} - public void Validate() { - if (!IsSetLength()) throw new System.ArgumentException("Missing value for required property 'Length'"); - -} -} -} diff --git a/TestVectors/runtimes/net/Generated/DDBEncryption/GetSegment.cs b/TestVectors/runtimes/net/Generated/DDBEncryption/GetSegment.cs deleted file mode 100644 index 5cf157b2e..000000000 --- a/TestVectors/runtimes/net/Generated/DDBEncryption/GetSegment.cs +++ /dev/null @@ -1,29 +0,0 @@ -// Copyright Amazon.com Inc. or its affiliates. All Rights Reserved. -// SPDX-License-Identifier: Apache-2.0 -// Do not modify this file. This file is machine generated, and any changes to it will be overwritten. -using System; - using AWS.Cryptography.DbEncryptionSDK.DynamoDb; namespace AWS.Cryptography.DbEncryptionSDK.DynamoDb { - public class GetSegment { - private string _split ; - private int? _index ; - public string Split { - get { return this._split; } - set { this._split = value; } -} - public bool IsSetSplit () { - return this._split != null; -} - public int Index { - get { return this._index.GetValueOrDefault(); } - set { this._index = value; } -} - public bool IsSetIndex () { - return this._index.HasValue; -} - public void Validate() { - if (!IsSetSplit()) throw new System.ArgumentException("Missing value for required property 'Split'"); - if (!IsSetIndex()) throw new System.ArgumentException("Missing value for required property 'Index'"); - -} -} -} diff --git a/TestVectors/runtimes/net/Generated/DDBEncryption/GetSegments.cs b/TestVectors/runtimes/net/Generated/DDBEncryption/GetSegments.cs deleted file mode 100644 index da498b4a0..000000000 --- a/TestVectors/runtimes/net/Generated/DDBEncryption/GetSegments.cs +++ /dev/null @@ -1,38 +0,0 @@ -// Copyright Amazon.com Inc. or its affiliates. All Rights Reserved. -// SPDX-License-Identifier: Apache-2.0 -// Do not modify this file. This file is machine generated, and any changes to it will be overwritten. -using System; - using AWS.Cryptography.DbEncryptionSDK.DynamoDb; namespace AWS.Cryptography.DbEncryptionSDK.DynamoDb { - public class GetSegments { - private string _split ; - private int? _low ; - private int? _high ; - public string Split { - get { return this._split; } - set { this._split = value; } -} - public bool IsSetSplit () { - return this._split != null; -} - public int Low { - get { return this._low.GetValueOrDefault(); } - set { this._low = value; } -} - public bool IsSetLow () { - return this._low.HasValue; -} - public int High { - get { return this._high.GetValueOrDefault(); } - set { this._high = value; } -} - public bool IsSetHigh () { - return this._high.HasValue; -} - public void Validate() { - if (!IsSetSplit()) throw new System.ArgumentException("Missing value for required property 'Split'"); - if (!IsSetLow()) throw new System.ArgumentException("Missing value for required property 'Low'"); - if (!IsSetHigh()) throw new System.ArgumentException("Missing value for required property 'High'"); - -} -} -} diff --git a/TestVectors/runtimes/net/Generated/DDBEncryption/GetSubstring.cs b/TestVectors/runtimes/net/Generated/DDBEncryption/GetSubstring.cs deleted file mode 100644 index 4dec9d952..000000000 --- a/TestVectors/runtimes/net/Generated/DDBEncryption/GetSubstring.cs +++ /dev/null @@ -1,29 +0,0 @@ -// Copyright Amazon.com Inc. or its affiliates. All Rights Reserved. -// SPDX-License-Identifier: Apache-2.0 -// Do not modify this file. This file is machine generated, and any changes to it will be overwritten. -using System; - using AWS.Cryptography.DbEncryptionSDK.DynamoDb; namespace AWS.Cryptography.DbEncryptionSDK.DynamoDb { - public class GetSubstring { - private int? _low ; - private int? _high ; - public int Low { - get { return this._low.GetValueOrDefault(); } - set { this._low = value; } -} - public bool IsSetLow () { - return this._low.HasValue; -} - public int High { - get { return this._high.GetValueOrDefault(); } - set { this._high = value; } -} - public bool IsSetHigh () { - return this._high.HasValue; -} - public void Validate() { - if (!IsSetLow()) throw new System.ArgumentException("Missing value for required property 'Low'"); - if (!IsSetHigh()) throw new System.ArgumentException("Missing value for required property 'High'"); - -} -} -} diff --git a/TestVectors/runtimes/net/Generated/DDBEncryption/GetSuffix.cs b/TestVectors/runtimes/net/Generated/DDBEncryption/GetSuffix.cs deleted file mode 100644 index 45df6e9ef..000000000 --- a/TestVectors/runtimes/net/Generated/DDBEncryption/GetSuffix.cs +++ /dev/null @@ -1,20 +0,0 @@ -// Copyright Amazon.com Inc. or its affiliates. All Rights Reserved. -// SPDX-License-Identifier: Apache-2.0 -// Do not modify this file. This file is machine generated, and any changes to it will be overwritten. -using System; - using AWS.Cryptography.DbEncryptionSDK.DynamoDb; namespace AWS.Cryptography.DbEncryptionSDK.DynamoDb { - public class GetSuffix { - private int? _length ; - public int Length { - get { return this._length.GetValueOrDefault(); } - set { this._length = value; } -} - public bool IsSetLength () { - return this._length.HasValue; -} - public void Validate() { - if (!IsSetLength()) throw new System.ArgumentException("Missing value for required property 'Length'"); - -} -} -} diff --git a/TestVectors/runtimes/net/Generated/DDBEncryption/IDynamoDbKeyBranchKeyIdSupplier.cs b/TestVectors/runtimes/net/Generated/DDBEncryption/IDynamoDbKeyBranchKeyIdSupplier.cs deleted file mode 100644 index 956318311..000000000 --- a/TestVectors/runtimes/net/Generated/DDBEncryption/IDynamoDbKeyBranchKeyIdSupplier.cs +++ /dev/null @@ -1,9 +0,0 @@ -// Copyright Amazon.com Inc. or its affiliates. All Rights Reserved. -// SPDX-License-Identifier: Apache-2.0 -// Do not modify this file. This file is machine generated, and any changes to it will be overwritten. -using System; - using AWS.Cryptography.DbEncryptionSDK.DynamoDb; namespace AWS.Cryptography.DbEncryptionSDK.DynamoDb { - public interface IDynamoDbKeyBranchKeyIdSupplier { - AWS.Cryptography.DbEncryptionSDK.DynamoDb.GetBranchKeyIdFromDdbKeyOutput GetBranchKeyIdFromDdbKey ( AWS.Cryptography.DbEncryptionSDK.DynamoDb.GetBranchKeyIdFromDdbKeyInput input ) ; -} -} diff --git a/TestVectors/runtimes/net/Generated/DDBEncryption/ILegacyDynamoDbEncryptor.cs b/TestVectors/runtimes/net/Generated/DDBEncryption/ILegacyDynamoDbEncryptor.cs deleted file mode 100644 index 218a9770c..000000000 --- a/TestVectors/runtimes/net/Generated/DDBEncryption/ILegacyDynamoDbEncryptor.cs +++ /dev/null @@ -1,9 +0,0 @@ -// Copyright Amazon.com Inc. or its affiliates. All Rights Reserved. -// SPDX-License-Identifier: Apache-2.0 -// Do not modify this file. This file is machine generated, and any changes to it will be overwritten. -using System; - using AWS.Cryptography.DbEncryptionSDK.DynamoDb; namespace AWS.Cryptography.DbEncryptionSDK.DynamoDb { - public interface ILegacyDynamoDbEncryptor { - -} -} diff --git a/TestVectors/runtimes/net/Generated/DDBEncryption/Insert.cs b/TestVectors/runtimes/net/Generated/DDBEncryption/Insert.cs deleted file mode 100644 index b4a9552c4..000000000 --- a/TestVectors/runtimes/net/Generated/DDBEncryption/Insert.cs +++ /dev/null @@ -1,20 +0,0 @@ -// Copyright Amazon.com Inc. or its affiliates. All Rights Reserved. -// SPDX-License-Identifier: Apache-2.0 -// Do not modify this file. This file is machine generated, and any changes to it will be overwritten. -using System; - using AWS.Cryptography.DbEncryptionSDK.DynamoDb; namespace AWS.Cryptography.DbEncryptionSDK.DynamoDb { - public class Insert { - private string _literal ; - public string Literal { - get { return this._literal; } - set { this._literal = value; } -} - public bool IsSetLiteral () { - return this._literal != null; -} - public void Validate() { - if (!IsSetLiteral()) throw new System.ArgumentException("Missing value for required property 'Literal'"); - -} -} -} diff --git a/TestVectors/runtimes/net/Generated/DDBEncryption/LegacyDynamoDbEncryptor.cs b/TestVectors/runtimes/net/Generated/DDBEncryption/LegacyDynamoDbEncryptor.cs deleted file mode 100644 index 3dc107b19..000000000 --- a/TestVectors/runtimes/net/Generated/DDBEncryption/LegacyDynamoDbEncryptor.cs +++ /dev/null @@ -1,14 +0,0 @@ -// Copyright Amazon.com Inc. or its affiliates. All Rights Reserved. -// SPDX-License-Identifier: Apache-2.0 -// Do not modify this file. This file is machine generated, and any changes to it will be overwritten. -using System; - using System.IO; - using System.Collections.Generic; - using AWS.Cryptography.DbEncryptionSDK.DynamoDb; - using software.amazon.cryptography.dbencryptionsdk.dynamodb.internaldafny.types; namespace AWS.Cryptography.DbEncryptionSDK.DynamoDb { - internal class LegacyDynamoDbEncryptor : LegacyDynamoDbEncryptorBase { - internal readonly software.amazon.cryptography.dbencryptionsdk.dynamodb.internaldafny.types.ILegacyDynamoDbEncryptor _impl; - internal LegacyDynamoDbEncryptor(software.amazon.cryptography.dbencryptionsdk.dynamodb.internaldafny.types.ILegacyDynamoDbEncryptor impl) { this._impl = impl; } - -} -} diff --git a/TestVectors/runtimes/net/Generated/DDBEncryption/LegacyDynamoDbEncryptorBase.cs b/TestVectors/runtimes/net/Generated/DDBEncryption/LegacyDynamoDbEncryptorBase.cs deleted file mode 100644 index eaed724d6..000000000 --- a/TestVectors/runtimes/net/Generated/DDBEncryption/LegacyDynamoDbEncryptorBase.cs +++ /dev/null @@ -1,9 +0,0 @@ -// Copyright Amazon.com Inc. or its affiliates. All Rights Reserved. -// SPDX-License-Identifier: Apache-2.0 -// Do not modify this file. This file is machine generated, and any changes to it will be overwritten. -using System; - using AWS.Cryptography.DbEncryptionSDK.DynamoDb; namespace AWS.Cryptography.DbEncryptionSDK.DynamoDb { - public abstract class LegacyDynamoDbEncryptorBase : ILegacyDynamoDbEncryptor { - -} -} diff --git a/TestVectors/runtimes/net/Generated/DDBEncryption/LegacyOverride.cs b/TestVectors/runtimes/net/Generated/DDBEncryption/LegacyOverride.cs deleted file mode 100644 index 62af3b999..000000000 --- a/TestVectors/runtimes/net/Generated/DDBEncryption/LegacyOverride.cs +++ /dev/null @@ -1,46 +0,0 @@ -// Copyright Amazon.com Inc. or its affiliates. All Rights Reserved. -// SPDX-License-Identifier: Apache-2.0 -// Do not modify this file. This file is machine generated, and any changes to it will be overwritten. -using System; - using AWS.Cryptography.DbEncryptionSDK.DynamoDb; namespace AWS.Cryptography.DbEncryptionSDK.DynamoDb { - public class LegacyOverride { - private AWS.Cryptography.DbEncryptionSDK.DynamoDb.LegacyPolicy _policy ; - private AWS.Cryptography.DbEncryptionSDK.DynamoDb.ILegacyDynamoDbEncryptor _encryptor ; - private System.Collections.Generic.Dictionary _attributeActionsOnEncrypt ; - private AWS.Cryptography.DbEncryptionSDK.StructuredEncryption.CryptoAction _defaultAttributeFlag ; - public AWS.Cryptography.DbEncryptionSDK.DynamoDb.LegacyPolicy Policy { - get { return this._policy; } - set { this._policy = value; } -} - public bool IsSetPolicy () { - return this._policy != null; -} - public AWS.Cryptography.DbEncryptionSDK.DynamoDb.ILegacyDynamoDbEncryptor Encryptor { - get { return this._encryptor; } - set { this._encryptor = value; } -} - public bool IsSetEncryptor () { - return this._encryptor != null; -} - public System.Collections.Generic.Dictionary AttributeActionsOnEncrypt { - get { return this._attributeActionsOnEncrypt; } - set { this._attributeActionsOnEncrypt = value; } -} - public bool IsSetAttributeActionsOnEncrypt () { - return this._attributeActionsOnEncrypt != null; -} - public AWS.Cryptography.DbEncryptionSDK.StructuredEncryption.CryptoAction DefaultAttributeFlag { - get { return this._defaultAttributeFlag; } - set { this._defaultAttributeFlag = value; } -} - public bool IsSetDefaultAttributeFlag () { - return this._defaultAttributeFlag != null; -} - public void Validate() { - if (!IsSetPolicy()) throw new System.ArgumentException("Missing value for required property 'Policy'"); - if (!IsSetEncryptor()) throw new System.ArgumentException("Missing value for required property 'Encryptor'"); - if (!IsSetAttributeActionsOnEncrypt()) throw new System.ArgumentException("Missing value for required property 'AttributeActionsOnEncrypt'"); - -} -} -} diff --git a/TestVectors/runtimes/net/Generated/DDBEncryption/LegacyPolicy.cs b/TestVectors/runtimes/net/Generated/DDBEncryption/LegacyPolicy.cs deleted file mode 100644 index b989976f3..000000000 --- a/TestVectors/runtimes/net/Generated/DDBEncryption/LegacyPolicy.cs +++ /dev/null @@ -1,19 +0,0 @@ -// Copyright Amazon.com Inc. or its affiliates. All Rights Reserved. -// SPDX-License-Identifier: Apache-2.0 -// Do not modify this file. This file is machine generated, and any changes to it will be overwritten. -using System; - using AWS.Cryptography.DbEncryptionSDK.DynamoDb; namespace AWS.Cryptography.DbEncryptionSDK.DynamoDb { - using Amazon.Runtime; public class LegacyPolicy : ConstantClass { - - - public static readonly LegacyPolicy FORCE_LEGACY_ENCRYPT_ALLOW_LEGACY_DECRYPT = new LegacyPolicy ("FORCE_LEGACY_ENCRYPT_ALLOW_LEGACY_DECRYPT"); - - public static readonly LegacyPolicy FORBID_LEGACY_ENCRYPT_ALLOW_LEGACY_DECRYPT = new LegacyPolicy ("FORBID_LEGACY_ENCRYPT_ALLOW_LEGACY_DECRYPT"); - - public static readonly LegacyPolicy FORBID_LEGACY_ENCRYPT_FORBID_LEGACY_DECRYPT = new LegacyPolicy ("FORBID_LEGACY_ENCRYPT_FORBID_LEGACY_DECRYPT"); - public static readonly LegacyPolicy [] Values = { - FORBID_LEGACY_ENCRYPT_ALLOW_LEGACY_DECRYPT , FORBID_LEGACY_ENCRYPT_FORBID_LEGACY_DECRYPT , FORCE_LEGACY_ENCRYPT_ALLOW_LEGACY_DECRYPT -} ; - public LegacyPolicy (string value) : base(value) {} -} -} diff --git a/TestVectors/runtimes/net/Generated/DDBEncryption/Lower.cs b/TestVectors/runtimes/net/Generated/DDBEncryption/Lower.cs deleted file mode 100644 index eb81f9b7c..000000000 --- a/TestVectors/runtimes/net/Generated/DDBEncryption/Lower.cs +++ /dev/null @@ -1,13 +0,0 @@ -// Copyright Amazon.com Inc. or its affiliates. All Rights Reserved. -// SPDX-License-Identifier: Apache-2.0 -// Do not modify this file. This file is machine generated, and any changes to it will be overwritten. -using System; - using AWS.Cryptography.DbEncryptionSDK.DynamoDb; namespace AWS.Cryptography.DbEncryptionSDK.DynamoDb { - public class Lower { - - - public void Validate() { - -} -} -} diff --git a/TestVectors/runtimes/net/Generated/DDBEncryption/MultiKeyStore.cs b/TestVectors/runtimes/net/Generated/DDBEncryption/MultiKeyStore.cs deleted file mode 100644 index d41aa44b6..000000000 --- a/TestVectors/runtimes/net/Generated/DDBEncryption/MultiKeyStore.cs +++ /dev/null @@ -1,37 +0,0 @@ -// Copyright Amazon.com Inc. or its affiliates. All Rights Reserved. -// SPDX-License-Identifier: Apache-2.0 -// Do not modify this file. This file is machine generated, and any changes to it will be overwritten. -using System; - using AWS.Cryptography.DbEncryptionSDK.DynamoDb; namespace AWS.Cryptography.DbEncryptionSDK.DynamoDb { - public class MultiKeyStore { - private string _keyFieldName ; - private int? _cacheTTL ; - private AWS.Cryptography.MaterialProviders.CacheType _cache ; - public string KeyFieldName { - get { return this._keyFieldName; } - set { this._keyFieldName = value; } -} - public bool IsSetKeyFieldName () { - return this._keyFieldName != null; -} - public int CacheTTL { - get { return this._cacheTTL.GetValueOrDefault(); } - set { this._cacheTTL = value; } -} - public bool IsSetCacheTTL () { - return this._cacheTTL.HasValue; -} - public AWS.Cryptography.MaterialProviders.CacheType Cache { - get { return this._cache; } - set { this._cache = value; } -} - public bool IsSetCache () { - return this._cache != null; -} - public void Validate() { - if (!IsSetKeyFieldName()) throw new System.ArgumentException("Missing value for required property 'KeyFieldName'"); - if (!IsSetCacheTTL()) throw new System.ArgumentException("Missing value for required property 'CacheTTL'"); - -} -} -} diff --git a/TestVectors/runtimes/net/Generated/DDBEncryption/NativeWrapper_DynamoDbKeyBranchKeyIdSupplier.cs b/TestVectors/runtimes/net/Generated/DDBEncryption/NativeWrapper_DynamoDbKeyBranchKeyIdSupplier.cs deleted file mode 100644 index c60f28873..000000000 --- a/TestVectors/runtimes/net/Generated/DDBEncryption/NativeWrapper_DynamoDbKeyBranchKeyIdSupplier.cs +++ /dev/null @@ -1,45 +0,0 @@ -// Copyright Amazon.com Inc. or its affiliates. All Rights Reserved. -// SPDX-License-Identifier: Apache-2.0 -// Do not modify this file. This file is machine generated, and any changes to it will be overwritten. -// ReSharper disable RedundantUsingDirective -// ReSharper disable RedundantNameQualifier -// ReSharper disable SuggestVarOrType_SimpleTypes - using System; - using _System; - using Wrappers_Compile; - - namespace AWS.Cryptography.DbEncryptionSDK.DynamoDb { - internal class NativeWrapper_DynamoDbKeyBranchKeyIdSupplier : software.amazon.cryptography.dbencryptionsdk.dynamodb.internaldafny.types.IDynamoDbKeyBranchKeyIdSupplier - { - internal readonly DynamoDbKeyBranchKeyIdSupplierBase _impl; - public NativeWrapper_DynamoDbKeyBranchKeyIdSupplier(DynamoDbKeyBranchKeyIdSupplierBase nativeImpl) - { - _impl = nativeImpl; -} - public Wrappers_Compile._IResult GetBranchKeyIdFromDdbKey(software.amazon.cryptography.dbencryptionsdk.dynamodb.internaldafny.types._IGetBranchKeyIdFromDdbKeyInput input) - { - void validateOutput(AWS.Cryptography.DbEncryptionSDK.DynamoDb.GetBranchKeyIdFromDdbKeyOutput nativeOutput) { - try { nativeOutput.Validate(); } catch (ArgumentException e) - { - var message = $"Output of {_impl}._GetBranchKeyIdFromDdbKey is invalid. {e.Message}"; - throw new DynamoDbEncryptionException(message); -} -} - AWS.Cryptography.DbEncryptionSDK.DynamoDb.GetBranchKeyIdFromDdbKeyInput nativeInput = TypeConversion.FromDafny_N3_aws__N12_cryptography__N15_dbEncryptionSdk__N8_dynamoDb__S29_GetBranchKeyIdFromDdbKeyInput(input); - try { - AWS.Cryptography.DbEncryptionSDK.DynamoDb.GetBranchKeyIdFromDdbKeyOutput nativeOutput = _impl.GetBranchKeyIdFromDdbKey(nativeInput); - _ = nativeOutput ?? throw new DynamoDbEncryptionException($"{_impl}._GetBranchKeyIdFromDdbKey returned null, should be {typeof(AWS.Cryptography.DbEncryptionSDK.DynamoDb.GetBranchKeyIdFromDdbKeyOutput)}"); - validateOutput(nativeOutput); - return Wrappers_Compile.Result.create_Success(TypeConversion.ToDafny_N3_aws__N12_cryptography__N15_dbEncryptionSdk__N8_dynamoDb__S30_GetBranchKeyIdFromDdbKeyOutput(nativeOutput)); -} - catch(Exception e) - { - return Wrappers_Compile.Result.create_Failure(TypeConversion.ToDafny_CommonError(e)); -} -} - public Wrappers_Compile._IResult GetBranchKeyIdFromDdbKey_k(software.amazon.cryptography.dbencryptionsdk.dynamodb.internaldafny.types._IGetBranchKeyIdFromDdbKeyInput input) - { - throw new DynamoDbEncryptionException("Not supported at this time."); -} -} -} diff --git a/TestVectors/runtimes/net/Generated/DDBEncryption/NativeWrapper_LegacyDynamoDbEncryptor.cs b/TestVectors/runtimes/net/Generated/DDBEncryption/NativeWrapper_LegacyDynamoDbEncryptor.cs deleted file mode 100644 index 37d4a600a..000000000 --- a/TestVectors/runtimes/net/Generated/DDBEncryption/NativeWrapper_LegacyDynamoDbEncryptor.cs +++ /dev/null @@ -1,21 +0,0 @@ -// Copyright Amazon.com Inc. or its affiliates. All Rights Reserved. -// SPDX-License-Identifier: Apache-2.0 -// Do not modify this file. This file is machine generated, and any changes to it will be overwritten. -// ReSharper disable RedundantUsingDirective -// ReSharper disable RedundantNameQualifier -// ReSharper disable SuggestVarOrType_SimpleTypes - using System; - using _System; - using Wrappers_Compile; - - namespace AWS.Cryptography.DbEncryptionSDK.DynamoDb { - internal class NativeWrapper_LegacyDynamoDbEncryptor : software.amazon.cryptography.dbencryptionsdk.dynamodb.internaldafny.types.ILegacyDynamoDbEncryptor - { - internal readonly LegacyDynamoDbEncryptorBase _impl; - public NativeWrapper_LegacyDynamoDbEncryptor(LegacyDynamoDbEncryptorBase nativeImpl) - { - _impl = nativeImpl; -} - -} -} diff --git a/TestVectors/runtimes/net/Generated/DDBEncryption/OpaqueError.cs b/TestVectors/runtimes/net/Generated/DDBEncryption/OpaqueError.cs deleted file mode 100644 index c92f08d6a..000000000 --- a/TestVectors/runtimes/net/Generated/DDBEncryption/OpaqueError.cs +++ /dev/null @@ -1,13 +0,0 @@ -// Copyright Amazon.com Inc. or its affiliates. All Rights Reserved. -// SPDX-License-Identifier: Apache-2.0 -// Do not modify this file. This file is machine generated, and any changes to it will be overwritten. -using System; - using AWS.Cryptography.DbEncryptionSDK.DynamoDb; namespace AWS.Cryptography.DbEncryptionSDK.DynamoDb { - public class OpaqueError : Exception { - public readonly object obj; - public OpaqueError(Exception ex) : base("OpaqueError:", ex) { this.obj = ex; } - public OpaqueError() : base("Unknown Unexpected Error") { } - public OpaqueError(object obj) : base(obj is Exception ? "OpaqueError:" : "Opaque obj is not an Exception.", obj as Exception) { this.obj = obj;} -} - -} diff --git a/TestVectors/runtimes/net/Generated/DDBEncryption/PartOnly.cs b/TestVectors/runtimes/net/Generated/DDBEncryption/PartOnly.cs deleted file mode 100644 index 35f7039c4..000000000 --- a/TestVectors/runtimes/net/Generated/DDBEncryption/PartOnly.cs +++ /dev/null @@ -1,13 +0,0 @@ -// Copyright Amazon.com Inc. or its affiliates. All Rights Reserved. -// SPDX-License-Identifier: Apache-2.0 -// Do not modify this file. This file is machine generated, and any changes to it will be overwritten. -using System; - using AWS.Cryptography.DbEncryptionSDK.DynamoDb; namespace AWS.Cryptography.DbEncryptionSDK.DynamoDb { - public class PartOnly { - - - public void Validate() { - -} -} -} diff --git a/TestVectors/runtimes/net/Generated/DDBEncryption/PlaintextOverride.cs b/TestVectors/runtimes/net/Generated/DDBEncryption/PlaintextOverride.cs deleted file mode 100644 index 04f9efcb7..000000000 --- a/TestVectors/runtimes/net/Generated/DDBEncryption/PlaintextOverride.cs +++ /dev/null @@ -1,19 +0,0 @@ -// Copyright Amazon.com Inc. or its affiliates. All Rights Reserved. -// SPDX-License-Identifier: Apache-2.0 -// Do not modify this file. This file is machine generated, and any changes to it will be overwritten. -using System; - using AWS.Cryptography.DbEncryptionSDK.DynamoDb; namespace AWS.Cryptography.DbEncryptionSDK.DynamoDb { - using Amazon.Runtime; public class PlaintextOverride : ConstantClass { - - - public static readonly PlaintextOverride FORCE_PLAINTEXT_WRITE_ALLOW_PLAINTEXT_READ = new PlaintextOverride ("FORCE_PLAINTEXT_WRITE_ALLOW_PLAINTEXT_READ"); - - public static readonly PlaintextOverride FORBID_PLAINTEXT_WRITE_ALLOW_PLAINTEXT_READ = new PlaintextOverride ("FORBID_PLAINTEXT_WRITE_ALLOW_PLAINTEXT_READ"); - - public static readonly PlaintextOverride FORBID_PLAINTEXT_WRITE_FORBID_PLAINTEXT_READ = new PlaintextOverride ("FORBID_PLAINTEXT_WRITE_FORBID_PLAINTEXT_READ"); - public static readonly PlaintextOverride [] Values = { - FORBID_PLAINTEXT_WRITE_ALLOW_PLAINTEXT_READ , FORBID_PLAINTEXT_WRITE_FORBID_PLAINTEXT_READ , FORCE_PLAINTEXT_WRITE_ALLOW_PLAINTEXT_READ -} ; - public PlaintextOverride (string value) : base(value) {} -} -} diff --git a/TestVectors/runtimes/net/Generated/DDBEncryption/SearchConfig.cs b/TestVectors/runtimes/net/Generated/DDBEncryption/SearchConfig.cs deleted file mode 100644 index 2729d66b1..000000000 --- a/TestVectors/runtimes/net/Generated/DDBEncryption/SearchConfig.cs +++ /dev/null @@ -1,29 +0,0 @@ -// Copyright Amazon.com Inc. or its affiliates. All Rights Reserved. -// SPDX-License-Identifier: Apache-2.0 -// Do not modify this file. This file is machine generated, and any changes to it will be overwritten. -using System; - using AWS.Cryptography.DbEncryptionSDK.DynamoDb; namespace AWS.Cryptography.DbEncryptionSDK.DynamoDb { - public class SearchConfig { - private System.Collections.Generic.List _versions ; - private int? _writeVersion ; - public System.Collections.Generic.List Versions { - get { return this._versions; } - set { this._versions = value; } -} - public bool IsSetVersions () { - return this._versions != null; -} - public int WriteVersion { - get { return this._writeVersion.GetValueOrDefault(); } - set { this._writeVersion = value; } -} - public bool IsSetWriteVersion () { - return this._writeVersion.HasValue; -} - public void Validate() { - if (!IsSetVersions()) throw new System.ArgumentException("Missing value for required property 'Versions'"); - if (!IsSetWriteVersion()) throw new System.ArgumentException("Missing value for required property 'WriteVersion'"); - -} -} -} diff --git a/TestVectors/runtimes/net/Generated/DDBEncryption/Shared.cs b/TestVectors/runtimes/net/Generated/DDBEncryption/Shared.cs deleted file mode 100644 index 840ea2673..000000000 --- a/TestVectors/runtimes/net/Generated/DDBEncryption/Shared.cs +++ /dev/null @@ -1,20 +0,0 @@ -// Copyright Amazon.com Inc. or its affiliates. All Rights Reserved. -// SPDX-License-Identifier: Apache-2.0 -// Do not modify this file. This file is machine generated, and any changes to it will be overwritten. -using System; - using AWS.Cryptography.DbEncryptionSDK.DynamoDb; namespace AWS.Cryptography.DbEncryptionSDK.DynamoDb { - public class Shared { - private string _other ; - public string Other { - get { return this._other; } - set { this._other = value; } -} - public bool IsSetOther () { - return this._other != null; -} - public void Validate() { - if (!IsSetOther()) throw new System.ArgumentException("Missing value for required property 'Other'"); - -} -} -} diff --git a/TestVectors/runtimes/net/Generated/DDBEncryption/SharedSet.cs b/TestVectors/runtimes/net/Generated/DDBEncryption/SharedSet.cs deleted file mode 100644 index 7b338feae..000000000 --- a/TestVectors/runtimes/net/Generated/DDBEncryption/SharedSet.cs +++ /dev/null @@ -1,20 +0,0 @@ -// Copyright Amazon.com Inc. or its affiliates. All Rights Reserved. -// SPDX-License-Identifier: Apache-2.0 -// Do not modify this file. This file is machine generated, and any changes to it will be overwritten. -using System; - using AWS.Cryptography.DbEncryptionSDK.DynamoDb; namespace AWS.Cryptography.DbEncryptionSDK.DynamoDb { - public class SharedSet { - private string _other ; - public string Other { - get { return this._other; } - set { this._other = value; } -} - public bool IsSetOther () { - return this._other != null; -} - public void Validate() { - if (!IsSetOther()) throw new System.ArgumentException("Missing value for required property 'Other'"); - -} -} -} diff --git a/TestVectors/runtimes/net/Generated/DDBEncryption/SignedPart.cs b/TestVectors/runtimes/net/Generated/DDBEncryption/SignedPart.cs deleted file mode 100644 index 53ba318ef..000000000 --- a/TestVectors/runtimes/net/Generated/DDBEncryption/SignedPart.cs +++ /dev/null @@ -1,37 +0,0 @@ -// Copyright Amazon.com Inc. or its affiliates. All Rights Reserved. -// SPDX-License-Identifier: Apache-2.0 -// Do not modify this file. This file is machine generated, and any changes to it will be overwritten. -using System; - using AWS.Cryptography.DbEncryptionSDK.DynamoDb; namespace AWS.Cryptography.DbEncryptionSDK.DynamoDb { - public class SignedPart { - private string _name ; - private string _prefix ; - private string _loc ; - public string Name { - get { return this._name; } - set { this._name = value; } -} - public bool IsSetName () { - return this._name != null; -} - public string Prefix { - get { return this._prefix; } - set { this._prefix = value; } -} - public bool IsSetPrefix () { - return this._prefix != null; -} - public string Loc { - get { return this._loc; } - set { this._loc = value; } -} - public bool IsSetLoc () { - return this._loc != null; -} - public void Validate() { - if (!IsSetName()) throw new System.ArgumentException("Missing value for required property 'Name'"); - if (!IsSetPrefix()) throw new System.ArgumentException("Missing value for required property 'Prefix'"); - -} -} -} diff --git a/TestVectors/runtimes/net/Generated/DDBEncryption/SingleKeyStore.cs b/TestVectors/runtimes/net/Generated/DDBEncryption/SingleKeyStore.cs deleted file mode 100644 index 7d3164717..000000000 --- a/TestVectors/runtimes/net/Generated/DDBEncryption/SingleKeyStore.cs +++ /dev/null @@ -1,29 +0,0 @@ -// Copyright Amazon.com Inc. or its affiliates. All Rights Reserved. -// SPDX-License-Identifier: Apache-2.0 -// Do not modify this file. This file is machine generated, and any changes to it will be overwritten. -using System; - using AWS.Cryptography.DbEncryptionSDK.DynamoDb; namespace AWS.Cryptography.DbEncryptionSDK.DynamoDb { - public class SingleKeyStore { - private string _keyId ; - private int? _cacheTTL ; - public string KeyId { - get { return this._keyId; } - set { this._keyId = value; } -} - public bool IsSetKeyId () { - return this._keyId != null; -} - public int CacheTTL { - get { return this._cacheTTL.GetValueOrDefault(); } - set { this._cacheTTL = value; } -} - public bool IsSetCacheTTL () { - return this._cacheTTL.HasValue; -} - public void Validate() { - if (!IsSetKeyId()) throw new System.ArgumentException("Missing value for required property 'KeyId'"); - if (!IsSetCacheTTL()) throw new System.ArgumentException("Missing value for required property 'CacheTTL'"); - -} -} -} diff --git a/TestVectors/runtimes/net/Generated/DDBEncryption/StandardBeacon.cs b/TestVectors/runtimes/net/Generated/DDBEncryption/StandardBeacon.cs deleted file mode 100644 index 21f2f7106..000000000 --- a/TestVectors/runtimes/net/Generated/DDBEncryption/StandardBeacon.cs +++ /dev/null @@ -1,45 +0,0 @@ -// Copyright Amazon.com Inc. or its affiliates. All Rights Reserved. -// SPDX-License-Identifier: Apache-2.0 -// Do not modify this file. This file is machine generated, and any changes to it will be overwritten. -using System; - using AWS.Cryptography.DbEncryptionSDK.DynamoDb; namespace AWS.Cryptography.DbEncryptionSDK.DynamoDb { - public class StandardBeacon { - private string _name ; - private int? _length ; - private string _loc ; - private AWS.Cryptography.DbEncryptionSDK.DynamoDb.BeaconStyle _style ; - public string Name { - get { return this._name; } - set { this._name = value; } -} - public bool IsSetName () { - return this._name != null; -} - public int Length { - get { return this._length.GetValueOrDefault(); } - set { this._length = value; } -} - public bool IsSetLength () { - return this._length.HasValue; -} - public string Loc { - get { return this._loc; } - set { this._loc = value; } -} - public bool IsSetLoc () { - return this._loc != null; -} - public AWS.Cryptography.DbEncryptionSDK.DynamoDb.BeaconStyle Style { - get { return this._style; } - set { this._style = value; } -} - public bool IsSetStyle () { - return this._style != null; -} - public void Validate() { - if (!IsSetName()) throw new System.ArgumentException("Missing value for required property 'Name'"); - if (!IsSetLength()) throw new System.ArgumentException("Missing value for required property 'Length'"); - -} -} -} diff --git a/TestVectors/runtimes/net/Generated/DDBEncryption/TypeConversion.cs b/TestVectors/runtimes/net/Generated/DDBEncryption/TypeConversion.cs deleted file mode 100644 index c10e673e1..000000000 --- a/TestVectors/runtimes/net/Generated/DDBEncryption/TypeConversion.cs +++ /dev/null @@ -1,1157 +0,0 @@ -// Copyright Amazon.com Inc. or its affiliates. All Rights Reserved. -// SPDX-License-Identifier: Apache-2.0 -// Do not modify this file. This file is machine generated, and any changes to it will be overwritten. -using System.Linq; using System; namespace AWS.Cryptography.DbEncryptionSDK.DynamoDb { - public static class TypeConversion { - public static AWS.Cryptography.DbEncryptionSDK.DynamoDb.BeaconKeySource FromDafny_N3_aws__N12_cryptography__N15_dbEncryptionSdk__N8_dynamoDb__S15_BeaconKeySource (software.amazon.cryptography.dbencryptionsdk.dynamodb.internaldafny.types._IBeaconKeySource value) { - software.amazon.cryptography.dbencryptionsdk.dynamodb.internaldafny.types.BeaconKeySource concrete = (software.amazon.cryptography.dbencryptionsdk.dynamodb.internaldafny.types.BeaconKeySource)value; - var converted = new AWS.Cryptography.DbEncryptionSDK.DynamoDb.BeaconKeySource(); if (value.is_single) { - converted.Single = FromDafny_N3_aws__N12_cryptography__N15_dbEncryptionSdk__N8_dynamoDb__S15_BeaconKeySource__M6_single(concrete.dtor_single); - return converted; -} if (value.is_multi) { - converted.Multi = FromDafny_N3_aws__N12_cryptography__N15_dbEncryptionSdk__N8_dynamoDb__S15_BeaconKeySource__M5_multi(concrete.dtor_multi); - return converted; -} -throw new System.ArgumentException("Invalid AWS.Cryptography.DbEncryptionSDK.DynamoDb.BeaconKeySource state"); -} - public static software.amazon.cryptography.dbencryptionsdk.dynamodb.internaldafny.types._IBeaconKeySource ToDafny_N3_aws__N12_cryptography__N15_dbEncryptionSdk__N8_dynamoDb__S15_BeaconKeySource (AWS.Cryptography.DbEncryptionSDK.DynamoDb.BeaconKeySource value) { - if (value.IsSetSingle()) { - return software.amazon.cryptography.dbencryptionsdk.dynamodb.internaldafny.types.BeaconKeySource.create_single(ToDafny_N3_aws__N12_cryptography__N15_dbEncryptionSdk__N8_dynamoDb__S15_BeaconKeySource__M6_single(value.Single)); -} if (value.IsSetMulti()) { - return software.amazon.cryptography.dbencryptionsdk.dynamodb.internaldafny.types.BeaconKeySource.create_multi(ToDafny_N3_aws__N12_cryptography__N15_dbEncryptionSdk__N8_dynamoDb__S15_BeaconKeySource__M5_multi(value.Multi)); -} -throw new System.ArgumentException("Invalid AWS.Cryptography.DbEncryptionSDK.DynamoDb.BeaconKeySource state"); -} - public static AWS.Cryptography.DbEncryptionSDK.DynamoDb.BeaconStyle FromDafny_N3_aws__N12_cryptography__N15_dbEncryptionSdk__N8_dynamoDb__S11_BeaconStyle (software.amazon.cryptography.dbencryptionsdk.dynamodb.internaldafny.types._IBeaconStyle value) { - software.amazon.cryptography.dbencryptionsdk.dynamodb.internaldafny.types.BeaconStyle concrete = (software.amazon.cryptography.dbencryptionsdk.dynamodb.internaldafny.types.BeaconStyle)value; - var converted = new AWS.Cryptography.DbEncryptionSDK.DynamoDb.BeaconStyle(); if (value.is_partOnly) { - converted.PartOnly = FromDafny_N3_aws__N12_cryptography__N15_dbEncryptionSdk__N8_dynamoDb__S11_BeaconStyle__M8_partOnly(concrete.dtor_partOnly); - return converted; -} if (value.is_shared) { - converted.Shared = FromDafny_N3_aws__N12_cryptography__N15_dbEncryptionSdk__N8_dynamoDb__S11_BeaconStyle__M6_shared(concrete.dtor_shared); - return converted; -} if (value.is_asSet) { - converted.AsSet = FromDafny_N3_aws__N12_cryptography__N15_dbEncryptionSdk__N8_dynamoDb__S11_BeaconStyle__M5_asSet(concrete.dtor_asSet); - return converted; -} if (value.is_sharedSet) { - converted.SharedSet = FromDafny_N3_aws__N12_cryptography__N15_dbEncryptionSdk__N8_dynamoDb__S11_BeaconStyle__M9_sharedSet(concrete.dtor_sharedSet); - return converted; -} -throw new System.ArgumentException("Invalid AWS.Cryptography.DbEncryptionSDK.DynamoDb.BeaconStyle state"); -} - public static software.amazon.cryptography.dbencryptionsdk.dynamodb.internaldafny.types._IBeaconStyle ToDafny_N3_aws__N12_cryptography__N15_dbEncryptionSdk__N8_dynamoDb__S11_BeaconStyle (AWS.Cryptography.DbEncryptionSDK.DynamoDb.BeaconStyle value) { - if (value.IsSetPartOnly()) { - return software.amazon.cryptography.dbencryptionsdk.dynamodb.internaldafny.types.BeaconStyle.create_partOnly(ToDafny_N3_aws__N12_cryptography__N15_dbEncryptionSdk__N8_dynamoDb__S11_BeaconStyle__M8_partOnly(value.PartOnly)); -} if (value.IsSetShared()) { - return software.amazon.cryptography.dbencryptionsdk.dynamodb.internaldafny.types.BeaconStyle.create_shared(ToDafny_N3_aws__N12_cryptography__N15_dbEncryptionSdk__N8_dynamoDb__S11_BeaconStyle__M6_shared(value.Shared)); -} if (value.IsSetAsSet()) { - return software.amazon.cryptography.dbencryptionsdk.dynamodb.internaldafny.types.BeaconStyle.create_asSet(ToDafny_N3_aws__N12_cryptography__N15_dbEncryptionSdk__N8_dynamoDb__S11_BeaconStyle__M5_asSet(value.AsSet)); -} if (value.IsSetSharedSet()) { - return software.amazon.cryptography.dbencryptionsdk.dynamodb.internaldafny.types.BeaconStyle.create_sharedSet(ToDafny_N3_aws__N12_cryptography__N15_dbEncryptionSdk__N8_dynamoDb__S11_BeaconStyle__M9_sharedSet(value.SharedSet)); -} -throw new System.ArgumentException("Invalid AWS.Cryptography.DbEncryptionSDK.DynamoDb.BeaconStyle state"); -} - public static AWS.Cryptography.DbEncryptionSDK.DynamoDb.CreateDynamoDbEncryptionBranchKeyIdSupplierInput FromDafny_N3_aws__N12_cryptography__N15_dbEncryptionSdk__N8_dynamoDb__S48_CreateDynamoDbEncryptionBranchKeyIdSupplierInput (software.amazon.cryptography.dbencryptionsdk.dynamodb.internaldafny.types._ICreateDynamoDbEncryptionBranchKeyIdSupplierInput value) { - software.amazon.cryptography.dbencryptionsdk.dynamodb.internaldafny.types.CreateDynamoDbEncryptionBranchKeyIdSupplierInput concrete = (software.amazon.cryptography.dbencryptionsdk.dynamodb.internaldafny.types.CreateDynamoDbEncryptionBranchKeyIdSupplierInput)value; AWS.Cryptography.DbEncryptionSDK.DynamoDb.CreateDynamoDbEncryptionBranchKeyIdSupplierInput converted = new AWS.Cryptography.DbEncryptionSDK.DynamoDb.CreateDynamoDbEncryptionBranchKeyIdSupplierInput(); converted.DdbKeyBranchKeyIdSupplier = (AWS.Cryptography.DbEncryptionSDK.DynamoDb.IDynamoDbKeyBranchKeyIdSupplier) FromDafny_N3_aws__N12_cryptography__N15_dbEncryptionSdk__N8_dynamoDb__S48_CreateDynamoDbEncryptionBranchKeyIdSupplierInput__M25_ddbKeyBranchKeyIdSupplier(concrete._ddbKeyBranchKeyIdSupplier); return converted; -} - public static software.amazon.cryptography.dbencryptionsdk.dynamodb.internaldafny.types._ICreateDynamoDbEncryptionBranchKeyIdSupplierInput ToDafny_N3_aws__N12_cryptography__N15_dbEncryptionSdk__N8_dynamoDb__S48_CreateDynamoDbEncryptionBranchKeyIdSupplierInput (AWS.Cryptography.DbEncryptionSDK.DynamoDb.CreateDynamoDbEncryptionBranchKeyIdSupplierInput value) { - - return new software.amazon.cryptography.dbencryptionsdk.dynamodb.internaldafny.types.CreateDynamoDbEncryptionBranchKeyIdSupplierInput ( ToDafny_N3_aws__N12_cryptography__N15_dbEncryptionSdk__N8_dynamoDb__S48_CreateDynamoDbEncryptionBranchKeyIdSupplierInput__M25_ddbKeyBranchKeyIdSupplier(value.DdbKeyBranchKeyIdSupplier) ) ; -} - public static AWS.Cryptography.DbEncryptionSDK.DynamoDb.CreateDynamoDbEncryptionBranchKeyIdSupplierOutput FromDafny_N3_aws__N12_cryptography__N15_dbEncryptionSdk__N8_dynamoDb__S49_CreateDynamoDbEncryptionBranchKeyIdSupplierOutput (software.amazon.cryptography.dbencryptionsdk.dynamodb.internaldafny.types._ICreateDynamoDbEncryptionBranchKeyIdSupplierOutput value) { - software.amazon.cryptography.dbencryptionsdk.dynamodb.internaldafny.types.CreateDynamoDbEncryptionBranchKeyIdSupplierOutput concrete = (software.amazon.cryptography.dbencryptionsdk.dynamodb.internaldafny.types.CreateDynamoDbEncryptionBranchKeyIdSupplierOutput)value; AWS.Cryptography.DbEncryptionSDK.DynamoDb.CreateDynamoDbEncryptionBranchKeyIdSupplierOutput converted = new AWS.Cryptography.DbEncryptionSDK.DynamoDb.CreateDynamoDbEncryptionBranchKeyIdSupplierOutput(); converted.BranchKeyIdSupplier = (AWS.Cryptography.MaterialProviders.IBranchKeyIdSupplier) FromDafny_N3_aws__N12_cryptography__N15_dbEncryptionSdk__N8_dynamoDb__S49_CreateDynamoDbEncryptionBranchKeyIdSupplierOutput__M19_branchKeyIdSupplier(concrete._branchKeyIdSupplier); return converted; -} - public static software.amazon.cryptography.dbencryptionsdk.dynamodb.internaldafny.types._ICreateDynamoDbEncryptionBranchKeyIdSupplierOutput ToDafny_N3_aws__N12_cryptography__N15_dbEncryptionSdk__N8_dynamoDb__S49_CreateDynamoDbEncryptionBranchKeyIdSupplierOutput (AWS.Cryptography.DbEncryptionSDK.DynamoDb.CreateDynamoDbEncryptionBranchKeyIdSupplierOutput value) { - - return new software.amazon.cryptography.dbencryptionsdk.dynamodb.internaldafny.types.CreateDynamoDbEncryptionBranchKeyIdSupplierOutput ( ToDafny_N3_aws__N12_cryptography__N15_dbEncryptionSdk__N8_dynamoDb__S49_CreateDynamoDbEncryptionBranchKeyIdSupplierOutput__M19_branchKeyIdSupplier(value.BranchKeyIdSupplier) ) ; -} - public static AWS.Cryptography.DbEncryptionSDK.DynamoDb.DynamoDbEncryptionConfig FromDafny_N3_aws__N12_cryptography__N15_dbEncryptionSdk__N8_dynamoDb__S24_DynamoDbEncryptionConfig (software.amazon.cryptography.dbencryptionsdk.dynamodb.internaldafny.types._IDynamoDbEncryptionConfig value) { - software.amazon.cryptography.dbencryptionsdk.dynamodb.internaldafny.types.DynamoDbEncryptionConfig concrete = (software.amazon.cryptography.dbencryptionsdk.dynamodb.internaldafny.types.DynamoDbEncryptionConfig)value; AWS.Cryptography.DbEncryptionSDK.DynamoDb.DynamoDbEncryptionConfig converted = new AWS.Cryptography.DbEncryptionSDK.DynamoDb.DynamoDbEncryptionConfig(); return converted; -} - public static software.amazon.cryptography.dbencryptionsdk.dynamodb.internaldafny.types._IDynamoDbEncryptionConfig ToDafny_N3_aws__N12_cryptography__N15_dbEncryptionSdk__N8_dynamoDb__S24_DynamoDbEncryptionConfig (AWS.Cryptography.DbEncryptionSDK.DynamoDb.DynamoDbEncryptionConfig value) { - - return new software.amazon.cryptography.dbencryptionsdk.dynamodb.internaldafny.types.DynamoDbEncryptionConfig ( ) ; -} - public static AWS.Cryptography.DbEncryptionSDK.DynamoDb.DynamoDbEncryptionException FromDafny_N3_aws__N12_cryptography__N15_dbEncryptionSdk__N8_dynamoDb__S27_DynamoDbEncryptionException (software.amazon.cryptography.dbencryptionsdk.dynamodb.internaldafny.types.Error_DynamoDbEncryptionException value) { - return new AWS.Cryptography.DbEncryptionSDK.DynamoDb.DynamoDbEncryptionException ( - FromDafny_N3_aws__N12_cryptography__N15_dbEncryptionSdk__N8_dynamoDb__S27_DynamoDbEncryptionException__M7_message(value._message) - ) ; -} - public static software.amazon.cryptography.dbencryptionsdk.dynamodb.internaldafny.types.Error_DynamoDbEncryptionException ToDafny_N3_aws__N12_cryptography__N15_dbEncryptionSdk__N8_dynamoDb__S27_DynamoDbEncryptionException (AWS.Cryptography.DbEncryptionSDK.DynamoDb.DynamoDbEncryptionException value) { - - return new software.amazon.cryptography.dbencryptionsdk.dynamodb.internaldafny.types.Error_DynamoDbEncryptionException ( - ToDafny_N3_aws__N12_cryptography__N15_dbEncryptionSdk__N8_dynamoDb__S27_DynamoDbEncryptionException__M7_message(value.Message) - ) ; -} - public static AWS.Cryptography.DbEncryptionSDK.DynamoDb.GetBranchKeyIdFromDdbKeyInput FromDafny_N3_aws__N12_cryptography__N15_dbEncryptionSdk__N8_dynamoDb__S29_GetBranchKeyIdFromDdbKeyInput (software.amazon.cryptography.dbencryptionsdk.dynamodb.internaldafny.types._IGetBranchKeyIdFromDdbKeyInput value) { - software.amazon.cryptography.dbencryptionsdk.dynamodb.internaldafny.types.GetBranchKeyIdFromDdbKeyInput concrete = (software.amazon.cryptography.dbencryptionsdk.dynamodb.internaldafny.types.GetBranchKeyIdFromDdbKeyInput)value; AWS.Cryptography.DbEncryptionSDK.DynamoDb.GetBranchKeyIdFromDdbKeyInput converted = new AWS.Cryptography.DbEncryptionSDK.DynamoDb.GetBranchKeyIdFromDdbKeyInput(); converted.DdbKey = (System.Collections.Generic.Dictionary) FromDafny_N3_aws__N12_cryptography__N15_dbEncryptionSdk__N8_dynamoDb__S29_GetBranchKeyIdFromDdbKeyInput__M6_ddbKey(concrete._ddbKey); return converted; -} - public static software.amazon.cryptography.dbencryptionsdk.dynamodb.internaldafny.types._IGetBranchKeyIdFromDdbKeyInput ToDafny_N3_aws__N12_cryptography__N15_dbEncryptionSdk__N8_dynamoDb__S29_GetBranchKeyIdFromDdbKeyInput (AWS.Cryptography.DbEncryptionSDK.DynamoDb.GetBranchKeyIdFromDdbKeyInput value) { - - return new software.amazon.cryptography.dbencryptionsdk.dynamodb.internaldafny.types.GetBranchKeyIdFromDdbKeyInput ( ToDafny_N3_aws__N12_cryptography__N15_dbEncryptionSdk__N8_dynamoDb__S29_GetBranchKeyIdFromDdbKeyInput__M6_ddbKey(value.DdbKey) ) ; -} - public static AWS.Cryptography.DbEncryptionSDK.DynamoDb.GetBranchKeyIdFromDdbKeyOutput FromDafny_N3_aws__N12_cryptography__N15_dbEncryptionSdk__N8_dynamoDb__S30_GetBranchKeyIdFromDdbKeyOutput (software.amazon.cryptography.dbencryptionsdk.dynamodb.internaldafny.types._IGetBranchKeyIdFromDdbKeyOutput value) { - software.amazon.cryptography.dbencryptionsdk.dynamodb.internaldafny.types.GetBranchKeyIdFromDdbKeyOutput concrete = (software.amazon.cryptography.dbencryptionsdk.dynamodb.internaldafny.types.GetBranchKeyIdFromDdbKeyOutput)value; AWS.Cryptography.DbEncryptionSDK.DynamoDb.GetBranchKeyIdFromDdbKeyOutput converted = new AWS.Cryptography.DbEncryptionSDK.DynamoDb.GetBranchKeyIdFromDdbKeyOutput(); converted.BranchKeyId = (string) FromDafny_N3_aws__N12_cryptography__N15_dbEncryptionSdk__N8_dynamoDb__S30_GetBranchKeyIdFromDdbKeyOutput__M11_branchKeyId(concrete._branchKeyId); return converted; -} - public static software.amazon.cryptography.dbencryptionsdk.dynamodb.internaldafny.types._IGetBranchKeyIdFromDdbKeyOutput ToDafny_N3_aws__N12_cryptography__N15_dbEncryptionSdk__N8_dynamoDb__S30_GetBranchKeyIdFromDdbKeyOutput (AWS.Cryptography.DbEncryptionSDK.DynamoDb.GetBranchKeyIdFromDdbKeyOutput value) { - - return new software.amazon.cryptography.dbencryptionsdk.dynamodb.internaldafny.types.GetBranchKeyIdFromDdbKeyOutput ( ToDafny_N3_aws__N12_cryptography__N15_dbEncryptionSdk__N8_dynamoDb__S30_GetBranchKeyIdFromDdbKeyOutput__M11_branchKeyId(value.BranchKeyId) ) ; -} - public static AWS.Cryptography.DbEncryptionSDK.DynamoDb.GetEncryptedDataKeyDescriptionInput FromDafny_N3_aws__N12_cryptography__N15_dbEncryptionSdk__N8_dynamoDb__S35_GetEncryptedDataKeyDescriptionInput (software.amazon.cryptography.dbencryptionsdk.dynamodb.internaldafny.types._IGetEncryptedDataKeyDescriptionInput value) { - software.amazon.cryptography.dbencryptionsdk.dynamodb.internaldafny.types.GetEncryptedDataKeyDescriptionInput concrete = (software.amazon.cryptography.dbencryptionsdk.dynamodb.internaldafny.types.GetEncryptedDataKeyDescriptionInput)value; AWS.Cryptography.DbEncryptionSDK.DynamoDb.GetEncryptedDataKeyDescriptionInput converted = new AWS.Cryptography.DbEncryptionSDK.DynamoDb.GetEncryptedDataKeyDescriptionInput(); converted.Input = (AWS.Cryptography.DbEncryptionSDK.DynamoDb.GetEncryptedDataKeyDescriptionUnion) FromDafny_N3_aws__N12_cryptography__N15_dbEncryptionSdk__N8_dynamoDb__S35_GetEncryptedDataKeyDescriptionInput__M5_input(concrete._input); return converted; -} - public static software.amazon.cryptography.dbencryptionsdk.dynamodb.internaldafny.types._IGetEncryptedDataKeyDescriptionInput ToDafny_N3_aws__N12_cryptography__N15_dbEncryptionSdk__N8_dynamoDb__S35_GetEncryptedDataKeyDescriptionInput (AWS.Cryptography.DbEncryptionSDK.DynamoDb.GetEncryptedDataKeyDescriptionInput value) { - - return new software.amazon.cryptography.dbencryptionsdk.dynamodb.internaldafny.types.GetEncryptedDataKeyDescriptionInput ( ToDafny_N3_aws__N12_cryptography__N15_dbEncryptionSdk__N8_dynamoDb__S35_GetEncryptedDataKeyDescriptionInput__M5_input(value.Input) ) ; -} - public static AWS.Cryptography.DbEncryptionSDK.DynamoDb.GetEncryptedDataKeyDescriptionOutput FromDafny_N3_aws__N12_cryptography__N15_dbEncryptionSdk__N8_dynamoDb__S36_GetEncryptedDataKeyDescriptionOutput (software.amazon.cryptography.dbencryptionsdk.dynamodb.internaldafny.types._IGetEncryptedDataKeyDescriptionOutput value) { - software.amazon.cryptography.dbencryptionsdk.dynamodb.internaldafny.types.GetEncryptedDataKeyDescriptionOutput concrete = (software.amazon.cryptography.dbencryptionsdk.dynamodb.internaldafny.types.GetEncryptedDataKeyDescriptionOutput)value; AWS.Cryptography.DbEncryptionSDK.DynamoDb.GetEncryptedDataKeyDescriptionOutput converted = new AWS.Cryptography.DbEncryptionSDK.DynamoDb.GetEncryptedDataKeyDescriptionOutput(); converted.EncryptedDataKeyDescriptionOutput = (System.Collections.Generic.List) FromDafny_N3_aws__N12_cryptography__N15_dbEncryptionSdk__N8_dynamoDb__S36_GetEncryptedDataKeyDescriptionOutput__M33_EncryptedDataKeyDescriptionOutput(concrete._EncryptedDataKeyDescriptionOutput); return converted; -} - public static software.amazon.cryptography.dbencryptionsdk.dynamodb.internaldafny.types._IGetEncryptedDataKeyDescriptionOutput ToDafny_N3_aws__N12_cryptography__N15_dbEncryptionSdk__N8_dynamoDb__S36_GetEncryptedDataKeyDescriptionOutput (AWS.Cryptography.DbEncryptionSDK.DynamoDb.GetEncryptedDataKeyDescriptionOutput value) { - - return new software.amazon.cryptography.dbencryptionsdk.dynamodb.internaldafny.types.GetEncryptedDataKeyDescriptionOutput ( ToDafny_N3_aws__N12_cryptography__N15_dbEncryptionSdk__N8_dynamoDb__S36_GetEncryptedDataKeyDescriptionOutput__M33_EncryptedDataKeyDescriptionOutput(value.EncryptedDataKeyDescriptionOutput) ) ; -} - public static AWS.Cryptography.DbEncryptionSDK.DynamoDb.GetEncryptedDataKeyDescriptionUnion FromDafny_N3_aws__N12_cryptography__N15_dbEncryptionSdk__N8_dynamoDb__S35_GetEncryptedDataKeyDescriptionUnion (software.amazon.cryptography.dbencryptionsdk.dynamodb.internaldafny.types._IGetEncryptedDataKeyDescriptionUnion value) { - software.amazon.cryptography.dbencryptionsdk.dynamodb.internaldafny.types.GetEncryptedDataKeyDescriptionUnion concrete = (software.amazon.cryptography.dbencryptionsdk.dynamodb.internaldafny.types.GetEncryptedDataKeyDescriptionUnion)value; - var converted = new AWS.Cryptography.DbEncryptionSDK.DynamoDb.GetEncryptedDataKeyDescriptionUnion(); if (value.is_header) { - converted.Header = FromDafny_N3_aws__N12_cryptography__N15_dbEncryptionSdk__N8_dynamoDb__S35_GetEncryptedDataKeyDescriptionUnion__M6_header(concrete.dtor_header); - return converted; -} if (value.is_plaintextItem) { - converted.PlaintextItem = FromDafny_N3_aws__N12_cryptography__N15_dbEncryptionSdk__N8_dynamoDb__S35_GetEncryptedDataKeyDescriptionUnion__M13_plaintextItem(concrete.dtor_plaintextItem); - return converted; -} -throw new System.ArgumentException("Invalid AWS.Cryptography.DbEncryptionSDK.DynamoDb.GetEncryptedDataKeyDescriptionUnion state"); -} - public static software.amazon.cryptography.dbencryptionsdk.dynamodb.internaldafny.types._IGetEncryptedDataKeyDescriptionUnion ToDafny_N3_aws__N12_cryptography__N15_dbEncryptionSdk__N8_dynamoDb__S35_GetEncryptedDataKeyDescriptionUnion (AWS.Cryptography.DbEncryptionSDK.DynamoDb.GetEncryptedDataKeyDescriptionUnion value) { - if (value.IsSetHeader()) { - return software.amazon.cryptography.dbencryptionsdk.dynamodb.internaldafny.types.GetEncryptedDataKeyDescriptionUnion.create_header(ToDafny_N3_aws__N12_cryptography__N15_dbEncryptionSdk__N8_dynamoDb__S35_GetEncryptedDataKeyDescriptionUnion__M6_header(value.Header)); -} if (value.IsSetPlaintextItem()) { - return software.amazon.cryptography.dbencryptionsdk.dynamodb.internaldafny.types.GetEncryptedDataKeyDescriptionUnion.create_plaintextItem(ToDafny_N3_aws__N12_cryptography__N15_dbEncryptionSdk__N8_dynamoDb__S35_GetEncryptedDataKeyDescriptionUnion__M13_plaintextItem(value.PlaintextItem)); -} -throw new System.ArgumentException("Invalid AWS.Cryptography.DbEncryptionSDK.DynamoDb.GetEncryptedDataKeyDescriptionUnion state"); -} - public static AWS.Cryptography.DbEncryptionSDK.DynamoDb.LegacyPolicy FromDafny_N3_aws__N12_cryptography__N15_dbEncryptionSdk__N8_dynamoDb__S12_LegacyPolicy (software.amazon.cryptography.dbencryptionsdk.dynamodb.internaldafny.types._ILegacyPolicy value) { - if (value.is_FORCE__LEGACY__ENCRYPT__ALLOW__LEGACY__DECRYPT) return AWS.Cryptography.DbEncryptionSDK.DynamoDb.LegacyPolicy.FORCE_LEGACY_ENCRYPT_ALLOW_LEGACY_DECRYPT; - if (value.is_FORBID__LEGACY__ENCRYPT__ALLOW__LEGACY__DECRYPT) return AWS.Cryptography.DbEncryptionSDK.DynamoDb.LegacyPolicy.FORBID_LEGACY_ENCRYPT_ALLOW_LEGACY_DECRYPT; - if (value.is_FORBID__LEGACY__ENCRYPT__FORBID__LEGACY__DECRYPT) return AWS.Cryptography.DbEncryptionSDK.DynamoDb.LegacyPolicy.FORBID_LEGACY_ENCRYPT_FORBID_LEGACY_DECRYPT; -throw new System.ArgumentException("Invalid AWS.Cryptography.DbEncryptionSDK.DynamoDb.LegacyPolicy value"); -} - public static software.amazon.cryptography.dbencryptionsdk.dynamodb.internaldafny.types._ILegacyPolicy ToDafny_N3_aws__N12_cryptography__N15_dbEncryptionSdk__N8_dynamoDb__S12_LegacyPolicy (AWS.Cryptography.DbEncryptionSDK.DynamoDb.LegacyPolicy value) { - if (AWS.Cryptography.DbEncryptionSDK.DynamoDb.LegacyPolicy.FORCE_LEGACY_ENCRYPT_ALLOW_LEGACY_DECRYPT.Equals(value)) return software.amazon.cryptography.dbencryptionsdk.dynamodb.internaldafny.types.LegacyPolicy.create_FORCE__LEGACY__ENCRYPT__ALLOW__LEGACY__DECRYPT(); - if (AWS.Cryptography.DbEncryptionSDK.DynamoDb.LegacyPolicy.FORBID_LEGACY_ENCRYPT_ALLOW_LEGACY_DECRYPT.Equals(value)) return software.amazon.cryptography.dbencryptionsdk.dynamodb.internaldafny.types.LegacyPolicy.create_FORBID__LEGACY__ENCRYPT__ALLOW__LEGACY__DECRYPT(); - if (AWS.Cryptography.DbEncryptionSDK.DynamoDb.LegacyPolicy.FORBID_LEGACY_ENCRYPT_FORBID_LEGACY_DECRYPT.Equals(value)) return software.amazon.cryptography.dbencryptionsdk.dynamodb.internaldafny.types.LegacyPolicy.create_FORBID__LEGACY__ENCRYPT__FORBID__LEGACY__DECRYPT(); -throw new System.ArgumentException("Invalid AWS.Cryptography.DbEncryptionSDK.DynamoDb.LegacyPolicy value"); -} - public static AWS.Cryptography.DbEncryptionSDK.DynamoDb.PlaintextOverride FromDafny_N3_aws__N12_cryptography__N15_dbEncryptionSdk__N8_dynamoDb__S17_PlaintextOverride (software.amazon.cryptography.dbencryptionsdk.dynamodb.internaldafny.types._IPlaintextOverride value) { - if (value.is_FORCE__PLAINTEXT__WRITE__ALLOW__PLAINTEXT__READ) return AWS.Cryptography.DbEncryptionSDK.DynamoDb.PlaintextOverride.FORCE_PLAINTEXT_WRITE_ALLOW_PLAINTEXT_READ; - if (value.is_FORBID__PLAINTEXT__WRITE__ALLOW__PLAINTEXT__READ) return AWS.Cryptography.DbEncryptionSDK.DynamoDb.PlaintextOverride.FORBID_PLAINTEXT_WRITE_ALLOW_PLAINTEXT_READ; - if (value.is_FORBID__PLAINTEXT__WRITE__FORBID__PLAINTEXT__READ) return AWS.Cryptography.DbEncryptionSDK.DynamoDb.PlaintextOverride.FORBID_PLAINTEXT_WRITE_FORBID_PLAINTEXT_READ; -throw new System.ArgumentException("Invalid AWS.Cryptography.DbEncryptionSDK.DynamoDb.PlaintextOverride value"); -} - public static software.amazon.cryptography.dbencryptionsdk.dynamodb.internaldafny.types._IPlaintextOverride ToDafny_N3_aws__N12_cryptography__N15_dbEncryptionSdk__N8_dynamoDb__S17_PlaintextOverride (AWS.Cryptography.DbEncryptionSDK.DynamoDb.PlaintextOverride value) { - if (AWS.Cryptography.DbEncryptionSDK.DynamoDb.PlaintextOverride.FORCE_PLAINTEXT_WRITE_ALLOW_PLAINTEXT_READ.Equals(value)) return software.amazon.cryptography.dbencryptionsdk.dynamodb.internaldafny.types.PlaintextOverride.create_FORCE__PLAINTEXT__WRITE__ALLOW__PLAINTEXT__READ(); - if (AWS.Cryptography.DbEncryptionSDK.DynamoDb.PlaintextOverride.FORBID_PLAINTEXT_WRITE_ALLOW_PLAINTEXT_READ.Equals(value)) return software.amazon.cryptography.dbencryptionsdk.dynamodb.internaldafny.types.PlaintextOverride.create_FORBID__PLAINTEXT__WRITE__ALLOW__PLAINTEXT__READ(); - if (AWS.Cryptography.DbEncryptionSDK.DynamoDb.PlaintextOverride.FORBID_PLAINTEXT_WRITE_FORBID_PLAINTEXT_READ.Equals(value)) return software.amazon.cryptography.dbencryptionsdk.dynamodb.internaldafny.types.PlaintextOverride.create_FORBID__PLAINTEXT__WRITE__FORBID__PLAINTEXT__READ(); -throw new System.ArgumentException("Invalid AWS.Cryptography.DbEncryptionSDK.DynamoDb.PlaintextOverride value"); -} - public static AWS.Cryptography.DbEncryptionSDK.DynamoDb.VirtualTransform FromDafny_N3_aws__N12_cryptography__N15_dbEncryptionSdk__N8_dynamoDb__S16_VirtualTransform (software.amazon.cryptography.dbencryptionsdk.dynamodb.internaldafny.types._IVirtualTransform value) { - software.amazon.cryptography.dbencryptionsdk.dynamodb.internaldafny.types.VirtualTransform concrete = (software.amazon.cryptography.dbencryptionsdk.dynamodb.internaldafny.types.VirtualTransform)value; - var converted = new AWS.Cryptography.DbEncryptionSDK.DynamoDb.VirtualTransform(); if (value.is_upper) { - converted.Upper = FromDafny_N3_aws__N12_cryptography__N15_dbEncryptionSdk__N8_dynamoDb__S16_VirtualTransform__M5_upper(concrete.dtor_upper); - return converted; -} if (value.is_lower) { - converted.Lower = FromDafny_N3_aws__N12_cryptography__N15_dbEncryptionSdk__N8_dynamoDb__S16_VirtualTransform__M5_lower(concrete.dtor_lower); - return converted; -} if (value.is_insert) { - converted.Insert = FromDafny_N3_aws__N12_cryptography__N15_dbEncryptionSdk__N8_dynamoDb__S16_VirtualTransform__M6_insert(concrete.dtor_insert); - return converted; -} if (value.is_prefix) { - converted.Prefix = FromDafny_N3_aws__N12_cryptography__N15_dbEncryptionSdk__N8_dynamoDb__S16_VirtualTransform__M6_prefix(concrete.dtor_prefix); - return converted; -} if (value.is_suffix) { - converted.Suffix = FromDafny_N3_aws__N12_cryptography__N15_dbEncryptionSdk__N8_dynamoDb__S16_VirtualTransform__M6_suffix(concrete.dtor_suffix); - return converted; -} if (value.is_substring) { - converted.Substring = FromDafny_N3_aws__N12_cryptography__N15_dbEncryptionSdk__N8_dynamoDb__S16_VirtualTransform__M9_substring(concrete.dtor_substring); - return converted; -} if (value.is_segment) { - converted.Segment = FromDafny_N3_aws__N12_cryptography__N15_dbEncryptionSdk__N8_dynamoDb__S16_VirtualTransform__M7_segment(concrete.dtor_segment); - return converted; -} if (value.is_segments) { - converted.Segments = FromDafny_N3_aws__N12_cryptography__N15_dbEncryptionSdk__N8_dynamoDb__S16_VirtualTransform__M8_segments(concrete.dtor_segments); - return converted; -} -throw new System.ArgumentException("Invalid AWS.Cryptography.DbEncryptionSDK.DynamoDb.VirtualTransform state"); -} - public static software.amazon.cryptography.dbencryptionsdk.dynamodb.internaldafny.types._IVirtualTransform ToDafny_N3_aws__N12_cryptography__N15_dbEncryptionSdk__N8_dynamoDb__S16_VirtualTransform (AWS.Cryptography.DbEncryptionSDK.DynamoDb.VirtualTransform value) { - if (value.IsSetUpper()) { - return software.amazon.cryptography.dbencryptionsdk.dynamodb.internaldafny.types.VirtualTransform.create_upper(ToDafny_N3_aws__N12_cryptography__N15_dbEncryptionSdk__N8_dynamoDb__S16_VirtualTransform__M5_upper(value.Upper)); -} if (value.IsSetLower()) { - return software.amazon.cryptography.dbencryptionsdk.dynamodb.internaldafny.types.VirtualTransform.create_lower(ToDafny_N3_aws__N12_cryptography__N15_dbEncryptionSdk__N8_dynamoDb__S16_VirtualTransform__M5_lower(value.Lower)); -} if (value.IsSetInsert()) { - return software.amazon.cryptography.dbencryptionsdk.dynamodb.internaldafny.types.VirtualTransform.create_insert(ToDafny_N3_aws__N12_cryptography__N15_dbEncryptionSdk__N8_dynamoDb__S16_VirtualTransform__M6_insert(value.Insert)); -} if (value.IsSetPrefix()) { - return software.amazon.cryptography.dbencryptionsdk.dynamodb.internaldafny.types.VirtualTransform.create_prefix(ToDafny_N3_aws__N12_cryptography__N15_dbEncryptionSdk__N8_dynamoDb__S16_VirtualTransform__M6_prefix(value.Prefix)); -} if (value.IsSetSuffix()) { - return software.amazon.cryptography.dbencryptionsdk.dynamodb.internaldafny.types.VirtualTransform.create_suffix(ToDafny_N3_aws__N12_cryptography__N15_dbEncryptionSdk__N8_dynamoDb__S16_VirtualTransform__M6_suffix(value.Suffix)); -} if (value.IsSetSubstring()) { - return software.amazon.cryptography.dbencryptionsdk.dynamodb.internaldafny.types.VirtualTransform.create_substring(ToDafny_N3_aws__N12_cryptography__N15_dbEncryptionSdk__N8_dynamoDb__S16_VirtualTransform__M9_substring(value.Substring)); -} if (value.IsSetSegment()) { - return software.amazon.cryptography.dbencryptionsdk.dynamodb.internaldafny.types.VirtualTransform.create_segment(ToDafny_N3_aws__N12_cryptography__N15_dbEncryptionSdk__N8_dynamoDb__S16_VirtualTransform__M7_segment(value.Segment)); -} if (value.IsSetSegments()) { - return software.amazon.cryptography.dbencryptionsdk.dynamodb.internaldafny.types.VirtualTransform.create_segments(ToDafny_N3_aws__N12_cryptography__N15_dbEncryptionSdk__N8_dynamoDb__S16_VirtualTransform__M8_segments(value.Segments)); -} -throw new System.ArgumentException("Invalid AWS.Cryptography.DbEncryptionSDK.DynamoDb.VirtualTransform state"); -} - public static AWS.Cryptography.DbEncryptionSDK.DynamoDb.SingleKeyStore FromDafny_N3_aws__N12_cryptography__N15_dbEncryptionSdk__N8_dynamoDb__S15_BeaconKeySource__M6_single (software.amazon.cryptography.dbencryptionsdk.dynamodb.internaldafny.types._ISingleKeyStore value) { - return FromDafny_N3_aws__N12_cryptography__N15_dbEncryptionSdk__N8_dynamoDb__S14_SingleKeyStore(value); -} - public static software.amazon.cryptography.dbencryptionsdk.dynamodb.internaldafny.types._ISingleKeyStore ToDafny_N3_aws__N12_cryptography__N15_dbEncryptionSdk__N8_dynamoDb__S15_BeaconKeySource__M6_single (AWS.Cryptography.DbEncryptionSDK.DynamoDb.SingleKeyStore value) { - return ToDafny_N3_aws__N12_cryptography__N15_dbEncryptionSdk__N8_dynamoDb__S14_SingleKeyStore(value); -} - public static AWS.Cryptography.DbEncryptionSDK.DynamoDb.MultiKeyStore FromDafny_N3_aws__N12_cryptography__N15_dbEncryptionSdk__N8_dynamoDb__S15_BeaconKeySource__M5_multi (software.amazon.cryptography.dbencryptionsdk.dynamodb.internaldafny.types._IMultiKeyStore value) { - return FromDafny_N3_aws__N12_cryptography__N15_dbEncryptionSdk__N8_dynamoDb__S13_MultiKeyStore(value); -} - public static software.amazon.cryptography.dbencryptionsdk.dynamodb.internaldafny.types._IMultiKeyStore ToDafny_N3_aws__N12_cryptography__N15_dbEncryptionSdk__N8_dynamoDb__S15_BeaconKeySource__M5_multi (AWS.Cryptography.DbEncryptionSDK.DynamoDb.MultiKeyStore value) { - return ToDafny_N3_aws__N12_cryptography__N15_dbEncryptionSdk__N8_dynamoDb__S13_MultiKeyStore(value); -} - public static AWS.Cryptography.DbEncryptionSDK.DynamoDb.PartOnly FromDafny_N3_aws__N12_cryptography__N15_dbEncryptionSdk__N8_dynamoDb__S11_BeaconStyle__M8_partOnly (software.amazon.cryptography.dbencryptionsdk.dynamodb.internaldafny.types._IPartOnly value) { - return FromDafny_N3_aws__N12_cryptography__N15_dbEncryptionSdk__N8_dynamoDb__S8_PartOnly(value); -} - public static software.amazon.cryptography.dbencryptionsdk.dynamodb.internaldafny.types._IPartOnly ToDafny_N3_aws__N12_cryptography__N15_dbEncryptionSdk__N8_dynamoDb__S11_BeaconStyle__M8_partOnly (AWS.Cryptography.DbEncryptionSDK.DynamoDb.PartOnly value) { - return ToDafny_N3_aws__N12_cryptography__N15_dbEncryptionSdk__N8_dynamoDb__S8_PartOnly(value); -} - public static AWS.Cryptography.DbEncryptionSDK.DynamoDb.Shared FromDafny_N3_aws__N12_cryptography__N15_dbEncryptionSdk__N8_dynamoDb__S11_BeaconStyle__M6_shared (software.amazon.cryptography.dbencryptionsdk.dynamodb.internaldafny.types._IShared value) { - return FromDafny_N3_aws__N12_cryptography__N15_dbEncryptionSdk__N8_dynamoDb__S6_Shared(value); -} - public static software.amazon.cryptography.dbencryptionsdk.dynamodb.internaldafny.types._IShared ToDafny_N3_aws__N12_cryptography__N15_dbEncryptionSdk__N8_dynamoDb__S11_BeaconStyle__M6_shared (AWS.Cryptography.DbEncryptionSDK.DynamoDb.Shared value) { - return ToDafny_N3_aws__N12_cryptography__N15_dbEncryptionSdk__N8_dynamoDb__S6_Shared(value); -} - public static AWS.Cryptography.DbEncryptionSDK.DynamoDb.AsSet FromDafny_N3_aws__N12_cryptography__N15_dbEncryptionSdk__N8_dynamoDb__S11_BeaconStyle__M5_asSet (software.amazon.cryptography.dbencryptionsdk.dynamodb.internaldafny.types._IAsSet value) { - return FromDafny_N3_aws__N12_cryptography__N15_dbEncryptionSdk__N8_dynamoDb__S5_AsSet(value); -} - public static software.amazon.cryptography.dbencryptionsdk.dynamodb.internaldafny.types._IAsSet ToDafny_N3_aws__N12_cryptography__N15_dbEncryptionSdk__N8_dynamoDb__S11_BeaconStyle__M5_asSet (AWS.Cryptography.DbEncryptionSDK.DynamoDb.AsSet value) { - return ToDafny_N3_aws__N12_cryptography__N15_dbEncryptionSdk__N8_dynamoDb__S5_AsSet(value); -} - public static AWS.Cryptography.DbEncryptionSDK.DynamoDb.SharedSet FromDafny_N3_aws__N12_cryptography__N15_dbEncryptionSdk__N8_dynamoDb__S11_BeaconStyle__M9_sharedSet (software.amazon.cryptography.dbencryptionsdk.dynamodb.internaldafny.types._ISharedSet value) { - return FromDafny_N3_aws__N12_cryptography__N15_dbEncryptionSdk__N8_dynamoDb__S9_SharedSet(value); -} - public static software.amazon.cryptography.dbencryptionsdk.dynamodb.internaldafny.types._ISharedSet ToDafny_N3_aws__N12_cryptography__N15_dbEncryptionSdk__N8_dynamoDb__S11_BeaconStyle__M9_sharedSet (AWS.Cryptography.DbEncryptionSDK.DynamoDb.SharedSet value) { - return ToDafny_N3_aws__N12_cryptography__N15_dbEncryptionSdk__N8_dynamoDb__S9_SharedSet(value); -} - public static AWS.Cryptography.DbEncryptionSDK.DynamoDb.IDynamoDbKeyBranchKeyIdSupplier FromDafny_N3_aws__N12_cryptography__N15_dbEncryptionSdk__N8_dynamoDb__S48_CreateDynamoDbEncryptionBranchKeyIdSupplierInput__M25_ddbKeyBranchKeyIdSupplier (software.amazon.cryptography.dbencryptionsdk.dynamodb.internaldafny.types.IDynamoDbKeyBranchKeyIdSupplier value) { - return FromDafny_N3_aws__N12_cryptography__N15_dbEncryptionSdk__N8_dynamoDb__S39_DynamoDbKeyBranchKeyIdSupplierReference(value); -} - public static software.amazon.cryptography.dbencryptionsdk.dynamodb.internaldafny.types.IDynamoDbKeyBranchKeyIdSupplier ToDafny_N3_aws__N12_cryptography__N15_dbEncryptionSdk__N8_dynamoDb__S48_CreateDynamoDbEncryptionBranchKeyIdSupplierInput__M25_ddbKeyBranchKeyIdSupplier (AWS.Cryptography.DbEncryptionSDK.DynamoDb.IDynamoDbKeyBranchKeyIdSupplier value) { - return ToDafny_N3_aws__N12_cryptography__N15_dbEncryptionSdk__N8_dynamoDb__S39_DynamoDbKeyBranchKeyIdSupplierReference(value); -} - public static AWS.Cryptography.MaterialProviders.IBranchKeyIdSupplier FromDafny_N3_aws__N12_cryptography__N15_dbEncryptionSdk__N8_dynamoDb__S49_CreateDynamoDbEncryptionBranchKeyIdSupplierOutput__M19_branchKeyIdSupplier (software.amazon.cryptography.materialproviders.internaldafny.types.IBranchKeyIdSupplier value) { - return FromDafny_N3_aws__N12_cryptography__N17_materialProviders__S28_BranchKeyIdSupplierReference(value); -} - public static software.amazon.cryptography.materialproviders.internaldafny.types.IBranchKeyIdSupplier ToDafny_N3_aws__N12_cryptography__N15_dbEncryptionSdk__N8_dynamoDb__S49_CreateDynamoDbEncryptionBranchKeyIdSupplierOutput__M19_branchKeyIdSupplier (AWS.Cryptography.MaterialProviders.IBranchKeyIdSupplier value) { - return ToDafny_N3_aws__N12_cryptography__N17_materialProviders__S28_BranchKeyIdSupplierReference(value); -} - public static string FromDafny_N3_aws__N12_cryptography__N15_dbEncryptionSdk__N8_dynamoDb__S27_DynamoDbEncryptionException__M7_message (Dafny.ISequence value) { - return FromDafny_N6_smithy__N3_api__S6_String(value); -} - public static Dafny.ISequence ToDafny_N3_aws__N12_cryptography__N15_dbEncryptionSdk__N8_dynamoDb__S27_DynamoDbEncryptionException__M7_message (string value) { - return ToDafny_N6_smithy__N3_api__S6_String(value); -} - public static System.Collections.Generic.Dictionary FromDafny_N3_aws__N12_cryptography__N15_dbEncryptionSdk__N8_dynamoDb__S29_GetBranchKeyIdFromDdbKeyInput__M6_ddbKey (Dafny.IMap, software.amazon.cryptography.services.dynamodb.internaldafny.types._IAttributeValue> value) { - return FromDafny_N3_com__N9_amazonaws__N8_dynamodb__S3_Key(value); -} - public static Dafny.IMap, software.amazon.cryptography.services.dynamodb.internaldafny.types._IAttributeValue> ToDafny_N3_aws__N12_cryptography__N15_dbEncryptionSdk__N8_dynamoDb__S29_GetBranchKeyIdFromDdbKeyInput__M6_ddbKey (System.Collections.Generic.Dictionary value) { - return ToDafny_N3_com__N9_amazonaws__N8_dynamodb__S3_Key(value); -} - public static string FromDafny_N3_aws__N12_cryptography__N15_dbEncryptionSdk__N8_dynamoDb__S30_GetBranchKeyIdFromDdbKeyOutput__M11_branchKeyId (Dafny.ISequence value) { - return FromDafny_N6_smithy__N3_api__S6_String(value); -} - public static Dafny.ISequence ToDafny_N3_aws__N12_cryptography__N15_dbEncryptionSdk__N8_dynamoDb__S30_GetBranchKeyIdFromDdbKeyOutput__M11_branchKeyId (string value) { - return ToDafny_N6_smithy__N3_api__S6_String(value); -} - public static AWS.Cryptography.DbEncryptionSDK.DynamoDb.GetEncryptedDataKeyDescriptionUnion FromDafny_N3_aws__N12_cryptography__N15_dbEncryptionSdk__N8_dynamoDb__S35_GetEncryptedDataKeyDescriptionInput__M5_input (software.amazon.cryptography.dbencryptionsdk.dynamodb.internaldafny.types._IGetEncryptedDataKeyDescriptionUnion value) { - return FromDafny_N3_aws__N12_cryptography__N15_dbEncryptionSdk__N8_dynamoDb__S35_GetEncryptedDataKeyDescriptionUnion(value); -} - public static software.amazon.cryptography.dbencryptionsdk.dynamodb.internaldafny.types._IGetEncryptedDataKeyDescriptionUnion ToDafny_N3_aws__N12_cryptography__N15_dbEncryptionSdk__N8_dynamoDb__S35_GetEncryptedDataKeyDescriptionInput__M5_input (AWS.Cryptography.DbEncryptionSDK.DynamoDb.GetEncryptedDataKeyDescriptionUnion value) { - return ToDafny_N3_aws__N12_cryptography__N15_dbEncryptionSdk__N8_dynamoDb__S35_GetEncryptedDataKeyDescriptionUnion(value); -} - public static System.Collections.Generic.List FromDafny_N3_aws__N12_cryptography__N15_dbEncryptionSdk__N8_dynamoDb__S36_GetEncryptedDataKeyDescriptionOutput__M33_EncryptedDataKeyDescriptionOutput (Dafny.ISequence value) { - return FromDafny_N3_aws__N12_cryptography__N15_dbEncryptionSdk__N8_dynamoDb__S31_EncryptedDataKeyDescriptionList(value); -} - public static Dafny.ISequence ToDafny_N3_aws__N12_cryptography__N15_dbEncryptionSdk__N8_dynamoDb__S36_GetEncryptedDataKeyDescriptionOutput__M33_EncryptedDataKeyDescriptionOutput (System.Collections.Generic.List value) { - return ToDafny_N3_aws__N12_cryptography__N15_dbEncryptionSdk__N8_dynamoDb__S31_EncryptedDataKeyDescriptionList(value); -} - public static System.IO.MemoryStream FromDafny_N3_aws__N12_cryptography__N15_dbEncryptionSdk__N8_dynamoDb__S35_GetEncryptedDataKeyDescriptionUnion__M6_header (Dafny.ISequence value) { - return FromDafny_N6_smithy__N3_api__S4_Blob(value); -} - public static Dafny.ISequence ToDafny_N3_aws__N12_cryptography__N15_dbEncryptionSdk__N8_dynamoDb__S35_GetEncryptedDataKeyDescriptionUnion__M6_header (System.IO.MemoryStream value) { - return ToDafny_N6_smithy__N3_api__S4_Blob(value); -} - public static System.Collections.Generic.Dictionary FromDafny_N3_aws__N12_cryptography__N15_dbEncryptionSdk__N8_dynamoDb__S35_GetEncryptedDataKeyDescriptionUnion__M13_plaintextItem (Dafny.IMap, software.amazon.cryptography.services.dynamodb.internaldafny.types._IAttributeValue> value) { - return FromDafny_N3_com__N9_amazonaws__N8_dynamodb__S12_AttributeMap(value); -} - public static Dafny.IMap, software.amazon.cryptography.services.dynamodb.internaldafny.types._IAttributeValue> ToDafny_N3_aws__N12_cryptography__N15_dbEncryptionSdk__N8_dynamoDb__S35_GetEncryptedDataKeyDescriptionUnion__M13_plaintextItem (System.Collections.Generic.Dictionary value) { - return ToDafny_N3_com__N9_amazonaws__N8_dynamodb__S12_AttributeMap(value); -} - public static AWS.Cryptography.DbEncryptionSDK.DynamoDb.Upper FromDafny_N3_aws__N12_cryptography__N15_dbEncryptionSdk__N8_dynamoDb__S16_VirtualTransform__M5_upper (software.amazon.cryptography.dbencryptionsdk.dynamodb.internaldafny.types._IUpper value) { - return FromDafny_N3_aws__N12_cryptography__N15_dbEncryptionSdk__N8_dynamoDb__S5_Upper(value); -} - public static software.amazon.cryptography.dbencryptionsdk.dynamodb.internaldafny.types._IUpper ToDafny_N3_aws__N12_cryptography__N15_dbEncryptionSdk__N8_dynamoDb__S16_VirtualTransform__M5_upper (AWS.Cryptography.DbEncryptionSDK.DynamoDb.Upper value) { - return ToDafny_N3_aws__N12_cryptography__N15_dbEncryptionSdk__N8_dynamoDb__S5_Upper(value); -} - public static AWS.Cryptography.DbEncryptionSDK.DynamoDb.Lower FromDafny_N3_aws__N12_cryptography__N15_dbEncryptionSdk__N8_dynamoDb__S16_VirtualTransform__M5_lower (software.amazon.cryptography.dbencryptionsdk.dynamodb.internaldafny.types._ILower value) { - return FromDafny_N3_aws__N12_cryptography__N15_dbEncryptionSdk__N8_dynamoDb__S5_Lower(value); -} - public static software.amazon.cryptography.dbencryptionsdk.dynamodb.internaldafny.types._ILower ToDafny_N3_aws__N12_cryptography__N15_dbEncryptionSdk__N8_dynamoDb__S16_VirtualTransform__M5_lower (AWS.Cryptography.DbEncryptionSDK.DynamoDb.Lower value) { - return ToDafny_N3_aws__N12_cryptography__N15_dbEncryptionSdk__N8_dynamoDb__S5_Lower(value); -} - public static AWS.Cryptography.DbEncryptionSDK.DynamoDb.Insert FromDafny_N3_aws__N12_cryptography__N15_dbEncryptionSdk__N8_dynamoDb__S16_VirtualTransform__M6_insert (software.amazon.cryptography.dbencryptionsdk.dynamodb.internaldafny.types._IInsert value) { - return FromDafny_N3_aws__N12_cryptography__N15_dbEncryptionSdk__N8_dynamoDb__S6_Insert(value); -} - public static software.amazon.cryptography.dbencryptionsdk.dynamodb.internaldafny.types._IInsert ToDafny_N3_aws__N12_cryptography__N15_dbEncryptionSdk__N8_dynamoDb__S16_VirtualTransform__M6_insert (AWS.Cryptography.DbEncryptionSDK.DynamoDb.Insert value) { - return ToDafny_N3_aws__N12_cryptography__N15_dbEncryptionSdk__N8_dynamoDb__S6_Insert(value); -} - public static AWS.Cryptography.DbEncryptionSDK.DynamoDb.GetPrefix FromDafny_N3_aws__N12_cryptography__N15_dbEncryptionSdk__N8_dynamoDb__S16_VirtualTransform__M6_prefix (software.amazon.cryptography.dbencryptionsdk.dynamodb.internaldafny.types._IGetPrefix value) { - return FromDafny_N3_aws__N12_cryptography__N15_dbEncryptionSdk__N8_dynamoDb__S9_GetPrefix(value); -} - public static software.amazon.cryptography.dbencryptionsdk.dynamodb.internaldafny.types._IGetPrefix ToDafny_N3_aws__N12_cryptography__N15_dbEncryptionSdk__N8_dynamoDb__S16_VirtualTransform__M6_prefix (AWS.Cryptography.DbEncryptionSDK.DynamoDb.GetPrefix value) { - return ToDafny_N3_aws__N12_cryptography__N15_dbEncryptionSdk__N8_dynamoDb__S9_GetPrefix(value); -} - public static AWS.Cryptography.DbEncryptionSDK.DynamoDb.GetSuffix FromDafny_N3_aws__N12_cryptography__N15_dbEncryptionSdk__N8_dynamoDb__S16_VirtualTransform__M6_suffix (software.amazon.cryptography.dbencryptionsdk.dynamodb.internaldafny.types._IGetSuffix value) { - return FromDafny_N3_aws__N12_cryptography__N15_dbEncryptionSdk__N8_dynamoDb__S9_GetSuffix(value); -} - public static software.amazon.cryptography.dbencryptionsdk.dynamodb.internaldafny.types._IGetSuffix ToDafny_N3_aws__N12_cryptography__N15_dbEncryptionSdk__N8_dynamoDb__S16_VirtualTransform__M6_suffix (AWS.Cryptography.DbEncryptionSDK.DynamoDb.GetSuffix value) { - return ToDafny_N3_aws__N12_cryptography__N15_dbEncryptionSdk__N8_dynamoDb__S9_GetSuffix(value); -} - public static AWS.Cryptography.DbEncryptionSDK.DynamoDb.GetSubstring FromDafny_N3_aws__N12_cryptography__N15_dbEncryptionSdk__N8_dynamoDb__S16_VirtualTransform__M9_substring (software.amazon.cryptography.dbencryptionsdk.dynamodb.internaldafny.types._IGetSubstring value) { - return FromDafny_N3_aws__N12_cryptography__N15_dbEncryptionSdk__N8_dynamoDb__S12_GetSubstring(value); -} - public static software.amazon.cryptography.dbencryptionsdk.dynamodb.internaldafny.types._IGetSubstring ToDafny_N3_aws__N12_cryptography__N15_dbEncryptionSdk__N8_dynamoDb__S16_VirtualTransform__M9_substring (AWS.Cryptography.DbEncryptionSDK.DynamoDb.GetSubstring value) { - return ToDafny_N3_aws__N12_cryptography__N15_dbEncryptionSdk__N8_dynamoDb__S12_GetSubstring(value); -} - public static AWS.Cryptography.DbEncryptionSDK.DynamoDb.GetSegment FromDafny_N3_aws__N12_cryptography__N15_dbEncryptionSdk__N8_dynamoDb__S16_VirtualTransform__M7_segment (software.amazon.cryptography.dbencryptionsdk.dynamodb.internaldafny.types._IGetSegment value) { - return FromDafny_N3_aws__N12_cryptography__N15_dbEncryptionSdk__N8_dynamoDb__S10_GetSegment(value); -} - public static software.amazon.cryptography.dbencryptionsdk.dynamodb.internaldafny.types._IGetSegment ToDafny_N3_aws__N12_cryptography__N15_dbEncryptionSdk__N8_dynamoDb__S16_VirtualTransform__M7_segment (AWS.Cryptography.DbEncryptionSDK.DynamoDb.GetSegment value) { - return ToDafny_N3_aws__N12_cryptography__N15_dbEncryptionSdk__N8_dynamoDb__S10_GetSegment(value); -} - public static AWS.Cryptography.DbEncryptionSDK.DynamoDb.GetSegments FromDafny_N3_aws__N12_cryptography__N15_dbEncryptionSdk__N8_dynamoDb__S16_VirtualTransform__M8_segments (software.amazon.cryptography.dbencryptionsdk.dynamodb.internaldafny.types._IGetSegments value) { - return FromDafny_N3_aws__N12_cryptography__N15_dbEncryptionSdk__N8_dynamoDb__S11_GetSegments(value); -} - public static software.amazon.cryptography.dbencryptionsdk.dynamodb.internaldafny.types._IGetSegments ToDafny_N3_aws__N12_cryptography__N15_dbEncryptionSdk__N8_dynamoDb__S16_VirtualTransform__M8_segments (AWS.Cryptography.DbEncryptionSDK.DynamoDb.GetSegments value) { - return ToDafny_N3_aws__N12_cryptography__N15_dbEncryptionSdk__N8_dynamoDb__S11_GetSegments(value); -} - public static AWS.Cryptography.DbEncryptionSDK.DynamoDb.SingleKeyStore FromDafny_N3_aws__N12_cryptography__N15_dbEncryptionSdk__N8_dynamoDb__S14_SingleKeyStore (software.amazon.cryptography.dbencryptionsdk.dynamodb.internaldafny.types._ISingleKeyStore value) { - software.amazon.cryptography.dbencryptionsdk.dynamodb.internaldafny.types.SingleKeyStore concrete = (software.amazon.cryptography.dbencryptionsdk.dynamodb.internaldafny.types.SingleKeyStore)value; AWS.Cryptography.DbEncryptionSDK.DynamoDb.SingleKeyStore converted = new AWS.Cryptography.DbEncryptionSDK.DynamoDb.SingleKeyStore(); converted.KeyId = (string) FromDafny_N3_aws__N12_cryptography__N15_dbEncryptionSdk__N8_dynamoDb__S14_SingleKeyStore__M5_keyId(concrete._keyId); - converted.CacheTTL = (int) FromDafny_N3_aws__N12_cryptography__N15_dbEncryptionSdk__N8_dynamoDb__S14_SingleKeyStore__M8_cacheTTL(concrete._cacheTTL); return converted; -} - public static software.amazon.cryptography.dbencryptionsdk.dynamodb.internaldafny.types._ISingleKeyStore ToDafny_N3_aws__N12_cryptography__N15_dbEncryptionSdk__N8_dynamoDb__S14_SingleKeyStore (AWS.Cryptography.DbEncryptionSDK.DynamoDb.SingleKeyStore value) { - - return new software.amazon.cryptography.dbencryptionsdk.dynamodb.internaldafny.types.SingleKeyStore ( ToDafny_N3_aws__N12_cryptography__N15_dbEncryptionSdk__N8_dynamoDb__S14_SingleKeyStore__M5_keyId(value.KeyId) , ToDafny_N3_aws__N12_cryptography__N15_dbEncryptionSdk__N8_dynamoDb__S14_SingleKeyStore__M8_cacheTTL(value.CacheTTL) ) ; -} - public static AWS.Cryptography.DbEncryptionSDK.DynamoDb.MultiKeyStore FromDafny_N3_aws__N12_cryptography__N15_dbEncryptionSdk__N8_dynamoDb__S13_MultiKeyStore (software.amazon.cryptography.dbencryptionsdk.dynamodb.internaldafny.types._IMultiKeyStore value) { - software.amazon.cryptography.dbencryptionsdk.dynamodb.internaldafny.types.MultiKeyStore concrete = (software.amazon.cryptography.dbencryptionsdk.dynamodb.internaldafny.types.MultiKeyStore)value; AWS.Cryptography.DbEncryptionSDK.DynamoDb.MultiKeyStore converted = new AWS.Cryptography.DbEncryptionSDK.DynamoDb.MultiKeyStore(); converted.KeyFieldName = (string) FromDafny_N3_aws__N12_cryptography__N15_dbEncryptionSdk__N8_dynamoDb__S13_MultiKeyStore__M12_keyFieldName(concrete._keyFieldName); - converted.CacheTTL = (int) FromDafny_N3_aws__N12_cryptography__N15_dbEncryptionSdk__N8_dynamoDb__S13_MultiKeyStore__M8_cacheTTL(concrete._cacheTTL); - if (concrete._cache.is_Some) converted.Cache = (AWS.Cryptography.MaterialProviders.CacheType) FromDafny_N3_aws__N12_cryptography__N15_dbEncryptionSdk__N8_dynamoDb__S13_MultiKeyStore__M5_cache(concrete._cache); return converted; -} - public static software.amazon.cryptography.dbencryptionsdk.dynamodb.internaldafny.types._IMultiKeyStore ToDafny_N3_aws__N12_cryptography__N15_dbEncryptionSdk__N8_dynamoDb__S13_MultiKeyStore (AWS.Cryptography.DbEncryptionSDK.DynamoDb.MultiKeyStore value) { - AWS.Cryptography.MaterialProviders.CacheType var_cache = value.IsSetCache() ? value.Cache : (AWS.Cryptography.MaterialProviders.CacheType) null; - return new software.amazon.cryptography.dbencryptionsdk.dynamodb.internaldafny.types.MultiKeyStore ( ToDafny_N3_aws__N12_cryptography__N15_dbEncryptionSdk__N8_dynamoDb__S13_MultiKeyStore__M12_keyFieldName(value.KeyFieldName) , ToDafny_N3_aws__N12_cryptography__N15_dbEncryptionSdk__N8_dynamoDb__S13_MultiKeyStore__M8_cacheTTL(value.CacheTTL) , ToDafny_N3_aws__N12_cryptography__N15_dbEncryptionSdk__N8_dynamoDb__S13_MultiKeyStore__M5_cache(var_cache) ) ; -} - public static AWS.Cryptography.DbEncryptionSDK.DynamoDb.PartOnly FromDafny_N3_aws__N12_cryptography__N15_dbEncryptionSdk__N8_dynamoDb__S8_PartOnly (software.amazon.cryptography.dbencryptionsdk.dynamodb.internaldafny.types._IPartOnly value) { - software.amazon.cryptography.dbencryptionsdk.dynamodb.internaldafny.types.PartOnly concrete = (software.amazon.cryptography.dbencryptionsdk.dynamodb.internaldafny.types.PartOnly)value; AWS.Cryptography.DbEncryptionSDK.DynamoDb.PartOnly converted = new AWS.Cryptography.DbEncryptionSDK.DynamoDb.PartOnly(); return converted; -} - public static software.amazon.cryptography.dbencryptionsdk.dynamodb.internaldafny.types._IPartOnly ToDafny_N3_aws__N12_cryptography__N15_dbEncryptionSdk__N8_dynamoDb__S8_PartOnly (AWS.Cryptography.DbEncryptionSDK.DynamoDb.PartOnly value) { - - return new software.amazon.cryptography.dbencryptionsdk.dynamodb.internaldafny.types.PartOnly ( ) ; -} - public static AWS.Cryptography.DbEncryptionSDK.DynamoDb.Shared FromDafny_N3_aws__N12_cryptography__N15_dbEncryptionSdk__N8_dynamoDb__S6_Shared (software.amazon.cryptography.dbencryptionsdk.dynamodb.internaldafny.types._IShared value) { - software.amazon.cryptography.dbencryptionsdk.dynamodb.internaldafny.types.Shared concrete = (software.amazon.cryptography.dbencryptionsdk.dynamodb.internaldafny.types.Shared)value; AWS.Cryptography.DbEncryptionSDK.DynamoDb.Shared converted = new AWS.Cryptography.DbEncryptionSDK.DynamoDb.Shared(); converted.Other = (string) FromDafny_N3_aws__N12_cryptography__N15_dbEncryptionSdk__N8_dynamoDb__S6_Shared__M5_other(concrete._other); return converted; -} - public static software.amazon.cryptography.dbencryptionsdk.dynamodb.internaldafny.types._IShared ToDafny_N3_aws__N12_cryptography__N15_dbEncryptionSdk__N8_dynamoDb__S6_Shared (AWS.Cryptography.DbEncryptionSDK.DynamoDb.Shared value) { - - return new software.amazon.cryptography.dbencryptionsdk.dynamodb.internaldafny.types.Shared ( ToDafny_N3_aws__N12_cryptography__N15_dbEncryptionSdk__N8_dynamoDb__S6_Shared__M5_other(value.Other) ) ; -} - public static AWS.Cryptography.DbEncryptionSDK.DynamoDb.AsSet FromDafny_N3_aws__N12_cryptography__N15_dbEncryptionSdk__N8_dynamoDb__S5_AsSet (software.amazon.cryptography.dbencryptionsdk.dynamodb.internaldafny.types._IAsSet value) { - software.amazon.cryptography.dbencryptionsdk.dynamodb.internaldafny.types.AsSet concrete = (software.amazon.cryptography.dbencryptionsdk.dynamodb.internaldafny.types.AsSet)value; AWS.Cryptography.DbEncryptionSDK.DynamoDb.AsSet converted = new AWS.Cryptography.DbEncryptionSDK.DynamoDb.AsSet(); return converted; -} - public static software.amazon.cryptography.dbencryptionsdk.dynamodb.internaldafny.types._IAsSet ToDafny_N3_aws__N12_cryptography__N15_dbEncryptionSdk__N8_dynamoDb__S5_AsSet (AWS.Cryptography.DbEncryptionSDK.DynamoDb.AsSet value) { - - return new software.amazon.cryptography.dbencryptionsdk.dynamodb.internaldafny.types.AsSet ( ) ; -} - public static AWS.Cryptography.DbEncryptionSDK.DynamoDb.SharedSet FromDafny_N3_aws__N12_cryptography__N15_dbEncryptionSdk__N8_dynamoDb__S9_SharedSet (software.amazon.cryptography.dbencryptionsdk.dynamodb.internaldafny.types._ISharedSet value) { - software.amazon.cryptography.dbencryptionsdk.dynamodb.internaldafny.types.SharedSet concrete = (software.amazon.cryptography.dbencryptionsdk.dynamodb.internaldafny.types.SharedSet)value; AWS.Cryptography.DbEncryptionSDK.DynamoDb.SharedSet converted = new AWS.Cryptography.DbEncryptionSDK.DynamoDb.SharedSet(); converted.Other = (string) FromDafny_N3_aws__N12_cryptography__N15_dbEncryptionSdk__N8_dynamoDb__S9_SharedSet__M5_other(concrete._other); return converted; -} - public static software.amazon.cryptography.dbencryptionsdk.dynamodb.internaldafny.types._ISharedSet ToDafny_N3_aws__N12_cryptography__N15_dbEncryptionSdk__N8_dynamoDb__S9_SharedSet (AWS.Cryptography.DbEncryptionSDK.DynamoDb.SharedSet value) { - - return new software.amazon.cryptography.dbencryptionsdk.dynamodb.internaldafny.types.SharedSet ( ToDafny_N3_aws__N12_cryptography__N15_dbEncryptionSdk__N8_dynamoDb__S9_SharedSet__M5_other(value.Other) ) ; -} - public static AWS.Cryptography.DbEncryptionSDK.DynamoDb.IDynamoDbKeyBranchKeyIdSupplier FromDafny_N3_aws__N12_cryptography__N15_dbEncryptionSdk__N8_dynamoDb__S39_DynamoDbKeyBranchKeyIdSupplierReference (software.amazon.cryptography.dbencryptionsdk.dynamodb.internaldafny.types.IDynamoDbKeyBranchKeyIdSupplier value) { - if (value is NativeWrapper_DynamoDbKeyBranchKeyIdSupplier nativeWrapper) return nativeWrapper._impl; -return new DynamoDbKeyBranchKeyIdSupplier(value); - -} - public static software.amazon.cryptography.dbencryptionsdk.dynamodb.internaldafny.types.IDynamoDbKeyBranchKeyIdSupplier ToDafny_N3_aws__N12_cryptography__N15_dbEncryptionSdk__N8_dynamoDb__S39_DynamoDbKeyBranchKeyIdSupplierReference (AWS.Cryptography.DbEncryptionSDK.DynamoDb.IDynamoDbKeyBranchKeyIdSupplier value) { - switch (value) - { - case DynamoDbKeyBranchKeyIdSupplier valueWithImpl: - return valueWithImpl._impl; - case DynamoDbKeyBranchKeyIdSupplierBase nativeImpl: - return new NativeWrapper_DynamoDbKeyBranchKeyIdSupplier(nativeImpl); - default: - throw new System.ArgumentException( - "Custom implementations of DynamoDbKeyBranchKeyIdSupplier must extend DynamoDbKeyBranchKeyIdSupplierBase."); -} -} - public static AWS.Cryptography.MaterialProviders.IBranchKeyIdSupplier FromDafny_N3_aws__N12_cryptography__N17_materialProviders__S28_BranchKeyIdSupplierReference (software.amazon.cryptography.materialproviders.internaldafny.types.IBranchKeyIdSupplier value) { - // This is converting a reference type in a dependant module. - // Therefore it defers to the dependant module for conversion - return AWS.Cryptography.MaterialProviders.TypeConversion.FromDafny_N3_aws__N12_cryptography__N17_materialProviders__S28_BranchKeyIdSupplierReference(value); -} - public static software.amazon.cryptography.materialproviders.internaldafny.types.IBranchKeyIdSupplier ToDafny_N3_aws__N12_cryptography__N17_materialProviders__S28_BranchKeyIdSupplierReference (AWS.Cryptography.MaterialProviders.IBranchKeyIdSupplier value) { - // This is converting a reference type in a dependant module. - // Therefore it defers to the dependant module for conversion - return AWS.Cryptography.MaterialProviders.TypeConversion.ToDafny_N3_aws__N12_cryptography__N17_materialProviders__S28_BranchKeyIdSupplierReference(value); -} - public static string FromDafny_N6_smithy__N3_api__S6_String (Dafny.ISequence value) { - return new string(value.Elements); -} - public static Dafny.ISequence ToDafny_N6_smithy__N3_api__S6_String (string value) { - return Dafny.Sequence.FromString(value); -} - public static System.Collections.Generic.Dictionary FromDafny_N3_com__N9_amazonaws__N8_dynamodb__S3_Key (Dafny.IMap, software.amazon.cryptography.services.dynamodb.internaldafny.types._IAttributeValue> value) { - return value.ItemEnumerable.ToDictionary(pair => FromDafny_N3_com__N9_amazonaws__N8_dynamodb__S3_Key__M3_key(pair.Car), pair => FromDafny_N3_com__N9_amazonaws__N8_dynamodb__S3_Key__M5_value(pair.Cdr)); -} - public static Dafny.IMap, software.amazon.cryptography.services.dynamodb.internaldafny.types._IAttributeValue> ToDafny_N3_com__N9_amazonaws__N8_dynamodb__S3_Key (System.Collections.Generic.Dictionary value) { - return Dafny.Map, software.amazon.cryptography.services.dynamodb.internaldafny.types._IAttributeValue>.FromCollection(value.Select(pair => - new Dafny.Pair, software.amazon.cryptography.services.dynamodb.internaldafny.types._IAttributeValue>(ToDafny_N3_com__N9_amazonaws__N8_dynamodb__S3_Key__M3_key(pair.Key), ToDafny_N3_com__N9_amazonaws__N8_dynamodb__S3_Key__M5_value(pair.Value)) -)); -} - public static System.Collections.Generic.List FromDafny_N3_aws__N12_cryptography__N15_dbEncryptionSdk__N8_dynamoDb__S31_EncryptedDataKeyDescriptionList (Dafny.ISequence value) { - return new System.Collections.Generic.List(value.Elements.Select(FromDafny_N3_aws__N12_cryptography__N15_dbEncryptionSdk__N8_dynamoDb__S31_EncryptedDataKeyDescriptionList__M6_member)); -} - public static Dafny.ISequence ToDafny_N3_aws__N12_cryptography__N15_dbEncryptionSdk__N8_dynamoDb__S31_EncryptedDataKeyDescriptionList (System.Collections.Generic.List value) { - return Dafny.Sequence.FromArray(value.Select(ToDafny_N3_aws__N12_cryptography__N15_dbEncryptionSdk__N8_dynamoDb__S31_EncryptedDataKeyDescriptionList__M6_member).ToArray()); -} - public static System.IO.MemoryStream FromDafny_N6_smithy__N3_api__S4_Blob (Dafny.ISequence value) { - return new System.IO.MemoryStream(value.Elements); -} - public static Dafny.ISequence ToDafny_N6_smithy__N3_api__S4_Blob (System.IO.MemoryStream value) { - return Dafny.Sequence.FromArray(value.ToArray()); -} - public static System.Collections.Generic.Dictionary FromDafny_N3_com__N9_amazonaws__N8_dynamodb__S12_AttributeMap (Dafny.IMap, software.amazon.cryptography.services.dynamodb.internaldafny.types._IAttributeValue> value) { - return value.ItemEnumerable.ToDictionary(pair => FromDafny_N3_com__N9_amazonaws__N8_dynamodb__S12_AttributeMap__M3_key(pair.Car), pair => FromDafny_N3_com__N9_amazonaws__N8_dynamodb__S12_AttributeMap__M5_value(pair.Cdr)); -} - public static Dafny.IMap, software.amazon.cryptography.services.dynamodb.internaldafny.types._IAttributeValue> ToDafny_N3_com__N9_amazonaws__N8_dynamodb__S12_AttributeMap (System.Collections.Generic.Dictionary value) { - return Dafny.Map, software.amazon.cryptography.services.dynamodb.internaldafny.types._IAttributeValue>.FromCollection(value.Select(pair => - new Dafny.Pair, software.amazon.cryptography.services.dynamodb.internaldafny.types._IAttributeValue>(ToDafny_N3_com__N9_amazonaws__N8_dynamodb__S12_AttributeMap__M3_key(pair.Key), ToDafny_N3_com__N9_amazonaws__N8_dynamodb__S12_AttributeMap__M5_value(pair.Value)) -)); -} - public static AWS.Cryptography.DbEncryptionSDK.DynamoDb.Upper FromDafny_N3_aws__N12_cryptography__N15_dbEncryptionSdk__N8_dynamoDb__S5_Upper (software.amazon.cryptography.dbencryptionsdk.dynamodb.internaldafny.types._IUpper value) { - software.amazon.cryptography.dbencryptionsdk.dynamodb.internaldafny.types.Upper concrete = (software.amazon.cryptography.dbencryptionsdk.dynamodb.internaldafny.types.Upper)value; AWS.Cryptography.DbEncryptionSDK.DynamoDb.Upper converted = new AWS.Cryptography.DbEncryptionSDK.DynamoDb.Upper(); return converted; -} - public static software.amazon.cryptography.dbencryptionsdk.dynamodb.internaldafny.types._IUpper ToDafny_N3_aws__N12_cryptography__N15_dbEncryptionSdk__N8_dynamoDb__S5_Upper (AWS.Cryptography.DbEncryptionSDK.DynamoDb.Upper value) { - - return new software.amazon.cryptography.dbencryptionsdk.dynamodb.internaldafny.types.Upper ( ) ; -} - public static AWS.Cryptography.DbEncryptionSDK.DynamoDb.Lower FromDafny_N3_aws__N12_cryptography__N15_dbEncryptionSdk__N8_dynamoDb__S5_Lower (software.amazon.cryptography.dbencryptionsdk.dynamodb.internaldafny.types._ILower value) { - software.amazon.cryptography.dbencryptionsdk.dynamodb.internaldafny.types.Lower concrete = (software.amazon.cryptography.dbencryptionsdk.dynamodb.internaldafny.types.Lower)value; AWS.Cryptography.DbEncryptionSDK.DynamoDb.Lower converted = new AWS.Cryptography.DbEncryptionSDK.DynamoDb.Lower(); return converted; -} - public static software.amazon.cryptography.dbencryptionsdk.dynamodb.internaldafny.types._ILower ToDafny_N3_aws__N12_cryptography__N15_dbEncryptionSdk__N8_dynamoDb__S5_Lower (AWS.Cryptography.DbEncryptionSDK.DynamoDb.Lower value) { - - return new software.amazon.cryptography.dbencryptionsdk.dynamodb.internaldafny.types.Lower ( ) ; -} - public static AWS.Cryptography.DbEncryptionSDK.DynamoDb.Insert FromDafny_N3_aws__N12_cryptography__N15_dbEncryptionSdk__N8_dynamoDb__S6_Insert (software.amazon.cryptography.dbencryptionsdk.dynamodb.internaldafny.types._IInsert value) { - software.amazon.cryptography.dbencryptionsdk.dynamodb.internaldafny.types.Insert concrete = (software.amazon.cryptography.dbencryptionsdk.dynamodb.internaldafny.types.Insert)value; AWS.Cryptography.DbEncryptionSDK.DynamoDb.Insert converted = new AWS.Cryptography.DbEncryptionSDK.DynamoDb.Insert(); converted.Literal = (string) FromDafny_N3_aws__N12_cryptography__N15_dbEncryptionSdk__N8_dynamoDb__S6_Insert__M7_literal(concrete._literal); return converted; -} - public static software.amazon.cryptography.dbencryptionsdk.dynamodb.internaldafny.types._IInsert ToDafny_N3_aws__N12_cryptography__N15_dbEncryptionSdk__N8_dynamoDb__S6_Insert (AWS.Cryptography.DbEncryptionSDK.DynamoDb.Insert value) { - - return new software.amazon.cryptography.dbencryptionsdk.dynamodb.internaldafny.types.Insert ( ToDafny_N3_aws__N12_cryptography__N15_dbEncryptionSdk__N8_dynamoDb__S6_Insert__M7_literal(value.Literal) ) ; -} - public static AWS.Cryptography.DbEncryptionSDK.DynamoDb.GetPrefix FromDafny_N3_aws__N12_cryptography__N15_dbEncryptionSdk__N8_dynamoDb__S9_GetPrefix (software.amazon.cryptography.dbencryptionsdk.dynamodb.internaldafny.types._IGetPrefix value) { - software.amazon.cryptography.dbencryptionsdk.dynamodb.internaldafny.types.GetPrefix concrete = (software.amazon.cryptography.dbencryptionsdk.dynamodb.internaldafny.types.GetPrefix)value; AWS.Cryptography.DbEncryptionSDK.DynamoDb.GetPrefix converted = new AWS.Cryptography.DbEncryptionSDK.DynamoDb.GetPrefix(); converted.Length = (int) FromDafny_N3_aws__N12_cryptography__N15_dbEncryptionSdk__N8_dynamoDb__S9_GetPrefix__M6_length(concrete._length); return converted; -} - public static software.amazon.cryptography.dbencryptionsdk.dynamodb.internaldafny.types._IGetPrefix ToDafny_N3_aws__N12_cryptography__N15_dbEncryptionSdk__N8_dynamoDb__S9_GetPrefix (AWS.Cryptography.DbEncryptionSDK.DynamoDb.GetPrefix value) { - - return new software.amazon.cryptography.dbencryptionsdk.dynamodb.internaldafny.types.GetPrefix ( ToDafny_N3_aws__N12_cryptography__N15_dbEncryptionSdk__N8_dynamoDb__S9_GetPrefix__M6_length(value.Length) ) ; -} - public static AWS.Cryptography.DbEncryptionSDK.DynamoDb.GetSuffix FromDafny_N3_aws__N12_cryptography__N15_dbEncryptionSdk__N8_dynamoDb__S9_GetSuffix (software.amazon.cryptography.dbencryptionsdk.dynamodb.internaldafny.types._IGetSuffix value) { - software.amazon.cryptography.dbencryptionsdk.dynamodb.internaldafny.types.GetSuffix concrete = (software.amazon.cryptography.dbencryptionsdk.dynamodb.internaldafny.types.GetSuffix)value; AWS.Cryptography.DbEncryptionSDK.DynamoDb.GetSuffix converted = new AWS.Cryptography.DbEncryptionSDK.DynamoDb.GetSuffix(); converted.Length = (int) FromDafny_N3_aws__N12_cryptography__N15_dbEncryptionSdk__N8_dynamoDb__S9_GetSuffix__M6_length(concrete._length); return converted; -} - public static software.amazon.cryptography.dbencryptionsdk.dynamodb.internaldafny.types._IGetSuffix ToDafny_N3_aws__N12_cryptography__N15_dbEncryptionSdk__N8_dynamoDb__S9_GetSuffix (AWS.Cryptography.DbEncryptionSDK.DynamoDb.GetSuffix value) { - - return new software.amazon.cryptography.dbencryptionsdk.dynamodb.internaldafny.types.GetSuffix ( ToDafny_N3_aws__N12_cryptography__N15_dbEncryptionSdk__N8_dynamoDb__S9_GetSuffix__M6_length(value.Length) ) ; -} - public static AWS.Cryptography.DbEncryptionSDK.DynamoDb.GetSubstring FromDafny_N3_aws__N12_cryptography__N15_dbEncryptionSdk__N8_dynamoDb__S12_GetSubstring (software.amazon.cryptography.dbencryptionsdk.dynamodb.internaldafny.types._IGetSubstring value) { - software.amazon.cryptography.dbencryptionsdk.dynamodb.internaldafny.types.GetSubstring concrete = (software.amazon.cryptography.dbencryptionsdk.dynamodb.internaldafny.types.GetSubstring)value; AWS.Cryptography.DbEncryptionSDK.DynamoDb.GetSubstring converted = new AWS.Cryptography.DbEncryptionSDK.DynamoDb.GetSubstring(); converted.Low = (int) FromDafny_N3_aws__N12_cryptography__N15_dbEncryptionSdk__N8_dynamoDb__S12_GetSubstring__M3_low(concrete._low); - converted.High = (int) FromDafny_N3_aws__N12_cryptography__N15_dbEncryptionSdk__N8_dynamoDb__S12_GetSubstring__M4_high(concrete._high); return converted; -} - public static software.amazon.cryptography.dbencryptionsdk.dynamodb.internaldafny.types._IGetSubstring ToDafny_N3_aws__N12_cryptography__N15_dbEncryptionSdk__N8_dynamoDb__S12_GetSubstring (AWS.Cryptography.DbEncryptionSDK.DynamoDb.GetSubstring value) { - - return new software.amazon.cryptography.dbencryptionsdk.dynamodb.internaldafny.types.GetSubstring ( ToDafny_N3_aws__N12_cryptography__N15_dbEncryptionSdk__N8_dynamoDb__S12_GetSubstring__M3_low(value.Low) , ToDafny_N3_aws__N12_cryptography__N15_dbEncryptionSdk__N8_dynamoDb__S12_GetSubstring__M4_high(value.High) ) ; -} - public static AWS.Cryptography.DbEncryptionSDK.DynamoDb.GetSegment FromDafny_N3_aws__N12_cryptography__N15_dbEncryptionSdk__N8_dynamoDb__S10_GetSegment (software.amazon.cryptography.dbencryptionsdk.dynamodb.internaldafny.types._IGetSegment value) { - software.amazon.cryptography.dbencryptionsdk.dynamodb.internaldafny.types.GetSegment concrete = (software.amazon.cryptography.dbencryptionsdk.dynamodb.internaldafny.types.GetSegment)value; AWS.Cryptography.DbEncryptionSDK.DynamoDb.GetSegment converted = new AWS.Cryptography.DbEncryptionSDK.DynamoDb.GetSegment(); converted.Split = (string) FromDafny_N3_aws__N12_cryptography__N15_dbEncryptionSdk__N8_dynamoDb__S10_GetSegment__M5_split(concrete._split); - converted.Index = (int) FromDafny_N3_aws__N12_cryptography__N15_dbEncryptionSdk__N8_dynamoDb__S10_GetSegment__M5_index(concrete._index); return converted; -} - public static software.amazon.cryptography.dbencryptionsdk.dynamodb.internaldafny.types._IGetSegment ToDafny_N3_aws__N12_cryptography__N15_dbEncryptionSdk__N8_dynamoDb__S10_GetSegment (AWS.Cryptography.DbEncryptionSDK.DynamoDb.GetSegment value) { - - return new software.amazon.cryptography.dbencryptionsdk.dynamodb.internaldafny.types.GetSegment ( ToDafny_N3_aws__N12_cryptography__N15_dbEncryptionSdk__N8_dynamoDb__S10_GetSegment__M5_split(value.Split) , ToDafny_N3_aws__N12_cryptography__N15_dbEncryptionSdk__N8_dynamoDb__S10_GetSegment__M5_index(value.Index) ) ; -} - public static AWS.Cryptography.DbEncryptionSDK.DynamoDb.GetSegments FromDafny_N3_aws__N12_cryptography__N15_dbEncryptionSdk__N8_dynamoDb__S11_GetSegments (software.amazon.cryptography.dbencryptionsdk.dynamodb.internaldafny.types._IGetSegments value) { - software.amazon.cryptography.dbencryptionsdk.dynamodb.internaldafny.types.GetSegments concrete = (software.amazon.cryptography.dbencryptionsdk.dynamodb.internaldafny.types.GetSegments)value; AWS.Cryptography.DbEncryptionSDK.DynamoDb.GetSegments converted = new AWS.Cryptography.DbEncryptionSDK.DynamoDb.GetSegments(); converted.Split = (string) FromDafny_N3_aws__N12_cryptography__N15_dbEncryptionSdk__N8_dynamoDb__S11_GetSegments__M5_split(concrete._split); - converted.Low = (int) FromDafny_N3_aws__N12_cryptography__N15_dbEncryptionSdk__N8_dynamoDb__S11_GetSegments__M3_low(concrete._low); - converted.High = (int) FromDafny_N3_aws__N12_cryptography__N15_dbEncryptionSdk__N8_dynamoDb__S11_GetSegments__M4_high(concrete._high); return converted; -} - public static software.amazon.cryptography.dbencryptionsdk.dynamodb.internaldafny.types._IGetSegments ToDafny_N3_aws__N12_cryptography__N15_dbEncryptionSdk__N8_dynamoDb__S11_GetSegments (AWS.Cryptography.DbEncryptionSDK.DynamoDb.GetSegments value) { - - return new software.amazon.cryptography.dbencryptionsdk.dynamodb.internaldafny.types.GetSegments ( ToDafny_N3_aws__N12_cryptography__N15_dbEncryptionSdk__N8_dynamoDb__S11_GetSegments__M5_split(value.Split) , ToDafny_N3_aws__N12_cryptography__N15_dbEncryptionSdk__N8_dynamoDb__S11_GetSegments__M3_low(value.Low) , ToDafny_N3_aws__N12_cryptography__N15_dbEncryptionSdk__N8_dynamoDb__S11_GetSegments__M4_high(value.High) ) ; -} - public static string FromDafny_N3_aws__N12_cryptography__N15_dbEncryptionSdk__N8_dynamoDb__S14_SingleKeyStore__M5_keyId (Dafny.ISequence value) { - return FromDafny_N6_smithy__N3_api__S6_String(value); -} - public static Dafny.ISequence ToDafny_N3_aws__N12_cryptography__N15_dbEncryptionSdk__N8_dynamoDb__S14_SingleKeyStore__M5_keyId (string value) { - return ToDafny_N6_smithy__N3_api__S6_String(value); -} - public static int FromDafny_N3_aws__N12_cryptography__N15_dbEncryptionSdk__N8_dynamoDb__S14_SingleKeyStore__M8_cacheTTL (int value) { - return FromDafny_N6_smithy__N3_api__S7_Integer(value); -} - public static int ToDafny_N3_aws__N12_cryptography__N15_dbEncryptionSdk__N8_dynamoDb__S14_SingleKeyStore__M8_cacheTTL (int value) { - return ToDafny_N6_smithy__N3_api__S7_Integer(value); -} - public static string FromDafny_N3_aws__N12_cryptography__N15_dbEncryptionSdk__N8_dynamoDb__S13_MultiKeyStore__M12_keyFieldName (Dafny.ISequence value) { - return FromDafny_N6_smithy__N3_api__S6_String(value); -} - public static Dafny.ISequence ToDafny_N3_aws__N12_cryptography__N15_dbEncryptionSdk__N8_dynamoDb__S13_MultiKeyStore__M12_keyFieldName (string value) { - return ToDafny_N6_smithy__N3_api__S6_String(value); -} - public static int FromDafny_N3_aws__N12_cryptography__N15_dbEncryptionSdk__N8_dynamoDb__S13_MultiKeyStore__M8_cacheTTL (int value) { - return FromDafny_N6_smithy__N3_api__S7_Integer(value); -} - public static int ToDafny_N3_aws__N12_cryptography__N15_dbEncryptionSdk__N8_dynamoDb__S13_MultiKeyStore__M8_cacheTTL (int value) { - return ToDafny_N6_smithy__N3_api__S7_Integer(value); -} - public static AWS.Cryptography.MaterialProviders.CacheType FromDafny_N3_aws__N12_cryptography__N15_dbEncryptionSdk__N8_dynamoDb__S13_MultiKeyStore__M5_cache (Wrappers_Compile._IOption value) { - return value.is_None ? (AWS.Cryptography.MaterialProviders.CacheType) null : FromDafny_N3_aws__N12_cryptography__N17_materialProviders__S9_CacheType(value.Extract()); -} - public static Wrappers_Compile._IOption ToDafny_N3_aws__N12_cryptography__N15_dbEncryptionSdk__N8_dynamoDb__S13_MultiKeyStore__M5_cache (AWS.Cryptography.MaterialProviders.CacheType value) { - return value == null ? Wrappers_Compile.Option.create_None() : Wrappers_Compile.Option.create_Some(ToDafny_N3_aws__N12_cryptography__N17_materialProviders__S9_CacheType((AWS.Cryptography.MaterialProviders.CacheType) value)); -} - public static string FromDafny_N3_aws__N12_cryptography__N15_dbEncryptionSdk__N8_dynamoDb__S6_Shared__M5_other (Dafny.ISequence value) { - return FromDafny_N6_smithy__N3_api__S6_String(value); -} - public static Dafny.ISequence ToDafny_N3_aws__N12_cryptography__N15_dbEncryptionSdk__N8_dynamoDb__S6_Shared__M5_other (string value) { - return ToDafny_N6_smithy__N3_api__S6_String(value); -} - public static string FromDafny_N3_aws__N12_cryptography__N15_dbEncryptionSdk__N8_dynamoDb__S9_SharedSet__M5_other (Dafny.ISequence value) { - return FromDafny_N6_smithy__N3_api__S6_String(value); -} - public static Dafny.ISequence ToDafny_N3_aws__N12_cryptography__N15_dbEncryptionSdk__N8_dynamoDb__S9_SharedSet__M5_other (string value) { - return ToDafny_N6_smithy__N3_api__S6_String(value); -} - public static string FromDafny_N3_com__N9_amazonaws__N8_dynamodb__S3_Key__M3_key (Dafny.ISequence value) { - return FromDafny_N3_com__N9_amazonaws__N8_dynamodb__S13_AttributeName(value); -} - public static Dafny.ISequence ToDafny_N3_com__N9_amazonaws__N8_dynamodb__S3_Key__M3_key (string value) { - return ToDafny_N3_com__N9_amazonaws__N8_dynamodb__S13_AttributeName(value); -} - public static Amazon.DynamoDBv2.Model.AttributeValue FromDafny_N3_com__N9_amazonaws__N8_dynamodb__S3_Key__M5_value (software.amazon.cryptography.services.dynamodb.internaldafny.types._IAttributeValue value) { - return FromDafny_N3_com__N9_amazonaws__N8_dynamodb__S14_AttributeValue(value); -} - public static software.amazon.cryptography.services.dynamodb.internaldafny.types._IAttributeValue ToDafny_N3_com__N9_amazonaws__N8_dynamodb__S3_Key__M5_value (Amazon.DynamoDBv2.Model.AttributeValue value) { - return ToDafny_N3_com__N9_amazonaws__N8_dynamodb__S14_AttributeValue(value); -} - public static AWS.Cryptography.DbEncryptionSDK.DynamoDb.EncryptedDataKeyDescriptionOutput FromDafny_N3_aws__N12_cryptography__N15_dbEncryptionSdk__N8_dynamoDb__S31_EncryptedDataKeyDescriptionList__M6_member (software.amazon.cryptography.dbencryptionsdk.dynamodb.internaldafny.types._IEncryptedDataKeyDescriptionOutput value) { - return FromDafny_N3_aws__N12_cryptography__N15_dbEncryptionSdk__N8_dynamoDb__S33_EncryptedDataKeyDescriptionOutput(value); -} - public static software.amazon.cryptography.dbencryptionsdk.dynamodb.internaldafny.types._IEncryptedDataKeyDescriptionOutput ToDafny_N3_aws__N12_cryptography__N15_dbEncryptionSdk__N8_dynamoDb__S31_EncryptedDataKeyDescriptionList__M6_member (AWS.Cryptography.DbEncryptionSDK.DynamoDb.EncryptedDataKeyDescriptionOutput value) { - return ToDafny_N3_aws__N12_cryptography__N15_dbEncryptionSdk__N8_dynamoDb__S33_EncryptedDataKeyDescriptionOutput(value); -} - public static string FromDafny_N3_com__N9_amazonaws__N8_dynamodb__S12_AttributeMap__M3_key (Dafny.ISequence value) { - return FromDafny_N3_com__N9_amazonaws__N8_dynamodb__S13_AttributeName(value); -} - public static Dafny.ISequence ToDafny_N3_com__N9_amazonaws__N8_dynamodb__S12_AttributeMap__M3_key (string value) { - return ToDafny_N3_com__N9_amazonaws__N8_dynamodb__S13_AttributeName(value); -} - public static Amazon.DynamoDBv2.Model.AttributeValue FromDafny_N3_com__N9_amazonaws__N8_dynamodb__S12_AttributeMap__M5_value (software.amazon.cryptography.services.dynamodb.internaldafny.types._IAttributeValue value) { - return FromDafny_N3_com__N9_amazonaws__N8_dynamodb__S14_AttributeValue(value); -} - public static software.amazon.cryptography.services.dynamodb.internaldafny.types._IAttributeValue ToDafny_N3_com__N9_amazonaws__N8_dynamodb__S12_AttributeMap__M5_value (Amazon.DynamoDBv2.Model.AttributeValue value) { - return ToDafny_N3_com__N9_amazonaws__N8_dynamodb__S14_AttributeValue(value); -} - public static string FromDafny_N3_aws__N12_cryptography__N15_dbEncryptionSdk__N8_dynamoDb__S6_Insert__M7_literal (Dafny.ISequence value) { - return FromDafny_N6_smithy__N3_api__S6_String(value); -} - public static Dafny.ISequence ToDafny_N3_aws__N12_cryptography__N15_dbEncryptionSdk__N8_dynamoDb__S6_Insert__M7_literal (string value) { - return ToDafny_N6_smithy__N3_api__S6_String(value); -} - public static int FromDafny_N3_aws__N12_cryptography__N15_dbEncryptionSdk__N8_dynamoDb__S9_GetPrefix__M6_length (int value) { - return FromDafny_N6_smithy__N3_api__S7_Integer(value); -} - public static int ToDafny_N3_aws__N12_cryptography__N15_dbEncryptionSdk__N8_dynamoDb__S9_GetPrefix__M6_length (int value) { - return ToDafny_N6_smithy__N3_api__S7_Integer(value); -} - public static int FromDafny_N3_aws__N12_cryptography__N15_dbEncryptionSdk__N8_dynamoDb__S9_GetSuffix__M6_length (int value) { - return FromDafny_N6_smithy__N3_api__S7_Integer(value); -} - public static int ToDafny_N3_aws__N12_cryptography__N15_dbEncryptionSdk__N8_dynamoDb__S9_GetSuffix__M6_length (int value) { - return ToDafny_N6_smithy__N3_api__S7_Integer(value); -} - public static int FromDafny_N3_aws__N12_cryptography__N15_dbEncryptionSdk__N8_dynamoDb__S12_GetSubstring__M3_low (int value) { - return FromDafny_N6_smithy__N3_api__S7_Integer(value); -} - public static int ToDafny_N3_aws__N12_cryptography__N15_dbEncryptionSdk__N8_dynamoDb__S12_GetSubstring__M3_low (int value) { - return ToDafny_N6_smithy__N3_api__S7_Integer(value); -} - public static int FromDafny_N3_aws__N12_cryptography__N15_dbEncryptionSdk__N8_dynamoDb__S12_GetSubstring__M4_high (int value) { - return FromDafny_N6_smithy__N3_api__S7_Integer(value); -} - public static int ToDafny_N3_aws__N12_cryptography__N15_dbEncryptionSdk__N8_dynamoDb__S12_GetSubstring__M4_high (int value) { - return ToDafny_N6_smithy__N3_api__S7_Integer(value); -} - public static string FromDafny_N3_aws__N12_cryptography__N15_dbEncryptionSdk__N8_dynamoDb__S10_GetSegment__M5_split (Dafny.ISequence value) { - return FromDafny_N3_aws__N12_cryptography__N15_dbEncryptionSdk__N8_dynamoDb__S4_Char(value); -} - public static Dafny.ISequence ToDafny_N3_aws__N12_cryptography__N15_dbEncryptionSdk__N8_dynamoDb__S10_GetSegment__M5_split (string value) { - return ToDafny_N3_aws__N12_cryptography__N15_dbEncryptionSdk__N8_dynamoDb__S4_Char(value); -} - public static int FromDafny_N3_aws__N12_cryptography__N15_dbEncryptionSdk__N8_dynamoDb__S10_GetSegment__M5_index (int value) { - return FromDafny_N6_smithy__N3_api__S7_Integer(value); -} - public static int ToDafny_N3_aws__N12_cryptography__N15_dbEncryptionSdk__N8_dynamoDb__S10_GetSegment__M5_index (int value) { - return ToDafny_N6_smithy__N3_api__S7_Integer(value); -} - public static string FromDafny_N3_aws__N12_cryptography__N15_dbEncryptionSdk__N8_dynamoDb__S11_GetSegments__M5_split (Dafny.ISequence value) { - return FromDafny_N3_aws__N12_cryptography__N15_dbEncryptionSdk__N8_dynamoDb__S4_Char(value); -} - public static Dafny.ISequence ToDafny_N3_aws__N12_cryptography__N15_dbEncryptionSdk__N8_dynamoDb__S11_GetSegments__M5_split (string value) { - return ToDafny_N3_aws__N12_cryptography__N15_dbEncryptionSdk__N8_dynamoDb__S4_Char(value); -} - public static int FromDafny_N3_aws__N12_cryptography__N15_dbEncryptionSdk__N8_dynamoDb__S11_GetSegments__M3_low (int value) { - return FromDafny_N6_smithy__N3_api__S7_Integer(value); -} - public static int ToDafny_N3_aws__N12_cryptography__N15_dbEncryptionSdk__N8_dynamoDb__S11_GetSegments__M3_low (int value) { - return ToDafny_N6_smithy__N3_api__S7_Integer(value); -} - public static int FromDafny_N3_aws__N12_cryptography__N15_dbEncryptionSdk__N8_dynamoDb__S11_GetSegments__M4_high (int value) { - return FromDafny_N6_smithy__N3_api__S7_Integer(value); -} - public static int ToDafny_N3_aws__N12_cryptography__N15_dbEncryptionSdk__N8_dynamoDb__S11_GetSegments__M4_high (int value) { - return ToDafny_N6_smithy__N3_api__S7_Integer(value); -} - public static int FromDafny_N6_smithy__N3_api__S7_Integer (int value) { - return value; -} - public static int ToDafny_N6_smithy__N3_api__S7_Integer (int value) { - return value; -} - public static AWS.Cryptography.MaterialProviders.CacheType FromDafny_N3_aws__N12_cryptography__N17_materialProviders__S9_CacheType (software.amazon.cryptography.materialproviders.internaldafny.types._ICacheType value) { - software.amazon.cryptography.materialproviders.internaldafny.types.CacheType concrete = (software.amazon.cryptography.materialproviders.internaldafny.types.CacheType)value; - var converted = new AWS.Cryptography.MaterialProviders.CacheType(); if (value.is_Default) { - converted.Default = FromDafny_N3_aws__N12_cryptography__N17_materialProviders__S9_CacheType__M7_Default(concrete.dtor_Default); - return converted; -} if (value.is_No) { - converted.No = FromDafny_N3_aws__N12_cryptography__N17_materialProviders__S9_CacheType__M2_No(concrete.dtor_No); - return converted; -} if (value.is_SingleThreaded) { - converted.SingleThreaded = FromDafny_N3_aws__N12_cryptography__N17_materialProviders__S9_CacheType__M14_SingleThreaded(concrete.dtor_SingleThreaded); - return converted; -} if (value.is_MultiThreaded) { - converted.MultiThreaded = FromDafny_N3_aws__N12_cryptography__N17_materialProviders__S9_CacheType__M13_MultiThreaded(concrete.dtor_MultiThreaded); - return converted; -} if (value.is_StormTracking) { - converted.StormTracking = FromDafny_N3_aws__N12_cryptography__N17_materialProviders__S9_CacheType__M13_StormTracking(concrete.dtor_StormTracking); - return converted; -} -throw new System.ArgumentException("Invalid AWS.Cryptography.MaterialProviders.CacheType state"); -} - public static software.amazon.cryptography.materialproviders.internaldafny.types._ICacheType ToDafny_N3_aws__N12_cryptography__N17_materialProviders__S9_CacheType (AWS.Cryptography.MaterialProviders.CacheType value) { - if (value.IsSetDefault()) { - return software.amazon.cryptography.materialproviders.internaldafny.types.CacheType.create_Default(ToDafny_N3_aws__N12_cryptography__N17_materialProviders__S9_CacheType__M7_Default(value.Default)); -} if (value.IsSetNo()) { - return software.amazon.cryptography.materialproviders.internaldafny.types.CacheType.create_No(ToDafny_N3_aws__N12_cryptography__N17_materialProviders__S9_CacheType__M2_No(value.No)); -} if (value.IsSetSingleThreaded()) { - return software.amazon.cryptography.materialproviders.internaldafny.types.CacheType.create_SingleThreaded(ToDafny_N3_aws__N12_cryptography__N17_materialProviders__S9_CacheType__M14_SingleThreaded(value.SingleThreaded)); -} if (value.IsSetMultiThreaded()) { - return software.amazon.cryptography.materialproviders.internaldafny.types.CacheType.create_MultiThreaded(ToDafny_N3_aws__N12_cryptography__N17_materialProviders__S9_CacheType__M13_MultiThreaded(value.MultiThreaded)); -} if (value.IsSetStormTracking()) { - return software.amazon.cryptography.materialproviders.internaldafny.types.CacheType.create_StormTracking(ToDafny_N3_aws__N12_cryptography__N17_materialProviders__S9_CacheType__M13_StormTracking(value.StormTracking)); -} -throw new System.ArgumentException("Invalid AWS.Cryptography.MaterialProviders.CacheType state"); -} - public static string FromDafny_N3_com__N9_amazonaws__N8_dynamodb__S13_AttributeName (Dafny.ISequence value) { - return new string(value.Elements); -} - public static Dafny.ISequence ToDafny_N3_com__N9_amazonaws__N8_dynamodb__S13_AttributeName (string value) { - return Dafny.Sequence.FromString(value); -} - public static Amazon.DynamoDBv2.Model.AttributeValue FromDafny_N3_com__N9_amazonaws__N8_dynamodb__S14_AttributeValue (software.amazon.cryptography.services.dynamodb.internaldafny.types._IAttributeValue value) { - software.amazon.cryptography.services.dynamodb.internaldafny.types.AttributeValue concrete = (software.amazon.cryptography.services.dynamodb.internaldafny.types.AttributeValue)value; - var converted = new Amazon.DynamoDBv2.Model.AttributeValue(); if (value.is_S) { - converted.S = FromDafny_N3_com__N9_amazonaws__N8_dynamodb__S14_AttributeValue__M1_S(concrete.dtor_S); - return converted; -} if (value.is_N) { - converted.N = FromDafny_N3_com__N9_amazonaws__N8_dynamodb__S14_AttributeValue__M1_N(concrete.dtor_N); - return converted; -} if (value.is_B) { - converted.B = FromDafny_N3_com__N9_amazonaws__N8_dynamodb__S14_AttributeValue__M1_B(concrete.dtor_B); - return converted; -} if (value.is_SS) { - converted.SS = FromDafny_N3_com__N9_amazonaws__N8_dynamodb__S14_AttributeValue__M2_SS(concrete.dtor_SS); - return converted; -} if (value.is_NS) { - converted.NS = FromDafny_N3_com__N9_amazonaws__N8_dynamodb__S14_AttributeValue__M2_NS(concrete.dtor_NS); - return converted; -} if (value.is_BS) { - converted.BS = FromDafny_N3_com__N9_amazonaws__N8_dynamodb__S14_AttributeValue__M2_BS(concrete.dtor_BS); - return converted; -} if (value.is_M) { - converted.M = FromDafny_N3_com__N9_amazonaws__N8_dynamodb__S14_AttributeValue__M1_M(concrete.dtor_M); - return converted; -} if (value.is_L) { - converted.L = FromDafny_N3_com__N9_amazonaws__N8_dynamodb__S14_AttributeValue__M1_L(concrete.dtor_L); - return converted; -} if (value.is_NULL) { - converted.NULL = FromDafny_N3_com__N9_amazonaws__N8_dynamodb__S14_AttributeValue__M4_NULL(concrete.dtor_NULL); - return converted; -} if (value.is_BOOL) { - converted.BOOL = FromDafny_N3_com__N9_amazonaws__N8_dynamodb__S14_AttributeValue__M4_BOOL(concrete.dtor_BOOL); - return converted; -} -throw new System.ArgumentException("Invalid Amazon.DynamoDBv2.Model.AttributeValue state"); -} - public static software.amazon.cryptography.services.dynamodb.internaldafny.types._IAttributeValue ToDafny_N3_com__N9_amazonaws__N8_dynamodb__S14_AttributeValue (Amazon.DynamoDBv2.Model.AttributeValue value) { - if (value.S != null) { - return software.amazon.cryptography.services.dynamodb.internaldafny.types.AttributeValue.create_S(ToDafny_N3_com__N9_amazonaws__N8_dynamodb__S14_AttributeValue__M1_S(value.S)); -} if (value.N != null) { - return software.amazon.cryptography.services.dynamodb.internaldafny.types.AttributeValue.create_N(ToDafny_N3_com__N9_amazonaws__N8_dynamodb__S14_AttributeValue__M1_N(value.N)); -} if (value.B != null) { - return software.amazon.cryptography.services.dynamodb.internaldafny.types.AttributeValue.create_B(ToDafny_N3_com__N9_amazonaws__N8_dynamodb__S14_AttributeValue__M1_B(value.B)); -} if (value.SS.Any()) { - return software.amazon.cryptography.services.dynamodb.internaldafny.types.AttributeValue.create_SS(ToDafny_N3_com__N9_amazonaws__N8_dynamodb__S14_AttributeValue__M2_SS(value.SS)); -} if (value.NS.Any()) { - return software.amazon.cryptography.services.dynamodb.internaldafny.types.AttributeValue.create_NS(ToDafny_N3_com__N9_amazonaws__N8_dynamodb__S14_AttributeValue__M2_NS(value.NS)); -} if (value.BS.Any()) { - return software.amazon.cryptography.services.dynamodb.internaldafny.types.AttributeValue.create_BS(ToDafny_N3_com__N9_amazonaws__N8_dynamodb__S14_AttributeValue__M2_BS(value.BS)); -} if (value.IsMSet) { - return software.amazon.cryptography.services.dynamodb.internaldafny.types.AttributeValue.create_M(ToDafny_N3_com__N9_amazonaws__N8_dynamodb__S14_AttributeValue__M1_M(value.M)); -} if (value.IsLSet) { - return software.amazon.cryptography.services.dynamodb.internaldafny.types.AttributeValue.create_L(ToDafny_N3_com__N9_amazonaws__N8_dynamodb__S14_AttributeValue__M1_L(value.L)); -} if (value.NULL == true) { - return software.amazon.cryptography.services.dynamodb.internaldafny.types.AttributeValue.create_NULL(ToDafny_N3_com__N9_amazonaws__N8_dynamodb__S14_AttributeValue__M4_NULL(value.NULL)); -} if (value.IsBOOLSet) { - return software.amazon.cryptography.services.dynamodb.internaldafny.types.AttributeValue.create_BOOL(ToDafny_N3_com__N9_amazonaws__N8_dynamodb__S14_AttributeValue__M4_BOOL(value.BOOL)); -} -throw new System.ArgumentException("Invalid Amazon.DynamoDBv2.Model.AttributeValue state"); -} - public static AWS.Cryptography.DbEncryptionSDK.DynamoDb.EncryptedDataKeyDescriptionOutput FromDafny_N3_aws__N12_cryptography__N15_dbEncryptionSdk__N8_dynamoDb__S33_EncryptedDataKeyDescriptionOutput (software.amazon.cryptography.dbencryptionsdk.dynamodb.internaldafny.types._IEncryptedDataKeyDescriptionOutput value) { - software.amazon.cryptography.dbencryptionsdk.dynamodb.internaldafny.types.EncryptedDataKeyDescriptionOutput concrete = (software.amazon.cryptography.dbencryptionsdk.dynamodb.internaldafny.types.EncryptedDataKeyDescriptionOutput)value; AWS.Cryptography.DbEncryptionSDK.DynamoDb.EncryptedDataKeyDescriptionOutput converted = new AWS.Cryptography.DbEncryptionSDK.DynamoDb.EncryptedDataKeyDescriptionOutput(); converted.KeyProviderId = (string) FromDafny_N3_aws__N12_cryptography__N15_dbEncryptionSdk__N8_dynamoDb__S33_EncryptedDataKeyDescriptionOutput__M13_keyProviderId(concrete._keyProviderId); - if (concrete._keyProviderInfo.is_Some) converted.KeyProviderInfo = (string) FromDafny_N3_aws__N12_cryptography__N15_dbEncryptionSdk__N8_dynamoDb__S33_EncryptedDataKeyDescriptionOutput__M15_keyProviderInfo(concrete._keyProviderInfo); - if (concrete._branchKeyId.is_Some) converted.BranchKeyId = (string) FromDafny_N3_aws__N12_cryptography__N15_dbEncryptionSdk__N8_dynamoDb__S33_EncryptedDataKeyDescriptionOutput__M11_branchKeyId(concrete._branchKeyId); - if (concrete._branchKeyVersion.is_Some) converted.BranchKeyVersion = (string) FromDafny_N3_aws__N12_cryptography__N15_dbEncryptionSdk__N8_dynamoDb__S33_EncryptedDataKeyDescriptionOutput__M16_branchKeyVersion(concrete._branchKeyVersion); return converted; -} - public static software.amazon.cryptography.dbencryptionsdk.dynamodb.internaldafny.types._IEncryptedDataKeyDescriptionOutput ToDafny_N3_aws__N12_cryptography__N15_dbEncryptionSdk__N8_dynamoDb__S33_EncryptedDataKeyDescriptionOutput (AWS.Cryptography.DbEncryptionSDK.DynamoDb.EncryptedDataKeyDescriptionOutput value) { - string var_keyProviderInfo = value.IsSetKeyProviderInfo() ? value.KeyProviderInfo : (string) null; - string var_branchKeyId = value.IsSetBranchKeyId() ? value.BranchKeyId : (string) null; - string var_branchKeyVersion = value.IsSetBranchKeyVersion() ? value.BranchKeyVersion : (string) null; - return new software.amazon.cryptography.dbencryptionsdk.dynamodb.internaldafny.types.EncryptedDataKeyDescriptionOutput ( ToDafny_N3_aws__N12_cryptography__N15_dbEncryptionSdk__N8_dynamoDb__S33_EncryptedDataKeyDescriptionOutput__M13_keyProviderId(value.KeyProviderId) , ToDafny_N3_aws__N12_cryptography__N15_dbEncryptionSdk__N8_dynamoDb__S33_EncryptedDataKeyDescriptionOutput__M15_keyProviderInfo(var_keyProviderInfo) , ToDafny_N3_aws__N12_cryptography__N15_dbEncryptionSdk__N8_dynamoDb__S33_EncryptedDataKeyDescriptionOutput__M11_branchKeyId(var_branchKeyId) , ToDafny_N3_aws__N12_cryptography__N15_dbEncryptionSdk__N8_dynamoDb__S33_EncryptedDataKeyDescriptionOutput__M16_branchKeyVersion(var_branchKeyVersion) ) ; -} - public static string FromDafny_N3_aws__N12_cryptography__N15_dbEncryptionSdk__N8_dynamoDb__S4_Char (Dafny.ISequence value) { - return new string(value.Elements); -} - public static Dafny.ISequence ToDafny_N3_aws__N12_cryptography__N15_dbEncryptionSdk__N8_dynamoDb__S4_Char (string value) { - return Dafny.Sequence.FromString(value); -} - public static AWS.Cryptography.MaterialProviders.DefaultCache FromDafny_N3_aws__N12_cryptography__N17_materialProviders__S9_CacheType__M7_Default (software.amazon.cryptography.materialproviders.internaldafny.types._IDefaultCache value) { - return FromDafny_N3_aws__N12_cryptography__N17_materialProviders__S12_DefaultCache(value); -} - public static software.amazon.cryptography.materialproviders.internaldafny.types._IDefaultCache ToDafny_N3_aws__N12_cryptography__N17_materialProviders__S9_CacheType__M7_Default (AWS.Cryptography.MaterialProviders.DefaultCache value) { - return ToDafny_N3_aws__N12_cryptography__N17_materialProviders__S12_DefaultCache(value); -} - public static AWS.Cryptography.MaterialProviders.NoCache FromDafny_N3_aws__N12_cryptography__N17_materialProviders__S9_CacheType__M2_No (software.amazon.cryptography.materialproviders.internaldafny.types._INoCache value) { - return FromDafny_N3_aws__N12_cryptography__N17_materialProviders__S7_NoCache(value); -} - public static software.amazon.cryptography.materialproviders.internaldafny.types._INoCache ToDafny_N3_aws__N12_cryptography__N17_materialProviders__S9_CacheType__M2_No (AWS.Cryptography.MaterialProviders.NoCache value) { - return ToDafny_N3_aws__N12_cryptography__N17_materialProviders__S7_NoCache(value); -} - public static AWS.Cryptography.MaterialProviders.SingleThreadedCache FromDafny_N3_aws__N12_cryptography__N17_materialProviders__S9_CacheType__M14_SingleThreaded (software.amazon.cryptography.materialproviders.internaldafny.types._ISingleThreadedCache value) { - return FromDafny_N3_aws__N12_cryptography__N17_materialProviders__S19_SingleThreadedCache(value); -} - public static software.amazon.cryptography.materialproviders.internaldafny.types._ISingleThreadedCache ToDafny_N3_aws__N12_cryptography__N17_materialProviders__S9_CacheType__M14_SingleThreaded (AWS.Cryptography.MaterialProviders.SingleThreadedCache value) { - return ToDafny_N3_aws__N12_cryptography__N17_materialProviders__S19_SingleThreadedCache(value); -} - public static AWS.Cryptography.MaterialProviders.MultiThreadedCache FromDafny_N3_aws__N12_cryptography__N17_materialProviders__S9_CacheType__M13_MultiThreaded (software.amazon.cryptography.materialproviders.internaldafny.types._IMultiThreadedCache value) { - return FromDafny_N3_aws__N12_cryptography__N17_materialProviders__S18_MultiThreadedCache(value); -} - public static software.amazon.cryptography.materialproviders.internaldafny.types._IMultiThreadedCache ToDafny_N3_aws__N12_cryptography__N17_materialProviders__S9_CacheType__M13_MultiThreaded (AWS.Cryptography.MaterialProviders.MultiThreadedCache value) { - return ToDafny_N3_aws__N12_cryptography__N17_materialProviders__S18_MultiThreadedCache(value); -} - public static AWS.Cryptography.MaterialProviders.StormTrackingCache FromDafny_N3_aws__N12_cryptography__N17_materialProviders__S9_CacheType__M13_StormTracking (software.amazon.cryptography.materialproviders.internaldafny.types._IStormTrackingCache value) { - return FromDafny_N3_aws__N12_cryptography__N17_materialProviders__S18_StormTrackingCache(value); -} - public static software.amazon.cryptography.materialproviders.internaldafny.types._IStormTrackingCache ToDafny_N3_aws__N12_cryptography__N17_materialProviders__S9_CacheType__M13_StormTracking (AWS.Cryptography.MaterialProviders.StormTrackingCache value) { - return ToDafny_N3_aws__N12_cryptography__N17_materialProviders__S18_StormTrackingCache(value); -} - public static string FromDafny_N3_com__N9_amazonaws__N8_dynamodb__S14_AttributeValue__M1_S (Dafny.ISequence value) { - return FromDafny_N3_com__N9_amazonaws__N8_dynamodb__S20_StringAttributeValue(value); -} - public static Dafny.ISequence ToDafny_N3_com__N9_amazonaws__N8_dynamodb__S14_AttributeValue__M1_S (string value) { - return ToDafny_N3_com__N9_amazonaws__N8_dynamodb__S20_StringAttributeValue(value); -} - public static string FromDafny_N3_com__N9_amazonaws__N8_dynamodb__S14_AttributeValue__M1_N (Dafny.ISequence value) { - return FromDafny_N3_com__N9_amazonaws__N8_dynamodb__S20_NumberAttributeValue(value); -} - public static Dafny.ISequence ToDafny_N3_com__N9_amazonaws__N8_dynamodb__S14_AttributeValue__M1_N (string value) { - return ToDafny_N3_com__N9_amazonaws__N8_dynamodb__S20_NumberAttributeValue(value); -} - public static System.IO.MemoryStream FromDafny_N3_com__N9_amazonaws__N8_dynamodb__S14_AttributeValue__M1_B (Dafny.ISequence value) { - return FromDafny_N3_com__N9_amazonaws__N8_dynamodb__S20_BinaryAttributeValue(value); -} - public static Dafny.ISequence ToDafny_N3_com__N9_amazonaws__N8_dynamodb__S14_AttributeValue__M1_B (System.IO.MemoryStream value) { - return ToDafny_N3_com__N9_amazonaws__N8_dynamodb__S20_BinaryAttributeValue(value); -} - public static System.Collections.Generic.List FromDafny_N3_com__N9_amazonaws__N8_dynamodb__S14_AttributeValue__M2_SS (Dafny.ISequence> value) { - return FromDafny_N3_com__N9_amazonaws__N8_dynamodb__S23_StringSetAttributeValue(value); -} - public static Dafny.ISequence> ToDafny_N3_com__N9_amazonaws__N8_dynamodb__S14_AttributeValue__M2_SS (System.Collections.Generic.List value) { - return ToDafny_N3_com__N9_amazonaws__N8_dynamodb__S23_StringSetAttributeValue(value); -} - public static System.Collections.Generic.List FromDafny_N3_com__N9_amazonaws__N8_dynamodb__S14_AttributeValue__M2_NS (Dafny.ISequence> value) { - return FromDafny_N3_com__N9_amazonaws__N8_dynamodb__S23_NumberSetAttributeValue(value); -} - public static Dafny.ISequence> ToDafny_N3_com__N9_amazonaws__N8_dynamodb__S14_AttributeValue__M2_NS (System.Collections.Generic.List value) { - return ToDafny_N3_com__N9_amazonaws__N8_dynamodb__S23_NumberSetAttributeValue(value); -} - public static System.Collections.Generic.List FromDafny_N3_com__N9_amazonaws__N8_dynamodb__S14_AttributeValue__M2_BS (Dafny.ISequence> value) { - return FromDafny_N3_com__N9_amazonaws__N8_dynamodb__S23_BinarySetAttributeValue(value); -} - public static Dafny.ISequence> ToDafny_N3_com__N9_amazonaws__N8_dynamodb__S14_AttributeValue__M2_BS (System.Collections.Generic.List value) { - return ToDafny_N3_com__N9_amazonaws__N8_dynamodb__S23_BinarySetAttributeValue(value); -} - public static System.Collections.Generic.Dictionary FromDafny_N3_com__N9_amazonaws__N8_dynamodb__S14_AttributeValue__M1_M (Dafny.IMap, software.amazon.cryptography.services.dynamodb.internaldafny.types._IAttributeValue> value) { - return FromDafny_N3_com__N9_amazonaws__N8_dynamodb__S17_MapAttributeValue(value); -} - public static Dafny.IMap, software.amazon.cryptography.services.dynamodb.internaldafny.types._IAttributeValue> ToDafny_N3_com__N9_amazonaws__N8_dynamodb__S14_AttributeValue__M1_M (System.Collections.Generic.Dictionary value) { - return ToDafny_N3_com__N9_amazonaws__N8_dynamodb__S17_MapAttributeValue(value); -} - public static System.Collections.Generic.List FromDafny_N3_com__N9_amazonaws__N8_dynamodb__S14_AttributeValue__M1_L (Dafny.ISequence value) { - return FromDafny_N3_com__N9_amazonaws__N8_dynamodb__S18_ListAttributeValue(value); -} - public static Dafny.ISequence ToDafny_N3_com__N9_amazonaws__N8_dynamodb__S14_AttributeValue__M1_L (System.Collections.Generic.List value) { - return ToDafny_N3_com__N9_amazonaws__N8_dynamodb__S18_ListAttributeValue(value); -} - public static bool FromDafny_N3_com__N9_amazonaws__N8_dynamodb__S14_AttributeValue__M4_NULL (bool value) { - return FromDafny_N3_com__N9_amazonaws__N8_dynamodb__S18_NullAttributeValue(value); -} - public static bool ToDafny_N3_com__N9_amazonaws__N8_dynamodb__S14_AttributeValue__M4_NULL (bool value) { - return ToDafny_N3_com__N9_amazonaws__N8_dynamodb__S18_NullAttributeValue(value); -} - public static bool FromDafny_N3_com__N9_amazonaws__N8_dynamodb__S14_AttributeValue__M4_BOOL (bool value) { - return FromDafny_N3_com__N9_amazonaws__N8_dynamodb__S21_BooleanAttributeValue(value); -} - public static bool ToDafny_N3_com__N9_amazonaws__N8_dynamodb__S14_AttributeValue__M4_BOOL (bool value) { - return ToDafny_N3_com__N9_amazonaws__N8_dynamodb__S21_BooleanAttributeValue(value); -} - public static string FromDafny_N3_aws__N12_cryptography__N15_dbEncryptionSdk__N8_dynamoDb__S33_EncryptedDataKeyDescriptionOutput__M13_keyProviderId (Dafny.ISequence value) { - return FromDafny_N6_smithy__N3_api__S6_String(value); -} - public static Dafny.ISequence ToDafny_N3_aws__N12_cryptography__N15_dbEncryptionSdk__N8_dynamoDb__S33_EncryptedDataKeyDescriptionOutput__M13_keyProviderId (string value) { - return ToDafny_N6_smithy__N3_api__S6_String(value); -} - public static string FromDafny_N3_aws__N12_cryptography__N15_dbEncryptionSdk__N8_dynamoDb__S33_EncryptedDataKeyDescriptionOutput__M15_keyProviderInfo (Wrappers_Compile._IOption> value) { - return value.is_None ? (string) null : FromDafny_N6_smithy__N3_api__S6_String(value.Extract()); -} - public static Wrappers_Compile._IOption> ToDafny_N3_aws__N12_cryptography__N15_dbEncryptionSdk__N8_dynamoDb__S33_EncryptedDataKeyDescriptionOutput__M15_keyProviderInfo (string value) { - return value == null ? Wrappers_Compile.Option>.create_None() : Wrappers_Compile.Option>.create_Some(ToDafny_N6_smithy__N3_api__S6_String((string) value)); -} - public static string FromDafny_N3_aws__N12_cryptography__N15_dbEncryptionSdk__N8_dynamoDb__S33_EncryptedDataKeyDescriptionOutput__M11_branchKeyId (Wrappers_Compile._IOption> value) { - return value.is_None ? (string) null : FromDafny_N6_smithy__N3_api__S6_String(value.Extract()); -} - public static Wrappers_Compile._IOption> ToDafny_N3_aws__N12_cryptography__N15_dbEncryptionSdk__N8_dynamoDb__S33_EncryptedDataKeyDescriptionOutput__M11_branchKeyId (string value) { - return value == null ? Wrappers_Compile.Option>.create_None() : Wrappers_Compile.Option>.create_Some(ToDafny_N6_smithy__N3_api__S6_String((string) value)); -} - public static string FromDafny_N3_aws__N12_cryptography__N15_dbEncryptionSdk__N8_dynamoDb__S33_EncryptedDataKeyDescriptionOutput__M16_branchKeyVersion (Wrappers_Compile._IOption> value) { - return value.is_None ? (string) null : FromDafny_N6_smithy__N3_api__S6_String(value.Extract()); -} - public static Wrappers_Compile._IOption> ToDafny_N3_aws__N12_cryptography__N15_dbEncryptionSdk__N8_dynamoDb__S33_EncryptedDataKeyDescriptionOutput__M16_branchKeyVersion (string value) { - return value == null ? Wrappers_Compile.Option>.create_None() : Wrappers_Compile.Option>.create_Some(ToDafny_N6_smithy__N3_api__S6_String((string) value)); -} - public static AWS.Cryptography.MaterialProviders.DefaultCache FromDafny_N3_aws__N12_cryptography__N17_materialProviders__S12_DefaultCache (software.amazon.cryptography.materialproviders.internaldafny.types._IDefaultCache value) { - software.amazon.cryptography.materialproviders.internaldafny.types.DefaultCache concrete = (software.amazon.cryptography.materialproviders.internaldafny.types.DefaultCache)value; AWS.Cryptography.MaterialProviders.DefaultCache converted = new AWS.Cryptography.MaterialProviders.DefaultCache(); converted.EntryCapacity = (int) FromDafny_N3_aws__N12_cryptography__N17_materialProviders__S12_DefaultCache__M13_entryCapacity(concrete._entryCapacity); return converted; -} - public static software.amazon.cryptography.materialproviders.internaldafny.types._IDefaultCache ToDafny_N3_aws__N12_cryptography__N17_materialProviders__S12_DefaultCache (AWS.Cryptography.MaterialProviders.DefaultCache value) { - - return new software.amazon.cryptography.materialproviders.internaldafny.types.DefaultCache ( ToDafny_N3_aws__N12_cryptography__N17_materialProviders__S12_DefaultCache__M13_entryCapacity(value.EntryCapacity) ) ; -} - public static AWS.Cryptography.MaterialProviders.NoCache FromDafny_N3_aws__N12_cryptography__N17_materialProviders__S7_NoCache (software.amazon.cryptography.materialproviders.internaldafny.types._INoCache value) { - software.amazon.cryptography.materialproviders.internaldafny.types.NoCache concrete = (software.amazon.cryptography.materialproviders.internaldafny.types.NoCache)value; AWS.Cryptography.MaterialProviders.NoCache converted = new AWS.Cryptography.MaterialProviders.NoCache(); return converted; -} - public static software.amazon.cryptography.materialproviders.internaldafny.types._INoCache ToDafny_N3_aws__N12_cryptography__N17_materialProviders__S7_NoCache (AWS.Cryptography.MaterialProviders.NoCache value) { - - return new software.amazon.cryptography.materialproviders.internaldafny.types.NoCache ( ) ; -} - public static AWS.Cryptography.MaterialProviders.SingleThreadedCache FromDafny_N3_aws__N12_cryptography__N17_materialProviders__S19_SingleThreadedCache (software.amazon.cryptography.materialproviders.internaldafny.types._ISingleThreadedCache value) { - software.amazon.cryptography.materialproviders.internaldafny.types.SingleThreadedCache concrete = (software.amazon.cryptography.materialproviders.internaldafny.types.SingleThreadedCache)value; AWS.Cryptography.MaterialProviders.SingleThreadedCache converted = new AWS.Cryptography.MaterialProviders.SingleThreadedCache(); converted.EntryCapacity = (int) FromDafny_N3_aws__N12_cryptography__N17_materialProviders__S19_SingleThreadedCache__M13_entryCapacity(concrete._entryCapacity); - if (concrete._entryPruningTailSize.is_Some) converted.EntryPruningTailSize = (int) FromDafny_N3_aws__N12_cryptography__N17_materialProviders__S19_SingleThreadedCache__M20_entryPruningTailSize(concrete._entryPruningTailSize); return converted; -} - public static software.amazon.cryptography.materialproviders.internaldafny.types._ISingleThreadedCache ToDafny_N3_aws__N12_cryptography__N17_materialProviders__S19_SingleThreadedCache (AWS.Cryptography.MaterialProviders.SingleThreadedCache value) { - int? var_entryPruningTailSize = value.IsSetEntryPruningTailSize() ? value.EntryPruningTailSize : (int?) null; - return new software.amazon.cryptography.materialproviders.internaldafny.types.SingleThreadedCache ( ToDafny_N3_aws__N12_cryptography__N17_materialProviders__S19_SingleThreadedCache__M13_entryCapacity(value.EntryCapacity) , ToDafny_N3_aws__N12_cryptography__N17_materialProviders__S19_SingleThreadedCache__M20_entryPruningTailSize(var_entryPruningTailSize) ) ; -} - public static AWS.Cryptography.MaterialProviders.MultiThreadedCache FromDafny_N3_aws__N12_cryptography__N17_materialProviders__S18_MultiThreadedCache (software.amazon.cryptography.materialproviders.internaldafny.types._IMultiThreadedCache value) { - software.amazon.cryptography.materialproviders.internaldafny.types.MultiThreadedCache concrete = (software.amazon.cryptography.materialproviders.internaldafny.types.MultiThreadedCache)value; AWS.Cryptography.MaterialProviders.MultiThreadedCache converted = new AWS.Cryptography.MaterialProviders.MultiThreadedCache(); converted.EntryCapacity = (int) FromDafny_N3_aws__N12_cryptography__N17_materialProviders__S18_MultiThreadedCache__M13_entryCapacity(concrete._entryCapacity); - if (concrete._entryPruningTailSize.is_Some) converted.EntryPruningTailSize = (int) FromDafny_N3_aws__N12_cryptography__N17_materialProviders__S18_MultiThreadedCache__M20_entryPruningTailSize(concrete._entryPruningTailSize); return converted; -} - public static software.amazon.cryptography.materialproviders.internaldafny.types._IMultiThreadedCache ToDafny_N3_aws__N12_cryptography__N17_materialProviders__S18_MultiThreadedCache (AWS.Cryptography.MaterialProviders.MultiThreadedCache value) { - int? var_entryPruningTailSize = value.IsSetEntryPruningTailSize() ? value.EntryPruningTailSize : (int?) null; - return new software.amazon.cryptography.materialproviders.internaldafny.types.MultiThreadedCache ( ToDafny_N3_aws__N12_cryptography__N17_materialProviders__S18_MultiThreadedCache__M13_entryCapacity(value.EntryCapacity) , ToDafny_N3_aws__N12_cryptography__N17_materialProviders__S18_MultiThreadedCache__M20_entryPruningTailSize(var_entryPruningTailSize) ) ; -} - public static AWS.Cryptography.MaterialProviders.StormTrackingCache FromDafny_N3_aws__N12_cryptography__N17_materialProviders__S18_StormTrackingCache (software.amazon.cryptography.materialproviders.internaldafny.types._IStormTrackingCache value) { - software.amazon.cryptography.materialproviders.internaldafny.types.StormTrackingCache concrete = (software.amazon.cryptography.materialproviders.internaldafny.types.StormTrackingCache)value; AWS.Cryptography.MaterialProviders.StormTrackingCache converted = new AWS.Cryptography.MaterialProviders.StormTrackingCache(); converted.EntryCapacity = (int) FromDafny_N3_aws__N12_cryptography__N17_materialProviders__S18_StormTrackingCache__M13_entryCapacity(concrete._entryCapacity); - if (concrete._entryPruningTailSize.is_Some) converted.EntryPruningTailSize = (int) FromDafny_N3_aws__N12_cryptography__N17_materialProviders__S18_StormTrackingCache__M20_entryPruningTailSize(concrete._entryPruningTailSize); - converted.GracePeriod = (int) FromDafny_N3_aws__N12_cryptography__N17_materialProviders__S18_StormTrackingCache__M11_gracePeriod(concrete._gracePeriod); - converted.GraceInterval = (int) FromDafny_N3_aws__N12_cryptography__N17_materialProviders__S18_StormTrackingCache__M13_graceInterval(concrete._graceInterval); - converted.FanOut = (int) FromDafny_N3_aws__N12_cryptography__N17_materialProviders__S18_StormTrackingCache__M6_fanOut(concrete._fanOut); - converted.InFlightTTL = (int) FromDafny_N3_aws__N12_cryptography__N17_materialProviders__S18_StormTrackingCache__M11_inFlightTTL(concrete._inFlightTTL); - converted.SleepMilli = (int) FromDafny_N3_aws__N12_cryptography__N17_materialProviders__S18_StormTrackingCache__M10_sleepMilli(concrete._sleepMilli); return converted; -} - public static software.amazon.cryptography.materialproviders.internaldafny.types._IStormTrackingCache ToDafny_N3_aws__N12_cryptography__N17_materialProviders__S18_StormTrackingCache (AWS.Cryptography.MaterialProviders.StormTrackingCache value) { - int? var_entryPruningTailSize = value.IsSetEntryPruningTailSize() ? value.EntryPruningTailSize : (int?) null; - return new software.amazon.cryptography.materialproviders.internaldafny.types.StormTrackingCache ( ToDafny_N3_aws__N12_cryptography__N17_materialProviders__S18_StormTrackingCache__M13_entryCapacity(value.EntryCapacity) , ToDafny_N3_aws__N12_cryptography__N17_materialProviders__S18_StormTrackingCache__M20_entryPruningTailSize(var_entryPruningTailSize) , ToDafny_N3_aws__N12_cryptography__N17_materialProviders__S18_StormTrackingCache__M11_gracePeriod(value.GracePeriod) , ToDafny_N3_aws__N12_cryptography__N17_materialProviders__S18_StormTrackingCache__M13_graceInterval(value.GraceInterval) , ToDafny_N3_aws__N12_cryptography__N17_materialProviders__S18_StormTrackingCache__M6_fanOut(value.FanOut) , ToDafny_N3_aws__N12_cryptography__N17_materialProviders__S18_StormTrackingCache__M11_inFlightTTL(value.InFlightTTL) , ToDafny_N3_aws__N12_cryptography__N17_materialProviders__S18_StormTrackingCache__M10_sleepMilli(value.SleepMilli) ) ; -} - public static string FromDafny_N3_com__N9_amazonaws__N8_dynamodb__S20_StringAttributeValue (Dafny.ISequence value) { - return new string(value.Elements); -} - public static Dafny.ISequence ToDafny_N3_com__N9_amazonaws__N8_dynamodb__S20_StringAttributeValue (string value) { - return Dafny.Sequence.FromString(value); -} - public static string FromDafny_N3_com__N9_amazonaws__N8_dynamodb__S20_NumberAttributeValue (Dafny.ISequence value) { - return new string(value.Elements); -} - public static Dafny.ISequence ToDafny_N3_com__N9_amazonaws__N8_dynamodb__S20_NumberAttributeValue (string value) { - return Dafny.Sequence.FromString(value); -} - public static System.IO.MemoryStream FromDafny_N3_com__N9_amazonaws__N8_dynamodb__S20_BinaryAttributeValue (Dafny.ISequence value) { - return new System.IO.MemoryStream(value.Elements); -} - public static Dafny.ISequence ToDafny_N3_com__N9_amazonaws__N8_dynamodb__S20_BinaryAttributeValue (System.IO.MemoryStream value) { - return Dafny.Sequence.FromArray(value.ToArray()); -} - public static System.Collections.Generic.List FromDafny_N3_com__N9_amazonaws__N8_dynamodb__S23_StringSetAttributeValue (Dafny.ISequence> value) { - return new System.Collections.Generic.List(value.Elements.Select(FromDafny_N3_com__N9_amazonaws__N8_dynamodb__S23_StringSetAttributeValue__M6_member)); -} - public static Dafny.ISequence> ToDafny_N3_com__N9_amazonaws__N8_dynamodb__S23_StringSetAttributeValue (System.Collections.Generic.List value) { - return Dafny.Sequence>.FromArray(value.Select(ToDafny_N3_com__N9_amazonaws__N8_dynamodb__S23_StringSetAttributeValue__M6_member).ToArray()); -} - public static System.Collections.Generic.List FromDafny_N3_com__N9_amazonaws__N8_dynamodb__S23_NumberSetAttributeValue (Dafny.ISequence> value) { - return new System.Collections.Generic.List(value.Elements.Select(FromDafny_N3_com__N9_amazonaws__N8_dynamodb__S23_NumberSetAttributeValue__M6_member)); -} - public static Dafny.ISequence> ToDafny_N3_com__N9_amazonaws__N8_dynamodb__S23_NumberSetAttributeValue (System.Collections.Generic.List value) { - return Dafny.Sequence>.FromArray(value.Select(ToDafny_N3_com__N9_amazonaws__N8_dynamodb__S23_NumberSetAttributeValue__M6_member).ToArray()); -} - public static System.Collections.Generic.List FromDafny_N3_com__N9_amazonaws__N8_dynamodb__S23_BinarySetAttributeValue (Dafny.ISequence> value) { - return new System.Collections.Generic.List(value.Elements.Select(FromDafny_N3_com__N9_amazonaws__N8_dynamodb__S23_BinarySetAttributeValue__M6_member)); -} - public static Dafny.ISequence> ToDafny_N3_com__N9_amazonaws__N8_dynamodb__S23_BinarySetAttributeValue (System.Collections.Generic.List value) { - return Dafny.Sequence>.FromArray(value.Select(ToDafny_N3_com__N9_amazonaws__N8_dynamodb__S23_BinarySetAttributeValue__M6_member).ToArray()); -} - public static System.Collections.Generic.Dictionary FromDafny_N3_com__N9_amazonaws__N8_dynamodb__S17_MapAttributeValue (Dafny.IMap, software.amazon.cryptography.services.dynamodb.internaldafny.types._IAttributeValue> value) { - return value.ItemEnumerable.ToDictionary(pair => FromDafny_N3_com__N9_amazonaws__N8_dynamodb__S17_MapAttributeValue__M3_key(pair.Car), pair => FromDafny_N3_com__N9_amazonaws__N8_dynamodb__S17_MapAttributeValue__M5_value(pair.Cdr)); -} - public static Dafny.IMap, software.amazon.cryptography.services.dynamodb.internaldafny.types._IAttributeValue> ToDafny_N3_com__N9_amazonaws__N8_dynamodb__S17_MapAttributeValue (System.Collections.Generic.Dictionary value) { - return Dafny.Map, software.amazon.cryptography.services.dynamodb.internaldafny.types._IAttributeValue>.FromCollection(value.Select(pair => - new Dafny.Pair, software.amazon.cryptography.services.dynamodb.internaldafny.types._IAttributeValue>(ToDafny_N3_com__N9_amazonaws__N8_dynamodb__S17_MapAttributeValue__M3_key(pair.Key), ToDafny_N3_com__N9_amazonaws__N8_dynamodb__S17_MapAttributeValue__M5_value(pair.Value)) -)); -} - public static System.Collections.Generic.List FromDafny_N3_com__N9_amazonaws__N8_dynamodb__S18_ListAttributeValue (Dafny.ISequence value) { - return new System.Collections.Generic.List(value.Elements.Select(FromDafny_N3_com__N9_amazonaws__N8_dynamodb__S18_ListAttributeValue__M6_member)); -} - public static Dafny.ISequence ToDafny_N3_com__N9_amazonaws__N8_dynamodb__S18_ListAttributeValue (System.Collections.Generic.List value) { - return Dafny.Sequence.FromArray(value.Select(ToDafny_N3_com__N9_amazonaws__N8_dynamodb__S18_ListAttributeValue__M6_member).ToArray()); -} - public static bool FromDafny_N3_com__N9_amazonaws__N8_dynamodb__S18_NullAttributeValue (bool value) { - return value; -} - public static bool ToDafny_N3_com__N9_amazonaws__N8_dynamodb__S18_NullAttributeValue (bool value) { - return value; -} - public static bool FromDafny_N3_com__N9_amazonaws__N8_dynamodb__S21_BooleanAttributeValue (bool value) { - return value; -} - public static bool ToDafny_N3_com__N9_amazonaws__N8_dynamodb__S21_BooleanAttributeValue (bool value) { - return value; -} - public static int FromDafny_N3_aws__N12_cryptography__N17_materialProviders__S12_DefaultCache__M13_entryCapacity (int value) { - return FromDafny_N3_aws__N12_cryptography__N17_materialProviders__S14_CountingNumber(value); -} - public static int ToDafny_N3_aws__N12_cryptography__N17_materialProviders__S12_DefaultCache__M13_entryCapacity (int value) { - return ToDafny_N3_aws__N12_cryptography__N17_materialProviders__S14_CountingNumber(value); -} - public static int FromDafny_N3_aws__N12_cryptography__N17_materialProviders__S19_SingleThreadedCache__M13_entryCapacity (int value) { - return FromDafny_N3_aws__N12_cryptography__N17_materialProviders__S14_CountingNumber(value); -} - public static int ToDafny_N3_aws__N12_cryptography__N17_materialProviders__S19_SingleThreadedCache__M13_entryCapacity (int value) { - return ToDafny_N3_aws__N12_cryptography__N17_materialProviders__S14_CountingNumber(value); -} - public static int? FromDafny_N3_aws__N12_cryptography__N17_materialProviders__S19_SingleThreadedCache__M20_entryPruningTailSize (Wrappers_Compile._IOption value) { - return value.is_None ? (int?) null : FromDafny_N3_aws__N12_cryptography__N17_materialProviders__S14_CountingNumber(value.Extract()); -} - public static Wrappers_Compile._IOption ToDafny_N3_aws__N12_cryptography__N17_materialProviders__S19_SingleThreadedCache__M20_entryPruningTailSize (int? value) { - return value == null ? Wrappers_Compile.Option.create_None() : Wrappers_Compile.Option.create_Some(ToDafny_N3_aws__N12_cryptography__N17_materialProviders__S14_CountingNumber((int) value)); -} - public static int FromDafny_N3_aws__N12_cryptography__N17_materialProviders__S18_MultiThreadedCache__M13_entryCapacity (int value) { - return FromDafny_N3_aws__N12_cryptography__N17_materialProviders__S14_CountingNumber(value); -} - public static int ToDafny_N3_aws__N12_cryptography__N17_materialProviders__S18_MultiThreadedCache__M13_entryCapacity (int value) { - return ToDafny_N3_aws__N12_cryptography__N17_materialProviders__S14_CountingNumber(value); -} - public static int? FromDafny_N3_aws__N12_cryptography__N17_materialProviders__S18_MultiThreadedCache__M20_entryPruningTailSize (Wrappers_Compile._IOption value) { - return value.is_None ? (int?) null : FromDafny_N3_aws__N12_cryptography__N17_materialProviders__S14_CountingNumber(value.Extract()); -} - public static Wrappers_Compile._IOption ToDafny_N3_aws__N12_cryptography__N17_materialProviders__S18_MultiThreadedCache__M20_entryPruningTailSize (int? value) { - return value == null ? Wrappers_Compile.Option.create_None() : Wrappers_Compile.Option.create_Some(ToDafny_N3_aws__N12_cryptography__N17_materialProviders__S14_CountingNumber((int) value)); -} - public static int FromDafny_N3_aws__N12_cryptography__N17_materialProviders__S18_StormTrackingCache__M13_entryCapacity (int value) { - return FromDafny_N3_aws__N12_cryptography__N17_materialProviders__S14_CountingNumber(value); -} - public static int ToDafny_N3_aws__N12_cryptography__N17_materialProviders__S18_StormTrackingCache__M13_entryCapacity (int value) { - return ToDafny_N3_aws__N12_cryptography__N17_materialProviders__S14_CountingNumber(value); -} - public static int? FromDafny_N3_aws__N12_cryptography__N17_materialProviders__S18_StormTrackingCache__M20_entryPruningTailSize (Wrappers_Compile._IOption value) { - return value.is_None ? (int?) null : FromDafny_N3_aws__N12_cryptography__N17_materialProviders__S14_CountingNumber(value.Extract()); -} - public static Wrappers_Compile._IOption ToDafny_N3_aws__N12_cryptography__N17_materialProviders__S18_StormTrackingCache__M20_entryPruningTailSize (int? value) { - return value == null ? Wrappers_Compile.Option.create_None() : Wrappers_Compile.Option.create_Some(ToDafny_N3_aws__N12_cryptography__N17_materialProviders__S14_CountingNumber((int) value)); -} - public static int FromDafny_N3_aws__N12_cryptography__N17_materialProviders__S18_StormTrackingCache__M11_gracePeriod (int value) { - return FromDafny_N3_aws__N12_cryptography__N17_materialProviders__S14_CountingNumber(value); -} - public static int ToDafny_N3_aws__N12_cryptography__N17_materialProviders__S18_StormTrackingCache__M11_gracePeriod (int value) { - return ToDafny_N3_aws__N12_cryptography__N17_materialProviders__S14_CountingNumber(value); -} - public static int FromDafny_N3_aws__N12_cryptography__N17_materialProviders__S18_StormTrackingCache__M13_graceInterval (int value) { - return FromDafny_N3_aws__N12_cryptography__N17_materialProviders__S14_CountingNumber(value); -} - public static int ToDafny_N3_aws__N12_cryptography__N17_materialProviders__S18_StormTrackingCache__M13_graceInterval (int value) { - return ToDafny_N3_aws__N12_cryptography__N17_materialProviders__S14_CountingNumber(value); -} - public static int FromDafny_N3_aws__N12_cryptography__N17_materialProviders__S18_StormTrackingCache__M6_fanOut (int value) { - return FromDafny_N3_aws__N12_cryptography__N17_materialProviders__S14_CountingNumber(value); -} - public static int ToDafny_N3_aws__N12_cryptography__N17_materialProviders__S18_StormTrackingCache__M6_fanOut (int value) { - return ToDafny_N3_aws__N12_cryptography__N17_materialProviders__S14_CountingNumber(value); -} - public static int FromDafny_N3_aws__N12_cryptography__N17_materialProviders__S18_StormTrackingCache__M11_inFlightTTL (int value) { - return FromDafny_N3_aws__N12_cryptography__N17_materialProviders__S14_CountingNumber(value); -} - public static int ToDafny_N3_aws__N12_cryptography__N17_materialProviders__S18_StormTrackingCache__M11_inFlightTTL (int value) { - return ToDafny_N3_aws__N12_cryptography__N17_materialProviders__S14_CountingNumber(value); -} - public static int FromDafny_N3_aws__N12_cryptography__N17_materialProviders__S18_StormTrackingCache__M10_sleepMilli (int value) { - return FromDafny_N3_aws__N12_cryptography__N17_materialProviders__S14_CountingNumber(value); -} - public static int ToDafny_N3_aws__N12_cryptography__N17_materialProviders__S18_StormTrackingCache__M10_sleepMilli (int value) { - return ToDafny_N3_aws__N12_cryptography__N17_materialProviders__S14_CountingNumber(value); -} - public static string FromDafny_N3_com__N9_amazonaws__N8_dynamodb__S23_StringSetAttributeValue__M6_member (Dafny.ISequence value) { - return FromDafny_N3_com__N9_amazonaws__N8_dynamodb__S20_StringAttributeValue(value); -} - public static Dafny.ISequence ToDafny_N3_com__N9_amazonaws__N8_dynamodb__S23_StringSetAttributeValue__M6_member (string value) { - return ToDafny_N3_com__N9_amazonaws__N8_dynamodb__S20_StringAttributeValue(value); -} - public static string FromDafny_N3_com__N9_amazonaws__N8_dynamodb__S23_NumberSetAttributeValue__M6_member (Dafny.ISequence value) { - return FromDafny_N3_com__N9_amazonaws__N8_dynamodb__S20_NumberAttributeValue(value); -} - public static Dafny.ISequence ToDafny_N3_com__N9_amazonaws__N8_dynamodb__S23_NumberSetAttributeValue__M6_member (string value) { - return ToDafny_N3_com__N9_amazonaws__N8_dynamodb__S20_NumberAttributeValue(value); -} - public static System.IO.MemoryStream FromDafny_N3_com__N9_amazonaws__N8_dynamodb__S23_BinarySetAttributeValue__M6_member (Dafny.ISequence value) { - return FromDafny_N3_com__N9_amazonaws__N8_dynamodb__S20_BinaryAttributeValue(value); -} - public static Dafny.ISequence ToDafny_N3_com__N9_amazonaws__N8_dynamodb__S23_BinarySetAttributeValue__M6_member (System.IO.MemoryStream value) { - return ToDafny_N3_com__N9_amazonaws__N8_dynamodb__S20_BinaryAttributeValue(value); -} - public static string FromDafny_N3_com__N9_amazonaws__N8_dynamodb__S17_MapAttributeValue__M3_key (Dafny.ISequence value) { - return FromDafny_N3_com__N9_amazonaws__N8_dynamodb__S13_AttributeName(value); -} - public static Dafny.ISequence ToDafny_N3_com__N9_amazonaws__N8_dynamodb__S17_MapAttributeValue__M3_key (string value) { - return ToDafny_N3_com__N9_amazonaws__N8_dynamodb__S13_AttributeName(value); -} - public static Amazon.DynamoDBv2.Model.AttributeValue FromDafny_N3_com__N9_amazonaws__N8_dynamodb__S17_MapAttributeValue__M5_value (software.amazon.cryptography.services.dynamodb.internaldafny.types._IAttributeValue value) { - return FromDafny_N3_com__N9_amazonaws__N8_dynamodb__S14_AttributeValue(value); -} - public static software.amazon.cryptography.services.dynamodb.internaldafny.types._IAttributeValue ToDafny_N3_com__N9_amazonaws__N8_dynamodb__S17_MapAttributeValue__M5_value (Amazon.DynamoDBv2.Model.AttributeValue value) { - return ToDafny_N3_com__N9_amazonaws__N8_dynamodb__S14_AttributeValue(value); -} - public static Amazon.DynamoDBv2.Model.AttributeValue FromDafny_N3_com__N9_amazonaws__N8_dynamodb__S18_ListAttributeValue__M6_member (software.amazon.cryptography.services.dynamodb.internaldafny.types._IAttributeValue value) { - return FromDafny_N3_com__N9_amazonaws__N8_dynamodb__S14_AttributeValue(value); -} - public static software.amazon.cryptography.services.dynamodb.internaldafny.types._IAttributeValue ToDafny_N3_com__N9_amazonaws__N8_dynamodb__S18_ListAttributeValue__M6_member (Amazon.DynamoDBv2.Model.AttributeValue value) { - return ToDafny_N3_com__N9_amazonaws__N8_dynamodb__S14_AttributeValue(value); -} - public static int FromDafny_N3_aws__N12_cryptography__N17_materialProviders__S14_CountingNumber (int value) { - return value; -} - public static int ToDafny_N3_aws__N12_cryptography__N17_materialProviders__S14_CountingNumber (int value) { - return value; -} - public static System.Exception FromDafny_CommonError(software.amazon.cryptography.dbencryptionsdk.dynamodb.internaldafny.types._IError value) { - switch(value) - { - case software.amazon.cryptography.dbencryptionsdk.dynamodb.internaldafny.types.Error_AwsCryptographyDbEncryptionSdkStructuredEncryption dafnyVal: - return AWS.Cryptography.DbEncryptionSDK.StructuredEncryption.TypeConversion.FromDafny_CommonError( - dafnyVal._AwsCryptographyDbEncryptionSdkStructuredEncryption - ); - case software.amazon.cryptography.dbencryptionsdk.dynamodb.internaldafny.types.Error_AwsCryptographyPrimitives dafnyVal: - return AWS.Cryptography.Primitives.TypeConversion.FromDafny_CommonError( - dafnyVal._AwsCryptographyPrimitives - ); - case software.amazon.cryptography.dbencryptionsdk.dynamodb.internaldafny.types.Error_AwsCryptographyMaterialProviders dafnyVal: - return AWS.Cryptography.MaterialProviders.TypeConversion.FromDafny_CommonError( - dafnyVal._AwsCryptographyMaterialProviders - ); - case software.amazon.cryptography.dbencryptionsdk.dynamodb.internaldafny.types.Error_ComAmazonawsDynamodb dafnyVal: - return Com.Amazonaws.Dynamodb.TypeConversion.FromDafny_CommonError( - dafnyVal._ComAmazonawsDynamodb - ); - case software.amazon.cryptography.dbencryptionsdk.dynamodb.internaldafny.types.Error_DynamoDbEncryptionException dafnyVal: -return FromDafny_N3_aws__N12_cryptography__N15_dbEncryptionSdk__N8_dynamoDb__S27_DynamoDbEncryptionException(dafnyVal); - case software.amazon.cryptography.dbencryptionsdk.dynamodb.internaldafny.types.Error_CollectionOfErrors dafnyVal: - return new CollectionOfErrors( - new System.Collections.Generic.List(dafnyVal.dtor_list.CloneAsArray() - .Select(x => TypeConversion.FromDafny_CommonError(x))), - new string(dafnyVal.dtor_message.Elements)); - case software.amazon.cryptography.dbencryptionsdk.dynamodb.internaldafny.types.Error_Opaque dafnyVal: - return new OpaqueError(dafnyVal._obj); - default: - // The switch MUST be complete for _IError, so `value` MUST NOT be an _IError. (How did you get here?) - return new OpaqueError(); -} -} - public static software.amazon.cryptography.dbencryptionsdk.dynamodb.internaldafny.types._IError ToDafny_CommonError(System.Exception value) { - - switch (value) - { - case AWS.Cryptography.DbEncryptionSDK.DynamoDb.DynamoDbEncryptionException exception: - return ToDafny_N3_aws__N12_cryptography__N15_dbEncryptionSdk__N8_dynamoDb__S27_DynamoDbEncryptionException(exception); - case CollectionOfErrors collectionOfErrors: - return new software.amazon.cryptography.dbencryptionsdk.dynamodb.internaldafny.types.Error_CollectionOfErrors( - Dafny.Sequence - .FromArray( - collectionOfErrors.list.Select - (x => TypeConversion.ToDafny_CommonError(x)) - .ToArray()), - Dafny.Sequence.FromString(collectionOfErrors.Message) - ); - // OpaqueError is redundant, but listed for completeness. - case OpaqueError exception: - return new software.amazon.cryptography.dbencryptionsdk.dynamodb.internaldafny.types.Error_Opaque(exception); - case System.Exception exception: - return new software.amazon.cryptography.dbencryptionsdk.dynamodb.internaldafny.types.Error_Opaque(exception); - default: - // The switch MUST be complete for System.Exception, so `value` MUST NOT be an System.Exception. (How did you get here?) - return new software.amazon.cryptography.dbencryptionsdk.dynamodb.internaldafny.types.Error_Opaque(value); -} -} -} -} diff --git a/TestVectors/runtimes/net/Generated/DDBEncryption/Upper.cs b/TestVectors/runtimes/net/Generated/DDBEncryption/Upper.cs deleted file mode 100644 index fb0cf7c25..000000000 --- a/TestVectors/runtimes/net/Generated/DDBEncryption/Upper.cs +++ /dev/null @@ -1,13 +0,0 @@ -// Copyright Amazon.com Inc. or its affiliates. All Rights Reserved. -// SPDX-License-Identifier: Apache-2.0 -// Do not modify this file. This file is machine generated, and any changes to it will be overwritten. -using System; - using AWS.Cryptography.DbEncryptionSDK.DynamoDb; namespace AWS.Cryptography.DbEncryptionSDK.DynamoDb { - public class Upper { - - - public void Validate() { - -} -} -} diff --git a/TestVectors/runtimes/net/Generated/DDBEncryption/VirtualField.cs b/TestVectors/runtimes/net/Generated/DDBEncryption/VirtualField.cs deleted file mode 100644 index 4508620e1..000000000 --- a/TestVectors/runtimes/net/Generated/DDBEncryption/VirtualField.cs +++ /dev/null @@ -1,29 +0,0 @@ -// Copyright Amazon.com Inc. or its affiliates. All Rights Reserved. -// SPDX-License-Identifier: Apache-2.0 -// Do not modify this file. This file is machine generated, and any changes to it will be overwritten. -using System; - using AWS.Cryptography.DbEncryptionSDK.DynamoDb; namespace AWS.Cryptography.DbEncryptionSDK.DynamoDb { - public class VirtualField { - private string _name ; - private System.Collections.Generic.List _parts ; - public string Name { - get { return this._name; } - set { this._name = value; } -} - public bool IsSetName () { - return this._name != null; -} - public System.Collections.Generic.List Parts { - get { return this._parts; } - set { this._parts = value; } -} - public bool IsSetParts () { - return this._parts != null; -} - public void Validate() { - if (!IsSetName()) throw new System.ArgumentException("Missing value for required property 'Name'"); - if (!IsSetParts()) throw new System.ArgumentException("Missing value for required property 'Parts'"); - -} -} -} diff --git a/TestVectors/runtimes/net/Generated/DDBEncryption/VirtualPart.cs b/TestVectors/runtimes/net/Generated/DDBEncryption/VirtualPart.cs deleted file mode 100644 index a9738268d..000000000 --- a/TestVectors/runtimes/net/Generated/DDBEncryption/VirtualPart.cs +++ /dev/null @@ -1,28 +0,0 @@ -// Copyright Amazon.com Inc. or its affiliates. All Rights Reserved. -// SPDX-License-Identifier: Apache-2.0 -// Do not modify this file. This file is machine generated, and any changes to it will be overwritten. -using System; - using AWS.Cryptography.DbEncryptionSDK.DynamoDb; namespace AWS.Cryptography.DbEncryptionSDK.DynamoDb { - public class VirtualPart { - private string _loc ; - private System.Collections.Generic.List _trans ; - public string Loc { - get { return this._loc; } - set { this._loc = value; } -} - public bool IsSetLoc () { - return this._loc != null; -} - public System.Collections.Generic.List Trans { - get { return this._trans; } - set { this._trans = value; } -} - public bool IsSetTrans () { - return this._trans != null; -} - public void Validate() { - if (!IsSetLoc()) throw new System.ArgumentException("Missing value for required property 'Loc'"); - -} -} -} diff --git a/TestVectors/runtimes/net/Generated/DDBEncryption/VirtualTransform.cs b/TestVectors/runtimes/net/Generated/DDBEncryption/VirtualTransform.cs deleted file mode 100644 index 64313ce67..000000000 --- a/TestVectors/runtimes/net/Generated/DDBEncryption/VirtualTransform.cs +++ /dev/null @@ -1,86 +0,0 @@ -// Copyright Amazon.com Inc. or its affiliates. All Rights Reserved. -// SPDX-License-Identifier: Apache-2.0 -// Do not modify this file. This file is machine generated, and any changes to it will be overwritten. -using System; - using AWS.Cryptography.DbEncryptionSDK.DynamoDb; namespace AWS.Cryptography.DbEncryptionSDK.DynamoDb { - public class VirtualTransform { - private AWS.Cryptography.DbEncryptionSDK.DynamoDb.Upper _upper ; - private AWS.Cryptography.DbEncryptionSDK.DynamoDb.Lower _lower ; - private AWS.Cryptography.DbEncryptionSDK.DynamoDb.Insert _insert ; - private AWS.Cryptography.DbEncryptionSDK.DynamoDb.GetPrefix _prefix ; - private AWS.Cryptography.DbEncryptionSDK.DynamoDb.GetSuffix _suffix ; - private AWS.Cryptography.DbEncryptionSDK.DynamoDb.GetSubstring _substring ; - private AWS.Cryptography.DbEncryptionSDK.DynamoDb.GetSegment _segment ; - private AWS.Cryptography.DbEncryptionSDK.DynamoDb.GetSegments _segments ; - public AWS.Cryptography.DbEncryptionSDK.DynamoDb.Upper Upper { - get { return this._upper; } - set { this._upper = value; } -} - public bool IsSetUpper () { - return this._upper != null; -} - public AWS.Cryptography.DbEncryptionSDK.DynamoDb.Lower Lower { - get { return this._lower; } - set { this._lower = value; } -} - public bool IsSetLower () { - return this._lower != null; -} - public AWS.Cryptography.DbEncryptionSDK.DynamoDb.Insert Insert { - get { return this._insert; } - set { this._insert = value; } -} - public bool IsSetInsert () { - return this._insert != null; -} - public AWS.Cryptography.DbEncryptionSDK.DynamoDb.GetPrefix Prefix { - get { return this._prefix; } - set { this._prefix = value; } -} - public bool IsSetPrefix () { - return this._prefix != null; -} - public AWS.Cryptography.DbEncryptionSDK.DynamoDb.GetSuffix Suffix { - get { return this._suffix; } - set { this._suffix = value; } -} - public bool IsSetSuffix () { - return this._suffix != null; -} - public AWS.Cryptography.DbEncryptionSDK.DynamoDb.GetSubstring Substring { - get { return this._substring; } - set { this._substring = value; } -} - public bool IsSetSubstring () { - return this._substring != null; -} - public AWS.Cryptography.DbEncryptionSDK.DynamoDb.GetSegment Segment { - get { return this._segment; } - set { this._segment = value; } -} - public bool IsSetSegment () { - return this._segment != null; -} - public AWS.Cryptography.DbEncryptionSDK.DynamoDb.GetSegments Segments { - get { return this._segments; } - set { this._segments = value; } -} - public bool IsSetSegments () { - return this._segments != null; -} - public void Validate() { - var numberOfPropertiesSet = Convert.ToUInt16(IsSetUpper()) + - Convert.ToUInt16(IsSetLower()) + - Convert.ToUInt16(IsSetInsert()) + - Convert.ToUInt16(IsSetPrefix()) + - Convert.ToUInt16(IsSetSuffix()) + - Convert.ToUInt16(IsSetSubstring()) + - Convert.ToUInt16(IsSetSegment()) + - Convert.ToUInt16(IsSetSegments()) ; - if (numberOfPropertiesSet == 0) throw new System.ArgumentException("No union value set"); - - if (numberOfPropertiesSet > 1) throw new System.ArgumentException("Multiple union values set"); - -} -} -} From 0c638cbaae4ff536212188421b086d8198637e66 Mon Sep 17 00:00:00 2001 From: rishav-karanjit Date: Mon, 1 Apr 2024 14:47:17 -0700 Subject: [PATCH 35/67] Add --local-service-test option and did polymorph --- SharedMakefile.mk | 2 +- .../dynamodb/wrapped/TestDynamoDbEncryption.java | 14 ++++++++++++++ 2 files changed, 15 insertions(+), 1 deletion(-) diff --git a/SharedMakefile.mk b/SharedMakefile.mk index 326403179..a89be143c 100644 --- a/SharedMakefile.mk +++ b/SharedMakefile.mk @@ -231,7 +231,7 @@ _polymorph: $(patsubst %, --dependent-model $(PROJECT_ROOT)/%/Model, $($(service_deps_var))) \ --namespace $($(namespace_var)) \ $(AWS_SDK_CMD) \ - $(OUTPUT_LOCAL_SERVICE) \ + $(OUTPUT_LOCAL_SERVICE_$(SERVICE)) \ "; # Generates all target runtime code for all namespaces in this project. diff --git a/TestVectors/runtimes/java/src/main/smithy-generated/software/amazon/cryptography/dbencryptionsdk/dynamodb/wrapped/TestDynamoDbEncryption.java b/TestVectors/runtimes/java/src/main/smithy-generated/software/amazon/cryptography/dbencryptionsdk/dynamodb/wrapped/TestDynamoDbEncryption.java index 2abb50d9c..ee980cfc6 100644 --- a/TestVectors/runtimes/java/src/main/smithy-generated/software/amazon/cryptography/dbencryptionsdk/dynamodb/wrapped/TestDynamoDbEncryption.java +++ b/TestVectors/runtimes/java/src/main/smithy-generated/software/amazon/cryptography/dbencryptionsdk/dynamodb/wrapped/TestDynamoDbEncryption.java @@ -13,6 +13,8 @@ import software.amazon.cryptography.dbencryptionsdk.dynamodb.internaldafny.types.CreateDynamoDbEncryptionBranchKeyIdSupplierInput; import software.amazon.cryptography.dbencryptionsdk.dynamodb.internaldafny.types.CreateDynamoDbEncryptionBranchKeyIdSupplierOutput; import software.amazon.cryptography.dbencryptionsdk.dynamodb.internaldafny.types.Error; +import software.amazon.cryptography.dbencryptionsdk.dynamodb.internaldafny.types.GetEncryptedDataKeyDescriptionInput; +import software.amazon.cryptography.dbencryptionsdk.dynamodb.internaldafny.types.GetEncryptedDataKeyDescriptionOutput; import software.amazon.cryptography.dbencryptionsdk.dynamodb.internaldafny.types.IDynamoDbEncryptionClient; public class TestDynamoDbEncryption implements IDynamoDbEncryptionClient { @@ -38,6 +40,18 @@ public Result CreateDy } } + public Result GetEncryptedDataKeyDescription( + GetEncryptedDataKeyDescriptionInput dafnyInput) { + software.amazon.cryptography.dbencryptionsdk.dynamodb.model.GetEncryptedDataKeyDescriptionInput nativeInput = ToNative.GetEncryptedDataKeyDescriptionInput(dafnyInput); + try { + software.amazon.cryptography.dbencryptionsdk.dynamodb.model.GetEncryptedDataKeyDescriptionOutput nativeOutput = this._impl.GetEncryptedDataKeyDescription(nativeInput); + GetEncryptedDataKeyDescriptionOutput dafnyOutput = ToDafny.GetEncryptedDataKeyDescriptionOutput(nativeOutput); + return Result.create_Success(dafnyOutput); + } catch (RuntimeException ex) { + return Result.create_Failure(ToDafny.Error(ex)); + } + } + public interface Builder { Builder impl(DynamoDbEncryption impl); From 98849eec61f540ce17b07f6907e94823968e6907 Mon Sep 17 00:00:00 2001 From: rishav-karanjit Date: Mon, 1 Apr 2024 17:10:44 -0700 Subject: [PATCH 36/67] Refactor to remove extra blank line to make the code look better --- ...raphyDbEncryptionSdkDynamoDbOperations.dfy | 7 +- ...moDbGetEncryptedDataKeyDescriptionTest.dfy | 68 +------------------ 2 files changed, 4 insertions(+), 71 deletions(-) diff --git a/DynamoDbEncryption/dafny/DynamoDbEncryption/src/AwsCryptographyDbEncryptionSdkDynamoDbOperations.dfy b/DynamoDbEncryption/dafny/DynamoDbEncryption/src/AwsCryptographyDbEncryptionSdkDynamoDbOperations.dfy index 05186a71a..e508bc470 100644 --- a/DynamoDbEncryption/dafny/DynamoDbEncryption/src/AwsCryptographyDbEncryptionSdkDynamoDbOperations.dfy +++ b/DynamoDbEncryption/dafny/DynamoDbEncryption/src/AwsCryptographyDbEncryptionSdkDynamoDbOperations.dfy @@ -9,9 +9,8 @@ module AwsCryptographyDbEncryptionSdkDynamoDbOperations refines AbstractAwsCrypt import UUID import AlgorithmSuites import DynamoToStruct - import opened DynamoDbEncryptionUtil - import Header = StructuredEncryptionHeader + import opened DynamoDbEncryptionUtil predicate ValidInternalConfig?(config: InternalConfig) {true} @@ -91,7 +90,6 @@ module AwsCryptographyDbEncryptionSdkDynamoDbOperations refines AbstractAwsCrypt var extractedKeyProviderId := UTF8.Decode(datakeys[i].keyProviderId).Extract(); var extractedKeyProviderIdInfo := UTF8.Decode(datakeys[i].keyProviderInfo).Extract(); - if |extractedKeyProviderId| < 7 || extractedKeyProviderId[0..7] != "aws-kms" { singleDataKeyOutput := EncryptedDataKeyDescriptionOutput( keyProviderId := extractedKeyProviderId, @@ -111,14 +109,11 @@ module AwsCryptographyDbEncryptionSdkDynamoDbOperations refines AbstractAwsCrypt var EDK_CIPHERTEXT_BRANCH_KEY_VERSION_INDEX := 12 + 16; var EDK_CIPHERTEXT_VERSION_INDEX := EDK_CIPHERTEXT_BRANCH_KEY_VERSION_INDEX + 16; - :- Need(EDK_CIPHERTEXT_BRANCH_KEY_VERSION_INDEX < EDK_CIPHERTEXT_VERSION_INDEX, E("Wrong branch key version index.")); :- Need(|providerWrappedMaterial| >= EDK_CIPHERTEXT_VERSION_INDEX, E("Incorrect ciphertext structure length.")); var branchKeyVersionUuid := providerWrappedMaterial[EDK_CIPHERTEXT_BRANCH_KEY_VERSION_INDEX .. EDK_CIPHERTEXT_VERSION_INDEX]; - :- Need(UUID.FromByteArray(branchKeyVersionUuid).Success?, E("Failed to convert UUID from byte array.")); var expectedBranchKeyVersion := UUID.FromByteArray(branchKeyVersionUuid).Extract(); - singleDataKeyOutput := EncryptedDataKeyDescriptionOutput( keyProviderId := extractedKeyProviderId, keyProviderInfo := Some(extractedKeyProviderIdInfo), diff --git a/DynamoDbEncryption/dafny/DynamoDbEncryption/test/DynamoDbGetEncryptedDataKeyDescriptionTest.dfy b/DynamoDbEncryption/dafny/DynamoDbEncryption/test/DynamoDbGetEncryptedDataKeyDescriptionTest.dfy index d237b6d0a..a9e8c456c 100644 --- a/DynamoDbEncryption/dafny/DynamoDbEncryption/test/DynamoDbGetEncryptedDataKeyDescriptionTest.dfy +++ b/DynamoDbEncryption/dafny/DynamoDbEncryption/test/DynamoDbGetEncryptedDataKeyDescriptionTest.dfy @@ -14,21 +14,16 @@ module DynamoDbGetEncryptedDataKeyDescriptionTest { import EdkWrapping import AlgorithmSuites + // THIS IS A TESTING RESOURCE DO NOT USE IN A PRODUCTION ENVIRONMENT const testVersion : Version := 1 - const testFlavor : Flavor := 1 - const testMsgID : MessageID := [1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32] - const testLegend : Legend := [0x65, 0x73] - const testEncContext : CMPEncryptionContext := map[EncodeAscii("abc") := EncodeAscii("def")] - const testAwsKmsDataKey := CMP.EncryptedDataKey( keyProviderId := EncodeAscii("aws-kms") , keyProviderInfo := EncodeAscii("keyproviderInfo"), ciphertext := [1, 2, 3, 4, 5]) - const testAwsKmsHDataKey := CMP.EncryptedDataKey( keyProviderId := EncodeAscii("aws-kms-hierarchy") , keyProviderInfo := EncodeAscii("keyproviderInfo"), @@ -43,19 +38,16 @@ module DynamoDbGetEncryptedDataKeyDescriptionTest { 107, 5, 120, 20, 95, 78, 70, 2, 49, 84, 39, 50, 40, 40, 115, 114, 76, 18, 103, 84, 34, 123, 1, 125, 61, 33, 13, 18, 81, 24, 53, 53, 26, 60, 52, 85, 81, 96, 85, 72]) - const testRawRsaDataKey := CMP.EncryptedDataKey( keyProviderId := EncodeAscii("raw-rsa") , keyProviderInfo := [1, 2, 3, 4, 5], ciphertext := [6, 7, 8, 9]) - const testAwsKmsRsaDataKey := CMP.EncryptedDataKey( keyProviderId := EncodeAscii("aws-kms-rsa") , keyProviderInfo := EncodeAscii("keyproviderInfo"), ciphertext := [1, 2, 3, 4, 5]) - const algorithmSuite := AlgorithmSuites.DBE_ALG_AES_256_GCM_HKDF_SHA512_COMMIT_KEY_ECDSA_P384_SYMSIG_HMAC_SHA384 - + method CreatePartialHeader(version : Version, flavor : Flavor, msgID : MessageID, legend : Legend, encContext : CMPEncryptionContext, dataKeyList : CMPEncryptedDataKeyList) returns (result: PartialHeader) ensures result.version == version @@ -79,24 +71,19 @@ module DynamoDbGetEncryptedDataKeyDescriptionTest { { var expectedHead := CreatePartialHeader(testVersion, testFlavor, testMsgID, testLegend, testEncContext, [testAwsKmsDataKey]); var serializedHeader := expectedHead.serialize() + expectedHead.msgID; - var ddbEncResources :- expect DynamoDbEncryption.DynamoDbEncryption(); - var inputVariable: Types.GetEncryptedDataKeyDescriptionInput := Types.GetEncryptedDataKeyDescriptionInput( input := Types.header(header := serializedHeader) ); - var actualDataKeyDescription := ddbEncResources.GetEncryptedDataKeyDescription(inputVariable); expect UTF8.Decode(expectedHead.dataKeys[0].keyProviderId).Success?; expect UTF8.Decode(expectedHead.dataKeys[0].keyProviderInfo).Success?; expect actualDataKeyDescription.Success?; expect |actualDataKeyDescription.Extract().EncryptedDataKeyDescriptionOutput| > 0; - expect |actualDataKeyDescription.Extract().EncryptedDataKeyDescriptionOutput| == |expectedHead.dataKeys|; expect actualDataKeyDescription.Extract().EncryptedDataKeyDescriptionOutput[0].keyProviderId == UTF8.Decode(expectedHead.dataKeys[0].keyProviderId).Extract(); - expect actualDataKeyDescription.Extract().EncryptedDataKeyDescriptionOutput[0].keyProviderInfo.Some?; expect actualDataKeyDescription.Extract().EncryptedDataKeyDescriptionOutput[0].keyProviderInfo.Extract() == UTF8.Decode(expectedHead.dataKeys[0].keyProviderInfo).Extract(); } @@ -105,25 +92,20 @@ module DynamoDbGetEncryptedDataKeyDescriptionTest { { var expectedHead := CreatePartialHeader(testVersion, testFlavor, testMsgID, testLegend, testEncContext, [testAwsKmsHDataKey]); var serializedHeader := expectedHead.serialize() + expectedHead.msgID; - var expectedBranchKeyVersion := getBranchKeyVersion(expectedHead); var ddbEncResources :- expect DynamoDbEncryption.DynamoDbEncryption(); - var inputVariable: Types.GetEncryptedDataKeyDescriptionInput := Types.GetEncryptedDataKeyDescriptionInput( input := Types.header(header := serializedHeader) ); - var actualDataKeyDescription := ddbEncResources.GetEncryptedDataKeyDescription(inputVariable); expect UTF8.Decode(expectedHead.dataKeys[0].keyProviderId).Success?; expect UTF8.Decode(expectedHead.dataKeys[0].keyProviderInfo).Success?; expect actualDataKeyDescription.Success?; expect |actualDataKeyDescription.Extract().EncryptedDataKeyDescriptionOutput| > 0; - expect |actualDataKeyDescription.Extract().EncryptedDataKeyDescriptionOutput| == |expectedHead.dataKeys|; expect actualDataKeyDescription.Extract().EncryptedDataKeyDescriptionOutput[0].keyProviderId == UTF8.Decode(expectedHead.dataKeys[0].keyProviderId).Extract(); - expect actualDataKeyDescription.Extract().EncryptedDataKeyDescriptionOutput[0].keyProviderInfo.Some?; expect actualDataKeyDescription.Extract().EncryptedDataKeyDescriptionOutput[0].keyProviderInfo.Extract() == UTF8.Decode(expectedHead.dataKeys[0].keyProviderInfo).Extract(); @@ -140,24 +122,19 @@ module DynamoDbGetEncryptedDataKeyDescriptionTest { { var expectedHead := CreatePartialHeader(testVersion, testFlavor, testMsgID, testLegend, testEncContext, [testRawRsaDataKey]); var serializedHeader := expectedHead.serialize() + expectedHead.msgID; - var ddbEncResources :- expect DynamoDbEncryption.DynamoDbEncryption(); - var inputVariable: Types.GetEncryptedDataKeyDescriptionInput := Types.GetEncryptedDataKeyDescriptionInput( input := Types.header(header := serializedHeader) ); - var actualDataKeyDescription := ddbEncResources.GetEncryptedDataKeyDescription(inputVariable); expect UTF8.Decode(expectedHead.dataKeys[0].keyProviderId).Success?; expect UTF8.Decode(expectedHead.dataKeys[0].keyProviderInfo).Success?; expect actualDataKeyDescription.Success?; expect |actualDataKeyDescription.Extract().EncryptedDataKeyDescriptionOutput| > 0; - expect |actualDataKeyDescription.Extract().EncryptedDataKeyDescriptionOutput| == |expectedHead.dataKeys|; expect actualDataKeyDescription.Extract().EncryptedDataKeyDescriptionOutput[0].keyProviderId == UTF8.Decode(expectedHead.dataKeys[0].keyProviderId).Extract(); - expect actualDataKeyDescription.Extract().EncryptedDataKeyDescriptionOutput[0].keyProviderInfo.Some?; expect actualDataKeyDescription.Extract().EncryptedDataKeyDescriptionOutput[0].keyProviderInfo.Extract() == UTF8.Decode(expectedHead.dataKeys[0].keyProviderInfo).Extract(); } @@ -166,24 +143,19 @@ module DynamoDbGetEncryptedDataKeyDescriptionTest { { var expectedHead := CreatePartialHeader(testVersion, testFlavor, testMsgID, testLegend, testEncContext, [testAwsKmsRsaDataKey]); var serializedHeader := expectedHead.serialize() + expectedHead.msgID; - var ddbEncResources :- expect DynamoDbEncryption.DynamoDbEncryption(); - var inputVariable: Types.GetEncryptedDataKeyDescriptionInput := Types.GetEncryptedDataKeyDescriptionInput( input := Types.header(header := serializedHeader) ); - var actualDataKeyDescription := ddbEncResources.GetEncryptedDataKeyDescription(inputVariable); expect UTF8.Decode(expectedHead.dataKeys[0].keyProviderId).Success?; expect UTF8.Decode(expectedHead.dataKeys[0].keyProviderInfo).Success?; expect actualDataKeyDescription.Success?; expect |actualDataKeyDescription.Extract().EncryptedDataKeyDescriptionOutput| > 0; - expect |actualDataKeyDescription.Extract().EncryptedDataKeyDescriptionOutput| == |expectedHead.dataKeys|; expect actualDataKeyDescription.Extract().EncryptedDataKeyDescriptionOutput[0].keyProviderId == UTF8.Decode(expectedHead.dataKeys[0].keyProviderId).Extract(); - expect actualDataKeyDescription.Extract().EncryptedDataKeyDescriptionOutput[0].keyProviderInfo.Some?; expect actualDataKeyDescription.Extract().EncryptedDataKeyDescriptionOutput[0].keyProviderInfo.Extract() == UTF8.Decode(expectedHead.dataKeys[0].keyProviderInfo).Extract(); } @@ -193,7 +165,6 @@ module DynamoDbGetEncryptedDataKeyDescriptionTest { { var expectedHead := CreatePartialHeader(testVersion, testFlavor, testMsgID, testLegend, testEncContext, [testAwsKmsDataKey]); var serializedHeader := expectedHead.serialize() + expectedHead.msgID; - var attr := map["aws_dbe_head" := ComAmazonawsDynamodbTypes.AttributeValue.B(serializedHeader)]; var ddbEncResources :- expect DynamoDbEncryption.DynamoDbEncryption(); @@ -203,15 +174,12 @@ module DynamoDbGetEncryptedDataKeyDescriptionTest { ); var actualDataKeyDescription := ddbEncResources.GetEncryptedDataKeyDescription(inputVariable); - expect UTF8.Decode(expectedHead.dataKeys[0].keyProviderId).Success?; expect UTF8.Decode(expectedHead.dataKeys[0].keyProviderInfo).Success?; expect actualDataKeyDescription.Success?; expect |actualDataKeyDescription.Extract().EncryptedDataKeyDescriptionOutput| > 0; - expect |actualDataKeyDescription.Extract().EncryptedDataKeyDescriptionOutput| == |expectedHead.dataKeys|; expect actualDataKeyDescription.Extract().EncryptedDataKeyDescriptionOutput[0].keyProviderId == UTF8.Decode(expectedHead.dataKeys[0].keyProviderId).Extract(); - expect actualDataKeyDescription.Extract().EncryptedDataKeyDescriptionOutput[0].keyProviderInfo.Some?; expect actualDataKeyDescription.Extract().EncryptedDataKeyDescriptionOutput[0].keyProviderInfo.Extract() == UTF8.Decode(expectedHead.dataKeys[0].keyProviderInfo).Extract(); } @@ -220,33 +188,27 @@ module DynamoDbGetEncryptedDataKeyDescriptionTest { { var expectedHead := CreatePartialHeader(testVersion, testFlavor, testMsgID, testLegend, testEncContext, [testAwsKmsHDataKey]); var serializedHeader := expectedHead.serialize() + expectedHead.msgID; - var expectedBranchKeyVersion := getBranchKeyVersion(expectedHead); var attr := map["aws_dbe_head" := ComAmazonawsDynamodbTypes.AttributeValue.B(serializedHeader)]; var ddbEncResources :- expect DynamoDbEncryption.DynamoDbEncryption(); - var inputVariable: Types.GetEncryptedDataKeyDescriptionInput := Types.GetEncryptedDataKeyDescriptionInput( input := Types.plaintextItem(plaintextItem := attr) ); - var actualDataKeyDescription := ddbEncResources.GetEncryptedDataKeyDescription(inputVariable); expect UTF8.Decode(expectedHead.dataKeys[0].keyProviderId).Success?; expect UTF8.Decode(expectedHead.dataKeys[0].keyProviderInfo).Success?; expect actualDataKeyDescription.Success?; expect |actualDataKeyDescription.Extract().EncryptedDataKeyDescriptionOutput| > 0; - expect |actualDataKeyDescription.Extract().EncryptedDataKeyDescriptionOutput| == |expectedHead.dataKeys|; expect actualDataKeyDescription.Extract().EncryptedDataKeyDescriptionOutput[0].keyProviderId == UTF8.Decode(expectedHead.dataKeys[0].keyProviderId).Extract(); - expect actualDataKeyDescription.Extract().EncryptedDataKeyDescriptionOutput[0].keyProviderInfo.Some?; expect actualDataKeyDescription.Extract().EncryptedDataKeyDescriptionOutput[0].keyProviderInfo.Extract() == UTF8.Decode(expectedHead.dataKeys[0].keyProviderInfo).Extract(); if actualDataKeyDescription.Extract().EncryptedDataKeyDescriptionOutput[0].keyProviderId == "aws-kms-hierarchy" { expect actualDataKeyDescription.Extract().EncryptedDataKeyDescriptionOutput[0].branchKeyId.Some?; expect actualDataKeyDescription.Extract().EncryptedDataKeyDescriptionOutput[0].branchKeyVersion.Some?; - expect actualDataKeyDescription.Extract().EncryptedDataKeyDescriptionOutput[0].branchKeyId.Extract() == UTF8.Decode(expectedHead.dataKeys[0].keyProviderInfo).Extract(); expect actualDataKeyDescription.Extract().EncryptedDataKeyDescriptionOutput[0].branchKeyVersion.Extract() == expectedBranchKeyVersion; } @@ -256,26 +218,20 @@ module DynamoDbGetEncryptedDataKeyDescriptionTest { { var expectedHead := CreatePartialHeader(testVersion, testFlavor, testMsgID, testLegend, testEncContext, [testRawRsaDataKey]); var serializedHeader := expectedHead.serialize() + expectedHead.msgID; - var attr := map["aws_dbe_head" := ComAmazonawsDynamodbTypes.AttributeValue.B(serializedHeader)]; var ddbEncResources :- expect DynamoDbEncryption.DynamoDbEncryption(); - - var inputVariable: Types.GetEncryptedDataKeyDescriptionInput := Types.GetEncryptedDataKeyDescriptionInput( input := Types.plaintextItem(plaintextItem := attr) - ); - + ); var actualDataKeyDescription := ddbEncResources.GetEncryptedDataKeyDescription(inputVariable); expect UTF8.Decode(expectedHead.dataKeys[0].keyProviderId).Success?; expect UTF8.Decode(expectedHead.dataKeys[0].keyProviderInfo).Success?; expect actualDataKeyDescription.Success?; expect |actualDataKeyDescription.Extract().EncryptedDataKeyDescriptionOutput| > 0; - expect |actualDataKeyDescription.Extract().EncryptedDataKeyDescriptionOutput| == |expectedHead.dataKeys|; expect actualDataKeyDescription.Extract().EncryptedDataKeyDescriptionOutput[0].keyProviderId == UTF8.Decode(expectedHead.dataKeys[0].keyProviderId).Extract(); - expect actualDataKeyDescription.Extract().EncryptedDataKeyDescriptionOutput[0].keyProviderInfo.Some?; expect actualDataKeyDescription.Extract().EncryptedDataKeyDescriptionOutput[0].keyProviderInfo.Extract() == UTF8.Decode(expectedHead.dataKeys[0].keyProviderInfo).Extract(); } @@ -284,26 +240,20 @@ module DynamoDbGetEncryptedDataKeyDescriptionTest { { var expectedHead := CreatePartialHeader(testVersion, testFlavor, testMsgID, testLegend, testEncContext, [testAwsKmsRsaDataKey]); var serializedHeader := expectedHead.serialize() + expectedHead.msgID; - var attr := map["aws_dbe_head" := ComAmazonawsDynamodbTypes.AttributeValue.B(serializedHeader)]; var ddbEncResources :- expect DynamoDbEncryption.DynamoDbEncryption(); - - var inputVariable: Types.GetEncryptedDataKeyDescriptionInput := Types.GetEncryptedDataKeyDescriptionInput( input := Types.plaintextItem(plaintextItem := attr) ); - var actualDataKeyDescription := ddbEncResources.GetEncryptedDataKeyDescription(inputVariable); expect UTF8.Decode(expectedHead.dataKeys[0].keyProviderId).Success?; expect UTF8.Decode(expectedHead.dataKeys[0].keyProviderInfo).Success?; expect actualDataKeyDescription.Success?; expect |actualDataKeyDescription.Extract().EncryptedDataKeyDescriptionOutput| > 0; - expect |actualDataKeyDescription.Extract().EncryptedDataKeyDescriptionOutput| == |expectedHead.dataKeys|; expect actualDataKeyDescription.Extract().EncryptedDataKeyDescriptionOutput[0].keyProviderId == UTF8.Decode(expectedHead.dataKeys[0].keyProviderId).Extract(); - expect actualDataKeyDescription.Extract().EncryptedDataKeyDescriptionOutput[0].keyProviderInfo.Some?; expect actualDataKeyDescription.Extract().EncryptedDataKeyDescriptionOutput[0].keyProviderInfo.Extract() == UTF8.Decode(expectedHead.dataKeys[0].keyProviderInfo).Extract(); } @@ -312,14 +262,11 @@ module DynamoDbGetEncryptedDataKeyDescriptionTest { { var expectedHead := CreatePartialHeader(testVersion, testFlavor, testMsgID, testLegend, testEncContext, [testAwsKmsDataKey, testAwsKmsRsaDataKey]); var serializedHeader := expectedHead.serialize() + expectedHead.msgID; - var ddbEncResources :- expect DynamoDbEncryption.DynamoDbEncryption(); - var inputVariable: Types.GetEncryptedDataKeyDescriptionInput := Types.GetEncryptedDataKeyDescriptionInput( input := Types.header(header := serializedHeader) ); - var actualDataKeyDescription := ddbEncResources.GetEncryptedDataKeyDescription(inputVariable); expect actualDataKeyDescription.Success?; @@ -343,18 +290,13 @@ module DynamoDbGetEncryptedDataKeyDescriptionTest { { var expectedHead := CreatePartialHeader(testVersion, testFlavor, testMsgID, testLegend, testEncContext, [testAwsKmsDataKey, testAwsKmsRsaDataKey]); var serializedHeader := expectedHead.serialize() + expectedHead.msgID; - var attr := map["aws_dbe_head" := ComAmazonawsDynamodbTypes.AttributeValue.B(serializedHeader)]; var ddbEncResources :- expect DynamoDbEncryption.DynamoDbEncryption(); - - var inputVariable: Types.GetEncryptedDataKeyDescriptionInput := Types.GetEncryptedDataKeyDescriptionInput( input := Types.plaintextItem(plaintextItem := attr) ); - var actualDataKeyDescription := ddbEncResources.GetEncryptedDataKeyDescription(inputVariable); - expect actualDataKeyDescription.Success?; expect |actualDataKeyDescription.Extract().EncryptedDataKeyDescriptionOutput| == |expectedHead.dataKeys|; expect |actualDataKeyDescription.Extract().EncryptedDataKeyDescriptionOutput| > 0; @@ -377,13 +319,9 @@ module DynamoDbGetEncryptedDataKeyDescriptionTest { { expect EdkWrapping.GetProviderWrappedMaterial(expectedHead.dataKeys[0].ciphertext, algorithmSuite).Success?; var providerWrappedMaterial := EdkWrapping.GetProviderWrappedMaterial(expectedHead.dataKeys[0].ciphertext, algorithmSuite).Extract(); - expect |providerWrappedMaterial| >= (28 + 16); - var expectedBranchKeyVersionResult := UUID.FromByteArray(providerWrappedMaterial[28 .. (28 + 16)]); - expect expectedBranchKeyVersionResult.Success?; - expectedBranchKeyVersion := expectedBranchKeyVersionResult.Extract(); } } From 7c17ef5287c7bafced4d3ba7bac9ba6e6a9a1d7c Mon Sep 17 00:00:00 2001 From: rishav-karanjit Date: Tue, 2 Apr 2024 09:55:07 -0700 Subject: [PATCH 37/67] Format dafny code --- .../test/DynamoDbGetEncryptedDataKeyDescriptionTest.dfy | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/DynamoDbEncryption/dafny/DynamoDbEncryption/test/DynamoDbGetEncryptedDataKeyDescriptionTest.dfy b/DynamoDbEncryption/dafny/DynamoDbEncryption/test/DynamoDbGetEncryptedDataKeyDescriptionTest.dfy index a9e8c456c..e9d532f9c 100644 --- a/DynamoDbEncryption/dafny/DynamoDbEncryption/test/DynamoDbGetEncryptedDataKeyDescriptionTest.dfy +++ b/DynamoDbEncryption/dafny/DynamoDbEncryption/test/DynamoDbGetEncryptedDataKeyDescriptionTest.dfy @@ -47,7 +47,7 @@ module DynamoDbGetEncryptedDataKeyDescriptionTest { keyProviderInfo := EncodeAscii("keyproviderInfo"), ciphertext := [1, 2, 3, 4, 5]) const algorithmSuite := AlgorithmSuites.DBE_ALG_AES_256_GCM_HKDF_SHA512_COMMIT_KEY_ECDSA_P384_SYMSIG_HMAC_SHA384 - + method CreatePartialHeader(version : Version, flavor : Flavor, msgID : MessageID, legend : Legend, encContext : CMPEncryptionContext, dataKeyList : CMPEncryptedDataKeyList) returns (result: PartialHeader) ensures result.version == version @@ -223,7 +223,7 @@ module DynamoDbGetEncryptedDataKeyDescriptionTest { var inputVariable: Types.GetEncryptedDataKeyDescriptionInput := Types.GetEncryptedDataKeyDescriptionInput( input := Types.plaintextItem(plaintextItem := attr) - ); + ); var actualDataKeyDescription := ddbEncResources.GetEncryptedDataKeyDescription(inputVariable); expect UTF8.Decode(expectedHead.dataKeys[0].keyProviderId).Success?; From 75ac9a442393799bda14c517114b7820ca62123b Mon Sep 17 00:00:00 2001 From: rishav-karanjit Date: Tue, 2 Apr 2024 11:36:57 -0700 Subject: [PATCH 38/67] Refactor code and add comments --- ...raphyDbEncryptionSdkDynamoDbOperations.dfy | 28 ++++++++++--------- 1 file changed, 15 insertions(+), 13 deletions(-) diff --git a/DynamoDbEncryption/dafny/DynamoDbEncryption/src/AwsCryptographyDbEncryptionSdkDynamoDbOperations.dfy b/DynamoDbEncryption/dafny/DynamoDbEncryption/src/AwsCryptographyDbEncryptionSdkDynamoDbOperations.dfy index e508bc470..3eb3c67cf 100644 --- a/DynamoDbEncryption/dafny/DynamoDbEncryption/src/AwsCryptographyDbEncryptionSdkDynamoDbOperations.dfy +++ b/DynamoDbEncryption/dafny/DynamoDbEncryption/src/AwsCryptographyDbEncryptionSdkDynamoDbOperations.dfy @@ -72,24 +72,14 @@ module AwsCryptographyDbEncryptionSdkDynamoDbOperations refines AbstractAwsCrypt } :- Need(Header.PartialDeserialize(header).Success?, E("Failed to deserialize header.")); var deserializedHeader := Header.PartialDeserialize(header); - var algorithmSuite; - - if deserializedHeader.Extract().flavor == 0{ - algorithmSuite := AlgorithmSuites.DBE_ALG_AES_256_GCM_HKDF_SHA512_COMMIT_KEY_SYMSIG_HMAC_SHA384; - } else { - algorithmSuite := AlgorithmSuites.DBE_ALG_AES_256_GCM_HKDF_SHA512_COMMIT_KEY_ECDSA_P384_SYMSIG_HMAC_SHA384; - } - var datakeys := deserializedHeader.Extract().dataKeys; var list : EncryptedDataKeyDescriptionList := []; for i := 0 to |datakeys| { var singleDataKeyOutput : EncryptedDataKeyDescriptionOutput; :- Need(UTF8.Decode(datakeys[i].keyProviderId).Success?, E("Failed to extract keyProviderId.")); - :- Need(UTF8.Decode(datakeys[i].keyProviderInfo).Success?, E("Failed to extract keyProviderInfo.")); - var extractedKeyProviderId := UTF8.Decode(datakeys[i].keyProviderId).Extract(); - var extractedKeyProviderIdInfo := UTF8.Decode(datakeys[i].keyProviderInfo).Extract(); + if |extractedKeyProviderId| < 7 || extractedKeyProviderId[0..7] != "aws-kms" { singleDataKeyOutput := EncryptedDataKeyDescriptionOutput( keyProviderId := extractedKeyProviderId, @@ -98,15 +88,27 @@ module AwsCryptographyDbEncryptionSdkDynamoDbOperations refines AbstractAwsCrypt branchKeyVersion := None ); } + + // Format flavor is either 0 or 1 + // https://github.com/aws/aws-database-encryption-sdk-dynamodb/blob/main/specification/structured-encryption/header.md#format-flavor + :- Need(deserializedHeader.Extract().flavor == 0 || deserializedHeader.Extract().flavor == 1, E("Invalid format flavor.")); + var algorithmSuite; + if deserializedHeader.Extract().flavor == 0{ + algorithmSuite := AlgorithmSuites.DBE_ALG_AES_256_GCM_HKDF_SHA512_COMMIT_KEY_SYMSIG_HMAC_SHA384; + } else { + algorithmSuite := AlgorithmSuites.DBE_ALG_AES_256_GCM_HKDF_SHA512_COMMIT_KEY_ECDSA_P384_SYMSIG_HMAC_SHA384; + } + + :- Need(UTF8.Decode(datakeys[i].keyProviderInfo).Success?, E("Failed to extract keyProviderInfo.")); + var extractedKeyProviderIdInfo := UTF8.Decode(datakeys[i].keyProviderInfo).Extract(); + if extractedKeyProviderId == "aws-kms-hierarchy" { :- Need(EdkWrapping.GetProviderWrappedMaterial(datakeys[i].ciphertext, algorithmSuite).Success?, E("Failed to get provider wrapped material.")); - var providerWrappedMaterial := EdkWrapping.GetProviderWrappedMaterial(datakeys[i].ciphertext, algorithmSuite).Extract(); // The ciphertext structure in the hierarchy keyring contains Salt and IV before Version. // The length of Salt is 16 and IV is 12 bytes. The length of Version is 16 bytes. // https://github.com/awslabs/aws-encryption-sdk-specification/blob/master/framework/aws-kms/aws-kms-hierarchical-keyring.md#ciphertext - var EDK_CIPHERTEXT_BRANCH_KEY_VERSION_INDEX := 12 + 16; var EDK_CIPHERTEXT_VERSION_INDEX := EDK_CIPHERTEXT_BRANCH_KEY_VERSION_INDEX + 16; :- Need(EDK_CIPHERTEXT_BRANCH_KEY_VERSION_INDEX < EDK_CIPHERTEXT_VERSION_INDEX, E("Wrong branch key version index.")); From d73839ac10b15a42833fa7a5bfb80961a7b54687 Mon Sep 17 00:00:00 2001 From: rishav-karanjit Date: Tue, 2 Apr 2024 14:14:17 -0700 Subject: [PATCH 39/67] Add comments to example --- ...GetEncryptedDataKeyDescriptionExample.java | 44 +++++++++---------- .../GetEncryptedDataKeyDescriptionExample.cs | 15 +++++-- 2 files changed, 31 insertions(+), 28 deletions(-) diff --git a/Examples/runtimes/java/DynamoDbEncryption/src/main/java/software/amazon/cryptography/examples/GetEncryptedDataKeyDescriptionExample.java b/Examples/runtimes/java/DynamoDbEncryption/src/main/java/software/amazon/cryptography/examples/GetEncryptedDataKeyDescriptionExample.java index 1d6cb04f7..8654451c9 100644 --- a/Examples/runtimes/java/DynamoDbEncryption/src/main/java/software/amazon/cryptography/examples/GetEncryptedDataKeyDescriptionExample.java +++ b/Examples/runtimes/java/DynamoDbEncryption/src/main/java/software/amazon/cryptography/examples/GetEncryptedDataKeyDescriptionExample.java @@ -20,62 +20,58 @@ public static void getEncryptedDataKeyDescription( String tableName, String partitionKey, String partitionKeyVal, String sortKeyName, String sortKeyValue, String expectedKeyProviderId, String expectedKeyProviderInfo, String expectedBranchKeyId, String expectedBranchKeyVersion ) { - DynamoDbEncryption ddbEnc = DynamoDbEncryption.builder() - .DynamoDbEncryptionConfig(DynamoDbEncryptionConfig.builder().build()) - .build(); - - String header_column = "aws_dbe_head"; + // 1. Create a new AWS SDK DynamoDb client. This client will be used to get item from the DynamoDB table DynamoDbClient ddb = DynamoDbClient.builder() - .region(Region.US_WEST_2) - .build(); + .build(); + // 2. Get item from the DynamoDB table. This item will be used to Get Encrypted DataKey Description HashMap keyToGet = new HashMap<>(); keyToGet.put(partitionKey, AttributeValue.builder() .s(partitionKeyVal) .build()); - keyToGet.put(sortKeyName, AttributeValue.builder() .n(sortKeyValue) .build()); - - // ddbEnc.GetHeader(ddbEnc.GetHeaderInput.builder().build()); GetItemRequest request = GetItemRequest.builder() .tableName(tableName) .key(keyToGet) .build(); - Map returnedItem = ddb.getItem(request).item(); - if (returnedItem.isEmpty()) System.out.format("No item found with the key %s!\n", partitionKey); - ByteBuffer header = returnedItem.get(header_column).b().asByteBuffer(); - + // 3. Prepare the input for GetEncryptedDataKeyDescription method. + // This input can be a DynamoDB item or a header. For now, we are giving input as a DynamoDB item + // but users can also extract the header from the column "aws_dbe_head" in the DynamoDB table + // and use it for GetEncryptedDataKeyDescription method. + DynamoDbEncryption ddbEnc = DynamoDbEncryption.builder() + .DynamoDbEncryptionConfig(DynamoDbEncryptionConfig.builder().build()) + .build(); GetEncryptedDataKeyDescriptionUnion InputUnion = GetEncryptedDataKeyDescriptionUnion.builder() .plaintextItem(returnedItem) .build(); - - // GetEncryptedDataKeyDescriptionUnion InputUnion = GetEncryptedDataKeyDescriptionUnion.builder() - // .header(header) - // .build(); - - // Create input software.amazon.cryptography.dbencryptionsdk.dynamodb.model.GetEncryptedDataKeyDescriptionInput input = GetEncryptedDataKeyDescriptionInput.builder() .input(InputUnion) .build(); - - // Call GetHeader method GetEncryptedDataKeyDescriptionOutput output = ddbEnc.GetEncryptedDataKeyDescription(input); + + // In the following code, we are giving input as header instead of a complete DynamoDB item + // This code is provided solely to demo how the alternative approach works. So, it is commented. - assert output.EncryptedDataKeyDescriptionOutput().get(0).keyProviderId().equals(expectedKeyProviderId); + // String header_column = "aws_dbe_head"; + // ByteBuffer header = returnedItem.get(header_column).b().asByteBuffer(); + // GetEncryptedDataKeyDescriptionUnion InputUnion = GetEncryptedDataKeyDescriptionUnion.builder() + // .header(header) + // .build(); + // Assert everything + assert output.EncryptedDataKeyDescriptionOutput().get(0).keyProviderId().equals(expectedKeyProviderId); if(expectedKeyProviderId.startsWith("aws-kms")) { assert output.EncryptedDataKeyDescriptionOutput().get(0).keyProviderInfo().equals(expectedKeyProviderInfo); } else { assert output.EncryptedDataKeyDescriptionOutput().get(0).keyProviderInfo() == expectedKeyProviderInfo; } - if(output.EncryptedDataKeyDescriptionOutput().get(0).keyProviderId().equals("aws-kms-hierarchy")) { assert output.EncryptedDataKeyDescriptionOutput().get(0).branchKeyId().equals(expectedBranchKeyId); assert output.EncryptedDataKeyDescriptionOutput().get(0).branchKeyVersion().equals(expectedBranchKeyVersion); diff --git a/Examples/runtimes/net/src/GetEncryptedDataKeyDescriptionExample.cs b/Examples/runtimes/net/src/GetEncryptedDataKeyDescriptionExample.cs index 72700c336..378177387 100644 --- a/Examples/runtimes/net/src/GetEncryptedDataKeyDescriptionExample.cs +++ b/Examples/runtimes/net/src/GetEncryptedDataKeyDescriptionExample.cs @@ -14,7 +14,6 @@ public static async Task GetEncryptedDataKeyDescription() var kmsKeyId = TestUtils.TEST_KMS_KEY_ID; var ddbTableName = TestUtils.TEST_DDB_TABLE_NAME; var ddbEnc = new DynamoDbEncryption(new DynamoDbEncryptionConfig()); - string header_column = "aws_dbe_head"; // 1. Define keys that will be used to retrieve item from the DynamoDB table. var keyToGet = new Dictionary @@ -32,14 +31,22 @@ public static async Task GetEncryptedDataKeyDescription() }; GetItemResponse getResponse = await ddb.GetItemAsync(getRequest); - // Demonstrate that PutItem succeeded + // Demonstrate that GetItem succeeded Debug.Assert(getResponse.HttpStatusCode == HttpStatusCode.OK); // 3. Extract the item from the dynamoDB table and prepare input for the GetEncryptedDataKeyDescription method. - // Here, we are sending header as the input by getting it from "aws_dbe_head" attribute but you can send a complete DDB item as well. + // Here, we are sending dynamodb item but you can also input the header itself by extracting the header from + // "aws_dbe_head" attribute in the dynamoDB item. The part of the code where we send input as the header is commented. var returnedItem = getResponse.Item; GetEncryptedDataKeyDescriptionUnion InputUnion = new GetEncryptedDataKeyDescriptionUnion(); - InputUnion.Header = returnedItem[header_column].B; + InputUnion.PlaintextItem = returnedItem; + + // The code below shows how we can send header as the input to the DynamoDB. This code is written to demo the + // alternative approach. So, it is commented. + + // string header_column = "aws_dbe_head"; + // InputUnion.Header = returnedItem[header_column].B; + GetEncryptedDataKeyDescriptionInput Input = new GetEncryptedDataKeyDescriptionInput(); Input.Input = InputUnion; GetEncryptedDataKeyDescriptionOutput output = ddbEnc.GetEncryptedDataKeyDescription(Input); From f3e2e71f99b38cab3e83fdd0a0c8a5aa5e73b430 Mon Sep 17 00:00:00 2001 From: rishav-karanjit Date: Tue, 2 Apr 2024 15:21:01 -0700 Subject: [PATCH 40/67] Update version date --- .../dafny/DynamoDbEncryption/Model/DynamoDbEncryption.smithy | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/DynamoDbEncryption/dafny/DynamoDbEncryption/Model/DynamoDbEncryption.smithy b/DynamoDbEncryption/dafny/DynamoDbEncryption/Model/DynamoDbEncryption.smithy index 2872fbd95..4d2176fdb 100644 --- a/DynamoDbEncryption/dafny/DynamoDbEncryption/Model/DynamoDbEncryption.smithy +++ b/DynamoDbEncryption/dafny/DynamoDbEncryption/Model/DynamoDbEncryption.smithy @@ -43,7 +43,7 @@ use aws.cryptography.materialProviders#AwsCryptographicMaterialProviders ] ) service DynamoDbEncryption { - version: "2024-03-06", + version: "2024-04-02", operations: [ CreateDynamoDbEncryptionBranchKeyIdSupplier, GetEncryptedDataKeyDescription], errors: [ DynamoDbEncryptionException ] } From e95ab463466bf0f6dd138ef06a94a913235a80cc Mon Sep 17 00:00:00 2001 From: rishav-karanjit Date: Tue, 9 Apr 2024 23:05:35 -0700 Subject: [PATCH 41/67] Removed expect --- ...raphyDbEncryptionSdkDynamoDbOperations.dfy | 47 ++++++------------- 1 file changed, 14 insertions(+), 33 deletions(-) diff --git a/DynamoDbEncryption/dafny/DynamoDbEncryption/src/AwsCryptographyDbEncryptionSdkDynamoDbOperations.dfy b/DynamoDbEncryption/dafny/DynamoDbEncryption/src/AwsCryptographyDbEncryptionSdkDynamoDbOperations.dfy index 3eb3c67cf..64607fc70 100644 --- a/DynamoDbEncryption/dafny/DynamoDbEncryption/src/AwsCryptographyDbEncryptionSdkDynamoDbOperations.dfy +++ b/DynamoDbEncryption/dafny/DynamoDbEncryption/src/AwsCryptographyDbEncryptionSdkDynamoDbOperations.dfy @@ -45,19 +45,6 @@ module AwsCryptographyDbEncryptionSdkDynamoDbOperations refines AbstractAwsCrypt method GetEncryptedDataKeyDescription(config: InternalConfig, input: GetEncryptedDataKeyDescriptionInput) returns (output: Result) ensures GetEncryptedDataKeyDescriptionEnsuresPublicly(input, output) - ensures output.Success? ==> ( - match input.input { - case plaintextItem(item) => - DynamoToStruct.ItemToStructured(item).Success? - && var extracted := DynamoToStruct.ItemToStructured(item).Extract(); - && var keys := extracted.Keys; - && "aws_dbe_head" in DynamoToStruct.ItemToStructured(item).Extract() - && var header := DynamoToStruct.ItemToStructured(item).Extract()["aws_dbe_head"].content.Terminal.value; - && Header.PartialDeserialize(header).Success? - case header(header) => - Header.PartialDeserialize(header).Success? - } - ) { var header; match input.input @@ -67,20 +54,16 @@ module AwsCryptographyDbEncryptionSdkDynamoDbOperations refines AbstractAwsCrypt :- Need("aws_dbe_head" in DynamoToStruct.ItemToStructured(plaintextItem).Extract(), E("aws_dbe_head is not present in the attribute map.")); header := DynamoToStruct.ItemToStructured(plaintextItem).Extract()["aws_dbe_head"].content.Terminal.value; } - case header(headeritem) => - header := headeritem; + case header(headerItem) => + header := headerItem; } - :- Need(Header.PartialDeserialize(header).Success?, E("Failed to deserialize header.")); - var deserializedHeader := Header.PartialDeserialize(header); - var datakeys := deserializedHeader.Extract().dataKeys; + var deserializedHeader :- Header.PartialDeserialize(header).MapFailure(e => E("Failed to deserialize header.")); + var datakeys := deserializedHeader.dataKeys; var list : EncryptedDataKeyDescriptionList := []; for i := 0 to |datakeys| { var singleDataKeyOutput : EncryptedDataKeyDescriptionOutput; - - :- Need(UTF8.Decode(datakeys[i].keyProviderId).Success?, E("Failed to extract keyProviderId.")); - var extractedKeyProviderId := UTF8.Decode(datakeys[i].keyProviderId).Extract(); - - if |extractedKeyProviderId| < 7 || extractedKeyProviderId[0..7] != "aws-kms" { + var extractedKeyProviderId :- UTF8.Decode(datakeys[i].keyProviderId).MapFailure(e => E(e)); + if !("aws-kms" < extractedKeyProviderId) { singleDataKeyOutput := EncryptedDataKeyDescriptionOutput( keyProviderId := extractedKeyProviderId, keyProviderInfo := None, @@ -91,20 +74,19 @@ module AwsCryptographyDbEncryptionSdkDynamoDbOperations refines AbstractAwsCrypt // Format flavor is either 0 or 1 // https://github.com/aws/aws-database-encryption-sdk-dynamodb/blob/main/specification/structured-encryption/header.md#format-flavor - :- Need(deserializedHeader.Extract().flavor == 0 || deserializedHeader.Extract().flavor == 1, E("Invalid format flavor.")); + :- Need(deserializedHeader.flavor == 0 || deserializedHeader.flavor == 1, E("Invalid format flavor.")); var algorithmSuite; - if deserializedHeader.Extract().flavor == 0{ + if deserializedHeader.flavor == 0{ algorithmSuite := AlgorithmSuites.DBE_ALG_AES_256_GCM_HKDF_SHA512_COMMIT_KEY_SYMSIG_HMAC_SHA384; } else { algorithmSuite := AlgorithmSuites.DBE_ALG_AES_256_GCM_HKDF_SHA512_COMMIT_KEY_ECDSA_P384_SYMSIG_HMAC_SHA384; } :- Need(UTF8.Decode(datakeys[i].keyProviderInfo).Success?, E("Failed to extract keyProviderInfo.")); - var extractedKeyProviderIdInfo := UTF8.Decode(datakeys[i].keyProviderInfo).Extract(); + var extractedKeyProviderIdInfo := UTF8.Decode(datakeys[i].keyProviderInfo).MapFailure(e => E("Failed to deserialize header.")); if extractedKeyProviderId == "aws-kms-hierarchy" { - :- Need(EdkWrapping.GetProviderWrappedMaterial(datakeys[i].ciphertext, algorithmSuite).Success?, E("Failed to get provider wrapped material.")); - var providerWrappedMaterial := EdkWrapping.GetProviderWrappedMaterial(datakeys[i].ciphertext, algorithmSuite).Extract(); + var providerWrappedMaterial :- EdkWrapping.GetProviderWrappedMaterial(datakeys[i].ciphertext, algorithmSuite).MapFailure(e => E("Failed to get provider wrapped material" )); // The ciphertext structure in the hierarchy keyring contains Salt and IV before Version. // The length of Salt is 16 and IV is 12 bytes. The length of Version is 16 bytes. @@ -114,19 +96,18 @@ module AwsCryptographyDbEncryptionSdkDynamoDbOperations refines AbstractAwsCrypt :- Need(EDK_CIPHERTEXT_BRANCH_KEY_VERSION_INDEX < EDK_CIPHERTEXT_VERSION_INDEX, E("Wrong branch key version index.")); :- Need(|providerWrappedMaterial| >= EDK_CIPHERTEXT_VERSION_INDEX, E("Incorrect ciphertext structure length.")); var branchKeyVersionUuid := providerWrappedMaterial[EDK_CIPHERTEXT_BRANCH_KEY_VERSION_INDEX .. EDK_CIPHERTEXT_VERSION_INDEX]; - :- Need(UUID.FromByteArray(branchKeyVersionUuid).Success?, E("Failed to convert UUID from byte array.")); - var expectedBranchKeyVersion := UUID.FromByteArray(branchKeyVersionUuid).Extract(); + var expectedBranchKeyVersion :- UUID.FromByteArray(branchKeyVersionUuid).MapFailure(e => E("Failed to convert UUID from byte array.")); singleDataKeyOutput := EncryptedDataKeyDescriptionOutput( keyProviderId := extractedKeyProviderId, - keyProviderInfo := Some(extractedKeyProviderIdInfo), - branchKeyId := Some(extractedKeyProviderIdInfo), + keyProviderInfo := Some(extractedKeyProviderIdInfo.value), + branchKeyId := Some(extractedKeyProviderIdInfo.value), branchKeyVersion := Some(expectedBranchKeyVersion) ); } else { singleDataKeyOutput := EncryptedDataKeyDescriptionOutput( keyProviderId := extractedKeyProviderId, - keyProviderInfo := Some(extractedKeyProviderIdInfo), + keyProviderInfo := Some(extractedKeyProviderIdInfo.value), branchKeyId := None, branchKeyVersion := None ); From f804374ef85d5114858e5f4382bf6b02610486ac Mon Sep 17 00:00:00 2001 From: rishav-karanjit Date: Tue, 9 Apr 2024 23:06:16 -0700 Subject: [PATCH 42/67] Removed extract --- ...moDbGetEncryptedDataKeyDescriptionTest.dfy | 220 +++++++++--------- 1 file changed, 107 insertions(+), 113 deletions(-) diff --git a/DynamoDbEncryption/dafny/DynamoDbEncryption/test/DynamoDbGetEncryptedDataKeyDescriptionTest.dfy b/DynamoDbEncryption/dafny/DynamoDbEncryption/test/DynamoDbGetEncryptedDataKeyDescriptionTest.dfy index e9d532f9c..5a540a8ca 100644 --- a/DynamoDbEncryption/dafny/DynamoDbEncryption/test/DynamoDbGetEncryptedDataKeyDescriptionTest.dfy +++ b/DynamoDbEncryption/dafny/DynamoDbEncryption/test/DynamoDbGetEncryptedDataKeyDescriptionTest.dfy @@ -76,16 +76,15 @@ module DynamoDbGetEncryptedDataKeyDescriptionTest { Types.GetEncryptedDataKeyDescriptionInput( input := Types.header(header := serializedHeader) ); - var actualDataKeyDescription := ddbEncResources.GetEncryptedDataKeyDescription(inputVariable); - - expect UTF8.Decode(expectedHead.dataKeys[0].keyProviderId).Success?; - expect UTF8.Decode(expectedHead.dataKeys[0].keyProviderInfo).Success?; - expect actualDataKeyDescription.Success?; - expect |actualDataKeyDescription.Extract().EncryptedDataKeyDescriptionOutput| > 0; - expect |actualDataKeyDescription.Extract().EncryptedDataKeyDescriptionOutput| == |expectedHead.dataKeys|; - expect actualDataKeyDescription.Extract().EncryptedDataKeyDescriptionOutput[0].keyProviderId == UTF8.Decode(expectedHead.dataKeys[0].keyProviderId).Extract(); - expect actualDataKeyDescription.Extract().EncryptedDataKeyDescriptionOutput[0].keyProviderInfo.Some?; - expect actualDataKeyDescription.Extract().EncryptedDataKeyDescriptionOutput[0].keyProviderInfo.Extract() == UTF8.Decode(expectedHead.dataKeys[0].keyProviderInfo).Extract(); + var actualDataKeyDescription :- expect ddbEncResources.GetEncryptedDataKeyDescription(inputVariable); + var expectedkeyProviderId :- expect UTF8.Decode(expectedHead.dataKeys[0].keyProviderId); + var expectedkeyProviderInfo :- expect UTF8.Decode(expectedHead.dataKeys[0].keyProviderInfo); + + expect |actualDataKeyDescription.EncryptedDataKeyDescriptionOutput| > 0; + expect |actualDataKeyDescription.EncryptedDataKeyDescriptionOutput| == |expectedHead.dataKeys|; + expect actualDataKeyDescription.EncryptedDataKeyDescriptionOutput[0].keyProviderId == expectedkeyProviderId; + expect actualDataKeyDescription.EncryptedDataKeyDescriptionOutput[0].keyProviderInfo.Some?; + expect actualDataKeyDescription.EncryptedDataKeyDescriptionOutput[0].keyProviderInfo.value == expectedkeyProviderInfo; } method {:test} TestHeaderInputAwsKmsHDataKeyCase() @@ -98,23 +97,22 @@ module DynamoDbGetEncryptedDataKeyDescriptionTest { Types.GetEncryptedDataKeyDescriptionInput( input := Types.header(header := serializedHeader) ); - var actualDataKeyDescription := ddbEncResources.GetEncryptedDataKeyDescription(inputVariable); - - expect UTF8.Decode(expectedHead.dataKeys[0].keyProviderId).Success?; - expect UTF8.Decode(expectedHead.dataKeys[0].keyProviderInfo).Success?; - expect actualDataKeyDescription.Success?; - expect |actualDataKeyDescription.Extract().EncryptedDataKeyDescriptionOutput| > 0; - expect |actualDataKeyDescription.Extract().EncryptedDataKeyDescriptionOutput| == |expectedHead.dataKeys|; - expect actualDataKeyDescription.Extract().EncryptedDataKeyDescriptionOutput[0].keyProviderId == UTF8.Decode(expectedHead.dataKeys[0].keyProviderId).Extract(); - expect actualDataKeyDescription.Extract().EncryptedDataKeyDescriptionOutput[0].keyProviderInfo.Some?; - expect actualDataKeyDescription.Extract().EncryptedDataKeyDescriptionOutput[0].keyProviderInfo.Extract() == UTF8.Decode(expectedHead.dataKeys[0].keyProviderInfo).Extract(); - - if actualDataKeyDescription.Extract().EncryptedDataKeyDescriptionOutput[0].keyProviderId == "aws-kms-hierarchy" { - expect actualDataKeyDescription.Extract().EncryptedDataKeyDescriptionOutput[0].branchKeyId.Some?; - expect actualDataKeyDescription.Extract().EncryptedDataKeyDescriptionOutput[0].branchKeyVersion.Some?; - - expect actualDataKeyDescription.Extract().EncryptedDataKeyDescriptionOutput[0].branchKeyId.Extract() == UTF8.Decode(expectedHead.dataKeys[0].keyProviderInfo).Extract(); - expect actualDataKeyDescription.Extract().EncryptedDataKeyDescriptionOutput[0].branchKeyVersion.Extract() == expectedBranchKeyVersion; + var actualDataKeyDescription :- expect ddbEncResources.GetEncryptedDataKeyDescription(inputVariable); + var expectedkeyProviderId :- expect UTF8.Decode(expectedHead.dataKeys[0].keyProviderId); + var expectedkeyProviderInfo :- expect UTF8.Decode(expectedHead.dataKeys[0].keyProviderInfo); + + expect |actualDataKeyDescription.EncryptedDataKeyDescriptionOutput| > 0; + expect |actualDataKeyDescription.EncryptedDataKeyDescriptionOutput| == |expectedHead.dataKeys|; + expect actualDataKeyDescription.EncryptedDataKeyDescriptionOutput[0].keyProviderId == expectedkeyProviderId; + expect actualDataKeyDescription.EncryptedDataKeyDescriptionOutput[0].keyProviderInfo.Some?; + expect actualDataKeyDescription.EncryptedDataKeyDescriptionOutput[0].keyProviderInfo.value == expectedkeyProviderInfo; + + if actualDataKeyDescription.EncryptedDataKeyDescriptionOutput[0].keyProviderId == "aws-kms-hierarchy" { + expect actualDataKeyDescription.EncryptedDataKeyDescriptionOutput[0].branchKeyId.Some?; + expect actualDataKeyDescription.EncryptedDataKeyDescriptionOutput[0].branchKeyVersion.Some?; + + expect actualDataKeyDescription.EncryptedDataKeyDescriptionOutput[0].branchKeyId.value == expectedkeyProviderInfo; + expect actualDataKeyDescription.EncryptedDataKeyDescriptionOutput[0].branchKeyVersion.value == expectedBranchKeyVersion; } } @@ -127,16 +125,15 @@ module DynamoDbGetEncryptedDataKeyDescriptionTest { Types.GetEncryptedDataKeyDescriptionInput( input := Types.header(header := serializedHeader) ); - var actualDataKeyDescription := ddbEncResources.GetEncryptedDataKeyDescription(inputVariable); - - expect UTF8.Decode(expectedHead.dataKeys[0].keyProviderId).Success?; - expect UTF8.Decode(expectedHead.dataKeys[0].keyProviderInfo).Success?; - expect actualDataKeyDescription.Success?; - expect |actualDataKeyDescription.Extract().EncryptedDataKeyDescriptionOutput| > 0; - expect |actualDataKeyDescription.Extract().EncryptedDataKeyDescriptionOutput| == |expectedHead.dataKeys|; - expect actualDataKeyDescription.Extract().EncryptedDataKeyDescriptionOutput[0].keyProviderId == UTF8.Decode(expectedHead.dataKeys[0].keyProviderId).Extract(); - expect actualDataKeyDescription.Extract().EncryptedDataKeyDescriptionOutput[0].keyProviderInfo.Some?; - expect actualDataKeyDescription.Extract().EncryptedDataKeyDescriptionOutput[0].keyProviderInfo.Extract() == UTF8.Decode(expectedHead.dataKeys[0].keyProviderInfo).Extract(); + var actualDataKeyDescription :- expect ddbEncResources.GetEncryptedDataKeyDescription(inputVariable); + var expectedkeyProviderId :- expect UTF8.Decode(expectedHead.dataKeys[0].keyProviderId); + var expectedkeyProviderInfo :- expect UTF8.Decode(expectedHead.dataKeys[0].keyProviderInfo); + + expect |actualDataKeyDescription.EncryptedDataKeyDescriptionOutput| > 0; + expect |actualDataKeyDescription.EncryptedDataKeyDescriptionOutput| == |expectedHead.dataKeys|; + expect actualDataKeyDescription.EncryptedDataKeyDescriptionOutput[0].keyProviderId == expectedkeyProviderId; + expect actualDataKeyDescription.EncryptedDataKeyDescriptionOutput[0].keyProviderInfo.Some?; + expect actualDataKeyDescription.EncryptedDataKeyDescriptionOutput[0].keyProviderInfo.value == expectedkeyProviderInfo; } method {:test} TestHeaderInputAwsKmsRsaDataKeyCase() @@ -148,16 +145,15 @@ module DynamoDbGetEncryptedDataKeyDescriptionTest { Types.GetEncryptedDataKeyDescriptionInput( input := Types.header(header := serializedHeader) ); - var actualDataKeyDescription := ddbEncResources.GetEncryptedDataKeyDescription(inputVariable); - - expect UTF8.Decode(expectedHead.dataKeys[0].keyProviderId).Success?; - expect UTF8.Decode(expectedHead.dataKeys[0].keyProviderInfo).Success?; - expect actualDataKeyDescription.Success?; - expect |actualDataKeyDescription.Extract().EncryptedDataKeyDescriptionOutput| > 0; - expect |actualDataKeyDescription.Extract().EncryptedDataKeyDescriptionOutput| == |expectedHead.dataKeys|; - expect actualDataKeyDescription.Extract().EncryptedDataKeyDescriptionOutput[0].keyProviderId == UTF8.Decode(expectedHead.dataKeys[0].keyProviderId).Extract(); - expect actualDataKeyDescription.Extract().EncryptedDataKeyDescriptionOutput[0].keyProviderInfo.Some?; - expect actualDataKeyDescription.Extract().EncryptedDataKeyDescriptionOutput[0].keyProviderInfo.Extract() == UTF8.Decode(expectedHead.dataKeys[0].keyProviderInfo).Extract(); + var actualDataKeyDescription :- expect ddbEncResources.GetEncryptedDataKeyDescription(inputVariable); + var expectedkeyProviderId :- expect UTF8.Decode(expectedHead.dataKeys[0].keyProviderId); + var expectedkeyProviderInfo :- expect UTF8.Decode(expectedHead.dataKeys[0].keyProviderInfo); + + expect |actualDataKeyDescription.EncryptedDataKeyDescriptionOutput| > 0; + expect |actualDataKeyDescription.EncryptedDataKeyDescriptionOutput| == |expectedHead.dataKeys|; + expect actualDataKeyDescription.EncryptedDataKeyDescriptionOutput[0].keyProviderId == expectedkeyProviderId; + expect actualDataKeyDescription.EncryptedDataKeyDescriptionOutput[0].keyProviderInfo.Some?; + expect actualDataKeyDescription.EncryptedDataKeyDescriptionOutput[0].keyProviderInfo.value == expectedkeyProviderInfo; } @@ -173,15 +169,15 @@ module DynamoDbGetEncryptedDataKeyDescriptionTest { input := Types.plaintextItem(plaintextItem := attr) ); - var actualDataKeyDescription := ddbEncResources.GetEncryptedDataKeyDescription(inputVariable); - expect UTF8.Decode(expectedHead.dataKeys[0].keyProviderId).Success?; - expect UTF8.Decode(expectedHead.dataKeys[0].keyProviderInfo).Success?; - expect actualDataKeyDescription.Success?; - expect |actualDataKeyDescription.Extract().EncryptedDataKeyDescriptionOutput| > 0; - expect |actualDataKeyDescription.Extract().EncryptedDataKeyDescriptionOutput| == |expectedHead.dataKeys|; - expect actualDataKeyDescription.Extract().EncryptedDataKeyDescriptionOutput[0].keyProviderId == UTF8.Decode(expectedHead.dataKeys[0].keyProviderId).Extract(); - expect actualDataKeyDescription.Extract().EncryptedDataKeyDescriptionOutput[0].keyProviderInfo.Some?; - expect actualDataKeyDescription.Extract().EncryptedDataKeyDescriptionOutput[0].keyProviderInfo.Extract() == UTF8.Decode(expectedHead.dataKeys[0].keyProviderInfo).Extract(); + var actualDataKeyDescription :- expect ddbEncResources.GetEncryptedDataKeyDescription(inputVariable); + var expectedkeyProviderId :- expect UTF8.Decode(expectedHead.dataKeys[0].keyProviderId); + var expectedkeyProviderInfo :- expect UTF8.Decode(expectedHead.dataKeys[0].keyProviderInfo); + + expect |actualDataKeyDescription.EncryptedDataKeyDescriptionOutput| > 0; + expect |actualDataKeyDescription.EncryptedDataKeyDescriptionOutput| == |expectedHead.dataKeys|; + expect actualDataKeyDescription.EncryptedDataKeyDescriptionOutput[0].keyProviderId == expectedkeyProviderId; + expect actualDataKeyDescription.EncryptedDataKeyDescriptionOutput[0].keyProviderInfo.Some?; + expect actualDataKeyDescription.EncryptedDataKeyDescriptionOutput[0].keyProviderInfo.value == expectedkeyProviderInfo; } method {:test} TestDDBItemInputAwsKmsHDataKeyCase() @@ -195,22 +191,22 @@ module DynamoDbGetEncryptedDataKeyDescriptionTest { Types.GetEncryptedDataKeyDescriptionInput( input := Types.plaintextItem(plaintextItem := attr) ); - var actualDataKeyDescription := ddbEncResources.GetEncryptedDataKeyDescription(inputVariable); - - expect UTF8.Decode(expectedHead.dataKeys[0].keyProviderId).Success?; - expect UTF8.Decode(expectedHead.dataKeys[0].keyProviderInfo).Success?; - expect actualDataKeyDescription.Success?; - expect |actualDataKeyDescription.Extract().EncryptedDataKeyDescriptionOutput| > 0; - expect |actualDataKeyDescription.Extract().EncryptedDataKeyDescriptionOutput| == |expectedHead.dataKeys|; - expect actualDataKeyDescription.Extract().EncryptedDataKeyDescriptionOutput[0].keyProviderId == UTF8.Decode(expectedHead.dataKeys[0].keyProviderId).Extract(); - expect actualDataKeyDescription.Extract().EncryptedDataKeyDescriptionOutput[0].keyProviderInfo.Some?; - expect actualDataKeyDescription.Extract().EncryptedDataKeyDescriptionOutput[0].keyProviderInfo.Extract() == UTF8.Decode(expectedHead.dataKeys[0].keyProviderInfo).Extract(); - - if actualDataKeyDescription.Extract().EncryptedDataKeyDescriptionOutput[0].keyProviderId == "aws-kms-hierarchy" { - expect actualDataKeyDescription.Extract().EncryptedDataKeyDescriptionOutput[0].branchKeyId.Some?; - expect actualDataKeyDescription.Extract().EncryptedDataKeyDescriptionOutput[0].branchKeyVersion.Some?; - expect actualDataKeyDescription.Extract().EncryptedDataKeyDescriptionOutput[0].branchKeyId.Extract() == UTF8.Decode(expectedHead.dataKeys[0].keyProviderInfo).Extract(); - expect actualDataKeyDescription.Extract().EncryptedDataKeyDescriptionOutput[0].branchKeyVersion.Extract() == expectedBranchKeyVersion; + var actualDataKeyDescription :- expect ddbEncResources.GetEncryptedDataKeyDescription(inputVariable); + var expectedkeyProviderId :- expect UTF8.Decode(expectedHead.dataKeys[0].keyProviderId); + var expectedkeyProviderInfo :- expect UTF8.Decode(expectedHead.dataKeys[0].keyProviderInfo); + + expect |actualDataKeyDescription.EncryptedDataKeyDescriptionOutput| > 0; + expect |actualDataKeyDescription.EncryptedDataKeyDescriptionOutput| == |expectedHead.dataKeys|; + expect actualDataKeyDescription.EncryptedDataKeyDescriptionOutput[0].keyProviderId == expectedkeyProviderId; + expect actualDataKeyDescription.EncryptedDataKeyDescriptionOutput[0].keyProviderInfo.Some?; + expect actualDataKeyDescription.EncryptedDataKeyDescriptionOutput[0].keyProviderInfo.value == expectedkeyProviderInfo; + + if actualDataKeyDescription.EncryptedDataKeyDescriptionOutput[0].keyProviderId == "aws-kms-hierarchy" { + expect actualDataKeyDescription.EncryptedDataKeyDescriptionOutput[0].branchKeyId.Some?; + expect actualDataKeyDescription.EncryptedDataKeyDescriptionOutput[0].branchKeyVersion.Some?; + + expect actualDataKeyDescription.EncryptedDataKeyDescriptionOutput[0].branchKeyId.value == expectedkeyProviderInfo; + expect actualDataKeyDescription.EncryptedDataKeyDescriptionOutput[0].branchKeyVersion.value == expectedBranchKeyVersion; } } @@ -224,16 +220,15 @@ module DynamoDbGetEncryptedDataKeyDescriptionTest { Types.GetEncryptedDataKeyDescriptionInput( input := Types.plaintextItem(plaintextItem := attr) ); - var actualDataKeyDescription := ddbEncResources.GetEncryptedDataKeyDescription(inputVariable); - - expect UTF8.Decode(expectedHead.dataKeys[0].keyProviderId).Success?; - expect UTF8.Decode(expectedHead.dataKeys[0].keyProviderInfo).Success?; - expect actualDataKeyDescription.Success?; - expect |actualDataKeyDescription.Extract().EncryptedDataKeyDescriptionOutput| > 0; - expect |actualDataKeyDescription.Extract().EncryptedDataKeyDescriptionOutput| == |expectedHead.dataKeys|; - expect actualDataKeyDescription.Extract().EncryptedDataKeyDescriptionOutput[0].keyProviderId == UTF8.Decode(expectedHead.dataKeys[0].keyProviderId).Extract(); - expect actualDataKeyDescription.Extract().EncryptedDataKeyDescriptionOutput[0].keyProviderInfo.Some?; - expect actualDataKeyDescription.Extract().EncryptedDataKeyDescriptionOutput[0].keyProviderInfo.Extract() == UTF8.Decode(expectedHead.dataKeys[0].keyProviderInfo).Extract(); + var actualDataKeyDescription :- expect ddbEncResources.GetEncryptedDataKeyDescription(inputVariable); + var expectedkeyProviderId :- expect UTF8.Decode(expectedHead.dataKeys[0].keyProviderId); + var expectedkeyProviderInfo :- expect UTF8.Decode(expectedHead.dataKeys[0].keyProviderInfo); + + expect |actualDataKeyDescription.EncryptedDataKeyDescriptionOutput| > 0; + expect |actualDataKeyDescription.EncryptedDataKeyDescriptionOutput| == |expectedHead.dataKeys|; + expect actualDataKeyDescription.EncryptedDataKeyDescriptionOutput[0].keyProviderId == expectedkeyProviderId; + expect actualDataKeyDescription.EncryptedDataKeyDescriptionOutput[0].keyProviderInfo.Some?; + expect actualDataKeyDescription.EncryptedDataKeyDescriptionOutput[0].keyProviderInfo.value == expectedkeyProviderInfo; } method {:test} TestDDBItemInputAwsKmsRsaDataKeyCase() @@ -246,16 +241,15 @@ module DynamoDbGetEncryptedDataKeyDescriptionTest { Types.GetEncryptedDataKeyDescriptionInput( input := Types.plaintextItem(plaintextItem := attr) ); - var actualDataKeyDescription := ddbEncResources.GetEncryptedDataKeyDescription(inputVariable); - - expect UTF8.Decode(expectedHead.dataKeys[0].keyProviderId).Success?; - expect UTF8.Decode(expectedHead.dataKeys[0].keyProviderInfo).Success?; - expect actualDataKeyDescription.Success?; - expect |actualDataKeyDescription.Extract().EncryptedDataKeyDescriptionOutput| > 0; - expect |actualDataKeyDescription.Extract().EncryptedDataKeyDescriptionOutput| == |expectedHead.dataKeys|; - expect actualDataKeyDescription.Extract().EncryptedDataKeyDescriptionOutput[0].keyProviderId == UTF8.Decode(expectedHead.dataKeys[0].keyProviderId).Extract(); - expect actualDataKeyDescription.Extract().EncryptedDataKeyDescriptionOutput[0].keyProviderInfo.Some?; - expect actualDataKeyDescription.Extract().EncryptedDataKeyDescriptionOutput[0].keyProviderInfo.Extract() == UTF8.Decode(expectedHead.dataKeys[0].keyProviderInfo).Extract(); + var actualDataKeyDescription :- expect ddbEncResources.GetEncryptedDataKeyDescription(inputVariable); + var expectedkeyProviderId :- expect UTF8.Decode(expectedHead.dataKeys[0].keyProviderId); + var expectedkeyProviderInfo :- expect UTF8.Decode(expectedHead.dataKeys[0].keyProviderInfo); + + expect |actualDataKeyDescription.EncryptedDataKeyDescriptionOutput| > 0; + expect |actualDataKeyDescription.EncryptedDataKeyDescriptionOutput| == |expectedHead.dataKeys|; + expect actualDataKeyDescription.EncryptedDataKeyDescriptionOutput[0].keyProviderId == expectedkeyProviderId; + expect actualDataKeyDescription.EncryptedDataKeyDescriptionOutput[0].keyProviderInfo.Some?; + expect actualDataKeyDescription.EncryptedDataKeyDescriptionOutput[0].keyProviderInfo.value == expectedkeyProviderInfo; } method {:test} TestHeaderMultiDataKeyCase() @@ -267,21 +261,20 @@ module DynamoDbGetEncryptedDataKeyDescriptionTest { Types.GetEncryptedDataKeyDescriptionInput( input := Types.header(header := serializedHeader) ); - var actualDataKeyDescription := ddbEncResources.GetEncryptedDataKeyDescription(inputVariable); + var actualDataKeyDescription :- expect ddbEncResources.GetEncryptedDataKeyDescription(inputVariable); + - expect actualDataKeyDescription.Success?; - expect |actualDataKeyDescription.Extract().EncryptedDataKeyDescriptionOutput| == |expectedHead.dataKeys|; - expect |actualDataKeyDescription.Extract().EncryptedDataKeyDescriptionOutput| > 0; + expect |actualDataKeyDescription.EncryptedDataKeyDescriptionOutput| == |expectedHead.dataKeys|; + expect |actualDataKeyDescription.EncryptedDataKeyDescriptionOutput| > 0; var i := 0; while (i < |expectedHead.dataKeys|) { - expect UTF8.Decode(expectedHead.dataKeys[i].keyProviderId).Success?; - expect UTF8.Decode(expectedHead.dataKeys[i].keyProviderInfo).Success?; - expect actualDataKeyDescription.Extract().EncryptedDataKeyDescriptionOutput[i].keyProviderInfo.Some?; - - expect actualDataKeyDescription.Extract().EncryptedDataKeyDescriptionOutput[i].keyProviderId == UTF8.Decode(expectedHead.dataKeys[i].keyProviderId).Extract(); - expect actualDataKeyDescription.Extract().EncryptedDataKeyDescriptionOutput[i].keyProviderInfo.Extract() == UTF8.Decode(expectedHead.dataKeys[i].keyProviderInfo).Extract(); - + var expectedkeyProviderId :- expect UTF8.Decode(expectedHead.dataKeys[i].keyProviderId); + var expectedkeyProviderInfo :- expect UTF8.Decode(expectedHead.dataKeys[i].keyProviderInfo); + + expect actualDataKeyDescription.EncryptedDataKeyDescriptionOutput[i].keyProviderInfo.Some?; + expect actualDataKeyDescription.EncryptedDataKeyDescriptionOutput[i].keyProviderId == expectedkeyProviderId; + expect actualDataKeyDescription.EncryptedDataKeyDescriptionOutput[i].keyProviderInfo.Extract() == expectedkeyProviderInfo; i := i + 1; } } @@ -296,20 +289,21 @@ module DynamoDbGetEncryptedDataKeyDescriptionTest { Types.GetEncryptedDataKeyDescriptionInput( input := Types.plaintextItem(plaintextItem := attr) ); - var actualDataKeyDescription := ddbEncResources.GetEncryptedDataKeyDescription(inputVariable); - expect actualDataKeyDescription.Success?; - expect |actualDataKeyDescription.Extract().EncryptedDataKeyDescriptionOutput| == |expectedHead.dataKeys|; - expect |actualDataKeyDescription.Extract().EncryptedDataKeyDescriptionOutput| > 0; + var actualDataKeyDescription :- expect ddbEncResources.GetEncryptedDataKeyDescription(inputVariable); + var expectedkeyProviderId :- expect UTF8.Decode(expectedHead.dataKeys[0].keyProviderId); + var expectedkeyProviderInfo :- expect UTF8.Decode(expectedHead.dataKeys[0].keyProviderInfo); + + expect |actualDataKeyDescription.EncryptedDataKeyDescriptionOutput| == |expectedHead.dataKeys|; + expect |actualDataKeyDescription.EncryptedDataKeyDescriptionOutput| > 0; var i := 0; while (i < |expectedHead.dataKeys|) { - expect UTF8.Decode(expectedHead.dataKeys[i].keyProviderId).Success?; - expect UTF8.Decode(expectedHead.dataKeys[i].keyProviderInfo).Success?; - expect actualDataKeyDescription.Extract().EncryptedDataKeyDescriptionOutput[i].keyProviderInfo.Some?; - - expect actualDataKeyDescription.Extract().EncryptedDataKeyDescriptionOutput[i].keyProviderId == UTF8.Decode(expectedHead.dataKeys[i].keyProviderId).Extract(); - expect actualDataKeyDescription.Extract().EncryptedDataKeyDescriptionOutput[i].keyProviderInfo.Extract() == UTF8.Decode(expectedHead.dataKeys[i].keyProviderInfo).Extract(); + var expectedkeyProviderId :- expect UTF8.Decode(expectedHead.dataKeys[i].keyProviderId); + var expectedkeyProviderInfo :- expect UTF8.Decode(expectedHead.dataKeys[i].keyProviderInfo); + expect actualDataKeyDescription.EncryptedDataKeyDescriptionOutput[i].keyProviderInfo.Some?; + expect actualDataKeyDescription.EncryptedDataKeyDescriptionOutput[i].keyProviderId == expectedkeyProviderId; + expect actualDataKeyDescription.EncryptedDataKeyDescriptionOutput[i].keyProviderInfo.Extract() == expectedkeyProviderInfo; i := i + 1; } } From 1d801ef5b9b4ecfa7195a0f96758c997609e58d4 Mon Sep 17 00:00:00 2001 From: rishav-karanjit Date: Wed, 10 Apr 2024 08:38:05 -0700 Subject: [PATCH 43/67] Assign Salt, IV and Version length constant --- .../AwsCryptographyDbEncryptionSdkDynamoDbOperations.dfy | 8 ++++++-- .../test/DynamoDbGetEncryptedDataKeyDescriptionTest.dfy | 1 - 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/DynamoDbEncryption/dafny/DynamoDbEncryption/src/AwsCryptographyDbEncryptionSdkDynamoDbOperations.dfy b/DynamoDbEncryption/dafny/DynamoDbEncryption/src/AwsCryptographyDbEncryptionSdkDynamoDbOperations.dfy index 64607fc70..edbbc3928 100644 --- a/DynamoDbEncryption/dafny/DynamoDbEncryption/src/AwsCryptographyDbEncryptionSdkDynamoDbOperations.dfy +++ b/DynamoDbEncryption/dafny/DynamoDbEncryption/src/AwsCryptographyDbEncryptionSdkDynamoDbOperations.dfy @@ -12,6 +12,10 @@ module AwsCryptographyDbEncryptionSdkDynamoDbOperations refines AbstractAwsCrypt import Header = StructuredEncryptionHeader import opened DynamoDbEncryptionUtil + const SALT_LENGTH := 16 + const IV_LENGTH := 12 + const VERSION_LENGTH := 16 + predicate ValidInternalConfig?(config: InternalConfig) {true} @@ -91,8 +95,8 @@ module AwsCryptographyDbEncryptionSdkDynamoDbOperations refines AbstractAwsCrypt // The ciphertext structure in the hierarchy keyring contains Salt and IV before Version. // The length of Salt is 16 and IV is 12 bytes. The length of Version is 16 bytes. // https://github.com/awslabs/aws-encryption-sdk-specification/blob/master/framework/aws-kms/aws-kms-hierarchical-keyring.md#ciphertext - var EDK_CIPHERTEXT_BRANCH_KEY_VERSION_INDEX := 12 + 16; - var EDK_CIPHERTEXT_VERSION_INDEX := EDK_CIPHERTEXT_BRANCH_KEY_VERSION_INDEX + 16; + var EDK_CIPHERTEXT_BRANCH_KEY_VERSION_INDEX := SALT_LENGTH + IV_LENGTH; + var EDK_CIPHERTEXT_VERSION_INDEX := EDK_CIPHERTEXT_BRANCH_KEY_VERSION_INDEX + VERSION_LENGTH; :- Need(EDK_CIPHERTEXT_BRANCH_KEY_VERSION_INDEX < EDK_CIPHERTEXT_VERSION_INDEX, E("Wrong branch key version index.")); :- Need(|providerWrappedMaterial| >= EDK_CIPHERTEXT_VERSION_INDEX, E("Incorrect ciphertext structure length.")); var branchKeyVersionUuid := providerWrappedMaterial[EDK_CIPHERTEXT_BRANCH_KEY_VERSION_INDEX .. EDK_CIPHERTEXT_VERSION_INDEX]; diff --git a/DynamoDbEncryption/dafny/DynamoDbEncryption/test/DynamoDbGetEncryptedDataKeyDescriptionTest.dfy b/DynamoDbEncryption/dafny/DynamoDbEncryption/test/DynamoDbGetEncryptedDataKeyDescriptionTest.dfy index 5a540a8ca..1dfa36fb4 100644 --- a/DynamoDbEncryption/dafny/DynamoDbEncryption/test/DynamoDbGetEncryptedDataKeyDescriptionTest.dfy +++ b/DynamoDbEncryption/dafny/DynamoDbEncryption/test/DynamoDbGetEncryptedDataKeyDescriptionTest.dfy @@ -263,7 +263,6 @@ module DynamoDbGetEncryptedDataKeyDescriptionTest { ); var actualDataKeyDescription :- expect ddbEncResources.GetEncryptedDataKeyDescription(inputVariable); - expect |actualDataKeyDescription.EncryptedDataKeyDescriptionOutput| == |expectedHead.dataKeys|; expect |actualDataKeyDescription.EncryptedDataKeyDescriptionOutput| > 0; From 4dcb69698fd16c454af64d395c2e2c90c3663b94 Mon Sep 17 00:00:00 2001 From: rishav-karanjit Date: Wed, 10 Apr 2024 08:43:58 -0700 Subject: [PATCH 44/67] format dafny --- .../test/DynamoDbGetEncryptedDataKeyDescriptionTest.dfy | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/DynamoDbEncryption/dafny/DynamoDbEncryption/test/DynamoDbGetEncryptedDataKeyDescriptionTest.dfy b/DynamoDbEncryption/dafny/DynamoDbEncryption/test/DynamoDbGetEncryptedDataKeyDescriptionTest.dfy index 1dfa36fb4..1dc22b2af 100644 --- a/DynamoDbEncryption/dafny/DynamoDbEncryption/test/DynamoDbGetEncryptedDataKeyDescriptionTest.dfy +++ b/DynamoDbEncryption/dafny/DynamoDbEncryption/test/DynamoDbGetEncryptedDataKeyDescriptionTest.dfy @@ -262,7 +262,7 @@ module DynamoDbGetEncryptedDataKeyDescriptionTest { input := Types.header(header := serializedHeader) ); var actualDataKeyDescription :- expect ddbEncResources.GetEncryptedDataKeyDescription(inputVariable); - + expect |actualDataKeyDescription.EncryptedDataKeyDescriptionOutput| == |expectedHead.dataKeys|; expect |actualDataKeyDescription.EncryptedDataKeyDescriptionOutput| > 0; @@ -270,7 +270,7 @@ module DynamoDbGetEncryptedDataKeyDescriptionTest { while (i < |expectedHead.dataKeys|) { var expectedkeyProviderId :- expect UTF8.Decode(expectedHead.dataKeys[i].keyProviderId); var expectedkeyProviderInfo :- expect UTF8.Decode(expectedHead.dataKeys[i].keyProviderInfo); - + expect actualDataKeyDescription.EncryptedDataKeyDescriptionOutput[i].keyProviderInfo.Some?; expect actualDataKeyDescription.EncryptedDataKeyDescriptionOutput[i].keyProviderId == expectedkeyProviderId; expect actualDataKeyDescription.EncryptedDataKeyDescriptionOutput[i].keyProviderInfo.Extract() == expectedkeyProviderInfo; From dc581e745f933bc81192cee50b7d73b8cd3e574c Mon Sep 17 00:00:00 2001 From: rishav-karanjit Date: Wed, 10 Apr 2024 09:18:35 -0700 Subject: [PATCH 45/67] Remove redundant codes --- .../test/DynamoDbGetEncryptedDataKeyDescriptionTest.dfy | 2 -- 1 file changed, 2 deletions(-) diff --git a/DynamoDbEncryption/dafny/DynamoDbEncryption/test/DynamoDbGetEncryptedDataKeyDescriptionTest.dfy b/DynamoDbEncryption/dafny/DynamoDbEncryption/test/DynamoDbGetEncryptedDataKeyDescriptionTest.dfy index 1dc22b2af..11b0e2886 100644 --- a/DynamoDbEncryption/dafny/DynamoDbEncryption/test/DynamoDbGetEncryptedDataKeyDescriptionTest.dfy +++ b/DynamoDbEncryption/dafny/DynamoDbEncryption/test/DynamoDbGetEncryptedDataKeyDescriptionTest.dfy @@ -289,8 +289,6 @@ module DynamoDbGetEncryptedDataKeyDescriptionTest { input := Types.plaintextItem(plaintextItem := attr) ); var actualDataKeyDescription :- expect ddbEncResources.GetEncryptedDataKeyDescription(inputVariable); - var expectedkeyProviderId :- expect UTF8.Decode(expectedHead.dataKeys[0].keyProviderId); - var expectedkeyProviderInfo :- expect UTF8.Decode(expectedHead.dataKeys[0].keyProviderInfo); expect |actualDataKeyDescription.EncryptedDataKeyDescriptionOutput| == |expectedHead.dataKeys|; expect |actualDataKeyDescription.EncryptedDataKeyDescriptionOutput| > 0; From b28e230fe8bb789e502de148d5e3e62ae34f3205 Mon Sep 17 00:00:00 2001 From: rishav-karanjit Date: Wed, 10 Apr 2024 10:24:33 -0700 Subject: [PATCH 46/67] Removed call to ItemToStructured --- .../AwsCryptographyDbEncryptionSdkDynamoDbOperations.dfy | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/DynamoDbEncryption/dafny/DynamoDbEncryption/src/AwsCryptographyDbEncryptionSdkDynamoDbOperations.dfy b/DynamoDbEncryption/dafny/DynamoDbEncryption/src/AwsCryptographyDbEncryptionSdkDynamoDbOperations.dfy index edbbc3928..64db95ce8 100644 --- a/DynamoDbEncryption/dafny/DynamoDbEncryption/src/AwsCryptographyDbEncryptionSdkDynamoDbOperations.dfy +++ b/DynamoDbEncryption/dafny/DynamoDbEncryption/src/AwsCryptographyDbEncryptionSdkDynamoDbOperations.dfy @@ -53,10 +53,9 @@ module AwsCryptographyDbEncryptionSdkDynamoDbOperations refines AbstractAwsCrypt var header; match input.input { - case plaintextItem(plaintextItem) =>{ - :- Need(DynamoToStruct.ItemToStructured(plaintextItem).Success?, E("Failed to convert AttributeMap to StructuredDataMap.")); - :- Need("aws_dbe_head" in DynamoToStruct.ItemToStructured(plaintextItem).Extract(), E("aws_dbe_head is not present in the attribute map.")); - header := DynamoToStruct.ItemToStructured(plaintextItem).Extract()["aws_dbe_head"].content.Terminal.value; + case plaintextItem(plainTextItem) =>{ + :- Need("aws_dbe_head" in plainTextItem && plainTextItem["aws_dbe_head"].B?, E("Header not found in the DynamoDB item.")); + header := plainTextItem["aws_dbe_head"].B; } case header(headerItem) => header := headerItem; From d9cd376f56a94d2b55b285ffa8d883d9d42ba5f9 Mon Sep 17 00:00:00 2001 From: rishav-karanjit Date: Wed, 10 Apr 2024 10:30:11 -0700 Subject: [PATCH 47/67] Remove extract --- .../test/DynamoDbGetEncryptedDataKeyDescriptionTest.dfy | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/DynamoDbEncryption/dafny/DynamoDbEncryption/test/DynamoDbGetEncryptedDataKeyDescriptionTest.dfy b/DynamoDbEncryption/dafny/DynamoDbEncryption/test/DynamoDbGetEncryptedDataKeyDescriptionTest.dfy index 11b0e2886..fbfa3971f 100644 --- a/DynamoDbEncryption/dafny/DynamoDbEncryption/test/DynamoDbGetEncryptedDataKeyDescriptionTest.dfy +++ b/DynamoDbEncryption/dafny/DynamoDbEncryption/test/DynamoDbGetEncryptedDataKeyDescriptionTest.dfy @@ -308,11 +308,9 @@ module DynamoDbGetEncryptedDataKeyDescriptionTest { method getBranchKeyVersion (expectedHead : PartialHeader) returns (expectedBranchKeyVersion : string) { - expect EdkWrapping.GetProviderWrappedMaterial(expectedHead.dataKeys[0].ciphertext, algorithmSuite).Success?; - var providerWrappedMaterial := EdkWrapping.GetProviderWrappedMaterial(expectedHead.dataKeys[0].ciphertext, algorithmSuite).Extract(); + var providerWrappedMaterial :- expect EdkWrapping.GetProviderWrappedMaterial(expectedHead.dataKeys[0].ciphertext, algorithmSuite); expect |providerWrappedMaterial| >= (28 + 16); - var expectedBranchKeyVersionResult := UUID.FromByteArray(providerWrappedMaterial[28 .. (28 + 16)]); - expect expectedBranchKeyVersionResult.Success?; - expectedBranchKeyVersion := expectedBranchKeyVersionResult.Extract(); + var expectedBranchKeyVersionResult :- expect UUID.FromByteArray(providerWrappedMaterial[28 .. (28 + 16)]); + expectedBranchKeyVersion := expectedBranchKeyVersionResult; } } From 1cef3ce42416a842b1c588e26f2f04bf30e3fdea Mon Sep 17 00:00:00 2001 From: rishav-karanjit Date: Wed, 10 Apr 2024 11:13:05 -0700 Subject: [PATCH 48/67] Some nits --- ...sCryptographyDbEncryptionSdkDynamoDbOperations.dfy | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/DynamoDbEncryption/dafny/DynamoDbEncryption/src/AwsCryptographyDbEncryptionSdkDynamoDbOperations.dfy b/DynamoDbEncryption/dafny/DynamoDbEncryption/src/AwsCryptographyDbEncryptionSdkDynamoDbOperations.dfy index 64db95ce8..92222a3e0 100644 --- a/DynamoDbEncryption/dafny/DynamoDbEncryption/src/AwsCryptographyDbEncryptionSdkDynamoDbOperations.dfy +++ b/DynamoDbEncryption/dafny/DynamoDbEncryption/src/AwsCryptographyDbEncryptionSdkDynamoDbOperations.dfy @@ -85,8 +85,7 @@ module AwsCryptographyDbEncryptionSdkDynamoDbOperations refines AbstractAwsCrypt algorithmSuite := AlgorithmSuites.DBE_ALG_AES_256_GCM_HKDF_SHA512_COMMIT_KEY_ECDSA_P384_SYMSIG_HMAC_SHA384; } - :- Need(UTF8.Decode(datakeys[i].keyProviderInfo).Success?, E("Failed to extract keyProviderInfo.")); - var extractedKeyProviderIdInfo := UTF8.Decode(datakeys[i].keyProviderInfo).MapFailure(e => E("Failed to deserialize header.")); + var extractedKeyProviderIdInfo :- UTF8.Decode(datakeys[i].keyProviderInfo).MapFailure(e => E(e)); if extractedKeyProviderId == "aws-kms-hierarchy" { var providerWrappedMaterial :- EdkWrapping.GetProviderWrappedMaterial(datakeys[i].ciphertext, algorithmSuite).MapFailure(e => E("Failed to get provider wrapped material" )); @@ -99,18 +98,18 @@ module AwsCryptographyDbEncryptionSdkDynamoDbOperations refines AbstractAwsCrypt :- Need(EDK_CIPHERTEXT_BRANCH_KEY_VERSION_INDEX < EDK_CIPHERTEXT_VERSION_INDEX, E("Wrong branch key version index.")); :- Need(|providerWrappedMaterial| >= EDK_CIPHERTEXT_VERSION_INDEX, E("Incorrect ciphertext structure length.")); var branchKeyVersionUuid := providerWrappedMaterial[EDK_CIPHERTEXT_BRANCH_KEY_VERSION_INDEX .. EDK_CIPHERTEXT_VERSION_INDEX]; - var expectedBranchKeyVersion :- UUID.FromByteArray(branchKeyVersionUuid).MapFailure(e => E("Failed to convert UUID from byte array.")); + var expectedBranchKeyVersion :- UUID.FromByteArray(branchKeyVersionUuid).MapFailure(e => E(e)); singleDataKeyOutput := EncryptedDataKeyDescriptionOutput( keyProviderId := extractedKeyProviderId, - keyProviderInfo := Some(extractedKeyProviderIdInfo.value), - branchKeyId := Some(extractedKeyProviderIdInfo.value), + keyProviderInfo := Some(extractedKeyProviderIdInfo), + branchKeyId := Some(extractedKeyProviderIdInfo), branchKeyVersion := Some(expectedBranchKeyVersion) ); } else { singleDataKeyOutput := EncryptedDataKeyDescriptionOutput( keyProviderId := extractedKeyProviderId, - keyProviderInfo := Some(extractedKeyProviderIdInfo.value), + keyProviderInfo := Some(extractedKeyProviderIdInfo), branchKeyId := None, branchKeyVersion := None ); From 4c886767dd8f34fbc30a5b64c72fd0cbbd0b3305 Mon Sep 17 00:00:00 2001 From: rishav-karanjit Date: Wed, 10 Apr 2024 11:14:03 -0700 Subject: [PATCH 49/67] Removed some more extract --- .../test/DynamoDbGetEncryptedDataKeyDescriptionTest.dfy | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/DynamoDbEncryption/dafny/DynamoDbEncryption/test/DynamoDbGetEncryptedDataKeyDescriptionTest.dfy b/DynamoDbEncryption/dafny/DynamoDbEncryption/test/DynamoDbGetEncryptedDataKeyDescriptionTest.dfy index fbfa3971f..f230f2988 100644 --- a/DynamoDbEncryption/dafny/DynamoDbEncryption/test/DynamoDbGetEncryptedDataKeyDescriptionTest.dfy +++ b/DynamoDbEncryption/dafny/DynamoDbEncryption/test/DynamoDbGetEncryptedDataKeyDescriptionTest.dfy @@ -273,7 +273,7 @@ module DynamoDbGetEncryptedDataKeyDescriptionTest { expect actualDataKeyDescription.EncryptedDataKeyDescriptionOutput[i].keyProviderInfo.Some?; expect actualDataKeyDescription.EncryptedDataKeyDescriptionOutput[i].keyProviderId == expectedkeyProviderId; - expect actualDataKeyDescription.EncryptedDataKeyDescriptionOutput[i].keyProviderInfo.Extract() == expectedkeyProviderInfo; + expect actualDataKeyDescription.EncryptedDataKeyDescriptionOutput[i].keyProviderInfo.value == expectedkeyProviderInfo; i := i + 1; } } @@ -300,7 +300,7 @@ module DynamoDbGetEncryptedDataKeyDescriptionTest { expect actualDataKeyDescription.EncryptedDataKeyDescriptionOutput[i].keyProviderInfo.Some?; expect actualDataKeyDescription.EncryptedDataKeyDescriptionOutput[i].keyProviderId == expectedkeyProviderId; - expect actualDataKeyDescription.EncryptedDataKeyDescriptionOutput[i].keyProviderInfo.Extract() == expectedkeyProviderInfo; + expect actualDataKeyDescription.EncryptedDataKeyDescriptionOutput[i].keyProviderInfo.value == expectedkeyProviderInfo; i := i + 1; } } From 5e88171f08dfaadcfa6ce3cfa6ffe492ffc420d6 Mon Sep 17 00:00:00 2001 From: rishav-karanjit Date: Wed, 10 Apr 2024 12:05:50 -0700 Subject: [PATCH 50/67] Updated to appropriate error datatype --- .../src/AwsCryptographyDbEncryptionSdkDynamoDbOperations.dfy | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/DynamoDbEncryption/dafny/DynamoDbEncryption/src/AwsCryptographyDbEncryptionSdkDynamoDbOperations.dfy b/DynamoDbEncryption/dafny/DynamoDbEncryption/src/AwsCryptographyDbEncryptionSdkDynamoDbOperations.dfy index 92222a3e0..211c64a58 100644 --- a/DynamoDbEncryption/dafny/DynamoDbEncryption/src/AwsCryptographyDbEncryptionSdkDynamoDbOperations.dfy +++ b/DynamoDbEncryption/dafny/DynamoDbEncryption/src/AwsCryptographyDbEncryptionSdkDynamoDbOperations.dfy @@ -8,7 +8,6 @@ module AwsCryptographyDbEncryptionSdkDynamoDbOperations refines AbstractAwsCrypt import EdkWrapping import UUID import AlgorithmSuites - import DynamoToStruct import Header = StructuredEncryptionHeader import opened DynamoDbEncryptionUtil @@ -60,7 +59,7 @@ module AwsCryptographyDbEncryptionSdkDynamoDbOperations refines AbstractAwsCrypt case header(headerItem) => header := headerItem; } - var deserializedHeader :- Header.PartialDeserialize(header).MapFailure(e => E("Failed to deserialize header.")); + var deserializedHeader :- Header.PartialDeserialize(header).MapFailure(e => AwsCryptographyDbEncryptionSdkStructuredEncryption(e)); var datakeys := deserializedHeader.dataKeys; var list : EncryptedDataKeyDescriptionList := []; for i := 0 to |datakeys| { @@ -88,7 +87,7 @@ module AwsCryptographyDbEncryptionSdkDynamoDbOperations refines AbstractAwsCrypt var extractedKeyProviderIdInfo :- UTF8.Decode(datakeys[i].keyProviderInfo).MapFailure(e => E(e)); if extractedKeyProviderId == "aws-kms-hierarchy" { - var providerWrappedMaterial :- EdkWrapping.GetProviderWrappedMaterial(datakeys[i].ciphertext, algorithmSuite).MapFailure(e => E("Failed to get provider wrapped material" )); + var providerWrappedMaterial :- EdkWrapping.GetProviderWrappedMaterial(datakeys[i].ciphertext, algorithmSuite).MapFailure(e => AwsCryptographyMaterialProviders(e)); // The ciphertext structure in the hierarchy keyring contains Salt and IV before Version. // The length of Salt is 16 and IV is 12 bytes. The length of Version is 16 bytes. From 6ffde547be27e75a1d7fcb042124b361cfd945a2 Mon Sep 17 00:00:00 2001 From: rishav-karanjit Date: Wed, 10 Apr 2024 13:08:36 -0700 Subject: [PATCH 51/67] Changed structure EncryptedDataKeyDescriptionOutput to EncryptedDataKeyDescription --- ...yptographyDbEncryptionSdkDynamoDbTypes.dfy | 4 +- .../Model/DynamoDbEncryption.smithy | 9 +- ...raphyDbEncryptionSdkDynamoDbOperations.dfy | 8 +- .../dbencryptionsdk/dynamodb/ToDafny.java | 18 +-- .../dbencryptionsdk/dynamodb/ToNative.java | 14 +- .../model/EncryptedDataKeyDescription.java | 130 ++++++++++++++++++ .../GetEncryptedDataKeyDescriptionOutput.java | 14 +- .../EncryptedDataKeyDescription.cs | 56 ++++++++ .../GetEncryptedDataKeyDescriptionOutput.cs | 4 +- .../DynamoDbEncryption/TypeConversion.cs | 52 +++---- .../TypeConversion.cs | 16 +-- .../DynamoDbItemEncryptor/TypeConversion.cs | 22 +-- .../StructuredEncryption/TypeConversion.cs | 8 +- 13 files changed, 273 insertions(+), 82 deletions(-) create mode 100644 DynamoDbEncryption/runtimes/java/src/main/smithy-generated/software/amazon/cryptography/dbencryptionsdk/dynamodb/model/EncryptedDataKeyDescription.java create mode 100644 DynamoDbEncryption/runtimes/net/Generated/DynamoDbEncryption/EncryptedDataKeyDescription.cs diff --git a/DynamoDbEncryption/dafny/DynamoDbEncryption/Model/AwsCryptographyDbEncryptionSdkDynamoDbTypes.dfy b/DynamoDbEncryption/dafny/DynamoDbEncryption/Model/AwsCryptographyDbEncryptionSdkDynamoDbTypes.dfy index 8b63080d9..2c61284d6 100644 --- a/DynamoDbEncryption/dafny/DynamoDbEncryption/Model/AwsCryptographyDbEncryptionSdkDynamoDbTypes.dfy +++ b/DynamoDbEncryption/dafny/DynamoDbEncryption/Model/AwsCryptographyDbEncryptionSdkDynamoDbTypes.dfy @@ -249,13 +249,13 @@ module {:extern "software.amazon.cryptography.dbencryptionsdk.dynamodb.internald datatype DynamoDbTablesEncryptionConfig = | DynamoDbTablesEncryptionConfig ( nameonly tableEncryptionConfigs: DynamoDbTableEncryptionConfigList ) - type EncryptedDataKeyDescriptionList = seq - datatype EncryptedDataKeyDescriptionOutput = | EncryptedDataKeyDescriptionOutput ( + datatype EncryptedDataKeyDescription = | EncryptedDataKeyDescription ( nameonly keyProviderId: string , nameonly keyProviderInfo: Option := Option.None , nameonly branchKeyId: Option := Option.None , nameonly branchKeyVersion: Option := Option.None ) + type EncryptedDataKeyDescriptionList = seq datatype EncryptedPart = | EncryptedPart ( nameonly name: string , nameonly prefix: Prefix diff --git a/DynamoDbEncryption/dafny/DynamoDbEncryption/Model/DynamoDbEncryption.smithy b/DynamoDbEncryption/dafny/DynamoDbEncryption/Model/DynamoDbEncryption.smithy index 4d2176fdb..86013d289 100644 --- a/DynamoDbEncryption/dafny/DynamoDbEncryption/Model/DynamoDbEncryption.smithy +++ b/DynamoDbEncryption/dafny/DynamoDbEncryption/Model/DynamoDbEncryption.smithy @@ -58,6 +58,11 @@ structure GetEncryptedDataKeyDescriptionInput { input: GetEncryptedDataKeyDescriptionUnion } +//= specification/dynamodb-encryption-client/ddb-get-encrypted-data-key-description.md#input +//# This operation MUST take in either of the following: +//# - A binary [header](https://github.com/aws/aws-database-encryption-sdk-dynamodb/blob/main/specification/structured-encryption/header.md) +//# - A [encrypted DynamoDB item](https://github.com/aws/aws-database-encryption-sdk-dynamodb/blob/ff9f08a355a20c81540e4ca652e09aaeffe90c4b/specification/dynamodb-encryption-client/encrypt-item.md#encrypted-dynamodb-item) + union GetEncryptedDataKeyDescriptionUnion { header: Blob, plaintextItem: AttributeMap, @@ -69,10 +74,10 @@ structure GetEncryptedDataKeyDescriptionOutput { } list EncryptedDataKeyDescriptionList { - member: EncryptedDataKeyDescriptionOutput + member: EncryptedDataKeyDescription } -structure EncryptedDataKeyDescriptionOutput { +structure EncryptedDataKeyDescription { @required keyProviderId: String, diff --git a/DynamoDbEncryption/dafny/DynamoDbEncryption/src/AwsCryptographyDbEncryptionSdkDynamoDbOperations.dfy b/DynamoDbEncryption/dafny/DynamoDbEncryption/src/AwsCryptographyDbEncryptionSdkDynamoDbOperations.dfy index 211c64a58..ba9f6c713 100644 --- a/DynamoDbEncryption/dafny/DynamoDbEncryption/src/AwsCryptographyDbEncryptionSdkDynamoDbOperations.dfy +++ b/DynamoDbEncryption/dafny/DynamoDbEncryption/src/AwsCryptographyDbEncryptionSdkDynamoDbOperations.dfy @@ -63,10 +63,10 @@ module AwsCryptographyDbEncryptionSdkDynamoDbOperations refines AbstractAwsCrypt var datakeys := deserializedHeader.dataKeys; var list : EncryptedDataKeyDescriptionList := []; for i := 0 to |datakeys| { - var singleDataKeyOutput : EncryptedDataKeyDescriptionOutput; + var singleDataKeyOutput : EncryptedDataKeyDescription; var extractedKeyProviderId :- UTF8.Decode(datakeys[i].keyProviderId).MapFailure(e => E(e)); if !("aws-kms" < extractedKeyProviderId) { - singleDataKeyOutput := EncryptedDataKeyDescriptionOutput( + singleDataKeyOutput := EncryptedDataKeyDescription( keyProviderId := extractedKeyProviderId, keyProviderInfo := None, branchKeyId := None, @@ -98,7 +98,7 @@ module AwsCryptographyDbEncryptionSdkDynamoDbOperations refines AbstractAwsCrypt :- Need(|providerWrappedMaterial| >= EDK_CIPHERTEXT_VERSION_INDEX, E("Incorrect ciphertext structure length.")); var branchKeyVersionUuid := providerWrappedMaterial[EDK_CIPHERTEXT_BRANCH_KEY_VERSION_INDEX .. EDK_CIPHERTEXT_VERSION_INDEX]; var expectedBranchKeyVersion :- UUID.FromByteArray(branchKeyVersionUuid).MapFailure(e => E(e)); - singleDataKeyOutput := EncryptedDataKeyDescriptionOutput( + singleDataKeyOutput := EncryptedDataKeyDescription( keyProviderId := extractedKeyProviderId, keyProviderInfo := Some(extractedKeyProviderIdInfo), branchKeyId := Some(extractedKeyProviderIdInfo), @@ -106,7 +106,7 @@ module AwsCryptographyDbEncryptionSdkDynamoDbOperations refines AbstractAwsCrypt ); } else { - singleDataKeyOutput := EncryptedDataKeyDescriptionOutput( + singleDataKeyOutput := EncryptedDataKeyDescription( keyProviderId := extractedKeyProviderId, keyProviderInfo := Some(extractedKeyProviderIdInfo), branchKeyId := None, diff --git a/DynamoDbEncryption/runtimes/java/src/main/smithy-generated/software/amazon/cryptography/dbencryptionsdk/dynamodb/ToDafny.java b/DynamoDbEncryption/runtimes/java/src/main/smithy-generated/software/amazon/cryptography/dbencryptionsdk/dynamodb/ToDafny.java index d9209b10a..e239d106b 100644 --- a/DynamoDbEncryption/runtimes/java/src/main/smithy-generated/software/amazon/cryptography/dbencryptionsdk/dynamodb/ToDafny.java +++ b/DynamoDbEncryption/runtimes/java/src/main/smithy-generated/software/amazon/cryptography/dbencryptionsdk/dynamodb/ToDafny.java @@ -27,7 +27,7 @@ import software.amazon.cryptography.dbencryptionsdk.dynamodb.internaldafny.types.DynamoDbEncryptionConfig; import software.amazon.cryptography.dbencryptionsdk.dynamodb.internaldafny.types.DynamoDbTableEncryptionConfig; import software.amazon.cryptography.dbencryptionsdk.dynamodb.internaldafny.types.DynamoDbTablesEncryptionConfig; -import software.amazon.cryptography.dbencryptionsdk.dynamodb.internaldafny.types.EncryptedDataKeyDescriptionOutput; +import software.amazon.cryptography.dbencryptionsdk.dynamodb.internaldafny.types.EncryptedDataKeyDescription; import software.amazon.cryptography.dbencryptionsdk.dynamodb.internaldafny.types.EncryptedPart; import software.amazon.cryptography.dbencryptionsdk.dynamodb.internaldafny.types.Error; import software.amazon.cryptography.dbencryptionsdk.dynamodb.internaldafny.types.Error_DynamoDbEncryptionException; @@ -242,8 +242,8 @@ public static DynamoDbTablesEncryptionConfig DynamoDbTablesEncryptionConfig( return new DynamoDbTablesEncryptionConfig(tableEncryptionConfigs); } - public static EncryptedDataKeyDescriptionOutput EncryptedDataKeyDescriptionOutput( - software.amazon.cryptography.dbencryptionsdk.dynamodb.model.EncryptedDataKeyDescriptionOutput nativeValue) { + public static EncryptedDataKeyDescription EncryptedDataKeyDescription( + software.amazon.cryptography.dbencryptionsdk.dynamodb.model.EncryptedDataKeyDescription nativeValue) { DafnySequence keyProviderId; keyProviderId = software.amazon.smithy.dafny.conversion.ToDafny.Simple.CharacterSequence(nativeValue.keyProviderId()); Option> keyProviderInfo; @@ -258,7 +258,7 @@ public static EncryptedDataKeyDescriptionOutput EncryptedDataKeyDescriptionOutpu branchKeyVersion = Objects.nonNull(nativeValue.branchKeyVersion()) ? Option.create_Some(software.amazon.smithy.dafny.conversion.ToDafny.Simple.CharacterSequence(nativeValue.branchKeyVersion())) : Option.create_None(); - return new EncryptedDataKeyDescriptionOutput(keyProviderId, keyProviderInfo, branchKeyId, branchKeyVersion); + return new EncryptedDataKeyDescription(keyProviderId, keyProviderInfo, branchKeyId, branchKeyVersion); } public static EncryptedPart EncryptedPart( @@ -293,7 +293,7 @@ public static GetEncryptedDataKeyDescriptionInput GetEncryptedDataKeyDescription public static GetEncryptedDataKeyDescriptionOutput GetEncryptedDataKeyDescriptionOutput( software.amazon.cryptography.dbencryptionsdk.dynamodb.model.GetEncryptedDataKeyDescriptionOutput nativeValue) { - DafnySequence encryptedDataKeyDescriptionOutput; + DafnySequence encryptedDataKeyDescriptionOutput; encryptedDataKeyDescriptionOutput = ToDafny.EncryptedDataKeyDescriptionList(nativeValue.EncryptedDataKeyDescriptionOutput()); return new GetEncryptedDataKeyDescriptionOutput(encryptedDataKeyDescriptionOutput); } @@ -615,12 +615,12 @@ public static DafnySequence ConstructorPartList( ConstructorPart._typeDescriptor()); } - public static DafnySequence EncryptedDataKeyDescriptionList( - List nativeValue) { + public static DafnySequence EncryptedDataKeyDescriptionList( + List nativeValue) { return software.amazon.smithy.dafny.conversion.ToDafny.Aggregate.GenericToSequence( nativeValue, - software.amazon.cryptography.dbencryptionsdk.dynamodb.ToDafny::EncryptedDataKeyDescriptionOutput, - EncryptedDataKeyDescriptionOutput._typeDescriptor()); + software.amazon.cryptography.dbencryptionsdk.dynamodb.ToDafny::EncryptedDataKeyDescription, + EncryptedDataKeyDescription._typeDescriptor()); } public static DafnySequence EncryptedPartsList( diff --git a/DynamoDbEncryption/runtimes/java/src/main/smithy-generated/software/amazon/cryptography/dbencryptionsdk/dynamodb/ToNative.java b/DynamoDbEncryption/runtimes/java/src/main/smithy-generated/software/amazon/cryptography/dbencryptionsdk/dynamodb/ToNative.java index bd6dff77d..36c0e5507 100644 --- a/DynamoDbEncryption/runtimes/java/src/main/smithy-generated/software/amazon/cryptography/dbencryptionsdk/dynamodb/ToNative.java +++ b/DynamoDbEncryption/runtimes/java/src/main/smithy-generated/software/amazon/cryptography/dbencryptionsdk/dynamodb/ToNative.java @@ -30,7 +30,7 @@ import software.amazon.cryptography.dbencryptionsdk.dynamodb.model.DynamoDbEncryptionException; import software.amazon.cryptography.dbencryptionsdk.dynamodb.model.DynamoDbTableEncryptionConfig; import software.amazon.cryptography.dbencryptionsdk.dynamodb.model.DynamoDbTablesEncryptionConfig; -import software.amazon.cryptography.dbencryptionsdk.dynamodb.model.EncryptedDataKeyDescriptionOutput; +import software.amazon.cryptography.dbencryptionsdk.dynamodb.model.EncryptedDataKeyDescription; import software.amazon.cryptography.dbencryptionsdk.dynamodb.model.EncryptedPart; import software.amazon.cryptography.dbencryptionsdk.dynamodb.model.GetBranchKeyIdFromDdbKeyInput; import software.amazon.cryptography.dbencryptionsdk.dynamodb.model.GetBranchKeyIdFromDdbKeyOutput; @@ -235,9 +235,9 @@ public static DynamoDbTablesEncryptionConfig DynamoDbTablesEncryptionConfig( return nativeBuilder.build(); } - public static EncryptedDataKeyDescriptionOutput EncryptedDataKeyDescriptionOutput( - software.amazon.cryptography.dbencryptionsdk.dynamodb.internaldafny.types.EncryptedDataKeyDescriptionOutput dafnyValue) { - EncryptedDataKeyDescriptionOutput.Builder nativeBuilder = EncryptedDataKeyDescriptionOutput.builder(); + public static EncryptedDataKeyDescription EncryptedDataKeyDescription( + software.amazon.cryptography.dbencryptionsdk.dynamodb.internaldafny.types.EncryptedDataKeyDescription dafnyValue) { + EncryptedDataKeyDescription.Builder nativeBuilder = EncryptedDataKeyDescription.builder(); nativeBuilder.keyProviderId(software.amazon.smithy.dafny.conversion.ToNative.Simple.String(dafnyValue.dtor_keyProviderId())); if (dafnyValue.dtor_keyProviderInfo().is_Some()) { nativeBuilder.keyProviderInfo(software.amazon.smithy.dafny.conversion.ToNative.Simple.String(dafnyValue.dtor_keyProviderInfo().dtor_value())); @@ -575,11 +575,11 @@ public static List ConstructorPartList( software.amazon.cryptography.dbencryptionsdk.dynamodb.ToNative::ConstructorPart); } - public static List EncryptedDataKeyDescriptionList( - DafnySequence dafnyValue) { + public static List EncryptedDataKeyDescriptionList( + DafnySequence dafnyValue) { return software.amazon.smithy.dafny.conversion.ToNative.Aggregate.GenericToList( dafnyValue, - software.amazon.cryptography.dbencryptionsdk.dynamodb.ToNative::EncryptedDataKeyDescriptionOutput); + software.amazon.cryptography.dbencryptionsdk.dynamodb.ToNative::EncryptedDataKeyDescription); } public static List EncryptedPartsList( diff --git a/DynamoDbEncryption/runtimes/java/src/main/smithy-generated/software/amazon/cryptography/dbencryptionsdk/dynamodb/model/EncryptedDataKeyDescription.java b/DynamoDbEncryption/runtimes/java/src/main/smithy-generated/software/amazon/cryptography/dbencryptionsdk/dynamodb/model/EncryptedDataKeyDescription.java new file mode 100644 index 000000000..197489fdf --- /dev/null +++ b/DynamoDbEncryption/runtimes/java/src/main/smithy-generated/software/amazon/cryptography/dbencryptionsdk/dynamodb/model/EncryptedDataKeyDescription.java @@ -0,0 +1,130 @@ +// Copyright Amazon.com Inc. or its affiliates. All Rights Reserved. +// SPDX-License-Identifier: Apache-2.0 +// Do not modify this file. This file is machine generated, and any changes to it will be overwritten. +package software.amazon.cryptography.dbencryptionsdk.dynamodb.model; + +import java.util.Objects; + +public class EncryptedDataKeyDescription { + private final String keyProviderId; + + private final String keyProviderInfo; + + private final String branchKeyId; + + private final String branchKeyVersion; + + protected EncryptedDataKeyDescription(BuilderImpl builder) { + this.keyProviderId = builder.keyProviderId(); + this.keyProviderInfo = builder.keyProviderInfo(); + this.branchKeyId = builder.branchKeyId(); + this.branchKeyVersion = builder.branchKeyVersion(); + } + + public String keyProviderId() { + return this.keyProviderId; + } + + public String keyProviderInfo() { + return this.keyProviderInfo; + } + + public String branchKeyId() { + return this.branchKeyId; + } + + public String branchKeyVersion() { + return this.branchKeyVersion; + } + + public Builder toBuilder() { + return new BuilderImpl(this); + } + + public static Builder builder() { + return new BuilderImpl(); + } + + public interface Builder { + Builder keyProviderId(String keyProviderId); + + String keyProviderId(); + + Builder keyProviderInfo(String keyProviderInfo); + + String keyProviderInfo(); + + Builder branchKeyId(String branchKeyId); + + String branchKeyId(); + + Builder branchKeyVersion(String branchKeyVersion); + + String branchKeyVersion(); + + EncryptedDataKeyDescription build(); + } + + static class BuilderImpl implements Builder { + protected String keyProviderId; + + protected String keyProviderInfo; + + protected String branchKeyId; + + protected String branchKeyVersion; + + protected BuilderImpl() { + } + + protected BuilderImpl(EncryptedDataKeyDescription model) { + this.keyProviderId = model.keyProviderId(); + this.keyProviderInfo = model.keyProviderInfo(); + this.branchKeyId = model.branchKeyId(); + this.branchKeyVersion = model.branchKeyVersion(); + } + + public Builder keyProviderId(String keyProviderId) { + this.keyProviderId = keyProviderId; + return this; + } + + public String keyProviderId() { + return this.keyProviderId; + } + + public Builder keyProviderInfo(String keyProviderInfo) { + this.keyProviderInfo = keyProviderInfo; + return this; + } + + public String keyProviderInfo() { + return this.keyProviderInfo; + } + + public Builder branchKeyId(String branchKeyId) { + this.branchKeyId = branchKeyId; + return this; + } + + public String branchKeyId() { + return this.branchKeyId; + } + + public Builder branchKeyVersion(String branchKeyVersion) { + this.branchKeyVersion = branchKeyVersion; + return this; + } + + public String branchKeyVersion() { + return this.branchKeyVersion; + } + + public EncryptedDataKeyDescription build() { + if (Objects.isNull(this.keyProviderId())) { + throw new IllegalArgumentException("Missing value for required field `keyProviderId`"); + } + return new EncryptedDataKeyDescription(this); + } + } +} diff --git a/DynamoDbEncryption/runtimes/java/src/main/smithy-generated/software/amazon/cryptography/dbencryptionsdk/dynamodb/model/GetEncryptedDataKeyDescriptionOutput.java b/DynamoDbEncryption/runtimes/java/src/main/smithy-generated/software/amazon/cryptography/dbencryptionsdk/dynamodb/model/GetEncryptedDataKeyDescriptionOutput.java index b4ca94f86..2d8e63584 100644 --- a/DynamoDbEncryption/runtimes/java/src/main/smithy-generated/software/amazon/cryptography/dbencryptionsdk/dynamodb/model/GetEncryptedDataKeyDescriptionOutput.java +++ b/DynamoDbEncryption/runtimes/java/src/main/smithy-generated/software/amazon/cryptography/dbencryptionsdk/dynamodb/model/GetEncryptedDataKeyDescriptionOutput.java @@ -7,13 +7,13 @@ import java.util.Objects; public class GetEncryptedDataKeyDescriptionOutput { - private final List EncryptedDataKeyDescriptionOutput; + private final List EncryptedDataKeyDescriptionOutput; protected GetEncryptedDataKeyDescriptionOutput(BuilderImpl builder) { this.EncryptedDataKeyDescriptionOutput = builder.EncryptedDataKeyDescriptionOutput(); } - public List EncryptedDataKeyDescriptionOutput() { + public List EncryptedDataKeyDescriptionOutput() { return this.EncryptedDataKeyDescriptionOutput; } @@ -27,15 +27,15 @@ public static Builder builder() { public interface Builder { Builder EncryptedDataKeyDescriptionOutput( - List EncryptedDataKeyDescriptionOutput); + List EncryptedDataKeyDescriptionOutput); - List EncryptedDataKeyDescriptionOutput(); + List EncryptedDataKeyDescriptionOutput(); GetEncryptedDataKeyDescriptionOutput build(); } static class BuilderImpl implements Builder { - protected List EncryptedDataKeyDescriptionOutput; + protected List EncryptedDataKeyDescriptionOutput; protected BuilderImpl() { } @@ -45,12 +45,12 @@ protected BuilderImpl(GetEncryptedDataKeyDescriptionOutput model) { } public Builder EncryptedDataKeyDescriptionOutput( - List EncryptedDataKeyDescriptionOutput) { + List EncryptedDataKeyDescriptionOutput) { this.EncryptedDataKeyDescriptionOutput = EncryptedDataKeyDescriptionOutput; return this; } - public List EncryptedDataKeyDescriptionOutput() { + public List EncryptedDataKeyDescriptionOutput() { return this.EncryptedDataKeyDescriptionOutput; } diff --git a/DynamoDbEncryption/runtimes/net/Generated/DynamoDbEncryption/EncryptedDataKeyDescription.cs b/DynamoDbEncryption/runtimes/net/Generated/DynamoDbEncryption/EncryptedDataKeyDescription.cs new file mode 100644 index 000000000..33bd04ec5 --- /dev/null +++ b/DynamoDbEncryption/runtimes/net/Generated/DynamoDbEncryption/EncryptedDataKeyDescription.cs @@ -0,0 +1,56 @@ +// Copyright Amazon.com Inc. or its affiliates. All Rights Reserved. +// SPDX-License-Identifier: Apache-2.0 +// Do not modify this file. This file is machine generated, and any changes to it will be overwritten. +using System; +using AWS.Cryptography.DbEncryptionSDK.DynamoDb; +namespace AWS.Cryptography.DbEncryptionSDK.DynamoDb +{ + public class EncryptedDataKeyDescription + { + private string _keyProviderId; + private string _keyProviderInfo; + private string _branchKeyId; + private string _branchKeyVersion; + public string KeyProviderId + { + get { return this._keyProviderId; } + set { this._keyProviderId = value; } + } + public bool IsSetKeyProviderId() + { + return this._keyProviderId != null; + } + public string KeyProviderInfo + { + get { return this._keyProviderInfo; } + set { this._keyProviderInfo = value; } + } + public bool IsSetKeyProviderInfo() + { + return this._keyProviderInfo != null; + } + public string BranchKeyId + { + get { return this._branchKeyId; } + set { this._branchKeyId = value; } + } + public bool IsSetBranchKeyId() + { + return this._branchKeyId != null; + } + public string BranchKeyVersion + { + get { return this._branchKeyVersion; } + set { this._branchKeyVersion = value; } + } + public bool IsSetBranchKeyVersion() + { + return this._branchKeyVersion != null; + } + public void Validate() + { + if (!IsSetKeyProviderId()) throw new System.ArgumentException("Missing value for required property 'KeyProviderId'"); + + } + } +} diff --git a/DynamoDbEncryption/runtimes/net/Generated/DynamoDbEncryption/GetEncryptedDataKeyDescriptionOutput.cs b/DynamoDbEncryption/runtimes/net/Generated/DynamoDbEncryption/GetEncryptedDataKeyDescriptionOutput.cs index 1f75f9ab9..e18046288 100644 --- a/DynamoDbEncryption/runtimes/net/Generated/DynamoDbEncryption/GetEncryptedDataKeyDescriptionOutput.cs +++ b/DynamoDbEncryption/runtimes/net/Generated/DynamoDbEncryption/GetEncryptedDataKeyDescriptionOutput.cs @@ -7,8 +7,8 @@ namespace AWS.Cryptography.DbEncryptionSDK.DynamoDb { public class GetEncryptedDataKeyDescriptionOutput { - private System.Collections.Generic.List _encryptedDataKeyDescriptionOutput; - public System.Collections.Generic.List EncryptedDataKeyDescriptionOutput + private System.Collections.Generic.List _encryptedDataKeyDescriptionOutput; + public System.Collections.Generic.List EncryptedDataKeyDescriptionOutput { get { return this._encryptedDataKeyDescriptionOutput; } set { this._encryptedDataKeyDescriptionOutput = value; } diff --git a/DynamoDbEncryption/runtimes/net/Generated/DynamoDbEncryption/TypeConversion.cs b/DynamoDbEncryption/runtimes/net/Generated/DynamoDbEncryption/TypeConversion.cs index a9ec2594b..3b120405a 100644 --- a/DynamoDbEncryption/runtimes/net/Generated/DynamoDbEncryption/TypeConversion.cs +++ b/DynamoDbEncryption/runtimes/net/Generated/DynamoDbEncryption/TypeConversion.cs @@ -185,7 +185,7 @@ public static software.amazon.cryptography.dbencryptionsdk.dynamodb.internaldafn } public static AWS.Cryptography.DbEncryptionSDK.DynamoDb.GetEncryptedDataKeyDescriptionOutput FromDafny_N3_aws__N12_cryptography__N15_dbEncryptionSdk__N8_dynamoDb__S36_GetEncryptedDataKeyDescriptionOutput(software.amazon.cryptography.dbencryptionsdk.dynamodb.internaldafny.types._IGetEncryptedDataKeyDescriptionOutput value) { - software.amazon.cryptography.dbencryptionsdk.dynamodb.internaldafny.types.GetEncryptedDataKeyDescriptionOutput concrete = (software.amazon.cryptography.dbencryptionsdk.dynamodb.internaldafny.types.GetEncryptedDataKeyDescriptionOutput)value; AWS.Cryptography.DbEncryptionSDK.DynamoDb.GetEncryptedDataKeyDescriptionOutput converted = new AWS.Cryptography.DbEncryptionSDK.DynamoDb.GetEncryptedDataKeyDescriptionOutput(); converted.EncryptedDataKeyDescriptionOutput = (System.Collections.Generic.List)FromDafny_N3_aws__N12_cryptography__N15_dbEncryptionSdk__N8_dynamoDb__S36_GetEncryptedDataKeyDescriptionOutput__M33_EncryptedDataKeyDescriptionOutput(concrete._EncryptedDataKeyDescriptionOutput); return converted; + software.amazon.cryptography.dbencryptionsdk.dynamodb.internaldafny.types.GetEncryptedDataKeyDescriptionOutput concrete = (software.amazon.cryptography.dbencryptionsdk.dynamodb.internaldafny.types.GetEncryptedDataKeyDescriptionOutput)value; AWS.Cryptography.DbEncryptionSDK.DynamoDb.GetEncryptedDataKeyDescriptionOutput converted = new AWS.Cryptography.DbEncryptionSDK.DynamoDb.GetEncryptedDataKeyDescriptionOutput(); converted.EncryptedDataKeyDescriptionOutput = (System.Collections.Generic.List)FromDafny_N3_aws__N12_cryptography__N15_dbEncryptionSdk__N8_dynamoDb__S36_GetEncryptedDataKeyDescriptionOutput__M33_EncryptedDataKeyDescriptionOutput(concrete._EncryptedDataKeyDescriptionOutput); return converted; } public static software.amazon.cryptography.dbencryptionsdk.dynamodb.internaldafny.types._IGetEncryptedDataKeyDescriptionOutput ToDafny_N3_aws__N12_cryptography__N15_dbEncryptionSdk__N8_dynamoDb__S36_GetEncryptedDataKeyDescriptionOutput(AWS.Cryptography.DbEncryptionSDK.DynamoDb.GetEncryptedDataKeyDescriptionOutput value) { @@ -424,11 +424,11 @@ public static software.amazon.cryptography.dbencryptionsdk.dynamodb.internaldafn { return ToDafny_N3_aws__N12_cryptography__N15_dbEncryptionSdk__N8_dynamoDb__S35_GetEncryptedDataKeyDescriptionUnion(value); } - public static System.Collections.Generic.List FromDafny_N3_aws__N12_cryptography__N15_dbEncryptionSdk__N8_dynamoDb__S36_GetEncryptedDataKeyDescriptionOutput__M33_EncryptedDataKeyDescriptionOutput(Dafny.ISequence value) + public static System.Collections.Generic.List FromDafny_N3_aws__N12_cryptography__N15_dbEncryptionSdk__N8_dynamoDb__S36_GetEncryptedDataKeyDescriptionOutput__M33_EncryptedDataKeyDescriptionOutput(Dafny.ISequence value) { return FromDafny_N3_aws__N12_cryptography__N15_dbEncryptionSdk__N8_dynamoDb__S31_EncryptedDataKeyDescriptionList(value); } - public static Dafny.ISequence ToDafny_N3_aws__N12_cryptography__N15_dbEncryptionSdk__N8_dynamoDb__S36_GetEncryptedDataKeyDescriptionOutput__M33_EncryptedDataKeyDescriptionOutput(System.Collections.Generic.List value) + public static Dafny.ISequence ToDafny_N3_aws__N12_cryptography__N15_dbEncryptionSdk__N8_dynamoDb__S36_GetEncryptedDataKeyDescriptionOutput__M33_EncryptedDataKeyDescriptionOutput(System.Collections.Generic.List value) { return ToDafny_N3_aws__N12_cryptography__N15_dbEncryptionSdk__N8_dynamoDb__S31_EncryptedDataKeyDescriptionList(value); } @@ -618,13 +618,13 @@ public static Dafny.ISequence ToDafny_N6_smithy__N3_api__S6_String(string new Dafny.Pair, software.amazon.cryptography.services.dynamodb.internaldafny.types._IAttributeValue>(ToDafny_N3_com__N9_amazonaws__N8_dynamodb__S3_Key__M3_key(pair.Key), ToDafny_N3_com__N9_amazonaws__N8_dynamodb__S3_Key__M5_value(pair.Value)) )); } - public static System.Collections.Generic.List FromDafny_N3_aws__N12_cryptography__N15_dbEncryptionSdk__N8_dynamoDb__S31_EncryptedDataKeyDescriptionList(Dafny.ISequence value) + public static System.Collections.Generic.List FromDafny_N3_aws__N12_cryptography__N15_dbEncryptionSdk__N8_dynamoDb__S31_EncryptedDataKeyDescriptionList(Dafny.ISequence value) { - return new System.Collections.Generic.List(value.Elements.Select(FromDafny_N3_aws__N12_cryptography__N15_dbEncryptionSdk__N8_dynamoDb__S31_EncryptedDataKeyDescriptionList__M6_member)); + return new System.Collections.Generic.List(value.Elements.Select(FromDafny_N3_aws__N12_cryptography__N15_dbEncryptionSdk__N8_dynamoDb__S31_EncryptedDataKeyDescriptionList__M6_member)); } - public static Dafny.ISequence ToDafny_N3_aws__N12_cryptography__N15_dbEncryptionSdk__N8_dynamoDb__S31_EncryptedDataKeyDescriptionList(System.Collections.Generic.List value) + public static Dafny.ISequence ToDafny_N3_aws__N12_cryptography__N15_dbEncryptionSdk__N8_dynamoDb__S31_EncryptedDataKeyDescriptionList(System.Collections.Generic.List value) { - return Dafny.Sequence.FromArray(value.Select(ToDafny_N3_aws__N12_cryptography__N15_dbEncryptionSdk__N8_dynamoDb__S31_EncryptedDataKeyDescriptionList__M6_member).ToArray()); + return Dafny.Sequence.FromArray(value.Select(ToDafny_N3_aws__N12_cryptography__N15_dbEncryptionSdk__N8_dynamoDb__S31_EncryptedDataKeyDescriptionList__M6_member).ToArray()); } public static System.IO.MemoryStream FromDafny_N6_smithy__N3_api__S4_Blob(Dafny.ISequence value) { @@ -792,13 +792,13 @@ public static software.amazon.cryptography.services.dynamodb.internaldafny.types { return ToDafny_N3_com__N9_amazonaws__N8_dynamodb__S14_AttributeValue(value); } - public static AWS.Cryptography.DbEncryptionSDK.DynamoDb.EncryptedDataKeyDescriptionOutput FromDafny_N3_aws__N12_cryptography__N15_dbEncryptionSdk__N8_dynamoDb__S31_EncryptedDataKeyDescriptionList__M6_member(software.amazon.cryptography.dbencryptionsdk.dynamodb.internaldafny.types._IEncryptedDataKeyDescriptionOutput value) + public static AWS.Cryptography.DbEncryptionSDK.DynamoDb.EncryptedDataKeyDescription FromDafny_N3_aws__N12_cryptography__N15_dbEncryptionSdk__N8_dynamoDb__S31_EncryptedDataKeyDescriptionList__M6_member(software.amazon.cryptography.dbencryptionsdk.dynamodb.internaldafny.types._IEncryptedDataKeyDescription value) { - return FromDafny_N3_aws__N12_cryptography__N15_dbEncryptionSdk__N8_dynamoDb__S33_EncryptedDataKeyDescriptionOutput(value); + return FromDafny_N3_aws__N12_cryptography__N15_dbEncryptionSdk__N8_dynamoDb__S27_EncryptedDataKeyDescription(value); } - public static software.amazon.cryptography.dbencryptionsdk.dynamodb.internaldafny.types._IEncryptedDataKeyDescriptionOutput ToDafny_N3_aws__N12_cryptography__N15_dbEncryptionSdk__N8_dynamoDb__S31_EncryptedDataKeyDescriptionList__M6_member(AWS.Cryptography.DbEncryptionSDK.DynamoDb.EncryptedDataKeyDescriptionOutput value) + public static software.amazon.cryptography.dbencryptionsdk.dynamodb.internaldafny.types._IEncryptedDataKeyDescription ToDafny_N3_aws__N12_cryptography__N15_dbEncryptionSdk__N8_dynamoDb__S31_EncryptedDataKeyDescriptionList__M6_member(AWS.Cryptography.DbEncryptionSDK.DynamoDb.EncryptedDataKeyDescription value) { - return ToDafny_N3_aws__N12_cryptography__N15_dbEncryptionSdk__N8_dynamoDb__S33_EncryptedDataKeyDescriptionOutput(value); + return ToDafny_N3_aws__N12_cryptography__N15_dbEncryptionSdk__N8_dynamoDb__S27_EncryptedDataKeyDescription(value); } public static string FromDafny_N3_com__N9_amazonaws__N8_dynamodb__S12_AttributeMap__M3_key(Dafny.ISequence value) { @@ -1065,19 +1065,19 @@ public static software.amazon.cryptography.services.dynamodb.internaldafny.types } throw new System.ArgumentException("Invalid Amazon.DynamoDBv2.Model.AttributeValue state"); } - public static AWS.Cryptography.DbEncryptionSDK.DynamoDb.EncryptedDataKeyDescriptionOutput FromDafny_N3_aws__N12_cryptography__N15_dbEncryptionSdk__N8_dynamoDb__S33_EncryptedDataKeyDescriptionOutput(software.amazon.cryptography.dbencryptionsdk.dynamodb.internaldafny.types._IEncryptedDataKeyDescriptionOutput value) + public static AWS.Cryptography.DbEncryptionSDK.DynamoDb.EncryptedDataKeyDescription FromDafny_N3_aws__N12_cryptography__N15_dbEncryptionSdk__N8_dynamoDb__S27_EncryptedDataKeyDescription(software.amazon.cryptography.dbencryptionsdk.dynamodb.internaldafny.types._IEncryptedDataKeyDescription value) { - software.amazon.cryptography.dbencryptionsdk.dynamodb.internaldafny.types.EncryptedDataKeyDescriptionOutput concrete = (software.amazon.cryptography.dbencryptionsdk.dynamodb.internaldafny.types.EncryptedDataKeyDescriptionOutput)value; AWS.Cryptography.DbEncryptionSDK.DynamoDb.EncryptedDataKeyDescriptionOutput converted = new AWS.Cryptography.DbEncryptionSDK.DynamoDb.EncryptedDataKeyDescriptionOutput(); converted.KeyProviderId = (string)FromDafny_N3_aws__N12_cryptography__N15_dbEncryptionSdk__N8_dynamoDb__S33_EncryptedDataKeyDescriptionOutput__M13_keyProviderId(concrete._keyProviderId); - if (concrete._keyProviderInfo.is_Some) converted.KeyProviderInfo = (string)FromDafny_N3_aws__N12_cryptography__N15_dbEncryptionSdk__N8_dynamoDb__S33_EncryptedDataKeyDescriptionOutput__M15_keyProviderInfo(concrete._keyProviderInfo); - if (concrete._branchKeyId.is_Some) converted.BranchKeyId = (string)FromDafny_N3_aws__N12_cryptography__N15_dbEncryptionSdk__N8_dynamoDb__S33_EncryptedDataKeyDescriptionOutput__M11_branchKeyId(concrete._branchKeyId); - if (concrete._branchKeyVersion.is_Some) converted.BranchKeyVersion = (string)FromDafny_N3_aws__N12_cryptography__N15_dbEncryptionSdk__N8_dynamoDb__S33_EncryptedDataKeyDescriptionOutput__M16_branchKeyVersion(concrete._branchKeyVersion); return converted; + software.amazon.cryptography.dbencryptionsdk.dynamodb.internaldafny.types.EncryptedDataKeyDescription concrete = (software.amazon.cryptography.dbencryptionsdk.dynamodb.internaldafny.types.EncryptedDataKeyDescription)value; AWS.Cryptography.DbEncryptionSDK.DynamoDb.EncryptedDataKeyDescription converted = new AWS.Cryptography.DbEncryptionSDK.DynamoDb.EncryptedDataKeyDescription(); converted.KeyProviderId = (string)FromDafny_N3_aws__N12_cryptography__N15_dbEncryptionSdk__N8_dynamoDb__S27_EncryptedDataKeyDescription__M13_keyProviderId(concrete._keyProviderId); + if (concrete._keyProviderInfo.is_Some) converted.KeyProviderInfo = (string)FromDafny_N3_aws__N12_cryptography__N15_dbEncryptionSdk__N8_dynamoDb__S27_EncryptedDataKeyDescription__M15_keyProviderInfo(concrete._keyProviderInfo); + if (concrete._branchKeyId.is_Some) converted.BranchKeyId = (string)FromDafny_N3_aws__N12_cryptography__N15_dbEncryptionSdk__N8_dynamoDb__S27_EncryptedDataKeyDescription__M11_branchKeyId(concrete._branchKeyId); + if (concrete._branchKeyVersion.is_Some) converted.BranchKeyVersion = (string)FromDafny_N3_aws__N12_cryptography__N15_dbEncryptionSdk__N8_dynamoDb__S27_EncryptedDataKeyDescription__M16_branchKeyVersion(concrete._branchKeyVersion); return converted; } - public static software.amazon.cryptography.dbencryptionsdk.dynamodb.internaldafny.types._IEncryptedDataKeyDescriptionOutput ToDafny_N3_aws__N12_cryptography__N15_dbEncryptionSdk__N8_dynamoDb__S33_EncryptedDataKeyDescriptionOutput(AWS.Cryptography.DbEncryptionSDK.DynamoDb.EncryptedDataKeyDescriptionOutput value) + public static software.amazon.cryptography.dbencryptionsdk.dynamodb.internaldafny.types._IEncryptedDataKeyDescription ToDafny_N3_aws__N12_cryptography__N15_dbEncryptionSdk__N8_dynamoDb__S27_EncryptedDataKeyDescription(AWS.Cryptography.DbEncryptionSDK.DynamoDb.EncryptedDataKeyDescription value) { string var_keyProviderInfo = value.IsSetKeyProviderInfo() ? value.KeyProviderInfo : (string)null; string var_branchKeyId = value.IsSetBranchKeyId() ? value.BranchKeyId : (string)null; string var_branchKeyVersion = value.IsSetBranchKeyVersion() ? value.BranchKeyVersion : (string)null; - return new software.amazon.cryptography.dbencryptionsdk.dynamodb.internaldafny.types.EncryptedDataKeyDescriptionOutput(ToDafny_N3_aws__N12_cryptography__N15_dbEncryptionSdk__N8_dynamoDb__S33_EncryptedDataKeyDescriptionOutput__M13_keyProviderId(value.KeyProviderId), ToDafny_N3_aws__N12_cryptography__N15_dbEncryptionSdk__N8_dynamoDb__S33_EncryptedDataKeyDescriptionOutput__M15_keyProviderInfo(var_keyProviderInfo), ToDafny_N3_aws__N12_cryptography__N15_dbEncryptionSdk__N8_dynamoDb__S33_EncryptedDataKeyDescriptionOutput__M11_branchKeyId(var_branchKeyId), ToDafny_N3_aws__N12_cryptography__N15_dbEncryptionSdk__N8_dynamoDb__S33_EncryptedDataKeyDescriptionOutput__M16_branchKeyVersion(var_branchKeyVersion)); + return new software.amazon.cryptography.dbencryptionsdk.dynamodb.internaldafny.types.EncryptedDataKeyDescription(ToDafny_N3_aws__N12_cryptography__N15_dbEncryptionSdk__N8_dynamoDb__S27_EncryptedDataKeyDescription__M13_keyProviderId(value.KeyProviderId), ToDafny_N3_aws__N12_cryptography__N15_dbEncryptionSdk__N8_dynamoDb__S27_EncryptedDataKeyDescription__M15_keyProviderInfo(var_keyProviderInfo), ToDafny_N3_aws__N12_cryptography__N15_dbEncryptionSdk__N8_dynamoDb__S27_EncryptedDataKeyDescription__M11_branchKeyId(var_branchKeyId), ToDafny_N3_aws__N12_cryptography__N15_dbEncryptionSdk__N8_dynamoDb__S27_EncryptedDataKeyDescription__M16_branchKeyVersion(var_branchKeyVersion)); } public static string FromDafny_N3_aws__N12_cryptography__N15_dbEncryptionSdk__N8_dynamoDb__S4_Char(Dafny.ISequence value) { @@ -1207,35 +1207,35 @@ public static bool ToDafny_N3_com__N9_amazonaws__N8_dynamodb__S14_AttributeValue { return ToDafny_N3_com__N9_amazonaws__N8_dynamodb__S21_BooleanAttributeValue(value); } - public static string FromDafny_N3_aws__N12_cryptography__N15_dbEncryptionSdk__N8_dynamoDb__S33_EncryptedDataKeyDescriptionOutput__M13_keyProviderId(Dafny.ISequence value) + public static string FromDafny_N3_aws__N12_cryptography__N15_dbEncryptionSdk__N8_dynamoDb__S27_EncryptedDataKeyDescription__M13_keyProviderId(Dafny.ISequence value) { return FromDafny_N6_smithy__N3_api__S6_String(value); } - public static Dafny.ISequence ToDafny_N3_aws__N12_cryptography__N15_dbEncryptionSdk__N8_dynamoDb__S33_EncryptedDataKeyDescriptionOutput__M13_keyProviderId(string value) + public static Dafny.ISequence ToDafny_N3_aws__N12_cryptography__N15_dbEncryptionSdk__N8_dynamoDb__S27_EncryptedDataKeyDescription__M13_keyProviderId(string value) { return ToDafny_N6_smithy__N3_api__S6_String(value); } - public static string FromDafny_N3_aws__N12_cryptography__N15_dbEncryptionSdk__N8_dynamoDb__S33_EncryptedDataKeyDescriptionOutput__M15_keyProviderInfo(Wrappers_Compile._IOption> value) + public static string FromDafny_N3_aws__N12_cryptography__N15_dbEncryptionSdk__N8_dynamoDb__S27_EncryptedDataKeyDescription__M15_keyProviderInfo(Wrappers_Compile._IOption> value) { return value.is_None ? (string)null : FromDafny_N6_smithy__N3_api__S6_String(value.Extract()); } - public static Wrappers_Compile._IOption> ToDafny_N3_aws__N12_cryptography__N15_dbEncryptionSdk__N8_dynamoDb__S33_EncryptedDataKeyDescriptionOutput__M15_keyProviderInfo(string value) + public static Wrappers_Compile._IOption> ToDafny_N3_aws__N12_cryptography__N15_dbEncryptionSdk__N8_dynamoDb__S27_EncryptedDataKeyDescription__M15_keyProviderInfo(string value) { return value == null ? Wrappers_Compile.Option>.create_None() : Wrappers_Compile.Option>.create_Some(ToDafny_N6_smithy__N3_api__S6_String((string)value)); } - public static string FromDafny_N3_aws__N12_cryptography__N15_dbEncryptionSdk__N8_dynamoDb__S33_EncryptedDataKeyDescriptionOutput__M11_branchKeyId(Wrappers_Compile._IOption> value) + public static string FromDafny_N3_aws__N12_cryptography__N15_dbEncryptionSdk__N8_dynamoDb__S27_EncryptedDataKeyDescription__M11_branchKeyId(Wrappers_Compile._IOption> value) { return value.is_None ? (string)null : FromDafny_N6_smithy__N3_api__S6_String(value.Extract()); } - public static Wrappers_Compile._IOption> ToDafny_N3_aws__N12_cryptography__N15_dbEncryptionSdk__N8_dynamoDb__S33_EncryptedDataKeyDescriptionOutput__M11_branchKeyId(string value) + public static Wrappers_Compile._IOption> ToDafny_N3_aws__N12_cryptography__N15_dbEncryptionSdk__N8_dynamoDb__S27_EncryptedDataKeyDescription__M11_branchKeyId(string value) { return value == null ? Wrappers_Compile.Option>.create_None() : Wrappers_Compile.Option>.create_Some(ToDafny_N6_smithy__N3_api__S6_String((string)value)); } - public static string FromDafny_N3_aws__N12_cryptography__N15_dbEncryptionSdk__N8_dynamoDb__S33_EncryptedDataKeyDescriptionOutput__M16_branchKeyVersion(Wrappers_Compile._IOption> value) + public static string FromDafny_N3_aws__N12_cryptography__N15_dbEncryptionSdk__N8_dynamoDb__S27_EncryptedDataKeyDescription__M16_branchKeyVersion(Wrappers_Compile._IOption> value) { return value.is_None ? (string)null : FromDafny_N6_smithy__N3_api__S6_String(value.Extract()); } - public static Wrappers_Compile._IOption> ToDafny_N3_aws__N12_cryptography__N15_dbEncryptionSdk__N8_dynamoDb__S33_EncryptedDataKeyDescriptionOutput__M16_branchKeyVersion(string value) + public static Wrappers_Compile._IOption> ToDafny_N3_aws__N12_cryptography__N15_dbEncryptionSdk__N8_dynamoDb__S27_EncryptedDataKeyDescription__M16_branchKeyVersion(string value) { return value == null ? Wrappers_Compile.Option>.create_None() : Wrappers_Compile.Option>.create_Some(ToDafny_N6_smithy__N3_api__S6_String((string)value)); } diff --git a/DynamoDbEncryption/runtimes/net/Generated/DynamoDbEncryptionTransforms/TypeConversion.cs b/DynamoDbEncryption/runtimes/net/Generated/DynamoDbEncryptionTransforms/TypeConversion.cs index 3738d55d6..4199f2a41 100644 --- a/DynamoDbEncryption/runtimes/net/Generated/DynamoDbEncryptionTransforms/TypeConversion.cs +++ b/DynamoDbEncryption/runtimes/net/Generated/DynamoDbEncryptionTransforms/TypeConversion.cs @@ -6485,14 +6485,6 @@ public static System.Exception FromDafny_CommonError(software.amazon.cryptograph { switch (value) { - case software.amazon.cryptography.dbencryptionsdk.dynamodb.transforms.internaldafny.types.Error_AwsCryptographyDbEncryptionSdkDynamoDb dafnyVal: - return AWS.Cryptography.DbEncryptionSDK.DynamoDb.TypeConversion.FromDafny_CommonError( - dafnyVal._AwsCryptographyDbEncryptionSdkDynamoDb - ); - case software.amazon.cryptography.dbencryptionsdk.dynamodb.transforms.internaldafny.types.Error_AwsCryptographyDbEncryptionSdkStructuredEncryption dafnyVal: - return AWS.Cryptography.DbEncryptionSDK.StructuredEncryption.TypeConversion.FromDafny_CommonError( - dafnyVal._AwsCryptographyDbEncryptionSdkStructuredEncryption - ); case software.amazon.cryptography.dbencryptionsdk.dynamodb.transforms.internaldafny.types.Error_ComAmazonawsDynamodb dafnyVal: return Com.Amazonaws.Dynamodb.TypeConversion.FromDafny_CommonError( dafnyVal._ComAmazonawsDynamodb @@ -6501,6 +6493,14 @@ public static System.Exception FromDafny_CommonError(software.amazon.cryptograph return AWS.Cryptography.DbEncryptionSDK.DynamoDb.ItemEncryptor.TypeConversion.FromDafny_CommonError( dafnyVal._AwsCryptographyDbEncryptionSdkDynamoDbItemEncryptor ); + case software.amazon.cryptography.dbencryptionsdk.dynamodb.transforms.internaldafny.types.Error_AwsCryptographyDbEncryptionSdkStructuredEncryption dafnyVal: + return AWS.Cryptography.DbEncryptionSDK.StructuredEncryption.TypeConversion.FromDafny_CommonError( + dafnyVal._AwsCryptographyDbEncryptionSdkStructuredEncryption + ); + case software.amazon.cryptography.dbencryptionsdk.dynamodb.transforms.internaldafny.types.Error_AwsCryptographyDbEncryptionSdkDynamoDb dafnyVal: + return AWS.Cryptography.DbEncryptionSDK.DynamoDb.TypeConversion.FromDafny_CommonError( + dafnyVal._AwsCryptographyDbEncryptionSdkDynamoDb + ); case software.amazon.cryptography.dbencryptionsdk.dynamodb.transforms.internaldafny.types.Error_AwsCryptographyMaterialProviders dafnyVal: return AWS.Cryptography.MaterialProviders.TypeConversion.FromDafny_CommonError( dafnyVal._AwsCryptographyMaterialProviders diff --git a/DynamoDbEncryption/runtimes/net/Generated/DynamoDbItemEncryptor/TypeConversion.cs b/DynamoDbEncryption/runtimes/net/Generated/DynamoDbItemEncryptor/TypeConversion.cs index 2fea0d004..dca9919f5 100644 --- a/DynamoDbEncryption/runtimes/net/Generated/DynamoDbItemEncryptor/TypeConversion.cs +++ b/DynamoDbEncryption/runtimes/net/Generated/DynamoDbItemEncryptor/TypeConversion.cs @@ -952,25 +952,25 @@ public static System.Exception FromDafny_CommonError(software.amazon.cryptograph { switch (value) { - case software.amazon.cryptography.dbencryptionsdk.dynamodb.itemencryptor.internaldafny.types.Error_AwsCryptographyMaterialProviders dafnyVal: - return AWS.Cryptography.MaterialProviders.TypeConversion.FromDafny_CommonError( - dafnyVal._AwsCryptographyMaterialProviders - ); - case software.amazon.cryptography.dbencryptionsdk.dynamodb.itemencryptor.internaldafny.types.Error_AwsCryptographyDbEncryptionSdkStructuredEncryption dafnyVal: - return AWS.Cryptography.DbEncryptionSDK.StructuredEncryption.TypeConversion.FromDafny_CommonError( - dafnyVal._AwsCryptographyDbEncryptionSdkStructuredEncryption - ); case software.amazon.cryptography.dbencryptionsdk.dynamodb.itemencryptor.internaldafny.types.Error_AwsCryptographyDbEncryptionSdkDynamoDb dafnyVal: return AWS.Cryptography.DbEncryptionSDK.DynamoDb.TypeConversion.FromDafny_CommonError( dafnyVal._AwsCryptographyDbEncryptionSdkDynamoDb ); + case software.amazon.cryptography.dbencryptionsdk.dynamodb.itemencryptor.internaldafny.types.Error_ComAmazonawsDynamodb dafnyVal: + return Com.Amazonaws.Dynamodb.TypeConversion.FromDafny_CommonError( + dafnyVal._ComAmazonawsDynamodb + ); + case software.amazon.cryptography.dbencryptionsdk.dynamodb.itemencryptor.internaldafny.types.Error_AwsCryptographyMaterialProviders dafnyVal: + return AWS.Cryptography.MaterialProviders.TypeConversion.FromDafny_CommonError( + dafnyVal._AwsCryptographyMaterialProviders + ); case software.amazon.cryptography.dbencryptionsdk.dynamodb.itemencryptor.internaldafny.types.Error_AwsCryptographyPrimitives dafnyVal: return AWS.Cryptography.Primitives.TypeConversion.FromDafny_CommonError( dafnyVal._AwsCryptographyPrimitives ); - case software.amazon.cryptography.dbencryptionsdk.dynamodb.itemencryptor.internaldafny.types.Error_ComAmazonawsDynamodb dafnyVal: - return Com.Amazonaws.Dynamodb.TypeConversion.FromDafny_CommonError( - dafnyVal._ComAmazonawsDynamodb + case software.amazon.cryptography.dbencryptionsdk.dynamodb.itemencryptor.internaldafny.types.Error_AwsCryptographyDbEncryptionSdkStructuredEncryption dafnyVal: + return AWS.Cryptography.DbEncryptionSDK.StructuredEncryption.TypeConversion.FromDafny_CommonError( + dafnyVal._AwsCryptographyDbEncryptionSdkStructuredEncryption ); case software.amazon.cryptography.dbencryptionsdk.dynamodb.itemencryptor.internaldafny.types.Error_DynamoDbItemEncryptorException dafnyVal: return FromDafny_N3_aws__N12_cryptography__N15_dbEncryptionSdk__N8_dynamoDb__N13_itemEncryptor__S30_DynamoDbItemEncryptorException(dafnyVal); diff --git a/DynamoDbEncryption/runtimes/net/Generated/StructuredEncryption/TypeConversion.cs b/DynamoDbEncryption/runtimes/net/Generated/StructuredEncryption/TypeConversion.cs index b352a6ed0..e83e3b2e6 100644 --- a/DynamoDbEncryption/runtimes/net/Generated/StructuredEncryption/TypeConversion.cs +++ b/DynamoDbEncryption/runtimes/net/Generated/StructuredEncryption/TypeConversion.cs @@ -921,14 +921,14 @@ public static System.Exception FromDafny_CommonError(software.amazon.cryptograph { switch (value) { - case software.amazon.cryptography.dbencryptionsdk.structuredencryption.internaldafny.types.Error_AwsCryptographyMaterialProviders dafnyVal: - return AWS.Cryptography.MaterialProviders.TypeConversion.FromDafny_CommonError( - dafnyVal._AwsCryptographyMaterialProviders - ); case software.amazon.cryptography.dbencryptionsdk.structuredencryption.internaldafny.types.Error_AwsCryptographyPrimitives dafnyVal: return AWS.Cryptography.Primitives.TypeConversion.FromDafny_CommonError( dafnyVal._AwsCryptographyPrimitives ); + case software.amazon.cryptography.dbencryptionsdk.structuredencryption.internaldafny.types.Error_AwsCryptographyMaterialProviders dafnyVal: + return AWS.Cryptography.MaterialProviders.TypeConversion.FromDafny_CommonError( + dafnyVal._AwsCryptographyMaterialProviders + ); case software.amazon.cryptography.dbencryptionsdk.structuredencryption.internaldafny.types.Error_StructuredEncryptionException dafnyVal: return FromDafny_N3_aws__N12_cryptography__N15_dbEncryptionSdk__N20_structuredEncryption__S29_StructuredEncryptionException(dafnyVal); case software.amazon.cryptography.dbencryptionsdk.structuredencryption.internaldafny.types.Error_CollectionOfErrors dafnyVal: From 6f6d384c8936433fdcbd6d9ce2477970fdac5cf8 Mon Sep 17 00:00:00 2001 From: rishav-karanjit Date: Wed, 10 Apr 2024 13:56:48 -0700 Subject: [PATCH 52/67] Update specification --- .../ddb-get-encrypted-data-key-description.md | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/specification/dynamodb-encryption-client/ddb-get-encrypted-data-key-description.md b/specification/dynamodb-encryption-client/ddb-get-encrypted-data-key-description.md index fb78e9f37..5737cd2c9 100644 --- a/specification/dynamodb-encryption-client/ddb-get-encrypted-data-key-description.md +++ b/specification/dynamodb-encryption-client/ddb-get-encrypted-data-key-description.md @@ -17,7 +17,7 @@ This operation MUST take in either of the following: ### Output -This operation MUST return a list of following: +This operation MUST return the following: - [keyProviderId](https://github.com/aws/aws-database-encryption-sdk-dynamodb/blob/main/specification/structured-encryption/header.md#key-provider-id) - [keyProviderInfo](https://github.com/aws/aws-database-encryption-sdk-dynamodb/blob/main/specification/structured-encryption/header.md#key-provider-information) (only for AWS Cryptographic Materials Provider Keyring) @@ -26,9 +26,8 @@ This operation MUST return a list of following: ### Behavior -This operation should behave in following ways: - - The operation MUST NEVER DECRYPT the Data Keys. +- The operation MUST NOT access the network in any way. - If the input is a encrypted DynamoDB item, it MUST attempt to extract "aws_dbe_head" attribute from the DynamoDB item to get binary header. - This operation MUST deserialize the header bytes according to the header format. - This operation MUST extract the Format Flavor from the deserialize header. Format Flavor is used to identify the algorithm suite. From d01a4320d240b450d36959418b04f14a388174a9 Mon Sep 17 00:00:00 2001 From: rishav-karanjit Date: Wed, 10 Apr 2024 14:13:44 -0700 Subject: [PATCH 53/67] Add duvet annotation --- .../Model/DynamoDbEncryption.smithy | 9 ++++++++ ...raphyDbEncryptionSdkDynamoDbOperations.dfy | 21 +++++++++++++------ 2 files changed, 24 insertions(+), 6 deletions(-) diff --git a/DynamoDbEncryption/dafny/DynamoDbEncryption/Model/DynamoDbEncryption.smithy b/DynamoDbEncryption/dafny/DynamoDbEncryption/Model/DynamoDbEncryption.smithy index 86013d289..2a76db395 100644 --- a/DynamoDbEncryption/dafny/DynamoDbEncryption/Model/DynamoDbEncryption.smithy +++ b/DynamoDbEncryption/dafny/DynamoDbEncryption/Model/DynamoDbEncryption.smithy @@ -59,6 +59,7 @@ structure GetEncryptedDataKeyDescriptionInput { } //= specification/dynamodb-encryption-client/ddb-get-encrypted-data-key-description.md#input +//= type=implication //# This operation MUST take in either of the following: //# - A binary [header](https://github.com/aws/aws-database-encryption-sdk-dynamodb/blob/main/specification/structured-encryption/header.md) //# - A [encrypted DynamoDB item](https://github.com/aws/aws-database-encryption-sdk-dynamodb/blob/ff9f08a355a20c81540e4ca652e09aaeffe90c4b/specification/dynamodb-encryption-client/encrypt-item.md#encrypted-dynamodb-item) @@ -77,6 +78,14 @@ list EncryptedDataKeyDescriptionList { member: EncryptedDataKeyDescription } +//= specification/dynamodb-encryption-client/ddb-get-encrypted-data-key-description.md#output +//= type=implication +//# This operation MUST return the following: +//# - [keyProviderId](https://github.com/aws/aws-database-encryption-sdk-dynamodb/blob/main/specification/structured-encryption/header.md#key-provider-id) +//#- [keyProviderInfo](https://github.com/aws/aws-database-encryption-sdk-dynamodb/blob/main/specification/structured-encryption/header.md#key-provider-information) (only for AWS Cryptographic Materials Provider Keyring) +//#- [branchKeyId](https://github.com/aws/aws-database-encryption-sdk-dynamodb/blob/main/specification/structured-encryption/header.md#key-provider-information) (only for hierarchy keyring) +//#- [branchKeyVersion](https://github.com/aws/aws-database-encryption-sdk-dynamodb/blob/main/specification/structured-encryption/header.md#key-provider-information) (only for hierarchy keyring) + structure EncryptedDataKeyDescription { @required keyProviderId: String, diff --git a/DynamoDbEncryption/dafny/DynamoDbEncryption/src/AwsCryptographyDbEncryptionSdkDynamoDbOperations.dfy b/DynamoDbEncryption/dafny/DynamoDbEncryption/src/AwsCryptographyDbEncryptionSdkDynamoDbOperations.dfy index ba9f6c713..20d1ef2ce 100644 --- a/DynamoDbEncryption/dafny/DynamoDbEncryption/src/AwsCryptographyDbEncryptionSdkDynamoDbOperations.dfy +++ b/DynamoDbEncryption/dafny/DynamoDbEncryption/src/AwsCryptographyDbEncryptionSdkDynamoDbOperations.dfy @@ -52,6 +52,9 @@ module AwsCryptographyDbEncryptionSdkDynamoDbOperations refines AbstractAwsCrypt var header; match input.input { + //= specification/dynamodb-encryption-client/ddb-get-encrypted-data-key-description.md#behavior + //= type=implication + //# - If the input is a encrypted DynamoDB item, it MUST attempt to extract "aws_dbe_head" attribute from the DynamoDB item to get binary header. case plaintextItem(plainTextItem) =>{ :- Need("aws_dbe_head" in plainTextItem && plainTextItem["aws_dbe_head"].B?, E("Header not found in the DynamoDB item.")); header := plainTextItem["aws_dbe_head"].B; @@ -59,9 +62,18 @@ module AwsCryptographyDbEncryptionSdkDynamoDbOperations refines AbstractAwsCrypt case header(headerItem) => header := headerItem; } + //= specification/dynamodb-encryption-client/ddb-get-encrypted-data-key-description.md#behavior + //= type=implication + //# - This operation MUST deserialize the header bytes according to the header format. var deserializedHeader :- Header.PartialDeserialize(header).MapFailure(e => AwsCryptographyDbEncryptionSdkStructuredEncryption(e)); + //= specification/dynamodb-encryption-client/ddb-get-encrypted-data-key-description.md#behavior + //= type=implication + //# - This operation MUST extract the dataKeys from the deserialize header. var datakeys := deserializedHeader.dataKeys; var list : EncryptedDataKeyDescriptionList := []; + //= specification/dynamodb-encryption-client/ddb-get-encrypted-data-key-description.md#behavior + //= type=implication + //# - For every Data Key in Data Keys, the operation MUST attempt to extract a description of the Data Key. for i := 0 to |datakeys| { var singleDataKeyOutput : EncryptedDataKeyDescription; var extractedKeyProviderId :- UTF8.Decode(datakeys[i].keyProviderId).MapFailure(e => E(e)); @@ -74,10 +86,11 @@ module AwsCryptographyDbEncryptionSdkDynamoDbOperations refines AbstractAwsCrypt ); } - // Format flavor is either 0 or 1 - // https://github.com/aws/aws-database-encryption-sdk-dynamodb/blob/main/specification/structured-encryption/header.md#format-flavor :- Need(deserializedHeader.flavor == 0 || deserializedHeader.flavor == 1, E("Invalid format flavor.")); var algorithmSuite; + //= specification/dynamodb-encryption-client/ddb-get-encrypted-data-key-description.md#behavior + //= type=implication + //# - This operation MUST extract the Format Flavor from the deserialize header. if deserializedHeader.flavor == 0{ algorithmSuite := AlgorithmSuites.DBE_ALG_AES_256_GCM_HKDF_SHA512_COMMIT_KEY_SYMSIG_HMAC_SHA384; } else { @@ -88,10 +101,6 @@ module AwsCryptographyDbEncryptionSdkDynamoDbOperations refines AbstractAwsCrypt if extractedKeyProviderId == "aws-kms-hierarchy" { var providerWrappedMaterial :- EdkWrapping.GetProviderWrappedMaterial(datakeys[i].ciphertext, algorithmSuite).MapFailure(e => AwsCryptographyMaterialProviders(e)); - - // The ciphertext structure in the hierarchy keyring contains Salt and IV before Version. - // The length of Salt is 16 and IV is 12 bytes. The length of Version is 16 bytes. - // https://github.com/awslabs/aws-encryption-sdk-specification/blob/master/framework/aws-kms/aws-kms-hierarchical-keyring.md#ciphertext var EDK_CIPHERTEXT_BRANCH_KEY_VERSION_INDEX := SALT_LENGTH + IV_LENGTH; var EDK_CIPHERTEXT_VERSION_INDEX := EDK_CIPHERTEXT_BRANCH_KEY_VERSION_INDEX + VERSION_LENGTH; :- Need(EDK_CIPHERTEXT_BRANCH_KEY_VERSION_INDEX < EDK_CIPHERTEXT_VERSION_INDEX, E("Wrong branch key version index.")); From af315641d4d1228c8f0bed11bd773e2144da4927 Mon Sep 17 00:00:00 2001 From: rishav-karanjit Date: Wed, 10 Apr 2024 16:11:44 -0700 Subject: [PATCH 54/67] put flavor extracting concept inside else block --- ...raphyDbEncryptionSdkDynamoDbOperations.dfy | 69 ++++++++++--------- 1 file changed, 35 insertions(+), 34 deletions(-) diff --git a/DynamoDbEncryption/dafny/DynamoDbEncryption/src/AwsCryptographyDbEncryptionSdkDynamoDbOperations.dfy b/DynamoDbEncryption/dafny/DynamoDbEncryption/src/AwsCryptographyDbEncryptionSdkDynamoDbOperations.dfy index 20d1ef2ce..df28daede 100644 --- a/DynamoDbEncryption/dafny/DynamoDbEncryption/src/AwsCryptographyDbEncryptionSdkDynamoDbOperations.dfy +++ b/DynamoDbEncryption/dafny/DynamoDbEncryption/src/AwsCryptographyDbEncryptionSdkDynamoDbOperations.dfy @@ -85,42 +85,43 @@ module AwsCryptographyDbEncryptionSdkDynamoDbOperations refines AbstractAwsCrypt branchKeyVersion := None ); } + else { + :- Need(deserializedHeader.flavor == 0 || deserializedHeader.flavor == 1, E("Invalid format flavor.")); + var algorithmSuite; + //= specification/dynamodb-encryption-client/ddb-get-encrypted-data-key-description.md#behavior + //= type=implication + //# - This operation MUST extract the Format Flavor from the deserialize header. + if deserializedHeader.flavor == 0{ + algorithmSuite := AlgorithmSuites.DBE_ALG_AES_256_GCM_HKDF_SHA512_COMMIT_KEY_SYMSIG_HMAC_SHA384; + } else { + algorithmSuite := AlgorithmSuites.DBE_ALG_AES_256_GCM_HKDF_SHA512_COMMIT_KEY_ECDSA_P384_SYMSIG_HMAC_SHA384; + } - :- Need(deserializedHeader.flavor == 0 || deserializedHeader.flavor == 1, E("Invalid format flavor.")); - var algorithmSuite; - //= specification/dynamodb-encryption-client/ddb-get-encrypted-data-key-description.md#behavior - //= type=implication - //# - This operation MUST extract the Format Flavor from the deserialize header. - if deserializedHeader.flavor == 0{ - algorithmSuite := AlgorithmSuites.DBE_ALG_AES_256_GCM_HKDF_SHA512_COMMIT_KEY_SYMSIG_HMAC_SHA384; - } else { - algorithmSuite := AlgorithmSuites.DBE_ALG_AES_256_GCM_HKDF_SHA512_COMMIT_KEY_ECDSA_P384_SYMSIG_HMAC_SHA384; - } - - var extractedKeyProviderIdInfo :- UTF8.Decode(datakeys[i].keyProviderInfo).MapFailure(e => E(e)); + var extractedKeyProviderIdInfo :- UTF8.Decode(datakeys[i].keyProviderInfo).MapFailure(e => E(e)); - if extractedKeyProviderId == "aws-kms-hierarchy" { - var providerWrappedMaterial :- EdkWrapping.GetProviderWrappedMaterial(datakeys[i].ciphertext, algorithmSuite).MapFailure(e => AwsCryptographyMaterialProviders(e)); - var EDK_CIPHERTEXT_BRANCH_KEY_VERSION_INDEX := SALT_LENGTH + IV_LENGTH; - var EDK_CIPHERTEXT_VERSION_INDEX := EDK_CIPHERTEXT_BRANCH_KEY_VERSION_INDEX + VERSION_LENGTH; - :- Need(EDK_CIPHERTEXT_BRANCH_KEY_VERSION_INDEX < EDK_CIPHERTEXT_VERSION_INDEX, E("Wrong branch key version index.")); - :- Need(|providerWrappedMaterial| >= EDK_CIPHERTEXT_VERSION_INDEX, E("Incorrect ciphertext structure length.")); - var branchKeyVersionUuid := providerWrappedMaterial[EDK_CIPHERTEXT_BRANCH_KEY_VERSION_INDEX .. EDK_CIPHERTEXT_VERSION_INDEX]; - var expectedBranchKeyVersion :- UUID.FromByteArray(branchKeyVersionUuid).MapFailure(e => E(e)); - singleDataKeyOutput := EncryptedDataKeyDescription( - keyProviderId := extractedKeyProviderId, - keyProviderInfo := Some(extractedKeyProviderIdInfo), - branchKeyId := Some(extractedKeyProviderIdInfo), - branchKeyVersion := Some(expectedBranchKeyVersion) - ); - } - else { - singleDataKeyOutput := EncryptedDataKeyDescription( - keyProviderId := extractedKeyProviderId, - keyProviderInfo := Some(extractedKeyProviderIdInfo), - branchKeyId := None, - branchKeyVersion := None - ); + if extractedKeyProviderId == "aws-kms-hierarchy" { + var providerWrappedMaterial :- EdkWrapping.GetProviderWrappedMaterial(datakeys[i].ciphertext, algorithmSuite).MapFailure(e => AwsCryptographyMaterialProviders(e)); + var EDK_CIPHERTEXT_BRANCH_KEY_VERSION_INDEX := SALT_LENGTH + IV_LENGTH; + var EDK_CIPHERTEXT_VERSION_INDEX := EDK_CIPHERTEXT_BRANCH_KEY_VERSION_INDEX + VERSION_LENGTH; + :- Need(EDK_CIPHERTEXT_BRANCH_KEY_VERSION_INDEX < EDK_CIPHERTEXT_VERSION_INDEX, E("Wrong branch key version index.")); + :- Need(|providerWrappedMaterial| >= EDK_CIPHERTEXT_VERSION_INDEX, E("Incorrect ciphertext structure length.")); + var branchKeyVersionUuid := providerWrappedMaterial[EDK_CIPHERTEXT_BRANCH_KEY_VERSION_INDEX .. EDK_CIPHERTEXT_VERSION_INDEX]; + var expectedBranchKeyVersion :- UUID.FromByteArray(branchKeyVersionUuid).MapFailure(e => E(e)); + singleDataKeyOutput := EncryptedDataKeyDescription( + keyProviderId := extractedKeyProviderId, + keyProviderInfo := Some(extractedKeyProviderIdInfo), + branchKeyId := Some(extractedKeyProviderIdInfo), + branchKeyVersion := Some(expectedBranchKeyVersion) + ); + } + else { + singleDataKeyOutput := EncryptedDataKeyDescription( + keyProviderId := extractedKeyProviderId, + keyProviderInfo := Some(extractedKeyProviderIdInfo), + branchKeyId := None, + branchKeyVersion := None + ); + } } list := list + [singleDataKeyOutput]; } From 23d94d1ee417f65d70340fe9ea5424dfc887a054 Mon Sep 17 00:00:00 2001 From: rishav-karanjit Date: Wed, 10 Apr 2024 22:32:18 -0700 Subject: [PATCH 55/67] change < to <= --- ...raphyDbEncryptionSdkDynamoDbOperations.dfy | 41 ++++++------------- ...moDbGetEncryptedDataKeyDescriptionTest.dfy | 6 --- 2 files changed, 13 insertions(+), 34 deletions(-) diff --git a/DynamoDbEncryption/dafny/DynamoDbEncryption/src/AwsCryptographyDbEncryptionSdkDynamoDbOperations.dfy b/DynamoDbEncryption/dafny/DynamoDbEncryption/src/AwsCryptographyDbEncryptionSdkDynamoDbOperations.dfy index df28daede..e2e07bb0a 100644 --- a/DynamoDbEncryption/dafny/DynamoDbEncryption/src/AwsCryptographyDbEncryptionSdkDynamoDbOperations.dfy +++ b/DynamoDbEncryption/dafny/DynamoDbEncryption/src/AwsCryptographyDbEncryptionSdkDynamoDbOperations.dfy @@ -75,17 +75,10 @@ module AwsCryptographyDbEncryptionSdkDynamoDbOperations refines AbstractAwsCrypt //= type=implication //# - For every Data Key in Data Keys, the operation MUST attempt to extract a description of the Data Key. for i := 0 to |datakeys| { - var singleDataKeyOutput : EncryptedDataKeyDescription; var extractedKeyProviderId :- UTF8.Decode(datakeys[i].keyProviderId).MapFailure(e => E(e)); - if !("aws-kms" < extractedKeyProviderId) { - singleDataKeyOutput := EncryptedDataKeyDescription( - keyProviderId := extractedKeyProviderId, - keyProviderInfo := None, - branchKeyId := None, - branchKeyVersion := None - ); - } - else { + var extractedKeyProviderIdInfo:= Option.None; + var expectedBranchKeyVersion := Option.None; + if ("aws-kms" <= extractedKeyProviderId) { :- Need(deserializedHeader.flavor == 0 || deserializedHeader.flavor == 1, E("Invalid format flavor.")); var algorithmSuite; //= specification/dynamodb-encryption-client/ddb-get-encrypted-data-key-description.md#behavior @@ -96,9 +89,8 @@ module AwsCryptographyDbEncryptionSdkDynamoDbOperations refines AbstractAwsCrypt } else { algorithmSuite := AlgorithmSuites.DBE_ALG_AES_256_GCM_HKDF_SHA512_COMMIT_KEY_ECDSA_P384_SYMSIG_HMAC_SHA384; } - - var extractedKeyProviderIdInfo :- UTF8.Decode(datakeys[i].keyProviderInfo).MapFailure(e => E(e)); - + var maybeKeyProviderIdInfo :- UTF8.Decode(datakeys[i].keyProviderInfo).MapFailure(e => E(e)); + extractedKeyProviderIdInfo := Some(maybeKeyProviderIdInfo); if extractedKeyProviderId == "aws-kms-hierarchy" { var providerWrappedMaterial :- EdkWrapping.GetProviderWrappedMaterial(datakeys[i].ciphertext, algorithmSuite).MapFailure(e => AwsCryptographyMaterialProviders(e)); var EDK_CIPHERTEXT_BRANCH_KEY_VERSION_INDEX := SALT_LENGTH + IV_LENGTH; @@ -106,23 +98,16 @@ module AwsCryptographyDbEncryptionSdkDynamoDbOperations refines AbstractAwsCrypt :- Need(EDK_CIPHERTEXT_BRANCH_KEY_VERSION_INDEX < EDK_CIPHERTEXT_VERSION_INDEX, E("Wrong branch key version index.")); :- Need(|providerWrappedMaterial| >= EDK_CIPHERTEXT_VERSION_INDEX, E("Incorrect ciphertext structure length.")); var branchKeyVersionUuid := providerWrappedMaterial[EDK_CIPHERTEXT_BRANCH_KEY_VERSION_INDEX .. EDK_CIPHERTEXT_VERSION_INDEX]; - var expectedBranchKeyVersion :- UUID.FromByteArray(branchKeyVersionUuid).MapFailure(e => E(e)); - singleDataKeyOutput := EncryptedDataKeyDescription( - keyProviderId := extractedKeyProviderId, - keyProviderInfo := Some(extractedKeyProviderIdInfo), - branchKeyId := Some(extractedKeyProviderIdInfo), - branchKeyVersion := Some(expectedBranchKeyVersion) - ); - } - else { - singleDataKeyOutput := EncryptedDataKeyDescription( - keyProviderId := extractedKeyProviderId, - keyProviderInfo := Some(extractedKeyProviderIdInfo), - branchKeyId := None, - branchKeyVersion := None - ); + var maybeBranchKeyVersion :- UUID.FromByteArray(branchKeyVersionUuid).MapFailure(e => E(e)); + expectedBranchKeyVersion := Some(maybeBranchKeyVersion); } } + var singleDataKeyOutput := EncryptedDataKeyDescription( + keyProviderId := extractedKeyProviderId, + keyProviderInfo := extractedKeyProviderIdInfo, + branchKeyId := extractedKeyProviderIdInfo, + branchKeyVersion := expectedBranchKeyVersion + ); list := list + [singleDataKeyOutput]; } diff --git a/DynamoDbEncryption/dafny/DynamoDbEncryption/test/DynamoDbGetEncryptedDataKeyDescriptionTest.dfy b/DynamoDbEncryption/dafny/DynamoDbEncryption/test/DynamoDbGetEncryptedDataKeyDescriptionTest.dfy index f230f2988..220792ae1 100644 --- a/DynamoDbEncryption/dafny/DynamoDbEncryption/test/DynamoDbGetEncryptedDataKeyDescriptionTest.dfy +++ b/DynamoDbEncryption/dafny/DynamoDbEncryption/test/DynamoDbGetEncryptedDataKeyDescriptionTest.dfy @@ -127,13 +127,10 @@ module DynamoDbGetEncryptedDataKeyDescriptionTest { ); var actualDataKeyDescription :- expect ddbEncResources.GetEncryptedDataKeyDescription(inputVariable); var expectedkeyProviderId :- expect UTF8.Decode(expectedHead.dataKeys[0].keyProviderId); - var expectedkeyProviderInfo :- expect UTF8.Decode(expectedHead.dataKeys[0].keyProviderInfo); expect |actualDataKeyDescription.EncryptedDataKeyDescriptionOutput| > 0; expect |actualDataKeyDescription.EncryptedDataKeyDescriptionOutput| == |expectedHead.dataKeys|; expect actualDataKeyDescription.EncryptedDataKeyDescriptionOutput[0].keyProviderId == expectedkeyProviderId; - expect actualDataKeyDescription.EncryptedDataKeyDescriptionOutput[0].keyProviderInfo.Some?; - expect actualDataKeyDescription.EncryptedDataKeyDescriptionOutput[0].keyProviderInfo.value == expectedkeyProviderInfo; } method {:test} TestHeaderInputAwsKmsRsaDataKeyCase() @@ -222,13 +219,10 @@ module DynamoDbGetEncryptedDataKeyDescriptionTest { ); var actualDataKeyDescription :- expect ddbEncResources.GetEncryptedDataKeyDescription(inputVariable); var expectedkeyProviderId :- expect UTF8.Decode(expectedHead.dataKeys[0].keyProviderId); - var expectedkeyProviderInfo :- expect UTF8.Decode(expectedHead.dataKeys[0].keyProviderInfo); expect |actualDataKeyDescription.EncryptedDataKeyDescriptionOutput| > 0; expect |actualDataKeyDescription.EncryptedDataKeyDescriptionOutput| == |expectedHead.dataKeys|; expect actualDataKeyDescription.EncryptedDataKeyDescriptionOutput[0].keyProviderId == expectedkeyProviderId; - expect actualDataKeyDescription.EncryptedDataKeyDescriptionOutput[0].keyProviderInfo.Some?; - expect actualDataKeyDescription.EncryptedDataKeyDescriptionOutput[0].keyProviderInfo.value == expectedkeyProviderInfo; } method {:test} TestDDBItemInputAwsKmsRsaDataKeyCase() From 912305a22adbadc09819234d5cf7f8df469a0a9f Mon Sep 17 00:00:00 2001 From: rishav-karanjit Date: Wed, 10 Apr 2024 22:52:12 -0700 Subject: [PATCH 56/67] fix examples redundancy --- .../examples/GetEncryptedDataKeyDescriptionExample.java | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/Examples/runtimes/java/DynamoDbEncryption/src/main/java/software/amazon/cryptography/examples/GetEncryptedDataKeyDescriptionExample.java b/Examples/runtimes/java/DynamoDbEncryption/src/main/java/software/amazon/cryptography/examples/GetEncryptedDataKeyDescriptionExample.java index 8654451c9..56b4ba324 100644 --- a/Examples/runtimes/java/DynamoDbEncryption/src/main/java/software/amazon/cryptography/examples/GetEncryptedDataKeyDescriptionExample.java +++ b/Examples/runtimes/java/DynamoDbEncryption/src/main/java/software/amazon/cryptography/examples/GetEncryptedDataKeyDescriptionExample.java @@ -69,15 +69,10 @@ public static void getEncryptedDataKeyDescription( assert output.EncryptedDataKeyDescriptionOutput().get(0).keyProviderId().equals(expectedKeyProviderId); if(expectedKeyProviderId.startsWith("aws-kms")) { assert output.EncryptedDataKeyDescriptionOutput().get(0).keyProviderInfo().equals(expectedKeyProviderInfo); - } else { - assert output.EncryptedDataKeyDescriptionOutput().get(0).keyProviderInfo() == expectedKeyProviderInfo; - } + } if(output.EncryptedDataKeyDescriptionOutput().get(0).keyProviderId().equals("aws-kms-hierarchy")) { assert output.EncryptedDataKeyDescriptionOutput().get(0).branchKeyId().equals(expectedBranchKeyId); assert output.EncryptedDataKeyDescriptionOutput().get(0).branchKeyVersion().equals(expectedBranchKeyVersion); - } else { - assert output.EncryptedDataKeyDescriptionOutput().get(0).branchKeyId() == expectedBranchKeyId; - assert output.EncryptedDataKeyDescriptionOutput().get(0).branchKeyVersion() == expectedBranchKeyVersion; } } public static void main(final String[] args) { From 88abd76c1f8051b99f685e09445cd0cf08ecb645 Mon Sep 17 00:00:00 2001 From: rishav-karanjit Date: Thu, 11 Apr 2024 11:56:01 -0700 Subject: [PATCH 57/67] fix duvet annotations --- .../AwsCryptographyDbEncryptionSdkDynamoDbOperations.dfy | 5 ----- .../test/DynamoDbGetEncryptedDataKeyDescriptionTest.dfy | 6 ++++++ 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/DynamoDbEncryption/dafny/DynamoDbEncryption/src/AwsCryptographyDbEncryptionSdkDynamoDbOperations.dfy b/DynamoDbEncryption/dafny/DynamoDbEncryption/src/AwsCryptographyDbEncryptionSdkDynamoDbOperations.dfy index e2e07bb0a..b7880a2e6 100644 --- a/DynamoDbEncryption/dafny/DynamoDbEncryption/src/AwsCryptographyDbEncryptionSdkDynamoDbOperations.dfy +++ b/DynamoDbEncryption/dafny/DynamoDbEncryption/src/AwsCryptographyDbEncryptionSdkDynamoDbOperations.dfy @@ -53,7 +53,6 @@ module AwsCryptographyDbEncryptionSdkDynamoDbOperations refines AbstractAwsCrypt match input.input { //= specification/dynamodb-encryption-client/ddb-get-encrypted-data-key-description.md#behavior - //= type=implication //# - If the input is a encrypted DynamoDB item, it MUST attempt to extract "aws_dbe_head" attribute from the DynamoDB item to get binary header. case plaintextItem(plainTextItem) =>{ :- Need("aws_dbe_head" in plainTextItem && plainTextItem["aws_dbe_head"].B?, E("Header not found in the DynamoDB item.")); @@ -63,16 +62,13 @@ module AwsCryptographyDbEncryptionSdkDynamoDbOperations refines AbstractAwsCrypt header := headerItem; } //= specification/dynamodb-encryption-client/ddb-get-encrypted-data-key-description.md#behavior - //= type=implication //# - This operation MUST deserialize the header bytes according to the header format. var deserializedHeader :- Header.PartialDeserialize(header).MapFailure(e => AwsCryptographyDbEncryptionSdkStructuredEncryption(e)); //= specification/dynamodb-encryption-client/ddb-get-encrypted-data-key-description.md#behavior - //= type=implication //# - This operation MUST extract the dataKeys from the deserialize header. var datakeys := deserializedHeader.dataKeys; var list : EncryptedDataKeyDescriptionList := []; //= specification/dynamodb-encryption-client/ddb-get-encrypted-data-key-description.md#behavior - //= type=implication //# - For every Data Key in Data Keys, the operation MUST attempt to extract a description of the Data Key. for i := 0 to |datakeys| { var extractedKeyProviderId :- UTF8.Decode(datakeys[i].keyProviderId).MapFailure(e => E(e)); @@ -82,7 +78,6 @@ module AwsCryptographyDbEncryptionSdkDynamoDbOperations refines AbstractAwsCrypt :- Need(deserializedHeader.flavor == 0 || deserializedHeader.flavor == 1, E("Invalid format flavor.")); var algorithmSuite; //= specification/dynamodb-encryption-client/ddb-get-encrypted-data-key-description.md#behavior - //= type=implication //# - This operation MUST extract the Format Flavor from the deserialize header. if deserializedHeader.flavor == 0{ algorithmSuite := AlgorithmSuites.DBE_ALG_AES_256_GCM_HKDF_SHA512_COMMIT_KEY_SYMSIG_HMAC_SHA384; diff --git a/DynamoDbEncryption/dafny/DynamoDbEncryption/test/DynamoDbGetEncryptedDataKeyDescriptionTest.dfy b/DynamoDbEncryption/dafny/DynamoDbEncryption/test/DynamoDbGetEncryptedDataKeyDescriptionTest.dfy index 220792ae1..bbce6e26a 100644 --- a/DynamoDbEncryption/dafny/DynamoDbEncryption/test/DynamoDbGetEncryptedDataKeyDescriptionTest.dfy +++ b/DynamoDbEncryption/dafny/DynamoDbEncryption/test/DynamoDbGetEncryptedDataKeyDescriptionTest.dfy @@ -261,6 +261,9 @@ module DynamoDbGetEncryptedDataKeyDescriptionTest { expect |actualDataKeyDescription.EncryptedDataKeyDescriptionOutput| > 0; var i := 0; + //= specification/dynamodb-encryption-client/ddb-get-encrypted-data-key-description.md#behavior + //= type=test + //# - For every Data Key in Data Keys, the operation MUST attempt to extract a description of the Data Key. while (i < |expectedHead.dataKeys|) { var expectedkeyProviderId :- expect UTF8.Decode(expectedHead.dataKeys[i].keyProviderId); var expectedkeyProviderInfo :- expect UTF8.Decode(expectedHead.dataKeys[i].keyProviderInfo); @@ -287,6 +290,9 @@ module DynamoDbGetEncryptedDataKeyDescriptionTest { expect |actualDataKeyDescription.EncryptedDataKeyDescriptionOutput| == |expectedHead.dataKeys|; expect |actualDataKeyDescription.EncryptedDataKeyDescriptionOutput| > 0; + //= specification/dynamodb-encryption-client/ddb-get-encrypted-data-key-description.md#behavior + //= type=test + //# - For every Data Key in Data Keys, the operation MUST attempt to extract a description of the Data Key. var i := 0; while (i < |expectedHead.dataKeys|) { var expectedkeyProviderId :- expect UTF8.Decode(expectedHead.dataKeys[i].keyProviderId); From 325b507b837f8b5068cb97fbc4166b9b1d9a9cba Mon Sep 17 00:00:00 2001 From: rishav-karanjit Date: Thu, 11 Apr 2024 12:19:48 -0700 Subject: [PATCH 58/67] Minor nit on specification --- .../ddb-get-encrypted-data-key-description.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/specification/dynamodb-encryption-client/ddb-get-encrypted-data-key-description.md b/specification/dynamodb-encryption-client/ddb-get-encrypted-data-key-description.md index 5737cd2c9..995c2b60b 100644 --- a/specification/dynamodb-encryption-client/ddb-get-encrypted-data-key-description.md +++ b/specification/dynamodb-encryption-client/ddb-get-encrypted-data-key-description.md @@ -5,7 +5,7 @@ ## Overview -Currently, Keyring's Encrypted Data Key serialization includes metadata like key provider id, key provider info, branch Key id (only Hierarchy Keyring), and the version of the branch Key (only Hierarchy Keyring). Encrypted Data Key Description operation provides a way for the customers to get these meta data. This operation will provide them with an insight of the keys the data is encrypted with. +Keyring's Encrypted Data Key serialization includes metadata like key provider id, key provider info, branch Key id (only Hierarchy Keyring), and the version of the branch Key (only Hierarchy Keyring). Encrypted Data Key Description operation provides a way for the customers to get these meta data. This operation will provide them with an insight of the keys the data is encrypted with. ## Operation From d96e977e37c609fd78123039da0eb9d4701a57b6 Mon Sep 17 00:00:00 2001 From: rishav-karanjit Date: Thu, 18 Apr 2024 12:55:34 -0700 Subject: [PATCH 59/67] Add TestNoHeaderFailureCase --- ...namoDbGetEncryptedDataKeyDescriptionTest.dfy | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/DynamoDbEncryption/dafny/DynamoDbEncryption/test/DynamoDbGetEncryptedDataKeyDescriptionTest.dfy b/DynamoDbEncryption/dafny/DynamoDbEncryption/test/DynamoDbGetEncryptedDataKeyDescriptionTest.dfy index bbce6e26a..b9f2f2045 100644 --- a/DynamoDbEncryption/dafny/DynamoDbEncryption/test/DynamoDbGetEncryptedDataKeyDescriptionTest.dfy +++ b/DynamoDbEncryption/dafny/DynamoDbEncryption/test/DynamoDbGetEncryptedDataKeyDescriptionTest.dfy @@ -305,6 +305,23 @@ module DynamoDbGetEncryptedDataKeyDescriptionTest { } } + method {:test} TestNoHeaderFailureCase() + { + var expectedHead := CreatePartialHeader(testVersion, testFlavor, testMsgID, testLegend, testEncContext, [testAwsKmsDataKey, testAwsKmsRsaDataKey]); + var serializedHeader := expectedHead.serialize() + expectedHead.msgID; + var attr := map["wrong_header_attribute" := ComAmazonawsDynamodbTypes.AttributeValue.B(serializedHeader)]; + var ddbEncResources :- expect DynamoDbEncryption.DynamoDbEncryption(); + var inputVariable: Types.GetEncryptedDataKeyDescriptionInput := + Types.GetEncryptedDataKeyDescriptionInput( + input := Types.plaintextItem(plaintextItem := attr) + ); + var actualDataKeyDescription := ddbEncResources.GetEncryptedDataKeyDescription(inputVariable); + + expect actualDataKeyDescription.IsFailure(); + expect actualDataKeyDescription.error.DynamoDbEncryptionException?; + expect actualDataKeyDescription.error.message == "Header not found in the DynamoDB item."; + } + method getBranchKeyVersion (expectedHead : PartialHeader) returns (expectedBranchKeyVersion : string) { From 23804d668d699d5aebf79c4e01c5046527ff6291 Mon Sep 17 00:00:00 2001 From: rishav-karanjit Date: Thu, 18 Apr 2024 14:24:23 -0700 Subject: [PATCH 60/67] Use another AlgorithmSuites as well --- ...moDbGetEncryptedDataKeyDescriptionTest.dfy | 32 +++++++++++-------- 1 file changed, 19 insertions(+), 13 deletions(-) diff --git a/DynamoDbEncryption/dafny/DynamoDbEncryption/test/DynamoDbGetEncryptedDataKeyDescriptionTest.dfy b/DynamoDbEncryption/dafny/DynamoDbEncryption/test/DynamoDbGetEncryptedDataKeyDescriptionTest.dfy index b9f2f2045..561f8f57c 100644 --- a/DynamoDbEncryption/dafny/DynamoDbEncryption/test/DynamoDbGetEncryptedDataKeyDescriptionTest.dfy +++ b/DynamoDbEncryption/dafny/DynamoDbEncryption/test/DynamoDbGetEncryptedDataKeyDescriptionTest.dfy @@ -16,7 +16,8 @@ module DynamoDbGetEncryptedDataKeyDescriptionTest { // THIS IS A TESTING RESOURCE DO NOT USE IN A PRODUCTION ENVIRONMENT const testVersion : Version := 1 - const testFlavor : Flavor := 1 + const testFlavor0 : Flavor := 0 + const testFlavor1 : Flavor := 1 const testMsgID : MessageID := [1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32] const testLegend : Legend := [0x65, 0x73] const testEncContext : CMPEncryptionContext := map[EncodeAscii("abc") := EncodeAscii("def")] @@ -46,7 +47,6 @@ module DynamoDbGetEncryptedDataKeyDescriptionTest { keyProviderId := EncodeAscii("aws-kms-rsa") , keyProviderInfo := EncodeAscii("keyproviderInfo"), ciphertext := [1, 2, 3, 4, 5]) - const algorithmSuite := AlgorithmSuites.DBE_ALG_AES_256_GCM_HKDF_SHA512_COMMIT_KEY_ECDSA_P384_SYMSIG_HMAC_SHA384 method CreatePartialHeader(version : Version, flavor : Flavor, msgID : MessageID, legend : Legend, encContext : CMPEncryptionContext, dataKeyList : CMPEncryptedDataKeyList) returns (result: PartialHeader) @@ -69,7 +69,7 @@ module DynamoDbGetEncryptedDataKeyDescriptionTest { method {:test} TestHeaderInputAwsKmsDataKeyCase() { - var expectedHead := CreatePartialHeader(testVersion, testFlavor, testMsgID, testLegend, testEncContext, [testAwsKmsDataKey]); + var expectedHead := CreatePartialHeader(testVersion, testFlavor1, testMsgID, testLegend, testEncContext, [testAwsKmsDataKey]); var serializedHeader := expectedHead.serialize() + expectedHead.msgID; var ddbEncResources :- expect DynamoDbEncryption.DynamoDbEncryption(); var inputVariable: Types.GetEncryptedDataKeyDescriptionInput := @@ -89,7 +89,7 @@ module DynamoDbGetEncryptedDataKeyDescriptionTest { method {:test} TestHeaderInputAwsKmsHDataKeyCase() { - var expectedHead := CreatePartialHeader(testVersion, testFlavor, testMsgID, testLegend, testEncContext, [testAwsKmsHDataKey]); + var expectedHead := CreatePartialHeader(testVersion, testFlavor1, testMsgID, testLegend, testEncContext, [testAwsKmsHDataKey]); var serializedHeader := expectedHead.serialize() + expectedHead.msgID; var expectedBranchKeyVersion := getBranchKeyVersion(expectedHead); var ddbEncResources :- expect DynamoDbEncryption.DynamoDbEncryption(); @@ -118,7 +118,7 @@ module DynamoDbGetEncryptedDataKeyDescriptionTest { method {:test} TestHeaderInputRawRsaDataKeyDataKeyCase() { - var expectedHead := CreatePartialHeader(testVersion, testFlavor, testMsgID, testLegend, testEncContext, [testRawRsaDataKey]); + var expectedHead := CreatePartialHeader(testVersion, testFlavor1, testMsgID, testLegend, testEncContext, [testRawRsaDataKey]); var serializedHeader := expectedHead.serialize() + expectedHead.msgID; var ddbEncResources :- expect DynamoDbEncryption.DynamoDbEncryption(); var inputVariable: Types.GetEncryptedDataKeyDescriptionInput := @@ -135,7 +135,7 @@ module DynamoDbGetEncryptedDataKeyDescriptionTest { method {:test} TestHeaderInputAwsKmsRsaDataKeyCase() { - var expectedHead := CreatePartialHeader(testVersion, testFlavor, testMsgID, testLegend, testEncContext, [testAwsKmsRsaDataKey]); + var expectedHead := CreatePartialHeader(testVersion, testFlavor1, testMsgID, testLegend, testEncContext, [testAwsKmsRsaDataKey]); var serializedHeader := expectedHead.serialize() + expectedHead.msgID; var ddbEncResources :- expect DynamoDbEncryption.DynamoDbEncryption(); var inputVariable: Types.GetEncryptedDataKeyDescriptionInput := @@ -156,7 +156,7 @@ module DynamoDbGetEncryptedDataKeyDescriptionTest { method {:test} TestDDBItemInputAwsKmsDataKeyCase() { - var expectedHead := CreatePartialHeader(testVersion, testFlavor, testMsgID, testLegend, testEncContext, [testAwsKmsDataKey]); + var expectedHead := CreatePartialHeader(testVersion, testFlavor1, testMsgID, testLegend, testEncContext, [testAwsKmsDataKey]); var serializedHeader := expectedHead.serialize() + expectedHead.msgID; var attr := map["aws_dbe_head" := ComAmazonawsDynamodbTypes.AttributeValue.B(serializedHeader)]; var ddbEncResources :- expect DynamoDbEncryption.DynamoDbEncryption(); @@ -179,7 +179,7 @@ module DynamoDbGetEncryptedDataKeyDescriptionTest { method {:test} TestDDBItemInputAwsKmsHDataKeyCase() { - var expectedHead := CreatePartialHeader(testVersion, testFlavor, testMsgID, testLegend, testEncContext, [testAwsKmsHDataKey]); + var expectedHead := CreatePartialHeader(testVersion, testFlavor0, testMsgID, testLegend, testEncContext, [testAwsKmsHDataKey]); var serializedHeader := expectedHead.serialize() + expectedHead.msgID; var expectedBranchKeyVersion := getBranchKeyVersion(expectedHead); var attr := map["aws_dbe_head" := ComAmazonawsDynamodbTypes.AttributeValue.B(serializedHeader)]; @@ -209,7 +209,7 @@ module DynamoDbGetEncryptedDataKeyDescriptionTest { method {:test} TestDDBItemInputRawRsaDataKeyCase() { - var expectedHead := CreatePartialHeader(testVersion, testFlavor, testMsgID, testLegend, testEncContext, [testRawRsaDataKey]); + var expectedHead := CreatePartialHeader(testVersion, testFlavor1, testMsgID, testLegend, testEncContext, [testRawRsaDataKey]); var serializedHeader := expectedHead.serialize() + expectedHead.msgID; var attr := map["aws_dbe_head" := ComAmazonawsDynamodbTypes.AttributeValue.B(serializedHeader)]; var ddbEncResources :- expect DynamoDbEncryption.DynamoDbEncryption(); @@ -227,7 +227,7 @@ module DynamoDbGetEncryptedDataKeyDescriptionTest { method {:test} TestDDBItemInputAwsKmsRsaDataKeyCase() { - var expectedHead := CreatePartialHeader(testVersion, testFlavor, testMsgID, testLegend, testEncContext, [testAwsKmsRsaDataKey]); + var expectedHead := CreatePartialHeader(testVersion, testFlavor1, testMsgID, testLegend, testEncContext, [testAwsKmsRsaDataKey]); var serializedHeader := expectedHead.serialize() + expectedHead.msgID; var attr := map["aws_dbe_head" := ComAmazonawsDynamodbTypes.AttributeValue.B(serializedHeader)]; var ddbEncResources :- expect DynamoDbEncryption.DynamoDbEncryption(); @@ -248,7 +248,7 @@ module DynamoDbGetEncryptedDataKeyDescriptionTest { method {:test} TestHeaderMultiDataKeyCase() { - var expectedHead := CreatePartialHeader(testVersion, testFlavor, testMsgID, testLegend, testEncContext, [testAwsKmsDataKey, testAwsKmsRsaDataKey]); + var expectedHead := CreatePartialHeader(testVersion, testFlavor1, testMsgID, testLegend, testEncContext, [testAwsKmsDataKey, testAwsKmsRsaDataKey]); var serializedHeader := expectedHead.serialize() + expectedHead.msgID; var ddbEncResources :- expect DynamoDbEncryption.DynamoDbEncryption(); var inputVariable: Types.GetEncryptedDataKeyDescriptionInput := @@ -277,7 +277,7 @@ module DynamoDbGetEncryptedDataKeyDescriptionTest { method {:test} TestDDBItemInputMultiDataKeyCase() { - var expectedHead := CreatePartialHeader(testVersion, testFlavor, testMsgID, testLegend, testEncContext, [testAwsKmsDataKey, testAwsKmsRsaDataKey]); + var expectedHead := CreatePartialHeader(testVersion, testFlavor1, testMsgID, testLegend, testEncContext, [testAwsKmsDataKey, testAwsKmsRsaDataKey]); var serializedHeader := expectedHead.serialize() + expectedHead.msgID; var attr := map["aws_dbe_head" := ComAmazonawsDynamodbTypes.AttributeValue.B(serializedHeader)]; var ddbEncResources :- expect DynamoDbEncryption.DynamoDbEncryption(); @@ -307,7 +307,7 @@ module DynamoDbGetEncryptedDataKeyDescriptionTest { method {:test} TestNoHeaderFailureCase() { - var expectedHead := CreatePartialHeader(testVersion, testFlavor, testMsgID, testLegend, testEncContext, [testAwsKmsDataKey, testAwsKmsRsaDataKey]); + var expectedHead := CreatePartialHeader(testVersion, testFlavor1, testMsgID, testLegend, testEncContext, [testAwsKmsDataKey, testAwsKmsRsaDataKey]); var serializedHeader := expectedHead.serialize() + expectedHead.msgID; var attr := map["wrong_header_attribute" := ComAmazonawsDynamodbTypes.AttributeValue.B(serializedHeader)]; var ddbEncResources :- expect DynamoDbEncryption.DynamoDbEncryption(); @@ -325,6 +325,12 @@ module DynamoDbGetEncryptedDataKeyDescriptionTest { method getBranchKeyVersion (expectedHead : PartialHeader) returns (expectedBranchKeyVersion : string) { + var algorithmSuite : AlgorithmSuites.AlgorithmSuite; + if expectedHead.flavor == 0{ + algorithmSuite := AlgorithmSuites.DBE_ALG_AES_256_GCM_HKDF_SHA512_COMMIT_KEY_SYMSIG_HMAC_SHA384; + } else { + algorithmSuite := AlgorithmSuites.DBE_ALG_AES_256_GCM_HKDF_SHA512_COMMIT_KEY_ECDSA_P384_SYMSIG_HMAC_SHA384; + } var providerWrappedMaterial :- expect EdkWrapping.GetProviderWrappedMaterial(expectedHead.dataKeys[0].ciphertext, algorithmSuite); expect |providerWrappedMaterial| >= (28 + 16); var expectedBranchKeyVersionResult :- expect UUID.FromByteArray(providerWrappedMaterial[28 .. (28 + 16)]); From e69af8c3f9b5847a9977735e1e104133ae0cc2be Mon Sep 17 00:00:00 2001 From: rishav-karanjit Date: Tue, 30 Apr 2024 09:05:58 -0700 Subject: [PATCH 61/67] Add polymorph file after merge --- .../DynamoDbEncryption/TypeConversion.cs | 16 ++++++++++++---- .../TypeConversion.cs | 14 +++----------- 2 files changed, 15 insertions(+), 15 deletions(-) diff --git a/DynamoDbEncryption/runtimes/net/Generated/DynamoDbEncryption/TypeConversion.cs b/DynamoDbEncryption/runtimes/net/Generated/DynamoDbEncryption/TypeConversion.cs index 91ccaf57c..eb7d974f0 100644 --- a/DynamoDbEncryption/runtimes/net/Generated/DynamoDbEncryption/TypeConversion.cs +++ b/DynamoDbEncryption/runtimes/net/Generated/DynamoDbEncryption/TypeConversion.cs @@ -185,6 +185,7 @@ public static AWS.Cryptography.DbEncryptionSDK.DynamoDb.GetEncryptedDataKeyDescr } public static software.amazon.cryptography.dbencryptionsdk.dynamodb.internaldafny.types._IGetEncryptedDataKeyDescriptionInput ToDafny_N3_aws__N12_cryptography__N15_dbEncryptionSdk__N8_dynamoDb__S35_GetEncryptedDataKeyDescriptionInput(AWS.Cryptography.DbEncryptionSDK.DynamoDb.GetEncryptedDataKeyDescriptionInput value) { + value.Validate(); return new software.amazon.cryptography.dbencryptionsdk.dynamodb.internaldafny.types.GetEncryptedDataKeyDescriptionInput(ToDafny_N3_aws__N12_cryptography__N15_dbEncryptionSdk__N8_dynamoDb__S35_GetEncryptedDataKeyDescriptionInput__M5_input(value.Input)); } @@ -194,6 +195,7 @@ public static AWS.Cryptography.DbEncryptionSDK.DynamoDb.GetEncryptedDataKeyDescr } public static software.amazon.cryptography.dbencryptionsdk.dynamodb.internaldafny.types._IGetEncryptedDataKeyDescriptionOutput ToDafny_N3_aws__N12_cryptography__N15_dbEncryptionSdk__N8_dynamoDb__S36_GetEncryptedDataKeyDescriptionOutput(AWS.Cryptography.DbEncryptionSDK.DynamoDb.GetEncryptedDataKeyDescriptionOutput value) { + value.Validate(); return new software.amazon.cryptography.dbencryptionsdk.dynamodb.internaldafny.types.GetEncryptedDataKeyDescriptionOutput(ToDafny_N3_aws__N12_cryptography__N15_dbEncryptionSdk__N8_dynamoDb__S36_GetEncryptedDataKeyDescriptionOutput__M33_EncryptedDataKeyDescriptionOutput(value.EncryptedDataKeyDescriptionOutput)); } @@ -214,7 +216,7 @@ public static AWS.Cryptography.DbEncryptionSDK.DynamoDb.GetEncryptedDataKeyDescr } public static software.amazon.cryptography.dbencryptionsdk.dynamodb.internaldafny.types._IGetEncryptedDataKeyDescriptionUnion ToDafny_N3_aws__N12_cryptography__N15_dbEncryptionSdk__N8_dynamoDb__S35_GetEncryptedDataKeyDescriptionUnion(AWS.Cryptography.DbEncryptionSDK.DynamoDb.GetEncryptedDataKeyDescriptionUnion value) { - if (value.IsSetHeader()) + value.Validate(); if (value.IsSetHeader()) { return software.amazon.cryptography.dbencryptionsdk.dynamodb.internaldafny.types.GetEncryptedDataKeyDescriptionUnion.create_header(ToDafny_N3_aws__N12_cryptography__N15_dbEncryptionSdk__N8_dynamoDb__S35_GetEncryptedDataKeyDescriptionUnion__M6_header(value.Header)); } @@ -643,7 +645,12 @@ public static System.IO.MemoryStream FromDafny_N6_smithy__N3_api__S4_Blob(Dafny. } public static Dafny.ISequence ToDafny_N6_smithy__N3_api__S4_Blob(System.IO.MemoryStream value) { + if (value.ToArray().Length == 0 && value.Length > 0) + { + throw new System.ArgumentException("Fatal Error: MemoryStream instance not backed by an array!"); + } return Dafny.Sequence.FromArray(value.ToArray()); + } public static System.Collections.Generic.Dictionary FromDafny_N3_com__N9_amazonaws__N8_dynamodb__S12_AttributeMap(Dafny.IMap, software.amazon.cryptography.services.dynamodb.internaldafny.types._IAttributeValue> value) { @@ -1093,6 +1100,7 @@ public static AWS.Cryptography.DbEncryptionSDK.DynamoDb.EncryptedDataKeyDescript } public static software.amazon.cryptography.dbencryptionsdk.dynamodb.internaldafny.types._IEncryptedDataKeyDescription ToDafny_N3_aws__N12_cryptography__N15_dbEncryptionSdk__N8_dynamoDb__S27_EncryptedDataKeyDescription(AWS.Cryptography.DbEncryptionSDK.DynamoDb.EncryptedDataKeyDescription value) { + value.Validate(); string var_keyProviderInfo = value.IsSetKeyProviderInfo() ? value.KeyProviderInfo : (string)null; string var_branchKeyId = value.IsSetBranchKeyId() ? value.BranchKeyId : (string)null; string var_branchKeyVersion = value.IsSetBranchKeyVersion() ? value.BranchKeyVersion : (string)null; @@ -1559,9 +1567,9 @@ public static System.Exception FromDafny_CommonError(software.amazon.cryptograph { switch (value) { - case software.amazon.cryptography.dbencryptionsdk.dynamodb.internaldafny.types.Error_ComAmazonawsDynamodb dafnyVal: - return Com.Amazonaws.Dynamodb.TypeConversion.FromDafny_CommonError( - dafnyVal._ComAmazonawsDynamodb + case software.amazon.cryptography.dbencryptionsdk.dynamodb.internaldafny.types.Error_AwsCryptographyDbEncryptionSdkStructuredEncryption dafnyVal: + return AWS.Cryptography.DbEncryptionSDK.StructuredEncryption.TypeConversion.FromDafny_CommonError( + dafnyVal._AwsCryptographyDbEncryptionSdkStructuredEncryption ); case software.amazon.cryptography.dbencryptionsdk.dynamodb.internaldafny.types.Error_AwsCryptographyMaterialProviders dafnyVal: return AWS.Cryptography.MaterialProviders.TypeConversion.FromDafny_CommonError( diff --git a/DynamoDbEncryption/runtimes/net/Generated/DynamoDbEncryptionTransforms/TypeConversion.cs b/DynamoDbEncryption/runtimes/net/Generated/DynamoDbEncryptionTransforms/TypeConversion.cs index 3bba03040..36226d34f 100644 --- a/DynamoDbEncryption/runtimes/net/Generated/DynamoDbEncryptionTransforms/TypeConversion.cs +++ b/DynamoDbEncryption/runtimes/net/Generated/DynamoDbEncryptionTransforms/TypeConversion.cs @@ -6624,13 +6624,9 @@ public static System.Exception FromDafny_CommonError(software.amazon.cryptograph { switch (value) { - case software.amazon.cryptography.dbencryptionsdk.dynamodb.transforms.internaldafny.types.Error_ComAmazonawsDynamodb dafnyVal: - return Com.Amazonaws.Dynamodb.TypeConversion.FromDafny_CommonError( - dafnyVal._ComAmazonawsDynamodb - ); - case software.amazon.cryptography.dbencryptionsdk.dynamodb.transforms.internaldafny.types.Error_AwsCryptographyDbEncryptionSdkDynamoDbItemEncryptor dafnyVal: - return AWS.Cryptography.DbEncryptionSDK.DynamoDb.ItemEncryptor.TypeConversion.FromDafny_CommonError( - dafnyVal._AwsCryptographyDbEncryptionSdkDynamoDbItemEncryptor + case software.amazon.cryptography.dbencryptionsdk.dynamodb.transforms.internaldafny.types.Error_AwsCryptographyDbEncryptionSdkDynamoDb dafnyVal: + return AWS.Cryptography.DbEncryptionSDK.DynamoDb.TypeConversion.FromDafny_CommonError( + dafnyVal._AwsCryptographyDbEncryptionSdkDynamoDb ); case software.amazon.cryptography.dbencryptionsdk.dynamodb.transforms.internaldafny.types.Error_AwsCryptographyDbEncryptionSdkDynamoDbItemEncryptor dafnyVal: return AWS.Cryptography.DbEncryptionSDK.DynamoDb.ItemEncryptor.TypeConversion.FromDafny_CommonError( @@ -6640,10 +6636,6 @@ public static System.Exception FromDafny_CommonError(software.amazon.cryptograph return AWS.Cryptography.DbEncryptionSDK.StructuredEncryption.TypeConversion.FromDafny_CommonError( dafnyVal._AwsCryptographyDbEncryptionSdkStructuredEncryption ); - case software.amazon.cryptography.dbencryptionsdk.dynamodb.transforms.internaldafny.types.Error_AwsCryptographyDbEncryptionSdkDynamoDb dafnyVal: - return AWS.Cryptography.DbEncryptionSDK.DynamoDb.TypeConversion.FromDafny_CommonError( - dafnyVal._AwsCryptographyDbEncryptionSdkDynamoDb - ); case software.amazon.cryptography.dbencryptionsdk.dynamodb.transforms.internaldafny.types.Error_AwsCryptographyMaterialProviders dafnyVal: return AWS.Cryptography.MaterialProviders.TypeConversion.FromDafny_CommonError( dafnyVal._AwsCryptographyMaterialProviders From 9b58508b3053cb1e7964c56f7b337f9bd20dfa8a Mon Sep 17 00:00:00 2001 From: rishav-karanjit Date: Sun, 5 May 2024 16:55:51 -0700 Subject: [PATCH 62/67] Add suggested changes --- ...yptographyDbEncryptionSdkDynamoDbTypes.dfy | 2 +- .../Model/DynamoDbEncryption.smithy | 14 +- ...raphyDbEncryptionSdkDynamoDbOperations.dfy | 6 +- ...moDbGetEncryptedDataKeyDescriptionTest.dfy | 158 +++++---------- .../dynamodb/DynamoDbEncryption.java | 17 +- .../dbencryptionsdk/dynamodb/ToDafny.java | 100 +++++++--- .../dbencryptionsdk/dynamodb/ToNative.java | 86 ++++++-- .../model/EncryptedDataKeyDescription.java | 59 +++++- .../EncryptedDataKeyDescriptionOutput.java | 11 +- .../GetEncryptedDataKeyDescriptionInput.java | 14 +- .../GetEncryptedDataKeyDescriptionOutput.java | 53 +++-- .../GetEncryptedDataKeyDescriptionUnion.java | 59 ++++-- .../GetEncryptedDataKeyDescriptionUnion.cs | 14 +- .../DynamoDbEncryption/TypeConversion.cs | 12 +- ...GetEncryptedDataKeyDescriptionExample.java | 6 +- .../GetEncryptedDataKeyDescriptionExample.cs | 4 +- .../wrapped/TestDynamoDbEncryption.java | 17 +- .../DDBEncryption/DynamoDbEncryptionShim.cs | 15 ++ .../Generated/DDBEncryption/TypeConversion.cs | 183 +++++++++++++++++- 19 files changed, 606 insertions(+), 224 deletions(-) diff --git a/DynamoDbEncryption/dafny/DynamoDbEncryption/Model/AwsCryptographyDbEncryptionSdkDynamoDbTypes.dfy b/DynamoDbEncryption/dafny/DynamoDbEncryption/Model/AwsCryptographyDbEncryptionSdkDynamoDbTypes.dfy index 0b86403cf..4700779b8 100644 --- a/DynamoDbEncryption/dafny/DynamoDbEncryption/Model/AwsCryptographyDbEncryptionSdkDynamoDbTypes.dfy +++ b/DynamoDbEncryption/dafny/DynamoDbEncryption/Model/AwsCryptographyDbEncryptionSdkDynamoDbTypes.dfy @@ -278,7 +278,7 @@ module {:extern "software.amazon.cryptography.dbencryptionsdk.dynamodb.internald ) datatype GetEncryptedDataKeyDescriptionUnion = | header(header: seq) - | plaintextItem(plaintextItem: ComAmazonawsDynamodbTypes.AttributeMap) + | item(item: ComAmazonawsDynamodbTypes.AttributeMap) datatype GetPrefix = | GetPrefix ( nameonly length: int32 ) diff --git a/DynamoDbEncryption/dafny/DynamoDbEncryption/Model/DynamoDbEncryption.smithy b/DynamoDbEncryption/dafny/DynamoDbEncryption/Model/DynamoDbEncryption.smithy index c02e0735a..b4c0066f9 100644 --- a/DynamoDbEncryption/dafny/DynamoDbEncryption/Model/DynamoDbEncryption.smithy +++ b/DynamoDbEncryption/dafny/DynamoDbEncryption/Model/DynamoDbEncryption.smithy @@ -48,11 +48,13 @@ service DynamoDbEncryption { errors: [ DynamoDbEncryptionException ] } +@javadoc("Returns encrypted data key description.") operation GetEncryptedDataKeyDescription { input: GetEncryptedDataKeyDescriptionInput, output: GetEncryptedDataKeyDescriptionOutput, } +@javadoc("Input for getting encrypted data key description.") structure GetEncryptedDataKeyDescriptionInput { @required input: GetEncryptedDataKeyDescriptionUnion @@ -65,12 +67,16 @@ structure GetEncryptedDataKeyDescriptionInput { //# - A [encrypted DynamoDB item](https://github.com/aws/aws-database-encryption-sdk-dynamodb/blob/ff9f08a355a20c81540e4ca652e09aaeffe90c4b/specification/dynamodb-encryption-client/encrypt-item.md#encrypted-dynamodb-item) union GetEncryptedDataKeyDescriptionUnion { + @javadoc("A binary header value.") header: Blob, - plaintextItem: AttributeMap, + @javadoc("A DynamoDB item.") + item: AttributeMap, } +@javadoc("Output for getting encrypted data key description.") structure GetEncryptedDataKeyDescriptionOutput { @required + @javadoc("A list of encrypted data key description.") EncryptedDataKeyDescriptionOutput: EncryptedDataKeyDescriptionList } @@ -88,12 +94,16 @@ list EncryptedDataKeyDescriptionList { structure EncryptedDataKeyDescription { @required + @javadoc("Key provider id of the encrypted data key.") keyProviderId: String, + @javadoc("Key provider information of the encrypted data key.") keyProviderInfo: String, - + + @javadoc("Branch key id of the encrypted data key.") branchKeyId: String, + @javadoc("Branch key version of the encrypted data key.") branchKeyVersion: String } // The top level DynamoDbEncryption local service takes in no config diff --git a/DynamoDbEncryption/dafny/DynamoDbEncryption/src/AwsCryptographyDbEncryptionSdkDynamoDbOperations.dfy b/DynamoDbEncryption/dafny/DynamoDbEncryption/src/AwsCryptographyDbEncryptionSdkDynamoDbOperations.dfy index b7880a2e6..8ce53d4da 100644 --- a/DynamoDbEncryption/dafny/DynamoDbEncryption/src/AwsCryptographyDbEncryptionSdkDynamoDbOperations.dfy +++ b/DynamoDbEncryption/dafny/DynamoDbEncryption/src/AwsCryptographyDbEncryptionSdkDynamoDbOperations.dfy @@ -54,9 +54,9 @@ module AwsCryptographyDbEncryptionSdkDynamoDbOperations refines AbstractAwsCrypt { //= specification/dynamodb-encryption-client/ddb-get-encrypted-data-key-description.md#behavior //# - If the input is a encrypted DynamoDB item, it MUST attempt to extract "aws_dbe_head" attribute from the DynamoDB item to get binary header. - case plaintextItem(plainTextItem) =>{ - :- Need("aws_dbe_head" in plainTextItem && plainTextItem["aws_dbe_head"].B?, E("Header not found in the DynamoDB item.")); - header := plainTextItem["aws_dbe_head"].B; + case item(item) =>{ + :- Need("aws_dbe_head" in item && item["aws_dbe_head"].B?, E("Header not found in the DynamoDB item.")); + header := item["aws_dbe_head"].B; } case header(headerItem) => header := headerItem; diff --git a/DynamoDbEncryption/dafny/DynamoDbEncryption/test/DynamoDbGetEncryptedDataKeyDescriptionTest.dfy b/DynamoDbEncryption/dafny/DynamoDbEncryption/test/DynamoDbGetEncryptedDataKeyDescriptionTest.dfy index 561f8f57c..b801aa04b 100644 --- a/DynamoDbEncryption/dafny/DynamoDbEncryption/test/DynamoDbGetEncryptedDataKeyDescriptionTest.dfy +++ b/DynamoDbEncryption/dafny/DynamoDbEncryption/test/DynamoDbGetEncryptedDataKeyDescriptionTest.dfy @@ -77,43 +77,34 @@ module DynamoDbGetEncryptedDataKeyDescriptionTest { input := Types.header(header := serializedHeader) ); var actualDataKeyDescription :- expect ddbEncResources.GetEncryptedDataKeyDescription(inputVariable); - var expectedkeyProviderId :- expect UTF8.Decode(expectedHead.dataKeys[0].keyProviderId); - var expectedkeyProviderInfo :- expect UTF8.Decode(expectedHead.dataKeys[0].keyProviderInfo); - expect |actualDataKeyDescription.EncryptedDataKeyDescriptionOutput| > 0; - expect |actualDataKeyDescription.EncryptedDataKeyDescriptionOutput| == |expectedHead.dataKeys|; - expect actualDataKeyDescription.EncryptedDataKeyDescriptionOutput[0].keyProviderId == expectedkeyProviderId; + expect |actualDataKeyDescription.EncryptedDataKeyDescriptionOutput| == 1; + expect actualDataKeyDescription.EncryptedDataKeyDescriptionOutput[0].keyProviderId == "aws-kms"; expect actualDataKeyDescription.EncryptedDataKeyDescriptionOutput[0].keyProviderInfo.Some?; - expect actualDataKeyDescription.EncryptedDataKeyDescriptionOutput[0].keyProviderInfo.value == expectedkeyProviderInfo; + expect actualDataKeyDescription.EncryptedDataKeyDescriptionOutput[0].keyProviderInfo.value == "keyproviderInfo"; } method {:test} TestHeaderInputAwsKmsHDataKeyCase() { var expectedHead := CreatePartialHeader(testVersion, testFlavor1, testMsgID, testLegend, testEncContext, [testAwsKmsHDataKey]); var serializedHeader := expectedHead.serialize() + expectedHead.msgID; - var expectedBranchKeyVersion := getBranchKeyVersion(expectedHead); var ddbEncResources :- expect DynamoDbEncryption.DynamoDbEncryption(); var inputVariable: Types.GetEncryptedDataKeyDescriptionInput := Types.GetEncryptedDataKeyDescriptionInput( input := Types.header(header := serializedHeader) ); var actualDataKeyDescription :- expect ddbEncResources.GetEncryptedDataKeyDescription(inputVariable); - var expectedkeyProviderId :- expect UTF8.Decode(expectedHead.dataKeys[0].keyProviderId); - var expectedkeyProviderInfo :- expect UTF8.Decode(expectedHead.dataKeys[0].keyProviderInfo); - expect |actualDataKeyDescription.EncryptedDataKeyDescriptionOutput| > 0; - expect |actualDataKeyDescription.EncryptedDataKeyDescriptionOutput| == |expectedHead.dataKeys|; - expect actualDataKeyDescription.EncryptedDataKeyDescriptionOutput[0].keyProviderId == expectedkeyProviderId; + expect |actualDataKeyDescription.EncryptedDataKeyDescriptionOutput| == 1; + expect actualDataKeyDescription.EncryptedDataKeyDescriptionOutput[0].keyProviderId == "aws-kms-hierarchy"; expect actualDataKeyDescription.EncryptedDataKeyDescriptionOutput[0].keyProviderInfo.Some?; - expect actualDataKeyDescription.EncryptedDataKeyDescriptionOutput[0].keyProviderInfo.value == expectedkeyProviderInfo; + expect actualDataKeyDescription.EncryptedDataKeyDescriptionOutput[0].keyProviderInfo.value == "keyproviderInfo"; - if actualDataKeyDescription.EncryptedDataKeyDescriptionOutput[0].keyProviderId == "aws-kms-hierarchy" { - expect actualDataKeyDescription.EncryptedDataKeyDescriptionOutput[0].branchKeyId.Some?; - expect actualDataKeyDescription.EncryptedDataKeyDescriptionOutput[0].branchKeyVersion.Some?; + expect actualDataKeyDescription.EncryptedDataKeyDescriptionOutput[0].branchKeyId.Some?; + expect actualDataKeyDescription.EncryptedDataKeyDescriptionOutput[0].branchKeyVersion.Some?; - expect actualDataKeyDescription.EncryptedDataKeyDescriptionOutput[0].branchKeyId.value == expectedkeyProviderInfo; - expect actualDataKeyDescription.EncryptedDataKeyDescriptionOutput[0].branchKeyVersion.value == expectedBranchKeyVersion; - } + expect actualDataKeyDescription.EncryptedDataKeyDescriptionOutput[0].branchKeyId.value == "keyproviderInfo"; + expect actualDataKeyDescription.EncryptedDataKeyDescriptionOutput[0].branchKeyVersion.value == "155b7a3d-7625-4826-4302-113d1179075a"; } method {:test} TestHeaderInputRawRsaDataKeyDataKeyCase() @@ -126,11 +117,9 @@ module DynamoDbGetEncryptedDataKeyDescriptionTest { input := Types.header(header := serializedHeader) ); var actualDataKeyDescription :- expect ddbEncResources.GetEncryptedDataKeyDescription(inputVariable); - var expectedkeyProviderId :- expect UTF8.Decode(expectedHead.dataKeys[0].keyProviderId); - expect |actualDataKeyDescription.EncryptedDataKeyDescriptionOutput| > 0; - expect |actualDataKeyDescription.EncryptedDataKeyDescriptionOutput| == |expectedHead.dataKeys|; - expect actualDataKeyDescription.EncryptedDataKeyDescriptionOutput[0].keyProviderId == expectedkeyProviderId; + expect |actualDataKeyDescription.EncryptedDataKeyDescriptionOutput| == 1; + expect actualDataKeyDescription.EncryptedDataKeyDescriptionOutput[0].keyProviderId == "raw-rsa"; } method {:test} TestHeaderInputAwsKmsRsaDataKeyCase() @@ -143,14 +132,11 @@ module DynamoDbGetEncryptedDataKeyDescriptionTest { input := Types.header(header := serializedHeader) ); var actualDataKeyDescription :- expect ddbEncResources.GetEncryptedDataKeyDescription(inputVariable); - var expectedkeyProviderId :- expect UTF8.Decode(expectedHead.dataKeys[0].keyProviderId); - var expectedkeyProviderInfo :- expect UTF8.Decode(expectedHead.dataKeys[0].keyProviderInfo); - expect |actualDataKeyDescription.EncryptedDataKeyDescriptionOutput| > 0; - expect |actualDataKeyDescription.EncryptedDataKeyDescriptionOutput| == |expectedHead.dataKeys|; - expect actualDataKeyDescription.EncryptedDataKeyDescriptionOutput[0].keyProviderId == expectedkeyProviderId; + expect |actualDataKeyDescription.EncryptedDataKeyDescriptionOutput| == 1; + expect actualDataKeyDescription.EncryptedDataKeyDescriptionOutput[0].keyProviderId == "aws-kms-rsa"; expect actualDataKeyDescription.EncryptedDataKeyDescriptionOutput[0].keyProviderInfo.Some?; - expect actualDataKeyDescription.EncryptedDataKeyDescriptionOutput[0].keyProviderInfo.value == expectedkeyProviderInfo; + expect actualDataKeyDescription.EncryptedDataKeyDescriptionOutput[0].keyProviderInfo.value == "keyproviderInfo"; } @@ -163,48 +149,39 @@ module DynamoDbGetEncryptedDataKeyDescriptionTest { var inputVariable: Types.GetEncryptedDataKeyDescriptionInput := Types.GetEncryptedDataKeyDescriptionInput( - input := Types.plaintextItem(plaintextItem := attr) + input := Types.item(item := attr) ); var actualDataKeyDescription :- expect ddbEncResources.GetEncryptedDataKeyDescription(inputVariable); - var expectedkeyProviderId :- expect UTF8.Decode(expectedHead.dataKeys[0].keyProviderId); - var expectedkeyProviderInfo :- expect UTF8.Decode(expectedHead.dataKeys[0].keyProviderInfo); - expect |actualDataKeyDescription.EncryptedDataKeyDescriptionOutput| > 0; - expect |actualDataKeyDescription.EncryptedDataKeyDescriptionOutput| == |expectedHead.dataKeys|; - expect actualDataKeyDescription.EncryptedDataKeyDescriptionOutput[0].keyProviderId == expectedkeyProviderId; + expect |actualDataKeyDescription.EncryptedDataKeyDescriptionOutput| == 1; + expect actualDataKeyDescription.EncryptedDataKeyDescriptionOutput[0].keyProviderId == "aws-kms"; expect actualDataKeyDescription.EncryptedDataKeyDescriptionOutput[0].keyProviderInfo.Some?; - expect actualDataKeyDescription.EncryptedDataKeyDescriptionOutput[0].keyProviderInfo.value == expectedkeyProviderInfo; + expect actualDataKeyDescription.EncryptedDataKeyDescriptionOutput[0].keyProviderInfo.value == "keyproviderInfo"; } method {:test} TestDDBItemInputAwsKmsHDataKeyCase() { var expectedHead := CreatePartialHeader(testVersion, testFlavor0, testMsgID, testLegend, testEncContext, [testAwsKmsHDataKey]); var serializedHeader := expectedHead.serialize() + expectedHead.msgID; - var expectedBranchKeyVersion := getBranchKeyVersion(expectedHead); var attr := map["aws_dbe_head" := ComAmazonawsDynamodbTypes.AttributeValue.B(serializedHeader)]; var ddbEncResources :- expect DynamoDbEncryption.DynamoDbEncryption(); var inputVariable: Types.GetEncryptedDataKeyDescriptionInput := Types.GetEncryptedDataKeyDescriptionInput( - input := Types.plaintextItem(plaintextItem := attr) + input := Types.item(item := attr) ); var actualDataKeyDescription :- expect ddbEncResources.GetEncryptedDataKeyDescription(inputVariable); - var expectedkeyProviderId :- expect UTF8.Decode(expectedHead.dataKeys[0].keyProviderId); - var expectedkeyProviderInfo :- expect UTF8.Decode(expectedHead.dataKeys[0].keyProviderInfo); - expect |actualDataKeyDescription.EncryptedDataKeyDescriptionOutput| > 0; - expect |actualDataKeyDescription.EncryptedDataKeyDescriptionOutput| == |expectedHead.dataKeys|; - expect actualDataKeyDescription.EncryptedDataKeyDescriptionOutput[0].keyProviderId == expectedkeyProviderId; + expect |actualDataKeyDescription.EncryptedDataKeyDescriptionOutput| == 1; + expect actualDataKeyDescription.EncryptedDataKeyDescriptionOutput[0].keyProviderId == "aws-kms-hierarchy"; expect actualDataKeyDescription.EncryptedDataKeyDescriptionOutput[0].keyProviderInfo.Some?; - expect actualDataKeyDescription.EncryptedDataKeyDescriptionOutput[0].keyProviderInfo.value == expectedkeyProviderInfo; + expect actualDataKeyDescription.EncryptedDataKeyDescriptionOutput[0].keyProviderInfo.value == "keyproviderInfo"; - if actualDataKeyDescription.EncryptedDataKeyDescriptionOutput[0].keyProviderId == "aws-kms-hierarchy" { - expect actualDataKeyDescription.EncryptedDataKeyDescriptionOutput[0].branchKeyId.Some?; - expect actualDataKeyDescription.EncryptedDataKeyDescriptionOutput[0].branchKeyVersion.Some?; + expect actualDataKeyDescription.EncryptedDataKeyDescriptionOutput[0].branchKeyId.Some?; + expect actualDataKeyDescription.EncryptedDataKeyDescriptionOutput[0].branchKeyVersion.Some?; - expect actualDataKeyDescription.EncryptedDataKeyDescriptionOutput[0].branchKeyId.value == expectedkeyProviderInfo; - expect actualDataKeyDescription.EncryptedDataKeyDescriptionOutput[0].branchKeyVersion.value == expectedBranchKeyVersion; - } + expect actualDataKeyDescription.EncryptedDataKeyDescriptionOutput[0].branchKeyId.value == "keyproviderInfo"; + expect actualDataKeyDescription.EncryptedDataKeyDescriptionOutput[0].branchKeyVersion.value == "155b7a3d-7625-4826-4302-113d1179075a"; } method {:test} TestDDBItemInputRawRsaDataKeyCase() @@ -215,14 +192,12 @@ module DynamoDbGetEncryptedDataKeyDescriptionTest { var ddbEncResources :- expect DynamoDbEncryption.DynamoDbEncryption(); var inputVariable: Types.GetEncryptedDataKeyDescriptionInput := Types.GetEncryptedDataKeyDescriptionInput( - input := Types.plaintextItem(plaintextItem := attr) + input := Types.item(item := attr) ); var actualDataKeyDescription :- expect ddbEncResources.GetEncryptedDataKeyDescription(inputVariable); - var expectedkeyProviderId :- expect UTF8.Decode(expectedHead.dataKeys[0].keyProviderId); - expect |actualDataKeyDescription.EncryptedDataKeyDescriptionOutput| > 0; - expect |actualDataKeyDescription.EncryptedDataKeyDescriptionOutput| == |expectedHead.dataKeys|; - expect actualDataKeyDescription.EncryptedDataKeyDescriptionOutput[0].keyProviderId == expectedkeyProviderId; + expect |actualDataKeyDescription.EncryptedDataKeyDescriptionOutput| == 1; + expect actualDataKeyDescription.EncryptedDataKeyDescriptionOutput[0].keyProviderId == "raw-rsa"; } method {:test} TestDDBItemInputAwsKmsRsaDataKeyCase() @@ -233,17 +208,14 @@ module DynamoDbGetEncryptedDataKeyDescriptionTest { var ddbEncResources :- expect DynamoDbEncryption.DynamoDbEncryption(); var inputVariable: Types.GetEncryptedDataKeyDescriptionInput := Types.GetEncryptedDataKeyDescriptionInput( - input := Types.plaintextItem(plaintextItem := attr) + input := Types.item(item := attr) ); var actualDataKeyDescription :- expect ddbEncResources.GetEncryptedDataKeyDescription(inputVariable); - var expectedkeyProviderId :- expect UTF8.Decode(expectedHead.dataKeys[0].keyProviderId); - var expectedkeyProviderInfo :- expect UTF8.Decode(expectedHead.dataKeys[0].keyProviderInfo); - expect |actualDataKeyDescription.EncryptedDataKeyDescriptionOutput| > 0; - expect |actualDataKeyDescription.EncryptedDataKeyDescriptionOutput| == |expectedHead.dataKeys|; - expect actualDataKeyDescription.EncryptedDataKeyDescriptionOutput[0].keyProviderId == expectedkeyProviderId; + expect |actualDataKeyDescription.EncryptedDataKeyDescriptionOutput| == 1; + expect actualDataKeyDescription.EncryptedDataKeyDescriptionOutput[0].keyProviderId == "aws-kms-rsa"; expect actualDataKeyDescription.EncryptedDataKeyDescriptionOutput[0].keyProviderInfo.Some?; - expect actualDataKeyDescription.EncryptedDataKeyDescriptionOutput[0].keyProviderInfo.value == expectedkeyProviderInfo; + expect actualDataKeyDescription.EncryptedDataKeyDescriptionOutput[0].keyProviderInfo.value == "keyproviderInfo"; } method {:test} TestHeaderMultiDataKeyCase() @@ -257,22 +229,14 @@ module DynamoDbGetEncryptedDataKeyDescriptionTest { ); var actualDataKeyDescription :- expect ddbEncResources.GetEncryptedDataKeyDescription(inputVariable); - expect |actualDataKeyDescription.EncryptedDataKeyDescriptionOutput| == |expectedHead.dataKeys|; - expect |actualDataKeyDescription.EncryptedDataKeyDescriptionOutput| > 0; + expect |actualDataKeyDescription.EncryptedDataKeyDescriptionOutput| == 2; + expect actualDataKeyDescription.EncryptedDataKeyDescriptionOutput[0].keyProviderInfo.Some?; + expect actualDataKeyDescription.EncryptedDataKeyDescriptionOutput[0].keyProviderId == "aws-kms"; + expect actualDataKeyDescription.EncryptedDataKeyDescriptionOutput[0].keyProviderInfo.value == "keyproviderInfo"; - var i := 0; - //= specification/dynamodb-encryption-client/ddb-get-encrypted-data-key-description.md#behavior - //= type=test - //# - For every Data Key in Data Keys, the operation MUST attempt to extract a description of the Data Key. - while (i < |expectedHead.dataKeys|) { - var expectedkeyProviderId :- expect UTF8.Decode(expectedHead.dataKeys[i].keyProviderId); - var expectedkeyProviderInfo :- expect UTF8.Decode(expectedHead.dataKeys[i].keyProviderInfo); - - expect actualDataKeyDescription.EncryptedDataKeyDescriptionOutput[i].keyProviderInfo.Some?; - expect actualDataKeyDescription.EncryptedDataKeyDescriptionOutput[i].keyProviderId == expectedkeyProviderId; - expect actualDataKeyDescription.EncryptedDataKeyDescriptionOutput[i].keyProviderInfo.value == expectedkeyProviderInfo; - i := i + 1; - } + expect actualDataKeyDescription.EncryptedDataKeyDescriptionOutput[1].keyProviderInfo.Some?; + expect actualDataKeyDescription.EncryptedDataKeyDescriptionOutput[1].keyProviderId == "aws-kms-rsa"; + expect actualDataKeyDescription.EncryptedDataKeyDescriptionOutput[1].keyProviderInfo.value == "keyproviderInfo"; } method {:test} TestDDBItemInputMultiDataKeyCase() @@ -283,26 +247,23 @@ module DynamoDbGetEncryptedDataKeyDescriptionTest { var ddbEncResources :- expect DynamoDbEncryption.DynamoDbEncryption(); var inputVariable: Types.GetEncryptedDataKeyDescriptionInput := Types.GetEncryptedDataKeyDescriptionInput( - input := Types.plaintextItem(plaintextItem := attr) + input := Types.item(item := attr) ); var actualDataKeyDescription :- expect ddbEncResources.GetEncryptedDataKeyDescription(inputVariable); - expect |actualDataKeyDescription.EncryptedDataKeyDescriptionOutput| == |expectedHead.dataKeys|; - expect |actualDataKeyDescription.EncryptedDataKeyDescriptionOutput| > 0; + expect |actualDataKeyDescription.EncryptedDataKeyDescriptionOutput| == 2; //= specification/dynamodb-encryption-client/ddb-get-encrypted-data-key-description.md#behavior //= type=test //# - For every Data Key in Data Keys, the operation MUST attempt to extract a description of the Data Key. - var i := 0; - while (i < |expectedHead.dataKeys|) { - var expectedkeyProviderId :- expect UTF8.Decode(expectedHead.dataKeys[i].keyProviderId); - var expectedkeyProviderInfo :- expect UTF8.Decode(expectedHead.dataKeys[i].keyProviderInfo); - - expect actualDataKeyDescription.EncryptedDataKeyDescriptionOutput[i].keyProviderInfo.Some?; - expect actualDataKeyDescription.EncryptedDataKeyDescriptionOutput[i].keyProviderId == expectedkeyProviderId; - expect actualDataKeyDescription.EncryptedDataKeyDescriptionOutput[i].keyProviderInfo.value == expectedkeyProviderInfo; - i := i + 1; - } + expect |actualDataKeyDescription.EncryptedDataKeyDescriptionOutput| == 2; + expect actualDataKeyDescription.EncryptedDataKeyDescriptionOutput[0].keyProviderInfo.Some?; + expect actualDataKeyDescription.EncryptedDataKeyDescriptionOutput[0].keyProviderId == "aws-kms"; + expect actualDataKeyDescription.EncryptedDataKeyDescriptionOutput[0].keyProviderInfo.value == "keyproviderInfo"; + + expect actualDataKeyDescription.EncryptedDataKeyDescriptionOutput[1].keyProviderInfo.Some?; + expect actualDataKeyDescription.EncryptedDataKeyDescriptionOutput[1].keyProviderId == "aws-kms-rsa"; + expect actualDataKeyDescription.EncryptedDataKeyDescriptionOutput[1].keyProviderInfo.value == "keyproviderInfo"; } method {:test} TestNoHeaderFailureCase() @@ -313,7 +274,7 @@ module DynamoDbGetEncryptedDataKeyDescriptionTest { var ddbEncResources :- expect DynamoDbEncryption.DynamoDbEncryption(); var inputVariable: Types.GetEncryptedDataKeyDescriptionInput := Types.GetEncryptedDataKeyDescriptionInput( - input := Types.plaintextItem(plaintextItem := attr) + input := Types.item(item := attr) ); var actualDataKeyDescription := ddbEncResources.GetEncryptedDataKeyDescription(inputVariable); @@ -321,19 +282,4 @@ module DynamoDbGetEncryptedDataKeyDescriptionTest { expect actualDataKeyDescription.error.DynamoDbEncryptionException?; expect actualDataKeyDescription.error.message == "Header not found in the DynamoDB item."; } - - method getBranchKeyVersion (expectedHead : PartialHeader) - returns (expectedBranchKeyVersion : string) - { - var algorithmSuite : AlgorithmSuites.AlgorithmSuite; - if expectedHead.flavor == 0{ - algorithmSuite := AlgorithmSuites.DBE_ALG_AES_256_GCM_HKDF_SHA512_COMMIT_KEY_SYMSIG_HMAC_SHA384; - } else { - algorithmSuite := AlgorithmSuites.DBE_ALG_AES_256_GCM_HKDF_SHA512_COMMIT_KEY_ECDSA_P384_SYMSIG_HMAC_SHA384; - } - var providerWrappedMaterial :- expect EdkWrapping.GetProviderWrappedMaterial(expectedHead.dataKeys[0].ciphertext, algorithmSuite); - expect |providerWrappedMaterial| >= (28 + 16); - var expectedBranchKeyVersionResult :- expect UUID.FromByteArray(providerWrappedMaterial[28 .. (28 + 16)]); - expectedBranchKeyVersion := expectedBranchKeyVersionResult; - } } diff --git a/DynamoDbEncryption/runtimes/java/src/main/smithy-generated/software/amazon/cryptography/dbencryptionsdk/dynamodb/DynamoDbEncryption.java b/DynamoDbEncryption/runtimes/java/src/main/smithy-generated/software/amazon/cryptography/dbencryptionsdk/dynamodb/DynamoDbEncryption.java index 12ee3134e..4ae4177d6 100644 --- a/DynamoDbEncryption/runtimes/java/src/main/smithy-generated/software/amazon/cryptography/dbencryptionsdk/dynamodb/DynamoDbEncryption.java +++ b/DynamoDbEncryption/runtimes/java/src/main/smithy-generated/software/amazon/cryptography/dbencryptionsdk/dynamodb/DynamoDbEncryption.java @@ -64,10 +64,21 @@ public CreateDynamoDbEncryptionBranchKeyIdSupplierOutput CreateDynamoDbEncryptio ); } + /** + * Returns encrypted data key description. + * + * @param input Input for getting encrypted data key description. + * @return Output for getting encrypted data key description. + */ public GetEncryptedDataKeyDescriptionOutput GetEncryptedDataKeyDescription( - GetEncryptedDataKeyDescriptionInput input) { - software.amazon.cryptography.dbencryptionsdk.dynamodb.internaldafny.types.GetEncryptedDataKeyDescriptionInput dafnyValue = ToDafny.GetEncryptedDataKeyDescriptionInput(input); - Result result = this._impl.GetEncryptedDataKeyDescription(dafnyValue); + GetEncryptedDataKeyDescriptionInput input + ) { + software.amazon.cryptography.dbencryptionsdk.dynamodb.internaldafny.types.GetEncryptedDataKeyDescriptionInput dafnyValue = + ToDafny.GetEncryptedDataKeyDescriptionInput(input); + Result< + software.amazon.cryptography.dbencryptionsdk.dynamodb.internaldafny.types.GetEncryptedDataKeyDescriptionOutput, + Error + > result = this._impl.GetEncryptedDataKeyDescription(dafnyValue); if (result.is_Failure()) { throw ToNative.Error(result.dtor_error()); } diff --git a/DynamoDbEncryption/runtimes/java/src/main/smithy-generated/software/amazon/cryptography/dbencryptionsdk/dynamodb/ToDafny.java b/DynamoDbEncryption/runtimes/java/src/main/smithy-generated/software/amazon/cryptography/dbencryptionsdk/dynamodb/ToDafny.java index eba8ea99c..88677a441 100644 --- a/DynamoDbEncryption/runtimes/java/src/main/smithy-generated/software/amazon/cryptography/dbencryptionsdk/dynamodb/ToDafny.java +++ b/DynamoDbEncryption/runtimes/java/src/main/smithy-generated/software/amazon/cryptography/dbencryptionsdk/dynamodb/ToDafny.java @@ -382,22 +382,46 @@ public static DynamoDbTablesEncryptionConfig DynamoDbTablesEncryptionConfig( } public static EncryptedDataKeyDescription EncryptedDataKeyDescription( - software.amazon.cryptography.dbencryptionsdk.dynamodb.model.EncryptedDataKeyDescription nativeValue) { + software.amazon.cryptography.dbencryptionsdk.dynamodb.model.EncryptedDataKeyDescription nativeValue + ) { DafnySequence keyProviderId; - keyProviderId = software.amazon.smithy.dafny.conversion.ToDafny.Simple.CharacterSequence(nativeValue.keyProviderId()); + keyProviderId = + software.amazon.smithy.dafny.conversion.ToDafny.Simple.CharacterSequence( + nativeValue.keyProviderId() + ); Option> keyProviderInfo; - keyProviderInfo = Objects.nonNull(nativeValue.keyProviderInfo()) ? - Option.create_Some(software.amazon.smithy.dafny.conversion.ToDafny.Simple.CharacterSequence(nativeValue.keyProviderInfo())) + keyProviderInfo = + Objects.nonNull(nativeValue.keyProviderInfo()) + ? Option.create_Some( + software.amazon.smithy.dafny.conversion.ToDafny.Simple.CharacterSequence( + nativeValue.keyProviderInfo() + ) + ) : Option.create_None(); Option> branchKeyId; - branchKeyId = Objects.nonNull(nativeValue.branchKeyId()) ? - Option.create_Some(software.amazon.smithy.dafny.conversion.ToDafny.Simple.CharacterSequence(nativeValue.branchKeyId())) + branchKeyId = + Objects.nonNull(nativeValue.branchKeyId()) + ? Option.create_Some( + software.amazon.smithy.dafny.conversion.ToDafny.Simple.CharacterSequence( + nativeValue.branchKeyId() + ) + ) : Option.create_None(); Option> branchKeyVersion; - branchKeyVersion = Objects.nonNull(nativeValue.branchKeyVersion()) ? - Option.create_Some(software.amazon.smithy.dafny.conversion.ToDafny.Simple.CharacterSequence(nativeValue.branchKeyVersion())) + branchKeyVersion = + Objects.nonNull(nativeValue.branchKeyVersion()) + ? Option.create_Some( + software.amazon.smithy.dafny.conversion.ToDafny.Simple.CharacterSequence( + nativeValue.branchKeyVersion() + ) + ) : Option.create_None(); - return new EncryptedDataKeyDescription(keyProviderId, keyProviderInfo, branchKeyId, branchKeyVersion); + return new EncryptedDataKeyDescription( + keyProviderId, + keyProviderInfo, + branchKeyId, + branchKeyVersion + ); } public static EncryptedPart EncryptedPart( @@ -442,17 +466,26 @@ public static GetBranchKeyIdFromDdbKeyOutput GetBranchKeyIdFromDdbKeyOutput( } public static GetEncryptedDataKeyDescriptionInput GetEncryptedDataKeyDescriptionInput( - software.amazon.cryptography.dbencryptionsdk.dynamodb.model.GetEncryptedDataKeyDescriptionInput nativeValue) { + software.amazon.cryptography.dbencryptionsdk.dynamodb.model.GetEncryptedDataKeyDescriptionInput nativeValue + ) { GetEncryptedDataKeyDescriptionUnion input; input = ToDafny.GetEncryptedDataKeyDescriptionUnion(nativeValue.input()); return new GetEncryptedDataKeyDescriptionInput(input); } public static GetEncryptedDataKeyDescriptionOutput GetEncryptedDataKeyDescriptionOutput( - software.amazon.cryptography.dbencryptionsdk.dynamodb.model.GetEncryptedDataKeyDescriptionOutput nativeValue) { - DafnySequence encryptedDataKeyDescriptionOutput; - encryptedDataKeyDescriptionOutput = ToDafny.EncryptedDataKeyDescriptionList(nativeValue.EncryptedDataKeyDescriptionOutput()); - return new GetEncryptedDataKeyDescriptionOutput(encryptedDataKeyDescriptionOutput); + software.amazon.cryptography.dbencryptionsdk.dynamodb.model.GetEncryptedDataKeyDescriptionOutput nativeValue + ) { + DafnySequence< + ? extends EncryptedDataKeyDescription + > encryptedDataKeyDescriptionOutput; + encryptedDataKeyDescriptionOutput = + ToDafny.EncryptedDataKeyDescriptionList( + nativeValue.EncryptedDataKeyDescriptionOutput() + ); + return new GetEncryptedDataKeyDescriptionOutput( + encryptedDataKeyDescriptionOutput + ); } public static GetPrefix GetPrefix( @@ -826,14 +859,27 @@ public static BeaconStyle BeaconStyle( } public static GetEncryptedDataKeyDescriptionUnion GetEncryptedDataKeyDescriptionUnion( - software.amazon.cryptography.dbencryptionsdk.dynamodb.model.GetEncryptedDataKeyDescriptionUnion nativeValue) { + software.amazon.cryptography.dbencryptionsdk.dynamodb.model.GetEncryptedDataKeyDescriptionUnion nativeValue + ) { if (Objects.nonNull(nativeValue.header())) { - return GetEncryptedDataKeyDescriptionUnion.create_header(software.amazon.smithy.dafny.conversion.ToDafny.Simple.ByteSequence(nativeValue.header())); + return GetEncryptedDataKeyDescriptionUnion.create_header( + software.amazon.smithy.dafny.conversion.ToDafny.Simple.ByteSequence( + nativeValue.header() + ) + ); } - if (Objects.nonNull(nativeValue.plaintextItem())) { - return GetEncryptedDataKeyDescriptionUnion.create_plaintextItem(software.amazon.cryptography.services.dynamodb.internaldafny.ToDafny.AttributeMap(nativeValue.plaintextItem())); + if (Objects.nonNull(nativeValue.item())) { + return GetEncryptedDataKeyDescriptionUnion.create_item( + software.amazon.cryptography.services.dynamodb.internaldafny.ToDafny.AttributeMap( + nativeValue.item() + ) + ); } - throw new IllegalArgumentException("Cannot convert " + nativeValue + " to software.amazon.cryptography.dbencryptionsdk.dynamodb.internaldafny.types.GetEncryptedDataKeyDescriptionUnion."); + throw new IllegalArgumentException( + "Cannot convert " + + nativeValue + + " to software.amazon.cryptography.dbencryptionsdk.dynamodb.internaldafny.types.GetEncryptedDataKeyDescriptionUnion." + ); } public static VirtualTransform VirtualTransform( @@ -930,12 +976,18 @@ public static DafnySequence ConstructorPartList( ); } - public static DafnySequence EncryptedDataKeyDescriptionList( - List nativeValue) { + public static DafnySequence< + ? extends EncryptedDataKeyDescription + > EncryptedDataKeyDescriptionList( + List< + software.amazon.cryptography.dbencryptionsdk.dynamodb.model.EncryptedDataKeyDescription + > nativeValue + ) { return software.amazon.smithy.dafny.conversion.ToDafny.Aggregate.GenericToSequence( - nativeValue, - software.amazon.cryptography.dbencryptionsdk.dynamodb.ToDafny::EncryptedDataKeyDescription, - EncryptedDataKeyDescription._typeDescriptor()); + nativeValue, + software.amazon.cryptography.dbencryptionsdk.dynamodb.ToDafny::EncryptedDataKeyDescription, + EncryptedDataKeyDescription._typeDescriptor() + ); } public static DafnySequence EncryptedPartsList( diff --git a/DynamoDbEncryption/runtimes/java/src/main/smithy-generated/software/amazon/cryptography/dbencryptionsdk/dynamodb/ToNative.java b/DynamoDbEncryption/runtimes/java/src/main/smithy-generated/software/amazon/cryptography/dbencryptionsdk/dynamodb/ToNative.java index c7f2526bc..bd4b65bc4 100644 --- a/DynamoDbEncryption/runtimes/java/src/main/smithy-generated/software/amazon/cryptography/dbencryptionsdk/dynamodb/ToNative.java +++ b/DynamoDbEncryption/runtimes/java/src/main/smithy-generated/software/amazon/cryptography/dbencryptionsdk/dynamodb/ToNative.java @@ -365,17 +365,35 @@ public static DynamoDbTablesEncryptionConfig DynamoDbTablesEncryptionConfig( } public static EncryptedDataKeyDescription EncryptedDataKeyDescription( - software.amazon.cryptography.dbencryptionsdk.dynamodb.internaldafny.types.EncryptedDataKeyDescription dafnyValue) { - EncryptedDataKeyDescription.Builder nativeBuilder = EncryptedDataKeyDescription.builder(); - nativeBuilder.keyProviderId(software.amazon.smithy.dafny.conversion.ToNative.Simple.String(dafnyValue.dtor_keyProviderId())); + software.amazon.cryptography.dbencryptionsdk.dynamodb.internaldafny.types.EncryptedDataKeyDescription dafnyValue + ) { + EncryptedDataKeyDescription.Builder nativeBuilder = + EncryptedDataKeyDescription.builder(); + nativeBuilder.keyProviderId( + software.amazon.smithy.dafny.conversion.ToNative.Simple.String( + dafnyValue.dtor_keyProviderId() + ) + ); if (dafnyValue.dtor_keyProviderInfo().is_Some()) { - nativeBuilder.keyProviderInfo(software.amazon.smithy.dafny.conversion.ToNative.Simple.String(dafnyValue.dtor_keyProviderInfo().dtor_value())); + nativeBuilder.keyProviderInfo( + software.amazon.smithy.dafny.conversion.ToNative.Simple.String( + dafnyValue.dtor_keyProviderInfo().dtor_value() + ) + ); } if (dafnyValue.dtor_branchKeyId().is_Some()) { - nativeBuilder.branchKeyId(software.amazon.smithy.dafny.conversion.ToNative.Simple.String(dafnyValue.dtor_branchKeyId().dtor_value())); + nativeBuilder.branchKeyId( + software.amazon.smithy.dafny.conversion.ToNative.Simple.String( + dafnyValue.dtor_branchKeyId().dtor_value() + ) + ); } if (dafnyValue.dtor_branchKeyVersion().is_Some()) { - nativeBuilder.branchKeyVersion(software.amazon.smithy.dafny.conversion.ToNative.Simple.String(dafnyValue.dtor_branchKeyVersion().dtor_value())); + nativeBuilder.branchKeyVersion( + software.amazon.smithy.dafny.conversion.ToNative.Simple.String( + dafnyValue.dtor_branchKeyVersion().dtor_value() + ) + ); } return nativeBuilder.build(); } @@ -424,16 +442,26 @@ public static GetBranchKeyIdFromDdbKeyOutput GetBranchKeyIdFromDdbKeyOutput( } public static GetEncryptedDataKeyDescriptionInput GetEncryptedDataKeyDescriptionInput( - software.amazon.cryptography.dbencryptionsdk.dynamodb.internaldafny.types.GetEncryptedDataKeyDescriptionInput dafnyValue) { - GetEncryptedDataKeyDescriptionInput.Builder nativeBuilder = GetEncryptedDataKeyDescriptionInput.builder(); - nativeBuilder.input(ToNative.GetEncryptedDataKeyDescriptionUnion(dafnyValue.dtor_input())); + software.amazon.cryptography.dbencryptionsdk.dynamodb.internaldafny.types.GetEncryptedDataKeyDescriptionInput dafnyValue + ) { + GetEncryptedDataKeyDescriptionInput.Builder nativeBuilder = + GetEncryptedDataKeyDescriptionInput.builder(); + nativeBuilder.input( + ToNative.GetEncryptedDataKeyDescriptionUnion(dafnyValue.dtor_input()) + ); return nativeBuilder.build(); } public static GetEncryptedDataKeyDescriptionOutput GetEncryptedDataKeyDescriptionOutput( - software.amazon.cryptography.dbencryptionsdk.dynamodb.internaldafny.types.GetEncryptedDataKeyDescriptionOutput dafnyValue) { - GetEncryptedDataKeyDescriptionOutput.Builder nativeBuilder = GetEncryptedDataKeyDescriptionOutput.builder(); - nativeBuilder.EncryptedDataKeyDescriptionOutput(ToNative.EncryptedDataKeyDescriptionList(dafnyValue.dtor_EncryptedDataKeyDescriptionOutput())); + software.amazon.cryptography.dbencryptionsdk.dynamodb.internaldafny.types.GetEncryptedDataKeyDescriptionOutput dafnyValue + ) { + GetEncryptedDataKeyDescriptionOutput.Builder nativeBuilder = + GetEncryptedDataKeyDescriptionOutput.builder(); + nativeBuilder.EncryptedDataKeyDescriptionOutput( + ToNative.EncryptedDataKeyDescriptionList( + dafnyValue.dtor_EncryptedDataKeyDescriptionOutput() + ) + ); return nativeBuilder.build(); } @@ -759,13 +787,23 @@ public static BeaconStyle BeaconStyle( } public static GetEncryptedDataKeyDescriptionUnion GetEncryptedDataKeyDescriptionUnion( - software.amazon.cryptography.dbencryptionsdk.dynamodb.internaldafny.types.GetEncryptedDataKeyDescriptionUnion dafnyValue) { - GetEncryptedDataKeyDescriptionUnion.Builder nativeBuilder = GetEncryptedDataKeyDescriptionUnion.builder(); + software.amazon.cryptography.dbencryptionsdk.dynamodb.internaldafny.types.GetEncryptedDataKeyDescriptionUnion dafnyValue + ) { + GetEncryptedDataKeyDescriptionUnion.Builder nativeBuilder = + GetEncryptedDataKeyDescriptionUnion.builder(); if (dafnyValue.is_header()) { - nativeBuilder.header(software.amazon.smithy.dafny.conversion.ToNative.Simple.ByteBuffer(dafnyValue.dtor_header())); + nativeBuilder.header( + software.amazon.smithy.dafny.conversion.ToNative.Simple.ByteBuffer( + dafnyValue.dtor_header() + ) + ); } - if (dafnyValue.is_plaintextItem()) { - nativeBuilder.plaintextItem(software.amazon.cryptography.services.dynamodb.internaldafny.ToNative.AttributeMap(dafnyValue.dtor_plaintextItem())); + if (dafnyValue.is_item()) { + nativeBuilder.item( + software.amazon.cryptography.services.dynamodb.internaldafny.ToNative.AttributeMap( + dafnyValue.dtor_item() + ) + ); } return nativeBuilder.build(); } @@ -847,11 +885,17 @@ public static List ConstructorPartList( ); } - public static List EncryptedDataKeyDescriptionList( - DafnySequence dafnyValue) { + public static List< + EncryptedDataKeyDescription + > EncryptedDataKeyDescriptionList( + DafnySequence< + ? extends software.amazon.cryptography.dbencryptionsdk.dynamodb.internaldafny.types.EncryptedDataKeyDescription + > dafnyValue + ) { return software.amazon.smithy.dafny.conversion.ToNative.Aggregate.GenericToList( - dafnyValue, - software.amazon.cryptography.dbencryptionsdk.dynamodb.ToNative::EncryptedDataKeyDescription); + dafnyValue, + software.amazon.cryptography.dbencryptionsdk.dynamodb.ToNative::EncryptedDataKeyDescription + ); } public static List EncryptedPartsList( diff --git a/DynamoDbEncryption/runtimes/java/src/main/smithy-generated/software/amazon/cryptography/dbencryptionsdk/dynamodb/model/EncryptedDataKeyDescription.java b/DynamoDbEncryption/runtimes/java/src/main/smithy-generated/software/amazon/cryptography/dbencryptionsdk/dynamodb/model/EncryptedDataKeyDescription.java index 197489fdf..14ce01777 100644 --- a/DynamoDbEncryption/runtimes/java/src/main/smithy-generated/software/amazon/cryptography/dbencryptionsdk/dynamodb/model/EncryptedDataKeyDescription.java +++ b/DynamoDbEncryption/runtimes/java/src/main/smithy-generated/software/amazon/cryptography/dbencryptionsdk/dynamodb/model/EncryptedDataKeyDescription.java @@ -6,12 +6,25 @@ import java.util.Objects; public class EncryptedDataKeyDescription { + + /** + * Key provider id of the encrypted data key. + */ private final String keyProviderId; + /** + * Key provider information of the encrypted data key. + */ private final String keyProviderInfo; + /** + * Branch key id of the encrypted data key. + */ private final String branchKeyId; + /** + * Branch key version of the encrypted data key. + */ private final String branchKeyVersion; protected EncryptedDataKeyDescription(BuilderImpl builder) { @@ -21,18 +34,30 @@ protected EncryptedDataKeyDescription(BuilderImpl builder) { this.branchKeyVersion = builder.branchKeyVersion(); } + /** + * @return Key provider id of the encrypted data key. + */ public String keyProviderId() { return this.keyProviderId; } + /** + * @return Key provider information of the encrypted data key. + */ public String keyProviderInfo() { return this.keyProviderInfo; } + /** + * @return Branch key id of the encrypted data key. + */ public String branchKeyId() { return this.branchKeyId; } + /** + * @return Branch key version of the encrypted data key. + */ public String branchKeyVersion() { return this.branchKeyVersion; } @@ -46,26 +71,51 @@ public static Builder builder() { } public interface Builder { + /** + * @param keyProviderId Key provider id of the encrypted data key. + */ Builder keyProviderId(String keyProviderId); + /** + * @return Key provider id of the encrypted data key. + */ String keyProviderId(); + /** + * @param keyProviderInfo Key provider information of the encrypted data key. + */ Builder keyProviderInfo(String keyProviderInfo); + /** + * @return Key provider information of the encrypted data key. + */ String keyProviderInfo(); + /** + * @param branchKeyId Branch key id of the encrypted data key. + */ Builder branchKeyId(String branchKeyId); + /** + * @return Branch key id of the encrypted data key. + */ String branchKeyId(); + /** + * @param branchKeyVersion Branch key version of the encrypted data key. + */ Builder branchKeyVersion(String branchKeyVersion); + /** + * @return Branch key version of the encrypted data key. + */ String branchKeyVersion(); EncryptedDataKeyDescription build(); } static class BuilderImpl implements Builder { + protected String keyProviderId; protected String keyProviderInfo; @@ -74,8 +124,7 @@ static class BuilderImpl implements Builder { protected String branchKeyVersion; - protected BuilderImpl() { - } + protected BuilderImpl() {} protected BuilderImpl(EncryptedDataKeyDescription model) { this.keyProviderId = model.keyProviderId(); @@ -121,8 +170,10 @@ public String branchKeyVersion() { } public EncryptedDataKeyDescription build() { - if (Objects.isNull(this.keyProviderId())) { - throw new IllegalArgumentException("Missing value for required field `keyProviderId`"); + if (Objects.isNull(this.keyProviderId())) { + throw new IllegalArgumentException( + "Missing value for required field `keyProviderId`" + ); } return new EncryptedDataKeyDescription(this); } diff --git a/DynamoDbEncryption/runtimes/java/src/main/smithy-generated/software/amazon/cryptography/dbencryptionsdk/dynamodb/model/EncryptedDataKeyDescriptionOutput.java b/DynamoDbEncryption/runtimes/java/src/main/smithy-generated/software/amazon/cryptography/dbencryptionsdk/dynamodb/model/EncryptedDataKeyDescriptionOutput.java index 974750bcf..f9f99732c 100644 --- a/DynamoDbEncryption/runtimes/java/src/main/smithy-generated/software/amazon/cryptography/dbencryptionsdk/dynamodb/model/EncryptedDataKeyDescriptionOutput.java +++ b/DynamoDbEncryption/runtimes/java/src/main/smithy-generated/software/amazon/cryptography/dbencryptionsdk/dynamodb/model/EncryptedDataKeyDescriptionOutput.java @@ -6,6 +6,7 @@ import java.util.Objects; public class EncryptedDataKeyDescriptionOutput { + private final String keyProviderId; private final String keyProviderInfo; @@ -66,6 +67,7 @@ public interface Builder { } static class BuilderImpl implements Builder { + protected String keyProviderId; protected String keyProviderInfo; @@ -74,8 +76,7 @@ static class BuilderImpl implements Builder { protected String branchKeyVersion; - protected BuilderImpl() { - } + protected BuilderImpl() {} protected BuilderImpl(EncryptedDataKeyDescriptionOutput model) { this.keyProviderId = model.keyProviderId(); @@ -121,8 +122,10 @@ public String branchKeyVersion() { } public EncryptedDataKeyDescriptionOutput build() { - if (Objects.isNull(this.keyProviderId())) { - throw new IllegalArgumentException("Missing value for required field `keyProviderId`"); + if (Objects.isNull(this.keyProviderId())) { + throw new IllegalArgumentException( + "Missing value for required field `keyProviderId`" + ); } return new EncryptedDataKeyDescriptionOutput(this); } diff --git a/DynamoDbEncryption/runtimes/java/src/main/smithy-generated/software/amazon/cryptography/dbencryptionsdk/dynamodb/model/GetEncryptedDataKeyDescriptionInput.java b/DynamoDbEncryption/runtimes/java/src/main/smithy-generated/software/amazon/cryptography/dbencryptionsdk/dynamodb/model/GetEncryptedDataKeyDescriptionInput.java index ef55a98ae..71ed715d2 100644 --- a/DynamoDbEncryption/runtimes/java/src/main/smithy-generated/software/amazon/cryptography/dbencryptionsdk/dynamodb/model/GetEncryptedDataKeyDescriptionInput.java +++ b/DynamoDbEncryption/runtimes/java/src/main/smithy-generated/software/amazon/cryptography/dbencryptionsdk/dynamodb/model/GetEncryptedDataKeyDescriptionInput.java @@ -5,7 +5,11 @@ import java.util.Objects; +/** + * Input for getting encrypted data key description. + */ public class GetEncryptedDataKeyDescriptionInput { + private final GetEncryptedDataKeyDescriptionUnion input; protected GetEncryptedDataKeyDescriptionInput(BuilderImpl builder) { @@ -33,10 +37,10 @@ public interface Builder { } static class BuilderImpl implements Builder { + protected GetEncryptedDataKeyDescriptionUnion input; - protected BuilderImpl() { - } + protected BuilderImpl() {} protected BuilderImpl(GetEncryptedDataKeyDescriptionInput model) { this.input = model.input(); @@ -52,8 +56,10 @@ public GetEncryptedDataKeyDescriptionUnion input() { } public GetEncryptedDataKeyDescriptionInput build() { - if (Objects.isNull(this.input())) { - throw new IllegalArgumentException("Missing value for required field `input`"); + if (Objects.isNull(this.input())) { + throw new IllegalArgumentException( + "Missing value for required field `input`" + ); } return new GetEncryptedDataKeyDescriptionInput(this); } diff --git a/DynamoDbEncryption/runtimes/java/src/main/smithy-generated/software/amazon/cryptography/dbencryptionsdk/dynamodb/model/GetEncryptedDataKeyDescriptionOutput.java b/DynamoDbEncryption/runtimes/java/src/main/smithy-generated/software/amazon/cryptography/dbencryptionsdk/dynamodb/model/GetEncryptedDataKeyDescriptionOutput.java index 2d8e63584..42448b411 100644 --- a/DynamoDbEncryption/runtimes/java/src/main/smithy-generated/software/amazon/cryptography/dbencryptionsdk/dynamodb/model/GetEncryptedDataKeyDescriptionOutput.java +++ b/DynamoDbEncryption/runtimes/java/src/main/smithy-generated/software/amazon/cryptography/dbencryptionsdk/dynamodb/model/GetEncryptedDataKeyDescriptionOutput.java @@ -6,13 +6,26 @@ import java.util.List; import java.util.Objects; +/** + * Output for getting encrypted data key description. + */ public class GetEncryptedDataKeyDescriptionOutput { - private final List EncryptedDataKeyDescriptionOutput; + + /** + * A list of encrypted data key description. + */ + private final List< + EncryptedDataKeyDescription + > EncryptedDataKeyDescriptionOutput; protected GetEncryptedDataKeyDescriptionOutput(BuilderImpl builder) { - this.EncryptedDataKeyDescriptionOutput = builder.EncryptedDataKeyDescriptionOutput(); + this.EncryptedDataKeyDescriptionOutput = + builder.EncryptedDataKeyDescriptionOutput(); } + /** + * @return A list of encrypted data key description. + */ public List EncryptedDataKeyDescriptionOutput() { return this.EncryptedDataKeyDescriptionOutput; } @@ -26,37 +39,53 @@ public static Builder builder() { } public interface Builder { + /** + * @param EncryptedDataKeyDescriptionOutput A list of encrypted data key description. + */ Builder EncryptedDataKeyDescriptionOutput( - List EncryptedDataKeyDescriptionOutput); + List EncryptedDataKeyDescriptionOutput + ); + /** + * @return A list of encrypted data key description. + */ List EncryptedDataKeyDescriptionOutput(); GetEncryptedDataKeyDescriptionOutput build(); } static class BuilderImpl implements Builder { - protected List EncryptedDataKeyDescriptionOutput; - protected BuilderImpl() { - } + protected List< + EncryptedDataKeyDescription + > EncryptedDataKeyDescriptionOutput; + + protected BuilderImpl() {} protected BuilderImpl(GetEncryptedDataKeyDescriptionOutput model) { - this.EncryptedDataKeyDescriptionOutput = model.EncryptedDataKeyDescriptionOutput(); + this.EncryptedDataKeyDescriptionOutput = + model.EncryptedDataKeyDescriptionOutput(); } public Builder EncryptedDataKeyDescriptionOutput( - List EncryptedDataKeyDescriptionOutput) { - this.EncryptedDataKeyDescriptionOutput = EncryptedDataKeyDescriptionOutput; + List EncryptedDataKeyDescriptionOutput + ) { + this.EncryptedDataKeyDescriptionOutput = + EncryptedDataKeyDescriptionOutput; return this; } - public List EncryptedDataKeyDescriptionOutput() { + public List< + EncryptedDataKeyDescription + > EncryptedDataKeyDescriptionOutput() { return this.EncryptedDataKeyDescriptionOutput; } public GetEncryptedDataKeyDescriptionOutput build() { - if (Objects.isNull(this.EncryptedDataKeyDescriptionOutput())) { - throw new IllegalArgumentException("Missing value for required field `EncryptedDataKeyDescriptionOutput`"); + if (Objects.isNull(this.EncryptedDataKeyDescriptionOutput())) { + throw new IllegalArgumentException( + "Missing value for required field `EncryptedDataKeyDescriptionOutput`" + ); } return new GetEncryptedDataKeyDescriptionOutput(this); } diff --git a/DynamoDbEncryption/runtimes/java/src/main/smithy-generated/software/amazon/cryptography/dbencryptionsdk/dynamodb/model/GetEncryptedDataKeyDescriptionUnion.java b/DynamoDbEncryption/runtimes/java/src/main/smithy-generated/software/amazon/cryptography/dbencryptionsdk/dynamodb/model/GetEncryptedDataKeyDescriptionUnion.java index 580c4de80..ae8d95673 100644 --- a/DynamoDbEncryption/runtimes/java/src/main/smithy-generated/software/amazon/cryptography/dbencryptionsdk/dynamodb/model/GetEncryptedDataKeyDescriptionUnion.java +++ b/DynamoDbEncryption/runtimes/java/src/main/smithy-generated/software/amazon/cryptography/dbencryptionsdk/dynamodb/model/GetEncryptedDataKeyDescriptionUnion.java @@ -9,21 +9,34 @@ import software.amazon.awssdk.services.dynamodb.model.AttributeValue; public class GetEncryptedDataKeyDescriptionUnion { + + /** + * A binary header value. + */ private final ByteBuffer header; - private final Map plaintextItem; + /** + * A DynamoDB item. + */ + private final Map item; protected GetEncryptedDataKeyDescriptionUnion(BuilderImpl builder) { this.header = builder.header(); - this.plaintextItem = builder.plaintextItem(); + this.item = builder.item(); } + /** + * @return A binary header value. + */ public ByteBuffer header() { return this.header; } - public Map plaintextItem() { - return this.plaintextItem; + /** + * @return A DynamoDB item. + */ + public Map item() { + return this.item; } public Builder toBuilder() { @@ -35,28 +48,40 @@ public static Builder builder() { } public interface Builder { + /** + * @param header A binary header value. + */ Builder header(ByteBuffer header); + /** + * @return A binary header value. + */ ByteBuffer header(); - Builder plaintextItem(Map plaintextItem); + /** + * @param item A DynamoDB item. + */ + Builder item(Map item); - Map plaintextItem(); + /** + * @return A DynamoDB item. + */ + Map item(); GetEncryptedDataKeyDescriptionUnion build(); } static class BuilderImpl implements Builder { + protected ByteBuffer header; - protected Map plaintextItem; + protected Map item; - protected BuilderImpl() { - } + protected BuilderImpl() {} protected BuilderImpl(GetEncryptedDataKeyDescriptionUnion model) { this.header = model.header(); - this.plaintextItem = model.plaintextItem(); + this.item = model.item(); } public Builder header(ByteBuffer header) { @@ -68,24 +93,26 @@ public ByteBuffer header() { return this.header; } - public Builder plaintextItem(Map plaintextItem) { - this.plaintextItem = plaintextItem; + public Builder item(Map item) { + this.item = item; return this; } - public Map plaintextItem() { - return this.plaintextItem; + public Map item() { + return this.item; } public GetEncryptedDataKeyDescriptionUnion build() { if (!onlyOneNonNull()) { - throw new IllegalArgumentException("`GetEncryptedDataKeyDescriptionUnion` is a Union. A Union MUST have one and only one value set."); + throw new IllegalArgumentException( + "`GetEncryptedDataKeyDescriptionUnion` is a Union. A Union MUST have one and only one value set." + ); } return new GetEncryptedDataKeyDescriptionUnion(this); } private boolean onlyOneNonNull() { - Object[] allValues = {this.header, this.plaintextItem}; + Object[] allValues = { this.header, this.item }; boolean haveOneNonNull = false; for (Object o : allValues) { if (Objects.nonNull(o)) { diff --git a/DynamoDbEncryption/runtimes/net/Generated/DynamoDbEncryption/GetEncryptedDataKeyDescriptionUnion.cs b/DynamoDbEncryption/runtimes/net/Generated/DynamoDbEncryption/GetEncryptedDataKeyDescriptionUnion.cs index ab55a2bdb..52333120e 100644 --- a/DynamoDbEncryption/runtimes/net/Generated/DynamoDbEncryption/GetEncryptedDataKeyDescriptionUnion.cs +++ b/DynamoDbEncryption/runtimes/net/Generated/DynamoDbEncryption/GetEncryptedDataKeyDescriptionUnion.cs @@ -8,7 +8,7 @@ namespace AWS.Cryptography.DbEncryptionSDK.DynamoDb public class GetEncryptedDataKeyDescriptionUnion { private System.IO.MemoryStream _header; - private System.Collections.Generic.Dictionary _plaintextItem; + private System.Collections.Generic.Dictionary _item; public System.IO.MemoryStream Header { get { return this._header; } @@ -18,19 +18,19 @@ public bool IsSetHeader() { return this._header != null; } - public System.Collections.Generic.Dictionary PlaintextItem + public System.Collections.Generic.Dictionary Item { - get { return this._plaintextItem; } - set { this._plaintextItem = value; } + get { return this._item; } + set { this._item = value; } } - public bool IsSetPlaintextItem() + public bool IsSetItem() { - return this._plaintextItem != null; + return this._item != null; } public void Validate() { var numberOfPropertiesSet = Convert.ToUInt16(IsSetHeader()) + - Convert.ToUInt16(IsSetPlaintextItem()); + Convert.ToUInt16(IsSetItem()); if (numberOfPropertiesSet == 0) throw new System.ArgumentException("No union value set"); if (numberOfPropertiesSet > 1) throw new System.ArgumentException("Multiple union values set"); diff --git a/DynamoDbEncryption/runtimes/net/Generated/DynamoDbEncryption/TypeConversion.cs b/DynamoDbEncryption/runtimes/net/Generated/DynamoDbEncryption/TypeConversion.cs index eb7d974f0..a2a04f8ca 100644 --- a/DynamoDbEncryption/runtimes/net/Generated/DynamoDbEncryption/TypeConversion.cs +++ b/DynamoDbEncryption/runtimes/net/Generated/DynamoDbEncryption/TypeConversion.cs @@ -207,9 +207,9 @@ public static AWS.Cryptography.DbEncryptionSDK.DynamoDb.GetEncryptedDataKeyDescr converted.Header = FromDafny_N3_aws__N12_cryptography__N15_dbEncryptionSdk__N8_dynamoDb__S35_GetEncryptedDataKeyDescriptionUnion__M6_header(concrete.dtor_header); return converted; } - if (value.is_plaintextItem) + if (value.is_item) { - converted.PlaintextItem = FromDafny_N3_aws__N12_cryptography__N15_dbEncryptionSdk__N8_dynamoDb__S35_GetEncryptedDataKeyDescriptionUnion__M13_plaintextItem(concrete.dtor_plaintextItem); + converted.Item = FromDafny_N3_aws__N12_cryptography__N15_dbEncryptionSdk__N8_dynamoDb__S35_GetEncryptedDataKeyDescriptionUnion__M4_item(concrete.dtor_item); return converted; } throw new System.ArgumentException("Invalid AWS.Cryptography.DbEncryptionSDK.DynamoDb.GetEncryptedDataKeyDescriptionUnion state"); @@ -220,9 +220,9 @@ public static software.amazon.cryptography.dbencryptionsdk.dynamodb.internaldafn { return software.amazon.cryptography.dbencryptionsdk.dynamodb.internaldafny.types.GetEncryptedDataKeyDescriptionUnion.create_header(ToDafny_N3_aws__N12_cryptography__N15_dbEncryptionSdk__N8_dynamoDb__S35_GetEncryptedDataKeyDescriptionUnion__M6_header(value.Header)); } - if (value.IsSetPlaintextItem()) + if (value.IsSetItem()) { - return software.amazon.cryptography.dbencryptionsdk.dynamodb.internaldafny.types.GetEncryptedDataKeyDescriptionUnion.create_plaintextItem(ToDafny_N3_aws__N12_cryptography__N15_dbEncryptionSdk__N8_dynamoDb__S35_GetEncryptedDataKeyDescriptionUnion__M13_plaintextItem(value.PlaintextItem)); + return software.amazon.cryptography.dbencryptionsdk.dynamodb.internaldafny.types.GetEncryptedDataKeyDescriptionUnion.create_item(ToDafny_N3_aws__N12_cryptography__N15_dbEncryptionSdk__N8_dynamoDb__S35_GetEncryptedDataKeyDescriptionUnion__M4_item(value.Item)); } throw new System.ArgumentException("Invalid AWS.Cryptography.DbEncryptionSDK.DynamoDb.GetEncryptedDataKeyDescriptionUnion state"); } @@ -447,11 +447,11 @@ public static Dafny.ISequence ToDafny_N3_aws__N12_cryptography__N15_dbEncr { return ToDafny_N6_smithy__N3_api__S4_Blob(value); } - public static System.Collections.Generic.Dictionary FromDafny_N3_aws__N12_cryptography__N15_dbEncryptionSdk__N8_dynamoDb__S35_GetEncryptedDataKeyDescriptionUnion__M13_plaintextItem(Dafny.IMap, software.amazon.cryptography.services.dynamodb.internaldafny.types._IAttributeValue> value) + public static System.Collections.Generic.Dictionary FromDafny_N3_aws__N12_cryptography__N15_dbEncryptionSdk__N8_dynamoDb__S35_GetEncryptedDataKeyDescriptionUnion__M4_item(Dafny.IMap, software.amazon.cryptography.services.dynamodb.internaldafny.types._IAttributeValue> value) { return FromDafny_N3_com__N9_amazonaws__N8_dynamodb__S12_AttributeMap(value); } - public static Dafny.IMap, software.amazon.cryptography.services.dynamodb.internaldafny.types._IAttributeValue> ToDafny_N3_aws__N12_cryptography__N15_dbEncryptionSdk__N8_dynamoDb__S35_GetEncryptedDataKeyDescriptionUnion__M13_plaintextItem(System.Collections.Generic.Dictionary value) + public static Dafny.IMap, software.amazon.cryptography.services.dynamodb.internaldafny.types._IAttributeValue> ToDafny_N3_aws__N12_cryptography__N15_dbEncryptionSdk__N8_dynamoDb__S35_GetEncryptedDataKeyDescriptionUnion__M4_item(System.Collections.Generic.Dictionary value) { return ToDafny_N3_com__N9_amazonaws__N8_dynamodb__S12_AttributeMap(value); } diff --git a/Examples/runtimes/java/DynamoDbEncryption/src/main/java/software/amazon/cryptography/examples/GetEncryptedDataKeyDescriptionExample.java b/Examples/runtimes/java/DynamoDbEncryption/src/main/java/software/amazon/cryptography/examples/GetEncryptedDataKeyDescriptionExample.java index 56b4ba324..7474b8adf 100644 --- a/Examples/runtimes/java/DynamoDbEncryption/src/main/java/software/amazon/cryptography/examples/GetEncryptedDataKeyDescriptionExample.java +++ b/Examples/runtimes/java/DynamoDbEncryption/src/main/java/software/amazon/cryptography/examples/GetEncryptedDataKeyDescriptionExample.java @@ -43,7 +43,7 @@ public static void getEncryptedDataKeyDescription( // 3. Prepare the input for GetEncryptedDataKeyDescription method. // This input can be a DynamoDB item or a header. For now, we are giving input as a DynamoDB item - // but users can also extract the header from the column "aws_dbe_head" in the DynamoDB table + // but users can also extract the header from the attribute "aws_dbe_head" in the DynamoDB table // and use it for GetEncryptedDataKeyDescription method. DynamoDbEncryption ddbEnc = DynamoDbEncryption.builder() .DynamoDbEncryptionConfig(DynamoDbEncryptionConfig.builder().build()) @@ -59,8 +59,8 @@ public static void getEncryptedDataKeyDescription( // In the following code, we are giving input as header instead of a complete DynamoDB item // This code is provided solely to demo how the alternative approach works. So, it is commented. - // String header_column = "aws_dbe_head"; - // ByteBuffer header = returnedItem.get(header_column).b().asByteBuffer(); + // String header_attribute = "aws_dbe_head"; + // ByteBuffer header = returnedItem.get(header_attribute).b().asByteBuffer(); // GetEncryptedDataKeyDescriptionUnion InputUnion = GetEncryptedDataKeyDescriptionUnion.builder() // .header(header) // .build(); diff --git a/Examples/runtimes/net/src/GetEncryptedDataKeyDescriptionExample.cs b/Examples/runtimes/net/src/GetEncryptedDataKeyDescriptionExample.cs index 378177387..5223b964f 100644 --- a/Examples/runtimes/net/src/GetEncryptedDataKeyDescriptionExample.cs +++ b/Examples/runtimes/net/src/GetEncryptedDataKeyDescriptionExample.cs @@ -44,8 +44,8 @@ public static async Task GetEncryptedDataKeyDescription() // The code below shows how we can send header as the input to the DynamoDB. This code is written to demo the // alternative approach. So, it is commented. - // string header_column = "aws_dbe_head"; - // InputUnion.Header = returnedItem[header_column].B; + // string header_attribute = "aws_dbe_head"; + // InputUnion.Header = returnedItem[header_attribute].B; GetEncryptedDataKeyDescriptionInput Input = new GetEncryptedDataKeyDescriptionInput(); Input.Input = InputUnion; diff --git a/TestVectors/runtimes/java/src/main/smithy-generated/software/amazon/cryptography/dbencryptionsdk/dynamodb/wrapped/TestDynamoDbEncryption.java b/TestVectors/runtimes/java/src/main/smithy-generated/software/amazon/cryptography/dbencryptionsdk/dynamodb/wrapped/TestDynamoDbEncryption.java index 59d05bf83..acf30bd1e 100644 --- a/TestVectors/runtimes/java/src/main/smithy-generated/software/amazon/cryptography/dbencryptionsdk/dynamodb/wrapped/TestDynamoDbEncryption.java +++ b/TestVectors/runtimes/java/src/main/smithy-generated/software/amazon/cryptography/dbencryptionsdk/dynamodb/wrapped/TestDynamoDbEncryption.java @@ -48,12 +48,19 @@ > CreateDynamoDbEncryptionBranchKeyIdSupplier( } } - public Result GetEncryptedDataKeyDescription( - GetEncryptedDataKeyDescriptionInput dafnyInput) { - software.amazon.cryptography.dbencryptionsdk.dynamodb.model.GetEncryptedDataKeyDescriptionInput nativeInput = ToNative.GetEncryptedDataKeyDescriptionInput(dafnyInput); + public Result< + GetEncryptedDataKeyDescriptionOutput, + Error + > GetEncryptedDataKeyDescription( + GetEncryptedDataKeyDescriptionInput dafnyInput + ) { try { - software.amazon.cryptography.dbencryptionsdk.dynamodb.model.GetEncryptedDataKeyDescriptionOutput nativeOutput = this._impl.GetEncryptedDataKeyDescription(nativeInput); - GetEncryptedDataKeyDescriptionOutput dafnyOutput = ToDafny.GetEncryptedDataKeyDescriptionOutput(nativeOutput); + software.amazon.cryptography.dbencryptionsdk.dynamodb.model.GetEncryptedDataKeyDescriptionInput nativeInput = + ToNative.GetEncryptedDataKeyDescriptionInput(dafnyInput); + software.amazon.cryptography.dbencryptionsdk.dynamodb.model.GetEncryptedDataKeyDescriptionOutput nativeOutput = + this._impl.GetEncryptedDataKeyDescription(nativeInput); + GetEncryptedDataKeyDescriptionOutput dafnyOutput = + ToDafny.GetEncryptedDataKeyDescriptionOutput(nativeOutput); return Result.create_Success(dafnyOutput); } catch (RuntimeException ex) { return Result.create_Failure(ToDafny.Error(ex)); diff --git a/TestVectors/runtimes/net/Generated/DDBEncryption/DynamoDbEncryptionShim.cs b/TestVectors/runtimes/net/Generated/DDBEncryption/DynamoDbEncryptionShim.cs index e7c16dc46..cc97276fc 100644 --- a/TestVectors/runtimes/net/Generated/DDBEncryption/DynamoDbEncryptionShim.cs +++ b/TestVectors/runtimes/net/Generated/DDBEncryption/DynamoDbEncryptionShim.cs @@ -28,6 +28,21 @@ public DynamoDbEncryptionShim(AWS.Cryptography.DbEncryptionSDK.DynamoDb.DynamoDb return Wrappers_Compile.Result.create_Failure(this.ConvertError(ex)); } + } + public Wrappers_Compile._IResult GetEncryptedDataKeyDescription(software.amazon.cryptography.dbencryptionsdk.dynamodb.internaldafny.types._IGetEncryptedDataKeyDescriptionInput request) + { + try + { + AWS.Cryptography.DbEncryptionSDK.DynamoDb.GetEncryptedDataKeyDescriptionInput unWrappedRequest = TypeConversion.FromDafny_N3_aws__N12_cryptography__N15_dbEncryptionSdk__N8_dynamoDb__S35_GetEncryptedDataKeyDescriptionInput(request); + AWS.Cryptography.DbEncryptionSDK.DynamoDb.GetEncryptedDataKeyDescriptionOutput wrappedResponse = + this._impl.GetEncryptedDataKeyDescription(unWrappedRequest); + return Wrappers_Compile.Result.create_Success(TypeConversion.ToDafny_N3_aws__N12_cryptography__N15_dbEncryptionSdk__N8_dynamoDb__S36_GetEncryptedDataKeyDescriptionOutput(wrappedResponse)); + } + catch (System.Exception ex) + { + return Wrappers_Compile.Result.create_Failure(this.ConvertError(ex)); + } + } private software.amazon.cryptography.dbencryptionsdk.dynamodb.internaldafny.types._IError ConvertError(System.Exception error) { diff --git a/TestVectors/runtimes/net/Generated/DDBEncryption/TypeConversion.cs b/TestVectors/runtimes/net/Generated/DDBEncryption/TypeConversion.cs index c4b5803f8..a611ed8b5 100644 --- a/TestVectors/runtimes/net/Generated/DDBEncryption/TypeConversion.cs +++ b/TestVectors/runtimes/net/Generated/DDBEncryption/TypeConversion.cs @@ -142,6 +142,53 @@ public static software.amazon.cryptography.dbencryptionsdk.dynamodb.internaldafn return new software.amazon.cryptography.dbencryptionsdk.dynamodb.internaldafny.types.GetBranchKeyIdFromDdbKeyOutput(ToDafny_N3_aws__N12_cryptography__N15_dbEncryptionSdk__N8_dynamoDb__S30_GetBranchKeyIdFromDdbKeyOutput__M11_branchKeyId(value.BranchKeyId)); } + public static AWS.Cryptography.DbEncryptionSDK.DynamoDb.GetEncryptedDataKeyDescriptionInput FromDafny_N3_aws__N12_cryptography__N15_dbEncryptionSdk__N8_dynamoDb__S35_GetEncryptedDataKeyDescriptionInput(software.amazon.cryptography.dbencryptionsdk.dynamodb.internaldafny.types._IGetEncryptedDataKeyDescriptionInput value) + { + software.amazon.cryptography.dbencryptionsdk.dynamodb.internaldafny.types.GetEncryptedDataKeyDescriptionInput concrete = (software.amazon.cryptography.dbencryptionsdk.dynamodb.internaldafny.types.GetEncryptedDataKeyDescriptionInput)value; AWS.Cryptography.DbEncryptionSDK.DynamoDb.GetEncryptedDataKeyDescriptionInput converted = new AWS.Cryptography.DbEncryptionSDK.DynamoDb.GetEncryptedDataKeyDescriptionInput(); converted.Input = (AWS.Cryptography.DbEncryptionSDK.DynamoDb.GetEncryptedDataKeyDescriptionUnion)FromDafny_N3_aws__N12_cryptography__N15_dbEncryptionSdk__N8_dynamoDb__S35_GetEncryptedDataKeyDescriptionInput__M5_input(concrete._input); return converted; + } + public static software.amazon.cryptography.dbencryptionsdk.dynamodb.internaldafny.types._IGetEncryptedDataKeyDescriptionInput ToDafny_N3_aws__N12_cryptography__N15_dbEncryptionSdk__N8_dynamoDb__S35_GetEncryptedDataKeyDescriptionInput(AWS.Cryptography.DbEncryptionSDK.DynamoDb.GetEncryptedDataKeyDescriptionInput value) + { + value.Validate(); + + return new software.amazon.cryptography.dbencryptionsdk.dynamodb.internaldafny.types.GetEncryptedDataKeyDescriptionInput(ToDafny_N3_aws__N12_cryptography__N15_dbEncryptionSdk__N8_dynamoDb__S35_GetEncryptedDataKeyDescriptionInput__M5_input(value.Input)); + } + public static AWS.Cryptography.DbEncryptionSDK.DynamoDb.GetEncryptedDataKeyDescriptionOutput FromDafny_N3_aws__N12_cryptography__N15_dbEncryptionSdk__N8_dynamoDb__S36_GetEncryptedDataKeyDescriptionOutput(software.amazon.cryptography.dbencryptionsdk.dynamodb.internaldafny.types._IGetEncryptedDataKeyDescriptionOutput value) + { + software.amazon.cryptography.dbencryptionsdk.dynamodb.internaldafny.types.GetEncryptedDataKeyDescriptionOutput concrete = (software.amazon.cryptography.dbencryptionsdk.dynamodb.internaldafny.types.GetEncryptedDataKeyDescriptionOutput)value; AWS.Cryptography.DbEncryptionSDK.DynamoDb.GetEncryptedDataKeyDescriptionOutput converted = new AWS.Cryptography.DbEncryptionSDK.DynamoDb.GetEncryptedDataKeyDescriptionOutput(); converted.EncryptedDataKeyDescriptionOutput = (System.Collections.Generic.List)FromDafny_N3_aws__N12_cryptography__N15_dbEncryptionSdk__N8_dynamoDb__S36_GetEncryptedDataKeyDescriptionOutput__M33_EncryptedDataKeyDescriptionOutput(concrete._EncryptedDataKeyDescriptionOutput); return converted; + } + public static software.amazon.cryptography.dbencryptionsdk.dynamodb.internaldafny.types._IGetEncryptedDataKeyDescriptionOutput ToDafny_N3_aws__N12_cryptography__N15_dbEncryptionSdk__N8_dynamoDb__S36_GetEncryptedDataKeyDescriptionOutput(AWS.Cryptography.DbEncryptionSDK.DynamoDb.GetEncryptedDataKeyDescriptionOutput value) + { + value.Validate(); + + return new software.amazon.cryptography.dbencryptionsdk.dynamodb.internaldafny.types.GetEncryptedDataKeyDescriptionOutput(ToDafny_N3_aws__N12_cryptography__N15_dbEncryptionSdk__N8_dynamoDb__S36_GetEncryptedDataKeyDescriptionOutput__M33_EncryptedDataKeyDescriptionOutput(value.EncryptedDataKeyDescriptionOutput)); + } + public static AWS.Cryptography.DbEncryptionSDK.DynamoDb.GetEncryptedDataKeyDescriptionUnion FromDafny_N3_aws__N12_cryptography__N15_dbEncryptionSdk__N8_dynamoDb__S35_GetEncryptedDataKeyDescriptionUnion(software.amazon.cryptography.dbencryptionsdk.dynamodb.internaldafny.types._IGetEncryptedDataKeyDescriptionUnion value) + { + software.amazon.cryptography.dbencryptionsdk.dynamodb.internaldafny.types.GetEncryptedDataKeyDescriptionUnion concrete = (software.amazon.cryptography.dbencryptionsdk.dynamodb.internaldafny.types.GetEncryptedDataKeyDescriptionUnion)value; + var converted = new AWS.Cryptography.DbEncryptionSDK.DynamoDb.GetEncryptedDataKeyDescriptionUnion(); if (value.is_header) + { + converted.Header = FromDafny_N3_aws__N12_cryptography__N15_dbEncryptionSdk__N8_dynamoDb__S35_GetEncryptedDataKeyDescriptionUnion__M6_header(concrete.dtor_header); + return converted; + } + if (value.is_item) + { + converted.Item = FromDafny_N3_aws__N12_cryptography__N15_dbEncryptionSdk__N8_dynamoDb__S35_GetEncryptedDataKeyDescriptionUnion__M4_item(concrete.dtor_item); + return converted; + } + throw new System.ArgumentException("Invalid AWS.Cryptography.DbEncryptionSDK.DynamoDb.GetEncryptedDataKeyDescriptionUnion state"); + } + public static software.amazon.cryptography.dbencryptionsdk.dynamodb.internaldafny.types._IGetEncryptedDataKeyDescriptionUnion ToDafny_N3_aws__N12_cryptography__N15_dbEncryptionSdk__N8_dynamoDb__S35_GetEncryptedDataKeyDescriptionUnion(AWS.Cryptography.DbEncryptionSDK.DynamoDb.GetEncryptedDataKeyDescriptionUnion value) + { + value.Validate(); if (value.IsSetHeader()) + { + return software.amazon.cryptography.dbencryptionsdk.dynamodb.internaldafny.types.GetEncryptedDataKeyDescriptionUnion.create_header(ToDafny_N3_aws__N12_cryptography__N15_dbEncryptionSdk__N8_dynamoDb__S35_GetEncryptedDataKeyDescriptionUnion__M6_header(value.Header)); + } + if (value.IsSetItem()) + { + return software.amazon.cryptography.dbencryptionsdk.dynamodb.internaldafny.types.GetEncryptedDataKeyDescriptionUnion.create_item(ToDafny_N3_aws__N12_cryptography__N15_dbEncryptionSdk__N8_dynamoDb__S35_GetEncryptedDataKeyDescriptionUnion__M4_item(value.Item)); + } + throw new System.ArgumentException("Invalid AWS.Cryptography.DbEncryptionSDK.DynamoDb.GetEncryptedDataKeyDescriptionUnion state"); + } public static AWS.Cryptography.DbEncryptionSDK.DynamoDb.LegacyPolicy FromDafny_N3_aws__N12_cryptography__N15_dbEncryptionSdk__N8_dynamoDb__S12_LegacyPolicy(software.amazon.cryptography.dbencryptionsdk.dynamodb.internaldafny.types._ILegacyPolicy value) { if (value.is_FORCE__LEGACY__ENCRYPT__ALLOW__LEGACY__DECRYPT) return AWS.Cryptography.DbEncryptionSDK.DynamoDb.LegacyPolicy.FORCE_LEGACY_ENCRYPT_ALLOW_LEGACY_DECRYPT; @@ -339,11 +386,43 @@ public static Dafny.ISequence ToDafny_N3_aws__N12_cryptography__N15_dbEncr { return ToDafny_N6_smithy__N3_api__S6_String(value); } + public static AWS.Cryptography.DbEncryptionSDK.DynamoDb.GetEncryptedDataKeyDescriptionUnion FromDafny_N3_aws__N12_cryptography__N15_dbEncryptionSdk__N8_dynamoDb__S35_GetEncryptedDataKeyDescriptionInput__M5_input(software.amazon.cryptography.dbencryptionsdk.dynamodb.internaldafny.types._IGetEncryptedDataKeyDescriptionUnion value) + { + return FromDafny_N3_aws__N12_cryptography__N15_dbEncryptionSdk__N8_dynamoDb__S35_GetEncryptedDataKeyDescriptionUnion(value); + } + public static software.amazon.cryptography.dbencryptionsdk.dynamodb.internaldafny.types._IGetEncryptedDataKeyDescriptionUnion ToDafny_N3_aws__N12_cryptography__N15_dbEncryptionSdk__N8_dynamoDb__S35_GetEncryptedDataKeyDescriptionInput__M5_input(AWS.Cryptography.DbEncryptionSDK.DynamoDb.GetEncryptedDataKeyDescriptionUnion value) + { + return ToDafny_N3_aws__N12_cryptography__N15_dbEncryptionSdk__N8_dynamoDb__S35_GetEncryptedDataKeyDescriptionUnion(value); + } + public static System.Collections.Generic.List FromDafny_N3_aws__N12_cryptography__N15_dbEncryptionSdk__N8_dynamoDb__S36_GetEncryptedDataKeyDescriptionOutput__M33_EncryptedDataKeyDescriptionOutput(Dafny.ISequence value) + { + return FromDafny_N3_aws__N12_cryptography__N15_dbEncryptionSdk__N8_dynamoDb__S31_EncryptedDataKeyDescriptionList(value); + } + public static Dafny.ISequence ToDafny_N3_aws__N12_cryptography__N15_dbEncryptionSdk__N8_dynamoDb__S36_GetEncryptedDataKeyDescriptionOutput__M33_EncryptedDataKeyDescriptionOutput(System.Collections.Generic.List value) + { + return ToDafny_N3_aws__N12_cryptography__N15_dbEncryptionSdk__N8_dynamoDb__S31_EncryptedDataKeyDescriptionList(value); + } + public static System.IO.MemoryStream FromDafny_N3_aws__N12_cryptography__N15_dbEncryptionSdk__N8_dynamoDb__S35_GetEncryptedDataKeyDescriptionUnion__M6_header(Dafny.ISequence value) + { + return FromDafny_N6_smithy__N3_api__S4_Blob(value); + } + public static Dafny.ISequence ToDafny_N3_aws__N12_cryptography__N15_dbEncryptionSdk__N8_dynamoDb__S35_GetEncryptedDataKeyDescriptionUnion__M6_header(System.IO.MemoryStream value) + { + return ToDafny_N6_smithy__N3_api__S4_Blob(value); + } + public static System.Collections.Generic.Dictionary FromDafny_N3_aws__N12_cryptography__N15_dbEncryptionSdk__N8_dynamoDb__S35_GetEncryptedDataKeyDescriptionUnion__M4_item(Dafny.IMap, software.amazon.cryptography.services.dynamodb.internaldafny.types._IAttributeValue> value) + { + return FromDafny_N3_com__N9_amazonaws__N8_dynamodb__S12_AttributeMap(value); + } + public static Dafny.IMap, software.amazon.cryptography.services.dynamodb.internaldafny.types._IAttributeValue> ToDafny_N3_aws__N12_cryptography__N15_dbEncryptionSdk__N8_dynamoDb__S35_GetEncryptedDataKeyDescriptionUnion__M4_item(System.Collections.Generic.Dictionary value) + { + return ToDafny_N3_com__N9_amazonaws__N8_dynamodb__S12_AttributeMap(value); + } public static AWS.Cryptography.DbEncryptionSDK.DynamoDb.Upper FromDafny_N3_aws__N12_cryptography__N15_dbEncryptionSdk__N8_dynamoDb__S16_VirtualTransform__M5_upper(software.amazon.cryptography.dbencryptionsdk.dynamodb.internaldafny.types._IUpper value) { return FromDafny_N3_aws__N12_cryptography__N15_dbEncryptionSdk__N8_dynamoDb__S5_Upper(value); } - public static software.amazon.cryptography.dbencryptionsdk.dynamodb.internaldafny.types._IUpper ToDafny_N3_aws__N12_cryptography__N15_dbEncryptionSdk__N8_dynamoDb__S16_VirtualTransform__M5_upper(AWS.Cryptography.DbEncryptionSDK.DynamoDb.Upper value) + public static software.amaztuson.cryptography.dbencryptionsdk.dynamodb.internaldafny.types._IUpper ToDafny_N3_aws__N12_cryptography__N15_dbEncryptionSdk__N8_dynamoDb__S16_VirtualTransform__M5_upper(AWS.Cryptography.DbEncryptionSDK.DynamoDb.Upper value) { return ToDafny_N3_aws__N12_cryptography__N15_dbEncryptionSdk__N8_dynamoDb__S5_Upper(value); } @@ -508,6 +587,37 @@ public static Dafny.ISequence ToDafny_N6_smithy__N3_api__S6_String(string new Dafny.Pair, software.amazon.cryptography.services.dynamodb.internaldafny.types._IAttributeValue>(ToDafny_N3_com__N9_amazonaws__N8_dynamodb__S3_Key__M3_key(pair.Key), ToDafny_N3_com__N9_amazonaws__N8_dynamodb__S3_Key__M5_value(pair.Value)) )); } + public static System.Collections.Generic.List FromDafny_N3_aws__N12_cryptography__N15_dbEncryptionSdk__N8_dynamoDb__S31_EncryptedDataKeyDescriptionList(Dafny.ISequence value) + { + return new System.Collections.Generic.List(value.Elements.Select(FromDafny_N3_aws__N12_cryptography__N15_dbEncryptionSdk__N8_dynamoDb__S31_EncryptedDataKeyDescriptionList__M6_member)); + } + public static Dafny.ISequence ToDafny_N3_aws__N12_cryptography__N15_dbEncryptionSdk__N8_dynamoDb__S31_EncryptedDataKeyDescriptionList(System.Collections.Generic.List value) + { + return Dafny.Sequence.FromArray(value.Select(ToDafny_N3_aws__N12_cryptography__N15_dbEncryptionSdk__N8_dynamoDb__S31_EncryptedDataKeyDescriptionList__M6_member).ToArray()); + } + public static System.IO.MemoryStream FromDafny_N6_smithy__N3_api__S4_Blob(Dafny.ISequence value) + { + return new System.IO.MemoryStream(value.Elements); + } + public static Dafny.ISequence ToDafny_N6_smithy__N3_api__S4_Blob(System.IO.MemoryStream value) + { + if (value.ToArray().Length == 0 && value.Length > 0) + { + throw new System.ArgumentException("Fatal Error: MemoryStream instance not backed by an array!"); + } + return Dafny.Sequence.FromArray(value.ToArray()); + + } + public static System.Collections.Generic.Dictionary FromDafny_N3_com__N9_amazonaws__N8_dynamodb__S12_AttributeMap(Dafny.IMap, software.amazon.cryptography.services.dynamodb.internaldafny.types._IAttributeValue> value) + { + return value.ItemEnumerable.ToDictionary(pair => FromDafny_N3_com__N9_amazonaws__N8_dynamodb__S12_AttributeMap__M3_key(pair.Car), pair => FromDafny_N3_com__N9_amazonaws__N8_dynamodb__S12_AttributeMap__M5_value(pair.Cdr)); + } + public static Dafny.IMap, software.amazon.cryptography.services.dynamodb.internaldafny.types._IAttributeValue> ToDafny_N3_com__N9_amazonaws__N8_dynamodb__S12_AttributeMap(System.Collections.Generic.Dictionary value) + { + return Dafny.Map, software.amazon.cryptography.services.dynamodb.internaldafny.types._IAttributeValue>.FromCollection(value.Select(pair => + new Dafny.Pair, software.amazon.cryptography.services.dynamodb.internaldafny.types._IAttributeValue>(ToDafny_N3_com__N9_amazonaws__N8_dynamodb__S12_AttributeMap__M3_key(pair.Key), ToDafny_N3_com__N9_amazonaws__N8_dynamodb__S12_AttributeMap__M5_value(pair.Value)) + )); + } public static AWS.Cryptography.DbEncryptionSDK.DynamoDb.Upper FromDafny_N3_aws__N12_cryptography__N15_dbEncryptionSdk__N8_dynamoDb__S5_Upper(software.amazon.cryptography.dbencryptionsdk.dynamodb.internaldafny.types._IUpper value) { software.amazon.cryptography.dbencryptionsdk.dynamodb.internaldafny.types.Upper concrete = (software.amazon.cryptography.dbencryptionsdk.dynamodb.internaldafny.types.Upper)value; AWS.Cryptography.DbEncryptionSDK.DynamoDb.Upper converted = new AWS.Cryptography.DbEncryptionSDK.DynamoDb.Upper(); return converted; @@ -664,6 +774,30 @@ public static software.amazon.cryptography.services.dynamodb.internaldafny.types { return ToDafny_N3_com__N9_amazonaws__N8_dynamodb__S14_AttributeValue(value); } + public static AWS.Cryptography.DbEncryptionSDK.DynamoDb.EncryptedDataKeyDescription FromDafny_N3_aws__N12_cryptography__N15_dbEncryptionSdk__N8_dynamoDb__S31_EncryptedDataKeyDescriptionList__M6_member(software.amazon.cryptography.dbencryptionsdk.dynamodb.internaldafny.types._IEncryptedDataKeyDescription value) + { + return FromDafny_N3_aws__N12_cryptography__N15_dbEncryptionSdk__N8_dynamoDb__S27_EncryptedDataKeyDescription(value); + } + public static software.amazon.cryptography.dbencryptionsdk.dynamodb.internaldafny.types._IEncryptedDataKeyDescription ToDafny_N3_aws__N12_cryptography__N15_dbEncryptionSdk__N8_dynamoDb__S31_EncryptedDataKeyDescriptionList__M6_member(AWS.Cryptography.DbEncryptionSDK.DynamoDb.EncryptedDataKeyDescription value) + { + return ToDafny_N3_aws__N12_cryptography__N15_dbEncryptionSdk__N8_dynamoDb__S27_EncryptedDataKeyDescription(value); + } + public static string FromDafny_N3_com__N9_amazonaws__N8_dynamodb__S12_AttributeMap__M3_key(Dafny.ISequence value) + { + return FromDafny_N3_com__N9_amazonaws__N8_dynamodb__S13_AttributeName(value); + } + public static Dafny.ISequence ToDafny_N3_com__N9_amazonaws__N8_dynamodb__S12_AttributeMap__M3_key(string value) + { + return ToDafny_N3_com__N9_amazonaws__N8_dynamodb__S13_AttributeName(value); + } + public static Amazon.DynamoDBv2.Model.AttributeValue FromDafny_N3_com__N9_amazonaws__N8_dynamodb__S12_AttributeMap__M5_value(software.amazon.cryptography.services.dynamodb.internaldafny.types._IAttributeValue value) + { + return FromDafny_N3_com__N9_amazonaws__N8_dynamodb__S14_AttributeValue(value); + } + public static software.amazon.cryptography.services.dynamodb.internaldafny.types._IAttributeValue ToDafny_N3_com__N9_amazonaws__N8_dynamodb__S12_AttributeMap__M5_value(Amazon.DynamoDBv2.Model.AttributeValue value) + { + return ToDafny_N3_com__N9_amazonaws__N8_dynamodb__S14_AttributeValue(value); + } public static string FromDafny_N3_aws__N12_cryptography__N15_dbEncryptionSdk__N8_dynamoDb__S6_Insert__M7_literal(Dafny.ISequence value) { return FromDafny_N6_smithy__N3_api__S6_String(value); @@ -913,6 +1047,21 @@ public static software.amazon.cryptography.services.dynamodb.internaldafny.types } throw new System.ArgumentException("Invalid Amazon.DynamoDBv2.Model.AttributeValue state"); } + public static AWS.Cryptography.DbEncryptionSDK.DynamoDb.EncryptedDataKeyDescription FromDafny_N3_aws__N12_cryptography__N15_dbEncryptionSdk__N8_dynamoDb__S27_EncryptedDataKeyDescription(software.amazon.cryptography.dbencryptionsdk.dynamodb.internaldafny.types._IEncryptedDataKeyDescription value) + { + software.amazon.cryptography.dbencryptionsdk.dynamodb.internaldafny.types.EncryptedDataKeyDescription concrete = (software.amazon.cryptography.dbencryptionsdk.dynamodb.internaldafny.types.EncryptedDataKeyDescription)value; AWS.Cryptography.DbEncryptionSDK.DynamoDb.EncryptedDataKeyDescription converted = new AWS.Cryptography.DbEncryptionSDK.DynamoDb.EncryptedDataKeyDescription(); converted.KeyProviderId = (string)FromDafny_N3_aws__N12_cryptography__N15_dbEncryptionSdk__N8_dynamoDb__S27_EncryptedDataKeyDescription__M13_keyProviderId(concrete._keyProviderId); + if (concrete._keyProviderInfo.is_Some) converted.KeyProviderInfo = (string)FromDafny_N3_aws__N12_cryptography__N15_dbEncryptionSdk__N8_dynamoDb__S27_EncryptedDataKeyDescription__M15_keyProviderInfo(concrete._keyProviderInfo); + if (concrete._branchKeyId.is_Some) converted.BranchKeyId = (string)FromDafny_N3_aws__N12_cryptography__N15_dbEncryptionSdk__N8_dynamoDb__S27_EncryptedDataKeyDescription__M11_branchKeyId(concrete._branchKeyId); + if (concrete._branchKeyVersion.is_Some) converted.BranchKeyVersion = (string)FromDafny_N3_aws__N12_cryptography__N15_dbEncryptionSdk__N8_dynamoDb__S27_EncryptedDataKeyDescription__M16_branchKeyVersion(concrete._branchKeyVersion); return converted; + } + public static software.amazon.cryptography.dbencryptionsdk.dynamodb.internaldafny.types._IEncryptedDataKeyDescription ToDafny_N3_aws__N12_cryptography__N15_dbEncryptionSdk__N8_dynamoDb__S27_EncryptedDataKeyDescription(AWS.Cryptography.DbEncryptionSDK.DynamoDb.EncryptedDataKeyDescription value) + { + value.Validate(); + string var_keyProviderInfo = value.IsSetKeyProviderInfo() ? value.KeyProviderInfo : (string)null; + string var_branchKeyId = value.IsSetBranchKeyId() ? value.BranchKeyId : (string)null; + string var_branchKeyVersion = value.IsSetBranchKeyVersion() ? value.BranchKeyVersion : (string)null; + return new software.amazon.cryptography.dbencryptionsdk.dynamodb.internaldafny.types.EncryptedDataKeyDescription(ToDafny_N3_aws__N12_cryptography__N15_dbEncryptionSdk__N8_dynamoDb__S27_EncryptedDataKeyDescription__M13_keyProviderId(value.KeyProviderId), ToDafny_N3_aws__N12_cryptography__N15_dbEncryptionSdk__N8_dynamoDb__S27_EncryptedDataKeyDescription__M15_keyProviderInfo(var_keyProviderInfo), ToDafny_N3_aws__N12_cryptography__N15_dbEncryptionSdk__N8_dynamoDb__S27_EncryptedDataKeyDescription__M11_branchKeyId(var_branchKeyId), ToDafny_N3_aws__N12_cryptography__N15_dbEncryptionSdk__N8_dynamoDb__S27_EncryptedDataKeyDescription__M16_branchKeyVersion(var_branchKeyVersion)); + } public static string FromDafny_N3_aws__N12_cryptography__N15_dbEncryptionSdk__N8_dynamoDb__S4_Char(Dafny.ISequence value) { return new string(value.Elements); @@ -1041,6 +1190,38 @@ public static bool ToDafny_N3_com__N9_amazonaws__N8_dynamodb__S14_AttributeValue { return ToDafny_N3_com__N9_amazonaws__N8_dynamodb__S21_BooleanAttributeValue(value); } + public static string FromDafny_N3_aws__N12_cryptography__N15_dbEncryptionSdk__N8_dynamoDb__S27_EncryptedDataKeyDescription__M13_keyProviderId(Dafny.ISequence value) + { + return FromDafny_N6_smithy__N3_api__S6_String(value); + } + public static Dafny.ISequence ToDafny_N3_aws__N12_cryptography__N15_dbEncryptionSdk__N8_dynamoDb__S27_EncryptedDataKeyDescription__M13_keyProviderId(string value) + { + return ToDafny_N6_smithy__N3_api__S6_String(value); + } + public static string FromDafny_N3_aws__N12_cryptography__N15_dbEncryptionSdk__N8_dynamoDb__S27_EncryptedDataKeyDescription__M15_keyProviderInfo(Wrappers_Compile._IOption> value) + { + return value.is_None ? (string)null : FromDafny_N6_smithy__N3_api__S6_String(value.Extract()); + } + public static Wrappers_Compile._IOption> ToDafny_N3_aws__N12_cryptography__N15_dbEncryptionSdk__N8_dynamoDb__S27_EncryptedDataKeyDescription__M15_keyProviderInfo(string value) + { + return value == null ? Wrappers_Compile.Option>.create_None() : Wrappers_Compile.Option>.create_Some(ToDafny_N6_smithy__N3_api__S6_String((string)value)); + } + public static string FromDafny_N3_aws__N12_cryptography__N15_dbEncryptionSdk__N8_dynamoDb__S27_EncryptedDataKeyDescription__M11_branchKeyId(Wrappers_Compile._IOption> value) + { + return value.is_None ? (string)null : FromDafny_N6_smithy__N3_api__S6_String(value.Extract()); + } + public static Wrappers_Compile._IOption> ToDafny_N3_aws__N12_cryptography__N15_dbEncryptionSdk__N8_dynamoDb__S27_EncryptedDataKeyDescription__M11_branchKeyId(string value) + { + return value == null ? Wrappers_Compile.Option>.create_None() : Wrappers_Compile.Option>.create_Some(ToDafny_N6_smithy__N3_api__S6_String((string)value)); + } + public static string FromDafny_N3_aws__N12_cryptography__N15_dbEncryptionSdk__N8_dynamoDb__S27_EncryptedDataKeyDescription__M16_branchKeyVersion(Wrappers_Compile._IOption> value) + { + return value.is_None ? (string)null : FromDafny_N6_smithy__N3_api__S6_String(value.Extract()); + } + public static Wrappers_Compile._IOption> ToDafny_N3_aws__N12_cryptography__N15_dbEncryptionSdk__N8_dynamoDb__S27_EncryptedDataKeyDescription__M16_branchKeyVersion(string value) + { + return value == null ? Wrappers_Compile.Option>.create_None() : Wrappers_Compile.Option>.create_Some(ToDafny_N6_smithy__N3_api__S6_String((string)value)); + } public static AWS.Cryptography.MaterialProviders.DefaultCache FromDafny_N3_aws__N12_cryptography__N17_materialProviders__S12_DefaultCache(software.amazon.cryptography.materialproviders.internaldafny.types._IDefaultCache value) { software.amazon.cryptography.materialproviders.internaldafny.types.DefaultCache concrete = (software.amazon.cryptography.materialproviders.internaldafny.types.DefaultCache)value; AWS.Cryptography.MaterialProviders.DefaultCache converted = new AWS.Cryptography.MaterialProviders.DefaultCache(); converted.EntryCapacity = (int)FromDafny_N3_aws__N12_cryptography__N17_materialProviders__S12_DefaultCache__M13_entryCapacity(concrete._entryCapacity); return converted; From 2f4cfc93f78ae3daac8d3723c1b31dc271717696 Mon Sep 17 00:00:00 2001 From: rishav-karanjit Date: Sun, 5 May 2024 18:02:39 -0700 Subject: [PATCH 63/67] add generated file --- .../runtimes/net/Generated/DDBEncryption/TypeConversion.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/TestVectors/runtimes/net/Generated/DDBEncryption/TypeConversion.cs b/TestVectors/runtimes/net/Generated/DDBEncryption/TypeConversion.cs index a611ed8b5..6a0902fa9 100644 --- a/TestVectors/runtimes/net/Generated/DDBEncryption/TypeConversion.cs +++ b/TestVectors/runtimes/net/Generated/DDBEncryption/TypeConversion.cs @@ -422,7 +422,7 @@ public static AWS.Cryptography.DbEncryptionSDK.DynamoDb.Upper FromDafny_N3_aws__ { return FromDafny_N3_aws__N12_cryptography__N15_dbEncryptionSdk__N8_dynamoDb__S5_Upper(value); } - public static software.amaztuson.cryptography.dbencryptionsdk.dynamodb.internaldafny.types._IUpper ToDafny_N3_aws__N12_cryptography__N15_dbEncryptionSdk__N8_dynamoDb__S16_VirtualTransform__M5_upper(AWS.Cryptography.DbEncryptionSDK.DynamoDb.Upper value) + public static software.amazon.cryptography.dbencryptionsdk.dynamodb.internaldafny.types._IUpper ToDafny_N3_aws__N12_cryptography__N15_dbEncryptionSdk__N8_dynamoDb__S16_VirtualTransform__M5_upper(AWS.Cryptography.DbEncryptionSDK.DynamoDb.Upper value) { return ToDafny_N3_aws__N12_cryptography__N15_dbEncryptionSdk__N8_dynamoDb__S5_Upper(value); } From 6dedc67fd3721dadba61fe4649c95ea53c19aad3 Mon Sep 17 00:00:00 2001 From: rishav-karanjit Date: Sun, 5 May 2024 20:38:31 -0700 Subject: [PATCH 64/67] Assert branch key into separate method to reduce resource count --- ...moDbGetEncryptedDataKeyDescriptionTest.dfy | 24 ++++++++++--------- 1 file changed, 13 insertions(+), 11 deletions(-) diff --git a/DynamoDbEncryption/dafny/DynamoDbEncryption/test/DynamoDbGetEncryptedDataKeyDescriptionTest.dfy b/DynamoDbEncryption/dafny/DynamoDbEncryption/test/DynamoDbGetEncryptedDataKeyDescriptionTest.dfy index b801aa04b..2f5cb02a8 100644 --- a/DynamoDbEncryption/dafny/DynamoDbEncryption/test/DynamoDbGetEncryptedDataKeyDescriptionTest.dfy +++ b/DynamoDbEncryption/dafny/DynamoDbEncryption/test/DynamoDbGetEncryptedDataKeyDescriptionTest.dfy @@ -100,11 +100,7 @@ module DynamoDbGetEncryptedDataKeyDescriptionTest { expect actualDataKeyDescription.EncryptedDataKeyDescriptionOutput[0].keyProviderInfo.Some?; expect actualDataKeyDescription.EncryptedDataKeyDescriptionOutput[0].keyProviderInfo.value == "keyproviderInfo"; - expect actualDataKeyDescription.EncryptedDataKeyDescriptionOutput[0].branchKeyId.Some?; - expect actualDataKeyDescription.EncryptedDataKeyDescriptionOutput[0].branchKeyVersion.Some?; - - expect actualDataKeyDescription.EncryptedDataKeyDescriptionOutput[0].branchKeyId.value == "keyproviderInfo"; - expect actualDataKeyDescription.EncryptedDataKeyDescriptionOutput[0].branchKeyVersion.value == "155b7a3d-7625-4826-4302-113d1179075a"; + assertBranchKey(actualDataKeyDescription); } method {:test} TestHeaderInputRawRsaDataKeyDataKeyCase() @@ -177,11 +173,7 @@ module DynamoDbGetEncryptedDataKeyDescriptionTest { expect actualDataKeyDescription.EncryptedDataKeyDescriptionOutput[0].keyProviderInfo.Some?; expect actualDataKeyDescription.EncryptedDataKeyDescriptionOutput[0].keyProviderInfo.value == "keyproviderInfo"; - expect actualDataKeyDescription.EncryptedDataKeyDescriptionOutput[0].branchKeyId.Some?; - expect actualDataKeyDescription.EncryptedDataKeyDescriptionOutput[0].branchKeyVersion.Some?; - - expect actualDataKeyDescription.EncryptedDataKeyDescriptionOutput[0].branchKeyId.value == "keyproviderInfo"; - expect actualDataKeyDescription.EncryptedDataKeyDescriptionOutput[0].branchKeyVersion.value == "155b7a3d-7625-4826-4302-113d1179075a"; + assertBranchKey(actualDataKeyDescription); } method {:test} TestDDBItemInputRawRsaDataKeyCase() @@ -268,7 +260,7 @@ module DynamoDbGetEncryptedDataKeyDescriptionTest { method {:test} TestNoHeaderFailureCase() { - var expectedHead := CreatePartialHeader(testVersion, testFlavor1, testMsgID, testLegend, testEncContext, [testAwsKmsDataKey, testAwsKmsRsaDataKey]); + var expectedHead := CreatePartialHeader(testVersion, testFlavor1, testMsgID, testLegend, testEncContext, [testAwsKmsDataKey]); var serializedHeader := expectedHead.serialize() + expectedHead.msgID; var attr := map["wrong_header_attribute" := ComAmazonawsDynamodbTypes.AttributeValue.B(serializedHeader)]; var ddbEncResources :- expect DynamoDbEncryption.DynamoDbEncryption(); @@ -282,4 +274,14 @@ module DynamoDbGetEncryptedDataKeyDescriptionTest { expect actualDataKeyDescription.error.DynamoDbEncryptionException?; expect actualDataKeyDescription.error.message == "Header not found in the DynamoDB item."; } + + method assertBranchKey(actualDataKeyDescription : Types.GetEncryptedDataKeyDescriptionOutput) + { + expect |actualDataKeyDescription.EncryptedDataKeyDescriptionOutput| == 1; + expect actualDataKeyDescription.EncryptedDataKeyDescriptionOutput[0].branchKeyId.Some?; + expect actualDataKeyDescription.EncryptedDataKeyDescriptionOutput[0].branchKeyVersion.Some?; + + expect actualDataKeyDescription.EncryptedDataKeyDescriptionOutput[0].branchKeyId.value == "keyproviderInfo"; + expect actualDataKeyDescription.EncryptedDataKeyDescriptionOutput[0].branchKeyVersion.value == "155b7a3d-7625-4826-4302-113d1179075a"; + } } From 6b30e4c06fd659034b68a82ebb07203354a36300 Mon Sep 17 00:00:00 2001 From: rishav-karanjit Date: Sun, 5 May 2024 21:04:50 -0700 Subject: [PATCH 65/67] Change plainTextItem to item in examples --- .../examples/GetEncryptedDataKeyDescriptionExample.java | 2 +- .../runtimes/net/src/GetEncryptedDataKeyDescriptionExample.cs | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Examples/runtimes/java/DynamoDbEncryption/src/main/java/software/amazon/cryptography/examples/GetEncryptedDataKeyDescriptionExample.java b/Examples/runtimes/java/DynamoDbEncryption/src/main/java/software/amazon/cryptography/examples/GetEncryptedDataKeyDescriptionExample.java index 7474b8adf..6c096f761 100644 --- a/Examples/runtimes/java/DynamoDbEncryption/src/main/java/software/amazon/cryptography/examples/GetEncryptedDataKeyDescriptionExample.java +++ b/Examples/runtimes/java/DynamoDbEncryption/src/main/java/software/amazon/cryptography/examples/GetEncryptedDataKeyDescriptionExample.java @@ -49,7 +49,7 @@ public static void getEncryptedDataKeyDescription( .DynamoDbEncryptionConfig(DynamoDbEncryptionConfig.builder().build()) .build(); GetEncryptedDataKeyDescriptionUnion InputUnion = GetEncryptedDataKeyDescriptionUnion.builder() - .plaintextItem(returnedItem) + .item(returnedItem) .build(); software.amazon.cryptography.dbencryptionsdk.dynamodb.model.GetEncryptedDataKeyDescriptionInput input = GetEncryptedDataKeyDescriptionInput.builder() .input(InputUnion) diff --git a/Examples/runtimes/net/src/GetEncryptedDataKeyDescriptionExample.cs b/Examples/runtimes/net/src/GetEncryptedDataKeyDescriptionExample.cs index 5223b964f..c4300cb51 100644 --- a/Examples/runtimes/net/src/GetEncryptedDataKeyDescriptionExample.cs +++ b/Examples/runtimes/net/src/GetEncryptedDataKeyDescriptionExample.cs @@ -39,7 +39,7 @@ public static async Task GetEncryptedDataKeyDescription() // "aws_dbe_head" attribute in the dynamoDB item. The part of the code where we send input as the header is commented. var returnedItem = getResponse.Item; GetEncryptedDataKeyDescriptionUnion InputUnion = new GetEncryptedDataKeyDescriptionUnion(); - InputUnion.PlaintextItem = returnedItem; + InputUnion.Item = returnedItem; // The code below shows how we can send header as the input to the DynamoDB. This code is written to demo the // alternative approach. So, it is commented. From 16bafa604969959d38bf87136082d8089adbba52 Mon Sep 17 00:00:00 2001 From: rishav-karanjit Date: Mon, 6 May 2024 08:27:32 -0700 Subject: [PATCH 66/67] Nits in specification --- .../ddb-get-encrypted-data-key-description.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/specification/dynamodb-encryption-client/ddb-get-encrypted-data-key-description.md b/specification/dynamodb-encryption-client/ddb-get-encrypted-data-key-description.md index 995c2b60b..d45395d79 100644 --- a/specification/dynamodb-encryption-client/ddb-get-encrypted-data-key-description.md +++ b/specification/dynamodb-encryption-client/ddb-get-encrypted-data-key-description.md @@ -28,7 +28,7 @@ This operation MUST return the following: - The operation MUST NEVER DECRYPT the Data Keys. - The operation MUST NOT access the network in any way. -- If the input is a encrypted DynamoDB item, it MUST attempt to extract "aws_dbe_head" attribute from the DynamoDB item to get binary header. +- If the input is an encrypted DynamoDB item, it MUST attempt to extract "aws_dbe_head" attribute from the DynamoDB item to get the binary header. - This operation MUST deserialize the header bytes according to the header format. - This operation MUST extract the Format Flavor from the deserialize header. Format Flavor is used to identify the algorithm suite. - This operation MUST extract the dataKeys from the deserialize header. From dff2be6914871b04299ff5371eff039d32e50677 Mon Sep 17 00:00:00 2001 From: rishav-karanjit Date: Mon, 6 May 2024 08:32:47 -0700 Subject: [PATCH 67/67] Fix duvet annotation after nits in specs --- .../src/AwsCryptographyDbEncryptionSdkDynamoDbOperations.dfy | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/DynamoDbEncryption/dafny/DynamoDbEncryption/src/AwsCryptographyDbEncryptionSdkDynamoDbOperations.dfy b/DynamoDbEncryption/dafny/DynamoDbEncryption/src/AwsCryptographyDbEncryptionSdkDynamoDbOperations.dfy index 8ce53d4da..c1379da88 100644 --- a/DynamoDbEncryption/dafny/DynamoDbEncryption/src/AwsCryptographyDbEncryptionSdkDynamoDbOperations.dfy +++ b/DynamoDbEncryption/dafny/DynamoDbEncryption/src/AwsCryptographyDbEncryptionSdkDynamoDbOperations.dfy @@ -53,7 +53,7 @@ module AwsCryptographyDbEncryptionSdkDynamoDbOperations refines AbstractAwsCrypt match input.input { //= specification/dynamodb-encryption-client/ddb-get-encrypted-data-key-description.md#behavior - //# - If the input is a encrypted DynamoDB item, it MUST attempt to extract "aws_dbe_head" attribute from the DynamoDB item to get binary header. + //# - If the input is an encrypted DynamoDB item, it MUST attempt to extract "aws_dbe_head" attribute from the DynamoDB item to get the binary header. case item(item) =>{ :- Need("aws_dbe_head" in item && item["aws_dbe_head"].B?, E("Header not found in the DynamoDB item.")); header := item["aws_dbe_head"].B;