Beispiel #1
0
 /**
  * Get a list of CloudFront distributions
  *
  * @return array
  */
 public static function listDistributions()
 {
     self::$useSSL = true;
     // CloudFront requires SSL
     $rest = new S3Request('GET', '', '2008-06-30/distribution', 'cloudfront.amazonaws.com');
     $rest = self::__getCloudFrontResponse($rest);
     if ($rest->error === false && $rest->code !== 200) {
         $rest->error = array('code' => $rest->code, 'message' => 'Unexpected HTTP status');
     }
     if ($rest->error !== false) {
         trigger_error(sprintf("S3Service::listDistributions(): [%s] %s", $rest->error['code'], $rest->error['message']), E_USER_WARNING);
         return false;
     } elseif ($rest->body instanceof SimpleXMLElement && isset($rest->body->DistributionSummary)) {
         $list = array();
         if (isset($rest->body->Marker, $rest->body->MaxItems, $rest->body->IsTruncated)) {
             //$info['marker'] = (string)$rest->body->Marker;
             //$info['maxItems'] = (int)$rest->body->MaxItems;
             //$info['isTruncated'] = (string)$rest->body->IsTruncated == 'true' ? true : false;
         }
         foreach ($rest->body->DistributionSummary as $summary) {
             $list[(string) $summary->Id] = self::__parseCloudFrontDistributionConfig($summary);
         }
         return $list;
     }
     return array();
 }