/**
  * Creates a new Server object and associates it with a Compute service
  *
  * @param mixed $info
  *      * If NULL, an empty Server object is created
  *      * If an object, then a Server object is created from the data in the
  *      object
  *      * If a string, then it's treated as a Server ID and retrieved from the
  *      service
  *      The normal use case for SDK clients is to treat it as either NULL or an
  *      ID. The object value parameter is a special case used to construct
  *      a Server object from a ServerList element to avoid a secondary
  *      call to the Service.
  * @throws ServerNotFound if a 404 is returned
  * @throws UnknownError if another error status is reported
  */
 public function __construct(Service $service, $info = null)
 {
     // make the service persistent
     parent::__construct($service, $info);
     // the metadata item is an object, not an array
     $this->metadata = $this->metadata();
 }
Esempio n. 2
0
 /**
  * Creates a new instance object
  *
  * This could use the default constructor, but we want to make sure that
  * the volume attribute is an object.
  *
  * @param \OpenCloud\DbService $service the DbService object associated
  *                                      with this
  * @param mixed                $info    the ID or array of info for the object
  */
 public function __construct(Service $service, $info = null)
 {
     $this->volume = new \stdClass();
     return parent::__construct($service, $info);
 }