Skip to content

Commit 54ad3b9

Browse files
committed
feat: smithy for virtual fields
1 parent b33f307 commit 54ad3b9

File tree

8 files changed

+1456
-802
lines changed

8 files changed

+1456
-802
lines changed

DynamoDbEncryptionMiddlewareInternal/Model/AwsCryptographyDynamoDbEncryptionTypes.dfy

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -780,6 +780,10 @@ include "../../private-aws-encryption-sdk-dafny-staging/StandardLibrary/src/Inde
780780
type NonSensitivePartsList = x: seq<NonSensitivePart> | IsValid_NonSensitivePartsList(x) witness *
781781
predicate method IsValid_NonSensitivePartsList(x: seq<NonSensitivePart>) {
782782
( 1 <= |x| )
783+
}
784+
type NumberList = x: seq<int32> | IsValid_NumberList(x) witness *
785+
predicate method IsValid_NumberList(x: seq<int32>) {
786+
( 1 <= |x| )
783787
}
784788
type Prefix = x: string | IsValid_Prefix(x) witness *
785789
predicate method IsValid_Prefix(x: string) {
@@ -846,6 +850,10 @@ include "../../private-aws-encryption-sdk-dafny-staging/StandardLibrary/src/Inde
846850
type StandardBeaconList = x: seq<StandardBeacon> | IsValid_StandardBeaconList(x) witness *
847851
predicate method IsValid_StandardBeaconList(x: seq<StandardBeacon>) {
848852
( 1 <= |x| )
853+
}
854+
type StringList = x: seq<string> | IsValid_StringList(x) witness *
855+
predicate method IsValid_StringList(x: seq<string>) {
856+
( 1 <= |x| )
849857
}
850858
type TerminalLocation = x: string | IsValid_TerminalLocation(x) witness *
851859
predicate method IsValid_TerminalLocation(x: string) {
@@ -877,6 +885,14 @@ include "../../private-aws-encryption-sdk-dafny-staging/StandardLibrary/src/Inde
877885
datatype TransactWriteItemsOutputTransformOutput = | TransactWriteItemsOutputTransformOutput (
878886
nameonly transformedOutput: ComAmazonawsDynamodbTypes.TransactWriteItemsOutput
879887
)
888+
datatype Transform =
889+
| LOWER
890+
| UPPER
891+
| INSERT
892+
| PREFIX
893+
| SUFFIX
894+
| SUBSTRING
895+
| SEGMENT
880896
datatype UpdateItemInputTransformInput = | UpdateItemInputTransformInput (
881897
nameonly sdkInput: ComAmazonawsDynamodbTypes.UpdateItemInput
882898
)
@@ -906,6 +922,31 @@ include "../../private-aws-encryption-sdk-dafny-staging/StandardLibrary/src/Inde
906922
type VersionNumber = x: int32 | IsValid_VersionNumber(x) witness *
907923
predicate method IsValid_VersionNumber(x: int32) {
908924
( 1 <= x )
925+
}
926+
datatype VirtualField = | VirtualField (
927+
nameonly name: string ,
928+
nameonly parts: VirtualPartList
929+
)
930+
type VirtualFieldList = x: seq<VirtualField> | IsValid_VirtualFieldList(x) witness *
931+
predicate method IsValid_VirtualFieldList(x: seq<VirtualField>) {
932+
( 1 <= |x| )
933+
}
934+
datatype VirtualPart = | VirtualPart (
935+
nameonly loc: TerminalLocation ,
936+
nameonly trans: Option<VirtualTransformList>
937+
)
938+
type VirtualPartList = x: seq<VirtualPart> | IsValid_VirtualPartList(x) witness *
939+
predicate method IsValid_VirtualPartList(x: seq<VirtualPart>) {
940+
( 1 <= |x| )
941+
}
942+
datatype VirtualTransform = | VirtualTransform (
943+
nameonly transform: Transform ,
944+
nameonly numbers: Option<NumberList> ,
945+
nameonly strings: Option<StringList>
946+
)
947+
type VirtualTransformList = x: seq<VirtualTransform> | IsValid_VirtualTransformList(x) witness *
948+
predicate method IsValid_VirtualTransformList(x: seq<VirtualTransform>) {
949+
( 1 <= |x| )
909950
}
910951
datatype Error =
911952
// Local Error structures are listed here

DynamoDbEncryptionMiddlewareInternal/Model/DynamoDbEncryptionMiddlewareInternal.smithy

Lines changed: 78 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -124,6 +124,31 @@ list BeaconVersionList {
124124
member: BeaconVersion
125125
}
126126

127+
@length(min: 1)
128+
list VirtualFieldList {
129+
member: VirtualField
130+
}
131+
132+
@length(min: 1)
133+
list VirtualPartList {
134+
member: VirtualPart
135+
}
136+
137+
@length(min: 1)
138+
list VirtualTransformList {
139+
member: VirtualTransform
140+
}
141+
142+
@length(min: 1)
143+
list StringList {
144+
member: String
145+
}
146+
147+
@length(min: 1)
148+
list NumberList {
149+
member: Integer
150+
}
151+
127152
@length(min: 1)
128153
list StandardBeaconList {
129154
member: StandardBeacon
@@ -154,6 +179,59 @@ list ConstructorPartList {
154179
member: ConstructorPart
155180
}
156181

182+
structure VirtualField {
183+
@required
184+
name : String,
185+
@required
186+
parts : VirtualPartList,
187+
}
188+
189+
structure VirtualPart {
190+
@required
191+
loc : TerminalLocation,
192+
trans : VirtualTransformList,
193+
}
194+
195+
@enum([
196+
{
197+
name: "LOWER",
198+
value: "Lower"
199+
},
200+
{
201+
name: "UPPER",
202+
value: "Upper"
203+
},
204+
{
205+
name: "INSERT",
206+
value: "Insert"
207+
},
208+
{
209+
name: "PREFIX",
210+
value: "Prefix"
211+
},
212+
{
213+
name: "SUFFIX",
214+
value: "Suffix"
215+
},
216+
{
217+
name: "SUBSTRING",
218+
value: "Substring"
219+
},
220+
{
221+
name: "SEGMENT",
222+
value: "Segment"
223+
},
224+
])
225+
string Transform
226+
227+
structure VirtualTransform {
228+
@required
229+
transform : Transform,
230+
numbers : NumberList,
231+
strings : StringList,
232+
}
233+
234+
157235
structure SensitivePart {
158236
@required
159237
name : String,

0 commit comments

Comments
 (0)