Scalr\Service\OpenStack\Services\Network\V2\NetworkApi::removeRouterInterface PHP Метод

removeRouterInterface() публичный Метод

This operation removes an internal router interface, thus detaching a subnet from the router. Either a subnet identifier (subnet_id) or a port identifier (port_id) should be passed in the request body; this will be used to identify the router interface to remove. If both are specified, the subnet identifier must correspond to the one of the first ip address on the port specified by the port identifier; Otherwise a 409 Conflict error will be returned. The response will contain information about the affected router and interface. A 404 Not Found error will be returned either if the router or the subnet/port do not exist or are not visible to the user. As a consequence of this operation, the port connecting the router with the subnet is removed from the subnet's network.
public removeRouterInterface ( string $routerId, string $subnetId = null, string $portId = null ) : object
$routerId string The ID of the router
$subnetId string optional The identifier of the subnet
$portId string optional The identifier of the port
Результат object Returns raw response as object
    public function removeRouterInterface($routerId, $subnetId = null, $portId = null)
    {
        $result = null;
        $options = array();
        if (!empty($subnetId)) {
            $options['subnet_id'] = $this->escape($subnetId);
        }
        if (!empty($portId)) {
            $options['port_id'] = $this->escape($portId);
        }
        if (empty($options)) {
            throw new \InvalidArgumentException(sprintf('Either a subnet identifier or a port identifier must be passed in the method.'));
        }
        $response = $this->getClient()->call($this->service, sprintf('/routers/%s/remove_router_interface', $this->escape($routerId)), array('_putData' => json_encode($options)), 'PUT');
        if ($response->hasError() === false) {
            $result = json_decode($response->getContent());
        }
        return $result;
    }