Scalr\Service\Aws\Ec2\V20150415\Ec2Api::deleteNetworkInterface PHP Method

deleteNetworkInterface() public method

Deletes the specified network interface.
public deleteNetworkInterface ( string $networkInterfaceId ) : boolean
$networkInterfaceId string The ID of the network interface
return boolean Returns true on success or throws an exception
    public function deleteNetworkInterface($networkInterfaceId)
    {
        $result = false;
        $options = ['NetworkInterfaceId' => (string) $networkInterfaceId];
        $action = ucfirst(__FUNCTION__);
        $response = $this->client->call($action, $options);
        if ($response->getError() === false) {
            $sxml = simplexml_load_string($response->getRawContent());
            if ((string) $sxml->return != 'true') {
                throw new Ec2Exception(sprintf('Amazon Ec2 could not %s "%s". It returned "%s"', $action, $options['NetworkInterfaceId'], $sxml->return));
            }
            $result = true;
            $entity = $this->ec2->getEntityManagerEnabled() ? $this->ec2->networkInterface->get($options['NetworkInterfaceId']) : null;
            if ($entity !== null) {
                $this->getEntityManager()->detach($entity);
            }
        }
        return $result;
    }
Ec2Api