/** * ListSubnets action (GET /subnets[/subnet-id]) * * Lists all subnets that are accessible to the tenant who submits the * request. * * @param string $subnetId optional The ID of the subnet to show detailed info * @param ListSubnetsFilter $filter optional The filter. * @return DefaultPaginationList|object Returns the list of the subnets or one subnet * @throws RestClientException */ public function listSubnets($subnetId = null, ListSubnetsFilter $filter = null) { $result = null; $detailed = $subnetId !== null ? sprintf("/%s", $this->escape($subnetId)) : ''; $response = $this->getClient()->call($this->service, '/subnets' . $detailed . ($filter !== null ? '?' . $filter->getQueryString() : '')); if ($response->hasError() === false) { $result = json_decode($response->getContent()); if (empty($detailed)) { $result = new DefaultPaginationList($this->service, 'subnets', $result->subnets, isset($result->subnets_links) ? $result->subnets_links : null); } else { $result = $result->subnet; } } return $result; }
/** * ListSubnets action (GET /subnets[/subnet-id]) * * Lists all subnets that are accessible to the tenant who submits the * request. * * @param string $subnetId optional The ID of the subnet to show detailed info * @param ListSubnetsFilter|array $filter optional The filter. * @return DefaultPaginationList|object Returns the list of the subnets or one subnet * @throws RestClientException */ public function listSubnets($subnetId = null, $filter = null) { if ($filter !== null && !$filter instanceof ListSubnetsFilter) { $filter = ListSubnetsFilter::initArray($filter); } return $this->getApiHandler()->listSubnets($subnetId, $filter); }
/** * ListSubnets action (GET /subnets[/subnet-id]) * * Lists all subnets that are accessible to the tenant who submits the * request. * * @param string $subnetId optional The ID of the subnet to show detailed info * @param ListSubnetsFilter $filter optional The filter. * @return array|object Returns the list of the subnets or one subnet * @throws RestClientException */ public function listSubnets($subnetId = null, ListSubnetsFilter $filter = null) { $result = null; $detailed = $subnetId !== null ? sprintf("/%s", $this->escape($subnetId)) : ''; $response = $this->getClient()->call($this->service, '/subnets' . $detailed . ($filter !== null ? '?' . $filter->getQueryString() : '')); if ($response->hasError() === false) { $result = json_decode($response->getContent()); $result = empty($detailed) ? $result->subnets : $result->subnet; } return $result; }