Search in sources :

Example 1 with InstanceGroupNetworkV4Request

use of com.sequenceiq.cloudbreak.api.endpoint.v4.stacks.request.instancegroup.network.InstanceGroupNetworkV4Request in project cloudbreak by hortonworks.

the class InstanceGroupNetworkToInstanceGroupNetworkV4RequestConverter method convert.

public InstanceGroupNetworkV4Request convert(InstanceGroupNetwork source) {
    InstanceGroupNetworkV4Request response = new InstanceGroupNetworkV4Request();
    Json attributes = source.getAttributes();
    if (attributes != null) {
        Map<String, Object> parameters = attributes.getMap();
        ofNullable(attributes).ifPresent(attr -> parameters.putAll(new Json(attr).getMap()));
        providerParameterCalculator.parse(parameters, response);
    }
    return response;
}
Also used : InstanceGroupNetworkV4Request(com.sequenceiq.cloudbreak.api.endpoint.v4.stacks.request.instancegroup.network.InstanceGroupNetworkV4Request) Json(com.sequenceiq.cloudbreak.common.json.Json)

Example 2 with InstanceGroupNetworkV4Request

use of com.sequenceiq.cloudbreak.api.endpoint.v4.stacks.request.instancegroup.network.InstanceGroupNetworkV4Request in project cloudbreak by hortonworks.

the class InstanceGroupNetworkV1ToInstanceGroupNetworkV4Converter method convertToInstanceGroupNetworkV4Request.

public InstanceGroupNetworkV4Request convertToInstanceGroupNetworkV4Request(Pair<InstanceGroupNetworkV1Request, DetailedEnvironmentResponse> network) {
    DetailedEnvironmentResponse value = network.getValue();
    EnvironmentNetworkResponse environmentNetworkResponse = null;
    if (value == null) {
        environmentNetworkResponse = new EnvironmentNetworkResponse();
    } else {
        environmentNetworkResponse = value.getNetwork();
    }
    InstanceGroupNetworkV1Request key = network.getKey();
    if (key == null) {
        key = new InstanceGroupNetworkV1Request();
    }
    InstanceGroupNetworkV4Request request = new InstanceGroupNetworkV4Request();
    if (value != null) {
        CloudPlatform cloudPlatform = CloudPlatform.valueOf(value.getCloudPlatform());
        request.setCloudPlatform(cloudPlatform);
        request.setAws(instanceGroupNetworkParameterConverter.convert(key.getAws(), environmentNetworkResponse, cloudPlatform));
        request.setAzure(instanceGroupNetworkParameterConverter.convert(key.getAzure(), environmentNetworkResponse, cloudPlatform));
        request.setGcp(instanceGroupNetworkParameterConverter.convert(key.getGcp(), environmentNetworkResponse, cloudPlatform));
        request.setYarn(instanceGroupNetworkParameterConverter.convert(key.getYarn(), environmentNetworkResponse, cloudPlatform));
        request.setMock(instanceGroupNetworkParameterConverter.convert(key.getMock(), environmentNetworkResponse, cloudPlatform));
    }
    return request;
}
Also used : CloudPlatform(com.sequenceiq.cloudbreak.common.mappable.CloudPlatform) InstanceGroupNetworkV4Request(com.sequenceiq.cloudbreak.api.endpoint.v4.stacks.request.instancegroup.network.InstanceGroupNetworkV4Request) DetailedEnvironmentResponse(com.sequenceiq.environment.api.v1.environment.model.response.DetailedEnvironmentResponse) EnvironmentNetworkResponse(com.sequenceiq.environment.api.v1.environment.model.response.EnvironmentNetworkResponse) InstanceGroupNetworkV1Request(com.sequenceiq.distrox.api.v1.distrox.model.network.InstanceGroupNetworkV1Request)

Example 3 with InstanceGroupNetworkV4Request

use of com.sequenceiq.cloudbreak.api.endpoint.v4.stacks.request.instancegroup.network.InstanceGroupNetworkV4Request in project cloudbreak by hortonworks.

the class AwsCloudProvider method instanceGroupNetworkV4Request.

