// Set the new network configuration
// Refresh virtual machine, to get the new configuration links
refresh();
VMNetworkConfigurationsDto configs = context.getApi().getCloudApi().listNetworkConfigurations(target);
Iterables.removeIf(target.getLinks(), LinkPredicates.rel(ParentLinkName.NETWORK_GATEWAY));
for (VMNetworkConfigurationDto config : configs.getCollection()) {
if (config.getGateway().equalsIgnoreCase(gatewayNetwork.getGateway())) {
target.addLink(new RESTLink(ParentLinkName.NETWORK_GATEWAY, config.getEditLink().getHref()));
break;
}
}