Search in sources :

Example 1 with InstanceGroupNetworkRequest

use of com.sequenceiq.freeipa.api.v1.freeipa.stack.model.common.instance.InstanceGroupNetworkRequest in project cloudbreak by hortonworks.

the class StackToCreateFreeIpaRequestConverter method getInstanceGroupNetworkRequest.

private InstanceGroupNetworkRequest getInstanceGroupNetworkRequest(InstanceGroupNetwork instanceGroupNetwork) {
    InstanceGroupNetworkRequest request = null;
    if (instanceGroupNetwork != null) {
        request = new InstanceGroupNetworkRequest();
        List<String> subnetIds = instanceGroupNetwork.getAttributes().getValue(NetworkConstants.SUBNET_IDS);
        if (subnetIds != null) {
            LOGGER.debug("Subnet IDs found in instance group network");
            InstanceGroupAwsNetworkParameters aws = new InstanceGroupAwsNetworkParameters();
            aws.setSubnetIds(subnetIds);
            request.setAws(aws);
        }
    }
    LOGGER.debug("Created instance group network request {} from instance group network {}", request, instanceGroupNetwork);
    return request;
}
Also used : InstanceGroupNetworkRequest(com.sequenceiq.freeipa.api.v1.freeipa.stack.model.common.instance.InstanceGroupNetworkRequest) InstanceGroupAwsNetworkParameters(com.sequenceiq.freeipa.api.v1.freeipa.stack.model.common.instance.aws.InstanceGroupAwsNetworkParameters)

Example 2 with InstanceGroupNetworkRequest

use of com.sequenceiq.freeipa.api.v1.freeipa.stack.model.common.instance.InstanceGroupNetworkRequest in project cloudbreak by hortonworks.

the class InstanceGroupNetworkRequestToInstanceGroupNetworkConverter method convert.

public InstanceGroupNetwork convert(String cloudPlatform, @Nonnull InstanceGroupNetworkRequest source) {
    InstanceGroupNetwork entity = new InstanceGroupNetwork();
    entity.setCloudPlatform(cloudPlatform);
    Map<String, Object> params = new HashMap<>();
    InstanceGroupAwsNetworkParameters aws = source.getAws();
    if (aws != null && aws.getSubnetIds() != null) {
        List<String> subnetIds = aws.getSubnetIds();
        params.put(NetworkConstants.SUBNET_IDS, subnetIds);
    }
    entity.setAttributes(new Json(params));
    return entity;
}
Also used : HashMap(java.util.HashMap) InstanceGroupAwsNetworkParameters(com.sequenceiq.freeipa.api.v1.freeipa.stack.model.common.instance.aws.InstanceGroupAwsNetworkParameters) Json(com.sequenceiq.cloudbreak.common.json.Json) InstanceGroupNetwork(com.sequenceiq.freeipa.entity.InstanceGroupNetwork)

Example 3 with InstanceGroupNetworkRequest

use of com.sequenceiq.freeipa.api.v1.freeipa.stack.model.common.instance.InstanceGroupNetworkRequest in project cloudbreak by hortonworks.

the class FreeIpaAwsNetworkProvider method networkByGroup.

@Override
public InstanceGroupNetworkRequest networkByGroup(EnvironmentDto environment) {
    InstanceGroupNetworkRequest instanceGroupNetworkRequest = new InstanceGroupNetworkRequest();
    ProvidedSubnetIds providedSubnetIds = subnetIdProvider.subnets(environment.getNetwork(), environment.getExperimentalFeatures().getTunnel(), CloudPlatform.AWS, true);
    InstanceGroupAwsNetworkParameters instanceGroupAwsNetworkParameters = new InstanceGroupAwsNetworkParameters();
    instanceGroupAwsNetworkParameters.setSubnetIds(new ArrayList<>(providedSubnetIds.getSubnetIds()));
    instanceGroupNetworkRequest.setAws(instanceGroupAwsNetworkParameters);
    return instanceGroupNetworkRequest;
}
Also used : InstanceGroupNetworkRequest(com.sequenceiq.freeipa.api.v1.freeipa.stack.model.common.instance.InstanceGroupNetworkRequest) ProvidedSubnetIds(com.sequenceiq.environment.network.service.domain.ProvidedSubnetIds) InstanceGroupAwsNetworkParameters(com.sequenceiq.freeipa.api.v1.freeipa.stack.model.common.instance.aws.InstanceGroupAwsNetworkParameters)

Example 4 with InstanceGroupNetworkRequest

