public function makeCollection($name, array $args, Resource $parent)
 {
     if (isset($args[0]) && is_array($args[0])) {
         $args = $args[0];
     }
     // Get the information on how to process the collection.
     $info = $this->model->search('collection', $parent->getType(), $name);
     // Create a paginator or an iterator that yields a single command's result.
     $command = $this->prepareCommand($info['request'], $parent, $args);
     if ($this->apiClient->getApi()->hasPaginator($command->getName())) {
         $paginator = $this->apiClient->getPaginator($command->getName(), $command->toArray());
     } else {
         $paginator = \Aws\map([$command], function (Command $command) {
             return $this->apiClient->execute($command);
         });
     }
     // Create a new from the paginator, including a lambda that coverts
     // results to batches by using info from the resources model.
     return new Collection($this, $parent->getType(), $paginator, function (Result $result) use($info, $parent, $command) {
         $ids = $this->createIdentityForRelatedResource($info['resource']['identifiers'], function (array $param) use($parent, $command, $result) {
             return $this->resolveValue($param, $parent, $command, $result);
         });
         return $ids === null ? new Batch($this, $info['resource']['type'], []) : $this->createResources($info['resource'], $result, $ids);
     });
 }
 /**
  * Creates a BatchDelete object from all of the paginated results of a
  * ListObjects operation. Each result that is returned by the ListObjects
  * operation will be deleted.
  *
  * @param AwsClientInterface $client            AWS Client to use.
  * @param array              $listObjectsParams ListObjects API parameters
  * @param array              $options           BatchDelete options.
  *
  * @return BatchDelete
  */
 public static function fromListObjects(AwsClientInterface $client, array $listObjectsParams, array $options = [])
 {
     $iter = $client->getPaginator('ListObjects', $listObjectsParams);
     $bucket = $listObjectsParams['Bucket'];
     $fn = function (BatchDelete $that) use($iter) {
         return $iter->each(function ($result) use($that) {
             $promises = [];
             foreach ($result['Contents'] as $object) {
                 if ($promise = $that->enqueue($object)) {
                     $promises[] = $promise;
                 }
             }
             return $promises ? Promise\all($promises) : null;
         });
     };
     return new self($client, $bucket, $fn, $options);
 }