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 efb13f8

Browse files
committedNov 18, 2024··
m
1 parent b2c1eb5 commit efb13f8

File tree

21 files changed

+946
-32
lines changed

21 files changed

+946
-32
lines changed
 

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

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,7 @@
6363
import software.amazon.cryptography.dbencryptionsdk.dynamodb.model.CollectionOfErrors;
6464
import software.amazon.cryptography.dbencryptionsdk.dynamodb.model.DynamoDbEncryptionException;
6565
import software.amazon.cryptography.dbencryptionsdk.dynamodb.model.OpaqueError;
66+
import software.amazon.cryptography.dbencryptionsdk.dynamodb.model.OpaqueWithTextError;
6667
import software.amazon.cryptography.dbencryptionsdk.structuredencryption.internaldafny.types.CryptoAction;
6768
import software.amazon.cryptography.keystore.internaldafny.types.IKeyStoreClient;
6869
import software.amazon.cryptography.materialproviders.internaldafny.types.CacheType;
@@ -81,6 +82,9 @@ public static Error Error(RuntimeException nativeValue) {
8182
if (nativeValue instanceof OpaqueError) {
8283
return ToDafny.Error((OpaqueError) nativeValue);
8384
}
85+
if (nativeValue instanceof OpaqueWithTextError) {
86+
return ToDafny.Error((OpaqueWithTextError) nativeValue);
87+
}
8488
if (nativeValue instanceof CollectionOfErrors) {
8589
return ToDafny.Error((CollectionOfErrors) nativeValue);
8690
}
@@ -91,6 +95,13 @@ public static Error Error(OpaqueError nativeValue) {
9195
return Error.create_Opaque(nativeValue.obj());
9296
}
9397

98+
public static Error Error(OpaqueWithTextError nativeValue) {
99+
return Error.create_OpaqueWithText(
100+
nativeValue.obj(),
101+
dafny.DafnySequence.asString(nativeValue.objMessage())
102+
);
103+
}
104+
94105
public static Error Error(CollectionOfErrors nativeValue) {
95106
DafnySequence<? extends Error> list =
96107
software.amazon.smithy.dafny.conversion.ToDafny.Aggregate.GenericToSequence(

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

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
import software.amazon.cryptography.dbencryptionsdk.dynamodb.internaldafny.types.Error_CollectionOfErrors;
1616
import software.amazon.cryptography.dbencryptionsdk.dynamodb.internaldafny.types.Error_DynamoDbEncryptionException;
1717
import software.amazon.cryptography.dbencryptionsdk.dynamodb.internaldafny.types.Error_Opaque;
18+
import software.amazon.cryptography.dbencryptionsdk.dynamodb.internaldafny.types.Error_OpaqueWithText;
1819
import software.amazon.cryptography.dbencryptionsdk.dynamodb.internaldafny.types.IDynamoDbEncryptionClient;
1920
import software.amazon.cryptography.dbencryptionsdk.dynamodb.model.AsSet;
2021
import software.amazon.cryptography.dbencryptionsdk.dynamodb.model.BeaconKeySource;
@@ -48,6 +49,7 @@
4849
import software.amazon.cryptography.dbencryptionsdk.dynamodb.model.Lower;
4950
import software.amazon.cryptography.dbencryptionsdk.dynamodb.model.MultiKeyStore;
5051
import software.amazon.cryptography.dbencryptionsdk.dynamodb.model.OpaqueError;
52+
import software.amazon.cryptography.dbencryptionsdk.dynamodb.model.OpaqueWithTextError;
5153
import software.amazon.cryptography.dbencryptionsdk.dynamodb.model.PartOnly;
5254
import software.amazon.cryptography.dbencryptionsdk.dynamodb.model.PlaintextOverride;
5355
import software.amazon.cryptography.dbencryptionsdk.dynamodb.model.SearchConfig;
@@ -70,6 +72,17 @@ public static OpaqueError Error(Error_Opaque dafnyValue) {
7072
return nativeBuilder.build();
7173
}
7274

75+
public static OpaqueWithTextError Error(Error_OpaqueWithText dafnyValue) {
76+
OpaqueWithTextError.Builder nativeBuilder = OpaqueWithTextError.builder();
77+
nativeBuilder.obj(dafnyValue.dtor_obj());
78+
nativeBuilder.objMessage(
79+
software.amazon.smithy.dafny.conversion.ToNative.Simple.String(
80+
dafnyValue.dtor_objMessage()
81+
)
82+
);
83+
return nativeBuilder.build();
84+
}
85+
7386
public static CollectionOfErrors Error(Error_CollectionOfErrors dafnyValue) {
7487
CollectionOfErrors.Builder nativeBuilder = CollectionOfErrors.builder();
7588
nativeBuilder.list(
@@ -106,6 +119,9 @@ public static RuntimeException Error(Error dafnyValue) {
106119
if (dafnyValue.is_Opaque()) {
107120
return ToNative.Error((Error_Opaque) dafnyValue);
108121
}
122+
if (dafnyValue.is_OpaqueWithText()) {
123+
return ToNative.Error((Error_OpaqueWithText) dafnyValue);
124+
}
109125
if (dafnyValue.is_CollectionOfErrors()) {
110126
return ToNative.Error((Error_CollectionOfErrors) dafnyValue);
111127
}

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

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@
2525
import software.amazon.cryptography.dbencryptionsdk.dynamodb.itemencryptor.model.CollectionOfErrors;
2626
import software.amazon.cryptography.dbencryptionsdk.dynamodb.itemencryptor.model.DynamoDbItemEncryptorException;
2727
import software.amazon.cryptography.dbencryptionsdk.dynamodb.itemencryptor.model.OpaqueError;
28+
import software.amazon.cryptography.dbencryptionsdk.dynamodb.itemencryptor.model.OpaqueWithTextError;
2829
import software.amazon.cryptography.dbencryptionsdk.structuredencryption.internaldafny.types.CryptoAction;
2930
import software.amazon.cryptography.materialproviders.internaldafny.types.DBEAlgorithmSuiteId;
3031
import software.amazon.cryptography.materialproviders.internaldafny.types.EncryptedDataKey;
@@ -41,6 +42,9 @@ public static Error Error(RuntimeException nativeValue) {
4142
if (nativeValue instanceof OpaqueError) {
4243
return ToDafny.Error((OpaqueError) nativeValue);
4344
}
45+
if (nativeValue instanceof OpaqueWithTextError) {
46+
return ToDafny.Error((OpaqueWithTextError) nativeValue);
47+
}
4448
if (nativeValue instanceof CollectionOfErrors) {
4549
return ToDafny.Error((CollectionOfErrors) nativeValue);
4650
}
@@ -51,6 +55,13 @@ public static Error Error(OpaqueError nativeValue) {
5155
return Error.create_Opaque(nativeValue.obj());
5256
}
5357

58+
public static Error Error(OpaqueWithTextError nativeValue) {
59+
return Error.create_OpaqueWithText(
60+
nativeValue.obj(),
61+
dafny.DafnySequence.asString(nativeValue.objMessage())
62+
);
63+
}
64+
5465
public static Error Error(CollectionOfErrors nativeValue) {
5566
DafnySequence<? extends Error> list =
5667
software.amazon.smithy.dafny.conversion.ToDafny.Aggregate.GenericToSequence(

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

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
import software.amazon.cryptography.dbencryptionsdk.dynamodb.itemencryptor.internaldafny.types.Error_CollectionOfErrors;
99
import software.amazon.cryptography.dbencryptionsdk.dynamodb.itemencryptor.internaldafny.types.Error_DynamoDbItemEncryptorException;
1010
import software.amazon.cryptography.dbencryptionsdk.dynamodb.itemencryptor.internaldafny.types.Error_Opaque;
11+
import software.amazon.cryptography.dbencryptionsdk.dynamodb.itemencryptor.internaldafny.types.Error_OpaqueWithText;
1112
import software.amazon.cryptography.dbencryptionsdk.dynamodb.itemencryptor.internaldafny.types.IDynamoDbItemEncryptorClient;
1213
import software.amazon.cryptography.dbencryptionsdk.dynamodb.itemencryptor.model.CollectionOfErrors;
1314
import software.amazon.cryptography.dbencryptionsdk.dynamodb.itemencryptor.model.DecryptItemInput;
@@ -17,6 +18,7 @@
1718
import software.amazon.cryptography.dbencryptionsdk.dynamodb.itemencryptor.model.EncryptItemInput;
1819
import software.amazon.cryptography.dbencryptionsdk.dynamodb.itemencryptor.model.EncryptItemOutput;
1920
import software.amazon.cryptography.dbencryptionsdk.dynamodb.itemencryptor.model.OpaqueError;
21+
import software.amazon.cryptography.dbencryptionsdk.dynamodb.itemencryptor.model.OpaqueWithTextError;
2022
import software.amazon.cryptography.dbencryptionsdk.dynamodb.itemencryptor.model.ParsedHeader;
2123

2224
public class ToNative {
@@ -27,6 +29,17 @@ public static OpaqueError Error(Error_Opaque dafnyValue) {
2729
return nativeBuilder.build();
2830
}
2931

32+
public static OpaqueWithTextError Error(Error_OpaqueWithText dafnyValue) {
33+
OpaqueWithTextError.Builder nativeBuilder = OpaqueWithTextError.builder();
34+
nativeBuilder.obj(dafnyValue.dtor_obj());
35+
nativeBuilder.objMessage(
36+
software.amazon.smithy.dafny.conversion.ToNative.Simple.String(
37+
dafnyValue.dtor_objMessage()
38+
)
39+
);
40+
return nativeBuilder.build();
41+
}
42+
3043
public static CollectionOfErrors Error(Error_CollectionOfErrors dafnyValue) {
3144
CollectionOfErrors.Builder nativeBuilder = CollectionOfErrors.builder();
3245
nativeBuilder.list(
@@ -63,6 +76,9 @@ public static RuntimeException Error(Error dafnyValue) {
6376
if (dafnyValue.is_Opaque()) {
6477
return ToNative.Error((Error_Opaque) dafnyValue);
6578
}
79+
if (dafnyValue.is_OpaqueWithText()) {
80+
return ToNative.Error((Error_OpaqueWithText) dafnyValue);
81+
}
6682
if (dafnyValue.is_CollectionOfErrors()) {
6783
return ToNative.Error((Error_CollectionOfErrors) dafnyValue);
6884
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,180 @@
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.itemencryptor.model;
5+
6+
public class OpaqueWithTextError extends RuntimeException {
7+
8+
/**
9+
* The unexpected object encountered. It MIGHT BE an Exception, but that is not guaranteed.
10+
*/
11+
private final Object obj;
12+
13+
/**
14+
* The text equivalent of obj.
15+
*/
16+
private final String objMessage;
17+
18+
protected OpaqueWithTextError(BuilderImpl builder) {
19+
super(messageFromBuilder(builder), builder.cause());
20+
this.obj = builder.obj();
21+
this.objMessage = builder.objMessage();
22+
}
23+
24+
private static String messageFromBuilder(Builder builder) {
25+
if (builder.message() != null) {
26+
return builder.message();
27+
}
28+
if (builder.cause() != null) {
29+
return builder.cause().getMessage();
30+
}
31+
return null;
32+
}
33+
34+
/**
35+
* See {@link Throwable#getMessage()}.
36+
*/
37+
public String message() {
38+
return this.getMessage();
39+
}
40+
41+
/**
42+
* See {@link Throwable#getCause()}.
43+
*/
44+
public Throwable cause() {
45+
return this.getCause();
46+
}
47+
48+
/**
49+
* @return The unexpected object encountered. It MIGHT BE an Exception, but that is not guaranteed.
50+
*/
51+
public Object obj() {
52+
return this.obj;
53+
}
54+
55+
/**
56+
* @return The text equivalent of obj.
57+
*/
58+
public String objMessage() {
59+
return this.objMessage;
60+
}
61+
62+
public Builder toBuilder() {
63+
return new BuilderImpl(this);
64+
}
65+
66+
public static Builder builder() {
67+
return new BuilderImpl();
68+
}
69+
70+
public interface Builder {
71+
/**
72+
* @param message The detailed message. The detail message is saved for later retrieval by the {@link #getMessage()} method.
73+
*/
74+
Builder message(String message);
75+
76+
/**
77+
* @return The detailed message. The detail message is saved for later retrieval by the {@link #getMessage()} method.
78+
*/
79+
String message();
80+
81+
/**
82+
* @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.)
83+
*/
84+
Builder cause(Throwable cause);
85+
86+
/**
87+
* @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.)
88+
*/
89+
Throwable cause();
90+
91+
/**
92+
* @param obj The unexpected object encountered. It MIGHT BE an Exception, but that is not guaranteed.
93+
*/
94+
Builder obj(Object obj);
95+
96+
/**
97+
* @return The unexpected object encountered. It MIGHT BE an Exception, but that is not guaranteed.
98+
*/
99+
Object obj();
100+
101+
/**
102+
* @param objMessage The text equivalent of obj.
103+
*/
104+
Builder objMessage(String objMessage);
105+
106+
/**
107+
* @return The text equivalent of obj.
108+
*/
109+
String objMessage();
110+
111+
OpaqueWithTextError build();
112+
}
113+
114+
static class BuilderImpl implements Builder {
115+
116+
protected String message;
117+
118+
protected Throwable cause;
119+
120+
protected Object obj;
121+
122+
protected String objMessage;
123+
124+
protected BuilderImpl() {}
125+
126+
protected BuilderImpl(OpaqueWithTextError model) {
127+
this.cause = model.getCause();
128+
this.message = model.getMessage();
129+
this.obj = model.obj();
130+
this.objMessage = model.objMessage();
131+
}
132+
133+
public Builder message(String message) {
134+
this.message = message;
135+
return this;
136+
}
137+
138+
public String message() {
139+
return this.message;
140+
}
141+
142+
public Builder cause(Throwable cause) {
143+
this.cause = cause;
144+
return this;
145+
}
146+
147+
public Throwable cause() {
148+
return this.cause;
149+
}
150+
151+
public Builder obj(Object obj) {
152+
this.obj = obj;
153+
return this;
154+
}
155+
156+
public Object obj() {
157+
return this.obj;
158+
}
159+
160+
public Builder objMessage(String objMessage) {
161+
this.objMessage = objMessage;
162+
return this;
163+
}
164+
165+
public String objMessage() {
166+
return this.objMessage;
167+
}
168+
169+
public OpaqueWithTextError build() {
170+
if (
171+
this.obj != null && this.cause == null && this.obj instanceof Throwable
172+
) {
173+
this.cause = (Throwable) this.obj;
174+
} else if (this.obj == null && this.cause != null) {
175+
this.obj = this.cause;
176+
}
177+
return new OpaqueWithTextError(this);
178+
}
179+
}
180+
}

0 commit comments

Comments
 (0)
Please sign in to comment.