use of com.microsoft.azure.management.privatedns.v2018_09_01.ProvisioningState.SUCCEEDED in project cloudbreak by hortonworks.
the class AzureClient method validateNetworkLinkExistenceForDnsZones.
public ValidationResult validateNetworkLinkExistenceForDnsZones(String networkLinkId, List<AzurePrivateDnsZoneServiceEnum> services, String resourceGroupName) {
ValidationResultBuilder resultBuilder = new ValidationResultBuilder();
PagedList<PrivateZone> privateDnsZoneList = getPrivateDnsZoneList();
for (AzurePrivateDnsZoneServiceEnum service : services) {
String dnsZoneName = service.getDnsZoneName();
Optional<PrivateZone> privateZoneWithNetworkLink = privateDnsZoneList.stream().filter(privateZone -> !privateZone.resourceGroupName().equalsIgnoreCase(resourceGroupName)).filter(privateZone -> privateZone.name().equalsIgnoreCase(dnsZoneName)).filter(privateZone -> privateZone.provisioningState().equals(SUCCEEDED)).filter(privateZone -> Objects.nonNull(getNetworkLinkByPrivateDnsZone(privateZone.resourceGroupName(), dnsZoneName, networkLinkId))).findFirst();
if (privateZoneWithNetworkLink.isPresent()) {
PrivateZone privateZone = privateZoneWithNetworkLink.get();
String validationMessage = String.format("Network link for the network %s already exists for Private DNS Zone %s in resource group %s. " + "Please ensure that there is no existing network link and try again!", networkLinkId, dnsZoneName, privateZone.resourceGroupName());
LOGGER.warn(validationMessage);
resultBuilder.error(validationMessage);
}
}
return resultBuilder.build();
}
use of com.microsoft.azure.management.privatedns.v2018_09_01.ProvisioningState.SUCCEEDED in project cloudbreak by hortonworks.
the class AzureClient method checkIfDnsZonesDeployed.
public boolean checkIfDnsZonesDeployed(String resourceGroupName, List<AzurePrivateDnsZoneServiceEnum> services) {
LOGGER.debug("Checking DNS Zones for services {}", services.stream().map(AzurePrivateDnsZoneServiceEnum::getDnsZoneName).collect(Collectors.toList()));
PagedList<PrivateZone> dnsZones = listPrivateDnsZonesByResourceGroup(resourceGroupName);
for (AzurePrivateDnsZoneServiceEnum service : services) {
String dnsZoneName = service.getDnsZoneName();
boolean dnsZoneFound = dnsZones.stream().filter(dnsZone -> dnsZone.name().equals(dnsZoneName)).anyMatch(dnsZone -> dnsZone.provisioningState().equals(SUCCEEDED));
if (!dnsZoneFound) {
LOGGER.info("DNS Zone {} is not provisioned successfully yet!", dnsZoneName);
return false;
}
}
return true;
}
use of com.microsoft.azure.management.privatedns.v2018_09_01.ProvisioningState.SUCCEEDED in project cloudbreak by hortonworks.
the class AzurePrivateDnsZoneValidatorService method privateDnsZonesNotConnectedToNetwork.
public ValidationResult privateDnsZonesNotConnectedToNetwork(AzureClient azureClient, String networkId, String resourceGroupName, String dnsZoneName, ValidationResult.ValidationResultBuilder resultBuilder, PagedList<PrivateZone> privateDnsZoneList) {
Optional<PrivateZone> privateZoneWithNetworkLink = privateDnsZoneList.stream().filter(privateZone -> !privateZone.resourceGroupName().equalsIgnoreCase(resourceGroupName)).filter(privateZone -> privateZone.name().equalsIgnoreCase(dnsZoneName)).filter(privateZone -> privateZone.provisioningState().equals(SUCCEEDED)).filter(privateZone -> Objects.nonNull(azureClient.getNetworkLinkByPrivateDnsZone(privateZone.resourceGroupName(), dnsZoneName, networkId))).findFirst();
if (privateZoneWithNetworkLink.isPresent()) {
PrivateZone privateZone = privateZoneWithNetworkLink.get();
String validationMessage = String.format("Network link for the network %s already exists for Private DNS Zone %s in resource group %s. " + "Please ensure that there is no existing network link and try again!", networkId, dnsZoneName, privateZone.resourceGroupName());
addValidationError(validationMessage, resultBuilder);
}
return resultBuilder.build();
}
Aggregations