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\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: protected static $json_collection_element = 'data';
33:
34: public $createKeys = array(
35: 'name',
36: 'change',
37: 'cooldown',
38: 'type'
39: );
40:
41: public function getWebhookList()
42: {
43: return $this->service()->resourceList('Webhook', null, $this);
44: }
45:
46: public function getWebhook($id = null)
47: {
48: $webhook = new Webhook();
49: $webhook->setParent($this);
50: $webhook->setService($this->service());
51: if ($id) {
52: $webhook->populate($id);
53: }
54: return $webhook;
55: }
56:
57: public function webhook($info)
58: {
59: $webhook = $this->getWebhook();
60: $webhook->populate($info);
61: return $webhook;
62: }
63:
64: public function execute()
65: {
66: return $this->customAction($this->url('execute', true), 'POST');
67: }
68:
69: }