@@ -87,31 +87,48 @@ private function populateResultBatchWriteItemRequestMap(array $json): array
8787 return $ items ;
8888 }
8989
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+
90112 /**
91113 * @return ConsumedCapacity[]
92114 */
93115 private function populateResultConsumedCapacityMultiple (array $ json ): array
94116 {
95117 $ items = [];
96118 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 );
110120 }
111121
112122 return $ items ;
113123 }
114124
125+ private function populateResultDeleteRequest (array $ json ): DeleteRequest
126+ {
127+ return new DeleteRequest ([
128+ 'Key ' => $ this ->populateResultKey ($ json ['Key ' ]),
129+ ]);
130+ }
131+
115132 /**
116133 * @return array<string, AttributeValue>
117134 */
@@ -125,17 +142,22 @@ private function populateResultItemCollectionKeyAttributeMap(array $json): array
125142 return $ items ;
126143 }
127144
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+
128153 /**
129154 * @return ItemCollectionMetrics[]
130155 */
131156 private function populateResultItemCollectionMetricsMultiple (array $ json ): array
132157 {
133158 $ items = [];
134159 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 );
139161 }
140162
141163 return $ items ;
@@ -196,6 +218,13 @@ private function populateResultPutItemInputAttributeMap(array $json): array
196218 return $ items ;
197219 }
198220
221+ private function populateResultPutRequest (array $ json ): PutRequest
222+ {
223+ return new PutRequest ([
224+ 'Item ' => $ this ->populateResultPutItemInputAttributeMap ($ json ['Item ' ]),
225+ ]);
226+ }
227+
199228 /**
200229 * @return array<string, Capacity>
201230 */
@@ -209,21 +238,22 @@ private function populateResultSecondaryIndexesCapacityMap(array $json): array
209238 return $ items ;
210239 }
211240
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+
212249 /**
213250 * @return WriteRequest[]
214251 */
215252 private function populateResultWriteRequests (array $ json ): array
216253 {
217254 $ items = [];
218255 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 );
227257 }
228258
229259 return $ items ;
0 commit comments