getUrl() public méthode

public getUrl ( )
Exemple #1
0
 /**
  * CopyImage action
  *
  * Initiates the copy of an AMI from the specified source region to the region in which the API call is executed
  *
  * @param   string     $srcRegion     The ID of the AWS region that contains the AMI to be copied.
  * @param   string     $srcImageId    The ID of the Amazon EC2 AMI to copy.
  * @param   string     $name          optional The name of the new Amazon EC2 AMI.
  * @param   string     $description   optional A description of the new EC2 AMI in the destination region.
  * @param   string     $clientToken   optional Unique, case-sensitive identifier you provide to ensure
  *                                             idempotency of the request
  * @param   string     $destRegion    optional The ID of the destination region.
  * @return  string     Returns ID of the created image on success.
  * @throws  ClientException
  * @throws  Ec2Exception
  */
 public function copyImage($srcRegion, $srcImageId, $name = null, $description = null, $clientToken = null, $destRegion = null)
 {
     $result = null;
     $options = array('SourceRegion' => (string) $srcRegion, 'SourceImageId' => (string) $srcImageId);
     if ($description !== null) {
         $options['Description'] = (string) $description;
     }
     if ($name !== null) {
         $options['Name'] = (string) $name;
     }
     if ($name !== null) {
         $options['ClientToken'] = (string) $clientToken;
     }
     if ($destRegion !== null) {
         //It overrides region to copy
         $options['_host'] = $this->ec2->getUrl($destRegion);
         $options['_region'] = $destRegion;
     }
     $response = $this->client->call(ucfirst(__FUNCTION__), $options);
     if ($response->getError() === false) {
         $sxml = simplexml_load_string($response->getRawContent());
         $result = (string) $sxml->imageId;
     }
     return $result;
 }