-
Notifications
You must be signed in to change notification settings - Fork 23
/
Copy pathtype.go
816 lines (728 loc) · 18.8 KB
/
type.go
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
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
package dynamodb
import (
"strconv"
"time"
SDK "github.com/aws/aws-sdk-go/service/dynamodb"
"github.com/evalphobia/aws-sdk-go-wrapper/private/pointers"
)
// BillingModeSummary contains the details for the read/write capacity mode.
type BillingModeSummary struct {
BillingMode string
LastUpdateToPayPerRequest time.Time
}
// NewBillingModeSummary creates BillingModeSummary from SDK's output.
func NewBillingModeSummary(out *SDK.BillingModeSummary) BillingModeSummary {
v := BillingModeSummary{}
if out == nil {
return v
}
if out.BillingMode != nil {
v.BillingMode = *out.BillingMode
}
if out.LastUpdateToPayPerRequestDateTime != nil {
v.LastUpdateToPayPerRequest = *out.LastUpdateToPayPerRequestDateTime
}
return v
}
// IsEmpty checks if the data is empty or not.
func (s BillingModeSummary) IsEmpty() bool {
switch {
case s.BillingMode != "",
!s.LastUpdateToPayPerRequest.IsZero():
return false
}
return true
}
// GSIDescription contains the properties of a global secondary index.
type GSIDescription struct {
Backfilling bool
IndexARN string
IndexName string
IndexSizeBytes int64
IndexStatus string
ItemCount int64
KeySchema []KeySchemaElement
Projection Projection
ProvisionedThroughput ProvisionedThroughputDescription
}
// NewGSIDescription creates GSIDescription from SDK's output.
func NewGSIDescription(out *SDK.GlobalSecondaryIndexDescription) GSIDescription {
v := GSIDescription{}
if out == nil {
return v
}
if out.Backfilling != nil {
v.Backfilling = *out.Backfilling
}
if out.IndexArn != nil {
v.IndexARN = *out.IndexArn
}
if out.IndexName != nil {
v.IndexName = *out.IndexName
}
if out.IndexSizeBytes != nil {
v.IndexSizeBytes = *out.IndexSizeBytes
}
if out.IndexStatus != nil {
v.IndexStatus = *out.IndexStatus
}
if out.ItemCount != nil {
v.ItemCount = *out.ItemCount
}
v.KeySchema = NewKeySchemaElementList(out.KeySchema)
v.Projection = NewProjection(out.Projection)
v.ProvisionedThroughput = NewProvisionedThroughputDescription(out.ProvisionedThroughput)
return v
}
// IsEmpty checks if the data is empty or not.
func (d GSIDescription) IsEmpty() bool {
switch {
case d.IndexARN != "",
d.IndexName != "",
d.IndexStatus != "",
d.IndexSizeBytes != 0,
d.ItemCount != 0:
return false
}
return true
}
// ToGSI converts to SDK's type.
func (d GSIDescription) ToGSI() *SDK.GlobalSecondaryIndex {
if d.IsEmpty() {
return nil
}
gsi := &SDK.GlobalSecondaryIndex{
IndexName: pointers.String(d.IndexName),
ProvisionedThroughput: d.ProvisionedThroughput.ToProvisionedThroughput(),
Projection: d.Projection.ToSDKType(),
}
if len(d.KeySchema) != 0 {
data := make([]*SDK.KeySchemaElement, 0, len(d.KeySchema))
for _, s := range d.KeySchema {
if !s.IsEmpty() {
data = append(data, s.ToSDKType())
}
}
gsi.KeySchema = data
}
return gsi
}
// NewGSIDescriptionList creates the list of GSIDescription from SDK's output.
func NewGSIDescriptionList(list []*SDK.GlobalSecondaryIndexDescription) []GSIDescription {
if len(list) == 0 {
return nil
}
result := make([]GSIDescription, len(list))
for i, out := range list {
result[i] = NewGSIDescription(out)
}
return result
}
// KeySchemaElement represents a single element of a key schema.
type KeySchemaElement struct {
AttributeName string
KeyType string
}
// NewKeySchemaElement creates KeySchemaElement from SDK's output.
func NewKeySchemaElement(out *SDK.KeySchemaElement) KeySchemaElement {
v := KeySchemaElement{}
if out == nil {
return v
}
if out.AttributeName != nil {
v.AttributeName = *out.AttributeName
}
if out.KeyType != nil {
v.KeyType = *out.KeyType
}
return v
}
// IsEmpty checks if the data is empty or not.
func (k KeySchemaElement) IsEmpty() bool {
switch {
case k.AttributeName != "",
k.KeyType != "":
return false
}
return true
}
// ToSDKType converts to SDK's type.
func (k KeySchemaElement) ToSDKType() *SDK.KeySchemaElement {
if k.IsEmpty() {
return nil
}
return &SDK.KeySchemaElement{
AttributeName: pointers.String(k.AttributeName),
KeyType: pointers.String(k.KeyType),
}
}
// NewKeySchemaElementList creates the list of KeySchemaElement from SDK's output.
func NewKeySchemaElementList(list []*SDK.KeySchemaElement) []KeySchemaElement {
if len(list) == 0 {
return nil
}
result := make([]KeySchemaElement, len(list))
for i, out := range list {
result[i] = NewKeySchemaElement(out)
}
return result
}
// LSIDescription represents the properties of a local secondary index.
type LSIDescription struct {
IndexARN string
IndexName string
IndexSizeBytes int64
ItemCount int64
KeySchema []KeySchemaElement
Projection Projection
}
// NewLSIDescription creates LSIDescription from SDK's output.
func NewLSIDescription(out *SDK.LocalSecondaryIndexDescription) LSIDescription {
v := LSIDescription{}
if out == nil {
return v
}
if out.IndexArn != nil {
v.IndexARN = *out.IndexArn
}
if out.IndexName != nil {
v.IndexName = *out.IndexName
}
if out.IndexSizeBytes != nil {
v.IndexSizeBytes = *out.IndexSizeBytes
}
if out.ItemCount != nil {
v.ItemCount = *out.ItemCount
}
v.KeySchema = NewKeySchemaElementList(out.KeySchema)
v.Projection = NewProjection(out.Projection)
return v
}
// IsEmpty checks if the data is empty or not.
func (d LSIDescription) IsEmpty() bool {
switch {
case d.IndexARN != "",
d.IndexName != "",
d.IndexSizeBytes != 0,
d.ItemCount != 0:
return false
}
return true
}
// ToLSI converts to SDK's type.
func (d LSIDescription) ToLSI() *SDK.LocalSecondaryIndex {
if d.IsEmpty() {
return nil
}
lsi := &SDK.LocalSecondaryIndex{
IndexName: pointers.String(d.IndexName),
Projection: d.Projection.ToSDKType(),
}
if len(d.KeySchema) != 0 {
data := make([]*SDK.KeySchemaElement, 0, len(d.KeySchema))
for _, s := range d.KeySchema {
if !s.IsEmpty() {
data = append(data, s.ToSDKType())
}
}
lsi.KeySchema = data
}
return lsi
}
// NewLSIDescriptionList creates the list of LSIDescription from SDK's output.
func NewLSIDescriptionList(list []*SDK.LocalSecondaryIndexDescription) []LSIDescription {
if len(list) == 0 {
return nil
}
result := make([]LSIDescription, len(list))
for i, out := range list {
result[i] = NewLSIDescription(out)
}
return result
}
// Projection represents attributes that are copied (projected) from the table into an index.
type Projection struct {
NonKeyAttributes []string
ProjectionType string
}
// NewProjection creates Projection from SDK's output.
func NewProjection(out *SDK.Projection) Projection {
v := Projection{}
if out == nil {
return v
}
if out.ProjectionType != nil {
v.ProjectionType = *out.ProjectionType
}
if len(out.NonKeyAttributes) != 0 {
data := make([]string, 0, len(out.NonKeyAttributes))
for _, val := range out.NonKeyAttributes {
if val != nil {
data = append(data, *val)
}
}
v.NonKeyAttributes = data
}
return v
}
// IsEmpty checks if the data is empty or not.
func (p Projection) IsEmpty() bool {
switch {
case p.ProjectionType != "",
len(p.NonKeyAttributes) != 0:
return false
}
return true
}
// ToSDKType converts to SDK's type.
func (p Projection) ToSDKType() *SDK.Projection {
if p.IsEmpty() {
return nil
}
pp := &SDK.Projection{
ProjectionType: pointers.String(p.ProjectionType),
}
if len(p.NonKeyAttributes) != 0 {
data := make([]*string, 0, len(p.NonKeyAttributes))
for _, v := range p.NonKeyAttributes {
data = append(data, pointers.String(v))
}
pp.NonKeyAttributes = data
}
return pp
}
// ProvisionedThroughputDescription represents the provisioned throughput settings for the table.
type ProvisionedThroughputDescription struct {
LastDecreaseDateTime time.Time
LastIncreaseDateTime time.Time
NumberOfDecreasesToday int64
ReadCapacityUnits int64
WriteCapacityUnits int64
}
// NewProvisionedThroughputDescription creates ProvisionedThroughputDescription from SDK's output.
func NewProvisionedThroughputDescription(out *SDK.ProvisionedThroughputDescription) ProvisionedThroughputDescription {
v := ProvisionedThroughputDescription{}
if out == nil {
return v
}
if out.LastDecreaseDateTime != nil {
v.LastDecreaseDateTime = *out.LastDecreaseDateTime
}
if out.LastIncreaseDateTime != nil {
v.LastIncreaseDateTime = *out.LastIncreaseDateTime
}
if out.NumberOfDecreasesToday != nil {
v.NumberOfDecreasesToday = *out.NumberOfDecreasesToday
}
if out.ReadCapacityUnits != nil {
v.ReadCapacityUnits = *out.ReadCapacityUnits
}
if out.WriteCapacityUnits != nil {
v.WriteCapacityUnits = *out.WriteCapacityUnits
}
return v
}
// IsEmpty checks if the data is empty or not.
func (p ProvisionedThroughputDescription) IsEmpty() bool {
switch {
case p.NumberOfDecreasesToday != 0,
p.ReadCapacityUnits != 0,
p.WriteCapacityUnits != 0,
!p.LastDecreaseDateTime.IsZero(),
!p.LastIncreaseDateTime.IsZero():
return false
}
return true
}
// ToProvisionedThroughput converts to SDK's type.
func (p ProvisionedThroughputDescription) ToProvisionedThroughput() *SDK.ProvisionedThroughput {
if p.IsEmpty() {
return nil
}
return &SDK.ProvisionedThroughput{
ReadCapacityUnits: pointers.Long64(p.ReadCapacityUnits),
WriteCapacityUnits: pointers.Long64(p.WriteCapacityUnits),
}
}
// RestoreSummary contains details for the restore.
type RestoreSummary struct {
RestoreDateTime time.Time
RestoreInProgress bool
SourceBackupARN string
SourceTableARN string
}
// NewRestoreSummary creates RestoreSummary from SDK's output.
func NewRestoreSummary(out *SDK.RestoreSummary) RestoreSummary {
v := RestoreSummary{}
if out == nil {
return v
}
if out.RestoreDateTime != nil {
v.RestoreDateTime = *out.RestoreDateTime
}
if out.RestoreInProgress != nil {
v.RestoreInProgress = *out.RestoreInProgress
}
if out.SourceBackupArn != nil {
v.SourceBackupARN = *out.SourceBackupArn
}
if out.SourceTableArn != nil {
v.SourceTableARN = *out.SourceTableArn
}
return v
}
// IsEmpty checks if the data is empty or not.
func (s RestoreSummary) IsEmpty() bool {
switch {
case s.SourceBackupARN != "",
s.SourceTableARN != "":
return false
}
return true
}
// SSEDescription contains description of the server-side encryption status on the specified table.
type SSEDescription struct {
KMSMasterKeyARN string
SSEType string
Status string
}
// NewSSEDescription creates SSEDescription from SDK's output.
func NewSSEDescription(out *SDK.SSEDescription) SSEDescription {
v := SSEDescription{}
if out == nil {
return v
}
if out.KMSMasterKeyArn != nil {
v.KMSMasterKeyARN = *out.KMSMasterKeyArn
}
if out.SSEType != nil {
v.SSEType = *out.SSEType
}
if out.Status != nil {
v.Status = *out.Status
}
return v
}
// IsEmpty checks if the data is empty or not.
func (s SSEDescription) IsEmpty() bool {
switch {
case s.KMSMasterKeyARN != "",
s.SSEType != "",
s.Status != "":
return false
}
return true
}
// StreamSpecification represents the DynamoDB Streams configuration for a table in DynamoDB.
type StreamSpecification struct {
StreamEnabled bool
StreamViewType string
}
// NewStreamSpecification creates StreamSpecification from SDK's output.
func NewStreamSpecification(out *SDK.StreamSpecification) StreamSpecification {
v := StreamSpecification{}
if out == nil {
return v
}
if out.StreamEnabled != nil {
v.StreamEnabled = *out.StreamEnabled
}
if out.StreamViewType != nil {
v.StreamViewType = *out.StreamViewType
}
return v
}
// IsEmpty checks if the data is empty or not.
func (s StreamSpecification) IsEmpty() bool {
switch {
case s.StreamViewType != "":
return false
}
return true
}
type KeysAndAttributes struct {
AttributesToGet []string
ConsistentRead bool
ExpressionAttributeNames map[string]string
Keys []map[string]AttributeValue
ProjectionExpression string
}
func (r KeysAndAttributes) ToSDK() *SDK.KeysAndAttributes {
o := SDK.KeysAndAttributes{}
if len(r.Keys) != 0 {
list := make([]map[string]*SDK.AttributeValue, len(r.Keys))
for i, v := range r.Keys {
m := make(map[string]*SDK.AttributeValue, len(v))
for key, val := range v {
m[key] = val.ToSDK()
}
list[i] = m
}
o.Keys = list
}
if r.ConsistentRead {
o.ConsistentRead = pointers.Bool(r.ConsistentRead)
}
if r.ProjectionExpression != "" {
o.ProjectionExpression = pointers.String(r.ProjectionExpression)
}
if len(r.AttributesToGet) != 0 {
attrs := make([]*string, len(r.AttributesToGet))
for i, s := range r.AttributesToGet {
attrs[i] = pointers.String(s)
}
o.AttributesToGet = attrs
}
if len(r.ExpressionAttributeNames) != 0 {
names := make(map[string]*string, len(r.ExpressionAttributeNames))
for i, s := range r.ExpressionAttributeNames {
names[i] = pointers.String(s)
}
o.ExpressionAttributeNames = names
}
return &o
}
func newKeysAndAttributes(o *SDK.KeysAndAttributes) KeysAndAttributes {
result := KeysAndAttributes{}
if o == nil {
return result
}
if len(o.AttributesToGet) != 0 {
list := make([]string, len(o.AttributesToGet))
for i, s := range o.AttributesToGet {
list[i] = *s
}
result.AttributesToGet = list
}
if len(o.ExpressionAttributeNames) != 0 {
list := make(map[string]string, len(o.ExpressionAttributeNames))
for i, s := range o.ExpressionAttributeNames {
list[i] = *s
}
result.ExpressionAttributeNames = list
}
if o.ConsistentRead != nil {
result.ConsistentRead = *o.ConsistentRead
}
if o.ProjectionExpression != nil {
result.ProjectionExpression = *o.ProjectionExpression
}
if len(o.Keys) != 0 {
list := make([]map[string]AttributeValue, len(o.Keys))
for i, v := range o.Keys {
list[i] = newAttributeValueMap(v)
}
result.Keys = list
}
return result
}
type AttributeValue struct {
Binary []byte
BinarySet [][]byte
List []AttributeValue
Map map[string]AttributeValue
Number string
NumberInt int64
NumberFloat float64
NumberSet []string
NumberSetInt []int64
NumberSetFloat []float64
Null bool
String string
StringSet []string
Bool bool
HasBool bool
HasNumber bool
}
func newAttributeValueBySDK(o *SDK.AttributeValue) AttributeValue {
result := AttributeValue{}
if o == nil {
return result
}
switch {
case len(o.B) != 0:
result.Binary = o.B
case len(o.BS) != 0:
result.BinarySet = o.BS
case len(o.L) != 0:
result.List = newAttributeValueList(o.L)
case len(o.M) != 0:
result.Map = newAttributeValueMap(o.M)
case o.N != nil:
result.Number = *o.N
result.HasNumber = true
case len(o.NS) != 0:
list := make([]string, len(o.NS))
for i, n := range o.NS {
list[i] = *n
}
result.NumberSet = list
case o.NULL != nil:
result.Null = *o.NULL
case o.S != nil:
result.String = *o.S
case len(o.SS) != 0:
list := make([]string, len(o.SS))
for i, n := range o.SS {
list[i] = *n
}
result.StringSet = list
case o.BOOL != nil:
result.Bool = *o.BOOL
result.HasBool = true
}
return result
}
func (r AttributeValue) ToSDK() *SDK.AttributeValue {
o := SDK.AttributeValue{}
switch {
case len(r.Binary) != 0:
o.B = r.Binary
case len(r.BinarySet) != 0:
o.BS = r.BinarySet
case len(r.List) != 0:
list := make([]*SDK.AttributeValue, len(r.List))
for i, v := range r.List {
list[i] = v.ToSDK()
}
o.L = list
case len(r.Map) != 0:
m := make(map[string]*SDK.AttributeValue, len(r.Map))
for key, val := range r.Map {
m[key] = val.ToSDK()
}
o.M = m
case r.Number != "":
o.N = pointers.String(r.Number)
case r.NumberInt != 0:
o.N = pointers.String(strconv.FormatInt(r.NumberInt, 10))
case r.NumberFloat != 0:
o.N = pointers.String(strconv.FormatFloat(r.NumberFloat, 'f', -1, 64))
case r.HasNumber:
o.N = pointers.String("0")
case len(r.NumberSet) != 0:
list := make([]*string, len(r.NumberSet))
for i, s := range r.NumberSet {
list[i] = pointers.String(s)
}
o.NS = list
case len(r.NumberSetInt) != 0:
list := make([]*string, len(r.NumberSetInt))
for i, v := range r.NumberSetInt {
list[i] = pointers.String(strconv.FormatInt(v, 10))
}
o.NS = list
case len(r.NumberSetFloat) != 0:
list := make([]*string, len(r.NumberSetFloat))
for i, v := range r.NumberSetFloat {
list[i] = pointers.String(strconv.FormatFloat(v, 'f', -1, 64))
}
o.NS = list
case r.String != "":
o.S = pointers.String(r.String)
case len(r.StringSet) != 0:
list := make([]*string, len(r.StringSet))
for i, v := range r.StringSet {
list[i] = pointers.String(v)
}
o.SS = list
case r.HasBool,
r.Bool:
o.BOOL = pointers.Bool(r.Bool)
case r.Null:
o.NULL = pointers.Bool(r.Null)
}
return &o
}
func newAttributeValueList(list []*SDK.AttributeValue) []AttributeValue {
if len(list) == 0 {
return nil
}
results := make([]AttributeValue, len(list))
for i, v := range list {
results[i] = newAttributeValueBySDK(v)
}
return results
}
func newAttributeValueMap(o map[string]*SDK.AttributeValue) map[string]AttributeValue {
if len(o) == 0 {
return nil
}
m := make(map[string]AttributeValue, len(o))
for key, val := range o {
m[key] = newAttributeValueBySDK(val)
}
return m
}
type ConsumedCapacity struct {
CapacityUnits float64
GlobalSecondaryIndexes map[string]Capacity
LocalSecondaryIndexes map[string]Capacity
ReadCapacityUnits float64
Table Capacity
TableName string
WriteCapacityUnits float64
}
func newConsumedCapacities(list []*SDK.ConsumedCapacity) []ConsumedCapacity {
if len(list) == 0 {
return nil
}
result := make([]ConsumedCapacity, len(list))
for i, v := range list {
result[i] = newConsumedCapacity(v)
}
return result
}
func newConsumedCapacity(o *SDK.ConsumedCapacity) ConsumedCapacity {
result := ConsumedCapacity{}
if o == nil {
return result
}
if o.CapacityUnits != nil {
result.CapacityUnits = *o.CapacityUnits
}
if o.ReadCapacityUnits != nil {
result.ReadCapacityUnits = *o.ReadCapacityUnits
}
if o.TableName != nil {
result.TableName = *o.TableName
}
if o.WriteCapacityUnits != nil {
result.WriteCapacityUnits = *o.WriteCapacityUnits
}
result.GlobalSecondaryIndexes = newCapacityMap(o.GlobalSecondaryIndexes)
result.LocalSecondaryIndexes = newCapacityMap(o.LocalSecondaryIndexes)
result.Table = newCapacity(o.Table)
return result
}
type Capacity struct {
CapacityUnits float64
ReadCapacityUnits float64
WriteCapacityUnits float64
}
func newCapacity(o *SDK.Capacity) Capacity {
result := Capacity{}
if o == nil {
return result
}
if o.CapacityUnits != nil {
result.CapacityUnits = *o.CapacityUnits
}
if o.ReadCapacityUnits != nil {
result.ReadCapacityUnits = *o.ReadCapacityUnits
}
if o.WriteCapacityUnits != nil {
result.WriteCapacityUnits = *o.WriteCapacityUnits
}
return result
}
func newCapacityMap(m map[string]*SDK.Capacity) map[string]Capacity {
if m == nil {
return nil
}
result := make(map[string]Capacity, len(m))
for key, val := range m {
result[key] = newCapacity(val)
}
return result
}