Search in sources :

Example 1 with InstanceGroupMockNetworkV4Parameters

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

the class StackV4RequestToStackConverter method setUpMock.

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

Example 2 with InstanceGroupMockNetworkV4Parameters

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

the class InstanceGroupNetworkParameterConverter method convertToMockNetworkParams.

private InstanceGroupMockNetworkV4Parameters convertToMockNetworkParams(Pair<InstanceGroupMockNetworkV1Parameters, EnvironmentNetworkResponse> source) {
    EnvironmentNetworkResponse value = source.getValue();
    InstanceGroupMockNetworkV1Parameters key = source.getKey();
    InstanceGroupMockNetworkV4Parameters params = new InstanceGroupMockNetworkV4Parameters();
    if (key != null) {
        List<String> subnetIds = key.getSubnetIds();
        if (value != null) {
            if (subnetIdsDefined(subnetIds)) {
                params.setSubnetIds(subnetIds);
            } else {
                params.setSubnetIds(List.of(value.getPreferedSubnetId()));
            }
        }
    }
    return params;
}
Also used : InstanceGroupMockNetworkV4Parameters(com.sequenceiq.cloudbreak.api.endpoint.v4.stacks.base.parameter.instancegroup.network.mock.InstanceGroupMockNetworkV4Parameters) EnvironmentNetworkResponse(com.sequenceiq.environment.api.v1.environment.model.response.EnvironmentNetworkResponse) InstanceGroupMockNetworkV1Parameters(com.sequenceiq.distrox.api.v1.distrox.model.network.mock.InstanceGroupMockNetworkV1Parameters)

Example 3 with InstanceGroupMockNetworkV4Parameters

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

the class InstanceGroupNetworkParameterConverter method convert.

public InstanceGroupMockNetworkV4Parameters convert(InstanceGroupMockNetworkV1Parameters mock, EnvironmentNetworkResponse value, CloudPlatform cloudPlatform) {
    InstanceGroupMockNetworkV4Parameters response = null;
    if (CloudPlatform.MOCK == cloudPlatform) {
        InstanceGroupMockNetworkV1Parameters params = mock == null ? new InstanceGroupMockNetworkV1Parameters() : mock;
        response = convertToMockNetworkParams(new ImmutablePair<>(params, value));
    }
    return response;
}
Also used : InstanceGroupMockNetworkV4Parameters(com.sequenceiq.cloudbreak.api.endpoint.v4.stacks.base.parameter.instancegroup.network.mock.InstanceGroupMockNetworkV4Parameters) ImmutablePair(org.apache.commons.lang3.tuple.ImmutablePair) InstanceGroupMockNetworkV1Parameters(com.sequenceiq.distrox.api.v1.distrox.model.network.mock.InstanceGroupMockNetworkV1Parameters)

Aggregations

InstanceGroupMockNetworkV4Parameters (com.sequenceiq.cloudbreak.api.endpoint.v4.stacks.base.parameter.instancegroup.network.mock.InstanceGroupMockNetworkV4Parameters)3 InstanceGroupMockNetworkV1Parameters (com.sequenceiq.distrox.api.v1.distrox.model.network.mock.InstanceGroupMockNetworkV1Parameters)2 EnvironmentNetworkResponse (com.sequenceiq.environment.api.v1.environment.model.response.EnvironmentNetworkResponse)1 ImmutablePair (org.apache.commons.lang3.tuple.ImmutablePair)1