1
|
|
|
package dynamodb |
2
|
|
|
|
3
|
|
|
import ( |
4
|
|
|
"strconv" |
5
|
|
|
"time" |
6
|
|
|
|
7
|
|
|
SDK "github.com/aws/aws-sdk-go-v2/service/dynamodb" |
8
|
|
|
"github.com/evalphobia/aws-sdk-go-v2-wrapper/private/pointers" |
9
|
|
|
_ "github.com/evalphobia/aws-sdk-go-v2-wrapper/private/pointers" |
|
|
|
|
10
|
|
|
) |
11
|
|
|
|
12
|
|
|
type ArchivalSummary struct { |
|
|
|
|
13
|
|
|
ArchivalBackupARN string |
14
|
|
|
ArchivalDateTime time.Time |
15
|
|
|
ArchivalReason string |
16
|
|
|
} |
17
|
|
|
|
18
|
|
|
func newArchivalSummary(o *SDK.ArchivalSummary) ArchivalSummary { |
19
|
|
|
result := ArchivalSummary{} |
20
|
|
|
if o == nil { |
21
|
|
|
return result |
22
|
|
|
} |
23
|
|
|
|
24
|
|
|
if o.ArchivalBackupArn != nil { |
25
|
|
|
result.ArchivalBackupARN = *o.ArchivalBackupArn |
26
|
|
|
} |
27
|
|
|
if o.ArchivalDateTime != nil { |
28
|
|
|
result.ArchivalDateTime = *o.ArchivalDateTime |
29
|
|
|
} |
30
|
|
|
if o.ArchivalReason != nil { |
31
|
|
|
result.ArchivalReason = *o.ArchivalReason |
32
|
|
|
} |
33
|
|
|
return result |
34
|
|
|
} |
35
|
|
|
|
36
|
|
|
type AttributeDefinition struct { |
|
|
|
|
37
|
|
|
AttributeName string |
38
|
|
|
AttributeType ScalarAttributeType |
39
|
|
|
} |
40
|
|
|
|
41
|
|
|
func newAttributeDefinitions(list []SDK.AttributeDefinition) []AttributeDefinition { |
42
|
|
|
if len(list) == 0 { |
43
|
|
|
return nil |
44
|
|
|
} |
45
|
|
|
|
46
|
|
|
results := make([]AttributeDefinition, len(list)) |
47
|
|
|
for i, v := range list { |
48
|
|
|
results[i] = newAttributeDefinition(v) |
49
|
|
|
} |
50
|
|
|
return results |
51
|
|
|
} |
52
|
|
|
|
53
|
|
|
func newAttributeDefinition(o SDK.AttributeDefinition) AttributeDefinition { |
54
|
|
|
result := AttributeDefinition{} |
55
|
|
|
|
56
|
|
|
if o.AttributeName != nil { |
57
|
|
|
result.AttributeName = *o.AttributeName |
58
|
|
|
} |
59
|
|
|
result.AttributeType = ScalarAttributeType(o.AttributeType) |
60
|
|
|
return result |
61
|
|
|
} |
62
|
|
|
|
63
|
|
|
func (r AttributeDefinition) ToSDK() SDK.AttributeDefinition { |
|
|
|
|
64
|
|
|
o := SDK.AttributeDefinition{} |
65
|
|
|
|
66
|
|
|
if r.AttributeName != "" { |
67
|
|
|
o.AttributeName = pointers.String(r.AttributeName) |
68
|
|
|
} |
69
|
|
|
|
70
|
|
|
o.AttributeType = SDK.ScalarAttributeType(r.AttributeType) |
71
|
|
|
return o |
72
|
|
|
} |
73
|
|
|
|
74
|
|
|
type AttributeValue struct { |
|
|
|
|
75
|
|
|
Binary []byte |
76
|
|
|
BinarySet [][]byte |
77
|
|
|
List []AttributeValue |
78
|
|
|
Map map[string]AttributeValue |
79
|
|
|
Number string |
80
|
|
|
NumberInt int64 |
81
|
|
|
NumberFloat float64 |
82
|
|
|
NumberSet []string |
83
|
|
|
NumberSetInt []int64 |
84
|
|
|
NumberSetFloat []float64 |
85
|
|
|
Null bool |
86
|
|
|
String string |
87
|
|
|
StringSet []string |
88
|
|
|
|
89
|
|
|
Bool bool |
90
|
|
|
HasBool bool |
91
|
|
|
HasNumber bool |
92
|
|
|
} |
93
|
|
|
|
94
|
|
|
func newAttributeValue(o SDK.AttributeValue) AttributeValue { |
95
|
|
|
result := AttributeValue{} |
96
|
|
|
|
97
|
|
|
switch { |
98
|
|
|
case len(o.B) != 0: |
99
|
|
|
result.Binary = o.B |
100
|
|
|
case len(o.BS) != 0: |
101
|
|
|
result.BinarySet = o.BS |
102
|
|
|
case len(o.L) != 0: |
103
|
|
|
result.List = newAttributeValueList(o.L) |
104
|
|
|
case len(o.M) != 0: |
105
|
|
|
result.Map = newAttributeValueMap(o.M) |
106
|
|
|
case o.N != nil: |
107
|
|
|
result.Number = *o.N |
108
|
|
|
result.HasNumber = true |
109
|
|
|
case len(o.NS) != 0: |
110
|
|
|
result.NumberSet = o.NS |
111
|
|
|
case o.NULL != nil: |
112
|
|
|
result.Null = *o.NULL |
113
|
|
|
case o.S != nil: |
114
|
|
|
result.String = *o.S |
115
|
|
|
case len(o.SS) != 0: |
116
|
|
|
result.StringSet = o.SS |
117
|
|
|
case o.BOOL != nil: |
118
|
|
|
result.Bool = *o.BOOL |
119
|
|
|
result.HasBool = true |
120
|
|
|
} |
121
|
|
|
return result |
122
|
|
|
} |
123
|
|
|
|
124
|
|
|
func newAttributeValueList(list []SDK.AttributeValue) []AttributeValue { |
125
|
|
|
if len(list) == 0 { |
126
|
|
|
return nil |
127
|
|
|
} |
128
|
|
|
|
129
|
|
|
results := make([]AttributeValue, len(list)) |
130
|
|
|
for i, v := range list { |
131
|
|
|
results[i] = newAttributeValue(v) |
132
|
|
|
} |
133
|
|
|
return results |
134
|
|
|
} |
135
|
|
|
|
136
|
|
|
func newAttributeValueMap(o map[string]SDK.AttributeValue) map[string]AttributeValue { |
137
|
|
|
if len(o) == 0 { |
138
|
|
|
return nil |
139
|
|
|
} |
140
|
|
|
|
141
|
|
|
m := make(map[string]AttributeValue, len(o)) |
142
|
|
|
for key, val := range o { |
143
|
|
|
m[key] = newAttributeValue(val) |
144
|
|
|
} |
145
|
|
|
return m |
146
|
|
|
} |
147
|
|
|
|
148
|
|
|
func (r AttributeValue) ToSDK() SDK.AttributeValue { |
|
|
|
|
149
|
|
|
o := SDK.AttributeValue{} |
150
|
|
|
|
151
|
|
|
switch { |
152
|
|
|
case len(r.Binary) != 0: |
153
|
|
|
o.B = r.Binary |
154
|
|
|
case len(r.BinarySet) != 0: |
155
|
|
|
o.BS = r.BinarySet |
156
|
|
|
case len(r.List) != 0: |
157
|
|
|
list := make([]SDK.AttributeValue, len(r.List)) |
158
|
|
|
for i, v := range r.List { |
159
|
|
|
list[i] = v.ToSDK() |
160
|
|
|
} |
161
|
|
|
o.L = list |
162
|
|
|
case len(r.Map) != 0: |
163
|
|
|
m := make(map[string]SDK.AttributeValue, len(r.Map)) |
164
|
|
|
for key, val := range r.Map { |
165
|
|
|
m[key] = val.ToSDK() |
166
|
|
|
} |
167
|
|
|
o.M = m |
168
|
|
|
case r.Number != "": |
169
|
|
|
o.N = pointers.String(r.Number) |
170
|
|
|
case r.NumberInt != 0: |
171
|
|
|
o.N = pointers.String(strconv.FormatInt(r.NumberInt, 10)) |
172
|
|
|
case r.NumberFloat != 0: |
173
|
|
|
o.N = pointers.String(strconv.FormatFloat(r.NumberFloat, 'f', -1, 64)) |
174
|
|
|
case r.HasNumber: |
175
|
|
|
o.N = pointers.String("0") |
176
|
|
|
case len(r.NumberSet) != 0: |
177
|
|
|
o.NS = r.NumberSet |
178
|
|
|
case len(r.NumberSetInt) != 0: |
179
|
|
|
list := make([]string, len(r.NumberSetInt)) |
180
|
|
|
for i, v := range r.NumberSetInt { |
181
|
|
|
list[i] = strconv.FormatInt(v, 10) |
182
|
|
|
} |
183
|
|
|
o.NS = list |
184
|
|
|
case len(r.NumberSetFloat) != 0: |
185
|
|
|
list := make([]string, len(r.NumberSetFloat)) |
186
|
|
|
for i, v := range r.NumberSetFloat { |
187
|
|
|
list[i] = strconv.FormatFloat(v, 'f', -1, 64) |
188
|
|
|
} |
189
|
|
|
o.NS = list |
190
|
|
|
case r.String != "": |
191
|
|
|
o.S = pointers.String(r.String) |
192
|
|
|
case len(r.StringSet) != 0: |
193
|
|
|
o.SS = r.StringSet |
194
|
|
|
case r.HasBool, |
195
|
|
|
r.Bool: |
196
|
|
|
o.BOOL = pointers.Bool(r.Bool) |
197
|
|
|
case r.Null: |
198
|
|
|
o.NULL = pointers.Bool(r.Null) |
199
|
|
|
} |
200
|
|
|
return o |
201
|
|
|
} |
202
|
|
|
|
203
|
|
|
func (r AttributeValue) hasValue() bool { |
204
|
|
|
switch { |
205
|
|
|
case r.HasNumber, |
206
|
|
|
r.HasBool, |
207
|
|
|
r.Bool, |
208
|
|
|
r.Null, |
209
|
|
|
r.Number != "", |
210
|
|
|
r.NumberInt != 0, |
211
|
|
|
r.NumberFloat != 0, |
212
|
|
|
r.String != "", |
213
|
|
|
len(r.Binary) != 0, |
214
|
|
|
len(r.BinarySet) != 0, |
215
|
|
|
len(r.List) != 0, |
216
|
|
|
len(r.Map) != 0, |
217
|
|
|
len(r.NumberSet) != 0, |
218
|
|
|
len(r.NumberSetInt) != 0, |
219
|
|
|
len(r.NumberSetFloat) != 0, |
220
|
|
|
len(r.StringSet) != 0: |
221
|
|
|
return true |
222
|
|
|
} |
223
|
|
|
return false |
224
|
|
|
} |
225
|
|
|
|
226
|
|
|
type BillingModeSummary struct { |
|
|
|
|
227
|
|
|
BillingMode BillingMode |
228
|
|
|
LastUpdateToPayPerRequestDateTime time.Time |
229
|
|
|
} |
230
|
|
|
|
231
|
|
|
func newBillingModeSummary(o *SDK.BillingModeSummary) BillingModeSummary { |
232
|
|
|
result := BillingModeSummary{} |
233
|
|
|
if o == nil { |
234
|
|
|
return result |
235
|
|
|
} |
236
|
|
|
|
237
|
|
|
if o.LastUpdateToPayPerRequestDateTime != nil { |
238
|
|
|
result.LastUpdateToPayPerRequestDateTime = *o.LastUpdateToPayPerRequestDateTime |
239
|
|
|
} |
240
|
|
|
|
241
|
|
|
result.BillingMode = BillingMode(o.BillingMode) |
242
|
|
|
return result |
243
|
|
|
} |
244
|
|
|
|
245
|
|
|
type Capacity struct { |
|
|
|
|
246
|
|
|
CapacityUnits float64 |
247
|
|
|
ReadCapacityUnits float64 |
248
|
|
|
WriteCapacityUnits float64 |
249
|
|
|
} |
250
|
|
|
|
251
|
|
|
func newCapacity(o *SDK.Capacity) Capacity { |
252
|
|
|
result := Capacity{} |
253
|
|
|
if o == nil { |
254
|
|
|
return result |
255
|
|
|
} |
256
|
|
|
|
257
|
|
|
if o.CapacityUnits != nil { |
258
|
|
|
result.CapacityUnits = *o.CapacityUnits |
259
|
|
|
} |
260
|
|
|
if o.ReadCapacityUnits != nil { |
261
|
|
|
result.ReadCapacityUnits = *o.ReadCapacityUnits |
262
|
|
|
} |
263
|
|
|
if o.WriteCapacityUnits != nil { |
264
|
|
|
result.WriteCapacityUnits = *o.WriteCapacityUnits |
265
|
|
|
} |
266
|
|
|
return result |
267
|
|
|
} |
268
|
|
|
|
269
|
|
|
func newCapacityMap(m map[string]SDK.Capacity) map[string]Capacity { |
270
|
|
|
if m == nil { |
271
|
|
|
return nil |
272
|
|
|
} |
273
|
|
|
|
274
|
|
|
result := make(map[string]Capacity, len(m)) |
275
|
|
|
for key, val := range m { |
276
|
|
|
result[key] = newCapacity(&val) |
277
|
|
|
} |
278
|
|
|
return result |
279
|
|
|
} |
280
|
|
|
|
281
|
|
|
type Condition struct { |
|
|
|
|
282
|
|
|
ComparisonOperator ComparisonOperator |
283
|
|
|
|
284
|
|
|
// optional |
285
|
|
|
AttributeValueList []AttributeValue |
286
|
|
|
} |
287
|
|
|
|
288
|
|
|
func (r Condition) ToSDK() SDK.Condition { |
|
|
|
|
289
|
|
|
o := SDK.Condition{} |
290
|
|
|
|
291
|
|
|
o.ComparisonOperator = SDK.ComparisonOperator(r.ComparisonOperator) |
292
|
|
|
|
293
|
|
|
if len(r.AttributeValueList) != 0 { |
294
|
|
|
list := make([]SDK.AttributeValue, len(r.AttributeValueList)) |
295
|
|
|
for i, v := range r.AttributeValueList { |
296
|
|
|
list[i] = v.ToSDK() |
297
|
|
|
} |
298
|
|
|
o.AttributeValueList = list |
299
|
|
|
} |
300
|
|
|
|
301
|
|
|
return o |
302
|
|
|
} |
303
|
|
|
|
304
|
|
|
type ConsumedCapacity struct { |
|
|
|
|
305
|
|
|
CapacityUnits float64 |
306
|
|
|
GlobalSecondaryIndexes map[string]Capacity |
307
|
|
|
LocalSecondaryIndexes map[string]Capacity |
308
|
|
|
ReadCapacityUnits float64 |
309
|
|
|
Table Capacity |
310
|
|
|
TableName string |
311
|
|
|
WriteCapacityUnits float64 |
312
|
|
|
} |
313
|
|
|
|
314
|
|
|
func newConsumedCapacities(list []SDK.ConsumedCapacity) []ConsumedCapacity { |
315
|
|
|
if len(list) == 0 { |
316
|
|
|
return nil |
317
|
|
|
} |
318
|
|
|
|
319
|
|
|
result := make([]ConsumedCapacity, len(list)) |
320
|
|
|
for i, v := range list { |
321
|
|
|
result[i] = newConsumedCapacity(v) |
322
|
|
|
} |
323
|
|
|
return result |
324
|
|
|
} |
325
|
|
|
|
326
|
|
|
func newConsumedCapacity(o SDK.ConsumedCapacity) ConsumedCapacity { |
327
|
|
|
result := ConsumedCapacity{} |
328
|
|
|
|
329
|
|
|
if o.CapacityUnits != nil { |
330
|
|
|
result.CapacityUnits = *o.CapacityUnits |
331
|
|
|
} |
332
|
|
|
if o.ReadCapacityUnits != nil { |
333
|
|
|
result.ReadCapacityUnits = *o.ReadCapacityUnits |
334
|
|
|
} |
335
|
|
|
if o.TableName != nil { |
336
|
|
|
result.TableName = *o.TableName |
337
|
|
|
} |
338
|
|
|
if o.WriteCapacityUnits != nil { |
339
|
|
|
result.WriteCapacityUnits = *o.WriteCapacityUnits |
340
|
|
|
} |
341
|
|
|
|
342
|
|
|
result.GlobalSecondaryIndexes = newCapacityMap(o.GlobalSecondaryIndexes) |
343
|
|
|
result.LocalSecondaryIndexes = newCapacityMap(o.LocalSecondaryIndexes) |
344
|
|
|
result.Table = newCapacity(o.Table) |
345
|
|
|
return result |
346
|
|
|
} |
347
|
|
|
|
348
|
|
|
type ExpectedAttributeValue struct { |
|
|
|
|
349
|
|
|
AttributeValueList []AttributeValue `type:"list"` |
350
|
|
|
ComparisonOperator ComparisonOperator `type:"string" enum:"true"` |
351
|
|
|
Exists bool `type:"boolean"` |
352
|
|
|
Value AttributeValue `type:"structure"` |
353
|
|
|
} |
354
|
|
|
|
355
|
|
|
func (r ExpectedAttributeValue) ToSDK() SDK.ExpectedAttributeValue { |
|
|
|
|
356
|
|
|
o := SDK.ExpectedAttributeValue{} |
357
|
|
|
|
358
|
|
|
if len(r.AttributeValueList) != 0 { |
359
|
|
|
list := make([]SDK.AttributeValue, 0, len(r.AttributeValueList)) |
360
|
|
|
for _, v := range r.AttributeValueList { |
361
|
|
|
if v.hasValue() { |
362
|
|
|
list = append(list, v.ToSDK()) |
363
|
|
|
} |
364
|
|
|
} |
365
|
|
|
o.AttributeValueList = list |
366
|
|
|
} |
367
|
|
|
|
368
|
|
|
if r.Exists { |
369
|
|
|
o.Exists = pointers.Bool(r.Exists) |
370
|
|
|
} |
371
|
|
|
|
372
|
|
|
o.ComparisonOperator = SDK.ComparisonOperator(r.ComparisonOperator) |
373
|
|
|
|
374
|
|
|
if r.Value.hasValue() { |
375
|
|
|
v := r.Value.ToSDK() |
376
|
|
|
o.Value = &v |
377
|
|
|
} |
378
|
|
|
|
379
|
|
|
return o |
380
|
|
|
} |
381
|
|
|
|
382
|
|
|
type GlobalSecondaryIndex struct { |
|
|
|
|
383
|
|
|
IndexName string |
384
|
|
|
KeySchema []KeySchemaElement |
385
|
|
|
Projection Projection |
386
|
|
|
|
387
|
|
|
// optional |
388
|
|
|
ProvisionedThroughput ProvisionedThroughput |
389
|
|
|
} |
390
|
|
|
|
391
|
|
|
func newGlobalSecondaryIndexes(list []SDK.GlobalSecondaryIndex) []GlobalSecondaryIndex { |
392
|
|
|
if len(list) == 0 { |
393
|
|
|
return nil |
394
|
|
|
} |
395
|
|
|
|
396
|
|
|
result := make([]GlobalSecondaryIndex, len(list)) |
397
|
|
|
for i, v := range list { |
398
|
|
|
result[i] = newGlobalSecondaryIndex(v) |
399
|
|
|
} |
400
|
|
|
return result |
401
|
|
|
} |
402
|
|
|
|
403
|
|
|
func newGlobalSecondaryIndex(o SDK.GlobalSecondaryIndex) GlobalSecondaryIndex { |
404
|
|
|
result := GlobalSecondaryIndex{} |
405
|
|
|
|
406
|
|
|
if o.IndexName != nil { |
407
|
|
|
result.IndexName = *o.IndexName |
408
|
|
|
} |
409
|
|
|
|
410
|
|
|
result.Projection = newProjection(o.Projection) |
411
|
|
|
result.ProvisionedThroughput = newProvisionedThroughput(o.ProvisionedThroughput) |
412
|
|
|
result.KeySchema = newKeySchemaElements(o.KeySchema) |
413
|
|
|
return result |
414
|
|
|
} |
415
|
|
|
|
416
|
|
|
func (r GlobalSecondaryIndex) ToSDK() SDK.GlobalSecondaryIndex { |
|
|
|
|
417
|
|
|
o := SDK.GlobalSecondaryIndex{} |
418
|
|
|
|
419
|
|
|
if r.IndexName != "" { |
420
|
|
|
o.IndexName = pointers.String(r.IndexName) |
421
|
|
|
} |
422
|
|
|
|
423
|
|
|
if r.Projection.hasValue() { |
424
|
|
|
v := r.Projection.ToSDK() |
425
|
|
|
o.Projection = &v |
426
|
|
|
} |
427
|
|
|
if r.ProvisionedThroughput.hasValue() { |
428
|
|
|
v := r.ProvisionedThroughput.ToSDK() |
429
|
|
|
o.ProvisionedThroughput = &v |
430
|
|
|
} |
431
|
|
|
|
432
|
|
|
if len(r.KeySchema) != 0 { |
433
|
|
|
list := make([]SDK.KeySchemaElement, len(r.KeySchema)) |
434
|
|
|
for i, v := range r.KeySchema { |
435
|
|
|
list[i] = v.ToSDK() |
436
|
|
|
} |
437
|
|
|
o.KeySchema = list |
438
|
|
|
} |
439
|
|
|
return o |
440
|
|
|
} |
441
|
|
|
|
442
|
|
|
// Represents the properties of a global secondary index. |
|
|
|
|
443
|
|
|
type GlobalSecondaryIndexDescription struct { |
444
|
|
|
Backfilling bool |
445
|
|
|
IndexARN string |
446
|
|
|
IndexName string |
447
|
|
|
IndexSizeBytes int64 |
448
|
|
|
IndexStatus IndexStatus |
449
|
|
|
ItemCount int64 |
450
|
|
|
KeySchema []KeySchemaElement |
451
|
|
|
Projection Projection |
452
|
|
|
ProvisionedThroughput ProvisionedThroughputDescription |
453
|
|
|
} |
454
|
|
|
|
455
|
|
|
func newGlobalSecondaryIndexDescriptions(list []SDK.GlobalSecondaryIndexDescription) []GlobalSecondaryIndexDescription { |
456
|
|
|
if len(list) == 0 { |
457
|
|
|
return nil |
458
|
|
|
} |
459
|
|
|
|
460
|
|
|
result := make([]GlobalSecondaryIndexDescription, len(list)) |
461
|
|
|
for i, v := range list { |
462
|
|
|
result[i] = newGlobalSecondaryIndexDescription(v) |
463
|
|
|
} |
464
|
|
|
return result |
465
|
|
|
} |
466
|
|
|
|
467
|
|
|
func newGlobalSecondaryIndexDescription(o SDK.GlobalSecondaryIndexDescription) GlobalSecondaryIndexDescription { |
468
|
|
|
result := GlobalSecondaryIndexDescription{} |
469
|
|
|
|
470
|
|
|
if o.Backfilling != nil { |
471
|
|
|
result.Backfilling = *o.Backfilling |
472
|
|
|
} |
473
|
|
|
if o.IndexArn != nil { |
474
|
|
|
result.IndexARN = *o.IndexArn |
475
|
|
|
} |
476
|
|
|
if o.IndexName != nil { |
477
|
|
|
result.IndexName = *o.IndexName |
478
|
|
|
} |
479
|
|
|
if o.IndexSizeBytes != nil { |
480
|
|
|
result.IndexSizeBytes = *o.IndexSizeBytes |
481
|
|
|
} |
482
|
|
|
if o.ItemCount != nil { |
483
|
|
|
result.ItemCount = *o.ItemCount |
484
|
|
|
} |
485
|
|
|
|
486
|
|
|
result.IndexStatus = IndexStatus(o.IndexStatus) |
487
|
|
|
|
488
|
|
|
result.KeySchema = newKeySchemaElements(o.KeySchema) |
489
|
|
|
result.Projection = newProjection(o.Projection) |
490
|
|
|
result.ProvisionedThroughput = newProvisionedThroughputDescription(o.ProvisionedThroughput) |
491
|
|
|
return result |
492
|
|
|
} |
493
|
|
|
|
494
|
|
|
type ItemCollectionMetrics struct { |
|
|
|
|
495
|
|
|
ItemCollectionKey map[string]AttributeValue `type:"map"` |
496
|
|
|
SizeEstimateRangeGB []float64 `type:"list"` |
497
|
|
|
} |
498
|
|
|
|
499
|
|
|
func newItemCollectionMetrics(o SDK.ItemCollectionMetrics) ItemCollectionMetrics { |
500
|
|
|
result := ItemCollectionMetrics{} |
501
|
|
|
|
502
|
|
|
m := make(map[string]AttributeValue, len(o.ItemCollectionKey)) |
503
|
|
|
for key, val := range o.ItemCollectionKey { |
504
|
|
|
m[key] = newAttributeValue(val) |
505
|
|
|
} |
506
|
|
|
result.ItemCollectionKey = m |
507
|
|
|
|
508
|
|
|
result.SizeEstimateRangeGB = o.SizeEstimateRangeGB |
509
|
|
|
return result |
510
|
|
|
} |
511
|
|
|
|
512
|
|
|
type KeysAndAttributes struct { |
|
|
|
|
513
|
|
|
Keys []map[string]AttributeValue |
514
|
|
|
|
515
|
|
|
// optional |
516
|
|
|
AttributesToGet []string |
517
|
|
|
ConsistentRead bool |
518
|
|
|
ExpressionAttributeNames map[string]string |
519
|
|
|
ProjectionExpression string |
520
|
|
|
} |
521
|
|
|
|
522
|
|
|
func newKeysAndAttributes(o SDK.KeysAndAttributes) KeysAndAttributes { |
523
|
|
|
result := KeysAndAttributes{} |
524
|
|
|
|
525
|
|
|
result.AttributesToGet = o.AttributesToGet |
526
|
|
|
result.ExpressionAttributeNames = o.ExpressionAttributeNames |
527
|
|
|
|
528
|
|
|
if o.ConsistentRead != nil { |
529
|
|
|
result.ConsistentRead = *o.ConsistentRead |
530
|
|
|
} |
531
|
|
|
if o.ProjectionExpression != nil { |
532
|
|
|
result.ProjectionExpression = *o.ProjectionExpression |
533
|
|
|
} |
534
|
|
|
|
535
|
|
|
if len(o.Keys) != 0 { |
536
|
|
|
list := make([]map[string]AttributeValue, len(o.Keys)) |
537
|
|
|
for i, v := range o.Keys { |
538
|
|
|
list[i] = newAttributeValueMap(v) |
539
|
|
|
} |
540
|
|
|
result.Keys = list |
541
|
|
|
} |
542
|
|
|
|
543
|
|
|
return result |
544
|
|
|
} |
545
|
|
|
|
546
|
|
|
func (r KeysAndAttributes) ToSDK() SDK.KeysAndAttributes { |
|
|
|
|
547
|
|
|
o := SDK.KeysAndAttributes{} |
548
|
|
|
|
549
|
|
|
if len(r.Keys) != 0 { |
550
|
|
|
list := make([]map[string]SDK.AttributeValue, len(r.Keys)) |
551
|
|
|
for i, v := range r.Keys { |
552
|
|
|
m := make(map[string]SDK.AttributeValue, len(v)) |
553
|
|
|
for key, val := range v { |
554
|
|
|
m[key] = val.ToSDK() |
555
|
|
|
} |
556
|
|
|
list[i] = m |
557
|
|
|
} |
558
|
|
|
o.Keys = list |
559
|
|
|
} |
560
|
|
|
|
561
|
|
|
if r.ConsistentRead { |
562
|
|
|
o.ConsistentRead = pointers.Bool(r.ConsistentRead) |
563
|
|
|
} |
564
|
|
|
if r.ProjectionExpression != "" { |
565
|
|
|
o.ProjectionExpression = pointers.String(r.ProjectionExpression) |
566
|
|
|
} |
567
|
|
|
|
568
|
|
|
o.AttributesToGet = r.AttributesToGet |
569
|
|
|
o.ExpressionAttributeNames = r.ExpressionAttributeNames |
570
|
|
|
return o |
571
|
|
|
} |
572
|
|
|
|
573
|
|
|
type KeySchemaElement struct { |
|
|
|
|
574
|
|
|
AttributeName string |
575
|
|
|
KeyType KeyType |
576
|
|
|
} |
577
|
|
|
|
578
|
|
|
func newKeySchemaElements(list []SDK.KeySchemaElement) []KeySchemaElement { |
579
|
|
|
if len(list) == 0 { |
580
|
|
|
return nil |
581
|
|
|
} |
582
|
|
|
|
583
|
|
|
results := make([]KeySchemaElement, len(list)) |
584
|
|
|
for i, v := range list { |
585
|
|
|
results[i] = newKeySchemaElement(v) |
586
|
|
|
} |
587
|
|
|
return results |
588
|
|
|
} |
589
|
|
|
|
590
|
|
|
func newKeySchemaElement(o SDK.KeySchemaElement) KeySchemaElement { |
591
|
|
|
result := KeySchemaElement{} |
592
|
|
|
|
593
|
|
|
if o.AttributeName != nil { |
594
|
|
|
result.AttributeName = *o.AttributeName |
595
|
|
|
} |
596
|
|
|
|
597
|
|
|
result.KeyType = KeyType(o.KeyType) |
598
|
|
|
return result |
599
|
|
|
} |
600
|
|
|
|
601
|
|
|
func (r KeySchemaElement) ToSDK() SDK.KeySchemaElement { |
|
|
|
|
602
|
|
|
o := SDK.KeySchemaElement{} |
603
|
|
|
|
604
|
|
|
if r.AttributeName != "" { |
605
|
|
|
o.AttributeName = pointers.String(r.AttributeName) |
606
|
|
|
} |
607
|
|
|
o.KeyType = SDK.KeyType(r.KeyType) |
608
|
|
|
return o |
609
|
|
|
} |
610
|
|
|
|
611
|
|
|
type LocalSecondaryIndex struct { |
|
|
|
|
612
|
|
|
IndexName string |
613
|
|
|
KeySchema []KeySchemaElement |
614
|
|
|
Projection Projection |
615
|
|
|
} |
616
|
|
|
|
617
|
|
|
func newLocalSecondaryIndexs(list []SDK.LocalSecondaryIndex) []LocalSecondaryIndex { |
618
|
|
|
if len(list) == 0 { |
619
|
|
|
return nil |
620
|
|
|
} |
621
|
|
|
|
622
|
|
|
result := make([]LocalSecondaryIndex, len(list)) |
623
|
|
|
for i, v := range list { |
624
|
|
|
result[i] = newLocalSecondaryIndex(v) |
625
|
|
|
} |
626
|
|
|
return result |
627
|
|
|
} |
628
|
|
|
|
629
|
|
|
func newLocalSecondaryIndex(o SDK.LocalSecondaryIndex) LocalSecondaryIndex { |
630
|
|
|
result := LocalSecondaryIndex{} |
631
|
|
|
|
632
|
|
|
if o.IndexName != nil { |
633
|
|
|
result.IndexName = *o.IndexName |
634
|
|
|
} |
635
|
|
|
|
636
|
|
|
result.KeySchema = newKeySchemaElements(o.KeySchema) |
637
|
|
|
result.Projection = newProjection(o.Projection) |
638
|
|
|
return result |
639
|
|
|
} |
640
|
|
|
|
641
|
|
|
func (r LocalSecondaryIndex) ToSDK() SDK.LocalSecondaryIndex { |
|
|
|
|
642
|
|
|
o := SDK.LocalSecondaryIndex{} |
643
|
|
|
|
644
|
|
|
if r.IndexName != "" { |
645
|
|
|
o.IndexName = pointers.String(r.IndexName) |
646
|
|
|
} |
647
|
|
|
|
648
|
|
|
if r.Projection.hasValue() { |
649
|
|
|
v := r.Projection.ToSDK() |
650
|
|
|
o.Projection = &v |
651
|
|
|
} |
652
|
|
|
|
653
|
|
|
if len(r.KeySchema) != 0 { |
654
|
|
|
list := make([]SDK.KeySchemaElement, len(r.KeySchema)) |
655
|
|
|
for i, v := range r.KeySchema { |
656
|
|
|
list[i] = v.ToSDK() |
657
|
|
|
} |
658
|
|
|
o.KeySchema = list |
659
|
|
|
} |
660
|
|
|
return o |
661
|
|
|
} |
662
|
|
|
|
663
|
|
|
type LocalSecondaryIndexDescription struct { |
|
|
|
|
664
|
|
|
IndexARN string |
665
|
|
|
IndexName string |
666
|
|
|
IndexSizeBytes int64 |
667
|
|
|
ItemCount int64 |
668
|
|
|
KeySchema []KeySchemaElement |
669
|
|
|
Projection Projection |
670
|
|
|
} |
671
|
|
|
|
672
|
|
|
func newLocalSecondaryIndexDescriptions(list []SDK.LocalSecondaryIndexDescription) []LocalSecondaryIndexDescription { |
673
|
|
|
if len(list) == 0 { |
674
|
|
|
return nil |
675
|
|
|
} |
676
|
|
|
|
677
|
|
|
result := make([]LocalSecondaryIndexDescription, len(list)) |
678
|
|
|
for i, v := range list { |
679
|
|
|
result[i] = newLocalSecondaryIndexDescription(v) |
680
|
|
|
} |
681
|
|
|
return result |
682
|
|
|
} |
683
|
|
|
|
684
|
|
|
func newLocalSecondaryIndexDescription(o SDK.LocalSecondaryIndexDescription) LocalSecondaryIndexDescription { |
685
|
|
|
result := LocalSecondaryIndexDescription{} |
686
|
|
|
|
687
|
|
|
if o.IndexArn != nil { |
688
|
|
|
result.IndexARN = *o.IndexArn |
689
|
|
|
} |
690
|
|
|
if o.IndexName != nil { |
691
|
|
|
result.IndexName = *o.IndexName |
692
|
|
|
} |
693
|
|
|
if o.IndexSizeBytes != nil { |
694
|
|
|
result.IndexSizeBytes = *o.IndexSizeBytes |
695
|
|
|
} |
696
|
|
|
if o.ItemCount != nil { |
697
|
|
|
result.ItemCount = *o.ItemCount |
698
|
|
|
} |
699
|
|
|
|
700
|
|
|
result.KeySchema = newKeySchemaElements(o.KeySchema) |
701
|
|
|
result.Projection = newProjection(o.Projection) |
702
|
|
|
return result |
703
|
|
|
} |
704
|
|
|
|
705
|
|
|
type Projection struct { |
|
|
|
|
706
|
|
|
NonKeyAttributes []string |
707
|
|
|
ProjectionType ProjectionType |
708
|
|
|
} |
709
|
|
|
|
710
|
|
|
func newProjection(o *SDK.Projection) Projection { |
711
|
|
|
result := Projection{} |
712
|
|
|
if o == nil { |
713
|
|
|
return result |
714
|
|
|
} |
715
|
|
|
|
716
|
|
|
result.NonKeyAttributes = o.NonKeyAttributes |
717
|
|
|
result.ProjectionType = ProjectionType(o.ProjectionType) |
718
|
|
|
return result |
719
|
|
|
} |
720
|
|
|
|
721
|
|
|
func (r Projection) ToSDK() SDK.Projection { |
|
|
|
|
722
|
|
|
o := SDK.Projection{} |
723
|
|
|
o.NonKeyAttributes = r.NonKeyAttributes |
724
|
|
|
o.ProjectionType = SDK.ProjectionType(r.ProjectionType) |
725
|
|
|
return o |
726
|
|
|
} |
727
|
|
|
|
728
|
|
|
func (r Projection) hasValue() bool { |
729
|
|
|
switch { |
730
|
|
|
case r.ProjectionType != "", |
731
|
|
|
len(r.NonKeyAttributes) != 0: |
732
|
|
|
return true |
733
|
|
|
} |
734
|
|
|
return false |
735
|
|
|
} |
736
|
|
|
|
737
|
|
|
type ProvisionedThroughput struct { |
|
|
|
|
738
|
|
|
ReadCapacityUnits int64 |
739
|
|
|
WriteCapacityUnits int64 |
740
|
|
|
} |
741
|
|
|
|
742
|
|
|
func newProvisionedThroughput(o *SDK.ProvisionedThroughput) ProvisionedThroughput { |
743
|
|
|
result := ProvisionedThroughput{} |
744
|
|
|
if o == nil { |
745
|
|
|
return result |
746
|
|
|
} |
747
|
|
|
|
748
|
|
|
if o.ReadCapacityUnits != nil { |
749
|
|
|
result.ReadCapacityUnits = *o.ReadCapacityUnits |
750
|
|
|
} |
751
|
|
|
if o.WriteCapacityUnits != nil { |
752
|
|
|
result.WriteCapacityUnits = *o.WriteCapacityUnits |
753
|
|
|
} |
754
|
|
|
return result |
755
|
|
|
} |
756
|
|
|
|
757
|
|
|
func (r ProvisionedThroughput) ToSDK() SDK.ProvisionedThroughput { |
|
|
|
|
758
|
|
|
return SDK.ProvisionedThroughput{ |
759
|
|
|
ReadCapacityUnits: pointers.Long64(r.ReadCapacityUnits), |
760
|
|
|
WriteCapacityUnits: pointers.Long64(r.WriteCapacityUnits), |
761
|
|
|
} |
762
|
|
|
} |
763
|
|
|
|
764
|
|
|
func (r ProvisionedThroughput) hasValue() bool { |
765
|
|
|
switch { |
766
|
|
|
case r.ReadCapacityUnits != 0, |
767
|
|
|
r.WriteCapacityUnits != 0: |
768
|
|
|
return true |
769
|
|
|
} |
770
|
|
|
return false |
771
|
|
|
} |
772
|
|
|
|
773
|
|
|
type ProvisionedThroughputDescription struct { |
|
|
|
|
774
|
|
|
LastDecreaseDateTime time.Time |
775
|
|
|
LastIncreaseDateTime time.Time |
776
|
|
|
NumberOfDecreasesToday int64 |
777
|
|
|
ReadCapacityUnits int64 |
778
|
|
|
WriteCapacityUnits int64 |
779
|
|
|
} |
780
|
|
|
|
781
|
|
|
func newProvisionedThroughputDescription(o *SDK.ProvisionedThroughputDescription) ProvisionedThroughputDescription { |
782
|
|
|
result := ProvisionedThroughputDescription{} |
783
|
|
|
if o == nil { |
784
|
|
|
return result |
785
|
|
|
} |
786
|
|
|
|
787
|
|
|
if o.LastDecreaseDateTime != nil { |
788
|
|
|
result.LastDecreaseDateTime = *o.LastDecreaseDateTime |
789
|
|
|
} |
790
|
|
|
if o.LastIncreaseDateTime != nil { |
791
|
|
|
result.LastIncreaseDateTime = *o.LastIncreaseDateTime |
792
|
|
|
} |
793
|
|
|
if o.NumberOfDecreasesToday != nil { |
794
|
|
|
result.NumberOfDecreasesToday = *o.NumberOfDecreasesToday |
795
|
|
|
} |
796
|
|
|
if o.ReadCapacityUnits != nil { |
797
|
|
|
result.ReadCapacityUnits = *o.ReadCapacityUnits |
798
|
|
|
} |
799
|
|
|
if o.WriteCapacityUnits != nil { |
800
|
|
|
result.WriteCapacityUnits = *o.WriteCapacityUnits |
801
|
|
|
} |
802
|
|
|
return result |
803
|
|
|
} |
804
|
|
|
|
805
|
|
|
type ReplicaDescription struct { |
|
|
|
|
806
|
|
|
GlobalSecondaryIndexes []ReplicaGlobalSecondaryIndexDescription |
807
|
|
|
KMSMasterKeyId string |
|
|
|
|
808
|
|
|
RegionName string |
809
|
|
|
ReplicaStatus ReplicaStatus |
810
|
|
|
ReplicaStatusDescription string |
811
|
|
|
ReplicaStatusPercentProgress string |
812
|
|
|
|
813
|
|
|
ProvisionedThroughputOverrideRCU int64 |
814
|
|
|
} |
815
|
|
|
|
816
|
|
|
func newReplicaDescriptions(list []SDK.ReplicaDescription) []ReplicaDescription { |
817
|
|
|
if len(list) == 0 { |
818
|
|
|
return nil |
819
|
|
|
} |
820
|
|
|
|
821
|
|
|
result := make([]ReplicaDescription, len(list)) |
822
|
|
|
for i, v := range list { |
823
|
|
|
result[i] = newReplicaDescription(v) |
824
|
|
|
} |
825
|
|
|
return result |
826
|
|
|
} |
827
|
|
|
|
828
|
|
|
func newReplicaDescription(o SDK.ReplicaDescription) ReplicaDescription { |
829
|
|
|
result := ReplicaDescription{} |
830
|
|
|
|
831
|
|
|
if o.KMSMasterKeyId != nil { |
832
|
|
|
result.KMSMasterKeyId = *o.KMSMasterKeyId |
833
|
|
|
} |
834
|
|
|
if o.RegionName != nil { |
835
|
|
|
result.RegionName = *o.RegionName |
836
|
|
|
} |
837
|
|
|
if o.ReplicaStatusDescription != nil { |
838
|
|
|
result.ReplicaStatusDescription = *o.ReplicaStatusDescription |
839
|
|
|
} |
840
|
|
|
if o.ReplicaStatusPercentProgress != nil { |
841
|
|
|
result.ReplicaStatusPercentProgress = *o.ReplicaStatusPercentProgress |
842
|
|
|
} |
843
|
|
|
|
844
|
|
|
result.ReplicaStatus = ReplicaStatus(o.ReplicaStatus) |
845
|
|
|
|
846
|
|
|
result.GlobalSecondaryIndexes = newReplicaGlobalSecondaryIndexDescriptions(o.GlobalSecondaryIndexes) |
847
|
|
|
if v := o.ProvisionedThroughputOverride; v != nil { |
848
|
|
|
if v.ReadCapacityUnits != nil { |
849
|
|
|
result.ProvisionedThroughputOverrideRCU = *v.ReadCapacityUnits |
850
|
|
|
} |
851
|
|
|
} |
852
|
|
|
return result |
853
|
|
|
} |
854
|
|
|
|
855
|
|
|
type ReplicaGlobalSecondaryIndexDescription struct { |
|
|
|
|
856
|
|
|
IndexName string |
857
|
|
|
ProvisionedThroughputOverrideRCU int64 |
858
|
|
|
} |
859
|
|
|
|
860
|
|
|
func newReplicaGlobalSecondaryIndexDescriptions(list []SDK.ReplicaGlobalSecondaryIndexDescription) []ReplicaGlobalSecondaryIndexDescription { |
861
|
|
|
if len(list) == 0 { |
862
|
|
|
return nil |
863
|
|
|
} |
864
|
|
|
|
865
|
|
|
result := make([]ReplicaGlobalSecondaryIndexDescription, len(list)) |
866
|
|
|
for i, v := range list { |
867
|
|
|
result[i] = newReplicaGlobalSecondaryIndexDescription(v) |
868
|
|
|
} |
869
|
|
|
return result |
870
|
|
|
} |
871
|
|
|
|
872
|
|
|
func newReplicaGlobalSecondaryIndexDescription(o SDK.ReplicaGlobalSecondaryIndexDescription) ReplicaGlobalSecondaryIndexDescription { |
873
|
|
|
result := ReplicaGlobalSecondaryIndexDescription{} |
874
|
|
|
|
875
|
|
|
if o.IndexName != nil { |
876
|
|
|
result.IndexName = *o.IndexName |
877
|
|
|
} |
878
|
|
|
if v := o.ProvisionedThroughputOverride; v != nil { |
879
|
|
|
if v.ReadCapacityUnits != nil { |
880
|
|
|
result.ProvisionedThroughputOverrideRCU = *v.ReadCapacityUnits |
881
|
|
|
} |
882
|
|
|
} |
883
|
|
|
return result |
884
|
|
|
} |
885
|
|
|
|
886
|
|
|
type RestoreSummary struct { |
|
|
|
|
887
|
|
|
RestoreDateTime time.Time |
888
|
|
|
RestoreInProgress bool |
889
|
|
|
|
890
|
|
|
// optional |
891
|
|
|
SourceBackupARN string |
892
|
|
|
SourceTableARN string |
893
|
|
|
} |
894
|
|
|
|
895
|
|
|
func newRestoreSummary(o *SDK.RestoreSummary) RestoreSummary { |
896
|
|
|
result := RestoreSummary{} |
897
|
|
|
if o == nil { |
898
|
|
|
return result |
899
|
|
|
} |
900
|
|
|
|
901
|
|
|
if o.RestoreDateTime != nil { |
902
|
|
|
result.RestoreDateTime = *o.RestoreDateTime |
903
|
|
|
} |
904
|
|
|
if o.RestoreInProgress != nil { |
905
|
|
|
result.RestoreInProgress = *o.RestoreInProgress |
906
|
|
|
} |
907
|
|
|
if o.SourceBackupArn != nil { |
908
|
|
|
result.SourceBackupARN = *o.SourceBackupArn |
909
|
|
|
} |
910
|
|
|
if o.SourceTableArn != nil { |
911
|
|
|
result.SourceTableARN = *o.SourceTableArn |
912
|
|
|
} |
913
|
|
|
return result |
914
|
|
|
} |
915
|
|
|
|
916
|
|
|
type SSEDescription struct { |
|
|
|
|
917
|
|
|
InaccessibleEncryptionDateTime time.Time |
918
|
|
|
KMSMasterKeyArn string |
919
|
|
|
SSEType SSEType |
920
|
|
|
Status SSEStatus |
921
|
|
|
} |
922
|
|
|
|
923
|
|
|
func newSSEDescription(o *SDK.SSEDescription) SSEDescription { |
924
|
|
|
result := SSEDescription{} |
925
|
|
|
if o == nil { |
926
|
|
|
return result |
927
|
|
|
} |
928
|
|
|
|
929
|
|
|
if o.InaccessibleEncryptionDateTime != nil { |
930
|
|
|
result.InaccessibleEncryptionDateTime = *o.InaccessibleEncryptionDateTime |
931
|
|
|
} |
932
|
|
|
if o.KMSMasterKeyArn != nil { |
933
|
|
|
result.KMSMasterKeyArn = *o.KMSMasterKeyArn |
934
|
|
|
} |
935
|
|
|
result.SSEType = SSEType(o.SSEType) |
936
|
|
|
result.Status = SSEStatus(o.Status) |
937
|
|
|
return result |
938
|
|
|
} |
939
|
|
|
|
940
|
|
|
type SSESpecification struct { |
|
|
|
|
941
|
|
|
Enabled bool |
942
|
|
|
KMSMasterKeyID string |
943
|
|
|
SSEType SSEType |
944
|
|
|
} |
945
|
|
|
|
946
|
|
|
func newSSESpecification(o *SDK.SSESpecification) SSESpecification { |
947
|
|
|
result := SSESpecification{} |
948
|
|
|
if o == nil { |
949
|
|
|
return result |
950
|
|
|
} |
951
|
|
|
|
952
|
|
|
if o.Enabled != nil { |
953
|
|
|
result.Enabled = *o.Enabled |
954
|
|
|
} |
955
|
|
|
if o.KMSMasterKeyId != nil { |
956
|
|
|
result.KMSMasterKeyID = *o.KMSMasterKeyId |
957
|
|
|
} |
958
|
|
|
|
959
|
|
|
result.SSEType = SSEType(o.SSEType) |
960
|
|
|
return result |
961
|
|
|
} |
962
|
|
|
|
963
|
|
|
func (r SSESpecification) ToSDK() SDK.SSESpecification { |
|
|
|
|
964
|
|
|
o := SDK.SSESpecification{} |
965
|
|
|
|
966
|
|
|
if r.Enabled { |
967
|
|
|
o.Enabled = pointers.Bool(r.Enabled) |
968
|
|
|
} |
969
|
|
|
if r.KMSMasterKeyID != "" { |
970
|
|
|
o.KMSMasterKeyId = pointers.String(r.KMSMasterKeyID) |
971
|
|
|
} |
972
|
|
|
o.SSEType = SDK.SSEType(r.SSEType) |
973
|
|
|
return o |
974
|
|
|
} |
975
|
|
|
|
976
|
|
|
func (r SSESpecification) hasValue() bool { |
977
|
|
|
switch { |
978
|
|
|
case r.Enabled, |
979
|
|
|
r.KMSMasterKeyID != "", |
980
|
|
|
r.SSEType != "": |
981
|
|
|
return true |
982
|
|
|
} |
983
|
|
|
return false |
984
|
|
|
} |
985
|
|
|
|
986
|
|
|
type StreamSpecification struct { |
|
|
|
|
987
|
|
|
StreamEnabled bool |
988
|
|
|
|
989
|
|
|
// optional |
990
|
|
|
StreamViewType StreamViewType |
991
|
|
|
} |
992
|
|
|
|
993
|
|
|
func newStreamSpecification(o *SDK.StreamSpecification) StreamSpecification { |
994
|
|
|
result := StreamSpecification{} |
995
|
|
|
if o == nil { |
996
|
|
|
return result |
997
|
|
|
} |
998
|
|
|
|
999
|
|
|
if o.StreamEnabled != nil { |
1000
|
|
|
result.StreamEnabled = *o.StreamEnabled |
1001
|
|
|
} |
1002
|
|
|
result.StreamViewType = StreamViewType(o.StreamViewType) |
1003
|
|
|
return result |
1004
|
|
|
} |
1005
|
|
|
|
1006
|
|
|
func (r StreamSpecification) ToSDK() SDK.StreamSpecification { |
|
|
|
|
1007
|
|
|
o := SDK.StreamSpecification{} |
1008
|
|
|
|
1009
|
|
|
if r.StreamEnabled { |
1010
|
|
|
o.StreamEnabled = pointers.Bool(r.StreamEnabled) |
1011
|
|
|
} |
1012
|
|
|
|
1013
|
|
|
o.StreamViewType = SDK.StreamViewType(r.StreamViewType) |
1014
|
|
|
return o |
1015
|
|
|
} |
1016
|
|
|
|
1017
|
|
|
func (r StreamSpecification) hasValue() bool { |
1018
|
|
|
switch { |
1019
|
|
|
case r.StreamEnabled, |
1020
|
|
|
r.StreamViewType != "": |
1021
|
|
|
return true |
1022
|
|
|
} |
1023
|
|
|
return false |
1024
|
|
|
} |
1025
|
|
|
|
1026
|
|
|
type TableDescription struct { |
|
|
|
|
1027
|
|
|
ArchivalSummary ArchivalSummary |
1028
|
|
|
AttributeDefinitions []AttributeDefinition |
1029
|
|
|
BillingModeSummary BillingModeSummary |
1030
|
|
|
CreationDateTime time.Time |
1031
|
|
|
GlobalSecondaryIndexes []GlobalSecondaryIndexDescription |
1032
|
|
|
GlobalTableVersion string |
1033
|
|
|
ItemCount int64 |
1034
|
|
|
KeySchema []KeySchemaElement |
1035
|
|
|
LatestStreamARN string |
1036
|
|
|
LatestStreamLabel string |
1037
|
|
|
LocalSecondaryIndexes []LocalSecondaryIndexDescription |
1038
|
|
|
ProvisionedThroughput ProvisionedThroughputDescription |
1039
|
|
|
Replicas []ReplicaDescription |
1040
|
|
|
RestoreSummary RestoreSummary |
1041
|
|
|
SSEDescription SSEDescription |
1042
|
|
|
StreamSpecification StreamSpecification |
1043
|
|
|
TableARN string |
1044
|
|
|
TableID string |
1045
|
|
|
TableName string |
1046
|
|
|
TableSizeBytes int64 |
1047
|
|
|
TableStatus TableStatus |
1048
|
|
|
} |
1049
|
|
|
|
1050
|
|
|
func newTableDescription(o SDK.TableDescription) TableDescription { |
1051
|
|
|
result := TableDescription{} |
1052
|
|
|
|
1053
|
|
|
if o.CreationDateTime != nil { |
1054
|
|
|
result.CreationDateTime = *o.CreationDateTime |
1055
|
|
|
} |
1056
|
|
|
if o.GlobalTableVersion != nil { |
1057
|
|
|
result.GlobalTableVersion = *o.GlobalTableVersion |
1058
|
|
|
} |
1059
|
|
|
if o.ItemCount != nil { |
1060
|
|
|
result.ItemCount = *o.ItemCount |
1061
|
|
|
} |
1062
|
|
|
if o.LatestStreamArn != nil { |
1063
|
|
|
result.LatestStreamARN = *o.LatestStreamArn |
1064
|
|
|
} |
1065
|
|
|
if o.LatestStreamLabel != nil { |
1066
|
|
|
result.LatestStreamLabel = *o.LatestStreamLabel |
1067
|
|
|
} |
1068
|
|
|
if o.TableArn != nil { |
1069
|
|
|
result.TableARN = *o.TableArn |
1070
|
|
|
} |
1071
|
|
|
if o.TableId != nil { |
1072
|
|
|
result.TableID = *o.TableId |
1073
|
|
|
} |
1074
|
|
|
if o.TableName != nil { |
1075
|
|
|
result.TableName = *o.TableName |
1076
|
|
|
} |
1077
|
|
|
if o.TableSizeBytes != nil { |
1078
|
|
|
result.TableSizeBytes = *o.TableSizeBytes |
1079
|
|
|
} |
1080
|
|
|
|
1081
|
|
|
result.TableStatus = TableStatus(o.TableStatus) |
1082
|
|
|
|
1083
|
|
|
result.ArchivalSummary = newArchivalSummary(o.ArchivalSummary) |
1084
|
|
|
result.BillingModeSummary = newBillingModeSummary(o.BillingModeSummary) |
1085
|
|
|
result.ProvisionedThroughput = newProvisionedThroughputDescription(o.ProvisionedThroughput) |
1086
|
|
|
result.RestoreSummary = newRestoreSummary(o.RestoreSummary) |
1087
|
|
|
result.SSEDescription = newSSEDescription(o.SSEDescription) |
1088
|
|
|
result.StreamSpecification = newStreamSpecification(o.StreamSpecification) |
1089
|
|
|
|
1090
|
|
|
result.AttributeDefinitions = newAttributeDefinitions(o.AttributeDefinitions) |
1091
|
|
|
result.GlobalSecondaryIndexes = newGlobalSecondaryIndexDescriptions(o.GlobalSecondaryIndexes) |
1092
|
|
|
result.LocalSecondaryIndexes = newLocalSecondaryIndexDescriptions(o.LocalSecondaryIndexes) |
1093
|
|
|
result.KeySchema = newKeySchemaElements(o.KeySchema) |
1094
|
|
|
result.Replicas = newReplicaDescriptions(o.Replicas) |
1095
|
|
|
return result |
1096
|
|
|
} |
1097
|
|
|
|
1098
|
|
|
type Tag struct { |
|
|
|
|
1099
|
|
|
Key string |
1100
|
|
|
Value string |
1101
|
|
|
} |
1102
|
|
|
|
1103
|
|
|
func newTags(list []SDK.Tag) []Tag { |
1104
|
|
|
if len(list) == 0 { |
1105
|
|
|
return nil |
1106
|
|
|
} |
1107
|
|
|
|
1108
|
|
|
result := make([]Tag, len(list)) |
1109
|
|
|
for i, v := range list { |
1110
|
|
|
result[i] = newTag(v) |
1111
|
|
|
} |
1112
|
|
|
return result |
1113
|
|
|
} |
1114
|
|
|
|
1115
|
|
|
func newTag(o SDK.Tag) Tag { |
1116
|
|
|
result := Tag{} |
1117
|
|
|
|
1118
|
|
|
if o.Key != nil { |
1119
|
|
|
result.Key = *o.Key |
1120
|
|
|
} |
1121
|
|
|
if o.Value != nil { |
1122
|
|
|
result.Value = *o.Value |
1123
|
|
|
} |
1124
|
|
|
return result |
1125
|
|
|
} |
1126
|
|
|
|
1127
|
|
|
func (r Tag) ToSDK() SDK.Tag { |
|
|
|
|
1128
|
|
|
o := SDK.Tag{} |
1129
|
|
|
|
1130
|
|
|
if r.Key != "" { |
1131
|
|
|
o.Key = pointers.String(r.Key) |
1132
|
|
|
} |
1133
|
|
|
if r.Value != "" { |
1134
|
|
|
o.Value = pointers.String(r.Value) |
1135
|
|
|
} |
1136
|
|
|
return o |
1137
|
|
|
} |
1138
|
|
|
|
1139
|
|
|
type WriteRequest struct { |
|
|
|
|
1140
|
|
|
DeleteKeys map[string]AttributeValue |
1141
|
|
|
PutItems map[string]AttributeValue |
1142
|
|
|
} |
1143
|
|
|
|
1144
|
|
|
func newWriteRequest(o SDK.WriteRequest) WriteRequest { |
1145
|
|
|
result := WriteRequest{ |
1146
|
|
|
DeleteKeys: make(map[string]AttributeValue), |
1147
|
|
|
PutItems: make(map[string]AttributeValue), |
1148
|
|
|
} |
1149
|
|
|
|
1150
|
|
|
if o.DeleteRequest != nil { |
1151
|
|
|
m := make(map[string]AttributeValue, len(o.DeleteRequest.Key)) |
1152
|
|
|
for key, val := range o.DeleteRequest.Key { |
1153
|
|
|
m[key] = newAttributeValue(val) |
1154
|
|
|
} |
1155
|
|
|
result.DeleteKeys = m |
1156
|
|
|
} |
1157
|
|
|
|
1158
|
|
|
if o.PutRequest != nil { |
1159
|
|
|
m := make(map[string]AttributeValue, len(o.PutRequest.Item)) |
1160
|
|
|
for key, val := range o.PutRequest.Item { |
1161
|
|
|
m[key] = newAttributeValue(val) |
1162
|
|
|
} |
1163
|
|
|
result.DeleteKeys = m |
1164
|
|
|
} |
1165
|
|
|
|
1166
|
|
|
return result |
1167
|
|
|
} |
1168
|
|
|
|
1169
|
|
|
func (r WriteRequest) ToSDK() SDK.WriteRequest { |
|
|
|
|
1170
|
|
|
o := SDK.WriteRequest{} |
1171
|
|
|
|
1172
|
|
|
if len(r.DeleteKeys) != 0 { |
1173
|
|
|
m := make(map[string]SDK.AttributeValue, len(r.DeleteKeys)) |
1174
|
|
|
for key, val := range r.DeleteKeys { |
1175
|
|
|
m[key] = val.ToSDK() |
1176
|
|
|
} |
1177
|
|
|
o.DeleteRequest = &SDK.DeleteRequest{ |
1178
|
|
|
Key: m, |
1179
|
|
|
} |
1180
|
|
|
} |
1181
|
|
|
|
1182
|
|
|
if len(r.PutItems) != 0 { |
1183
|
|
|
m := make(map[string]SDK.AttributeValue, len(r.PutItems)) |
1184
|
|
|
for key, val := range r.PutItems { |
1185
|
|
|
m[key] = val.ToSDK() |
1186
|
|
|
} |
1187
|
|
|
o.PutRequest = &SDK.PutRequest{ |
1188
|
|
|
Item: m, |
1189
|
|
|
} |
1190
|
|
|
} |
1191
|
|
|
|
1192
|
|
|
return o |
1193
|
|
|
} |
1194
|
|
|
|