コード例 #1
0
 /**
  * constructs a new AsyncResponse object from a JSON
  * string
  *
  * @param \OpenCloud\Service $service the calling service
  * @param string             $json    the json response from the initial request
  */
 public function __construct(ServiceInterface $service, $object = null)
 {
     if (!$object) {
         return;
     }
     parent::__construct($service, $object);
 }
コード例 #2
0
ファイル: AsyncResponse.php プロジェクト: huhugon/sso
 /**
  * constructs a new AsyncResponse object from a JSON
  * string
  *
  * @param \OpenCloud\Service $service the calling service
  * @param string $json the json response from the initial request
  */
 public function __construct(AbstractService $service, $object = null)
 {
     if (!$object) {
         return;
     }
     parent::__construct($service, $object);
 }
コード例 #3
0
ファイル: Database.php プロジェクト: huhugon/sso
 /**
  * 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
  * Databases 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
  * @return void
  * @throws DatabaseNameError if `$info` is not a string, object, or array
  */
 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);
 }
コード例 #4
0
 /**
  * constructs a new AsyncResponse object from a JSON
  * string
  *
  * @param \OpenCloud\Service $service the calling service
  * @param string $json the json response from the initial request
  */
 public function __construct(AbstractService $service, $json = null)
 {
     if (!$json) {
         return;
     }
     $object = json_decode($json);
     $this->checkJsonError();
     parent::__construct($service, $object);
 }
コード例 #5
0
ファイル: AsyncResponse.php プロジェクト: omusico/home365
 /**
  * constructs a new AsyncResponse object from a JSON
  * string
  *
  * @param \OpenCloud\Service $service the calling service
  * @param string $json the json response from the initial request
  */
 public function __construct(AbstractService $service, $json = null)
 {
     if (!$json) {
         return;
     }
     $obj = json_decode($json);
     if ($this->CheckJsonError()) {
         return;
     }
     parent::__construct($service, $obj);
 }
コード例 #6
0
ファイル: User.php プロジェクト: artlabsdesign/missbloom
 /**
  * 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);
 }
コード例 #7
0
ファイル: SubResource.php プロジェクト: omusico/home365
 /**
  * constructs the SubResource's object
  *
  * @param mixed $obj the parent object
  * @param mixed $value the ID or array of values for the object
  */
 public function __construct($object, $value = null)
 {
     $this->parent = $object;
     parent::__construct($object->Service(), $value);
     /**
      * Note that, since these sub-resources do not have an ID, we must
      * fake out the `Refresh` method.
      */
     if (isset($this->id)) {
         $this->Refresh();
     } else {
         $this->Refresh('<no-id>');
     }
 }
コード例 #8
0
ファイル: Network.php プロジェクト: artlabsdesign/missbloom
 /**
  * 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(Service $service, $id = null)
 {
     $this->id = $id;
     switch ($id) {
         case RAX_PUBLIC:
             $this->label = 'public';
             $this->cidr = 'NA';
             break;
         case RAX_PRIVATE:
             $this->label = 'private';
             $this->cidr = 'NA';
             break;
         default:
             return parent::__construct($service, $id);
     }
     return;
 }
コード例 #9
0
ファイル: AbstractResource.php プロジェクト: omusico/home365
 /**
  * __construct function.
  * 
  * @access public
  * @param mixed $service
  * @param mixed $info
  * @return void
  */
 public function __construct($service, $info)
 {
     $this->setService($service);
     parent::__construct($service, $info);
 }
コード例 #10
0
ファイル: Server.php プロジェクト: BulatSa/Ctex
 /**
  * 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();
 }
コード例 #11
0
ファイル: Instance.php プロジェクト: samj1912/repo
 /**
  * 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);
 }
コード例 #12
0
ファイル: VolumeAttachment.php プロジェクト: omusico/home365
 /**
  * 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);
 }
コード例 #13
0
ファイル: Node.php プロジェクト: omusico/home365
 /**
  * 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);
 }