public function replaceRoute($routeTableId, $destinationCidrBlock, $gatewayId = null, $instanceId = null, $networkInterfaceId = null, $vpcPeeringConnectionId = null)
{
$result = false;
$options = ['DestinationCidrBlock' => (string) $destinationCidrBlock, 'RouteTableId' => (string) $routeTableId];
$f = 0;
if ($gatewayId !== null) {
$options['GatewayId'] = (string) $gatewayId;
$f++;
}
if ($instanceId !== null) {
$options['InstanceId'] = (string) $instanceId;
$f++;
}
if ($networkInterfaceId !== null) {
$options['NetworkInterfaceId'] = (string) $networkInterfaceId;
$f++;
}
if ($vpcPeeringConnectionId !== null) {
$options['VpcPeeringConnectionId'] = (string) $vpcPeeringConnectionId;
$f++;
}
if ($f > 1) {
throw new \InvalidArgumentException(sprintf('You must provide only one of the following: a GatewayId, InstanceId, VpcPeeringConnectionId or 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 RouteTableId:"%s". It returned "%s"', $action, $options['RouteTableId'], $sxml->return));
}
$result = true;
}
return $result;
}