1: <?php
2: /**
3: * PHP OpenCloud library.
4: *
5: * @copyright Copyright 2013 Rackspace US, Inc. See COPYING for licensing information.
6: * @license https://www.apache.org/licenses/LICENSE-2.0 Apache 2.0
7: * @version 1.6.0
8: * @author Glen Campbell <glen.campbell@rackspace.com>
9: * @author Jamie Hannaford <jamie.hannaford@rackspace.com>
10: */
11:
12: namespace OpenCloud\ObjectStore;
13:
14: use OpenCloud\OpenStack;
15: use OpenCloud\Common\Exceptions;
16:
17: /**
18: * This is the CDN version of the ObjectStore service.
19: */
20: class CDNService extends AbstractService
21: {
22:
23: /**
24: * Creates a new CDNService object.
25: *
26: * This is a simple wrapper function around the parent Service construct,
27: * but supplies defaults for the service type.
28: *
29: * @param OpenCloud\OpenStack $connection The connection object
30: * @param string $serviceName The name of the service
31: * @param string $serviceRegion The service's region
32: * @param string $urlType The type of URL (normally 'publicURL')
33: */
34: public function __construct(
35: OpenStack $connection,
36: $serviceName = RAXSDK_OBJSTORE_NAME,
37: $serviceRegion = RAXSDK_OBJSTORE_REGION,
38: $urltype = RAXSDK_URL_PUBLIC
39: ) {
40: $this->getLogger()->info('Initializing CDN Service...');
41:
42: parent::__construct(
43: $connection,
44: 'rax:object-cdn',
45: $serviceName,
46: $serviceRegion,
47: $urltype
48: );
49: }
50:
51: /**
52: * Helps catch errors if someone calls the method on the
53: * wrong object
54: */
55: public function CDN()
56: {
57: throw new Exceptions\CdnError(
58: 'Invalid method call; no CDN() on the CDN object'
59: );
60: }
61:
62: }
63: