use of com.sequenceiq.environment.network.dao.domain.BaseNetwork in project cloudbreak by hortonworks.
the class EnvironmentResourceServiceTest method createAndSetNetwork.
@Test
void createAndSetNetwork() {
Environment environment = new Environment();
NetworkDto networkDto = null;
BaseNetwork network = new AwsNetwork();
when(networkService.saveNetwork(eq(environment), eq(networkDto), eq(ACCOUNT_ID), any(), any())).thenReturn(network);
assertEquals(network, environmentResourceServiceUnderTest.createAndSetNetwork(environment, networkDto, ACCOUNT_ID, Map.of(), Map.of()));
}
use of com.sequenceiq.environment.network.dao.domain.BaseNetwork in project cloudbreak by hortonworks.
the class AzureEnvironmentNetworkConverter method convertToNetwork.
@Override
public Network convertToNetwork(BaseNetwork baseNetwork) {
AzureNetwork azureNetwork = (AzureNetwork) baseNetwork;
Map<String, Object> param = new HashMap<>();
param.put(RG_NAME, azureNetwork.getResourceGroupName());
param.put(NETWORK_ID, azureNetwork.getNetworkId());
param.put(DATABASE_PRIVATE_DS_ZONE_ID, azureNetwork.getDatabasePrivateDnsZoneId());
return new Network(null, param);
}
use of com.sequenceiq.environment.network.dao.domain.BaseNetwork in project cloudbreak by hortonworks.
the class EnvironmentBaseNetworkConverter method convert.
@Override
public BaseNetwork convert(Environment environment, NetworkDto creationDto, Map<String, CloudSubnet> subnetMetas, Map<String, CloudSubnet> gatewayEndpointSubnetMetas) {
BaseNetwork result = createProviderSpecificNetwork(creationDto);
result.setName(creationDto.getNetworkName() != null ? creationDto.getNetworkName() : environment.getName());
result.setNetworkCidr(creationDto.getNetworkCidr());
result.setNetworkCidrs(StringUtils.join(creationDto.getNetworkCidrs(), ","));
result.setEnvironments(convertEnvToView(environment));
result.setPrivateSubnetCreation(creationDto.getPrivateSubnetCreation());
result.setServiceEndpointCreation(creationDto.getServiceEndpointCreation());
result.setOutboundInternetTraffic(creationDto.getOutboundInternetTraffic());
setRegistrationType(result, creationDto);
result.setSubnetMetas(subnetMetas);
result.setPublicEndpointAccessGateway(creationDto.getPublicEndpointAccessGateway());
result.setLoadBalancerCreation(creationDto.getLoadBalancerCreation());
result.setEndpointGatewaySubnetMetas(gatewayEndpointSubnetMetas);
return result;
}
use of com.sequenceiq.environment.network.dao.domain.BaseNetwork in project cloudbreak by hortonworks.
the class NetworkService method saveNetwork.
public BaseNetwork saveNetwork(Environment environment, NetworkDto networkDto, String accountId, Map<String, CloudSubnet> subnetMetas, Map<String, CloudSubnet> endpointGatewaySubnetMetas) {
BaseNetwork baseNetwork = null;
if (networkDto != null) {
EnvironmentNetworkConverter environmentNetworkConverter = environmentNetworkConverterMap.get(getCloudPlatform(environment));
if (environmentNetworkConverter != null) {
baseNetwork = environmentNetworkConverter.convert(environment, networkDto, subnetMetas, endpointGatewaySubnetMetas);
baseNetwork.setId(getIfNotNull(networkDto, NetworkDto::getId));
baseNetwork.setResourceCrn(createCRN(accountId));
baseNetwork.setAccountId(accountId);
baseNetwork = save(baseNetwork);
}
}
return baseNetwork;
}
Aggregations