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');
 }
Ejemplo n.º 2
0
 /**
  * @expectedException \InvalidArgumentException
  */
 public function testEnsuresMethodIsPost()
 {
     $request = new EntityEnclosingRequest('PUT', 'http://foo.com');
     SignatureV4::convertPostToGet($request);
 }