Search in sources :

Example 1 with GcpNetworkV4Parameters

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());
}
Also used : GcpNetworkV4Parameters(com.sequenceiq.cloudbreak.api.endpoint.v4.stacks.base.parameter.network.GcpNetworkV4Parameters) Test(org.junit.jupiter.api.Test)

Example 2 with GcpNetworkV4Parameters

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;
}
Also used : GcpNetworkV4Parameters(com.sequenceiq.cloudbreak.api.endpoint.v4.stacks.base.parameter.network.GcpNetworkV4Parameters) EnvironmentNetworkResponse(com.sequenceiq.environment.api.v1.environment.model.response.EnvironmentNetworkResponse) GcpNetworkV1Parameters(com.sequenceiq.distrox.api.v1.distrox.model.network.gcp.GcpNetworkV1Parameters)

Example 3 with GcpNetworkV4Parameters

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());
}
Also used : GcpNetworkV4Parameters(com.sequenceiq.cloudbreak.api.endpoint.v4.stacks.base.parameter.network.GcpNetworkV4Parameters) EnvironmentNetworkGcpParams(com.sequenceiq.environment.api.v1.environment.model.EnvironmentNetworkGcpParams) DetailedEnvironmentResponse(com.sequenceiq.environment.api.v1.environment.model.response.DetailedEnvironmentResponse) NetworkV4Request(com.sequenceiq.cloudbreak.api.endpoint.v4.stacks.request.network.NetworkV4Request) Test(org.junit.jupiter.api.Test)

Example 4 with GcpNetworkV4Parameters

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);
}
Also used : GcpNetworkV4Parameters(com.sequenceiq.cloudbreak.api.endpoint.v4.stacks.base.parameter.network.GcpNetworkV4Parameters)

Aggregations

GcpNetworkV4Parameters (com.sequenceiq.cloudbreak.api.endpoint.v4.stacks.base.parameter.network.GcpNetworkV4Parameters)4 Test (org.junit.jupiter.api.Test)2 NetworkV4Request (com.sequenceiq.cloudbreak.api.endpoint.v4.stacks.request.network.NetworkV4Request)1 GcpNetworkV1Parameters (com.sequenceiq.distrox.api.v1.distrox.model.network.gcp.GcpNetworkV1Parameters)1 EnvironmentNetworkGcpParams (com.sequenceiq.environment.api.v1.environment.model.EnvironmentNetworkGcpParams)1 DetailedEnvironmentResponse (com.sequenceiq.environment.api.v1.environment.model.response.DetailedEnvironmentResponse)1 EnvironmentNetworkResponse (com.sequenceiq.environment.api.v1.environment.model.response.EnvironmentNetworkResponse)1