Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit 6ffde54

Browse files
committedApr 10, 2024
Changed structure EncryptedDataKeyDescriptionOutput to EncryptedDataKeyDescription
1 parent 5e88171 commit 6ffde54

File tree

13 files changed

+273
-82
lines changed

13 files changed

+273
-82
lines changed
 

‎DynamoDbEncryption/dafny/DynamoDbEncryption/Model/AwsCryptographyDbEncryptionSdkDynamoDbTypes.dfy

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -249,13 +249,13 @@ module {:extern "software.amazon.cryptography.dbencryptionsdk.dynamodb.internald
249249
datatype DynamoDbTablesEncryptionConfig = | DynamoDbTablesEncryptionConfig (
250250
nameonly tableEncryptionConfigs: DynamoDbTableEncryptionConfigList
251251
)
252-
type EncryptedDataKeyDescriptionList = seq<EncryptedDataKeyDescriptionOutput>
253-
datatype EncryptedDataKeyDescriptionOutput = | EncryptedDataKeyDescriptionOutput (
252+
datatype EncryptedDataKeyDescription = | EncryptedDataKeyDescription (
254253
nameonly keyProviderId: string ,
255254
nameonly keyProviderInfo: Option<string> := Option.None ,
256255
nameonly branchKeyId: Option<string> := Option.None ,
257256
nameonly branchKeyVersion: Option<string> := Option.None
258257
)
258+
type EncryptedDataKeyDescriptionList = seq<EncryptedDataKeyDescription>
259259
datatype EncryptedPart = | EncryptedPart (
260260
nameonly name: string ,
261261
nameonly prefix: Prefix

‎DynamoDbEncryption/dafny/DynamoDbEncryption/Model/DynamoDbEncryption.smithy

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,11 @@ structure GetEncryptedDataKeyDescriptionInput {
5858
input: GetEncryptedDataKeyDescriptionUnion
5959
}
6060

61+
//= specification/dynamodb-encryption-client/ddb-get-encrypted-data-key-description.md#input
62+
//# This operation MUST take in either of the following:
63+
//# - A binary [header](https://github.com/aws/aws-database-encryption-sdk-dynamodb/blob/main/specification/structured-encryption/header.md)
64+
//# - 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)
65+
6166
union GetEncryptedDataKeyDescriptionUnion {
6267
header: Blob,
6368
plaintextItem: AttributeMap,
@@ -69,10 +74,10 @@ structure GetEncryptedDataKeyDescriptionOutput {
6974
}
7075

7176
list EncryptedDataKeyDescriptionList {
72-
member: EncryptedDataKeyDescriptionOutput
77+
member: EncryptedDataKeyDescription
7378
}
7479

75-
structure EncryptedDataKeyDescriptionOutput {
80+
structure EncryptedDataKeyDescription {
7681
@required
7782
keyProviderId: String,
7883

‎DynamoDbEncryption/dafny/DynamoDbEncryption/src/AwsCryptographyDbEncryptionSdkDynamoDbOperations.dfy

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -63,10 +63,10 @@ module AwsCryptographyDbEncryptionSdkDynamoDbOperations refines AbstractAwsCrypt
6363
var datakeys := deserializedHeader.dataKeys;
6464
var list : EncryptedDataKeyDescriptionList := [];
6565
for i := 0 to |datakeys| {
66-
var singleDataKeyOutput : EncryptedDataKeyDescriptionOutput;
66+
var singleDataKeyOutput : EncryptedDataKeyDescription;
6767
var extractedKeyProviderId :- UTF8.Decode(datakeys[i].keyProviderId).MapFailure(e => E(e));
6868
if !("aws-kms" < extractedKeyProviderId) {
69-
singleDataKeyOutput := EncryptedDataKeyDescriptionOutput(
69+
singleDataKeyOutput := EncryptedDataKeyDescription(
7070
keyProviderId := extractedKeyProviderId,
7171
keyProviderInfo := None,
7272
branchKeyId := None,
@@ -98,15 +98,15 @@ module AwsCryptographyDbEncryptionSdkDynamoDbOperations refines AbstractAwsCrypt
9898
:- Need(|providerWrappedMaterial| >= EDK_CIPHERTEXT_VERSION_INDEX, E("Incorrect ciphertext structure length."));
9999
var branchKeyVersionUuid := providerWrappedMaterial[EDK_CIPHERTEXT_BRANCH_KEY_VERSION_INDEX .. EDK_CIPHERTEXT_VERSION_INDEX];
100100
var expectedBranchKeyVersion :- UUID.FromByteArray(branchKeyVersionUuid).MapFailure(e => E(e));
101-
singleDataKeyOutput := EncryptedDataKeyDescriptionOutput(
101+
singleDataKeyOutput := EncryptedDataKeyDescription(
102102
keyProviderId := extractedKeyProviderId,
103103
keyProviderInfo := Some(extractedKeyProviderIdInfo),
104104
branchKeyId := Some(extractedKeyProviderIdInfo),
105105
branchKeyVersion := Some(expectedBranchKeyVersion)
106106
);
107107
}
108108
else {
109-
singleDataKeyOutput := EncryptedDataKeyDescriptionOutput(
109+
singleDataKeyOutput := EncryptedDataKeyDescription(
110110
keyProviderId := extractedKeyProviderId,
111111
keyProviderInfo := Some(extractedKeyProviderIdInfo),
112112
branchKeyId := None,

‎DynamoDbEncryption/runtimes/java/src/main/smithy-generated/software/amazon/cryptography/dbencryptionsdk/dynamodb/ToDafny.java

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@
2727
import software.amazon.cryptography.dbencryptionsdk.dynamodb.internaldafny.types.DynamoDbEncryptionConfig;
2828
import software.amazon.cryptography.dbencryptionsdk.dynamodb.internaldafny.types.DynamoDbTableEncryptionConfig;
2929
import software.amazon.cryptography.dbencryptionsdk.dynamodb.internaldafny.types.DynamoDbTablesEncryptionConfig;
30-
import software.amazon.cryptography.dbencryptionsdk.dynamodb.internaldafny.types.EncryptedDataKeyDescriptionOutput;
30+
import software.amazon.cryptography.dbencryptionsdk.dynamodb.internaldafny.types.EncryptedDataKeyDescription;
3131
import software.amazon.cryptography.dbencryptionsdk.dynamodb.internaldafny.types.EncryptedPart;
3232
import software.amazon.cryptography.dbencryptionsdk.dynamodb.internaldafny.types.Error;
3333
import software.amazon.cryptography.dbencryptionsdk.dynamodb.internaldafny.types.Error_DynamoDbEncryptionException;
@@ -242,8 +242,8 @@ public static DynamoDbTablesEncryptionConfig DynamoDbTablesEncryptionConfig(
242242
return new DynamoDbTablesEncryptionConfig(tableEncryptionConfigs);
243243
}
244244

245-
public static EncryptedDataKeyDescriptionOutput EncryptedDataKeyDescriptionOutput(
246-
software.amazon.cryptography.dbencryptionsdk.dynamodb.model.EncryptedDataKeyDescriptionOutput nativeValue) {
245+
public static EncryptedDataKeyDescription EncryptedDataKeyDescription(
246+
software.amazon.cryptography.dbencryptionsdk.dynamodb.model.EncryptedDataKeyDescription nativeValue) {
247247
DafnySequence<? extends Character> keyProviderId;
248248
keyProviderId = software.amazon.smithy.dafny.conversion.ToDafny.Simple.CharacterSequence(nativeValue.keyProviderId());
249249
Option<DafnySequence<? extends Character>> keyProviderInfo;
@@ -258,7 +258,7 @@ public static EncryptedDataKeyDescriptionOutput EncryptedDataKeyDescriptionOutpu
258258
branchKeyVersion = Objects.nonNull(nativeValue.branchKeyVersion()) ?
259259
Option.create_Some(software.amazon.smithy.dafny.conversion.ToDafny.Simple.CharacterSequence(nativeValue.branchKeyVersion()))
260260
: Option.create_None();
261-
return new EncryptedDataKeyDescriptionOutput(keyProviderId, keyProviderInfo, branchKeyId, branchKeyVersion);
261+
return new EncryptedDataKeyDescription(keyProviderId, keyProviderInfo, branchKeyId, branchKeyVersion);
262262
}
263263

264264
public static EncryptedPart EncryptedPart(
@@ -293,7 +293,7 @@ public static GetEncryptedDataKeyDescriptionInput GetEncryptedDataKeyDescription
293293

294294
public static GetEncryptedDataKeyDescriptionOutput GetEncryptedDataKeyDescriptionOutput(
295295
software.amazon.cryptography.dbencryptionsdk.dynamodb.model.GetEncryptedDataKeyDescriptionOutput nativeValue) {
296-
DafnySequence<? extends EncryptedDataKeyDescriptionOutput> encryptedDataKeyDescriptionOutput;
296+
DafnySequence<? extends EncryptedDataKeyDescription> encryptedDataKeyDescriptionOutput;
297297
encryptedDataKeyDescriptionOutput = ToDafny.EncryptedDataKeyDescriptionList(nativeValue.EncryptedDataKeyDescriptionOutput());
298298
return new GetEncryptedDataKeyDescriptionOutput(encryptedDataKeyDescriptionOutput);
299299
}
@@ -615,12 +615,12 @@ public static DafnySequence<? extends ConstructorPart> ConstructorPartList(
615615
ConstructorPart._typeDescriptor());
616616
}
617617

618-
public static DafnySequence<? extends EncryptedDataKeyDescriptionOutput> EncryptedDataKeyDescriptionList(
619-
List<software.amazon.cryptography.dbencryptionsdk.dynamodb.model.EncryptedDataKeyDescriptionOutput> nativeValue) {
618+
public static DafnySequence<? extends EncryptedDataKeyDescription> EncryptedDataKeyDescriptionList(
619+
List<software.amazon.cryptography.dbencryptionsdk.dynamodb.model.EncryptedDataKeyDescription> nativeValue) {
620620
return software.amazon.smithy.dafny.conversion.ToDafny.Aggregate.GenericToSequence(
621621
nativeValue,
622-
software.amazon.cryptography.dbencryptionsdk.dynamodb.ToDafny::EncryptedDataKeyDescriptionOutput,
623-
EncryptedDataKeyDescriptionOutput._typeDescriptor());
622+
software.amazon.cryptography.dbencryptionsdk.dynamodb.ToDafny::EncryptedDataKeyDescription,
623+
EncryptedDataKeyDescription._typeDescriptor());
624624
}
625625

626626
public static DafnySequence<? extends EncryptedPart> EncryptedPartsList(

‎DynamoDbEncryption/runtimes/java/src/main/smithy-generated/software/amazon/cryptography/dbencryptionsdk/dynamodb/ToNative.java

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@
3030
import software.amazon.cryptography.dbencryptionsdk.dynamodb.model.DynamoDbEncryptionException;
3131
import software.amazon.cryptography.dbencryptionsdk.dynamodb.model.DynamoDbTableEncryptionConfig;
3232
import software.amazon.cryptography.dbencryptionsdk.dynamodb.model.DynamoDbTablesEncryptionConfig;
33-
import software.amazon.cryptography.dbencryptionsdk.dynamodb.model.EncryptedDataKeyDescriptionOutput;
33+
import software.amazon.cryptography.dbencryptionsdk.dynamodb.model.EncryptedDataKeyDescription;
3434
import software.amazon.cryptography.dbencryptionsdk.dynamodb.model.EncryptedPart;
3535
import software.amazon.cryptography.dbencryptionsdk.dynamodb.model.GetBranchKeyIdFromDdbKeyInput;
3636
import software.amazon.cryptography.dbencryptionsdk.dynamodb.model.GetBranchKeyIdFromDdbKeyOutput;
@@ -235,9 +235,9 @@ public static DynamoDbTablesEncryptionConfig DynamoDbTablesEncryptionConfig(
235235
return nativeBuilder.build();
236236
}
237237

238-
public static EncryptedDataKeyDescriptionOutput EncryptedDataKeyDescriptionOutput(
239-
software.amazon.cryptography.dbencryptionsdk.dynamodb.internaldafny.types.EncryptedDataKeyDescriptionOutput dafnyValue) {
240-
EncryptedDataKeyDescriptionOutput.Builder nativeBuilder = EncryptedDataKeyDescriptionOutput.builder();
238+
public static EncryptedDataKeyDescription EncryptedDataKeyDescription(
239+
software.amazon.cryptography.dbencryptionsdk.dynamodb.internaldafny.types.EncryptedDataKeyDescription dafnyValue) {
240+
EncryptedDataKeyDescription.Builder nativeBuilder = EncryptedDataKeyDescription.builder();
241241
nativeBuilder.keyProviderId(software.amazon.smithy.dafny.conversion.ToNative.Simple.String(dafnyValue.dtor_keyProviderId()));
242242
if (dafnyValue.dtor_keyProviderInfo().is_Some()) {
243243
nativeBuilder.keyProviderInfo(software.amazon.smithy.dafny.conversion.ToNative.Simple.String(dafnyValue.dtor_keyProviderInfo().dtor_value()));
@@ -575,11 +575,11 @@ public static List<ConstructorPart> ConstructorPartList(
575575
software.amazon.cryptography.dbencryptionsdk.dynamodb.ToNative::ConstructorPart);
576576
}
577577

578-
public static List<EncryptedDataKeyDescriptionOutput> EncryptedDataKeyDescriptionList(
579-
DafnySequence<? extends software.amazon.cryptography.dbencryptionsdk.dynamodb.internaldafny.types.EncryptedDataKeyDescriptionOutput> dafnyValue) {
578+
public static List<EncryptedDataKeyDescription> EncryptedDataKeyDescriptionList(
579+
DafnySequence<? extends software.amazon.cryptography.dbencryptionsdk.dynamodb.internaldafny.types.EncryptedDataKeyDescription> dafnyValue) {
580580
return software.amazon.smithy.dafny.conversion.ToNative.Aggregate.GenericToList(
581581
dafnyValue,
582-
software.amazon.cryptography.dbencryptionsdk.dynamodb.ToNative::EncryptedDataKeyDescriptionOutput);
582+
software.amazon.cryptography.dbencryptionsdk.dynamodb.ToNative::EncryptedDataKeyDescription);
583583
}
584584

585585
public static List<EncryptedPart> EncryptedPartsList(
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,130 @@
1+
// Copyright Amazon.com Inc. or its affiliates. All Rights Reserved.
2+
// SPDX-License-Identifier: Apache-2.0
3+
// Do not modify this file. This file is machine generated, and any changes to it will be overwritten.
4+
package software.amazon.cryptography.dbencryptionsdk.dynamodb.model;
5+
6+
import java.util.Objects;
7+
8+
public class EncryptedDataKeyDescription {
9+
private final String keyProviderId;
10+
11+
private final String keyProviderInfo;
12+
13+
private final String branchKeyId;
14+
15+
private final String branchKeyVersion;
16+
17+
protected EncryptedDataKeyDescription(BuilderImpl builder) {
18+
this.keyProviderId = builder.keyProviderId();
19+
this.keyProviderInfo = builder.keyProviderInfo();
20+
this.branchKeyId = builder.branchKeyId();
21+
this.branchKeyVersion = builder.branchKeyVersion();
22+
}
23+
24+
public String keyProviderId() {
25+
return this.keyProviderId;
26+
}
27+
28+
public String keyProviderInfo() {
29+
return this.keyProviderInfo;
30+
}
31+
32+
public String branchKeyId() {
33+
return this.branchKeyId;
34+
}
35+
36+
public String branchKeyVersion() {
37+
return this.branchKeyVersion;
38+
}
39+
40+
public Builder toBuilder() {
41+
return new BuilderImpl(this);
42+
}
43+
44+
public static Builder builder() {
45+
return new BuilderImpl();
46+
}
47+
48+
public interface Builder {
49+
Builder keyProviderId(String keyProviderId);
50+
51+
String keyProviderId();
52+
53+
Builder keyProviderInfo(String keyProviderInfo);
54+
55+
String keyProviderInfo();
56+
57+
Builder branchKeyId(String branchKeyId);
58+
59+
String branchKeyId();
60+
61+
Builder branchKeyVersion(String branchKeyVersion);
62+
63+
String branchKeyVersion();
64+
65+
EncryptedDataKeyDescription build();
66+
}
67+
68+
static class BuilderImpl implements Builder {
69+
protected String keyProviderId;
70+
71+
protected String keyProviderInfo;
72+
73+
protected String branchKeyId;
74+
75+
protected String branchKeyVersion;
76+
77+
protected BuilderImpl() {
78+
}
79+
80+
protected BuilderImpl(EncryptedDataKeyDescription model) {
81+
this.keyProviderId = model.keyProviderId();
82+
this.keyProviderInfo = model.keyProviderInfo();
83+
this.branchKeyId = model.branchKeyId();
84+
this.branchKeyVersion = model.branchKeyVersion();
85+
}
86+
87+
public Builder keyProviderId(String keyProviderId) {
88+
this.keyProviderId = keyProviderId;
89+
return this;
90+
}
91+
92+
public String keyProviderId() {
93+
return this.keyProviderId;
94+
}
95+
96+
public Builder keyProviderInfo(String keyProviderInfo) {
97+
this.keyProviderInfo = keyProviderInfo;
98+
return this;
99+
}
100+
101+
public String keyProviderInfo() {
102+
return this.keyProviderInfo;
103+
}
104+
105+
public Builder branchKeyId(String branchKeyId) {
106+
this.branchKeyId = branchKeyId;
107+
return this;
108+
}
109+
110+
public String branchKeyId() {
111+
return this.branchKeyId;
112+
}
113+
114+
public Builder branchKeyVersion(String branchKeyVersion) {
115+
this.branchKeyVersion = branchKeyVersion;
116+
return this;
117+
}
118+
119+
public String branchKeyVersion() {
120+
return this.branchKeyVersion;
121+
}
122+
123+
public EncryptedDataKeyDescription build() {
124+
if (Objects.isNull(this.keyProviderId())) {
125+
throw new IllegalArgumentException("Missing value for required field `keyProviderId`");
126+
}
127+
return new EncryptedDataKeyDescription(this);
128+
}
129+
}
130+
}

‎DynamoDbEncryption/runtimes/java/src/main/smithy-generated/software/amazon/cryptography/dbencryptionsdk/dynamodb/model/GetEncryptedDataKeyDescriptionOutput.java

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -7,13 +7,13 @@
77
import java.util.Objects;
88

99
public class GetEncryptedDataKeyDescriptionOutput {
10-
private final List<EncryptedDataKeyDescriptionOutput> EncryptedDataKeyDescriptionOutput;
10+
private final List<EncryptedDataKeyDescription> EncryptedDataKeyDescriptionOutput;
1111

1212
protected GetEncryptedDataKeyDescriptionOutput(BuilderImpl builder) {
1313
this.EncryptedDataKeyDescriptionOutput = builder.EncryptedDataKeyDescriptionOutput();
1414
}
1515

16-
public List<EncryptedDataKeyDescriptionOutput> EncryptedDataKeyDescriptionOutput() {
16+
public List<EncryptedDataKeyDescription> EncryptedDataKeyDescriptionOutput() {
1717
return this.EncryptedDataKeyDescriptionOutput;
1818
}
1919

@@ -27,15 +27,15 @@ public static Builder builder() {
2727

2828
public interface Builder {
2929
Builder EncryptedDataKeyDescriptionOutput(
30-
List<EncryptedDataKeyDescriptionOutput> EncryptedDataKeyDescriptionOutput);
30+
List<EncryptedDataKeyDescription> EncryptedDataKeyDescriptionOutput);
3131

32-
List<EncryptedDataKeyDescriptionOutput> EncryptedDataKeyDescriptionOutput();
32+
List<EncryptedDataKeyDescription> EncryptedDataKeyDescriptionOutput();
3333

3434
GetEncryptedDataKeyDescriptionOutput build();
3535
}
3636

3737
static class BuilderImpl implements Builder {
38-
protected List<EncryptedDataKeyDescriptionOutput> EncryptedDataKeyDescriptionOutput;
38+
protected List<EncryptedDataKeyDescription> EncryptedDataKeyDescriptionOutput;
3939

4040
protected BuilderImpl() {
4141
}
@@ -45,12 +45,12 @@ protected BuilderImpl(GetEncryptedDataKeyDescriptionOutput model) {
4545
}
4646

4747
public Builder EncryptedDataKeyDescriptionOutput(
48-
List<EncryptedDataKeyDescriptionOutput> EncryptedDataKeyDescriptionOutput) {
48+
List<EncryptedDataKeyDescription> EncryptedDataKeyDescriptionOutput) {
4949
this.EncryptedDataKeyDescriptionOutput = EncryptedDataKeyDescriptionOutput;
5050
return this;
5151
}
5252

53-
public List<EncryptedDataKeyDescriptionOutput> EncryptedDataKeyDescriptionOutput() {
53+
public List<EncryptedDataKeyDescription> EncryptedDataKeyDescriptionOutput() {
5454
return this.EncryptedDataKeyDescriptionOutput;
5555
}
5656

0 commit comments

Comments
 (0)
Please sign in to comment.