/** * List Networks action (GET /networks[/network-id]) * * Lists a summary of all networks defined in Quantum that are accessible * to the tenant who submits the request. * * @param string $networkId optional The ID of the network to show detailed info * @param ListNetworksFilter|array $filter optional The query filter. * @return DefaultPaginationList|object Returns the list of the networks or one network * @throws RestClientException */ public function listNetworks($networkId = null, $filter = null) { if ($filter !== null && !$filter instanceof ListNetworksFilter) { $filter = ListNetworksFilter::initArray($filter); } return $this->getApiHandler()->listNetworks($networkId, $filter); }
/** * List Networks action (GET /networks[/network-id]) * * Lists a summary of all networks defined in Quantum that are accessible * to the tenant who submits the request. * * @param string $networkId optional The ID of the network to show detailed info * @param ListNetworksFilter $filter optional The query filter. * @return array|object Returns the list of the networks or one network * @throws RestClientException */ public function listNetworks($networkId = null, ListNetworksFilter $filter = null) { $result = null; $detailed = $networkId !== null ? sprintf("/%s", $this->escape($networkId)) : ''; $response = $this->getClient()->call($this->service, '/networks' . $detailed . ($filter !== null ? '?' . $filter->getQueryString() : ''), null, 'GET'); if ($response->hasError() === false) { $result = json_decode($response->getContent()); if (empty($detailed)) { $result = new DefaultPaginationList($this->service, 'networks', $result->networks, isset($result->networks_links) ? $result->networks_links : null); } else { $result = $result->network; } } return $result; }