String stackName = request.getStackName();
String stackVersion = request.getStackVersion();
String osType = request.getOsType();
if (osType != null) {
OperatingSystemInfo operatingSystem = this.ambariMetaInfo.getOperatingSystem(stackName, stackVersion, osType);
response = Collections.singleton(operatingSystem.convertToResponse());
} else {
Set<OperatingSystemInfo> operatingSystems = this.ambariMetaInfo.getOperatingSystems(stackName, stackVersion);
response = new HashSet<OperatingSystemResponse>();
for (OperatingSystemInfo operatingSystem : operatingSystems)
response.add(operatingSystem.convertToResponse());
}
return response;
}