Search in sources :

Example 1 with InstanceGroupGcpNetworkV4Parameters

use of com.sequenceiq.cloudbreak.api.endpoint.v4.stacks.base.parameter.instancegroup.network.gcp.InstanceGroupGcpNetworkV4Parameters 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;
}
Also used : InstanceGroupGcpNetworkV1Parameters(com.sequenceiq.distrox.api.v1.distrox.model.network.gcp.InstanceGroupGcpNetworkV1Parameters) ImmutablePair(org.apache.commons.lang3.tuple.ImmutablePair) InstanceGroupGcpNetworkV4Parameters(com.sequenceiq.cloudbreak.api.endpoint.v4.stacks.base.parameter.instancegroup.network.gcp.InstanceGroupGcpNetworkV4Parameters)

Example 2 with InstanceGroupGcpNetworkV4Parameters

use of com.sequenceiq.cloudbreak.api.endpoint.v4.stacks.base.parameter.instancegroup.network.gcp.InstanceGroupGcpNetworkV4Parameters 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;
}
Also used : InstanceGroupGcpNetworkV1Parameters(com.sequenceiq.distrox.api.v1.distrox.model.network.gcp.InstanceGroupGcpNetworkV1Parameters) InstanceGroupGcpNetworkV4Parameters(com.sequenceiq.cloudbreak.api.endpoint.v4.stacks.base.parameter.instancegroup.network.gcp.InstanceGroupGcpNetworkV4Parameters)

Example 3 with InstanceGroupGcpNetworkV4Parameters

use of com.sequenceiq.cloudbreak.api.endpoint.v4.stacks.base.parameter.instancegroup.network.gcp.InstanceGroupGcpNetworkV4Parameters in project cloudbreak by hortonworks.

the class StackV4RequestToStackConverter method setUpGcp.

private void setUpGcp(InstanceGroupV4Request instanceGroup, InstanceGroupNetworkV4Request instanceGroupNetworkV4Request, String subnetId) {
    if (!StringUtils.isEmpty(subnetId)) {
        InstanceGroupGcpNetworkV4Parameters gcp = new InstanceGroupGcpNetworkV4Parameters();
        gcp.setSubnetIds(List.of(subnetId));
        instanceGroupNetworkV4Request.setGcp(gcp);
        instanceGroup.setNetwork(instanceGroupNetworkV4Request);
    }
}
Also used : InstanceGroupGcpNetworkV4Parameters(com.sequenceiq.cloudbreak.api.endpoint.v4.stacks.base.parameter.instancegroup.network.gcp.InstanceGroupGcpNetworkV4Parameters)

Aggregations

InstanceGroupGcpNetworkV4Parameters (com.sequenceiq.cloudbreak.api.endpoint.v4.stacks.base.parameter.instancegroup.network.gcp.InstanceGroupGcpNetworkV4Parameters)3 InstanceGroupGcpNetworkV1Parameters (com.sequenceiq.distrox.api.v1.distrox.model.network.gcp.InstanceGroupGcpNetworkV1Parameters)2 ImmutablePair (org.apache.commons.lang3.tuple.ImmutablePair)1