Scalr\Service\OpenStack\Services\AbstractService::getOpenStack PHP Method

getOpenStack() public method

Gets an OpenStack instance
public getOpenStack ( ) : OpenStack
return Scalr\Service\OpenStack\OpenStack Returns OpenStack instance
    public function getOpenStack()
    {
        return $this->openstack;
    }

Usage Example

Example #1
0
 /**
  * Gets requested page
  *
  * @param   object    $target
  * @return  AbstractPaginationList  Returns result set on success or throws an exception
  * @throws  RestClientException
  */
 private function _getRequestedPage($target)
 {
     $class = get_class($this);
     $response = $this->service->getOpenStack()->getClient()->call($target->base, $target->path, null, 'GET');
     if ($response->hasError() === false) {
         $result = json_decode($response->getContent());
         if (!empty($result->{$this->subject . '_links'})) {
             $links = $result->{$this->subject . '_links'};
         } else {
             $links = null;
         }
     } else {
         throw new \Exception('Something goes wrong. Exception is expected to have thrown in hasError() method.');
     }
     return new $class($this->service, $this->subject, $result->{$this->subject}, $links);
 }