use of com.sequenceiq.common.api.telemetry.model.Features in project cloudbreak by hortonworks.
the class TelemetryConverter method createFeaturesRequestFromSource.
private FeaturesRequest createFeaturesRequestFromSource(Telemetry telemetry) {
FeaturesRequest featuresRequest = null;
Features features = telemetry.getFeatures();
if (features != null) {
featuresRequest = new FeaturesRequest();
featuresRequest.setWorkloadAnalytics(features.getWorkloadAnalytics());
featuresRequest.setClusterLogsCollection(features.getClusterLogsCollection());
featuresRequest.setMonitoring(features.getMonitoring());
setCloudStorageLoggingOnFeaturesModel(features, featuresRequest);
}
return featuresRequest;
}
use of com.sequenceiq.common.api.telemetry.model.Features in project cloudbreak by hortonworks.
the class TelemetryConverter method convert.
public Telemetry convert(TelemetryRequest request, StackType type) {
Telemetry telemetry = new Telemetry();
Features features = new Features();
LOGGER.debug("Converting telemetry request to telemetry object");
if (request != null) {
Logging logging = createLoggingFromRequest(request);
Monitoring monitoring = createMonitoringFromRequest(request);
WorkloadAnalytics workloadAnalytics = createWorkloadAnalyticsFromRequest(request);
telemetry.setLogging(logging);
telemetry.setMonitoring(monitoring);
telemetry.setWorkloadAnalytics(workloadAnalytics);
setWorkloadAnalyticsFeature(telemetry, features);
setClusterLogsCollection(request, features);
setMonitoring(request, features);
setUseSharedAltusCredential(features);
setCloudStorageLogging(request, features);
telemetry.setFluentAttributes(request.getFluentAttributes());
}
if (monitoringEnabled) {
LOGGER.debug("Cluster level monitoring feature is enabled");
features.addMonitoring(true);
}
setMeteringFeature(type, features);
if (StringUtils.isNotEmpty(databusEndpoint)) {
LOGGER.debug("Setting databus endpoint: {}", databusEndpoint);
telemetry.setDatabusEndpoint(databusEndpoint);
}
telemetry.setFeatures(features);
return telemetry;
}
use of com.sequenceiq.common.api.telemetry.model.Features in project cloudbreak by hortonworks.
the class TelemetryConverter method createFeaturesFromRequest.
private Features createFeaturesFromRequest(FeaturesRequest featuresRequest) {
Features features = new Features();
if (clusterLogsCollection) {
if (featuresRequest != null && featuresRequest.getClusterLogsCollection() != null) {
features.setClusterLogsCollection(featuresRequest.getClusterLogsCollection());
LOGGER.debug("Fill report deployment log settings from feature request");
} else {
LOGGER.debug("Auto-fill report deployment logs settings with defaults. (disabled)");
features.addClusterLogsCollection(false);
}
}
if (useSharedAltusCredential) {
features.addUseSharedAltusCredential(true);
}
if (featuresRequest != null && featuresRequest.getCloudStorageLogging() != null) {
features.setCloudStorageLogging(featuresRequest.getCloudStorageLogging());
} else {
features.addCloudStorageLogging(true);
}
if (featuresRequest != null && featuresRequest.getMonitoring() != null) {
features.setMonitoring(featuresRequest.getMonitoring());
} else {
features.addMonitoring(true);
}
return features;
}
use of com.sequenceiq.common.api.telemetry.model.Features in project cloudbreak by hortonworks.
the class EnvironmentApiConverterTest method testAzureSingleRgEnabledAndEmptyAzureRequest.
@Test
void testAzureSingleRgEnabledAndEmptyAzureRequest() {
EnvironmentRequest request = createEnvironmentRequest(AZURE);
request.setAzure(null);
FreeIpaCreationDto freeIpaCreationDto = mock(FreeIpaCreationDto.class);
EnvironmentTelemetry environmentTelemetry = mock(EnvironmentTelemetry.class);
AccountTelemetry accountTelemetry = mock(AccountTelemetry.class);
Features features = mock(Features.class);
NetworkDto networkDto = mock(NetworkDto.class);
when(credentialService.getCloudPlatformByCredential(anyString(), anyString(), any())).thenReturn(AZURE.name());
when(freeIpaConverter.convert(request.getFreeIpa(), "id", CloudConstants.AWS)).thenReturn(freeIpaCreationDto);
when(accountTelemetry.getFeatures()).thenReturn(features);
when(accountTelemetryService.getOrDefault(any())).thenReturn(accountTelemetry);
when(telemetryApiConverter.convert(eq(request.getTelemetry()), any(), anyString())).thenReturn(environmentTelemetry);
when(tunnelConverter.convert(request.getTunnel())).thenReturn(request.getTunnel());
when(networkRequestToDtoConverter.convert(request.getNetwork())).thenReturn(networkDto);
EnvironmentCreationDto actual = testInitCreationDto(request);
assertEquals(ResourceGroupUsagePattern.USE_MULTIPLE, actual.getParameters().getAzureParametersDto().getAzureResourceGroupDto().getResourceGroupUsagePattern());
}
use of com.sequenceiq.common.api.telemetry.model.Features in project cloudbreak by hortonworks.
the class TelemetryApiConverterTest method testConvertWithDefaultMonitoringFeatureWithoutCdpSaas.
@Test
public void testConvertWithDefaultMonitoringFeatureWithoutCdpSaas() {
// GIVEN
TelemetryRequest telemetryRequest = new TelemetryRequest();
given(entitlementService.isCdpSaasEnabled(anyString())).willReturn(false);
// WHEN
EnvironmentTelemetry result = underTest.convert(telemetryRequest, new Features(), ACCOUNT_ID);
// THEN
assertNull(result.getFeatures());
assertNull(result.getMonitoring().getRemoteWriteUrl());
}
Aggregations