Search in sources :

Example 1 with HardwareInfoResponse

use of com.sequenceiq.cloudbreak.api.model.HardwareInfoResponse in project cloudbreak by hortonworks.

the class StackResponseHardwareInfoProvider method providerEntriesToStackResponse.

@Override
public StackResponse providerEntriesToStackResponse(Stack stack, StackResponse stackResponse) {
    Set<HardwareInfoResponse> hardwareInfoResponses = new HashSet<>();
    for (InstanceGroup instanceGroup : stack.getInstanceGroups()) {
        for (InstanceMetaData instanceMetaData : instanceGroup.getAllInstanceMetaData()) {
            HostMetadata hostMetadata = null;
            if (stack.getCluster() != null && instanceMetaData.getDiscoveryFQDN() != null) {
                hostMetadata = hostMetadataRepository.findHostInClusterByName(stack.getCluster().getId(), instanceMetaData.getDiscoveryFQDN());
            }
            HardwareInfoResponse hardwareInfoResponse = new HardwareInfoResponse();
            hardwareInfoResponse.setInstanceMetaData(conversionService.convert(instanceMetaData, InstanceMetaDataJson.class));
            hardwareInfoResponse.setHostMetadata(conversionService.convert(hostMetadata, HostMetadataResponse.class));
            hardwareInfoResponses.add(hardwareInfoResponse);
        }
    }
    stackResponse.setHardwareInfos(hardwareInfoResponses);
    return stackResponse;
}
Also used : InstanceMetaData(com.sequenceiq.cloudbreak.domain.InstanceMetaData) HostMetadataResponse(com.sequenceiq.cloudbreak.api.model.HostMetadataResponse) InstanceMetaDataJson(com.sequenceiq.cloudbreak.api.model.InstanceMetaDataJson) HardwareInfoResponse(com.sequenceiq.cloudbreak.api.model.HardwareInfoResponse) HashSet(java.util.HashSet) InstanceGroup(com.sequenceiq.cloudbreak.domain.InstanceGroup) HostMetadata(com.sequenceiq.cloudbreak.domain.HostMetadata)

Aggregations

HardwareInfoResponse (com.sequenceiq.cloudbreak.api.model.HardwareInfoResponse)1 HostMetadataResponse (com.sequenceiq.cloudbreak.api.model.HostMetadataResponse)1 InstanceMetaDataJson (com.sequenceiq.cloudbreak.api.model.InstanceMetaDataJson)1 HostMetadata (com.sequenceiq.cloudbreak.domain.HostMetadata)1 InstanceGroup (com.sequenceiq.cloudbreak.domain.InstanceGroup)1 InstanceMetaData (com.sequenceiq.cloudbreak.domain.InstanceMetaData)1 HashSet (java.util.HashSet)1