Ejemplo n.º 1
0
 /**
  * A Collection is an array of objects
  *
  * Some assumptions:
  * * The `Collection` class assumes that there exists on its service
  *   a factory method with the same name of the class. For example, if
  *   you create a Collection of class `Foobar`, it will attempt to call
  *   the method `parent::Foobar()` to create instances of that class.
  * * It assumes that the factory method can take an array of values, and
  *   it passes that to the method.
  *
  * @param Service $service   - the service associated with the collection
  * @param string  $itemclass - the Class of each item in the collection
  *                           (assumed to be the name of the factory method)
  * @param array   $arr       - the input array
  */
 public function __construct($service, $class, array $array = array())
 {
     $service->getLogger()->warning(Logger::deprecated(__METHOD__, 'OpenCloud\\Common\\Collection\\CollectionBuilder'));
     $this->setService($service);
     $this->setNextPageClass($class);
     // If they've supplied a FQCN, only get the last part
     $class = false !== ($classNamePos = strrpos($class, '\\')) ? substr($class, $classNamePos + 1) : $class;
     $this->setItemClass($class);
     // Set data
     $this->setItemList($array);
 }
Ejemplo n.º 2
0
 /**
  * Called when creating a new Compute service object
  *
  * _NOTE_ that the order of parameters for this is *different* from the
  * parent Service class. This is because the earlier parameters are the
  * ones that most typically change, whereas the later ones are not
  * modified as often.
  *
  * @param \OpenCloud\Identity $conn - a connection object
  * @param string $serviceRegion - identifies the region of this Compute
  *      service
  * @param string $urltype - identifies the URL type ("publicURL",
  *      "privateURL")
  * @param string $serviceName - identifies the name of the service in the
  *      catalog
  */
 public function __construct(OpenStack $conn, $serviceName, $serviceRegion, $urltype)
 {
     $this->debug(_('initializing Orchestration...'));
     parent::__construct($conn, 'orchestration', $serviceName, $serviceRegion, $urltype);
 }
Ejemplo n.º 3
0
 /**
  * {@inheritDoc}
  */
 public function __construct(OpenStack $conn, $serviceName, $serviceRegion, $urltype)
 {
     $this->getLogger()->info('Initializing Orchestration...');
     parent::__construct($conn, 'orchestration', $serviceName, $serviceRegion, $urltype);
 }
Ejemplo n.º 4
0
 /**
  * Gets a request from an HTTP source and ensures that the
  * content type is always "application/json"
  *
  * This is a simple subclass of the parent::Request() method that ensures
  * that all Compute requests use application/json as the Content-Type:
  *
  * @param string $url - the URL of the request
  * @param string $method - the HTTP method ("GET" by default)
  * @param array $headers - an associative array of headers to pass to
  *      the request
  * @param string $body - optional body for POST or PUT requests
  * @return \Rackspace\HttpResult object
  */
 public function Request($url, $method = 'GET', array $headers = array(), $body = null)
 {
     $headers['Content-Type'] = RAXSDK_CONTENT_TYPE_JSON;
     return parent::Request($url, $method, $headers, $body);
 }
Ejemplo n.º 5
0
 /**
  * Main service constructor.
  * 
  * @access public
  * @param OpenStack $connection
  * @param mixed $serviceName
  * @param mixed $serviceRegion
  * @param mixed $urlType
  * @return void
  */
 public function __construct(OpenStack $connection, $serviceName, $serviceRegion, $urlType)
 {
     parent::__construct($connection, 'rax:monitor', $serviceName, $serviceRegion, $urlType);
 }
Ejemplo n.º 6
0
 public function Request($url, $method = 'GET', array $headers = array(), $body = NULL)
 {
     return parent::Request($url, $method, $headers, $body);
 }
Ejemplo n.º 7
0
 /**
  * Called when creating a new Autoscale service object
  *
  * _NOTE_ that the order of parameters for this is *different* from the
  * parent Service class. This is because the earlier parameters are the
  * ones that most typically change, whereas the later ones are not
  * modified as often.
  *
  * @param OpenStack $conn - a connection object
  * @param string $serviceRegion - identifies the region of this Compute
  *      service
  * @param string $urltype - identifies the URL type ("publicURL",
  *      "privateURL")
  * @param string $serviceName - identifies the name of the service in the
  *      catalog
  */
 public function __construct(OpenStack $conn, $serviceName, $serviceRegion, $urltype, $customEndpoint = null)
 {
     parent::__construct($conn, 'rax:autoscale', $serviceName, $serviceRegion, $urltype, $customEndpoint);
     $this->getLogger()->info('Initializing Autoscale...');
 }
Ejemplo n.º 8
0
 /**
  * Called when creating a new Autoscale service object
  *
  * _NOTE_ that the order of parameters for this is *different* from the
  * parent Service class. This is because the earlier parameters are the
  * ones that most typically change, whereas the later ones are not
  * modified as often.
  *
  * @param OpenStack $conn - a connection object
  * @param string $serviceRegion - identifies the region of this Compute
  *      service
  * @param string $urltype - identifies the URL type ("publicURL",
  *      "privateURL")
  * @param string $serviceName - identifies the name of the service in the
  *      catalog
  */
 public function __construct(OpenStack $conn, $serviceName, $serviceRegion, $urltype)
 {
     $this->debug(_('initializing Autoscale...'));
     parent::__construct($conn, 'rax:autoscale', $serviceName, $serviceRegion, $urltype);
 }