1: <?php
2: /**
3: * PHP OpenCloud library.
4: *
5: * @copyright 2013 Rackspace Hosting, Inc. See LICENSE for information.
6: * @license https://www.apache.org/licenses/LICENSE-2.0
7: * @author Glen Campbell <glen.campbell@rackspace.com>
8: * @author Jamie Hannaford <jamie.hannaford@rackspace.com>
9: */
10:
11: namespace OpenCloud\Autoscale\Resource;
12:
13: /**
14: * Description of ScalingPolicy
15: *
16: * @link
17: */
18: class ScalingPolicy extends AbstractResource
19: {
20:
21: public $id;
22: public $links;
23: public $name;
24: public $change;
25: public $cooldown;
26: public $type;
27: public $metadata;
28:
29: protected static $json_name = 'policy';
30: protected static $json_collection_name = 'policies';
31: protected static $url_resource = 'policies';
32:
33: public $createKeys = array(
34: 'name',
35: 'change',
36: 'cooldown',
37: 'type'
38: );
39:
40: public function getWebhookList()
41: {
42: return $this->getService()->resourceList('Webhook', null, $this);
43: }
44:
45: public function getWebhook($id = null)
46: {
47: $webhook = new Webhook();
48: $webhook->setParent($this);
49: $webhook->setService($this->getService());
50: if ($id) {
51: $webhook->populate($id);
52: }
53: return $webhook;
54: }
55:
56: public function execute()
57: {
58: return $this->getClient()->post($this->url('execute'))->send();
59: }
60:
61: }