1 <?php
2 3 4 5 6 7 8 9 10 11 12 13 14 15 16
17
18 namespace OpenCloud\Database\Resource;
19
20 use OpenCloud\Common\Http\Message\Formatter;
21 use OpenCloud\Common\Lang;
22 use OpenCloud\Common\Exceptions;
23 use OpenCloud\Common\Resource\PersistentResource;
24 use OpenCloud\Database\Service;
25
26 27 28
29 class Configuration extends PersistentResource
30 {
31 public $id;
32 public $datastore_name;
33 public $datastore_version_id;
34 public $datastore_version_name;
35 public $description;
36 public $instance_count;
37 public $name;
38 public $created;
39 public $updated;
40 public $values;
41
42 protected static $json_name = 'configuration';
43 protected static $url_resource = 'configurations';
44
45 protected $createKeys = array(
46 'name',
47 'description',
48 'values',
49 'datastore'
50 );
51
52 53 54
55 public function patch($params = array())
56 {
57 $json = json_encode($this->updateJson($params));
58 $this->checkJsonError();
59
60 return $this->getClient()->patch($this->url(), self::getJsonHeader(), $json)->send();
61 }
62
63 64 65 66 67
68 protected function updateJson($params = array())
69 {
70 return (object) array(
71 self::$json_name => $params
72 );
73 }
74
75 76 77 78 79
80 public function instanceList()
81 {
82 return $this->getService()->resourceList('Instance', $this->getUrl('instances'));
83 }
84 }
85