Search in sources :

Example 1 with InstanceGroupParameterRequest

use of com.sequenceiq.cloudbreak.cloud.model.InstanceGroupParameterRequest in project cloudbreak by hortonworks.

the class AzurePlatformParameters method collectInstanceGroupParameters.

@Override
public Map<String, InstanceGroupParameterResponse> collectInstanceGroupParameters(Set<InstanceGroupParameterRequest> instanceGroupParameterRequests) {
    Map<String, InstanceGroupParameterResponse> result = new HashMap<>();
    for (InstanceGroupParameterRequest groupParameterRequest : instanceGroupParameterRequests) {
        InstanceGroupParameterResponse instanceGroupParameterResponse = new InstanceGroupParameterResponse();
        if (groupParameterRequest.getParameters().keySet().contains("availabilitySet")) {
            instanceGroupParameterResponse.setGroupName(groupParameterRequest.getGroupName());
            instanceGroupParameterResponse.setParameters(groupParameterRequest.getParameters());
        } else if (groupParameterRequest.getNodeCount() > 1) {
            Map<String, Object> parameters = groupParameterRequest.getParameters();
            Map<String, Object> availabilitySet = new HashMap<>();
            availabilitySet.put("name", String.format("%s-%s-as", groupParameterRequest.getGroupName(), groupParameterRequest.getStackName()));
            availabilitySet.put("faultDomainCount", DEFAULT_FAULT_DOMAIN_COUNTER);
            availabilitySet.put("updateDomainCount", DEFAULT_UPDATE_DOMAIN_COUNTER);
            parameters.put("availabilitySet", availabilitySet);
            instanceGroupParameterResponse.setGroupName(groupParameterRequest.getGroupName());
            instanceGroupParameterResponse.setParameters(parameters);
        }
        result.put(instanceGroupParameterResponse.getGroupName(), instanceGroupParameterResponse);
    }
    return result;
}
Also used : HashMap(java.util.HashMap) InstanceGroupParameterRequest(com.sequenceiq.cloudbreak.cloud.model.InstanceGroupParameterRequest) InstanceGroupParameterResponse(com.sequenceiq.cloudbreak.cloud.model.InstanceGroupParameterResponse) HashMap(java.util.HashMap) Map(java.util.Map)

Example 2 with InstanceGroupParameterRequest

use of com.sequenceiq.cloudbreak.cloud.model.InstanceGroupParameterRequest in project cloudbreak by hortonworks.

the class InstanceGroupToInstanceGroupParameterRequestConverter method convert.

@Override
public InstanceGroupParameterRequest convert(InstanceGroup source) {
    InstanceGroupParameterRequest instanceGroupParameterRequest = new InstanceGroupParameterRequest();
    instanceGroupParameterRequest.setGroupName(source.getGroupName());
    if (source.getAttributes() != null && !Strings.isNullOrEmpty(source.getAttributes().getValue())) {
        instanceGroupParameterRequest.setParameters(source.getAttributes().getMap());
    } else {
        instanceGroupParameterRequest.setParameters(new HashMap<>());
    }
    instanceGroupParameterRequest.setNodeCount(source.getNodeCount());
    return instanceGroupParameterRequest;
}
Also used : InstanceGroupParameterRequest(com.sequenceiq.cloudbreak.cloud.model.InstanceGroupParameterRequest)

Example 3 with InstanceGroupParameterRequest

use of com.sequenceiq.cloudbreak.cloud.model.InstanceGroupParameterRequest in project cloudbreak by hortonworks.

the class StackDecorator method getInstanceGroupParameterRequests.

private Set<InstanceGroupParameterRequest> getInstanceGroupParameterRequests(Stack subject) {
    Set<InstanceGroupParameterRequest> instanceGroupParameterRequests = new HashSet<>();
    for (InstanceGroup instanceGroup : subject.getInstanceGroups()) {
        InstanceGroupParameterRequest convert = conversionService.convert(instanceGroup, InstanceGroupParameterRequest.class);
        convert.setStackName(subject.getName());
        instanceGroupParameterRequests.add(convert);
    }
    return instanceGroupParameterRequests;
}
Also used : InstanceGroupParameterRequest(com.sequenceiq.cloudbreak.cloud.model.InstanceGroupParameterRequest) HashSet(java.util.HashSet) InstanceGroup(com.sequenceiq.cloudbreak.domain.InstanceGroup)

Aggregations

InstanceGroupParameterRequest (com.sequenceiq.cloudbreak.cloud.model.InstanceGroupParameterRequest)3 InstanceGroupParameterResponse (com.sequenceiq.cloudbreak.cloud.model.InstanceGroupParameterResponse)1 InstanceGroup (com.sequenceiq.cloudbreak.domain.InstanceGroup)1 HashMap (java.util.HashMap)1 HashSet (java.util.HashSet)1 Map (java.util.Map)1