Scalr\Service\OpenStack\Services\Network\V2\NetworkApi::listNetworks PHP Method

listNetworks() public method

Lists a summary of all networks defined in Quantum that are accessible to the tenant who submits the request.
public listNetworks ( string $networkId = null, Scalr\Service\OpenStack\Services\Network\Type\ListNetworksFilter $filter = null ) : array | object
$networkId string optional The ID of the network to show detailed info
$filter Scalr\Service\OpenStack\Services\Network\Type\ListNetworksFilter optional The query filter.
return array | object Returns the list of the networks or one network
    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;
    }