/**
* 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);
}