@@ -87,31 +87,48 @@ private function populateResultBatchWriteItemRequestMap(array $json): array
87
87
return $ items ;
88
88
}
89
89
90
+ private function populateResultCapacity (array $ json ): Capacity
91
+ {
92
+ return new Capacity ([
93
+ 'ReadCapacityUnits ' => isset ($ json ['ReadCapacityUnits ' ]) ? (float ) $ json ['ReadCapacityUnits ' ] : null ,
94
+ 'WriteCapacityUnits ' => isset ($ json ['WriteCapacityUnits ' ]) ? (float ) $ json ['WriteCapacityUnits ' ] : null ,
95
+ 'CapacityUnits ' => isset ($ json ['CapacityUnits ' ]) ? (float ) $ json ['CapacityUnits ' ] : null ,
96
+ ]);
97
+ }
98
+
99
+ private function populateResultConsumedCapacity (array $ json ): ConsumedCapacity
100
+ {
101
+ return new ConsumedCapacity ([
102
+ 'TableName ' => isset ($ json ['TableName ' ]) ? (string ) $ json ['TableName ' ] : null ,
103
+ 'CapacityUnits ' => isset ($ json ['CapacityUnits ' ]) ? (float ) $ json ['CapacityUnits ' ] : null ,
104
+ 'ReadCapacityUnits ' => isset ($ json ['ReadCapacityUnits ' ]) ? (float ) $ json ['ReadCapacityUnits ' ] : null ,
105
+ 'WriteCapacityUnits ' => isset ($ json ['WriteCapacityUnits ' ]) ? (float ) $ json ['WriteCapacityUnits ' ] : null ,
106
+ 'Table ' => empty ($ json ['Table ' ]) ? null : $ this ->populateResultCapacity ($ json ['Table ' ]),
107
+ 'LocalSecondaryIndexes ' => !isset ($ json ['LocalSecondaryIndexes ' ]) ? null : $ this ->populateResultSecondaryIndexesCapacityMap ($ json ['LocalSecondaryIndexes ' ]),
108
+ 'GlobalSecondaryIndexes ' => !isset ($ json ['GlobalSecondaryIndexes ' ]) ? null : $ this ->populateResultSecondaryIndexesCapacityMap ($ json ['GlobalSecondaryIndexes ' ]),
109
+ ]);
110
+ }
111
+
90
112
/**
91
113
* @return ConsumedCapacity[]
92
114
*/
93
115
private function populateResultConsumedCapacityMultiple (array $ json ): array
94
116
{
95
117
$ items = [];
96
118
foreach ($ json as $ item ) {
97
- $ items [] = new ConsumedCapacity ([
98
- 'TableName ' => isset ($ item ['TableName ' ]) ? (string ) $ item ['TableName ' ] : null ,
99
- 'CapacityUnits ' => isset ($ item ['CapacityUnits ' ]) ? (float ) $ item ['CapacityUnits ' ] : null ,
100
- 'ReadCapacityUnits ' => isset ($ item ['ReadCapacityUnits ' ]) ? (float ) $ item ['ReadCapacityUnits ' ] : null ,
101
- 'WriteCapacityUnits ' => isset ($ item ['WriteCapacityUnits ' ]) ? (float ) $ item ['WriteCapacityUnits ' ] : null ,
102
- 'Table ' => empty ($ item ['Table ' ]) ? null : new Capacity ([
103
- 'ReadCapacityUnits ' => isset ($ item ['Table ' ]['ReadCapacityUnits ' ]) ? (float ) $ item ['Table ' ]['ReadCapacityUnits ' ] : null ,
104
- 'WriteCapacityUnits ' => isset ($ item ['Table ' ]['WriteCapacityUnits ' ]) ? (float ) $ item ['Table ' ]['WriteCapacityUnits ' ] : null ,
105
- 'CapacityUnits ' => isset ($ item ['Table ' ]['CapacityUnits ' ]) ? (float ) $ item ['Table ' ]['CapacityUnits ' ] : null ,
106
- ]),
107
- 'LocalSecondaryIndexes ' => !isset ($ item ['LocalSecondaryIndexes ' ]) ? null : $ this ->populateResultSecondaryIndexesCapacityMap ($ item ['LocalSecondaryIndexes ' ]),
108
- 'GlobalSecondaryIndexes ' => !isset ($ item ['GlobalSecondaryIndexes ' ]) ? null : $ this ->populateResultSecondaryIndexesCapacityMap ($ item ['GlobalSecondaryIndexes ' ]),
109
- ]);
119
+ $ items [] = $ this ->populateResultConsumedCapacity ($ item );
110
120
}
111
121
112
122
return $ items ;
113
123
}
114
124
125
+ private function populateResultDeleteRequest (array $ json ): DeleteRequest
126
+ {
127
+ return new DeleteRequest ([
128
+ 'Key ' => $ this ->populateResultKey ($ json ['Key ' ]),
129
+ ]);
130
+ }
131
+
115
132
/**
116
133
* @return array<string, AttributeValue>
117
134
*/
@@ -125,17 +142,22 @@ private function populateResultItemCollectionKeyAttributeMap(array $json): array
125
142
return $ items ;
126
143
}
127
144
145
+ private function populateResultItemCollectionMetrics (array $ json ): ItemCollectionMetrics
146
+ {
147
+ return new ItemCollectionMetrics ([
148
+ 'ItemCollectionKey ' => !isset ($ json ['ItemCollectionKey ' ]) ? null : $ this ->populateResultItemCollectionKeyAttributeMap ($ json ['ItemCollectionKey ' ]),
149
+ 'SizeEstimateRangeGB ' => !isset ($ json ['SizeEstimateRangeGB ' ]) ? null : $ this ->populateResultItemCollectionSizeEstimateRange ($ json ['SizeEstimateRangeGB ' ]),
150
+ ]);
151
+ }
152
+
128
153
/**
129
154
* @return ItemCollectionMetrics[]
130
155
*/
131
156
private function populateResultItemCollectionMetricsMultiple (array $ json ): array
132
157
{
133
158
$ items = [];
134
159
foreach ($ json as $ item ) {
135
- $ items [] = new ItemCollectionMetrics ([
136
- 'ItemCollectionKey ' => !isset ($ item ['ItemCollectionKey ' ]) ? null : $ this ->populateResultItemCollectionKeyAttributeMap ($ item ['ItemCollectionKey ' ]),
137
- 'SizeEstimateRangeGB ' => !isset ($ item ['SizeEstimateRangeGB ' ]) ? null : $ this ->populateResultItemCollectionSizeEstimateRange ($ item ['SizeEstimateRangeGB ' ]),
138
- ]);
160
+ $ items [] = $ this ->populateResultItemCollectionMetrics ($ item );
139
161
}
140
162
141
163
return $ items ;
@@ -196,6 +218,13 @@ private function populateResultPutItemInputAttributeMap(array $json): array
196
218
return $ items ;
197
219
}
198
220
221
+ private function populateResultPutRequest (array $ json ): PutRequest
222
+ {
223
+ return new PutRequest ([
224
+ 'Item ' => $ this ->populateResultPutItemInputAttributeMap ($ json ['Item ' ]),
225
+ ]);
226
+ }
227
+
199
228
/**
200
229
* @return array<string, Capacity>
201
230
*/
@@ -209,21 +238,22 @@ private function populateResultSecondaryIndexesCapacityMap(array $json): array
209
238
return $ items ;
210
239
}
211
240
241
+ private function populateResultWriteRequest (array $ json ): WriteRequest
242
+ {
243
+ return new WriteRequest ([
244
+ 'PutRequest ' => empty ($ json ['PutRequest ' ]) ? null : $ this ->populateResultPutRequest ($ json ['PutRequest ' ]),
245
+ 'DeleteRequest ' => empty ($ json ['DeleteRequest ' ]) ? null : $ this ->populateResultDeleteRequest ($ json ['DeleteRequest ' ]),
246
+ ]);
247
+ }
248
+
212
249
/**
213
250
* @return WriteRequest[]
214
251
*/
215
252
private function populateResultWriteRequests (array $ json ): array
216
253
{
217
254
$ items = [];
218
255
foreach ($ json as $ item ) {
219
- $ items [] = new WriteRequest ([
220
- 'PutRequest ' => empty ($ item ['PutRequest ' ]) ? null : new PutRequest ([
221
- 'Item ' => $ this ->populateResultPutItemInputAttributeMap ($ item ['PutRequest ' ]['Item ' ]),
222
- ]),
223
- 'DeleteRequest ' => empty ($ item ['DeleteRequest ' ]) ? null : new DeleteRequest ([
224
- 'Key ' => $ this ->populateResultKey ($ item ['DeleteRequest ' ]['Key ' ]),
225
- ]),
226
- ]);
256
+ $ items [] = $ this ->populateResultWriteRequest ($ item );
227
257
}
228
258
229
259
return $ items ;
0 commit comments