Overview
  • Namespace
  • Class

Namespaces

  • OpenCloud
    • Autoscale
      • Resource
    • CloudMonitoring
      • Collection
      • Exception
      • Resource
    • Common
      • Collection
      • Constants
      • Exceptions
      • Http
        • Message
      • Log
      • Resource
      • Service
    • Compute
      • Constants
      • Exception
      • Resource
    • Database
      • Resource
    • DNS
      • Collection
      • Resource
    • Identity
      • Constants
      • Resource
    • Image
      • Enum
      • Resource
        • JsonPatch
        • Schema
    • LoadBalancer
      • Collection
      • Enum
      • Resource
    • Networking
      • Resource
    • ObjectStore
      • Constants
      • Exception
      • Resource
      • Upload
    • Orchestration
      • Resource
    • Queues
      • Collection
      • Exception
      • Resource
    • Volume
      • Resource

Classes

  • OpenCloud\Volume\Resource\Snapshot
  • OpenCloud\Volume\Resource\Volume
  • OpenCloud\Volume\Resource\VolumeType
 1 <?php
 2 /**
 3  * Copyright 2012-2014 Rackspace US, Inc.
 4  *
 5  * Licensed under the Apache License, Version 2.0 (the "License");
 6  * you may not use this file except in compliance with the License.
 7  * You may obtain a copy of the License at
 8  *
 9  * http://www.apache.org/licenses/LICENSE-2.0
10  *
11  * Unless required by applicable law or agreed to in writing, software
12  * distributed under the License is distributed on an "AS IS" BASIS,
13  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14  * See the License for the specific language governing permissions and
15  * limitations under the License.
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  * Configuration represents an configuration group for a tenant
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      * Patches a database configuration, replacing ONLY the values provided.
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      * Generates the JSON string for update()
65      *
66      * @return \@stdClass
67      */
68     protected function updateJson($params = array())
69     {
70         return (object) array(
71             self::$json_name => $params
72         );
73     }
74 
75     /**
76      * Returns a Collection of all instances using this configuration
77      *
78      * @return OpenCloud\Common\Collection\PaginatedIterator
79      */
80     public function instanceList()
81     {
82         return $this->getService()->resourceList('Instance', $this->getUrl('instances'));
83     }
84 }
85 
API documentation generated by ApiGen