private function createPresignedUrl(AwsClientInterface $client, CommandInterface $command)
 {
     // Create a temporary client used to generate the presigned URL
     $newClient = Ec2Client::factory(array('region' => $command['SourceRegion'], 'signature' => 'v4', 'credentials' => $client->getCredentials()));
     $preCommand = $newClient->getCommand('CopySnapshot', $command->toArray());
     $preCommand['__internal'] = true;
     /** @var \Guzzle\Http\Message\EntityEnclosingRequest $preRequest */
     $preRequest = $preCommand->prepare();
     return $newClient->getSignature()->createPresignedUrl(SignatureV4::convertPostToGet($preRequest), $newClient->getCredentials(), '+1 hour');
 }
예제 #2
0
 protected function prepareAdditionalParameters(OperationInterface $operation, CommandInterface $command, RequestInterface $request, Parameter $additional)
 {
     if (!($location = $additional->getLocation())) {
         return;
     }
     $visitor = $this->factory->getRequestVisitor($location);
     $hidden = $command[$command::HIDDEN_PARAMS];
     foreach ($command->toArray() as $key => $value) {
         if ($value !== null && !in_array($key, $hidden) && !$operation->hasParam($key)) {
             $additional->setName($key);
             $visitor->visit($command, $request, $additional, $value);
         }
     }
     return $visitor;
 }