Ejemplo n.º 1
0
 /**
  * Return an existing CDN-enabled container.
  *
  * @param \stdClass $data Data to initialize container.
  * @return CDNContainer CDN-enabled Container
  */
 public function cdnContainer($data)
 {
     $container = new CDNContainer($this, $data);
     $metadata = new ContainerMetadata();
     $metadata->setArray(array('Streaming-Uri' => $data->cdn_streaming_uri, 'Ios-Uri' => $data->cdn_ios_uri, 'Ssl-Uri' => $data->cdn_ssl_uri, 'Enabled' => $data->cdn_enabled, 'Ttl' => $data->ttl, 'Log-Retention' => $data->log_retention, 'Uri' => $data->cdn_uri));
     $container->setMetadata($metadata);
     return $container;
 }
Ejemplo n.º 2
0
 public function refresh($id = null, $url = null)
 {
     $headers = $this->createRefreshRequest()->send()->getHeaders();
     $this->setMetadata($headers, true);
     try {
         $cdn = new CDNContainer($this->getService()->getCDNService());
         $cdn->setName($this->name);
         $response = $cdn->createRefreshRequest()->send();
         if ($response->isSuccessful()) {
             $this->cdn = $cdn;
             $this->cdn->setMetadata($response->getHeaders(), true);
         }
     } catch (ClientErrorResponseException $e) {
     }
 }
Ejemplo n.º 3
0
 protected function refreshCdnObject()
 {
     try {
         if (null !== ($cdnService = $this->getService()->getCDNService())) {
             $cdn = new CDNContainer($cdnService);
             $cdn->setName($this->name);
             $response = $cdn->createRefreshRequest()->send();
             if ($response->isSuccessful()) {
                 $this->cdn = $cdn;
                 $this->cdn->setMetadata($response->getHeaders(), true);
             }
         } else {
             $this->cdn = null;
         }
     } catch (ClientErrorResponseException $e) {
     }
 }