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;
}
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;
}
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;
}
Aggregations