Example #1
0
 protected function createJson()
 {
     $element = parent::createJson();
     if ($this->getProperty('volume_type') instanceof VolumeType) {
         $element->volume->volume_type = $this->volume_type->name();
     }
     return $element;
 }
 public function __construct(Instance $instance, $info = null)
 {
     $this->setParent($instance);
     // Catering for laziness
     if (is_string($info)) {
         $info = array('name' => $info);
     }
     return parent::__construct($instance->getService(), $info);
 }
Example #3
0
 /**
  * Creates a new database object
  *
  * Unlike other objects (Servers, DataObjects, etc.), passing a database
  * name to the constructor does *not* pull information from the database.
  * For example, if you pass an ID to the `Server()` constructor, it will
  * attempt to retrieve the information on that server from the service,
  * and will return an error if it is not found. However, the Cloud
  * Users service does not permit retrieval of information on
  * individual databases (only via Collection), and thus passing in a
  * name via the `$info` parameter only creates an in-memory object that
  * is not necessarily tied to an actual database.
  *
  * @param Instance $instance the parent DbService\Instance of the database
  * @param mixed    $info     if an array or object, treated as properties to set;
  *                           if a string, treated as the database name
  * @param array    $db       a list of database names to associate with the User
  * @return void
  * @throws UserNameError if `$info` is not a string, object, or array
  */
 public function __construct(Instance $instance, $info = null, $db = array())
 {
     $this->setParent($instance);
     if (!empty($db)) {
         $this->databases = $db;
     }
     // Lazy...
     if (is_string($info)) {
         $info = array('name' => $info);
     }
     return parent::__construct($instance->getService(), $info);
 }
 public function delete()
 {
     $body = Formatter::decode(parent::delete());
     return new AsyncResponse($this->getService(), $body);
 }
 public function name()
 {
     $classArray = explode('\\', get_class($this));
     return method_exists($this->getParent(), 'id') ? sprintf('%s-%s', end($classArray), $this->getParent()->id()) : parent::name();
 }
Example #6
0
 protected function createJson()
 {
     $createJson = parent::createJson();
     return $createJson->{self::$json_name};
 }
 public function generateJsonPatch($updateParams)
 {
     return parent::generateJsonPatch($updateParams);
 }
 /**
  * This method is inherited. The inherited method has protected scope
  * but we are widening the scope to public so this method may be called
  * from other classes such as {@see OpenCloud\Networking\Service}.
  */
 public function createJson()
 {
     return parent::createJson();
 }
Example #9
0
 protected function updateJson($params = array())
 {
     $updateJson = parent::updateJson($params);
     return $updateJson->{self::$json_name};
 }
Example #10
0
 /**
  * Deletes an isolated network
  *
  * @api
  * @return \OpenCloud\HttpResponse
  * @throws NetworkDeleteError if HTTP status is not Success
  */
 public function delete()
 {
     switch ($this->id) {
         case NetworkConst::RAX_PUBLIC:
         case NetworkConst::RAX_PRIVATE:
             throw new Exceptions\DeleteError('Network may not be deleted');
         default:
             return parent::delete();
     }
 }
Example #11
0
 public function __construct(Service $service, $info = null)
 {
     $this->instance = new \stdClass();
     return parent::__construct($service, $info);
 }
 public function recursivelyAliasPropertyValue($propertyValue)
 {
     return parent::recursivelyAliasPropertyValue($propertyValue);
 }