@ Override public void stopForwardToServer ( @ Nonnull final String ruleId , @ Nonnull final String serverId ) throws InternalException , CloudException { if ( serverId == null ) throw new InternalException ( "Parameter serverId cannot be null" ) ; final AzureRuleIdParts azureRuleIdParts = AzureRuleIdParts . fromString ( ruleId ) ; PersistentVMRoleModel persistentVMRoleModel = getVMRole ( serverId ) ; if ( persistentVMRoleModel == null ) throw new InternalException ( "Cannot find Azure virtual machine with id: " + serverId ) ; CollectionUtils . filter ( persistentVMRoleModel . getConfigurationSets ( ) . get ( 0 ) . getInputEndpoints ( ) , new Predicate ( ) { @ Override public boolean evaluate ( Object object ) { PersistentVMRoleModel . InputEndpoint inputEndpoint = ( PersistentVMRoleModel . InputEndpoint ) object ; return ! azureRuleIdParts . equals ( new AzureRuleIdParts ( serverId , inputEndpoint . getProtocol ( ) , inputEndpoint . getLocalPort ( ) ) ) ; } } ) ; updateVMRole ( serverId , persistentVMRoleModel ) ; }
Removes the specified forwarding rule from the address with which it is associated .