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 Jamie Hannaford <jamie.hannaford@rackspace.com>
9: */
10:
11: namespace OpenCloud\Autoscale;
12:
13: use OpenCloud\Common\Service as AbstractService;
14: use OpenCloud\OpenStack;
15:
16: /**
17: * The Autoscale class represents the OpenStack Otter service.
18: */
19: class Service extends AbstractService
20: {
21:
22: /**
23: * Autoscale resources.
24: *
25: * @var array
26: * @access private
27: */
28: public $resources = array(
29: 'Group',
30: 'GroupConfiguration',
31: 'LaunchConfiguration',
32: 'ScalingPolicy'
33: );
34:
35: /**
36: * Called when creating a new Autoscale service object
37: *
38: * _NOTE_ that the order of parameters for this is *different* from the
39: * parent Service class. This is because the earlier parameters are the
40: * ones that most typically change, whereas the later ones are not
41: * modified as often.
42: *
43: * @param OpenStack $conn - a connection object
44: * @param string $serviceRegion - identifies the region of this Compute
45: * service
46: * @param string $urltype - identifies the URL type ("publicURL",
47: * "privateURL")
48: * @param string $serviceName - identifies the name of the service in the
49: * catalog
50: */
51: public function __construct(
52: OpenStack $conn,
53: $serviceName,
54: $serviceRegion,
55: $urltype,
56: $customEndpoint = null
57: ) {
58:
59: parent::__construct(
60: $conn, 'rax:autoscale', $serviceName, $serviceRegion, $urltype, $customEndpoint
61: );
62:
63: $this->getLogger()->info('Initializing Autoscale...');
64: }
65:
66: /**
67: * Convenience method for getting an autoscale group.
68: *
69: * @param mixed $info
70: * @return AbstractResource
71: */
72: public function group($info = null)
73: {
74: return $this->resource('Group', $info);
75: }
76:
77: /**
78: * Convenience method for getting a list of autoscale groups.
79: *
80: * @return OpenCloud\Common\Collection
81: */
82: public function groupList()
83: {
84: return $this->resourceList('Group');
85: }
86:
87: }
88: