Search in sources :

Example 1 with EnvironmentNetworkGcpParams

use of com.sequenceiq.environment.api.v1.environment.model.EnvironmentNetworkGcpParams in project cloudbreak by hortonworks.

the class GcpEnvironmentNetworkConverter method getAttributesForLegacyNetwork.

@Override
Map<String, Object> getAttributesForLegacyNetwork(EnvironmentNetworkResponse source) {
    EnvironmentNetworkGcpParams gcp = source.getGcp();
    Map<String, Object> result = new HashMap<>();
    if (!Strings.isNullOrEmpty(gcp.getNetworkId())) {
        result.put("networkId", gcp.getNetworkId());
    }
    if (gcp.getNoFirewallRules() != null) {
        result.put("noFirewallRules", gcp.getNoFirewallRules());
    }
    if (gcp.getNoPublicIp() != null) {
        result.put("noPublicIp", gcp.getNoPublicIp());
    }
    if (!Strings.isNullOrEmpty(gcp.getSharedProjectId())) {
        result.put("sharedProjectId", gcp.getSharedProjectId());
    }
    return result;
}
Also used : EnvironmentNetworkGcpParams(com.sequenceiq.environment.api.v1.environment.model.EnvironmentNetworkGcpParams) HashMap(java.util.HashMap)

Example 2 with EnvironmentNetworkGcpParams

use of com.sequenceiq.environment.api.v1.environment.model.EnvironmentNetworkGcpParams in project cloudbreak by hortonworks.

the class GcpEnvironmentNetworkConverterTest method getNoFirewallRulesAttributeForLegacyNetwork.

@Test
void getNoFirewallRulesAttributeForLegacyNetwork() {
    EnvironmentNetworkResponse environmentNetworkResponse = mock(EnvironmentNetworkResponse.class);
    EnvironmentNetworkGcpParams environmentNetworkGcpParams = mock(EnvironmentNetworkGcpParams.class);
    when(environmentNetworkResponse.getGcp()).thenReturn(environmentNetworkGcpParams);
    when(environmentNetworkGcpParams.getNoFirewallRules()).thenReturn(true);
    Map<String, Object> result = converter.getAttributesForLegacyNetwork(environmentNetworkResponse);
    assertEquals(true, result.get("noFirewallRules"));
}
Also used : EnvironmentNetworkGcpParams(com.sequenceiq.environment.api.v1.environment.model.EnvironmentNetworkGcpParams) EnvironmentNetworkResponse(com.sequenceiq.environment.api.v1.environment.model.response.EnvironmentNetworkResponse) Test(org.junit.jupiter.api.Test)

Example 3 with EnvironmentNetworkGcpParams

use of com.sequenceiq.environment.api.v1.environment.model.EnvironmentNetworkGcpParams in project cloudbreak by hortonworks.

the class GcpCloudProvider method environmentNetworkParameters.

private EnvironmentNetworkGcpParams environmentNetworkParameters() {
    EnvironmentNetworkGcpParams params = new EnvironmentNetworkGcpParams();
    params.setSharedProjectId(gcpProperties.getNetwork().getSharedProjectId());
    params.setNetworkId(gcpProperties.getNetwork().getNetworkId());
    params.setNoFirewallRules(gcpProperties.getNetwork().getNoFirewallRules());
    params.setNoPublicIp(gcpProperties.getNetwork().getNoPublicIp());
    return params;
}
Also used : EnvironmentNetworkGcpParams(com.sequenceiq.environment.api.v1.environment.model.EnvironmentNetworkGcpParams)

Example 4 with EnvironmentNetworkGcpParams

use of com.sequenceiq.environment.api.v1.environment.model.EnvironmentNetworkGcpParams in project cloudbreak by hortonworks.

the class NetworkRequestToDtoConverterTest method createGcpParams.

private EnvironmentNetworkGcpParams createGcpParams() {
    EnvironmentNetworkGcpParams gcpParams = new EnvironmentNetworkGcpParams();
    gcpParams.setNetworkId(NETWORK_ID);
    return gcpParams;
}
Also used : EnvironmentNetworkGcpParams(com.sequenceiq.environment.api.v1.environment.model.EnvironmentNetworkGcpParams)

Example 5 with EnvironmentNetworkGcpParams

use of com.sequenceiq.environment.api.v1.environment.model.EnvironmentNetworkGcpParams in project cloudbreak by hortonworks.

the class GcpEnvironmentNetworkConverterTest method getNetworkIdForAttributeLegacyNetwork.

@Test
void getNetworkIdForAttributeLegacyNetwork() {
    EnvironmentNetworkResponse environmentNetworkResponse = mock(EnvironmentNetworkResponse.class);
    EnvironmentNetworkGcpParams environmentNetworkGcpParams = mock(EnvironmentNetworkGcpParams.class);
    when(environmentNetworkResponse.getGcp()).thenReturn(environmentNetworkGcpParams);
    when(environmentNetworkGcpParams.getNetworkId()).thenReturn(GCP_NETWORK_ID);
    Map<String, Object> result = converter.getAttributesForLegacyNetwork(environmentNetworkResponse);
    assertEquals(GCP_NETWORK_ID, result.get("networkId"));
}
Also used : EnvironmentNetworkGcpParams(com.sequenceiq.environment.api.v1.environment.model.EnvironmentNetworkGcpParams) EnvironmentNetworkResponse(com.sequenceiq.environment.api.v1.environment.model.response.EnvironmentNetworkResponse) Test(org.junit.jupiter.api.Test)

Aggregations

EnvironmentNetworkGcpParams (com.sequenceiq.environment.api.v1.environment.model.EnvironmentNetworkGcpParams)10 Test (org.junit.jupiter.api.Test)6 EnvironmentNetworkResponse (com.sequenceiq.environment.api.v1.environment.model.response.EnvironmentNetworkResponse)5 GcpNetworkV4Parameters (com.sequenceiq.cloudbreak.api.endpoint.v4.stacks.base.parameter.network.GcpNetworkV4Parameters)1 NetworkV4Request (com.sequenceiq.cloudbreak.api.endpoint.v4.stacks.request.network.NetworkV4Request)1 DetailedEnvironmentResponse (com.sequenceiq.environment.api.v1.environment.model.response.DetailedEnvironmentResponse)1 HashMap (java.util.HashMap)1