Search in sources :

Example 1 with VolumeParameterConfigV4Response

use of com.sequenceiq.cloudbreak.api.endpoint.v4.util.responses.VolumeParameterConfigV4Response in project cloudbreak by hortonworks.

the class VmTypeToVmTypeV4ResponseConverter method convert.

public VmTypeV4Response convert(VmType source) {
    VmTypeV4Response vmTypeV4Response = new VmTypeV4Response();
    List<VolumeParameterConfigV4Response> configs = new ArrayList<>();
    convertVolumeConfig(configs, source.getMetaData().getAutoAttachedConfig());
    convertVolumeConfig(configs, source.getMetaData().getEphemeralConfig());
    convertVolumeConfig(configs, source.getMetaData().getMagneticConfig());
    convertVolumeConfig(configs, source.getMetaData().getSsdConfig());
    convertVolumeConfig(configs, source.getMetaData().getSt1Config());
    VmTypeMetaJson vmTypeMetaJson = new VmTypeMetaJson();
    vmTypeMetaJson.setProperties(source.getMetaData().getProperties());
    vmTypeMetaJson.setConfigs(configs);
    vmTypeV4Response.setVmTypeMetaJson(vmTypeMetaJson);
    vmTypeV4Response.setValue(source.value());
    return vmTypeV4Response;
}
Also used : VmTypeMetaJson(com.sequenceiq.cloudbreak.api.endpoint.v4.util.responses.VmTypeMetaJson) VmTypeV4Response(com.sequenceiq.cloudbreak.api.endpoint.v4.util.responses.VmTypeV4Response) ArrayList(java.util.ArrayList) VolumeParameterConfigV4Response(com.sequenceiq.cloudbreak.api.endpoint.v4.util.responses.VolumeParameterConfigV4Response)

Example 2 with VolumeParameterConfigV4Response

use of com.sequenceiq.cloudbreak.api.endpoint.v4.util.responses.VolumeParameterConfigV4Response in project cloudbreak by hortonworks.

the class VmTypeToVmTypeV4ResponseConverter method convertVolumeConfig.

private void convertVolumeConfig(Collection<VolumeParameterConfigV4Response> configs, VolumeParameterConfig source) {
    if (source != null) {
        VolumeParameterConfigV4Response config = new VolumeParameterConfigV4Response();
        config.setMaximumNumber(source.maximumNumber());
        config.setMaximumSize(source.maximumSize());
        config.setMinimumNumber(source.minimumNumber());
        config.setMinimumSize(source.minimumSize());
        config.setVolumeParameterType(source.volumeParameterType().name());
        configs.add(config);
    }
}
Also used : VolumeParameterConfigV4Response(com.sequenceiq.cloudbreak.api.endpoint.v4.util.responses.VolumeParameterConfigV4Response)

Aggregations

VolumeParameterConfigV4Response (com.sequenceiq.cloudbreak.api.endpoint.v4.util.responses.VolumeParameterConfigV4Response)2 VmTypeMetaJson (com.sequenceiq.cloudbreak.api.endpoint.v4.util.responses.VmTypeMetaJson)1 VmTypeV4Response (com.sequenceiq.cloudbreak.api.endpoint.v4.util.responses.VmTypeV4Response)1 ArrayList (java.util.ArrayList)1