class AzureProbeMonitorConfiguration implements ConfigurationValidation {

    public void validate(AzureClient azureClient) throws ConfigurationException {
        Preconditions.checkNotNull(azureClient, "azureClient cannot be null");

        for (NvaConfiguration config : this.nvaConfigurations) {
            config.validate(azureClient);
        }

        if (this.nvaConfigurations.stream()
            .map(c -> ((InetSocketAddress)c.getProbeSocketAddress()).getHostName())
            .distinct()
            .count() != this.nvaConfigurations.size()) {
            throw new ConfigurationException("Duplicate probe IP Address found");
        }

        List<String> invalidPublicIpAddresses = this.publicIpAddresses.stream()
            .map(r -> r.getId())
            .filter(id -> !azureClient.checkExistenceById(id))
            .collect(Collectors.toList());
        if (invalidPublicIpAddresses.size() > 0) {
            throw new ConfigurationException("Invalid public ip address(es): " +
                invalidPublicIpAddresses.stream().collect(Collectors.joining(", ")));
        }

        List<String> invalidRouteTables = this.routeTables.stream()
            .filter(id -> !azureClient.checkExistenceById(id))
            .collect(Collectors.toList());

        if (invalidRouteTables.size() > 0) {
            throw new ConfigurationException("Invalid route table(s): " +
            invalidRouteTables.stream().collect(Collectors.joining(", ")));
        }
    }

    @JsonCreator public  AzureProbeMonitorConfiguration(@JsonProperty("azure")AzureConfiguration azureConfiguration,
                                          @JsonProperty("nvas")List<NvaConfiguration> nvaConfigurations,
                                          @JsonProperty("routeTables")List<String> routeTables,
                                          @JsonProperty("publicIpAddresses")List<NamedResourceId> publicIpAddresses,
                                          @JsonProperty("numberOfFailuresThreshold")Integer numberOfFailuresThreshold,
                                          @JsonProperty("probeConnectTimeout")Integer probeConnectTimeout,
                                          @JsonProperty("probePollingInterval")Integer probePollingInterval);

}