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;
}
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"));
}
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;
}
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;
}
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"));
}
Aggregations