use of com.sequenceiq.cloudbreak.api.endpoint.v4.stacks.base.parameter.network.GcpNetworkV4Parameters in project cloudbreak by hortonworks.
the class NetworkV4BaseTest method testGcpNetworkPublicIpIsNotEmpty.
@Test
void testGcpNetworkPublicIpIsNotEmpty() {
GcpNetworkV4Parameters networkParameters = new GcpNetworkV4Parameters();
networkParameters.setNoPublicIp(true);
underTest.setGcp(networkParameters);
assertTrue(underTest.isNoPublicIp().get());
}
use of com.sequenceiq.cloudbreak.api.endpoint.v4.stacks.base.parameter.network.GcpNetworkV4Parameters in project cloudbreak by hortonworks.
the class NetworkV1ToNetworkV4Converter method convertToGcpStackRequest.
private GcpNetworkV4Parameters convertToGcpStackRequest(Pair<GcpNetworkV1Parameters, EnvironmentNetworkResponse> source) {
EnvironmentNetworkResponse value = source.getValue();
GcpNetworkV1Parameters key = source.getKey();
GcpNetworkV4Parameters response = new GcpNetworkV4Parameters();
if (key != null) {
response.setNetworkId(value.getGcp().getNetworkId());
response.setNoFirewallRules(value.getGcp().getNoFirewallRules());
response.setNoPublicIp(value.getGcp().getNoPublicIp());
response.setSharedProjectId(value.getGcp().getSharedProjectId());
String subnetId = key.getSubnetId();
if (!Strings.isNullOrEmpty(subnetId)) {
response.setSubnetId(subnetId);
} else {
response.setSubnetId(getFirstSubnetIdFromEnvironment(value));
}
}
return response;
}
use of com.sequenceiq.cloudbreak.api.endpoint.v4.stacks.base.parameter.network.GcpNetworkV4Parameters in project cloudbreak by hortonworks.
the class NetworkV1ToNetworkV4ConverterTest method testConvertToNetworkV4RequestWhenGcpNetworkKeyIsNullThenBasicSettingShouldHappen.
@Test
void testConvertToNetworkV4RequestWhenGcpNetworkKeyIsNullThenBasicSettingShouldHappen() {
DetailedEnvironmentResponse input = createGcpEnvironment();
NetworkV4Request result = underTest.convertToNetworkV4Request(new ImmutablePair<>(null, input));
Assertions.assertNotNull(result);
GcpNetworkV4Parameters gcpNetworkResult = result.getGcp();
EnvironmentNetworkGcpParams inputGcpNetwork = input.getNetwork().getGcp();
Assertions.assertNotNull(gcpNetworkResult);
assertEquals(inputGcpNetwork.getNetworkId(), gcpNetworkResult.getNetworkId());
assertEquals(inputGcpNetwork.getNoPublicIp(), gcpNetworkResult.getNoPublicIp());
assertEquals(inputGcpNetwork.getSharedProjectId(), gcpNetworkResult.getSharedProjectId());
assertEquals(inputGcpNetwork.getNoFirewallRules(), gcpNetworkResult.getNoFirewallRules());
}
use of com.sequenceiq.cloudbreak.api.endpoint.v4.stacks.base.parameter.network.GcpNetworkV4Parameters in project cloudbreak by hortonworks.
the class GcpCloudProvider method network.
@Override
public NetworkV4TestDto network(NetworkV4TestDto network) {
GcpNetworkV4Parameters gcpNetworkV4Parameters = new GcpNetworkV4Parameters();
gcpNetworkV4Parameters.setNoFirewallRules(gcpProperties.getNetwork().getNoFirewallRules());
gcpNetworkV4Parameters.setNoPublicIp(gcpProperties.getNetwork().getNoPublicIp());
String subnetCIDR = null;
if (StringUtils.isNotBlank(gcpProperties.getNetwork().getSharedProjectId())) {
gcpNetworkV4Parameters.setSharedProjectId(gcpProperties.getNetwork().getSharedProjectId());
gcpNetworkV4Parameters.setNetworkId(gcpProperties.getNetwork().getNetworkId());
gcpNetworkV4Parameters.setSubnetId(gcpProperties.getNetwork().getSubnetId());
} else {
subnetCIDR = getSubnetCIDR();
}
return network.withGcp(gcpNetworkV4Parameters).withSubnetCIDR(subnetCIDR);
}
Aggregations