Exemplo n.º 1
0
 /**
  * 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(\OpenCloud\Compute $service, $info = NULL)
 {
     // make the service persistent
     parent::__construct($service, $info);
     // the metadata item is an object, not an array
     $this->metadata = $this->Metadata();
 }
Exemplo n.º 2
0
 /**
  * Creates a new isolated Network object
  *
  * NOTE: contains hacks to recognize the Rackspace public and private
  * networks. These are not really networks, but they show up in lists.
  *
  * @param \OpenCloud\Compute $service The compute service associated with
  *      the network
  * @param string $id The ID of the network (this handles the pseudo-networks
  *		RAX_PUBLIC and RAX_PRIVATE
  * @return void
  */
 public function __construct(\OpenCloud\Compute $service, $id = NULL)
 {
     $this->id = $id;
     switch ($id) {
         case RAX_PUBLIC:
             $this->label = 'public';
             $this->cidr = 'NA';
             return;
         case RAX_PRIVATE:
             $this->label = 'private';
             $this->cidr = 'NA';
             return;
         default:
             return parent::__construct($service, $id);
     }
 }
Exemplo n.º 3
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(\OpenCloud\DbService $service, $info = NULL)
 {
     $this->volume = new \stdClass();
     return parent::__construct($service, $info);
 }
 /**
  * builds a new Node object
  *
  * @param LoadBalancer $lb the parent LB object
  * @param mixed $info either an ID or an array of values
  * @returns void
  */
 public function __construct(LoadBalancer $lb, $info = NULL)
 {
     $this->_lb = $lb;
     parent::__construct($lb->Service(), $info);
 }
 /**
  * creates the object
  *
  * This overrides the default constructor so that we can save off the
  * server to which this attachment is associated.
  */
 public function __construct(Server $server, $id = NULL)
 {
     $this->_server = $server;
     return parent::__construct($server->Service(), $id);
 }