Search in sources :

Example 1 with AzureDnsZoneDeploymentParameters

use of com.sequenceiq.cloudbreak.cloud.azure.connector.resource.AzureDnsZoneDeploymentParameters in project cloudbreak by hortonworks.

the class AzureDnsZoneService method createDnsZonesAndNetworkLinks.

private void createDnsZonesAndNetworkLinks(AzureClient azureClient, String azureNetworkId, String resourceGroup, Map<String, String> tags, List<AzurePrivateDnsZoneServiceEnum> enabledPrivateEndpointServices) {
    AzureDnsZoneDeploymentParameters parameters = new AzureDnsZoneDeploymentParameters(azureNetworkId, false, enabledPrivateEndpointServices, resourceGroup, tags);
    azureResourceDeploymentHelperService.deployTemplate(azureClient, parameters);
}
Also used : AzureDnsZoneDeploymentParameters(com.sequenceiq.cloudbreak.cloud.azure.connector.resource.AzureDnsZoneDeploymentParameters)

Example 2 with AzureDnsZoneDeploymentParameters

use of com.sequenceiq.cloudbreak.cloud.azure.connector.resource.AzureDnsZoneDeploymentParameters in project cloudbreak by hortonworks.

the class AzureNetworkDnsZoneTemplateBuilderTest method whenBuildTemplateThenModelParametersAreSet.

@Test
public void whenBuildTemplateThenModelParametersAreSet() throws IOException, TemplateException {
    AzureDnsZoneDeploymentParameters parameters = new AzureDnsZoneDeploymentParameters("networkId", false, List.of(AzurePrivateDnsZoneServiceEnum.STORAGE, AzurePrivateDnsZoneServiceEnum.POSTGRES), "resourceGroup", Collections.emptyMap());
    when(freeMarkerTemplateUtils.processTemplateIntoString(any(), any())).thenCallRealMethod();
    ObjectMapper objectMapper = new ObjectMapper();
    JsonNode expectedJson = objectMapper.readTree(new File("src/test/resources/json/arm-network-dnszone.json"));
    String actual = underTest.build(parameters);
    JsonNode actualJson = objectMapper.readTree(actual);
    assertEquals(expectedJson, actualJson);
}
Also used : AzureDnsZoneDeploymentParameters(com.sequenceiq.cloudbreak.cloud.azure.connector.resource.AzureDnsZoneDeploymentParameters) JsonNode(com.fasterxml.jackson.databind.JsonNode) File(java.io.File) ObjectMapper(com.fasterxml.jackson.databind.ObjectMapper) Test(org.junit.Test)

Example 3 with AzureDnsZoneDeploymentParameters

use of com.sequenceiq.cloudbreak.cloud.azure.connector.resource.AzureDnsZoneDeploymentParameters in project cloudbreak by hortonworks.

the class AzureNetworkLinkService method createMissingNetworkLinks.

private void createMissingNetworkLinks(AzureClient azureClient, String azureNetworkId, String resourceGroup, Map<String, String> tags, List<AzurePrivateDnsZoneServiceEnum> enabledPrivateEndpointServices) {
    for (AzurePrivateDnsZoneServiceEnum service : enabledPrivateEndpointServices) {
        PagedList<VirtualNetworkLinkInner> networkLinks = azureClient.listNetworkLinksByPrivateDnsZoneName(resourceGroup, service.getDnsZoneName());
        boolean networkLinkCreated = azureClient.isNetworkLinkCreated(StringUtils.substringAfterLast(azureNetworkId, "/"), networkLinks);
        if (!networkLinkCreated) {
            LOGGER.debug("Network links for service {} not yet created, creating them now", service.getSubResource());
            AzureDnsZoneDeploymentParameters parameters = new AzureDnsZoneDeploymentParameters(azureNetworkId, true, enabledPrivateEndpointServices, resourceGroup, tags);
            azureResourceDeploymentHelperService.deployTemplate(azureClient, parameters);
        }
    }
}
Also used : AzureDnsZoneDeploymentParameters(com.sequenceiq.cloudbreak.cloud.azure.connector.resource.AzureDnsZoneDeploymentParameters) VirtualNetworkLinkInner(com.microsoft.azure.management.privatedns.v2018_09_01.implementation.VirtualNetworkLinkInner)

Aggregations

AzureDnsZoneDeploymentParameters (com.sequenceiq.cloudbreak.cloud.azure.connector.resource.AzureDnsZoneDeploymentParameters)3 JsonNode (com.fasterxml.jackson.databind.JsonNode)1 ObjectMapper (com.fasterxml.jackson.databind.ObjectMapper)1 VirtualNetworkLinkInner (com.microsoft.azure.management.privatedns.v2018_09_01.implementation.VirtualNetworkLinkInner)1 File (java.io.File)1 Test (org.junit.Test)1