use of com.sequenceiq.distrox.api.v1.distrox.model.network.gcp.InstanceGroupGcpNetworkV1Parameters in project cloudbreak by hortonworks.
the class InstanceGroupNetworkParameterConverter method convert.
public InstanceGroupGcpNetworkV4Parameters convert(InstanceGroupGcpNetworkV1Parameters gcp, EnvironmentNetworkResponse value, CloudPlatform cloudPlatform) {
InstanceGroupGcpNetworkV4Parameters response = null;
if (CloudPlatform.GCP == cloudPlatform) {
InstanceGroupGcpNetworkV1Parameters params = gcp == null ? new InstanceGroupGcpNetworkV1Parameters() : gcp;
response = convertToGcpNetworkParams(new ImmutablePair<>(params, value));
}
return response;
}
use of com.sequenceiq.distrox.api.v1.distrox.model.network.gcp.InstanceGroupGcpNetworkV1Parameters in project cloudbreak by hortonworks.
the class InstanceGroupNetworkParameterConverter method convertToGcpNetworkParams.
private InstanceGroupGcpNetworkV4Parameters convertToGcpNetworkParams(Pair<InstanceGroupGcpNetworkV1Parameters, EnvironmentNetworkResponse> source) {
InstanceGroupGcpNetworkV1Parameters key = source.getKey();
InstanceGroupGcpNetworkV4Parameters response = new InstanceGroupGcpNetworkV4Parameters();
if (key != null) {
List<String> subnetIds = key.getSubnetIds();
if (subnetIdsDefined(subnetIds)) {
response.setSubnetIds(subnetIds);
} else if (source.getValue() != null) {
response.setSubnetIds(List.of(source.getValue().getPreferedSubnetId()));
}
}
return response;
}
use of com.sequenceiq.distrox.api.v1.distrox.model.network.gcp.InstanceGroupGcpNetworkV1Parameters in project cloudbreak by hortonworks.
the class InstanceGroupV1ToInstanceGroupV4Converter method hasGcpSubnets.
private boolean hasGcpSubnets(InstanceGroupV1Request instanceGroupV1Request) {
boolean instanceGroupRequestHasSubnet = false;
InstanceGroupGcpNetworkV1Parameters gcp = instanceGroupV1Request.getNetwork().getGcp();
if (gcp != null) {
instanceGroupRequestHasSubnet = isNotEmptyOrNull(gcp.getSubnetIds());
}
return instanceGroupRequestHasSubnet;
}
use of com.sequenceiq.distrox.api.v1.distrox.model.network.gcp.InstanceGroupGcpNetworkV1Parameters in project cloudbreak by hortonworks.
the class InstanceGroupV1ToInstanceGroupV4Converter method getInstanceGroupNetworkV1RequestByProvider.
private InstanceGroupNetworkV1Request getInstanceGroupNetworkV1RequestByProvider(NetworkV4Request distroxNetwork, DetailedEnvironmentResponse environment) {
InstanceGroupNetworkV1Request request = null;
switch(environment.getCloudPlatform()) {
case "AWS":
if (distroxNetwork.getAws() != null) {
request = new InstanceGroupNetworkV1Request();
InstanceGroupAwsNetworkV1Parameters aws = new InstanceGroupAwsNetworkV1Parameters();
aws.setSubnetIds(getSubnetIds(distroxNetwork.getAws().getSubnetId()));
request.setAws(aws);
}
break;
case "AZURE":
if (distroxNetwork.getAzure() != null) {
request = new InstanceGroupNetworkV1Request();
InstanceGroupAzureNetworkV1Parameters azure = new InstanceGroupAzureNetworkV1Parameters();
azure.setSubnetIds(getSubnetIds(distroxNetwork.getAzure().getSubnetId()));
request.setAzure(azure);
}
break;
case "MOCK":
if (distroxNetwork.getMock() != null) {
request = new InstanceGroupNetworkV1Request();
InstanceGroupMockNetworkV1Parameters mock = new InstanceGroupMockNetworkV1Parameters();
mock.setSubnetIds(getSubnetIds(distroxNetwork.getMock().getSubnetId()));
request.setMock(mock);
}
break;
case "GCP":
if (distroxNetwork.getGcp() != null) {
request = new InstanceGroupNetworkV1Request();
InstanceGroupGcpNetworkV1Parameters gcp = new InstanceGroupGcpNetworkV1Parameters();
gcp.setSubnetIds(getSubnetIds(distroxNetwork.getGcp().getSubnetId()));
request.setGcp(gcp);
}
break;
default:
}
return request;
}
Aggregations