use of com.sequenceiq.freeipa.api.v1.freeipa.stack.model.common.instance.InstanceGroupNetworkRequest in project cloudbreak by hortonworks.

the class FreeIpaCreationHandler method createInstanceGroupRequests.

private List<InstanceGroupRequest> createInstanceGroupRequests(CreateFreeIpaRequest createFreeIpaRequest, SecurityGroupRequest securityGroupRequest, EnvironmentDto environment, boolean multiAzRequired) {
    List<InstanceGroupRequest> instanceGroupRequests = new LinkedList<>();
    FreeIpaCreationDto freeIpaCreation = environment.getFreeIpaCreation();
    InstanceGroupRequest instanceGroupRequest = new InstanceGroupRequest();
    instanceGroupRequest.setName(MASTER_GROUP_NAME);
    instanceGroupRequest.setNodeCount(freeIpaCreation.getInstanceCountByGroup());
    instanceGroupRequest.setType(InstanceGroupType.MASTER);
    instanceGroupRequest.setSecurityGroup(securityGroupRequest);
    instanceGroupRequest.setInstanceTemplateRequest(createInstanceTemplate(freeIpaCreation));
    if (multiAzRequired && multiAzValidator.suportedMultiAzForEnvironment(environment.getCloudPlatform())) {
        FreeIpaNetworkProvider freeIpaNetworkProvider = freeIpaNetworkProviderMapByCloudPlatform.get(CloudPlatform.valueOf(environment.getCloudPlatform()));
        if (freeIpaNetworkProvider != null) {
            InstanceGroupNetworkRequest instanceGroupNetworkRequest = freeIpaNetworkProvider.networkByGroup(environment);
            instanceGroupRequest.setNetwork(instanceGroupNetworkRequest);
            createFreeIpaRequest.getPlacement().setAvailabilityZone(freeIpaNetworkProvider.availabilityZone(instanceGroupNetworkRequest, environment));
        }
    }
    instanceGroupRequests.add(instanceGroupRequest);
    return instanceGroupRequests;
}
Also used : InstanceGroupNetworkRequest(com.sequenceiq.freeipa.api.v1.freeipa.stack.model.common.instance.InstanceGroupNetworkRequest) InstanceGroupRequest(com.sequenceiq.freeipa.api.v1.freeipa.stack.model.common.instance.InstanceGroupRequest) FreeIpaCreationDto(com.sequenceiq.environment.environment.dto.FreeIpaCreationDto) LinkedList(java.util.LinkedList)

Example 5 with InstanceGroupNetworkRequest

use of com.sequenceiq.freeipa.api.v1.freeipa.stack.model.common.instance.InstanceGroupNetworkRequest in project cloudbreak by hortonworks.

the class FreeIpaTestDto method mapInstanceGroupNetwork.

private InstanceGroupNetworkRequest mapInstanceGroupNetwork(InstanceGroupNetworkV4Request source) {
    if (source != null) {
        InstanceGroupNetworkRequest result = new InstanceGroupNetworkRequest();
        if (source.getAws() != null) {
            InstanceGroupAwsNetworkParameters aws = new InstanceGroupAwsNetworkParameters();
            aws.setSubnetIds(source.getAws().getSubnetIds());
            result.setAws(aws);
        }
        return result;
    } else {
        return null;
    }
}
Also used : InstanceGroupNetworkRequest(com.sequenceiq.freeipa.api.v1.freeipa.stack.model.common.instance.InstanceGroupNetworkRequest) InstanceGroupAwsNetworkParameters(com.sequenceiq.freeipa.api.v1.freeipa.stack.model.common.instance.aws.InstanceGroupAwsNetworkParameters)

Aggregations

InstanceGroupNetworkRequest (com.sequenceiq.freeipa.api.v1.freeipa.stack.model.common.instance.InstanceGroupNetworkRequest)4 InstanceGroupAwsNetworkParameters (com.sequenceiq.freeipa.api.v1.freeipa.stack.model.common.instance.aws.InstanceGroupAwsNetworkParameters)4 Json (com.sequenceiq.cloudbreak.common.json.Json)1 FreeIpaCreationDto (com.sequenceiq.environment.environment.dto.FreeIpaCreationDto)1 ProvidedSubnetIds (com.sequenceiq.environment.network.service.domain.ProvidedSubnetIds)1 InstanceGroupRequest (com.sequenceiq.freeipa.api.v1.freeipa.stack.model.common.instance.InstanceGroupRequest)1 InstanceGroupNetwork (com.sequenceiq.freeipa.entity.InstanceGroupNetwork)1 HashMap (java.util.HashMap)1 LinkedList (java.util.LinkedList)1