@Override
public InstanceGroupNetworkV4Request instanceGroupNetworkV4Request(SubnetId subnetId) {
    if (awsProperties.getMultiaz()) {
        InstanceGroupNetworkV4Request result = new InstanceGroupNetworkV4Request();
        result.createAws();
        result.getAws().setSubnetIds(subnetId.collectSubnets(new LinkedList<>(awsProperties.getSubnetIds())));
        return result;
    } else {
        return null;
    }
}
Also used : InstanceGroupNetworkV4Request(com.sequenceiq.cloudbreak.api.endpoint.v4.stacks.request.instancegroup.network.InstanceGroupNetworkV4Request) LinkedList(java.util.LinkedList)

Example 4 with InstanceGroupNetworkV4Request

use of com.sequenceiq.cloudbreak.api.endpoint.v4.stacks.request.instancegroup.network.InstanceGroupNetworkV4Request in project cloudbreak by hortonworks.

the class GcpCloudProvider method instanceGroupNetworkV4Request.

@Override
public InstanceGroupNetworkV4Request instanceGroupNetworkV4Request(SubnetId subnetId) {
    if (gcpProperties.getMultiaz()) {
        InstanceGroupNetworkV4Request result = new InstanceGroupNetworkV4Request();
        result.createGcp();
        result.getGcp().setSubnetIds(subnetId.collectSubnets(gcpProperties.getNetwork().getSubnetIds()));
        return result;
    } else {
        return null;
    }
}
Also used : InstanceGroupNetworkV4Request(com.sequenceiq.cloudbreak.api.endpoint.v4.stacks.request.instancegroup.network.InstanceGroupNetworkV4Request)

Example 5 with InstanceGroupNetworkV4Request

use of com.sequenceiq.cloudbreak.api.endpoint.v4.stacks.request.instancegroup.network.InstanceGroupNetworkV4Request 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)

Aggregations

InstanceGroupNetworkV4Request (com.sequenceiq.cloudbreak.api.endpoint.v4.stacks.request.instancegroup.network.InstanceGroupNetworkV4Request)9 InstanceGroupAwsNetworkV4Parameters (com.sequenceiq.cloudbreak.api.endpoint.v4.stacks.base.parameter.instancegroup.network.aws.InstanceGroupAwsNetworkV4Parameters)3 InstanceGroupV4Request (com.sequenceiq.cloudbreak.api.endpoint.v4.stacks.request.instancegroup.InstanceGroupV4Request)2 DetailedEnvironmentResponse (com.sequenceiq.environment.api.v1.environment.model.response.DetailedEnvironmentResponse)2 InstanceGroupAzureNetworkV4Parameters (com.sequenceiq.cloudbreak.api.endpoint.v4.stacks.base.parameter.instancegroup.network.azure.InstanceGroupAzureNetworkV4Parameters)1 InstanceGroupGcpNetworkV4Parameters (com.sequenceiq.cloudbreak.api.endpoint.v4.stacks.base.parameter.instancegroup.network.gcp.InstanceGroupGcpNetworkV4Parameters)1 InstanceGroupMockNetworkV4Parameters (com.sequenceiq.cloudbreak.api.endpoint.v4.stacks.base.parameter.instancegroup.network.mock.InstanceGroupMockNetworkV4Parameters)1 InstanceGroupYarnNetworkV4Parameters (com.sequenceiq.cloudbreak.api.endpoint.v4.stacks.base.parameter.instancegroup.network.yarn.InstanceGroupYarnNetworkV4Parameters)1 NetworkV4Request (com.sequenceiq.cloudbreak.api.endpoint.v4.stacks.request.network.NetworkV4Request)1 Json (com.sequenceiq.cloudbreak.common.json.Json)1 CloudPlatform (com.sequenceiq.cloudbreak.common.mappable.CloudPlatform)1 InstanceGroupV1Request (com.sequenceiq.distrox.api.v1.distrox.model.instancegroup.InstanceGroupV1Request)1 InstanceTemplateV1Request (com.sequenceiq.distrox.api.v1.distrox.model.instancegroup.template.InstanceTemplateV1Request)1 InstanceGroupNetworkV1Request (com.sequenceiq.distrox.api.v1.distrox.model.network.InstanceGroupNetworkV1Request)1 EnvironmentNetworkResponse (com.sequenceiq.environment.api.v1.environment.model.response.EnvironmentNetworkResponse)1 LinkedList (java.util.LinkedList)1 Test (org.junit.jupiter.api.Test)1 ParameterizedTest (org.junit.jupiter.params.ParameterizedTest)1