class AzureNetworkConnector implements NetworkConnector {

    @Override
    public NetworkCidr getNetworkCidr(Network network, CloudCredential credential) {
        AzureClient azureClient = azureClientService.getClient(credential);
        String resourceGroupName = azureUtils.getCustomResourceGroupName(network);
        String networkId = azureUtils.getCustomNetworkId(network);
        com.microsoft.azure.management.network.Network networkByResourceGroup = azureClient.getNetworkByResourceGroup(resourceGroupName, networkId);
        if (networkByResourceGroup == null || networkByResourceGroup.addressSpaces().isEmpty()) {
            throw new BadRequestException(String.format("Network could not be fetch from Azure with resource group name: %s and network id: %s",
                    resourceGroupName, networkId));
        }
        List<String> networkCidrs = networkByResourceGroup.addressSpaces();
        if (networkCidrs.size() > 1) {
            LOGGER.info("More than one network cidrs for resource group name: {} and network id: {}. We will use the first one: {}",
                    resourceGroupName, networkId, networkCidrs.get(0));
        }
        return new NetworkCidr(networkCidrs.get(0), networkCidrs);
    }

}