Overview
  • Namespace
  • Class

Namespaces

  • OpenCloud
    • Autoscale
      • Resource
    • CloudMonitoring
      • Collection
      • Exception
      • Resource
    • Common
      • Collection
      • Constants
      • Exceptions
      • Http
        • Message
      • Log
      • Resource
      • Service
    • Compute
      • Constants
      • Exception
      • Resource
    • Database
      • Resource
    • DNS
      • Collection
      • Resource
    • Identity
      • Constants
      • Resource
    • Image
      • Enum
      • Resource
        • JsonPatch
        • Schema
    • LoadBalancer
      • Collection
      • Enum
      • Resource
    • Networking
      • Resource
    • ObjectStore
      • Constants
      • Exception
      • Resource
      • Upload
    • Orchestration
      • Resource
    • Queues
      • Collection
      • Exception
      • Resource
    • Volume
      • Resource

Classes

  • OpenCloud\Volume\Resource\Snapshot
  • OpenCloud\Volume\Resource\Volume
  • OpenCloud\Volume\Resource\VolumeType
  1 <?php
  2 /**
  3  * Copyright 2012-2014 Rackspace US, Inc.
  4  *
  5  * Licensed under the Apache License, Version 2.0 (the "License");
  6  * you may not use this file except in compliance with the License.
  7  * You may obtain a copy of the License at
  8  *
  9  * http://www.apache.org/licenses/LICENSE-2.0
 10  *
 11  * Unless required by applicable law or agreed to in writing, software
 12  * distributed under the License is distributed on an "AS IS" BASIS,
 13  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 14  * See the License for the specific language governing permissions and
 15  * limitations under the License.
 16  */
 17 
 18 namespace OpenCloud\ObjectStore\Resource;
 19 
 20 use OpenCloud\ObjectStore\Constants\Header as HeaderConst;
 21 
 22 /**
 23  * A container that has been CDN-enabled. Each CDN-enabled container has a unique
 24  * Uniform Resource Locator (URL) that can be combined with its object names and
 25  * openly distributed in web pages, emails, or other applications.
 26  */
 27 class CDNContainer extends AbstractContainer
 28 {
 29     const METADATA_LABEL = 'Cdn';
 30 
 31     /**
 32      * @return null|string|int
 33      */
 34     public function getCdnSslUri()
 35     {
 36         return $this->metadata->getProperty('Ssl-Uri');
 37     }
 38 
 39     /**
 40      * @return null|string|int
 41      */
 42     public function getCdnUri()
 43     {
 44         return $this->metadata->getProperty('Uri');
 45     }
 46 
 47     /**
 48      * @return null|string|int
 49      */
 50     public function getTtl()
 51     {
 52         return $this->metadata->getProperty('Ttl');
 53     }
 54 
 55     /**
 56      * @return null|string|int
 57      */
 58     public function getCdnStreamingUri()
 59     {
 60         return $this->metadata->getProperty('Streaming-Uri');
 61     }
 62 
 63     /**
 64      * @return null|string|int
 65      */
 66     public function getIosStreamingUri()
 67     {
 68         return $this->metadata->getProperty('Ios-Uri');
 69     }
 70 
 71     public function refresh($name = null, $url = null)
 72     {
 73         $response = $this->createRefreshRequest()->send();
 74 
 75         $headers = $response->getHeaders();
 76         $this->setMetadata($headers, true);
 77 
 78         return $headers;
 79     }
 80 
 81     /**
 82      * Turn on access logs, which track all the web traffic that your data objects accrue.
 83      *
 84      * @return \Guzzle\Http\Message\Response
 85      */
 86     public function enableCdnLogging()
 87     {
 88         $headers = array('X-Log-Retention' => 'True');
 89 
 90         return $this->getClient()->put($this->getUrl(), $headers)->send();
 91     }
 92 
 93     /**
 94      * Disable access logs.
 95      *
 96      * @return \Guzzle\Http\Message\Response
 97      */
 98     public function disableCdnLogging()
 99     {
100         $headers = array('X-Log-Retention' => 'False');
101 
102         return $this->getClient()->put($this->getUrl(), $headers)->send();
103     }
104 
105     public function isCdnEnabled()
106     {
107         return $this->metadata->getProperty(HeaderConst::ENABLED) == 'True';
108     }
109 
110     /**
111      * Set the TTL.
112      *
113      * @param $ttl The time-to-live in seconds.
114      * @return \Guzzle\Http\Message\Response
115      */
116     public function setTtl($ttl)
117     {
118         $headers = array('X-Ttl' => $ttl);
119 
120         return $this->getClient()->post($this->getUrl(), $headers)->send();
121     }
122 }
123 
API documentation generated by ApiGen