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

createRouter() public method

This operation creates a new logical router. When it is created, a logical router does not have any internal interface. In other words, it is not associated to any subnet. The user can optionally specify an external gateway for a router at create time; a router's external gateway must be plugged into an external network, that is to say a network for which the extended field router:external is set to true.
public createRouter ( Scalr\Service\OpenStack\Services\Network\Type\CreateRouter $request ) : object
$request Scalr\Service\OpenStack\Services\Network\Type\CreateRouter Create router request object
return object Returns router object on success or throws an exception otherwise
    public function createRouter(CreateRouter $request)
    {
        $result = null;
        $options = array('router' => array_filter(get_object_vars($request), [$this, 'filterNull']));
        $response = $this->getClient()->call($this->service, '/routers', $options, 'POST');
        if ($response->hasError() === false) {
            $result = json_decode($response->getContent());
            $result = $result->router;
        }
        return $result;
    }